@v11g/agents-rock 1.0.0
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.
- package/README.md +65 -0
- package/bin/agents-rock.mjs +4 -0
- package/package.json +13 -0
- package/plugins/solution-architect/.claude-plugin/plugin.json +9 -0
- package/plugins/solution-architect/skills/analyze-requirements/README.md +75 -0
- package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +31 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/OFL.txt +98 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/mermaid-theme.json +52 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +101 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +2389 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +53 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/likec4.md +157 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +60 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/research.md +78 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +772 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +206 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +74 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/chrome.mjs +66 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/companion-links.mjs +20 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-kinds.mjs +37 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +26 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +27 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-sections.mjs +78 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/embed.mjs +8 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/er-entities.mjs +16 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/fonts.mjs +39 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/frontmatter.mjs +17 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +41 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-config.mjs +41 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-extract.mjs +29 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/likec4-steps.mjs +22 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-defs.mjs +20 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-flows.mjs +46 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-inline.mjs +31 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-links.mjs +7 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-list.mjs +64 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +127 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-shape.mjs +19 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-tables.mjs +30 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-views.mjs +48 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-wide.mjs +44 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/nav.mjs +72 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/offline.mjs +19 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/port.mjs +13 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +113 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +49 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/slug-registry.mjs +11 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-clusters.mjs +15 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-deployment.mjs +8 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-elections.mjs +20 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-links.mjs +23 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-model-tables.mjs +24 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-palette.mjs +34 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +20 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-tree.mjs +16 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-config.mjs +19 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-export.mjs +35 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/likec4-gen.mjs +39 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +130 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/serve.mjs +71 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +553 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/companion-links.test.mjs +60 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-kinds.test.mjs +41 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +104 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-routes.test.mjs +54 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-sections.test.mjs +197 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/embed.test.mjs +28 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/er-entities.test.mjs +14 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/ARCHITECTURE.md +47 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/broken/model.c4 +27 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/c4-src/pass/model.c4 +29 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/adr/0001-sample.md +18 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimate.html +2 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/docs/estimation.md +8 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model-broken.json +1 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/model.json +1 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/docs-pass/threat-model.md +8 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample-model.json +1 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fixtures/sample.c4 +28 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/fonts.test.mjs +38 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/frontmatter.test.mjs +27 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +72 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config-cli.test.mjs +26 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-config.test.mjs +74 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-export-cli.test.mjs +61 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-extract.test.mjs +37 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-gen-cli.test.mjs +73 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/likec4-steps.test.mjs +32 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-flows.test.mjs +82 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-links.test.mjs +16 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-provenance.test.mjs +42 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +226 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-tables.test.mjs +30 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-views.test.mjs +76 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-wide.test.mjs +76 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/nav.test.mjs +236 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/offline.test.mjs +37 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +86 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gates.test.mjs +20 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +171 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/research-workflow.test.mjs +38 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +101 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/serve.test.mjs +48 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-clusters.test.mjs +46 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-deployment.test.mjs +23 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-elections.test.mjs +30 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-links.test.mjs +38 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-model-tables.test.mjs +51 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +28 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-tree.test.mjs +43 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/viewer-template.test.mjs +1206 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +88 -0
- package/plugins/solution-architect/skills/analyze-requirements/workflows/research.js +57 -0
- package/plugins/solution-architect/skills/estimate/README.md +67 -0
- package/plugins/solution-architect/skills/estimate/SKILL.md +64 -0
- package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +1128 -0
- package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +95 -0
- package/plugins/solution-architect/skills/estimate/references/interview.md +80 -0
- package/plugins/solution-architect/skills/estimate/references/slicing.md +55 -0
- package/plugins/solution-architect/skills/estimate/references/techniques.md +111 -0
- package/plugins/solution-architect/skills/estimate/references/writing.md +211 -0
- package/plugins/solution-architect/skills/estimate/scripts/compute.mjs +23 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +128 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/components.mjs +19 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +85 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +10 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +30 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +32 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +122 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +128 -0
- package/plugins/solution-architect/skills/estimate/scripts/render.mjs +65 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +623 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +88 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +34 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +112 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +58 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +30 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +60 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/quality-gates.test.mjs +20 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +71 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +121 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +129 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +72 -0
- package/plugins/solution-architect/skills/estimate/scripts/validate.mjs +20 -0
- package/plugins/solution-architect/skills/new-lead/README.md +48 -0
- package/plugins/solution-architect/skills/new-lead/SKILL.md +113 -0
- package/plugins/solution-architect/skills/new-lead/assets/dashboard/detail.html +842 -0
- package/plugins/solution-architect/skills/new-lead/assets/dashboard/index.html +655 -0
- package/plugins/solution-architect/skills/new-lead/assets/dashboard/start.sh +3 -0
- package/plugins/solution-architect/skills/new-lead/assets/dashboard/stats.mjs +98 -0
- package/plugins/solution-architect/skills/new-lead/assets/dashboard/vendor/reactflow-bundle.js +473 -0
- package/plugins/solution-architect/skills/new-lead/assets/vendor-build/entry.jsx +33 -0
- package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package-lock.json +1055 -0
- package/plugins/solution-architect/skills/new-lead/assets/vendor-build/package.json +19 -0
- package/plugins/solution-architect/skills/new-lead/scripts/init-root.mjs +73 -0
- package/plugins/solution-architect/skills/new-lead/scripts/lead-upsert.mjs +31 -0
- package/plugins/solution-architect/skills/new-lead/scripts/lib/enrich.mjs +20 -0
- package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +124 -0
- package/plugins/solution-architect/skills/new-lead/scripts/lib/map.mjs +117 -0
- package/plugins/solution-architect/skills/new-lead/scripts/lib/port.mjs +15 -0
- package/plugins/solution-architect/skills/new-lead/scripts/lib/registry.mjs +116 -0
- package/plugins/solution-architect/skills/new-lead/scripts/serve.mjs +163 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/e2e-workspace.test.mjs +59 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/enrich.test.mjs +16 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/ARCHITECTURE.md +16 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/brief.md +4 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/index.html +11 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/proposal-non-tech.html +2 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/dist/threat-model.html +2 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation-inputs.json +6 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/estimation.json +10 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/notes.md +3 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/proposal-non-tech.md +3 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads/acme-crm/rfp.md +3 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/fixtures/root/leads.json +25 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/init-root.test.mjs +81 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/lead-upsert.test.mjs +67 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/map.test.mjs +72 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/port.test.mjs +31 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/registry-io.test.mjs +57 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/registry.test.mjs +49 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/serve.test.mjs +205 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/stats.test.mjs +92 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/validate-cli.test.mjs +24 -0
- package/plugins/solution-architect/skills/new-lead/scripts/test/vendor-bundle.test.mjs +9 -0
- package/plugins/solution-architect/skills/new-lead/scripts/validate.mjs +9 -0
- package/plugins/solution-architect/skills/proposal/README.md +36 -0
- package/plugins/solution-architect/skills/proposal/SKILL.md +58 -0
- package/plugins/solution-architect/skills/proposal/assets/proposal-template.html +82 -0
- package/plugins/solution-architect/skills/proposal/references/interview.md +63 -0
- package/plugins/solution-architect/skills/proposal/references/review.md +28 -0
- package/plugins/solution-architect/skills/proposal/references/writing.md +102 -0
- package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +22 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +75 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +54 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +17 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +43 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/jargon.mjs +9 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +32 -0
- package/plugins/solution-architect/skills/proposal/scripts/render.mjs +60 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +144 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +93 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +51 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +30 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +81 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +22 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +55 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/quality-gates.test.mjs +20 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +70 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +40 -0
- package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +20 -0
- package/src/cli/agents.mjs +12 -0
- package/src/cli/args.mjs +46 -0
- package/src/cli/install.mjs +68 -0
- package/src/cli/main.mjs +124 -0
- package/src/cli/picker.mjs +78 -0
- package/src/cli/registry.mjs +26 -0
- package/src/cli/uninstall.mjs +38 -0
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { execFileSync } from 'node:child_process';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
import { findChrome } from '../../../analyze-requirements/scripts/lib/chrome.mjs';
|
|
9
|
+
import { openPage } from '../../../analyze-requirements/scripts/lib/cdp.mjs';
|
|
10
|
+
import {
|
|
11
|
+
pert, taskHours, scenarioRollup, riskBufferHours, projectBuffer, dominantSeniority,
|
|
12
|
+
} from '../lib/estimate-math.mjs';
|
|
13
|
+
|
|
14
|
+
const skip = { skip: !findChrome() && 'no chrome on PATH' };
|
|
15
|
+
const fixture = new URL('./fixtures/booking-inputs.json', import.meta.url).pathname;
|
|
16
|
+
|
|
17
|
+
function buildPage(extra = []) {
|
|
18
|
+
const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-'));
|
|
19
|
+
const scripts = new URL('..', import.meta.url).pathname;
|
|
20
|
+
const passMd = join(scripts, 'test/fixtures/estimation-pass.md');
|
|
21
|
+
execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', fixture, '--out', join(dir, 'estimation.json')]);
|
|
22
|
+
execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', passMd, '--out', dir, ...extra]);
|
|
23
|
+
return pathToFileURL(join(dir, 'estimate.html')).href;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function nodeRecompute(p) {
|
|
27
|
+
const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
|
|
28
|
+
const tasks = inputs.features.flatMap((f) => f.tasks);
|
|
29
|
+
const seniority = dominantSeniority(p.team);
|
|
30
|
+
const hoursOf = (t) => taskHours({ e: pert(t).e, seniority, plan: p.plan,
|
|
31
|
+
category: t.category, verificationPct: inputs.verificationPct, scale: p.aiScale });
|
|
32
|
+
const dev = tasks.reduce((s, t) => s + hoursOf(t), 0);
|
|
33
|
+
const buffers = (riskBufferHours(inputs.risks) + projectBuffer(tasks.map((t) => pert(t).sigma))) * p.bufferScale;
|
|
34
|
+
const hours = dev + dev * p.overheadPct + buffers;
|
|
35
|
+
return { hours, ...scenarioRollup({ hours, team: p.team, plan: p.plan }) };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// A mixed roster on purpose: effort follows the dominant seniority (mid),
|
|
39
|
+
// labor cost follows each member's own rate.
|
|
40
|
+
const PARAMS = {
|
|
41
|
+
team: [{ seniority: 'senior', rate: 60 }, { seniority: 'mid', rate: 45 }, { seniority: 'mid', rate: 45 }],
|
|
42
|
+
plan: 'max5x', aiScale: 1, bufferScale: 1, overheadPct: 0.35,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
test('page boots without console errors and browser math equals node math', skip, async () => {
|
|
46
|
+
const page = await openPage(buildPage());
|
|
47
|
+
try {
|
|
48
|
+
const got = await page.eval(`window.__recompute(${JSON.stringify(PARAMS)})`);
|
|
49
|
+
const want = nodeRecompute(PARAMS);
|
|
50
|
+
for (const key of ['hours', 'months', 'totalCost']) {
|
|
51
|
+
assert.ok(Math.abs(got[key] - want[key]) < 1e-6, `${key}: ${got[key]} != ${want[key]}`);
|
|
52
|
+
}
|
|
53
|
+
assert.deepEqual(page.errors, []);
|
|
54
|
+
} finally { page.close(); }
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// The bug this guards against: the old rail replicated team[0].rate across
|
|
58
|
+
// the whole team, so its resting numbers disagreed with the committed card
|
|
59
|
+
// it claims to reproduce (2×$60 instead of $60+$45 on the fixture).
|
|
60
|
+
test('the rail at rest reproduces the committed recommended scenario', skip, async () => {
|
|
61
|
+
const page = await openPage(buildPage());
|
|
62
|
+
try {
|
|
63
|
+
const { got, want } = await page.eval(`(() => {
|
|
64
|
+
const rec = DATA.inputs.scenarios.find((s) => s.id === DATA.inputs.recommendedScenario);
|
|
65
|
+
return { got: window.__recompute({ team: rec.team, plan: rec.plan,
|
|
66
|
+
aiScale: 1, bufferScale: 1, overheadPct: DATA.inputs.overheadPct }),
|
|
67
|
+
want: DATA.computed.scenarios[rec.id] };
|
|
68
|
+
})()`);
|
|
69
|
+
for (const key of ['hours', 'months', 'totalCost']) {
|
|
70
|
+
// committed numbers are round2'd — compare at that grain
|
|
71
|
+
assert.ok(Math.abs(got[key] - want[key]) < 0.005, `${key}: ${got[key]} != ${want[key]}`);
|
|
72
|
+
}
|
|
73
|
+
} finally { page.close(); }
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const readRoster = (page) => page.eval(`[...document.querySelectorAll('#ctl-team .team-row')].map((r) => ({
|
|
77
|
+
seniority: r.querySelector('select').value, rate: Number(r.querySelector('input').value) }))`);
|
|
78
|
+
|
|
79
|
+
test('the roster boots as the recommended team, one row per member', skip, async () => {
|
|
80
|
+
const page = await openPage(buildPage());
|
|
81
|
+
try {
|
|
82
|
+
const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
|
|
83
|
+
const rec = inputs.scenarios.find((s) => s.id === inputs.recommendedScenario);
|
|
84
|
+
assert.deepEqual(await readRoster(page), rec.team);
|
|
85
|
+
// seniority options come from SENIORITY_FACTOR, not a hand-written triple
|
|
86
|
+
assert.deepEqual(await page.eval(
|
|
87
|
+
`[...document.querySelector('#ctl-team select').options].map((o) => o.value)`),
|
|
88
|
+
['junior', 'mid', 'senior']);
|
|
89
|
+
} finally { page.close(); }
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Rates ride with seniority: the committed scenarios are the page's only
|
|
93
|
+
// rate table (booking fixture: junior 30, mid 45, senior 60), so switching
|
|
94
|
+
// a row's level re-seeds its rate — still hand-editable afterwards.
|
|
95
|
+
test('switching a row seniority re-seeds its rate from the committed scenarios', skip, async () => {
|
|
96
|
+
const page = await openPage(buildPage());
|
|
97
|
+
try {
|
|
98
|
+
const readout = () => page.eval(`document.getElementById('whatif-readout').textContent`);
|
|
99
|
+
const before = await readout();
|
|
100
|
+
await page.eval(`(() => {
|
|
101
|
+
const sel = document.querySelector('#ctl-team .team-row select');
|
|
102
|
+
sel.value = 'junior'; sel.dispatchEvent(new Event('input', { bubbles: true }));
|
|
103
|
+
})()`);
|
|
104
|
+
assert.deepEqual((await readRoster(page))[0], { seniority: 'junior', rate: 30 });
|
|
105
|
+
assert.notEqual(await readout(), before, 'the readout must follow the re-seeded rate');
|
|
106
|
+
} finally { page.close(); }
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('every rate input carries a dollar-sign prefix', skip, async () => {
|
|
110
|
+
const page = await openPage(buildPage());
|
|
111
|
+
try {
|
|
112
|
+
const cur = await page.eval(
|
|
113
|
+
`[...document.querySelectorAll('#ctl-team .team-row .cur')].map((c) => c.textContent)`);
|
|
114
|
+
assert.deepEqual(cur, ['$', '$']);
|
|
115
|
+
} finally { page.close(); }
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('adding and removing a row recalculates with the coordination tax', skip, async () => {
|
|
119
|
+
const page = await openPage(buildPage());
|
|
120
|
+
try {
|
|
121
|
+
const months = () => page.eval(
|
|
122
|
+
`parseFloat(document.querySelector('#whatif-readout .num').textContent)`);
|
|
123
|
+
const before = await months();
|
|
124
|
+
await page.eval(`document.querySelector('#ctl-team .team-add').click()`);
|
|
125
|
+
const rows = await readRoster(page);
|
|
126
|
+
assert.equal(rows.length, 3);
|
|
127
|
+
assert.deepEqual(rows[2], rows[1], 'a new row clones the last one');
|
|
128
|
+
assert.ok(await months() < before, `three engineers must finish sooner than two`);
|
|
129
|
+
await page.eval(`document.querySelector('#ctl-team .team-row:last-of-type .team-del').click()`);
|
|
130
|
+
assert.equal(await months(), before);
|
|
131
|
+
} finally { page.close(); }
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('the roster is capped between one and eight engineers', skip, async () => {
|
|
135
|
+
const page = await openPage(buildPage());
|
|
136
|
+
try {
|
|
137
|
+
const count = () => page.eval(`document.querySelectorAll('#ctl-team .team-row').length`);
|
|
138
|
+
// clicks are synchronous in-page; a disabled button ignores them, so
|
|
139
|
+
// over-clicking in one eval is exactly the user mashing the button
|
|
140
|
+
await page.eval(`for (let i = 0; i < 10; i++) document.querySelector('#ctl-team .team-add').click()`);
|
|
141
|
+
assert.equal(await count(), 8);
|
|
142
|
+
assert.equal(await page.eval(`document.querySelector('#ctl-team .team-add').disabled`), true);
|
|
143
|
+
await page.eval(
|
|
144
|
+
`for (let i = 0; i < 10; i++) document.querySelector('#ctl-team .team-row:last-of-type .team-del').click()`);
|
|
145
|
+
assert.equal(await count(), 1);
|
|
146
|
+
assert.equal(await page.eval(`document.querySelector('#ctl-team .team-del').disabled`), true);
|
|
147
|
+
} finally { page.close(); }
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test('the scenario cards show only committed scenarios — the rail owns what-if', skip, async () => {
|
|
151
|
+
const page = await openPage(buildPage());
|
|
152
|
+
try {
|
|
153
|
+
const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
|
|
154
|
+
const cards = await page.eval(`[...document.querySelectorAll('#scenario-cards .scenario h3')].map((h) => h.textContent)`);
|
|
155
|
+
assert.deepEqual(cards.sort(), inputs.scenarios.map((s) => s.id).sort());
|
|
156
|
+
const bars = await page.eval(`[...document.querySelectorAll('#cost-bars .bar-label')].map((b) => b.textContent)`);
|
|
157
|
+
assert.ok(!bars.some((b) => b.startsWith('custom')), `custom bar leaked: ${bars}`);
|
|
158
|
+
} finally { page.close(); }
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('moving a control shows the banner; reset rebuilds the default roster', skip, async () => {
|
|
162
|
+
const page = await openPage(buildPage());
|
|
163
|
+
try {
|
|
164
|
+
await page.eval(`(() => {
|
|
165
|
+
const ctl = document.querySelector('#ctl-team .team-row input');
|
|
166
|
+
ctl.value = '80'; ctl.dispatchEvent(new Event('input', { bubbles: true }));
|
|
167
|
+
})()`);
|
|
168
|
+
assert.equal(await page.eval(`document.getElementById('modified-banner').hidden`), false);
|
|
169
|
+
await page.eval(`document.querySelector('#ctl-team .team-add').click()`);
|
|
170
|
+
await page.eval(`document.getElementById('reset').click()`);
|
|
171
|
+
assert.equal(await page.eval(`document.getElementById('modified-banner').hidden`), true);
|
|
172
|
+
assert.equal(await page.eval(`document.querySelectorAll('#ctl-team .team-row').length`), 2);
|
|
173
|
+
assert.equal(await page.eval(`document.querySelector('#ctl-team .team-row input').value`), '60');
|
|
174
|
+
} finally { page.close(); }
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test('every section explains itself: help icons plus a rendered method section', skip, async () => {
|
|
178
|
+
const page = await openPage(buildPage());
|
|
179
|
+
try {
|
|
180
|
+
assert.ok(await page.eval(`document.querySelectorAll('details.help').length >= 6`),
|
|
181
|
+
'expected a help icon per section');
|
|
182
|
+
const method = await page.eval(`document.getElementById('method').textContent`);
|
|
183
|
+
assert.match(method, /three-point-pert/); // technique named from inputs
|
|
184
|
+
assert.match(method, /PERT/);
|
|
185
|
+
assert.match(method, /atomicobject\.com/);
|
|
186
|
+
// open by default: the method explains the page up front; still collapsible
|
|
187
|
+
assert.equal(await page.eval(`document.querySelector('#method details.method-fold').open`), true);
|
|
188
|
+
await page.eval(`document.querySelector('#method details.method-fold summary').click()`);
|
|
189
|
+
assert.equal(await page.eval(`document.querySelector('#method details.method-fold').open`), false);
|
|
190
|
+
} finally { page.close(); }
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test('the what-if rail shows a live readout that tracks control changes', skip, async () => {
|
|
194
|
+
const page = await openPage(buildPage());
|
|
195
|
+
try {
|
|
196
|
+
const read = () => page.eval(`document.getElementById('whatif-readout').textContent`);
|
|
197
|
+
const before = await read();
|
|
198
|
+
assert.match(before, /months/);
|
|
199
|
+
await page.eval(`(() => {
|
|
200
|
+
const sel = document.querySelector('#ctl-team .team-row select');
|
|
201
|
+
sel.value = 'junior'; sel.dispatchEvent(new Event('input', { bubbles: true }));
|
|
202
|
+
})()`);
|
|
203
|
+
assert.notEqual(await read(), before);
|
|
204
|
+
} finally { page.close(); }
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test('client view hides internals; theme toggle flips the root attribute', skip, async () => {
|
|
208
|
+
const page = await openPage(buildPage());
|
|
209
|
+
try {
|
|
210
|
+
await page.eval(`document.getElementById('view-toggle').click()`);
|
|
211
|
+
assert.equal(await page.eval(
|
|
212
|
+
`getComputedStyle(document.getElementById('controls')).display`), 'none');
|
|
213
|
+
await page.eval(`document.getElementById('theme-toggle').click()`);
|
|
214
|
+
assert.equal(await page.eval(`document.documentElement.dataset.theme`), 'light');
|
|
215
|
+
} finally { page.close(); }
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test('the --client-only page boots clean without its stripped controls', skip, async () => {
|
|
219
|
+
const page = await openPage(buildPage(['--client-only']));
|
|
220
|
+
try {
|
|
221
|
+
assert.deepEqual(page.errors, []); // stripped nodes must be null-guarded, not assumed
|
|
222
|
+
assert.equal(await page.eval(`document.getElementById('ctl-team')`), null);
|
|
223
|
+
for (const id of ['scenario-cards', 'feature-table', 'register', 'method', 'roadmap', 'containers']) {
|
|
224
|
+
assert.ok(await page.eval(`document.getElementById('${id}').children.length > 0`),
|
|
225
|
+
`${id} empty on client-only page`);
|
|
226
|
+
}
|
|
227
|
+
} finally { page.close(); }
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('feature breakdown absorbs the effort chart and the task register', skip, async () => {
|
|
231
|
+
const page = await openPage(buildPage());
|
|
232
|
+
try {
|
|
233
|
+
assert.equal(await page.eval(`document.getElementById('timeline')`), null);
|
|
234
|
+
const names = await page.eval(
|
|
235
|
+
`[...document.querySelectorAll('#feature-table tr.feat-row td:first-child')].map((c) => c.textContent.trim())`);
|
|
236
|
+
assert.equal(names.length, 2);
|
|
237
|
+
assert.match(names[0], /book appointment/); // hours desc by default
|
|
238
|
+
assert.equal(await page.eval(`document.querySelectorAll('#feature-table .bd-fill').length`), 2);
|
|
239
|
+
// per-feature confidence chip is the worst task confidence (booking: HIGH+MED → MED)
|
|
240
|
+
const conf = await page.eval(
|
|
241
|
+
`[...document.querySelectorAll('#feature-table tr.feat-row .conf')].map((c) => c.textContent)`);
|
|
242
|
+
assert.deepEqual(conf, ['MED', 'MED']);
|
|
243
|
+
// the flat task register is gone; the risk register keeps its own section
|
|
244
|
+
const captions = await page.eval(
|
|
245
|
+
`[...document.querySelectorAll('#register caption')].map((c) => c.textContent)`);
|
|
246
|
+
assert.equal(captions.length, 1);
|
|
247
|
+
assert.match(captions[0], /Risk register/);
|
|
248
|
+
assert.deepEqual(page.errors, []);
|
|
249
|
+
} finally { page.close(); }
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
test('breakdown headers sort: effort toggles to ascending on click', skip, async () => {
|
|
253
|
+
const page = await openPage(buildPage());
|
|
254
|
+
try {
|
|
255
|
+
const firstRow = () => page.eval(
|
|
256
|
+
`document.querySelector('#feature-table tr.feat-row td:first-child').textContent.trim()`);
|
|
257
|
+
assert.match(await firstRow(), /book appointment/);
|
|
258
|
+
await page.eval(`document.querySelector('#feature-table th button[data-sort="hours"]').click()`);
|
|
259
|
+
assert.match(await firstRow(), /Email reminders/);
|
|
260
|
+
assert.equal(await page.eval(
|
|
261
|
+
`document.querySelector('#feature-table th button[data-sort="hours"]').closest('th').getAttribute('aria-sort')`),
|
|
262
|
+
'ascending');
|
|
263
|
+
} finally { page.close(); }
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test('expanding a feature reveals its tasks; client view hides the drill-down', skip, async () => {
|
|
267
|
+
const page = await openPage(buildPage());
|
|
268
|
+
try {
|
|
269
|
+
assert.equal(await page.eval(`document.querySelectorAll('#feature-table tr.task-row').length`), 0);
|
|
270
|
+
await page.eval(`document.querySelector('#feature-table tr.feat-row .expand').click()`);
|
|
271
|
+
const tasks = await page.eval(
|
|
272
|
+
`[...document.querySelectorAll('#feature-table tr.task-row td:first-child')].map((c) => c.textContent.trim())`);
|
|
273
|
+
assert.deepEqual(tasks, ['Booking CRUD API', 'Slot conflict + cancellation rules']);
|
|
274
|
+
await page.eval(`document.getElementById('view-toggle').click()`);
|
|
275
|
+
assert.equal(await page.eval(
|
|
276
|
+
`getComputedStyle(document.querySelector('#feature-table tr.task-row')).display`), 'none');
|
|
277
|
+
assert.equal(await page.eval(
|
|
278
|
+
`getComputedStyle(document.querySelector('#feature-table .expand')).display`), 'none');
|
|
279
|
+
} finally { page.close(); }
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
test('scenario cards carry a month gauge, facts grid, and delta on non-recommended', skip, async () => {
|
|
283
|
+
const page = await openPage(buildPage());
|
|
284
|
+
try {
|
|
285
|
+
assert.equal(await page.eval(
|
|
286
|
+
`document.querySelectorAll('#scenario-cards .scenario .gauge span').length`), 2);
|
|
287
|
+
const widths = await page.eval(
|
|
288
|
+
`[...document.querySelectorAll('#scenario-cards .gauge span')].map((s) => s.style.width)`);
|
|
289
|
+
assert.ok(widths.includes('100%'), `longest scenario must fill its gauge: ${widths}`);
|
|
290
|
+
assert.equal(await page.eval(
|
|
291
|
+
`document.querySelectorAll('#scenario-cards .scenario.recommended .facts dt').length`), 4);
|
|
292
|
+
const facts = await page.eval(
|
|
293
|
+
`[...document.querySelectorAll('#scenario-cards .scenario:not(.recommended) .facts dd')].map((d) => d.textContent)`);
|
|
294
|
+
assert.ok(facts.some((t) => t.includes('2× mid · 1× junior')), `team summary missing: ${facts}`);
|
|
295
|
+
assert.equal(await page.eval(
|
|
296
|
+
`document.querySelectorAll('#scenario-cards .scenario.recommended .delta').length`), 0);
|
|
297
|
+
assert.match(await page.eval(
|
|
298
|
+
`document.querySelector('#scenario-cards .scenario:not(.recommended) .delta').textContent`),
|
|
299
|
+
/mo · [+-]\$[\d,]+ vs recommended/);
|
|
300
|
+
} finally { page.close(); }
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
test('expand all / collapse all toggle every task row and stay internal-only', skip, async () => {
|
|
304
|
+
const page = await openPage(buildPage());
|
|
305
|
+
try {
|
|
306
|
+
await page.eval(`document.querySelector('#feature-table button[data-expand="all"]').click()`);
|
|
307
|
+
assert.equal(await page.eval(`document.querySelectorAll('#feature-table tr.task-row').length`), 3);
|
|
308
|
+
await page.eval(`document.querySelector('#feature-table button[data-expand="none"]').click()`);
|
|
309
|
+
assert.equal(await page.eval(`document.querySelectorAll('#feature-table tr.task-row').length`), 0);
|
|
310
|
+
await page.eval(`document.getElementById('view-toggle').click()`);
|
|
311
|
+
assert.equal(await page.eval(
|
|
312
|
+
`getComputedStyle(document.querySelector('#feature-table button[data-expand="all"]').closest('.bd-filter-group')).display`), 'none');
|
|
313
|
+
} finally { page.close(); }
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test('the what-if rail is not sticky and lower sections span the full width', skip, async () => {
|
|
317
|
+
const page = await openPage(buildPage());
|
|
318
|
+
try {
|
|
319
|
+
assert.notEqual(await page.eval(
|
|
320
|
+
`getComputedStyle(document.getElementById('controls')).position`), 'sticky');
|
|
321
|
+
const width = (id) => page.eval(
|
|
322
|
+
`document.getElementById('${id}').getBoundingClientRect().width`);
|
|
323
|
+
const narrow = await width('cost-bars');
|
|
324
|
+
for (const id of ['method', 'roadmap', 'feature-table', 'register']) {
|
|
325
|
+
assert.ok(await width(id) > narrow + 100,
|
|
326
|
+
`${id} should outspan the rail-adjacent sections (${await width(id)} vs ${narrow})`);
|
|
327
|
+
}
|
|
328
|
+
// no hole under the cost bars: the left column stretches to the rail's end
|
|
329
|
+
const bottom = (id) => page.eval(
|
|
330
|
+
`document.getElementById('${id}').getBoundingClientRect().bottom`);
|
|
331
|
+
assert.ok(await bottom('cost-bars') >= await bottom('controls') - 1,
|
|
332
|
+
`left column ends above the rail (${await bottom('cost-bars')} vs ${await bottom('controls')})`);
|
|
333
|
+
// the rail panel starts level with the scenario cards, not their heading
|
|
334
|
+
const railTop = await page.eval(
|
|
335
|
+
`document.getElementById('controls').getBoundingClientRect().top`);
|
|
336
|
+
const cardTop = await page.eval(
|
|
337
|
+
`document.querySelector('#scenario-cards .scenario').getBoundingClientRect().top`);
|
|
338
|
+
assert.ok(Math.abs(railTop - cardTop) < 2, `rail top ${railTop} != card top ${cardTop}`);
|
|
339
|
+
// the scenario cards own the tall row; the cost bars stay content-sized
|
|
340
|
+
const height = (id) => page.eval(
|
|
341
|
+
`document.getElementById('${id}').getBoundingClientRect().height`);
|
|
342
|
+
assert.ok(await height('scenario-cards') > await height('cost-bars'),
|
|
343
|
+
'scenario cards should be the taller section');
|
|
344
|
+
} finally { page.close(); }
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
const pickOption = (key, value) => `(() => {
|
|
348
|
+
const sel = document.querySelector('#feature-table select[data-select="${key}"]');
|
|
349
|
+
sel.value = ${JSON.stringify(value)};
|
|
350
|
+
sel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
351
|
+
})()`;
|
|
352
|
+
|
|
353
|
+
test('milestone select and provenance pills scope rows without rescaling bars', skip, async () => {
|
|
354
|
+
const page = await openPage(buildPage());
|
|
355
|
+
try {
|
|
356
|
+
const width = () => page.eval(
|
|
357
|
+
`document.querySelector('#feature-table tr.feat-row[data-id="reminders"] .bd-fill').style.width`);
|
|
358
|
+
const before = await width();
|
|
359
|
+
await page.eval(pickOption('milestone', 'M2 - Notifications'));
|
|
360
|
+
const visible = await page.eval(
|
|
361
|
+
`[...document.querySelectorAll('#feature-table tr.feat-row')].map((r) => r.dataset.id)`);
|
|
362
|
+
assert.deepEqual(visible, ['reminders']);
|
|
363
|
+
assert.equal(await width(), before, 'bar must keep its global scale under filters');
|
|
364
|
+
await page.eval(pickOption('milestone', ''));
|
|
365
|
+
await page.eval(`document.querySelector('#feature-table button[data-prov="stated"]').click()`);
|
|
366
|
+
assert.deepEqual(await page.eval(
|
|
367
|
+
`[...document.querySelectorAll('#feature-table tr.feat-row')].map((r) => r.dataset.id)`), ['booking']);
|
|
368
|
+
} finally { page.close(); }
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
test('the effort-by-container donut shows shares and names the honest gaps', skip, async () => {
|
|
372
|
+
const page = await openPage(buildPage());
|
|
373
|
+
try {
|
|
374
|
+
// one slice per estimated container, hours desc — the excused one never gets a slice
|
|
375
|
+
const slices = await page.eval(`[...document.querySelectorAll('#containers svg .pie-slice')].map((s) => ({
|
|
376
|
+
title: s.querySelector('title').textContent, dash: s.getAttribute('stroke-dasharray') }))`);
|
|
377
|
+
assert.equal(slices.length, 2);
|
|
378
|
+
assert.match(slices[0].title, /Booking API · 69\.33h \(76%\)/);
|
|
379
|
+
assert.match(slices[1].title, /Notification Service · 21\.33h \(24%\)/);
|
|
380
|
+
assert.match(slices[0].dash, /^76(\.\d+)? /, 'slice arc length must be its share');
|
|
381
|
+
const legend = await page.eval(`[...document.querySelectorAll('#containers .pie-legend li')].map((r) =>
|
|
382
|
+
r.textContent.trim().replace(/\\s+/g, ' '))`);
|
|
383
|
+
assert.deepEqual(legend, ['Booking API 69.33h 76%', 'Notification Service 21.33h 24%']);
|
|
384
|
+
// the roster-excused container stays visible as words — an honest gap, not a hidden zero
|
|
385
|
+
const note = await page.eval(`document.querySelector('#containers .pie-note').textContent`);
|
|
386
|
+
assert.match(note, /not estimated/i);
|
|
387
|
+
assert.match(note, /Admin Console/);
|
|
388
|
+
assert.match(note, /out of v1 scope/);
|
|
389
|
+
// hovering a slice lights up its legend row, so a thin slice is still nameable
|
|
390
|
+
const hot = (type) => page.eval(`(() => {
|
|
391
|
+
document.querySelector('#containers .pie-slice[data-ct="notify"]')
|
|
392
|
+
.dispatchEvent(new MouseEvent('${type}', { bubbles: true }));
|
|
393
|
+
return [...document.querySelectorAll('#containers .pie-legend li.hot')].map((r) => r.dataset.ct);
|
|
394
|
+
})()`);
|
|
395
|
+
assert.deepEqual(await hot('mouseover'), ['notify']);
|
|
396
|
+
assert.deepEqual(await hot('mouseout'), []);
|
|
397
|
+
// and the reverse: hovering a legend row lights its slice on the donut
|
|
398
|
+
const hotSlices = (type) => page.eval(`(() => {
|
|
399
|
+
document.querySelector('#containers .pie-legend li[data-ct="api"]')
|
|
400
|
+
.dispatchEvent(new MouseEvent('${type}', { bubbles: true }));
|
|
401
|
+
return [...document.querySelectorAll('#containers .pie-slice.hot')].map((s) => s.dataset.ct);
|
|
402
|
+
})()`);
|
|
403
|
+
assert.deepEqual(await hotSlices('mouseover'), ['api']);
|
|
404
|
+
assert.equal(await page.eval(
|
|
405
|
+
`getComputedStyle(document.querySelector('#containers .pie-slice[data-ct="api"]')).opacity`),
|
|
406
|
+
'0.75', 'the lit slice must read as highlighted');
|
|
407
|
+
assert.deepEqual(await hotSlices('mouseout'), []);
|
|
408
|
+
assert.deepEqual(page.errors, []);
|
|
409
|
+
} finally { page.close(); }
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
test('no roster → the containers section is absent, no placeholder', skip, async () => {
|
|
413
|
+
const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-'));
|
|
414
|
+
const scripts = new URL('..', import.meta.url).pathname;
|
|
415
|
+
const bare = JSON.parse(readFileSync(fixture, 'utf8'));
|
|
416
|
+
delete bare.components;
|
|
417
|
+
for (const f of bare.features) delete f.component;
|
|
418
|
+
writeFileSync(join(dir, 'inputs.json'), JSON.stringify(bare));
|
|
419
|
+
execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', join(dir, 'inputs.json'), '--out', join(dir, 'estimation.json')]);
|
|
420
|
+
execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', join(scripts, 'test/fixtures/estimation-pass.md'), '--out', dir]);
|
|
421
|
+
const page = await openPage(pathToFileURL(join(dir, 'estimate.html')).href);
|
|
422
|
+
try {
|
|
423
|
+
assert.equal(await page.eval(`document.getElementById('containers')`), null);
|
|
424
|
+
// no roster → no segments either; the band falls back to the solid accent fill
|
|
425
|
+
assert.equal(await page.eval(`document.querySelectorAll('#roadmap .roadmap-seg').length`), 0);
|
|
426
|
+
assert.ok(await page.eval(`document.querySelectorAll('#roadmap .roadmap-band').length > 0`));
|
|
427
|
+
// and the breakdown rows carry no container stripes
|
|
428
|
+
assert.equal(await page.eval(`document.querySelectorAll('#feature-table td.ct-edge').length`), 0);
|
|
429
|
+
assert.deepEqual(page.errors, []);
|
|
430
|
+
} finally { page.close(); }
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
test('container select filters rows by container', skip, async () => {
|
|
434
|
+
const page = await openPage(buildPage());
|
|
435
|
+
try {
|
|
436
|
+
// options name containers from the roster — never leaf components, never admin (no rows)
|
|
437
|
+
const options = await page.eval(
|
|
438
|
+
`[...document.querySelectorAll('#feature-table select[data-select="component"] option')].map((o) => o.textContent)`);
|
|
439
|
+
assert.deepEqual(options, ['all containers', 'Booking API', 'Notification Service']);
|
|
440
|
+
// each row's first cell carries its container's stripe on the left edge,
|
|
441
|
+
// named on hover — same palette as the donut
|
|
442
|
+
const stripes = await page.eval(`[...document.querySelectorAll('#feature-table tr.feat-row td.ct-edge')]
|
|
443
|
+
.map((c) => ({ title: c.title, shadow: getComputedStyle(c).boxShadow, inline: c.style.boxShadow }))`);
|
|
444
|
+
assert.deepEqual(stripes.map((s) => s.title), ['Booking API', 'Notification Service']);
|
|
445
|
+
assert.ok(stripes.every((s) => /inset/.test(s.shadow)), 'stripe must be an inset edge, no gap');
|
|
446
|
+
assert.notEqual(stripes[0].shadow, stripes[1].shadow, 'containers must differ in color');
|
|
447
|
+
assert.ok(stripes.every((s) => s.inline === ''),
|
|
448
|
+
'the shadow lives in the ct-edge class — inline style carries only the color variable');
|
|
449
|
+
await page.eval(pickOption('component', 'notify'));
|
|
450
|
+
assert.deepEqual(await page.eval(
|
|
451
|
+
`[...document.querySelectorAll('#feature-table tr.feat-row')].map((r) => r.dataset.id)`), ['reminders']);
|
|
452
|
+
await page.eval(pickOption('component', ''));
|
|
453
|
+
assert.equal(await page.eval(`document.querySelectorAll('#feature-table tr.feat-row').length`), 2);
|
|
454
|
+
// expanded task rows belong to the feature's container — same stripe
|
|
455
|
+
await page.eval(`document.querySelector('#feature-table tr.feat-row .expand').click()`);
|
|
456
|
+
const taskStripe = await page.eval(
|
|
457
|
+
`getComputedStyle(document.querySelector('#feature-table tr.task-row td.ct-edge')).boxShadow`);
|
|
458
|
+
assert.equal(taskStripe, stripes[0].shadow);
|
|
459
|
+
assert.deepEqual(page.errors, []);
|
|
460
|
+
} finally { page.close(); }
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
test('roadmap bands segment by container; clicking a row drives the breakdown', skip, async () => {
|
|
464
|
+
const page = await openPage(buildPage());
|
|
465
|
+
try {
|
|
466
|
+
const segs = await page.eval(`[...document.querySelectorAll('#roadmap .roadmap-row')].map((r) =>
|
|
467
|
+
[...r.querySelectorAll('.roadmap-seg')].map((s) => s.title))`);
|
|
468
|
+
assert.deepEqual(segs, [['Booking API · 69.33h (100%)'], ['Notification Service · 21.33h (100%)']]);
|
|
469
|
+
// a stale container filter would hide the milestone's rows — the click clears it first
|
|
470
|
+
await page.eval(pickOption('component', 'api'));
|
|
471
|
+
await page.eval(`document.querySelector('#roadmap .roadmap-row[data-milestone="M2 - Notifications"]').click()`);
|
|
472
|
+
assert.deepEqual(await page.eval(
|
|
473
|
+
`[...document.querySelectorAll('#feature-table tr.feat-row')].map((r) => r.dataset.id)`), ['reminders']);
|
|
474
|
+
assert.equal(await page.eval(
|
|
475
|
+
`document.querySelector('#feature-table select[data-select="milestone"]').value`), 'M2 - Notifications');
|
|
476
|
+
assert.equal(await page.eval(
|
|
477
|
+
`document.querySelector('#feature-table select[data-select="component"]').value`), '');
|
|
478
|
+
// same row again → the filter clears, every feature returns
|
|
479
|
+
await page.eval(`document.querySelector('#roadmap .roadmap-row[data-milestone="M2 - Notifications"]').click()`);
|
|
480
|
+
assert.equal(await page.eval(`document.querySelectorAll('#feature-table tr.feat-row').length`), 2);
|
|
481
|
+
assert.deepEqual(page.errors, []);
|
|
482
|
+
} finally { page.close(); }
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
// Clicking a roadmap row filters to its milestone AND groups the surviving
|
|
486
|
+
// rows by container, so the stripe colors cluster the way the band's segments
|
|
487
|
+
// do — the roadmap colors and the breakdown colors tell the same story.
|
|
488
|
+
test('a roadmap click groups the breakdown rows by container', skip, async () => {
|
|
489
|
+
const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-'));
|
|
490
|
+
const scripts = new URL('..', import.meta.url).pathname;
|
|
491
|
+
const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
|
|
492
|
+
inputs.features.push({
|
|
493
|
+
id: 'audit', name: 'Booking audit log', provenance: 'proposed',
|
|
494
|
+
component: 'api', milestone: 'M2 - Notifications',
|
|
495
|
+
tasks: [{ id: 'audit-log', name: 'Audit log writes', category: 'boilerplate',
|
|
496
|
+
o: 4, m: 6, p: 10, confidence: 'MED', assumptions: [], provenance: 'proposed' }],
|
|
497
|
+
});
|
|
498
|
+
writeFileSync(join(dir, 'inputs.json'), JSON.stringify(inputs));
|
|
499
|
+
execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', join(dir, 'inputs.json'), '--out', join(dir, 'estimation.json')]);
|
|
500
|
+
execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', join(scripts, 'test/fixtures/estimation-pass.md'), '--out', dir]);
|
|
501
|
+
const page = await openPage(pathToFileURL(join(dir, 'estimate.html')).href);
|
|
502
|
+
try {
|
|
503
|
+
const ids = () => page.eval(
|
|
504
|
+
`[...document.querySelectorAll('#feature-table tr.feat-row')].map((r) => r.dataset.id)`);
|
|
505
|
+
await page.eval(`document.querySelector('#roadmap .roadmap-row[data-milestone="M2 - Notifications"]').click()`);
|
|
506
|
+
// hours desc would put reminders first; container grouping puts the api row first
|
|
507
|
+
assert.deepEqual(await ids(), ['audit', 'reminders']);
|
|
508
|
+
// no header may claim a sort the grouping just overrode
|
|
509
|
+
assert.deepEqual(await page.eval(
|
|
510
|
+
`[...document.querySelectorAll('#feature-table th')].map((t) => t.getAttribute('aria-sort'))`),
|
|
511
|
+
['none', 'none', 'none', 'none', 'none']);
|
|
512
|
+
// an explicit header sort takes control back from the grouping, starting
|
|
513
|
+
// fresh at the column's default direction — not toggling a stale one
|
|
514
|
+
await page.eval(`document.querySelector('#feature-table th button[data-sort="hours"]').click()`);
|
|
515
|
+
assert.deepEqual(await ids(), ['reminders', 'audit']);
|
|
516
|
+
assert.equal(await page.eval(
|
|
517
|
+
`document.querySelector('#feature-table th button[data-sort="hours"]').closest('th').getAttribute('aria-sort')`),
|
|
518
|
+
'descending');
|
|
519
|
+
assert.deepEqual(page.errors, []);
|
|
520
|
+
} finally { page.close(); }
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
test('the container donut and roadmap sit directly above the feature breakdown', skip, async () => {
|
|
524
|
+
const page = await openPage(buildPage());
|
|
525
|
+
try {
|
|
526
|
+
const ids = await page.eval(`[...document.querySelectorAll('main section[id]')].map((s) => s.id)`);
|
|
527
|
+
const [c, r, f] = ['containers', 'roadmap', 'feature-table'].map((id) => ids.indexOf(id));
|
|
528
|
+
assert.ok(c >= 0 && c < r && r + 1 === f, `order wrong: ${ids}`);
|
|
529
|
+
} finally { page.close(); }
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
test('roadmap renders committed bands and ignores the what-if rail', skip, async () => {
|
|
533
|
+
const page = await openPage(buildPage());
|
|
534
|
+
try {
|
|
535
|
+
const labels = await page.eval(
|
|
536
|
+
`[...document.querySelectorAll('#roadmap .roadmap-label')].map((l) => l.textContent)`);
|
|
537
|
+
assert.equal(labels.length, 2);
|
|
538
|
+
assert.match(labels[0], /M1 - Booking core/);
|
|
539
|
+
assert.match(labels[1], /M2 - Notifications/);
|
|
540
|
+
const before = await page.eval(`document.getElementById('roadmap').innerHTML`);
|
|
541
|
+
await page.eval(`(() => {
|
|
542
|
+
const ctl = document.querySelector('#ctl-team .team-row input');
|
|
543
|
+
ctl.value = '90'; ctl.dispatchEvent(new Event('input', { bubbles: true }));
|
|
544
|
+
})()`);
|
|
545
|
+
assert.equal(await page.eval(`document.getElementById('roadmap').innerHTML`), before,
|
|
546
|
+
'roadmap must stay frozen at the committed estimate');
|
|
547
|
+
} finally { page.close(); }
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
// 150px of label column against milestone names that read "M1 - Foundation: the
|
|
551
|
+
// governed write path": every row clips, and a clipped Gantt label names nothing.
|
|
552
|
+
// The row carries the full text as its hover title so the axis stays narrow.
|
|
553
|
+
test('a clipped roadmap label still names its milestone on hover', skip, async () => {
|
|
554
|
+
const page = await openPage(buildPage());
|
|
555
|
+
try {
|
|
556
|
+
const rows = await page.eval(`[...document.querySelectorAll('#roadmap .roadmap-row')].map((r) => ({
|
|
557
|
+
name: r.querySelector('.roadmap-name').textContent,
|
|
558
|
+
nameTitle: r.querySelector('.roadmap-name').title,
|
|
559
|
+
featTitle: r.querySelector('.roadmap-feature-names').title,
|
|
560
|
+
feats: r.querySelector('.roadmap-feature-names').textContent,
|
|
561
|
+
}))`);
|
|
562
|
+
assert.equal(rows.length, 2);
|
|
563
|
+
for (const row of rows) {
|
|
564
|
+
assert.equal(row.nameTitle, row.name, 'milestone name must carry its own full text');
|
|
565
|
+
assert.equal(row.featTitle, row.feats, 'feature list must carry its own full text');
|
|
566
|
+
}
|
|
567
|
+
} finally { page.close(); }
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
// A page that declares no color-scheme is the page a force-dark browser rewrites,
|
|
571
|
+
// and the toggle then flips data-theme with nothing visible changing — the button
|
|
572
|
+
// reads as broken. Declared per theme, forced dark is off and the toggle bites.
|
|
573
|
+
const READ_THEME = `({
|
|
574
|
+
theme: document.documentElement.dataset.theme || null,
|
|
575
|
+
scheme: getComputedStyle(document.documentElement).colorScheme,
|
|
576
|
+
bg: getComputedStyle(document.body).backgroundColor,
|
|
577
|
+
})`;
|
|
578
|
+
|
|
579
|
+
test('the page opens dark, declares its scheme, and the toggle flips both', skip, async () => {
|
|
580
|
+
const page = await openPage(buildPage());
|
|
581
|
+
try {
|
|
582
|
+
const before = await page.eval(READ_THEME);
|
|
583
|
+
assert.equal(before.theme, 'dark');
|
|
584
|
+
assert.equal(before.scheme, 'dark');
|
|
585
|
+
await page.eval(`document.getElementById('theme-toggle').click()`);
|
|
586
|
+
const after = await page.eval(READ_THEME);
|
|
587
|
+
assert.equal(after.theme, 'light');
|
|
588
|
+
assert.equal(after.scheme, 'light');
|
|
589
|
+
assert.notEqual(after.bg, before.bg, 'the first click must change what the reader sees');
|
|
590
|
+
} finally { page.close(); }
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
// The estimate is a document that gets printed and handed over. A dark screen
|
|
594
|
+
// default must not follow it onto paper — that is a full-bleed ink page and grey
|
|
595
|
+
// text on it. The dark palette is scoped to screen so paper keeps the light one.
|
|
596
|
+
test('the dark default stops at the screen — paper stays light', skip, async () => {
|
|
597
|
+
const page = await openPage(buildPage());
|
|
598
|
+
try {
|
|
599
|
+
const screen = await page.eval(READ_THEME);
|
|
600
|
+
await page.send('Emulation.setEmulatedMedia', { media: 'print' });
|
|
601
|
+
const paper = await page.eval(READ_THEME);
|
|
602
|
+
assert.equal(paper.bg, 'rgb(247, 245, 240)');
|
|
603
|
+
assert.notEqual(paper.bg, screen.bg, 'print must not inherit the dark background');
|
|
604
|
+
} finally { page.close(); }
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
test('no milestones → the roadmap section is absent, no placeholder', skip, async () => {
|
|
608
|
+
const dir = mkdtempSync(join(tmpdir(), 'estimate-browser-'));
|
|
609
|
+
const scripts = new URL('..', import.meta.url).pathname;
|
|
610
|
+
const bare = JSON.parse(readFileSync(fixture, 'utf8'));
|
|
611
|
+
for (const f of bare.features) delete f.milestone;
|
|
612
|
+
writeFileSync(join(dir, 'inputs.json'), JSON.stringify(bare));
|
|
613
|
+
const md = readFileSync(join(scripts, 'test/fixtures/estimation-pass.md'), 'utf8')
|
|
614
|
+
.replace(/### Roadmap[\s\S]*?(?=### Assumptions)/, '');
|
|
615
|
+
writeFileSync(join(dir, 'bare.md'), md);
|
|
616
|
+
execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', join(dir, 'inputs.json'), '--out', join(dir, 'estimation.json')]);
|
|
617
|
+
execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', join(dir, 'bare.md'), '--out', dir]);
|
|
618
|
+
const page = await openPage(pathToFileURL(join(dir, 'estimate.html')).href);
|
|
619
|
+
try {
|
|
620
|
+
assert.equal(await page.eval(`document.getElementById('roadmap')`), null);
|
|
621
|
+
assert.deepEqual(page.errors, []);
|
|
622
|
+
} finally { page.close(); }
|
|
623
|
+
});
|