@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
@@ -1,8 +1,11 @@
1
1
  import { test } from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
3
  import { readFileSync } from 'node:fs';
4
- import { AI_CATEGORIES, TIER_BREAKS } from '../lib/estimate-math.mjs';
5
- import { TASK_SHAPES } from '../lib/measurements.mjs';
4
+ import { AI_CATEGORIES } from '../../../shared/lib/estimate-math.mjs';
5
+ import { TASK_SHAPES } from '../../../shared/lib/measurements.mjs';
6
+ import { WEIGHTS, BANDS } from '../../../shared/lib/pricing.mjs';
7
+ import { CONTEXT_FACTORS } from '../../../shared/lib/project-price.mjs';
8
+ import { readZip } from './zip.mjs';
6
9
 
7
10
  const ref = (f) => readFileSync(new URL(`../../references/${f}`, import.meta.url), 'utf8');
8
11
  const ALL = ['interview.md', 'techniques.md', 'ai-multipliers.md', 'writing.md', 'slicing.md',
@@ -12,6 +15,14 @@ test('no reference doc carries placeholders', () => {
12
15
  for (const f of ALL) assert.doesNotMatch(ref(f), /\bTBD\b|\bTODO\b/, f);
13
16
  });
14
17
 
18
+ // The Claude-plan price table used to live in ai-multipliers.md and the
19
+ // interview's seat-cost question used to guard against naming one; both
20
+ // hosts are gone, but the vendor-neutrality rule they carried is not — it
21
+ // now covers every reference doc, not just the one that happened to host it.
22
+ test('no reference doc names a vendor AI plan tier', () => {
23
+ for (const f of ALL) assert.doesNotMatch(ref(f), /Max 5x|Max 20x|Claude plan/, f);
24
+ });
25
+
15
26
  test('interview.md carries its five required parts', () => {
16
27
  const doc = ref('interview.md');
17
28
  for (const needle of ['stated', 'proposed', 'QUICK', 'STANDARD', 'DEEP',
@@ -20,13 +31,16 @@ test('interview.md carries its five required parts', () => {
20
31
  }
21
32
  });
22
33
 
23
- test('techniques.md names every technique and the real tier breaks', () => {
34
+ test('techniques.md names every technique and the shipped bands', () => {
24
35
  const doc = ref('techniques.md');
25
36
  for (const needle of ['factor-scored tiering', 'three-point PERT', 'analogy']) {
26
37
  assert.ok(doc.includes(needle), `techniques.md missing: ${needle}`);
27
38
  }
28
- assert.ok(doc.includes('12–17 M') || doc.includes('12-17 M'), 'tier breaks must match TIER_BREAKS');
29
- assert.equal(TIER_BREAKS[1].max, 17); // the doc claim above is only honest while this holds
39
+ for (const b of BANDS) {
40
+ assert.ok(doc.includes(`${b.start}`) && doc.includes(b.tier), `band ${b.tier} not documented`);
41
+ }
42
+ assert.match(doc, /continuous/i, 'bands must be described as continuous');
43
+ assert.match(doc, /interpolat/i, 'bands must be described as interpolated');
30
44
  });
31
45
 
32
46
  test('ai-multipliers.md agrees with the code constants', () => {
@@ -35,29 +49,22 @@ test('ai-multipliers.md agrees with the code constants', () => {
35
49
  assert.ok(doc.includes(category), `ai-multipliers.md missing category: ${category}`);
36
50
  }
37
51
  assert.match(doc, /blanket/i, 'the blanket-multiplier prohibition must be stated');
38
- // The Claude-plan price table lived here; seat cost is now an interview input.
39
52
  assert.doesNotMatch(doc, /PLAN_PRICES|max5x|max20x/, 'vendor plan pricing must not be documented as a constant');
40
53
  });
41
54
 
42
- test('interview.md asks AI-assisted (default yes) and a nullable seat cost, never a Claude plan', () => {
43
- const doc = ref('interview.md');
44
- for (const needle of ['AI-assisted', 'toolingCostPerSeat', 'default']) {
45
- assert.ok(doc.includes(needle), `interview.md missing: ${needle}`);
46
- }
47
- assert.doesNotMatch(doc, /Max 5x|Max 20x|Claude plan/);
48
- });
49
-
50
- test('interview.md defaults to one team and asks why when several are compared', () => {
55
+ // AI-assisted (default yes) and toolingCostPerSeat priced a team that no
56
+ // longer exists in estimation-inputs.json — schema.mjs refuses `scenarios`
57
+ // outright. The doc must not describe fields the code no longer accepts.
58
+ test('interview.md does not ask for a team, rates, or a seat cost', () => {
51
59
  const doc = ref('interview.md');
52
- for (const needle of ['one team', 'recommendedReason']) {
53
- assert.ok(doc.includes(needle), `interview.md missing: ${needle}`);
54
- }
60
+ assert.doesNotMatch(doc, /toolingCostPerSeat|recommendedReason/, 'removed team/rate fields must not be documented');
61
+ assert.doesNotMatch(doc, /Team \+ rates \+ seniority mix/);
55
62
  });
56
63
 
57
64
  test('writing.md states every validator rule family', () => {
58
65
  const doc = ref('writing.md');
59
66
  for (const needle of ['not estimated', 'stated', 'proposed', 'Out of scope',
60
- 'assumptions', 'buffer', 'elected', 'docs/estimate/', 'Roadmap', 'not calendar dates',
67
+ 'assumptions', 'contingencyRate', 'elected', 'docs/estimate/', 'Roadmap', 'relative shares',
61
68
  'components', 'scope hole']) {
62
69
  assert.ok(doc.includes(needle), `writing.md missing: ${needle}`);
63
70
  }
@@ -108,13 +115,18 @@ test('method sources are cited where techniques are recommended', () => {
108
115
  }
109
116
  });
110
117
 
111
- test('scoring-guide.md carries five rows of five anchors and the tier scale', () => {
118
+ test('the scoring guide states the weight of every factor and the priced bands', () => {
112
119
  const doc = ref('scoring-guide.md');
113
120
  const rows = doc.split('\n').filter((l) => /^\| (Tech complexity|Feature size|Dependencies|Uncertainty|Risk) \|/.test(l));
114
121
  assert.equal(rows.length, 5);
115
122
  for (const r of rows) assert.equal(r.split('|').length - 2, 6, r); // label + 5 anchors
116
- assert.match(doc, /S ≤ 11 · M 12–17 · L 18–22 · XL 23\+/);
117
- assert.match(doc, /XL 400–800 h/);
123
+ for (const [key, w] of Object.entries(WEIGHTS)) {
124
+ assert.ok(doc.includes(`${w * 100}%`), `guide never states ${key}'s ${w * 100}% weight`);
125
+ }
126
+ for (const b of BANDS) {
127
+ assert.ok(doc.includes(`${b.start}`) && doc.includes(b.tier), `band ${b.tier} not documented`);
128
+ }
129
+ assert.doesNotMatch(doc, /XL 400.{1,3}800 ?h/, 'hours calibration must be gone — price bands replace it');
118
130
  assert.doesNotMatch(doc, /derived:/);
119
131
  });
120
132
 
@@ -130,12 +142,24 @@ test('interview.md scores before tasks, names the three review channels and the
130
142
  assert.ok(doc.indexOf('Factor scores per feature') < doc.indexOf('Tasks + O/M/P'), 'scores come before tasks');
131
143
  });
132
144
 
133
- test('techniques.md says scores persist at STANDARD/DEEP and the band is a soft cross-check', () => {
145
+ // The five context factors from project-price.mjs: four derived from
146
+ // upstream BA/architecture artifacts, one (stack familiarity) asked
147
+ // directly. Standalone mode (no companion docs) asks all five.
148
+ test('interview.md asks for stack familiarity and derives the other four context factors', () => {
149
+ const doc = ref('interview.md');
150
+ assert.match(doc, /stack.*familiar/i, 'no stack familiarity question');
151
+ for (const key of Object.keys(CONTEXT_FACTORS)) {
152
+ assert.ok(doc.includes(key), `context factor ${key} never mentioned`);
153
+ }
154
+ assert.match(doc, /standalone/i, 'standalone mode must state it asks all five');
155
+ });
156
+
157
+ test('techniques.md says scores persist at STANDARD/DEEP and the band is the price, not a cross-check', () => {
134
158
  const doc = ref('techniques.md');
135
159
  assert.match(doc, /STANDARD\/DEEP/);
136
160
  assert.match(doc, /persist/i);
137
- assert.match(doc, /cross-check/i);
138
- assert.match(doc, /XL 400-800h|XL 400–800 h/);
161
+ assert.doesNotMatch(doc, /soft cross-check/i, 'the band is the price now, not a cross-check against it');
162
+ assert.doesNotMatch(doc, /XL 400-800h|XL 400–800 h/, 'hours calibration must be gone');
139
163
  });
140
164
 
141
165
  test('writing.md documents the score fields and the Tier rule', () => {
@@ -147,7 +171,45 @@ test('writing.md documents the score fields and the Tier rule', () => {
147
171
  });
148
172
 
149
173
  test('SKILL.md points the interview at the scoring guide and the review script', () => {
150
- const skill = readFileSync(new URL('../../SKILL.md', import.meta.url), 'utf8');
174
+ const skill = readFileSync(new URL('../../FLOW.md', import.meta.url), 'utf8');
151
175
  assert.match(skill, /scoring-guide\.md/);
152
176
  assert.match(skill, /score-review\.mjs/);
153
177
  });
178
+
179
+ // The level definitions for the five context factors live in the v2 workbook
180
+ // the page embeds (Project Roll-up F11:F15, rows in CONTEXT_FACTORS order).
181
+ // Read them from those bytes so the rubric cannot drift from the workbook.
182
+ function rollupDefinitions() {
183
+ const html = readFileSync(new URL('../../../shared/assets/xlsx-export.js', import.meta.url), 'utf8');
184
+ const files = readZip(Buffer.from(/const XLSX_TEMPLATE = '([^']+)'/.exec(html)[1], 'base64'));
185
+ const strings = [...files.get('xl/sharedStrings.xml').toString('utf8').matchAll(/<si>([\s\S]*?)<\/si>/g)]
186
+ .map((m) => [...m[1].matchAll(/<t[^>]*>([^<]*)<\/t>/g)].map((t) => t[1]).join('').replace(/&amp;/g, '&'));
187
+ const sheet = files.get('xl/worksheets/sheet5.xml').toString('utf8');
188
+ return [11, 12, 13, 14, 15].map((row) => {
189
+ const idx = new RegExp(`<c r="F${row}"[^>]*t="s"[^>]*><v>(\\d+)</v>`).exec(sheet)[1];
190
+ return strings[Number(idx)].split(' / ');
191
+ });
192
+ }
193
+
194
+ test('the scoring guide carries the workbook\'s level definitions for every context factor', () => {
195
+ const doc = ref('scoring-guide.md');
196
+ const defs = rollupDefinitions();
197
+ Object.keys(CONTEXT_FACTORS).forEach((key, i) => {
198
+ const row = doc.split('\n').find((l) => l.startsWith(`| \`${key}\` |`));
199
+ assert.ok(row, `scoring-guide.md has no rubric row for ${key}`);
200
+ const cells = row.split('|').slice(2, -1).map((c) => c.trim());
201
+ assert.deepEqual(cells, defs[i], `${key} levels differ from Project Roll-up F${11 + i}`);
202
+ });
203
+ });
204
+
205
+ // Level 1 is the familiar, cheapest end (x1.00); level 3-4 is a stack new to
206
+ // the team (x1.35). A pick-list that runs the other way prices backwards.
207
+ test('interview.md asks stack familiarity with level 1 as the familiar stack', () => {
208
+ const doc = ref('interview.md');
209
+ const levels = rollupDefinitions()[1];
210
+ levels.forEach((words, i) => {
211
+ const re = new RegExp(`${i + 1}\\s+${words.replace(/ /g, '\\s+')}`, 'i');
212
+ assert.ok(re.test(doc), `stack pick-list level ${i + 1} must read "${words}"`);
213
+ });
214
+ assert.doesNotMatch(doc, /never used it/i, 'level 1 is the familiar stack, not "never used it"');
215
+ });
@@ -0,0 +1,405 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { readFileSync, writeFileSync, mkdtempSync } from 'node:fs';
4
+ import { execFileSync } from 'node:child_process';
5
+ import { tmpdir } from 'node:os';
6
+ import { join } from 'node:path';
7
+ import { inlineModule, extractExports, stripInternal } from '../../../shared/lib/inline.mjs';
8
+
9
+ const tpl = () => readFileSync(new URL('../../assets/estimate-template.html', import.meta.url), 'utf8');
10
+ const cli = new URL('../render.mjs', import.meta.url).pathname;
11
+ const fixture = new URL('./fixtures/booking-inputs.json', import.meta.url).pathname;
12
+ const passMd = new URL('./fixtures/estimation-pass.md', import.meta.url).pathname;
13
+ const computeCli = new URL('../compute.mjs', import.meta.url).pathname;
14
+ const agenticFixture = new URL('./fixtures/agentic-inputs.json', import.meta.url).pathname;
15
+ const agenticPassMd = new URL('./fixtures/agentic-estimation-pass.md', import.meta.url).pathname;
16
+ const measurementsFixture = new URL('./fixtures/measurements.jsonl', import.meta.url).pathname;
17
+
18
+ function renderedPage(extra = []) {
19
+ return renderWith(() => {}, extra);
20
+ }
21
+
22
+ // Same pipeline, with the booking inputs mutated first — for pages whose
23
+ // shape depends on an optional input (recommendedReason, the expose flag).
24
+ function renderWith(mutate, extra = []) {
25
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-render-'));
26
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
27
+ mutate(inputs);
28
+ const inputsPath = join(dir, 'inputs.json');
29
+ writeFileSync(inputsPath, JSON.stringify(inputs));
30
+ const json = join(dir, 'estimation.json');
31
+ execFileSync('node', [computeCli, '--inputs', inputsPath, '--out', json]);
32
+ execFileSync('node', [cli, '--json', json, '--md', passMd, '--out', dir, ...extra]);
33
+ return readFileSync(join(dir, 'estimate.html'), 'utf8');
34
+ }
35
+
36
+ // Agentic fixtures point measurementsPath at the shared fixture file, same
37
+ // as validate.test.mjs's agenticEstimation() helper.
38
+ function renderAgentic({ clientOnly = false } = {}) {
39
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-render-agentic-'));
40
+ const inputs = JSON.parse(readFileSync(agenticFixture, 'utf8'));
41
+ inputs.measurementsPath = measurementsFixture;
42
+ const inputsPath = join(dir, 'inputs.json');
43
+ writeFileSync(inputsPath, JSON.stringify(inputs));
44
+ const json = join(dir, 'estimation.json');
45
+ execFileSync('node', [computeCli, '--inputs', inputsPath, '--out', json]);
46
+ execFileSync('node', [cli, '--json', json, '--md', agenticPassMd, '--out', dir, ...(clientOnly ? ['--client-only'] : [])]);
47
+ return readFileSync(join(dir, 'estimate.html'), 'utf8');
48
+ }
49
+
50
+ // The data island is the only place a rendered page states a number: every
51
+ // section is drawn in the browser from this blob, so a test about what the
52
+ // page carries reads it here rather than pattern-matching template source.
53
+ function embedded(html) {
54
+ return JSON.parse(html.match(/<script type="application\/json" id="estimation-data">([\s\S]*?)<\/script>/)[1]);
55
+ }
56
+
57
+ test('render refuses a deliverable that fails validation', () => {
58
+ const failMd = new URL('./fixtures/estimation-fail.md', import.meta.url).pathname;
59
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-render-'));
60
+ const json = join(dir, 'estimation.json');
61
+ execFileSync('node', [computeCli, '--inputs', fixture, '--out', json]);
62
+ assert.throws(() => execFileSync('node', [cli, '--json', json, '--md', failMd, '--out', dir]));
63
+ });
64
+
65
+ test('template carries exactly the six slots and no external URLs', () => {
66
+ const markers = [...tpl().matchAll(/<!-- slot:(\w+) -->/g)].map((m) => m[1]).sort();
67
+ assert.deepEqual([...new Set(markers)], ['DATA', 'FONTS', 'GUIDE', 'TITLE', 'VIEWER', 'XLSX']);
68
+ // openxmlformats URIs are XML namespace identifiers the xlsx export writes
69
+ // into generated sheets — never fetched, so the page stays self-contained.
70
+ assert.doesNotMatch(tpl(), /https?:\/\/(?!www\.w3\.org|schemas\.openxmlformats\.org)/);
71
+ });
72
+
73
+ // Companion mode: the analyze-requirements viewer links this page, and this page links
74
+ // back. The href is caller-supplied because only the caller knows where the
75
+ // viewer was rendered; internal-only because a client file must not point at
76
+ // an internal document set.
77
+ test('--viewer adds an internal-only back-link; client-only strips it', () => {
78
+ const withLink = renderedPage(['--viewer', '../viewer/index.html']);
79
+ assert.match(withLink, /<a id="viewer-link" data-internal href="\.\.\/viewer\/index\.html">/);
80
+ const without = renderedPage();
81
+ assert.doesNotMatch(without, /<a id="viewer-link"/);
82
+ const client = renderedPage(['--viewer', '../viewer/index.html', '--client-only']);
83
+ assert.doesNotMatch(client, /<a id="viewer-link"/);
84
+ });
85
+
86
+ test('the --viewer href is attribute-escaped', () => {
87
+ const html = renderedPage(['--viewer', '../a"b/index.html']);
88
+ assert.match(html, /href="\.\.\/a&quot;b\/index\.html"/);
89
+ });
90
+
91
+ test('rendered page is self-contained and carries parseable data', () => {
92
+ const html = renderedPage();
93
+ assert.doesNotMatch(html, /<!-- slot:/);
94
+ assert.match(html, /@font-face/);
95
+ const data = html.match(/<script type="application\/json" id="estimation-data">([\s\S]*?)<\/script>/)[1];
96
+ assert.equal(JSON.parse(data).inputs.project, 'Booking App');
97
+ // No formula is inlined any more: the page reads committed numbers only.
98
+ assert.doesNotMatch(html, /function pert\(/);
99
+ assert.doesNotMatch(html, /function scenarioRollup\(|function taskHours\(/);
100
+ });
101
+
102
+ test('inlineModule strips export keywords; extractExports keeps only the named blocks', () => {
103
+ assert.equal(inlineModule('export function f() {}\nexport const X = 1;\nconst y = 2;'),
104
+ 'function f() {}\nconst X = 1;\nconst y = 2;');
105
+ assert.equal(extractExports('export const A = 1;\nexport function b() {\n return A;\n}\nexport const C = 3;', ['b']),
106
+ 'export function b() {\n return A;\n}');
107
+ });
108
+
109
+ test('the page carries a method section with source attributions', () => {
110
+ const html = renderedPage();
111
+ assert.match(html, /id="method"/);
112
+ assert.match(html, /atomicobject\.com/); // sources cited in the page, not only in refs
113
+ assert.match(html, /kmino\.io/);
114
+ });
115
+
116
+ test('the summary comes first and the method fold last — the number before the formula', () => {
117
+ assert.match(tpl(), /<main>\s*<div class="col">\s*<section id="summary">/);
118
+ assert.match(tpl(), /<section id="register"><\/section>\s*<section id="method"><\/section>\s*<\/div>\s*<\/main>/);
119
+ });
120
+
121
+ // The scenario cards, the cost bars and the what-if rail are gone: one
122
+ // Summary block states the recommended team, months and cost once.
123
+ test('the page has no scenario cards, cost bars or what-if rail', () => {
124
+ const html = renderedPage();
125
+ assert.doesNotMatch(html, /scenario-cards|cost-bars|ctl-|whatif|modified-banner|id="reset"/);
126
+ assert.match(html, /id="summary"/);
127
+ });
128
+
129
+ // The page's one headline is the price, and it is the price the roll-up
130
+ // committed — the summary reads computed.price and nothing else. Durations
131
+ // are checked over the whole file (minus HTML comments, so a commented-out
132
+ // month would not pass) because nothing in the model produces one any more.
133
+ test('the page carries the price block and no duration anywhere', () => {
134
+ const html = renderedPage();
135
+ const { price, roadmap } = embedded(html).computed;
136
+ assert.deepEqual(
137
+ [price.presentLow, price.presentHigh, price.singleNumber, price.contingencyRate],
138
+ [10000, 14000, 12000, 0.15]);
139
+ // the retired key was one level up, computed.scenarios, not computed.price.scenarios —
140
+ // breaks if rollup.mjs/project-price.mjs ever puts a scenarios key back on computed
141
+ assert.equal(embedded(html).computed.scenarios, undefined);
142
+ assert.ok(roadmap.length > 0);
143
+ assert.ok(!/month/i.test(html.replace(/<!--[\s\S]*?-->/g, '')), 'no durations anywhere');
144
+ });
145
+
146
+ // The roadmap is milestone shares of total effort. The percentages the page
147
+ // draws are checked in browser.test.mjs; here the shares must reach the page
148
+ // attached to the milestone they size.
149
+ test('the roadmap travels as milestone shares, not month bands', () => {
150
+ const { roadmap } = embedded(renderedPage()).computed;
151
+ assert.deepEqual(roadmap.map((b) => [b.milestone, b.share]),
152
+ [['M1 - Booking core', 0.76], ['M2 - Notifications', 0.24]]);
153
+ for (const band of roadmap) {
154
+ assert.equal(band.startMonths, undefined);
155
+ assert.equal(band.endMonths, undefined);
156
+ }
157
+ });
158
+
159
+ // proposal-figures.json carries a cost range and a single number; it carries
160
+ // no duration, so neither does the line the page draws from it.
161
+ test('--figures adds the client-facing range; without it there is none', () => {
162
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-figures-'));
163
+ const figures = join(dir, 'proposal-figures.json');
164
+ writeFileSync(figures, JSON.stringify({
165
+ cost: { low: 5000, high: 7000 }, singleNumber: 6500,
166
+ milestones: [{ name: 'M1 - Booking core', share: 0.76 }],
167
+ }));
168
+ const withRange = renderedPage(['--figures', figures]);
169
+ assert.deepEqual(embedded(withRange).figures,
170
+ { cost: { low: 5000, high: 7000 }, singleNumber: 6500 });
171
+ const without = renderedPage();
172
+ assert.equal(embedded(without).figures, undefined);
173
+ });
174
+
175
+ test('recommendedReason travels with the data', () => {
176
+ const html = renderWith((inputs) => { inputs.recommendedReason = 'client has one senior available'; });
177
+ assert.match(html, /"recommendedReason":"client has one senior available"/);
178
+ });
179
+
180
+ // R48: recommendedReason is free text an internal agent writes under a
181
+ // contract that never warns it reaches the client (same reasoning as a
182
+ // score's cite). The client receives the file, not a rendered view, so this
183
+ // checks the raw exported bytes rather than the DOM — a DOM-only or
184
+ // rendered-text assertion would pass even if the phrase still sat in the
185
+ // embedded JSON, which is exactly the gap this closes.
186
+ test('--client-only strips recommendedReason from the file, not just the rendered view', () => {
187
+ const hazard = 'we quoted low to beat the incumbent bid';
188
+ const client = renderWith((inputs) => { inputs.recommendedReason = hazard; }, ['--client-only']);
189
+ assert.ok(!client.includes(hazard), 'client-only export leaks recommendedReason');
190
+ assert.doesNotMatch(client, /"recommendedReason":/);
191
+ // the internal render is the field's actual audience; it must still carry it
192
+ const internal = renderWith((inputs) => { inputs.recommendedReason = hazard; });
193
+ assert.ok(internal.includes(hazard), 'internal render lost recommendedReason');
194
+ });
195
+
196
+ // R49: a task's o/m/p/name/category are the estimate itself, the same class
197
+ // as computed.features[*].hours/low/high, which already ship unconditionally
198
+ // — so those stay. The judgment behind the number (confidence, provenance,
199
+ // assumptions) is the same class as a score's cite, so it is stripped from
200
+ // the file, not just hidden from the render. Checked at the file-byte level,
201
+ // like R48, using the booking fixture's own task-level values (no mutation
202
+ // needed). The task assumption's exact serialized form (a bare string array)
203
+ // is the needle, not the word alone — inputs.assumptions is a project-level,
204
+ // client-facing field that separately carries "single timezone" as prose,
205
+ // and that one must survive.
206
+ test('--client-only strips a task\'s judgment fields, not its estimate', () => {
207
+ const client = renderedPage(['--client-only']);
208
+ assert.doesNotMatch(client, /"assumptions":\["single timezone"\]/);
209
+ assert.doesNotMatch(client, /"confidence":/);
210
+ // provenance also names a feature-level field (client-facing per spec), so
211
+ // only the task-level key is checked, structurally rather than by string
212
+ for (const f of Object.values(embedded(client).inputs.features)) {
213
+ for (const t of f.tasks) {
214
+ assert.equal(t.confidence, undefined);
215
+ assert.equal(t.provenance, undefined);
216
+ assert.equal(t.assumptions, undefined);
217
+ }
218
+ }
219
+ assert.match(client, /"name":"Booking CRUD API"/);
220
+ assert.match(client, /"o":16,"m":24,"p":40/);
221
+
222
+ // the internal render is where the judgment belongs; it must still carry it
223
+ const internal = renderedPage();
224
+ assert.match(internal, /"assumptions":\["single timezone"\]/);
225
+ assert.match(internal, /"confidence":"HIGH"/);
226
+ });
227
+
228
+ test('the breakdown no longer carries a Range column', () => {
229
+ assert.doesNotMatch(tpl(), /label: 'Range'/);
230
+ });
231
+
232
+ // `data-internal` and `ctl-team` were dropped from this check (were R49):
233
+ // `data-internal` is built at runtime as ['data','internal'].join('-') so it
234
+ // never appears as source text whether or not anything was stripped, and
235
+ // `ctl-team` has zero occurrences anywhere in the template — both are
236
+ // can't-fail. `internal:start` is real: it is the marker stripInternal
237
+ // deletes, and the raw template carries it three times.
238
+ test('--client-only strips every internal range', () => {
239
+ const html = renderedPage(['--client-only']);
240
+ assert.doesNotMatch(html, /internal:start/);
241
+ assert.match(stripInternal('a<!-- internal:start -->X<!-- internal:end -->b'), /^ab$/);
242
+ });
243
+
244
+ // exposeRatesToClient gates the pricing working: the context multiplier, the
245
+ // overhead lines, the adjusted base, and each feature's tier and price band.
246
+ //
247
+ // Bare identifiers, not quoted JSON keys, for everything the page names only
248
+ // while drawing the working — the renderer for it lives inside an
249
+ // internal:start/end block, so a client file carries these in neither its data
250
+ // nor its code, captions included. `Tier Reference` is that block's caption
251
+ // and is checked the same way.
252
+ const BARE_INTERNALS = ['contextMultiplier', 'adjustedBase', 'featurePoints', 'priceLow', 'priceHigh', 'Tier Reference'];
253
+ // `overheads` is the one exception: the Method section explains in prose that
254
+ // overheads are loaded onto the base, and that sentence is client-facing. Only
255
+ // the numbers behind it are internal, so this one is matched as a quoted JSON
256
+ // key — the form that still fails if redact.mjs stops stripping the block.
257
+ const QUOTED_INTERNALS = [/"overheads":/, /"contextMultiplier":/, /"adjustedBase":/];
258
+
259
+ test('--client-only strips the pricing internals and keeps the presented range', () => {
260
+ const internal = renderedPage();
261
+ for (const field of BARE_INTERNALS) assert.ok(internal.includes(field), `internal render must carry ${field}`);
262
+ for (const re of QUOTED_INTERNALS) assert.match(internal, re);
263
+
264
+ const html = renderedPage(['--client-only']);
265
+ for (const field of BARE_INTERNALS) assert.ok(!html.includes(field), `client view leaks ${field}`);
266
+ for (const re of QUOTED_INTERNALS) assert.doesNotMatch(html, re);
267
+
268
+ const { price } = embedded(html).computed;
269
+ assert.deepEqual([price.presentLow, price.presentHigh, price.singleNumber], [10000, 14000, 12000]);
270
+ });
271
+
272
+ // The per-feature half of the same strip: the tier a feature landed in and
273
+ // the band it priced at are the working, not the quote.
274
+ test('--client-only strips each feature tier and price band', () => {
275
+ const client = embedded(renderedPage(['--client-only'])).computed.features;
276
+ assert.deepEqual(Object.keys(client).sort(), ['booking', 'reminders']);
277
+ for (const f of Object.values(client)) {
278
+ assert.deepEqual([f.tier, f.point, f.priceLow, f.priceHigh], [undefined, undefined, undefined, undefined]);
279
+ assert.equal(typeof f.hours, 'number'); // delivery planning survives
280
+ assert.equal(typeof f.scoreTotal, 'number'); // so does the score it was judged on
281
+ }
282
+ });
283
+
284
+ // The cite is internal shorthand — ticket phrases, file names, meeting
285
+ // wording — so it never ships, rates opt-out or not. The anchor is the guide
286
+ // sentence the client can read, and it stays.
287
+ test('--client-only blanks the evidence cites and keeps the anchors', () => {
288
+ const client = renderedPage(['--client-only']);
289
+ assert.doesNotMatch(client, /slot conflict \+ cancellation rules/);
290
+ assert.match(client, /Custom business logic, moderate algorithm complexity, multiple states/);
291
+ assert.match(renderedPage(), /slot conflict \+ cancellation rules/);
292
+ });
293
+
294
+ // The context levels are our written rating of the client's own spec and
295
+ // decision-making, and the input to the context multiplier the client file
296
+ // already hides. With rates hidden, both objects leave the bytes; with rates
297
+ // exposed, the levels stay but the cite (our internal file references) never
298
+ // ships, same as a score's cite.
299
+ test('--client-only drops the context levels and provenance from the file', () => {
300
+ const internal = renderedPage();
301
+ for (const s of ['contextLevels', 'contextProvenance', 'requirements.json readiness 62']) {
302
+ assert.ok(internal.includes(s), `internal render must carry ${s}`);
303
+ }
304
+ const client = renderedPage(['--client-only']);
305
+ for (const s of ['contextLevels', 'contextProvenance', 'requirements.json readiness 62', 'outline or slide deck']) {
306
+ assert.ok(!client.includes(s), `client file leaks ${s}`);
307
+ }
308
+ const exposed = renderWith((inputs) => { inputs.exposeRatesToClient = true; }, ['--client-only']);
309
+ assert.equal(embedded(exposed).inputs.contextLevels.specQuality, 3);
310
+ assert.ok(!exposed.includes('requirements.json readiness 62'), 'a context cite ships with rates exposed');
311
+ });
312
+
313
+ // Spec §8: the xlsx export block stays inside internal: markers because the
314
+ // embedded workbook carries the tier bands, overhead percentages and
315
+ // contingency parameters. The build-up renderer sits in its own internal block.
316
+ test('--client-only strips the embedded workbook and the build-up renderer', () => {
317
+ const NEEDLES = ['XLSX_TEMPLATE', 'buildUpTable', 'tierReferenceTable'];
318
+ const internal = renderedPage();
319
+ for (const s of NEEDLES) assert.ok(internal.includes(s), `internal render must carry ${s}`);
320
+ const client = renderedPage(['--client-only']);
321
+ for (const s of NEEDLES) assert.ok(!client.includes(s), `client file carries ${s}`);
322
+ });
323
+
324
+ test('--client-only keeps the pricing internals when exposeRatesToClient is true', () => {
325
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-render-'));
326
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
327
+ inputs.exposeRatesToClient = true;
328
+ const inputsPath = join(dir, 'inputs.json');
329
+ writeFileSync(inputsPath, JSON.stringify(inputs));
330
+ const json = join(dir, 'estimation.json');
331
+ execFileSync('node', [computeCli, '--inputs', inputsPath, '--out', json]);
332
+ execFileSync('node', [cli, '--json', json, '--md', passMd, '--out', dir, '--client-only']);
333
+ const { computed } = embedded(readFileSync(join(dir, 'estimate.html'), 'utf8'));
334
+ assert.equal(computed.price.contextMultiplier, 1.4);
335
+ assert.equal(computed.price.overheads.totalPct, 0.56);
336
+ assert.equal(computed.features.booking.tier, 'M');
337
+ assert.equal(typeof computed.features.booking.priceLow, 'number');
338
+ });
339
+
340
+ test('component data survives the client-only render', () => {
341
+ // deliberate: names come from the architecture doc the client already sees;
342
+ // costs stay redacted — the rollup shows hours/share only
343
+ const client = renderedPage(['--client-only']);
344
+ assert.match(client, /"components":/);
345
+ assert.match(client, /"component":"api"/);
346
+ });
347
+
348
+ test('the rendered page carries the roadmap section markup', () => {
349
+ const html = renderedPage();
350
+ assert.match(html, /id="roadmap"/);
351
+ assert.match(html, /roadmapRow|roadmap-row/); // renderer present, not stripped
352
+ });
353
+
354
+ // Agentic template routing.
355
+ test('agentic estimation renders the agentic template', () => {
356
+ const html = renderAgentic();
357
+ assert.match(html, /Delivery: agentic/);
358
+ assert.match(html, /UNCALIBRATED/);
359
+ assert.match(html, /Refactor A/); // evidence rendered from computed data
360
+ assert.doesNotMatch(html, /boilerplate/); // no AI-category machinery on this page
361
+ });
362
+
363
+ // An agentic estimation scores nothing, so its features carry no tier and
364
+ // its price is all zeroes — but the price block itself still exists, and its
365
+ // working is stripped by the same rule as a team estimate's.
366
+ test('agentic client render strips the pricing internals too', () => {
367
+ const full = renderAgentic();
368
+ const fullPrice = embedded(full).computed.price;
369
+ assert.equal(fullPrice.contextMultiplier, 1);
370
+ assert.equal(typeof fullPrice.overheads.totalPct, 'number');
371
+
372
+ const client = renderAgentic({ clientOnly: true });
373
+ for (const field of ['contextMultiplier', 'overheads', 'adjustedBase', 'featurePoints']) {
374
+ assert.ok(!client.includes(field), `agentic client view leaks ${field}`);
375
+ }
376
+ assert.equal(embedded(client).computed.price.presentLow, 0);
377
+ });
378
+
379
+ test('agentic client render strips the measurements path, repository, and evidence descriptions', () => {
380
+ const full = renderAgentic();
381
+ assert.match(full, new RegExp(measurementsFixture.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
382
+ assert.match(full, /"repository":"project-a"/);
383
+ assert.match(full, /Refactor A/);
384
+
385
+ const client = renderAgentic({ clientOnly: true });
386
+ assert.doesNotMatch(client, new RegExp(measurementsFixture.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')));
387
+ assert.doesNotMatch(client, /"measurementsPath":/);
388
+ assert.doesNotMatch(client, /"repository":/);
389
+ assert.doesNotMatch(client, /Refactor A/);
390
+ assert.doesNotMatch(client, />undefined</); // renderEvidence tolerates a stripped description
391
+ });
392
+
393
+ test('the page never derives scores and carries the guide from the reference file', () => {
394
+ const html = renderedPage();
395
+ for (const gone of ['deriveScores', 'TECH_CATEGORY_SCORE', 'scoreTier', 'SCORE_GUIDE', 'bdModePill', 'bdMode(', 'derived:']) {
396
+ assert.equal(html.includes(gone), false, `${gone} must not be in the page`);
397
+ }
398
+ assert.match(html, /<template id="scoring-guide"><table class="guide-table">/);
399
+ assert.ok(html.includes('Payments, auth, data migrations, or PII — high business impact'));
400
+ });
401
+
402
+ test('the agentic page has no guide slot', () => {
403
+ const html = renderAgentic();
404
+ assert.doesNotMatch(html, /scoring-guide/);
405
+ });