Open
Conversation
The `claude-wt` CLI was failing with an "unknown option '--add-dir'"
error on Linux systems. The root cause was that the fallback path for
the Claude executable was hardcoded to a macOS-specific path
(`/Users/jlowin/.claude/local/claude`).
When `shutil.which("claude")` couldn't find the executable (because it's
an alias, not in PATH), the code would fall back to this macOS path,
which doesn't exist on Linux systems. This caused the subprocess to fail
when trying to execute a non-existent file.
Fixed by replacing the hardcoded path with a dynamic path using
`Path.home()` to construct the user-agnostic path
`~/.claude/local/claude`. This ensures the CLI works correctly across
different operating systems and users.
Handle both branch name formats from `git worktree list --porcelain`: - Older format: "branch claude-wt-foo" - Newer format: "branch refs/heads/claude-wt-foo" This ensures all claude-wt worktrees are properly detected regardless of the git version being used. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
The
claude-wtCLI was failing with an "unknown option '--add-dir'" error on Linux systems. The root cause was that the fallback path for the Claude executable was hardcoded to a macOS-specific path (/Users/jlowin/.claude/local/claude).When
shutil.which("claude")couldn't find the executable (because it's an alias, not in PATH), the code would fall back to this macOS/User/*path (which doesn't exist on Linux systems) forjlowin(who is one of a kind). This caused the subprocess to fail when trying to execute a non-existent file.Fixed by replacing the hardcoded path with a dynamic path using
Path.home()to construct the user-agnostic path~/.claude/local/claude. This ensures the CLI works correctly across different operating systems and users (expect windows, probably, which I did not test and I'm not even sure is supported by claude).