Imported from yong076/divecode (
skills/divecode-pr-watch/SKILL.md). Install upstream withnpx skills add yong076/divecode --skill divecode-pr-watch. Copyright stays with the author.
divecode-pr-watch — status-driven routing
You are running divecode-pr-watch. Read the PR's live status, decide the next route per agent-flow's 6-status contract.
Iron Laws
- Status is computed, not assumed. Always actually fetch the PR.
- One status → one route. No "maybe try X then Y" — the routing table is deterministic.
- Block ≠ fail. Pending CI is not a failure; just don't merge yet.
- Closed (not merged) requires user input. Never auto-cleanup a closed-without-merge PR.
Preamble
PROJ_DIR="${DIVECODE_PROJECT_DIR:-$PWD}"
DIVECODE_HOME="${DIVECODE_HOME:-$HOME/.divecode}"
[ -x "$DIVECODE_HOME/bin/divecode-pr-watch" ] || DIVECODE_HOME="$HOME/Trappist/divecode"
# Find PR number from push-pr.md
PR=$(grep -E '^url:' "$PROJ_DIR/divecode/push-pr.md" 2>/dev/null | head -1 | grep -oE '/pull/[0-9]+' | grep -oE '[0-9]+')
[ -z "$PR" ] && { echo "could not find PR in divecode/push-pr.md"; exit 1; }
echo "PR: $PR"
Workflow
Step 1 — Fetch + route
bash "$DIVECODE_HOME/bin/divecode-pr-watch" "$PR" > "$PROJ_DIR/divecode/pr-watch.md"
cat "$PROJ_DIR/divecode/pr-watch.md"
Routing table (matches agent-flow exactly):
| status | route | action |
|---|---|---|
green |
merge |
invoke /divecode-merge |
has_comments |
fix-loop |
invoke /divecode-fix-loop with PR comments converted into must-fix items |
ci_failed |
fix-loop |
invoke /divecode-fix-loop; reproduce the failure locally, fix, push |
pending |
block |
sleep / wait — re-invoke pr-watch after ~5min |
closed (not merged) |
block |
ask user before proceeding |
merged |
cleanup |
invoke /divecode-cleanup |
error |
block |
surface error; do not retry until user input |
Step 2 — Branch per route
Per the table. For pending, suggest the user re-invoke later or set a timer.
Step 3 — Append round entry to pr-watch.md
Each poll/action is recorded:
## Round <N> — <date>
status: <s>
route: <r>
action: <what was done>
Done criteria
pr-watch.mdshows latest status- Next skill invoked (or user prompted for
pending/closed)
