@v11g/agents-rock 1.0.11 → 1.0.12

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 (26) 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/skills/estimate/workflow-based/assets/estimate-components.html +73 -9
  18. package/plugins/solution-architect/skills/estimate/workflow-based/assets/score-review.html +73 -9
  19. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-template.mjs +14 -1
  20. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/also-builds.css +3 -0
  21. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/also-builds.js +16 -0
  22. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/link-picker.css +8 -0
  23. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/link-picker.js +43 -0
  24. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/also-builds-browser.test.mjs +59 -0
  25. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/link-picker-browser.test.mjs +83 -0
  26. package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/stage.mjs +19 -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.1 |
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.12",
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.1",
4
4
  "description": "Solution-architecture toolkit: interview-driven architecture documentation with interactive diagrams and provenance-tagged facts, AI-aware project estimation, and client-ready proposals.",
5
5
  "author": {
6
6
  "name": "Truong Vu",
@@ -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; } }
@@ -579,10 +590,69 @@ const archLink = (containers) => {
579
590
  return [...c3.map((c) => `<a class="archlink" href="${ARCH}#panel-components-${PAGE.c3[c]}" target="_blank" rel="noopener">C3 ${esc(c)} ↗</a>`),
580
591
  c2 && `<a class="archlink" href="${ARCH}#panel-containers" target="_blank" rel="noopener">C2 containers ↗</a>`].filter(Boolean).join(' · ');
581
592
  };
593
+ // the other features a component builds: 3 or more fold to one chip and "…N more"
594
+ const ALSO_SHOWN = 1; const ALSO_FOLD = 3;
595
+ 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>`;
596
+ function alsoHtml(others) {
597
+ if (!others.length) return '<span class="dim">only this feature</span>';
598
+ const fold = others.length >= ALSO_FOLD;
599
+ const chips = others.map((c, i) => alsoChip(c, fold && i >= ALSO_SHOWN)).join('');
600
+ const more = fold ? `<button type="button" class="alsomore" data-also-more aria-expanded="false">…${others.length - ALSO_SHOWN} more</button>` : '';
601
+ return `also builds ${chips}${more}`;
602
+ }
603
+ function toggleAlso(b) {
604
+ const box = b.closest('.calso'); const open = box.classList.toggle('open');
605
+ b.setAttribute('aria-expanded', String(open));
606
+ b.textContent = open ? 'show less' : `…${box.querySelectorAll('.cmini.more').length} more`;
607
+ }
608
+ document.addEventListener('click', (e) => { const b = e.target.closest('[data-also-more]'); if (b) toggleAlso(b); });
609
+ // "+ Link a component": a wide search box; typing filters by component or container name
610
+ 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>`;
611
+ 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>`;
612
+ function pickList(capId, q) {
613
+ const by = buildersOf(capId); const t = q.trim().toLowerCase();
614
+ const hit = (b) => !by.includes(b.id) && `${b.name} ${b.container}`.toLowerCase().includes(t);
615
+ const groups = [...new Set(COMPS.map((b) => b.container))].map((g) => [g, COMPS.filter((b) => b.container === g && hit(b))]).filter(([, bs]) => bs.length);
616
+ if (!groups.length) return '<div class="lpick-none dim">No component matches</div>';
617
+ return groups.map(([g, bs]) => `<div class="lpick-g">${esc(g)}</div>${bs.map(pickOpt).join('')}`).join('');
618
+ }
619
+ function openPick(inp) {
620
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box);
621
+ list.innerHTML = pickList(box.dataset.lpick, inp.value); list.classList.remove('hide');
622
+ $('.lpick-o', list)?.classList.add('lpick-cur');
623
+ }
624
+ function movePick(list, d) {
625
+ const os = [...list.querySelectorAll('.lpick-o')]; if (!os.length) return;
626
+ const i = os.findIndex((o) => o.classList.contains('lpick-cur'));
627
+ os.forEach((o) => o.classList.remove('lpick-cur'));
628
+ const n = os[(i + d + os.length) % os.length]; n.classList.add('lpick-cur'); n.scrollIntoView({ block: 'nearest' });
629
+ }
630
+ function pickComp(capId, bid) { links[bid] = [...links[bid], capId]; relink(); }
631
+ function onPickKey(e) {
632
+ const inp = e.target.closest?.('[data-lpick-q]'); if (!inp) return;
633
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box); const cur = $('.lpick-o.lpick-cur', list);
634
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); if (list.classList.contains('hide')) openPick(inp); else movePick(list, e.key === 'ArrowDown' ? 1 : -1); }
635
+ if (e.key === 'Enter') { e.preventDefault(); if (cur && !list.classList.contains('hide')) pickComp(box.dataset.lpick, cur.dataset.lpickId); }
636
+ if (e.key === 'Escape') { inp.value = ''; list.classList.add('hide'); }
637
+ }
638
+ const pickInput = (e) => e.target.closest?.('[data-lpick-q]');
639
+ document.addEventListener('focusin', (e) => { const q = pickInput(e); if (q) openPick(q); });
640
+ document.addEventListener('input', (e) => { const q = pickInput(e); if (q) openPick(q); });
641
+ document.addEventListener('focusout', (e) => { const q = pickInput(e); if (q) $('.lpick-list', q.closest('.lpick')).classList.add('hide'); });
642
+ document.addEventListener('keydown', onPickKey);
643
+ // mousedown would blur the box and close the list before the click lands
644
+ document.addEventListener('mousedown', (e) => { if (e.target.closest('.lpick-list')) e.preventDefault(); });
645
+ document.addEventListener('click', (e) => { const o = e.target.closest('.lpick-o'); if (o) pickComp(o.closest('.lpick').dataset.lpick, o.dataset.lpickId); });
646
+ // hovering a row moves the highlight, so mouse and keyboard never show two
647
+ document.addEventListener('mouseover', (e) => {
648
+ const o = e.target.closest?.('.lpick-o'); if (!o) return;
649
+ o.parentNode.querySelectorAll('.lpick-cur').forEach((x) => x.classList.remove('lpick-cur'));
650
+ o.classList.add('lpick-cur');
651
+ });
582
652
  // one row per component: its container, its name, and the other features it builds
583
653
  function compRow(bid, capId, cls = '') {
584
654
  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>';
655
+ const also = alsoHtml(others);
586
656
  const x = !FINAL && !cls.includes('removed') ? `<button type="button" data-unlink="${bid}:${capId}" title="This component does not build it">×</button>` : '';
587
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>`;
588
658
  }
@@ -596,9 +666,7 @@ function paintBuilt(capId) {
596
666
  if (FINAL) { const h = by.reduce((n, b) => n + hoursOf(b), 0); $(`[data-hrs="${capId}"]`).textContent = `${h.toLocaleString('en-US')}h`;
597
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; }
598
668
  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>`;
669
+ const pick = pickerHtml(capId);
602
670
  const gap = by.length ? '' : asks[capId] !== undefined
603
671
  ? `<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
672
  : `<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>`;
@@ -783,10 +851,6 @@ $('#systems').addEventListener('toggle', (e) => {
783
851
  else if (openSys === d.dataset.sys) openSystem(null);
784
852
  refresh();
785
853
  }, 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
854
  document.addEventListener('input', (e) => {
791
855
  const n = e.target.dataset.note; if (n) { notes[n] = e.target.value; save(); }
792
856
  const a = e.target.dataset.ask; if (a) { asks[a] = e.target.value; save(); }
@@ -812,7 +876,7 @@ function highlight(refs, caps, comps) {
812
876
  }
813
877
  const clearHl = () => document.querySelectorAll('.hl, .cur').forEach((x) => x.classList.remove('hl', 'cur'));
814
878
  function hitAt(t) {
815
- if (t.closest('button:not(.dot), input, textarea, select, .factors, nav, .bar, dialog, details.tasks, a')) return null;
879
+ if (t.closest('button:not(.dot), input, textarea, select, .lpick, .factors, nav, .bar, dialog, details.tasks, a')) return null;
816
880
  const node = t.closest('.flow g.node');
817
881
  if (node) { const ref = JSON.parse(node.closest('.flow').dataset.map)[(node.id.match(/flowchart-(n\d+)-/) || [])[1]];
818
882
  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; }
@@ -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);
@@ -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); });
@@ -0,0 +1,8 @@
1
+ .lpick { position:relative; width:100%; max-width:28rem; margin-top:.4rem; }
2
+ .lpick input { width:100%; box-sizing:border-box; font:inherit; font-size:.85rem; padding:.35rem .6rem; color:var(--ink); background:var(--sheet); border:1px dashed var(--ink-dim); border-radius:.3rem; }
3
+ .lpick input:focus { border-style:solid; border-color:var(--ink); outline:none; }
4
+ .lpick-list { position:absolute; z-index:20; left:0; right:0; top:calc(100% + .2rem); max-height:20rem; overflow:auto; background:var(--sheet); border:1px solid var(--grid); border-radius:.3rem; box-shadow:0 6px 18px rgba(0,0,0,.25); padding:.25rem 0; }
5
+ .lpick-g { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-dim); padding:.35rem .7rem .15rem; }
6
+ .lpick-o { font-size:.88rem; padding:.3rem .7rem .3rem 1.3rem; cursor:pointer; }
7
+ .lpick-o.lpick-cur { background:var(--hi); }
8
+ .lpick-none { padding:.4rem .7rem; font-size:.85rem; }
@@ -0,0 +1,43 @@
1
+ // "+ Link a component": a wide search box; typing filters by component or container name
2
+ const pickerHtml = (capId) => `<div class="lpick" data-lpick="${capId}"><input type="search" data-lpick-q placeholder="+ Link a component… type to filter" aria-label="Link a component" autocomplete="off"><div class="lpick-list hide" role="listbox"></div></div>`;
3
+ const pickOpt = (b) => `<div class="lpick-o" role="option" data-lpick-id="${b.id}">${esc(b.name)}${notAsked(b.id) ? '<span class="dim"> · builds nothing yet</span>' : ''}</div>`;
4
+ function pickList(capId, q) {
5
+ const by = buildersOf(capId); const t = q.trim().toLowerCase();
6
+ const hit = (b) => !by.includes(b.id) && `${b.name} ${b.container}`.toLowerCase().includes(t);
7
+ const groups = [...new Set(COMPS.map((b) => b.container))].map((g) => [g, COMPS.filter((b) => b.container === g && hit(b))]).filter(([, bs]) => bs.length);
8
+ if (!groups.length) return '<div class="lpick-none dim">No component matches</div>';
9
+ return groups.map(([g, bs]) => `<div class="lpick-g">${esc(g)}</div>${bs.map(pickOpt).join('')}`).join('');
10
+ }
11
+ function openPick(inp) {
12
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box);
13
+ list.innerHTML = pickList(box.dataset.lpick, inp.value); list.classList.remove('hide');
14
+ $('.lpick-o', list)?.classList.add('lpick-cur');
15
+ }
16
+ function movePick(list, d) {
17
+ const os = [...list.querySelectorAll('.lpick-o')]; if (!os.length) return;
18
+ const i = os.findIndex((o) => o.classList.contains('lpick-cur'));
19
+ os.forEach((o) => o.classList.remove('lpick-cur'));
20
+ const n = os[(i + d + os.length) % os.length]; n.classList.add('lpick-cur'); n.scrollIntoView({ block: 'nearest' });
21
+ }
22
+ function pickComp(capId, bid) { links[bid] = [...links[bid], capId]; relink(); }
23
+ function onPickKey(e) {
24
+ const inp = e.target.closest?.('[data-lpick-q]'); if (!inp) return;
25
+ const box = inp.closest('.lpick'); const list = $('.lpick-list', box); const cur = $('.lpick-o.lpick-cur', list);
26
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); if (list.classList.contains('hide')) openPick(inp); else movePick(list, e.key === 'ArrowDown' ? 1 : -1); }
27
+ if (e.key === 'Enter') { e.preventDefault(); if (cur && !list.classList.contains('hide')) pickComp(box.dataset.lpick, cur.dataset.lpickId); }
28
+ if (e.key === 'Escape') { inp.value = ''; list.classList.add('hide'); }
29
+ }
30
+ const pickInput = (e) => e.target.closest?.('[data-lpick-q]');
31
+ document.addEventListener('focusin', (e) => { const q = pickInput(e); if (q) openPick(q); });
32
+ document.addEventListener('input', (e) => { const q = pickInput(e); if (q) openPick(q); });
33
+ document.addEventListener('focusout', (e) => { const q = pickInput(e); if (q) $('.lpick-list', q.closest('.lpick')).classList.add('hide'); });
34
+ document.addEventListener('keydown', onPickKey);
35
+ // mousedown would blur the box and close the list before the click lands
36
+ document.addEventListener('mousedown', (e) => { if (e.target.closest('.lpick-list')) e.preventDefault(); });
37
+ document.addEventListener('click', (e) => { const o = e.target.closest('.lpick-o'); if (o) pickComp(o.closest('.lpick').dataset.lpick, o.dataset.lpickId); });
38
+ // hovering a row moves the highlight, so mouse and keyboard never show two
39
+ document.addEventListener('mouseover', (e) => {
40
+ const o = e.target.closest?.('.lpick-o'); if (!o) return;
41
+ o.parentNode.querySelectorAll('.lpick-cur').forEach((x) => x.classList.remove('lpick-cur'));
42
+ o.classList.add('lpick-cur');
43
+ });
@@ -0,0 +1,59 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { findChrome } from '../../../../analyze-requirements/scripts/lib/chrome.mjs';
4
+ import { openPage } from '../../../../analyze-requirements/scripts/lib/cdp.mjs';
5
+ import { reviewPage, componentsPage } from './stage.mjs';
6
+
7
+ const skip = !findChrome();
8
+ const settle = () => new Promise((r) => setTimeout(r, 1500));
9
+ // office builds FEAT-001, 003, 005; adding 002 and 004 gives FEAT-001's row 4 others
10
+ const wide = (i) => i.components.find((c) => c.id === 'office').builds.push({ feature: 'FEAT-002', why: 'a' }, { feature: 'FEAT-004', why: 'b' });
11
+
12
+ const one = (i) => i.components.find((c) => c.id === 'office').builds.push({ feature: 'FEAT-002', why: 'a' });
13
+
14
+ const ROW = `document.querySelector('[data-builtby="FEAT-001"] [data-comp-chip="office"] .calso')`;
15
+ const shown = (page) => page.eval(`[...${ROW}.querySelectorAll('.cmini')].filter((x) => getComputedStyle(x).display !== 'none').map((x) => x.dataset.capChip)`);
16
+ const button = (page) => page.eval(`(() => { const b = ${ROW}.querySelector('[data-also-more]'); return b && { text: b.textContent, open: b.getAttribute('aria-expanded') }; })()`);
17
+ const toggle = (page) => page.eval(`${ROW}.querySelector('[data-also-more]').click()`);
18
+ const pinned = (page) => page.eval(`!document.getElementById('pinbar').classList.contains('hide')`);
19
+
20
+ async function foldsAndUnfolds(url) {
21
+ const page = await openPage(url);
22
+ try {
23
+ await settle();
24
+ assert.deepEqual(await shown(page), ['FEAT-003']);
25
+ assert.deepEqual(await button(page), { text: '…3 more', open: 'false' });
26
+ await toggle(page);
27
+ assert.deepEqual(await shown(page), ['FEAT-003', 'FEAT-005', 'FEAT-002', 'FEAT-004']);
28
+ assert.deepEqual(await button(page), { text: 'show less', open: 'true' });
29
+ assert.equal(await pinned(page), false);
30
+ await toggle(page);
31
+ assert.deepEqual(await shown(page), ['FEAT-003']);
32
+ assert.deepEqual(await button(page), { text: '…3 more', open: 'false' });
33
+ assert.deepEqual(page.errors, []);
34
+ } finally { await page.close(); }
35
+ }
36
+
37
+ test('score review: 3+ other features fold behind "…N more" and unfold', { skip }, () => foldsAndUnfolds(reviewPage(wide)));
38
+
39
+ test('estimate (component-based): the same fold', { skip }, () => foldsAndUnfolds(componentsPage(wide)));
40
+
41
+ test('two other features show both chips and no button', { skip }, async () => {
42
+ const page = await openPage(reviewPage());
43
+ try {
44
+ await settle();
45
+ assert.deepEqual(await shown(page), ['FEAT-003', 'FEAT-005']);
46
+ assert.equal(await button(page), null);
47
+ assert.deepEqual(page.errors, []);
48
+ } finally { await page.close(); }
49
+ });
50
+
51
+ test('exactly three other features: one chip and "…2 more"', { skip }, async () => {
52
+ const page = await openPage(reviewPage(one));
53
+ try {
54
+ await settle();
55
+ assert.deepEqual(await shown(page), ['FEAT-003']);
56
+ assert.deepEqual(await button(page), { text: '…2 more', open: 'false' });
57
+ assert.deepEqual(page.errors, []);
58
+ } finally { await page.close(); }
59
+ });
@@ -0,0 +1,83 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { findChrome } from '../../../../analyze-requirements/scripts/lib/chrome.mjs';
4
+ import { openPage } from '../../../../analyze-requirements/scripts/lib/cdp.mjs';
5
+ import { reviewPage, componentsPage } from './stage.mjs';
6
+
7
+ const skip = !findChrome();
8
+ const settle = () => new Promise((r) => setTimeout(r, 1500));
9
+ const BOX = `document.querySelector('[data-lpick="FEAT-001"]')`;
10
+ const type = (page, q) => page.eval(`(() => { const i = ${BOX}.querySelector('input'); i.value = ${JSON.stringify(q)}; i.dispatchEvent(new Event('input', { bubbles: true })); })()`);
11
+ const key = (page, k) => page.eval(`${BOX}.querySelector('input').dispatchEvent(new KeyboardEvent('keydown', { key: '${k}', bubbles: true }))`);
12
+ const options = (page) => page.eval(`[...${BOX}.querySelectorAll('.lpick-o')].map((o) => o.dataset.lpickId)`);
13
+ const current = (page) => page.eval(`${BOX}.querySelector('.lpick-o.lpick-cur')?.dataset.lpickId ?? null`);
14
+ const isOpen = (page) => page.eval(`!${BOX}.querySelector('.lpick-list').classList.contains('hide')`);
15
+ const builders = (page) => page.eval(`[...document.querySelectorAll('[data-builtby="FEAT-001"] [data-comp-chip]')].map((r) => r.dataset.compChip).sort()`);
16
+ const pinned = (page) => page.eval(`!document.getElementById('pinbar').classList.contains('hide')`);
17
+
18
+ async function onReview(fn) {
19
+ const page = await openPage(reviewPage());
20
+ try { await settle(); await fn(page); assert.deepEqual(page.errors, []); } finally { await page.close(); }
21
+ }
22
+
23
+ test('typing filters by component or container name; builders are left out', { skip }, () => onReview(async (page) => {
24
+ assert.equal(await page.eval(`${BOX}.querySelector('input').placeholder`), '+ Link a component… type to filter');
25
+ await type(page, 'BILL');
26
+ assert.deepEqual(await options(page), ['api.billing']);
27
+ assert.equal(await isOpen(page), true);
28
+ await type(page, 'worker');
29
+ assert.deepEqual((await options(page)).sort(), ['worker.drafter', 'worker.notify']);
30
+ await type(page, 'stage');
31
+ assert.deepEqual(await options(page), []);
32
+ assert.match(await page.eval(`${BOX}.querySelector('.lpick-list').textContent`), /No component matches/);
33
+ await type(page, '');
34
+ assert.deepEqual((await options(page)).sort(), ['api.billing', 'api.orders', 'ops', 'worker.drafter', 'worker.notify']);
35
+ assert.match(await page.eval(`${BOX}.querySelector('[data-lpick-id="ops"]').textContent`), /builds nothing yet/);
36
+ }));
37
+
38
+ test('arrows move the highlight, Enter links it, nothing gets pinned', { skip }, () => onReview(async (page) => {
39
+ await type(page, 'worker');
40
+ const [first, second] = await options(page);
41
+ assert.equal(await current(page), first);
42
+ await key(page, 'ArrowDown');
43
+ assert.equal(await current(page), second);
44
+ await key(page, 'ArrowUp');
45
+ assert.equal(await current(page), first);
46
+ await key(page, 'Enter');
47
+ assert.deepEqual(await builders(page), ['api.stage', first, 'office'].sort());
48
+ assert.equal(await pinned(page), false);
49
+ }));
50
+
51
+ const over = (page, sel) => page.eval(`${BOX}.querySelector('${sel}').dispatchEvent(new MouseEvent('mouseover', { bubbles: true }))`);
52
+
53
+ test('hovering the card keeps the keyboard highlight; hovering an option moves it', { skip }, () => onReview(async (page) => {
54
+ await type(page, 'worker');
55
+ const [first, second] = await options(page);
56
+ await over(page, 'input');
57
+ await over(page, '.lpick-g');
58
+ assert.equal(await current(page), first);
59
+ await over(page, `[data-lpick-id="${second}"]`);
60
+ assert.equal(await current(page), second);
61
+ await key(page, 'Enter');
62
+ assert.deepEqual(await builders(page), ['api.stage', second, 'office'].sort());
63
+ }));
64
+
65
+ test('a mouse pick links it and does not pin; Esc clears and closes', { skip }, () => onReview(async (page) => {
66
+ await type(page, 'drafter');
67
+ await page.eval(`${BOX}.querySelector('[data-lpick-id="worker.drafter"]').click()`);
68
+ assert.deepEqual(await builders(page), ['api.stage', 'office', 'worker.drafter']);
69
+ assert.equal(await pinned(page), false);
70
+ await type(page, 'bill');
71
+ await key(page, 'Escape');
72
+ assert.equal(await isOpen(page), false);
73
+ assert.equal(await page.eval(`${BOX}.querySelector('input').value`), '');
74
+ }));
75
+
76
+ test('the read-only Component-based page has no picker', { skip }, async () => {
77
+ const page = await openPage(componentsPage());
78
+ try {
79
+ await settle();
80
+ assert.equal(await page.eval(`document.querySelectorAll('.lpick, select[data-link]').length`), 0);
81
+ assert.deepEqual(page.errors, []);
82
+ } finally { await page.close(); }
83
+ });
@@ -3,7 +3,7 @@ import { execFileSync } from 'node:child_process';
3
3
  import { mkdtempSync, readFileSync, writeFileSync, copyFileSync } from 'node:fs';
4
4
  import { tmpdir } from 'node:os';
5
5
  import { join } from 'node:path';
6
- import { fileURLToPath } from 'node:url';
6
+ import { fileURLToPath, pathToFileURL } from 'node:url';
7
7
 
8
8
  export const script = (n) => fileURLToPath(new URL(`../${n}.mjs`, import.meta.url));
9
9
  const fx = (n) => fileURLToPath(new URL(`./fixtures/${n}`, import.meta.url));
@@ -30,3 +30,21 @@ export function noFlowsAt(dir) {
30
30
  for (const f of req.features.slice(2, 4)) f.steps = [];
31
31
  writeFileSync(path, JSON.stringify(req));
32
32
  }
33
+
34
+ // The score review page for the fixture lead, as a file URL.
35
+ export function reviewPage(mutate) {
36
+ const dir = mkdtempSync(join(tmpdir(), 'wf-review-'));
37
+ const inputs = JSON.parse(readFileSync(fx('inputs-pass.json'), 'utf8'));
38
+ if (mutate) mutate(inputs);
39
+ writeFileSync(join(dir, 'estimation-inputs.json'), JSON.stringify(inputs));
40
+ copyFileSync(fx('requirements.json'), join(dir, 'requirements.json'));
41
+ execFileSync('node', [script('score-review'), '--write', join(dir, 'estimation-inputs.json'), '--out', join(dir, 'review.html')]);
42
+ return pathToFileURL(join(dir, 'review.html')).href;
43
+ }
44
+
45
+ // The Component-based estimate page for the fixture lead, as a file URL.
46
+ export function componentsPage(mutate) {
47
+ const dir = staged(mutate);
48
+ execFileSync('node', [script('render'), '--inputs', join(dir, 'estimation-inputs.json'), '--json', join(dir, 'estimation.json'), '--out', join(dir, 'dist')]);
49
+ return pathToFileURL(join(dir, 'dist', 'estimate-components.html')).href;
50
+ }