@v11g/agents-rock 1.0.7 → 1.0.9

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 (215) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/reasoning/.claude-plugin/plugin.json +1 -1
  4. package/plugins/reasoning/evals/format-handoff-folder/graders/folder-named.md +8 -0
  5. package/plugins/reasoning/evals/format-handoff-folder/graders/skill-fired.md +7 -0
  6. package/plugins/reasoning/evals/format-handoff-folder/prompt.md +9 -0
  7. package/plugins/reasoning/evals/format-ids-and-supports/graders/ids-in-chat.md +8 -0
  8. package/plugins/reasoning/evals/format-ids-and-supports/graders/skill-fired.md +7 -0
  9. package/plugins/reasoning/evals/format-ids-and-supports/graders/supports-resolve.md +11 -0
  10. package/plugins/reasoning/evals/format-ids-and-supports/prompt.md +8 -0
  11. package/plugins/reasoning/evals/format-root-candidate-status/graders/candidate-status.md +11 -0
  12. package/plugins/reasoning/evals/format-root-candidate-status/graders/skill-fired.md +7 -0
  13. package/plugins/reasoning/evals/format-root-candidate-status/prompt.md +8 -0
  14. package/plugins/reasoning/evals/format-unsaved-continues/graders/analysis-completes.md +9 -0
  15. package/plugins/reasoning/evals/format-unsaved-continues/graders/not-saved-stated.md +9 -0
  16. package/plugins/reasoning/evals/format-unsaved-continues/graders/skill-fired.md +7 -0
  17. package/plugins/reasoning/evals/format-unsaved-continues/prompt.md +8 -0
  18. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/names-closest-available.md +5 -6
  19. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/no-improvised-levels.md +4 -6
  20. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/skill-fired.md +1 -1
  21. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/states-unavailable.md +4 -5
  22. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/systemic-design-fired.md +10 -0
  23. package/plugins/reasoning/evals/guardrail-unavailable-framework/prompt.md +2 -2
  24. package/plugins/reasoning/evals/ps-interview-first-question/graders/look-in-present.md +10 -0
  25. package/plugins/reasoning/evals/ps-interview-first-question/graders/no-fixed-exits.md +11 -0
  26. package/plugins/reasoning/evals/ps-interview-first-question/graders/options-from-input.md +15 -0
  27. package/plugins/reasoning/evals/ps-interview-first-question/graders/skill-fired.md +7 -0
  28. package/plugins/reasoning/evals/ps-interview-first-question/graders/source-hint.md +11 -0
  29. package/plugins/reasoning/evals/ps-interview-first-question/graders/targets-gap.md +13 -0
  30. package/plugins/reasoning/evals/ps-interview-first-question/prompt.md +8 -0
  31. package/plugins/reasoning/evals/ps-interview-five-whys/graders/look-in-present.md +10 -0
  32. package/plugins/reasoning/evals/ps-interview-five-whys/graders/no-fixed-exits.md +11 -0
  33. package/plugins/reasoning/evals/ps-interview-five-whys/graders/options-from-input.md +11 -0
  34. package/plugins/reasoning/evals/ps-interview-five-whys/graders/skill-fired.md +7 -0
  35. package/plugins/reasoning/evals/ps-interview-five-whys/graders/source-hint.md +11 -0
  36. package/plugins/reasoning/evals/ps-interview-five-whys/graders/targets-gap.md +15 -0
  37. package/plugins/reasoning/evals/ps-interview-five-whys/prompt.md +8 -0
  38. package/plugins/reasoning/evals/ps-router-handoff/graders/no-reselection.md +11 -0
  39. package/plugins/reasoning/evals/ps-router-handoff/graders/runs-rca.md +8 -0
  40. package/plugins/reasoning/evals/ps-router-handoff/graders/skill-fired.md +7 -0
  41. package/plugins/reasoning/evals/ps-router-handoff/prompt.md +11 -0
  42. package/plugins/reasoning/evals/routing-adaptive-discriminator/graders/confidence-single-word.md +10 -0
  43. package/plugins/reasoning/evals/routing-ambiguous-feature-request/graders/confidence-single-word.md +10 -0
  44. package/plugins/reasoning/evals/routing-classify-only/graders/confidence-single-word.md +10 -0
  45. package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/confidence-single-word.md +10 -0
  46. package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/no-unavailability-claim.md +10 -0
  47. package/plugins/reasoning/evals/routing-complex-delivery-slowdown/graders/confidence-single-word.md +10 -0
  48. package/plugins/reasoning/evals/routing-simple-null-pointer/graders/confidence-single-word.md +10 -0
  49. package/plugins/reasoning/evals/routing-thin-input-provisional/graders/confidence-single-word.md +10 -0
  50. package/plugins/reasoning/evals/sd-default-selection/graders/dates-traced.md +15 -0
  51. package/plugins/reasoning/evals/sd-default-selection/graders/interventions-cite-entries.md +12 -0
  52. package/plugins/reasoning/evals/sd-default-selection/graders/owners-from-input.md +8 -0
  53. package/plugins/reasoning/evals/sd-default-selection/graders/plan-steps-complete.md +21 -0
  54. package/plugins/reasoning/evals/sd-default-selection/graders/selects-systemic-design.md +12 -0
  55. package/plugins/reasoning/evals/sd-default-selection/graders/skill-fired.md +7 -0
  56. package/plugins/reasoning/evals/sd-default-selection/graders/systemic-design-fired.md +10 -0
  57. package/plugins/reasoning/evals/sd-default-selection/prompt.md +11 -0
  58. package/plugins/reasoning/evals/sd-named-framework-software/graders/names-no-skill.md +11 -0
  59. package/plugins/reasoning/evals/sd-named-framework-software/graders/no-systemic-block.md +10 -0
  60. package/plugins/reasoning/evals/sd-named-framework-software/graders/systemic-design-fired.md +10 -0
  61. package/plugins/reasoning/evals/sd-named-framework-software/prompt.md +8 -0
  62. package/plugins/reasoning/evals/sd-not-software/graders/no-systemic-block.md +10 -0
  63. package/plugins/reasoning/evals/sd-not-software/graders/says-out-of-scope.md +10 -0
  64. package/plugins/reasoning/evals/sd-not-software/prompt.md +8 -0
  65. package/plugins/reasoning/evals/sd-raw-input/graders/first-question-targets-model.md +11 -0
  66. package/plugins/reasoning/evals/sd-raw-input/graders/look-in-present.md +10 -0
  67. package/plugins/reasoning/evals/sd-raw-input/graders/model-gap-blocks-stop.md +14 -0
  68. package/plugins/reasoning/evals/sd-raw-input/graders/model-in-assumptions.md +13 -0
  69. package/plugins/reasoning/evals/sd-raw-input/graders/no-fixed-exits.md +11 -0
  70. package/plugins/reasoning/evals/sd-raw-input/graders/skill-fired.md +7 -0
  71. package/plugins/reasoning/evals/sd-raw-input/graders/systemic-design-fired.md +10 -0
  72. package/plugins/reasoning/evals/sd-raw-input/prompt.md +8 -0
  73. package/plugins/reasoning/evals/sd-theory-of-change/graders/links-carry-assumptions.md +9 -0
  74. package/plugins/reasoning/evals/sd-theory-of-change/graders/no-dates.md +8 -0
  75. package/plugins/reasoning/evals/sd-theory-of-change/graders/skill-fired.md +7 -0
  76. package/plugins/reasoning/evals/sd-theory-of-change/graders/systemic-design-fired.md +10 -0
  77. package/plugins/reasoning/evals/sd-theory-of-change/graders/toc-block.md +10 -0
  78. package/plugins/reasoning/evals/sd-theory-of-change/prompt.md +8 -0
  79. package/plugins/reasoning/evals/sd-three-horizons/graders/dates-are-assumptions.md +11 -0
  80. package/plugins/reasoning/evals/sd-three-horizons/graders/owners-are-roles.md +8 -0
  81. package/plugins/reasoning/evals/sd-three-horizons/graders/skill-fired.md +7 -0
  82. package/plugins/reasoning/evals/sd-three-horizons/graders/systemic-design-fired.md +10 -0
  83. package/plugins/reasoning/evals/sd-three-horizons/graders/three-horizons-block.md +10 -0
  84. package/plugins/reasoning/evals/sd-three-horizons/prompt.md +9 -0
  85. package/plugins/reasoning/evals/st-causal-loop-unclosed/graders/edges-carry-support-labels.md +2 -2
  86. package/plugins/reasoning/evals/st-causal-loop-unclosed/graders/no-invented-delays.md +7 -4
  87. package/plugins/reasoning/evals/st-interview-first-question/graders/look-in-present.md +10 -0
  88. package/plugins/reasoning/evals/st-interview-first-question/graders/no-fixed-exits.md +11 -0
  89. package/plugins/reasoning/evals/st-interview-first-question/graders/options-from-input.md +11 -0
  90. package/plugins/reasoning/evals/st-interview-first-question/graders/skill-fired.md +7 -0
  91. package/plugins/reasoning/evals/st-interview-first-question/graders/source-hint.md +11 -0
  92. package/plugins/reasoning/evals/st-interview-first-question/graders/targets-gap.md +13 -0
  93. package/plugins/reasoning/evals/st-interview-first-question/prompt.md +8 -0
  94. package/plugins/reasoning/evals/st-selection-boundary/graders/one-block-only.md +9 -6
  95. package/plugins/reasoning/skills/problem-router/README.md +6 -0
  96. package/plugins/reasoning/skills/problem-router/SKILL.md +11 -11
  97. package/plugins/reasoning/skills/problem-router/references/contract.md +117 -16
  98. package/plugins/reasoning/skills/problem-solving/README.md +10 -0
  99. package/plugins/reasoning/skills/problem-solving/SKILL.md +15 -3
  100. package/plugins/reasoning/skills/problem-solving/references/contract.md +117 -16
  101. package/plugins/reasoning/skills/problem-solving/references/interview.md +68 -0
  102. package/plugins/reasoning/skills/systemic-design/README.md +45 -0
  103. package/plugins/reasoning/skills/systemic-design/SKILL.md +184 -0
  104. package/plugins/reasoning/skills/systemic-design/frameworks/systemic-design.md +39 -0
  105. package/plugins/reasoning/skills/systemic-design/frameworks/theory-of-change.md +34 -0
  106. package/plugins/reasoning/skills/systemic-design/frameworks/three-horizons.md +28 -0
  107. package/plugins/reasoning/skills/systemic-design/references/contract.md +205 -0
  108. package/plugins/reasoning/skills/systemic-design/references/interview.md +68 -0
  109. package/plugins/reasoning/skills/systems-thinking/README.md +13 -6
  110. package/plugins/reasoning/skills/systems-thinking/SKILL.md +18 -6
  111. package/plugins/reasoning/skills/systems-thinking/frameworks/causal-loop.md +5 -2
  112. package/plugins/reasoning/skills/systems-thinking/frameworks/leverage-points.md +16 -7
  113. package/plugins/reasoning/skills/systems-thinking/frameworks/system-map.md +4 -5
  114. package/plugins/reasoning/skills/systems-thinking/references/contract.md +117 -16
  115. package/plugins/reasoning/skills/systems-thinking/references/interview.md +68 -0
  116. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  117. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +3 -2
  118. package/plugins/solution-architect/skills/analyze-requirements/references/rewriting.md +108 -0
  119. package/plugins/solution-architect/skills/analyze-requirements/scripts/drift.mjs +64 -0
  120. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +4 -1
  121. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/drift.mjs +31 -0
  122. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/git-diff.mjs +27 -0
  123. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +16 -1
  124. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/state.mjs +52 -0
  125. package/plugins/solution-architect/skills/analyze-requirements/scripts/record.mjs +87 -0
  126. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/drift-cli.test.mjs +178 -0
  127. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/drift.test.mjs +76 -0
  128. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/git-diff.test.mjs +62 -0
  129. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +9 -0
  130. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/record-cli.test.mjs +136 -0
  131. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rerun-safety.test.mjs +53 -0
  132. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rewriting.test.mjs +80 -0
  133. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/state.test.mjs +123 -0
  134. package/plugins/solution-architect/skills/estimate/README.md +20 -15
  135. package/plugins/solution-architect/skills/estimate/SKILL.md +10 -6
  136. package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +111 -138
  137. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +361 -247
  138. package/plugins/solution-architect/skills/estimate/assets/scores-review-template.html +5 -4
  139. package/plugins/solution-architect/skills/estimate/evals/evals.json +7 -7
  140. package/plugins/solution-architect/skills/estimate/references/agentic-estimation.md +4 -2
  141. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +38 -82
  142. package/plugins/solution-architect/skills/estimate/references/interview.md +56 -35
  143. package/plugins/solution-architect/skills/estimate/references/scoring-guide.md +40 -4
  144. package/plugins/solution-architect/skills/estimate/references/techniques.md +29 -21
  145. package/plugins/solution-architect/skills/estimate/references/writing.md +75 -43
  146. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +37 -5
  147. package/plugins/solution-architect/skills/estimate/scripts/lib/context-schema.mjs +35 -0
  148. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +17 -75
  149. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +5 -5
  150. package/plugins/solution-architect/skills/estimate/scripts/lib/pricing.mjs +78 -0
  151. package/plugins/solution-architect/skills/estimate/scripts/lib/project-price.mjs +96 -0
  152. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +67 -19
  153. package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +4 -5
  154. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +48 -73
  155. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +28 -13
  156. package/plugins/solution-architect/skills/estimate/scripts/lib/score-csv.mjs +2 -2
  157. package/plugins/solution-architect/skills/estimate/scripts/lib/score-html.mjs +1 -1
  158. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring.mjs +2 -2
  159. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +1 -1
  160. package/plugins/solution-architect/skills/estimate/scripts/score-review.mjs +1 -1
  161. package/plugins/solution-architect/skills/estimate/scripts/test/browser-agentic.test.mjs +143 -0
  162. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +209 -50
  163. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +57 -32
  164. package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +52 -0
  165. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +25 -112
  166. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-fail.md +0 -10
  167. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-pass.md +0 -10
  168. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +1 -7
  169. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +11 -10
  170. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +6 -0
  171. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +17 -21
  172. package/plugins/solution-architect/skills/estimate/scripts/test/pricing.test.mjs +88 -0
  173. package/plugins/solution-architect/skills/estimate/scripts/test/project-price.test.mjs +93 -0
  174. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +86 -24
  175. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +185 -31
  176. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +114 -61
  177. package/plugins/solution-architect/skills/estimate/scripts/test/score-review.test.mjs +34 -1
  178. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +103 -9
  179. package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +292 -71
  180. package/plugins/solution-architect/skills/new-lead/SKILL.md +4 -3
  181. package/plugins/solution-architect/skills/proposal/README.md +9 -7
  182. package/plugins/solution-architect/skills/proposal/SKILL.md +10 -7
  183. package/plugins/solution-architect/skills/proposal/evals/evals.json +29 -11
  184. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/ARCHITECTURE.md +65 -0
  185. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/brief.md +21 -0
  186. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation-inputs.json +126 -0
  187. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation.json +215 -0
  188. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation-inputs.json +224 -34
  189. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.json +103 -114
  190. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.md +48 -22
  191. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation-inputs.json +211 -33
  192. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.json +102 -117
  193. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.md +48 -25
  194. package/plugins/solution-architect/skills/proposal/references/interview.md +3 -6
  195. package/plugins/solution-architect/skills/proposal/references/review.md +5 -4
  196. package/plugins/solution-architect/skills/proposal/references/writing.md +33 -31
  197. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +1 -1
  198. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +5 -22
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +18 -8
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +6 -2
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +24 -33
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +1 -1
  203. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +50 -47
  204. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +99 -40
  205. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +11 -5
  206. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +1 -1
  207. package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +39 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +67 -54
  209. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +6 -1
  210. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +8 -12
  211. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +1 -1
  212. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +3 -2
  213. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/names-owning-skill.md +0 -9
  214. package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/states-systemic-design-unavailable.md +0 -15
  215. package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +0 -39
@@ -11,23 +11,35 @@ import { openPage } from '../../../analyze-requirements/scripts/lib/cdp.mjs';
11
11
  const skip = { skip: !findChrome() && 'no chrome on PATH' };
12
12
  const fixture = new URL('./fixtures/booking-inputs.json', import.meta.url).pathname;
13
13
 
14
+ // The deliverable gate cross-checks the document's presented range against the
15
+ // computed one, so a fixture variant that prices differently needs the range
16
+ // it actually priced. The booking fixture's own numbers are unchanged.
17
+ function pricedMd(jsonPath) {
18
+ const md = readFileSync(new URL('./fixtures/estimation-pass.md', import.meta.url), 'utf8');
19
+ const { presentLow, presentHigh } = JSON.parse(readFileSync(jsonPath, 'utf8')).computed.price;
20
+ return md.replace(/\| Presented range \|[^|]*\|/,
21
+ `| Presented range | $${presentLow.toLocaleString('en-US')} – $${presentHigh.toLocaleString('en-US')} |`);
22
+ }
23
+
14
24
  function buildPage(extra = [], inputsPath = fixture) {
15
25
  const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-'));
16
26
  const scripts = new URL('..', import.meta.url).pathname;
17
- const passMd = join(scripts, 'test/fixtures/estimation-pass.md');
18
- execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', inputsPath, '--out', join(dir, 'estimation.json')]);
19
- execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', passMd, '--out', dir, ...extra]);
27
+ const json = join(dir, 'estimation.json');
28
+ const md = join(dir, 'estimation.md');
29
+ execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', inputsPath, '--out', json]);
30
+ writeFileSync(md, pricedMd(json));
31
+ execFileSync('node', [join(scripts, 'render.mjs'), '--json', json, '--md', md, '--out', dir, ...extra]);
20
32
  return pathToFileURL(join(dir, 'estimate.html')).href;
21
33
  }
22
34
 
23
35
  // The booking inputs with a mutation applied, for pages whose shape depends
24
- // on the scenarios.
25
- function buildPageWith(mutate) {
36
+ // on an input the fixture does not carry (an extra feature, a written reason).
37
+ function buildPageWith(mutate, extra = []) {
26
38
  const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-inputs-'));
27
39
  const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
28
40
  mutate(inputs);
29
41
  writeFileSync(join(dir, 'inputs.json'), JSON.stringify(inputs));
30
- return buildPage([], join(dir, 'inputs.json'));
42
+ return buildPage(extra, join(dir, 'inputs.json'));
31
43
  }
32
44
 
33
45
 
@@ -41,6 +53,8 @@ test('every section explains itself: help icons plus a rendered method section',
41
53
  assert.match(method, /three-point-pert/); // technique named from inputs
42
54
  assert.match(method, /PERT/);
43
55
  assert.match(method, /atomicobject\.com/);
56
+ // a field removed from schema.mjs or computed still must not print undefined/NaN
57
+ assert.doesNotMatch(method, /undefined|NaN/);
44
58
  // open by default: the method explains the page up front; still collapsible
45
59
  assert.equal(await page.eval(`document.querySelector('#method details.method-fold').open`), true);
46
60
  await page.eval(`document.querySelector('#method details.method-fold summary').click()`);
@@ -53,7 +67,7 @@ test('client view hides internals; theme toggle flips the root attribute', skip,
53
67
  try {
54
68
  await page.eval(`document.getElementById('view-toggle').click()`);
55
69
  assert.equal(await page.eval(
56
- `getComputedStyle(document.querySelector('#summary .alts')).display`), 'none');
70
+ `getComputedStyle(document.querySelector('#summary .working')).display`), 'none');
57
71
  await page.eval(`document.getElementById('theme-toggle').click()`);
58
72
  assert.equal(await page.eval(`document.documentElement.dataset.theme`), 'light');
59
73
  } finally { page.close(); }
@@ -71,6 +85,26 @@ test('the --client-only page boots clean without its stripped controls', skip, a
71
85
  } finally { page.close(); }
72
86
  });
73
87
 
88
+ // render.test.mjs's byte check of a can't-fail assertion asked, in spirit,
89
+ // "does the client page contain no internal-only nodes?" — a DOM question.
90
+ // It is not "zero [data-internal] nodes exist": several are unconditional,
91
+ // always-rendered UI chrome (the empty price-working container, the xlsx
92
+ // download button, the expand-all control, a feature's expand button) that
93
+ // exist in every render, client-only included, and rely entirely on the
94
+ // `.view-client [data-internal] { display:none }` rule — not on being absent
95
+ // — for the toggle-preview mechanism this template already uses everywhere.
96
+ // A `=== null` assertion here would fail on that legitimate chrome, not on a
97
+ // leak. The honest, breakable question is: is every one of them invisible?
98
+ test('every internal-marked node on the client-only page is hidden, not just absent from data', skip, async () => {
99
+ const page = await openPage(buildPage(['--client-only']));
100
+ try {
101
+ const visible = await page.eval(`[...document.querySelectorAll('[data-internal]')]
102
+ .filter((el) => getComputedStyle(el).display !== 'none')
103
+ .map((el) => el.tagName + (el.id ? '#' + el.id : '') + (el.className ? '.' + el.className : ''))`);
104
+ assert.deepEqual(visible, []);
105
+ } finally { page.close(); }
106
+ });
107
+
74
108
  test('feature breakdown absorbs the effort chart and the task register', skip, async () => {
75
109
  const page = await openPage(buildPage());
76
110
  try {
@@ -262,10 +296,7 @@ test('roadmap bands segment by container; clicking a row drives the breakdown',
262
296
  // rows by container, so the stripe colors cluster the way the band's segments
263
297
  // do — the roadmap colors and the breakdown colors tell the same story.
264
298
  test('a roadmap click groups the breakdown rows by container', skip, async () => {
265
- const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-'));
266
- const scripts = new URL('..', import.meta.url).pathname;
267
- const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
268
- inputs.features.push({
299
+ const url = buildPageWith((inputs) => inputs.features.push({
269
300
  id: 'audit', name: 'Booking audit log', provenance: 'proposed',
270
301
  component: 'api', milestone: 'M2 - Notifications',
271
302
  scores: {
@@ -279,11 +310,8 @@ test('a roadmap click groups the breakdown rows by container', skip, async () =>
279
310
  scoreProvenance: 'proposed',
280
311
  tasks: [{ id: 'audit-log', name: 'Audit log writes', category: 'boilerplate',
281
312
  o: 4, m: 6, p: 10, confidence: 'MED', assumptions: [], provenance: 'proposed' }],
282
- });
283
- writeFileSync(join(dir, 'inputs.json'), JSON.stringify(inputs));
284
- execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', join(dir, 'inputs.json'), '--out', join(dir, 'estimation.json')]);
285
- execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', join(scripts, 'test/fixtures/estimation-pass.md'), '--out', dir]);
286
- const page = await openPage(pathToFileURL(join(dir, 'estimate.html')).href);
313
+ }));
314
+ const page = await openPage(url);
287
315
  try {
288
316
  const ids = () => page.eval(
289
317
  `[...document.querySelectorAll('#panel-estimate tr.feat-row')].map((r) => r.dataset.id)`);
@@ -415,11 +443,18 @@ const headTexts = stripArrow(BD_HEAD);
415
443
  const scoreHeadTexts = stripArrow(SCORE_HEAD);
416
444
  const clickTab = (tab) => `document.querySelector('#feature-table [role="tab"][data-tab="${tab}"]').click()`;
417
445
 
418
- test('the scoring tab carries the five factors, Σ and tier; values verbatim from inputs', skip, async () => {
446
+ // The total is a weighted score, not a sum — (3,3,4,2,4) weighs 15.5, not
447
+ // 16 — and the tier cut-offs are the v2 band edges, where an edge prices
448
+ // into the upper band.
449
+ test('the scoring tab carries the five factors, the weighted score and tier; values verbatim from inputs', skip, async () => {
419
450
  const page = await openPage(buildPage());
420
451
  try {
421
452
  assert.deepEqual(await page.eval(scoreHeadTexts),
422
- ['Feature', 'Tech', 'Size', 'Deps', 'Unc', 'Risk', 'Σ', 'Tier']);
453
+ ['Feature', 'Tech', 'Size', 'Deps', 'Unc', 'Risk', 'Score', 'Tier']);
454
+ const hints = await page.eval(`[...document.querySelectorAll('#panel-scoring > .bd-scroll th button')].map((b) => b.title)`);
455
+ assert.match(hints[6], /weighted/i);
456
+ assert.doesNotMatch(hints[6], /sum of the five/);
457
+ assert.equal(hints[7], 'S < 11.5 / M < 17.5 / L < 22.5 / XL from 22.5');
423
458
  const booking = await page.eval(cellTexts('#panel-scoring tr[data-id="booking"] td.score'));
424
459
  assert.deepEqual(booking.slice(0, 5), ['3', '3', '2', '3', '3']);
425
460
  assert.equal(booking[5], '14');
@@ -443,15 +478,19 @@ test('score cells explain themselves: anchor + cite on hover, note under the nam
443
478
  } finally { page.close(); }
444
479
  });
445
480
 
446
- test('⚠ marks a feature whose PERT hours fall outside its tier band', skip, async () => {
481
+ // The hours calibration bands no longer bound anything: a tier is 70% risk,
482
+ // uncertainty and dependencies and only 10% size, so a small-but-hairy feature
483
+ // is legitimately XL on hours nobody would call XL. The cross-check that
484
+ // compared the two fired on exactly that shape, so it is gone — inputs.calibration
485
+ // stays as QUICK depth's PERT seed and nothing on the page reads it.
486
+ test('the effort cell carries no tier-band cross-check', skip, async () => {
447
487
  const page = await openPage(buildPageWith((inputs) => {
448
- // reminders is S (20–60 h); push its only task to ~120 h
488
+ // reminders scores S; push its only task far past the S hour band
449
489
  inputs.features[1].tasks[0] = { ...inputs.features[1].tasks[0], o: 90, m: 120, p: 160 };
450
490
  }));
451
491
  try {
452
- const warn = await page.eval(`document.querySelector('#panel-estimate tr[data-id="reminders"] .oob')?.title ?? ''`);
453
- assert.match(warn, /outside S band 20–60 h/);
454
- assert.equal(await page.eval(`!!document.querySelector('#panel-estimate tr[data-id="booking"] .oob')`), false);
492
+ assert.equal(await page.eval(`document.querySelectorAll('#panel-estimate .oob').length`), 0);
493
+ assert.equal(await page.eval(`document.querySelector('#panel-estimate tr[data-id="reminders"] .bd-num').textContent`), '121.67');
455
494
  assert.deepEqual(page.errors, []);
456
495
  } finally { page.close(); }
457
496
  });
@@ -543,7 +582,7 @@ test('each tab shows only its own columns', skip, async () => {
543
582
  try {
544
583
  assert.deepEqual(await page.eval(headTexts), ['Feature', 'Effort (h)', 'Confidence', 'Source']);
545
584
  assert.deepEqual(await page.eval(scoreHeadTexts),
546
- ['Feature', 'Tech', 'Size', 'Deps', 'Unc', 'Risk', 'Σ', 'Tier']);
585
+ ['Feature', 'Tech', 'Size', 'Deps', 'Unc', 'Risk', 'Score', 'Tier']);
547
586
  await page.eval(clickTab('scoring'));
548
587
  assert.equal(await page.eval(`document.getElementById('panel-scoring').hidden`), false);
549
588
  assert.equal(await page.eval(`document.getElementById('panel-estimate').hidden`), true);
@@ -732,48 +771,168 @@ test('printing shows both tables, named', skip, async () => {
732
771
  } finally { page.close(); }
733
772
  });
734
773
 
735
- // The Summary is the one place team, months and cost appear. The booking
736
- // fixture recommends the AI-assisted senior+mid pair; the unaided trio is a
737
- // different roster, so it is an alternative row, not a collapsed line.
738
- test('the summary states the recommended scenario once and lists team alternatives', skip, async () => {
774
+ // The Summary is the one place the price appears, and it is the presented
775
+ // range — the booking fixture's p50 and p95 rounded to $10,000 and $14,000,
776
+ // with $12,000 as the single number to give when one is demanded.
777
+ test('the summary states the presented range and the single number', skip, async () => {
739
778
  const page = await openPage(buildPage());
740
779
  try {
741
- const lead = await page.eval(`document.querySelector('#summary .lead').textContent`);
742
- assert.equal(lead, '2 engineers (senior · mid), AI-assisted');
780
+ assert.equal(await page.eval(`document.querySelector('#summary .lead').textContent`), 'Presented range');
743
781
  const figures = await page.eval(`document.querySelector('#summary .figures').textContent`);
744
- assert.match(figures, /0\.40 months/);
745
- assert.match(figures, /\$5,993/);
746
- const alts = await page.eval(`[...document.querySelectorAll('#summary .alts tbody tr td:first-child')].map((c) => c.textContent)`);
747
- assert.deepEqual(alts, ['3 engineers (mid · mid · junior), humans unaided']);
748
- assert.equal(await page.eval(`document.querySelector('#summary .insight')`), null); // slower and pricier: no insight
782
+ assert.equal(figures, '$10,000–$14,000');
783
+ const meta = await page.eval(cellTexts('#summary p.meta'));
784
+ assert.equal(meta[0], 'single number, if one is required: $12,000');
785
+ assert.equal(meta[1], 'contingency 15% · implied accuracy 24%');
786
+ assert.ok(meta.some((m) => m.startsWith('91 h to plan')), `no planning hours line: ${meta}`);
787
+ // nothing on this page is a duration, in any section
788
+ assert.doesNotMatch(await page.eval(`document.body.textContent`), /month/i);
789
+ // a field removed from computed.price or refused by schema.mjs still must
790
+ // not print undefined/NaN (riskBufferHours and overheadPct both did once)
791
+ assert.doesNotMatch(await page.eval(`document.getElementById('summary').textContent`), /undefined|NaN/);
792
+ assert.deepEqual(page.errors, []);
793
+ } finally { page.close(); }
794
+ });
795
+
796
+ // The working behind the number — the multiplier, the overhead lines, the
797
+ // tier each feature's score bought — is internal-only. --client-only strips
798
+ // the whole block; the internal page shows it under the range.
799
+ test('the price working sits under the summary, internal-only', skip, async () => {
800
+ const page = await openPage(buildPage());
801
+ try {
802
+ const captions = await page.eval(cellTexts('#summary .working caption'));
803
+ assert.deepEqual(captions, ['Price build-up', 'Tier Reference']);
804
+ const rows = await page.eval(cellTexts('#summary .working tbody tr td:first-child'));
805
+ assert.deepEqual(rows.slice(0, 5),
806
+ ['Feature prices', 'Context multiplier', 'Adjusted base', 'Overheads', 'Contingency']);
807
+ assert.match(await page.eval(`document.querySelector('#summary .working').textContent`), /×1\.4/);
749
808
  assert.deepEqual(page.errors, []);
750
809
  } finally { page.close(); }
751
810
  });
752
811
 
753
- // Same roster, AI on vs off: not a staffing choice, so it collapses to one
754
- // line under the recommendation instead of an alternatives table.
755
- test('a same-team AI-only variant collapses to one line, not a table', skip, async () => {
812
+ test('the client-only page shows the range and no working at all', skip, async () => {
813
+ const page = await openPage(buildPage(['--client-only']));
814
+ try {
815
+ assert.equal(await page.eval(`document.querySelector('#summary .figures').textContent`), '$10,000–$14,000');
816
+ assert.equal(await page.eval(`document.querySelector('#summary .working').children.length`), 0);
817
+ assert.equal(await page.eval(`document.querySelectorAll('#panel-scoring .tier').length`), 0);
818
+ assert.deepEqual(page.errors, []);
819
+ } finally { page.close(); }
820
+ });
821
+
822
+ // R61 / spec 3 + 12: no project hours total beside the price for a client.
823
+ // Feature hours still ship (R49); only the Summary headline goes. Read from
824
+ // the DOM text, not innerText, so a node merely hidden by CSS still fails.
825
+ test('the client summary carries no project hours total', skip, async () => {
826
+ const client = await openPage(buildPage(['--client-only']));
827
+ try {
828
+ const text = await client.eval(`document.getElementById('summary').textContent`);
829
+ assert.doesNotMatch(text, /h to plan/, 'client-only summary shows a project hours total');
830
+ assert.match(text, /2 features/, 'the rest of the size line stays');
831
+ assert.deepEqual(client.errors, []);
832
+ } finally { client.close(); }
833
+ const internal = await openPage(buildPage());
834
+ try {
835
+ await internal.eval(`document.getElementById('view-toggle').click()`);
836
+ const shown = await internal.eval(`document.getElementById('summary').innerText`);
837
+ assert.doesNotMatch(shown, /h to plan/, 'the client-view preview shows a project hours total');
838
+ } finally { internal.close(); }
839
+ });
840
+
841
+ // What a reader actually sees: a clone of <body> with <script>/<style> torn
842
+ // out, then its textContent. Not `document.body.textContent` (which walks
843
+ // the JS source and embedded JSON, so it flags a `$0`/`month` sitting only
844
+ // in a code comment — a false positive, not the leak this check is for).
845
+ // Not `innerText` either — that also drops nodes the client-view toggle
846
+ // hides via `display:none` without removing from the DOM ([data-internal]),
847
+ // which is exactly where a leaked `$0` would hide.
848
+ function readerText(page) {
849
+ return page.eval(`(() => {
850
+ const clone = document.body.cloneNode(true);
851
+ clone.querySelectorAll('script,style').forEach((n) => n.remove());
852
+ return clone.textContent;
853
+ })()`);
854
+ }
855
+
856
+ // R50: a QUICK-depth estimate scores no feature and hits the same all-zero
857
+ // price an agentic estimate does (estimate-template-agentic.html) — the
858
+ // summary must say plainly that this scope is not priced, never present the
859
+ // bare $0 that computed.price.presentLow/presentHigh/singleNumber all are,
860
+ // and the internal price build-up must carry no zeroed rows either. Checked
861
+ // on both renders the brief asked for: the internal page and --client-only.
862
+ const quickUnscored = (inputs) => {
863
+ inputs.depth = 'QUICK';
864
+ for (const f of inputs.features) {
865
+ delete f.scores; delete f.scoreNote; delete f.scoreProvenance;
866
+ f.tasks = [{ ...f.tasks[0], id: `${f.id}-band`, o: 60, m: 110, p: 160 }];
867
+ }
868
+ };
869
+
870
+ async function assertQuickUnpriced(page) {
871
+ assert.deepEqual(page.errors, []);
872
+ assert.equal(await page.eval(`document.querySelector('#summary .lead').textContent`), 'Not priced');
873
+ assert.match(await page.eval(`document.querySelector('#summary .figures').textContent`), /^\d+(\.\d+)? h$/);
874
+ assert.equal(await page.eval(`document.querySelector('#summary .working').children.length`), 0);
875
+ const body = await readerText(page);
876
+ assert.doesNotMatch(body, /\$0\b/);
877
+ assert.doesNotMatch(body, /month/i);
878
+ }
879
+
880
+ test('a QUICK-depth estimate states it is not priced instead of presenting $0', skip, async () => {
881
+ const page = await openPage(buildPageWith(quickUnscored));
882
+ try { await assertQuickUnpriced(page); } finally { page.close(); }
883
+ });
884
+
885
+ test('a QUICK-depth --client-only render states the same unpriced state', skip, async () => {
886
+ const page = await openPage(buildPageWith(quickUnscored, ['--client-only']));
887
+ try { await assertQuickUnpriced(page); } finally { page.close(); }
888
+ });
889
+
890
+ // The roadmap draws computed.roadmap's shares: M1 is 76% of the booking
891
+ // fixture's effort and M2 the remaining 24%, and neither is a duration.
892
+ test('the roadmap bars are labelled with their share of effort', skip, async () => {
893
+ const page = await openPage(buildPage());
894
+ try {
895
+ assert.deepEqual(await page.eval(cellTexts('#roadmap .roadmap-share')), ['76%', '24%']);
896
+ const widths = await page.eval(
897
+ `[...document.querySelectorAll('#roadmap .roadmap-band')].map((b) => b.style.width)`);
898
+ assert.deepEqual(widths, ['76%', '24%']);
899
+ assert.equal(await page.eval(`document.querySelector('#roadmap .roadmap-axis-unit').textContent`), '% of effort');
900
+ assert.deepEqual(page.errors, []);
901
+ } finally { page.close(); }
902
+ });
903
+
904
+ // Free text about the approach taken, when the writer left any. It explains a
905
+ // judgment call — delivery mode, technique — not a choice between prices. It
906
+ // is internal shorthand under the writing contract (references/writing.md),
907
+ // same as a score's cite, so it is marked data-internal like the price
908
+ // working above it (R45) — only the "Approach:" label is new.
909
+ test('a written approach note renders under the summary figures', skip, async () => {
756
910
  const page = await openPage(buildPageWith((inputs) => {
757
- const rec = inputs.scenarios.find((s) => s.id === inputs.recommendedScenario);
758
- const other = inputs.scenarios.find((s) => s.id !== rec.id);
759
- other.team = rec.team.map((m) => ({ ...m }));
911
+ inputs.recommendedReason = 'the client has one senior available';
760
912
  }));
761
913
  try {
762
- assert.equal(await page.eval(`document.querySelector('#summary .alts table')`), null);
763
- const line = await page.eval(`document.querySelector('#summary .alts .meta').textContent`);
764
- assert.match(line, /^Without AI assistance: 0\.\d\d months · \$[\d,]+ \(\+0\.\d\d mo · \+\$[\d,]+\)$/);
914
+ assert.equal(await page.eval(`document.querySelector('#summary .why').textContent`),
915
+ 'Approach: the client has one senior available.');
916
+ assert.ok(await page.eval(`document.querySelector('#summary .why')?.closest('[data-internal]')`),
917
+ 'the approach note must be marked internal-only');
765
918
  assert.deepEqual(page.errors, []);
766
919
  } finally { page.close(); }
767
920
  });
768
921
 
769
- // One scenario is the default interview answer: no alternatives block at all.
770
- test('a single-scenario estimate shows the summary with no alternatives block', skip, async () => {
922
+ // R45: the note is free text an internal agent writes under a contract that
923
+ // never warns it reaches the client — the same reasoning that blanks a
924
+ // score's cite unconditionally. A client-only render must not show it.
925
+ // R48: redact.mjs blanks recommendedReason itself (not just the DOM node),
926
+ // so a client-only page never has the data to render the note from — the
927
+ // element is absent, not merely CSS-hidden. The byte-level guarantee (the
928
+ // phrase is nowhere in the exported file) lives in render.test.mjs, since
929
+ // that is what a client-only render actually promises.
930
+ test('the client-only page does not show the written approach note', skip, async () => {
771
931
  const page = await openPage(buildPageWith((inputs) => {
772
- inputs.scenarios = inputs.scenarios.filter((s) => s.id === inputs.recommendedScenario);
773
- }));
932
+ inputs.recommendedReason = 'we quoted low to beat the incumbent bid';
933
+ }, ['--client-only']));
774
934
  try {
775
- assert.equal(await page.eval(`document.querySelector('#summary .alts')`), null);
776
- assert.equal(await page.eval(`document.querySelector('#summary .lead').textContent`), '2 engineers (senior · mid), AI-assisted');
935
+ assert.equal(await page.eval(`document.querySelector('#summary .why')`), null);
777
936
  assert.deepEqual(page.errors, []);
778
937
  } finally { page.close(); }
779
938
  });
@@ -16,23 +16,22 @@ test('golden numbers for the booking fixture', () => {
16
16
  assert.equal(computed.tasks['booking-api'].e, 25.33);
17
17
  assert.equal(computed.tasks['booking-rules'].e, 44);
18
18
  assert.equal(computed.tasks['reminder-jobs'].e, 21.33);
19
- assert.equal(computed.devHours, 90.67); // round2(152/6 + 44 + 128/6)
20
- assert.equal(computed.overheadHours, 31.73); // round2(90.6667 × 0.35)
21
- assert.equal(computed.spreadBufferHours, 10.91); // round2(√(4² + 9.3333² + 4²))
22
- assert.equal(computed.riskBufferHours, 12); // 0.3 × 40
23
19
  assert.equal(computed.projectConfidence, 'MED'); // critical path = booking, worst row MED
24
- const rec = computed.scenarios['2eng-max5x'];
25
- assert.ok(rec.months > 0 && rec.totalCost > 0);
26
- assert.equal(rec.totalCost, rec.laborCost + rec.toolingCost);
27
- assert.equal('planCost' in rec, false);
28
- // Same team math as before the plan→aiAssisted rename: hours and seat cost pinned
29
- assert.equal(computed.scenarios['3eng-noai'].hours, 145.31);
30
- assert.equal(rec.hours, 101.35);
31
- assert.equal(rec.toolingCost, 80.44); // 0.4022 mo × $100 × 2 seats
32
- // AI hours strictly below traditional on every task in an AI scenario
33
- for (const id of Object.keys(computed.tasks)) {
34
- assert.ok(rec.taskHours[id] < computed.tasks[id].e);
35
- }
20
+ const { price } = computed;
21
+ // booking: weighted score 14 (M, point 2541.67) · reminders: score 11 (S, point 1423.08)
22
+ assert.equal(price.featurePoints, 3964.74);
23
+ assert.equal(price.contextMultiplier, 1.4); // 1 + (.1 + 0 + .2 + 0 + .1) context deviations
24
+ assert.equal(price.adjustedBase, 5550.64);
25
+ assert.equal(price.contingencyRate, 0.15); // 0.05 + 2.5×0.02 + 2.5×0.02 avg unc/risk
26
+ assert.equal(price.p50, 9957.85);
27
+ assert.equal(price.presentLow, 10000);
28
+ assert.equal(price.presentHigh, 14000);
29
+ });
30
+
31
+ test('price.overheads.amount is rounded before it reaches estimation.json', () => {
32
+ const { computed } = computeEstimation(fixture());
33
+ // adjustedBase 5550.64 × totalPct 0.56 = 3108.3589743589755 unrounded
34
+ assert.equal(computed.price.overheads.amount, 3108.36);
36
35
  });
37
36
 
38
37
  test('CLI writes byte-identical output on repeat runs', () => {
@@ -55,18 +54,16 @@ test('CLI refuses invalid inputs, naming findings', () => {
55
54
  );
56
55
  });
57
56
 
58
- test('scenarios carry a roadmap when features have milestones', () => {
57
+ test('the roadmap is top level when features have milestones', () => {
59
58
  const { computed } = computeEstimation(fixture());
60
- const roadmap = computed.scenarios['2eng-max5x'].roadmap;
59
+ const { roadmap } = computed;
61
60
  assert.deepEqual(roadmap.map((b) => b.milestone), ['M1 - Booking core', 'M2 - Notifications']);
62
61
  assert.deepEqual(roadmap[0].features, ['booking']);
63
62
  assert.deepEqual(roadmap[1].features, ['reminders']);
64
- assert.equal(roadmap[0].startMonths, 0);
65
- assert.equal(roadmap[1].startMonths, roadmap[0].endMonths); // bands tile, no gap
66
- assert.equal(roadmap[1].endMonths, computed.scenarios['2eng-max5x'].months);
67
- // AI-adjusted shares: booking (M1) carries most of the hours
68
- assert.ok(roadmap[0].endMonths - roadmap[0].startMonths
69
- > roadmap[1].endMonths - roadmap[1].startMonths);
63
+ // booking (M1) carries most of the task hours
64
+ assert.ok(roadmap[0].share > roadmap[1].share);
65
+ assert.equal(roadmap[0].share, 0.76);
66
+ assert.equal(roadmap[1].share, 0.24);
70
67
  });
71
68
 
72
69
  test('computed.components rolls feature hours into top-level containers', () => {
@@ -87,9 +84,7 @@ test('no milestones → no roadmap key at all', () => {
87
84
  const bare = fixture();
88
85
  for (const f of bare.features) delete f.milestone;
89
86
  const { computed } = computeEstimation(bare);
90
- for (const s of Object.values(computed.scenarios)) {
91
- assert.ok(!('roadmap' in s), 'roadmap key must be absent, not empty');
92
- }
87
+ assert.ok(!('roadmap' in computed), 'roadmap key must be absent, not empty');
93
88
  });
94
89
 
95
90
  // Agentic-mode rollup.
@@ -104,7 +99,7 @@ function agenticInputs() {
104
99
  }
105
100
  const measurements = () => loadMeasurements(measurementsFixture).records;
106
101
 
107
- test('agentic tasks are baseline-driven and scenario-independent', () => {
102
+ test('agentic tasks are baseline-driven', () => {
108
103
  const { computed } = computeEstimation(agenticInputs(), measurements());
109
104
  const swap = computed.tasks['swap-refactor'];
110
105
  assert.equal(swap.samples, 7);
@@ -116,13 +111,10 @@ test('agentic tasks are baseline-driven and scenario-independent', () => {
116
111
  const db = computed.tasks['swap-db'];
117
112
  assert.equal(db.confidence, 'UNCALIBRATED');
118
113
  assert.equal(db.calibrated, false);
119
- // measured durations do not vary by team or plan
120
- assert.deepEqual(computed.scenarios.solo.taskHours, computed.scenarios.pair.taskHours);
121
114
  });
122
115
 
123
- test('agentic risks convert minutes to hours; uncalibrated task taints project confidence', () => {
116
+ test('uncalibrated task taints project confidence', () => {
124
117
  const { computed } = computeEstimation(agenticInputs(), measurements());
125
- assert.equal(computed.riskBufferHours, Math.round((0.3 * 30 / 60) * 100) / 100);
126
118
  assert.equal(computed.projectConfidence, 'UNCALIBRATED'); // swap-db sits on the largest feature
127
119
  });
128
120
 
@@ -154,3 +146,36 @@ test('QUICK inputs get no score fields in computed features', () => {
154
146
  assert.equal('tier' in computed.features.booking, false);
155
147
  assert.equal('scoreTotal' in computed.features.booking, false);
156
148
  });
149
+
150
+ test('computed carries a price block and no scenarios', () => {
151
+ const { computed } = computeEstimation(fixture());
152
+ assert.equal(computed.scenarios, undefined);
153
+ assert.equal(computed.devHours, undefined);
154
+ assert.ok(computed.price.p50 > 0);
155
+ assert.ok(computed.price.presentHigh >= computed.price.presentLow);
156
+ assert.equal(computed.price.presentLow % 500, 0);
157
+ });
158
+
159
+ test('every scored feature carries its price and flag', () => {
160
+ const { computed } = computeEstimation(fixture());
161
+ for (const f of Object.values(computed.features)) {
162
+ assert.ok(Number.isFinite(f.point), 'point');
163
+ assert.ok(Number.isFinite(f.spread), 'spread');
164
+ assert.equal(typeof f.flag, 'string');
165
+ assert.ok(f.priceLow <= f.point && f.point <= f.priceHigh);
166
+ }
167
+ });
168
+
169
+ test('the roadmap is top level and its shares sum to 1', () => {
170
+ const { computed } = computeEstimation(fixture());
171
+ const total = computed.roadmap.reduce((sum, b) => sum + b.share, 0);
172
+ assert.ok(Math.abs(total - 1) < 1e-9, `shares sum to ${total}`);
173
+ assert.equal(computed.roadmap[0].startMonths, undefined);
174
+ });
175
+
176
+ test('repeat runs are byte-identical', () => {
177
+ assert.equal(
178
+ JSON.stringify(computeEstimation(fixture())),
179
+ JSON.stringify(computeEstimation(fixture())),
180
+ );
181
+ });
@@ -4,12 +4,17 @@ import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
4
4
  import { execFileSync } from 'node:child_process';
5
5
  import { tmpdir } from 'node:os';
6
6
  import { join } from 'node:path';
7
+ import { pathToFileURL } from 'node:url';
7
8
  import { createServer } from '../../../analyze-requirements/scripts/serve.mjs';
8
9
  import { findFreePort } from '../../../analyze-requirements/scripts/lib/port.mjs';
10
+ import { computeEstimation } from '../lib/rollup.mjs';
11
+ import { findChrome } from '../../../analyze-requirements/scripts/lib/chrome.mjs';
12
+ import { openPage } from '../../../analyze-requirements/scripts/lib/cdp.mjs';
9
13
 
10
14
  const scripts = new URL('..', import.meta.url).pathname;
11
15
  const fixture = join(scripts, 'test/fixtures/booking-inputs.json');
12
16
  const passMd = join(scripts, 'test/fixtures/estimation-pass.md');
17
+ const skip = { skip: !findChrome() && 'no chrome on PATH' };
13
18
 
14
19
  test('SKILL.md exists with hard rules and auto-trigger description', () => {
15
20
  const skill = readFileSync(new URL('../../SKILL.md', import.meta.url), 'utf8');
@@ -59,3 +64,50 @@ test('agentic fixture flows compute → validate → render, and a vague range i
59
64
  writeFileSync(vagueMdPath, vagueMd);
60
65
  assert.throws(() => execFileSync('node', [join(scripts, 'validate.mjs'), '--md', vagueMdPath, '--json', json]));
61
66
  });
67
+
68
+ // The workbook export (assets/estimate-template.html's __buildWorkbook) is
69
+ // deliberately left out of this check: it only runs inside a real page (it
70
+ // reads live DOM/table state), and the price cells it writes are formulas
71
+ // with their cached values stripped (dropCachedValues + recalcOnLoad) so
72
+ // Excel recomputes on open — there is no computed presentLow/presentHigh to
73
+ // read back from the raw xlsx bytes in Node.
74
+
75
+ // Browser-independent: must run (not skip) with no Chrome on PATH, so a
76
+ // price-parity regression never comes back as a silent "skipped".
77
+ test('the estimate and the proposal figures quote the same range', async () => {
78
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
79
+ const estimation = computeEstimation(inputs);
80
+ const { presentLow, presentHigh } = estimation.computed.price;
81
+ const { deriveFigures } = await import('../../../proposal/scripts/lib/figures.mjs');
82
+ const figures = deriveFigures(estimation);
83
+ assert.equal(figures.cost.low, presentLow);
84
+ assert.equal(figures.cost.high, presentHigh);
85
+ });
86
+
87
+ // The presented range is formatted by the page's own client-side script,
88
+ // not baked into the static file, so this needs a real browser — the one
89
+ // part of this check that Chrome-gates.
90
+ test('the rendered page shows the presented range', skip, async () => {
91
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
92
+ const estimation = computeEstimation(inputs);
93
+ const { presentLow } = estimation.computed.price;
94
+
95
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-e2e-figures-'));
96
+ const json = join(dir, 'estimation.json');
97
+ writeFileSync(json, JSON.stringify(estimation));
98
+ execFileSync('node', [join(scripts, 'render.mjs'), '--json', json, '--md', passMd, '--out', dir]);
99
+
100
+ const page = await openPage(pathToFileURL(join(dir, 'estimate.html')).href);
101
+ try {
102
+ const body = await page.eval('document.body.textContent');
103
+ assert.ok(body.includes(presentLow.toLocaleString('en-US')), 'page range');
104
+ } finally { page.close(); }
105
+ });
106
+
107
+ test('no duration survives anywhere in the pipeline', () => {
108
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
109
+ const json = JSON.stringify(computeEstimation(inputs));
110
+ for (const gone of ['months', 'laborCost', 'toolingCost', 'totalCost', 'seniority', 'rate']) {
111
+ assert.ok(!json.includes(`"${gone}"`), `${gone} still present in estimation.json`);
112
+ }
113
+ });