@v11g/agents-rock 1.0.9 → 1.0.10

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 (246) hide show
  1. package/README.md +1 -0
  2. package/package.json +2 -2
  3. package/plugins/business-analyst/.claude-plugin/plugin.json +1 -1
  4. package/plugins/business-analyst/evals/ba-interview-conflict/graders/conflict-quoted.md +15 -0
  5. package/plugins/business-analyst/evals/ba-interview-conflict/graders/no-internal-ids.md +9 -0
  6. package/plugins/business-analyst/evals/ba-interview-conflict/graders/one-question.md +15 -0
  7. package/plugins/business-analyst/evals/ba-interview-conflict/graders/skill-fired.md +7 -0
  8. package/plugins/business-analyst/evals/ba-interview-conflict/prompt.md +31 -0
  9. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-internal-ids.md +9 -0
  10. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-setup-questions.md +16 -0
  11. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/one-scope-question.md +19 -0
  12. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/skill-fired.md +7 -0
  13. package/plugins/business-analyst/evals/ba-interview-first-turn/prompt.md +31 -0
  14. package/plugins/business-analyst/evals/ba-review-page/case.yaml +4 -0
  15. package/plugins/business-analyst/evals/ba-review-page/fixture.sh +12 -0
  16. package/plugins/business-analyst/evals/ba-review-page/graders/decide-in-interview.md +26 -0
  17. package/plugins/business-analyst/evals/ba-review-page/graders/skill-fired.md +7 -0
  18. package/plugins/business-analyst/evals/ba-review-page/prompt.md +9 -0
  19. package/plugins/business-analyst/skills/business-analyst/README.md +8 -0
  20. package/plugins/business-analyst/skills/business-analyst/SKILL.md +47 -16
  21. package/plugins/business-analyst/skills/business-analyst/assets/review-page.html +68 -0
  22. package/plugins/business-analyst/skills/business-analyst/evals/evals.json +1 -1
  23. package/plugins/business-analyst/skills/business-analyst/references/frameworks.md +3 -2
  24. package/plugins/business-analyst/skills/business-analyst/references/interview.md +156 -8
  25. package/plugins/business-analyst/skills/business-analyst/references/review.md +18 -4
  26. package/plugins/business-analyst/skills/business-analyst/references/writing.md +49 -8
  27. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
  28. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
  29. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
  30. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
  31. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
  32. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
  33. package/plugins/business-analyst/skills/business-analyst/scripts/lib/checks.mjs +12 -6
  34. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-data.mjs +66 -0
  35. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-layout.mjs +53 -0
  36. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-page.mjs +78 -0
  37. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-checks.mjs +73 -0
  38. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-md.mjs +53 -0
  39. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-render.mjs +72 -0
  40. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-rules.mjs +90 -0
  41. package/plugins/business-analyst/skills/business-analyst/scripts/review.mjs +48 -0
  42. package/plugins/business-analyst/skills/business-analyst/scripts/review.py +60 -0
  43. package/plugins/business-analyst/skills/business-analyst/scripts/review_data.py +81 -0
  44. package/plugins/business-analyst/skills/business-analyst/scripts/review_layout.py +50 -0
  45. package/plugins/business-analyst/skills/business-analyst/scripts/review_page.py +115 -0
  46. package/plugins/business-analyst/skills/business-analyst/scripts/scope.mjs +24 -0
  47. package/plugins/business-analyst/skills/business-analyst/scripts/scope.py +35 -0
  48. package/plugins/business-analyst/skills/business-analyst/scripts/scope_checks.py +168 -0
  49. package/plugins/business-analyst/skills/business-analyst/scripts/scope_render.py +140 -0
  50. package/plugins/business-analyst/skills/business-analyst/scripts/test/checks.test.mjs +27 -0
  51. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.json +78 -0
  52. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.md +136 -0
  53. package/plugins/business-analyst/skills/business-analyst/scripts/test/python-parity.test.mjs +88 -0
  54. package/plugins/business-analyst/skills/business-analyst/scripts/test/quality-gates.test.mjs +26 -0
  55. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-browser.test.mjs +106 -0
  56. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-fixture.mjs +32 -0
  57. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-page.test.mjs +340 -0
  58. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-parity.test.mjs +79 -0
  59. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-cases.mjs +58 -0
  60. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-checks.test.mjs +31 -0
  61. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-md.test.mjs +140 -0
  62. package/plugins/business-analyst/skills/business-analyst/scripts/validate.mjs +1 -1
  63. package/plugins/business-analyst/skills/business-analyst/scripts/validate.py +17 -8
  64. package/plugins/solution-architect/evals/proposal-workflow/case.yaml +6 -0
  65. package/plugins/solution-architect/evals/proposal-workflow/fixture.sh +6 -0
  66. package/plugins/solution-architect/evals/proposal-workflow/graders/inputs-written.md +23 -0
  67. package/plugins/solution-architect/evals/proposal-workflow/graders/no-proposal-md.md +7 -0
  68. package/plugins/solution-architect/evals/proposal-workflow/graders/skill-fired.md +7 -0
  69. package/plugins/solution-architect/evals/proposal-workflow/graders/validate-then-render.md +16 -0
  70. package/plugins/solution-architect/evals/proposal-workflow/prompt.md +10 -0
  71. package/plugins/solution-architect/evals/workflow-gate-no-architecture/case.yaml +4 -0
  72. package/plugins/solution-architect/evals/workflow-gate-no-architecture/fixture.sh +6 -0
  73. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/no-classic-fallback.md +10 -0
  74. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/nothing-written.md +7 -0
  75. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/skill-fired.md +7 -0
  76. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/stops-at-gate.md +11 -0
  77. package/plugins/solution-architect/evals/workflow-gate-no-architecture/prompt.md +7 -0
  78. package/plugins/solution-architect/evals/workflow-happy-path/case.yaml +4 -0
  79. package/plugins/solution-architect/evals/workflow-happy-path/fixture.sh +6 -0
  80. package/plugins/solution-architect/evals/workflow-happy-path/graders/no-estimation-md.md +7 -0
  81. package/plugins/solution-architect/evals/workflow-happy-path/graders/pages-or-stop.md +16 -0
  82. package/plugins/solution-architect/evals/workflow-happy-path/graders/routed-to-workflow.md +12 -0
  83. package/plugins/solution-architect/evals/workflow-happy-path/graders/skill-fired.md +7 -0
  84. package/plugins/solution-architect/evals/workflow-happy-path/graders/three-questions-max.md +14 -0
  85. package/plugins/solution-architect/evals/workflow-happy-path/graders/workflow-or-exact-stop.md +15 -0
  86. package/plugins/solution-architect/evals/workflow-happy-path/prompt.md +9 -0
  87. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +11 -1
  88. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +27 -0
  89. package/plugins/solution-architect/skills/estimate/README.md +18 -3
  90. package/plugins/solution-architect/skills/estimate/SKILL.md +18 -75
  91. package/plugins/solution-architect/skills/estimate/classic/FLOW.md +77 -0
  92. package/plugins/solution-architect/skills/estimate/classic/assets/estimate-template.html +1337 -0
  93. package/plugins/solution-architect/skills/estimate/{references → classic/references}/task-shapes.md +1 -1
  94. package/plugins/solution-architect/skills/estimate/{references → classic/references}/writing.md +2 -2
  95. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/compute.mjs +1 -1
  96. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/checks.mjs +1 -1
  97. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/roadmap.mjs +1 -1
  98. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/rollup.mjs +5 -5
  99. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/schema.mjs +4 -26
  100. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-csv.mjs +2 -2
  101. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-html.mjs +2 -2
  102. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/render.mjs +8 -7
  103. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/score-review.mjs +3 -3
  104. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/baselines.test.mjs +3 -3
  105. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser-agentic.test.mjs +2 -2
  106. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser.test.mjs +2 -2
  107. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/compute.test.mjs +1 -1
  108. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/e2e.test.mjs +6 -6
  109. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/estimate-math.test.mjs +3 -3
  110. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/measurements.test.mjs +1 -1
  111. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/pricing.test.mjs +1 -1
  112. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/project-price.test.mjs +1 -1
  113. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/quality-gates.test.mjs +7 -1
  114. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/references.test.mjs +6 -6
  115. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/render.test.mjs +3 -3
  116. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/schema.test.mjs +1 -1
  117. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/score-review.test.mjs +6 -6
  118. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/scoring.test.mjs +1 -1
  119. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/url-state.test.mjs +2 -2
  120. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/validate.test.mjs +1 -1
  121. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/xlsx-export.test.mjs +3 -3
  122. package/plugins/solution-architect/skills/estimate/classic/scripts/test/zip-store.test.mjs +26 -0
  123. package/plugins/solution-architect/skills/estimate/evals/evals.json +37 -2
  124. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +28 -0
  125. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  126. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.md +141 -0
  127. package/plugins/solution-architect/skills/estimate/shared/assets/xlsx-export.js +336 -0
  128. package/plugins/solution-architect/skills/estimate/shared/lib/agentic-task-schema.mjs +24 -0
  129. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/context-schema.mjs +2 -2
  130. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/inline.mjs +8 -0
  131. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring-schema.mjs +1 -1
  132. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring.mjs +1 -1
  133. package/plugins/solution-architect/skills/estimate/shared/lib/zip.mjs +60 -0
  134. package/plugins/solution-architect/skills/estimate/workflow-based/FLOW.md +91 -0
  135. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-components.html +994 -0
  136. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-template.html +440 -0
  137. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimator-system.xlsx +0 -0
  138. package/plugins/solution-architect/skills/estimate/workflow-based/assets/score-review.html +838 -0
  139. package/plugins/solution-architect/skills/estimate/workflow-based/references/hidden-work-by-type.md +429 -0
  140. package/plugins/solution-architect/skills/estimate/workflow-based/references/linking.md +59 -0
  141. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +80 -0
  142. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-template.mjs +60 -0
  143. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-workflow-template.mjs +51 -0
  144. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-xlsx-template.py +144 -0
  145. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/compute.mjs +32 -0
  146. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +44 -0
  147. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-view.mjs +71 -0
  148. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/pair-findings.mjs +19 -0
  149. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/requirements.mjs +33 -0
  150. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/rollup.mjs +66 -0
  151. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +69 -0
  152. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema.mjs +70 -0
  153. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-diff.mjs +54 -0
  154. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-html.mjs +52 -0
  155. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +51 -0
  156. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/render.mjs +42 -0
  157. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/score-review.mjs +46 -0
  158. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/arch-link.js +9 -0
  159. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/click.js +28 -0
  160. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/prelude.js +4 -0
  161. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/view.js +63 -0
  162. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/browser.test.mjs +127 -0
  163. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-pages.test.mjs +43 -0
  164. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-template.test.mjs +18 -0
  165. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/cli.test.mjs +48 -0
  166. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/estimator-system.test.mjs +66 -0
  167. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/ARCHITECTURE-mini.md +31 -0
  168. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/feedback.json +19 -0
  169. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +80 -0
  170. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/measurements.jsonl +0 -0
  171. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/requirements.json +79 -0
  172. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/page-view.test.mjs +54 -0
  173. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/pages-browser.test.mjs +209 -0
  174. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/quality-gates.test.mjs +25 -0
  175. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/render.test.mjs +54 -0
  176. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/requirements.test.mjs +33 -0
  177. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +80 -0
  178. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/schema.test.mjs +61 -0
  179. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/score-review.test.mjs +108 -0
  180. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/stage.mjs +32 -0
  181. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/workflow-script.test.mjs +24 -0
  182. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +58 -0
  183. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/validate.mjs +19 -0
  184. package/plugins/solution-architect/skills/proposal/README.md +13 -0
  185. package/plugins/solution-architect/skills/proposal/SKILL.md +8 -0
  186. package/plugins/solution-architect/skills/proposal/assets/proposal-workflow.html +143 -0
  187. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +31 -0
  188. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +468 -0
  189. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +773 -0
  190. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/measurements.jsonl +0 -0
  191. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  192. package/plugins/solution-architect/skills/proposal/references/review.md +11 -0
  193. package/plugins/solution-architect/skills/proposal/references/workflow.md +88 -0
  194. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-body.mjs +42 -0
  195. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-package.mjs +56 -0
  196. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-xml.mjs +44 -0
  197. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-checks.mjs +71 -0
  198. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-cli.mjs +46 -0
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-html.mjs +39 -0
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-lead.mjs +45 -0
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-page.mjs +30 -0
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-view.mjs +80 -0
  203. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +5 -1
  204. package/plugins/solution-architect/skills/proposal/scripts/test/docx.test.mjs +68 -0
  205. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +2 -2
  206. package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +9 -2
  207. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-inputs-pass.json +17 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +2 -2
  209. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +2 -2
  210. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-browser.test.mjs +96 -0
  211. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-checks.test.mjs +98 -0
  212. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-docs.test.mjs +25 -0
  213. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-render.test.mjs +75 -0
  214. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-stage.mjs +15 -0
  215. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-view.test.mjs +78 -0
  216. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +4 -1
  217. package/plugins/solution-architect/workflows/review-links.js +61 -0
  218. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +0 -1677
  219. /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/estimate-template-agentic.html +0 -0
  220. /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/scores-review-template.html +0 -0
  221. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/agentic-estimation.md +0 -0
  222. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/ai-multipliers.md +0 -0
  223. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/interview.md +0 -0
  224. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/scoring-guide.md +0 -0
  225. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/slicing.md +0 -0
  226. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/techniques.md +0 -0
  227. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/agentic-checks.mjs +0 -0
  228. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/components.mjs +0 -0
  229. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/md-tables.mjs +0 -0
  230. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/redact.mjs +0 -0
  231. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/scoring-checks.mjs +0 -0
  232. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-fail.md +0 -0
  233. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-pass.md +0 -0
  234. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-inputs.json +0 -0
  235. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/booking-inputs.json +0 -0
  236. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-fail.md +0 -0
  237. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-pass.md +0 -0
  238. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/measurements.jsonl +0 -0
  239. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/zip.mjs +0 -0
  240. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/validate.mjs +0 -0
  241. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/baselines.mjs +0 -0
  242. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/estimate-math.mjs +0 -0
  243. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/measurements.mjs +0 -0
  244. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/pricing.mjs +0 -0
  245. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/project-price.mjs +0 -0
  246. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/score-diff.mjs +0 -0
@@ -5,6 +5,7 @@ import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
5
5
  import { tmpdir } from 'node:os';
6
6
  import { join } from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
+ import { CASES, loadWorkflow, noFlows } from './scope-cases.mjs';
8
9
 
9
10
  const py = fileURLToPath(new URL('../validate.py', import.meta.url));
10
11
  const js = fileURLToPath(new URL('../validate.mjs', import.meta.url));
@@ -48,3 +49,90 @@ test('python and node agree on a mutated package (status + blocker + md sync)',
48
49
  assert.equal(p.code, 1);
49
50
  assert.equal(p.err.trim(), n.err.trim());
50
51
  });
52
+
53
+ const pyScope = fileURLToPath(new URL('../scope.py', import.meta.url));
54
+ const jsScope = fileURLToPath(new URL('../scope.mjs', import.meta.url));
55
+
56
+ function writePair(pkg, md) {
57
+ const dir = mkdtempSync(join(tmpdir(), 'ba-parity-'));
58
+ const jsonPath = join(dir, 'requirements.json');
59
+ const mdPath = join(dir, 'requirements.md');
60
+ writeFileSync(jsonPath, JSON.stringify(pkg));
61
+ writeFileSync(mdPath, md);
62
+ return { jsonPath, mdPath };
63
+ }
64
+
65
+ test('python validator accepts the workflow pass pair like node', () => {
66
+ const p = run('python3', py, fx('requirements-workflow-pass.json'), fx('requirements-workflow-pass.md'));
67
+ assert.equal(p.code, 0);
68
+ });
69
+
70
+ for (const c of CASES) {
71
+ test(`python and node agree on scope rule: ${c.name}`, () => {
72
+ const { pkg, md } = c.edit(loadWorkflow());
73
+ const { jsonPath, mdPath } = writePair(pkg, md);
74
+ const n = run('node', js, jsonPath, mdPath);
75
+ const p = run('python3', py, jsonPath, mdPath);
76
+ assert.equal(n.code, 1);
77
+ assert.equal(p.code, 1);
78
+ assert.equal(p.err.trim(), n.err.trim());
79
+ });
80
+ }
81
+
82
+ test('scope.py writes the same bytes as scope.mjs', () => {
83
+ const { pkg, md } = loadWorkflow();
84
+ const bare = md.replace(/<!-- scope:start -->[\s\S]*?<!-- scope:end -->\n*/, '');
85
+ const a = writePair(pkg, bare);
86
+ const b = writePair(pkg, bare);
87
+ assert.equal(run('node', jsScope, a.jsonPath, a.mdPath).code, 0);
88
+ assert.equal(run('python3', pyScope, b.jsonPath, b.mdPath).code, 0);
89
+ assert.equal(readFileSync(b.mdPath, 'utf8'), readFileSync(a.mdPath, 'utf8'));
90
+ assert.equal(readFileSync(a.mdPath, 'utf8'), md);
91
+ });
92
+
93
+ test('scope.py and scope.mjs agree on escaped pipes and a colon step', () => {
94
+ const { pkg, md } = loadWorkflow();
95
+ pkg.features[0].does = 'Moves an order | shows each stage';
96
+ pkg.workflows[1].steps[1] = 'Pack: scan';
97
+ pkg.workflows[1].branches = [{ from: 'Pack: scan', to: 'Short-pack alert' }];
98
+ pkg.features[0].steps[1] = 'WF-002:Pack: scan';
99
+ const a = writePair(pkg, md);
100
+ const b = writePair(pkg, md);
101
+ assert.equal(run('node', jsScope, a.jsonPath, a.mdPath).code, 0);
102
+ assert.equal(run('python3', pyScope, b.jsonPath, b.mdPath).code, 0);
103
+ assert.equal(readFileSync(b.mdPath, 'utf8'), readFileSync(a.mdPath, 'utf8'));
104
+ });
105
+
106
+ function exec(cmd, args) {
107
+ try {
108
+ return { code: 0, out: execFileSync(cmd, args, { encoding: 'utf8' }), err: '' };
109
+ } catch (e) {
110
+ return { code: e.status, out: e.stdout ?? '', err: e.stderr ?? '' };
111
+ }
112
+ }
113
+
114
+ test('validate.py --json without --md matches node', () => {
115
+ const { jsonPath } = writePair(loadWorkflow().pkg, '');
116
+ assert.deepEqual(exec('python3', [py, '--json', jsonPath]), exec('node', [js, '--json', jsonPath]));
117
+ });
118
+
119
+ test('scope.py and validate.py agree with node on a system with no workflow', () => {
120
+ const { pkg, md } = noFlows();
121
+ const bare = md.replace(/<!-- scope:start -->[\s\S]*?<!-- scope:end -->\n*/, '');
122
+ const a = writePair(pkg, bare);
123
+ const b = writePair(pkg, bare);
124
+ assert.equal(run('node', jsScope, a.jsonPath, a.mdPath).code, 0);
125
+ assert.equal(run('python3', pyScope, b.jsonPath, b.mdPath).code, 0);
126
+ assert.equal(readFileSync(b.mdPath, 'utf8'), readFileSync(a.mdPath, 'utf8'));
127
+ assert.deepEqual(exec('python3', [py, '--json', a.jsonPath]), exec('node', [js, '--json', a.jsonPath]));
128
+ });
129
+
130
+ test('scope.py and scope.mjs agree on a system with no workflows key', () => {
131
+ const { pkg, md } = noFlows();
132
+ delete pkg.systems[1].workflows;
133
+ const a = writePair(pkg, md);
134
+ const b = writePair(pkg, md);
135
+ assert.equal(run('node', jsScope, a.jsonPath, a.mdPath).code, 0);
136
+ assert.equal(run('python3', pyScope, b.jsonPath, b.mdPath).code, 0);
137
+ assert.equal(readFileSync(b.mdPath, 'utf8'), readFileSync(a.mdPath, 'utf8'));
138
+ });
@@ -0,0 +1,26 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { readFileSync } from 'node:fs';
4
+ import {
5
+ TEMPLATE_LIMITS, templateScripts, violations,
6
+ } from '../../../../../solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs';
7
+
8
+ // The review page's modules. checks.mjs predates the gates and is over them;
9
+ // it is not listed, and this work only shrinks it.
10
+ const MODULES = [
11
+ 'scripts/review.mjs', 'scripts/lib/review-data.mjs',
12
+ 'scripts/lib/review-page.mjs', 'scripts/lib/review-layout.mjs', 'scripts/lib/scope-render.mjs',
13
+ ];
14
+ const base = new URL('../..', import.meta.url).pathname;
15
+
16
+ for (const file of MODULES) {
17
+ test(`gates: ${file}`, () => {
18
+ assert.deepEqual(violations(readFileSync(base + file, 'utf8')), []);
19
+ });
20
+ }
21
+
22
+ for (const { file, js } of templateScripts(base)) {
23
+ test(`gates: ${file.replace(base, '')}`, () => {
24
+ assert.deepEqual(violations(js, TEMPLATE_LIMITS), []);
25
+ });
26
+ }
@@ -0,0 +1,106 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { mkdtempSync, writeFileSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { join } from 'node:path';
6
+ import { pathToFileURL } from 'node:url';
7
+ import { findChrome } from '../../../../../solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs';
8
+ import { openPage } from '../../../../../solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs';
9
+ import { pageHtml } from '../lib/review-page.mjs';
10
+ import { DATE, decided } from './review-fixture.mjs';
11
+
12
+ const skip = { skip: !findChrome() && 'no chrome on PATH' };
13
+
14
+ function open(pkg) {
15
+ const file = join(mkdtempSync(join(tmpdir(), 'ba-review-browser-')), 'review.html');
16
+ writeFileSync(file, pageHtml(pkg, DATE));
17
+ return openPage(pathToFileURL(file).href);
18
+ }
19
+
20
+ test('the page draws with no script, no controls and no ids', skip, async () => {
21
+ const page = await open(decided());
22
+ try {
23
+ assert.deepEqual(page.errors, []);
24
+ assert.equal(await page.eval(`document.querySelectorAll('script, button, input, textarea, select').length`), 0);
25
+ assert.equal(await page.eval(`/\\b(?:SYS|WF|FEAT|FR|BR|Q|ASM)-\\d{3}\\b/.test(document.body.innerText)`), false);
26
+ assert.equal(await page.eval(`document.querySelectorAll('tr.new, li.new').length`), 2);
27
+ assert.equal(await page.eval(`document.querySelectorAll('.flow').length`), 3);
28
+ } finally { page.close(); }
29
+ });
30
+
31
+ test('markup in a name shows as text, never as html', skip, async () => {
32
+ const pkg = decided();
33
+ pkg.features[0].name = 'Order <b>pipeline</b> & "stage"';
34
+ const page = await open(pkg);
35
+ try {
36
+ assert.equal(await page.eval(`document.querySelector('td').textContent`), 'Order <b>pipeline</b> & "stage"');
37
+ assert.equal(await page.eval(`document.querySelectorAll('td b').length`), 0);
38
+ } finally { page.close(); }
39
+ });
40
+
41
+ test('a side branch sits under the step it leaves', skip, async () => {
42
+ const page = await open(decided());
43
+ const mid = (t) => `(() => { const e = [...document.querySelectorAll('.step')].find((x) => x.textContent === ${JSON.stringify(t)}); const r = e.getBoundingClientRect(); return r.left + r.width / 2; })()`;
44
+ try {
45
+ assert.ok(Math.abs(await page.eval(mid('Short-pack alert')) - await page.eval(mid('Pack'))) <= 1);
46
+ assert.ok(Math.abs(await page.eval(mid('↺ back to Pack')) - await page.eval(mid('Pack Review'))) <= 1);
47
+ } finally { page.close(); }
48
+ });
49
+
50
+ test('a step box fills its column, so arrows stay next to it', skip, async () => {
51
+ const page = await open(decided());
52
+ const box = (t) => `[...document.querySelectorAll('.step')].find((x) => x.textContent === ${JSON.stringify(t)}).getBoundingClientRect()`;
53
+ const arrow = `document.querySelector('.arrow').getBoundingClientRect()`;
54
+ try {
55
+ assert.ok(Math.abs(await page.eval(`${box('Order In')}.right - ${arrow}.left`)) <= 1);
56
+ assert.ok(Math.abs(await page.eval(`${arrow}.right - ${box('Pack')}.left`)) <= 1);
57
+ } finally { page.close(); }
58
+ });
59
+
60
+ test('main-row arrows and branch connectors are drawn the same way', skip, async () => {
61
+ const page = await open(decided());
62
+ const css = (sel, pseudo, prop) => `getComputedStyle(document.querySelector(${JSON.stringify(sel)}), ${JSON.stringify(pseudo)}).${prop}`;
63
+ try {
64
+ const px = (sel, pseudo, prop) => page.eval(css(sel, pseudo, prop));
65
+ assert.equal(await px('.arrow', '::before', 'height'), '1px');
66
+ assert.equal(await px('.down', '::before', 'width'), '1px');
67
+ const dotted = await px('.down', '::before', 'backgroundImage');
68
+ assert.ok(dotted.includes(await px('.arrow', '::before', 'backgroundColor')));
69
+ assert.ok(dotted.includes('repeating-linear-gradient'));
70
+ assert.equal(await px('.arrow', '::after', 'borderLeftColor'), await px('.down', '::after', 'borderTopColor'));
71
+ assert.equal(await px('.arrow', '::after', 'borderLeftWidth'), '7px');
72
+ assert.equal(await px('.down', '::after', 'borderTopWidth'), '7px');
73
+ assert.equal(await page.eval(`document.querySelector('.arrow').getBoundingClientRect().height < 20`), true);
74
+ } finally { page.close(); }
75
+ });
76
+
77
+ test('two branches from one step sit side by side under it; labels stay in their column', skip, async () => {
78
+ const pkg = decided();
79
+ const flow = pkg.workflows.find((w) => w.name === 'Order pipeline');
80
+ flow.branches[0].label = 'cannot fulfil the whole order from stock';
81
+ flow.branches.push({ from: 'Pack', to: 'Extra box', label: 'customer asked for one more box' });
82
+ const page = await open(pkg);
83
+ const rect = (sel, t) => `(() => { const r = [...document.querySelectorAll(${JSON.stringify(sel)})].find((x) => x.textContent === ${JSON.stringify(t)}).getBoundingClientRect(); return { l: r.left, r: r.right, t: r.top, b: r.bottom }; })()`;
84
+ const hit = (a, b) => a.l < b.r && b.l < a.r && a.t < b.b && b.t < a.b;
85
+ try {
86
+ const [pack, one, two] = [await page.eval(rect('.step', 'Pack')), await page.eval(rect('.step', 'Short-pack alert')), await page.eval(rect('.step', 'Extra box'))];
87
+ const [l1, l2] = [await page.eval(rect('.lbl', flow.branches[0].label)), await page.eval(rect('.lbl', 'customer asked for one more box'))];
88
+ assert.ok(Math.abs(one.t - two.t) <= 1, 'siblings share a row');
89
+ assert.ok(!hit(one, two) && !hit(l1, l2) && !hit(l1, two) && !hit(l2, one));
90
+ for (const s of [one, two]) assert.ok((s.l + s.r) / 2 >= pack.l && (s.l + s.r) / 2 <= pack.r);
91
+ } finally { page.close(); }
92
+ });
93
+
94
+ test('a main step fills a column widened by a long branch box, so no arrow has a gap', skip, async () => {
95
+ const pkg = decided();
96
+ const flow = pkg.workflows.find((w) => w.name === 'Order pipeline');
97
+ flow.branches.push({ from: 'Order In', to: 'Escalate to the duty manager for a manual decision', label: 'unclear' });
98
+ const page = await open(pkg);
99
+ const gaps = `(() => { const g = document.querySelector('.grid'); const out = [];
100
+ for (const a of g.querySelectorAll('.arrow')) { const p = a.previousElementSibling.getBoundingClientRect(); const n = a.nextElementSibling.getBoundingClientRect(); const r = a.getBoundingClientRect(); out.push(Math.max(Math.abs(p.right - r.left), Math.abs(r.right - n.left))); }
101
+ return out; })()`;
102
+ try {
103
+ const found = await page.eval(gaps);
104
+ assert.ok(found.length > 0 && found.every((d) => d <= 1), `gaps: ${found}`);
105
+ } finally { page.close(); }
106
+ });
@@ -0,0 +1,32 @@
1
+ // Review-state fixtures built from the workflow pass pair, so no reviewed
2
+ // JSON is committed that could drift from the pass fixture.
3
+ import { loadWorkflow } from './scope-cases.mjs';
4
+
5
+ export const DATE = '2026-10-07';
6
+
7
+ // The pass package once the interview settled it: one feature and one
8
+ // assumption added by the PO.
9
+ export function decided() {
10
+ const { pkg } = loadWorkflow();
11
+ Object.assign(pkg.features[3], { label: 'confirmed', source: `PO in interview, ${DATE}` });
12
+ pkg.assumptions.push({
13
+ id: 'ASM-002', text: 'Offline scan gaps last under 1 hour; longer outages are a change request.',
14
+ impact: 'low', status: 'accepted', source: `PO in interview, ${DATE}`,
15
+ });
16
+ return pkg;
17
+ }
18
+
19
+ // A 0.3.x package being re-run: the BA drafted "Order to cash" and the
20
+ // invoice feature, each paired with an open question. Valid, not decided.
21
+ export function drafted() {
22
+ const { pkg } = loadWorkflow();
23
+ const was = { label: 'recommended', source: 'drafted from PO brief, System 2' };
24
+ Object.assign(pkg.workflows[2], was);
25
+ Object.assign(pkg.features[3], was);
26
+ pkg.openQuestions.push({
27
+ id: 'Q-002', question: 'Is order to cash the right shape: quote before the order is confirmed?',
28
+ priority: 'P1', reason: 'the workflow was drafted, not described by the client',
29
+ affects: ['WF-003'], status: 'open', answer: null, architectureBlocker: false,
30
+ });
31
+ return pkg;
32
+ }
@@ -0,0 +1,340 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { spawnSync } from 'node:child_process';
4
+ import { existsSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
5
+ import { tmpdir } from 'node:os';
6
+ import { join } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { pageData, undecided, idLeaks } from '../lib/review-data.mjs';
9
+ import { fillPage, pageHtml } from '../lib/review-page.mjs';
10
+ import { loadWorkflow, noFlows } from './scope-cases.mjs';
11
+ import { DATE, decided, drafted } from './review-fixture.mjs';
12
+ import { checkPackage } from '../lib/checks.mjs';
13
+
14
+ const script = fileURLToPath(new URL('../review.mjs', import.meta.url));
15
+ const IDS = /\b(?:G|ACT|SYS|WF|FEAT|FR|BR|SC|Q|ASM|NFR|INT|DAT|CON)-\d{3}\b/;
16
+
17
+ function runPage(pkg, extra = []) {
18
+ const dir = mkdtempSync(join(tmpdir(), 'ba-review-'));
19
+ writeFileSync(join(dir, 'r.json'), JSON.stringify(pkg));
20
+ const out = join(dir, 'review.html');
21
+ const args = [script, 'page', '--json', join(dir, 'r.json'), '--out', out, '--date', DATE, ...extra];
22
+ const r = spawnSync('node', args, { encoding: 'utf8' });
23
+ return { code: r.status, stdout: r.stdout, stderr: r.stderr, html: existsSync(out) ? readFileSync(out, 'utf8') : null };
24
+ }
25
+
26
+ test('features keep their table order; interview additions carry their source', () => {
27
+ const [one, two] = pageData(decided(), DATE).systems;
28
+ assert.deepEqual(one.features.map((f) => [f.name, f.added]), [['Order pipeline & stage engine', null], ['Short-pack alert', null]]);
29
+ assert.deepEqual(two.features.map((f) => [f.name, f.added]), [
30
+ ['Order intake & quotation', null], ['Invoice from packed quantities', 'PO in interview, 2026-10-07'], ['One login, role-based screens', null]]);
31
+ });
32
+
33
+ test('workflows: steps, side branches, loops back and the sub-flow note', () => {
34
+ const [one, two] = pageData(decided(), DATE).systems;
35
+ assert.deepEqual(one.flows, [{
36
+ name: 'Order pipeline', steps: ['Order In', 'Pack', 'Pack Review', 'Shipped'], sub: null, branches: [
37
+ { from: 'Pack', to: 'Short-pack alert', label: "can't fulfil", back: false },
38
+ { from: 'Pack Review', to: 'Pack', label: 'mismatch', back: true }],
39
+ }]);
40
+ assert.deepEqual(two.flows.map((w) => [w.name, w.sub]), [['Order to cash', null],
41
+ ['Custom order', { startsAt: 'Order received', rejoins: 'Order pipeline', share: 'about 20% of orders' }]]);
42
+ });
43
+
44
+ test('assumptions: resolved ones are not shown; interview ones carry their source', () => {
45
+ const pkg = decided();
46
+ pkg.assumptions.push({ id: 'ASM-003', text: 'Old belief.', impact: 'low', status: 'resolved' });
47
+ assert.deepEqual(pageData(pkg, DATE).assumptions, [
48
+ { text: 'Packers carry a phone with a camera on the warehouse floor.', added: null },
49
+ { text: 'Offline scan gaps last under 1 hour; longer outages are a change request.', added: 'PO in interview, 2026-10-07' }]);
50
+ });
51
+
52
+ test('undecided scope is listed, systems then workflows then features (R2)', () => {
53
+ assert.deepEqual(undecided(decided()), []);
54
+ const pkg = drafted();
55
+ pkg.systems[1].label = 'assumed';
56
+ assert.deepEqual(undecided(pkg), [
57
+ 'SYS-002: not decided; ask the PO in the interview',
58
+ 'WF-003: not decided; ask the PO in the interview',
59
+ 'FEAT-004: not decided; ask the PO in the interview',
60
+ ]);
61
+ });
62
+
63
+ test('the page is static html in the shape of the document', () => {
64
+ const html = pageHtml(decided(), DATE);
65
+ assert.doesNotMatch(html, /<script|<button|<input|<textarea|@TITLE@|@BODY@/);
66
+ assert.doesNotMatch(html, IDS);
67
+ assert.doesNotMatch(html, /flowcap|<nav/);
68
+ assert.match(html, /<title>Sin Kowa Mini<\/title>/);
69
+ for (const part of [
70
+ '<p class="summary">2 systems · 5 features · 2 assumptions · <span class="tag">★ New</span> 2 added in interview</p>',
71
+ '<h2><span class="sysno">System 2:</span> Orders &amp; invoicing</h2>',
72
+ '<p class="flow-name">Main workflow · Order pipeline</p>\n<div class="flow">',
73
+ '<tr class="new"><td><span class="tag">★ New</span> Invoice from packed quantities<span class="src">Added: PO in interview, 2026-10-07</span></td><td>Raises the invoice from what was packed and shipped</td></tr>',
74
+ '<p class="flow-name">Sub-workflow · Custom order — starts at Order received, rejoins Order pipeline · about 20% of orders</p>',
75
+ '<li class="new"><span class="tag">★ New</span> Offline scan gaps last under 1 hour; longer outages are a change request.<span class="src">Added: PO in interview, 2026-10-07</span></li>',
76
+ ]) assert.ok(html.includes(part), part);
77
+ });
78
+
79
+ test('no assumptions and no additions: no section, no ★ anywhere', () => {
80
+ const pkg = decided();
81
+ pkg.assumptions = [];
82
+ pkg.features[3].source = 'PO brief, System 2';
83
+ const html = pageHtml(pkg, DATE);
84
+ assert.doesNotMatch(html, /<h2>Assumptions<\/h2>|★/);
85
+ assert.ok(html.includes('<p class="summary">2 systems · 5 features · 0 assumptions</p>'));
86
+ });
87
+
88
+ test('markup in text is escaped, never drawn', () => {
89
+ const pkg = decided();
90
+ pkg.features[0].name = 'Order <b>pipeline</b> & "stage"';
91
+ assert.ok(pageHtml(pkg, DATE).includes('<td>Order &lt;b&gt;pipeline&lt;/b&gt; &amp; &quot;stage&quot;</td>'));
92
+ });
93
+
94
+ test('the template slots: title escaped, body as is, a missing slot refused', () => {
95
+ const t = '<title><!--@TITLE@--></title><main><!--@BODY@--></main>';
96
+ assert.equal(fillPage(t, 'A & B', '<p>x</p>'), '<title>A &amp; B</title><main><p>x</p></main>');
97
+ assert.throws(() => fillPage('<title></title>', 't', 'b'), /slot/);
98
+ });
99
+
100
+ test('an id in text the page shows is refused, one line per field (R3)', () => {
101
+ const pkg = decided();
102
+ assert.deepEqual(idLeaks(pkg), []);
103
+ pkg.features[0].does = 'Moves an order (see BR-001)';
104
+ pkg.workflows[1].branches[0].label = 'per FR-003';
105
+ pkg.features[3].source = 'PO in interview, after FR-004';
106
+ pkg.assumptions[1].text = 'Scans as in FR-002.';
107
+ assert.deepEqual(idLeaks(pkg), [
108
+ 'WF-002: branch label names an id (FR-003); the PO page shows it',
109
+ 'FEAT-001: does names an id (BR-001); the PO page shows it',
110
+ 'FEAT-004: source names an id (FR-004); the PO page shows it',
111
+ 'ASM-002: text names an id (FR-002); the PO page shows it',
112
+ ]);
113
+ });
114
+
115
+ test('text the page never shows may name ids', () => {
116
+ const pkg = decided();
117
+ pkg.features[2].source = 'PO brief, FR-003';
118
+ pkg.openQuestions[0].question = 'About WF-003?';
119
+ pkg.workflows[0].steps[0] = 'see FR-001';
120
+ pkg.assumptions.push({ id: 'ASM-003', text: 'Gone, see FR-001.', impact: 'low', status: 'resolved' });
121
+ assert.deepEqual(idLeaks(pkg), []);
122
+ });
123
+
124
+ test('review page: writes the file and says where', () => {
125
+ const r = runPage(decided());
126
+ assert.equal(r.code, 0);
127
+ assert.match(r.stdout, /^review page written: .*review\.html\n$/);
128
+ assert.equal(r.html, pageHtml(decided(), DATE));
129
+ });
130
+
131
+ test('review page: refuses undecided items, one line each, and writes nothing', () => {
132
+ const r = runPage(drafted());
133
+ assert.equal(r.code, 1);
134
+ assert.equal(r.stderr, 'WF-003: not decided; ask the PO in the interview\nFEAT-004: not decided; ask the PO in the interview\n');
135
+ assert.equal(r.html, null);
136
+ });
137
+
138
+ test('review page: refuses a broken scope and writes nothing', () => {
139
+ const pkg = decided();
140
+ pkg.features[1].steps = ['WF-002:Nowhere'];
141
+ const r = runPage(pkg);
142
+ assert.equal(r.code, 1);
143
+ assert.match(r.stderr, /^FEAT-002: unknown step WF-002:Nowhere$/m);
144
+ assert.equal(r.html, null);
145
+ });
146
+
147
+ test('review page: refuses an id leak and writes nothing', () => {
148
+ const pkg = decided();
149
+ pkg.features[0].does = 'Moves an order (see BR-001)';
150
+ const r = runPage(pkg);
151
+ assert.equal(r.code, 1);
152
+ assert.equal(r.stderr, 'FEAT-001: does names an id (BR-001); the PO page shows it\n');
153
+ assert.equal(r.html, null);
154
+ });
155
+
156
+ test('review page: classic mode writes nothing and exits 0', () => {
157
+ const pkg = decided();
158
+ for (const k of ['systems', 'features', 'scopeMode', 'mapLabel']) delete pkg[k];
159
+ const r = runPage(pkg);
160
+ assert.equal(r.code, 0);
161
+ assert.equal(r.stdout, 'classic mode: no review page\n');
162
+ assert.equal(r.html, null);
163
+ });
164
+
165
+ test('review: page is the only command; a flag needs a value', () => {
166
+ const dir = mkdtempSync(join(tmpdir(), 'ba-review-'));
167
+ writeFileSync(join(dir, 'r.json'), JSON.stringify(decided()));
168
+ const apply = spawnSync('node', [script, 'apply', '--json', join(dir, 'r.json')], { encoding: 'utf8' });
169
+ assert.equal(apply.status, 1);
170
+ assert.equal(apply.stderr, 'usage: review.mjs page --json <requirements.json> --out <review.html> [--date YYYY-MM-DD]\n');
171
+ const bare = spawnSync('node', [script, 'page', '--json', join(dir, 'r.json'), '--out'], { encoding: 'utf8' });
172
+ assert.equal(bare.status, 1);
173
+ assert.equal(bare.stderr, '--out: needs a value\n');
174
+ });
175
+
176
+ test('a system with no workflow draws its feature table only', () => {
177
+ const { pkg } = noFlows();
178
+ assert.deepEqual(pageData(pkg, DATE).systems[1].flows, []);
179
+ assert.doesNotMatch(pageHtml(pkg, DATE).split('System 2:</span>')[1], /class="flow"/);
180
+ });
181
+
182
+ test('the canonical workflow fixture is R5-clean; drafted() rebuilds a 0.3.x re-run', () => {
183
+ const { pkg, md } = loadWorkflow();
184
+ assert.deepEqual(undecided(pkg), []);
185
+ assert.doesNotMatch(JSON.stringify(pkg) + md, /drafted|right shape/i);
186
+ const old = drafted();
187
+ assert.deepEqual(undecided(old), [
188
+ 'WF-003: not decided; ask the PO in the interview',
189
+ 'FEAT-004: not decided; ask the PO in the interview',
190
+ ]);
191
+ assert.deepEqual(checkPackage({ pkg: old, md: null }), []);
192
+ });
193
+
194
+ const doc = (p) => readFileSync(new URL(`../../${p}`, import.meta.url), 'utf8');
195
+ const DOCS = ['SKILL.md', 'README.md', 'references/interview.md', 'references/writing.md', 'references/review.md'];
196
+ const flat = (p) => doc(p).replace(/\s+/g, ' ');
197
+
198
+ test('docs: the review page is read-only; nothing is pasted back', () => {
199
+ for (const p of DOCS) {
200
+ assert.doesNotMatch(doc(p), /Copy decisions|review\.mjs apply|--confirm|leftOut|review decisions|No, keep them|\(Recommended\)/, p);
201
+ }
202
+ assert.match(doc('SKILL.md'), /\*\*review page\*\*/);
203
+ });
204
+
205
+ test('docs: interview options cite an input quote, assume with a boundary, never recommend', () => {
206
+ const t = doc('references/interview.md');
207
+ assert.match(t, /starts with "Assume"/);
208
+ assert.doesNotMatch(t, /no hint in the input|input hint/);
209
+ const f = flat('references/interview.md');
210
+ assert.match(f, /cites its input quote: the file, the place and the exact words, copied, not paraphrased/);
211
+ assert.match(f, /An option with no input quote cites nothing/);
212
+ assert.match(f, /a scale and a limit/);
213
+ assert.match(f, /else the smallest scope still safe to price/);
214
+ assert.match(t, /Every question you ask closes/);
215
+ assert.match(t, /must pick an assumption or leave it out/);
216
+ assert.doesNotMatch(t, /include "Don't know"|"Don't know" (?:becomes|takes|leaves)/);
217
+ assert.match(t, /Never draft systems, workflows or features/);
218
+ assert.match(t, /PO in interview, <date>/);
219
+ assert.match(t, /status `accepted`/);
220
+ });
221
+
222
+ test('docs: the scope-mode question marks no pick and states the evidence', () => {
223
+ const t = doc('references/interview.md');
224
+ assert.match(t, /"Workflow: systems, their steps and features"/);
225
+ assert.match(t, /"Classic: one flat list of requirements"/);
226
+ assert.doesNotMatch(t + doc('SKILL.md'), /recommended option first|Recommend a mode|Recommend `workflow`|recommend `classic`|recommend one from the input/);
227
+ });
228
+
229
+ test('docs: an undecided workflow is asked with the input steps, No workflow, or Other only', () => {
230
+ const t = flat('references/interview.md');
231
+ assert.match(t, /the steps exactly as the input lists them/);
232
+ assert.match(t, /"No workflow for <system>: its features stay, on no step"/);
233
+ assert.match(t, /lists the steps through "Other"/);
234
+ assert.match(t, /Never offer a step order the input does not give/);
235
+ assert.match(t, /Leaving a workflow out never removes a feature/);
236
+ const grader = readFileSync(new URL('../../../../evals/ba-review-page/graders/decide-in-interview.md', import.meta.url), 'utf8');
237
+ assert.match(grader.replace(/\s+/g, ' '), /offers, as an option to pick, a step order the brief never gave/);
238
+ });
239
+
240
+ test('docs: a real answer is confirmed (§2b is the one rule); scope waits for the md', () => {
241
+ assert.doesNotMatch(flat('references/interview.md'), /default to `assumed`/);
242
+ for (const p of ['references/interview.md', 'SKILL.md']) {
243
+ assert.match(flat(p), /`scope` once requirements\.md exists; before that,? validate with `--json` only/, p);
244
+ }
245
+ });
246
+
247
+ test('docs: frameworks never leave an asked feature open', () => {
248
+ assert.doesNotMatch(flat('references/frameworks.md'), /becomes an open question/);
249
+ assert.match(flat('references/frameworks.md'), /closes like every asked question/);
250
+ });
251
+
252
+ test('docs: after the page, one approval question; at the end, the handoff line', () => {
253
+ const t = flat('references/interview.md');
254
+ assert.match(t, /"Does the review page read like your document\?"/);
255
+ assert.match(t, /"Approve: go on to requirements\.md and the readiness report"/);
256
+ assert.match(t, /"Change something: say what in Other"/);
257
+ assert.match(flat('SKILL.md'), /send requirements\.md and requirements\.json to the engineering team for the estimate/);
258
+ });
259
+
260
+ test('docs: branch labels are copied; the input assumptions stay word for word', () => {
261
+ const t = flat('references/writing.md');
262
+ assert.match(t, /A branch `label` is the input's own arrow text, copied; an arrow with no text has no `label`/);
263
+ assert.match(t, /Every assumption the input lists is an ASM row, word for word, in the input's order/);
264
+ assert.match(t, /even when it reads like a constraint/);
265
+ assert.match(t, /leaves the page only when the PO picks to drop it/);
266
+ });
267
+
268
+ test('docs: an answered input assumption is accepted; dropping one is an option', () => {
269
+ const w = flat('references/writing.md');
270
+ assert.match(w, /Once the PO answers, the input row's status becomes `accepted`; its words stay\./);
271
+ assert.match(w, /A question about an input assumption adds the option "Drop this assumption"; picking it sets that row's status to `resolved`\./);
272
+ assert.match(flat('references/interview.md').split('## §2b')[1].split('## §3')[0], /"Drop this assumption"/);
273
+ });
274
+
275
+ test('docs: the review page asks nothing first; a change comes through Other or chat', () => {
276
+ assert.doesNotMatch(flat('SKILL.md'), /Nothing else is asked/);
277
+ assert.match(flat('SKILL.md'), /Nothing is asked before the page; it ends with the approval question \(interview\.md §8\)\./);
278
+ assert.match(flat('references/interview.md'), /A change \(through Other, or in chat\) is a re-run/);
279
+ assert.match(flat('references/review.md'), /Input assumptions \(source names an input file\) are verbatim: flag a problem, never reword them\./);
280
+ });
281
+
282
+ test('docs: step 11 ends with the handoff line', () => {
283
+ const step = flat('SKILL.md').split('11. **Finish**')[1].split('## Review page')[0];
284
+ const handoff = step.indexOf('send requirements.md and requirements.json to the engineering team');
285
+ assert.ok(step.indexOf('review page') >= 0 && handoff > step.indexOf('review page'));
286
+ });
287
+
288
+ const pipeline = (pkg) => pkg.workflows.find((w) => w.name === 'Order pipeline');
289
+
290
+ test('the diagram: main row, then each branch under its parent', () => {
291
+ const pkg = decided();
292
+ pipeline(pkg).branches.push({ from: 'Short-pack alert', to: 'Cancel or substitute' });
293
+ const html = pageHtml(pkg, DATE);
294
+ for (const part of [
295
+ '<div class="grid">',
296
+ '<div class="step" style="grid-area:1/1">Order In</div>',
297
+ '<div class="arrow" style="grid-area:1/2">→</div>',
298
+ '<div class="step" style="grid-area:1/3">Pack</div>',
299
+ '<div class="down" style="grid-area:2/3"><span class="lbl">can\'t fulfil</span></div>',
300
+ '<div class="step alt" style="grid-area:3/3">Short-pack alert</div>',
301
+ '<div class="down" style="grid-area:2/5"><span class="lbl">mismatch</span></div>',
302
+ '<div class="step back" style="grid-area:3/5">↺ back to Pack</div>',
303
+ '<div class="down" style="grid-area:4/3"></div>',
304
+ '<div class="step alt" style="grid-area:5/3">Cancel or substitute</div>',
305
+ ]) assert.ok(html.includes(part), part);
306
+ assert.doesNotMatch(html, /↳|row side|class="row"/);
307
+ });
308
+
309
+ test('two branches from one step sit side by side; the step spans them', () => {
310
+ const pkg = decided();
311
+ pipeline(pkg).branches.push({ from: 'Pack', to: 'Extra box', label: 'needs a box' });
312
+ const html = pageHtml(pkg, DATE);
313
+ for (const part of [
314
+ '<div class="step wide" style="grid-area:1/3/auto/span 2">Pack</div>',
315
+ '<div class="arrow" style="grid-area:1/5">→</div>',
316
+ '<div class="step" style="grid-area:1/6">Pack Review</div>',
317
+ '<div class="step alt" style="grid-area:3/3">Short-pack alert</div>',
318
+ '<div class="down" style="grid-area:2/4"><span class="lbl">needs a box</span></div>',
319
+ '<div class="step alt" style="grid-area:3/4">Extra box</div>',
320
+ '<div class="step back" style="grid-area:3/6">↺ back to Pack</div>',
321
+ ]) assert.ok(html.includes(part), part);
322
+ });
323
+
324
+ test('a child listed before its parent is drawn one level below it', () => {
325
+ const pkg = decided();
326
+ pipeline(pkg).branches.unshift({ from: 'Short-pack alert', to: 'Cancel or substitute' });
327
+ const html = pageHtml(pkg, DATE);
328
+ assert.ok(html.includes('<div class="step alt" style="grid-area:3/3">Short-pack alert</div>'));
329
+ assert.ok(html.includes('<div class="step alt" style="grid-area:5/3">Cancel or substitute</div>'));
330
+ });
331
+
332
+ test('a cycle between two branch boxes draws each once, under the first step', () => {
333
+ const pkg = decided();
334
+ pipeline(pkg).branches.push({ from: 'Loop B', to: 'Loop A' }, { from: 'Loop A', to: 'Loop B' });
335
+ const html = pageHtml(pkg, DATE);
336
+ assert.ok(html.includes('<div class="step alt" style="grid-area:3/1">Loop A</div>'));
337
+ assert.ok(html.includes('<div class="step alt" style="grid-area:5/1">Loop B</div>'));
338
+ assert.equal(html.split('>Loop A<').length, 2);
339
+ assert.equal(html.split('>Loop B<').length, 2);
340
+ });