@v11g/agents-rock 1.0.3 → 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 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. | 1.1.1 |
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.4",
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": "1.1.1",
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,5 +1,5 @@
1
1
  <!doctype html>
2
- <!-- new-lead-dashboard v3 -->
2
+ <!-- new-lead-dashboard v4 -->
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="utf-8">
@@ -8,48 +8,9 @@
8
8
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='%230f766e'/%3E%3C/svg%3E">
9
9
  <title>Lead detail</title>
10
10
  <style>
11
- /* Tokens: same vocabulary as index.html. Full light palette on bare :root,
12
- dark redefines via media query; [data-theme] lets this page's own toggle
13
- force an override in either direction. */
11
+ /* Tokens: same vocabulary as index.html. Dark by default on bare :root;
12
+ [data-theme="light"] is the explicit override this page's toggle sets. */
14
13
  :root {
15
- color-scheme:light;
16
- --bg:#f6f4ef; --bg-sunk:#edeae1; --card:#fffdf9; --card-raised:#fff;
17
- --ink:#1c1b18; --ink-soft:#45423a; --ink-dim:#6c6759;
18
- --border:#e4dfd3; --border-strong:#cec7b6;
19
- --accent:#0f766e; --accent-ink:#0a544f; --accent-soft:rgba(15,118,110,.09); --accent-line:rgba(15,118,110,.38);
20
- --ok:#15803d; --ok-soft:rgba(21,128,61,.1);
21
- --warn:#a55708; --warn-soft:rgba(165,87,8,.1);
22
- --pending-bg:#eae7dd; --pending-border:#c8c1b0; --pending-ink:#857f70;
23
- --focus:#0f766e; --focus-halo:rgba(15,118,110,.22);
24
- --scroll-thumb:#cec7b6; --scroll-thumb-hover:#b3aa95; --scroll-track:transparent;
25
- --tier-flat:0 0 0 1px rgba(0,0,0,.06);
26
- --tier-raised:0 0 0 1px rgba(0,0,0,.06), 0 1px 2px -1px rgba(0,0,0,.06), 0 2px 4px 0 rgba(0,0,0,.04);
27
- --tier-raised-hover:0 0 0 1px rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.08), 0 2px 4px 0 rgba(0,0,0,.06);
28
- --tier-hero:0 0 0 1px rgba(15,118,110,.16), 0 2px 6px -2px rgba(0,0,0,.07), 0 10px 26px -8px rgba(0,0,0,.09);
29
- --tier-sunk:inset 0 1px 3px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.04);
30
- --r-lg:.875rem; --r-md:.625rem; --r-sm:.5rem; --r-xs:.375rem; --r-pill:999px;
31
- --topbar-h:4.25rem; --ease:cubic-bezier(.16, 1, .3, 1);
32
- }
33
- @media (prefers-color-scheme:dark) {
34
- :root:not([data-theme="light"]) {
35
- color-scheme:dark;
36
- --bg:#0f1413; --bg-sunk:#0a0e0d; --card:#171d1c; --card-raised:#1c2322;
37
- --ink:#e9e7e2; --ink-soft:#bdc4c0; --ink-dim:#8d9a95;
38
- --border:#26312f; --border-strong:#3a4946;
39
- --accent:#3fb3a8; --accent-ink:#74d6cc; --accent-soft:rgba(63,179,168,.13); --accent-line:rgba(63,179,168,.42);
40
- --ok:#62c082; --ok-soft:rgba(98,192,130,.13);
41
- --warn:#dd9247; --warn-soft:rgba(221,146,71,.13);
42
- --pending-bg:#171d1c; --pending-border:#35423f; --pending-ink:#737e79;
43
- --focus:#74d6cc; --focus-halo:rgba(116,214,204,.25);
44
- --scroll-thumb:#3a4946; --scroll-thumb-hover:#4f6360;
45
- --tier-flat:0 0 0 1px rgba(255,255,255,.08);
46
- --tier-raised:0 0 0 1px rgba(255,255,255,.08);
47
- --tier-raised-hover:0 0 0 1px rgba(255,255,255,.13);
48
- --tier-hero:0 0 0 1px rgba(116,214,204,.22), 0 10px 30px -12px rgba(0,0,0,.7);
49
- --tier-sunk:inset 0 1px 3px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
50
- }
51
- }
52
- :root[data-theme="dark"] {
53
14
  color-scheme:dark;
54
15
  --bg:#0f1413; --bg-sunk:#0a0e0d; --card:#171d1c; --card-raised:#1c2322;
55
16
  --ink:#e9e7e2; --ink-soft:#bdc4c0; --ink-dim:#8d9a95;
@@ -59,12 +20,31 @@
59
20
  --warn:#dd9247; --warn-soft:rgba(221,146,71,.13);
60
21
  --pending-bg:#171d1c; --pending-border:#35423f; --pending-ink:#737e79;
61
22
  --focus:#74d6cc; --focus-halo:rgba(116,214,204,.25);
62
- --scroll-thumb:#3a4946; --scroll-thumb-hover:#4f6360;
23
+ --scroll-thumb:#3a4946; --scroll-thumb-hover:#4f6360; --scroll-track:transparent;
63
24
  --tier-flat:0 0 0 1px rgba(255,255,255,.08);
64
25
  --tier-raised:0 0 0 1px rgba(255,255,255,.08);
65
26
  --tier-raised-hover:0 0 0 1px rgba(255,255,255,.13);
66
27
  --tier-hero:0 0 0 1px rgba(116,214,204,.22), 0 10px 30px -12px rgba(0,0,0,.7);
67
28
  --tier-sunk:inset 0 1px 3px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
29
+ --r-lg:.875rem; --r-md:.625rem; --r-sm:.5rem; --r-xs:.375rem; --r-pill:999px;
30
+ --topbar-h:4.25rem; --ease:cubic-bezier(.16, 1, .3, 1);
31
+ }
32
+ :root[data-theme="light"] {
33
+ color-scheme:light;
34
+ --bg:#f6f4ef; --bg-sunk:#edeae1; --card:#fffdf9; --card-raised:#fff;
35
+ --ink:#1c1b18; --ink-soft:#45423a; --ink-dim:#6c6759;
36
+ --border:#e4dfd3; --border-strong:#cec7b6;
37
+ --accent:#0f766e; --accent-ink:#0a544f; --accent-soft:rgba(15,118,110,.09); --accent-line:rgba(15,118,110,.38);
38
+ --ok:#15803d; --ok-soft:rgba(21,128,61,.1);
39
+ --warn:#a55708; --warn-soft:rgba(165,87,8,.1);
40
+ --pending-bg:#eae7dd; --pending-border:#c8c1b0; --pending-ink:#857f70;
41
+ --focus:#0f766e; --focus-halo:rgba(15,118,110,.22);
42
+ --scroll-thumb:#cec7b6; --scroll-thumb-hover:#b3aa95;
43
+ --tier-flat:0 0 0 1px rgba(0,0,0,.06);
44
+ --tier-raised:0 0 0 1px rgba(0,0,0,.06), 0 1px 2px -1px rgba(0,0,0,.06), 0 2px 4px 0 rgba(0,0,0,.04);
45
+ --tier-raised-hover:0 0 0 1px rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.08), 0 2px 4px 0 rgba(0,0,0,.06);
46
+ --tier-hero:0 0 0 1px rgba(15,118,110,.16), 0 2px 6px -2px rgba(0,0,0,.07), 0 10px 26px -8px rgba(0,0,0,.09);
47
+ --tier-sunk:inset 0 1px 3px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.04);
68
48
  }
69
49
 
70
50
  /* base */
@@ -454,19 +434,14 @@ function esc(s) {
454
434
  }
455
435
 
456
436
  /* ================================================================== *
457
- * Theme toggle (three-state tokens; this only forces an override).
437
+ * Theme toggle (dark is the page default; light is an explicit override).
458
438
  * ================================================================== */
459
439
  (function () {
460
440
  const buttons = document.querySelectorAll('[data-set-theme]');
461
441
  function mark(theme) {
462
442
  buttons.forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.setTheme === theme)));
463
443
  }
464
- const media = window.matchMedia('(prefers-color-scheme: dark)');
465
- function current() {
466
- return document.documentElement.dataset.theme || (media.matches ? 'dark' : 'light');
467
- }
468
- mark(current());
469
- media.addEventListener('change', () => { if (!document.documentElement.dataset.theme) mark(current()); });
444
+ mark(document.documentElement.dataset.theme || 'dark');
470
445
  buttons.forEach((btn) => btn.addEventListener('click', () => {
471
446
  document.documentElement.dataset.theme = btn.dataset.setTheme;
472
447
  mark(btn.dataset.setTheme);
@@ -1,5 +1,5 @@
1
1
  <!doctype html>
2
- <!-- new-lead-dashboard v2 -->
2
+ <!-- new-lead-dashboard v3 -->
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="utf-8">
@@ -8,51 +8,31 @@
8
8
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='%230f766e'/%3E%3C/svg%3E">
9
9
  <title>Leads</title>
10
10
  <style>
11
- /* Tokens: same vocabulary as the lead detail page. Full light palette on bare
12
- :root, dark redefines only. No [data-theme] override block because this page
13
- ships no theme control. */
11
+ /* Tokens: same vocabulary as the lead detail page. Dark by default on bare
12
+ :root. No light block and no [data-theme] override because this page ships
13
+ no theme control. */
14
14
  :root {
15
- color-scheme:light;
16
- --bg:#f6f4ef; --bg-sunk:#edeae1; --card:#fffdf9; --card-raised:#fff;
17
- --ink:#1c1b18; --ink-soft:#45423a; --ink-dim:#6c6759;
18
- --border:#e4dfd3; --border-strong:#cec7b6;
19
- --accent:#0f766e; --accent-ink:#0a544f; --accent-soft:rgba(15,118,110,.09); --accent-line:rgba(15,118,110,.38);
20
- --ok:#15803d; --ok-soft:rgba(21,128,61,.1);
21
- --warn:#a55708; --warn-soft:rgba(165,87,8,.1);
22
- --pending-bg:#eae7dd; --pending-ink:#857f70;
23
- --focus:#0f766e;
15
+ color-scheme:dark;
16
+ --bg:#0f1413; --bg-sunk:#0a0e0d; --card:#171d1c; --card-raised:#1c2322;
17
+ --ink:#e9e7e2; --ink-soft:#bdc4c0; --ink-dim:#8d9a95;
18
+ --border:#26312f; --border-strong:#3a4946;
19
+ --accent:#3fb3a8; --accent-ink:#74d6cc; --accent-soft:rgba(63,179,168,.13); --accent-line:rgba(63,179,168,.42);
20
+ --ok:#62c082; --ok-soft:rgba(98,192,130,.13);
21
+ --warn:#dd9247; --warn-soft:rgba(221,146,71,.13);
22
+ --pending-bg:#1f2726; --pending-ink:#8d9a95;
23
+ --focus:#74d6cc;
24
24
  /* Opaque: sticky cells paint over scrolling content, so these two cannot be tints. */
25
- --row-hover:#f2efe7; --th-active:#e6e9e4;
26
- --scroll-thumb:#cec7b6; --scroll-thumb-hover:#b3aa95; --scroll-track:transparent;
25
+ --row-hover:#1d2523; --th-active:#152321;
26
+ --scroll-thumb:#3a4946; --scroll-thumb-hover:#4f6360; --scroll-track:transparent;
27
27
  /* Depth tiers: layered transparent shadows instead of borders. */
28
- --tier-flat:0 0 0 1px rgba(0,0,0,.06);
29
- --tier-raised:0 0 0 1px rgba(0,0,0,.06), 0 1px 2px -1px rgba(0,0,0,.06), 0 2px 4px 0 rgba(0,0,0,.04);
30
- --tier-raised-hover:0 0 0 1px rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.08), 0 2px 4px 0 rgba(0,0,0,.06);
31
- --tier-hero:0 0 0 1px rgba(15,118,110,.16), 0 2px 6px -2px rgba(0,0,0,.07), 0 10px 26px -8px rgba(0,0,0,.09);
32
- --tier-sunk:inset 0 1px 3px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.04);
28
+ --tier-flat:0 0 0 1px rgba(255,255,255,.08);
29
+ --tier-raised:0 0 0 1px rgba(255,255,255,.08);
30
+ --tier-raised-hover:0 0 0 1px rgba(255,255,255,.13);
31
+ --tier-hero:0 0 0 1px rgba(116,214,204,.22), 0 10px 30px -12px rgba(0,0,0,.7);
32
+ --tier-sunk:inset 0 1px 3px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
33
33
  --r-lg:.875rem; --r-md:.625rem; --r-sm:.5rem; --r-xs:.375rem; --r-pill:999px;
34
34
  --topbar-h:3.5rem; --ease:cubic-bezier(.16, 1, .3, 1);
35
35
  }
36
- @media (prefers-color-scheme:dark) {
37
- :root {
38
- color-scheme:dark;
39
- --bg:#0f1413; --bg-sunk:#0a0e0d; --card:#171d1c; --card-raised:#1c2322;
40
- --ink:#e9e7e2; --ink-soft:#bdc4c0; --ink-dim:#8d9a95;
41
- --border:#26312f; --border-strong:#3a4946;
42
- --accent:#3fb3a8; --accent-ink:#74d6cc; --accent-soft:rgba(63,179,168,.13); --accent-line:rgba(63,179,168,.42);
43
- --ok:#62c082; --ok-soft:rgba(98,192,130,.13);
44
- --warn:#dd9247; --warn-soft:rgba(221,146,71,.13);
45
- --pending-bg:#1f2726; --pending-ink:#8d9a95;
46
- --focus:#74d6cc;
47
- --row-hover:#1d2523; --th-active:#152321;
48
- --scroll-thumb:#3a4946; --scroll-thumb-hover:#4f6360;
49
- --tier-flat:0 0 0 1px rgba(255,255,255,.08);
50
- --tier-raised:0 0 0 1px rgba(255,255,255,.08);
51
- --tier-raised-hover:0 0 0 1px rgba(255,255,255,.13);
52
- --tier-hero:0 0 0 1px rgba(116,214,204,.22), 0 10px 30px -12px rgba(0,0,0,.7);
53
- --tier-sunk:inset 0 1px 3px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
54
- }
55
- }
56
36
 
57
37
  /* base */
58
38
  * { box-sizing:border-box; }
@@ -1,5 +1,5 @@
1
1
  // scripts/lib/map-nodes.mjs
2
- // new-lead-dashboard v2
2
+ // new-lead-dashboard v3
3
3
  import { readdir } from 'node:fs/promises';
4
4
  import { join } from 'node:path';
5
5
 
@@ -37,7 +37,7 @@ export async function leadNodes(id, dir, src) {
37
37
  const proposalMds = [...ctx.names].filter((n) => isProposalMd(n) && n !== 'proposal.md');
38
38
  const claimed = new Set([...Object.values(NAMED_PAGES), ...proposalMds.map(htmlFor)]);
39
39
  return [
40
- ...evidenceNodes(entries),
40
+ ...evidenceNodes(ctx, entries),
41
41
  ...docNodes(ctx),
42
42
  ...proposalMds.map((n) => docNode(ctx, { key: n, label: n, page: htmlFor(n), exists: true })),
43
43
  ...pageNodes(ctx, claimed),
@@ -51,12 +51,20 @@ function isEvidence(entry) {
51
51
  && !isProposalMd(entry.name);
52
52
  }
53
53
 
54
- function evidenceNodes(entries) {
54
+ // Doc extensions the dashboard server serves from the lead root (serve.mjs DOC_RE).
55
+ const VIEWABLE_RE = /\.(?:md|txt|csv|json|pdf)$/;
56
+
57
+ function evidenceNodes(ctx, entries) {
55
58
  return entries.filter(isEvidence).map((entry) => ({
56
59
  id: `evidence-${entry.name}`,
57
60
  type: 'evidence',
58
61
  position: { x: 0, y: 0 },
59
- data: { label: entry.name, status: 'ready', href: null, detail: null },
62
+ data: {
63
+ label: entry.name,
64
+ status: 'ready',
65
+ href: entry.isFile() && VIEWABLE_RE.test(entry.name) ? `/leads/${ctx.id}/${entry.name}` : null,
66
+ detail: null,
67
+ },
60
68
  }));
61
69
  }
62
70
 
@@ -1,5 +1,5 @@
1
1
  // scripts/serve.mjs
2
- // new-lead-dashboard v3
2
+ // new-lead-dashboard v4
3
3
  import { createServer } from 'node:http';
4
4
  import { readFile, writeFile, realpath, stat, lstat } from 'node:fs/promises';
5
5
  import { join, resolve, sep, extname } from 'node:path';
@@ -12,10 +12,14 @@ import { findFreePort } from './lib/port.mjs';
12
12
 
13
13
  const MIME = {
14
14
  '.html': 'text/html', '.js': 'text/javascript', '.mjs': 'text/javascript', '.css': 'text/css',
15
- '.json': 'application/json', '.svg': 'image/svg+xml', '.md': 'text/plain',
15
+ '.json': 'application/json', '.svg': 'image/svg+xml', '.pdf': 'application/pdf',
16
+ '.md': 'text/plain; charset=utf-8', '.txt': 'text/plain; charset=utf-8', '.csv': 'text/plain; charset=utf-8',
16
17
  };
17
18
  const ID = ID_RE.source.slice(1, -1);
18
19
  const DIST_RE = new RegExp(`^/leads/(${ID})/dist/`);
20
+ // Documents at the lead root (requirements.md, rfp.md, a client PDF, ...) are
21
+ // viewable in the browser: one path segment deep, doc extensions only.
22
+ const DOC_RE = new RegExp(`^/leads/(${ID})/[^/]+\\.(?:md|txt|csv|json|pdf)$`);
19
23
  const SCRIPTS_DIR = 'scripts';
20
24
  const DEFAULT_PORT = 4600;
21
25
 
@@ -128,7 +132,8 @@ function send(res, status, body) {
128
132
  function isAllowlisted(decoded) {
129
133
  return decoded === '/scripts/stats.mjs'
130
134
  || decoded.startsWith('/scripts/vendor/')
131
- || DIST_RE.test(decoded);
135
+ || DIST_RE.test(decoded)
136
+ || DOC_RE.test(decoded);
132
137
  }
133
138
 
134
139
  async function serveStatic(root, pathname, res) {
@@ -26,6 +26,10 @@ test('evidence is the human-dropped files, never the generated artifacts', async
26
26
  assert.ok(!labels.includes(generated), `${generated} must not be listed as evidence`);
27
27
  }
28
28
  });
29
+ test('evidence doc files are clickable, served from the lead root', async () => {
30
+ const m = await buildLeadMap(ROOT, 'acme-crm');
31
+ assert.equal(byId(m, 'evidence-rfp.md').data.href, '/leads/acme-crm/rfp.md');
32
+ });
29
33
  test('components parsed from ARCHITECTURE.md §6 table', async () => {
30
34
  const m = await buildLeadMap(ROOT, 'acme-crm');
31
35
  assert.ok(byId(m, 'component-atlas.api'));
@@ -65,14 +65,31 @@ test('static serving with traversal guard', async () => {
65
65
  assert.equal((await fetch(`${base}/leads/acme-crm/..%2F..%2Fetc%2Fpasswd`)).status, 403);
66
66
  assert.equal((await fetch(`${base}/leads/acme-crm/..%2Fleads.json.lock`)).status, 403);
67
67
  });
68
- test('static allowlist: leads.json, notes.md, rfp.md, brief.md -> 404; stats.mjs, vendor -> 200', async () => {
68
+ test('static allowlist: leads.json -> 404; lead-root docs, stats.mjs, vendor -> 200', async () => {
69
69
  assert.equal((await fetch(`${base}/leads.json`)).status, 404);
70
- assert.equal((await fetch(`${base}/leads/acme-crm/notes.md`)).status, 404);
71
- assert.equal((await fetch(`${base}/leads/acme-crm/rfp.md`)).status, 404);
72
- assert.equal((await fetch(`${base}/leads/acme-crm/brief.md`)).status, 404);
70
+ assert.equal((await fetch(`${base}/leads/acme-crm/notes.md`)).status, 200);
71
+ assert.equal((await fetch(`${base}/leads/acme-crm/rfp.md`)).status, 200);
72
+ assert.equal((await fetch(`${base}/leads/acme-crm/brief.md`)).status, 200);
73
73
  assert.equal((await fetch(`${base}/scripts/stats.mjs`)).status, 200);
74
74
  assert.equal((await fetch(`${base}/scripts/vendor/reactflow-bundle.js`)).status, 200);
75
75
  });
76
+ test('lead-root docs: only doc extensions, only one path segment deep', async () => {
77
+ await writeFile(join(root, 'leads', 'acme-crm', 'script.mjs'), 'export {};\n');
78
+ assert.equal((await fetch(`${base}/leads/acme-crm/script.mjs`)).status, 404);
79
+ await mkdir(join(root, 'leads', 'acme-crm', 'docs'), { recursive: true });
80
+ await writeFile(join(root, 'leads', 'acme-crm', 'docs', 'nested.md'), 'nested\n');
81
+ assert.equal((await fetch(`${base}/leads/acme-crm/docs/nested.md`)).status, 404);
82
+ const md = await fetch(`${base}/leads/acme-crm/rfp.md`);
83
+ assert.equal(md.headers.get('content-type'), 'text/plain; charset=utf-8');
84
+ });
85
+ test('lead-root doc symlinked out of the root is rejected, not followed', async () => {
86
+ const outside = join(root, '..', 'outside-doc.md');
87
+ await writeFile(outside, 'top secret');
88
+ await symlink(outside, join(root, 'leads', 'acme-crm', 'leak.md'));
89
+ const res = await fetch(`${base}/leads/acme-crm/leak.md`);
90
+ assert.ok(res.status >= 400 && res.status < 500, `expected 4xx, got ${res.status}`);
91
+ await rm(outside, { force: true });
92
+ });
76
93
  test('static content-type and body are correct for allowlisted files', async () => {
77
94
  const stats = await fetch(`${base}/scripts/stats.mjs`);
78
95
  assert.equal(stats.headers.get('content-type'), 'text/javascript');
@@ -114,23 +131,10 @@ test('symlink inside dist/ escaping to leads.json is rejected, not the registry'
114
131
  assert.ok(res.status >= 400 && res.status < 500, `expected 4xx, got ${res.status}`);
115
132
  assert.doesNotMatch(await res.text(), /Beta Shop/);
116
133
  });
117
- test('symlink inside dist/ escaping to notes.md is rejected, not the notes', async () => {
118
- await symlink(join(root, 'leads', 'acme-crm', 'notes.md'), join(root, 'leads', 'acme-crm', 'dist', 'notes-leak.md'));
119
- const res = await fetch(`${base}/leads/acme-crm/dist/notes-leak.md`);
120
- assert.ok(res.status >= 400 && res.status < 500, `expected 4xx, got ${res.status}`);
121
- assert.doesNotMatch(await res.text(), /omnichannel/);
122
- });
123
- test('symlinks inside dist/ escaping to brief.md and rfp.md are also rejected', async () => {
124
- const targets = [
125
- ['brief.md', /aging spreadsheet-based/],
126
- ['rfp.md', /Request for Proposal/],
127
- ];
128
- for (const [name, marker] of targets) {
129
- await symlink(join(root, 'leads', 'acme-crm', name), join(root, 'leads', 'acme-crm', 'dist', `escape-${name}`));
130
- const res = await fetch(`${base}/leads/acme-crm/dist/escape-${name}`);
131
- assert.ok(res.status >= 400 && res.status < 500, `${name}: expected 4xx, got ${res.status}`);
132
- assert.doesNotMatch(await res.text(), marker);
133
- }
134
+ test('symlink inside dist/ to a lead-root doc serves 200 — those docs are allowlisted directly now', async () => {
135
+ await symlink(join(root, 'leads', 'acme-crm', 'rfp.md'), join(root, 'leads', 'acme-crm', 'dist', 'alias-rfp.md'));
136
+ const res = await fetch(`${base}/leads/acme-crm/dist/alias-rfp.md`);
137
+ assert.equal(res.status, 200);
134
138
  });
135
139
  test('symlinked directory inside dist/ cannot reach leads.json through it', async () => {
136
140
  await symlink(root, join(root, 'leads', 'acme-crm', 'dist', 'sub'));