@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,79 @@
1
+ {
2
+ "schemaVersion": "1.0",
3
+ "lead": "sin-kowa-mini",
4
+ "status": "ANALYZED",
5
+ "depth": "STANDARD",
6
+ "updated": "2026-10-06",
7
+ "mode": "greenfield",
8
+ "scopeMode": "workflow",
9
+ "mapLabel": "IMDA roadmap pillar",
10
+ "context": {
11
+ "problem": "Clients dispute charges after the ship sails and there is no record of what was packed.",
12
+ "goals": [
13
+ { "id": "G-001", "goal": "Stop billing disputes after sailing", "metric": "disputes per month down 50% in 6 months", "source": "PO brief" }
14
+ ],
15
+ "successMetrics": ["disputes per month down 50% within 6 months of go-live"]
16
+ },
17
+ "actors": [
18
+ { "id": "ACT-001", "name": "Packer", "type": "human", "goal": "pack an order without paper lists", "painPoints": ["packs from a printed list"] },
19
+ { "id": "ACT-002", "name": "Office staff", "type": "human", "goal": "invoice the moment goods are delivered", "painPoints": ["waits weeks for the paper delivery order"] }
20
+ ],
21
+ "workflows": [
22
+ { "id": "WF-001", "name": "Order to invoice today", "state": "as-is", "trigger": "ship sends an order by email or phone", "steps": ["office staff key the order in", "warehouse packs from a paper list", "paper delivery order signed at the dock", "invoice raised when the paper returns"], "exceptions": ["client disputes a charge after sailing"] },
23
+ { "id": "WF-002", "name": "Order pipeline", "state": "to-be", "label": "confirmed", "source": "PO brief, System 1", "trigger": "order confirmed by office staff", "steps": ["Order In", "Pack", "Pack Review", "Shipped"], "branches": [{ "from": "Pack", "to": "Short-pack alert", "label": "can't fulfil" }, { "from": "Pack Review", "to": "Pack", "label": "mismatch" }], "replaces": ["WF-001"], "exceptions": [] },
24
+ { "id": "WF-003", "name": "Order to cash", "state": "to-be", "label": "recommended", "source": "drafted from PO brief, System 2", "trigger": "order received by email or phone", "steps": ["Order received", "Quote", "Invoice", "Paid"], "branches": [], "replaces": ["WF-001"], "exceptions": [] },
25
+ { "id": "WF-004", "name": "Custom order", "state": "to-be", "label": "confirmed", "source": "PO brief, System 2 sub-flow", "trigger": "order holds an item that is sourced, not stocked", "steps": ["Flag as custom", "Vendor PO", "Receive into stock"], "branches": [], "sub": { "startsAt": "WF-003:Order received", "rejoins": "WF-002", "share": "about 20% of orders" }, "exceptions": [] }
26
+ ],
27
+ "systems": [
28
+ { "id": "SYS-001", "name": "Warehouse operations", "purpose": "Moves an order from intake to the dock; the one screen a warehouse worker needs.", "map": "Warehouse Automation", "label": "confirmed", "source": "PO brief, System 1", "workflows": ["WF-002"], "features": ["FEAT-001", "FEAT-002"] },
29
+ { "id": "SYS-002", "name": "Orders & invoicing", "purpose": "Quotation through to a paid invoice.", "map": "Finance/Documentation", "label": "confirmed", "source": "PO brief, System 2", "workflows": ["WF-003", "WF-004"], "features": ["FEAT-003", "FEAT-004", "FEAT-005"] }
30
+ ],
31
+ "features": [
32
+ { "id": "FEAT-001", "name": "Order pipeline & stage engine", "does": "Moves an order through each stage, with task views per role", "label": "confirmed", "source": "PO brief, System 1", "steps": ["WF-002:Order In", "WF-002:Pack", "WF-002:Pack Review", "WF-002:Shipped"], "requirements": ["FR-001"] },
33
+ { "id": "FEAT-002", "name": "Short-pack alert", "does": "Flags an item that cannot be packed, in time to buy or cancel", "label": "confirmed", "source": "PO brief, System 1", "steps": ["WF-002:Short-pack alert"], "requirements": ["FR-002"] },
34
+ { "id": "FEAT-003", "name": "Order intake & quotation", "does": "Captures email and phone orders and prices them", "label": "confirmed", "source": "PO brief, System 2", "steps": ["WF-003:Order received", "WF-003:Quote", "WF-004:Flag as custom"], "requirements": ["FR-003"] },
35
+ { "id": "FEAT-004", "name": "Invoice from packed quantities", "does": "Raises the invoice from what was packed and shipped", "label": "recommended", "source": "drafted from PO brief, System 2", "steps": ["WF-002:Shipped", "WF-003:Invoice", "WF-003:Paid"], "requirements": ["FR-004"] },
36
+ { "id": "FEAT-005", "name": "One login, role-based screens", "does": "One login; packers see packing tasks, office staff see orders and invoices", "label": "confirmed", "source": "PO brief, System 1", "steps": ["*"], "requirements": ["FR-005"] }
37
+ ],
38
+ "requirements": [
39
+ { "id": "FR-001", "text": "The system must move each order through the stages Order In, Pack, Pack Review and Shipped.", "label": "confirmed", "source": "PO brief, System 1", "traces": { "goal": "G-001", "workflow": "WF-002", "rules": [] }, "scope": "in", "acceptance": [] },
40
+ { "id": "FR-002", "text": "The system must let a packer flag an item that cannot be packed and alert office staff.", "label": "confirmed", "source": "PO brief, System 1", "traces": { "goal": "G-001", "workflow": "WF-002", "rules": [] }, "scope": "in", "acceptance": [] },
41
+ { "id": "FR-003", "text": "Office staff must be able to enter an order received by email or phone and produce a quotation.", "label": "confirmed", "source": "PO brief, System 2", "traces": { "goal": "G-001", "workflow": "WF-003", "rules": [] }, "scope": "in", "acceptance": [] },
42
+ { "id": "FR-004", "text": "The system must raise the invoice from packed-and-audited quantities.", "label": "assumed", "source": "PO brief, System 2", "traces": { "goal": "G-001", "workflow": "WF-003", "rules": ["BR-001"] }, "scope": "in", "acceptance": ["SC-001"] },
43
+ { "id": "FR-005", "text": "The system must provide one login, with packers limited to packing tasks.", "label": "confirmed", "source": "PO brief, System 1", "traces": { "goal": "G-001", "workflow": "WF-002", "rules": [] }, "scope": "in", "acceptance": [] },
44
+ { "id": "FR-006", "text": "The system must print a pallet label at the Pack stage.", "label": "assumed", "source": "PO brief, System 4", "traces": { "goal": "G-001", "workflow": "WF-002", "rules": [] }, "scope": "future", "acceptance": [] }
45
+ ],
46
+ "businessRules": [
47
+ { "id": "BR-001", "rule": "Invoice quantity equals packed-and-audited quantity.", "source": "PO brief, System 2", "examples": ["ordered 10, packed 10 -> invoice 10", "ordered 10, packed 8 -> invoice 8"] }
48
+ ],
49
+ "scenarios": [
50
+ { "id": "SC-001", "requirement": "FR-004", "type": "happy", "given": "an order of 10 items with 8 packed", "when": "the invoice is raised", "then": "it bills 8 items" }
51
+ ],
52
+ "nfrs": [
53
+ { "id": "NFR-001", "area": "availability", "text": "Scans made without connectivity must be kept and synced within 5 minutes of reconnecting.", "label": "assumed" }
54
+ ],
55
+ "integrations": [
56
+ { "id": "INT-001", "system": "InvoiceNow network", "direction": "write", "label": "recommended" }
57
+ ],
58
+ "data": [
59
+ { "id": "DAT-001", "entity": "Order", "sensitivity": "commercial", "volume": "about 300 per month", "label": "assumed" }
60
+ ],
61
+ "constraints": [
62
+ { "id": "CON-001", "text": "Vessels are offline at sea; delivery orders are signed on paper at the dock today.", "source": "PO brief" }
63
+ ],
64
+ "assumptions": [
65
+ { "id": "ASM-001", "text": "Packers carry a phone with a camera on the warehouse floor.", "impact": "medium", "status": "unconfirmed" }
66
+ ],
67
+ "openQuestions": [
68
+ { "id": "Q-001", "question": "Is order to cash the right shape: quote before the order is confirmed?", "priority": "P1", "reason": "the workflow was drafted, not described by the client", "affects": ["WF-003"], "status": "open", "answer": null, "architectureBlocker": false },
69
+ { "id": "Q-002", "question": "Should the invoice be raised at shipping, or when the delivery order is signed?", "priority": "P2", "reason": "decides the invoice trigger", "affects": ["FEAT-004", "INT-001"], "status": "open", "answer": null, "architectureBlocker": false }
70
+ ],
71
+ "conflicts": [],
72
+ "scope": { "out": ["last-mile delivery tracking"], "future": ["pallet labels"], "unconfirmed": [] },
73
+ "ai": null,
74
+ "readiness": {
75
+ "overall": 63,
76
+ "areas": { "businessContext": 80, "workflows": 70, "rules": 60, "integrations": 50, "data": 60, "nfrs": 60 },
77
+ "blockers": []
78
+ }
79
+ }
@@ -22,6 +22,17 @@ way the client will.
22
22
 
23
23
  Return findings as a list; no rewrites.
24
24
 
25
+ ## Workflow mode
26
+
27
+ Run after `render.mjs` first writes `dist/proposal.html`, before human
28
+ review. Dispatch one general-purpose subagent with **only**:
29
+ `dist/proposal.html`, estimation.json, and the client tech level. Same
30
+ charter, read against the page text, except item 2, which becomes: does
31
+ the Scope section say what we build, and the Cost section what it costs?
32
+ Findings are fixed in `proposal-inputs.json` (the only text you wrote);
33
+ a finding about a system, feature, assumption or exclusion goes back to
34
+ the BA package or the estimate, never into the proposal.
35
+
25
36
  ## Loop bound
26
37
 
27
38
  Fix findings → re-run `validate.mjs` → one findings-only re-review, then
@@ -0,0 +1,88 @@
1
+ # Workflow mode — Systems & Workflows proposal page
2
+
3
+ Read when `estimation.json` has `inputs.scopeMode: "workflow"`. The page
4
+ copies the format of the proposal sent to Sin Kowa: Scope, one section per
5
+ system (its workflow diagrams and a Feature | What it does table),
6
+ Milestones, Assumptions & exclusions, Cost estimate. Every fact on it comes
7
+ from data; you write only the sentences, in `proposal-inputs.json`. There
8
+ is no proposal.md, and nobody edits one: the human reads the page, asks for
9
+ changes in chat, and downloads the DOCX or PDF to send.
10
+
11
+ ## 1. Where each part comes from
12
+
13
+ | Part | Source |
14
+ | --- | --- |
15
+ | Systems, workflows, features and what each does, scope.out | `requirements.json` (the BA package the estimate names) |
16
+ | Milestone contents, assumptions, exclusions, price | `estimation.json` |
17
+ | Title, byline, scope intro, one optional sentence per system, milestone client names and what each demonstrates | `proposal-inputs.json` (you) |
18
+
19
+ Prices are USD. The team changes the currency, and adds an About-us or
20
+ next-steps section if they want one, in the copy they send — never in a
21
+ skill file.
22
+
23
+ ## 2. Flow
24
+
25
+ 1. **Gate.** `estimation.json` exists with `scopeMode: "workflow"`, and the
26
+ `requirements.json` it names exists. A missing estimate → stop: "run the
27
+ estimate skill first." `validate.mjs` (step 4) re-runs the estimate's own
28
+ validation; a finding there → stop and name the estimate skill.
29
+ 2. **Interview, one question at a time, only what is unknown.** Client name;
30
+ tech level (non-tech | low-tech | technical, as classic
31
+ `references/interview.md` §1); the firm name (`firm` from the profile,
32
+ classic §3 lookup — ask only the name if there is no profile). Then show
33
+ the milestones (`computed.features[].milestone`, with the features each
34
+ finishes) and propose a client name and one "what it demonstrates" line
35
+ for each; the user corrects them.
36
+ 3. **Write `proposal-inputs.json`** beside `estimation.json` (§3).
37
+ 4. **Validate:** `node scripts/validate.mjs --estimation <dir>/estimation.json
38
+ --inputs <dir>/proposal-inputs.json` — fix findings, re-run until clean.
39
+ 5. **Render:** `node scripts/render.mjs --estimation <dir>/estimation.json
40
+ --inputs <dir>/proposal-inputs.json --mermaid-bundle <path> --out <dir>/dist`
41
+ — the same mermaid bundle as classic step 8. It re-runs validation and
42
+ writes nothing on a finding.
43
+ 6. **Fresh-eyes review** of `dist/proposal.html` (`references/review.md`,
44
+ Workflow mode); fix in `proposal-inputs.json`, steps 4–5 again.
45
+ 7. **Serve and hand over.** `node ../analyze-requirements/scripts/serve.mjs <dir>`.
46
+ Tell the user: the URL; that the page has Download PDF and Download DOCX
47
+ buttons; that prices are USD and currency, About-us and next steps are
48
+ theirs to change in the sent copy. Changes → edit `proposal-inputs.json`
49
+ (or, for a fact, the BA package or estimate) → steps 4–7 again.
50
+
51
+ ## 3. `proposal-inputs.json`
52
+
53
+ ```json
54
+ {
55
+ "client": "Sin Kowa",
56
+ "title": "Sin Kowa Digital Transformation",
57
+ "firm": "Code Engine Studio",
58
+ "date": "2026-10-07",
59
+ "techLevel": "non-tech",
60
+ "jargonAllow": [],
61
+ "scopeIntro": "This proposal covers two systems for Phase 1 …",
62
+ "systems": { "SYS-002": "It closes the paper delivery-order gap …" },
63
+ "milestones": {
64
+ "M1 - Walking skeleton": { "name": "Digitise core records", "demonstrates": "Orders move through each stage on screen …" }
65
+ }
66
+ }
67
+ ```
68
+
69
+ - `title` becomes "<title> — Systems & Workflows Proposal"; `date` is today
70
+ (ISO) and shows as "Oct 7, 2026 · <firm>".
71
+ - `systems` is optional, keyed by the BA system id; the sentence follows the
72
+ system's own purpose line.
73
+ - `milestones` needs an entry for every milestone the estimate uses, keyed
74
+ by its estimate name, and no others. The page numbers them in order.
75
+
76
+ ## 4. Sentence rules (validate.mjs refuses each)
77
+
78
+ The title counts as a sentence: it is the page heading.
79
+
80
+ - No price of any kind in a sentence (`$40k`, `USD 5,000`, `12k SGD`,
81
+ `5,000 dollars`, `RM 20,000`, `1.2 million usd`): the only prices on the
82
+ page are the estimate's.
83
+ - No internal ID (`FEAT-001`, `SYS-002`, `FR-003` …) and no engineer
84
+ milestone name (`M1 - Walking skeleton`): name the thing in words.
85
+ - `non-tech`: no word from the jargon list (`scripts/lib/jargon.mjs`) unless
86
+ listed in `jargonAllow` because the client uses it.
87
+ - No timeline, rate, team or score: the estimate produces none for the
88
+ client (the fresh-eyes review catches what no script can).
@@ -0,0 +1,42 @@
1
+ // document.xml for the proposal: the same page data the HTML prints, in the
2
+ // same order, as Word headings, paragraphs, tables and lists. Diagrams are
3
+ // the page's drawn workflows as PNGs; a workflow with no image (the drawing
4
+ // failed) falls back to its steps written out.
5
+ import { para, bullets, table, image } from './docx-xml.mjs';
6
+
7
+ const NS = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" '
8
+ + 'xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" '
9
+ + 'xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"';
10
+ const SECTION = '<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1134" w:right="1134" w:bottom="1134" w:left="1134" w:header="709" w:footer="709" w:gutter="0"/></w:sectPr>';
11
+
12
+ function scopeXml({ scope }) {
13
+ const head = scope.mapLabel ? ['System', scope.mapLabel] : ['System'];
14
+ const rows = scope.systems.map((s) => (scope.mapLabel ? [s.name, s.map] : [s.name]));
15
+ return para('Scope: what this proposal covers', 'Heading1') + para(scope.intro) + table(head, rows) + para(scope.outLine);
16
+ }
17
+
18
+ function systemXml(s, { images, first }) {
19
+ const flows = s.flows.map((f, i) => {
20
+ const img = images[first + i];
21
+ return para(f.label, 'Heading3') + (img ? image(img, first + i + 1) : para(f.steps));
22
+ }).join('');
23
+ return para(`System ${s.no}: ${s.name}`, 'Heading1') + para(s.purpose) + para(s.extra) + flows
24
+ + table(['Feature', 'What it does'], s.features.map((f) => [f.name, f.does]));
25
+ }
26
+
27
+ function closingXml({ milestones, register, cost }) {
28
+ return para('Milestones', 'Heading1') + para(milestones.lead)
29
+ + table(['Milestone', 'Includes', 'What it demonstrates'], milestones.rows.map((m) => [m.title, m.includes, m.demonstrates]))
30
+ + para('Assumptions & exclusions', 'Heading1') + para(register.lead)
31
+ + para('Assumptions', 'Heading2') + bullets(register.assumptions) + para('Exclusions', 'Heading2') + bullets(register.exclusions)
32
+ + para('Cost estimate', 'Heading1') + para(cost.lead)
33
+ + table(['Range', 'If one fixed number is needed'], [[cost.range, cost.single], [cost.rangeNote, cost.singleNote]]);
34
+ }
35
+
36
+ // images[k] belongs to the k-th workflow in page order (null when not drawn).
37
+ export function documentXml(view, images) {
38
+ const firsts = view.systems.map((_, i) => view.systems.slice(0, i).reduce((n, s) => n + s.flows.length, 0));
39
+ const body = para(view.title, 'Title') + para(view.byline, 'Subtitle') + scopeXml(view)
40
+ + view.systems.map((s, i) => systemXml(s, { images, first: firsts[i] })).join('') + closingXml(view);
41
+ return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<w:document ${NS}><w:body>${body}${SECTION}</w:body></w:document>`;
42
+ }
@@ -0,0 +1,56 @@
1
+ // The DOCX package around document.xml: content types, relationships, the
2
+ // built-in styles the body uses, one bullet list, and the diagram PNGs.
3
+ // Standard Word styles only — the team restyles the copy they send.
4
+ import { zipStore } from '../../../estimate/shared/lib/zip.mjs';
5
+ import { documentXml } from './docx-body.mjs';
6
+
7
+ const XML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
8
+ const W = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"';
9
+ const REL = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
10
+ const MAIN = 'application/vnd.openxmlformats-officedocument.wordprocessingml';
11
+
12
+ const CONTENT_TYPES = `${XML}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">`
13
+ + '<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'
14
+ + '<Default Extension="xml" ContentType="application/xml"/><Default Extension="png" ContentType="image/png"/>'
15
+ + `<Override PartName="/word/document.xml" ContentType="${MAIN}.document.main+xml"/>`
16
+ + `<Override PartName="/word/styles.xml" ContentType="${MAIN}.styles+xml"/>`
17
+ + `<Override PartName="/word/numbering.xml" ContentType="${MAIN}.numbering+xml"/></Types>`;
18
+
19
+ const ROOT_RELS = `${XML}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`
20
+ + `<Relationship Id="rId1" Type="${REL}/officeDocument" Target="word/document.xml"/></Relationships>`;
21
+
22
+ const pStyle = (id, name, props) => `<w:style w:type="paragraph" w:styleId="${id}"><w:name w:val="${name}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/>${props}</w:style>`;
23
+ const heading = (level, size, color) => pStyle(`Heading${level}`, `heading ${level}`,
24
+ `<w:pPr><w:keepNext/><w:spacing w:before="${level === 1 ? 360 : 240}" w:after="120"/><w:outlineLvl w:val="${level - 1}"/></w:pPr><w:rPr><w:b/><w:color w:val="${color}"/><w:sz w:val="${size}"/></w:rPr>`);
25
+ const BORDER = ['top', 'left', 'bottom', 'right', 'insideH', 'insideV'].map((b) => `<w:${b} w:val="single" w:sz="4" w:space="0" w:color="D9DDE3"/>`).join('');
26
+
27
+ const STYLES = `${XML}<w:styles ${W}><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:cs="Calibri"/><w:sz w:val="22"/></w:rPr></w:rPrDefault>`
28
+ + '<w:pPrDefault><w:pPr><w:spacing w:after="120" w:line="276" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults>'
29
+ + '<w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/></w:style>'
30
+ + pStyle('Title', 'Title', '<w:pPr><w:spacing w:after="80"/></w:pPr><w:rPr><w:b/><w:sz w:val="44"/></w:rPr>')
31
+ + pStyle('Subtitle', 'Subtitle', '<w:rPr><w:color w:val="5C6470"/><w:sz w:val="24"/></w:rPr>')
32
+ + heading(1, 32, '0F5C5A') + heading(2, 24, '1A1D21') + heading(3, 22, '5C6470')
33
+ + pStyle('ListParagraph', 'List Paragraph', '<w:pPr><w:ind w:left="720"/></w:pPr>')
34
+ + `<w:style w:type="table" w:styleId="TableGrid"><w:name w:val="Table Grid"/><w:tblPr><w:tblBorders>${BORDER}</w:tblBorders>`
35
+ + '<w:tblCellMar><w:top w:w="60" w:type="dxa"/><w:left w:w="100" w:type="dxa"/><w:bottom w:w="60" w:type="dxa"/><w:right w:w="100" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style></w:styles>';
36
+
37
+ const NUMBERING = `${XML}<w:numbering ${W}><w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="hybridMultilevel"/>`
38
+ + '<w:lvl w:ilvl="0"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="•"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="720" w:hanging="360"/></w:pPr></w:lvl>'
39
+ + '</w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num></w:numbering>';
40
+
41
+ function documentRels(images) {
42
+ const media = images.map((img, i) => (img ? `<Relationship Id="rIdImg${i + 1}" Type="${REL}/image" Target="media/image${i + 1}.png"/>` : '')).join('');
43
+ return `${XML}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`
44
+ + `<Relationship Id="rIdStyles" Type="${REL}/styles" Target="styles.xml"/><Relationship Id="rIdNumbering" Type="${REL}/numbering" Target="numbering.xml"/>${media}</Relationships>`;
45
+ }
46
+
47
+ // images: one entry per workflow in page order, { bytes, width, height } or null.
48
+ export function buildDocx(view, images) {
49
+ const enc = new TextEncoder();
50
+ const files = new Map([
51
+ ['[Content_Types].xml', CONTENT_TYPES], ['_rels/.rels', ROOT_RELS], ['word/document.xml', documentXml(view, images)],
52
+ ['word/_rels/document.xml.rels', documentRels(images)], ['word/styles.xml', STYLES], ['word/numbering.xml', NUMBERING],
53
+ ].map(([path, xml]) => [path, enc.encode(xml)]));
54
+ images.forEach((img, i) => { if (img) files.set(`word/media/image${i + 1}.png`, img.bytes); });
55
+ return zipStore(files);
56
+ }
@@ -0,0 +1,44 @@
1
+ // WordprocessingML pieces for the proposal's DOCX: paragraphs, tables, bullet
2
+ // lists and inline images, in the styles docx-package.mjs defines. Pure
3
+ // strings, no DOM: Node tests read exactly what the page writes. Like the
4
+ // zip writer it ships twice, imported here and inlined into the page.
5
+ const TEXT_WIDTH = 9638; // twips: A4 width less two 2 cm margins
6
+ const EMU_PER_PX = 9525;
7
+ const EMU_PER_TWIP = 635;
8
+
9
+ // Control characters other than tab/newline are not allowed in XML 1.0.
10
+ export const xmlText = (s) => String(s).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, '')
11
+ .replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
12
+
13
+ const run = (text, bold) => `<w:r>${bold ? '<w:rPr><w:b/></w:rPr>' : ''}<w:t xml:space="preserve">${xmlText(text)}</w:t></w:r>`;
14
+
15
+ export function para(text, style) {
16
+ if (!text) return '';
17
+ return `<w:p>${style ? `<w:pPr><w:pStyle w:val="${style}"/></w:pPr>` : ''}${run(text)}</w:p>`;
18
+ }
19
+
20
+ export const bullets = (items) => items.map((t) => `<w:p><w:pPr><w:pStyle w:val="ListParagraph"/><w:numPr><w:ilvl w:val="0"/><w:numId w:val="1"/></w:numPr></w:pPr>${run(t)}</w:p>`).join('');
21
+
22
+ function row(cells, head) {
23
+ const cell = (c) => `<w:tc><w:p>${run(c, head)}</w:p></w:tc>`;
24
+ return `<w:tr>${head ? '<w:trPr><w:tblHeader/></w:trPr>' : ''}${cells.map(cell).join('')}</w:tr>`;
25
+ }
26
+
27
+ export function table(head, rows) {
28
+ const col = Math.floor(TEXT_WIDTH / head.length);
29
+ const grid = head.map(() => `<w:gridCol w:w="${col}"/>`).join('');
30
+ return `<w:tbl><w:tblPr><w:tblStyle w:val="TableGrid"/><w:tblW w:w="5000" w:type="pct"/></w:tblPr><w:tblGrid>${grid}</w:tblGrid>${row(head, true)}${rows.map((r) => row(r, false)).join('')}</w:tbl><w:p/>`;
31
+ }
32
+
33
+ // One diagram, scaled down to the text width, never up. n is the image's
34
+ // 1-based number: its media file, relationship id and drawing id.
35
+ export function image(img, n) {
36
+ const scale = Math.min(1, (TEXT_WIDTH * EMU_PER_TWIP) / (img.width * EMU_PER_PX));
37
+ const cx = Math.round(img.width * EMU_PER_PX * scale);
38
+ const cy = Math.round(img.height * EMU_PER_PX * scale);
39
+ const pic = `<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="${n}" name="diagram${n}.png"/><pic:cNvPicPr/></pic:nvPicPr>`
40
+ + `<pic:blipFill><a:blip r:embed="rIdImg${n}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill>`
41
+ + `<pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic>`;
42
+ return `<w:p><w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${cx}" cy="${cy}"/><wp:docPr id="${n}" name="Diagram ${n}"/>`
43
+ + `<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">${pic}</a:graphicData></a:graphic></wp:inline></w:drawing></w:r></w:p>`;
44
+ }
@@ -0,0 +1,71 @@
1
+ // The facts on a workflow proposal page are rendered from data; what the
2
+ // agent writes is sentences (proposal-inputs.json). These checks hold the
3
+ // sentences to the client rules: complete, no prices (the price comes only
4
+ // from the estimate), no internal IDs, no jargon for a non-tech reader.
5
+ import { milestoneView } from '../../../estimate/workflow-based/scripts/lib/page-view.mjs';
6
+ import { JARGON } from './jargon.mjs';
7
+ import { escapeRegExp } from './sections.mjs';
8
+
9
+ const TECH_LEVELS = ['non-tech', 'low-tech', 'technical'];
10
+ const CODES = 'USD|SGD|EUR|GBP|AUD|NZD|CAD|CHF|JPY|CNY|RMB|HKD|MYR|RM|IDR|INR|THB|VND|KRW|TWD';
11
+ const WORDS = 'dollars?|euros?|pounds?|ringgit|yen|rupees?|baht|dong';
12
+ const NUM = '\\d[\\d,.]*\\s?(?:k|m|mn|bn|million|thousand|billion)?';
13
+ const MONEY = new RegExp(`\\p{Sc}\\s?${NUM}|\\b(?:${CODES})\\s?${NUM}|${NUM}\\s?(?:${CODES}|${WORDS})\\b`, 'iu');
14
+ // Engineer milestone names ("M1 - Walking skeleton") never reach the client (P6).
15
+ const ID = /\b(?:FEAT|FR|NFR|SYS|WF|BR|ASM|INT|SC|Q)-\d+|\bM\d+ - /;
16
+ const filled = (v) => typeof v === 'string' && v.trim() !== '';
17
+
18
+ function checkRequired(inputs, out) {
19
+ for (const key of ['client', 'title', 'firm', 'scopeIntro']) {
20
+ if (!filled(inputs[key])) out.push(`proposal-inputs.json: missing "${key}"`);
21
+ }
22
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(inputs.date ?? '') || Number.isNaN(Date.parse(inputs.date))) {
23
+ out.push('proposal-inputs.json: "date" must be an ISO date (YYYY-MM-DD)');
24
+ }
25
+ if (!TECH_LEVELS.includes(inputs.techLevel)) out.push(`proposal-inputs.json: "techLevel" must be ${TECH_LEVELS.join(' | ')}`);
26
+ }
27
+
28
+ function checkKeys({ inputs, est, req }, out) {
29
+ const used = milestoneView(est).map((m) => m.name);
30
+ const ms = inputs.milestones ?? {};
31
+ for (const name of used) {
32
+ if (!filled(ms[name]?.name) || !filled(ms[name]?.demonstrates)) out.push(`milestone "${name}": needs a client "name" and "demonstrates"`);
33
+ }
34
+ for (const key of Object.keys(ms)) if (!used.includes(key)) out.push(`milestones: "${key}" is not a milestone of this estimate`);
35
+ for (const [key, text] of Object.entries(inputs.systems ?? {})) {
36
+ if (!req.systemById[key]) out.push(`systems: "${key}" is not a system in requirements.json`);
37
+ else if (!filled(text)) out.push(`systems: "${key}" needs a sentence or no entry`);
38
+ }
39
+ }
40
+
41
+ export function sentences(inputs) {
42
+ const out = [['title', inputs.title], ['scopeIntro', inputs.scopeIntro]];
43
+ for (const [id, text] of Object.entries(inputs.systems ?? {})) out.push([`systems.${id}`, text]);
44
+ for (const [id, m] of Object.entries(inputs.milestones ?? {})) {
45
+ out.push([`milestones.${id}.name`, m?.name], [`milestones.${id}.demonstrates`, m?.demonstrates]);
46
+ }
47
+ return out.filter(([, text]) => filled(text));
48
+ }
49
+
50
+ const jargonIn = (text, allow) => JARGON.filter((t) => !allow.has(t)
51
+ && new RegExp(`(?<![\\w/])${escapeRegExp(t)}(?:e?s)?(?![\\w/])`, 'i').test(text));
52
+
53
+ function checkSentences(inputs, out) {
54
+ const allow = new Set((Array.isArray(inputs.jargonAllow) ? inputs.jargonAllow : []).map((w) => String(w).toLowerCase()));
55
+ for (const [where, text] of sentences(inputs)) {
56
+ const money = MONEY.exec(text);
57
+ if (money) out.push(`${where}: price "${money[0]}" — prices come only from the estimate`);
58
+ const id = ID.exec(text);
59
+ if (id) out.push(`${where}: internal ID "${id[0]}" — name the thing in words`);
60
+ if (inputs.techLevel !== 'non-tech') continue;
61
+ for (const term of jargonIn(text, allow)) out.push(`${where}: jargon for a non-tech client: "${term}" (rewrite plainly or add to jargonAllow)`);
62
+ }
63
+ }
64
+
65
+ export function checkProposalInputs({ inputs, est, req }) {
66
+ const out = [];
67
+ checkRequired(inputs, out);
68
+ checkKeys({ inputs, est, req }, out);
69
+ checkSentences(inputs, out);
70
+ return out;
71
+ }
@@ -0,0 +1,46 @@
1
+ // validate.mjs and render.mjs in workflow mode: estimation.json (with the
2
+ // BA package it names) plus proposal-inputs.json. Same rule as classic:
3
+ // render re-runs validation and writes nothing on a finding.
4
+ import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import { proposalFindings } from './workflow-lead.mjs';
7
+ import { proposalView } from './workflow-view.mjs';
8
+ import { workflowPage } from './workflow-page.mjs';
9
+
10
+ const USAGE = {
11
+ validate: 'usage: validate.mjs --estimation estimation.json --inputs proposal-inputs.json',
12
+ render: 'usage: render.mjs --estimation estimation.json --inputs proposal-inputs.json --mermaid-bundle <path> --out <lead>/dist',
13
+ };
14
+
15
+ function report(findings) {
16
+ console.error(findings.join('\n'));
17
+ return 1;
18
+ }
19
+
20
+ export function validateWorkflow(args) {
21
+ if (typeof args.inputs !== 'string') return report([USAGE.validate]);
22
+ const { findings } = proposalFindings(args);
23
+ if (findings.length) return report(findings);
24
+ console.log('proposal inputs valid');
25
+ return 0;
26
+ }
27
+
28
+ function readBundle(path) {
29
+ if (typeof path !== 'string') return { error: '--mermaid-bundle is required (see analyze-requirements references/viewer.md §1)' };
30
+ const bundle = readFileSync(path, 'utf8');
31
+ if (bundle.includes('</script')) return { error: 'mermaid bundle carries a literal </script — rebuild it (analyze-requirements references/viewer.md §1)' };
32
+ return { bundle };
33
+ }
34
+
35
+ export function renderWorkflow(args) {
36
+ if (typeof args.inputs !== 'string' || typeof args.out !== 'string') return report([USAGE.render]);
37
+ const { findings, ...lead } = proposalFindings(args);
38
+ if (findings.length) return report(findings);
39
+ const { bundle, error } = readBundle(args['mermaid-bundle']);
40
+ if (error) return report([error]);
41
+ mkdirSync(args.out, { recursive: true });
42
+ const out = join(args.out, 'proposal.html');
43
+ writeFileSync(out, workflowPage({ view: proposalView(lead), bundle }));
44
+ console.log(out);
45
+ return 0;
46
+ }
@@ -0,0 +1,39 @@
1
+ // The workflow proposal's body and menu, rendered in Node from the page data
2
+ // (workflow-view.mjs), so the page script only draws diagrams and builds the
3
+ // downloads. Every value goes through esc().
4
+ import { escapeHtml as esc } from '../../../analyze-requirements/scripts/lib/md-render.mjs';
5
+
6
+ const para = (text) => (text ? `<p>${esc(text)}</p>` : '');
7
+ const cells = (tag, row) => row.map((c) => `<${tag}>${esc(c)}</${tag}>`).join('');
8
+ const table = (head, rows) => `<table><thead><tr>${cells('th', head)}</tr></thead><tbody>${rows.map((r) => `<tr>${cells('td', r)}</tr>`).join('')}</tbody></table>`;
9
+ const bullets = (items) => `<ul>${items.map((t) => `<li>${esc(t)}</li>`).join('')}</ul>`;
10
+ const flowHtml = (f) => `<p class="flow-name">${esc(f.label)}</p><div class="diagram-shell"><div class="mermaid-canvas">${esc(f.code)}</div></div>`;
11
+
12
+ function scopeHtml({ scope }) {
13
+ const head = scope.mapLabel ? ['System', scope.mapLabel] : ['System'];
14
+ const rows = scope.systems.map((s) => (scope.mapLabel ? [s.name, s.map] : [s.name]));
15
+ return `<section id="scope"><h2>Scope: what this proposal covers</h2>${para(scope.intro)}${table(head, rows)}${para(scope.outLine)}</section>`;
16
+ }
17
+
18
+ function systemHtml(s) {
19
+ const features = table(['Feature', 'What it does'], s.features.map((f) => [f.name, f.does]));
20
+ return `<section id="${s.anchor}" class="system"><h2><span class="sysno">System ${s.no}:</span> ${esc(s.name)}</h2>${para(s.purpose)}${para(s.extra)}${s.flows.map(flowHtml).join('')}${features}</section>`;
21
+ }
22
+
23
+ function closingHtml({ milestones, register, cost }) {
24
+ const ms = table(['Milestone', 'Includes', 'What it demonstrates'], milestones.rows.map((m) => [m.title, m.includes, m.demonstrates]));
25
+ const price = (label, value, note) => `<div><span>${esc(label)}</span><b>${esc(value)}</b><span>${esc(note)}</span></div>`;
26
+ return `<section id="milestones"><h2>Milestones</h2>${para(milestones.lead)}${ms}</section>`
27
+ + `<section id="register"><h2>Assumptions &amp; exclusions</h2>${para(register.lead)}<h3>Assumptions</h3>${bullets(register.assumptions)}<h3>Exclusions</h3>${bullets(register.exclusions)}</section>`
28
+ + `<section id="cost"><h2>Cost estimate</h2>${para(cost.lead)}<div class="price">${price('Range', cost.range, cost.rangeNote)}${price('If one fixed number is needed', cost.single, cost.singleNote)}</div></section>`;
29
+ }
30
+
31
+ export function contentHtml(view) {
32
+ return `<h1>${esc(view.title)}</h1><p class="byline">${esc(view.byline)}</p>${scopeHtml(view)}${view.systems.map(systemHtml).join('')}${closingHtml(view)}`;
33
+ }
34
+
35
+ export function navHtml(view) {
36
+ const links = [['scope', 'Scope'], ...view.systems.map((s) => [s.anchor, `System ${s.no}: ${s.name}`]),
37
+ ['milestones', 'Milestones'], ['register', 'Assumptions & exclusions'], ['cost', 'Cost estimate']];
38
+ return links.map(([id, text]) => `<a href="#${id}">${esc(text)}</a>`).join('\n');
39
+ }
@@ -0,0 +1,45 @@
1
+ // A workflow-mode proposal reads what the estimate already validated:
2
+ // estimation.json and the BA package it names. Loading re-runs the
3
+ // estimate's own validation, so a stale or hand-edited estimate never
4
+ // reaches a client page (spec 4 W6). Modules stay single-line-import: the
5
+ // page inlines some of them with their import lines stripped.
6
+ import { existsSync, readFileSync } from 'node:fs';
7
+ import { resolveRequirementsPath, loadRequirements } from '../../../estimate/workflow-based/scripts/lib/requirements.mjs';
8
+ import { pairFindings } from '../../../estimate/workflow-based/scripts/lib/pair-findings.mjs';
9
+ import { deriveFigures } from './figures.mjs';
10
+ import { checkProposalInputs } from './workflow-checks.mjs';
11
+
12
+ export const isWorkflow = (estimation) => estimation.inputs?.scopeMode === 'workflow';
13
+
14
+ function quotable(est) {
15
+ try { deriveFigures(est); return []; } catch (e) { return [`cannot quote this estimate: ${e.message}`]; }
16
+ }
17
+
18
+ export function loadLead(estimationPath) {
19
+ const est = JSON.parse(readFileSync(estimationPath, 'utf8'));
20
+ const reqPath = resolveRequirementsPath(estimationPath, est.inputs);
21
+ if (!reqPath || !existsSync(reqPath)) {
22
+ return { est, req: null, findings: [`requirements.json not found (estimation.json names "${est.inputs.requirements}") — run the estimate skill in the lead folder`] };
23
+ }
24
+ const req = loadRequirements(reqPath);
25
+ const findings = req.raw.scopeMode === 'workflow' ? [] : ['requirements.json is not in workflow scope mode'];
26
+ findings.push(...pairFindings(est.inputs, req, estimationPath), ...quotable(est));
27
+ return { est, req, findings };
28
+ }
29
+
30
+ export function loadInputs(path) {
31
+ try {
32
+ return { inputs: JSON.parse(readFileSync(path, 'utf8')), findings: [] };
33
+ } catch (e) {
34
+ return { inputs: null, findings: [`proposal-inputs.json: ${e.message}`] };
35
+ }
36
+ }
37
+
38
+ // The lead first: the sentence checks need a valid estimate to know its milestones.
39
+ export function proposalFindings({ estimation, inputs }) {
40
+ const lead = loadLead(estimation);
41
+ const sent = loadInputs(inputs);
42
+ const findings = [...lead.findings, ...sent.findings];
43
+ if (!findings.length) findings.push(...checkProposalInputs({ inputs: sent.inputs, est: lead.est, req: lead.req }));
44
+ return { findings, est: lead.est, req: lead.req, inputs: sent.inputs };
45
+ }
@@ -0,0 +1,30 @@
1
+ // Fills the workflow proposal template: the body and menu rendered in Node,
2
+ // the page data for the DOCX, the mermaid bundle, and the DOCX writer (the
3
+ // shared zip writer plus the three docx modules, imports stripped).
4
+ import { readFileSync } from 'node:fs';
5
+ import { embed } from '../../../analyze-requirements/scripts/lib/embed.mjs';
6
+ import { buildFontFaces } from '../../../analyze-requirements/scripts/lib/fonts.mjs';
7
+ import { escapeHtml } from '../../../analyze-requirements/scripts/lib/md-render.mjs';
8
+ import { inlineModule, withZip } from '../../../estimate/shared/lib/inline.mjs';
9
+ import { contentHtml, navHtml } from './workflow-html.mjs';
10
+
11
+ const here = (rel) => new URL(rel, import.meta.url);
12
+ const DOCX_MODULES = ['./docx-xml.mjs', './docx-body.mjs', './docx-package.mjs'];
13
+ const noImports = (src) => src.replace(/^import [^\n]*\n/gm, '');
14
+
15
+ export const docxScript = () => withZip(DOCX_MODULES.map((m) => inlineModule(noImports(readFileSync(here(m), 'utf8')))).join('\n'));
16
+
17
+ // Every "<" escaped: nothing in the data can close or comment out its script tag.
18
+ const island = (value) => JSON.stringify(value).replaceAll('<', '\\u003c');
19
+
20
+ export function workflowPage({ view, bundle }) {
21
+ return embed({
22
+ template: readFileSync(here('../../assets/proposal-workflow.html'), 'utf8'),
23
+ slots: {
24
+ TITLE: escapeHtml(`Proposal — ${view.client}`),
25
+ FONTS: buildFontFaces(here('../../../analyze-requirements/assets/fonts/').pathname),
26
+ NAV: navHtml(view), CONTENT: contentHtml(view), DATA: island(view),
27
+ MERMAID_BUNDLE: bundle, DOCX: docxScript(),
28
+ },
29
+ });
30
+ }