Files
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1 line
3.1 KiB
JSON

{"content": "---\nallowed-tools: Bash(git:*), Bash(mkdir:*), Bash(ls:*), Bash(cat:*), Bash(basename:*), Bash(pwd:*), Bash(sed:*)\nargument-hint: task 1 | task 2 | task 3\ndescription: Create parallel worktrees for multi-task development with Ghostty panels\n---\n\n# Worktree Parallel Init\n\nCreate multiple git worktrees for parallel development: $ARGUMENTS\n\n## Instructions\n\nYou are setting up parallel worktrees so the user can work on multiple tasks simultaneously in separate Ghostty terminal panels, each running its own Claude instance.\n\n### Step 1: Validate Environment\n\n1. Check this is a git repository: `git rev-parse --is-inside-work-tree`\n2. Get the repo name: `basename $(git rev-parse --show-toplevel)`\n3. Get the main branch name (check for `main` or `master`): `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'` — if that fails, default to `main`\n4. Ensure working tree is clean: `git status --porcelain`. If dirty, warn the user and ask if they want to continue.\n5. Fetch latest: `git fetch origin`\n\n### Step 2: Parse Tasks\n\nParse tasks from `$ARGUMENTS`. Tasks are separated by `|` (pipe character).\n\nIf `$ARGUMENTS` is empty, use AskUserQuestion to ask the user to describe their tasks (they can provide multiple separated by `|`).\n\nFor each task description:\n- Trim whitespace\n- Generate a kebab-case branch name: `claude/<kebab-case-task>` (max 50 chars, alphanumeric and hyphens only)\n- Generate a worktree directory path: `../worktrees/<repo-name>/claude-<kebab-case-task>`\n\n### Step 3: Create Worktrees\n\nFor each task:\n\n1. Create the parent directory if needed: `mkdir -p ../worktrees/<repo-name>`\n2. Create the worktree:\n ```bash\n git worktree add -b claude/<name> ../worktrees/<repo-name>/claude-<name> origin/<main-branch>\n ```\n3. Write a `.worktree-task.md` file inside the new worktree with this content:\n ```markdown\n # Worktree Task\n\n **Branch:** claude/<name>\n **Task:** <original task description>\n **Created:** <ISO date>\n **Source repo:** <path to main repo>\n ```\n\n### Step 4: Check for Dependencies\n\nIf a `package.json` exists in the repo root, note that each worktree may need `npm install` (or the appropriate package manager).\n\nCheck for:\n- `package-lock.json` → npm install\n- `yarn.lock` → yarn install\n- `pnpm-lock.yaml` → pnpm install\n- `bun.lockb` → bun install\n\n### Step 5: Output Summary\n\nDisplay a clear summary table:\n\n```\n| # | Task | Branch | Path |\n|---|------|--------|------|\n| 1 | ... | claude/... | ../worktrees/repo/claude-... |\n```\n\nThen display ready-to-copy commands for Ghostty panels. For each worktree:\n\n```\n# Panel <N>: <task description>\ncd <absolute-path-to-worktree> && claude\n```\n\nIf dependencies were detected, add a note:\n```\n# Note: Run <package-manager> install in each worktree before starting\n```\n\nFinally, remind the user:\n- Open a new Ghostty panel with `Cmd+D` (split right) or `Cmd+Shift+D` (split down)\n- When done with a task, use `/worktree-deliver` to commit, push, and create a PR\n- After merging all PRs, use `/worktree-cleanup --all` from the main repo\n"}