@v11g/agents-rock 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/README.md +2 -1
  2. package/package.json +2 -2
  3. package/plugins/business-analyst/.claude-plugin/plugin.json +1 -1
  4. package/plugins/business-analyst/evals/ba-interview-conflict/graders/conflict-quoted.md +15 -0
  5. package/plugins/business-analyst/evals/ba-interview-conflict/graders/no-internal-ids.md +9 -0
  6. package/plugins/business-analyst/evals/ba-interview-conflict/graders/one-question.md +15 -0
  7. package/plugins/business-analyst/evals/ba-interview-conflict/graders/skill-fired.md +7 -0
  8. package/plugins/business-analyst/evals/ba-interview-conflict/prompt.md +31 -0
  9. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-internal-ids.md +9 -0
  10. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-setup-questions.md +16 -0
  11. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/one-scope-question.md +19 -0
  12. package/plugins/business-analyst/evals/ba-interview-first-turn/graders/skill-fired.md +7 -0
  13. package/plugins/business-analyst/evals/ba-interview-first-turn/prompt.md +31 -0
  14. package/plugins/business-analyst/evals/ba-review-page/case.yaml +4 -0
  15. package/plugins/business-analyst/evals/ba-review-page/fixture.sh +12 -0
  16. package/plugins/business-analyst/evals/ba-review-page/graders/decide-in-interview.md +26 -0
  17. package/plugins/business-analyst/evals/ba-review-page/graders/skill-fired.md +7 -0
  18. package/plugins/business-analyst/evals/ba-review-page/prompt.md +9 -0
  19. package/plugins/business-analyst/skills/business-analyst/README.md +8 -0
  20. package/plugins/business-analyst/skills/business-analyst/SKILL.md +47 -16
  21. package/plugins/business-analyst/skills/business-analyst/assets/review-page.html +68 -0
  22. package/plugins/business-analyst/skills/business-analyst/evals/evals.json +1 -1
  23. package/plugins/business-analyst/skills/business-analyst/references/frameworks.md +3 -2
  24. package/plugins/business-analyst/skills/business-analyst/references/interview.md +156 -8
  25. package/plugins/business-analyst/skills/business-analyst/references/review.md +18 -4
  26. package/plugins/business-analyst/skills/business-analyst/references/writing.md +49 -8
  27. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
  28. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
  29. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
  30. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
  31. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
  32. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
  33. package/plugins/business-analyst/skills/business-analyst/scripts/lib/checks.mjs +12 -6
  34. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-data.mjs +66 -0
  35. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-layout.mjs +53 -0
  36. package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-page.mjs +78 -0
  37. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-checks.mjs +73 -0
  38. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-md.mjs +53 -0
  39. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-render.mjs +72 -0
  40. package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-rules.mjs +90 -0
  41. package/plugins/business-analyst/skills/business-analyst/scripts/review.mjs +48 -0
  42. package/plugins/business-analyst/skills/business-analyst/scripts/review.py +60 -0
  43. package/plugins/business-analyst/skills/business-analyst/scripts/review_data.py +81 -0
  44. package/plugins/business-analyst/skills/business-analyst/scripts/review_layout.py +50 -0
  45. package/plugins/business-analyst/skills/business-analyst/scripts/review_page.py +115 -0
  46. package/plugins/business-analyst/skills/business-analyst/scripts/scope.mjs +24 -0
  47. package/plugins/business-analyst/skills/business-analyst/scripts/scope.py +35 -0
  48. package/plugins/business-analyst/skills/business-analyst/scripts/scope_checks.py +168 -0
  49. package/plugins/business-analyst/skills/business-analyst/scripts/scope_render.py +140 -0
  50. package/plugins/business-analyst/skills/business-analyst/scripts/test/checks.test.mjs +27 -0
  51. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.json +78 -0
  52. package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.md +136 -0
  53. package/plugins/business-analyst/skills/business-analyst/scripts/test/python-parity.test.mjs +88 -0
  54. package/plugins/business-analyst/skills/business-analyst/scripts/test/quality-gates.test.mjs +26 -0
  55. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-browser.test.mjs +106 -0
  56. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-fixture.mjs +32 -0
  57. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-page.test.mjs +340 -0
  58. package/plugins/business-analyst/skills/business-analyst/scripts/test/review-parity.test.mjs +79 -0
  59. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-cases.mjs +58 -0
  60. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-checks.test.mjs +31 -0
  61. package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-md.test.mjs +140 -0
  62. package/plugins/business-analyst/skills/business-analyst/scripts/validate.mjs +1 -1
  63. package/plugins/business-analyst/skills/business-analyst/scripts/validate.py +17 -8
  64. package/plugins/reasoning/.claude-plugin/plugin.json +1 -1
  65. package/plugins/reasoning/evals/format-handoff-folder/graders/folder-named.md +8 -0
  66. package/plugins/reasoning/evals/format-handoff-folder/graders/skill-fired.md +7 -0
  67. package/plugins/reasoning/evals/format-handoff-folder/prompt.md +9 -0
  68. package/plugins/reasoning/evals/format-ids-and-supports/graders/ids-in-chat.md +8 -0
  69. package/plugins/reasoning/evals/format-ids-and-supports/graders/skill-fired.md +7 -0
  70. package/plugins/reasoning/evals/format-ids-and-supports/graders/supports-resolve.md +11 -0
  71. package/plugins/reasoning/evals/format-ids-and-supports/prompt.md +8 -0
  72. package/plugins/reasoning/evals/format-root-candidate-status/graders/candidate-status.md +11 -0
  73. package/plugins/reasoning/evals/format-root-candidate-status/graders/skill-fired.md +7 -0
  74. package/plugins/reasoning/evals/format-root-candidate-status/prompt.md +8 -0
  75. package/plugins/reasoning/evals/format-unsaved-continues/graders/analysis-completes.md +9 -0
  76. package/plugins/reasoning/evals/format-unsaved-continues/graders/not-saved-stated.md +9 -0
  77. package/plugins/reasoning/evals/format-unsaved-continues/graders/skill-fired.md +7 -0
  78. package/plugins/reasoning/evals/format-unsaved-continues/prompt.md +8 -0
  79. package/plugins/reasoning/skills/problem-router/README.md +6 -0
  80. package/plugins/reasoning/skills/problem-router/SKILL.md +4 -0
  81. package/plugins/reasoning/skills/problem-router/references/contract.md +114 -19
  82. package/plugins/reasoning/skills/problem-solving/README.md +6 -0
  83. package/plugins/reasoning/skills/problem-solving/SKILL.md +2 -0
  84. package/plugins/reasoning/skills/problem-solving/references/contract.md +114 -19
  85. package/plugins/reasoning/skills/problem-solving/references/interview.md +2 -0
  86. package/plugins/reasoning/skills/systemic-design/README.md +3 -0
  87. package/plugins/reasoning/skills/systemic-design/SKILL.md +2 -0
  88. package/plugins/reasoning/skills/systemic-design/references/contract.md +114 -19
  89. package/plugins/reasoning/skills/systemic-design/references/interview.md +2 -0
  90. package/plugins/reasoning/skills/systems-thinking/README.md +3 -0
  91. package/plugins/reasoning/skills/systems-thinking/SKILL.md +2 -0
  92. package/plugins/reasoning/skills/systems-thinking/frameworks/leverage-points.md +15 -6
  93. package/plugins/reasoning/skills/systems-thinking/references/contract.md +114 -19
  94. package/plugins/reasoning/skills/systems-thinking/references/interview.md +2 -0
  95. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  96. package/plugins/solution-architect/evals/proposal-workflow/case.yaml +6 -0
  97. package/plugins/solution-architect/evals/proposal-workflow/fixture.sh +6 -0
  98. package/plugins/solution-architect/evals/proposal-workflow/graders/inputs-written.md +23 -0
  99. package/plugins/solution-architect/evals/proposal-workflow/graders/no-proposal-md.md +7 -0
  100. package/plugins/solution-architect/evals/proposal-workflow/graders/skill-fired.md +7 -0
  101. package/plugins/solution-architect/evals/proposal-workflow/graders/validate-then-render.md +16 -0
  102. package/plugins/solution-architect/evals/proposal-workflow/prompt.md +10 -0
  103. package/plugins/solution-architect/evals/workflow-gate-no-architecture/case.yaml +4 -0
  104. package/plugins/solution-architect/evals/workflow-gate-no-architecture/fixture.sh +6 -0
  105. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/no-classic-fallback.md +10 -0
  106. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/nothing-written.md +7 -0
  107. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/skill-fired.md +7 -0
  108. package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/stops-at-gate.md +11 -0
  109. package/plugins/solution-architect/evals/workflow-gate-no-architecture/prompt.md +7 -0
  110. package/plugins/solution-architect/evals/workflow-happy-path/case.yaml +4 -0
  111. package/plugins/solution-architect/evals/workflow-happy-path/fixture.sh +6 -0
  112. package/plugins/solution-architect/evals/workflow-happy-path/graders/no-estimation-md.md +7 -0
  113. package/plugins/solution-architect/evals/workflow-happy-path/graders/pages-or-stop.md +16 -0
  114. package/plugins/solution-architect/evals/workflow-happy-path/graders/routed-to-workflow.md +12 -0
  115. package/plugins/solution-architect/evals/workflow-happy-path/graders/skill-fired.md +7 -0
  116. package/plugins/solution-architect/evals/workflow-happy-path/graders/three-questions-max.md +14 -0
  117. package/plugins/solution-architect/evals/workflow-happy-path/graders/workflow-or-exact-stop.md +15 -0
  118. package/plugins/solution-architect/evals/workflow-happy-path/prompt.md +9 -0
  119. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +11 -1
  120. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +4 -1
  121. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +16 -1
  122. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +27 -0
  123. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +9 -0
  124. package/plugins/solution-architect/skills/estimate/README.md +38 -18
  125. package/plugins/solution-architect/skills/estimate/SKILL.md +16 -69
  126. package/plugins/solution-architect/skills/estimate/classic/FLOW.md +77 -0
  127. package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/estimate-template-agentic.html +111 -138
  128. package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/estimate-template.html +219 -445
  129. package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/scores-review-template.html +5 -4
  130. package/plugins/solution-architect/skills/estimate/{references → classic/references}/agentic-estimation.md +4 -2
  131. package/plugins/solution-architect/skills/estimate/classic/references/ai-multipliers.md +57 -0
  132. package/plugins/solution-architect/skills/estimate/{references → classic/references}/interview.md +56 -35
  133. package/plugins/solution-architect/skills/estimate/{references → classic/references}/scoring-guide.md +40 -4
  134. package/plugins/solution-architect/skills/estimate/{references → classic/references}/task-shapes.md +1 -1
  135. package/plugins/solution-architect/skills/estimate/{references → classic/references}/techniques.md +29 -21
  136. package/plugins/solution-architect/skills/estimate/{references → classic/references}/writing.md +77 -45
  137. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/compute.mjs +1 -1
  138. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/checks.mjs +38 -6
  139. package/plugins/solution-architect/skills/estimate/classic/scripts/lib/redact.mjs +112 -0
  140. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/roadmap.mjs +4 -5
  141. package/plugins/solution-architect/skills/estimate/classic/scripts/lib/rollup.mjs +129 -0
  142. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/schema.mjs +31 -38
  143. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-csv.mjs +3 -3
  144. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-html.mjs +3 -3
  145. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/render.mjs +9 -8
  146. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/score-review.mjs +3 -3
  147. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/baselines.test.mjs +3 -3
  148. package/plugins/solution-architect/skills/estimate/classic/scripts/test/browser-agentic.test.mjs +143 -0
  149. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser.test.mjs +211 -52
  150. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/compute.test.mjs +58 -33
  151. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/e2e.test.mjs +55 -3
  152. package/plugins/solution-architect/skills/estimate/classic/scripts/test/estimate-math.test.mjs +44 -0
  153. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-fail.md +0 -10
  154. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-pass.md +0 -10
  155. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-inputs.json +1 -7
  156. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/booking-inputs.json +11 -10
  157. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-fail.md +6 -0
  158. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-pass.md +17 -21
  159. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/measurements.test.mjs +1 -1
  160. package/plugins/solution-architect/skills/estimate/classic/scripts/test/pricing.test.mjs +88 -0
  161. package/plugins/solution-architect/skills/estimate/classic/scripts/test/project-price.test.mjs +93 -0
  162. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/quality-gates.test.mjs +7 -1
  163. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/references.test.mjs +88 -26
  164. package/plugins/solution-architect/skills/estimate/classic/scripts/test/render.test.mjs +405 -0
  165. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/schema.test.mjs +114 -61
  166. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/score-review.test.mjs +37 -4
  167. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/scoring.test.mjs +1 -1
  168. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/url-state.test.mjs +2 -2
  169. package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/validate.test.mjs +104 -10
  170. package/plugins/solution-architect/skills/estimate/classic/scripts/test/xlsx-export.test.mjs +475 -0
  171. package/plugins/solution-architect/skills/estimate/classic/scripts/test/zip-store.test.mjs +26 -0
  172. package/plugins/solution-architect/skills/estimate/evals/evals.json +44 -9
  173. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +28 -0
  174. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  175. package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.md +141 -0
  176. package/plugins/solution-architect/skills/estimate/shared/assets/xlsx-export.js +336 -0
  177. package/plugins/solution-architect/skills/estimate/shared/lib/agentic-task-schema.mjs +24 -0
  178. package/plugins/solution-architect/skills/estimate/shared/lib/context-schema.mjs +35 -0
  179. package/plugins/solution-architect/skills/estimate/shared/lib/estimate-math.mjs +31 -0
  180. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/inline.mjs +13 -5
  181. package/plugins/solution-architect/skills/estimate/shared/lib/pricing.mjs +78 -0
  182. package/plugins/solution-architect/skills/estimate/shared/lib/project-price.mjs +96 -0
  183. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring-schema.mjs +1 -1
  184. package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring.mjs +3 -3
  185. package/plugins/solution-architect/skills/estimate/shared/lib/zip.mjs +60 -0
  186. package/plugins/solution-architect/skills/estimate/workflow-based/FLOW.md +91 -0
  187. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-components.html +994 -0
  188. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-template.html +440 -0
  189. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimator-system.xlsx +0 -0
  190. package/plugins/solution-architect/skills/estimate/workflow-based/assets/score-review.html +838 -0
  191. package/plugins/solution-architect/skills/estimate/workflow-based/references/hidden-work-by-type.md +429 -0
  192. package/plugins/solution-architect/skills/estimate/workflow-based/references/linking.md +59 -0
  193. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +80 -0
  194. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-template.mjs +60 -0
  195. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-workflow-template.mjs +51 -0
  196. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-xlsx-template.py +144 -0
  197. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/compute.mjs +32 -0
  198. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +44 -0
  199. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-view.mjs +71 -0
  200. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/pair-findings.mjs +19 -0
  201. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/requirements.mjs +33 -0
  202. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/rollup.mjs +66 -0
  203. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +69 -0
  204. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema.mjs +70 -0
  205. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-diff.mjs +54 -0
  206. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-html.mjs +52 -0
  207. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +51 -0
  208. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/render.mjs +42 -0
  209. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/score-review.mjs +46 -0
  210. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/arch-link.js +9 -0
  211. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/click.js +28 -0
  212. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/prelude.js +4 -0
  213. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/view.js +63 -0
  214. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/browser.test.mjs +127 -0
  215. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-pages.test.mjs +43 -0
  216. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-template.test.mjs +18 -0
  217. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/cli.test.mjs +48 -0
  218. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/estimator-system.test.mjs +66 -0
  219. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/ARCHITECTURE-mini.md +31 -0
  220. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/feedback.json +19 -0
  221. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +80 -0
  222. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/measurements.jsonl +0 -0
  223. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/requirements.json +79 -0
  224. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/page-view.test.mjs +54 -0
  225. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/pages-browser.test.mjs +209 -0
  226. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/quality-gates.test.mjs +25 -0
  227. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/render.test.mjs +54 -0
  228. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/requirements.test.mjs +33 -0
  229. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +80 -0
  230. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/schema.test.mjs +61 -0
  231. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/score-review.test.mjs +108 -0
  232. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/stage.mjs +32 -0
  233. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/workflow-script.test.mjs +24 -0
  234. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +58 -0
  235. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/validate.mjs +19 -0
  236. package/plugins/solution-architect/skills/new-lead/SKILL.md +4 -3
  237. package/plugins/solution-architect/skills/proposal/README.md +22 -7
  238. package/plugins/solution-architect/skills/proposal/SKILL.md +18 -7
  239. package/plugins/solution-architect/skills/proposal/assets/proposal-workflow.html +143 -0
  240. package/plugins/solution-architect/skills/proposal/evals/evals.json +29 -11
  241. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/ARCHITECTURE.md +65 -0
  242. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/brief.md +21 -0
  243. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation-inputs.json +126 -0
  244. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation.json +215 -0
  245. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation-inputs.json +224 -34
  246. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.json +103 -114
  247. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.md +48 -22
  248. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation-inputs.json +211 -33
  249. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.json +102 -117
  250. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.md +48 -25
  251. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +31 -0
  252. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +468 -0
  253. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +773 -0
  254. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/measurements.jsonl +0 -0
  255. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
  256. package/plugins/solution-architect/skills/proposal/references/interview.md +3 -6
  257. package/plugins/solution-architect/skills/proposal/references/review.md +16 -4
  258. package/plugins/solution-architect/skills/proposal/references/workflow.md +88 -0
  259. package/plugins/solution-architect/skills/proposal/references/writing.md +33 -31
  260. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +1 -1
  261. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +5 -22
  262. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +18 -8
  263. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +6 -2
  264. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-body.mjs +42 -0
  265. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-package.mjs +56 -0
  266. package/plugins/solution-architect/skills/proposal/scripts/lib/docx-xml.mjs +44 -0
  267. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +24 -33
  268. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +1 -1
  269. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-checks.mjs +71 -0
  270. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-cli.mjs +46 -0
  271. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-html.mjs +39 -0
  272. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-lead.mjs +45 -0
  273. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-page.mjs +30 -0
  274. package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-view.mjs +80 -0
  275. package/plugins/solution-architect/skills/proposal/scripts/render.mjs +5 -1
  276. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +50 -47
  277. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +99 -40
  278. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +11 -5
  279. package/plugins/solution-architect/skills/proposal/scripts/test/docx.test.mjs +68 -0
  280. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +3 -3
  281. package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +46 -0
  282. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +67 -54
  283. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +6 -1
  284. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-inputs-pass.json +17 -0
  285. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +8 -12
  286. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +3 -3
  287. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +5 -4
  288. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-browser.test.mjs +96 -0
  289. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-checks.test.mjs +98 -0
  290. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-docs.test.mjs +25 -0
  291. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-render.test.mjs +75 -0
  292. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-stage.mjs +15 -0
  293. package/plugins/solution-architect/skills/proposal/scripts/test/workflow-view.test.mjs +78 -0
  294. package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +4 -1
  295. package/plugins/solution-architect/workflows/review-links.js +61 -0
  296. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +0 -101
  297. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +0 -89
  298. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +0 -64
  299. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +0 -154
  300. package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +0 -39
  301. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +0 -131
  302. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +0 -251
  303. package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +0 -254
  304. /package/plugins/solution-architect/skills/estimate/{references → classic/references}/slicing.md +0 -0
  305. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/agentic-checks.mjs +0 -0
  306. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/components.mjs +0 -0
  307. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/md-tables.mjs +0 -0
  308. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/scoring-checks.mjs +0 -0
  309. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/measurements.jsonl +0 -0
  310. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/zip.mjs +0 -0
  311. /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/validate.mjs +0 -0
  312. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/baselines.mjs +0 -0
  313. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/measurements.mjs +0 -0
  314. /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/score-diff.mjs +0 -0
@@ -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
+ }
@@ -1,43 +1,34 @@
1
1
  // Client-facing figures derived from estimation.json — the proposal never
2
- // invents a number. Totals come from the chosen scenario; ranges scale by
3
- // the feature low/high spread; milestone splits follow the roadmap shares.
4
- export const round1 = (n) => Math.round(n * 10) / 10;
2
+ // invents a number. The range is the estimate's own presented range, so the
3
+ // proposal and the workbook always quote the same figures. Milestone splits
4
+ // follow the roadmap's effort shares; there are no durations, because the
5
+ // estimate produces none.
5
6
  export const round100 = (n) => Math.round(n / 100) * 100;
6
7
  export const formatMoney = (n) => `$${n.toLocaleString('en-US')}`;
7
8
 
8
- function spreadRatios(computed) {
9
- const feats = Object.values(computed.features);
10
- const hours = feats.reduce((s, f) => s + f.hours, 0);
11
- return {
12
- lo: feats.reduce((s, f) => s + f.low, 0) / hours,
13
- hi: feats.reduce((s, f) => s + f.high, 0) / hours,
14
- };
15
- }
16
-
17
- const range = (value, ratios, round) => ({ low: round(value * ratios.lo), high: round(value * ratios.hi) });
9
+ const split = (cost, share) => ({ low: round100(cost.low * share), high: round100(cost.high * share) });
18
10
 
19
- function milestoneFigures(scenario, ratios) {
20
- return (scenario.roadmap ?? []).map((band) => {
21
- const width = band.endMonths - band.startMonths;
22
- return {
23
- name: band.milestone,
24
- cost: range(scenario.totalCost * (width / scenario.months), ratios, round100),
25
- months: range(width, ratios, round1),
26
- };
27
- });
11
+ // The rows sit above a bold Total line the client reads against them, so
12
+ // they must add up to it exactly: every milestone but the last is its share
13
+ // rounded to $100, and the last takes whatever remains (R59).
14
+ function splitCosts(cost, roadmap) {
15
+ if (roadmap.length === 0) return [];
16
+ const heads = roadmap.slice(0, -1).map((b) => split(cost, b.share));
17
+ const taken = (bound) => heads.reduce((sum, c) => sum + c[bound], 0);
18
+ return [...heads, { low: cost.low - taken('low'), high: cost.high - taken('high') }];
28
19
  }
29
20
 
30
- export function deriveFigures(estimation, scenarioId) {
31
- const scenario = estimation.computed.scenarios[scenarioId];
32
- if (!scenario) throw new Error(`scenario "${scenarioId}" not in estimation.json`);
33
- const ratios = spreadRatios(estimation.computed);
34
- const team = (estimation.inputs.scenarios.find((s) => s.id === scenarioId)?.team ?? [])
35
- .map((m) => m.seniority);
21
+ export function deriveFigures(estimation) {
22
+ const { price, roadmap } = estimation.computed;
23
+ if (!price || price.p50 === 0) {
24
+ throw new Error('estimate is not priced (no scored features) — a proposal cannot quote it');
25
+ }
26
+ const cost = { low: price.presentLow, high: price.presentHigh };
27
+ const bands = roadmap ?? [];
28
+ const costs = splitCosts(cost, bands);
36
29
  return {
37
- scenario: scenarioId,
38
- cost: range(scenario.totalCost, ratios, round100),
39
- months: range(scenario.months, ratios, round1),
40
- milestones: milestoneFigures(scenario, ratios),
41
- team,
30
+ cost,
31
+ singleNumber: price.singleNumber,
32
+ milestones: bands.map((b, i) => ({ name: b.milestone, cost: costs[i], share: b.share })),
42
33
  };
43
34
  }
@@ -3,7 +3,7 @@
3
3
  export const SECTIONS = [
4
4
  'Executive Summary', 'Background & Objectives', 'Proposed Solution', 'Scope',
5
5
  'Out of Scope & Assumptions', 'Delivery Approach', 'Investment & Timeline',
6
- 'Team', 'About', 'Next Steps',
6
+ 'About', 'Next Steps',
7
7
  ];
8
8
 
9
9
  export const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
@@ -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
+ }
@@ -0,0 +1,80 @@
1
+ // Page data for the workflow proposal: the BA package's systems, workflows
2
+ // and features, the estimate's milestones, register and price, and the
3
+ // agent's sentences from proposal-inputs.json. The HTML and the DOCX both
4
+ // print this one object, so the two can never disagree. No ID, score,
5
+ // component or per-milestone price goes in (spec 4 P5).
6
+ import { milestoneView, registerView } from '../../../estimate/workflow-based/scripts/lib/page-view.mjs';
7
+ import { formatMoney } from './figures.mjs';
8
+
9
+ const list = (xs) => (xs.length > 1 ? `${xs.slice(0, -1).join(', ')} and ${xs[xs.length - 1]}` : xs[0] ?? '');
10
+ const longDate = (iso) => new Date(`${iso}T00:00:00Z`).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' });
11
+ const slug = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
12
+ const label = (s) => s.replaceAll('"', "'");
13
+
14
+ // Mermaid source for one workflow: the steps in a row, each branch dashed
15
+ // with its label.
16
+ export function flowCode(w) {
17
+ const ids = new Map();
18
+ const id = (name) => ids.get(name) ?? ids.set(name, `n${ids.size}`).get(name);
19
+ const lines = ['flowchart LR'];
20
+ w.steps.forEach((step, i) => { if (i) lines.push(` ${id(w.steps[i - 1])} --> ${id(step)}`); });
21
+ for (const b of w.branches) lines.push(` ${id(b.from)} -.->${b.label ? `|"${label(b.label)}"|` : ''} ${id(b.to)}`);
22
+ for (const [name, n] of ids) lines.push(` ${n}["${label(name)}"]`);
23
+ return lines.join('\n');
24
+ }
25
+
26
+ function flowsOf(system, req) {
27
+ return (system.workflows ?? []).map((wid, i) => {
28
+ const w = req.workflows[wid];
29
+ const flow = { steps: w.steps ?? [], branches: w.branches ?? [] };
30
+ return { label: `${i ? 'Sub-workflow' : 'Main workflow'} · ${w.name}`, code: flowCode(flow), steps: flow.steps.join(' → ') };
31
+ });
32
+ }
33
+
34
+ function systemView(system, i, { req, inputs }) {
35
+ return {
36
+ anchor: `system-${i + 1}`, no: i + 1, name: system.name, purpose: system.purpose ?? '', extra: inputs.systems?.[system.id] ?? '',
37
+ flows: flowsOf(system, req),
38
+ features: (system.features ?? []).map((fid) => ({ name: req.features[fid].name, does: req.features[fid].does ?? '' })),
39
+ };
40
+ }
41
+
42
+ function scopeView({ req, inputs }) {
43
+ const out = req.raw.scope?.out ?? [];
44
+ return {
45
+ intro: inputs.scopeIntro, mapLabel: req.mapLabel,
46
+ systems: req.systems.map((s) => ({ name: s.name, map: s.map ?? '' })),
47
+ outLine: out.length
48
+ ? `Explicitly excluded: ${list(out)}. Every assumption and exclusion is listed at the end of this proposal.`
49
+ : 'The assumptions and exclusions this proposal rests on are listed at the end.',
50
+ };
51
+ }
52
+
53
+ function milestonesView(est, inputs) {
54
+ const rows = milestoneView(est).map((m, i) => ({
55
+ title: `${i + 1}. ${inputs.milestones[m.name].name}`,
56
+ includes: list(m.features.map((f) => f.name)), demonstrates: inputs.milestones[m.name].demonstrates,
57
+ }));
58
+ return { lead: `The ${est.inputs.features.length} features sequence into ${rows.length} milestones; each one ends with something working you can see.`, rows };
59
+ }
60
+
61
+ function costView(est) {
62
+ const { price } = est.computed;
63
+ return {
64
+ lead: `The estimate scores the work behind all ${est.inputs.features.length} features above and rolls it up into a project range, including design, testing, project management and contingency.`,
65
+ range: `${formatMoney(price.presentLow)} – ${formatMoney(price.presentHigh)}`, rangeNote: 'expected cost to worst realistic case, USD',
66
+ single: formatMoney(price.singleNumber), singleNote: 'confident figure: 80% chance the project comes in at or under',
67
+ };
68
+ }
69
+
70
+ export function proposalView({ est, req, inputs }) {
71
+ return {
72
+ client: inputs.client, title: `${inputs.title} — Systems & Workflows Proposal`, byline: `${longDate(inputs.date)} · ${inputs.firm}`,
73
+ file: `${slug(inputs.client)}-proposal.docx`,
74
+ scope: scopeView({ req, inputs }),
75
+ systems: req.systems.map((s, i) => systemView(s, i, { req, inputs })),
76
+ milestones: milestonesView(est, inputs),
77
+ register: { lead: 'These carry over from the estimate, so the price and the scope never drift apart.', ...registerView(est, req) },
78
+ cost: costView(est),
79
+ };
80
+ }
@@ -5,6 +5,8 @@ import { buildFontFaces } from '../../analyze-requirements/scripts/lib/fonts.mjs
5
5
  import { renderMarkdown, escapeHtml } from '../../analyze-requirements/scripts/lib/md-render.mjs';
6
6
  import { parseFrontmatter } from '../../analyze-requirements/scripts/lib/frontmatter.mjs';
7
7
  import { checkProposal } from './lib/checks.mjs';
8
+ import { isWorkflow } from './lib/workflow-lead.mjs';
9
+ import { renderWorkflow } from './lib/workflow-cli.mjs';
8
10
 
9
11
  function parseArgs(argv) {
10
12
  const args = {};
@@ -18,8 +20,10 @@ const archFontsDir = new URL('../../analyze-requirements/assets/fonts/', import.
18
20
  const templatePath = new URL('../assets/proposal-template.html', import.meta.url).pathname;
19
21
 
20
22
  const args = parseArgs(process.argv.slice(2));
21
- const md = readFileSync(args.md, 'utf8');
22
23
  const estimation = JSON.parse(readFileSync(args.estimation, 'utf8'));
24
+ // A workflow-mode estimate gets the Systems & Workflows page (spec 4); no proposal.md.
25
+ if (isWorkflow(estimation)) process.exit(renderWorkflow(args));
26
+ const md = readFileSync(args.md, 'utf8');
23
27
 
24
28
  // Validation blocks rendering — same hard rule as the estimate skill,
25
29
  // enforced in code with no skip flag.
@@ -1,37 +1,27 @@
1
1
  import { test } from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
+ import { checkClient } from '../lib/checks-client.mjs';
3
4
  import { checkProposal } from '../lib/checks.mjs';
5
+ import { parseFrontmatter } from '../../../analyze-requirements/scripts/lib/frontmatter.mjs';
4
6
  import { JARGON } from '../lib/jargon.mjs';
5
7
 
6
- // Same synthetic estimation as figures.test.mjs: figures are
7
- // cost 8000/12000, months 1.6/2.4, M1 6000/9000 1.2/1.8, M2 2000/3000 0.4/0.6.
8
+ // Synthetic estimation in the new price/roadmap shape (same as
9
+ // figures.test.mjs): figures are cost 8000/12000, singleNumber 10000,
10
+ // M1 6000/9000, M2 2000/3000.
8
11
  const estimation = {
9
- inputs: {
10
- scenarios: [
11
- { id: 's1', aiAssisted: true, toolingCostPerSeat: 100, team: [{ seniority: 'senior', rate: 50 }] },
12
- { id: 's2-secret', aiAssisted: false, toolingCostPerSeat: null, team: [{ seniority: 'mid', rate: 40 }] },
13
- ],
14
- },
12
+ inputs: { features: [] },
15
13
  computed: {
16
- features: { a: { hours: 100, low: 80, high: 120 }, b: { hours: 100, low: 80, high: 120 } },
17
- scenarios: {
18
- s1: {
19
- months: 2, totalCost: 10000,
20
- roadmap: [
21
- { name: 'M1', startMonths: 0, endMonths: 1.5 },
22
- { name: 'M2', startMonths: 1.5, endMonths: 2 },
23
- ],
24
- },
25
- 's2-secret': { months: 3, totalCost: 15000 },
26
- },
14
+ price: { presentLow: 8000, presentHigh: 12000, singleNumber: 10000, p50: 7998 },
15
+ roadmap: [
16
+ { milestone: 'M1', features: ['a'], share: 0.75 },
17
+ { milestone: 'M2', features: ['b'], share: 0.25 },
18
+ ],
27
19
  },
28
20
  };
29
- const TODAY = new Date('2026-08-06');
30
21
 
31
22
  const md = `---
32
23
  client: Acme Corp
33
24
  client_tech_level: non-tech
34
- scenario: s1
35
25
  currency: USD
36
26
  valid_until: 2099-12-31
37
27
  source_architecture: ../ARCHITECTURE.md
@@ -39,7 +29,7 @@ source_estimation: ../estimation.json
39
29
  ---
40
30
 
41
31
  ## Executive Summary
42
- New booking system for $8,000 – $12,000, delivered in 1.6–2.4 months.
32
+ New booking system for $8,000 – $12,000.
43
33
  ## Background & Objectives
44
34
  Bookings are manual today.
45
35
  ## Proposed Solution
@@ -53,23 +43,27 @@ graph LR; A[Your customers] --> B[New system]
53
43
  ## Out of Scope & Assumptions
54
44
  - Text-message reminders are out.
55
45
  ## Delivery Approach
56
- M1 runs 1.2–1.8 months; M2 runs 0.4–0.6 months. Weekly demos.
46
+ M1 covers booking; M2 covers notifications. Weekly demos.
57
47
  ## Investment & Timeline
58
- | Milestone | Duration | Investment |
59
- | --- | --- | --- |
60
- | M1 | 1.2–1.8 months | $6,000 – $9,000 |
61
- | M2 | 0.4–0.6 months | $2,000 – $3,000 |
62
-
63
- Total: $8,000 – $12,000 over 1.6–2.4 months.
64
- ## Team
65
- One senior engineer.
48
+ | Milestone | Investment |
49
+ | --- | --- |
50
+ | M1 | $6,000 – $9,000 |
51
+ | M2 | $2,000 – $3,000 |
52
+
53
+ Total: $8,000 – $12,000.
66
54
  ## About Code Engine Studio
67
55
  We build software. Contact: hello@example.com
68
56
  ## Next Steps
69
57
  Valid until 2099-12-31. Reply to accept.
70
58
  `;
71
59
 
72
- const run = (doc) => checkProposal({ md: doc, estimation, today: TODAY });
60
+ // checkClient takes already-parsed frontmatter — parse fresh for each
61
+ // variant so tests that edit the frontmatter block (jargon_allow, tech
62
+ // level) see their own change.
63
+ const run = (doc) => {
64
+ const { data: fm } = parseFrontmatter(doc);
65
+ return checkClient({ md: doc, fm, estimation }, []);
66
+ };
73
67
 
74
68
  test('a document whose numbers all trace to the figures passes', () => {
75
69
  assert.deepEqual(run(md), []);
@@ -79,30 +73,20 @@ test('an invented money amount is a finding', () => {
79
73
  assert.ok(run(md.replace('$6,000', '$6,500')).some((f) => f.includes('6,500') || f.includes('6500')));
80
74
  });
81
75
 
82
- test('an invented duration bound is a finding', () => {
83
- assert.ok(run(md.replace('1.6–2.4 months.\n## Team', '1.6–9.9 months.\n## Team'))
84
- .some((f) => f.includes('9.9')));
85
- });
86
-
87
76
  test('the headline cost range must be present', () => {
88
- const noTotals = md.replaceAll('$8,000 – $12,000', 'a fair price').replaceAll('1.6–2.4 months', 'a short time');
77
+ const noTotals = md.replace('New booking system for $8,000 – $12,000.', 'A fair price for a new booking system.');
89
78
  const findings = run(noTotals);
90
79
  assert.ok(findings.some((f) => f.includes('8,000')));
91
- assert.ok(findings.some((f) => f.includes('2.4')));
92
- });
93
-
94
- test('a lone invented duration is a finding', () => {
95
- assert.ok(run(md.replace('Weekly demos.', 'Live within 9 months.')).some((f) => f.includes('9')));
80
+ assert.ok(findings.some((f) => f.includes('12,000')));
96
81
  });
97
82
 
98
83
  test('headline ranges must live in the Executive Summary itself', () => {
99
- const buried = md.replace('New booking system for $8,000 – $12,000, delivered in 1.6–2.4 months.', 'A fair price, fast.');
84
+ const buried = md.replace('New booking system for $8,000 – $12,000.', 'A fair price, fast.');
100
85
  const findings = run(buried);
101
86
  assert.ok(findings.some((f) => /Executive Summary/.test(f)));
102
87
  });
103
88
 
104
- test('other scenario ids and provenance markup are leaks', () => {
105
- assert.ok(run(md.replace('Weekly demos.', 'Cheaper than s2-secret.')).some((f) => f.includes('s2-secret')));
89
+ test('provenance markup is a leak', () => {
106
90
  assert.ok(run(md.replace('| Feature | What you get |', '| Feature | src |')).some((f) => f.includes('src')));
107
91
  assert.ok(run(md.replace('Weekly demos.', '| observed |')).some((f) => f.includes('observed')));
108
92
  });
@@ -138,7 +122,26 @@ test('the deny-list is lowercase and non-trivial', () => {
138
122
  for (const term of JARGON) assert.equal(term, term.toLowerCase());
139
123
  });
140
124
 
125
+ // This one is about the whole pipeline's crash-safety on a document with no
126
+ // frontmatter at all, not about client-safety specifically — checkProposal
127
+ // returns early before ever touching estimation shape, so it stays safe
128
+ // regardless of the scenario-vs-price schema.
141
129
  test('a document with no frontmatter is a finding, not a crash', () => {
142
- assert.deepEqual(checkProposal({ md: '## Executive Summary\nHi.', estimation, today: TODAY }),
130
+ assert.deepEqual(checkProposal({ md: '## Executive Summary\nHi.', estimation, today: new Date('2026-08-06') }),
143
131
  ['frontmatter: no frontmatter block']);
144
132
  });
133
+
134
+ // R55/load-bearing: checkProposal must run the client-safety checks itself —
135
+ // frontmatter no longer carries a scenario key to gate on, so checkClient
136
+ // has to run whenever the estimate is priced. Break the gate in checks.mjs
137
+ // (e.g. restore the old `fm.scenario && estimation.computed.scenarios[...]`
138
+ // condition) and this test goes red because the invented figure below is
139
+ // never caught.
140
+ test('checkProposal refuses an invented money figure through the pipeline', () => {
141
+ const invented = md.replace(
142
+ 'New booking system for $8,000 – $12,000.',
143
+ 'New booking system for $8,000 – $12,000, plus a $6,500 setup fee.',
144
+ );
145
+ const findings = checkProposal({ md: invented, estimation, today: new Date('2026-08-06') });
146
+ assert.ok(findings.some((f) => f.includes('6,500')), findings.join('\n'));
147
+ });