Problem
The cv finish command currently relies on the user having the GitHub CLI (gh) installed and separately authenticated. As demonstrated in a recent user session, if gh is not authenticated (gh auth login), the command fails with a non-obvious error (exit status 4).
This creates a brittle external dependency and a poor user experience. The cv tool should manage its own authentication for core features.
Proposed Solution
Refactor the cv finish command to remove the call to the gh pr create executable. Instead, it should use the internal GitHub client (internal/github) to create the pull request directly via the GitHub API.
This approach has several advantages:
- It removes the dependency on the
gh CLI being installed.
- It centralizes authentication; the command will rely on the
GITHUB_TOKEN environment variable, which is the same token used by other cv project commands.
- It makes the command more robust and suitable for automated environments.
Acceptance Criteria
- The
cv finish command no longer executes the gh binary.
- When run,
cv finish successfully creates a pull request against the repository's default branch using the GitHub API.
- The command gracefully handles cases where the
GITHUB_TOKEN is missing or invalid with a clear, user-friendly error message.
- The command should still intelligently pre-fill the pull request title and body from the branch's commits.
Problem
The
cv finishcommand currently relies on the user having the GitHub CLI (gh) installed and separately authenticated. As demonstrated in a recent user session, ifghis not authenticated (gh auth login), the command fails with a non-obvious error (exit status 4).This creates a brittle external dependency and a poor user experience. The
cvtool should manage its own authentication for core features.Proposed Solution
Refactor the
cv finishcommand to remove the call to thegh pr createexecutable. Instead, it should use the internal GitHub client (internal/github) to create the pull request directly via the GitHub API.This approach has several advantages:
ghCLI being installed.GITHUB_TOKENenvironment variable, which is the same token used by othercv projectcommands.Acceptance Criteria
cv finishcommand no longer executes theghbinary.cv finishsuccessfully creates a pull request against the repository's default branch using the GitHub API.GITHUB_TOKENis missing or invalid with a clear, user-friendly error message.