claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Enhanced /ide command for git worktree development workflows

Open bjcoombs opened this issue 8 months ago • 0 comments

Enhanced /ide Command for Git Worktree Development

Problem

The /ide command currently requires the IDE to be running in the exact same directory as the Claude Code session. This creates friction for developers using git worktrees, which is a common workflow pattern where:

  • Base repo is at: ~/dev/github.com/<user>/<repo>/<repo>-main/
  • Feature branches are at: ~/dev/github.com/<user>/<repo>/worktree/<branch-name>/
  • Developers often run Claude Code from the base repo level for broader context
  • IDEs are typically opened at the worktree level for focused development

Current Behavior

When running /ide from ~/dev/github.com/<user>/<repo>/, Claude Code cannot connect to an IDE running in ~/dev/github.com/<user>/<repo>/<repo>-main/ or worktree subdirectories.

Proposed Solution

Enhance the /ide command to:

  1. Auto-detect related workspaces: When run from a parent directory, automatically detect and offer IDEs running in subdirectories that are part of the same git repository family

  2. Workspace selection: Present a menu of available related IDEs when multiple options exist:

    Found multiple related IDEs:
    1. IntelliJ IDEA: ./<repo>-main (main branch)
    2. IntelliJ IDEA: ./worktree/<feature-branch> (current work)
    
    Select IDE [1-2]:
    
  3. Contextual awareness: Prioritize IDEs in active worktrees or recently modified directories

Benefits

  • Supports git worktree workflows without requiring directory navigation
  • Maintains ability to run Claude Code at higher levels for cross-service analysis
  • Reduces context switching between terminal sessions
  • Aligns with established development patterns in large codebases

Alternative Approaches

  • Add a --search-subdirs flag to /ide command
  • Allow manual specification: /ide --path ./worktree/<branch-name>
  • Auto-connect to the most recently active IDE in subdirectories

This enhancement would significantly improve the developer experience for teams using git worktrees and multi-service repositories.

bjcoombs avatar Jun 02 '25 12:06 bjcoombs