@v11g/agents-rock 1.0.12 → 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 (40) 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 +23 -10
  21. package/plugins/solution-architect/skills/estimate/workflow-based/references/linking.md +3 -2
  22. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +7 -2
  23. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +2 -2
  24. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +17 -0
  25. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +18 -16
  26. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/feature-tasks.js +21 -0
  27. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/also-builds-browser.test.mjs +5 -1
  28. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/feature-tasks-browser.test.mjs +30 -0
  29. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +8 -8
  30. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/page-html.test.mjs +14 -0
  31. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/render.test.mjs +1 -1
  32. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +8 -0
  33. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/schema.test.mjs +3 -0
  34. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +6 -5
  35. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +35 -8
  36. package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +35 -8
  37. package/src/cli/install.mjs +18 -2
  38. package/src/cli/registry.mjs +8 -0
  39. package/src/cli/targets.mjs +4 -2
  40. 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.2.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.12",
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.1",
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
@@ -573,13 +573,26 @@ function capHtml(c) {
573
573
  <div class="builds" data-builtby="${c.id}"></div>
574
574
  <div class="side-score"><div class="factors">${K.map((k) => factorHtml(c, k)).join('')}</div>${note}</div></article>`;
575
575
  }
576
- // ---- 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.
577
580
  const pert = (x) => x[2]; // expected hours from estimation.json (agentic baselines)
578
- const hoursOf = (id) => Math.round((typeof TASKS === 'undefined' ? [] : TASKS[id] || []).reduce((n, x) => n + pert(x), 0));
579
- function tasksHtml(b) {
580
- const ts = TASKS[b.id] || [];
581
- 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) =>
582
- `<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>`;
583
596
  }
584
597
  // the architecture document holds the C4 views; this page links there instead of redrawing them.
585
598
  // PAGE.c3 maps a container's name to its id when it has components (a C3 view); the rest live in C2.
@@ -654,7 +667,7 @@ function compRow(bid, capId, cls = '') {
654
667
  const b = compById[bid]; const others = links[bid].filter((c) => c !== capId);
655
668
  const also = alsoHtml(others);
656
669
  const x = !FINAL && !cls.includes('removed') ? `<button type="button" data-unlink="${bid}:${capId}" title="This component does not build it">×</button>` : '';
657
- 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>`;
658
671
  }
659
672
  // the "Built by" panel on a feature card: rows (× unlinks), a picker to add one, or the gap
660
673
  function paintBuilt(capId) {
@@ -663,8 +676,8 @@ function paintBuilt(capId) {
663
676
  $(`[data-ms="${capId}"]`).textContent = ms ? ` · ${ms}` : '';
664
677
  box.classList.toggle('none', !by.length);
665
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';
666
- if (FINAL) { const h = by.reduce((n, b) => n + hoursOf(b), 0); $(`[data-hrs="${capId}"]`).textContent = `${h.toLocaleString('en-US')}h`;
667
- 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; }
668
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('');
669
682
  const pick = pickerHtml(capId);
670
683
  const gap = by.length ? '' : asks[capId] !== undefined
@@ -743,7 +756,7 @@ function totals() {
743
756
  $(`[data-sec="${s.id}"]`).classList.toggle('hide', !s.features.some((c) => capVisible({ ...c, sys: s })));
744
757
  const hrs = FINAL ? new Set(s.features.flatMap((c) => buildersOf(c.id))) : null;
745
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>`
746
- + (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>` : '');
747
760
  });
748
761
  CAPS.forEach(paintCap);
749
762
  const covered = CAPS.filter((c) => buildersOf(c.id).length).length; const gaps = notBuiltCount();
@@ -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 = {
@@ -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,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
+ }
@@ -7,7 +7,11 @@ import { reviewPage, componentsPage } from './stage.mjs';
7
7
  const skip = !findChrome();
8
8
  const settle = () => new Promise((r) => setTimeout(r, 1500));
9
9
  // office builds FEAT-001, 003, 005; adding 002 and 004 gives FEAT-001's row 4 others
10
- const wide = (i) => i.components.find((c) => c.id === 'office').builds.push({ feature: 'FEAT-002', why: 'a' }, { feature: 'FEAT-004', why: 'b' });
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
+ };
11
15
 
12
16
  const one = (i) => i.components.find((c) => c.id === 'office').builds.push({ feature: 'FEAT-002', why: 'a' });
13
17
 
@@ -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,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'],
@@ -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
  },
@@ -1,6 +1,6 @@
1
- import { cpSync, existsSync, lstatSync, mkdirSync, readlinkSync, rmSync, symlinkSync } from 'node:fs';
1
+ import { copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, readlinkSync, rmSync, symlinkSync } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { listSkills } from './registry.mjs';
3
+ import { listSkills, listWorkflows } from './registry.mjs';
4
4
 
5
5
  export function installPlugin({ pluginDir, targets, agents, force = false }) {
6
6
  const result = { installed: [], skipped: [], reused: [] };
@@ -10,9 +10,25 @@ export function installPlugin({ pluginDir, targets, agents, force = false }) {
10
10
  linkAgent({ skill: skill.name, canonical, agent, targets, force, result });
11
11
  }
12
12
  }
13
+ if (agents.includes('claude')) copyWorkflows({ pluginDir, targets, force, result });
13
14
  return result;
14
15
  }
15
16
 
17
+ // Workflows are Claude Code only, so they are plain copies with no canonical.
18
+ function copyWorkflows({ pluginDir, targets, force, result }) {
19
+ for (const workflow of listWorkflows(pluginDir)) {
20
+ const skill = `workflows/${workflow.name}`;
21
+ const dest = path.join(targets.workflows, workflow.name);
22
+ if (existsSync(dest) && !force) {
23
+ result.reused.push({ skill, path: dest });
24
+ continue;
25
+ }
26
+ mkdirSync(targets.workflows, { recursive: true });
27
+ copyFileSync(workflow.file, dest);
28
+ result.installed.push({ skill, agent: 'claude', mode: 'file' });
29
+ }
30
+ }
31
+
16
32
  const NOT_SHIPPED = new Set(['evals']);
17
33
 
18
34
  function shipsToUsers(src) {
@@ -24,3 +24,11 @@ export function listSkills(pluginDir) {
24
24
  .filter((entry) => entry.isDirectory())
25
25
  .map((entry) => ({ name: entry.name, dir: path.join(skillsDir, entry.name) }));
26
26
  }
27
+
28
+ export function listWorkflows(pluginDir) {
29
+ const workflowsDir = path.join(pluginDir, 'workflows');
30
+ if (!existsSync(workflowsDir)) return [];
31
+ return readdirSync(workflowsDir, { withFileTypes: true })
32
+ .filter((entry) => entry.isFile() && entry.name.endsWith('.js'))
33
+ .map((entry) => ({ name: entry.name, file: path.join(workflowsDir, entry.name) }));
34
+ }
@@ -7,8 +7,8 @@ const CANONICAL = ['.agents', 'skills'];
7
7
 
8
8
  /**
9
9
  * Resolve every path an install writes to. Both scopes share one shape —
10
- * a canonical skills dir plus one skills dir per agent — so install and
11
- * uninstall stay scope-agnostic.
10
+ * a canonical skills dir, one skills dir per agent, and Claude's workflows
11
+ * dir — so install and uninstall stay scope-agnostic.
12
12
  */
13
13
  export function resolveTargets({ scope, root, home = homedir(), env = process.env }) {
14
14
  if (scope === 'project') return projectTargets(requireRoot(root));
@@ -25,6 +25,7 @@ function projectTargets(root) {
25
25
  return {
26
26
  canonical: path.join(root, ...CANONICAL),
27
27
  agentDirs: mapAgents((agent) => path.join(root, AGENT_HOMES[agent].dir, 'skills')),
28
+ workflows: path.join(root, AGENT_HOMES.claude.dir, 'workflows'),
28
29
  };
29
30
  }
30
31
 
@@ -32,6 +33,7 @@ function userTargets(home, env) {
32
33
  return {
33
34
  canonical: path.join(home, ...CANONICAL),
34
35
  agentDirs: mapAgents((agent) => path.join(agentHome(agent, home, env), 'skills')),
36
+ workflows: path.join(agentHome('claude', home, env), 'workflows'),
35
37
  };
36
38
  }
37
39
 
@@ -1,6 +1,6 @@
1
1
  import { existsSync, lstatSync, rmSync } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { listSkills } from './registry.mjs';
3
+ import { listSkills, listWorkflows } from './registry.mjs';
4
4
 
5
5
  export function uninstallPlugin({ pluginDir, targets, agents, force = false }) {
6
6
  const result = { removed: [], canonicalRemoved: [], skipped: [] };
@@ -10,9 +10,19 @@ export function uninstallPlugin({ pluginDir, targets, agents, force = false }) {
10
10
  }
11
11
  maybeRemoveCanonical(skill.name, targets, result);
12
12
  }
13
+ if (agents.includes('claude')) removeWorkflows(pluginDir, targets, result);
13
14
  return result;
14
15
  }
15
16
 
17
+ function removeWorkflows(pluginDir, targets, result) {
18
+ for (const workflow of listWorkflows(pluginDir)) {
19
+ const dest = path.join(targets.workflows, workflow.name);
20
+ if (!existsSync(dest)) continue;
21
+ rmSync(dest, { force: true });
22
+ result.removed.push({ skill: `workflows/${workflow.name}`, agent: 'claude' });
23
+ }
24
+ }
25
+
16
26
  function removeAgentEntry({ skill, agent, targets, force, result }) {
17
27
  const linkPath = path.join(targets.agentDirs[agent], skill);
18
28
  let stat;