mandrel 1.93.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) hide show
  1. package/.agents/README.md +59 -73
  2. package/.agents/agents/acceptance-critic.md +129 -0
  3. package/.agents/agents/story-worker.md +161 -0
  4. package/.agents/docs/SDLC.md +489 -1285
  5. package/.agents/docs/agentrc-reference.json +177 -67
  6. package/.agents/docs/configuration.md +108 -136
  7. package/.agents/docs/execution-reference.md +44 -22
  8. package/.agents/docs/quality-gates.md +13 -19
  9. package/.agents/docs/workflows.md +3 -3
  10. package/.agents/instructions.md +107 -108
  11. package/.agents/rules/ci-remediation.md +8 -12
  12. package/.agents/rules/git-conventions-reference.md +224 -0
  13. package/.agents/rules/git-conventions.md +42 -223
  14. package/.agents/rules/security-baseline.md +5 -0
  15. package/.agents/rules/testing-standards.md +106 -13
  16. package/.agents/schemas/acceptance-eval-verdict.schema.json +1 -1
  17. package/.agents/schemas/agentrc.schema.json +71 -201
  18. package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
  19. package/.agents/schemas/lifecycle/retro.end.schema.json +1 -1
  20. package/.agents/schemas/risk-verdict.schema.json +0 -13
  21. package/.agents/scripts/acceptance-eval.js +62 -18
  22. package/.agents/scripts/agents-bootstrap-github.js +1 -1
  23. package/.agents/scripts/analyze-execution.js +1 -1
  24. package/.agents/scripts/audit-to-stories.js +7 -7
  25. package/.agents/scripts/boot-sweep.js +1 -1
  26. package/.agents/scripts/check-context-budget.js +62 -5
  27. package/.agents/scripts/check-lifecycle-lint.js +6 -9
  28. package/.agents/scripts/check-prepush-recovery.js +1 -1
  29. package/.agents/scripts/cleanup-repo-test-temp.js +6 -1
  30. package/.agents/scripts/diagnose-friction.js +0 -6
  31. package/.agents/scripts/lib/Logger.js +6 -10
  32. package/.agents/scripts/lib/audit-suite/runner.js +2 -2
  33. package/.agents/scripts/lib/audit-suite/selector.js +5 -5
  34. package/.agents/scripts/lib/audit-to-stories/{seed-epic-from-findings.js → seed-from-findings.js} +9 -9
  35. package/.agents/scripts/lib/baselines/kernel.js +206 -18
  36. package/.agents/scripts/lib/baselines/kinds/maintainability.js +0 -4
  37. package/.agents/scripts/lib/baselines/reader.js +1 -6
  38. package/.agents/scripts/lib/bdd-runner-detect.js +5 -9
  39. package/.agents/scripts/lib/bootstrap/issue-forms-template.js +32 -33
  40. package/.agents/scripts/lib/bootstrap/project-bootstrap.js +56 -18
  41. package/.agents/scripts/lib/checks/core-bare-clean.js +2 -2
  42. package/.agents/scripts/lib/checks/index.js +2 -1
  43. package/.agents/scripts/lib/checks/story-init-not-backgrounded.js +23 -21
  44. package/.agents/scripts/lib/cli/standard-args.js +13 -22
  45. package/.agents/scripts/lib/cli-args.js +16 -7
  46. package/.agents/scripts/lib/close-validation/gates.js +160 -22
  47. package/.agents/scripts/lib/config/acceptance-eval.js +52 -5
  48. package/.agents/scripts/lib/config/ci.js +6 -31
  49. package/.agents/scripts/lib/config/delivery-routing.js +103 -0
  50. package/.agents/scripts/lib/config/explain.js +57 -36
  51. package/.agents/scripts/lib/config/limits.js +17 -58
  52. package/.agents/scripts/lib/config/paths.js +0 -2
  53. package/.agents/scripts/lib/config/quality.js +1 -1
  54. package/.agents/scripts/lib/config/runners.js +17 -50
  55. package/.agents/scripts/lib/config/temp-paths.js +19 -14
  56. package/.agents/scripts/lib/config/worktree-isolation.js +0 -5
  57. package/.agents/scripts/lib/config-resolver.js +3 -8
  58. package/.agents/scripts/lib/config-settings-schema-delivery.js +46 -136
  59. package/.agents/scripts/lib/config-settings-schema-quality.js +17 -14
  60. package/.agents/scripts/lib/config-settings-schema.js +52 -38
  61. package/.agents/scripts/lib/dependency-parser.js +3 -2
  62. package/.agents/scripts/lib/doc-tiers.js +39 -4
  63. package/.agents/scripts/lib/duplicate-search.js +211 -41
  64. package/.agents/scripts/lib/feedback-loop/retro-proposals-graduator.js +1 -1
  65. package/.agents/scripts/lib/findings/promote-finding.js +5 -5
  66. package/.agents/scripts/lib/framework-version.js +2 -3
  67. package/.agents/scripts/lib/git-branch-cleanup.js +1 -10
  68. package/.agents/scripts/lib/git-branch-lifecycle.js +17 -22
  69. package/.agents/scripts/lib/git-utils.js +32 -6
  70. package/.agents/scripts/lib/github/framework-repo.js +6 -0
  71. package/.agents/scripts/lib/label-constants.js +10 -23
  72. package/.agents/scripts/lib/label-taxonomy.js +9 -43
  73. package/.agents/scripts/lib/observability/active-story-env.js +112 -3
  74. package/.agents/scripts/lib/observability/hook-heartbeat.js +187 -0
  75. package/.agents/scripts/lib/observability/source-classifier.js +3 -3
  76. package/.agents/scripts/lib/observability/tool-trace-hook.js +15 -4
  77. package/.agents/scripts/lib/onboard/init-tail.js +1 -3
  78. package/.agents/scripts/lib/orchestration/acceptance-clusters.js +111 -0
  79. package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +32 -4
  80. package/.agents/scripts/lib/orchestration/audit-lens-routing.js +128 -0
  81. package/.agents/scripts/lib/orchestration/bookkeeping-outbox.js +273 -0
  82. package/.agents/scripts/lib/orchestration/ceremony-routing.js +204 -0
  83. package/.agents/scripts/lib/orchestration/code-review.js +20 -268
  84. package/.agents/scripts/lib/orchestration/column-sync.js +1 -1
  85. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +1 -1
  86. package/.agents/scripts/lib/orchestration/context-envelope.js +2 -5
  87. package/.agents/scripts/lib/orchestration/docs-digest.js +8 -8
  88. package/.agents/scripts/lib/orchestration/file-assumptions.js +7 -13
  89. package/.agents/scripts/lib/orchestration/git-cleanup/phases/cli.js +1 -1
  90. package/.agents/scripts/lib/orchestration/lifecycle/emit-loop-tick.js +8 -8
  91. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-heartbeat.js +2 -2
  92. package/.agents/scripts/lib/orchestration/lifecycle/ledger-writer.js +6 -3
  93. package/.agents/scripts/lib/orchestration/lifecycle/listeners/README.md +17 -43
  94. package/.agents/scripts/lib/orchestration/lint-baseline-service.js +4 -4
  95. package/.agents/scripts/lib/orchestration/merge-block-class.js +1 -1
  96. package/.agents/scripts/lib/orchestration/phase-runner.js +3 -2
  97. package/.agents/scripts/lib/orchestration/plan-context.js +248 -266
  98. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +3 -2
  99. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +1 -1
  100. package/.agents/scripts/lib/orchestration/plan-navigation.js +92 -0
  101. package/.agents/scripts/lib/orchestration/plan-persist/fan-out-gate.js +61 -0
  102. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +97 -0
  103. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +223 -854
  104. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +361 -0
  105. package/.agents/scripts/lib/orchestration/plan-persist/summary.js +35 -108
  106. package/.agents/scripts/lib/orchestration/plan-reachability.js +9 -14
  107. package/.agents/scripts/lib/orchestration/plan-runner/worktree-sweep.js +1 -1
  108. package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/authoring-context.js +14 -14
  109. package/.agents/scripts/lib/orchestration/planning/decomposer-context.js +27 -0
  110. package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/risk-verdict.js +3 -4
  111. package/.agents/scripts/lib/orchestration/post-merge/phases/branch-cleanup.js +2 -2
  112. package/.agents/scripts/lib/orchestration/post-merge/phases/dashboard-refresh.js +8 -20
  113. package/.agents/scripts/lib/orchestration/post-merge/phases/worktree-reap.js +3 -2
  114. package/.agents/scripts/lib/orchestration/pr-base-guard.js +18 -28
  115. package/.agents/scripts/lib/orchestration/preflight-cache.js +5 -5
  116. package/.agents/scripts/lib/orchestration/remote-verifier.js +1 -1
  117. package/.agents/scripts/lib/orchestration/resolve-plan-run.js +155 -0
  118. package/.agents/scripts/lib/orchestration/resolves-token.js +1 -1
  119. package/.agents/scripts/lib/orchestration/retro-perf-heuristics.js +8 -8
  120. package/.agents/scripts/lib/orchestration/retro-proposals.js +140 -79
  121. package/.agents/scripts/lib/orchestration/review-depth.js +26 -12
  122. package/.agents/scripts/lib/orchestration/review-providers/codex.js +2 -2
  123. package/.agents/scripts/lib/orchestration/review-providers/review-provider-factory.js +21 -56
  124. package/.agents/scripts/lib/orchestration/run-epilogue.js +426 -0
  125. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +1 -1
  126. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +1 -0
  127. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +95 -41
  128. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +16 -13
  129. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +40 -0
  130. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +11 -3
  131. package/.agents/scripts/lib/orchestration/spec-freshness.js +14 -205
  132. package/.agents/scripts/lib/orchestration/spec-section-validator.js +4 -5
  133. package/.agents/scripts/lib/orchestration/spec-spill.js +60 -0
  134. package/.agents/scripts/lib/orchestration/split-policy-validator.js +188 -0
  135. package/.agents/scripts/lib/orchestration/story-close/emit-blocked.js +49 -0
  136. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +15 -12
  137. package/.agents/scripts/lib/orchestration/story-follow-ups.js +237 -0
  138. package/.agents/scripts/lib/orchestration/story-init-remote.js +47 -0
  139. package/.agents/scripts/lib/orchestration/story-plan-state.js +48 -0
  140. package/.agents/scripts/lib/orchestration/{epic-runner → story-progress}/story-run-progress-writer.js +3 -3
  141. package/.agents/scripts/lib/orchestration/structured-comment-parser.js +1 -1
  142. package/.agents/scripts/lib/orchestration/task-body-validator.js +8 -18
  143. package/.agents/scripts/lib/orchestration/ticket-validator-conflicts.js +11 -61
  144. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +189 -373
  145. package/.agents/scripts/lib/orchestration/ticket-validator.js +3 -8
  146. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +0 -25
  147. package/.agents/scripts/lib/orchestration/ticketing/reads.js +29 -26
  148. package/.agents/scripts/lib/orchestration/ticketing/transition.js +5 -5
  149. package/.agents/scripts/lib/planning-corpus.js +16 -11
  150. package/.agents/scripts/lib/preflight-runner.js +2 -2
  151. package/.agents/scripts/lib/provider-factory.js +1 -1
  152. package/.agents/scripts/lib/qa/coverage-verdict.js +5 -5
  153. package/.agents/scripts/lib/single-story/confirm-merge-follow-ups.js +36 -0
  154. package/.agents/scripts/lib/single-story-sweep/protection-ctx.js +1 -1
  155. package/.agents/scripts/lib/story-adjacency.js +11 -14
  156. package/.agents/scripts/lib/story-body/story-body.js +124 -70
  157. package/.agents/scripts/lib/story-plan.js +2 -4
  158. package/.agents/scripts/lib/templates/decomposer-prompts.js +46 -45
  159. package/.agents/scripts/lib/templates/spec-author-prompts.js +47 -45
  160. package/.agents/scripts/lib/{epic-body-sections.js → ticket-body-sections.js} +26 -26
  161. package/.agents/scripts/lib/validation-evidence.js +1 -1
  162. package/.agents/scripts/lib/wave-runner/ready-set.js +6 -6
  163. package/.agents/scripts/lib/workspace-provisioner.js +1 -1
  164. package/.agents/scripts/lib/worktree/lifecycle/reap.js +5 -7
  165. package/.agents/scripts/lint-issue-body.js +71 -40
  166. package/.agents/scripts/mandrel-update-preflight.js +1 -1
  167. package/.agents/scripts/notify.js +4 -3
  168. package/.agents/scripts/plan-context.js +64 -74
  169. package/.agents/scripts/plan-persist.js +121 -280
  170. package/.agents/scripts/plan-run-epilogue.js +97 -0
  171. package/.agents/scripts/post-structured-comment.js +38 -0
  172. package/.agents/scripts/providers/github/issues.js +17 -33
  173. package/.agents/scripts/providers/github/mappers.js +0 -12
  174. package/.agents/scripts/providers/github/tickets.js +2 -5
  175. package/.agents/scripts/resolve-plan-run.js +117 -0
  176. package/.agents/scripts/signals-view.js +24 -19
  177. package/.agents/scripts/single-story-close.js +11 -14
  178. package/.agents/scripts/single-story-confirm-merge.js +39 -23
  179. package/.agents/scripts/single-story-init.js +29 -20
  180. package/.agents/scripts/stories-wave-tick.js +6 -6
  181. package/.agents/scripts/story-plan.js +26 -47
  182. package/.agents/scripts/sync-claude-agents.js +165 -0
  183. package/.agents/scripts/update-ticket-state.js +37 -15
  184. package/.agents/skills/core/analyze-execution/SKILL.md +21 -18
  185. package/.agents/skills/core/api-and-interface-design/SKILL.md +5 -3
  186. package/.agents/skills/core/code-review-and-quality/SKILL.md +63 -7
  187. package/.agents/skills/core/debugging-and-error-recovery/SKILL.md +1 -1
  188. package/.agents/skills/core/gates-and-baselines/SKILL.md +149 -0
  189. package/.agents/skills/core/idea-refinement/SKILL.md +8 -14
  190. package/.agents/skills/core/qa-coverage-mapping/SKILL.md +7 -7
  191. package/.agents/skills/core/scope-triage/SKILL.md +28 -172
  192. package/.agents/skills/skills.index.json +8 -418
  193. package/.agents/starter-agentrc.json +0 -5
  194. package/.agents/templates/agent-protocol.md +9 -10
  195. package/.agents/workflows/audit-architecture.md +3 -3
  196. package/.agents/workflows/audit-clean-code.md +3 -3
  197. package/.agents/workflows/audit-dependencies.md +3 -3
  198. package/.agents/workflows/audit-devops.md +3 -3
  199. package/.agents/workflows/audit-documentation.md +5 -5
  200. package/.agents/workflows/audit-lighthouse.md +3 -3
  201. package/.agents/workflows/audit-navigability.md +3 -2
  202. package/.agents/workflows/audit-performance.md +3 -3
  203. package/.agents/workflows/audit-privacy.md +3 -3
  204. package/.agents/workflows/audit-quality.md +3 -3
  205. package/.agents/workflows/audit-security.md +3 -3
  206. package/.agents/workflows/audit-seo.md +3 -3
  207. package/.agents/workflows/audit-sre.md +3 -3
  208. package/.agents/workflows/audit-to-stories.md +20 -20
  209. package/.agents/workflows/audit-ux-ui.md +3 -3
  210. package/.agents/workflows/deliver.md +122 -131
  211. package/.agents/workflows/git-cleanup.md +3 -4
  212. package/.agents/workflows/helpers/_merge-conflict-template.md +1 -1
  213. package/.agents/workflows/helpers/acceptance-self-eval.md +52 -40
  214. package/.agents/workflows/helpers/code-review.md +70 -193
  215. package/.agents/workflows/helpers/{single-story-deliver-reference.md → deliver-story-reference.md} +12 -14
  216. package/.agents/workflows/helpers/{single-story-deliver.md → deliver-story.md} +113 -139
  217. package/.agents/workflows/helpers/diagnose.md +10 -10
  218. package/.agents/workflows/helpers/mandrel-sync-config.md +1 -1
  219. package/.agents/workflows/helpers/parallel-tooling.md +1 -1
  220. package/.agents/workflows/helpers/signals.md +16 -16
  221. package/.agents/workflows/helpers/worktree-lifecycle.md +48 -64
  222. package/.agents/workflows/mandrel-update.md +3 -2
  223. package/.agents/workflows/plan.md +112 -145
  224. package/.agents/workflows/qa-assist.md +24 -30
  225. package/.agents/workflows/qa-explore.md +29 -38
  226. package/.agents/workflows/qa-run.md +2 -2
  227. package/README.md +9 -8
  228. package/docs/CHANGELOG.md +46 -0
  229. package/lib/cli/registry.js +95 -0
  230. package/lib/migrations/index.js +6 -5
  231. package/package.json +5 -3
  232. package/.agents/personas/architect.md +0 -113
  233. package/.agents/personas/devops-engineer.md +0 -38
  234. package/.agents/personas/engineer-mobile.md +0 -120
  235. package/.agents/personas/engineer-web.md +0 -111
  236. package/.agents/personas/engineer.md +0 -119
  237. package/.agents/personas/product.md +0 -94
  238. package/.agents/personas/project-manager.md +0 -114
  239. package/.agents/personas/qa-engineer.md +0 -95
  240. package/.agents/personas/refactorer.md +0 -113
  241. package/.agents/personas/security-engineer.md +0 -112
  242. package/.agents/personas/sre.md +0 -86
  243. package/.agents/personas/technical-writer.md +0 -101
  244. package/.agents/personas/ux-designer.md +0 -95
  245. package/.agents/schemas/dispatch-manifest.json +0 -232
  246. package/.agents/schemas/epic-spec.schema.json +0 -153
  247. package/.agents/scripts/acceptance-spec-reconciler.js +0 -642
  248. package/.agents/scripts/dispatcher.js +0 -295
  249. package/.agents/scripts/epic-audit-prepare.js +0 -497
  250. package/.agents/scripts/epic-audit-recheck.js +0 -274
  251. package/.agents/scripts/epic-deliver-note-intervention.js +0 -192
  252. package/.agents/scripts/epic-deliver-preflight.js +0 -462
  253. package/.agents/scripts/epic-deliver-prepare.js +0 -590
  254. package/.agents/scripts/epic-execute-record-wave.js +0 -449
  255. package/.agents/scripts/epic-plan-clarity.js +0 -211
  256. package/.agents/scripts/epic-plan-decompose.js +0 -54
  257. package/.agents/scripts/epic-plan-healthcheck.js +0 -581
  258. package/.agents/scripts/epic-plan-spec.js +0 -64
  259. package/.agents/scripts/epic-reconcile.js +0 -625
  260. package/.agents/scripts/lib/baseline-snapshot.js +0 -979
  261. package/.agents/scripts/lib/checks/epic-merge-lock-stale.js +0 -54
  262. package/.agents/scripts/lib/checks/stale-origin-epic.js +0 -49
  263. package/.agents/scripts/lib/config/lifecycle.js +0 -40
  264. package/.agents/scripts/lib/config/preflight.js +0 -58
  265. package/.agents/scripts/lib/config/retro.js +0 -77
  266. package/.agents/scripts/lib/epic-merge-lock.js +0 -322
  267. package/.agents/scripts/lib/epic-plan-clarity.js +0 -181
  268. package/.agents/scripts/lib/epic-plan-ideation.js +0 -261
  269. package/.agents/scripts/lib/orchestration/context-hydration-engine.js +0 -660
  270. package/.agents/scripts/lib/orchestration/dispatch-engine.js +0 -134
  271. package/.agents/scripts/lib/orchestration/dispatch-pipeline.js +0 -183
  272. package/.agents/scripts/lib/orchestration/epic-cleanup.js +0 -801
  273. package/.agents/scripts/lib/orchestration/epic-deliver-lease-guard.js +0 -310
  274. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/context.js +0 -163
  275. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/creation.js +0 -140
  276. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/dag.js +0 -64
  277. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/diagnostics.js +0 -72
  278. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist-helpers.js +0 -156
  279. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist.js +0 -345
  280. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/planning-artifacts.js +0 -41
  281. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/reconcile-spawn.js +0 -86
  282. package/.agents/scripts/lib/orchestration/epic-plan-lease-guard.js +0 -391
  283. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/drain.js +0 -94
  284. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/plan-epic.js +0 -236
  285. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/run-spec-phase.js +0 -307
  286. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/spec-freshness.js +0 -117
  287. package/.agents/scripts/lib/orchestration/epic-plan-state-store.js +0 -117
  288. package/.agents/scripts/lib/orchestration/epic-run-state-store.js +0 -388
  289. package/.agents/scripts/lib/orchestration/epic-runner/concurrency-gate.js +0 -186
  290. package/.agents/scripts/lib/orchestration/epic-runner/deliver-phases.js +0 -50
  291. package/.agents/scripts/lib/orchestration/epic-runner/phases/build-wave-dag.js +0 -129
  292. package/.agents/scripts/lib/orchestration/epic-runner/phases/snapshot.js +0 -103
  293. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/composition.js +0 -267
  294. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/signals.js +0 -210
  295. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/transport.js +0 -238
  296. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/_bullet-format.js +0 -32
  297. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/component-drift.js +0 -203
  298. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/crap-drift.js +0 -227
  299. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/maintainability-drift.js +0 -117
  300. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/stalled-worktree.js +0 -37
  301. package/.agents/scripts/lib/orchestration/epic-runner/story-launcher.js +0 -127
  302. package/.agents/scripts/lib/orchestration/epic-runner/sub-agent-return.js +0 -276
  303. package/.agents/scripts/lib/orchestration/epic-runner/wave-scheduler.js +0 -66
  304. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-apply.js +0 -789
  305. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-diff.js +0 -676
  306. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-discriminator.js +0 -389
  307. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-format.js +0 -230
  308. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-ops.js +0 -361
  309. package/.agents/scripts/lib/orchestration/finalize/open-or-locate-pr.js +0 -306
  310. package/.agents/scripts/lib/orchestration/finalize/post-handoff-comment.js +0 -489
  311. package/.agents/scripts/lib/orchestration/finalize/sanitize-skip-ci.js +0 -88
  312. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-dispatch-end.js +0 -147
  313. package/.agents/scripts/lib/orchestration/lifecycle/listeners/acceptance-reconciler.js +0 -384
  314. package/.agents/scripts/lib/orchestration/lifecycle/listeners/automerge-armer.js +0 -501
  315. package/.agents/scripts/lib/orchestration/lifecycle/listeners/automerge-predicate.js +0 -984
  316. package/.agents/scripts/lib/orchestration/lifecycle/listeners/branch-cleaner.js +0 -264
  317. package/.agents/scripts/lib/orchestration/lifecycle/listeners/checkpoint-pointer-writer.js +0 -278
  318. package/.agents/scripts/lib/orchestration/lifecycle/listeners/cleaner.js +0 -355
  319. package/.agents/scripts/lib/orchestration/lifecycle/listeners/finalizer.js +0 -673
  320. package/.agents/scripts/lib/orchestration/lifecycle/listeners/index.js +0 -378
  321. package/.agents/scripts/lib/orchestration/lifecycle/listeners/intervention-recorder.js +0 -140
  322. package/.agents/scripts/lib/orchestration/lifecycle/listeners/label-transitioner.js +0 -144
  323. package/.agents/scripts/lib/orchestration/lifecycle/listeners/notify-dispatcher.js +0 -174
  324. package/.agents/scripts/lib/orchestration/manifest-builder.js +0 -222
  325. package/.agents/scripts/lib/orchestration/plan-persist/amend.js +0 -359
  326. package/.agents/scripts/lib/orchestration/plan-persist/delivery-mode.js +0 -127
  327. package/.agents/scripts/lib/orchestration/post-merge-pipeline.js +0 -205
  328. package/.agents/scripts/lib/orchestration/recurring-failure-detector.js +0 -152
  329. package/.agents/scripts/lib/orchestration/retro/phases/checks.js +0 -94
  330. package/.agents/scripts/lib/orchestration/retro/phases/compose-body.js +0 -571
  331. package/.agents/scripts/lib/orchestration/retro/phases/gather-signals.js +0 -450
  332. package/.agents/scripts/lib/orchestration/retro/phases/post-and-mirror.js +0 -191
  333. package/.agents/scripts/lib/orchestration/retro-heuristics.js +0 -57
  334. package/.agents/scripts/lib/orchestration/retro-runner.js +0 -197
  335. package/.agents/scripts/lib/orchestration/skill-capsule-loader.js +0 -109
  336. package/.agents/scripts/lib/orchestration/spec-renderer.js +0 -447
  337. package/.agents/scripts/lib/orchestration/story-close/auto-refresh-runner.js +0 -747
  338. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/gate-failure.js +0 -211
  339. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/pre-merge-attribution.js +0 -158
  340. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/refresh-commit.js +0 -446
  341. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/regression-projection.js +0 -297
  342. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/scope-discovery.js +0 -48
  343. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution-wiring.js +0 -67
  344. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution.js +0 -161
  345. package/.agents/scripts/lib/orchestration/story-close/baseline-friction-body.js +0 -117
  346. package/.agents/scripts/lib/orchestration/story-close/cd-out-guard.js +0 -86
  347. package/.agents/scripts/lib/orchestration/story-close/cleanup-reconciler.js +0 -147
  348. package/.agents/scripts/lib/orchestration/story-close/close-inputs.js +0 -142
  349. package/.agents/scripts/lib/orchestration/story-close/comment-bodies.js +0 -62
  350. package/.agents/scripts/lib/orchestration/story-close/merge-runner.js +0 -658
  351. package/.agents/scripts/lib/orchestration/story-close/merge-subject.js +0 -198
  352. package/.agents/scripts/lib/orchestration/story-close/phases/branch-restore.js +0 -105
  353. package/.agents/scripts/lib/orchestration/story-close/phases/close.js +0 -222
  354. package/.agents/scripts/lib/orchestration/story-close/phases/gates.js +0 -292
  355. package/.agents/scripts/lib/orchestration/story-close/phases/locked-pipeline.js +0 -270
  356. package/.agents/scripts/lib/orchestration/story-close/phases/preflight.js +0 -110
  357. package/.agents/scripts/lib/orchestration/story-close/phases/refresh.js +0 -86
  358. package/.agents/scripts/lib/orchestration/story-close/phases/timeout-blocked-emitter.js +0 -112
  359. package/.agents/scripts/lib/orchestration/story-close/phases/timeout-blocked.js +0 -157
  360. package/.agents/scripts/lib/orchestration/story-close/post-merge-close.js +0 -421
  361. package/.agents/scripts/lib/orchestration/story-close/pre-merge-validation.js +0 -301
  362. package/.agents/scripts/lib/orchestration/story-close/shared-checkout-guard.js +0 -163
  363. package/.agents/scripts/lib/orchestration/story-close-recovery.js +0 -690
  364. package/.agents/scripts/lib/orchestration/wave-marker.js +0 -28
  365. package/.agents/scripts/lib/orchestration/wave-record-io.js +0 -218
  366. package/.agents/scripts/lib/orchestration/wave-record-notifications.js +0 -145
  367. package/.agents/scripts/lib/orchestration/wave-record-projection.js +0 -212
  368. package/.agents/scripts/lib/presentation/dispatch-manifest-render.js +0 -111
  369. package/.agents/scripts/lib/presentation/manifest-builder.js +0 -239
  370. package/.agents/scripts/lib/presentation/manifest-formatter.js +0 -242
  371. package/.agents/scripts/lib/presentation/manifest-helpers.js +0 -213
  372. package/.agents/scripts/lib/presentation/manifest-persistence.js +0 -261
  373. package/.agents/scripts/lib/presentation/manifest-procedures.js +0 -55
  374. package/.agents/scripts/lib/presentation/manifest-render-waves.js +0 -306
  375. package/.agents/scripts/lib/presentation/manifest-renderer.js +0 -188
  376. package/.agents/scripts/lib/presentation/manifest-story-views.js +0 -110
  377. package/.agents/scripts/lib/push-epic-retry.js +0 -209
  378. package/.agents/scripts/lib/spec/index.js +0 -36
  379. package/.agents/scripts/lib/spec/loader.js +0 -425
  380. package/.agents/scripts/lib/spec/state.js +0 -208
  381. package/.agents/scripts/lib/story-init/blocker-validator.js +0 -68
  382. package/.agents/scripts/lib/story-init/branch-initializer.js +0 -408
  383. package/.agents/scripts/lib/story-init/context-resolver.js +0 -92
  384. package/.agents/scripts/lib/story-init/donor-precheck.js +0 -207
  385. package/.agents/scripts/lib/story-init/state-transitioner.js +0 -80
  386. package/.agents/scripts/lib/story-init/task-graph-builder.js +0 -124
  387. package/.agents/scripts/lib/story-init/transition-summary.js +0 -34
  388. package/.agents/scripts/lib/test-reserved-epic-temp-ids.js +0 -35
  389. package/.agents/scripts/lib/wave-runner/tick.js +0 -754
  390. package/.agents/scripts/lib/wave-runner/wave-runner-error.js +0 -20
  391. package/.agents/scripts/lifecycle-emit-story-dispatch.js +0 -194
  392. package/.agents/scripts/lifecycle-emit.js +0 -510
  393. package/.agents/scripts/plan-critics.js +0 -199
  394. package/.agents/scripts/retro-run.js +0 -218
  395. package/.agents/scripts/standalone-feedback-rollup.js +0 -188
  396. package/.agents/scripts/story-close.js +0 -294
  397. package/.agents/scripts/story-init.js +0 -599
  398. package/.agents/scripts/story-phase.js +0 -369
  399. package/.agents/scripts/wave-tick.js +0 -335
  400. package/.agents/skills/core/baseline-refresh/SKILL.md +0 -181
  401. package/.agents/skills/core/ci-cd-and-automation/SKILL.md +0 -274
  402. package/.agents/skills/core/ci-cd-and-automation/examples.md +0 -211
  403. package/.agents/skills/core/code-simplification/SKILL.md +0 -389
  404. package/.agents/skills/core/context-engineering/SKILL.md +0 -309
  405. package/.agents/skills/core/context-engineering/examples.md +0 -58
  406. package/.agents/skills/core/deprecation-and-migration/SKILL.md +0 -250
  407. package/.agents/skills/core/epic-plan-consolidate/SKILL.md +0 -172
  408. package/.agents/skills/core/epic-plan-consolidate/examples.md +0 -51
  409. package/.agents/skills/core/epic-plan-decompose-author/SKILL.md +0 -441
  410. package/.agents/skills/core/epic-plan-decompose-author/examples.md +0 -47
  411. package/.agents/skills/core/epic-plan-premortem/SKILL.md +0 -146
  412. package/.agents/skills/core/epic-plan-premortem/examples.md +0 -53
  413. package/.agents/skills/core/epic-plan-spec-author/SKILL.md +0 -413
  414. package/.agents/skills/core/epic-plan-spec-author/examples.md +0 -91
  415. package/.agents/skills/core/frontend-ui-engineering/SKILL.md +0 -357
  416. package/.agents/skills/core/hydrate-context/SKILL.md +0 -123
  417. package/.agents/skills/core/idea-refinement/examples.md +0 -437
  418. package/.agents/skills/core/idea-refinement/frameworks.md +0 -135
  419. package/.agents/skills/core/incremental-implementation/SKILL.md +0 -271
  420. package/.agents/skills/core/introducing-a-baseline-gate/SKILL.md +0 -213
  421. package/.agents/skills/core/knowledge-transfer/SKILL.md +0 -180
  422. package/.agents/skills/core/mutation-survivor-remediation/SKILL.md +0 -117
  423. package/.agents/skills/core/performance-optimization/SKILL.md +0 -314
  424. package/.agents/skills/core/planning-and-task-breakdown/SKILL.md +0 -277
  425. package/.agents/skills/core/property-based-testing/SKILL.md +0 -148
  426. package/.agents/skills/core/refactoring-discipline/SKILL.md +0 -111
  427. package/.agents/skills/core/shipping-and-launch/SKILL.md +0 -328
  428. package/.agents/skills/core/spec-driven-development/SKILL.md +0 -252
  429. package/.agents/skills/core/test-driven-development/SKILL.md +0 -475
  430. package/.agents/skills/core/using-agent-skills/SKILL.md +0 -232
  431. package/.agents/skills/stack/architecture/monorepo-path-strategist/SKILL.md +0 -31
  432. package/.agents/skills/stack/architecture/structured-output-zod/SKILL.md +0 -51
  433. package/.agents/skills/stack/architecture/subagent-orchestration/SKILL.md +0 -76
  434. package/.agents/skills/stack/backend/cloudflare-hono-architect/SKILL.md +0 -31
  435. package/.agents/skills/stack/backend/cloudflare-hono-architect/examples/route-template.ts +0 -33
  436. package/.agents/skills/stack/backend/cloudflare-queue-manager/SKILL.md +0 -31
  437. package/.agents/skills/stack/backend/cloudflare-workers/SKILL.md +0 -51
  438. package/.agents/skills/stack/backend/highlevel-crm/SKILL.md +0 -54
  439. package/.agents/skills/stack/backend/sqlite-drizzle-expert/SKILL.md +0 -29
  440. package/.agents/skills/stack/backend/sqlite-drizzle-expert/examples/schema-template.ts +0 -30
  441. package/.agents/skills/stack/backend/stripe-integration/SKILL.md +0 -57
  442. package/.agents/skills/stack/backend/stripe-integration/scripts/listen-stripe.sh +0 -9
  443. package/.agents/skills/stack/backend/turso-sqlite/SKILL.md +0 -48
  444. package/.agents/skills/stack/frontend/astro/SKILL.md +0 -62
  445. package/.agents/skills/stack/frontend/astro-react-island-strategist/SKILL.md +0 -30
  446. package/.agents/skills/stack/frontend/expo-react-native-developer/SKILL.md +0 -29
  447. package/.agents/skills/stack/frontend/google-analytics-v4/SKILL.md +0 -50
  448. package/.agents/skills/stack/frontend/tailwind-v4/SKILL.md +0 -58
  449. package/.agents/skills/stack/frontend/ui-accessibility-engineer/SKILL.md +0 -34
  450. package/.agents/skills/stack/qa/audit-accessibility/SKILL.md +0 -51
  451. package/.agents/skills/stack/qa/lighthouse-baseline/SKILL.md +0 -199
  452. package/.agents/skills/stack/security/backend-security-patterns/SKILL.md +0 -68
  453. package/.agents/workflows/helpers/deliver-epic-reference.md +0 -534
  454. package/.agents/workflows/helpers/deliver-epic.md +0 -955
  455. package/.agents/workflows/helpers/deliver-stories.md +0 -440
  456. package/.agents/workflows/helpers/epic-audit.md +0 -189
  457. package/.agents/workflows/helpers/epic-deliver-story.md +0 -427
  458. package/.agents/workflows/helpers/epic-testing.md +0 -125
  459. package/.agents/workflows/helpers/plan-epic-reference.md +0 -160
  460. package/.agents/workflows/helpers/plan-epic.md +0 -351
  461. package/.agents/workflows/helpers/plan-story.md +0 -251
  462. package/.agents/workflows/helpers/scope-triage-gate.md +0 -108
  463. /package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/spec-authoring-grounding.js +0 -0
@@ -1,199 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * plan-critics.js — deterministic dispatch gate for the conditional
5
- * author-step critics of the collapsed /plan flow (Epic #4474 PR6,
6
- * design §4).
7
- *
8
- * **Thin shim (#4496 fix 6).** The evaluation itself now lives in
9
- * `lib/orchestration/plan-critics-evaluate.js` and is folded into
10
- * `plan-persist.js` as a pre-write phase, so the headless (`--yes`) path
11
- * never pays a standalone CLI turn for the dispatch decision. This CLI
12
- * survives one release for the attended pre-gate evaluation (the verdict
13
- * folds into gate #2's view before the persist runs) and for any external
14
- * scripting; it delegates to the shared module and keeps its exact output
15
- * contract.
16
- *
17
- * Runs between authoring and gate #2, entirely git-local (zero GitHub
18
- * calls): reads the authored artifacts, evaluates the risk/size dispatch
19
- * conditions for the consolidation (8.3) and pre-mortem (8.5) critics via
20
- * the shared evaluator, and emits one JSON verdict on stdout. The workflow
21
- * dispatches a fresh-context sub-agent ONLY for critics with
22
- * `dispatch: true`; every skip decision is appended to the plan-metrics
23
- * ledger (`kind: "critic-skip"`, with reasons) so under-firing is
24
- * auditable — the persist validators remain unchanged hard gates
25
- * regardless of what this gate decides.
26
- *
27
- * Conditions (design §4 / §6 PR6):
28
- * - Consolidation: the existing deterministic precondition
29
- * (`evaluateConsolidationPrecondition`) says dispatch AND (the draft
30
- * has > 5 stories OR a confirmed divergence from the Tech Spec's
31
- * Delivery Slicing table). Skipped outright in the single-delivery
32
- * shape (no tickets exist to consolidate).
33
- * - Pre-mortem: risk verdict overall level is high, OR ticket count is
34
- * at least half `maxTickets`, OR any `planning.riskHeuristics` phrase
35
- * matches the plan text (case-insensitive substring over tech spec +
36
- * tickets + risk summary).
37
- *
38
- * Modes:
39
- * --epic <id> Artifact paths default to the per-Epic temp tree
40
- * (`temp/epic-<id>/techspec.md`, `risk-verdict.json`,
41
- * `tickets.json`); skip records land on the
42
- * per-Epic plan-metrics ledger.
43
- * explicit paths Ideation mode: pass --tech-spec/--risk-verdict
44
- * (and --tickets when fan-out) explicitly; skip
45
- * records land on the standalone ledger stream.
46
- *
47
- * Output (stdout-pure JSON):
48
- * { epicId, consolidation: { critic, dispatch, reasons },
49
- * premortem: { critic, dispatch, reasons } }
50
- *
51
- * Exit codes: 0 — verdict emitted (dispatch decisions are data, not
52
- * failures); 1 — fatal error (unreadable/invalid artifacts, bad args).
53
- */
54
-
55
- // Fail-fast if the framework's runtime deps are not installed — must be the
56
- // first import so the check runs before any third-party-importing sibling
57
- // module is evaluated (Story #3432).
58
- import './lib/runtime-deps/ensure-installed.js';
59
- import { readFile } from 'node:fs/promises';
60
- import { parseArgs } from 'node:util';
61
-
62
- import { runAsCli } from './lib/cli-utils.js';
63
- import { epicArtifactPath } from './lib/config/temp-paths.js';
64
- import {
65
- resolveConfig,
66
- validateOrchestrationConfig,
67
- } from './lib/config-resolver.js';
68
- import { routeAllOutputToStderr } from './lib/Logger.js';
69
- import { loadRiskVerdict } from './lib/orchestration/epic-plan-spec/phases/risk-verdict.js';
70
- import { evaluatePlanCritics } from './lib/orchestration/plan-critics-evaluate.js';
71
- import {
72
- appendCriticSkip,
73
- recordPlanInvocation,
74
- } from './lib/orchestration/plan-metrics.js';
75
-
76
- const USAGE =
77
- 'Usage: plan-critics.js (--epic <EpicId> | --tech-spec <file> ' +
78
- '--risk-verdict <file> [--tickets <file>]) [--pretty]';
79
-
80
- async function readOptional(filePath, { required }) {
81
- try {
82
- return await readFile(filePath, 'utf8');
83
- } catch (err) {
84
- if (!required && err?.code === 'ENOENT') return null;
85
- throw new Error(`Cannot read ${filePath}: ${err.message}`);
86
- }
87
- }
88
-
89
- async function main() {
90
- const { values } = parseArgs({
91
- options: {
92
- epic: { type: 'string' },
93
- 'tech-spec': { type: 'string' },
94
- 'risk-verdict': { type: 'string' },
95
- tickets: { type: 'string' },
96
- pretty: { type: 'boolean', default: false },
97
- },
98
- strict: true,
99
- });
100
-
101
- let epicId = null;
102
- if (values.epic !== undefined) {
103
- epicId = Number.parseInt(values.epic, 10);
104
- if (!Number.isInteger(epicId)) {
105
- throw new Error(
106
- `--epic must be a numeric issue id (got "${values.epic}").\n${USAGE}`,
107
- );
108
- }
109
- }
110
-
111
- // stdout is reserved for the JSON verdict — flip every Logger sink to
112
- // stderr before any pipeline code runs (same guarantee plan-context.js
113
- // gives its envelope).
114
- routeAllOutputToStderr();
115
-
116
- let config;
117
- try {
118
- config = resolveConfig();
119
- validateOrchestrationConfig(config);
120
- } catch (err) {
121
- throw new Error(`Config schema validation failed:\n${err.message}`);
122
- }
123
-
124
- const fallback = (basename) =>
125
- epicId === null ? undefined : epicArtifactPath(epicId, basename, config);
126
- const techSpecPath = values['tech-spec'] ?? fallback('techspec.md');
127
- const riskVerdictPath =
128
- values['risk-verdict'] ?? fallback('risk-verdict.json');
129
- const ticketsPath = values.tickets ?? fallback('tickets.json');
130
- if (!techSpecPath || !riskVerdictPath) {
131
- throw new Error(
132
- `Missing artifact path(s): without --epic, explicit --tech-spec and --risk-verdict are required.\n${USAGE}`,
133
- );
134
- }
135
-
136
- const verdict = await recordPlanInvocation(
137
- { cli: 'plan-critics', mode: 'evaluate', epicId, config },
138
- async () => {
139
- const techSpecContent = await readOptional(techSpecPath, {
140
- required: true,
141
- });
142
- const riskVerdict = loadRiskVerdict(riskVerdictPath);
143
- // Tickets are shape-dependent: a single-delivery plan authors none.
144
- // Required only when passed explicitly.
145
- const ticketsRaw = ticketsPath
146
- ? await readOptional(ticketsPath, {
147
- required: values.tickets !== undefined,
148
- })
149
- : null;
150
- let tickets = null;
151
- if (ticketsRaw !== null) {
152
- try {
153
- tickets = JSON.parse(ticketsRaw);
154
- } catch (err) {
155
- throw new Error(
156
- `Failed to parse tickets file "${ticketsPath}" as JSON: ${err.message}`,
157
- );
158
- }
159
- if (!Array.isArray(tickets)) {
160
- throw new Error(
161
- `Tickets file "${ticketsPath}" must contain a JSON array.`,
162
- );
163
- }
164
- }
165
-
166
- const { consolidation, premortem } = evaluatePlanCritics({
167
- techSpecContent,
168
- riskVerdict,
169
- tickets,
170
- config,
171
- });
172
-
173
- // Skip-audit trail (#4474 PR6): every non-dispatch is a ledger
174
- // record. Best-effort — a failed append never fails the gate.
175
- for (const decision of [consolidation, premortem]) {
176
- if (!decision.dispatch) {
177
- await appendCriticSkip(
178
- {
179
- critic: decision.critic,
180
- reasons: decision.reasons,
181
- cli: 'plan-critics',
182
- epicId,
183
- },
184
- config,
185
- );
186
- }
187
- }
188
-
189
- return { epicId, consolidation, premortem };
190
- },
191
- );
192
-
193
- const json = values.pretty
194
- ? JSON.stringify(verdict, null, 2)
195
- : JSON.stringify(verdict);
196
- process.stdout.write(`${json}\n`);
197
- }
198
-
199
- runAsCli(import.meta.url, main, { source: 'plan-critics' });
@@ -1,218 +0,0 @@
1
- #!/usr/bin/env node
2
- /* node:coverage ignore file */
3
-
4
- /**
5
- * retro-run.js — execute the `/deliver` Phase 6 retro from a CLI.
6
- *
7
- * Phase 6 of `/deliver` posts the Epic retro by invoking the
8
- * in-process retro module (`lib/orchestration/retro-runner.js`'s
9
- * `runRetro`). That module is a library entry point — it has no CLI
10
- * wrapper and hard-requires both a GitHub `provider` and a lifecycle
11
- * `bus` (Epic #2646 Story C made `bus` a non-optional input). Without a
12
- * wrapper the host LLM driving Phase 6 had to hand-improvise a bus, and
13
- * a bare bus with no `LedgerWriter` registered means `retro.start` /
14
- * `retro.end` never reach the Epic-scoped `lifecycle.ndjson` ledger.
15
- *
16
- * This CLI mirrors `epic-deliver-note-intervention.js`: it resolves the
17
- * config and provider, constructs a lifecycle bus with a `LedgerWriter`
18
- * bound to the Epic's temp tree, calls `runRetro`, and prints the result
19
- * envelope. `--full-retro` forces the six-section retro regardless of
20
- * manifest cleanliness (maps to `runRetro`'s `forceFull`).
21
- *
22
- * Usage:
23
- * node .agents/scripts/retro-run.js --epic <epicId> [--full-retro]
24
- *
25
- * Output: a single JSON envelope
26
- * `{ epicId, posted, compact, ledgerPath, commentId? }`.
27
- */
28
-
29
- import { parseArgs } from 'node:util';
30
-
31
- import { runAsCli } from './lib/cli-utils.js';
32
- import { tempRootFrom } from './lib/config/temp-paths.js';
33
- import { resolveConfig } from './lib/config-resolver.js';
34
- import { Logger } from './lib/Logger.js';
35
- import { createBus } from './lib/orchestration/lifecycle/bus.js';
36
- import { createLedgerWriter } from './lib/orchestration/lifecycle/ledger-writer.js';
37
- import { runRetro } from './lib/orchestration/retro-runner.js';
38
- import { createProvider } from './lib/provider-factory.js';
39
-
40
- /**
41
- * Pure: resolve the framework/consumer repo slugs (`"<owner>/<repo>"`)
42
- * from a resolved config's `github` block, for threading into the retro's
43
- * routed-proposal composer.
44
- *
45
- * - `consumerRepo` is the project's OWN repo (`github.owner/github.repo`).
46
- * It has **no** silent fallback: when `github.owner` / `github.repo` are
47
- * absent the slug is `''`, which `gatherRetroSignals` treats as "disable
48
- * the consumer pane loudly" rather than routing consumer-tagged friction
49
- * at the framework mirror (Story #4417).
50
- * - `frameworkRepo` is the distinct framework mirror
51
- * (`github.frameworkRepo.{owner,repo}`) when configured, otherwise `''`
52
- * — `gatherRetroSignals` then falls back to its `DEFAULT_FRAMEWORK_REPO`
53
- * constant (a stable, known default is legitimate for the framework).
54
- *
55
- * Exported for tests.
56
- *
57
- * @param {object} [config]
58
- * @returns {{ frameworkRepo: string, consumerRepo: string }}
59
- */
60
- export function resolveRetroRepos(config) {
61
- const gh = config?.github ?? {};
62
- const consumerRepo =
63
- typeof gh.owner === 'string' &&
64
- gh.owner.length > 0 &&
65
- typeof gh.repo === 'string' &&
66
- gh.repo.length > 0
67
- ? `${gh.owner}/${gh.repo}`
68
- : '';
69
- const fw = gh.frameworkRepo ?? {};
70
- const frameworkRepo =
71
- typeof fw.owner === 'string' &&
72
- fw.owner.length > 0 &&
73
- typeof fw.repo === 'string' &&
74
- fw.repo.length > 0
75
- ? `${fw.owner}/${fw.repo}`
76
- : '';
77
- return { frameworkRepo, consumerRepo };
78
- }
79
-
80
- const HELP = `Usage: node .agents/scripts/retro-run.js --epic <epicId> [--full-retro]
81
-
82
- Composes and posts the Epic retro structured comment for Epic #<epicId>,
83
- wiring a lifecycle bus + LedgerWriter so the run's \`retro.start\` /
84
- \`retro.end\` boundaries land in temp/epic-<epicId>/lifecycle.ndjson.
85
-
86
- --epic <epicId> Epic to run the retro for (required, positive integer).
87
- --full-retro Force the full six-section retro regardless of
88
- manifest cleanliness (maps to runRetro forceFull).
89
- `;
90
-
91
- /**
92
- * Pure: parse argv into the normalized option bag. Exported for tests.
93
- *
94
- * @param {string[]} argv
95
- * @returns {{ epicId: number|null, fullRetro: boolean, help: boolean }}
96
- */
97
- export function parseRetroRunArgs(argv) {
98
- const { values } = parseArgs({
99
- args: argv,
100
- options: {
101
- epic: { type: 'string' },
102
- 'full-retro': { type: 'boolean' },
103
- help: { type: 'boolean', short: 'h' },
104
- },
105
- strict: false,
106
- });
107
- const epicId = Number.parseInt(values.epic ?? '', 10);
108
- return {
109
- epicId: Number.isNaN(epicId) || epicId <= 0 ? null : epicId,
110
- fullRetro: values['full-retro'] === true,
111
- help: values.help === true,
112
- };
113
- }
114
-
115
- /**
116
- * Runner-shaped entry point. DI-friendly so tests can stub the provider,
117
- * the bus, the ledger writer, and `runRetro` without touching disk or the
118
- * GitHub API.
119
- *
120
- * Wires the lifecycle bus and registers a `LedgerWriter` bound to the
121
- * Epic's temp tree before invoking `runRetro`, so the run's
122
- * `retro.start` / `retro.end` boundaries persist to
123
- * `temp/epic-<epicId>/lifecycle.ndjson` rather than evaporating into a
124
- * bare bus.
125
- *
126
- * @param {{
127
- * epicId: number,
128
- * fullRetro?: boolean,
129
- * injectedConfig?: object,
130
- * injectedProvider?: object,
131
- * busFactory?: () => object,
132
- * ledgerFactory?: (deps: { epicId: number, tempRoot: string }) => { register: Function, ledgerPath?: string },
133
- * runRetroFn?: typeof runRetro,
134
- * logger?: { info?: Function, warn?: Function },
135
- * }} args
136
- * @returns {Promise<{
137
- * epicId: number,
138
- * posted: boolean,
139
- * compact: boolean,
140
- * ledgerPath: string|null,
141
- * commentId?: number,
142
- * }>}
143
- */
144
- export async function runRetroCli({
145
- epicId,
146
- fullRetro = false,
147
- injectedConfig,
148
- injectedProvider,
149
- busFactory,
150
- ledgerFactory,
151
- runRetroFn = runRetro,
152
- logger,
153
- } = {}) {
154
- if (!Number.isInteger(epicId) || epicId <= 0) {
155
- throw new TypeError('runRetroCli: epicId must be a positive integer');
156
- }
157
-
158
- const config = injectedConfig ?? resolveConfig();
159
- const provider = injectedProvider ?? createProvider(config);
160
- const bus = busFactory ? busFactory() : createBus();
161
-
162
- const tempRoot = tempRootFrom(config);
163
- const ledger = ledgerFactory
164
- ? ledgerFactory({ epicId, tempRoot })
165
- : createLedgerWriter({ epicId, tempRoot });
166
- ledger.register(bus);
167
-
168
- // Story #4417 — thread the framework/consumer repo slugs resolved from
169
- // `config.github` into the retro so the routed-proposal composer files
170
- // consumer-tagged friction at the project's own repo (not the framework
171
- // mirror), and disables the consumer pane loudly when unresolved.
172
- const { frameworkRepo, consumerRepo } = resolveRetroRepos(config);
173
-
174
- const result = await runRetroFn({
175
- epicId,
176
- provider,
177
- bus,
178
- forceFull: fullRetro,
179
- frameworkRepo,
180
- consumerRepo,
181
- // Story #4418 — thread the resolved config so the retro auto-filer can
182
- // read the `delivery.feedbackLoop.retroProposals` toggle.
183
- config,
184
- logger,
185
- });
186
-
187
- const envelope = {
188
- epicId,
189
- posted: result?.posted === true,
190
- compact: result?.compact === true,
191
- ledgerPath: ledger.ledgerPath ?? null,
192
- };
193
- if (Number.isInteger(result?.commentId)) {
194
- envelope.commentId = result.commentId;
195
- }
196
- return envelope;
197
- }
198
-
199
- async function main() {
200
- const args = parseRetroRunArgs(process.argv.slice(2));
201
- if (args.help) {
202
- Logger.info(HELP);
203
- return;
204
- }
205
- if (args.epicId === null) {
206
- Logger.error('[retro-run] ERROR: --epic <epicId> is required.');
207
- Logger.error(HELP);
208
- process.exit(2);
209
- }
210
- const out = await runRetroCli({
211
- epicId: args.epicId,
212
- fullRetro: args.fullRetro,
213
- logger: Logger,
214
- });
215
- Logger.info(JSON.stringify(out, null, 2));
216
- }
217
-
218
- runAsCli(import.meta.url, main, { source: 'retro-run' });
@@ -1,188 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * standalone-feedback-rollup.js — end-of-run feedback rollup for the
5
- * `/deliver` standalone multi-Story path (Epic #4406 / Story #4416).
6
- *
7
- * The standalone delivery path (`helpers/deliver-stories`) drives one or
8
- * more Epic-free Stories to green, and each per-Story sub-agent appends
9
- * `friction` records to its **standalone** signals stream at
10
- * `temp/standalone/stories/story-<sid>/signals.ndjson` (written via
11
- * `appendSignal({ epicId: null, storyId })`). Before this rollup that
12
- * tree was write-only — nothing ever read it back. This CLI closes the
13
- * gap: it scans the standalone streams for the delivered Story set and
14
- * emits a per-category friction summary that `deliver-stories.md`
15
- * surfaces in its Phase 3 run summary.
16
- *
17
- * Usage:
18
- * node standalone-feedback-rollup.js --stories <id,...>
19
- *
20
- * Contract:
21
- * - Stream paths resolve **exclusively** through the `temp-paths`
22
- * helpers via `forEachLine(null, storyId, cb, config)` — the `null`
23
- * Epic sentinel routes to the standalone tree. No hand-built path
24
- * strings.
25
- * - Aggregates `friction` records by their **top-level** `category`
26
- * (Epic #4406 canonical envelope shape); a record with no category
27
- * buckets under `Unknown`.
28
- * - **Never fails a run.** A missing or empty stream degrades to an
29
- * empty contribution; the CLI always prints a JSON summary and
30
- * exits 0. Observability MUST NOT take down the delivering flow.
31
- *
32
- * Output (stdout, one JSON object):
33
- * {
34
- * "kind": "standalone-feedback-rollup",
35
- * "stories": [<id>, ...],
36
- * "totalFriction": <int>,
37
- * "byCategory": { "<category>": <count>, ... },
38
- * "perStory": { "<id>": { "friction": <int>, "missing": <bool> }, ... }
39
- * }
40
- *
41
- * @see .agents/scripts/lib/observability/signals-writer.js (forEachLine, appendSignal)
42
- * @see .agents/scripts/lib/config/temp-paths.js (signalsFile — null Epic sentinel)
43
- * @see .agents/workflows/helpers/deliver-stories.md (Phase 3 summary wiring)
44
- */
45
-
46
- import { runAsCli } from './lib/cli-utils.js';
47
- import { resolveConfig } from './lib/config-resolver.js';
48
- import { forEachLine } from './lib/observability/signals-writer.js';
49
-
50
- const FRICTION_KIND = 'friction';
51
- const UNKNOWN_CATEGORY = 'Unknown';
52
-
53
- /**
54
- * Parse `--stories <id,...>` into an ordered, de-duplicated array of
55
- * positive-integer Story IDs. Accepts a single comma-separated value or
56
- * repeated `--stories` flags. Non-integer / non-positive tokens are
57
- * rejected so a typo surfaces as an input error rather than a silently
58
- * empty rollup.
59
- *
60
- * @param {string[]} args
61
- * @returns {{ stories: number[] }}
62
- */
63
- export function parseArguments(args) {
64
- const raw = [];
65
- for (let i = 0; i < args.length; i++) {
66
- if (args[i] === '--stories') {
67
- const value = args[++i];
68
- if (typeof value === 'string') {
69
- raw.push(...value.split(','));
70
- }
71
- }
72
- }
73
-
74
- const seen = new Set();
75
- const stories = [];
76
- for (const token of raw) {
77
- const trimmed = token.trim();
78
- if (trimmed.length === 0) continue;
79
- const id = Number(trimmed);
80
- if (!Number.isInteger(id) || id <= 0) {
81
- throw new Error(
82
- `--stories expects comma-separated positive integers; got ${JSON.stringify(trimmed)}`,
83
- );
84
- }
85
- if (seen.has(id)) continue;
86
- seen.add(id);
87
- stories.push(id);
88
- }
89
-
90
- if (stories.length === 0) {
91
- throw new Error(
92
- 'Usage: node standalone-feedback-rollup.js --stories <id,...>',
93
- );
94
- }
95
-
96
- return { stories };
97
- }
98
-
99
- /**
100
- * Read one standalone Story's signals stream and aggregate its `friction`
101
- * records by top-level `category`, mutating the shared `byCategory` tally.
102
- *
103
- * Degrades to a zero contribution on a missing / empty / unreadable
104
- * stream — `forEachLine` already swallows fs + JSON faults and reports a
105
- * missing file via `{ missing: true }` rather than throwing.
106
- *
107
- * @param {number} storyId
108
- * @param {Record<string, number>} byCategory Mutated in place.
109
- * @param {object} config
110
- * @returns {Promise<{ friction: number, missing: boolean }>}
111
- */
112
- async function rollupStory(storyId, byCategory, config) {
113
- let friction = 0;
114
- // `epicId: null` routes forEachLine → signalsFile(null, storyId, config)
115
- // → the standalone tree. Never a hand-built path string.
116
- const result = await forEachLine(
117
- null,
118
- storyId,
119
- (record) => {
120
- if (
121
- record === null ||
122
- typeof record !== 'object' ||
123
- record.kind !== FRICTION_KIND
124
- ) {
125
- return;
126
- }
127
- const category =
128
- typeof record.category === 'string' && record.category.length > 0
129
- ? record.category
130
- : UNKNOWN_CATEGORY;
131
- byCategory[category] = (byCategory[category] ?? 0) + 1;
132
- friction += 1;
133
- },
134
- config,
135
- );
136
-
137
- return { friction, missing: Boolean(result?.missing) };
138
- }
139
-
140
- /**
141
- * Aggregate friction across every named standalone Story stream.
142
- *
143
- * @param {number[]} stories
144
- * @param {object} [config]
145
- * @returns {Promise<{
146
- * kind: string,
147
- * stories: number[],
148
- * totalFriction: number,
149
- * byCategory: Record<string, number>,
150
- * perStory: Record<string, { friction: number, missing: boolean }>,
151
- * }>}
152
- */
153
- export async function buildRollup(stories, config) {
154
- const byCategory = {};
155
- const perStory = {};
156
- let totalFriction = 0;
157
-
158
- for (const storyId of stories) {
159
- const { friction, missing } = await rollupStory(
160
- storyId,
161
- byCategory,
162
- config,
163
- );
164
- perStory[storyId] = { friction, missing };
165
- totalFriction += friction;
166
- }
167
-
168
- return {
169
- kind: 'standalone-feedback-rollup',
170
- stories,
171
- totalFriction,
172
- byCategory,
173
- perStory,
174
- };
175
- }
176
-
177
- export async function main(args = process.argv.slice(2)) {
178
- const { stories } = parseArguments(args);
179
- const config = resolveConfig();
180
- const summary = await buildRollup(stories, config);
181
- process.stdout.write(`${JSON.stringify(summary, null, 2)}\n`);
182
- return 0;
183
- }
184
-
185
- runAsCli(import.meta.url, main, {
186
- source: 'StandaloneFeedbackRollup',
187
- propagateExitCode: true,
188
- });