Skip to main content

run_create

Function run_create 

Source
pub fn run_create() -> Result<()>
Expand description

Handle a Claude Code WorktreeCreate hook event.

Claude Code’s payload carries worktree_name (and cwd/base_commit) but NOT a worktree path — the hook itself is responsible for creating the worktree and reporting where it landed. We read the payload from stdin, delegate to gw new --emit json --term skip (self-reexec), parse the resulting JSON, and print only the created worktree_path as a plain-text line to stdout — exactly what Claude Code’s hook contract expects.

Human-readable progress output from the inner gw new call flows through to stderr unchanged, so the user can see what’s happening.