@v11g/agents-rock 1.0.9 → 1.0.11

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 (347) hide show
  1. package/README.md +3 -1
  2. package/package.json +2 -2
  3. package/plugins/business-analyst/.claude-plugin/plugin.json +2 -2
  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/evals/draft-scope-rich/case.yaml +4 -0
  20. package/plugins/business-analyst/evals/draft-scope-rich/fixture.sh +5 -0
  21. package/plugins/business-analyst/evals/draft-scope-rich/graders/conflict-question.md +11 -0
  22. package/plugins/business-analyst/evals/draft-scope-rich/graders/keep-and-exclude.md +14 -0
  23. package/plugins/business-analyst/evals/draft-scope-rich/graders/noise-and-shape.md +13 -0
  24. package/plugins/business-analyst/evals/draft-scope-rich/graders/problem-not-solution.md +13 -0
  25. package/plugins/business-analyst/evals/draft-scope-rich/graders/share-kept.md +11 -0
  26. package/plugins/business-analyst/evals/draft-scope-rich/graders/skill-fired.md +7 -0
  27. package/plugins/business-analyst/evals/draft-scope-rich/graders/vague-word.md +13 -0
  28. package/plugins/business-analyst/evals/draft-scope-rich/inputs/C1.txt +10 -0
  29. package/plugins/business-analyst/evals/draft-scope-rich/inputs/E1.txt +5 -0
  30. package/plugins/business-analyst/evals/draft-scope-rich/inputs/E2.txt +5 -0
  31. package/plugins/business-analyst/evals/draft-scope-rich/inputs/E3.txt +5 -0
  32. package/plugins/business-analyst/evals/draft-scope-rich/prompt.md +9 -0
  33. package/plugins/business-analyst/evals/draft-scope-thin/case.yaml +4 -0
  34. package/plugins/business-analyst/evals/draft-scope-thin/fixture.sh +4 -0
  35. package/plugins/business-analyst/evals/draft-scope-thin/graders/no-invention.md +18 -0
  36. package/plugins/business-analyst/evals/draft-scope-thin/graders/skill-fired.md +7 -0
  37. package/plugins/business-analyst/evals/draft-scope-thin/inputs/E1.txt +5 -0
  38. package/plugins/business-analyst/evals/draft-scope-thin/prompt.md +8 -0
  39. package/plugins/business-analyst/skills/business-analyst/README.md +8 -0
  40. package/plugins/business-analyst/skills/business-analyst/SKILL.md +47 -16
  41. package/plugins/business-analyst/skills/business-analyst/assets/review-page.html +68 -0
  42. package/plugins/business-analyst/skills/business-analyst/evals/evals.json +1 -1
  43. package/plugins/business-analyst/skills/business-analyst/references/frameworks.md +3 -2
  44. package/plugins/business-analyst/skills/business-analyst/references/interview.md +156 -8
  45. package/plugins/business-analyst/skills/business-analyst/references/review.md +18 -4
  46. package/plugins/business-analyst/skills/business-analyst/references/writing.md +49 -8
  47. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
  48. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
  49. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
  50. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
  51. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
  52. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
  53. package/plugins/business-analyst/skills/business-analyst/scripts/lib/checks.mjs +12 -6
  54. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-data.mjs +66 -0
  55. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-layout.mjs +53 -0
  56. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-page.mjs +78 -0
  57. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-checks.mjs +73 -0
  58. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-md.mjs +53 -0
  59. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-render.mjs +72 -0
  60. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-rules.mjs +90 -0
  61. package/plugins/business-analyst/skills/business-analyst/scripts/review.mjs +48 -0
  62. package/plugins/business-analyst/skills/business-analyst/scripts/review.py +60 -0
  63. package/plugins/business-analyst/skills/business-analyst/scripts/review_data.py +81 -0
  64. package/plugins/business-analyst/skills/business-analyst/scripts/review_layout.py +50 -0
  65. package/plugins/business-analyst/skills/business-analyst/scripts/review_page.py +115 -0
  66. package/plugins/business-analyst/skills/business-analyst/scripts/scope.mjs +24 -0
  67. package/plugins/business-analyst/skills/business-analyst/scripts/scope.py +35 -0
  68. package/plugins/business-analyst/skills/business-analyst/scripts/scope_checks.py +168 -0
  69. package/plugins/business-analyst/skills/business-analyst/scripts/scope_render.py +140 -0
  70. package/plugins/business-analyst/skills/business-analyst/scripts/test/checks.test.mjs +27 -0
  71. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.json +78 -0
  72. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.md +136 -0
  73. package/plugins/business-analyst/skills/business-analyst/scripts/test/python-parity.test.mjs +88 -0
  74. package/plugins/business-analyst/skills/business-analyst/scripts/test/quality-gates.test.mjs +26 -0
  75. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-browser.test.mjs +106 -0
  76. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-fixture.mjs +32 -0
  77. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-page.test.mjs +340 -0
  78. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-parity.test.mjs +79 -0
  79. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-cases.mjs +58 -0
  80. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-checks.test.mjs +31 -0
  81. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-md.test.mjs +140 -0
  82. package/plugins/business-analyst/skills/business-analyst/scripts/validate.mjs +1 -1
  83. package/plugins/business-analyst/skills/business-analyst/scripts/validate.py +17 -8
  84. package/plugins/business-analyst/skills/draft-scope/SKILL.md +46 -0
  85. package/plugins/business-analyst/skills/draft-scope/references/credits.md +12 -0
  86. package/plugins/business-analyst/skills/draft-scope/references/draft-schema.md +44 -0
  87. package/plugins/business-analyst/skills/draft-scope/references/rules.md +24 -0
  88. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-312.pyc +0 -0
  89. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-312.pyc +0 -0
  90. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-312.pyc +0 -0
  91. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-312.pyc +0 -0
  92. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-312.pyc +0 -0
  93. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-312.pyc +0 -0
  94. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-312.pyc +0 -0
  95. package/plugins/business-analyst/skills/draft-scope/scripts/build_docx.py +36 -0
  96. package/plugins/business-analyst/skills/draft-scope/scripts/check.py +53 -0
  97. package/plugins/business-analyst/skills/draft-scope/scripts/docx_body.py +58 -0
  98. package/plugins/business-analyst/skills/draft-scope/scripts/docx_flow.py +52 -0
  99. package/plugins/business-analyst/skills/draft-scope/scripts/docx_package.py +62 -0
  100. package/plugins/business-analyst/skills/draft-scope/scripts/docx_xml.py +44 -0
  101. package/plugins/business-analyst/skills/draft-scope/scripts/draft_quotes.py +49 -0
  102. package/plugins/business-analyst/skills/draft-scope/scripts/draft_rules.py +106 -0
  103. package/plugins/business-analyst/skills/draft-scope/scripts/draft_schema.py +87 -0
  104. package/plugins/business-analyst/skills/draft-scope/scripts/test/build-docx.test.mjs +76 -0
  105. package/plugins/business-analyst/skills/draft-scope/scripts/test/check-rules.test.mjs +131 -0
  106. package/plugins/business-analyst/skills/draft-scope/scripts/test/check-shape.test.mjs +70 -0
  107. package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/draft-pass.json +40 -0
  108. package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/C1.txt +7 -0
  109. package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/E1.txt +5 -0
  110. package/plugins/business-analyst/skills/draft-scope/scripts/test/gates.test.mjs +39 -0
  111. package/plugins/business-analyst/skills/draft-scope/scripts/test/helpers.mjs +30 -0
  112. package/plugins/business-analyst/skills/draft-scope/scripts/test/skill-files.test.mjs +59 -0
  113. package/plugins/business-analyst/skills/draft-scope/steps/assumptions.md +24 -0
  114. package/plugins/business-analyst/skills/draft-scope/steps/check.md +24 -0
  115. package/plugins/business-analyst/skills/draft-scope/steps/discover.md +53 -0
  116. package/plugins/business-analyst/skills/draft-scope/steps/draft.md +64 -0
  117. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  118. package/plugins/solution-architect/evals/proposal-workflow/case.yaml +6 -0
  119. package/plugins/solution-architect/evals/proposal-workflow/fixture.sh +6 -0
  120. package/plugins/solution-architect/evals/proposal-workflow/graders/inputs-written.md +23 -0
  121. package/plugins/solution-architect/evals/proposal-workflow/graders/no-proposal-md.md +7 -0
  122. package/plugins/solution-architect/evals/proposal-workflow/graders/skill-fired.md +7 -0
  123. package/plugins/solution-architect/evals/proposal-workflow/graders/validate-then-render.md +16 -0
  124. package/plugins/solution-architect/evals/proposal-workflow/prompt.md +10 -0
  125. package/plugins/solution-architect/evals/workflow-gate-no-architecture/case.yaml +4 -0
  126. package/plugins/solution-architect/evals/workflow-gate-no-architecture/fixture.sh +6 -0
  127. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/no-classic-fallback.md +10 -0
  128. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/nothing-written.md +7 -0
  129. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/skill-fired.md +7 -0
  130. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/stops-at-gate.md +11 -0
  131. package/plugins/solution-architect/evals/workflow-gate-no-architecture/prompt.md +7 -0
  132. package/plugins/solution-architect/evals/workflow-happy-path/case.yaml +4 -0
  133. package/plugins/solution-architect/evals/workflow-happy-path/fixture.sh +6 -0
  134. package/plugins/solution-architect/evals/workflow-happy-path/graders/no-estimation-md.md +7 -0
  135. package/plugins/solution-architect/evals/workflow-happy-path/graders/pages-or-stop.md +16 -0
  136. package/plugins/solution-architect/evals/workflow-happy-path/graders/routed-to-workflow.md +12 -0
  137. package/plugins/solution-architect/evals/workflow-happy-path/graders/skill-fired.md +7 -0
  138. package/plugins/solution-architect/evals/workflow-happy-path/graders/three-questions-max.md +14 -0
  139. package/plugins/solution-architect/evals/workflow-happy-path/graders/workflow-or-exact-stop.md +15 -0
  140. package/plugins/solution-architect/evals/workflow-happy-path/prompt.md +9 -0
  141. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +8 -7
  142. package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +5 -5
  143. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +26 -4
  144. package/plugins/solution-architect/skills/analyze-requirements/evals/evals.json +50 -6
  145. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.json +31 -0
  146. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.md +17 -0
  147. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/C1-kickoff-call.txt +16 -0
  148. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/E1-intro-email.md +9 -0
  149. package/plugins/solution-architect/skills/analyze-requirements/references/extract.md +108 -0
  150. package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +39 -5
  151. package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +1 -1
  152. package/plugins/solution-architect/skills/analyze-requirements/references/quality-goals.md +84 -0
  153. package/plugins/solution-architect/skills/analyze-requirements/references/research.md +1 -1
  154. package/plugins/solution-architect/skills/analyze-requirements/references/rewriting.md +7 -2
  155. package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +10 -6
  156. package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +45 -3
  157. package/plugins/solution-architect/skills/analyze-requirements/scripts/ba-facts.mjs +32 -0
  158. package/plugins/solution-architect/skills/analyze-requirements/scripts/check-quotes.mjs +39 -0
  159. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/ba-package.mjs +75 -0
  160. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +19 -7
  161. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +1 -1
  162. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +42 -11
  163. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +15 -4
  164. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +1 -1
  165. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/strategy-sections.mjs +30 -0
  166. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +14 -2
  167. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-quotes.mjs +55 -0
  168. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-strategy.mjs +65 -0
  169. package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +18 -5
  170. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-facts-cli.test.mjs +55 -0
  171. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package-cli.test.mjs +101 -0
  172. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package.test.mjs +115 -0
  173. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +77 -2
  174. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/check-quotes-cli.test.mjs +49 -0
  175. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +49 -4
  176. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/extract-workflow.test.mjs +69 -0
  177. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +14 -0
  178. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +19 -5
  179. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/record-cli.test.mjs +1 -1
  180. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +69 -2
  181. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rewriting.test.mjs +1 -1
  182. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +6 -0
  183. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +19 -0
  184. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes-cli.test.mjs +58 -0
  185. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes.test.mjs +81 -0
  186. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy-cli.test.mjs +32 -0
  187. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy.test.mjs +118 -0
  188. package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +17 -6
  189. package/plugins/solution-architect/skills/analyze-requirements/workflows/extract.js +51 -0
  190. package/plugins/solution-architect/skills/estimate/README.md +18 -3
  191. package/plugins/solution-architect/skills/estimate/SKILL.md +18 -75
  192. package/plugins/solution-architect/skills/estimate/classic/FLOW.md +77 -0
  193. package/plugins/solution-architect/skills/estimate/classic/assets/estimate-template.html +1337 -0
  194. package/plugins/solution-architect/skills/estimate/{references → classic/references}/task-shapes.md +1 -1
  195. package/plugins/solution-architect/skills/estimate/{references → classic/references}/writing.md +2 -2
  196. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/compute.mjs +1 -1
  197. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/checks.mjs +1 -1
  198. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/roadmap.mjs +1 -1
  199. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/rollup.mjs +5 -5
  200. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/schema.mjs +4 -26
  201. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-csv.mjs +2 -2
  202. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-html.mjs +2 -2
  203. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/render.mjs +8 -7
  204. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/score-review.mjs +3 -3
  205. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/baselines.test.mjs +3 -3
  206. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser-agentic.test.mjs +2 -2
  207. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser.test.mjs +2 -2
  208. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/compute.test.mjs +1 -1
  209. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/e2e.test.mjs +6 -6
  210. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/estimate-math.test.mjs +3 -3
  211. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/measurements.test.mjs +1 -1
  212. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/pricing.test.mjs +1 -1
  213. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/project-price.test.mjs +1 -1
  214. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/quality-gates.test.mjs +7 -1
  215. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/references.test.mjs +6 -6
  216. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/render.test.mjs +3 -3
  217. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/schema.test.mjs +1 -1
  218. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/score-review.test.mjs +6 -6
  219. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/scoring.test.mjs +1 -1
  220. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/url-state.test.mjs +2 -2
  221. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/validate.test.mjs +1 -1
  222. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/xlsx-export.test.mjs +3 -3
  223. package/plugins/solution-architect/skills/estimate/classic/scripts/test/zip-store.test.mjs +26 -0
  224. package/plugins/solution-architect/skills/estimate/evals/evals.json +37 -2
  225. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +28 -0
  226. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  227. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.md +141 -0
  228. package/plugins/solution-architect/skills/estimate/shared/assets/xlsx-export.js +336 -0
  229. package/plugins/solution-architect/skills/estimate/shared/lib/agentic-task-schema.mjs +24 -0
  230. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/context-schema.mjs +2 -2
  231. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/inline.mjs +8 -0
  232. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring-schema.mjs +1 -1
  233. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring.mjs +1 -1
  234. package/plugins/solution-architect/skills/estimate/shared/lib/zip.mjs +60 -0
  235. package/plugins/solution-architect/skills/estimate/workflow-based/FLOW.md +91 -0
  236. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-components.html +994 -0
  237. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-template.html +440 -0
  238. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimator-system.xlsx +0 -0
  239. package/plugins/solution-architect/skills/estimate/workflow-based/assets/score-review.html +838 -0
  240. package/plugins/solution-architect/skills/estimate/workflow-based/references/hidden-work-by-type.md +429 -0
  241. package/plugins/solution-architect/skills/estimate/workflow-based/references/linking.md +59 -0
  242. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +80 -0
  243. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-template.mjs +60 -0
  244. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-workflow-template.mjs +51 -0
  245. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-xlsx-template.py +144 -0
  246. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/compute.mjs +32 -0
  247. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +44 -0
  248. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-view.mjs +71 -0
  249. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/pair-findings.mjs +19 -0
  250. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/requirements.mjs +33 -0
  251. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/rollup.mjs +66 -0
  252. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +69 -0
  253. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema.mjs +70 -0
  254. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-diff.mjs +54 -0
  255. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-html.mjs +52 -0
  256. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +51 -0
  257. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/render.mjs +42 -0
  258. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/score-review.mjs +46 -0
  259. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/arch-link.js +9 -0
  260. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/click.js +28 -0
  261. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/prelude.js +4 -0
  262. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/view.js +63 -0
  263. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/browser.test.mjs +127 -0
  264. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-pages.test.mjs +43 -0
  265. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-template.test.mjs +18 -0
  266. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/cli.test.mjs +48 -0
  267. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/estimator-system.test.mjs +66 -0
  268. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/ARCHITECTURE-mini.md +31 -0
  269. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/feedback.json +19 -0
  270. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +80 -0
  271. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/measurements.jsonl +0 -0
  272. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/requirements.json +79 -0
  273. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/page-view.test.mjs +54 -0
  274. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/pages-browser.test.mjs +209 -0
  275. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/quality-gates.test.mjs +25 -0
  276. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/render.test.mjs +54 -0
  277. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/requirements.test.mjs +33 -0
  278. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +80 -0
  279. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/schema.test.mjs +61 -0
  280. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/score-review.test.mjs +108 -0
  281. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/stage.mjs +32 -0
  282. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/workflow-script.test.mjs +24 -0
  283. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +58 -0
  284. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/validate.mjs +19 -0
  285. package/plugins/solution-architect/skills/proposal/README.md +13 -0
  286. package/plugins/solution-architect/skills/proposal/SKILL.md +8 -0
  287. package/plugins/solution-architect/skills/proposal/assets/proposal-workflow.html +143 -0
  288. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +31 -0
  289. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +468 -0
  290. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +773 -0
  291. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/measurements.jsonl +0 -0
  292. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  293. package/plugins/solution-architect/skills/proposal/references/review.md +11 -0
  294. package/plugins/solution-architect/skills/proposal/references/workflow.md +88 -0
  295. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-body.mjs +42 -0
  296. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-package.mjs +56 -0
  297. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-xml.mjs +44 -0
  298. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-checks.mjs +71 -0
  299. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-cli.mjs +46 -0
  300. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-html.mjs +39 -0
  301. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-lead.mjs +45 -0
  302. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-page.mjs +30 -0
  303. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-view.mjs +80 -0
  304. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +5 -1
  305. package/plugins/solution-architect/skills/proposal/scripts/test/docx.test.mjs +68 -0
  306. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +2 -2
  307. package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +9 -2
  308. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-inputs-pass.json +17 -0
  309. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +2 -2
  310. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +2 -2
  311. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-browser.test.mjs +96 -0
  312. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-checks.test.mjs +98 -0
  313. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-docs.test.mjs +25 -0
  314. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-render.test.mjs +75 -0
  315. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-stage.mjs +15 -0
  316. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-view.test.mjs +78 -0
  317. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +4 -1
  318. package/plugins/solution-architect/workflows/review-links.js +61 -0
  319. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +0 -1677
  320. /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/estimate-template-agentic.html +0 -0
  321. /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/scores-review-template.html +0 -0
  322. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/agentic-estimation.md +0 -0
  323. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/ai-multipliers.md +0 -0
  324. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/interview.md +0 -0
  325. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/scoring-guide.md +0 -0
  326. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/slicing.md +0 -0
  327. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/techniques.md +0 -0
  328. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/agentic-checks.mjs +0 -0
  329. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/components.mjs +0 -0
  330. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/md-tables.mjs +0 -0
  331. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/redact.mjs +0 -0
  332. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/scoring-checks.mjs +0 -0
  333. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-fail.md +0 -0
  334. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-pass.md +0 -0
  335. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-inputs.json +0 -0
  336. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/booking-inputs.json +0 -0
  337. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-fail.md +0 -0
  338. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-pass.md +0 -0
  339. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/measurements.jsonl +0 -0
  340. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/zip.mjs +0 -0
  341. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/validate.mjs +0 -0
  342. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/baselines.mjs +0 -0
  343. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/estimate-math.mjs +0 -0
  344. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/measurements.mjs +0 -0
  345. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/pricing.mjs +0 -0
  346. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/project-price.mjs +0 -0
  347. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/score-diff.mjs +0 -0
@@ -0,0 +1,78 @@
1
+ // Draws the read-only review page (spec R1): requirements.json in the shape
2
+ // of the PO's own document, static HTML, no script. The template holds the
3
+ // styles; two slots take the title and the body. A slot missing or doubled
4
+ // throws, so a template edit can never ship a page without its content.
5
+ import { readFileSync } from 'node:fs';
6
+ import { pageData } from './review-data.mjs';
7
+ import { layout } from './review-layout.mjs';
8
+
9
+ const esc = (s) => String(s).replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;');
10
+ const TAG = '<span class="tag">★ New</span> ';
11
+ const src = (added) => `<span class="src">Added: ${esc(added)}</span>`;
12
+ const asset = (name) => readFileSync(new URL(`../../assets/${name}`, import.meta.url), 'utf8');
13
+
14
+ const cell = (area, cls, html) => `<div class="${cls}" style="grid-area:${area}">${html}</div>`;
15
+ const area = (row, col, span) => (span > 1 ? `${row}/${col}/auto/span ${span}` : `${row}/${col}`);
16
+ const wide = (cls, span) => (span > 1 ? `${cls} wide` : cls);
17
+
18
+ const stepCells = (lanes) => lanes.flatMap((l, i) => [...(i ? [cell(`1/${l.col - 1}`, 'arrow', '→')] : []),
19
+ cell(area(1, l.col, l.span), wide('step', l.span), esc(l.name))]);
20
+
21
+ // Depth d: connector (line, label, arrowhead) in row 2d, the box in row 2d + 1.
22
+ const branchCells = ({ b, depth, col, span }) => [
23
+ cell(area(2 * depth, col, span), 'down', b.label ? `<span class="lbl">${esc(b.label)}</span>` : ''),
24
+ b.back ? cell(area(2 * depth + 1, col, span), 'step back', `↺ back to ${esc(b.to)}`)
25
+ : cell(area(2 * depth + 1, col, span), wide('step alt', span), esc(b.to))];
26
+
27
+ function flowHtml(w) {
28
+ const s = w.sub;
29
+ const name = s ? 'Sub-workflow' : 'Main workflow';
30
+ const sub = s ? ` — starts at ${esc(s.startsAt)}${s.rejoins ? `, rejoins ${esc(s.rejoins)}` : ''}${s.share ? ` · ${esc(s.share)}` : ''}` : '';
31
+ const { lanes, boxes } = layout(w.steps, w.branches);
32
+ return [`<p class="flow-name">${name} · ${esc(w.name)}${sub}</p>`, '<div class="flow">', '<div class="grid">',
33
+ ...stepCells(lanes), ...boxes.flatMap(branchCells), '</div>', '</div>'].join('\n');
34
+ }
35
+
36
+ function featureRow(f) {
37
+ if (!f.added) return `<tr><td>${esc(f.name)}</td><td>${esc(f.does)}</td></tr>`;
38
+ return `<tr class="new"><td>${TAG}${esc(f.name)}${src(f.added)}</td><td>${esc(f.does)}</td></tr>`;
39
+ }
40
+
41
+ function systemHtml(s, i) {
42
+ return ['<section>', `<h2><span class="sysno">System ${i + 1}:</span> ${esc(s.name)}</h2>`, `<p>${esc(s.purpose)}</p>`, ...s.flows.map(flowHtml),
43
+ '<table>', '<tr><th>Feature</th><th>What it does</th></tr>', ...s.features.map(featureRow), '</table>', '</section>'].join('\n');
44
+ }
45
+
46
+ function assumptionsHtml(list) {
47
+ if (!list.length) return [];
48
+ const li = (a) => (a.added ? `<li class="new">${TAG}${esc(a.text)}${src(a.added)}</li>` : `<li>${esc(a.text)}</li>`);
49
+ return ['<section>', '<h2>Assumptions</h2>', '<ul>', ...list.map(li), '</ul>', '</section>'];
50
+ }
51
+
52
+ function summary(d) {
53
+ const feats = d.systems.flatMap((s) => s.features);
54
+ const fresh = [...feats, ...d.assumptions].filter((r) => r.added).length;
55
+ const n = (k, word) => `${k} ${word}${k === 1 ? '' : 's'}`;
56
+ const parts = [n(d.systems.length, 'system'), n(feats.length, 'feature'), n(d.assumptions.length, 'assumption')];
57
+ return parts.join(' · ') + (fresh ? ` · ${TAG}${fresh} added in interview` : '');
58
+ }
59
+
60
+ export function bodyHtml(d) {
61
+ return ['<header>', `<h1>${esc(d.title)}</h1>`, `<p class="byline">Requirements review · ${esc(d.date)} · read-only</p>`,
62
+ `<p class="summary">${summary(d)}</p>`, '</header>', ...d.systems.map(systemHtml), ...assumptionsHtml(d.assumptions)].join('\n');
63
+ }
64
+
65
+ function fill(template, slot, value) {
66
+ const parts = template.split(slot);
67
+ if (parts.length !== 2) throw new Error(`template slot ${slot} must appear once`);
68
+ return parts.join(value);
69
+ }
70
+
71
+ export function fillPage(template, title, body) {
72
+ return fill(fill(template, '<!--@TITLE@-->', esc(title)), '<!--@BODY@-->', body);
73
+ }
74
+
75
+ export function pageHtml(pkg, date) {
76
+ const d = pageData(pkg, date);
77
+ return fillPage(asset('review-page.html'), d.title, bodyHtml(d));
78
+ }
@@ -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