feat: add branch selector and VCS checkout APIs#14266
Open
itskritix wants to merge 2 commits intoanomalyco:devfrom
Open
feat: add branch selector and VCS checkout APIs#14266itskritix wants to merge 2 commits intoanomalyco:devfrom
itskritix wants to merge 2 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Contributor
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.
Contributor
Author
|
Addressed Copilot review notes in
Also re-ran local checks ( |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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