feat: add branch selector and VCS checkout APIs#14266
feat: add branch selector and VCS checkout APIs#14266itskritix wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
There was a problem hiding this comment.
Pull request overview
This PR adds branch switching capabilities to the OpenCode IDE by implementing VCS API endpoints and a UI branch selector component. The feature is integrated into the session header and includes worktree-aware checkout logic to prevent conflicts when branches are used in multiple worktrees.
Changes:
- Added
vcs.branchesandvcs.checkoutAPI endpoints with typed error definitions (VcsBranchListFailedError, VcsBranchNotFoundError, VcsBranchCheckoutFailedError) - Generated TypeScript SDK bindings for the new VCS endpoints
- Implemented a branch selector popover in the session header that displays local and remote branches, marks branches in use by other worktrees, and handles branch checkout
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/opencode/src/project/vcs.ts | Added branches() and checkout() functions with worktree detection and git command execution |
| packages/opencode/src/server/server.ts | Registered /vcs/branches (GET) and /vcs/checkout (POST) routes with error mapping |
| packages/sdk/js/src/v2/gen/types.gen.ts | Generated TypeScript types for VcsBranch, VcsCheckoutInput, and response/error types |
| packages/sdk/js/src/v2/gen/sdk.gen.ts | Generated SDK methods vcs.branches() and vcs.checkout() |
| packages/app/src/i18n/en.ts | Added internationalization strings for branch groups, in-use badge, and error messages |
| packages/app/src/components/session/session-header.tsx | Implemented branch selector popover with search, grouping, and worktree conflict prevention |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Addressed Copilot review notes in
Also re-ran local checks ( |
|
Will this be able to see private GH repos? #13343 |
Issue for this PR
Closes #14265
Type of change
What does this PR do?
/vcs/branches,/vcs/checkout) with typed errors and SDK generation.git worktree list --porcelainparsing CRLF-safe to avoid platform parsing issues.How did you verify your code works?
bun run typecheckinpackages/opencodebun run typecheckinpackages/appOPENCODE_SERVER_PASSWORD= bun run testinpackages/opencodebun run test:unitinpackages/appbun run buildinpackages/opencodebun run buildinpackages/appScreenshots / recordings
Checklist