@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
@@ -0,0 +1,73 @@
1
+ import {
2
+ SCOPE_MODES, modeOf, toBe, scopeIds,
3
+ checkFlows, checkFeatureSteps, checkFeatureFrs, checkNames, checkScopeLabels,
4
+ } from './scope-rules.mjs';
5
+
6
+ const ID_RES = [['systems', /^SYS-\d{3}$/], ['features', /^FEAT-\d{3}$/]];
7
+ const FIELDS = [['systems', ['name', 'purpose']], ['features', ['name', 'does']]];
8
+
9
+ function checkFields(pkg) {
10
+ return FIELDS.flatMap(([k, fields]) =>
11
+ pkg[k].flatMap((r) => fields.filter((f) => !r[f]).map((f) => `${r.id}: missing ${f}`)));
12
+ }
13
+
14
+ function checkShape(pkg) {
15
+ if (!SCOPE_MODES.includes(modeOf(pkg))) return ['scopeMode must be workflow|classic'];
16
+ if (modeOf(pkg) === 'classic') {
17
+ return 'systems' in pkg || 'features' in pkg ? ['systems/features only in workflow mode'] : [];
18
+ }
19
+ if (!pkg.systems?.length || !pkg.features?.length) return ['scopeMode workflow needs systems and features'];
20
+ const findings = [];
21
+ for (const [k, re] of ID_RES) {
22
+ for (const r of pkg[k]) if (!re.test(r.id ?? '')) findings.push(`${k}: bad id ${r.id}`);
23
+ }
24
+ const seen = new Set();
25
+ for (const id of scopeIds(pkg)) {
26
+ if (seen.has(id)) findings.push(`duplicate id: ${id}`);
27
+ seen.add(id);
28
+ }
29
+ return findings;
30
+ }
31
+
32
+ function owners(systems, key) {
33
+ const map = new Map();
34
+ for (const s of systems) for (const id of s[key] ?? []) map.set(id, [...(map.get(id) ?? []), s.id]);
35
+ return map;
36
+ }
37
+
38
+ function ownership(ids, own, verb) {
39
+ return ids.flatMap((id) => {
40
+ const by = own.get(id) ?? [];
41
+ if (by.length === 1) return [];
42
+ return [by.length ? `${id}: ${verb} ${by.join(' and ')}` : `${id}: ${verb} no system`];
43
+ });
44
+ }
45
+
46
+ function checkMembership(pkg) {
47
+ const findings = [];
48
+ const flows = toBe(pkg).map((w) => w.id);
49
+ const feats = pkg.features.map((f) => f.id);
50
+ for (const s of pkg.systems) {
51
+ for (const w of s.workflows ?? []) if (!flows.includes(w)) findings.push(`${s.id}: workflow ${w} is not a to-be workflow`);
52
+ for (const f of s.features ?? []) if (!feats.includes(f)) findings.push(`${s.id}: dangling reference ${f}`);
53
+ }
54
+ return [
55
+ ...findings,
56
+ ...ownership(flows, owners(pkg.systems, 'workflows'), 'belongs to'),
57
+ ...ownership(feats, owners(pkg.systems, 'features'), 'listed by'),
58
+ ];
59
+ }
60
+
61
+ export function checkScope(pkg, ids) {
62
+ const shape = checkShape(pkg);
63
+ if (shape.length || modeOf(pkg) === 'classic') return shape;
64
+ return [
65
+ ...checkFields(pkg),
66
+ ...checkMembership(pkg),
67
+ ...checkFlows(pkg),
68
+ ...checkFeatureSteps(pkg),
69
+ ...checkFeatureFrs(pkg, ids),
70
+ ...checkNames(pkg),
71
+ ...checkScopeLabels(pkg),
72
+ ];
73
+ }
@@ -0,0 +1,53 @@
1
+ import { modeOf } from './scope-rules.mjs';
2
+ import { START, END, cell, renderScope } from './scope-render.mjs';
3
+
4
+ const BLOCK = /<!-- scope:start -->[\s\S]*?<!-- scope:end -->\n*/;
5
+ // The 0.3.x Start-here line pointed the PO at this section; the PO now has
6
+ // the review page, so re-running scope removes the line from older files.
7
+ const HERE = /\n> \*\*Product owner\? Start here:\*\*[^\n]*\n/;
8
+ const cells = (line) => line.split(/(?<!\\)\|/).slice(1, -1).map((c) => c.trim());
9
+ const count = (md, marker) => md.split(marker).length - 1;
10
+
11
+ export function checkMarkers(md) {
12
+ const [s, e] = [count(md, START), count(md, END)];
13
+ const ok = s === e && s <= 1 && md.indexOf(START) <= md.indexOf(END);
14
+ return ok ? [] : ['md: scope markers unbalanced'];
15
+ }
16
+
17
+ export function applyScope(md, pkg) {
18
+ let out = md.replace(HERE, '');
19
+ const at = out.search(BLOCK);
20
+ out = out.replace(BLOCK, '');
21
+ if (modeOf(pkg) === 'classic') return out;
22
+ const part3 = out.search(/^## Part 3/m);
23
+ const i = at >= 0 ? at : part3 >= 0 ? part3 : out.length;
24
+ return `${out.slice(0, i)}${renderScope(pkg)}\n\n${out.slice(i)}`;
25
+ }
26
+
27
+ function expectedFeature(pkg, frId) {
28
+ const names = pkg.features.filter((f) => (f.requirements ?? []).includes(frId)).map((f) => f.name);
29
+ return names.length ? names.join(', ') : '—';
30
+ }
31
+
32
+ function checkFeatureColumn(pkg, md) {
33
+ const lines = md.split('\n');
34
+ const header = lines.find((l) => /^\| ID \| Requirement \|/.test(l));
35
+ if (!header || cells(header).at(-1) !== 'Feature') return ['md: FR table has no Feature column'];
36
+ const findings = [];
37
+ for (const line of lines.filter((l) => /^\| FR-\d{3} \|/.test(l))) {
38
+ const c = cells(line);
39
+ const want = cell(expectedFeature(pkg, c[0]));
40
+ if (c.at(-1) !== want) findings.push(`md: ${c[0]} Feature column says ${c.at(-1)}, json says ${want}`);
41
+ }
42
+ return findings;
43
+ }
44
+
45
+ export function checkScopeMd(pkg, md) {
46
+ const findings = checkMarkers(md);
47
+ const fm = md.match(/^scopeMode:\s*(\S+)/m)?.[1] ?? 'classic';
48
+ if (fm !== modeOf(pkg)) findings.push('md: scopeMode does not match json');
49
+ const block = md.match(BLOCK)?.[0].trimEnd() ?? null;
50
+ if (modeOf(pkg) === 'classic') return block ? [...findings, 'md: To-be scope only in workflow mode'] : findings;
51
+ if (block !== renderScope(pkg)) findings.push('md: To-be scope is stale — run scope');
52
+ return [...findings, ...checkFeatureColumn(pkg, md)];
53
+ }
@@ -0,0 +1,72 @@
1
+ export const START = '<!-- scope:start -->';
2
+ export const END = '<!-- scope:end -->';
3
+
4
+ const stepOf = (ref) => ref.slice(ref.indexOf(':') + 1);
5
+ export const cell = (text) => String(text).replaceAll('|', '\\|');
6
+
7
+ export function mermaid(w) {
8
+ const ids = new Map();
9
+ const nid = (n) => {
10
+ if (!ids.has(n)) ids.set(n, `n${ids.size}`);
11
+ return ids.get(n);
12
+ };
13
+ const steps = w.steps ?? [];
14
+ steps.forEach(nid);
15
+ const lines = ['flowchart LR'];
16
+ steps.slice(1).forEach((s, i) => lines.push(` ${nid(steps[i])} --> ${nid(s)}`));
17
+ for (const b of w.branches ?? []) lines.push(` ${nid(b.from)} -.->${b.label ? `|${b.label}|` : ''} ${nid(b.to)}`);
18
+ for (const [n, id] of ids) lines.push(` ${id}["${n.replaceAll('"', "'")}"]`);
19
+ return ['```mermaid', ...lines, '```'].join('\n');
20
+ }
21
+
22
+ function whereCell(f, sys, flows) {
23
+ const refs = f.steps ?? [];
24
+ if (!refs.length) return '—';
25
+ if (refs.length === 1 && refs[0] === '*') return 'every step';
26
+ const groups = new Map();
27
+ for (const r of refs) {
28
+ const wid = r.slice(0, r.indexOf(':'));
29
+ groups.set(wid, [...(groups.get(wid) ?? []), stepOf(r)]);
30
+ }
31
+ return [...groups]
32
+ .map(([wid, st]) => st.join(' → ') + ((sys.workflows ?? []).includes(wid) ? '' : ` (in ${flows.get(wid).name})`))
33
+ .join('; ');
34
+ }
35
+
36
+ function workflowBlock(w, main, flows) {
37
+ let head = `**${main ? 'Main workflow' : 'Sub-workflow'}: ${w.id} ${w.name}**`;
38
+ if (w.sub) {
39
+ head += ` — starts at ${stepOf(w.sub.startsAt)}, rejoins ${flows.get(w.sub.rejoins).name}`;
40
+ if (w.sub.share) head += ` · ${w.sub.share}`;
41
+ }
42
+ return [head, mermaid(w)].join('\n\n');
43
+ }
44
+
45
+ function systemBlock(s, ctx) {
46
+ const replaced = [...new Set((s.workflows ?? []).flatMap((id) => ctx.flows.get(id).replaces ?? []))];
47
+ const names = replaced.map((id) => `"${ctx.flows.get(id).name}"`).join(', ');
48
+ const intro = s.purpose + (replaced.length ? ` Replaces today's ${names}.` : '');
49
+ const rows = (s.features ?? []).map((id) => ctx.feats.get(id)).map((f) =>
50
+ `| ${f.id} | ${cell(f.name)} | ${cell(f.does)} | ${cell(whereCell(f, s, ctx.flows))} | ${(f.requirements ?? []).join(', ') || '—'} |`);
51
+ const table = ['| ID | Feature | What it does | Where in the workflow | Requirements |', '| --- | --- | --- | --- | --- |', ...rows].join('\n');
52
+ const flowsMd = (s.workflows ?? []).map((id, i) => workflowBlock(ctx.flows.get(id), i === 0, ctx.flows));
53
+ return [`### ${s.id} ${s.name}`, intro, ...flowsMd, table].join('\n\n');
54
+ }
55
+
56
+ function systemsTable(pkg) {
57
+ const map = pkg.mapLabel;
58
+ const head = map ? `| ID | System | Purpose | ${cell(map)} |\n| --- | --- | --- | --- |` : '| ID | System | Purpose |\n| --- | --- | --- |';
59
+ const rows = pkg.systems.map((s) => `| ${s.id} | ${cell(s.name)} | ${cell(s.purpose)} |${map ? ` ${cell(s.map ?? '—')} |` : ''}`);
60
+ return [head, ...rows].join('\n');
61
+ }
62
+
63
+ export function renderScope(pkg) {
64
+ const ctx = {
65
+ flows: new Map((pkg.workflows ?? []).map((w) => [w.id, w])),
66
+ feats: new Map(pkg.features.map((f) => [f.id, f])),
67
+ };
68
+ const n = pkg.systems.length;
69
+ const intro = `What we propose to build: ${n === 1 ? 'one system' : `${n} systems`}, each shown as its workflows and then the features that serve them.`;
70
+ return [START, '### To-be scope', intro, systemsTable(pkg),
71
+ ...pkg.systems.map((s) => systemBlock(s, ctx)), END].join('\n\n');
72
+ }
@@ -0,0 +1,90 @@
1
+ import { LABELS } from './schema.mjs';
2
+
3
+ export const SCOPE_MODES = ['workflow', 'classic'];
4
+ export const TECH_WORDS = ['API', 'database', 'microservice', 'backend', 'frontend', 'server', 'endpoint', 'schema', 'PWA', 'cloud'];
5
+
6
+ export const modeOf = (pkg) => pkg.scopeMode ?? 'classic';
7
+ export const toBe = (pkg) => (pkg.workflows ?? []).filter((w) => w.state === 'to-be');
8
+ export const scopeIds = (pkg) => [...(pkg.systems ?? []), ...(pkg.features ?? [])].map((r) => r.id);
9
+
10
+ function stepIndex(pkg) {
11
+ const idx = new Set();
12
+ for (const w of toBe(pkg)) {
13
+ for (const s of w.steps ?? []) idx.add(`${w.id}:${s}`);
14
+ for (const b of w.branches ?? []) idx.add(`${w.id}:${b.to}`);
15
+ }
16
+ return idx;
17
+ }
18
+
19
+ export function checkFlows(pkg) {
20
+ const findings = [];
21
+ const idx = stepIndex(pkg);
22
+ const flows = toBe(pkg).map((w) => w.id);
23
+ const asIs = (pkg.workflows ?? []).filter((w) => w.state === 'as-is').map((w) => w.id);
24
+ for (const w of toBe(pkg)) {
25
+ for (const b of w.branches ?? []) {
26
+ if (!idx.has(`${w.id}:${b.from}`)) findings.push(`${w.id}: branch from unknown step ${b.from}`);
27
+ }
28
+ if (w.sub && !idx.has(w.sub.startsAt)) findings.push(`${w.id}: sub.startsAt unknown`);
29
+ if (w.sub && !flows.includes(w.sub.rejoins)) findings.push(`${w.id}: sub.rejoins is not a to-be workflow`);
30
+ for (const r of w.replaces ?? []) if (!asIs.includes(r)) findings.push(`${w.id}: replaces unknown as-is workflow ${r}`);
31
+ }
32
+ return findings;
33
+ }
34
+
35
+ export function checkFeatureSteps(pkg) {
36
+ const findings = [];
37
+ const idx = stepIndex(pkg);
38
+ for (const f of pkg.features) {
39
+ const steps = f.steps ?? [];
40
+ if (steps.length === 1 && steps[0] === '*') continue;
41
+ for (const s of steps) if (!idx.has(s)) findings.push(`${f.id}: unknown step ${s}`);
42
+ }
43
+ return findings;
44
+ }
45
+
46
+ export function checkFeatureFrs(pkg, ids) {
47
+ const findings = [];
48
+ const covered = new Set();
49
+ for (const f of pkg.features) {
50
+ for (const fr of f.requirements ?? []) {
51
+ covered.add(fr);
52
+ if (!ids.has(fr)) findings.push(`${f.id}: dangling reference ${fr}`);
53
+ }
54
+ }
55
+ for (const fr of pkg.requirements ?? []) {
56
+ if (fr.scope === 'in' && !covered.has(fr.id)) findings.push(`${fr.id}: in scope but in no feature`);
57
+ }
58
+ return findings;
59
+ }
60
+
61
+ const techWord = (name) => TECH_WORDS.find((w) => new RegExp(`\\b${w}s?\\b`, 'i').test(name ?? ''));
62
+
63
+ export function checkNames(pkg) {
64
+ const findings = [];
65
+ for (const [kind, rows] of [['system', pkg.systems], ['feature', pkg.features]]) {
66
+ const seen = new Set();
67
+ for (const r of rows) {
68
+ const key = (r.name ?? '').toLowerCase();
69
+ if (seen.has(key)) findings.push(`duplicate ${kind} name: ${r.name}`);
70
+ seen.add(key);
71
+ const word = techWord(r.name);
72
+ if (word) findings.push(`${r.id}: name uses a tech word (${word})`);
73
+ }
74
+ }
75
+ return findings;
76
+ }
77
+
78
+ export function checkScopeLabels(pkg) {
79
+ const findings = [];
80
+ const asked = new Set((pkg.openQuestions ?? []).flatMap((q) => q.affects ?? []));
81
+ for (const r of [...toBe(pkg), ...pkg.systems, ...pkg.features]) {
82
+ if (!r.label) findings.push(`${r.id}: missing label`);
83
+ else if (!LABELS.includes(r.label)) findings.push(`${r.id}: illegal label "${r.label}"`);
84
+ if (!r.source) findings.push(`${r.id}: missing source`);
85
+ if (r.label === 'recommended' && !asked.has(r.id)) {
86
+ findings.push(`${r.id}: recommended without a paired open question`);
87
+ }
88
+ }
89
+ return findings;
90
+ }
@@ -0,0 +1,48 @@
1
+ // The read-only PO review page (spec R1–R3):
2
+ // node review.mjs page --json requirements.json --out review.html [--date YYYY-MM-DD]
3
+ import { readFileSync, writeFileSync } from 'node:fs';
4
+ import { collectIds } from './lib/checks.mjs';
5
+ import { modeOf, scopeIds } from './lib/scope-rules.mjs';
6
+ import { checkScope } from './lib/scope-checks.mjs';
7
+ import { pageHtml } from './lib/review-page.mjs';
8
+ import { undecided, idLeaks } from './lib/review-data.mjs';
9
+
10
+ const USAGE = 'usage: review.mjs page --json <requirements.json> --out <review.html> [--date YYYY-MM-DD]';
11
+
12
+ function fail(findings) {
13
+ console.error(findings.join('\n'));
14
+ process.exit(1);
15
+ }
16
+
17
+ function parseArgs(argv) {
18
+ const args = {};
19
+ for (let i = 0; i < argv.length; i += 1) {
20
+ if (!argv[i].startsWith('--')) continue;
21
+ const value = argv[i + 1];
22
+ if (value === undefined || value.startsWith('--')) fail([`${argv[i]}: needs a value`]);
23
+ args[argv[i].slice(2)] = value;
24
+ i += 1;
25
+ }
26
+ return args;
27
+ }
28
+
29
+ const pad = (n) => String(n).padStart(2, '0');
30
+ const today = (d = new Date()) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
31
+
32
+ // Checks run in order and stop at the first that finds something: a broken
33
+ // scope cannot be drawn, so undecided items and ids wait for it.
34
+ function page(pkg, args) {
35
+ if (modeOf(pkg) === 'classic') return console.log('classic mode: no review page');
36
+ const checks = [() => checkScope(pkg, new Set([...collectIds(pkg), ...scopeIds(pkg)])), () => undecided(pkg), () => idLeaks(pkg)];
37
+ for (const check of checks) {
38
+ const findings = check();
39
+ if (findings.length) fail(findings);
40
+ }
41
+ writeFileSync(args.out, pageHtml(pkg, args.date ?? today()));
42
+ console.log(`review page written: ${args.out}`);
43
+ }
44
+
45
+ const [cmd, ...rest] = process.argv.slice(2);
46
+ const args = parseArgs(rest);
47
+ if (cmd !== 'page') fail([USAGE]);
48
+ page(JSON.parse(readFileSync(args.json, 'utf8')), args);
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env python3
2
+ """Python port of review.mjs: the read-only PO review page.
3
+
4
+ python3 review.py page --json requirements.json --out review.html [--date YYYY-MM-DD]
5
+ """
6
+ import datetime
7
+ import json
8
+ import sys
9
+
10
+ from review_data import id_leaks, undecided
11
+ from review_page import page_html
12
+ from scope_checks import check_scope, mode_of, scope_ids
13
+ from validate import collect_ids
14
+
15
+ USAGE = 'usage: review.mjs page --json <requirements.json> --out <review.html> [--date YYYY-MM-DD]'
16
+
17
+
18
+ def fail(findings):
19
+ print('\n'.join(findings), file=sys.stderr)
20
+ sys.exit(1)
21
+
22
+
23
+ def parse_args(argv):
24
+ args, i = {}, 0
25
+ while i < len(argv):
26
+ if argv[i].startswith('--'):
27
+ value = argv[i + 1] if i + 1 < len(argv) else None
28
+ if value is None or value.startswith('--'):
29
+ fail([f'{argv[i]}: needs a value'])
30
+ args[argv[i][2:]] = value
31
+ i += 1
32
+ i += 1
33
+ return args
34
+
35
+
36
+ def page(pkg, args):
37
+ if mode_of(pkg) == 'classic':
38
+ print('classic mode: no review page')
39
+ return
40
+ checks = [lambda: check_scope(pkg, set(collect_ids(pkg)) | set(scope_ids(pkg))),
41
+ lambda: undecided(pkg), lambda: id_leaks(pkg)]
42
+ for check in checks:
43
+ findings = check()
44
+ if findings:
45
+ fail(findings)
46
+ with open(args['out'], 'w', encoding='utf-8', newline='') as f:
47
+ f.write(page_html(pkg, args.get('date') or datetime.date.today().isoformat()))
48
+ print(f"review page written: {args['out']}")
49
+
50
+
51
+ def main(argv):
52
+ cmd, args = (argv[0] if argv else None), parse_args(argv[1:])
53
+ if cmd != 'page':
54
+ fail([USAGE])
55
+ with open(args['json'], encoding='utf-8') as f:
56
+ page(json.load(f), args)
57
+
58
+
59
+ if __name__ == '__main__':
60
+ main(sys.argv[1:])
@@ -0,0 +1,81 @@
1
+ """Read-only review page data; mirrors lib/review-data.mjs (parity-tested)."""
2
+ from scope_checks import to_be
3
+ from validate import ID_TOKEN
4
+
5
+ NEW = 'PO in interview'
6
+
7
+
8
+ def added(r):
9
+ src = r.get('source')
10
+ return src if isinstance(src, str) and src.startswith(NEW) else None
11
+
12
+
13
+ def title(lead):
14
+ return ' '.join(w[:1].upper() + w[1:] for w in lead.split('-'))
15
+
16
+
17
+ def shown_assumptions(pkg):
18
+ return [a for a in pkg.get('assumptions') or [] if a.get('status') != 'resolved']
19
+
20
+
21
+ def flow_data(w, flows):
22
+ steps = w.get('steps') or []
23
+ sub = w.get('sub')
24
+ return {
25
+ 'name': w['name'], 'steps': steps,
26
+ 'branches': [{'from': b['from'], 'to': b['to'], 'label': b.get('label'), 'back': b['to'] in steps}
27
+ for b in w.get('branches') or []],
28
+ 'sub': {'startsAt': sub['startsAt'][sub['startsAt'].index(':') + 1:],
29
+ 'rejoins': (flows.get(sub.get('rejoins')) or {}).get('name'),
30
+ 'share': sub.get('share')} if sub else None,
31
+ }
32
+
33
+
34
+ def page_data(pkg, date):
35
+ flows = {w['id']: w for w in pkg.get('workflows') or []}
36
+ feats = {f['id']: f for f in pkg['features']}
37
+ systems = [{
38
+ 'name': s['name'], 'purpose': s['purpose'],
39
+ 'flows': [flow_data(flows[i], flows) for i in s.get('workflows') or []],
40
+ 'features': [{'name': feats[i]['name'], 'does': feats[i]['does'], 'added': added(feats[i])}
41
+ for i in s.get('features') or []],
42
+ } for s in pkg['systems']]
43
+ assumptions = [{'text': a['text'], 'added': added(a)} for a in shown_assumptions(pkg)]
44
+ return {'title': title(pkg['lead']), 'date': date, 'systems': systems, 'assumptions': assumptions}
45
+
46
+
47
+ def undecided(pkg):
48
+ return [f"{r['id']}: not decided; ask the PO in the interview"
49
+ for r in pkg['systems'] + to_be(pkg) + pkg['features'] if r.get('label') != 'confirmed']
50
+
51
+
52
+ def when(ok, row):
53
+ return [row] if ok else []
54
+
55
+
56
+ def flow_text(w):
57
+ steps = w.get('steps') or []
58
+ rows = [[w['id'], 'name', w.get('name')]] + [[w['id'], 'step', x] for x in steps]
59
+ for b in w.get('branches') or []:
60
+ rows += when(b.get('to') not in steps, [w['id'], 'step', b.get('to')]) + [[w['id'], 'branch label', b.get('label')]]
61
+ return rows + [[w['id'], 'share', (w.get('sub') or {}).get('share')]]
62
+
63
+
64
+ def shown_text(pkg):
65
+ flows = {w['id']: w for w in pkg.get('workflows') or []}
66
+ rows = [row for s in pkg['systems'] for row in ([s['id'], 'name', s.get('name')], [s['id'], 'purpose', s.get('purpose')])]
67
+ rows += [row for s in pkg['systems'] for i in s.get('workflows') or [] for row in flow_text(flows[i])]
68
+ for f in pkg['features']:
69
+ rows += [[f['id'], 'name', f.get('name')], [f['id'], 'does', f.get('does')]] + when(added(f), [f['id'], 'source', f.get('source')])
70
+ for a in shown_assumptions(pkg):
71
+ rows += [[a['id'], 'text', a.get('text')]] + when(added(a), [a['id'], 'source', a.get('source')])
72
+ return rows
73
+
74
+
75
+ def id_leaks(pkg):
76
+ out = []
77
+ for rid, field, text in shown_text(pkg):
78
+ ids = list(dict.fromkeys(ID_TOKEN.findall('' if text is None else str(text))))
79
+ if ids:
80
+ out.append(f"{rid}: {field} names an id ({', '.join(ids)}); the PO page shows it")
81
+ return out
@@ -0,0 +1,50 @@
1
+ """Where each box of a workflow diagram sits (spec R10); mirrors
2
+ lib/review-layout.mjs. Branches form a tree under each main step; siblings
3
+ sit side by side and a parent spans its children."""
4
+
5
+
6
+ def width(kids):
7
+ return sum(width(k['kids']) for k in kids) if kids else 1
8
+
9
+
10
+ def forest(steps, branches):
11
+ placed = set()
12
+
13
+ def take(i):
14
+ placed.add(i)
15
+ return {'b': branches[i], 'kids': []}
16
+
17
+ def grow(name):
18
+ kids = [take(i) for i, b in enumerate(branches) if b['from'] == name and i not in placed]
19
+ for k in kids:
20
+ k['kids'] = [] if k['b']['back'] else grow(k['b']['to'])
21
+ return kids
22
+
23
+ roots = [grow(s) for s in steps]
24
+ for i, b in enumerate(branches):
25
+ if i in placed:
26
+ continue
27
+ n = take(i)
28
+ n['kids'] = [] if b['back'] else grow(b['to'])
29
+ roots[0].append(n)
30
+ return roots
31
+
32
+
33
+ def place(kids, depth, col):
34
+ out = []
35
+ for n in kids:
36
+ span = width(n['kids'])
37
+ out.append({'b': n['b'], 'depth': depth, 'col': col, 'span': span})
38
+ out += place(n['kids'], depth + 1, col)
39
+ col += span
40
+ return out
41
+
42
+
43
+ def layout(steps, branches):
44
+ lanes, boxes, col = [], [], 1
45
+ for name, kids in zip(steps, forest(steps, branches)):
46
+ span = width(kids)
47
+ lanes.append({'name': name, 'col': col, 'span': span})
48
+ boxes += place(kids, 1, col)
49
+ col += span + 1
50
+ return lanes, boxes
@@ -0,0 +1,115 @@
1
+ """Draws the read-only review page; mirrors lib/review-page.mjs. Byte-identical
2
+ page, kept in lockstep by scripts/test/review-parity.test.mjs."""
3
+ import os
4
+
5
+ from review_data import page_data
6
+ from review_layout import layout
7
+
8
+ ASSETS = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'assets')
9
+ TAG = '<span class="tag">★ New</span> '
10
+
11
+
12
+ def esc(s):
13
+ return str(s).replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;')
14
+
15
+
16
+ def src(added):
17
+ return f'<span class="src">Added: {esc(added)}</span>'
18
+
19
+
20
+ def cell(area, cls, html):
21
+ return f'<div class="{cls}" style="grid-area:{area}">{html}</div>'
22
+
23
+
24
+ def area(row, col, span):
25
+ return f'{row}/{col}/auto/span {span}' if span > 1 else f'{row}/{col}'
26
+
27
+
28
+ def wide(cls, span):
29
+ return f'{cls} wide' if span > 1 else cls
30
+
31
+
32
+ def step_cells(lanes):
33
+ out = []
34
+ for i, l in enumerate(lanes):
35
+ if i:
36
+ out.append(cell(f"1/{l['col'] - 1}", 'arrow', '→'))
37
+ out.append(cell(area(1, l['col'], l['span']), wide('step', l['span']), esc(l['name'])))
38
+ return out
39
+
40
+
41
+ def branch_cells(x):
42
+ b, row, col, span = x['b'], 2 * x['depth'], x['col'], x['span']
43
+ label = f'<span class="lbl">{esc(b["label"])}</span>' if b['label'] else ''
44
+ box = (cell(area(row + 1, col, span), 'step back', f'↺ back to {esc(b["to"])}') if b['back']
45
+ else cell(area(row + 1, col, span), wide('step alt', span), esc(b['to'])))
46
+ return [cell(area(row, col, span), 'down', label), box]
47
+
48
+
49
+ def flow_html(w):
50
+ s = w['sub']
51
+ cap = f"{'Sub-workflow' if s else 'Main workflow'} · {esc(w['name'])}"
52
+ if s:
53
+ cap += f" — starts at {esc(s['startsAt'])}"
54
+ cap += f", rejoins {esc(s['rejoins'])}" if s['rejoins'] else ''
55
+ cap += f" · {esc(s['share'])}" if s['share'] else ''
56
+ lanes, boxes = layout(w['steps'], w['branches'])
57
+ branches = [c for x in boxes for c in branch_cells(x)]
58
+ return '\n'.join([f'<p class="flow-name">{cap}</p>', '<div class="flow">', '<div class="grid">',
59
+ *step_cells(lanes), *branches, '</div>', '</div>'])
60
+
61
+
62
+ def feature_row(f):
63
+ if not f['added']:
64
+ return f"<tr><td>{esc(f['name'])}</td><td>{esc(f['does'])}</td></tr>"
65
+ return f"<tr class=\"new\"><td>{TAG}{esc(f['name'])}{src(f['added'])}</td><td>{esc(f['does'])}</td></tr>"
66
+
67
+
68
+ def system_html(s, i):
69
+ return '\n'.join(['<section>', f"<h2><span class=\"sysno\">System {i + 1}:</span> {esc(s['name'])}</h2>", f"<p>{esc(s['purpose'])}</p>",
70
+ *(flow_html(w) for w in s['flows']), '<table>', '<tr><th>Feature</th><th>What it does</th></tr>',
71
+ *(feature_row(f) for f in s['features']), '</table>', '</section>'])
72
+
73
+
74
+ def assumptions_html(items):
75
+ if not items:
76
+ return []
77
+ lis = [f"<li class=\"new\">{TAG}{esc(a['text'])}{src(a['added'])}</li>" if a['added'] else f"<li>{esc(a['text'])}</li>"
78
+ for a in items]
79
+ return ['<section>', '<h2>Assumptions</h2>', '<ul>', *lis, '</ul>', '</section>']
80
+
81
+
82
+ def count(k, word):
83
+ return f"{k} {word}{'' if k == 1 else 's'}"
84
+
85
+
86
+ def summary(d):
87
+ feats = [f for s in d['systems'] for f in s['features']]
88
+ fresh = len([r for r in feats + d['assumptions'] if r['added']])
89
+ parts = [count(len(d['systems']), 'system'), count(len(feats), 'feature'), count(len(d['assumptions']), 'assumption')]
90
+ return ' · '.join(parts) + (f' · {TAG}{fresh} added in interview' if fresh else '')
91
+
92
+
93
+ def body_html(d):
94
+ return '\n'.join(['<header>', f"<h1>{esc(d['title'])}</h1>",
95
+ f"<p class=\"byline\">Requirements review · {esc(d['date'])} · read-only</p>",
96
+ f'<p class="summary">{summary(d)}</p>', '</header>',
97
+ *(system_html(s, i) for i, s in enumerate(d['systems'])), *assumptions_html(d['assumptions'])])
98
+
99
+
100
+ def fill(template, slot, value):
101
+ parts = template.split(slot)
102
+ if len(parts) != 2:
103
+ raise ValueError(f'template slot {slot} must appear once')
104
+ return value.join(parts)
105
+
106
+
107
+ def fill_page(template, title, body):
108
+ return fill(fill(template, '<!--@TITLE@-->', esc(title)), '<!--@BODY@-->', body)
109
+
110
+
111
+ def page_html(pkg, date):
112
+ with open(os.path.join(ASSETS, 'review-page.html'), encoding='utf-8') as f:
113
+ template = f.read()
114
+ d = page_data(pkg, date)
115
+ return fill_page(template, d['title'], body_html(d))
@@ -0,0 +1,24 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ import { collectIds } from './lib/checks.mjs';
3
+ import { scopeIds } from './lib/scope-rules.mjs';
4
+ import { checkScope } from './lib/scope-checks.mjs';
5
+ import { applyScope, checkMarkers } from './lib/scope-md.mjs';
6
+
7
+ function parseArgs(argv) {
8
+ const args = {};
9
+ for (let i = 0; i < argv.length; i += 1) {
10
+ if (argv[i].startsWith('--')) args[argv[i].slice(2)] = argv[++i];
11
+ }
12
+ return args;
13
+ }
14
+
15
+ const args = parseArgs(process.argv.slice(2));
16
+ const pkg = JSON.parse(readFileSync(args.json, 'utf8'));
17
+ const md = readFileSync(args.md, 'utf8');
18
+ const findings = [...checkScope(pkg, new Set([...collectIds(pkg), ...scopeIds(pkg)])), ...checkMarkers(md)];
19
+ if (findings.length) {
20
+ console.error(findings.join('\n'));
21
+ process.exit(1);
22
+ }
23
+ writeFileSync(args.md, applyScope(md, pkg));
24
+ console.log(`scope written (${pkg.scopeMode ?? 'classic'})`);