@v11g/agents-rock 1.0.1 → 1.0.3
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 +58 -14
- package/package.json +7 -3
- package/plugins/business-analyst/.claude-plugin/plugin.json +9 -0
- package/plugins/business-analyst/skills/business-analyst/README.md +20 -0
- package/plugins/business-analyst/skills/business-analyst/SKILL.md +69 -0
- package/plugins/business-analyst/skills/business-analyst/references/ai-extension.md +37 -0
- package/plugins/business-analyst/skills/business-analyst/references/frameworks.md +53 -0
- package/plugins/business-analyst/skills/business-analyst/references/interview.md +89 -0
- package/plugins/business-analyst/skills/business-analyst/references/review.md +25 -0
- package/plugins/business-analyst/skills/business-analyst/references/writing.md +102 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/checks.mjs +166 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/schema.mjs +78 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/checks.test.mjs +188 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/e2e.test.mjs +17 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-fail.json +205 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-pass.json +59 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-pass.md +63 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/schema.test.mjs +41 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/validate.mjs +20 -0
- package/plugins/solution-architect/skills/analyze-requirements/README.md +1 -1
- package/plugins/solution-architect/skills/estimate/SKILL.md +13 -5
- package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +917 -0
- package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +430 -13
- package/plugins/solution-architect/skills/estimate/references/agentic-estimation.md +148 -0
- package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +10 -0
- package/plugins/solution-architect/skills/estimate/references/interview.md +20 -1
- package/plugins/solution-architect/skills/estimate/references/task-shapes.md +173 -0
- package/plugins/solution-architect/skills/estimate/references/writing.md +31 -0
- package/plugins/solution-architect/skills/estimate/scripts/compute.mjs +5 -1
- package/plugins/solution-architect/skills/estimate/scripts/lib/agentic-checks.mjs +65 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/baselines.mjs +107 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +16 -7
- package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +14 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/measurements.mjs +59 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +28 -5
- package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +53 -22
- package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +52 -7
- package/plugins/solution-architect/skills/estimate/scripts/render.mjs +14 -3
- package/plugins/solution-architect/skills/estimate/scripts/test/baselines.test.mjs +120 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +69 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +44 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +28 -1
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-fail.md +55 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-pass.md +54 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +45 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/measurements.jsonl +20 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/measurements.test.mjs +54 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +25 -1
- package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +48 -1
- package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +59 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +37 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +168 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/zip.mjs +41 -0
- package/plugins/solution-architect/skills/new-lead/SKILL.md +15 -10
- package/src/cli/agents.mjs +10 -10
- package/src/cli/args.mjs +22 -3
- package/src/cli/flow.mjs +85 -0
- package/src/cli/install.mjs +7 -8
- package/src/cli/main.mjs +30 -72
- package/src/cli/prompts.mjs +84 -0
- package/src/cli/report.mjs +26 -0
- package/src/cli/scope.mjs +34 -0
- package/src/cli/targets.mjs +45 -0
- package/src/cli/uninstall.mjs +9 -10
- package/src/cli/picker.mjs +0 -78
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { REGISTERS, STATUSES, AREAS, checkSchema } from './schema.mjs';
|
|
2
|
+
|
|
3
|
+
const LABELED = ['requirements', 'nfrs', 'integrations', 'data'];
|
|
4
|
+
const SOURCED = ['requirements', 'businessRules', 'constraints'];
|
|
5
|
+
|
|
6
|
+
export function collectIds(pkg) {
|
|
7
|
+
const ids = new Set((pkg.context?.goals ?? []).map((g) => g.id));
|
|
8
|
+
for (const [name] of REGISTERS) for (const row of pkg[name] ?? []) ids.add(row.id);
|
|
9
|
+
return ids;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function checkDuplicates(pkg) {
|
|
13
|
+
const findings = [];
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const rows = [...(pkg.context?.goals ?? []), ...REGISTERS.flatMap(([name]) => pkg[name] ?? [])];
|
|
16
|
+
for (const row of rows) {
|
|
17
|
+
if (seen.has(row.id)) findings.push(`duplicate id: ${row.id}`);
|
|
18
|
+
seen.add(row.id);
|
|
19
|
+
}
|
|
20
|
+
return findings;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function checkRefs(pkg, ids) {
|
|
24
|
+
const findings = [];
|
|
25
|
+
const miss = (owner, ref) => findings.push(`${owner}: dangling reference ${ref}`);
|
|
26
|
+
for (const fr of pkg.requirements ?? []) {
|
|
27
|
+
const t = fr.traces ?? {};
|
|
28
|
+
const refs = [t.goal, t.workflow, ...(t.rules ?? []), ...(fr.acceptance ?? [])];
|
|
29
|
+
for (const ref of refs) if (ref && !ids.has(ref)) miss(fr.id, ref);
|
|
30
|
+
}
|
|
31
|
+
for (const br of pkg.businessRules ?? []) {
|
|
32
|
+
if (br.openQuestion && !ids.has(br.openQuestion)) miss(br.id, br.openQuestion);
|
|
33
|
+
}
|
|
34
|
+
for (const sc of pkg.scenarios ?? []) if (!ids.has(sc.requirement)) miss(sc.id, sc.requirement);
|
|
35
|
+
for (const q of pkg.openQuestions ?? []) {
|
|
36
|
+
for (const ref of q.affects ?? []) if (!ids.has(ref)) miss(q.id, ref);
|
|
37
|
+
}
|
|
38
|
+
for (const ref of pkg.readiness?.blockers ?? []) if (!ids.has(ref)) miss('readiness.blockers', ref);
|
|
39
|
+
return findings;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function hasOpenQuestionFor(pkg, id) {
|
|
43
|
+
return (pkg.openQuestions ?? []).some((q) => (q.affects ?? []).includes(id));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function checkLabels(pkg) {
|
|
47
|
+
const findings = [];
|
|
48
|
+
for (const name of LABELED) {
|
|
49
|
+
for (const row of pkg[name] ?? []) if (!row.label) findings.push(`${row.id}: missing label`);
|
|
50
|
+
}
|
|
51
|
+
for (const name of SOURCED) {
|
|
52
|
+
for (const row of pkg[name] ?? []) if (!row.source) findings.push(`${row.id}: missing source`);
|
|
53
|
+
}
|
|
54
|
+
for (const fr of pkg.requirements ?? []) {
|
|
55
|
+
if (fr.label === 'recommended' && fr.scope === 'in' && !hasOpenQuestionFor(pkg, fr.id)) {
|
|
56
|
+
findings.push(`${fr.id}: recommended requirement in scope "in" without a paired open question`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return findings;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const AMBIGUOUS = [
|
|
63
|
+
'fast', 'quick', 'easy', 'simple', 'user-friendly', 'intuitive', 'flexible',
|
|
64
|
+
'robust', 'seamless', 'efficient', 'optimal', 'appropriate', 'various',
|
|
65
|
+
'etc', 'some', 'many', 'several', 'as needed',
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
export function checkAmbiguity(pkg) {
|
|
69
|
+
const findings = [];
|
|
70
|
+
for (const row of [...(pkg.requirements ?? []), ...(pkg.nfrs ?? [])]) {
|
|
71
|
+
for (const word of AMBIGUOUS) {
|
|
72
|
+
const re = new RegExp(`\\b${word.replace(/[-\s]/g, '[-\\s]')}\\b`, 'i');
|
|
73
|
+
if (re.test(row.text ?? '')) {
|
|
74
|
+
findings.push(`${row.id}: ambiguous term "${word}" — replace with a measurable statement`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return findings;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function checkReadiness(pkg) {
|
|
82
|
+
const findings = [];
|
|
83
|
+
const r = pkg.readiness ?? {};
|
|
84
|
+
const values = AREAS.map((a) => r.areas?.[a]).filter((v) => typeof v === 'number');
|
|
85
|
+
if (values.length !== AREAS.length) findings.push('readiness.areas: missing area score');
|
|
86
|
+
const mean = Math.round(values.reduce((s, v) => s + v, 0) / (values.length || 1));
|
|
87
|
+
if (r.overall !== mean) findings.push(`readiness.overall ${r.overall} != recomputed mean ${mean}`);
|
|
88
|
+
const openBlockers = (pkg.openQuestions ?? []).filter((q) => q.status === 'open' && q.architectureBlocker);
|
|
89
|
+
if (openBlockers.length && STATUSES.indexOf(pkg.status) > STATUSES.indexOf('ANALYZED')) {
|
|
90
|
+
findings.push(`status ${pkg.status} with open architecture blockers: ${openBlockers.map((q) => q.id).join(', ')}`);
|
|
91
|
+
}
|
|
92
|
+
for (const q of openBlockers) {
|
|
93
|
+
if (!(r.blockers ?? []).includes(q.id)) findings.push(`readiness.blockers missing ${q.id}`);
|
|
94
|
+
}
|
|
95
|
+
const risky = (pkg.assumptions ?? []).filter((a) => a.impact === 'high' && a.status === 'unconfirmed');
|
|
96
|
+
if (pkg.status === 'READY_FOR_ARCHITECTURE' && risky.length) {
|
|
97
|
+
findings.push(`READY_FOR_ARCHITECTURE with unconfirmed high-impact assumptions: ${risky.map((a) => a.id).join(', ')}`);
|
|
98
|
+
}
|
|
99
|
+
if (pkg.status === 'READY_FOR_ARCHITECTURE' && (pkg.conflicts ?? []).some((c) => c.status === 'open')) {
|
|
100
|
+
findings.push('READY_FOR_ARCHITECTURE with open conflicts');
|
|
101
|
+
}
|
|
102
|
+
return findings;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const PARTS = ['Part 1', 'Part 2', 'Part 3', 'Part 4', 'Part 5'];
|
|
106
|
+
const QUICK_PARTS = ['Part 1', 'Part 3', 'Part 5'];
|
|
107
|
+
const ID_TOKEN = /\b(?:G|ACT|WF|FR|BR|SC|NFR|INT|DAT|CON|ASM|Q|CONFLICT)-\d{3}\b/g;
|
|
108
|
+
|
|
109
|
+
function sectionBodies(md) {
|
|
110
|
+
const bodies = {};
|
|
111
|
+
for (const chunk of md.split(/^## /m).slice(1)) {
|
|
112
|
+
const nl = chunk.indexOf('\n');
|
|
113
|
+
const title = nl === -1 ? chunk.trim() : chunk.slice(0, nl).trim();
|
|
114
|
+
const body = nl === -1 ? '' : chunk.slice(nl + 1);
|
|
115
|
+
bodies[title] = body;
|
|
116
|
+
}
|
|
117
|
+
return bodies;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function checkMd(pkg, md) {
|
|
121
|
+
const findings = [];
|
|
122
|
+
if (/\[TODO\]|\bTBD\b|\bXXX\b/.test(md)) findings.push('md: placeholder found ([TODO]/TBD/XXX)');
|
|
123
|
+
const bodies = sectionBodies(md);
|
|
124
|
+
const required = pkg.depth === 'QUICK' ? QUICK_PARTS : PARTS;
|
|
125
|
+
for (const part of required) {
|
|
126
|
+
const key = Object.keys(bodies).find((h) => h.startsWith(part));
|
|
127
|
+
if (!key) findings.push(`md: missing section "## ${part}"`);
|
|
128
|
+
else if (!bodies[key].trim()) findings.push(`md: empty section "## ${part}"`);
|
|
129
|
+
}
|
|
130
|
+
const mdIds = new Set([...md.matchAll(ID_TOKEN)].map((m) => m[0]));
|
|
131
|
+
for (const id of collectIds(pkg)) {
|
|
132
|
+
if (!mdIds.has(id)) findings.push(`md: id ${id} absent from requirements.md`);
|
|
133
|
+
}
|
|
134
|
+
const fmStatus = md.match(/^status:\s*(\S+)/m)?.[1];
|
|
135
|
+
if (fmStatus !== pkg.status) findings.push(`md frontmatter status ${fmStatus} != json status ${pkg.status}`);
|
|
136
|
+
const fmDepth = md.match(/^depth:\s*(\S+)/m)?.[1];
|
|
137
|
+
if (fmDepth !== pkg.depth) findings.push(`md frontmatter depth ${fmDepth} != json depth ${pkg.depth}`);
|
|
138
|
+
const fmReadiness = Number(md.match(/^readiness:\s*(\d+)/m)?.[1]);
|
|
139
|
+
if (fmReadiness !== pkg.readiness?.overall) {
|
|
140
|
+
findings.push(`md frontmatter readiness ${fmReadiness} != json readiness.overall ${pkg.readiness?.overall}`);
|
|
141
|
+
}
|
|
142
|
+
return findings;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function checkMdOrphanIds(pkg, md, ids) {
|
|
146
|
+
const findings = [];
|
|
147
|
+
for (const m of md.matchAll(ID_TOKEN)) {
|
|
148
|
+
if (!ids.has(m[0])) findings.push(`md: unknown id ${m[0]}`);
|
|
149
|
+
}
|
|
150
|
+
return findings;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function checkPackage({ pkg, md }) {
|
|
154
|
+
const schemaFindings = checkSchema(pkg);
|
|
155
|
+
if (schemaFindings.length) return schemaFindings;
|
|
156
|
+
const ids = collectIds(pkg);
|
|
157
|
+
return [
|
|
158
|
+
...checkDuplicates(pkg),
|
|
159
|
+
...checkRefs(pkg, ids),
|
|
160
|
+
...checkLabels(pkg),
|
|
161
|
+
...checkAmbiguity(pkg),
|
|
162
|
+
...checkReadiness(pkg),
|
|
163
|
+
...checkMd(pkg, md),
|
|
164
|
+
...checkMdOrphanIds(pkg, md, ids),
|
|
165
|
+
];
|
|
166
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const STATUSES = ['DRAFT', 'CLARIFICATION_REQUIRED', 'ANALYZED', 'VALIDATED', 'READY_FOR_ARCHITECTURE'];
|
|
2
|
+
export const DEPTHS = ['QUICK', 'STANDARD', 'DEEP'];
|
|
3
|
+
export const MODES = ['greenfield', 'existing'];
|
|
4
|
+
export const LABELS = ['confirmed', 'assumed', 'recommended'];
|
|
5
|
+
export const PRIORITIES = ['P1', 'P2', 'P3'];
|
|
6
|
+
export const FR_SCOPES = ['in', 'out', 'future', 'unconfirmed'];
|
|
7
|
+
export const AREAS = ['businessContext', 'workflows', 'rules', 'integrations', 'data', 'nfrs'];
|
|
8
|
+
|
|
9
|
+
export const REGISTERS = [
|
|
10
|
+
['actors', /^ACT-\d{3}$/],
|
|
11
|
+
['workflows', /^WF-\d{3}$/],
|
|
12
|
+
['requirements', /^FR-\d{3}$/],
|
|
13
|
+
['businessRules', /^BR-\d{3}$/],
|
|
14
|
+
['scenarios', /^SC-\d{3}$/],
|
|
15
|
+
['nfrs', /^NFR-\d{3}$/],
|
|
16
|
+
['integrations', /^INT-\d{3}$/],
|
|
17
|
+
['data', /^DAT-\d{3}$/],
|
|
18
|
+
['constraints', /^CON-\d{3}$/],
|
|
19
|
+
['assumptions', /^ASM-\d{3}$/],
|
|
20
|
+
['openQuestions', /^Q-\d{3}$/],
|
|
21
|
+
['conflicts', /^CONFLICT-\d{3}$/],
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const REQUIRED = ['schemaVersion', 'lead', 'status', 'depth', 'updated', 'mode', 'context', 'scope', 'ai', 'readiness'];
|
|
25
|
+
const TOP_ENUMS = [['status', STATUSES], ['depth', DEPTHS], ['mode', MODES]];
|
|
26
|
+
|
|
27
|
+
const ROW_ENUMS = [
|
|
28
|
+
['requirements', 'label', LABELS],
|
|
29
|
+
['requirements', 'scope', FR_SCOPES],
|
|
30
|
+
['nfrs', 'label', LABELS],
|
|
31
|
+
['integrations', 'label', LABELS],
|
|
32
|
+
['integrations', 'direction', ['read', 'write', 'both']],
|
|
33
|
+
['data', 'label', LABELS],
|
|
34
|
+
['scenarios', 'type', ['happy', 'edge', 'error']],
|
|
35
|
+
['assumptions', 'impact', ['high', 'medium', 'low']],
|
|
36
|
+
['assumptions', 'status', ['unconfirmed', 'accepted', 'resolved']],
|
|
37
|
+
['openQuestions', 'priority', PRIORITIES],
|
|
38
|
+
['openQuestions', 'status', ['open', 'answered']],
|
|
39
|
+
['conflicts', 'status', ['open', 'resolved']],
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
function checkTopLevel(pkg) {
|
|
43
|
+
const findings = [];
|
|
44
|
+
for (const f of REQUIRED) if (!(f in pkg)) findings.push(`missing required field: ${f}`);
|
|
45
|
+
for (const [f, legal] of TOP_ENUMS) {
|
|
46
|
+
if (f in pkg && !legal.includes(pkg[f])) findings.push(`illegal ${f}: ${pkg[f]}`);
|
|
47
|
+
}
|
|
48
|
+
return findings;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function checkIds(pkg) {
|
|
52
|
+
const findings = [];
|
|
53
|
+
for (const g of pkg.context?.goals ?? []) {
|
|
54
|
+
if (!/^G-\d{3}$/.test(g.id ?? '')) findings.push(`context.goals: bad id ${g.id}`);
|
|
55
|
+
}
|
|
56
|
+
for (const [name, re] of REGISTERS) {
|
|
57
|
+
for (const row of pkg[name] ?? []) {
|
|
58
|
+
if (!re.test(row.id ?? '')) findings.push(`${name}: bad id ${row.id}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return findings;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function checkRowEnums(pkg) {
|
|
65
|
+
const findings = [];
|
|
66
|
+
for (const [name, field, legal] of ROW_ENUMS) {
|
|
67
|
+
for (const row of pkg[name] ?? []) {
|
|
68
|
+
if (row[field] !== undefined && !legal.includes(row[field])) {
|
|
69
|
+
findings.push(`${row.id}: illegal ${field} "${row[field]}"`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return findings;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function checkSchema(pkg) {
|
|
77
|
+
return [...checkTopLevel(pkg), ...checkIds(pkg), ...checkRowEnums(pkg)];
|
|
78
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { collectIds, checkDuplicates, checkRefs, checkLabels, checkAmbiguity, checkReadiness, checkPackage } from '../lib/checks.mjs';
|
|
5
|
+
|
|
6
|
+
const load = () =>
|
|
7
|
+
JSON.parse(readFileSync(new URL('./fixtures/requirements-pass.json', import.meta.url), 'utf8'));
|
|
8
|
+
|
|
9
|
+
const loadMd = () =>
|
|
10
|
+
readFileSync(new URL('./fixtures/requirements-pass.md', import.meta.url), 'utf8');
|
|
11
|
+
|
|
12
|
+
test('the pass fixture has no integrity findings', () => {
|
|
13
|
+
const pkg = load();
|
|
14
|
+
const ids = collectIds(pkg);
|
|
15
|
+
assert.deepEqual(
|
|
16
|
+
[...checkDuplicates(pkg), ...checkRefs(pkg, ids), ...checkLabels(pkg)], []);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('a duplicate id is refused', () => {
|
|
20
|
+
const pkg = load();
|
|
21
|
+
pkg.assumptions.push({ ...pkg.assumptions[0] });
|
|
22
|
+
assert.ok(checkDuplicates(pkg).some((f) => f.includes('duplicate id: ASM-001')));
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('a dangling trace reference is refused', () => {
|
|
26
|
+
const pkg = load();
|
|
27
|
+
pkg.requirements[0].traces.rules = ['BR-999'];
|
|
28
|
+
assert.ok(checkRefs(pkg, collectIds(pkg)).some((f) => f.includes('FR-001') && f.includes('BR-999')));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('a dangling readiness blocker is refused', () => {
|
|
32
|
+
const pkg = load();
|
|
33
|
+
pkg.readiness.blockers.push('Q-404');
|
|
34
|
+
assert.ok(checkRefs(pkg, collectIds(pkg)).some((f) => f.includes('Q-404')));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('a requirement without a label is refused', () => {
|
|
38
|
+
const pkg = load();
|
|
39
|
+
delete pkg.requirements[1].label;
|
|
40
|
+
assert.ok(checkLabels(pkg).some((f) => f.includes('FR-002') && f.includes('missing label')));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('a business rule without a source is refused', () => {
|
|
44
|
+
const pkg = load();
|
|
45
|
+
delete pkg.businessRules[0].source;
|
|
46
|
+
assert.ok(checkLabels(pkg).some((f) => f.includes('BR-001') && f.includes('missing source')));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('a recommended requirement in scope "in" needs a paired open question', () => {
|
|
50
|
+
const pkg = load();
|
|
51
|
+
pkg.requirements[1].label = 'recommended';
|
|
52
|
+
assert.ok(checkLabels(pkg).some((f) => f.includes('FR-002') && f.includes('open question')));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('the pass fixture has no ambiguity or readiness findings', () => {
|
|
56
|
+
const pkg = load();
|
|
57
|
+
assert.deepEqual([...checkAmbiguity(pkg), ...checkReadiness(pkg)], []);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('a vague requirement is flagged with its id and the term', () => {
|
|
61
|
+
const pkg = load();
|
|
62
|
+
pkg.requirements[0].text = 'The system must be fast and user-friendly.';
|
|
63
|
+
const findings = checkAmbiguity(pkg);
|
|
64
|
+
assert.ok(findings.some((f) => f.includes('FR-001') && f.includes('"fast"')));
|
|
65
|
+
assert.ok(findings.some((f) => f.includes('FR-001') && f.includes('"user-friendly"')));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('a vague nfr is flagged', () => {
|
|
69
|
+
const pkg = load();
|
|
70
|
+
pkg.nfrs[0].text = 'The system should be robust.';
|
|
71
|
+
assert.ok(checkAmbiguity(pkg).some((f) => f.includes('NFR-001') && f.includes('"robust"')));
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('a hand-edited readiness overall is refused', () => {
|
|
75
|
+
const pkg = load();
|
|
76
|
+
pkg.readiness.overall = 95;
|
|
77
|
+
assert.ok(checkReadiness(pkg).some((f) => f.includes('recomputed')));
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('a missing area score is refused', () => {
|
|
81
|
+
const pkg = load();
|
|
82
|
+
delete pkg.readiness.areas.data;
|
|
83
|
+
assert.ok(checkReadiness(pkg).some((f) => f.includes('missing area score')));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('status past ANALYZED with an open architecture blocker is refused', () => {
|
|
87
|
+
const pkg = load();
|
|
88
|
+
pkg.status = 'VALIDATED';
|
|
89
|
+
assert.ok(checkReadiness(pkg).some((f) => f.includes('VALIDATED') && f.includes('Q-001')));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('an open architecture blocker missing from readiness.blockers is refused', () => {
|
|
93
|
+
const pkg = load();
|
|
94
|
+
pkg.readiness.blockers = ['ASM-001'];
|
|
95
|
+
assert.ok(checkReadiness(pkg).some((f) => f.includes('blockers missing') && f.includes('Q-001')));
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('READY with an unconfirmed high-impact assumption is refused', () => {
|
|
99
|
+
const pkg = load();
|
|
100
|
+
pkg.status = 'READY_FOR_ARCHITECTURE';
|
|
101
|
+
assert.ok(checkReadiness(pkg).some((f) => f.includes('high-impact assumptions') && f.includes('ASM-001')));
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('READY with an open conflict is refused', () => {
|
|
105
|
+
const pkg = load();
|
|
106
|
+
pkg.status = 'READY_FOR_ARCHITECTURE';
|
|
107
|
+
pkg.conflicts.push({ id: 'CONFLICT-001', topic: 'approval', statements: ['A: all', 'B: under $1,000 auto'], status: 'open' });
|
|
108
|
+
assert.ok(checkReadiness(pkg).some((f) => f.includes('open conflicts')));
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test('the pass pair passes checkPackage end to end', () => {
|
|
112
|
+
assert.deepEqual(checkPackage({ pkg: load(), md: loadMd() }), []);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('schema findings short-circuit the deeper checks', () => {
|
|
116
|
+
const pkg = load();
|
|
117
|
+
delete pkg.readiness;
|
|
118
|
+
const findings = checkPackage({ pkg, md: loadMd() });
|
|
119
|
+
assert.ok(findings.some((f) => f.includes('readiness')));
|
|
120
|
+
assert.ok(!findings.some((f) => f.includes('recomputed')));
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('a placeholder in the md is refused', () => {
|
|
124
|
+
const findings = checkPackage({ pkg: load(), md: loadMd() + '\nTBD\n' });
|
|
125
|
+
assert.ok(findings.some((f) => f.includes('placeholder')));
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('a missing required section is refused', () => {
|
|
129
|
+
const md = loadMd().replace('## Part 4 — Acceptance Scenarios', '## Acceptance');
|
|
130
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('Part 4')));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('QUICK depth requires only parts 1, 3 and 5', () => {
|
|
134
|
+
const pkg = load();
|
|
135
|
+
pkg.depth = 'QUICK';
|
|
136
|
+
const md = loadMd()
|
|
137
|
+
.replace(/## Part 2[\s\S]*?(?=## Part 3)/, '')
|
|
138
|
+
.replace(/## Part 4[\s\S]*?(?=## Part 5)/, '')
|
|
139
|
+
.replace('depth: STANDARD', 'depth: QUICK');
|
|
140
|
+
const findings = checkPackage({ pkg, md });
|
|
141
|
+
assert.ok(!findings.some((f) => f.includes('Part 2') || f.includes('Part 4')));
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('a json id absent from the md is refused', () => {
|
|
145
|
+
const md = loadMd().replaceAll('ASM-001', 'ASM-0O1');
|
|
146
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('ASM-001') && f.includes('absent')));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('an unknown id in the md is refused', () => {
|
|
150
|
+
const md = loadMd() + '\nSee FR-042 for details.\n';
|
|
151
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('unknown id FR-042')));
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('a frontmatter status mismatch is refused', () => {
|
|
155
|
+
const md = loadMd().replace('status: CLARIFICATION_REQUIRED', 'status: VALIDATED');
|
|
156
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('frontmatter status')));
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('a frontmatter readiness mismatch is refused', () => {
|
|
160
|
+
const md = loadMd().replace('readiness: 73', 'readiness: 99');
|
|
161
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('frontmatter readiness')));
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test('a frontmatter depth mismatch is refused', () => {
|
|
165
|
+
const md = loadMd().replace('depth: STANDARD', 'depth: DEEP');
|
|
166
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('frontmatter depth')));
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('a dropped FR-001 is not masked by NFR-001 substring match', () => {
|
|
170
|
+
const md = loadMd()
|
|
171
|
+
.replace(/\| FR-001 \|[^\n]*\n/, '')
|
|
172
|
+
.replace('(FR-001)', '(FR-002)');
|
|
173
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('FR-001') && f.includes('absent')));
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('a heading at eof with no trailing newline is an empty section', () => {
|
|
177
|
+
const md = loadMd().replace(/## Part 5[\s\S]*$/, '## Part 5 — Readiness Report');
|
|
178
|
+
const findings = checkPackage({ pkg: load(), md });
|
|
179
|
+
assert.ok(findings.some((f) => f.includes('empty section') && f.includes('Part 5')));
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test('a blank Part 4 section body is an empty section', () => {
|
|
183
|
+
const md = loadMd().replace(
|
|
184
|
+
/(## Part 4 — Acceptance Scenarios\n)[\s\S]*?(?=## Part 5)/,
|
|
185
|
+
'$1\n\n',
|
|
186
|
+
);
|
|
187
|
+
assert.ok(checkPackage({ pkg: load(), md }).some((f) => f.includes('empty section') && f.includes('Part 4')));
|
|
188
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const script = fileURLToPath(new URL('../validate.mjs', import.meta.url));
|
|
7
|
+
const fx = (f) => fileURLToPath(new URL(`./fixtures/${f}`, import.meta.url));
|
|
8
|
+
const run = (json, md) =>
|
|
9
|
+
execFileSync('node', [script, '--json', fx(json), '--md', fx(md)], { encoding: 'utf8' });
|
|
10
|
+
|
|
11
|
+
test('validate.mjs exits 0 on the pass pair', () => {
|
|
12
|
+
assert.match(run('requirements-pass.json', 'requirements-pass.md'), /requirements package valid/);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('validate.mjs exits non-zero on a broken package', () => {
|
|
16
|
+
assert.throws(() => run('requirements-fail.json', 'requirements-pass.md'));
|
|
17
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0",
|
|
3
|
+
"lead": "acme-crm",
|
|
4
|
+
"status": "CLARIFICATION_REQUIRED",
|
|
5
|
+
"depth": "STANDARD",
|
|
6
|
+
"updated": "2026-08-27",
|
|
7
|
+
"mode": "existing",
|
|
8
|
+
"context": {
|
|
9
|
+
"problem": "Invoice approval is manual; finance spends 3 days per cycle chasing approvers.",
|
|
10
|
+
"goals": [
|
|
11
|
+
{
|
|
12
|
+
"id": "G-001",
|
|
13
|
+
"goal": "Cut invoice approval cycle time",
|
|
14
|
+
"metric": "median cycle < 1 day",
|
|
15
|
+
"source": "kickoff call 2026-08-20"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"successMetrics": [
|
|
19
|
+
"median approval cycle time under 1 day within 3 months"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"actors": [
|
|
23
|
+
{
|
|
24
|
+
"id": "ACT-001",
|
|
25
|
+
"name": "Finance Officer",
|
|
26
|
+
"type": "human",
|
|
27
|
+
"goal": "process invoices without chasing approvers",
|
|
28
|
+
"painPoints": [
|
|
29
|
+
"chasing approvers by email"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "ACT-002",
|
|
34
|
+
"name": "Manager",
|
|
35
|
+
"type": "human",
|
|
36
|
+
"goal": "approve high-value invoices",
|
|
37
|
+
"painPoints": [
|
|
38
|
+
"no visibility of the pending queue"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"workflows": [
|
|
43
|
+
{
|
|
44
|
+
"id": "WF-001",
|
|
45
|
+
"name": "Invoice approval",
|
|
46
|
+
"state": "as-is",
|
|
47
|
+
"trigger": "invoice received by email",
|
|
48
|
+
"steps": [
|
|
49
|
+
"finance officer logs invoice",
|
|
50
|
+
"emails manager for approval",
|
|
51
|
+
"manager replies",
|
|
52
|
+
"officer pays"
|
|
53
|
+
],
|
|
54
|
+
"exceptions": [
|
|
55
|
+
"manager on leave: invoice waits"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"requirements": [
|
|
60
|
+
{
|
|
61
|
+
"id": "FR-001",
|
|
62
|
+
"text": "The system must route invoices above the approval threshold to a manager for approval.",
|
|
63
|
+
"label": "confirmed",
|
|
64
|
+
"source": "kickoff call 2026-08-20",
|
|
65
|
+
"traces": {
|
|
66
|
+
"goal": "G-001",
|
|
67
|
+
"workflow": "WF-001",
|
|
68
|
+
"rules": [
|
|
69
|
+
"BR-999"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"scope": "in",
|
|
73
|
+
"acceptance": [
|
|
74
|
+
"SC-001",
|
|
75
|
+
"SC-002"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "FR-002",
|
|
80
|
+
"text": "The system must be user-friendly and record audit trails as needed.",
|
|
81
|
+
"label": "assumed",
|
|
82
|
+
"source": "compliance mention in meeting notes 2026-08-21",
|
|
83
|
+
"traces": {
|
|
84
|
+
"goal": "G-001",
|
|
85
|
+
"workflow": "WF-001",
|
|
86
|
+
"rules": []
|
|
87
|
+
},
|
|
88
|
+
"scope": "in",
|
|
89
|
+
"acceptance": []
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"businessRules": [
|
|
93
|
+
{
|
|
94
|
+
"id": "BR-001",
|
|
95
|
+
"rule": "Invoices above $10,000 require manager approval.",
|
|
96
|
+
"source": "kickoff call 2026-08-20",
|
|
97
|
+
"examples": [
|
|
98
|
+
"$8,000 -> no approval",
|
|
99
|
+
"$15,000 -> approval required"
|
|
100
|
+
],
|
|
101
|
+
"openQuestion": "Q-001"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"scenarios": [
|
|
105
|
+
{
|
|
106
|
+
"id": "SC-001",
|
|
107
|
+
"requirement": "FR-001",
|
|
108
|
+
"type": "happy",
|
|
109
|
+
"given": "an invoice of $15,000",
|
|
110
|
+
"when": "the invoice is submitted",
|
|
111
|
+
"then": "manager approval is requested"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"id": "SC-002",
|
|
115
|
+
"requirement": "FR-001",
|
|
116
|
+
"type": "edge",
|
|
117
|
+
"given": "an invoice of exactly $10,000",
|
|
118
|
+
"when": "the invoice is submitted",
|
|
119
|
+
"then": "no approval is requested"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"nfrs": [
|
|
123
|
+
{
|
|
124
|
+
"id": "NFR-001",
|
|
125
|
+
"area": "auditability",
|
|
126
|
+
"text": "Approval decisions must be retained for 7 years.",
|
|
127
|
+
"label": "assumed"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"integrations": [
|
|
131
|
+
{
|
|
132
|
+
"id": "INT-001",
|
|
133
|
+
"system": "Xero",
|
|
134
|
+
"direction": "read",
|
|
135
|
+
"label": "confirmed"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"data": [
|
|
139
|
+
{
|
|
140
|
+
"id": "DAT-001",
|
|
141
|
+
"entity": "Invoice",
|
|
142
|
+
"sensitivity": "financial",
|
|
143
|
+
"volume": "about 400 per month",
|
|
144
|
+
"label": "confirmed"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"constraints": [
|
|
148
|
+
{
|
|
149
|
+
"id": "CON-001",
|
|
150
|
+
"text": "Must run inside the client's existing Microsoft 365 tenant.",
|
|
151
|
+
"source": "client IT policy document"
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"assumptions": [
|
|
155
|
+
{
|
|
156
|
+
"id": "ASM-001",
|
|
157
|
+
"text": "Managers authenticate through Microsoft Entra.",
|
|
158
|
+
"impact": "high",
|
|
159
|
+
"status": "unconfirmed"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"openQuestions": [
|
|
163
|
+
{
|
|
164
|
+
"id": "Q-001",
|
|
165
|
+
"question": "Is the $10,000 threshold in local currency or USD equivalent?",
|
|
166
|
+
"priority": "P1",
|
|
167
|
+
"reason": "changes the approval rule for multi-currency invoices",
|
|
168
|
+
"affects": [
|
|
169
|
+
"BR-001",
|
|
170
|
+
"FR-001"
|
|
171
|
+
],
|
|
172
|
+
"status": "open",
|
|
173
|
+
"answer": null,
|
|
174
|
+
"architectureBlocker": true
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"conflicts": [],
|
|
178
|
+
"scope": {
|
|
179
|
+
"out": [
|
|
180
|
+
"payment execution"
|
|
181
|
+
],
|
|
182
|
+
"future": [
|
|
183
|
+
"mobile approvals"
|
|
184
|
+
],
|
|
185
|
+
"unconfirmed": [
|
|
186
|
+
"multi-entity support"
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"ai": null,
|
|
190
|
+
"readiness": {
|
|
191
|
+
"overall": 95,
|
|
192
|
+
"areas": {
|
|
193
|
+
"businessContext": 90,
|
|
194
|
+
"workflows": 80,
|
|
195
|
+
"rules": 70,
|
|
196
|
+
"integrations": 60,
|
|
197
|
+
"data": 70,
|
|
198
|
+
"nfrs": 70
|
|
199
|
+
},
|
|
200
|
+
"blockers": [
|
|
201
|
+
"Q-001",
|
|
202
|
+
"ASM-001"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
}
|