@v11g/agents-rock 1.0.8 → 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 (117) 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/skills/problem-router/README.md +6 -0
  19. package/plugins/reasoning/skills/problem-router/SKILL.md +4 -0
  20. package/plugins/reasoning/skills/problem-router/references/contract.md +114 -19
  21. package/plugins/reasoning/skills/problem-solving/README.md +6 -0
  22. package/plugins/reasoning/skills/problem-solving/SKILL.md +2 -0
  23. package/plugins/reasoning/skills/problem-solving/references/contract.md +114 -19
  24. package/plugins/reasoning/skills/problem-solving/references/interview.md +2 -0
  25. package/plugins/reasoning/skills/systemic-design/README.md +3 -0
  26. package/plugins/reasoning/skills/systemic-design/SKILL.md +2 -0
  27. package/plugins/reasoning/skills/systemic-design/references/contract.md +114 -19
  28. package/plugins/reasoning/skills/systemic-design/references/interview.md +2 -0
  29. package/plugins/reasoning/skills/systems-thinking/README.md +3 -0
  30. package/plugins/reasoning/skills/systems-thinking/SKILL.md +2 -0
  31. package/plugins/reasoning/skills/systems-thinking/frameworks/leverage-points.md +15 -6
  32. package/plugins/reasoning/skills/systems-thinking/references/contract.md +114 -19
  33. package/plugins/reasoning/skills/systems-thinking/references/interview.md +2 -0
  34. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  35. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +4 -1
  36. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +16 -1
  37. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +9 -0
  38. package/plugins/solution-architect/skills/estimate/README.md +20 -15
  39. package/plugins/solution-architect/skills/estimate/SKILL.md +10 -6
  40. package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +111 -138
  41. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +361 -247
  42. package/plugins/solution-architect/skills/estimate/assets/scores-review-template.html +5 -4
  43. package/plugins/solution-architect/skills/estimate/evals/evals.json +7 -7
  44. package/plugins/solution-architect/skills/estimate/references/agentic-estimation.md +4 -2
  45. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +38 -82
  46. package/plugins/solution-architect/skills/estimate/references/interview.md +56 -35
  47. package/plugins/solution-architect/skills/estimate/references/scoring-guide.md +40 -4
  48. package/plugins/solution-architect/skills/estimate/references/techniques.md +29 -21
  49. package/plugins/solution-architect/skills/estimate/references/writing.md +75 -43
  50. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +37 -5
  51. package/plugins/solution-architect/skills/estimate/scripts/lib/context-schema.mjs +35 -0
  52. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +17 -75
  53. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +5 -5
  54. package/plugins/solution-architect/skills/estimate/scripts/lib/pricing.mjs +78 -0
  55. package/plugins/solution-architect/skills/estimate/scripts/lib/project-price.mjs +96 -0
  56. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +67 -19
  57. package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +4 -5
  58. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +48 -73
  59. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +28 -13
  60. package/plugins/solution-architect/skills/estimate/scripts/lib/score-csv.mjs +2 -2
  61. package/plugins/solution-architect/skills/estimate/scripts/lib/score-html.mjs +1 -1
  62. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring.mjs +2 -2
  63. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +1 -1
  64. package/plugins/solution-architect/skills/estimate/scripts/score-review.mjs +1 -1
  65. package/plugins/solution-architect/skills/estimate/scripts/test/browser-agentic.test.mjs +143 -0
  66. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +209 -50
  67. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +57 -32
  68. package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +52 -0
  69. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +25 -112
  70. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-fail.md +0 -10
  71. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-pass.md +0 -10
  72. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +1 -7
  73. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +11 -10
  74. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +6 -0
  75. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +17 -21
  76. package/plugins/solution-architect/skills/estimate/scripts/test/pricing.test.mjs +88 -0
  77. package/plugins/solution-architect/skills/estimate/scripts/test/project-price.test.mjs +93 -0
  78. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +86 -24
  79. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +185 -31
  80. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +114 -61
  81. package/plugins/solution-architect/skills/estimate/scripts/test/score-review.test.mjs +34 -1
  82. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +103 -9
  83. package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +292 -71
  84. package/plugins/solution-architect/skills/new-lead/SKILL.md +4 -3
  85. package/plugins/solution-architect/skills/proposal/README.md +9 -7
  86. package/plugins/solution-architect/skills/proposal/SKILL.md +10 -7
  87. package/plugins/solution-architect/skills/proposal/evals/evals.json +29 -11
  88. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/ARCHITECTURE.md +65 -0
  89. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/brief.md +21 -0
  90. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation-inputs.json +126 -0
  91. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation.json +215 -0
  92. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation-inputs.json +224 -34
  93. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.json +103 -114
  94. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.md +48 -22
  95. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation-inputs.json +211 -33
  96. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.json +102 -117
  97. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.md +48 -25
  98. package/plugins/solution-architect/skills/proposal/references/interview.md +3 -6
  99. package/plugins/solution-architect/skills/proposal/references/review.md +5 -4
  100. package/plugins/solution-architect/skills/proposal/references/writing.md +33 -31
  101. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +1 -1
  102. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +5 -22
  103. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +18 -8
  104. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +6 -2
  105. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +24 -33
  106. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +1 -1
  107. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +50 -47
  108. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +99 -40
  109. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +11 -5
  110. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +1 -1
  111. package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +39 -0
  112. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +67 -54
  113. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +6 -1
  114. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +8 -12
  115. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +1 -1
  116. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +3 -2
  117. package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +0 -39
@@ -1,93 +1,152 @@
1
1
  import { test } from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
- import { sectionText, tables } from '../lib/sections.mjs';
3
+ import { sectionText, tables, SECTIONS } from '../lib/sections.mjs';
4
4
  import { checkDoc } from '../lib/checks-doc.mjs';
5
- import { parseFrontmatter } from '../../../analyze-requirements/scripts/lib/frontmatter.mjs';
6
5
 
7
- const estimation = { computed: { scenarios: { s1: { months: 2, totalCost: 10000 } } }, inputs: { scenarios: [{ id: 's1', team: [] }] } };
8
6
  const TODAY = new Date('2026-08-06');
9
7
 
10
- const FM = `---
11
- client: Acme Corp
12
- client_tech_level: non-tech
13
- scenario: s1
14
- currency: USD
15
- valid_until: 2099-12-31
16
- source_architecture: ../ARCHITECTURE.md
17
- source_estimation: ../estimation.json
18
- ---`;
19
-
20
- const SECTION_BODIES = `
8
+ function validFm() {
9
+ return {
10
+ client: 'Acme Corp',
11
+ client_tech_level: 'non-tech',
12
+ currency: 'USD',
13
+ valid_until: '2099-12-31',
14
+ source_architecture: '../ARCHITECTURE.md',
15
+ source_estimation: '../estimation.json',
16
+ };
17
+ }
18
+
19
+ function fullDoc() {
20
+ return `
21
21
  ## Executive Summary
22
- We fix scheduling.
22
+
23
+ We fix scheduling for $8,000 – $12,000.
24
+
23
25
  ## Background & Objectives
26
+
24
27
  Bookings are manual today.
28
+
25
29
  ## Proposed Solution
30
+
26
31
  \`\`\`mermaid
27
32
  graph LR; A[You] --> B[New system]
28
33
  \`\`\`
34
+
29
35
  ## Scope
36
+
30
37
  | Feature | What you get |
31
38
  | --- | --- |
32
39
  | Booking | Online appointments |
40
+
33
41
  ## Out of Scope & Assumptions
42
+
34
43
  - SMS reminders are out.
44
+
35
45
  ## Delivery Approach
46
+
36
47
  Two milestones, weekly demos.
48
+
37
49
  ## Investment & Timeline
38
- $8,000 – $12,000 over 1.6–2.4 months.
39
- ## Team
40
- One senior engineer, one mid-level engineer.
50
+
51
+ | Milestone | Investment |
52
+ | --- | --- |
53
+ | M1 | $6,000 – $9,000 |
54
+ | M2 | $2,000 – $3,000 |
55
+
41
56
  ## About Code Engine Studio
57
+
42
58
  We build software. Contact: hello@example.com
59
+
43
60
  ## Next Steps
61
+
44
62
  Valid until 2099-12-31. Reply to accept.
45
63
  `;
64
+ }
46
65
 
47
- const goodMd = `${FM}\n${SECTION_BODIES}`;
48
- const check = (md) => checkDoc({ fm: parseFrontmatter(md).data, md, estimation, today: TODAY });
66
+ const check = ({ fm = validFm(), md = fullDoc(), today = TODAY } = {}) => checkDoc({ fm, md, today });
49
67
 
50
68
  test('a complete document produces no findings', () => {
51
- assert.deepEqual(check(goodMd), []);
69
+ assert.deepEqual(check(), []);
52
70
  });
53
71
 
54
72
  test('sectionText slices one section and returns null for missing ones', () => {
55
- assert.match(sectionText(goodMd, 'Scope'), /Online appointments/);
56
- assert.doesNotMatch(sectionText(goodMd, 'Scope'), /SMS reminders/);
57
- assert.equal(sectionText(goodMd, 'Signature'), null);
73
+ const md = fullDoc();
74
+ assert.match(sectionText(md, 'Scope'), /Online appointments/);
75
+ assert.doesNotMatch(sectionText(md, 'Scope'), /SMS reminders/);
76
+ assert.equal(sectionText(md, 'Signature'), null);
58
77
  });
59
78
 
60
79
  test('tables groups pipe rows and drops the separator', () => {
61
- const [t] = tables(sectionText(goodMd, 'Scope'));
80
+ const [t] = tables(sectionText(fullDoc(), 'Scope'));
62
81
  assert.deepEqual(t.header, ['Feature', 'What you get']);
63
82
  assert.deepEqual(t.rows, [['Booking', 'Online appointments']]);
64
83
  });
65
84
 
66
85
  test('every missing or empty section is a finding', () => {
67
- const noTeam = goodMd.replace(/## Team[\s\S]*?(?=## About)/, '');
68
- assert.ok(check(noTeam).some((f) => f.includes('Team')));
69
- const emptyScope = goodMd.replace('| Booking | Online appointments |\n', '')
70
- .replace('## Scope\n| Feature | What you get |\n| --- | --- |', '## Scope');
71
- assert.ok(check(emptyScope).some((f) => f.includes('Scope')));
86
+ const noScope = fullDoc().replace(/## Scope[\s\S]*?(?=## Out of Scope)/, '');
87
+ assert.ok(check({ md: noScope }).some((f) => f.includes('Scope')));
88
+ const emptyScope = fullDoc().replace('| Booking | Online appointments |\n', '')
89
+ .replace('## Scope\n\n| Feature | What you get |\n| --- | --- |', '## Scope');
90
+ assert.ok(check({ md: emptyScope }).some((f) => f.includes('Scope')));
72
91
  });
73
92
 
74
- test('frontmatter contract: missing key, bad tech level, unknown scenario', () => {
75
- assert.ok(check(goodMd.replace('currency: USD\n', '')).some((f) => f.includes('currency')));
76
- assert.ok(check(goodMd.replace('non-tech', 'wizard')).some((f) => f.includes('client_tech_level')));
77
- assert.ok(check(goodMd.replace('scenario: s1', 'scenario: ghost')).some((f) => f.includes('ghost')));
93
+ test('frontmatter contract: missing key, bad tech level', () => {
94
+ const noCurrency = validFm();
95
+ delete noCurrency.currency;
96
+ assert.ok(check({ fm: noCurrency }).some((f) => f.includes('currency')));
97
+ assert.ok(check({ fm: { ...validFm(), client_tech_level: 'wizard' } })
98
+ .some((f) => f.includes('client_tech_level')));
78
99
  });
79
100
 
80
101
  test('valid_until must be a future ISO date', () => {
81
- assert.ok(check(goodMd.replace('2099-12-31', '2020-01-01')).some((f) => f.includes('valid_until')));
82
- assert.ok(check(goodMd.replace('2099-12-31', 'someday')).some((f) => f.includes('valid_until')));
102
+ assert.ok(check({ fm: { ...validFm(), valid_until: '2020-01-01' } })
103
+ .some((f) => f.includes('valid_until')));
104
+ assert.ok(check({ fm: { ...validFm(), valid_until: 'someday' } })
105
+ .some((f) => f.includes('valid_until')));
83
106
  });
84
107
 
85
108
  test('placeholders and empty tables are findings', () => {
86
- assert.ok(check(goodMd.replace('We fix scheduling.', 'TBD')).some((f) => /placeholder/i.test(f)));
87
- assert.ok(check(`${goodMd}\n| A | B |\n| --- | --- |\n`).some((f) => /empty table/i.test(f)));
109
+ assert.ok(check({ md: fullDoc().replace('We fix scheduling for $8,000 – $12,000.', 'TBD') })
110
+ .some((f) => /placeholder/i.test(f)));
111
+ assert.ok(check({ md: `${fullDoc()}\n| A | B |\n| --- | --- |\n` })
112
+ .some((f) => /empty table/i.test(f)));
88
113
  });
89
114
 
90
115
  test('Proposed Solution must carry a mermaid diagram', () => {
91
- const noDiagram = goodMd.replace(/```mermaid[\s\S]*?```/, 'A drawing.');
92
- assert.ok(check(noDiagram).some((f) => f.includes('mermaid')));
116
+ const noDiagram = fullDoc().replace(/```mermaid[\s\S]*?```/, 'A drawing.');
117
+ assert.ok(check({ md: noDiagram }).some((f) => f.includes('mermaid')));
118
+ });
119
+
120
+ test('the proposal has nine sections and no Team', () => {
121
+ assert.equal(SECTIONS.length, 9);
122
+ assert.ok(!SECTIONS.includes('Team'));
123
+ assert.deepEqual(SECTIONS.slice(0, 3), ['Executive Summary', 'Background & Objectives', 'Proposed Solution']);
124
+ });
125
+
126
+ test('frontmatter no longer requires a scenario', () => {
127
+ const fm = validFm();
128
+ delete fm.scenario;
129
+ const out = checkDoc({ fm, md: fullDoc(), today: new Date('2026-09-25') });
130
+ assert.ok(!out.some((f) => /scenario/i.test(f)), out.join('\n'));
131
+ });
132
+
133
+ test('a leftover scenario key in frontmatter is refused', () => {
134
+ const fm = { ...validFm(), scenario: '2eng-max5x' };
135
+ const out = checkDoc({ fm, md: fullDoc(), today: new Date('2026-09-25') });
136
+ assert.ok(out.some((f) => /scenario.*removed/i.test(f)), out.join('\n'));
137
+ });
138
+
139
+ test('an Investment table with a Duration column is refused', () => {
140
+ const md = fullDoc().replace(
141
+ '## Investment & Timeline\n\n',
142
+ '## Investment & Timeline\n\n| Milestone | Duration | Investment |\n|---|---|---|\n| M1 | 2 months | $32,300 |\n\n',
143
+ );
144
+ const out = checkDoc({ fm: validFm(), md, today: new Date('2026-09-25') });
145
+ assert.ok(out.some((f) => /Duration column/i.test(f)), out.join('\n'));
146
+ });
147
+
148
+ test('a proposal still carrying a Team section is refused', () => {
149
+ const md = `${fullDoc()}\n## Team\n\nTwo senior engineers.\n`;
150
+ const out = checkDoc({ fm: validFm(), md, today: new Date('2026-09-25') });
151
+ assert.ok(out.some((f) => /Team section was removed/i.test(f)), out.join('\n'));
93
152
  });
@@ -22,22 +22,24 @@ test('SKILL.md names the pipeline, both hard prerequisites, and the review gate'
22
22
  }
23
23
  });
24
24
 
25
- test('interview.md carries the prereq gate, tech levels, scenario pick, and profile scopes', () => {
25
+ test('interview.md carries the prereq gate, tech levels, and profile scopes', () => {
26
26
  const d = doc('references/interview.md');
27
- for (const needle of ['non-tech', 'low-tech', 'technical', 'scenario',
27
+ for (const needle of ['non-tech', 'low-tech', 'technical',
28
28
  'valid', 'proposal-profile.json', '.claude/', 'stop']) {
29
29
  assert.ok(d.includes(needle), `interview.md missing: ${needle}`);
30
30
  }
31
+ assert.doesNotMatch(d, /scenario/i);
31
32
  });
32
33
 
33
- test('writing.md states every validator rule family and the ten sections', () => {
34
+ test('writing.md states every validator rule family and the nine sections', () => {
34
35
  const d = doc('references/writing.md');
35
36
  for (const needle of ['Executive Summary', 'Background & Objectives', 'Proposed Solution',
36
37
  'Scope', 'Out of Scope & Assumptions', 'Delivery Approach', 'Investment & Timeline',
37
- 'Team', 'About', 'Next Steps', 'valid_until', 'jargon_allow', 'proposal-figures.json',
38
- 'Never write a number', 'rates']) {
38
+ 'About', 'Next Steps', 'valid_until', 'jargon_allow', 'proposal-figures.json',
39
+ 'Never write a number', 'rates', 'carries no timeline']) {
39
40
  assert.ok(d.includes(needle), `writing.md missing: ${needle}`);
40
41
  }
42
+ assert.doesNotMatch(d, /\*\*Team\*\*/);
41
43
  for (const term of ['kubernetes', 'api']) {
42
44
  assert.ok(JARGON.includes(term), `jargon list lost its anchor term: ${term}`);
43
45
  }
@@ -48,4 +50,8 @@ test('review.md dispatches a fresh-eyes subagent with the five-point charter', (
48
50
  for (const needle of ['fresh', 'tech level', 'hype', 'leak', 'contradiction', 'one']) {
49
51
  assert.ok(d.toLowerCase().includes(needle), `review.md missing: ${needle}`);
50
52
  }
53
+ // The estimate produces no timeline; a review that asks for one pushes the
54
+ // author to promise a duration nothing downstream can back.
55
+ assert.doesNotMatch(d, /how long/i, 'review.md must not ask how long delivery takes');
56
+ assert.match(d, /delivery duration or date/, 'a duration must be listed as a leak');
51
57
  });
@@ -13,7 +13,7 @@ test('compute → derive → validate → render runs clean end to end', () => {
13
13
  execFileSync('node', [script('../../../estimate/scripts/compute.mjs'),
14
14
  '--inputs', script('../../../estimate/scripts/test/fixtures/booking-inputs.json'), '--out', json]);
15
15
  execFileSync('node', [script('../derive.mjs'),
16
- '--estimation', json, '--scenario', '2eng-max5x', '--out', join(dir, 'proposal-figures.json')]);
16
+ '--estimation', json, '--out', join(dir, 'proposal-figures.json')]);
17
17
  execFileSync('node', [script('../validate.mjs'),
18
18
  '--md', script('./fixtures/proposal-pass.md'), '--estimation', json]);
19
19
  const bundle = join(dir, 'mermaid.js');
@@ -0,0 +1,39 @@
1
+ // The pre-fed eval fixtures feed `claude plugin eval` a finished estimate.
2
+ // If they drift from the current estimate model, every eval scores correct
3
+ // behaviour as failure. Pin them: each recomputes to its stored numbers,
4
+ // derives a price, and the figures its eval asserts are the ones derived.
5
+ import { test } from 'node:test';
6
+ import assert from 'node:assert/strict';
7
+ import { readFileSync } from 'node:fs';
8
+ import { checkInputs } from '../../../estimate/scripts/lib/schema.mjs';
9
+ import { computeEstimation } from '../../../estimate/scripts/lib/rollup.mjs';
10
+ import { deriveFigures } from '../lib/figures.mjs';
11
+
12
+ const evalsDir = new URL('../../evals/', import.meta.url);
13
+ const read = (p) => JSON.parse(readFileSync(new URL(p, evalsDir), 'utf8'));
14
+ const evals = read('evals.json').evals;
15
+ const PRE_FED = { 1: 'pre-fed-harborline-dispatch', 2: 'pre-fed-meridian-dental' };
16
+
17
+ const flat = (f) => [f.cost.low, f.cost.high, f.singleNumber,
18
+ ...f.milestones.flatMap((m) => [m.cost.low, m.cost.high])];
19
+
20
+ for (const [id, dir] of Object.entries(PRE_FED)) {
21
+ test(`${dir}: v2 inputs, stored numbers recompute, figures match the eval`, () => {
22
+ const inputs = read(`fixtures/${dir}/estimation-inputs.json`);
23
+ assert.deepEqual(checkInputs(inputs), []);
24
+ const stored = read(`fixtures/${dir}/estimation.json`);
25
+ assert.deepEqual(computeEstimation(stored.inputs).computed, stored.computed);
26
+ assert.deepEqual(stored.inputs, inputs, 'estimation.json was computed from other inputs');
27
+ const figures = deriveFigures(stored);
28
+ const traced = evals.find((e) => e.id === Number(id)).assertions
29
+ .find((a) => a.startsWith('every-number-traces-upstream'));
30
+ const listed = JSON.parse(`[${/\{([\d, ]+)\}/.exec(traced)[1]}]`);
31
+ assert.deepEqual([...listed].sort((a, b) => a - b), flat(figures).sort((a, b) => a - b));
32
+ });
33
+ }
34
+
35
+ test('the unpriced fixture really is unpriced, so the proposal refuses it', () => {
36
+ const stored = read('fixtures/gate-check-unpriced-harborline/estimation.json');
37
+ assert.deepEqual(computeEstimation(stored.inputs).computed, stored.computed);
38
+ assert.throws(() => deriveFigures(stored), /not priced/);
39
+ });
@@ -1,81 +1,94 @@
1
+ // plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs
1
2
  import { test } from 'node:test';
2
3
  import assert from 'node:assert/strict';
3
- import { readFileSync, mkdtempSync } from 'node:fs';
4
+ import { readFileSync, writeFileSync, mkdtempSync } from 'node:fs';
4
5
  import { execFileSync } from 'node:child_process';
5
6
  import { tmpdir } from 'node:os';
6
7
  import { join } from 'node:path';
7
- import { writeFileSync } from 'node:fs';
8
- import { deriveFigures, formatMoney } from '../lib/figures.mjs';
8
+ import { deriveFigures } from '../lib/figures.mjs';
9
9
 
10
- // Hand-checkable synthetic estimation: spread ratios are lo 0.8 / hi 1.2.
11
- const estimation = {
12
- inputs: {
13
- scenarios: [{
14
- id: 's1', aiAssisted: true, toolingCostPerSeat: 100,
15
- team: [{ seniority: 'senior', rate: 50 }, { seniority: 'mid', rate: 40 }],
16
- }],
17
- },
10
+ const estimation = () => ({
11
+ inputs: { features: [] },
18
12
  computed: {
19
- features: {
20
- a: { hours: 100, low: 80, high: 120 },
21
- b: { hours: 100, low: 80, high: 120 },
22
- },
23
- scenarios: {
24
- s1: {
25
- months: 2, totalCost: 10000,
26
- roadmap: [
27
- { milestone: 'M1', startMonths: 0, endMonths: 1.5 },
28
- { milestone: 'M2', startMonths: 1.5, endMonths: 2 },
29
- ],
30
- },
31
- },
13
+ price: { presentLow: 43000, presentHigh: 58000, singleNumber: 50500, p50: 42577.08 },
14
+ roadmap: [
15
+ { milestone: 'M1 - Booking core', features: ['booking'], share: 0.75 },
16
+ { milestone: 'M2 - Notifications', features: ['reminders'], share: 0.25 },
17
+ ],
32
18
  },
33
- };
19
+ });
20
+
21
+ test('cost comes from the presented range, not from hour ratios', () => {
22
+ const f = deriveFigures(estimation());
23
+ assert.equal(f.cost.low, 43000);
24
+ assert.equal(f.cost.high, 58000);
25
+ assert.equal(f.singleNumber, 50500);
26
+ });
34
27
 
35
- test('figures scale totals by the feature spread ratios', () => {
36
- const f = deriveFigures(estimation, 's1');
37
- assert.deepEqual(f.cost, { low: 8000, high: 12000 });
38
- assert.deepEqual(f.months, { low: 1.6, high: 2.4 });
28
+ test('no months and no team survive in the figures', () => {
29
+ const f = deriveFigures(estimation());
30
+ assert.equal(f.months, undefined);
31
+ assert.equal(f.team, undefined);
32
+ for (const m of f.milestones) assert.equal(m.months, undefined);
39
33
  });
40
34
 
41
- test('milestone splits follow the roadmap band shares', () => {
42
- const f = deriveFigures(estimation, 's1');
43
- assert.deepEqual(f.milestones, [
44
- { name: 'M1', cost: { low: 6000, high: 9000 }, months: { low: 1.2, high: 1.8 } },
45
- { name: 'M2', cost: { low: 2000, high: 3000 }, months: { low: 0.4, high: 0.6 } },
46
- ]);
35
+ test('milestone cost splits follow the roadmap shares; the last takes the remainder', () => {
36
+ const f = deriveFigures(estimation());
37
+ assert.equal(f.milestones[0].cost.low, 32300); // 43000 * 0.75, rounded to 100
38
+ assert.equal(f.milestones[1].cost.low, 10700); // 43000 - 32300, not round100(10750) = 10800
47
39
  });
48
40
 
49
- test('team lists seniorities only — rates never leave the estimate', () => {
50
- const f = deriveFigures(estimation, 's1');
51
- assert.deepEqual(f.team, ['senior', 'mid']);
52
- assert.doesNotMatch(JSON.stringify(f), /rate|50|40/);
41
+ // R59: the rows above the bold Total line must add up to it exactly, and
42
+ // checkMoney refuses any hand-corrected amount, so the figures have to.
43
+ const withShares = (shares) => {
44
+ const e = estimation();
45
+ e.computed.roadmap = shares.map((share, i) => ({ milestone: `M${i + 1}`, features: [], share }));
46
+ return e;
47
+ };
48
+
49
+ test('milestone costs sum exactly to the presented range', () => {
50
+ for (const shares of [[0.75, 0.25], [0.33, 0.33, 0.33], [0.17, 0.42, 0.42]]) {
51
+ const f = deriveFigures(withShares(shares));
52
+ for (const bound of ['low', 'high']) {
53
+ const sum = f.milestones.reduce((s, m) => s + m.cost[bound], 0);
54
+ assert.equal(sum, f.cost[bound], `shares ${shares} ${bound}: rows sum to ${sum}`);
55
+ }
56
+ }
53
57
  });
54
58
 
55
- test('no roadmap means no milestones, not a crash', () => {
56
- const noRoadmap = structuredClone(estimation);
57
- delete noRoadmap.computed.scenarios.s1.roadmap;
58
- assert.deepEqual(deriveFigures(noRoadmap, 's1').milestones, []);
59
+ test('an estimate with no roadmap yields no milestones, not a crash', () => {
60
+ const e = estimation();
61
+ delete e.computed.roadmap;
62
+ assert.deepEqual(deriveFigures(e).milestones, []);
59
63
  });
60
64
 
61
- test('unknown scenario throws with the id in the message', () => {
62
- assert.throws(() => deriveFigures(estimation, 'nope'), /scenario "nope" not in estimation\.json/);
65
+ // R54: an unpriced estimate (agentic mode / QUICK depth, no scored features)
66
+ // must be refused, never quoted at $0.
67
+ test('an unpriced estimate (p50 zero) is refused, not quoted at $0', () => {
68
+ const e = estimation();
69
+ e.computed.price = { presentLow: 0, presentHigh: 0, singleNumber: 0, p50: 0 };
70
+ assert.throws(() => deriveFigures(e), /estimate is not priced \(no scored features\)/);
63
71
  });
64
72
 
65
- test('formatMoney uses en-US grouping with a dollar sign', () => {
66
- assert.equal(formatMoney(8000), '$8,000');
67
- assert.equal(formatMoney(1234500), '$1,234,500');
73
+ test('a missing price block is refused the same way', () => {
74
+ const e = estimation();
75
+ delete e.computed.price;
76
+ assert.throws(() => deriveFigures(e), /estimate is not priced \(no scored features\)/);
68
77
  });
69
78
 
70
- test('derive.mjs CLI writes the figures file and refuses unknown scenarios', () => {
79
+ test('derive.mjs CLI writes the figures file and refuses an unpriced estimate', () => {
71
80
  const dir = mkdtempSync(join(tmpdir(), 'proposal-derive-'));
72
81
  const est = join(dir, 'estimation.json');
73
- writeFileSync(est, JSON.stringify(estimation));
82
+ writeFileSync(est, JSON.stringify(estimation()));
74
83
  const out = join(dir, 'proposal-figures.json');
75
84
  const cli = new URL('../derive.mjs', import.meta.url).pathname;
76
- execFileSync('node', [cli, '--estimation', est, '--scenario', 's1', '--out', out]);
85
+ execFileSync('node', [cli, '--estimation', est, '--out', out]);
77
86
  const written = JSON.parse(readFileSync(out, 'utf8'));
78
- assert.equal(written.cost.low, 8000);
79
- assert.equal(written.milestones[0].name, 'M1');
80
- assert.throws(() => execFileSync('node', [cli, '--estimation', est, '--scenario', 'nope', '--out', out]));
87
+ assert.equal(written.cost.low, 43000);
88
+ assert.equal(written.milestones[0].name, 'M1 - Booking core');
89
+
90
+ const unpriced = estimation();
91
+ unpriced.computed.price = { presentLow: 0, presentHigh: 0, singleNumber: 0, p50: 0 };
92
+ writeFileSync(est, JSON.stringify(unpriced));
93
+ assert.throws(() => execFileSync('node', [cli, '--estimation', est, '--out', out], { stdio: 'pipe' }));
81
94
  });
@@ -19,4 +19,9 @@ TBD — we deploy the backend API for $9,999.
19
19
  | Booking | observed |
20
20
 
21
21
  ## Investment & Timeline
22
- Total: $9,999 over 1–99 months. Cheaper than 3eng-noai.
22
+ | Milestone | Duration | Investment |
23
+ | --- | --- | --- |
24
+ | M1 | 2 months | $9,999 |
25
+
26
+ ## Team
27
+ Two senior engineers.
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  client: Acme Corp
3
3
  client_tech_level: non-tech
4
- scenario: 2eng-max5x
5
4
  currency: USD
6
5
  valid_until: 2099-12-31
7
6
  source_architecture: ../ARCHITECTURE.md
@@ -11,10 +10,10 @@ source_estimation: ../estimation.json
11
10
  # Acme Corp — Proposal
12
11
 
13
12
  ## Executive Summary
14
- Your customers book by phone today; every double-booking costs you a client. We will build an online booking system for $3,400 – $10,300, delivered in 0.2–0.7 months by a two-person team.
13
+ Your customers book by phone today; every double-booking costs you a client. We will build an online booking system for $10,000 – $14,000.
15
14
 
16
15
  ## Background & Objectives
17
- Acme staff manage appointments by hand. The goal: customers book online, reminders go out automatically, and no slot is ever double-booked, live within 0.7 months.
16
+ Acme staff manage appointments by hand. The goal: customers book online, reminders go out automatically, and no slot is ever double-booked.
18
17
 
19
18
  ## Proposed Solution
20
19
  One new system with two parts: the booking page your customers see, and reminders that go out on their own.
@@ -35,18 +34,15 @@ graph LR; C[Your customers] --> B[Online booking] --> R[Automatic reminders]
35
34
  - We assume all bookings happen in a single timezone.
36
35
 
37
36
  ## Delivery Approach
38
- Two milestones. M1 - Booking core runs 0.2–0.5 months; M2 - Notifications runs 0.1–0.2 months. You see a working demo every week, and each milestone ends with your sign-off.
37
+ Two milestones. M1 - Booking core comes first; M2 - Notifications follows. You see a working demo every week, and each milestone ends with your sign-off.
39
38
 
40
39
  ## Investment & Timeline
41
- | Milestone | Duration | Investment |
42
- | --- | --- | --- |
43
- | M1 - Booking core | 0.2–0.5 months | $2,600 – $7,700 |
44
- | M2 - Notifications | 0.1–0.2 months | $900 – $2,600 |
45
-
46
- **Total: $3,400 – $10,300 over 0.2–0.7 months.** The range reflects estimation confidence; we confirm a fixed price before each milestone begins.
40
+ | Milestone | Investment |
41
+ | --- | --- |
42
+ | M1 - Booking core | $7,600 – $10,600 |
43
+ | M2 - Notifications | $2,400 – $3,400 |
47
44
 
48
- ## Team
49
- One senior engineer and one mid-level engineer, working with AI-assisted tooling.
45
+ **Total: $10,000 – $14,000**, or a single fixed price of $12,000 if you prefer one number. The range reflects estimation confidence; we confirm a fixed price before each milestone begins.
50
46
 
51
47
  ## About Code Engine Studio
52
48
  We build custom software for small businesses. Recent work: a clinic scheduling system and a salon booking app. Contact: hello@codeenginestudio.com
@@ -41,7 +41,7 @@ test('render refuses a proposal that fails validation', () => {
41
41
  assert.throws(() => rendered(failMd));
42
42
  });
43
43
 
44
- test('rendered page is self-contained with fonts, nav, and all ten sections', () => {
44
+ test('rendered page is self-contained with fonts, nav, and all nine sections', () => {
45
45
  const html = rendered();
46
46
  assert.doesNotMatch(html, /<!-- slot:/);
47
47
  assert.match(html, /@font-face/);
@@ -30,11 +30,12 @@ test('the fail fixture exits 1 and names every violation class', () => {
30
30
  } catch (e) { err = e; }
31
31
  assert.ok(err, 'expected non-zero exit');
32
32
  const findings = err.stderr.toString();
33
- assert.match(findings, /missing ## Team/);
33
+ assert.match(findings, /scenario.*removed/i);
34
+ assert.match(findings, /Team section was removed/i);
35
+ assert.match(findings, /Duration column/i);
34
36
  assert.match(findings, /placeholder/i);
35
37
  assert.match(findings, /valid_until/);
36
38
  assert.match(findings, /9,999|9999/);
37
39
  assert.match(findings, /"src"/);
38
- assert.match(findings, /3eng-noai/);
39
40
  assert.match(findings, /jargon/i);
40
41
  });
@@ -1,39 +0,0 @@
1
- // Scenario-shape checks for estimation-inputs.json: team roster, AI
2
- // assistance, and the per-seat tooling price. Split from schema.mjs so each
3
- // module stays under the ten-function gate; findings follow the same
4
- // "scenario <id>: ..." form.
5
- import { SENIORITY_FACTOR } from './estimate-math.mjs';
6
-
7
- // A seat price may be skipped (the client may mandate a vendor) but only as
8
- // a recorded gap: an AI-assisted scenario with a null seat cost needs an
9
- // assumption that names it, or the total would silently miss a line item.
10
- const seatCostOk = (v) => v === null || (typeof v === 'number' && v > 0);
11
- const toolingAssumed = (inputs) => (inputs.assumptions ?? [])
12
- .some((a) => /tooling/i.test(typeof a === 'string' ? a : a?.text ?? ''));
13
-
14
- function checkScenarioAi(s, inputs, out) {
15
- if ('plan' in s) out.push(`scenario ${s.id}: "plan" was removed — use aiAssisted + toolingCostPerSeat`);
16
- if (typeof s.aiAssisted !== 'boolean') out.push(`scenario ${s.id}: aiAssisted must be true|false`);
17
- if (!('toolingCostPerSeat' in s) || !seatCostOk(s.toolingCostPerSeat)) {
18
- out.push(`scenario ${s.id}: toolingCostPerSeat must be a positive number or null`);
19
- }
20
- if (s.aiAssisted === true && s.toolingCostPerSeat === null && !toolingAssumed(inputs)) {
21
- out.push(`scenario ${s.id}: null toolingCostPerSeat needs an assumption naming the tooling cost gap`);
22
- }
23
- }
24
-
25
- export function checkScenarios(inputs, out) {
26
- const ids = (inputs.scenarios ?? []).map((s) => s.id);
27
- if (!ids.includes(inputs.recommendedScenario)) out.push('recommendedScenario names no scenario');
28
- if ('recommendedReason' in inputs && !(typeof inputs.recommendedReason === 'string' && inputs.recommendedReason.trim())) {
29
- out.push('recommendedReason must be a non-empty string when present');
30
- }
31
- for (const s of inputs.scenarios ?? []) {
32
- if (!s.team?.length) out.push(`scenario ${s.id}: empty team`);
33
- checkScenarioAi(s, inputs, out);
34
- for (const member of s.team ?? []) {
35
- if (!Object.hasOwn(SENIORITY_FACTOR, member.seniority)) out.push(`scenario ${s.id}: unknown seniority "${member.seniority}"`);
36
- if (!(typeof member.rate === 'number' && member.rate > 0)) out.push(`scenario ${s.id}: rate must be a positive number`);
37
- }
38
- }
39
- }