Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 12, 2025

Adds a convenient way to start a Claude coding agent session directly from branch context menus, addressing issue #10248.

What this PR adds

When right-clicking on a branch header, users now see a "Start Coding Agent session" option that:

  • Only appears when Claude is enabled and properly configured
  • Navigates directly to the codegen page with the selected branch pre-loaded
  • Provides seamless integration between workspace branches and the coding agent

Implementation

The feature works through URL parameter passing and automatic branch selection:

  1. Context menu integration - Added menu item to BranchHeaderContextMenu.svelte that navigates to /[projectId]/codegen?stackId=[stackId]
  2. Auto-selection logic - Enhanced the codegen route to detect the stackId URL parameter and automatically select the corresponding branch in the Claude interface
  3. Clean UX - URL parameters are removed after processing to maintain clean URLs

User flow

Branch header → Right-click → "Start Coding Agent session" → Codegen page opens with branch selected

The menu item intelligently appears only when:

  • AI features are enabled in project settings
  • Claude configuration is valid
  • The branch has a valid stack ID
  • Not in read-only mode

Files changed

  • apps/desktop/src/components/BranchHeaderContextMenu.svelte - Added context menu item and navigation logic
  • apps/desktop/src/routes/[projectId]/codegen/+page.svelte - Added URL parameter handling for automatic branch selection
  • packages/ui/src/lib/utils/testIds.ts - Added test ID for the new menu item

The implementation follows existing patterns in the codebase, particularly mirroring how the workspace route handles stackId URL parameters for consistent behavior across the application.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI assigned Copilot and Byron Sep 12, 2025
Copy link

vercel bot commented Sep 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
gitbutler-web Ignored Ignored Preview Sep 12, 2025 0:45am

@Copilot Copilot AI changed the title [WIP] @gitbutlerapp/gitbutler/issues/10248 Add a "Start Coding Agent session" entry into the context menu for branches and implement it. Add "Start Coding Agent session" context menu item to branch headers Sep 12, 2025
@Copilot Copilot AI requested a review from Byron September 12, 2025 12:20
Copilot finished work on behalf of Byron September 12, 2025 12:20
@Byron Byron force-pushed the copilot/fix-3763b7d0-4210-4648-972a-3ad24de9aeb0 branch from d78af09 to 825afea Compare September 12, 2025 12:45
@Byron
Copy link
Collaborator

Byron commented Sep 12, 2025

@PavelLaptev Here is a PR for the addition to the context menu. But it doesn't look like it works, at least the menu entry doesn't seem to show up, probably because it's conditions aren't really met in practice.
So I don't know if it's worth salvaging this.
Also CC @krlvi .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants