@v11g/agents-rock 1.0.3 → 1.0.5

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 (61) hide show
  1. package/README.md +4 -2
  2. package/package.json +1 -1
  3. package/plugins/business-analyst/.claude-plugin/plugin.json +1 -1
  4. package/plugins/business-analyst/skills/business-analyst/README.md +4 -1
  5. package/plugins/business-analyst/skills/business-analyst/SKILL.md +6 -2
  6. package/plugins/business-analyst/skills/business-analyst/scripts/test/python-parity.test.mjs +50 -0
  7. package/plugins/business-analyst/skills/business-analyst/scripts/validate.py +288 -0
  8. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  9. package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +4 -2
  10. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs +4 -1
  11. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +3 -2
  12. package/plugins/solution-architect/skills/estimate/README.md +8 -5
  13. package/plugins/solution-architect/skills/estimate/SKILL.md +9 -5
  14. package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +142 -376
  15. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +610 -601
  16. package/plugins/solution-architect/skills/estimate/assets/scores-review-template.html +118 -0
  17. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +5 -9
  18. package/plugins/solution-architect/skills/estimate/references/interview.md +121 -10
  19. package/plugins/solution-architect/skills/estimate/references/scoring-guide.md +23 -0
  20. package/plugins/solution-architect/skills/estimate/references/techniques.md +9 -2
  21. package/plugins/solution-architect/skills/estimate/references/writing.md +21 -5
  22. package/plugins/solution-architect/skills/estimate/scripts/lib/agentic-checks.mjs +1 -1
  23. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +4 -30
  24. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +14 -10
  25. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +6 -8
  26. package/plugins/solution-architect/skills/estimate/scripts/lib/md-tables.mjs +31 -0
  27. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +14 -3
  28. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +5 -4
  29. package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +39 -0
  30. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +4 -14
  31. package/plugins/solution-architect/skills/estimate/scripts/lib/score-csv.mjs +58 -0
  32. package/plugins/solution-architect/skills/estimate/scripts/lib/score-diff.mjs +30 -0
  33. package/plugins/solution-architect/skills/estimate/scripts/lib/score-html.mjs +17 -0
  34. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring-checks.mjs +24 -0
  35. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring-schema.mjs +48 -0
  36. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring.mjs +45 -0
  37. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +14 -13
  38. package/plugins/solution-architect/skills/estimate/scripts/score-review.mjs +59 -0
  39. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +403 -316
  40. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +25 -1
  41. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +29 -10
  42. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +2 -2
  43. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +21 -3
  44. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +1 -1
  45. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +4 -4
  46. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +61 -6
  47. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +96 -13
  48. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +105 -4
  49. package/plugins/solution-architect/skills/estimate/scripts/test/score-review.test.mjs +187 -0
  50. package/plugins/solution-architect/skills/estimate/scripts/test/scoring.test.mjs +49 -0
  51. package/plugins/solution-architect/skills/estimate/scripts/test/url-state.test.mjs +198 -0
  52. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +38 -0
  53. package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +93 -28
  54. package/plugins/solution-architect/skills/new-lead/assets/dashboard/detail.html +25 -50
  55. package/plugins/solution-architect/skills/new-lead/assets/dashboard/index.html +20 -40
  56. package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +13 -5
  57. package/plugins/solution-architect/skills/new-lead/scripts/serve.mjs +8 -3
  58. package/plugins/solution-architect/skills/new-lead/scripts/test/map.test.mjs +4 -0
  59. package/plugins/solution-architect/skills/new-lead/scripts/test/serve.test.mjs +25 -21
  60. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +2 -2
  61. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +1 -1
package/README.md CHANGED
@@ -81,7 +81,8 @@ rather than a hang.
81
81
 
82
82
  | Plugin | Description | Version |
83
83
  | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
84
- | `solution-architect` | Solution-architecture toolkit: interview-driven architecture documentation with interactive diagrams and provenance-tagged facts, AI-aware project estimation, and client-ready proposals. | 1.0.0 |
84
+ | `business-analyst` | Business-analysis toolkit: interview-driven requirements discovery that turns raw client input into a validated, traceable requirements package ready for solution architecture. | 0.2.0 |
85
+ | `solution-architect` | Solution-architecture toolkit: interview-driven architecture documentation with interactive diagrams and provenance-tagged facts, AI-aware project estimation, and client-ready proposals. | 2.0.0 |
85
86
  | `lmk` | Terminal-native visual explainer: explains the current topic with cheap diagrams (flowcharts, sequences, timelines, tables) rendered directly in the terminal via a bundled Mermaid renderer. | 0.1.0 |
86
87
 
87
88
  ## Skills
@@ -93,11 +94,12 @@ for automatically by the agent when the task fits.
93
94
 
94
95
  **User-invoked**
95
96
 
96
- - **[new-lead](./plugins/solution-architect/skills/new-lead/SKILL.md)** (`solution-architect`) — Orchestrator: sets up a lead workspace and launches analyze-requirements → estimate → proposal in order, stopping between each, plus a leads dashboard.
97
+ - **[new-lead](./plugins/solution-architect/skills/new-lead/SKILL.md)** (`solution-architect`) — Orchestrator: sets up a lead workspace and launches business-analyst (when installed) → analyze-requirements → estimate → proposal in order, stopping between each, plus a leads dashboard.
97
98
  - **[lmk](./plugins/lmk/skills/lmk/SKILL.md)** (`lmk`) — `/lmk` explains the current topic visually in the terminal; bare `/lmk` recaps the last substantial thing. Also auto-triggers on keywords like "explain this", "show me", or "I'm lost".
98
99
 
99
100
  **Model-invoked**
100
101
 
102
+ - **[business-analyst](./plugins/business-analyst/skills/business-analyst/SKILL.md)** (`business-analyst`) — Interview-driven requirements discovery: turns raw client input (emails, notes, transcripts) into a validated requirements package (requirements.md + requirements.json) with labeled facts, open questions, and a readiness gate; triggers on asks to analyze client requirements, run discovery, or clarify a vague request. `new-lead` offers it as optional step 0 when installed.
101
103
  - **[analyze-requirements](./plugins/solution-architect/skills/analyze-requirements/SKILL.md)** (`solution-architect`) — Interview-driven architecture documentation with interactive diagrams and provenance-tagged facts; triggers on asks for architecture docs, C4 diagrams, ADRs, or a threat model.
102
104
  - **[estimate](./plugins/solution-architect/skills/estimate/SKILL.md)** (`solution-architect`) — Interview-driven, AI-aware project estimation with an interactive what-if page; triggers on asks for an estimate, quote, timeline, or "how long would this take".
103
105
  - **[proposal](./plugins/solution-architect/skills/proposal/SKILL.md)** (`solution-architect`) — Pre-sales client proposal rendered as a print-ready page; triggers on asks for a proposal, client pitch, or "something I can send the client".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v11g/agents-rock",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "business-analyst",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Business-analysis toolkit: interview-driven requirements discovery that turns raw client input into a validated, traceable requirements package ready for solution architecture.",
5
5
  "author": {
6
6
  "name": "Truong Vu",
@@ -17,4 +17,7 @@ The package is gated by `scripts/validate.mjs`: schema, ID traceability,
17
17
  label discipline, an ambiguity lint on requirement text, readiness math,
18
18
  and md↔json consistency.
19
19
 
20
- Requires Node ≥ 20. No npm dependencies.
20
+ Requires Node ≥ 20 or Python ≥ 3.10 (`scripts/validate.py` is a
21
+ parity-tested port of the validator, so the skill also runs on claude.ai —
22
+ zip this folder and upload it under Settings → Features). No dependencies
23
+ either way.
@@ -45,7 +45,9 @@ Turn incomplete client input into two artifacts in the lead directory:
45
45
  7. **Write**: requirements.md + requirements.json per
46
46
  `references/writing.md`.
47
47
  8. **Validate**: `node scripts/validate.mjs --json <dir>/requirements.json
48
- --md <dir>/requirements.md` — fix findings, re-run until clean.
48
+ --md <dir>/requirements.md` — fix findings, re-run until clean. No Node
49
+ in the environment (e.g. the claude.ai sandbox) → run
50
+ `python3 scripts/validate.py` with the same flags; identical checks.
49
51
  9. **Fresh-eyes review**: dispatch a subagent per `references/review.md`;
50
52
  apply findings, re-validate; one cycle max.
51
53
  10. **Human review**: show Part 5 (readiness report); the human confirms
@@ -66,4 +68,6 @@ estimates can cite them.
66
68
 
67
69
  ## Dependency
68
70
 
69
- Node ≥ 20. Scripts are dependency-free.
71
+ Node ≥ 20, or Python ≥ 3.10 where Node is unavailable (`scripts/validate.py`
72
+ is a parity-tested port of `scripts/validate.mjs`). Scripts are
73
+ dependency-free either way.
@@ -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
+ });
@@ -0,0 +1,288 @@
1
+ #!/usr/bin/env python3
2
+ """Python port of validate.mjs for environments without Node (e.g. the
3
+ claude.ai sandbox). Same checks, same finding strings, same exit codes —
4
+ kept in lockstep by scripts/test/python-parity.test.mjs."""
5
+ import json
6
+ import math
7
+ import re
8
+ import sys
9
+
10
+ STATUSES = ['DRAFT', 'CLARIFICATION_REQUIRED', 'ANALYZED', 'VALIDATED', 'READY_FOR_ARCHITECTURE']
11
+ DEPTHS = ['QUICK', 'STANDARD', 'DEEP']
12
+ MODES = ['greenfield', 'existing']
13
+ LABELS = ['confirmed', 'assumed', 'recommended']
14
+ PRIORITIES = ['P1', 'P2', 'P3']
15
+ FR_SCOPES = ['in', 'out', 'future', 'unconfirmed']
16
+ AREAS = ['businessContext', 'workflows', 'rules', 'integrations', 'data', 'nfrs']
17
+
18
+ REGISTERS = [
19
+ ('actors', r'^ACT-\d{3}$'),
20
+ ('workflows', r'^WF-\d{3}$'),
21
+ ('requirements', r'^FR-\d{3}$'),
22
+ ('businessRules', r'^BR-\d{3}$'),
23
+ ('scenarios', r'^SC-\d{3}$'),
24
+ ('nfrs', r'^NFR-\d{3}$'),
25
+ ('integrations', r'^INT-\d{3}$'),
26
+ ('data', r'^DAT-\d{3}$'),
27
+ ('constraints', r'^CON-\d{3}$'),
28
+ ('assumptions', r'^ASM-\d{3}$'),
29
+ ('openQuestions', r'^Q-\d{3}$'),
30
+ ('conflicts', r'^CONFLICT-\d{3}$'),
31
+ ]
32
+
33
+ REQUIRED = ['schemaVersion', 'lead', 'status', 'depth', 'updated', 'mode', 'context', 'scope', 'ai', 'readiness']
34
+ TOP_ENUMS = [('status', STATUSES), ('depth', DEPTHS), ('mode', MODES)]
35
+
36
+ ROW_ENUMS = [
37
+ ('requirements', 'label', LABELS),
38
+ ('requirements', 'scope', FR_SCOPES),
39
+ ('nfrs', 'label', LABELS),
40
+ ('integrations', 'label', LABELS),
41
+ ('integrations', 'direction', ['read', 'write', 'both']),
42
+ ('data', 'label', LABELS),
43
+ ('scenarios', 'type', ['happy', 'edge', 'error']),
44
+ ('assumptions', 'impact', ['high', 'medium', 'low']),
45
+ ('assumptions', 'status', ['unconfirmed', 'accepted', 'resolved']),
46
+ ('openQuestions', 'priority', PRIORITIES),
47
+ ('openQuestions', 'status', ['open', 'answered']),
48
+ ('conflicts', 'status', ['open', 'resolved']),
49
+ ]
50
+
51
+ LABELED = ['requirements', 'nfrs', 'integrations', 'data']
52
+ SOURCED = ['requirements', 'businessRules', 'constraints']
53
+
54
+ AMBIGUOUS = [
55
+ 'fast', 'quick', 'easy', 'simple', 'user-friendly', 'intuitive', 'flexible',
56
+ 'robust', 'seamless', 'efficient', 'optimal', 'appropriate', 'various',
57
+ 'etc', 'some', 'many', 'several', 'as needed',
58
+ ]
59
+
60
+ PARTS = ['Part 1', 'Part 2', 'Part 3', 'Part 4', 'Part 5']
61
+ QUICK_PARTS = ['Part 1', 'Part 3', 'Part 5']
62
+ ID_TOKEN = re.compile(r'\b(?:G|ACT|WF|FR|BR|SC|NFR|INT|DAT|CON|ASM|Q|CONFLICT)-\d{3}\b')
63
+
64
+
65
+ def rows(pkg, name):
66
+ return pkg.get(name) or []
67
+
68
+
69
+ def goals(pkg):
70
+ return (pkg.get('context') or {}).get('goals') or []
71
+
72
+
73
+ def check_schema(pkg):
74
+ findings = []
75
+ for f in REQUIRED:
76
+ if f not in pkg:
77
+ findings.append(f'missing required field: {f}')
78
+ for f, legal in TOP_ENUMS:
79
+ if f in pkg and pkg[f] not in legal:
80
+ findings.append(f'illegal {f}: {pkg[f]}')
81
+ for g in goals(pkg):
82
+ if not re.match(r'^G-\d{3}$', g.get('id') or ''):
83
+ findings.append(f"context.goals: bad id {g.get('id')}")
84
+ for name, pattern in REGISTERS:
85
+ for row in rows(pkg, name):
86
+ if not re.match(pattern, row.get('id') or ''):
87
+ findings.append(f"{name}: bad id {row.get('id')}")
88
+ for name, field, legal in ROW_ENUMS:
89
+ for row in rows(pkg, name):
90
+ if field in row and row[field] not in legal:
91
+ findings.append(f'{row.get("id")}: illegal {field} "{row[field]}"')
92
+ return findings
93
+
94
+
95
+ def collect_ids(pkg):
96
+ ordered = {}
97
+ for g in goals(pkg):
98
+ ordered[g.get('id')] = True
99
+ for name, _ in REGISTERS:
100
+ for row in rows(pkg, name):
101
+ ordered[row.get('id')] = True
102
+ return list(ordered)
103
+
104
+
105
+ def check_duplicates(pkg):
106
+ findings, seen = [], set()
107
+ all_rows = list(goals(pkg))
108
+ for name, _ in REGISTERS:
109
+ all_rows.extend(rows(pkg, name))
110
+ for row in all_rows:
111
+ rid = row.get('id')
112
+ if rid in seen:
113
+ findings.append(f'duplicate id: {rid}')
114
+ seen.add(rid)
115
+ return findings
116
+
117
+
118
+ def check_refs(pkg, ids):
119
+ findings = []
120
+
121
+ def miss(owner, ref):
122
+ findings.append(f'{owner}: dangling reference {ref}')
123
+
124
+ for fr in rows(pkg, 'requirements'):
125
+ t = fr.get('traces') or {}
126
+ refs = [t.get('goal'), t.get('workflow'), *(t.get('rules') or []), *(fr.get('acceptance') or [])]
127
+ for ref in refs:
128
+ if ref and ref not in ids:
129
+ miss(fr.get('id'), ref)
130
+ for br in rows(pkg, 'businessRules'):
131
+ if br.get('openQuestion') and br['openQuestion'] not in ids:
132
+ miss(br.get('id'), br['openQuestion'])
133
+ for sc in rows(pkg, 'scenarios'):
134
+ if sc.get('requirement') not in ids:
135
+ miss(sc.get('id'), sc.get('requirement'))
136
+ for q in rows(pkg, 'openQuestions'):
137
+ for ref in q.get('affects') or []:
138
+ if ref not in ids:
139
+ miss(q.get('id'), ref)
140
+ for ref in (pkg.get('readiness') or {}).get('blockers') or []:
141
+ if ref not in ids:
142
+ miss('readiness.blockers', ref)
143
+ return findings
144
+
145
+
146
+ def check_labels(pkg):
147
+ findings = []
148
+ for name in LABELED:
149
+ for row in rows(pkg, name):
150
+ if not row.get('label'):
151
+ findings.append(f"{row.get('id')}: missing label")
152
+ for name in SOURCED:
153
+ for row in rows(pkg, name):
154
+ if not row.get('source'):
155
+ findings.append(f"{row.get('id')}: missing source")
156
+ for fr in rows(pkg, 'requirements'):
157
+ has_question = any(fr.get('id') in (q.get('affects') or []) for q in rows(pkg, 'openQuestions'))
158
+ if fr.get('label') == 'recommended' and fr.get('scope') == 'in' and not has_question:
159
+ findings.append(f'{fr.get("id")}: recommended requirement in scope "in" without a paired open question')
160
+ return findings
161
+
162
+
163
+ def check_ambiguity(pkg):
164
+ findings = []
165
+ for row in [*rows(pkg, 'requirements'), *rows(pkg, 'nfrs')]:
166
+ for word in AMBIGUOUS:
167
+ pattern = r'\b' + re.sub(r'[-\s]', '[-\\\\s]', word) + r'\b'
168
+ if re.search(pattern, row.get('text') or '', re.IGNORECASE):
169
+ findings.append(f'{row.get("id")}: ambiguous term "{word}" — replace with a measurable statement')
170
+ return findings
171
+
172
+
173
+ def check_readiness(pkg):
174
+ findings = []
175
+ r = pkg.get('readiness') or {}
176
+ areas = r.get('areas') or {}
177
+ values = []
178
+ for a in AREAS:
179
+ v = areas.get(a)
180
+ if isinstance(v, (int, float)) and not isinstance(v, bool):
181
+ values.append(v)
182
+ if len(values) != len(AREAS):
183
+ findings.append('readiness.areas: missing area score')
184
+ mean = math.floor(sum(values) / (len(values) or 1) + 0.5)
185
+ if r.get('overall') != mean:
186
+ findings.append(f'readiness.overall {r.get("overall")} != recomputed mean {mean}')
187
+ open_blockers = [q for q in rows(pkg, 'openQuestions') if q.get('status') == 'open' and q.get('architectureBlocker')]
188
+ status_idx = STATUSES.index(pkg.get('status')) if pkg.get('status') in STATUSES else -1
189
+ if open_blockers and status_idx > STATUSES.index('ANALYZED'):
190
+ joined = ', '.join(q.get('id') for q in open_blockers)
191
+ findings.append(f'status {pkg.get("status")} with open architecture blockers: {joined}')
192
+ for q in open_blockers:
193
+ if q.get('id') not in (r.get('blockers') or []):
194
+ findings.append(f'readiness.blockers missing {q.get("id")}')
195
+ risky = [a for a in rows(pkg, 'assumptions') if a.get('impact') == 'high' and a.get('status') == 'unconfirmed']
196
+ if pkg.get('status') == 'READY_FOR_ARCHITECTURE' and risky:
197
+ joined = ', '.join(a.get('id') for a in risky)
198
+ findings.append(f'READY_FOR_ARCHITECTURE with unconfirmed high-impact assumptions: {joined}')
199
+ if pkg.get('status') == 'READY_FOR_ARCHITECTURE' and any(c.get('status') == 'open' for c in rows(pkg, 'conflicts')):
200
+ findings.append('READY_FOR_ARCHITECTURE with open conflicts')
201
+ return findings
202
+
203
+
204
+ def section_bodies(md):
205
+ bodies = {}
206
+ for chunk in re.split(r'^## ', md, flags=re.MULTILINE)[1:]:
207
+ nl = chunk.find('\n')
208
+ title = chunk.strip() if nl == -1 else chunk[:nl].strip()
209
+ bodies[title] = '' if nl == -1 else chunk[nl + 1:]
210
+ return bodies
211
+
212
+
213
+ def frontmatter(md, field, pattern=r'(\S+)'):
214
+ m = re.search(r'^' + field + r':\s*' + pattern, md, re.MULTILINE)
215
+ return m.group(1) if m else None
216
+
217
+
218
+ def check_md(pkg, md):
219
+ findings = []
220
+ if re.search(r'\[TODO\]|\bTBD\b|\bXXX\b', md):
221
+ findings.append('md: placeholder found ([TODO]/TBD/XXX)')
222
+ bodies = section_bodies(md)
223
+ required = QUICK_PARTS if pkg.get('depth') == 'QUICK' else PARTS
224
+ for part in required:
225
+ key = next((h for h in bodies if h.startswith(part)), None)
226
+ if key is None:
227
+ findings.append(f'md: missing section "## {part}"')
228
+ elif not bodies[key].strip():
229
+ findings.append(f'md: empty section "## {part}"')
230
+ md_ids = {m.group(0) for m in ID_TOKEN.finditer(md)}
231
+ for rid in collect_ids(pkg):
232
+ if rid not in md_ids:
233
+ findings.append(f'md: id {rid} absent from requirements.md')
234
+ fm_status = frontmatter(md, 'status')
235
+ if fm_status != pkg.get('status'):
236
+ findings.append(f'md frontmatter status {fm_status} != json status {pkg.get("status")}')
237
+ fm_depth = frontmatter(md, 'depth')
238
+ if fm_depth != pkg.get('depth'):
239
+ findings.append(f'md frontmatter depth {fm_depth} != json depth {pkg.get("depth")}')
240
+ fm_readiness = frontmatter(md, 'readiness', r'(\d+)')
241
+ overall = (pkg.get('readiness') or {}).get('overall')
242
+ if (None if fm_readiness is None else int(fm_readiness)) != overall:
243
+ shown = 'NaN' if fm_readiness is None else int(fm_readiness)
244
+ findings.append(f'md frontmatter readiness {shown} != json readiness.overall {overall}')
245
+ return findings
246
+
247
+
248
+ def check_md_orphan_ids(_pkg, md, ids):
249
+ return [f'md: unknown id {m.group(0)}' for m in ID_TOKEN.finditer(md) if m.group(0) not in ids]
250
+
251
+
252
+ def check_package(pkg, md):
253
+ schema_findings = check_schema(pkg)
254
+ if schema_findings:
255
+ return schema_findings
256
+ ids = set(collect_ids(pkg))
257
+ return [
258
+ *check_duplicates(pkg),
259
+ *check_refs(pkg, ids),
260
+ *check_labels(pkg),
261
+ *check_ambiguity(pkg),
262
+ *check_readiness(pkg),
263
+ *check_md(pkg, md),
264
+ *check_md_orphan_ids(None, md, ids),
265
+ ]
266
+
267
+
268
+ def main(argv):
269
+ args = {}
270
+ i = 0
271
+ while i < len(argv):
272
+ if argv[i].startswith('--'):
273
+ args[argv[i][2:]] = argv[i + 1]
274
+ i += 1
275
+ i += 1
276
+ with open(args['md'], encoding='utf-8') as f:
277
+ md = f.read()
278
+ with open(args['json'], encoding='utf-8') as f:
279
+ pkg = json.load(f)
280
+ findings = check_package(pkg, md)
281
+ if findings:
282
+ print('\n'.join(findings), file=sys.stderr)
283
+ sys.exit(1)
284
+ print('requirements package valid')
285
+
286
+
287
+ if __name__ == '__main__':
288
+ main(sys.argv[1:])
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solution-architect",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Solution-architecture toolkit: interview-driven architecture documentation with interactive diagrams and provenance-tagged facts, AI-aware project estimation, and client-ready proposals.",
5
5
  "author": {
6
6
  "name": "Truong Vu",
@@ -1,5 +1,7 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <!-- data-theme="dark" in the markup: the page opens dark for everyone; the
3
+ toggle (persisted in localStorage) can still switch it to light. -->
4
+ <html lang="en" data-theme="dark">
3
5
  <head>
4
6
  <meta charset="UTF-8">
5
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -7,7 +9,7 @@
7
9
  before the boot script runs, so without this a dark-mode reader gets a white
8
10
  flash — and the UA scrollbar and the search field's own clear button stay
9
11
  light inside a dark page. -->
10
- <meta name="color-scheme" content="light dark">
12
+ <meta name="color-scheme" content="dark light">
11
13
  <meta name="description" content="Architecture documentation — one self-contained page, no network.">
12
14
  <!-- The rail's own mark, inline. A linked file would be a second request from a
13
15
  viewer whose whole premise is one offline file. -->
@@ -60,7 +60,10 @@ export async function launch(fileUrl) {
60
60
  wsUrl,
61
61
  kill() {
62
62
  proc.kill('SIGKILL');
63
- rmSync(dir, { recursive: true, force: true });
63
+ // SIGKILL is asynchronous: Chrome can still be flushing its profile dir
64
+ // when rm starts, which surfaces as ENOTEMPTY in CI. Node retries
65
+ // ENOTEMPTY/EBUSY when maxRetries is set.
66
+ rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
64
67
  },
65
68
  };
66
69
  }
@@ -835,8 +835,9 @@ test('the measure is the column it sits in, not the viewport minus the rail', ()
835
835
  // Without a declared scheme the browser paints the canvas white before the boot
836
836
  // script runs, so a dark-mode reader gets a flash — and the UA scrollbar and the
837
837
  // search field's clear button stay light inside a dark page.
838
- test('the head states its colour scheme, its icon and its description', () => {
839
- assert.match(tpl, /<meta name="color-scheme" content="light dark">/);
838
+ test('the head states its colour scheme (dark first), its icon and its description', () => {
839
+ assert.match(tpl, /<meta name="color-scheme" content="dark light">/);
840
+ assert.match(tpl, /<html lang="en" data-theme="dark">/);
840
841
  assert.match(tpl, /<link rel="icon"[^>]*data:image\/svg\+xml/);
841
842
  assert.match(tpl, /<meta name="description"/);
842
843
  });
@@ -1,19 +1,22 @@
1
1
  # estimate
2
2
 
3
3
  Produce an honest, validated project estimate, then serve it on localhost as an
4
- interactive what-if page.
4
+ interactive page.
5
5
 
6
6
  ## What it produces
7
7
 
8
8
  **`estimation.md`** — scope split into `stated` vs `proposed` items, a task-level
9
9
  backlog with confidence and assumptions per row, an AI-aware scenario comparison
10
- (team composition × Claude Code plan), and the technique used, all backed by
10
+ (team composition × AI assistance), and the technique used, all backed by
11
11
  `estimation.json` (the numbers every table cell comes from — nothing in the
12
12
  doc is hand-totaled).
13
13
 
14
14
  **An interactive page** (`estimate.html`) — the same data rendered as a
15
- self-contained, offline-capable HTML file with live what-if controls (swap
16
- team/plan, see months and cost recompute), served on `localhost:4173` (or the
15
+ self-contained, offline-capable HTML file: a Summary (recommended team, months,
16
+ cost, and the committed alternatives), the feature breakdown (the interview's
17
+ five factor scores per feature, Σ, tier and hours side by side; a
18
+ spreadsheet export with a scoring tab, a Score Rationale tab and a task
19
+ tab), containers, roadmap and risks, served on `localhost:4173` (or the
17
20
  next free port).
18
21
 
19
22
  ## Two run modes
@@ -42,7 +45,7 @@ node scripts/render.mjs --json estimation.json --md estimation.md --out .
42
45
 
43
46
  `validate.mjs` must exit 0 before `render.mjs` will produce a page — an
44
47
  unvalidated estimate cannot ship. Add `--client-only` to `render.mjs` for a
45
- client-safe file with rates and the labor/plan cost breakdown stripped from
48
+ client-safe file with rates and the labor/tooling cost breakdown stripped from
46
49
  both the embedded data and the task register (totals and months stay) —
47
50
  unless `exposeRatesToClient: true` is set in `estimation-inputs.json`, which
48
51
  keeps them.
@@ -7,7 +7,7 @@ description: Interview-driven project estimation with AI-aware delivery scenario
7
7
 
8
8
  Produce an honest, validated estimate: confirmed scope split from assumptions,
9
9
  a technique that fits the evidence, AI-assisted staffing scenarios, and an
10
- interactive what-if page served on localhost.
10
+ interactive page served on localhost.
11
11
 
12
12
  ## Hard rules
13
13
 
@@ -30,9 +30,11 @@ interactive what-if page served on localhost.
30
30
  2. **Depth and delivery mode**: ask QUICK / STANDARD / DEEP, then TRADITIONAL
31
31
  / AGENTIC (`references/interview.md` §2b). Delivery mode decides step 4.
32
32
  3. **Interview**: follow `references/interview.md` — pre-fill from evidence,
33
- ask only holes, run the clear-vs-assumed gate before sizing. Before
34
- proposing milestones, read `references/slicing.md` — slices are judged
35
- there, not computed.
33
+ ask only holes, run the clear-vs-assumed gate before sizing. Read
34
+ `references/scoring-guide.md` before proposing any score; offer the
35
+ review channel (terminal cards, csv, or html via
36
+ `node scripts/score-review.mjs`). Before proposing milestones, read
37
+ `references/slicing.md` — slices are judged there, not computed.
36
38
  4. **Technique**: TRADITIONAL-only — recommend from `references/techniques.md`,
37
39
  state why, cite the method's sources (its §Sources — attribution + link,
38
40
  never quoted text), confirm. AGENTIC reads
@@ -46,7 +48,9 @@ interactive what-if page served on localhost.
46
48
  — fix findings, re-run until clean.
47
49
  9. **Render + serve**:
48
50
  `node scripts/render.mjs --json estimation.json --md estimation.md --out <dir>`
49
- (add `--client-only` for a client-safe file) — render re-runs the validation
51
+ (add `--client-only` for a client-safe file; add `--figures proposal-figures.json`
52
+ once `/proposal` has written it, so the Summary shows the client's quoted
53
+ range) — render re-runs the validation
50
54
  checks itself and refuses on findings, so an unvalidated page cannot ship.
51
55
  `deliveryMode: "agentic"` routes rendering to the agentic HTML template
52
56
  automatically; nothing to choose here. Then serve with the