Surveillance PR — routage par statut

VérifiéPrudence

Surveille le statut en direct d'une PR et route vers l'action appropriée (merge, fix-loop, block, cleanup) selon une table déterministe.

Spar Skills Guide Bot
DeveloppementIntermédiaire
1024/07/2026
Claude Code
#pr-watch#pull-request#ci#auto-respond#routing

Recommandé pour

Notre avis

Surveille une pull request et achemine automatiquement vers l'étape suivante (fusion, boucle de correction, attente, nettoyage) selon l'état du CI et des commentaires.

Points forts

  • Automatisation du suivi des PR sans intervention manuelle
  • Routage déterministe basé sur six états précis
  • Intégration avec les autres outils Divecode (push, merge, cleanup)
  • Journalisation de chaque cycle de surveillance

Limites

  • Nécessite que le PR ait été créé par /divecode-push-pr au préalable
  • Ne gère pas les conflits de fusion complexes
  • Dépend de l'outil gh et de l'API GitHub
Quand l'utiliser

Après avoir poussé une PR et avant de vouloir la fusionner automatiquement lorsque les conditions sont remplies.

Quand l'éviter

Pour une PR manuelle ou hors du flux Divecode, ou si vous préférez un contrôle humain à chaque étape.

Analyse de sécurité

Prudence
Score qualité85/100

The skill delegates to an external binary that interacts with GitHub via `gh`, which could be a risk if the binary is compromised or misused. No destructive actions are instructed, but the binary’s behaviour is not controlled within the skill.

Points d'attention
  • Relies on external binary `divecode-pr-watch` without integrity verification
  • Uses Bash and network access (gh) which may expose credentials or tokens

Exemples

Watch current PR and auto-route
divecode pr-watch
Poll PR status and decide next action
watch pr
Check PR and route according to status
poll pr

name: divecode-pr-watch description: | Watch a PR — auto-respond to comments and CI failures. Uses bin/divecode-pr-watch which polls via gh and emits a routing decision (status + route). 6-status / 7-route routing per agent-flow: green→merge, has_comments→fix-loop, ci_failed→fix-loop, pending→block, closed→block, merged→cleanup, error→block. Use after /divecode-push-pr, before /divecode-merge. triggers:

  • divecode pr-watch
  • watch pr
  • poll pr allowed-tools:
  • Bash
  • Read
  • Write

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

  1. Status is computed, not assumed. Always actually fetch the PR.
  2. One status → one route. No "maybe try X then Y" — the routing table is deterministic.
  3. Block ≠ fail. Pending CI is not a failure; just don't merge yet.
  4. 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.md shows latest status
  • Next skill invoked (or user prompted for pending/closed)
Skills similaires