Skip to content

feedback(claude-hooks): chezmoi worktree source guard fires on chezmoi run remotely over ssh #629

Open

Description

@laurigates

What happened

exact_dot_claude/hooks/executable_chezmoi-worktree-source-guard.sh added its "this chezmoi command runs from a Claude Code worktree … add --source" heads-up to Bash calls that ran chezmoi on another machine over SSH, for example:

ssh <host> 'chezmoi apply --force --exclude=scripts; echo done; chezmoi status'

The local worktree and the pinned source dir are irrelevant there: the remote chezmoi uses its own config. The warning fired on every such call while the session cwd was a dotfiles worktree.

Cause

The command-position anchor (^|[;&|]|…) also matches separators inside a quoted argument, so ; chezmoi status within the single-quoted ssh command counts as a local command start. The existing bash|sh|zsh|eval wrapper handling does not cover ssh.

Suggested fix

Skip (exit 0) when the chezmoi match sits inside a quoted argument to ssh/scp/mosh, or more simply when the command starts with ssh . Add a test case for ssh host '…; chezmoi status' next to the existing false-positive cases.

Found during a remote laptop setup session on 2026-11-15.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaudesession-feedbackFeedback from session analysis

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions