@v11g/agents-rock 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +2 -1
  2. package/package.json +1 -1
  3. package/plugins/business-analyst/.claude-plugin/plugin.json +2 -2
  4. package/plugins/business-analyst/evals/draft-scope-rich/case.yaml +4 -0
  5. package/plugins/business-analyst/evals/draft-scope-rich/fixture.sh +5 -0
  6. package/plugins/business-analyst/evals/draft-scope-rich/graders/conflict-question.md +11 -0
  7. package/plugins/business-analyst/evals/draft-scope-rich/graders/keep-and-exclude.md +14 -0
  8. package/plugins/business-analyst/evals/draft-scope-rich/graders/noise-and-shape.md +13 -0
  9. package/plugins/business-analyst/evals/draft-scope-rich/graders/problem-not-solution.md +13 -0
  10. package/plugins/business-analyst/evals/draft-scope-rich/graders/share-kept.md +11 -0
  11. package/plugins/business-analyst/evals/draft-scope-rich/graders/skill-fired.md +7 -0
  12. package/plugins/business-analyst/evals/draft-scope-rich/graders/vague-word.md +13 -0
  13. package/plugins/business-analyst/evals/draft-scope-rich/inputs/C1.txt +10 -0
  14. package/plugins/business-analyst/evals/draft-scope-rich/inputs/E1.txt +5 -0
  15. package/plugins/business-analyst/evals/draft-scope-rich/inputs/E2.txt +5 -0
  16. package/plugins/business-analyst/evals/draft-scope-rich/inputs/E3.txt +5 -0
  17. package/plugins/business-analyst/evals/draft-scope-rich/prompt.md +9 -0
  18. package/plugins/business-analyst/evals/draft-scope-thin/case.yaml +4 -0
  19. package/plugins/business-analyst/evals/draft-scope-thin/fixture.sh +4 -0
  20. package/plugins/business-analyst/evals/draft-scope-thin/graders/no-invention.md +18 -0
  21. package/plugins/business-analyst/evals/draft-scope-thin/graders/skill-fired.md +7 -0
  22. package/plugins/business-analyst/evals/draft-scope-thin/inputs/E1.txt +5 -0
  23. package/plugins/business-analyst/evals/draft-scope-thin/prompt.md +8 -0
  24. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
  25. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
  26. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
  27. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
  28. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
  29. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
  30. package/plugins/business-analyst/skills/draft-scope/SKILL.md +46 -0
  31. package/plugins/business-analyst/skills/draft-scope/references/credits.md +12 -0
  32. package/plugins/business-analyst/skills/draft-scope/references/draft-schema.md +44 -0
  33. package/plugins/business-analyst/skills/draft-scope/references/rules.md +24 -0
  34. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-312.pyc +0 -0
  35. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-312.pyc +0 -0
  36. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-312.pyc +0 -0
  37. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-312.pyc +0 -0
  38. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-312.pyc +0 -0
  39. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-312.pyc +0 -0
  40. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-312.pyc +0 -0
  41. package/plugins/business-analyst/skills/draft-scope/scripts/build_docx.py +36 -0
  42. package/plugins/business-analyst/skills/draft-scope/scripts/check.py +53 -0
  43. package/plugins/business-analyst/skills/draft-scope/scripts/docx_body.py +58 -0
  44. package/plugins/business-analyst/skills/draft-scope/scripts/docx_flow.py +52 -0
  45. package/plugins/business-analyst/skills/draft-scope/scripts/docx_package.py +62 -0
  46. package/plugins/business-analyst/skills/draft-scope/scripts/docx_xml.py +44 -0
  47. package/plugins/business-analyst/skills/draft-scope/scripts/draft_quotes.py +49 -0
  48. package/plugins/business-analyst/skills/draft-scope/scripts/draft_rules.py +106 -0
  49. package/plugins/business-analyst/skills/draft-scope/scripts/draft_schema.py +87 -0
  50. package/plugins/business-analyst/skills/draft-scope/scripts/test/build-docx.test.mjs +76 -0
  51. package/plugins/business-analyst/skills/draft-scope/scripts/test/check-rules.test.mjs +131 -0
  52. package/plugins/business-analyst/skills/draft-scope/scripts/test/check-shape.test.mjs +70 -0
  53. package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/draft-pass.json +40 -0
  54. package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/C1.txt +7 -0
  55. package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/E1.txt +5 -0
  56. package/plugins/business-analyst/skills/draft-scope/scripts/test/gates.test.mjs +39 -0
  57. package/plugins/business-analyst/skills/draft-scope/scripts/test/helpers.mjs +30 -0
  58. package/plugins/business-analyst/skills/draft-scope/scripts/test/skill-files.test.mjs +59 -0
  59. package/plugins/business-analyst/skills/draft-scope/steps/assumptions.md +24 -0
  60. package/plugins/business-analyst/skills/draft-scope/steps/check.md +24 -0
  61. package/plugins/business-analyst/skills/draft-scope/steps/discover.md +53 -0
  62. package/plugins/business-analyst/skills/draft-scope/steps/draft.md +64 -0
  63. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  64. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +8 -7
  65. package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +5 -5
  66. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +15 -3
  67. package/plugins/solution-architect/skills/analyze-requirements/evals/evals.json +50 -6
  68. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.json +31 -0
  69. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.md +17 -0
  70. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/C1-kickoff-call.txt +16 -0
  71. package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/E1-intro-email.md +9 -0
  72. package/plugins/solution-architect/skills/analyze-requirements/references/extract.md +108 -0
  73. package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +39 -5
  74. package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +1 -1
  75. package/plugins/solution-architect/skills/analyze-requirements/references/quality-goals.md +84 -0
  76. package/plugins/solution-architect/skills/analyze-requirements/references/research.md +1 -1
  77. package/plugins/solution-architect/skills/analyze-requirements/references/rewriting.md +7 -2
  78. package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +10 -6
  79. package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +45 -3
  80. package/plugins/solution-architect/skills/analyze-requirements/scripts/ba-facts.mjs +32 -0
  81. package/plugins/solution-architect/skills/analyze-requirements/scripts/check-quotes.mjs +39 -0
  82. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/ba-package.mjs +75 -0
  83. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +19 -7
  84. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +1 -1
  85. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +42 -11
  86. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +15 -4
  87. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +1 -1
  88. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/strategy-sections.mjs +30 -0
  89. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +14 -2
  90. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-quotes.mjs +55 -0
  91. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-strategy.mjs +65 -0
  92. package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +18 -5
  93. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-facts-cli.test.mjs +55 -0
  94. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package-cli.test.mjs +101 -0
  95. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package.test.mjs +115 -0
  96. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +50 -2
  97. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/check-quotes-cli.test.mjs +49 -0
  98. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +49 -4
  99. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/extract-workflow.test.mjs +69 -0
  100. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +14 -0
  101. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +19 -5
  102. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/record-cli.test.mjs +1 -1
  103. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +69 -2
  104. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rewriting.test.mjs +1 -1
  105. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +6 -0
  106. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +19 -0
  107. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes-cli.test.mjs +58 -0
  108. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes.test.mjs +81 -0
  109. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy-cli.test.mjs +32 -0
  110. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy.test.mjs +118 -0
  111. package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +17 -6
  112. package/plugins/solution-architect/skills/analyze-requirements/workflows/extract.js +51 -0
@@ -0,0 +1,81 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import {
4
+ normalize, parseCitations, closestSentence, briefQuotesOf, validateQuotes,
5
+ } from '../lib/validate-quotes.mjs';
6
+
7
+ const C1 = 'Maya: We open sales at 10am sharp. For a headline act we get ten times the orders\nin the first five minutes.\nMaya: We don’t want to touch card data.';
8
+ const sources = new Map([['inputs/C1-kickoff-call.txt', C1]]);
9
+ const cite = (quote) => ({ label: 'C1 · 2026-09-10', path: 'inputs/C1-kickoff-call.txt', quote });
10
+
11
+ test('normalize folds curly quotes and whitespace', () => {
12
+ assert.equal(normalize(' don’t “x”\n y '), 'don\'t "x" y');
13
+ });
14
+
15
+ test('parseCitations reads label, path without fragment, and quote', () => {
16
+ const md = '| a | stated [C1 · 2026-09-10](inputs/C1.txt) "ten times" |\n| b | stated [Q3 · 2026-10-14](interview-log.md#q3) |';
17
+ assert.deepEqual(parseCitations(md), [
18
+ { label: 'C1 · 2026-09-10', path: 'inputs/C1.txt', quote: 'ten times' },
19
+ { label: 'Q3 · 2026-10-14', path: 'interview-log.md', quote: null },
20
+ ]);
21
+ });
22
+
23
+ test('passes an exact quote, a wrapped quote, and a straight-quoted apostrophe', () => {
24
+ const citations = [
25
+ cite('We open sales at 10am sharp.'),
26
+ cite('ten times the orders in the first five minutes'),
27
+ cite("We don't want to touch card data."),
28
+ ];
29
+ assert.deepEqual(validateQuotes({ citations, briefQuotes: [], sources }), []);
30
+ });
31
+
32
+ test('fails a reworded quote and names the closest sentence', () => {
33
+ const out = validateQuotes({ citations: [cite('ten times more orders in five minutes')], briefQuotes: [], sources });
34
+ assert.equal(out.length, 1);
35
+ assert.equal(out[0].check, 'quotes');
36
+ assert.match(out[0].message, /not found in inputs\/C1-kickoff-call\.txt; closest: "For a headline act/);
37
+ });
38
+
39
+ test('is case-sensitive', () => {
40
+ assert.equal(validateQuotes({ citations: [cite('we open sales at 10am sharp.')], briefQuotes: [], sources }).length, 1);
41
+ });
42
+
43
+ test('skips interview citations and citations to files not loaded', () => {
44
+ const citations = [
45
+ { label: 'Q3', path: 'interview-log.md', quote: null },
46
+ { label: 'E9', path: 'inputs/E9.md', quote: 'anything' },
47
+ ];
48
+ assert.deepEqual(validateQuotes({ citations, briefQuotes: [], sources }), []);
49
+ });
50
+
51
+ test('Brief says quotes must appear in some input, and are skipped with no inputs', () => {
52
+ assert.deepEqual(validateQuotes({ citations: [], briefQuotes: ['10am sharp'], sources }), []);
53
+ const out = validateQuotes({ citations: [], briefQuotes: ['sold out in seconds'], sources });
54
+ assert.match(out[0].message, /Brief says "sold out in seconds" is in no input file/);
55
+ assert.deepEqual(validateQuotes({ citations: [], briefQuotes: ['anything'], sources: new Map() }), []);
56
+ });
57
+
58
+ test('briefQuotesOf reads the §13 Brief says column', () => {
59
+ const t = {
60
+ section: '13 Quality Requirements and SLOs',
61
+ headers: ['Goal', 'Target', 'Brief says', 'src'],
62
+ rows: [['Speed', 't', '"10am sharp"', 'stated'], ['Uptime', 't', '—', 'stated'], ['Not provided — x', '', '', 'stated']],
63
+ };
64
+ assert.deepEqual(briefQuotesOf([t]), ['10am sharp']);
65
+ assert.deepEqual(briefQuotesOf([]), []);
66
+ });
67
+
68
+ test('closestSentence picks the sentence sharing most words', () => {
69
+ assert.match(closestSentence(C1, 'orders in five minutes'), /^For a headline act/);
70
+ });
71
+
72
+ test('briefQuotesOf strips curly surrounding quotes', () => {
73
+ const t = {
74
+ section: '13 Quality Requirements and SLOs',
75
+ headers: ['Goal', 'Target', 'Brief says', 'src'],
76
+ rows: [['Speed', 't', '“10am sharp”', 'stated']],
77
+ };
78
+ const briefQuotes = briefQuotesOf([t]);
79
+ assert.deepEqual(briefQuotes, ['10am sharp']);
80
+ assert.deepEqual(validateQuotes({ citations: [], briefQuotes, sources }), []);
81
+ });
@@ -0,0 +1,32 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { spawnSync } from 'node:child_process';
4
+ import { mkdtempSync, writeFileSync } from 'node:fs';
5
+ import { tmpdir } from 'node:os';
6
+ import { join } from 'node:path';
7
+
8
+ const CLI = 'plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs';
9
+ const FRONT = '---\nelectedDocs: [{"name":"threat-model","elected":false,"reason":"r"},{"name":"interface-contract","elected":false,"reason":"r"},{"name":"estimation","elected":false,"reason":"r"},{"name":"domain-overview","elected":false,"reason":"r"}]\n---\n\n';
10
+ const GOALS = '## 13 Quality Requirements and SLOs\n\n| Goal | Target | Brief says | src |\n| --- | --- | --- | --- |\n| Uptime | 99.9% | "q" | stated |\n| Integration | 5 min | "q" | stated |\n| Speed (gives way first) | 2s | "q" | stated |\n';
11
+
12
+ function validate(body) {
13
+ const dir = mkdtempSync(join(tmpdir(), 'strategy-cli-'));
14
+ writeFileSync(join(dir, 'ARCHITECTURE.md'), FRONT + body);
15
+ writeFileSync(join(dir, 'model.json'), JSON.stringify({ elements: {} }));
16
+ return spawnSync('node', [CLI, '--root', dir,
17
+ '--arch', join(dir, 'ARCHITECTURE.md'), '--model', join(dir, 'model.json')], { encoding: 'utf8' });
18
+ }
19
+
20
+ test('§4 bullets: WARN printed, exit 0', () => {
21
+ const r = validate('## 4 Solution Strategy\n\n- Single app → ADR-001\n\n' + GOALS);
22
+ assert.equal(r.status, 0, r.stdout);
23
+ assert.match(r.stdout, /^WARN \[strategy\] §4 is a list/m);
24
+ assert.match(r.stdout, /all checks passed/);
25
+ });
26
+
27
+ test('unserved goal: FAIL printed, exit 1', () => {
28
+ const strategy = '## 4 Solution Strategy\n\n| Decision | Serves | ADR | src |\n| --- | --- | --- | --- |\n| Single app | Uptime, Integration | ADR-001 | proposed |\n\n';
29
+ const r = validate(strategy + GOALS);
30
+ assert.equal(r.status, 1);
31
+ assert.match(r.stdout, /^FAIL \[strategy\] §13 goal "speed"/m);
32
+ });
@@ -0,0 +1,118 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { validateStrategy } from '../lib/validate-strategy.mjs';
4
+
5
+ const GOALS = '13 Quality Requirements and SLOs';
6
+ const STRATEGY = '4 Solution Strategy';
7
+ const goals = (...cells) => ({
8
+ section: GOALS, headers: ['Goal', 'Target', 'Brief says', 'src'],
9
+ rows: cells.map((c) => [c, 't', 'q', 'stated']),
10
+ });
11
+ const strategy = (...serves) => ({
12
+ section: STRATEGY, headers: ['Decision', 'Serves', 'ADR', 'src'],
13
+ rows: serves.map((s, i) => [`decision ${i}`, s, 'ADR-001', 'proposed']),
14
+ });
15
+ const THREE = goals('Uptime', 'Integration', 'Speed (gives way first)');
16
+ const render = (t) => [
17
+ `## ${t.section}`, '', `| ${t.headers.join(' | ')} |`, `|${t.headers.map(() => '---').join('|')}|`,
18
+ ...t.rows.map((r) => `| ${r.join(' | ')} |`), '',
19
+ ].join('\n');
20
+ const run = (tables, archMd = '') => validateStrategy({ tables: [], archMd: tables.map(render).join('\n') + archMd });
21
+ const fails = (fs) => fs.filter((f) => f.level !== 'warn');
22
+
23
+ test('passes three goals, one giving way, every goal served', () => {
24
+ assert.deepEqual(run([THREE, strategy('Uptime, Integration', 'Speed')]), []);
25
+ });
26
+
27
+ test('fails when §13 does not have exactly three rows', () => {
28
+ const out = run([goals('Uptime', 'Speed (gives way first)'), strategy('Uptime, Speed')]);
29
+ assert.match(out[0].message, /2 goal rows, expected 3/);
30
+ });
31
+
32
+ test('fails when no goal or two goals give way first', () => {
33
+ assert.equal(run([goals('A', 'B', 'C'), strategy('A, B, C')]).length, 1);
34
+ const two = goals('A (gives way first)', 'B (gives way first)', 'C');
35
+ assert.match(run([two, strategy('A, B, C')])[0].message, /marks 2 goals/);
36
+ });
37
+
38
+ test('Not provided rows count as rows but not as goals', () => {
39
+ const t = goals('Reliability', 'Simplicity (gives way first)', 'Not provided — user declined');
40
+ assert.deepEqual(run([t, strategy('Reliability', 'Simplicity')]), []);
41
+ const one = goals('Reliability', 'Not provided — a', 'Not provided — b');
42
+ assert.deepEqual(run([one, strategy('Reliability')]), []);
43
+ });
44
+
45
+ test('fails a decision serving a non-goal, and one serving nothing', () => {
46
+ const out = run([THREE, strategy('Uptime, Integration, Speed', 'Growth', '')]);
47
+ assert.equal(out.length, 2);
48
+ assert.match(out[0].message, /"growth", not a §13 goal/);
49
+ assert.match(out[1].message, /serves no goal/);
50
+ });
51
+
52
+ test('fails a goal no decision serves', () => {
53
+ const out = run([THREE, strategy('Uptime, Integration')]);
54
+ assert.match(out[0].message, /goal "speed" is served by no §4 decision/);
55
+ });
56
+
57
+ test('matches serves names case-insensitively and with the gives-way label', () => {
58
+ assert.deepEqual(run([THREE, strategy('uptime, INTEGRATION', 'Speed (gives way first)')]), []);
59
+ });
60
+
61
+ test('fails a §4 table with no Serves column', () => {
62
+ const t = { section: STRATEGY, headers: ['Decision', 'ADR', 'src'], rows: [['d', 'a', 'proposed']] };
63
+ assert.match(run([THREE, t])[0].message, /no Serves column/);
64
+ });
65
+
66
+ test('legacy §13 (no Goal column) warns once and skips serves checks', () => {
67
+ const legacy = { section: GOALS, headers: ['Requirement', 'Target', 'src'], rows: [['r', 't', 'stated']] };
68
+ const out = run([legacy, strategy('anything')]);
69
+ assert.equal(out.length, 1);
70
+ assert.equal(out[0].level, 'warn');
71
+ assert.match(out[0].message, /predates top-3 goals/);
72
+ });
73
+
74
+ test('§4 written as bullets warns, even under a ### subheading', () => {
75
+ const md = '## 4 Solution Strategy\n\n### Notes\n\n- Single app → ADR-001\n\n## 5 Architecture Model\n';
76
+ const out = run([THREE], md);
77
+ assert.equal(out.length, 1);
78
+ assert.equal(out[0].level, 'warn');
79
+ assert.match(out[0].message, /§4 is a list/);
80
+ });
81
+
82
+ test('no findings when §4 and §13 are absent or Not applicable', () => {
83
+ assert.deepEqual(run([], '## Core Components\n'), []);
84
+ const md = '## 4 Solution Strategy\n\nNot applicable — single script\n\n## 13 Quality Requirements\n\nNot applicable — x\n';
85
+ assert.deepEqual(run([], md), []);
86
+ });
87
+
88
+ test('fails never carry the warn level', () => {
89
+ assert.equal(fails(run([THREE, strategy('Uptime')])).length, 2);
90
+ });
91
+
92
+ const GOAL_TABLE = '| Goal | Target | Brief says | src |\n|---|---|---|---|\n| A | t | q | stated |\n| B | t | q | stated |\n| C (gives way first) | t | q | stated |\n';
93
+ const SERVES = (rows) => `| Decision | Serves | ADR | src |\n|---|---|---|---|\n${rows}\n`;
94
+
95
+ test('checks a §4 table under a ### subheading', () => {
96
+ const md = `## 4 Solution Strategy\n\n### Key decisions\n\n${SERVES('| d | A | ADR-1 | proposed |')}\n## 13 Quality Requirements\n\n${GOAL_TABLE}`;
97
+ const out = validateStrategy({ tables: [], archMd: md });
98
+ assert.equal(fails(out).length, 2);
99
+ assert.match(out[0].message, /goal "b" is served by no §4 decision/);
100
+ });
101
+
102
+ test('finds the Goal table when another table comes first in §13', () => {
103
+ const slo = '| SLO | Target | src |\n|---|---|---|\n| p95 | 1s | stated |\n\n';
104
+ const md = `## 4 Solution Strategy\n\n${SERVES('| d | A | ADR-1 | proposed |')}\n## 13 Quality Requirements\n\n${slo}${GOAL_TABLE}`;
105
+ const out = validateStrategy({ tables: [], archMd: md });
106
+ assert.ok(out.every((f) => f.level !== 'warn'));
107
+ assert.equal(out.length, 2);
108
+ });
109
+
110
+ test('skips serves checks when every §13 goal is Not provided', () => {
111
+ const t = goals('Not provided — a', 'Not provided — b', 'Not provided — c');
112
+ assert.deepEqual(run([t, strategy('Growth', '')]), []);
113
+ });
114
+
115
+ test('ignores markdown emphasis in goal and serves cells', () => {
116
+ const t = goals('**Uptime**', '_Integration_', 'Speed *(gives way first)*');
117
+ assert.deepEqual(run([t, strategy('Uptime, **Integration**', 'Speed')]), []);
118
+ });
@@ -8,6 +8,9 @@ import { validateDeployment } from './lib/validate-deployment.mjs';
8
8
  import { validateLinks } from './lib/validate-links.mjs';
9
9
  import { validateTree } from './lib/validate-tree.mjs';
10
10
  import { validateClusters } from './lib/validate-clusters.mjs';
11
+ import { validateStrategy } from './lib/validate-strategy.mjs';
12
+ import { validateQuotes, briefQuotesOf } from './lib/validate-quotes.mjs';
13
+ import { validateBaCitations } from './lib/ba-package.mjs';
11
14
 
12
15
  function consumeDocs(argv, i, docs) {
13
16
  while (argv[i + 1] && !argv[i + 1].startsWith('--')) docs.push(argv[++i]);
@@ -15,11 +18,11 @@ function consumeDocs(argv, i, docs) {
15
18
  }
16
19
 
17
20
  function parseArgs(argv) {
18
- const args = { root: process.cwd(), docs: [] };
21
+ const args = { root: process.cwd(), docs: [], inputs: [] };
19
22
  for (let i = 0; i < argv.length; i += 1) {
20
23
  const flag = argv[i];
21
- if (flag === '--docs') {
22
- i = consumeDocs(argv, i, args.docs);
24
+ if (flag === '--docs' || flag === '--inputs') {
25
+ i = consumeDocs(argv, i, args[flag.slice(2)]);
23
26
  } else if (flag.startsWith('--')) {
24
27
  args[flag.slice(2)] = argv[++i];
25
28
  }
@@ -72,10 +75,14 @@ const inputs = await buildInputs({
72
75
  archPath: args.arch,
73
76
  modelPath: args.model,
74
77
  docPaths: args.docs,
78
+ inputPaths: args.inputs,
75
79
  });
76
80
 
77
81
  const findings = [
78
82
  ...validateProvenance({ tables: inputs.tables }),
83
+ ...validateStrategy({ tables: inputs.tables, archMd: inputs.archMd }),
84
+ ...validateQuotes({ citations: inputs.citations, briefQuotes: briefQuotesOf(inputs.tables), sources: inputs.sources }),
85
+ ...validateBaCitations({ citations: inputs.citations, packages: inputs.packages }),
79
86
  ...validateElections({ frontmatter: inputs.frontmatter }),
80
87
  ...validateModelTables({ model: inputs.model, tables: inputs.tables, erNames: inputs.erNames }),
81
88
  ...validateDeployment({ model: inputs.model }),
@@ -83,6 +90,10 @@ const findings = [
83
90
  ...(args.mode === 'brownfield' ? brownfieldFindings({ inputs, args, root }) : []),
84
91
  ];
85
92
 
86
- for (const f of findings) console.log(`FAIL [${f.check}] ${f.message}`);
87
- if (!findings.length) console.log('ok all checks passed');
88
- process.exit(findings.length ? 1 : 0);
93
+ // A warn finding marks a set written before a rule existed: printed so the
94
+ // next rewrite fixes it, never blocking — rule 4 makes validation gate rendering.
95
+ const fails = findings.filter((f) => f.level !== 'warn');
96
+ for (const f of findings.filter((x) => x.level === 'warn')) console.log(`WARN [${f.check}] ${f.message}`);
97
+ for (const f of fails) console.log(`FAIL [${f.check}] ${f.message}`);
98
+ if (!fails.length) console.log('ok all checks passed');
99
+ process.exit(fails.length ? 1 : 0);
@@ -0,0 +1,51 @@
1
+ export const meta = {
2
+ name: 'arch-docs-extract',
3
+ description: 'One agent per client input file: facts backed by exact quotes',
4
+ phases: [{ title: 'Extract', detail: 'one agent per input file' }],
5
+ }
6
+
7
+ const FACTS = { type: 'object', required: ['facts'], properties: { facts: { type: 'array', items: {
8
+ type: 'object', required: ['fact', 'quote', 'section'],
9
+ properties: { fact: { type: 'string' }, quote: { type: 'string' }, section: { type: 'string' } },
10
+ } } } }
11
+
12
+ // The spine sections a client input can speak to; the agent hunts each one so
13
+ // a fact is missed by omission less often (references/extract.md).
14
+ const CHECKLIST = [
15
+ 'goals and scope',
16
+ 'users and actors',
17
+ 'constraints: budget, deadline, mandated tech, compliance',
18
+ 'quality: speed, load spikes, uptime, data loss, reliability, security, running cost',
19
+ 'external systems and integrations',
20
+ 'data and its sensitivity',
21
+ 'deployment and hosting',
22
+ ]
23
+
24
+ const RULES = 'Read the file with the Read tool. Every fact carries a quote copied character for character from the file: no rewording, no joining separate sentences, no fixing typos. A fact you cannot quote is left out. Small talk is left out.'
25
+
26
+ // requirements.md read without its json (references/extract.md §2.2): the BA
27
+ // already labelled every row, and only a confirmed one is the client's word.
28
+ const BA = 'This file is a business-analyst requirements package. Take only rows labelled confirmed, plus constraints and business rules that name a source. Skip rows labelled assumed or recommended, the assumptions register and open questions: the client did not confirm them.'
29
+
30
+ function promptFor(file) {
31
+ const head = `${RULES}${file.ba ? `\n${BA}` : ''}\nFile: ${file.path}\n`
32
+ if (file.fix) return `${head}These quotes were not found in the file. For each, return the fact again with a quote copied exactly from the file, or leave it out:\n${JSON.stringify(file.fix)}`
33
+ if (args.question) return `${head}Answer only this: ${args.question}`
34
+ return `${head}Work through each topic and return every fact the file states about it, with section set to the topic:\n- ${CHECKLIST.join('\n- ')}`
35
+ }
36
+
37
+ const dropped = []
38
+ const tag = (file) => (r) => {
39
+ if (r) return r.facts.map((f) => ({ ...f, src: file.id, date: file.date, path: file.path }))
40
+ dropped.push({ item: file.id, reason: 'agent returned nothing' })
41
+ log(`DROPPED ${file.id}: agent returned nothing`)
42
+ return []
43
+ }
44
+
45
+ phase('Extract')
46
+ const facts = (await parallel(args.files.map((file) => () =>
47
+ agent(promptFor(file), { label: `extract-${file.id}`, phase: 'Extract', schema: FACTS }).then(tag(file))
48
+ ))).flat()
49
+
50
+ log(`extract done: ${facts.length} facts from ${args.files.length} files, ${dropped.length} dropped`)
51
+ return { facts, dropped }