next.js
cfd5d5db - pr-status: add --wait flag and background execution for /pr-status command (#90687)

Commit
49 days ago
pr-status: add --wait flag and background execution for /pr-status command (#90687) ## Summary - Add a `--wait` flag to `scripts/pr-status.js` that writes a partial report with currently available CI results, then blocks on `gh run watch` until CI completes, and re-runs the full analysis to produce the final report - Refactor `main()` into a reusable `runAnalysis()` function so it can be called twice (partial + final) - Update the `/pr-status` command to run the script with `--wait` in the background, present the partial report immediately while CI is still running, then poll for completion with 5-minute timeouts ### How it works 1. `/pr-status` launches `node scripts/pr-status.js --wait` in the background (1-minute Bash timeout) 2. The script writes the initial report (with whatever jobs have completed so far) and prints `Output written to ...` 3. The command polls for that message using `TaskOutput` with 20-second timeouts, then reads `index.md` and analyzes the partial results 4. Meanwhile, the script blocks on `gh run watch` until CI finishes, then re-runs the full analysis 5. After presenting the partial analysis, the command polls for the background script to complete using `TaskOutput` with 5-minute timeouts (repeating if needed) 6. When it finishes, the command re-reads the final report and analyzes any newly failed jobs ### Files changed - `scripts/pr-status.js` — Extracted `runAnalysis()` from `main()`, added `--wait` flag with `gh run watch` blocking and re-analysis - `.claude/commands/pr-status.md` — Updated workflow to use `--wait` with background execution, poll for readiness (20s timeouts), and poll for final results (5-min timeouts) ## Test plan - [ ] Run `node scripts/pr-status.js <completed-pr-number>` (no `--wait`) — should behave identically to before - [ ] Run `node scripts/pr-status.js <completed-pr-number> --wait` — should produce report and exit immediately (no waiting needed since CI is done) - [ ] Run `node scripts/pr-status.js --wait` on a branch with in-progress CI — should write partial report, block on `gh run watch`, then write final report - [ ] Run `/pr-status` command — should show partial results, then update with final results after CI completes --------- Co-authored-by: Claude <noreply@anthropic.com>
Author
Parents
Loading