Skip to content

feat: non-interactive shell wrapper and AI agent skill#59

Merged
guodong-sq merged 4 commits intomainfrom
guodong/non-interactive-wrapper-and-skill
Mar 29, 2026
Merged

feat: non-interactive shell wrapper and AI agent skill#59
guodong-sq merged 4 commits intomainfrom
guodong/non-interactive-wrapper-and-skill

Conversation

@guodong-sq
Copy link
Copy Markdown
Collaborator

@guodong-sq guodong-sq commented Mar 29, 2026

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 keeping wt() — resulting in a broken wt command that fails with _wt_run: command not found.

Additionally, there's no structured way to teach AI agents to use wt instead of raw git worktree commands or built-in worktree isolation.

What

  • Rename all single-underscore helpers in wt.sh to double-underscore (_wt_run__wt_run, etc.) so they survive shell snapshot filtering
  • Add skill/ 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

…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>
guodong-sq and others added 3 commits March 28, 2026 22:27
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>
@guodong-sq guodong-sq merged commit 2ecb51c into main Mar 29, 2026
5 checks passed
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