-
Notifications
You must be signed in to change notification settings - Fork 0
feat!: Add Claude integration and refactor CLI interface #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove Mode enum and --mode flag from CLI - Add standalone --ide flag to open worktree in specified IDE - Add --claude flag to automatically start Claude session - Make --ide and --claude mutually exclusive - Add copy_claude_settings() to copy .claude/settings.local.json to new worktrees - Add launch_claude() function to start Claude in terminal - Extend Linux support for terminal launching (gnome-terminal, konsole, xfce4-terminal, xterm) - Update all tests to reflect new CLI interface - Remove handle_mode() function BREAKING CHANGE: The --mode flag has been removed. Use --ide for IDE launching instead of --mode ide. The --mode terminal option has been replaced with separate functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Claude integration to git-worktree-cli and removes the --mode flag in favor of cleaner standalone flags, representing a breaking change to the CLI interface.
- Added Claude integration with automatic settings copying and session launching
- Removed
--modeenum and replaced with--ideand--claudestandalone flags - Extended Linux terminal support and improved cross-platform functionality
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| wt/worktree.py | Added copy_claude_settings() function and integrated it into worktree creation |
| wt/launchers.py | Added Claude support, extended Linux terminal support, and refactored mode handling |
| wt/cli.py | Removed Mode enum and --mode flag, added --claude flag with mutual exclusivity |
| tests/test_worktree.py | Updated tests to mock new Claude settings functionality |
| tests/test_launchers.py | Replaced mode tests with Claude-specific tests and added Linux terminal tests |
| tests/test_cli.py | Updated CLI tests for new flag structure and mutual exclusivity |
| specs/ez-leaf.md | Removed project specification file |
| LICENSE | Added MIT License |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Import shlex module for proper shell escaping - Use shlex.quote() for worktree_path in all terminal commands - Use shlex.quote() for command parameter in terminal launchers - Properly escape AppleScript strings to prevent injection - Fixes security issues identified by GitHub Copilot review This prevents command injection if worktree paths contain special characters like spaces, quotes, semicolons, or other shell metacharacters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Update comment to reflect generic command parameter (not just 'claude') - Standardize xfce4-terminal argument passing to match other terminals - Pass arguments as separate list items instead of manual string construction Addresses GitHub Copilot review feedback for better maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
iTerm2's 'write text' types command literally into the terminal shell. Quoting the command with shlex.quote() causes it to be typed as 'claude' (with quotes) which the shell won't execute properly. Since the command value is controlled by our code (always 'claude'), not user input, it's safe to pass it unquoted. The path is still properly quoted for security. Fixes GitHub Copilot review comment about double-quoting on line 93.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Replace brittle str(call) checks with explicit call.args[0] access. This makes assertions less dependent on internal call object representation and more directly verify the actual arguments passed to mocked functions. Applied consistently across all error message verification tests. Addresses GitHub Copilot review feedback on test quality.
Summary
This PR adds Claude integration to git-worktree-cli and modernizes the CLI interface by removing the
--modeflag in favor of standalone flags.Breaking Changes
--modeflag has been removed--ide <editor>instead of--mode ide --ide <editor>--mode terminaloption has been replaced with new functionalityNew Features
--claudeflag to automatically start Claude sessions in new worktrees.claude/settings.local.jsonfrom repo root to new worktrees--ideand--claudeflagsChanges
CLI Interface
Modeenum and--modeflag--ideflag for opening worktrees in IDEs--claudeflag for starting Claude sessions--ideand--claudemutually exclusiveFunctionality
copy_claude_settings(): Copies Claude settings to new worktrees if they existlaunch_claude(): Opens terminal and starts Claude session_launch_iterm2()to support running commands after cd_launch_linux_terminal()with support for multiple terminal emulatorsTests
--claudeflag and mutual exclusivityOther
Migration Guide
Before:
After:
Test Plan