Skip to main content

git_worktree_manager/operations/setup_claude/
command_gw.rs

1//! Body of the `/gw` slash command. Acts as a thin trigger that hands off
2//! to the bundled `delegate` skill, which contains the actual task-routing
3//! logic.
4
5pub fn content() -> &'static str {
6    r#"---
7description: "Delegate a coding task to an isolated git worktree. Usage: /gw <natural-language task>."
8allowed-tools: Bash
9argument-hint: <task description>
10---
11
12The user invoked `/gw $ARGUMENTS`.
13
14Use the `delegate` skill bundled with this plugin to handle the request.
15The skill contains the full workflow for parsing the task, generating a
16branch name, and spawning a fresh AI session in a new worktree via
17`gw new ... --prompt-file ...`.
18
19Brief recap (the delegate skill has the full version):
20
211. Parse the task description from `$ARGUMENTS`.
222. Generate a short, hyphenated branch name (`fix-`, `feat-`, etc.).
233. Write the full task into a temp prompt file and call:
24   ```bash
25   trap 'rm -f /tmp/gw-prompt-$$.txt' EXIT
26   cat > /tmp/gw-prompt-$$.txt <<'PROMPT'
27   <full task body>
28   PROMPT
29   gw new <branch-name> --prompt-file /tmp/gw-prompt-$$.txt
30   ```
314. If the user did not specify a terminal launcher, omit `-T` (uses the
32   default from `gw config get launch.method`).
33
34If the task is ambiguous, ask one clarifying question before spawning —
35the delegated session is fire-and-forget.
36"#
37}