(status, ordered)
| 203 | } |
| 204 | |
| 205 | function buildPostApprovalRunbook(status, ordered) { |
| 206 | if (status === 'no-stack') { |
| 207 | return [ |
| 208 | { |
| 209 | step: 'Generate PR readiness reports', |
| 210 | gate: 'At least one report exists in .planning/pr-readiness.', |
| 211 | action: 'Run node scripts/pr-ready.js --pr <pull-request-url> --run-verification for each PR.', |
| 212 | }, |
| 213 | ]; |
| 214 | } |
| 215 | if (status === 'blocked') { |
| 216 | return [ |
| 217 | { |
| 218 | step: 'Refresh blocked readiness reports', |
| 219 | gate: 'Every report status is ready and every readiness gate passes.', |
| 220 | action: 'Fix the blocked PRs, then rerun node scripts/pr-ready.js --pr <pull-request-url> --run-verification.', |
| 221 | }, |
| 222 | ]; |
| 223 | } |
| 224 | const steps = [ |
| 225 | { |
| 226 | step: 'Reconfirm stack state', |
| 227 | gate: 'npm run stack:plan reports approval-needed with zero blocked items.', |
| 228 | action: 'Read .planning/stack-readiness/latest.md and .planning/approval-capsules/latest.md.', |
| 229 | }, |
| 230 | ]; |
| 231 | for (const [index, report] of ordered.entries()) { |
| 232 | const label = report.pr || report.branch; |
| 233 | steps.push({ |
| 234 | step: `Land ${index + 1}: ${label}`, |
| 235 | gate: `Readiness report ${report.path} is ready and branch head is ${report.currentHead || report.head || 'current'}.`, |
| 236 | action: 'Mark ready or merge only after the prior PR in this stack has landed cleanly.', |
| 237 | }); |
| 238 | } |
| 239 | steps.push({ |
| 240 | step: 'Verify landed main', |
| 241 | gate: 'Main contains the final stack head and the selected verification command passes.', |
| 242 | action: 'Run npm run test, then run npm run stack:plan to confirm no stale readiness remains.', |
| 243 | }); |
| 244 | return steps; |
| 245 | } |
| 246 | |
| 247 | function buildStackApprovalCapsule(projectRoot, stack) { |
| 248 | if (stack.status !== 'approval-needed') return null; |
no outgoing calls
no test coverage detected