@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
@@ -3,7 +3,7 @@
3
3
  // currently visible rows, and keeps every tier/price formula live in-cell.
4
4
  import { test } from 'node:test';
5
5
  import assert from 'node:assert/strict';
6
- import { mkdtempSync } from 'node:fs';
6
+ import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
7
7
  import { execFileSync } from 'node:child_process';
8
8
  import { tmpdir } from 'node:os';
9
9
  import { join } from 'node:path';
@@ -15,11 +15,11 @@ import { readZip } from './zip.mjs';
15
15
  const skip = { skip: !findChrome() && 'no chrome on PATH' };
16
16
  const fixture = new URL('./fixtures/booking-inputs.json', import.meta.url).pathname;
17
17
 
18
- function buildPage() {
18
+ function buildPage(inputsPath = fixture) {
19
19
  const dir = mkdtempSync(join(tmpdir(), 'estimate-xlsx-'));
20
20
  const scripts = new URL('..', import.meta.url).pathname;
21
21
  const passMd = join(scripts, 'test/fixtures/estimation-pass.md');
22
- execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', fixture, '--out', join(dir, 'estimation.json')]);
22
+ execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', inputsPath, '--out', join(dir, 'estimation.json')]);
23
23
  execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', passMd, '--out', dir]);
24
24
  return pathToFileURL(join(dir, 'estimate.html')).href;
25
25
  }
@@ -30,17 +30,19 @@ async function exportedFiles(page) {
30
30
  }
31
31
 
32
32
  const sheet1 = (files) => files.get('xl/worksheets/sheet1.xml').toString('utf8');
33
- const cell = (xml, ref) => new RegExp(`<c r="${ref}"[^>]*>(.*?)</c>`, 's').exec(xml)?.[1] ?? '';
33
+ const cell = (xml, ref) => new RegExp(`<c r="${ref}"[^>]*?(?:/>|>(.*?)</c>)`, 's').exec(xml)?.[1] ?? '';
34
34
  const inlineText = (frag) => /<t[^>]*>([^<]*)<\/t>/.exec(frag)?.[1];
35
35
  const cellNumber = (frag) => Number(/<v>([^<]*)<\/v>/.exec(frag)?.[1]);
36
36
  const cellFormula = (frag) => /<f>([^<]*)<\/f>/.exec(frag)?.[1];
37
37
 
38
- test('the breakdown filter bar carries an internal-only download button', skip, async () => {
38
+ // The workbook carries a Task Breakdown sheet and a Score Rationale sheet, so
39
+ // the export answers for the whole section rather than for either tab.
40
+ test('the section heading carries an internal-only download button', skip, async () => {
39
41
  const page = await openPage(buildPage());
40
42
  try {
41
43
  assert.ok(await page.eval(
42
- `!!document.querySelector('#feature-table .bd-filters button[data-download][data-internal]')`),
43
- 'expected a data-download button marked data-internal in the filter bar');
44
+ `!!document.querySelector('#feature-table .sec-head button[data-download][data-internal]')`),
45
+ 'expected a data-download button marked data-internal on the section heading');
44
46
  } finally { page.close(); }
45
47
  });
46
48
 
@@ -58,35 +60,90 @@ test('the export clones the sample workbook with its guide tabs intact', skip, a
58
60
  } finally { page.close(); }
59
61
  });
60
62
 
61
- test('rows land as inline strings ordered by milestone with derived 1-5 scores', skip, async () => {
63
+ test('rows land ordered by milestone with the interview scores verbatim', skip, async () => {
62
64
  const page = await openPage(buildPage());
63
65
  try {
64
66
  const xml = sheet1(await exportedFiles(page));
65
- // M1 feature before M2 feature regardless of the table's hour sort
66
67
  assert.equal(inlineText(cell(xml, 'A7')), 'User can book appointment');
67
68
  assert.equal(inlineText(cell(xml, 'A8')), 'Email reminders');
68
- for (const row of [7, 8]) {
69
- for (const col of ['B', 'C', 'D', 'E', 'F']) {
70
- const v = cellNumber(cell(xml, `${col}${row}`));
71
- assert.ok(Number.isInteger(v) && v >= 1 && v <= 5, `${col}${row} must be 1-5, got ${v}`);
72
- }
73
- }
69
+ assert.deepEqual(['B', 'C', 'D', 'E', 'F'].map((c) => cellNumber(cell(xml, `${c}7`))), [3, 3, 2, 3, 3]);
70
+ assert.deepEqual(['B', 'C', 'D', 'E', 'F'].map((c) => cellNumber(cell(xml, `${c}8`))), [2, 2, 3, 2, 2]);
71
+ } finally { page.close(); }
72
+ });
73
+
74
+ // Row 6 is the sample workbook's own header row — the export never writes it,
75
+ // it writes scores into B–F underneath. Pin the seam: if the sample's score
76
+ // columns are ever reordered or renamed, every exported score lands under the
77
+ // wrong heading and nothing else would notice. The sample keeps these as
78
+ // shared strings, unlike the cells the export writes inline.
79
+ function sharedText(files, frag) {
80
+ const idx = Number(/<v>(\d+)<\/v>/.exec(frag)?.[1]);
81
+ const items = [...files.get('xl/sharedStrings.xml').toString('utf8').matchAll(/<si>([\s\S]*?)<\/si>/g)];
82
+ return [...items[idx][1].matchAll(/<t[^>]*>([^<]*)<\/t>/g)].map((m) => m[1]).join('');
83
+ }
84
+
85
+ const headerText = (files, frag) => inlineText(frag) ?? sharedText(files, frag);
86
+
87
+ test('the score columns sit under the sample workbook\'s five score headers', skip, async () => {
88
+ const page = await openPage(buildPage());
89
+ try {
90
+ const files = await exportedFiles(page);
91
+ const xml = sheet1(files);
92
+ assert.deepEqual(['B', 'C', 'D', 'E', 'F'].map((c) => headerText(files, cell(xml, `${c}6`))),
93
+ ['TECH\nCOMPLEXITY\n(1–5)', 'FEATURE\nSIZE\n(1–5)', 'DEPEND-\nENCIES\n(1–5)',
94
+ 'UNCER-\nTAINTY\n(1–5)', 'RISK\n(1–5)']);
74
95
  } finally { page.close(); }
75
96
  });
76
97
 
77
- test('tech and size scores follow the Scoring Guide definitions', skip, async () => {
98
+ test('column N carries the plain-words note for sales readers', skip, async () => {
78
99
  const page = await openPage(buildPage());
79
100
  try {
80
101
  const xml = sheet1(await exportedFiles(page));
81
- // TECH: hours-weighted category score (boilerplate 1.5, logic 3, novel 5).
82
- // Booking mixes boilerplate(25.3h) + logic(44h) → 2.45 → 2; reminders is
83
- // logic-only → 3.
84
- assert.equal(cellNumber(cell(xml, 'B7')), 2);
85
- assert.equal(cellNumber(cell(xml, 'B8')), 3);
86
- // SIZE: absolute expected-hour bands [8, 24, 64, 128] per the guide's
87
- // "<1 day → epic" scale. Booking ≈69h → 4; reminders ≈21h → 2.
88
- assert.equal(cellNumber(cell(xml, 'C7')), 4);
89
- assert.equal(cellNumber(cell(xml, 'C8')), 2);
102
+ assert.equal(inlineText(cell(xml, 'N6')), 'WHY THIS TIER');
103
+ assert.match(inlineText(cell(xml, 'N7')) ?? '', /open questions/);
104
+ assert.match(xml, /<autoFilter ref="A6:N26"\/>/);
105
+ } finally { page.close(); }
106
+ });
107
+
108
+ const sheetRationale = (files) => files.get('xl/worksheets/sheet5.xml')?.toString('utf8') ?? '';
109
+
110
+ test('a Score Rationale tab lists anchor, evidence and provenance per factor', skip, async () => {
111
+ const page = await openPage(buildPage());
112
+ try {
113
+ const files = await exportedFiles(page);
114
+ assert.match(files.get('xl/workbook.xml').toString('utf8'), /name="Score Rationale"/);
115
+ assert.match(files.get('xl/_rels/workbook.xml.rels').toString('utf8'), /Target="worksheets\/sheet5\.xml"/);
116
+ assert.match(files.get('[Content_Types].xml').toString('utf8'), /PartName="\/xl\/worksheets\/sheet5\.xml"/);
117
+ const xml = sheetRationale(files);
118
+ assert.deepEqual(['A1', 'B1', 'C1', 'D1', 'E1', 'F1'].map((r) => inlineText(cell(xml, r))),
119
+ ['FEATURE', 'FACTOR', 'SCORE', 'ANCHOR', 'EVIDENCE', 'PROVENANCE']);
120
+ assert.equal(inlineText(cell(xml, 'A2')), 'User can book appointment');
121
+ assert.equal(inlineText(cell(xml, 'B2')), 'Tech');
122
+ assert.equal(cellNumber(cell(xml, 'C2')), 3);
123
+ assert.equal(inlineText(cell(xml, 'D2')), 'Custom business logic, moderate algorithm complexity, multiple states');
124
+ assert.equal(inlineText(cell(xml, 'E2')), 'slot conflict + cancellation rules');
125
+ assert.equal(inlineText(cell(xml, 'F2')), 'stated');
126
+ assert.match(xml, /<autoFilter ref="A1:F11"\/>/); // 2 features × 5 factors
127
+ } finally { page.close(); }
128
+ });
129
+
130
+ test('QUICK inputs export blank score cells and an empty rationale tab', skip, async () => {
131
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-xlsx-quick-'));
132
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
133
+ inputs.depth = 'QUICK';
134
+ for (const f of inputs.features) {
135
+ delete f.scores; delete f.scoreNote; delete f.scoreProvenance;
136
+ f.tasks = [{ ...f.tasks[0], id: `${f.id}-band`, o: 60, m: 110, p: 160 }];
137
+ }
138
+ const inputsPath = join(dir, 'inputs.json');
139
+ writeFileSync(inputsPath, JSON.stringify(inputs));
140
+ const page = await openPage(buildPage(inputsPath));
141
+ try {
142
+ const files = await exportedFiles(page);
143
+ const xml = sheet1(files);
144
+ assert.equal(cell(xml, 'B7'), '', 'no score value at QUICK');
145
+ assert.match(xml, /<c r="B7" s="\d+"\/>/);
146
+ assert.match(sheetRationale(files), /<autoFilter ref="A1:F1"\/>/);
90
147
  } finally { page.close(); }
91
148
  });
92
149
 
@@ -113,14 +170,18 @@ test('milestone and container fill L/M under an autofiltered header', skip, asyn
113
170
  assert.equal(inlineText(cell(xml, 'L7')), 'M1 - Booking core');
114
171
  assert.equal(inlineText(cell(xml, 'M7')), 'Booking API');
115
172
  assert.equal(inlineText(cell(xml, 'M8')), 'Notification Service');
116
- assert.match(xml, /<autoFilter ref="A6:M26"\/>/);
173
+ assert.match(xml, /<autoFilter ref="A6:N26"\/>/);
117
174
  } finally { page.close(); }
118
175
  });
119
176
 
120
177
  test('the export honours the active source filter', skip, async () => {
121
178
  const page = await openPage(buildPage());
122
179
  try {
123
- await page.eval(`document.querySelector('#feature-table [data-prov="stated"]').click()`);
180
+ await page.eval(`(() => {
181
+ const sel = document.querySelector('#feature-table select[data-select="prov"]');
182
+ sel.value = 'stated';
183
+ sel.dispatchEvent(new Event('change', { bubbles: true }));
184
+ })()`);
124
185
  const xml = sheet1(await exportedFiles(page));
125
186
  assert.match(xml, /User can book appointment/);
126
187
  assert.doesNotMatch(xml, /Email reminders/);
@@ -144,7 +205,11 @@ test('the export adds a registered Task Breakdown tab', skip, async () => {
144
205
  test('task rows carry the PERT formula in-cell and ride the feature filter', skip, async () => {
145
206
  const page = await openPage(buildPage());
146
207
  try {
147
- await page.eval(`document.querySelector('#feature-table [data-prov="stated"]').click()`);
208
+ await page.eval(`(() => {
209
+ const sel = document.querySelector('#feature-table select[data-select="prov"]');
210
+ sel.value = 'stated';
211
+ sel.dispatchEvent(new Event('change', { bubbles: true }));
212
+ })()`);
148
213
  const xml = sheetTasks(await exportedFiles(page));
149
214
  assert.equal(inlineText(cell(xml, 'A2')), 'User can book appointment');
150
215
  assert.equal(inlineText(cell(xml, 'B2')), 'Booking CRUD API');
@@ -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
 
@@ -119,6 +127,6 @@ function scenarioNodes(est) {
119
127
  id: `scenario-${s.id ?? s.name}`,
120
128
  type: 'scenario',
121
129
  position: { x: 0, y: 0 },
122
- data: { label: s.label ?? s.plan ?? String(s.id ?? s.name), status: 'ready', href: null, detail: null },
130
+ data: { label: s.label ?? String(s.id ?? s.name), status: 'ready', href: null, detail: null },
123
131
  }));
124
132
  }
@@ -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'));
@@ -8,8 +8,8 @@ import { JARGON } from '../lib/jargon.mjs';
8
8
  const estimation = {
9
9
  inputs: {
10
10
  scenarios: [
11
- { id: 's1', plan: 'max5x', team: [{ seniority: 'senior', rate: 50 }] },
12
- { id: 's2-secret', plan: 'none', team: [{ seniority: 'mid', rate: 40 }] },
11
+ { id: 's1', aiAssisted: true, toolingCostPerSeat: 100, team: [{ seniority: 'senior', rate: 50 }] },
12
+ { id: 's2-secret', aiAssisted: false, toolingCostPerSeat: null, team: [{ seniority: 'mid', rate: 40 }] },
13
13
  ],
14
14
  },
15
15
  computed: {
@@ -11,7 +11,7 @@ import { deriveFigures, formatMoney } from '../lib/figures.mjs';
11
11
  const estimation = {
12
12
  inputs: {
13
13
  scenarios: [{
14
- id: 's1', plan: 'max5x',
14
+ id: 's1', aiAssisted: true, toolingCostPerSeat: 100,
15
15
  team: [{ seniority: 'senior', rate: 50 }, { seniority: 'mid', rate: 40 }],
16
16
  }],
17
17
  },