@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
package/README.md CHANGED
@@ -82,7 +82,7 @@ rather than a hang.
82
82
  | Plugin | Description | Version |
83
83
  | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
84
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, plus a drafter that turns raw emails and call transcripts into an editable workflow-based scope document. | 0.5.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. | 3.0.1 |
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. | 3.2.2 |
86
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 |
87
87
  | `reasoning` | Reasoning toolkit: classify a problem, pick a fitting framework, and work it to a testable next step — with evidence and assumptions kept apart. | 0.5.0 |
88
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v11g/agents-rock",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solution-architect",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
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",
@@ -7,7 +7,7 @@ Workflow mode needs the Workflow tool for its link review. This sandbox
7
7
  may not provide it.
8
8
 
9
9
  PASS if either (a) the agent invoked the review-links workflow
10
- (/solution-architect:review-links) before scoring, or (b) its reply says
10
+ (/review-links or /solution-architect:review-links) before scoring, or (b) its reply says
11
11
  "Workflow mode needs dynamic workflows for the link review. Turn them on in
12
12
  /config (Dynamic workflows), then run /estimate again." (wording may differ
13
13
  only trivially) and it did not go on to estimate.
@@ -69,7 +69,7 @@
69
69
  "assertions": [
70
70
  "routed-to-workflow: the reply names scopeMode workflow and never offers the classic depth question (QUICK/STANDARD/DEEP) or the delivery-mode opt-out",
71
71
  "three-questions-max: the only AskUserQuestion prompts are the architecture-reviewed gate, the score-review hand-off, and the closing \"anything to change?\"; no question about agent/model, milestones, scope confirmation, review channel, familiarity, deadline or budget",
72
- "workflow-or-exact-stop: either /solution-architect:review-links was invoked before scoring, or the reply contains exactly \"Workflow mode needs dynamic workflows for the link review. Turn them on in /config (Dynamic workflows), then run /estimate again.\" and no estimation-inputs.json exists",
72
+ "workflow-or-exact-stop: either /review-links or /solution-architect:review-links was invoked before scoring, or the reply contains exactly \"Workflow mode needs dynamic workflows for the link review. Turn them on in /config (Dynamic workflows), then run /estimate again.\" and no estimation-inputs.json exists",
73
73
  "features-are-ids-and-scores: when estimation-inputs.json exists, every features[] entry has id, scores (five factors with n, anchor, cite), scoreNote and scoreProvenance and none of tasks, component, milestone, provenance",
74
74
  "components-carry-the-work: when estimation-inputs.json exists, every component with builds has a non-empty why on each build, a milestone, and at least one agentic task with shape and seedMinutes; a component with no builds has notEstimated",
75
75
  "validate-clean: when estimation.json exists, `node workflow-based/scripts/validate.mjs --inputs estimation-inputs.json --json estimation.json` exits 0",
@@ -41,7 +41,8 @@ run the scripts from here.
41
41
  write `components[].builds` with a `why` per link. Components are §6
42
42
  rows; `parent` = their container; a container with no components may
43
43
  build features itself.
44
- 4. **Review.** Run `/solution-architect:review-links` with
44
+ 4. **Review.** Run the `review-links` workflow (`/review-links` when
45
+ installed via npx, `/solution-architect:review-links` as a plugin) with
45
46
  `args = { inputs, architecture, requirements, linking }` (absolute
46
47
  paths). Apply the returned findings (add/drop links, fix tasks named
47
48
  under "task"). One cycle; do not re-run.
@@ -62,7 +63,10 @@ run the scripts from here.
62
63
  building nothing gets `notEstimated` with a reason.
63
64
  7. **Tasks.** For every component that builds something: agentic tasks
64
65
  (`shape` from `../classic/references/task-shapes.md`, `scope`,
65
- `seedMinutes`), and a `milestone` ("M1 - <name>", ordered). Components
66
+ `seedMinutes`) and `features`, the features this task serves, taken from
67
+ the component's `builds`. A task for several features lists them all.
68
+ Every feature the component builds needs at least one task. Add a
69
+ `milestone` ("M1 - <name>", ordered). Components
66
70
  that build nothing get `notEstimated` with a reason. Write
67
71
  `exclusions` — the commercial items the price leaves out that the BA scope
68
72
  does not name (hosting and subscriptions, post-launch support, security
@@ -308,6 +308,17 @@ textarea, input, select { font-size:.92rem; }
308
308
  @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { color-scheme:dark; } }
309
309
  :root[data-theme="dark"] { color-scheme:dark; }
310
310
  select option, select optgroup { background:var(--sheet); color:var(--ink); }
311
+ .crow .calso:not(.open) .cmini.more { display:none; }
312
+ .alsomore { font:inherit; font-size:.74rem; color:var(--ink-dim); background:none; border:0; padding:0 .2rem; cursor:pointer; text-decoration:underline dotted; }
313
+ .alsomore:hover, .alsomore:focus-visible { color:var(--ink); }
314
+ .lpick { position:relative; width:100%; max-width:28rem; margin-top:.4rem; }
315
+ .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; }
316
+ .lpick input:focus { border-style:solid; border-color:var(--ink); outline:none; }
317
+ .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; }
318
+ .lpick-g { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-dim); padding:.35rem .7rem .15rem; }
319
+ .lpick-o { font-size:.88rem; padding:.3rem .7rem .3rem 1.3rem; cursor:pointer; }
320
+ .lpick-o.lpick-cur { background:var(--hi); }
321
+ .lpick-none { padding:.4rem .7rem; font-size:.85rem; }
311
322
 
312
323
  :root { --c1:#44586a; --c2:#7d96ab; }
313
324
  @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { --c1:#bacdda; --c2:#8fa8bb; } }
@@ -562,13 +573,26 @@ function capHtml(c) {
562
573
  <div class="builds" data-builtby="${c.id}"></div>
563
574
  <div class="side-score"><div class="factors">${K.map((k) => factorHtml(c, k)).join('')}</div>${note}</div></article>`;
564
575
  }
565
- // ---- components: tasks and hours (Component-based page only) ----
576
+ // ---- components: tasks and hours, per feature (Component-based page only) ----
577
+ // TASKS[component]: [name, low, expected, high, confidence, assumptions, features].
578
+ // A task shared by k features counts 1/k of its hours on each card, so the
579
+ // cards add up to the project total.
566
580
  const pert = (x) => x[2]; // expected hours from estimation.json (agentic baselines)
567
- const hoursOf = (id) => Math.round((typeof TASKS === 'undefined' ? [] : TASKS[id] || []).reduce((n, x) => n + pert(x), 0));
568
- function tasksHtml(b) {
569
- const ts = TASKS[b.id] || [];
570
- return `<details class="tasks side-effort"><summary>${esc(b.name)} · ${ts.length} tasks · ${hoursOf(b.id)}h expected</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) =>
571
- `<tr><td>${esc(x[0])}${x[5] ? `<div class="dim">${esc(x[5])}</div>` : ''}</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>`).join('')}</table></details>`;
581
+ const hoursOf = (id) => Math.round((TASKS[id] || []).reduce((n, x) => n + pert(x), 0));
582
+ const tasksFor = (id, capId) => (TASKS[id] || []).filter((x) => x[6].includes(capId));
583
+ const hoursFor = (id, capId) => Math.round(tasksFor(id, capId).reduce((n, x) => n + pert(x) / x[6].length, 0));
584
+ 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));
585
+ function sharedNote(x, capId) {
586
+ const others = x[6].filter((f) => f !== capId);
587
+ return others.length ? `<div class="dim">shared with ${others.map(esc).join(', ')} · 1/${x[6].length} of its hours counted here</div>` : '';
588
+ }
589
+ function taskRow(x, capId) {
590
+ const note = x[5] ? `<div class="dim">${esc(x[5])}</div>` : '';
591
+ 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>`;
592
+ }
593
+ function tasksHtml(b, capId) {
594
+ const ts = tasksFor(b.id, capId);
595
+ 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>`;
572
596
  }
573
597
  // the architecture document holds the C4 views; this page links there instead of redrawing them.
574
598
  // PAGE.c3 maps a container's name to its id when it has components (a C3 view); the rest live in C2.
@@ -579,12 +603,71 @@ const archLink = (containers) => {
579
603
  return [...c3.map((c) => `<a class="archlink" href="${ARCH}#panel-components-${PAGE.c3[c]}" target="_blank" rel="noopener">C3 ${esc(c)} ↗</a>`),
580
604
  c2 && `<a class="archlink" href="${ARCH}#panel-containers" target="_blank" rel="noopener">C2 containers ↗</a>`].filter(Boolean).join(' · ');
581
605
  };
606
+ // the other features a component builds: 3 or more fold to one chip and "…N more"
607
+ const ALSO_SHOWN = 1; const ALSO_FOLD = 3;
608
+ const alsoChip = (c, fold) => `<span class="cmini${fold ? ' more' : ''}" style="--sc:var(--s${sysNo(c)})" data-cap-chip="${c}" title="${esc(capById[c].name)}">${c}</span>`;
609
+ function alsoHtml(others) {
610
+ if (!others.length) return '<span class="dim">only this feature</span>';
611
+ const fold = others.length >= ALSO_FOLD;
612
+ const chips = others.map((c, i) => alsoChip(c, fold && i >= ALSO_SHOWN)).join('');
613
+ const more = fold ? `<button type="button" class="alsomore" data-also-more aria-expanded="false">…${others.length - ALSO_SHOWN} more</button>` : '';
614
+ return `also builds ${chips}${more}`;
615
+ }
616
+ function toggleAlso(b) {
617
+ const box = b.closest('.calso'); const open = box.classList.toggle('open');
618
+ b.setAttribute('aria-expanded', String(open));
619
+ b.textContent = open ? 'show less' : `…${box.querySelectorAll('.cmini.more').length} more`;
620
+ }
621
+ document.addEventListener('click', (e) => { const b = e.target.closest('[data-also-more]'); if (b) toggleAlso(b); });
622
+ // "+ Link a component": a wide search box; typing filters by component or container name
623
+ 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>`;
624
+ 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>`;
625
+ function pickList(capId, q) {
626
+ const by = buildersOf(capId); const t = q.trim().toLowerCase();
627
+ const hit = (b) => !by.includes(b.id) && `${b.name} ${b.container}`.toLowerCase().includes(t);
628
+ const groups = [...new Set(COMPS.map((b) => b.container))].map((g) => [g, COMPS.filter((b) => b.container === g && hit(b))]).filter(([, bs]) => bs.length);
629
+ if (!groups.length) return '<div class="lpick-none dim">No component matches</div>';
630
+ return groups.map(([g, bs]) => `<div class="lpick-g">${esc(g)}</div>${bs.map(pickOpt).join('')}`).join('');
631
+ }
632
+ function openPick(inp) {
633
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box);
634
+ list.innerHTML = pickList(box.dataset.lpick, inp.value); list.classList.remove('hide');
635
+ $('.lpick-o', list)?.classList.add('lpick-cur');
636
+ }
637
+ function movePick(list, d) {
638
+ const os = [...list.querySelectorAll('.lpick-o')]; if (!os.length) return;
639
+ const i = os.findIndex((o) => o.classList.contains('lpick-cur'));
640
+ os.forEach((o) => o.classList.remove('lpick-cur'));
641
+ const n = os[(i + d + os.length) % os.length]; n.classList.add('lpick-cur'); n.scrollIntoView({ block: 'nearest' });
642
+ }
643
+ function pickComp(capId, bid) { links[bid] = [...links[bid], capId]; relink(); }
644
+ function onPickKey(e) {
645
+ const inp = e.target.closest?.('[data-lpick-q]'); if (!inp) return;
646
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box); const cur = $('.lpick-o.lpick-cur', list);
647
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); if (list.classList.contains('hide')) openPick(inp); else movePick(list, e.key === 'ArrowDown' ? 1 : -1); }
648
+ if (e.key === 'Enter') { e.preventDefault(); if (cur && !list.classList.contains('hide')) pickComp(box.dataset.lpick, cur.dataset.lpickId); }
649
+ if (e.key === 'Escape') { inp.value = ''; list.classList.add('hide'); }
650
+ }
651
+ const pickInput = (e) => e.target.closest?.('[data-lpick-q]');
652
+ document.addEventListener('focusin', (e) => { const q = pickInput(e); if (q) openPick(q); });
653
+ document.addEventListener('input', (e) => { const q = pickInput(e); if (q) openPick(q); });
654
+ document.addEventListener('focusout', (e) => { const q = pickInput(e); if (q) $('.lpick-list', q.closest('.lpick')).classList.add('hide'); });
655
+ document.addEventListener('keydown', onPickKey);
656
+ // mousedown would blur the box and close the list before the click lands
657
+ document.addEventListener('mousedown', (e) => { if (e.target.closest('.lpick-list')) e.preventDefault(); });
658
+ document.addEventListener('click', (e) => { const o = e.target.closest('.lpick-o'); if (o) pickComp(o.closest('.lpick').dataset.lpick, o.dataset.lpickId); });
659
+ // hovering a row moves the highlight, so mouse and keyboard never show two
660
+ document.addEventListener('mouseover', (e) => {
661
+ const o = e.target.closest?.('.lpick-o'); if (!o) return;
662
+ o.parentNode.querySelectorAll('.lpick-cur').forEach((x) => x.classList.remove('lpick-cur'));
663
+ o.classList.add('lpick-cur');
664
+ });
582
665
  // one row per component: its container, its name, and the other features it builds
583
666
  function compRow(bid, capId, cls = '') {
584
667
  const b = compById[bid]; const others = links[bid].filter((c) => c !== capId);
585
- const also = others.length ? `also builds ${others.map((c) => `<span class="cmini" style="--sc:var(--s${sysNo(c)})" data-cap-chip="${c}" title="${esc(capById[c].name)}">${c}</span>`).join('')}` : '<span class="dim">only this feature</span>';
668
+ const also = alsoHtml(others);
586
669
  const x = !FINAL && !cls.includes('removed') ? `<button type="button" data-unlink="${bid}:${capId}" title="This component does not build it">×</button>` : '';
587
- return `<div class="crow${cls}" data-comp-chip="${bid}"><span class="ccont">${esc(b.container)}</span><b class="cname">${esc(b.name)}</b><span class="calso">${also}</span>${FINAL ? `<span class="chrs">${hoursOf(bid)}h</span>` : ''}${x}</div>`;
670
+ return `<div class="crow${cls}" data-comp-chip="${bid}"><span class="ccont">${esc(b.container)}</span><b class="cname">${esc(b.name)}</b><span class="calso">${also}</span>${FINAL ? `<span class="chrs">${hoursFor(bid, capId)}h</span>` : ''}${x}</div>`;
588
671
  }
589
672
  // the "Built by" panel on a feature card: rows (× unlinks), a picker to add one, or the gap
590
673
  function paintBuilt(capId) {
@@ -593,12 +676,10 @@ function paintBuilt(capId) {
593
676
  $(`[data-ms="${capId}"]`).textContent = ms ? ` · ${ms}` : '';
594
677
  box.classList.toggle('none', !by.length);
595
678
  const head = by.length ? `Built by <b>${by.length}</b> component${by.length > 1 ? 's' : ''} in <b>${conts.length}</b> container${conts.length > 1 ? 's' : ''}` : 'Not built yet';
596
- if (FINAL) { const h = by.reduce((n, b) => n + hoursOf(b), 0); $(`[data-hrs="${capId}"]`).textContent = `${h.toLocaleString('en-US')}h`;
597
- box.innerHTML = `<div class="bhead">${head}<span class="arch">${archLink(conts)}</span></div><div class="crows">${by.map((b) => compRow(b, capId)).join('')}</div>${by.map((b) => tasksHtml(compById[b])).join('')}`; return; }
679
+ if (FINAL) { const h = by.reduce((n, b) => n + hoursFor(b, capId), 0); $(`[data-hrs="${capId}"]`).textContent = `${h.toLocaleString('en-US')}h`;
680
+ box.innerHTML = `<div class="bhead">${head}<span class="arch">${archLink(conts)}</span></div><div class="crows">${by.map((b) => compRow(b, capId)).join('')}</div>${by.map((b) => tasksHtml(compById[b], capId)).join('')}`; return; }
598
681
  const rows = by.map((b) => compRow(b, capId, was.includes(b) ? '' : ' added')).join('') + was.filter((b) => !by.includes(b)).map((b) => compRow(b, capId, ' removed')).join('');
599
- const conts2 = [...new Set(COMPS.map((b) => b.container))];
600
- const pick = `<select data-link="${capId}" aria-label="Link a component"><option value="">+ Link a component</option>${conts2.map((g) => `<optgroup label="${esc(g)}">${COMPS.filter((b) => b.container === g && !by.includes(b.id)).map((b) =>
601
- `<option value="${b.id}">${esc(b.name)}${notAsked(b.id) ? ' · builds nothing yet' : ''}</option>`).join('')}</optgroup>`).join('')}</select>`;
682
+ const pick = pickerHtml(capId);
602
683
  const gap = by.length ? '' : asks[capId] !== undefined
603
684
  ? `<div class="ask"><b>Asked the agent to add a component</b> <button type="button" class="btn" data-unask="${capId}">undo</button><textarea data-ask="${capId}" rows="1" placeholder="What should it cover? e.g. parse emails/faxes into a draft order">${esc(asks[capId])}</textarea></div>`
604
685
  : `<div class="ask"><span class="gapnote">⚠ No component builds this, so nobody would build it.</span> <button type="button" class="btn" data-ask-btn="${capId}">Ask the agent to add one</button> <span class="dim">or link one</span></div>`;
@@ -675,7 +756,7 @@ function totals() {
675
756
  $(`[data-sec="${s.id}"]`).classList.toggle('hide', !s.features.some((c) => capVisible({ ...c, sys: s })));
676
757
  const hrs = FINAL ? new Set(s.features.flatMap((c) => buildersOf(c.id))) : null;
677
758
  $(`[data-sub="${s.id}"]`).innerHTML = `<div class="side-score"><b>${money(sn)}</b><span>feature build subtotal</span>${Math.round(sn) !== Math.round(sw) ? `<span class="was"> · was ${money(sw)}</span>` : ''}</div>`
678
- + (FINAL ? `<div class="side-effort"><b>${[...hrs].reduce((n, b) => n + hoursOf(b), 0).toLocaleString('en-US')}h</b><span>${hrs.size} components, each counted once</span></div>` : '');
759
+ + (FINAL ? `<div class="side-effort"><b>${sysHours(s.features.map((c) => c.id)).toLocaleString('en-US')}h</b><span>${hrs.size} components, each task counted once</span></div>` : '');
679
760
  });
680
761
  CAPS.forEach(paintCap);
681
762
  const covered = CAPS.filter((c) => buildersOf(c.id).length).length; const gaps = notBuiltCount();
@@ -783,10 +864,6 @@ $('#systems').addEventListener('toggle', (e) => {
783
864
  else if (openSys === d.dataset.sys) openSystem(null);
784
865
  refresh();
785
866
  }, true);
786
- document.addEventListener('change', (e) => {
787
- const capId = e.target.dataset.link;
788
- if (capId && e.target.value) { links[e.target.value] = [...links[e.target.value], capId]; relink(); }
789
- });
790
867
  document.addEventListener('input', (e) => {
791
868
  const n = e.target.dataset.note; if (n) { notes[n] = e.target.value; save(); }
792
869
  const a = e.target.dataset.ask; if (a) { asks[a] = e.target.value; save(); }
@@ -812,7 +889,7 @@ function highlight(refs, caps, comps) {
812
889
  }
813
890
  const clearHl = () => document.querySelectorAll('.hl, .cur').forEach((x) => x.classList.remove('hl', 'cur'));
814
891
  function hitAt(t) {
815
- if (t.closest('button:not(.dot), input, textarea, select, .factors, nav, .bar, dialog, details.tasks, a')) return null;
892
+ if (t.closest('button:not(.dot), input, textarea, select, .lpick, .factors, nav, .bar, dialog, details.tasks, a')) return null;
816
893
  const node = t.closest('.flow g.node');
817
894
  if (node) { const ref = JSON.parse(node.closest('.flow').dataset.map)[(node.id.match(/flowchart-(n\d+)-/) || [])[1]];
818
895
  return ref ? { hit: fromStep(ref), label: `Step “${stepName(ref)}”` } : null; }
@@ -308,6 +308,17 @@ textarea, input, select { font-size:.92rem; }
308
308
  @media (prefers-color-scheme:dark) { :root:not([data-theme="light"]) { color-scheme:dark; } }
309
309
  :root[data-theme="dark"] { color-scheme:dark; }
310
310
  select option, select optgroup { background:var(--sheet); color:var(--ink); }
311
+ .crow .calso:not(.open) .cmini.more { display:none; }
312
+ .alsomore { font:inherit; font-size:.74rem; color:var(--ink-dim); background:none; border:0; padding:0 .2rem; cursor:pointer; text-decoration:underline dotted; }
313
+ .alsomore:hover, .alsomore:focus-visible { color:var(--ink); }
314
+ .lpick { position:relative; width:100%; max-width:28rem; margin-top:.4rem; }
315
+ .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; }
316
+ .lpick input:focus { border-style:solid; border-color:var(--ink); outline:none; }
317
+ .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; }
318
+ .lpick-g { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-dim); padding:.35rem .7rem .15rem; }
319
+ .lpick-o { font-size:.88rem; padding:.3rem .7rem .3rem 1.3rem; cursor:pointer; }
320
+ .lpick-o.lpick-cur { background:var(--hi); }
321
+ .lpick-none { padding:.4rem .7rem; font-size:.85rem; }
311
322
  </style>
312
323
  </head>
313
324
  <body>
@@ -497,10 +508,69 @@ const archLink = (containers) => {
497
508
  return [...c3.map((c) => `<a class="archlink" href="${ARCH}#panel-components-${PAGE.c3[c]}" target="_blank" rel="noopener">C3 ${esc(c)} ↗</a>`),
498
509
  c2 && `<a class="archlink" href="${ARCH}#panel-containers" target="_blank" rel="noopener">C2 containers ↗</a>`].filter(Boolean).join(' · ');
499
510
  };
511
+ // the other features a component builds: 3 or more fold to one chip and "…N more"
512
+ const ALSO_SHOWN = 1; const ALSO_FOLD = 3;
513
+ const alsoChip = (c, fold) => `<span class="cmini${fold ? ' more' : ''}" style="--sc:var(--s${sysNo(c)})" data-cap-chip="${c}" title="${esc(capById[c].name)}">${c}</span>`;
514
+ function alsoHtml(others) {
515
+ if (!others.length) return '<span class="dim">only this feature</span>';
516
+ const fold = others.length >= ALSO_FOLD;
517
+ const chips = others.map((c, i) => alsoChip(c, fold && i >= ALSO_SHOWN)).join('');
518
+ const more = fold ? `<button type="button" class="alsomore" data-also-more aria-expanded="false">…${others.length - ALSO_SHOWN} more</button>` : '';
519
+ return `also builds ${chips}${more}`;
520
+ }
521
+ function toggleAlso(b) {
522
+ const box = b.closest('.calso'); const open = box.classList.toggle('open');
523
+ b.setAttribute('aria-expanded', String(open));
524
+ b.textContent = open ? 'show less' : `…${box.querySelectorAll('.cmini.more').length} more`;
525
+ }
526
+ document.addEventListener('click', (e) => { const b = e.target.closest('[data-also-more]'); if (b) toggleAlso(b); });
527
+ // "+ Link a component": a wide search box; typing filters by component or container name
528
+ 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>`;
529
+ 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>`;
530
+ function pickList(capId, q) {
531
+ const by = buildersOf(capId); const t = q.trim().toLowerCase();
532
+ const hit = (b) => !by.includes(b.id) && `${b.name} ${b.container}`.toLowerCase().includes(t);
533
+ const groups = [...new Set(COMPS.map((b) => b.container))].map((g) => [g, COMPS.filter((b) => b.container === g && hit(b))]).filter(([, bs]) => bs.length);
534
+ if (!groups.length) return '<div class="lpick-none dim">No component matches</div>';
535
+ return groups.map(([g, bs]) => `<div class="lpick-g">${esc(g)}</div>${bs.map(pickOpt).join('')}`).join('');
536
+ }
537
+ function openPick(inp) {
538
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box);
539
+ list.innerHTML = pickList(box.dataset.lpick, inp.value); list.classList.remove('hide');
540
+ $('.lpick-o', list)?.classList.add('lpick-cur');
541
+ }
542
+ function movePick(list, d) {
543
+ const os = [...list.querySelectorAll('.lpick-o')]; if (!os.length) return;
544
+ const i = os.findIndex((o) => o.classList.contains('lpick-cur'));
545
+ os.forEach((o) => o.classList.remove('lpick-cur'));
546
+ const n = os[(i + d + os.length) % os.length]; n.classList.add('lpick-cur'); n.scrollIntoView({ block: 'nearest' });
547
+ }
548
+ function pickComp(capId, bid) { links[bid] = [...links[bid], capId]; relink(); }
549
+ function onPickKey(e) {
550
+ const inp = e.target.closest?.('[data-lpick-q]'); if (!inp) return;
551
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box); const cur = $('.lpick-o.lpick-cur', list);
552
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); if (list.classList.contains('hide')) openPick(inp); else movePick(list, e.key === 'ArrowDown' ? 1 : -1); }
553
+ if (e.key === 'Enter') { e.preventDefault(); if (cur && !list.classList.contains('hide')) pickComp(box.dataset.lpick, cur.dataset.lpickId); }
554
+ if (e.key === 'Escape') { inp.value = ''; list.classList.add('hide'); }
555
+ }
556
+ const pickInput = (e) => e.target.closest?.('[data-lpick-q]');
557
+ document.addEventListener('focusin', (e) => { const q = pickInput(e); if (q) openPick(q); });
558
+ document.addEventListener('input', (e) => { const q = pickInput(e); if (q) openPick(q); });
559
+ document.addEventListener('focusout', (e) => { const q = pickInput(e); if (q) $('.lpick-list', q.closest('.lpick')).classList.add('hide'); });
560
+ document.addEventListener('keydown', onPickKey);
561
+ // mousedown would blur the box and close the list before the click lands
562
+ document.addEventListener('mousedown', (e) => { if (e.target.closest('.lpick-list')) e.preventDefault(); });
563
+ document.addEventListener('click', (e) => { const o = e.target.closest('.lpick-o'); if (o) pickComp(o.closest('.lpick').dataset.lpick, o.dataset.lpickId); });
564
+ // hovering a row moves the highlight, so mouse and keyboard never show two
565
+ document.addEventListener('mouseover', (e) => {
566
+ const o = e.target.closest?.('.lpick-o'); if (!o) return;
567
+ o.parentNode.querySelectorAll('.lpick-cur').forEach((x) => x.classList.remove('lpick-cur'));
568
+ o.classList.add('lpick-cur');
569
+ });
500
570
  // one row per component: its container, its name, and the other features it builds
501
571
  function compRow(bid, capId, cls = '') {
502
572
  const b = compById[bid]; const others = links[bid].filter((c) => c !== capId);
503
- const also = others.length ? `also builds ${others.map((c) => `<span class="cmini" style="--sc:var(--s${sysNo(c)})" data-cap-chip="${c}" title="${esc(capById[c].name)}">${c}</span>`).join('')}` : '<span class="dim">only this feature</span>';
573
+ const also = alsoHtml(others);
504
574
  const x = !FINAL && !cls.includes('removed') ? `<button type="button" data-unlink="${bid}:${capId}" title="This component does not build it">×</button>` : '';
505
575
  return `<div class="crow${cls}" data-comp-chip="${bid}"><span class="ccont">${esc(b.container)}</span><b class="cname">${esc(b.name)}</b><span class="calso">${also}</span>${FINAL ? `<span class="chrs">${hoursOf(bid)}h</span>` : ''}${x}</div>`;
506
576
  }
@@ -514,9 +584,7 @@ function paintBuilt(capId) {
514
584
  if (FINAL) { const h = by.reduce((n, b) => n + hoursOf(b), 0); $(`[data-hrs="${capId}"]`).textContent = `${h.toLocaleString('en-US')}h`;
515
585
  box.innerHTML = `<div class="bhead">${head}<span class="arch">${archLink(conts)}</span></div><div class="crows">${by.map((b) => compRow(b, capId)).join('')}</div>${by.map((b) => tasksHtml(compById[b])).join('')}`; return; }
516
586
  const rows = by.map((b) => compRow(b, capId, was.includes(b) ? '' : ' added')).join('') + was.filter((b) => !by.includes(b)).map((b) => compRow(b, capId, ' removed')).join('');
517
- const conts2 = [...new Set(COMPS.map((b) => b.container))];
518
- const pick = `<select data-link="${capId}" aria-label="Link a component"><option value="">+ Link a component</option>${conts2.map((g) => `<optgroup label="${esc(g)}">${COMPS.filter((b) => b.container === g && !by.includes(b.id)).map((b) =>
519
- `<option value="${b.id}">${esc(b.name)}${notAsked(b.id) ? ' · builds nothing yet' : ''}</option>`).join('')}</optgroup>`).join('')}</select>`;
587
+ const pick = pickerHtml(capId);
520
588
  const gap = by.length ? '' : asks[capId] !== undefined
521
589
  ? `<div class="ask"><b>Asked the agent to add a component</b> <button type="button" class="btn" data-unask="${capId}">undo</button><textarea data-ask="${capId}" rows="1" placeholder="What should it cover? e.g. parse emails/faxes into a draft order">${esc(asks[capId])}</textarea></div>`
522
590
  : `<div class="ask"><span class="gapnote">⚠ No component builds this, so nobody would build it.</span> <button type="button" class="btn" data-ask-btn="${capId}">Ask the agent to add one</button> <span class="dim">or link one</span></div>`;
@@ -701,10 +769,6 @@ $('#systems').addEventListener('toggle', (e) => {
701
769
  else if (openSys === d.dataset.sys) openSystem(null);
702
770
  refresh();
703
771
  }, true);
704
- document.addEventListener('change', (e) => {
705
- const capId = e.target.dataset.link;
706
- if (capId && e.target.value) { links[e.target.value] = [...links[e.target.value], capId]; relink(); }
707
- });
708
772
  document.addEventListener('input', (e) => {
709
773
  const n = e.target.dataset.note; if (n) { notes[n] = e.target.value; save(); }
710
774
  const a = e.target.dataset.ask; if (a) { asks[a] = e.target.value; save(); }
@@ -730,7 +794,7 @@ function highlight(refs, caps, comps) {
730
794
  }
731
795
  const clearHl = () => document.querySelectorAll('.hl, .cur').forEach((x) => x.classList.remove('hl', 'cur'));
732
796
  function hitAt(t) {
733
- if (t.closest('button:not(.dot), input, textarea, select, .factors, nav, .bar, dialog, details.tasks, a')) return null;
797
+ if (t.closest('button:not(.dot), input, textarea, select, .lpick, .factors, nav, .bar, dialog, details.tasks, a')) return null;
734
798
  const node = t.closest('.flow g.node');
735
799
  if (node) { const ref = JSON.parse(node.closest('.flow').dataset.map)[(node.id.match(/flowchart-(n\d+)-/) || [])[1]];
736
800
  return ref ? { hit: fromStep(ref), label: `Step “${stepName(ref)}”` } : null; }
@@ -45,8 +45,9 @@ Answer these per feature, from ARCHITECTURE.md (§5 C4 views, §6 components,
45
45
 
46
46
  ## Task rubric (the reviewer reads this; tasks live on components)
47
47
 
48
- 1. **Covers its links.** Every feature a component builds has at least one
49
- task that serves it.
48
+ 1. **Covers its links.** Each task lists the features it serves in
49
+ `features`; every feature a component builds has at least one task that
50
+ lists it (the validator enforces both).
50
51
  2. **No double work.** The same work does not appear in two components.
51
52
  3. **Right shape.** Each task's `shape` (`estimate/classic/references/task-shapes.md`)
52
53
  matches the work described.
@@ -55,8 +55,13 @@ rep(/<span class="howto-page">You score the <b>features<\/b>[\s\S]*?<\/span>/,
55
55
  '<span class="howto-page"><b>Scoring</b> shows each feature&#39;s scores and price; <b>Effort</b> the components behind it, with tasks and hours. Containers and components are the ones in the architecture document: <a class="archlink" href="index.html#panel-containers" target="_blank" rel="noopener">C2 containers ↗</a></span>');
56
56
  rep('const FINAL = false;', 'const FINAL = true;');
57
57
  rep('const TASKS = {};', 'const TASKS = PAGE.tasks;');
58
- rep('const pert = ([, o, m, pp]) => (o + 4 * m + pp) / 6;', 'const pert = (x) => x[2]; // expected hours from estimation.json (agentic baselines)');
59
- rep('<th class="r">O / M / P h</th>', '<th class="r">Low / Expected / High h</th>');
58
+ // Tasks and hours per feature: a card lists the tasks that serve it.
59
+ rep(/\/\/ ---- components: tasks and hours \(Component-based page only\) ----\n[\s\S]*?<\/table><\/details>`;\n\}\n/, readFileSync(at('./template/feature-tasks.js'), 'utf8'));
60
+ rep('<span class="chrs">${hoursOf(bid)}h</span>', '<span class="chrs">${hoursFor(bid, capId)}h</span>');
61
+ rep('by.reduce((n, b) => n + hoursOf(b), 0)', 'by.reduce((n, b) => n + hoursFor(b, capId), 0)');
62
+ rep('tasksHtml(compById[b])', 'tasksHtml(compById[b], capId)');
63
+ rep("${[...hrs].reduce((n, b) => n + hoursOf(b), 0).toLocaleString('en-US')}h</b><span>${hrs.size} components, each counted once</span>",
64
+ "${sysHours(s.features.map((c) => c.id)).toLocaleString('en-US')}h</b><span>${hrs.size} components, each task counted once</span>");
60
65
  rep(/draw\(\)\.then\(\(\) => \{ if \(FINAL\) setTimeout\(pinFromHash, 150\); \}\);\n/, (m) => `${m}${readFileSync(at('./template/view.js'), 'utf8')}
61
66
  viewSummary(PAGE.view); viewRoadmap(PAGE); viewMethod(PAGE.view);
62
67
  const XLSX_SOURCE = {
@@ -46,6 +46,19 @@ rep(/function price\(s\) \{\n[\s\S]*?\n\}\n/, 'const price = (s) => featurePrice
46
46
  rep(/\/\/ the architecture document holds the C4 views[^\n]*\n\/\/ \(C3 is the Backend API[^\n]*\nconst ARCH = 'architecture\.html';\nconst archLink = [\s\S]*?\.join\(' · '\); \};\n/,
47
47
  readFileSync(at('./template/arch-link.js'), 'utf8'));
48
48
 
49
+ // ---- "also builds": 3 or more other features fold to one chip and "…N more" ----
50
+ rep(/ const also = others\.length \? `also builds [^\n]*\n/, ' const also = alsoHtml(others);\n');
51
+ rep('// one row per component: its container', `${readFileSync(at('./template/also-builds.js'), 'utf8')}// one row per component: its container`);
52
+
53
+ // ---- "+ Link a component": a search box that filters as you type, not a <select> ----
54
+ rep(/ const pick = `<select data-link=[\s\S]*?<\/select>`;\n/, ' const pick = pickerHtml(capId);\n');
55
+ rep('// one row per component: its container', `${readFileSync(at('./template/link-picker.js'), 'utf8')}// one row per component: its container`);
56
+ // the Task 2 select is gone: its unused container list and change listener go too
57
+ rep(" const conts2 = [...new Set(COMPS.map((b) => b.container))];\n", '');
58
+ rep(/document\.addEventListener\('change', \(e\) => \{\n const capId = e\.target\.dataset\.link;[\s\S]*?\n\}\);\n/, '');
59
+ // a click inside the picker is a pick, not a pin
60
+ rep("t.closest('button:not(.dot), input, textarea, select, ", "t.closest('button:not(.dot), input, textarea, select, .lpick, ");
61
+
49
62
  // ---- the 22-line function gate (quality-gates.test.mjs) ----
50
63
  // An apostrophe inside a template literal reads as a string quote to the gate.
51
64
  rep("data-tip=\"Each feature's scores", 'data-tip="Each feature&#39;s scores');
@@ -56,5 +69,5 @@ rep(" const count = { edits: CAPS.filter((c) => isChanged(c.id)).length,", " r
56
69
  rep('diagrams need a connection in this mockup', 'diagrams need a connection');
57
70
 
58
71
  const head = base.slice(0, base.indexOf('</style>')).replace('<title>Sin Kowa — score review</title>', '<title><!-- slot:TITLE --> — score review</title>');
59
- writeFileSync(OUT, `${head}${css}${readFileSync(`${M}reading.css`, 'utf8')}</style>\n</head>\n<body>\n${body}`);
72
+ writeFileSync(OUT, `${head}${css}${readFileSync(`${M}reading.css`, 'utf8')}${readFileSync(at('./template/also-builds.css'), 'utf8')}${readFileSync(at('./template/link-picker.css'), 'utf8')}</style>\n</head>\n<body>\n${body}`);
60
73
  console.log(OUT);
@@ -13,12 +13,12 @@ function common(est, req) {
13
13
  return { currency: est.inputs.currency ?? 'USD', view: priceView(est), milestones: milestoneView(est), register: registerView(est, req) };
14
14
  }
15
15
 
16
- // The Effort side's task rows: [name, low, expected, high hours, confidence, assumptions].
16
+ // The Effort side's task rows: [name, low, expected, high hours, confidence, assumptions, features].
17
17
  export function taskTable(est) {
18
18
  const out = {};
19
19
  for (const c of est.inputs.components) {
20
20
  const done = est.computed.components[c.id]?.tasks ?? {};
21
- if (c.tasks?.length) out[c.id] = c.tasks.map((t) => [t.name, done[t.id].low, done[t.id].e, done[t.id].high, done[t.id].confidence, (t.assumptions ?? []).join('; ')]);
21
+ if (c.tasks?.length) out[c.id] = c.tasks.map((t) => [t.name, done[t.id].low, done[t.id].e, done[t.id].high, done[t.id].confidence, (t.assumptions ?? []).join('; '), t.features]);
22
22
  }
23
23
  return out;
24
24
  }
@@ -35,6 +35,22 @@ function checkIdle(c, out) {
35
35
  if (c.tasks?.length) out.push(`component ${c.id}: tasks need a builds entry — link a feature or move the tasks`);
36
36
  }
37
37
 
38
+ // Each task names the features it serves, out of the component's builds; every
39
+ // build has at least one task (the task rubric's "covers its links").
40
+ function checkTaskFeatures(c, out) {
41
+ const builds = new Set(c.builds.map((b) => b.feature));
42
+ const served = new Set();
43
+ for (const t of c.tasks ?? []) {
44
+ if (!Array.isArray(t.features) || !t.features.length) { out.push(`task ${t.id}: features must list the features it serves`); continue; }
45
+ for (const f of t.features) {
46
+ if (builds.has(f)) served.add(f);
47
+ else out.push(`task ${t.id}: serves ${f}, which ${c.id} does not build`);
48
+ }
49
+ }
50
+ if (!c.tasks?.length) return;
51
+ for (const f of builds) if (!served.has(f)) out.push(`component ${c.id}: builds ${f} but no task serves it`);
52
+ }
53
+
38
54
  function checkWork(c, parents, out) {
39
55
  const builds = c.builds ?? [];
40
56
  if (parents.has(c.id)) {
@@ -51,6 +67,7 @@ function checkWork(c, parents, out) {
51
67
  if (!nonEmpty(c.milestone)) out.push(`component ${c.id}: builds features but has no milestone`);
52
68
  if (!(c.tasks?.length > 0)) out.push(`component ${c.id}: builds features but has no tasks`);
53
69
  for (const t of c.tasks ?? []) checkAgenticTask(t, out);
70
+ checkTaskFeatures(c, out);
54
71
  }
55
72
 
56
73
  export function checkComponents(inputs, out) {
@@ -1,8 +1,8 @@
1
1
  // Feeds the shared v2 workbook export (shared/assets/xlsx-export.js) rows in
2
2
  // the shape the classic page passes it: one per feature, its tasks under it.
3
- // Workflow tasks live on components, so each component's tasks go under the
4
- // first feature it builds — listed once, never dropped. Rows come grouped by
5
- // system, for the workbook's SYSTEM / MODULE column.
3
+ // Workflow tasks live on components, so each task goes under the first feature
4
+ // it serves — listed once, never dropped. Rows come grouped by system, for the
5
+ // workbook's SYSTEM / MODULE column.
6
6
  import { mainBuilder } from './rollup.mjs';
7
7
  import { featureProvenance } from './requirements.mjs';
8
8
 
@@ -21,31 +21,33 @@ function containerName(c, components) {
21
21
  return (c.parent && components.find((x) => x.id === c.parent))?.name ?? c.name;
22
22
  }
23
23
 
24
- function taskOwners(inputs) {
24
+ function taskRow(t, done) {
25
+ return {
26
+ name: t.name, category: t.shape, o: done[t.id].low, m: done[t.id].e, p: done[t.id].high,
27
+ confidence: done[t.id].confidence, assumptions: t.assumptions ?? [],
28
+ };
29
+ }
30
+
31
+ // Feature id → its task rows, in roster order then task order.
32
+ function taskOwners(inputs, computed) {
25
33
  const owners = {};
26
34
  for (const c of inputs.components) {
27
- const first = inputs.features.find((f) => (c.builds ?? []).some((b) => b.feature === f.id));
28
- if (first && c.tasks?.length) (owners[first.id] ??= []).push(c);
35
+ for (const t of c.tasks ?? []) {
36
+ const first = inputs.features.find((f) => t.features.includes(f.id));
37
+ (owners[first.id] ??= []).push(taskRow(t, computed.components[c.id].tasks));
38
+ }
29
39
  }
30
40
  return owners;
31
41
  }
32
42
 
33
- function taskRows(c, computed) {
34
- const done = computed.components[c.id].tasks;
35
- return c.tasks.map((t) => ({
36
- name: t.name, category: t.shape, o: done[t.id].low, m: done[t.id].e, p: done[t.id].high,
37
- confidence: done[t.id].confidence, assumptions: t.assumptions ?? [],
38
- }));
39
- }
40
-
41
43
  export function xlsxRows(est, req) {
42
44
  const { inputs, computed } = est;
43
- const owners = taskOwners(inputs);
45
+ const owners = taskOwners(inputs, computed);
44
46
  const byId = Object.fromEntries(inputs.features.map((f) => [f.id, f]));
45
47
  return systemOrder(inputs, req).map(([id, system]) => [byId[id], system]).map(([f, system]) => ({
46
48
  id: f.id, system, name: req.features[f.id].name, scores: f.scores, scoreNote: f.scoreNote ?? '',
47
49
  scoreProvenance: f.scoreProvenance, provenance: featureProvenance(req.features[f.id]),
48
50
  milestone: computed.features[f.id].milestone ?? '', container: containerName(mainBuilder(f.id, inputs.components), inputs.components),
49
- tasks: (owners[f.id] ?? []).flatMap((c) => taskRows(c, computed)),
51
+ tasks: owners[f.id] ?? [],
50
52
  }));
51
53
  }
@@ -0,0 +1,3 @@
1
+ .crow .calso:not(.open) .cmini.more { display:none; }
2
+ .alsomore { font:inherit; font-size:.74rem; color:var(--ink-dim); background:none; border:0; padding:0 .2rem; cursor:pointer; text-decoration:underline dotted; }
3
+ .alsomore:hover, .alsomore:focus-visible { color:var(--ink); }
@@ -0,0 +1,16 @@
1
+ // the other features a component builds: 3 or more fold to one chip and "…N more"
2
+ const ALSO_SHOWN = 1; const ALSO_FOLD = 3;
3
+ const alsoChip = (c, fold) => `<span class="cmini${fold ? ' more' : ''}" style="--sc:var(--s${sysNo(c)})" data-cap-chip="${c}" title="${esc(capById[c].name)}">${c}</span>`;
4
+ function alsoHtml(others) {
5
+ if (!others.length) return '<span class="dim">only this feature</span>';
6
+ const fold = others.length >= ALSO_FOLD;
7
+ const chips = others.map((c, i) => alsoChip(c, fold && i >= ALSO_SHOWN)).join('');
8
+ const more = fold ? `<button type="button" class="alsomore" data-also-more aria-expanded="false">…${others.length - ALSO_SHOWN} more</button>` : '';
9
+ return `also builds ${chips}${more}`;
10
+ }
11
+ function toggleAlso(b) {
12
+ const box = b.closest('.calso'); const open = box.classList.toggle('open');
13
+ b.setAttribute('aria-expanded', String(open));
14
+ b.textContent = open ? 'show less' : `…${box.querySelectorAll('.cmini.more').length} more`;
15
+ }
16
+ document.addEventListener('click', (e) => { const b = e.target.closest('[data-also-more]'); if (b) toggleAlso(b); });