|
| 1 | +--- |
| 2 | +name: ship |
| 3 | +description: Update docs, commit, create PR, monitor CI and reviews, address feedback, merge |
| 4 | +user-invocable: true |
| 5 | +argument-hint: "[optional PR number to resume monitoring]" |
| 6 | +allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent |
| 7 | +--- |
| 8 | + |
| 9 | +# Ship — Commit, Monitor, Fix, Merge |
| 10 | + |
| 11 | +End-to-end workflow: update documentation, commit, create PR, monitor CI |
| 12 | +and code reviews, address feedback, and merge when everything passes. |
| 13 | + |
| 14 | +If `$ARGUMENTS` contains a PR number, skip to the monitoring phase for |
| 15 | +that PR. |
| 16 | + |
| 17 | +## Phase 1 — Update Documentation |
| 18 | + |
| 19 | +Before committing, review all staged and unstaged changes to understand |
| 20 | +what was modified, then update: |
| 21 | + |
| 22 | +1. **CLAUDE.md** — If any CI/CD pipelines, hooks, skills, conventions, |
| 23 | + or project structure changed, update the relevant sections. |
| 24 | +2. **README.md** — If scripts, settings, architecture, or tooling |
| 25 | + changed, update the relevant sections. |
| 26 | +3. **docs/adr/** — If a significant architectural decision was made |
| 27 | + (new pattern, new tool, structural change), create or update an ADR. |
| 28 | +4. **MEMORY.md** — Update project memory at |
| 29 | + `$HOME/.claude/projects/-Users-gamaware-Documents-Repos-personal-github-org-settings/memory/MEMORY.md` |
| 30 | + if there are new gotchas, patterns, or preferences learned. |
| 31 | + |
| 32 | +Only update files where changes are actually needed. Do not update docs |
| 33 | +for trivial changes. |
| 34 | + |
| 35 | +## Phase 2 — Commit and Push |
| 36 | + |
| 37 | +1. Stage all changes (including doc updates from Phase 1). |
| 38 | +2. Write a conventional commit message summarizing all changes. |
| 39 | +3. Push to the current feature branch. |
| 40 | +4. Create a PR if one does not exist yet. Use the commit message as |
| 41 | + the PR title. Include a summary and test plan in the body. |
| 42 | + |
| 43 | +## Phase 3 — Monitor CI |
| 44 | + |
| 45 | +Poll CI status using `gh pr checks <number>` every 30 seconds until |
| 46 | +all checks complete (pass, fail, or skip). Report the final status. |
| 47 | + |
| 48 | +If any check fails: |
| 49 | + |
| 50 | +1. Read the failure logs with `gh run view <id> --log-failed`. |
| 51 | +2. Diagnose and fix the issue. |
| 52 | +3. Commit and push the fix. |
| 53 | +4. Return to monitoring. |
| 54 | + |
| 55 | +## Phase 4 — Monitor Code Reviews |
| 56 | + |
| 57 | +Check for review comments from CodeRabbit and Copilot: |
| 58 | + |
| 59 | +```bash |
| 60 | +gh api repos/{owner}/{repo}/pulls/{number}/comments |
| 61 | +gh api repos/{owner}/{repo}/issues/{number}/comments |
| 62 | +``` |
| 63 | + |
| 64 | +If CodeRabbit is rate-limited, wait for the timeout period then trigger |
| 65 | +with `gh pr comment <number> --body "@coderabbitai review"`. |
| 66 | + |
| 67 | +For each review comment: |
| 68 | + |
| 69 | +1. Read the comment carefully. |
| 70 | +2. Check if the comment is stale (already fixed in a later commit) by |
| 71 | + reading the current file state. Dismiss stale comments. |
| 72 | +3. If the comment is valid, fix the issue, commit, and push. |
| 73 | +4. After fixing, re-monitor CI (return to Phase 3). |
| 74 | + |
| 75 | +After all fixes are pushed and the incremental review passes, resolve |
| 76 | +stale CodeRabbit threads in bulk: |
| 77 | + |
| 78 | +```bash |
| 79 | +gh pr comment <number> --body "@coderabbitai resolve" |
| 80 | +``` |
| 81 | + |
| 82 | +For Copilot threads, resolve them via the GraphQL API: |
| 83 | + |
| 84 | +```bash |
| 85 | +gh api graphql -f query='{ |
| 86 | + repository(owner: "gamaware", name: "github-org-settings") { |
| 87 | + pullRequest(number: <NUMBER>) { |
| 88 | + reviewThreads(first: 100) { nodes { id isResolved } } |
| 89 | + } |
| 90 | + } |
| 91 | +}' |
| 92 | +``` |
| 93 | + |
| 94 | +Then for each unresolved thread ID: |
| 95 | + |
| 96 | +```bash |
| 97 | +gh api graphql -f query='mutation { |
| 98 | + resolveReviewThread(input: {threadId: "<ID>"}) { |
| 99 | + thread { isResolved } |
| 100 | + } |
| 101 | +}' |
| 102 | +``` |
| 103 | + |
| 104 | +## Phase 5 — Merge |
| 105 | + |
| 106 | +Once ALL of the following are true: |
| 107 | + |
| 108 | +- All CI checks pass |
| 109 | +- CodeRabbit review has no unaddressed comments |
| 110 | +- Copilot review has no unaddressed comments |
| 111 | + |
| 112 | +Then merge: |
| 113 | + |
| 114 | +```bash |
| 115 | +gh pr merge <number> --squash --admin --delete-branch |
| 116 | +``` |
| 117 | + |
| 118 | +Pull main locally after merge: |
| 119 | + |
| 120 | +```bash |
| 121 | +git checkout main && git pull |
| 122 | +``` |
| 123 | + |
| 124 | +Report the merge commit and confirm the branch was deleted. |
| 125 | + |
| 126 | +## Rules |
| 127 | + |
| 128 | +- Never suppress lint violations — fix them. |
| 129 | +- No AI attribution in commits. |
| 130 | +- Conventional commit messages required. |
| 131 | +- CodeRabbit may hit hourly rate limits — wait and retry. |
| 132 | +- Copilot comments may be stale after fix commits — verify current file state. |
| 133 | +- CodeRabbit auto-reviews incrementally on every push (up to 5 commits, |
| 134 | + then pauses). Use `@coderabbitai review` to resume after pause. |
| 135 | +- CodeRabbit does NOT auto-resolve its threads — use `@coderabbitai resolve` |
| 136 | + after fixes are confirmed. |
| 137 | +- Use `--admin` to bypass branch protection for merge. |
0 commit comments