@v11g/agents-rock 1.0.11 → 1.0.13

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 (48) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
  4. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
  5. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
  6. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
  7. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
  8. package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
  9. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-312.pyc +0 -0
  10. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-312.pyc +0 -0
  11. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-312.pyc +0 -0
  12. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-312.pyc +0 -0
  13. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-312.pyc +0 -0
  14. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-312.pyc +0 -0
  15. package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-312.pyc +0 -0
  16. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  17. package/plugins/solution-architect/evals/workflow-happy-path/graders/workflow-or-exact-stop.md +1 -1
  18. package/plugins/solution-architect/skills/estimate/evals/evals.json +1 -1
  19. package/plugins/solution-architect/skills/estimate/workflow-based/FLOW.md +6 -2
  20. package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-components.html +96 -19
  21. package/plugins/solution-architect/skills/estimate/workflow-based/assets/score-review.html +73 -9
  22. package/plugins/solution-architect/skills/estimate/workflow-based/references/linking.md +3 -2
  23. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +7 -2
  24. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-template.mjs +14 -1
  25. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +2 -2
  26. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +17 -0
  27. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +18 -16
  28. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/also-builds.css +3 -0
  29. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/also-builds.js +16 -0
  30. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/feature-tasks.js +21 -0
  31. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/link-picker.css +8 -0
  32. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/link-picker.js +43 -0
  33. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/also-builds-browser.test.mjs +63 -0
  34. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/feature-tasks-browser.test.mjs +30 -0
  35. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +8 -8
  36. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/link-picker-browser.test.mjs +83 -0
  37. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/page-html.test.mjs +14 -0
  38. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/render.test.mjs +1 -1
  39. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +8 -0
  40. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/schema.test.mjs +3 -0
  41. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/stage.mjs +19 -1
  42. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +6 -5
  43. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +35 -8
  44. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +35 -8
  45. package/src/cli/install.mjs +18 -2
  46. package/src/cli/registry.mjs +8 -0
  47. package/src/cli/targets.mjs +4 -2
  48. package/src/cli/uninstall.mjs +11 -1
@@ -0,0 +1,21 @@
1
+ // ---- components: tasks and hours, per feature (Component-based page only) ----
2
+ // TASKS[component]: [name, low, expected, high, confidence, assumptions, features].
3
+ // A task shared by k features counts 1/k of its hours on each card, so the
4
+ // cards add up to the project total.
5
+ const pert = (x) => x[2]; // expected hours from estimation.json (agentic baselines)
6
+ const hoursOf = (id) => Math.round((TASKS[id] || []).reduce((n, x) => n + pert(x), 0));
7
+ const tasksFor = (id, capId) => (TASKS[id] || []).filter((x) => x[6].includes(capId));
8
+ const hoursFor = (id, capId) => Math.round(tasksFor(id, capId).reduce((n, x) => n + pert(x) / x[6].length, 0));
9
+ const sysHours = (ids) => Math.round(COMPS.flatMap((b) => TASKS[b.id] || []).filter((x) => x[6].some((f) => ids.includes(f))).reduce((n, x) => n + pert(x), 0));
10
+ function sharedNote(x, capId) {
11
+ const others = x[6].filter((f) => f !== capId);
12
+ return others.length ? `<div class="dim">shared with ${others.map(esc).join(', ')} · 1/${x[6].length} of its hours counted here</div>` : '';
13
+ }
14
+ function taskRow(x, capId) {
15
+ const note = x[5] ? `<div class="dim">${esc(x[5])}</div>` : '';
16
+ return `<tr><td>${esc(x[0])}${note}${sharedNote(x, capId)}</td><td class="r">${x[1]} / ${x[2]} / ${x[3]}</td><td class="r"><b>${Math.round(pert(x))}h</b></td><td><span class="conf c-${x[4]}">${x[4]}</span></td></tr>`;
17
+ }
18
+ function tasksHtml(b, capId) {
19
+ const ts = tasksFor(b.id, capId);
20
+ return `<details class="tasks side-effort"><summary>${esc(b.name)} · ${ts.length} tasks · ${hoursFor(b.id, capId)}h for this feature</summary><table><tr><th>Task</th><th class="r">Low / Expected / High h</th><th class="r">Expected</th><th>Confidence</th></tr>${ts.map((x) => taskRow(x, capId)).join('')}</table></details>`;
21
+ }
@@ -0,0 +1,8 @@
1
+ .lpick { position:relative; width:100%; max-width:28rem; margin-top:.4rem; }
2
+ .lpick input { width:100%; box-sizing:border-box; font:inherit; font-size:.85rem; padding:.35rem .6rem; color:var(--ink); background:var(--sheet); border:1px dashed var(--ink-dim); border-radius:.3rem; }
3
+ .lpick input:focus { border-style:solid; border-color:var(--ink); outline:none; }
4
+ .lpick-list { position:absolute; z-index:20; left:0; right:0; top:calc(100% + .2rem); max-height:20rem; overflow:auto; background:var(--sheet); border:1px solid var(--grid); border-radius:.3rem; box-shadow:0 6px 18px rgba(0,0,0,.25); padding:.25rem 0; }
5
+ .lpick-g { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-dim); padding:.35rem .7rem .15rem; }
6
+ .lpick-o { font-size:.88rem; padding:.3rem .7rem .3rem 1.3rem; cursor:pointer; }
7
+ .lpick-o.lpick-cur { background:var(--hi); }
8
+ .lpick-none { padding:.4rem .7rem; font-size:.85rem; }
@@ -0,0 +1,43 @@
1
+ // "+ Link a component": a wide search box; typing filters by component or container name
2
+ const pickerHtml = (capId) => `<div class="lpick" data-lpick="${capId}"><input type="search" data-lpick-q placeholder="+ Link a component… type to filter" aria-label="Link a component" autocomplete="off"><div class="lpick-list hide" role="listbox"></div></div>`;
3
+ const pickOpt = (b) => `<div class="lpick-o" role="option" data-lpick-id="${b.id}">${esc(b.name)}${notAsked(b.id) ? '<span class="dim"> · builds nothing yet</span>' : ''}</div>`;
4
+ function pickList(capId, q) {
5
+ const by = buildersOf(capId); const t = q.trim().toLowerCase();
6
+ const hit = (b) => !by.includes(b.id) && `${b.name} ${b.container}`.toLowerCase().includes(t);
7
+ const groups = [...new Set(COMPS.map((b) => b.container))].map((g) => [g, COMPS.filter((b) => b.container === g && hit(b))]).filter(([, bs]) => bs.length);
8
+ if (!groups.length) return '<div class="lpick-none dim">No component matches</div>';
9
+ return groups.map(([g, bs]) => `<div class="lpick-g">${esc(g)}</div>${bs.map(pickOpt).join('')}`).join('');
10
+ }
11
+ function openPick(inp) {
12
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box);
13
+ list.innerHTML = pickList(box.dataset.lpick, inp.value); list.classList.remove('hide');
14
+ $('.lpick-o', list)?.classList.add('lpick-cur');
15
+ }
16
+ function movePick(list, d) {
17
+ const os = [...list.querySelectorAll('.lpick-o')]; if (!os.length) return;
18
+ const i = os.findIndex((o) => o.classList.contains('lpick-cur'));
19
+ os.forEach((o) => o.classList.remove('lpick-cur'));
20
+ const n = os[(i + d + os.length) % os.length]; n.classList.add('lpick-cur'); n.scrollIntoView({ block: 'nearest' });
21
+ }
22
+ function pickComp(capId, bid) { links[bid] = [...links[bid], capId]; relink(); }
23
+ function onPickKey(e) {
24
+ const inp = e.target.closest?.('[data-lpick-q]'); if (!inp) return;
25
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box); const cur = $('.lpick-o.lpick-cur', list);
26
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); if (list.classList.contains('hide')) openPick(inp); else movePick(list, e.key === 'ArrowDown' ? 1 : -1); }
27
+ if (e.key === 'Enter') { e.preventDefault(); if (cur && !list.classList.contains('hide')) pickComp(box.dataset.lpick, cur.dataset.lpickId); }
28
+ if (e.key === 'Escape') { inp.value = ''; list.classList.add('hide'); }
29
+ }
30
+ const pickInput = (e) => e.target.closest?.('[data-lpick-q]');
31
+ document.addEventListener('focusin', (e) => { const q = pickInput(e); if (q) openPick(q); });
32
+ document.addEventListener('input', (e) => { const q = pickInput(e); if (q) openPick(q); });
33
+ document.addEventListener('focusout', (e) => { const q = pickInput(e); if (q) $('.lpick-list', q.closest('.lpick')).classList.add('hide'); });
34
+ document.addEventListener('keydown', onPickKey);
35
+ // mousedown would blur the box and close the list before the click lands
36
+ document.addEventListener('mousedown', (e) => { if (e.target.closest('.lpick-list')) e.preventDefault(); });
37
+ document.addEventListener('click', (e) => { const o = e.target.closest('.lpick-o'); if (o) pickComp(o.closest('.lpick').dataset.lpick, o.dataset.lpickId); });
38
+ // hovering a row moves the highlight, so mouse and keyboard never show two
39
+ document.addEventListener('mouseover', (e) => {
40
+ const o = e.target.closest?.('.lpick-o'); if (!o) return;
41
+ o.parentNode.querySelectorAll('.lpick-cur').forEach((x) => x.classList.remove('lpick-cur'));
42
+ o.classList.add('lpick-cur');
43
+ });
@@ -0,0 +1,63 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { findChrome } from '../../../../analyze-requirements/scripts/lib/chrome.mjs';
4
+ import { openPage } from '../../../../analyze-requirements/scripts/lib/cdp.mjs';
5
+ import { reviewPage, componentsPage } from './stage.mjs';
6
+
7
+ const skip = !findChrome();
8
+ const settle = () => new Promise((r) => setTimeout(r, 1500));
9
+ // office builds FEAT-001, 003, 005; adding 002 and 004 gives FEAT-001's row 4 others
10
+ const wide = (i) => {
11
+ const office = i.components.find((c) => c.id === 'office');
12
+ office.builds.push({ feature: 'FEAT-002', why: 'a' }, { feature: 'FEAT-004', why: 'b' });
13
+ office.tasks[0].features.push('FEAT-002', 'FEAT-004');
14
+ };
15
+
16
+ const one = (i) => i.components.find((c) => c.id === 'office').builds.push({ feature: 'FEAT-002', why: 'a' });
17
+
18
+ const ROW = `document.querySelector('[data-builtby="FEAT-001"] [data-comp-chip="office"] .calso')`;
19
+ const shown = (page) => page.eval(`[...${ROW}.querySelectorAll('.cmini')].filter((x) => getComputedStyle(x).display !== 'none').map((x) => x.dataset.capChip)`);
20
+ const button = (page) => page.eval(`(() => { const b = ${ROW}.querySelector('[data-also-more]'); return b && { text: b.textContent, open: b.getAttribute('aria-expanded') }; })()`);
21
+ const toggle = (page) => page.eval(`${ROW}.querySelector('[data-also-more]').click()`);
22
+ const pinned = (page) => page.eval(`!document.getElementById('pinbar').classList.contains('hide')`);
23
+
24
+ async function foldsAndUnfolds(url) {
25
+ const page = await openPage(url);
26
+ try {
27
+ await settle();
28
+ assert.deepEqual(await shown(page), ['FEAT-003']);
29
+ assert.deepEqual(await button(page), { text: '…3 more', open: 'false' });
30
+ await toggle(page);
31
+ assert.deepEqual(await shown(page), ['FEAT-003', 'FEAT-005', 'FEAT-002', 'FEAT-004']);
32
+ assert.deepEqual(await button(page), { text: 'show less', open: 'true' });
33
+ assert.equal(await pinned(page), false);
34
+ await toggle(page);
35
+ assert.deepEqual(await shown(page), ['FEAT-003']);
36
+ assert.deepEqual(await button(page), { text: '…3 more', open: 'false' });
37
+ assert.deepEqual(page.errors, []);
38
+ } finally { await page.close(); }
39
+ }
40
+
41
+ test('score review: 3+ other features fold behind "…N more" and unfold', { skip }, () => foldsAndUnfolds(reviewPage(wide)));
42
+
43
+ test('estimate (component-based): the same fold', { skip }, () => foldsAndUnfolds(componentsPage(wide)));
44
+
45
+ test('two other features show both chips and no button', { skip }, async () => {
46
+ const page = await openPage(reviewPage());
47
+ try {
48
+ await settle();
49
+ assert.deepEqual(await shown(page), ['FEAT-003', 'FEAT-005']);
50
+ assert.equal(await button(page), null);
51
+ assert.deepEqual(page.errors, []);
52
+ } finally { await page.close(); }
53
+ });
54
+
55
+ test('exactly three other features: one chip and "…2 more"', { skip }, async () => {
56
+ const page = await openPage(reviewPage(one));
57
+ try {
58
+ await settle();
59
+ assert.deepEqual(await shown(page), ['FEAT-003']);
60
+ assert.deepEqual(await button(page), { text: '…2 more', open: 'false' });
61
+ assert.deepEqual(page.errors, []);
62
+ } finally { await page.close(); }
63
+ });
@@ -0,0 +1,30 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { findChrome } from '../../../../analyze-requirements/scripts/lib/chrome.mjs';
4
+ import { openPage } from '../../../../analyze-requirements/scripts/lib/cdp.mjs';
5
+ import { componentsPage } from './stage.mjs';
6
+
7
+ const skip = !findChrome();
8
+ const settle = () => new Promise((r) => setTimeout(r, 1500));
9
+ // stage-engine serves FEAT-001 and FEAT-002; stage-tests moves to FEAT-002 only
10
+ const split = (i) => { i.components.find((c) => c.id === 'api.stage').tasks[1].features = ['FEAT-002']; };
11
+
12
+ const STAGE = (cap) => `[...document.querySelectorAll('#c-${cap} details.tasks')].find((d) => d.querySelector('summary').textContent.startsWith('Stage Engine'))`;
13
+ const taskNames = (page, cap) => page.eval(`[...${STAGE(cap)}.querySelectorAll('tr td:first-child')].map((td) => td.firstChild.textContent)`);
14
+ const firstRow = (page, cap) => page.eval(`${STAGE(cap)}.querySelector('tr td:first-child').textContent`);
15
+ const hrs = (s) => Number(s.replace(/[,h]/g, ''));
16
+ const cardSum = (page) => page.eval(`[...document.querySelectorAll('[data-hrs]')].map((b) => b.textContent)`);
17
+ const total = (page) => page.eval(`[...document.querySelectorAll('#strip div')].find((d) => d.textContent.includes('expected effort')).querySelector('b').textContent`);
18
+
19
+ test('a feature card lists only the tasks that serve it; card hours add up to the total', { skip }, async () => {
20
+ const page = await openPage(componentsPage(split));
21
+ try {
22
+ await settle();
23
+ assert.deepEqual(await taskNames(page, 'FEAT-001'), ['Stage transitions with audit']);
24
+ assert.deepEqual(await taskNames(page, 'FEAT-002'), ['Stage transitions with audit', 'Transition tests']);
25
+ assert.match(await firstRow(page, 'FEAT-002'), /shared with FEAT-001/);
26
+ const sum = (await cardSum(page)).reduce((n, s) => n + hrs(s), 0);
27
+ assert.ok(Math.abs(sum - hrs(await total(page))) <= 5, `cards ${sum}h vs total ${await total(page)}`);
28
+ assert.deepEqual(page.errors, []);
29
+ } finally { await page.close(); }
30
+ });
@@ -50,25 +50,25 @@
50
50
  { "id": "api", "name": "Core API" },
51
51
  { "id": "api.stage", "name": "Stage Engine", "parent": "api", "milestone": "M1 - Walking skeleton",
52
52
  "builds": [ { "feature": "FEAT-001", "why": "moves Orders through the five stages" }, { "feature": "FEAT-002", "why": "raises the Short-Pack alert on a can't-fulfil line" } ],
53
- "tasks": [ { "id": "stage-engine", "name": "Stage transitions with audit", "shape": "small_implementation", "scope": { "affectedFiles": 8, "complexity": "medium" }, "seedMinutes": { "o": 90, "m": 180, "p": 360 }, "assumptions": [], "provenance": "proposed" },
54
- { "id": "stage-tests", "name": "Transition tests", "shape": "test_creation", "scope": { "affectedFiles": 3, "complexity": "low" }, "seedMinutes": { "o": 30, "m": 60, "p": 120 }, "assumptions": [], "provenance": "proposed" } ] },
53
+ "tasks": [ { "id": "stage-engine", "features": ["FEAT-001", "FEAT-002"], "name": "Stage transitions with audit", "shape": "small_implementation", "scope": { "affectedFiles": 8, "complexity": "medium" }, "seedMinutes": { "o": 90, "m": 180, "p": 360 }, "assumptions": [], "provenance": "proposed" },
54
+ { "id": "stage-tests", "features": ["FEAT-001"], "name": "Transition tests", "shape": "test_creation", "scope": { "affectedFiles": 3, "complexity": "low" }, "seedMinutes": { "o": 30, "m": 60, "p": 120 }, "assumptions": [], "provenance": "proposed" } ] },
55
55
  { "id": "api.orders", "name": "Orders and Quoting", "parent": "api", "milestone": "M1 - Walking skeleton",
56
56
  "builds": [ { "feature": "FEAT-003", "why": "owns Order, Quotation and the cost-plus pricing rule" } ],
57
- "tasks": [ { "id": "orders-impl", "name": "Order and quotation aggregate", "shape": "small_implementation", "scope": { "affectedFiles": 10, "complexity": "medium" }, "seedMinutes": { "o": 120, "m": 240, "p": 480 }, "assumptions": [], "provenance": "proposed" } ] },
57
+ "tasks": [ { "id": "orders-impl", "features": ["FEAT-003"], "name": "Order and quotation aggregate", "shape": "small_implementation", "scope": { "affectedFiles": 10, "complexity": "medium" }, "seedMinutes": { "o": 120, "m": 240, "p": 480 }, "assumptions": [], "provenance": "proposed" } ] },
58
58
  { "id": "api.billing", "name": "Billing", "parent": "api", "milestone": "M2 - Money",
59
59
  "builds": [ { "feature": "FEAT-005", "why": "invoice qty = accepted packed qty; issued invoices never edited" } ],
60
- "tasks": [ { "id": "billing-match", "name": "Three-way match", "shape": "small_implementation", "scope": { "affectedFiles": 6, "complexity": "medium" }, "seedMinutes": { "o": 60, "m": 120, "p": 240 }, "assumptions": [], "provenance": "proposed" },
61
- { "id": "billing-docs", "name": "Printable invoice", "shape": "small_implementation", "scope": { "affectedFiles": 4, "complexity": "low" }, "seedMinutes": { "o": 40, "m": 80, "p": 160 }, "assumptions": [], "provenance": "proposed" } ] },
60
+ "tasks": [ { "id": "billing-match", "features": ["FEAT-005"], "name": "Three-way match", "shape": "small_implementation", "scope": { "affectedFiles": 6, "complexity": "medium" }, "seedMinutes": { "o": 60, "m": 120, "p": 240 }, "assumptions": [], "provenance": "proposed" },
61
+ { "id": "billing-docs", "features": ["FEAT-005"], "name": "Printable invoice", "shape": "small_implementation", "scope": { "affectedFiles": 4, "complexity": "low" }, "seedMinutes": { "o": 40, "m": 80, "p": 160 }, "assumptions": [], "provenance": "proposed" } ] },
62
62
  { "id": "office", "name": "Office Web App", "milestone": "M1 - Walking skeleton",
63
63
  "builds": [ { "feature": "FEAT-001", "why": "stage board and task views" }, { "feature": "FEAT-003", "why": "order intake and quote screens" }, { "feature": "FEAT-005", "why": "invoice list, detail and release screens" } ],
64
- "tasks": [ { "id": "office-screens", "name": "Orders, quotes and invoicing screens", "shape": "ui_implementation", "scope": { "affectedFiles": 14, "complexity": "medium" }, "seedMinutes": { "o": 180, "m": 360, "p": 720 }, "assumptions": [], "provenance": "proposed" } ] },
64
+ "tasks": [ { "id": "office-screens", "features": ["FEAT-001", "FEAT-003", "FEAT-005"], "name": "Orders, quotes and invoicing screens", "shape": "ui_implementation", "scope": { "affectedFiles": 14, "complexity": "medium" }, "seedMinutes": { "o": 180, "m": 360, "p": 720 }, "assumptions": [], "provenance": "proposed" } ] },
65
65
  { "id": "worker", "name": "Background Worker" },
66
66
  { "id": "worker.notify", "name": "Notifier", "parent": "worker", "milestone": "M2 - Money",
67
67
  "builds": [ { "feature": "FEAT-002", "why": "delivers the Short-Pack alert to ops and invoicing staff" } ],
68
- "tasks": [ { "id": "notify-impl", "name": "Alert delivery", "shape": "api_integration", "scope": { "affectedFiles": 3, "complexity": "low" }, "seedMinutes": { "o": 30, "m": 60, "p": 120 }, "assumptions": [], "provenance": "proposed" } ] },
68
+ "tasks": [ { "id": "notify-impl", "features": ["FEAT-002"], "name": "Alert delivery", "shape": "api_integration", "scope": { "affectedFiles": 3, "complexity": "low" }, "seedMinutes": { "o": 30, "m": 60, "p": 120 }, "assumptions": [], "provenance": "proposed" } ] },
69
69
  { "id": "worker.drafter", "name": "Order Drafter", "parent": "worker", "milestone": "M3 - Operations",
70
70
  "builds": [ { "feature": "FEAT-004", "why": "turns message text into an Order Draft" } ],
71
- "tasks": [ { "id": "drafter-impl", "name": "Email to draft extraction", "shape": "api_integration", "scope": { "affectedFiles": 5, "complexity": "medium" }, "seedMinutes": { "o": 90, "m": 180, "p": 360 }, "assumptions": [], "provenance": "proposed" } ] },
71
+ "tasks": [ { "id": "drafter-impl", "features": ["FEAT-004"], "name": "Email to draft extraction", "shape": "api_integration", "scope": { "affectedFiles": 5, "complexity": "medium" }, "seedMinutes": { "o": 90, "m": 180, "p": 360 }, "assumptions": [], "provenance": "proposed" } ] },
72
72
  { "id": "ops", "name": "Operations Database", "notEstimated": "one schema per module; no store-specific work in this scope" }
73
73
  ],
74
74
  "risks": [],
@@ -0,0 +1,83 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { findChrome } from '../../../../analyze-requirements/scripts/lib/chrome.mjs';
4
+ import { openPage } from '../../../../analyze-requirements/scripts/lib/cdp.mjs';
5
+ import { reviewPage, componentsPage } from './stage.mjs';
6
+
7
+ const skip = !findChrome();
8
+ const settle = () => new Promise((r) => setTimeout(r, 1500));
9
+ const BOX = `document.querySelector('[data-lpick="FEAT-001"]')`;
10
+ const type = (page, q) => page.eval(`(() => { const i = ${BOX}.querySelector('input'); i.value = ${JSON.stringify(q)}; i.dispatchEvent(new Event('input', { bubbles: true })); })()`);
11
+ const key = (page, k) => page.eval(`${BOX}.querySelector('input').dispatchEvent(new KeyboardEvent('keydown', { key: '${k}', bubbles: true }))`);
12
+ const options = (page) => page.eval(`[...${BOX}.querySelectorAll('.lpick-o')].map((o) => o.dataset.lpickId)`);
13
+ const current = (page) => page.eval(`${BOX}.querySelector('.lpick-o.lpick-cur')?.dataset.lpickId ?? null`);
14
+ const isOpen = (page) => page.eval(`!${BOX}.querySelector('.lpick-list').classList.contains('hide')`);
15
+ const builders = (page) => page.eval(`[...document.querySelectorAll('[data-builtby="FEAT-001"] [data-comp-chip]')].map((r) => r.dataset.compChip).sort()`);
16
+ const pinned = (page) => page.eval(`!document.getElementById('pinbar').classList.contains('hide')`);
17
+
18
+ async function onReview(fn) {
19
+ const page = await openPage(reviewPage());
20
+ try { await settle(); await fn(page); assert.deepEqual(page.errors, []); } finally { await page.close(); }
21
+ }
22
+
23
+ test('typing filters by component or container name; builders are left out', { skip }, () => onReview(async (page) => {
24
+ assert.equal(await page.eval(`${BOX}.querySelector('input').placeholder`), '+ Link a component… type to filter');
25
+ await type(page, 'BILL');
26
+ assert.deepEqual(await options(page), ['api.billing']);
27
+ assert.equal(await isOpen(page), true);
28
+ await type(page, 'worker');
29
+ assert.deepEqual((await options(page)).sort(), ['worker.drafter', 'worker.notify']);
30
+ await type(page, 'stage');
31
+ assert.deepEqual(await options(page), []);
32
+ assert.match(await page.eval(`${BOX}.querySelector('.lpick-list').textContent`), /No component matches/);
33
+ await type(page, '');
34
+ assert.deepEqual((await options(page)).sort(), ['api.billing', 'api.orders', 'ops', 'worker.drafter', 'worker.notify']);
35
+ assert.match(await page.eval(`${BOX}.querySelector('[data-lpick-id="ops"]').textContent`), /builds nothing yet/);
36
+ }));
37
+
38
+ test('arrows move the highlight, Enter links it, nothing gets pinned', { skip }, () => onReview(async (page) => {
39
+ await type(page, 'worker');
40
+ const [first, second] = await options(page);
41
+ assert.equal(await current(page), first);
42
+ await key(page, 'ArrowDown');
43
+ assert.equal(await current(page), second);
44
+ await key(page, 'ArrowUp');
45
+ assert.equal(await current(page), first);
46
+ await key(page, 'Enter');
47
+ assert.deepEqual(await builders(page), ['api.stage', first, 'office'].sort());
48
+ assert.equal(await pinned(page), false);
49
+ }));
50
+
51
+ const over = (page, sel) => page.eval(`${BOX}.querySelector('${sel}').dispatchEvent(new MouseEvent('mouseover', { bubbles: true }))`);
52
+
53
+ test('hovering the card keeps the keyboard highlight; hovering an option moves it', { skip }, () => onReview(async (page) => {
54
+ await type(page, 'worker');
55
+ const [first, second] = await options(page);
56
+ await over(page, 'input');
57
+ await over(page, '.lpick-g');
58
+ assert.equal(await current(page), first);
59
+ await over(page, `[data-lpick-id="${second}"]`);
60
+ assert.equal(await current(page), second);
61
+ await key(page, 'Enter');
62
+ assert.deepEqual(await builders(page), ['api.stage', second, 'office'].sort());
63
+ }));
64
+
65
+ test('a mouse pick links it and does not pin; Esc clears and closes', { skip }, () => onReview(async (page) => {
66
+ await type(page, 'drafter');
67
+ await page.eval(`${BOX}.querySelector('[data-lpick-id="worker.drafter"]').click()`);
68
+ assert.deepEqual(await builders(page), ['api.stage', 'office', 'worker.drafter']);
69
+ assert.equal(await pinned(page), false);
70
+ await type(page, 'bill');
71
+ await key(page, 'Escape');
72
+ assert.equal(await isOpen(page), false);
73
+ assert.equal(await page.eval(`${BOX}.querySelector('input').value`), '');
74
+ }));
75
+
76
+ test('the read-only Component-based page has no picker', { skip }, async () => {
77
+ const page = await openPage(componentsPage());
78
+ try {
79
+ await settle();
80
+ assert.equal(await page.eval(`document.querySelectorAll('.lpick, select[data-link]').length`), 0);
81
+ assert.deepEqual(page.errors, []);
82
+ } finally { await page.close(); }
83
+ });
@@ -0,0 +1,14 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { loadPair } from '../lib/requirements.mjs';
5
+ import { computeWorkflowEstimation } from '../lib/rollup.mjs';
6
+ import { taskTable } from '../lib/page-html.mjs';
7
+
8
+ const fx = fileURLToPath(new URL('./fixtures/inputs-pass.json', import.meta.url));
9
+
10
+ test('each task row carries the features it serves, 7th', () => {
11
+ const { inputs, req } = loadPair(fx);
12
+ const out = taskTable(computeWorkflowEstimation(inputs, req, []));
13
+ assert.deepEqual(out['api.stage'].map((x) => x[6]), [['FEAT-001', 'FEAT-002'], ['FEAT-001']]);
14
+ });
@@ -20,7 +20,7 @@ test('render writes both pages and warns when the viewer is missing', () => {
20
20
  assert.deepEqual(p.register.exclusions, ['last-mile delivery tracking', 'Hosting and third-party subscription fees']);
21
21
  assert.equal(p.view.price.presentLow, JSON.parse(readFileSync(join(dir, 'estimation.json'), 'utf8')).computed.price.presentLow);
22
22
  const cp = pageOf(readFileSync(join(dir, 'dist', 'estimate-components.html'), 'utf8'));
23
- assert.deepEqual(cp.tasks['api.billing'][0], ['Three-way match', 1, 2.17, 4, 'UNCALIBRATED', '']);
23
+ assert.deepEqual(cp.tasks['api.billing'][0], ['Three-way match', 1, 2.17, 4, 'UNCALIBRATED', '', ['FEAT-005']]);
24
24
  assert.equal(cp.xlsx.rows.length, 5);
25
25
  assert.equal(cp.arch, 'index.html');
26
26
  });
@@ -78,3 +78,11 @@ test('each task carries its low and high hours beside the expected', () => {
78
78
  assert.equal(t.e, 2.17); // PERT of 60/120/240 min
79
79
  assert.equal(t.high, 4); // seed p 240 min
80
80
  });
81
+
82
+ test('task features do not move the price', () => {
83
+ const { inputs, req } = loadPair(fx);
84
+ const bare = structuredClone(inputs);
85
+ for (const c of bare.components) for (const t of c.tasks ?? []) delete t.features;
86
+ const price = (i) => computeWorkflowEstimation(i, req, []).computed.price;
87
+ assert.deepEqual(price(inputs), price(bare));
88
+ });
@@ -30,6 +30,9 @@ const CASES = [
30
30
  ['W8 no milestone', (i) => { delete comp(i, 'api.billing').milestone; }, 'component api.billing: builds features but has no milestone'],
31
31
  ['W8 no tasks', (i) => { comp(i, 'api.billing').tasks = []; }, 'component api.billing: builds features but has no tasks'],
32
32
  ['W8 bad task shape', (i) => { comp(i, 'api.billing').tasks[0].shape = 'magic'; }, 'task billing-match: unknown shape "magic"'],
33
+ ['W8 task without features', (i) => { delete comp(i, 'api.stage').tasks[0].features; }, 'task stage-engine: features must list the features it serves'],
34
+ ['W8 task serves an unbuilt feature', (i) => { comp(i, 'api.stage').tasks[1].features = ['FEAT-003']; }, 'task stage-tests: serves FEAT-003, which api.stage does not build'],
35
+ ['W8 build no task serves', (i) => { for (const t of comp(i, 'api.stage').tasks) t.features = ['FEAT-001']; }, 'component api.stage: builds FEAT-002 but no task serves it'],
33
36
  ['W8 orphan without reason', (i) => { delete comp(i, 'ops').notEstimated; }, 'component ops: no feature covers it'],
34
37
  ['W8 container builds', (i) => { comp(i, 'api').builds = [{ feature: 'FEAT-001', why: 'x' }]; }, 'component api: a container with components cannot build features'],
35
38
  ['W9 bad parent', (i) => { comp(i, 'api.stage').parent = 'nope'; }, 'component api.stage: parent "nope" not in roster'],
@@ -3,7 +3,7 @@ import { execFileSync } from 'node:child_process';
3
3
  import { mkdtempSync, readFileSync, writeFileSync, copyFileSync } from 'node:fs';
4
4
  import { tmpdir } from 'node:os';
5
5
  import { join } from 'node:path';
6
- import { fileURLToPath } from 'node:url';
6
+ import { fileURLToPath, pathToFileURL } from 'node:url';
7
7
 
8
8
  export const script = (n) => fileURLToPath(new URL(`../${n}.mjs`, import.meta.url));
9
9
  const fx = (n) => fileURLToPath(new URL(`./fixtures/${n}`, import.meta.url));
@@ -30,3 +30,21 @@ export function noFlowsAt(dir) {
30
30
  for (const f of req.features.slice(2, 4)) f.steps = [];
31
31
  writeFileSync(path, JSON.stringify(req));
32
32
  }
33
+
34
+ // The score review page for the fixture lead, as a file URL.
35
+ export function reviewPage(mutate) {
36
+ const dir = mkdtempSync(join(tmpdir(), 'wf-review-'));
37
+ const inputs = JSON.parse(readFileSync(fx('inputs-pass.json'), 'utf8'));
38
+ if (mutate) mutate(inputs);
39
+ writeFileSync(join(dir, 'estimation-inputs.json'), JSON.stringify(inputs));
40
+ copyFileSync(fx('requirements.json'), join(dir, 'requirements.json'));
41
+ execFileSync('node', [script('score-review'), '--write', join(dir, 'estimation-inputs.json'), '--out', join(dir, 'review.html')]);
42
+ return pathToFileURL(join(dir, 'review.html')).href;
43
+ }
44
+
45
+ // The Component-based estimate page for the fixture lead, as a file URL.
46
+ export function componentsPage(mutate) {
47
+ const dir = staged(mutate);
48
+ execFileSync('node', [script('render'), '--inputs', join(dir, 'estimation-inputs.json'), '--json', join(dir, 'estimation.json'), '--out', join(dir, 'dist')]);
49
+ return pathToFileURL(join(dir, 'dist', 'estimate-components.html')).href;
50
+ }
@@ -6,9 +6,10 @@ import { computeWorkflowEstimation } from '../lib/rollup.mjs';
6
6
  import { xlsxRows } from '../lib/xlsx-rows.mjs';
7
7
 
8
8
  const fx = fileURLToPath(new URL('./fixtures/inputs-pass.json', import.meta.url));
9
- function rows(editReq) {
9
+ function rows(editReq, editInputs) {
10
10
  const { inputs, req } = loadPair(fx);
11
11
  if (editReq) editReq(req);
12
+ if (editInputs) editInputs(inputs);
12
13
  return xlsxRows(computeWorkflowEstimation(inputs, req, []), req);
13
14
  }
14
15
 
@@ -41,13 +42,13 @@ test('a feature two systems list gets one row, under the first system', () => {
41
42
  assert.equal(r.length, 5);
42
43
  });
43
44
 
44
- test('every task appears once, under the first feature its component builds', () => {
45
- const r = rows();
45
+ test('every task appears once, under the first feature it serves', () => {
46
+ const r = rows(undefined, (i) => { i.components.find((c) => c.id === 'api.stage').tasks[1].features = ['FEAT-002']; });
46
47
  const all = r.flatMap((x) => x.tasks.map((t) => t.name));
47
48
  assert.equal(all.length, 8);
48
49
  assert.equal(new Set(all).size, 8);
49
- // office builds FEAT-001, -003, -005 and is no feature's main builder: its task still lands, under FEAT-001
50
- assert.deepEqual(r[0].tasks.map((t) => t.name), ['Stage transitions with audit', 'Transition tests', 'Orders, quotes and invoicing screens']);
50
+ assert.deepEqual(r[0].tasks.map((t) => t.name), ['Stage transitions with audit', 'Orders, quotes and invoicing screens']);
51
+ assert.deepEqual(r[1].tasks.map((t) => t.name), ['Transition tests', 'Alert delivery']);
51
52
  });
52
53
 
53
54
  test('task hours map to o / m / p and the shape becomes the category', () => {
@@ -245,7 +245,11 @@
245
245
  "p": 360
246
246
  },
247
247
  "assumptions": [],
248
- "provenance": "proposed"
248
+ "provenance": "proposed",
249
+ "features": [
250
+ "FEAT-001",
251
+ "FEAT-002"
252
+ ]
249
253
  },
250
254
  {
251
255
  "id": "stage-tests",
@@ -261,7 +265,10 @@
261
265
  "p": 120
262
266
  },
263
267
  "assumptions": [],
264
- "provenance": "proposed"
268
+ "provenance": "proposed",
269
+ "features": [
270
+ "FEAT-001"
271
+ ]
265
272
  }
266
273
  ]
267
274
  },
@@ -291,7 +298,10 @@
291
298
  "p": 480
292
299
  },
293
300
  "assumptions": [],
294
- "provenance": "proposed"
301
+ "provenance": "proposed",
302
+ "features": [
303
+ "FEAT-003"
304
+ ]
295
305
  }
296
306
  ]
297
307
  },
@@ -321,7 +331,10 @@
321
331
  "p": 240
322
332
  },
323
333
  "assumptions": [],
324
- "provenance": "proposed"
334
+ "provenance": "proposed",
335
+ "features": [
336
+ "FEAT-005"
337
+ ]
325
338
  },
326
339
  {
327
340
  "id": "billing-docs",
@@ -337,7 +350,10 @@
337
350
  "p": 160
338
351
  },
339
352
  "assumptions": [],
340
- "provenance": "proposed"
353
+ "provenance": "proposed",
354
+ "features": [
355
+ "FEAT-005"
356
+ ]
341
357
  }
342
358
  ]
343
359
  },
@@ -374,7 +390,12 @@
374
390
  "p": 720
375
391
  },
376
392
  "assumptions": [],
377
- "provenance": "proposed"
393
+ "provenance": "proposed",
394
+ "features": [
395
+ "FEAT-001",
396
+ "FEAT-003",
397
+ "FEAT-005"
398
+ ]
378
399
  }
379
400
  ]
380
401
  },
@@ -408,7 +429,10 @@
408
429
  "p": 120
409
430
  },
410
431
  "assumptions": [],
411
- "provenance": "proposed"
432
+ "provenance": "proposed",
433
+ "features": [
434
+ "FEAT-002"
435
+ ]
412
436
  }
413
437
  ]
414
438
  },
@@ -438,7 +462,10 @@
438
462
  "p": 360
439
463
  },
440
464
  "assumptions": [],
441
- "provenance": "proposed"
465
+ "provenance": "proposed",
466
+ "features": [
467
+ "FEAT-004"
468
+ ]
442
469
  }
443
470
  ]
444
471
  },
@@ -246,7 +246,11 @@
246
246
  "p": 360
247
247
  },
248
248
  "assumptions": [],
249
- "provenance": "proposed"
249
+ "provenance": "proposed",
250
+ "features": [
251
+ "FEAT-001",
252
+ "FEAT-002"
253
+ ]
250
254
  },
251
255
  {
252
256
  "id": "stage-tests",
@@ -262,7 +266,10 @@
262
266
  "p": 120
263
267
  },
264
268
  "assumptions": [],
265
- "provenance": "proposed"
269
+ "provenance": "proposed",
270
+ "features": [
271
+ "FEAT-001"
272
+ ]
266
273
  }
267
274
  ]
268
275
  },
@@ -292,7 +299,10 @@
292
299
  "p": 480
293
300
  },
294
301
  "assumptions": [],
295
- "provenance": "proposed"
302
+ "provenance": "proposed",
303
+ "features": [
304
+ "FEAT-003"
305
+ ]
296
306
  }
297
307
  ]
298
308
  },
@@ -322,7 +332,10 @@
322
332
  "p": 240
323
333
  },
324
334
  "assumptions": [],
325
- "provenance": "proposed"
335
+ "provenance": "proposed",
336
+ "features": [
337
+ "FEAT-005"
338
+ ]
326
339
  },
327
340
  {
328
341
  "id": "billing-docs",
@@ -338,7 +351,10 @@
338
351
  "p": 160
339
352
  },
340
353
  "assumptions": [],
341
- "provenance": "proposed"
354
+ "provenance": "proposed",
355
+ "features": [
356
+ "FEAT-005"
357
+ ]
342
358
  }
343
359
  ]
344
360
  },
@@ -375,7 +391,12 @@
375
391
  "p": 720
376
392
  },
377
393
  "assumptions": [],
378
- "provenance": "proposed"
394
+ "provenance": "proposed",
395
+ "features": [
396
+ "FEAT-001",
397
+ "FEAT-003",
398
+ "FEAT-005"
399
+ ]
379
400
  }
380
401
  ]
381
402
  },
@@ -409,7 +430,10 @@
409
430
  "p": 120
410
431
  },
411
432
  "assumptions": [],
412
- "provenance": "proposed"
433
+ "provenance": "proposed",
434
+ "features": [
435
+ "FEAT-002"
436
+ ]
413
437
  }
414
438
  ]
415
439
  },
@@ -439,7 +463,10 @@
439
463
  "p": 360
440
464
  },
441
465
  "assumptions": [],
442
- "provenance": "proposed"
466
+ "provenance": "proposed",
467
+ "features": [
468
+ "FEAT-004"
469
+ ]
443
470
  }
444
471
  ]
445
472
  },