项目文件夹

文件
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 行
4.1 KiB
JSON

{"content": "---\nallowed-tools: Bash(git:*), Bash(gh:*), Bash(rm:*), Bash(cat:*), Bash(pwd:*), Bash(ls:*)\ndescription: Commit, push, and create PR from the current worktree\n---\n\n# Worktree Deliver\n\nCommit all work, push, and create a pull request from the current worktree.\n\n## Instructions\n\nYou are inside a worktree. Package up the work and deliver it as a PR.\n\n### Step 1: Validate Environment\n\n1. Verify this is a worktree (not the main working tree) using `git worktree list`\n2. Get current branch: `git branch --show-current`\n3. Verify branch follows `claude/*`, `claude-daniel/*`, or `review/*` pattern. If not, warn the user and ask if they want to continue.\n4. Read `.worktree-task.md` if it exists to get the original task description\n\n### Step 2: Review Changes\n\n1. Run `git diff --stat` and `git diff --cached --stat` to show all changes\n2. Run `git status --short` to show the full picture\n3. If there are no changes at all (clean working tree, no commits ahead of main), inform the user there's nothing to deliver and stop.\n\n### Step 3: Clean Up Task File\n\nBefore staging anything, remove the worktree task file so it doesn't end up in the commit:\n\n```bash\nrm -f .worktree-task.md\n```\n\n### Step 4: Confirm Files to Commit\n\nUse AskUserQuestion to show the user what will be committed and ask for confirmation. List all modified, added, and untracked files.\n\nOptions:\n- \"Stage all changes\" — stage everything\n- \"Let me choose\" — user will specify which files to include\n\nIf the user wants to choose, ask them which files to stage.\n\n### Step 5: Stage and Commit\n\n1. Stage the confirmed files with `git add`\n2. Generate a commit message following conventional commits format\n\n**Commit Message Strategy:**\n\n 1. **Analyze the diff** to determine the conventional commit type:\n - `feat:` — New functionality, new files, new exports, new API endpoints\n - `fix:` — Bug fixes, error corrections, fixing broken behavior\n - `refactor:` — Code restructuring without changing behavior\n - `docs:` — Documentation only changes\n - `test:` — Adding or modifying tests\n - `chore:` — Build scripts, configs, maintenance tasks\n\n 2. **Generate a commit message** based on:\n - The task description from `.worktree-task.md` (if it was found)\n - A brief summary of what the diff actually changed\n - Format: `<type>: <subject>` (max 72 characters)\n\n 3. **Show the proposed message** to the user with AskUserQuestion:\n - Display the generated message clearly\n - Options: \"Use this message\" / \"Let me write my own\"\n\n 4. **If user chooses to write their own:**\n - Ask them to provide their commit message\n - Validate it follows conventional commits format (warn if not, but allow)\n\n 5. **Always include body and co-author:**\n - Add a brief body summarizing what changed (2-3 bullet points if multiple changes)\n - Include the standard co-author line\n\n3. Create the commit with the message using a HEREDOC:\n ```bash\n git commit -m \"$(cat <<'EOF'\n <commit message here>\n EOF\n )\"\n ```\n\n### Step 6: Push\n\nPush the branch to origin:\n\n```bash\ngit push -u origin HEAD\n```\n\nIf push fails due to no upstream, the `-u` flag should handle it. If it fails for another reason, show the error and suggest fixes.\n\n### Step 7: Create Pull Request\n\n1. Determine the base branch (main or master) using the same detection as worktree-init\n2. Create the PR using `gh pr create`:\n\n```bash\ngh pr create --base <main-branch> --title \"<PR title>\" --body \"$(cat <<'EOF'\n## Summary\n\n<bullet points describing the changes based on task description and diff>\n\n## Original Task\n\n<task description from .worktree-task.md>\n\n## Changes\n\n<git diff --stat summary>\n\n---\nCreated from worktree `claude/<name>` using `/worktree-deliver`\nEOF\n)\"\n```\n\n3. Display the PR URL prominently\n\n### Step 8: Next Steps\n\nTell the user:\n- PR is ready for review at `<URL>`\n- After merging, run `/worktree-cleanup` from the main repo to clean up\n- They can close this terminal panel\n"}