@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
|
@@ -10,12 +10,13 @@ way the client will.
|
|
|
10
10
|
1. **Comprehension** — would a reader at the stated tech level understand
|
|
11
11
|
every sentence? Flag anything too technical; this catches jargon beyond
|
|
12
12
|
the deny-list.
|
|
13
|
-
2. **Executive summary** — does page one answer what we build
|
|
14
|
-
costs
|
|
13
|
+
2. **Executive summary** — does page one answer what we build and what it
|
|
14
|
+
costs?
|
|
15
15
|
3. **Honesty** — persuasive is fine, hype is not. Flag any claim the
|
|
16
16
|
document itself cannot back.
|
|
17
|
-
4. **Leaks** — anything internal:
|
|
18
|
-
words, confidence internals
|
|
17
|
+
4. **Leaks** — anything internal: staffing detail, rates, provenance
|
|
18
|
+
words, confidence internals, a delivery duration or date (the estimate
|
|
19
|
+
produces no timeline).
|
|
19
20
|
5. **Contradictions** — scope vs out-of-scope, price table vs summary,
|
|
20
21
|
milestones vs delivery prose.
|
|
21
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Writing — frontmatter contract,
|
|
1
|
+
# Writing — frontmatter contract, nine sections, language rules
|
|
2
2
|
|
|
3
3
|
Read while writing proposal.md. The validator enforces everything below;
|
|
4
4
|
a document that satisfies this file passes `validate.mjs` by construction.
|
|
@@ -9,7 +9,6 @@ a document that satisfies this file passes `validate.mjs` by construction.
|
|
|
9
9
|
---
|
|
10
10
|
client: Acme Corp
|
|
11
11
|
client_tech_level: non-tech # non-tech | low-tech | technical
|
|
12
|
-
scenario: 2eng-max5x # must exist in estimation.json
|
|
13
12
|
currency: USD
|
|
14
13
|
valid_until: 2026-09-06 # ISO date, must be in the future
|
|
15
14
|
jargon_allow: [] # optional, JSON array
|
|
@@ -22,21 +21,25 @@ source_estimation: ../estimation.json
|
|
|
22
21
|
|
|
23
22
|
**Never write a number that `scripts/derive.mjs` did not output.** Run it
|
|
24
23
|
first, keep proposal-figures.json open, and use only those values: the cost
|
|
25
|
-
range, the
|
|
26
|
-
`$8,000` (en-US grouping)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
figures from estimation.json itself, so editing proposal-figures.json by
|
|
31
|
-
hand changes nothing.
|
|
24
|
+
range, the single-number figure, and the per-milestone splits. Money is
|
|
25
|
+
written `$8,000` (en-US grouping). The validator extracts every money amount
|
|
26
|
+
in the document and refuses any value the derivation didn't produce — and it
|
|
27
|
+
recomputes the figures from estimation.json itself, so editing
|
|
28
|
+
proposal-figures.json by hand changes nothing.
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
The proposal carries no timeline: the estimate scores and prices features,
|
|
31
|
+
it does not schedule them, so there is no duration figure to quote — never
|
|
32
|
+
write a number of months or weeks, and the Investment & Timeline table never
|
|
33
|
+
carries a Duration column.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Rates never appear — no staffing detail of any kind does; the estimate
|
|
36
|
+
prices a package, not rates or a team roster.
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
## 3. The nine sections, in order (all `##`, exact names)
|
|
39
|
+
|
|
40
|
+
1. **Executive Summary** — problem, solution, headline cost range. One page.
|
|
41
|
+
The headline range is mandatory: the validator requires cost low/high to
|
|
42
|
+
appear.
|
|
40
43
|
2. **Background & Objectives** — the client's problem in their words, then
|
|
41
44
|
measurable goals.
|
|
42
45
|
3. **Proposed Solution** — what we build, in the client's language, plus
|
|
@@ -48,18 +51,16 @@ Rates never appear. Team members are described by role/seniority only.
|
|
|
48
51
|
do not break section slicing; each table still validates on its own.
|
|
49
52
|
5. **Out of Scope & Assumptions** — explicit exclusions (from estimation.md
|
|
50
53
|
plus the interview) and the assumptions the estimate rests on.
|
|
51
|
-
6. **Delivery Approach** — milestones
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
7. **Investment & Timeline** — the milestone table:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
8. **
|
|
58
|
-
never rates.
|
|
59
|
-
9. **About <firm>** — blurb, relevant work, contact, from the profile. The
|
|
54
|
+
6. **Delivery Approach** — milestones, ways of working, QA, communication
|
|
55
|
+
cadence, and the client-relevant risks with mitigations. The full risk
|
|
56
|
+
register stays internal.
|
|
57
|
+
7. **Investment & Timeline** — the milestone table: an Investment column
|
|
58
|
+
from the figures, then the bold total line and the sentence explaining
|
|
59
|
+
the range reflects estimation confidence.
|
|
60
|
+
8. **About <firm>** — blurb, relevant work, contact, from the profile. The
|
|
60
61
|
jargon scan skips this section.
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
9. **Next Steps** — the valid_until date in prose, the acceptance path,
|
|
63
|
+
and a call to action.
|
|
63
64
|
|
|
64
65
|
## 4. Tech-level language
|
|
65
66
|
|
|
@@ -74,11 +75,12 @@ Rates never appear. Team members are described by role/seniority only.
|
|
|
74
75
|
|
|
75
76
|
## 5. What must never appear
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
A `scenario` frontmatter key (removed — the estimate produces one price, not
|
|
79
|
+
a menu of staffing scenarios), a `## Team` section, a Duration column,
|
|
80
|
+
provenance vocabulary (`observed`/`stated`/`researched`/`proposed` as table
|
|
81
|
+
cells or a `src` column), `data-internal`, placeholder text of any spelling,
|
|
82
|
+
empty tables, and any number the derivation didn't produce — all of these
|
|
83
|
+
fail `validate.mjs`. Rates, internal risk ids, and confidence internals must
|
|
82
84
|
never appear either, but no script can recognize them reliably: the
|
|
83
85
|
fresh-eyes review (`references/review.md` charter item 4) and your own
|
|
84
86
|
read before rendering are the gate for those. Unknowns are honest
|
|
@@ -91,7 +93,7 @@ proposal.md, proposal-figures.json beside ARCHITECTURE.md/estimation.md.
|
|
|
91
93
|
Run from `plugins/solution-architect/skills/proposal/`:
|
|
92
94
|
|
|
93
95
|
```
|
|
94
|
-
node scripts/derive.mjs --estimation <dir>/estimation.json --
|
|
96
|
+
node scripts/derive.mjs --estimation <dir>/estimation.json --out <dir>/proposal-figures.json
|
|
95
97
|
node scripts/validate.mjs --md <dir>/proposal.md --estimation <dir>/estimation.json
|
|
96
98
|
node scripts/render.mjs --md <dir>/proposal.md --estimation <dir>/estimation.json --mermaid-bundle <path> --out <out-dir>
|
|
97
99
|
node ../analyze-requirements/scripts/serve.mjs <out-dir>
|
|
@@ -13,7 +13,7 @@ const args = parseArgs(process.argv.slice(2));
|
|
|
13
13
|
const estimation = JSON.parse(readFileSync(args.estimation, 'utf8'));
|
|
14
14
|
let figures;
|
|
15
15
|
try {
|
|
16
|
-
figures = deriveFigures(estimation
|
|
16
|
+
figures = deriveFigures(estimation);
|
|
17
17
|
} catch (e) {
|
|
18
18
|
console.error(e.message);
|
|
19
19
|
process.exit(1);
|
|
@@ -6,8 +6,8 @@ import { sectionText, escapeRegExp } from './sections.mjs';
|
|
|
6
6
|
import { JARGON } from './jargon.mjs';
|
|
7
7
|
|
|
8
8
|
const flat = (f) => [
|
|
9
|
-
f.cost.low, f.cost.high, f.
|
|
10
|
-
...f.milestones.flatMap((m) => [m.cost.low, m.cost.high
|
|
9
|
+
f.cost.low, f.cost.high, f.singleNumber,
|
|
10
|
+
...f.milestones.flatMap((m) => [m.cost.low, m.cost.high]),
|
|
11
11
|
];
|
|
12
12
|
|
|
13
13
|
function checkMoney(md, figures, out) {
|
|
@@ -16,15 +16,6 @@ function checkMoney(md, figures, out) {
|
|
|
16
16
|
const n = Number(m[1].replaceAll(',', ''));
|
|
17
17
|
if (!allowed.has(n)) out.push(`money amount ${m[0].trim()} not derived from estimation.json`);
|
|
18
18
|
}
|
|
19
|
-
for (const m of md.matchAll(/(\d+(?:\.\d+)?)\s*[–-]\s*(\d+(?:\.\d+)?)\s+months/g)) {
|
|
20
|
-
for (const bound of [Number(m[1]), Number(m[2])]) {
|
|
21
|
-
if (!allowed.has(bound)) out.push(`duration bound ${bound} months not derived from estimation.json`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
for (const m of md.matchAll(/(\d+(?:\.\d+)?)\s+months\b/g)) {
|
|
25
|
-
const n = Number(m[1]);
|
|
26
|
-
if (!allowed.has(n)) out.push(`duration bound ${n} months not derived from estimation.json`);
|
|
27
|
-
}
|
|
28
19
|
}
|
|
29
20
|
|
|
30
21
|
function checkHeadline(md, figures, out) {
|
|
@@ -34,17 +25,9 @@ function checkHeadline(md, figures, out) {
|
|
|
34
25
|
out.push(`headline cost bound ${n.toLocaleString('en-US')} missing from Executive Summary`);
|
|
35
26
|
}
|
|
36
27
|
}
|
|
37
|
-
for (const n of [figures.months.low, figures.months.high]) {
|
|
38
|
-
if (!new RegExp(`\\b${escapeRegExp(String(n))}\\b`).test(summary)) {
|
|
39
|
-
out.push(`headline duration bound ${n} missing from Executive Summary`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
28
|
}
|
|
43
29
|
|
|
44
|
-
function checkLeaks({ md
|
|
45
|
-
for (const s of estimation.inputs.scenarios ?? []) {
|
|
46
|
-
if (s.id !== fm.scenario && md.includes(s.id)) out.push(`leak: scenario id "${s.id}"`);
|
|
47
|
-
}
|
|
30
|
+
function checkLeaks({ md }, out) {
|
|
48
31
|
if (/\|\s*src\s*\|/i.test(md)) out.push('leak: provenance "src" column');
|
|
49
32
|
if (/data-internal/.test(md)) out.push('leak: data-internal marker');
|
|
50
33
|
for (const word of ['observed', 'stated', 'researched', 'proposed']) {
|
|
@@ -66,10 +49,10 @@ function checkJargon({ md, fm }, out) {
|
|
|
66
49
|
}
|
|
67
50
|
|
|
68
51
|
export function checkClient({ md, fm, estimation }, out = []) {
|
|
69
|
-
const figures = deriveFigures(estimation
|
|
52
|
+
const figures = deriveFigures(estimation);
|
|
70
53
|
checkMoney(md, figures, out);
|
|
71
54
|
checkHeadline(md, figures, out);
|
|
72
|
-
checkLeaks({ md
|
|
55
|
+
checkLeaks({ md }, out);
|
|
73
56
|
checkJargon({ md, fm }, out);
|
|
74
57
|
return out;
|
|
75
58
|
}
|
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
// Structural half of the proposal gate: frontmatter contract, the
|
|
1
|
+
// Structural half of the proposal gate: frontmatter contract, the nine
|
|
2
2
|
// sections, placeholder scan, future validity. Client-safety checks live
|
|
3
3
|
// in checks-client.mjs.
|
|
4
4
|
import { SECTIONS, sectionText, tables } from './sections.mjs';
|
|
5
5
|
|
|
6
|
-
const FM_KEYS = ['client', 'client_tech_level', '
|
|
6
|
+
const FM_KEYS = ['client', 'client_tech_level', 'currency',
|
|
7
7
|
'valid_until', 'source_architecture', 'source_estimation'];
|
|
8
8
|
const TECH_LEVELS = ['non-tech', 'low-tech', 'technical'];
|
|
9
|
+
const DURATION_HEADER = /\|\s*Duration\s*\|/i;
|
|
9
10
|
|
|
10
|
-
function checkFrontmatter({ fm,
|
|
11
|
+
function checkFrontmatter({ fm, today }, out) {
|
|
11
12
|
for (const key of FM_KEYS) {
|
|
12
13
|
if (!fm[key]) out.push(`frontmatter: missing "${key}"`);
|
|
13
14
|
}
|
|
14
15
|
if (fm.client_tech_level && !TECH_LEVELS.includes(fm.client_tech_level)) {
|
|
15
16
|
out.push(`frontmatter: client_tech_level must be ${TECH_LEVELS.join('|')}`);
|
|
16
17
|
}
|
|
17
|
-
if (fm.scenario && !estimation.computed.scenarios[fm.scenario]) {
|
|
18
|
-
out.push(`frontmatter: scenario "${fm.scenario}" not in estimation.json`);
|
|
19
|
-
}
|
|
20
18
|
checkValidUntil(fm.valid_until, today, out);
|
|
21
19
|
}
|
|
22
20
|
|
|
21
|
+
// Both of these priced a team. The estimate prices a package now, so a
|
|
22
|
+
// document still carrying either is showing a number nothing computed.
|
|
23
|
+
function checkRemoved({ fm, md }, out) {
|
|
24
|
+
if ('scenario' in fm) out.push('frontmatter: "scenario" was removed — the estimate has one price');
|
|
25
|
+
if (/^##\s+Team\s*$/m.test(md)) out.push('the Team section was removed — this estimate prices a package, not a staffing plan');
|
|
26
|
+
const investment = sectionText(md, 'Investment & Timeline') ?? '';
|
|
27
|
+
if (DURATION_HEADER.test(investment)) {
|
|
28
|
+
out.push('Investment & Timeline must not carry a Duration column — the estimate produces no timeline');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
function checkValidUntil(raw, today, out) {
|
|
24
33
|
if (!raw) return;
|
|
25
34
|
const wellFormed = /^\d{4}-\d{2}-\d{2}$/.test(raw) && !Number.isNaN(Date.parse(raw));
|
|
@@ -46,8 +55,9 @@ function checkPlaceholders(md, out) {
|
|
|
46
55
|
}
|
|
47
56
|
}
|
|
48
57
|
|
|
49
|
-
export function checkDoc({ fm, md,
|
|
50
|
-
checkFrontmatter({ fm,
|
|
58
|
+
export function checkDoc({ fm, md, today }, out = []) {
|
|
59
|
+
checkFrontmatter({ fm, today }, out);
|
|
60
|
+
checkRemoved({ fm, md }, out);
|
|
51
61
|
checkSections(md, out);
|
|
52
62
|
checkPlaceholders(md, out);
|
|
53
63
|
return out;
|
|
@@ -9,9 +9,13 @@ import { checkClient } from './checks-client.mjs';
|
|
|
9
9
|
export function checkProposal({ md, estimation, today = new Date() }) {
|
|
10
10
|
const { data: fm, error } = parseFrontmatter(md);
|
|
11
11
|
if (!fm) return [`frontmatter: ${error}`];
|
|
12
|
-
const out = checkDoc({ fm, md,
|
|
13
|
-
|
|
12
|
+
const out = checkDoc({ fm, md, today });
|
|
13
|
+
// checkClient derives its figures from the estimate itself; an unpriced
|
|
14
|
+
// estimate can't quote a client, but that's a finding, not a crash.
|
|
15
|
+
try {
|
|
14
16
|
checkClient({ md, fm, estimation }, out);
|
|
17
|
+
} catch (e) {
|
|
18
|
+
out.push(`cannot check client-facing figures: ${e.message}`);
|
|
15
19
|
}
|
|
16
20
|
return out;
|
|
17
21
|
}
|
|
@@ -1,43 +1,34 @@
|
|
|
1
1
|
// Client-facing figures derived from estimation.json — the proposal never
|
|
2
|
-
// invents a number.
|
|
3
|
-
//
|
|
4
|
-
|
|
2
|
+
// invents a number. The range is the estimate's own presented range, so the
|
|
3
|
+
// proposal and the workbook always quote the same figures. Milestone splits
|
|
4
|
+
// follow the roadmap's effort shares; there are no durations, because the
|
|
5
|
+
// estimate produces none.
|
|
5
6
|
export const round100 = (n) => Math.round(n / 100) * 100;
|
|
6
7
|
export const formatMoney = (n) => `$${n.toLocaleString('en-US')}`;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
const feats = Object.values(computed.features);
|
|
10
|
-
const hours = feats.reduce((s, f) => s + f.hours, 0);
|
|
11
|
-
return {
|
|
12
|
-
lo: feats.reduce((s, f) => s + f.low, 0) / hours,
|
|
13
|
-
hi: feats.reduce((s, f) => s + f.high, 0) / hours,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const range = (value, ratios, round) => ({ low: round(value * ratios.lo), high: round(value * ratios.hi) });
|
|
9
|
+
const split = (cost, share) => ({ low: round100(cost.low * share), high: round100(cost.high * share) });
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
11
|
+
// The rows sit above a bold Total line the client reads against them, so
|
|
12
|
+
// they must add up to it exactly: every milestone but the last is its share
|
|
13
|
+
// rounded to $100, and the last takes whatever remains (R59).
|
|
14
|
+
function splitCosts(cost, roadmap) {
|
|
15
|
+
if (roadmap.length === 0) return [];
|
|
16
|
+
const heads = roadmap.slice(0, -1).map((b) => split(cost, b.share));
|
|
17
|
+
const taken = (bound) => heads.reduce((sum, c) => sum + c[bound], 0);
|
|
18
|
+
return [...heads, { low: cost.low - taken('low'), high: cost.high - taken('high') }];
|
|
28
19
|
}
|
|
29
20
|
|
|
30
|
-
export function deriveFigures(estimation
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
export function deriveFigures(estimation) {
|
|
22
|
+
const { price, roadmap } = estimation.computed;
|
|
23
|
+
if (!price || price.p50 === 0) {
|
|
24
|
+
throw new Error('estimate is not priced (no scored features) — a proposal cannot quote it');
|
|
25
|
+
}
|
|
26
|
+
const cost = { low: price.presentLow, high: price.presentHigh };
|
|
27
|
+
const bands = roadmap ?? [];
|
|
28
|
+
const costs = splitCosts(cost, bands);
|
|
36
29
|
return {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
milestones: milestoneFigures(scenario, ratios),
|
|
41
|
-
team,
|
|
30
|
+
cost,
|
|
31
|
+
singleNumber: price.singleNumber,
|
|
32
|
+
milestones: bands.map((b, i) => ({ name: b.milestone, cost: costs[i], share: b.share })),
|
|
42
33
|
};
|
|
43
34
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export const SECTIONS = [
|
|
4
4
|
'Executive Summary', 'Background & Objectives', 'Proposed Solution', 'Scope',
|
|
5
5
|
'Out of Scope & Assumptions', 'Delivery Approach', 'Investment & Timeline',
|
|
6
|
-
'
|
|
6
|
+
'About', 'Next Steps',
|
|
7
7
|
];
|
|
8
8
|
|
|
9
9
|
export const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -1,37 +1,27 @@
|
|
|
1
1
|
import { test } from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
+
import { checkClient } from '../lib/checks-client.mjs';
|
|
3
4
|
import { checkProposal } from '../lib/checks.mjs';
|
|
5
|
+
import { parseFrontmatter } from '../../../analyze-requirements/scripts/lib/frontmatter.mjs';
|
|
4
6
|
import { JARGON } from '../lib/jargon.mjs';
|
|
5
7
|
|
|
6
|
-
//
|
|
7
|
-
// cost 8000/12000,
|
|
8
|
+
// Synthetic estimation in the new price/roadmap shape (same as
|
|
9
|
+
// figures.test.mjs): figures are cost 8000/12000, singleNumber 10000,
|
|
10
|
+
// M1 6000/9000, M2 2000/3000.
|
|
8
11
|
const estimation = {
|
|
9
|
-
inputs: {
|
|
10
|
-
scenarios: [
|
|
11
|
-
{ id: 's1', aiAssisted: true, toolingCostPerSeat: 100, team: [{ seniority: 'senior', rate: 50 }] },
|
|
12
|
-
{ id: 's2-secret', aiAssisted: false, toolingCostPerSeat: null, team: [{ seniority: 'mid', rate: 40 }] },
|
|
13
|
-
],
|
|
14
|
-
},
|
|
12
|
+
inputs: { features: [] },
|
|
15
13
|
computed: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{ name: 'M1', startMonths: 0, endMonths: 1.5 },
|
|
22
|
-
{ name: 'M2', startMonths: 1.5, endMonths: 2 },
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
's2-secret': { months: 3, totalCost: 15000 },
|
|
26
|
-
},
|
|
14
|
+
price: { presentLow: 8000, presentHigh: 12000, singleNumber: 10000, p50: 7998 },
|
|
15
|
+
roadmap: [
|
|
16
|
+
{ milestone: 'M1', features: ['a'], share: 0.75 },
|
|
17
|
+
{ milestone: 'M2', features: ['b'], share: 0.25 },
|
|
18
|
+
],
|
|
27
19
|
},
|
|
28
20
|
};
|
|
29
|
-
const TODAY = new Date('2026-08-06');
|
|
30
21
|
|
|
31
22
|
const md = `---
|
|
32
23
|
client: Acme Corp
|
|
33
24
|
client_tech_level: non-tech
|
|
34
|
-
scenario: s1
|
|
35
25
|
currency: USD
|
|
36
26
|
valid_until: 2099-12-31
|
|
37
27
|
source_architecture: ../ARCHITECTURE.md
|
|
@@ -39,7 +29,7 @@ source_estimation: ../estimation.json
|
|
|
39
29
|
---
|
|
40
30
|
|
|
41
31
|
## Executive Summary
|
|
42
|
-
New booking system for $8,000 – $12,000
|
|
32
|
+
New booking system for $8,000 – $12,000.
|
|
43
33
|
## Background & Objectives
|
|
44
34
|
Bookings are manual today.
|
|
45
35
|
## Proposed Solution
|
|
@@ -53,23 +43,27 @@ graph LR; A[Your customers] --> B[New system]
|
|
|
53
43
|
## Out of Scope & Assumptions
|
|
54
44
|
- Text-message reminders are out.
|
|
55
45
|
## Delivery Approach
|
|
56
|
-
M1
|
|
46
|
+
M1 covers booking; M2 covers notifications. Weekly demos.
|
|
57
47
|
## Investment & Timeline
|
|
58
|
-
| Milestone |
|
|
59
|
-
| --- | --- |
|
|
60
|
-
| M1 |
|
|
61
|
-
| M2 |
|
|
62
|
-
|
|
63
|
-
Total: $8,000 – $12,000
|
|
64
|
-
## Team
|
|
65
|
-
One senior engineer.
|
|
48
|
+
| Milestone | Investment |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| M1 | $6,000 – $9,000 |
|
|
51
|
+
| M2 | $2,000 – $3,000 |
|
|
52
|
+
|
|
53
|
+
Total: $8,000 – $12,000.
|
|
66
54
|
## About Code Engine Studio
|
|
67
55
|
We build software. Contact: hello@example.com
|
|
68
56
|
## Next Steps
|
|
69
57
|
Valid until 2099-12-31. Reply to accept.
|
|
70
58
|
`;
|
|
71
59
|
|
|
72
|
-
|
|
60
|
+
// checkClient takes already-parsed frontmatter — parse fresh for each
|
|
61
|
+
// variant so tests that edit the frontmatter block (jargon_allow, tech
|
|
62
|
+
// level) see their own change.
|
|
63
|
+
const run = (doc) => {
|
|
64
|
+
const { data: fm } = parseFrontmatter(doc);
|
|
65
|
+
return checkClient({ md: doc, fm, estimation }, []);
|
|
66
|
+
};
|
|
73
67
|
|
|
74
68
|
test('a document whose numbers all trace to the figures passes', () => {
|
|
75
69
|
assert.deepEqual(run(md), []);
|
|
@@ -79,30 +73,20 @@ test('an invented money amount is a finding', () => {
|
|
|
79
73
|
assert.ok(run(md.replace('$6,000', '$6,500')).some((f) => f.includes('6,500') || f.includes('6500')));
|
|
80
74
|
});
|
|
81
75
|
|
|
82
|
-
test('an invented duration bound is a finding', () => {
|
|
83
|
-
assert.ok(run(md.replace('1.6–2.4 months.\n## Team', '1.6–9.9 months.\n## Team'))
|
|
84
|
-
.some((f) => f.includes('9.9')));
|
|
85
|
-
});
|
|
86
|
-
|
|
87
76
|
test('the headline cost range must be present', () => {
|
|
88
|
-
const noTotals = md.
|
|
77
|
+
const noTotals = md.replace('New booking system for $8,000 – $12,000.', 'A fair price for a new booking system.');
|
|
89
78
|
const findings = run(noTotals);
|
|
90
79
|
assert.ok(findings.some((f) => f.includes('8,000')));
|
|
91
|
-
assert.ok(findings.some((f) => f.includes('
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
test('a lone invented duration is a finding', () => {
|
|
95
|
-
assert.ok(run(md.replace('Weekly demos.', 'Live within 9 months.')).some((f) => f.includes('9')));
|
|
80
|
+
assert.ok(findings.some((f) => f.includes('12,000')));
|
|
96
81
|
});
|
|
97
82
|
|
|
98
83
|
test('headline ranges must live in the Executive Summary itself', () => {
|
|
99
|
-
const buried = md.replace('New booking system for $8,000 – $12,000
|
|
84
|
+
const buried = md.replace('New booking system for $8,000 – $12,000.', 'A fair price, fast.');
|
|
100
85
|
const findings = run(buried);
|
|
101
86
|
assert.ok(findings.some((f) => /Executive Summary/.test(f)));
|
|
102
87
|
});
|
|
103
88
|
|
|
104
|
-
test('
|
|
105
|
-
assert.ok(run(md.replace('Weekly demos.', 'Cheaper than s2-secret.')).some((f) => f.includes('s2-secret')));
|
|
89
|
+
test('provenance markup is a leak', () => {
|
|
106
90
|
assert.ok(run(md.replace('| Feature | What you get |', '| Feature | src |')).some((f) => f.includes('src')));
|
|
107
91
|
assert.ok(run(md.replace('Weekly demos.', '| observed |')).some((f) => f.includes('observed')));
|
|
108
92
|
});
|
|
@@ -138,7 +122,26 @@ test('the deny-list is lowercase and non-trivial', () => {
|
|
|
138
122
|
for (const term of JARGON) assert.equal(term, term.toLowerCase());
|
|
139
123
|
});
|
|
140
124
|
|
|
125
|
+
// This one is about the whole pipeline's crash-safety on a document with no
|
|
126
|
+
// frontmatter at all, not about client-safety specifically — checkProposal
|
|
127
|
+
// returns early before ever touching estimation shape, so it stays safe
|
|
128
|
+
// regardless of the scenario-vs-price schema.
|
|
141
129
|
test('a document with no frontmatter is a finding, not a crash', () => {
|
|
142
|
-
assert.deepEqual(checkProposal({ md: '## Executive Summary\nHi.', estimation, today:
|
|
130
|
+
assert.deepEqual(checkProposal({ md: '## Executive Summary\nHi.', estimation, today: new Date('2026-08-06') }),
|
|
143
131
|
['frontmatter: no frontmatter block']);
|
|
144
132
|
});
|
|
133
|
+
|
|
134
|
+
// R55/load-bearing: checkProposal must run the client-safety checks itself —
|
|
135
|
+
// frontmatter no longer carries a scenario key to gate on, so checkClient
|
|
136
|
+
// has to run whenever the estimate is priced. Break the gate in checks.mjs
|
|
137
|
+
// (e.g. restore the old `fm.scenario && estimation.computed.scenarios[...]`
|
|
138
|
+
// condition) and this test goes red because the invented figure below is
|
|
139
|
+
// never caught.
|
|
140
|
+
test('checkProposal refuses an invented money figure through the pipeline', () => {
|
|
141
|
+
const invented = md.replace(
|
|
142
|
+
'New booking system for $8,000 – $12,000.',
|
|
143
|
+
'New booking system for $8,000 – $12,000, plus a $6,500 setup fee.',
|
|
144
|
+
);
|
|
145
|
+
const findings = checkProposal({ md: invented, estimation, today: new Date('2026-08-06') });
|
|
146
|
+
assert.ok(findings.some((f) => f.includes('6,500')), findings.join('\n'));
|
|
147
|
+
});
|