feat: non-interactive shell wrapper and AI agent skill#59
Merged
guodong-sq merged 4 commits intomainfrom Mar 29, 2026
Merged
Conversation
…skill Add bin/wt, a standalone wrapper script that enables wt to work in non-interactive shells (Claude Code, scripts, cron) where .zshrc is not sourced. The wrapper dispatches to sibling wt-* scripts directly, handles wt cd gracefully with an error message, and does not collide with the sourced wt() function in interactive shells. Update install.sh to add ~/.wt/bin to PATH via .zshenv and .bash_profile so the wrapper is discoverable in all shell contexts. Add skill/ directory with an agent-agnostic AI skill that teaches coding assistants (Claude Code, Codex, Cursor, etc.) to use wt for worktree management. Includes command reference, conflict detection, installation guide, subagent patterns, troubleshooting, and examples. Reference files are lazily loaded to minimize context usage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add explicit ~/.wt/bin/wt fallback path to SKILL.md Step 0 and troubleshooting.md. Warn against sourcing wt.sh in agent environments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename all single-underscore helper functions in wt.sh (_wt_run, _wt_source_lib, etc.) to double-underscore (__wt_run, __wt_source_lib, etc.). This ensures they survive shell snapshot mechanisms used by AI coding agents (Claude Code, etc.) which filter out single-underscore functions to avoid capturing zsh completion functions. Add skill/ directory with an agent-agnostic AI skill that teaches coding assistants (Claude Code, Codex, Cursor, etc.) to use wt for worktree management. Includes command reference, conflict detection, installation guide, subagent patterns, troubleshooting, and examples. Reference files are lazily loaded to minimize context usage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Why
AI coding agents (Claude Code, Codex, etc.) that capture shell state via snapshots filter out single-underscore functions (to avoid dumping hundreds of zsh completion functions). This drops
_wt_run,_wt_source_lib, etc. from the snapshot while keepingwt()— resulting in a brokenwtcommand that fails with_wt_run: command not found.Additionally, there's no structured way to teach AI agents to use
wtinstead of rawgit worktreecommands or built-in worktree isolation.What
wt.shto double-underscore (_wt_run→__wt_run, etc.) so they survive shell snapshot filteringskill/directory with an agent-agnostic AI skill (SKILL.md + 9 lazily-loaded reference files) covering commands, rules, subagent patterns, installation, conflict detection, troubleshooting, and examples🤖 Generated with Claude Code