@v11g/agents-rock 1.0.2 → 1.0.4
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 +4 -2
- package/package.json +1 -1
- package/plugins/business-analyst/.claude-plugin/plugin.json +9 -0
- package/plugins/business-analyst/skills/business-analyst/README.md +23 -0
- package/plugins/business-analyst/skills/business-analyst/SKILL.md +73 -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/python-parity.test.mjs +50 -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/business-analyst/skills/business-analyst/scripts/validate.py +288 -0
- package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +4 -2
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs +4 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +3 -2
- 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/plugins/solution-architect/skills/new-lead/assets/dashboard/detail.html +25 -50
- package/plugins/solution-architect/skills/new-lead/assets/dashboard/index.html +20 -40
- package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +12 -4
- package/plugins/solution-architect/skills/new-lead/scripts/serve.mjs +8 -3
- package/plugins/solution-architect/skills/new-lead/scripts/test/map.test.mjs +4 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/serve.test.mjs +25 -21
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
{ "id": "G-001", "goal": "Cut invoice approval cycle time", "metric": "median cycle < 1 day", "source": "kickoff call 2026-08-20" }
|
|
12
|
+
],
|
|
13
|
+
"successMetrics": ["median approval cycle time under 1 day within 3 months"]
|
|
14
|
+
},
|
|
15
|
+
"actors": [
|
|
16
|
+
{ "id": "ACT-001", "name": "Finance Officer", "type": "human", "goal": "process invoices without chasing approvers", "painPoints": ["chasing approvers by email"] },
|
|
17
|
+
{ "id": "ACT-002", "name": "Manager", "type": "human", "goal": "approve high-value invoices", "painPoints": ["no visibility of the pending queue"] }
|
|
18
|
+
],
|
|
19
|
+
"workflows": [
|
|
20
|
+
{ "id": "WF-001", "name": "Invoice approval", "state": "as-is", "trigger": "invoice received by email", "steps": ["finance officer logs invoice", "emails manager for approval", "manager replies", "officer pays"], "exceptions": ["manager on leave: invoice waits"] }
|
|
21
|
+
],
|
|
22
|
+
"requirements": [
|
|
23
|
+
{ "id": "FR-001", "text": "The system must route invoices above the approval threshold to a manager for approval.", "label": "confirmed", "source": "kickoff call 2026-08-20", "traces": { "goal": "G-001", "workflow": "WF-001", "rules": ["BR-001"] }, "scope": "in", "acceptance": ["SC-001", "SC-002"] },
|
|
24
|
+
{ "id": "FR-002", "text": "The system must record an audit trail of every approval decision.", "label": "assumed", "source": "compliance mention in meeting notes 2026-08-21", "traces": { "goal": "G-001", "workflow": "WF-001", "rules": [] }, "scope": "in", "acceptance": [] }
|
|
25
|
+
],
|
|
26
|
+
"businessRules": [
|
|
27
|
+
{ "id": "BR-001", "rule": "Invoices above $10,000 require manager approval.", "source": "kickoff call 2026-08-20", "examples": ["$8,000 -> no approval", "$15,000 -> approval required"], "openQuestion": "Q-001" }
|
|
28
|
+
],
|
|
29
|
+
"scenarios": [
|
|
30
|
+
{ "id": "SC-001", "requirement": "FR-001", "type": "happy", "given": "an invoice of $15,000", "when": "the invoice is submitted", "then": "manager approval is requested" },
|
|
31
|
+
{ "id": "SC-002", "requirement": "FR-001", "type": "edge", "given": "an invoice of exactly $10,000", "when": "the invoice is submitted", "then": "no approval is requested" }
|
|
32
|
+
],
|
|
33
|
+
"nfrs": [
|
|
34
|
+
{ "id": "NFR-001", "area": "auditability", "text": "Approval decisions must be retained for 7 years.", "label": "assumed" }
|
|
35
|
+
],
|
|
36
|
+
"integrations": [
|
|
37
|
+
{ "id": "INT-001", "system": "Xero", "direction": "read", "label": "confirmed" }
|
|
38
|
+
],
|
|
39
|
+
"data": [
|
|
40
|
+
{ "id": "DAT-001", "entity": "Invoice", "sensitivity": "financial", "volume": "about 400 per month", "label": "confirmed" }
|
|
41
|
+
],
|
|
42
|
+
"constraints": [
|
|
43
|
+
{ "id": "CON-001", "text": "Must run inside the client's existing Microsoft 365 tenant.", "source": "client IT policy document" }
|
|
44
|
+
],
|
|
45
|
+
"assumptions": [
|
|
46
|
+
{ "id": "ASM-001", "text": "Managers authenticate through Microsoft Entra.", "impact": "high", "status": "unconfirmed" }
|
|
47
|
+
],
|
|
48
|
+
"openQuestions": [
|
|
49
|
+
{ "id": "Q-001", "question": "Is the $10,000 threshold in local currency or USD equivalent?", "priority": "P1", "reason": "changes the approval rule for multi-currency invoices", "affects": ["BR-001", "FR-001"], "status": "open", "answer": null, "architectureBlocker": true }
|
|
50
|
+
],
|
|
51
|
+
"conflicts": [],
|
|
52
|
+
"scope": { "out": ["payment execution"], "future": ["mobile approvals"], "unconfirmed": ["multi-entity support"] },
|
|
53
|
+
"ai": null,
|
|
54
|
+
"readiness": {
|
|
55
|
+
"overall": 73,
|
|
56
|
+
"areas": { "businessContext": 90, "workflows": 80, "rules": 70, "integrations": 60, "data": 70, "nfrs": 70 },
|
|
57
|
+
"blockers": ["Q-001", "ASM-001"]
|
|
58
|
+
}
|
|
59
|
+
}
|
package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-pass.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
lead: acme-crm
|
|
3
|
+
status: CLARIFICATION_REQUIRED
|
|
4
|
+
depth: STANDARD
|
|
5
|
+
updated: 2026-08-27
|
|
6
|
+
readiness: 73
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Requirements — Acme CRM invoice approval
|
|
10
|
+
|
|
11
|
+
## Part 1 — Discovery Brief
|
|
12
|
+
|
|
13
|
+
Problem: invoice approval is manual; finance spends 3 days per cycle chasing approvers.
|
|
14
|
+
|
|
15
|
+
| ID | Goal | Metric |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| G-001 | Cut invoice approval cycle time | median cycle < 1 day |
|
|
18
|
+
|
|
19
|
+
Benefit hypothesis: we believe automated approval routing (FR-001) will cut cycle
|
|
20
|
+
time, measured by a median approval cycle under 1 day within 3 months.
|
|
21
|
+
|
|
22
|
+
Constraints: CON-001 — must run inside the client's existing Microsoft 365 tenant.
|
|
23
|
+
|
|
24
|
+
## Part 2 — Process & Domain
|
|
25
|
+
|
|
26
|
+
As-is workflow WF-001 (invoice approval): invoice received by email → finance
|
|
27
|
+
officer (ACT-001) logs the invoice → emails the manager (ACT-002) for approval →
|
|
28
|
+
manager replies → officer pays. Exception: manager on leave — the invoice waits.
|
|
29
|
+
|
|
30
|
+
| ID | Rule | Examples |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| BR-001 | Invoices above $10,000 require manager approval | $8,000 → no approval; $15,000 → approval required |
|
|
33
|
+
|
|
34
|
+
## Part 3 — Requirements
|
|
35
|
+
|
|
36
|
+
Scope — out: payment execution. Future: mobile approvals. Unconfirmed: multi-entity support.
|
|
37
|
+
|
|
38
|
+
| ID | Requirement | Label | Scope |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| FR-001 | Route invoices above the approval threshold to a manager | confirmed | in |
|
|
41
|
+
| FR-002 | Record an audit trail of every approval decision | assumed | in |
|
|
42
|
+
|
|
43
|
+
NFR-001 (auditability, assumed): approval decisions retained for 7 years.
|
|
44
|
+
INT-001: read invoices from Xero (confirmed).
|
|
45
|
+
DAT-001: Invoice — financial sensitivity, about 400 per month (confirmed).
|
|
46
|
+
|
|
47
|
+
## Part 4 — Acceptance Scenarios
|
|
48
|
+
|
|
49
|
+
| ID | Given | When | Then |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
| SC-001 | an invoice of $15,000 | the invoice is submitted | manager approval is requested |
|
|
52
|
+
| SC-002 | an invoice of exactly $10,000 | the invoice is submitted | no approval is requested |
|
|
53
|
+
|
|
54
|
+
## Part 5 — Readiness Report
|
|
55
|
+
|
|
56
|
+
Readiness: 73%. Areas — businessContext 90, workflows 80, rules 70,
|
|
57
|
+
integrations 60, data 70, nfrs 70.
|
|
58
|
+
|
|
59
|
+
Open questions: Q-001 (P1, architecture blocker) — is the $10,000 threshold in
|
|
60
|
+
local currency or USD equivalent?
|
|
61
|
+
Assumptions: ASM-001 (high impact, unconfirmed) — managers authenticate through
|
|
62
|
+
Microsoft Entra.
|
|
63
|
+
Blockers: Q-001, ASM-001. Conflicts: none.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const py = fileURLToPath(new URL('../validate.py', import.meta.url));
|
|
10
|
+
const js = fileURLToPath(new URL('../validate.mjs', import.meta.url));
|
|
11
|
+
const fx = (f) => fileURLToPath(new URL(`./fixtures/${f}`, import.meta.url));
|
|
12
|
+
|
|
13
|
+
function run(cmd, script, jsonPath, mdPath) {
|
|
14
|
+
try {
|
|
15
|
+
const out = execFileSync(cmd, [script, '--json', jsonPath, '--md', mdPath], { encoding: 'utf8' });
|
|
16
|
+
return { code: 0, out, err: '' };
|
|
17
|
+
} catch (e) {
|
|
18
|
+
return { code: e.status, out: e.stdout ?? '', err: e.stderr ?? '' };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
test('python validator accepts the pass pair like node', () => {
|
|
23
|
+
const p = run('python3', py, fx('requirements-pass.json'), fx('requirements-pass.md'));
|
|
24
|
+
assert.equal(p.code, 0);
|
|
25
|
+
assert.match(p.out, /requirements package valid/);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('python validator reports identical findings on the fail fixture', () => {
|
|
29
|
+
const n = run('node', js, fx('requirements-fail.json'), fx('requirements-pass.md'));
|
|
30
|
+
const p = run('python3', py, fx('requirements-fail.json'), fx('requirements-pass.md'));
|
|
31
|
+
assert.equal(p.code, 1);
|
|
32
|
+
assert.equal(p.err.trim(), n.err.trim());
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('python and node agree on a mutated package (status + blocker + md sync)', () => {
|
|
36
|
+
const dir = mkdtempSync(join(tmpdir(), 'ba-parity-'));
|
|
37
|
+
const pkg = JSON.parse(readFileSync(fx('requirements-pass.json'), 'utf8'));
|
|
38
|
+
pkg.status = 'READY_FOR_ARCHITECTURE';
|
|
39
|
+
pkg.requirements[0].text = 'The system must be fast.';
|
|
40
|
+
const jsonPath = join(dir, 'requirements.json');
|
|
41
|
+
writeFileSync(jsonPath, JSON.stringify(pkg));
|
|
42
|
+
const md = readFileSync(fx('requirements-pass.md'), 'utf8').replaceAll('ASM-001', 'ASM-009');
|
|
43
|
+
const mdPath = join(dir, 'requirements.md');
|
|
44
|
+
writeFileSync(mdPath, md);
|
|
45
|
+
const n = run('node', js, jsonPath, mdPath);
|
|
46
|
+
const p = run('python3', py, jsonPath, mdPath);
|
|
47
|
+
assert.equal(n.code, 1);
|
|
48
|
+
assert.equal(p.code, 1);
|
|
49
|
+
assert.equal(p.err.trim(), n.err.trim());
|
|
50
|
+
});
|