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