Skip to content

fix: rename underscore-prefixed shell functions to avoid Claude shell snapshot filtering - #5

Open
bloatfan wants to merge 1 commit into
maxktz:mainfrom
bloatfan:main
Open

fix: rename underscore-prefixed shell functions to avoid Claude shell snapshot filtering#5
bloatfan wants to merge 1 commit into
maxktz:mainfrom
bloatfan:main

Conversation

@bloatfan

@bloatfan bloatfan commented Jul 6, 2026

Copy link
Copy Markdown

Problem

Shell integration functions prefixed with _ (zsh/bash) or __ (fish) are filtered out by Claude shell's environment snapshot mechanism. Claude shell treats underscore-prefixed functions as private/zsh-completion internals and excludes them from snapshots, which means hitch's internal helpers are invisible to the AI agent during a session.

Solution

Rename all internal shell helpers to remove the leading underscores:

Shell Old name New name
zsh _hitch_prompt_segment hitch_prompt_segment
zsh _hitch_precmd hitch_precmd
zsh _hitch_run hitch_dispatch
bash _hitch_prompt_segment hitch_prompt_segment
bash _hitch_prompt_command hitch_prompt_command
bash _hitch_run hitch_dispatch
fish __hitch_original_fish_prompt hitch_original_fish_prompt
fish __hitch_run hitch_dispatch

Local variables (_hitch_* / __hitch_*) are also renamed to hitch_* for consistency.

What stays unchanged

  • User-facing commands: hitch, hitch-dev, unhitch
  • p10k integration: prompt_hitch()

Migration

No manual migration needed. The upsert_marked_block mechanism replaces the entire hitch block in the user's RC file on the next hitch setup run, so existing users get the new names automatically.

🤖 Generated with Claude Code

…tering

Shell integration functions prefixed with `_` (zsh/bash) or `__` (fish)
are filtered out by Claude shell's environment snapshot mechanism, which
treats underscore-prefixed functions as private/zsh-completion internals.

Rename all internal helpers to remove the leading underscores:

  zsh:  _hitch_prompt_segment -> hitch_prompt_segment
        _hitch_precmd        -> hitch_precmd
        _hitch_run           -> hitch_dispatch
  bash: _hitch_prompt_segment -> hitch_prompt_segment
        _hitch_prompt_command -> hitch_prompt_command
        _hitch_run            -> hitch_dispatch
  fish: __hitch_original_fish_prompt -> hitch_original_fish_prompt
        __hitch_run                  -> hitch_dispatch

Local variables (_hitch_* / __hitch_*) are updated for consistency.

The upsert_marked_block mechanism ensures existing users get the new
names on the next `hitch setup` run — no manual migration needed.

User-facing commands (hitch, hitch-dev, unhitch) and the p10k
prompt_hitch() function are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant