opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(web): show recent git branches in new session dropdown

Open R44VC0RP opened this issue 4 days ago • 2 comments

Summary

  • Add recent git branches to the "New session" dropdown for quick branch switching
  • Users can now see and checkout recent branches without leaving the web UI

Changes

  • Backend: Added GET /vcs/branches endpoint to list recent branches sorted by commit date
  • Backend: Added POST /vcs/checkout endpoint to switch branches
  • Frontend: Updated session-new-view dropdown to show up to 6 recent branches
  • Frontend: Handle branch selection with checkout API and toast notifications
  • SDK: Regenerated with new types (BranchInfo, CheckoutInput, CheckoutResult)

Testing

  1. Start API server: cd packages/opencode && bun dev -- serve --port 5556
  2. Start Vite: cd packages/app && VITE_API_URL=http://127.0.0.1:5556 bun dev
  3. Open http://localhost:3001, click "New session"
  4. Click branch dropdown - should show recent branches
  5. Select a different branch - should checkout and show toast

Notes

  • The pre-existing TypeScript "type instantiation excessively deep" error in server.ts was triggered by adding more routes. This is a known issue (see TODO at line 77) and exists independently of these changes.

R44VC0RP avatar Jan 11 '26 20:01 R44VC0RP