Skip to content

bb pr diff <number> with --name-only #4

@zoldyzdk

Description

@zoldyzdk

Parent PRD

#1

What to build

New bb pr diff [<number>] command that retrieves and displays the raw diff of a pull request from the Bitbucket API. In this slice, only the explicit PR number argument is supported (branch inference is added in a follow-up slice).

End-to-end: the user runs bb pr diff 42 and sees the unified diff output in their terminal. With --name-only, only the changed file paths are listed.

This requires:

  • A new GetPullRequestDiff method in the API layer that calls GET /repositories/{workspace}/{repo}/pullrequests/{id}/diff and returns the raw diff string
  • A new Cobra command (cmd/pr_diff.go) with --name-only flag
  • Parsing the unified diff output to extract file names when --name-only is used

Acceptance criteria

  • bb pr diff 42 outputs the raw unified diff from the Bitbucket API
  • bb pr diff 42 --name-only outputs only the changed file paths (one per line)
  • Clear error message if the PR number doesn't exist
  • Workspace/repo resolution follows existing conventions (flags → config → git remote)
  • The command accepts an optional positional argument (PR number); running without it shows a usage hint (branch inference comes in the next slice)

Blocked by

None - can start immediately

User stories addressed

  • User story 5
  • User story 7
  • User story 25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions