-
Notifications
You must be signed in to change notification settings - Fork 1
feat(finish): Replace 'gh' dependency with direct GitHub API for PR creation #66
Copy link
Copy link
Open
Labels
Description
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
ghCLI being installed. - It centralizes authentication; the command will rely on the
GITHUB_TOKENenvironment variable, which is the same token used by othercv projectcommands. - It makes the command more robust and suitable for automated environments.
Acceptance Criteria
- The
cv finishcommand no longer executes theghbinary. - When run,
cv finishsuccessfully creates a pull request against the repository's default branch using the GitHub API. - The command gracefully handles cases where the
GITHUB_TOKENis 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.
Reactions are currently unavailable