@v11g/agents-rock 1.0.9 → 1.0.10
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 +1 -0
- package/package.json +2 -2
- package/plugins/business-analyst/.claude-plugin/plugin.json +1 -1
- package/plugins/business-analyst/evals/ba-interview-conflict/graders/conflict-quoted.md +15 -0
- package/plugins/business-analyst/evals/ba-interview-conflict/graders/no-internal-ids.md +9 -0
- package/plugins/business-analyst/evals/ba-interview-conflict/graders/one-question.md +15 -0
- package/plugins/business-analyst/evals/ba-interview-conflict/graders/skill-fired.md +7 -0
- package/plugins/business-analyst/evals/ba-interview-conflict/prompt.md +31 -0
- package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-internal-ids.md +9 -0
- package/plugins/business-analyst/evals/ba-interview-first-turn/graders/no-setup-questions.md +16 -0
- package/plugins/business-analyst/evals/ba-interview-first-turn/graders/one-scope-question.md +19 -0
- package/plugins/business-analyst/evals/ba-interview-first-turn/graders/skill-fired.md +7 -0
- package/plugins/business-analyst/evals/ba-interview-first-turn/prompt.md +31 -0
- package/plugins/business-analyst/evals/ba-review-page/case.yaml +4 -0
- package/plugins/business-analyst/evals/ba-review-page/fixture.sh +12 -0
- package/plugins/business-analyst/evals/ba-review-page/graders/decide-in-interview.md +26 -0
- package/plugins/business-analyst/evals/ba-review-page/graders/skill-fired.md +7 -0
- package/plugins/business-analyst/evals/ba-review-page/prompt.md +9 -0
- package/plugins/business-analyst/skills/business-analyst/README.md +8 -0
- package/plugins/business-analyst/skills/business-analyst/SKILL.md +47 -16
- package/plugins/business-analyst/skills/business-analyst/assets/review-page.html +68 -0
- package/plugins/business-analyst/skills/business-analyst/evals/evals.json +1 -1
- package/plugins/business-analyst/skills/business-analyst/references/frameworks.md +3 -2
- package/plugins/business-analyst/skills/business-analyst/references/interview.md +156 -8
- package/plugins/business-analyst/skills/business-analyst/references/review.md +18 -4
- package/plugins/business-analyst/skills/business-analyst/references/writing.md +49 -8
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_data.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_layout.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/review_page.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_checks.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/scope_render.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/__pycache__/validate.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/checks.mjs +12 -6
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-data.mjs +66 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-layout.mjs +53 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/review-page.mjs +78 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-checks.mjs +73 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-md.mjs +53 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-render.mjs +72 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/lib/scope-rules.mjs +90 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/review.mjs +48 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/review.py +60 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/review_data.py +81 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/review_layout.py +50 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/review_page.py +115 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/scope.mjs +24 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/scope.py +35 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/scope_checks.py +168 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/scope_render.py +140 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/checks.test.mjs +27 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.json +78 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/fixtures/requirements-workflow-pass.md +136 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/python-parity.test.mjs +88 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/quality-gates.test.mjs +26 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/review-browser.test.mjs +106 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/review-fixture.mjs +32 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/review-page.test.mjs +340 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/review-parity.test.mjs +79 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-cases.mjs +58 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-checks.test.mjs +31 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/test/scope-md.test.mjs +140 -0
- package/plugins/business-analyst/skills/business-analyst/scripts/validate.mjs +1 -1
- package/plugins/business-analyst/skills/business-analyst/scripts/validate.py +17 -8
- package/plugins/solution-architect/evals/proposal-workflow/case.yaml +6 -0
- package/plugins/solution-architect/evals/proposal-workflow/fixture.sh +6 -0
- package/plugins/solution-architect/evals/proposal-workflow/graders/inputs-written.md +23 -0
- package/plugins/solution-architect/evals/proposal-workflow/graders/no-proposal-md.md +7 -0
- package/plugins/solution-architect/evals/proposal-workflow/graders/skill-fired.md +7 -0
- package/plugins/solution-architect/evals/proposal-workflow/graders/validate-then-render.md +16 -0
- package/plugins/solution-architect/evals/proposal-workflow/prompt.md +10 -0
- package/plugins/solution-architect/evals/workflow-gate-no-architecture/case.yaml +4 -0
- package/plugins/solution-architect/evals/workflow-gate-no-architecture/fixture.sh +6 -0
- package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/no-classic-fallback.md +10 -0
- package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/nothing-written.md +7 -0
- package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/skill-fired.md +7 -0
- package/plugins/solution-architect/evals/workflow-gate-no-architecture/graders/stops-at-gate.md +11 -0
- package/plugins/solution-architect/evals/workflow-gate-no-architecture/prompt.md +7 -0
- package/plugins/solution-architect/evals/workflow-happy-path/case.yaml +4 -0
- package/plugins/solution-architect/evals/workflow-happy-path/fixture.sh +6 -0
- package/plugins/solution-architect/evals/workflow-happy-path/graders/no-estimation-md.md +7 -0
- package/plugins/solution-architect/evals/workflow-happy-path/graders/pages-or-stop.md +16 -0
- package/plugins/solution-architect/evals/workflow-happy-path/graders/routed-to-workflow.md +12 -0
- package/plugins/solution-architect/evals/workflow-happy-path/graders/skill-fired.md +7 -0
- package/plugins/solution-architect/evals/workflow-happy-path/graders/three-questions-max.md +14 -0
- package/plugins/solution-architect/evals/workflow-happy-path/graders/workflow-or-exact-stop.md +15 -0
- package/plugins/solution-architect/evals/workflow-happy-path/prompt.md +9 -0
- package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +11 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +27 -0
- package/plugins/solution-architect/skills/estimate/README.md +18 -3
- package/plugins/solution-architect/skills/estimate/SKILL.md +18 -75
- package/plugins/solution-architect/skills/estimate/classic/FLOW.md +77 -0
- package/plugins/solution-architect/skills/estimate/classic/assets/estimate-template.html +1337 -0
- package/plugins/solution-architect/skills/estimate/{references → classic/references}/task-shapes.md +1 -1
- package/plugins/solution-architect/skills/estimate/{references → classic/references}/writing.md +2 -2
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/compute.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/checks.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/roadmap.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/rollup.mjs +5 -5
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/schema.mjs +4 -26
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-csv.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/score-html.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/render.mjs +8 -7
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/score-review.mjs +3 -3
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/baselines.test.mjs +3 -3
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser-agentic.test.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/browser.test.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/compute.test.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/e2e.test.mjs +6 -6
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/estimate-math.test.mjs +3 -3
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/measurements.test.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/pricing.test.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/project-price.test.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/quality-gates.test.mjs +7 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/references.test.mjs +6 -6
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/render.test.mjs +3 -3
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/schema.test.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/score-review.test.mjs +6 -6
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/scoring.test.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/url-state.test.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/validate.test.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/xlsx-export.test.mjs +3 -3
- package/plugins/solution-architect/skills/estimate/classic/scripts/test/zip-store.test.mjs +26 -0
- package/plugins/solution-architect/skills/estimate/evals/evals.json +37 -2
- package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +28 -0
- package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
- package/plugins/solution-architect/skills/estimate/evals/fixtures/workflow-sin-kowa-mini/requirements.md +141 -0
- package/plugins/solution-architect/skills/estimate/shared/assets/xlsx-export.js +336 -0
- package/plugins/solution-architect/skills/estimate/shared/lib/agentic-task-schema.mjs +24 -0
- package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/context-schema.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/inline.mjs +8 -0
- package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring-schema.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/scoring.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/shared/lib/zip.mjs +60 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/FLOW.md +91 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-components.html +994 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimate-template.html +440 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/assets/estimator-system.xlsx +0 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/assets/score-review.html +838 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/references/hidden-work-by-type.md +429 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/references/linking.md +59 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-components-template.mjs +80 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-template.mjs +60 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-workflow-template.mjs +51 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/build-xlsx-template.py +144 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/compute.mjs +32 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-html.mjs +44 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/page-view.mjs +71 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/pair-findings.mjs +19 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/requirements.mjs +33 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/rollup.mjs +66 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema-components.mjs +69 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/schema.mjs +70 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-diff.mjs +54 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/score-html.mjs +52 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/lib/xlsx-rows.mjs +51 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/render.mjs +42 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/score-review.mjs +46 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/arch-link.js +9 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/click.js +28 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/prelude.js +4 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/template/view.js +63 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/browser.test.mjs +127 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-pages.test.mjs +43 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/build-template.test.mjs +18 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/cli.test.mjs +48 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/estimator-system.test.mjs +66 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/ARCHITECTURE-mini.md +31 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/feedback.json +19 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/inputs-pass.json +80 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/measurements.jsonl +0 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/fixtures/requirements.json +79 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/page-view.test.mjs +54 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/pages-browser.test.mjs +209 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/quality-gates.test.mjs +25 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/render.test.mjs +54 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/requirements.test.mjs +33 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/rollup.test.mjs +80 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/schema.test.mjs +61 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/score-review.test.mjs +108 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/stage.mjs +32 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/workflow-script.test.mjs +24 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/test/xlsx-rows.test.mjs +58 -0
- package/plugins/solution-architect/skills/estimate/workflow-based/scripts/validate.mjs +19 -0
- package/plugins/solution-architect/skills/proposal/README.md +13 -0
- package/plugins/solution-architect/skills/proposal/SKILL.md +8 -0
- package/plugins/solution-architect/skills/proposal/assets/proposal-workflow.html +143 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/ARCHITECTURE.md +31 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation-inputs.json +468 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/estimation.json +773 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/measurements.jsonl +0 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/workflow-sin-kowa-mini/requirements.json +79 -0
- package/plugins/solution-architect/skills/proposal/references/review.md +11 -0
- package/plugins/solution-architect/skills/proposal/references/workflow.md +88 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/docx-body.mjs +42 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/docx-package.mjs +56 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/docx-xml.mjs +44 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-checks.mjs +71 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-cli.mjs +46 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-html.mjs +39 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-lead.mjs +45 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-page.mjs +30 -0
- package/plugins/solution-architect/skills/proposal/scripts/lib/workflow-view.mjs +80 -0
- package/plugins/solution-architect/skills/proposal/scripts/render.mjs +5 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/docx.test.mjs +68 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +2 -2
- package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +9 -2
- package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-inputs-pass.json +17 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +2 -2
- package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +2 -2
- package/plugins/solution-architect/skills/proposal/scripts/test/workflow-browser.test.mjs +96 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/workflow-checks.test.mjs +98 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/workflow-docs.test.mjs +25 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/workflow-render.test.mjs +75 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/workflow-stage.mjs +15 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/workflow-view.test.mjs +78 -0
- package/plugins/solution-architect/skills/proposal/scripts/validate.mjs +4 -1
- package/plugins/solution-architect/workflows/review-links.js +61 -0
- package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +0 -1677
- /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/estimate-template-agentic.html +0 -0
- /package/plugins/solution-architect/skills/estimate/{assets → classic/assets}/scores-review-template.html +0 -0
- /package/plugins/solution-architect/skills/estimate/{references → classic/references}/agentic-estimation.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{references → classic/references}/ai-multipliers.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{references → classic/references}/interview.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{references → classic/references}/scoring-guide.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{references → classic/references}/slicing.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{references → classic/references}/techniques.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/agentic-checks.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/components.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/md-tables.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/redact.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/lib/scoring-checks.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-fail.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-estimation-pass.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/agentic-inputs.json +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/booking-inputs.json +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-fail.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/estimation-pass.md +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/fixtures/measurements.jsonl +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/test/zip.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → classic/scripts}/validate.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/baselines.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/estimate-math.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/measurements.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/pricing.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/project-price.mjs +0 -0
- /package/plugins/solution-architect/skills/estimate/{scripts → shared}/lib/score-diff.mjs +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Page data for the workflow proposal: the BA package's systems, workflows
|
|
2
|
+
// and features, the estimate's milestones, register and price, and the
|
|
3
|
+
// agent's sentences from proposal-inputs.json. The HTML and the DOCX both
|
|
4
|
+
// print this one object, so the two can never disagree. No ID, score,
|
|
5
|
+
// component or per-milestone price goes in (spec 4 P5).
|
|
6
|
+
import { milestoneView, registerView } from '../../../estimate/workflow-based/scripts/lib/page-view.mjs';
|
|
7
|
+
import { formatMoney } from './figures.mjs';
|
|
8
|
+
|
|
9
|
+
const list = (xs) => (xs.length > 1 ? `${xs.slice(0, -1).join(', ')} and ${xs[xs.length - 1]}` : xs[0] ?? '');
|
|
10
|
+
const longDate = (iso) => new Date(`${iso}T00:00:00Z`).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' });
|
|
11
|
+
const slug = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
12
|
+
const label = (s) => s.replaceAll('"', "'");
|
|
13
|
+
|
|
14
|
+
// Mermaid source for one workflow: the steps in a row, each branch dashed
|
|
15
|
+
// with its label.
|
|
16
|
+
export function flowCode(w) {
|
|
17
|
+
const ids = new Map();
|
|
18
|
+
const id = (name) => ids.get(name) ?? ids.set(name, `n${ids.size}`).get(name);
|
|
19
|
+
const lines = ['flowchart LR'];
|
|
20
|
+
w.steps.forEach((step, i) => { if (i) lines.push(` ${id(w.steps[i - 1])} --> ${id(step)}`); });
|
|
21
|
+
for (const b of w.branches) lines.push(` ${id(b.from)} -.->${b.label ? `|"${label(b.label)}"|` : ''} ${id(b.to)}`);
|
|
22
|
+
for (const [name, n] of ids) lines.push(` ${n}["${label(name)}"]`);
|
|
23
|
+
return lines.join('\n');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function flowsOf(system, req) {
|
|
27
|
+
return (system.workflows ?? []).map((wid, i) => {
|
|
28
|
+
const w = req.workflows[wid];
|
|
29
|
+
const flow = { steps: w.steps ?? [], branches: w.branches ?? [] };
|
|
30
|
+
return { label: `${i ? 'Sub-workflow' : 'Main workflow'} · ${w.name}`, code: flowCode(flow), steps: flow.steps.join(' → ') };
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function systemView(system, i, { req, inputs }) {
|
|
35
|
+
return {
|
|
36
|
+
anchor: `system-${i + 1}`, no: i + 1, name: system.name, purpose: system.purpose ?? '', extra: inputs.systems?.[system.id] ?? '',
|
|
37
|
+
flows: flowsOf(system, req),
|
|
38
|
+
features: (system.features ?? []).map((fid) => ({ name: req.features[fid].name, does: req.features[fid].does ?? '' })),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function scopeView({ req, inputs }) {
|
|
43
|
+
const out = req.raw.scope?.out ?? [];
|
|
44
|
+
return {
|
|
45
|
+
intro: inputs.scopeIntro, mapLabel: req.mapLabel,
|
|
46
|
+
systems: req.systems.map((s) => ({ name: s.name, map: s.map ?? '' })),
|
|
47
|
+
outLine: out.length
|
|
48
|
+
? `Explicitly excluded: ${list(out)}. Every assumption and exclusion is listed at the end of this proposal.`
|
|
49
|
+
: 'The assumptions and exclusions this proposal rests on are listed at the end.',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function milestonesView(est, inputs) {
|
|
54
|
+
const rows = milestoneView(est).map((m, i) => ({
|
|
55
|
+
title: `${i + 1}. ${inputs.milestones[m.name].name}`,
|
|
56
|
+
includes: list(m.features.map((f) => f.name)), demonstrates: inputs.milestones[m.name].demonstrates,
|
|
57
|
+
}));
|
|
58
|
+
return { lead: `The ${est.inputs.features.length} features sequence into ${rows.length} milestones; each one ends with something working you can see.`, rows };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function costView(est) {
|
|
62
|
+
const { price } = est.computed;
|
|
63
|
+
return {
|
|
64
|
+
lead: `The estimate scores the work behind all ${est.inputs.features.length} features above and rolls it up into a project range, including design, testing, project management and contingency.`,
|
|
65
|
+
range: `${formatMoney(price.presentLow)} – ${formatMoney(price.presentHigh)}`, rangeNote: 'expected cost to worst realistic case, USD',
|
|
66
|
+
single: formatMoney(price.singleNumber), singleNote: 'confident figure: 80% chance the project comes in at or under',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function proposalView({ est, req, inputs }) {
|
|
71
|
+
return {
|
|
72
|
+
client: inputs.client, title: `${inputs.title} — Systems & Workflows Proposal`, byline: `${longDate(inputs.date)} · ${inputs.firm}`,
|
|
73
|
+
file: `${slug(inputs.client)}-proposal.docx`,
|
|
74
|
+
scope: scopeView({ req, inputs }),
|
|
75
|
+
systems: req.systems.map((s, i) => systemView(s, i, { req, inputs })),
|
|
76
|
+
milestones: milestonesView(est, inputs),
|
|
77
|
+
register: { lead: 'These carry over from the estimate, so the price and the scope never drift apart.', ...registerView(est, req) },
|
|
78
|
+
cost: costView(est),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -5,6 +5,8 @@ import { buildFontFaces } from '../../analyze-requirements/scripts/lib/fonts.mjs
|
|
|
5
5
|
import { renderMarkdown, escapeHtml } from '../../analyze-requirements/scripts/lib/md-render.mjs';
|
|
6
6
|
import { parseFrontmatter } from '../../analyze-requirements/scripts/lib/frontmatter.mjs';
|
|
7
7
|
import { checkProposal } from './lib/checks.mjs';
|
|
8
|
+
import { isWorkflow } from './lib/workflow-lead.mjs';
|
|
9
|
+
import { renderWorkflow } from './lib/workflow-cli.mjs';
|
|
8
10
|
|
|
9
11
|
function parseArgs(argv) {
|
|
10
12
|
const args = {};
|
|
@@ -18,8 +20,10 @@ const archFontsDir = new URL('../../analyze-requirements/assets/fonts/', import.
|
|
|
18
20
|
const templatePath = new URL('../assets/proposal-template.html', import.meta.url).pathname;
|
|
19
21
|
|
|
20
22
|
const args = parseArgs(process.argv.slice(2));
|
|
21
|
-
const md = readFileSync(args.md, 'utf8');
|
|
22
23
|
const estimation = JSON.parse(readFileSync(args.estimation, 'utf8'));
|
|
24
|
+
// A workflow-mode estimate gets the Systems & Workflows page (spec 4); no proposal.md.
|
|
25
|
+
if (isWorkflow(estimation)) process.exit(renderWorkflow(args));
|
|
26
|
+
const md = readFileSync(args.md, 'utf8');
|
|
23
27
|
|
|
24
28
|
// Validation blocks rendering — same hard rule as the estimate skill,
|
|
25
29
|
// enforced in code with no skip flag.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
4
|
+
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { loadLead } from '../lib/workflow-lead.mjs';
|
|
8
|
+
import { proposalView } from '../lib/workflow-view.mjs';
|
|
9
|
+
import { buildDocx } from '../lib/docx-package.mjs';
|
|
10
|
+
import { readZip } from '../../../estimate/classic/scripts/test/zip.mjs';
|
|
11
|
+
import { lead, passInputs } from './workflow-stage.mjs';
|
|
12
|
+
|
|
13
|
+
const { est, req } = loadLead(lead().estimation);
|
|
14
|
+
const view = proposalView({ est, req, inputs: passInputs() });
|
|
15
|
+
// A real 1x1 PNG, standing in for a drawn diagram.
|
|
16
|
+
const PNG = Uint8Array.from(Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==', 'base64'));
|
|
17
|
+
const drawn = { bytes: PNG, width: 1200, height: 300 };
|
|
18
|
+
// Three workflows in page order; the second one was not drawn.
|
|
19
|
+
const docx = () => readZip(Buffer.from(buildDocx(view, [drawn, null, drawn])));
|
|
20
|
+
const count = (xml, re) => (xml.match(re) ?? []).length;
|
|
21
|
+
|
|
22
|
+
test('the package has every part Word needs, and one PNG per drawn workflow', () => {
|
|
23
|
+
const files = docx();
|
|
24
|
+
assert.deepEqual([...files.keys()], ['[Content_Types].xml', '_rels/.rels', 'word/document.xml', 'word/_rels/document.xml.rels',
|
|
25
|
+
'word/styles.xml', 'word/numbering.xml', 'word/media/image1.png', 'word/media/image3.png']);
|
|
26
|
+
const rels = files.get('word/_rels/document.xml.rels').toString('utf8');
|
|
27
|
+
assert.match(rels, /Id="rIdImg1"[^>]*Target="media\/image1\.png"/);
|
|
28
|
+
assert.doesNotMatch(rels, /rIdImg2/);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('document.xml follows the page: headings, tables, lists, in order', () => {
|
|
32
|
+
const xml = docx().get('word/document.xml').toString('utf8');
|
|
33
|
+
assert.equal(count(xml, /<w:pStyle w:val="Heading1"\/>/g), 6); // scope, 2 systems, milestones, register, cost
|
|
34
|
+
assert.equal(count(xml, /<w:tbl>/g), 5); // scope, 2 feature tables, milestones, cost
|
|
35
|
+
assert.equal(count(xml, /<w:numId w:val="1"\/>/g), 4); // 2 assumptions + 2 exclusions
|
|
36
|
+
const order = ['Scope: what this proposal covers', 'System 1: Warehouse operations', 'System 2: Orders & invoicing', 'Milestones', 'Cost estimate'];
|
|
37
|
+
const at = order.map((h) => xml.indexOf(`<w:t xml:space="preserve">${h}</w:t>`));
|
|
38
|
+
assert.ok(at.every((x, i) => x > 0 && (i === 0 || x > at[i - 1])), JSON.stringify(at));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('drawn workflows become images; an undrawn one falls back to its steps', () => {
|
|
42
|
+
const xml = docx().get('word/document.xml').toString('utf8');
|
|
43
|
+
assert.deepEqual([...xml.matchAll(/r:embed="(\w+)"/g)].map((m) => m[1]), ['rIdImg1', 'rIdImg3']);
|
|
44
|
+
assert.match(xml, /Order received → Quote → Invoice → Paid/);
|
|
45
|
+
const [, cx] = /<wp:extent cx="(\d+)"/.exec(xml);
|
|
46
|
+
assert.equal(Number(cx), 9638 * 635); // 1200 px is wider than the page: scaled to the text width
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('the price, no IDs, no undefined, and text is escaped', () => {
|
|
50
|
+
const xml = docx().get('word/document.xml').toString('utf8');
|
|
51
|
+
assert.match(xml, /\$39,000 – \$48,500/);
|
|
52
|
+
assert.doesNotMatch(xml, /undefined|\b(?:FEAT|FR|SYS|WF|ASM)-\d|M\d - /);
|
|
53
|
+
const v = structuredClone(view);
|
|
54
|
+
v.systems[0].features[0].name = 'A <b> & "c"\u0007';
|
|
55
|
+
const odd = readZip(Buffer.from(buildDocx(v, [null, null, null]))).get('word/document.xml').toString('utf8');
|
|
56
|
+
assert.match(odd, /A <b> & "c"<\/w:t>/);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const soffice = spawnSync('soffice', ['--version']).status === 0;
|
|
60
|
+
test('LibreOffice opens the file and reads the text back', { skip: soffice ? false : 'no soffice on PATH' }, () => {
|
|
61
|
+
const dir = mkdtempSync(join(tmpdir(), 'proposal-docx-'));
|
|
62
|
+
writeFileSync(join(dir, 'p.docx'), buildDocx(view, [drawn, null, drawn]));
|
|
63
|
+
execFileSync('soffice', ['--headless', `-env:UserInstallation=file://${dir}/lo`, '--convert-to', 'txt:Text', '--outdir', dir, join(dir, 'p.docx')], { stdio: 'ignore' });
|
|
64
|
+
const text = readFileSync(join(dir, 'p.txt'), 'utf8');
|
|
65
|
+
for (const s of ['Systems & Workflows Proposal', 'System 2: Orders & invoicing', 'Short-pack alert', 'Invoice from the floor', '$39,000 – $48,500']) {
|
|
66
|
+
assert.ok(text.includes(s), s);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
@@ -10,8 +10,8 @@ const script = (p) => new URL(p, import.meta.url).pathname;
|
|
|
10
10
|
test('compute → derive → validate → render runs clean end to end', () => {
|
|
11
11
|
const dir = mkdtempSync(join(tmpdir(), 'proposal-e2e-'));
|
|
12
12
|
const json = join(dir, 'estimation.json');
|
|
13
|
-
execFileSync('node', [script('../../../estimate/scripts/compute.mjs'),
|
|
14
|
-
'--inputs', script('../../../estimate/scripts/test/fixtures/booking-inputs.json'), '--out', json]);
|
|
13
|
+
execFileSync('node', [script('../../../estimate/classic/scripts/compute.mjs'),
|
|
14
|
+
'--inputs', script('../../../estimate/classic/scripts/test/fixtures/booking-inputs.json'), '--out', json]);
|
|
15
15
|
execFileSync('node', [script('../derive.mjs'),
|
|
16
16
|
'--estimation', json, '--out', join(dir, 'proposal-figures.json')]);
|
|
17
17
|
execFileSync('node', [script('../validate.mjs'),
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { test } from 'node:test';
|
|
6
6
|
import assert from 'node:assert/strict';
|
|
7
7
|
import { readFileSync } from 'node:fs';
|
|
8
|
-
import { checkInputs } from '../../../estimate/scripts/lib/schema.mjs';
|
|
9
|
-
import { computeEstimation } from '../../../estimate/scripts/lib/rollup.mjs';
|
|
8
|
+
import { checkInputs } from '../../../estimate/classic/scripts/lib/schema.mjs';
|
|
9
|
+
import { computeEstimation } from '../../../estimate/classic/scripts/lib/rollup.mjs';
|
|
10
10
|
import { deriveFigures } from '../lib/figures.mjs';
|
|
11
11
|
|
|
12
12
|
const evalsDir = new URL('../../evals/', import.meta.url);
|
|
@@ -37,3 +37,10 @@ test('the unpriced fixture really is unpriced, so the proposal refuses it', () =
|
|
|
37
37
|
assert.deepEqual(computeEstimation(stored.inputs).computed, stored.computed);
|
|
38
38
|
assert.throws(() => deriveFigures(stored), /not priced/);
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
test('the workflow fixture lead validates as the proposal will load it', async () => {
|
|
42
|
+
const { loadLead } = await import('../lib/workflow-lead.mjs');
|
|
43
|
+
const lead = loadLead(new URL('fixtures/workflow-sin-kowa-mini/estimation.json', evalsDir).pathname);
|
|
44
|
+
assert.deepEqual(lead.findings, []);
|
|
45
|
+
assert.equal(lead.est.inputs.scopeMode, 'workflow');
|
|
46
|
+
});
|
package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-inputs-pass.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"client": "Sin Kowa",
|
|
3
|
+
"title": "Sin Kowa Digital Transformation",
|
|
4
|
+
"firm": "Code Engine Studio",
|
|
5
|
+
"date": "2026-10-07",
|
|
6
|
+
"techLevel": "non-tech",
|
|
7
|
+
"jargonAllow": [],
|
|
8
|
+
"scopeIntro": "This proposal covers two systems for Phase 1: warehouse operations, and orders and invoicing. Each is described below by its workflows and the features that serve them.",
|
|
9
|
+
"systems": {
|
|
10
|
+
"SYS-002": "It closes the paper delivery-order gap that delays cash collection by weeks."
|
|
11
|
+
},
|
|
12
|
+
"milestones": {
|
|
13
|
+
"M1 - Walking skeleton": { "name": "Digitise core records", "demonstrates": "Orders move through each stage on screen instead of on paper." },
|
|
14
|
+
"M2 - Money": { "name": "Connect the workflow", "demonstrates": "Short-packs are flagged as they happen, and each person sees only their own work." },
|
|
15
|
+
"M3 - Operations": { "name": "Invoice from the floor", "demonstrates": "Invoices are raised from what was actually packed." }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -7,8 +7,8 @@ import { join } from 'node:path';
|
|
|
7
7
|
|
|
8
8
|
const tpl = () => readFileSync(new URL('../../assets/proposal-template.html', import.meta.url), 'utf8');
|
|
9
9
|
const cli = new URL('../render.mjs', import.meta.url).pathname;
|
|
10
|
-
const computeCli = new URL('../../../estimate/scripts/compute.mjs', import.meta.url).pathname;
|
|
11
|
-
const inputs = new URL('../../../estimate/scripts/test/fixtures/booking-inputs.json', import.meta.url).pathname;
|
|
10
|
+
const computeCli = new URL('../../../estimate/classic/scripts/compute.mjs', import.meta.url).pathname;
|
|
11
|
+
const inputs = new URL('../../../estimate/classic/scripts/test/fixtures/booking-inputs.json', import.meta.url).pathname;
|
|
12
12
|
const passMd = new URL('./fixtures/proposal-pass.md', import.meta.url).pathname;
|
|
13
13
|
const failMd = new URL('./fixtures/proposal-fail.md', import.meta.url).pathname;
|
|
14
14
|
|
|
@@ -6,8 +6,8 @@ import { tmpdir } from 'node:os';
|
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
|
|
8
8
|
const cli = new URL('../validate.mjs', import.meta.url).pathname;
|
|
9
|
-
const computeCli = new URL('../../../estimate/scripts/compute.mjs', import.meta.url).pathname;
|
|
10
|
-
const inputs = new URL('../../../estimate/scripts/test/fixtures/booking-inputs.json', import.meta.url).pathname;
|
|
9
|
+
const computeCli = new URL('../../../estimate/classic/scripts/compute.mjs', import.meta.url).pathname;
|
|
10
|
+
const inputs = new URL('../../../estimate/classic/scripts/test/fixtures/booking-inputs.json', import.meta.url).pathname;
|
|
11
11
|
const passMd = new URL('./fixtures/proposal-pass.md', import.meta.url).pathname;
|
|
12
12
|
const failMd = new URL('./fixtures/proposal-fail.md', import.meta.url).pathname;
|
|
13
13
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { writeFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { pathToFileURL } from 'node:url';
|
|
7
|
+
import { findChrome } from '../../../analyze-requirements/scripts/lib/chrome.mjs';
|
|
8
|
+
import { openPage } from '../../../analyze-requirements/scripts/lib/cdp.mjs';
|
|
9
|
+
import { readZip } from '../../../estimate/classic/scripts/test/zip.mjs';
|
|
10
|
+
import { noFlowsAt } from '../../../estimate/workflow-based/scripts/test/stage.mjs';
|
|
11
|
+
import { lead } from './workflow-stage.mjs';
|
|
12
|
+
|
|
13
|
+
const skip = findChrome() ? false : 'no chrome on PATH';
|
|
14
|
+
const settle = () => new Promise((r) => setTimeout(r, 1500));
|
|
15
|
+
// Draws a small SVG into each diagram, as mermaid would, so the PNG path runs for real.
|
|
16
|
+
const DRAWING_STUB = 'globalThis.mermaid={initialize(){},async run({querySelector}){for(const el of document.querySelectorAll(querySelector)){'
|
|
17
|
+
+ 'el.innerHTML=\'<svg xmlns="http://www.w3.org/2000/svg" width="300" height="80" viewBox="0 0 300 80"><rect x="5" y="5" width="120" height="40" fill="#eee" stroke="#333"/><text x="20" y="30">Step</text></svg>\';}}};';
|
|
18
|
+
|
|
19
|
+
// Fails the second diagram as real mermaid does: an error drawing in its
|
|
20
|
+
// place unless suppressErrorRendering is set, then run() rejects.
|
|
21
|
+
const FAILING_STUB = 'globalThis.mermaid={cfg:{},initialize(c){this.cfg=c;},async run({querySelector}){let err;'
|
|
22
|
+
+ '[...document.querySelectorAll(querySelector)].forEach((el,i)=>{if(i===1){err=new Error("Syntax error in text");'
|
|
23
|
+
+ 'if(!this.cfg.suppressErrorRendering)el.innerHTML=\'<svg xmlns="http://www.w3.org/2000/svg" aria-roledescription="error" width="300" height="80"><text x="10" y="40">Syntax error</text></svg>\';return;}'
|
|
24
|
+
+ 'el.innerHTML=\'<svg xmlns="http://www.w3.org/2000/svg" width="300" height="80" viewBox="0 0 300 80"><rect x="5" y="5" width="120" height="40" fill="#eee"/></svg>\';});if(err)throw err;}};';
|
|
25
|
+
|
|
26
|
+
function proposalUrl(stub = DRAWING_STUB, edit = null) {
|
|
27
|
+
const l = lead();
|
|
28
|
+
if (edit) edit(l.dir);
|
|
29
|
+
const bundle = join(l.dir, 'mermaid.js');
|
|
30
|
+
writeFileSync(bundle, stub);
|
|
31
|
+
execFileSync('node', [new URL('../render.mjs', import.meta.url).pathname, '--estimation', l.estimation, '--inputs', l.inputs,
|
|
32
|
+
'--mermaid-bundle', bundle, '--out', join(l.dir, 'dist')]);
|
|
33
|
+
return pathToFileURL(join(l.dir, 'dist', 'proposal.html')).href;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
test('the page renders every section with no console errors', { skip }, async () => {
|
|
37
|
+
const page = await openPage(proposalUrl());
|
|
38
|
+
try {
|
|
39
|
+
await settle();
|
|
40
|
+
assert.deepEqual(page.errors, []);
|
|
41
|
+
assert.equal(await page.eval('document.querySelectorAll("nav a").length'), 6);
|
|
42
|
+
assert.equal(await page.eval('document.querySelectorAll(".mermaid-canvas svg").length'), 3);
|
|
43
|
+
assert.match(await page.eval('document.getElementById("cost").textContent'), /\$39,000 – \$48,500/);
|
|
44
|
+
} finally { await page.close(); }
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('Download DOCX builds a Word file with one PNG per diagram and well-formed XML', { skip }, async () => {
|
|
48
|
+
const page = await openPage(proposalUrl());
|
|
49
|
+
try {
|
|
50
|
+
await settle();
|
|
51
|
+
const files = readZip(Buffer.from(await page.eval('window.__buildDocx()'), 'base64'));
|
|
52
|
+
const pngs = [...files.keys()].filter((k) => k.startsWith('word/media/'));
|
|
53
|
+
assert.deepEqual(pngs, ['word/media/image1.png', 'word/media/image2.png', 'word/media/image3.png']);
|
|
54
|
+
assert.equal(files.get('word/media/image1.png').subarray(1, 4).toString('latin1'), 'PNG');
|
|
55
|
+
for (const part of ['word/document.xml', 'word/styles.xml', 'word/numbering.xml', '[Content_Types].xml']) {
|
|
56
|
+
const xml = JSON.stringify(files.get(part).toString('utf8'));
|
|
57
|
+
const broken = await page.eval(`new DOMParser().parseFromString(${xml}, 'application/xml').getElementsByTagName('parsererror').length`);
|
|
58
|
+
assert.equal(broken, 0, part);
|
|
59
|
+
}
|
|
60
|
+
} finally { await page.close(); }
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('the print layout hides the menu and both buttons', { skip }, async () => {
|
|
64
|
+
const page = await openPage(proposalUrl());
|
|
65
|
+
try {
|
|
66
|
+
await page.send('Emulation.setEmulatedMedia', { media: 'print' });
|
|
67
|
+
assert.equal(await page.eval('getComputedStyle(document.querySelector(".tools")).display'), 'none');
|
|
68
|
+
assert.equal(await page.eval('getComputedStyle(document.querySelector("nav")).display'), 'none');
|
|
69
|
+
assert.equal(await page.eval('getComputedStyle(document.getElementById("system-2")).breakBefore'), 'page');
|
|
70
|
+
} finally { await page.close(); }
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('a diagram that fails to draw shows its steps on the page and in the DOCX, never an error picture', { skip }, async () => {
|
|
74
|
+
const page = await openPage(proposalUrl(FAILING_STUB));
|
|
75
|
+
try {
|
|
76
|
+
await settle();
|
|
77
|
+
assert.deepEqual(page.errors, []);
|
|
78
|
+
const steps = await page.eval('JSON.parse(document.getElementById("proposal-data").textContent).systems.flatMap((s) => s.flows)[1].steps');
|
|
79
|
+
assert.equal(await page.eval('document.querySelectorAll(".mermaid-canvas")[1].querySelector("svg") === null'), true);
|
|
80
|
+
assert.equal(await page.eval('document.querySelectorAll(".mermaid-canvas")[1].textContent'), steps);
|
|
81
|
+
const files = readZip(Buffer.from(await page.eval('window.__buildDocx()'), 'base64'));
|
|
82
|
+
assert.deepEqual([...files.keys()].filter((k) => k.startsWith('word/media/')), ['word/media/image1.png', 'word/media/image3.png']);
|
|
83
|
+
assert.ok(files.get('word/document.xml').toString('utf8').includes(steps.replaceAll('&', '&')));
|
|
84
|
+
} finally { await page.close(); }
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('a system with no workflow: one diagram fewer on the page and in the DOCX, no errors', { skip }, async () => {
|
|
88
|
+
const page = await openPage(proposalUrl(DRAWING_STUB, noFlowsAt));
|
|
89
|
+
try {
|
|
90
|
+
await settle();
|
|
91
|
+
assert.deepEqual(page.errors, []);
|
|
92
|
+
assert.equal(await page.eval('document.querySelectorAll(".mermaid-canvas svg").length'), 1);
|
|
93
|
+
const files = readZip(Buffer.from(await page.eval('window.__buildDocx()'), 'base64'));
|
|
94
|
+
assert.deepEqual([...files.keys()].filter((k) => k.startsWith('word/media/')), ['word/media/image1.png']);
|
|
95
|
+
} finally { await page.close(); }
|
|
96
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { readFileSync, writeFileSync, unlinkSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { loadLead, proposalFindings, isWorkflow } from '../lib/workflow-lead.mjs';
|
|
6
|
+
import { checkProposalInputs } from '../lib/workflow-checks.mjs';
|
|
7
|
+
import { lead, passInputs } from './workflow-stage.mjs';
|
|
8
|
+
|
|
9
|
+
const staged = lead();
|
|
10
|
+
const { est, req } = loadLead(staged.estimation);
|
|
11
|
+
const check = (edit) => { const inputs = passInputs(); edit(inputs); return checkProposalInputs({ inputs, est, req }); };
|
|
12
|
+
|
|
13
|
+
test('the sin-kowa-mini lead and its sentences pass', () => {
|
|
14
|
+
assert.equal(isWorkflow(est), true);
|
|
15
|
+
assert.deepEqual(proposalFindings(staged).findings, []);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('W1: client, title, firm, scope intro, ISO date and tech level are required', () => {
|
|
19
|
+
const out = check((i) => { delete i.firm; i.scopeIntro = ' '; i.date = '7 Oct 2026'; i.techLevel = 'expert'; });
|
|
20
|
+
assert.deepEqual(out, [
|
|
21
|
+
'proposal-inputs.json: missing "firm"',
|
|
22
|
+
'proposal-inputs.json: missing "scopeIntro"',
|
|
23
|
+
'proposal-inputs.json: "date" must be an ISO date (YYYY-MM-DD)',
|
|
24
|
+
'proposal-inputs.json: "techLevel" must be non-tech | low-tech | technical',
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('W2: every milestone the features use needs a name and what it demonstrates; no unknown keys', () => {
|
|
29
|
+
const out = check((i) => {
|
|
30
|
+
delete i.milestones['M2 - Money'].demonstrates;
|
|
31
|
+
i.milestones['M9 - Later'] = { name: 'x', demonstrates: 'y' };
|
|
32
|
+
i.systems['SYS-404'] = 'nothing';
|
|
33
|
+
i.systems['SYS-001'] = '';
|
|
34
|
+
});
|
|
35
|
+
assert.deepEqual(out, [
|
|
36
|
+
'milestone "M2 - Money": needs a client "name" and "demonstrates"',
|
|
37
|
+
'milestones: "M9 - Later" is not a milestone of this estimate',
|
|
38
|
+
'systems: "SYS-404" is not a system in requirements.json',
|
|
39
|
+
'systems: "SYS-001" needs a sentence or no entry',
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('W3: a price written in a sentence is refused, in any common spelling', () => {
|
|
44
|
+
for (const said of ['$40k', 'USD 5,000', 'SGD150,000', '5,000 dollars', '12k SGD', '€300']) {
|
|
45
|
+
const out = check((i) => { i.scopeIntro = `Phase 1 costs about ${said} in total.`; });
|
|
46
|
+
assert.equal(out.length, 1, said);
|
|
47
|
+
assert.match(out[0], /^scopeIntro: price ".+" — prices come only from the estimate$/, said);
|
|
48
|
+
}
|
|
49
|
+
assert.deepEqual(check((i) => { i.scopeIntro = 'It covers 2 systems and 5 features in 3 milestones.'; }), []);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('W3: lowercase, regional and spelled-out prices are refused too', () => {
|
|
53
|
+
for (const said of ['5000 usd', 'usd 5,000', '5,000 Dollars', 'RM 20,000', 'MYR 20,000', 'HKD 10k', 'JPY 300000',
|
|
54
|
+
'VND 500,000,000', '¥300,000', '₹50,000', '1.2 million USD', '40 thousand dollars']) {
|
|
55
|
+
const out = check((i) => { i.scopeIntro = `Phase 1 costs about ${said} in total.`; });
|
|
56
|
+
assert.equal(out.length, 1, said);
|
|
57
|
+
assert.match(out[0], /^scopeIntro: price ".+" — prices come only from the estimate$/, said);
|
|
58
|
+
}
|
|
59
|
+
assert.deepEqual(check((i) => { i.scopeIntro = 'In 2 months, 3 teams cover 5 features over 2026.'; }), []);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('W3/W4: the title is the page heading, so it is held to the sentence rules', () => {
|
|
63
|
+
const out = check((i) => { i.title = 'Sin Kowa FEAT-001 for $40k'; });
|
|
64
|
+
assert.deepEqual(out, ['title: price "$40k" — prices come only from the estimate', 'title: internal ID "FEAT-001" — name the thing in words']);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('W4: an engineer milestone name in a sentence is refused (P6)', () => {
|
|
68
|
+
const out = check((i) => { i.scopeIntro = 'After M1 - Walking skeleton the team moves on.'; });
|
|
69
|
+
assert.deepEqual(out, ['scopeIntro: internal ID "M1 - " — name the thing in words']);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('W4: an internal ID in a sentence is refused', () => {
|
|
73
|
+
const out = check((i) => { i.milestones['M1 - Walking skeleton'].demonstrates = 'FEAT-001 works end to end.'; });
|
|
74
|
+
assert.deepEqual(out, ['milestones.M1 - Walking skeleton.demonstrates: internal ID "FEAT-001" — name the thing in words']);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('W5: jargon is refused for a non-tech client, allowed when listed or for a technical one', () => {
|
|
78
|
+
const said = (i) => { i.systems['SYS-002'] = 'A backend checks every order.'; };
|
|
79
|
+
assert.deepEqual(check(said), ['systems.SYS-002: jargon for a non-tech client: "backend" (rewrite plainly or add to jargonAllow)']);
|
|
80
|
+
assert.deepEqual(check((i) => { said(i); i.jargonAllow = ['Backend']; }), []);
|
|
81
|
+
assert.deepEqual(check((i) => { said(i); i.techLevel = 'technical'; }), []);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('W6: a stale estimate, a missing BA package or bad inputs JSON stop before the sentences', () => {
|
|
85
|
+
const stale = lead();
|
|
86
|
+
const e = JSON.parse(readFileSync(stale.estimation, 'utf8'));
|
|
87
|
+
e.computed.features['FEAT-001'].point += 1;
|
|
88
|
+
writeFileSync(stale.estimation, JSON.stringify(e));
|
|
89
|
+
assert.match(proposalFindings(stale).findings.join('\n'), /computed block differs/);
|
|
90
|
+
const noReq = lead();
|
|
91
|
+
unlinkSync(join(noReq.dir, 'requirements.json'));
|
|
92
|
+
assert.match(proposalFindings(noReq).findings[0], /^requirements\.json not found/);
|
|
93
|
+
const bad = lead();
|
|
94
|
+
writeFileSync(bad.inputs, '{ “client”: "Sin Kowa" }');
|
|
95
|
+
const { findings } = proposalFindings(bad);
|
|
96
|
+
assert.equal(findings.length, 1);
|
|
97
|
+
assert.match(findings[0], /^proposal-inputs\.json: /);
|
|
98
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const doc = (p) => readFileSync(new URL(`../../${p}`, import.meta.url), 'utf8');
|
|
6
|
+
|
|
7
|
+
test('SKILL.md routes a workflow estimate to references/workflow.md', () => {
|
|
8
|
+
const skill = doc('SKILL.md');
|
|
9
|
+
assert.match(skill, /scopeMode` is `"workflow"` → follow\s+`references\/workflow\.md`/);
|
|
10
|
+
assert.ok(skill.includes('proposal-inputs.json'));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('workflow.md carries the inputs contract, both commands and the hand-over', () => {
|
|
14
|
+
const d = doc('references/workflow.md');
|
|
15
|
+
for (const needle of ['proposal-inputs.json', 'scripts/validate.mjs --estimation', '--inputs', 'scripts/render.mjs --estimation',
|
|
16
|
+
'--mermaid-bundle', 'Download PDF', 'Download DOCX', 'USD', 'jargonAllow', 'techLevel', 'demonstrates', 'no proposal.md']) {
|
|
17
|
+
assert.ok(d.includes(needle), `workflow.md missing: ${needle}`);
|
|
18
|
+
}
|
|
19
|
+
assert.doesNotMatch(d, /\bTBD\b|\bTODO\b/);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('review.md has a workflow charter that reads the rendered page', () => {
|
|
23
|
+
const d = doc('references/review.md');
|
|
24
|
+
assert.match(d, /## Workflow mode[\s\S]*dist\/proposal\.html/);
|
|
25
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { lead } from './workflow-stage.mjs';
|
|
7
|
+
|
|
8
|
+
const cli = (name) => new URL(`../${name}.mjs`, import.meta.url).pathname;
|
|
9
|
+
const tpl = () => readFileSync(new URL('../../assets/proposal-workflow.html', import.meta.url), 'utf8');
|
|
10
|
+
const STUB_BUNDLE = 'globalThis.mermaid={initialize(){},run(){return Promise.resolve();}};';
|
|
11
|
+
|
|
12
|
+
function render(l, bundleText = STUB_BUNDLE) {
|
|
13
|
+
const bundle = join(l.dir, 'mermaid.js');
|
|
14
|
+
writeFileSync(bundle, bundleText);
|
|
15
|
+
return spawnSync('node', [cli('render'), '--estimation', l.estimation, '--inputs', l.inputs, '--mermaid-bundle', bundle, '--out', join(l.dir, 'dist')], { encoding: 'utf8' });
|
|
16
|
+
}
|
|
17
|
+
const page = (l) => readFileSync(join(l.dir, 'dist', 'proposal.html'), 'utf8');
|
|
18
|
+
|
|
19
|
+
test('template carries exactly its seven slots, both buttons, a print layout and no external URL', () => {
|
|
20
|
+
const markers = [...new Set([...tpl().matchAll(/<!-- slot:(\w+) -->/g)].map((m) => m[1]))].sort();
|
|
21
|
+
assert.deepEqual(markers, ['CONTENT', 'DATA', 'DOCX', 'FONTS', 'MERMAID_BUNDLE', 'NAV', 'TITLE']);
|
|
22
|
+
assert.match(tpl(), /id="pdf"[^>]*>Download PDF</);
|
|
23
|
+
assert.match(tpl(), /id="docx"[^>]*>Download DOCX</);
|
|
24
|
+
assert.match(tpl(), /@media print[\s\S]*\.tools[\s\S]*break-before: page/);
|
|
25
|
+
assert.doesNotMatch(tpl(), /https?:\/\/(?!www\.w3\.org)/);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('validate routes a workflow estimate to the inputs checks', () => {
|
|
29
|
+
const ok = lead();
|
|
30
|
+
const r = spawnSync('node', [cli('validate'), '--estimation', ok.estimation, '--inputs', ok.inputs], { encoding: 'utf8' });
|
|
31
|
+
assert.equal(r.status, 0, r.stderr);
|
|
32
|
+
assert.match(r.stdout, /proposal inputs valid/);
|
|
33
|
+
const noInputs = spawnSync('node', [cli('validate'), '--estimation', ok.estimation], { encoding: 'utf8' });
|
|
34
|
+
assert.equal(noInputs.status, 1);
|
|
35
|
+
assert.match(noInputs.stderr, /^usage: validate\.mjs --estimation estimation\.json --inputs proposal-inputs\.json/);
|
|
36
|
+
const bad = lead((i) => { i.scopeIntro = 'About $40k.'; });
|
|
37
|
+
const r2 = spawnSync('node', [cli('validate'), '--estimation', bad.estimation, '--inputs', bad.inputs], { encoding: 'utf8' });
|
|
38
|
+
assert.equal(r2.status, 1);
|
|
39
|
+
assert.match(r2.stderr, /scopeIntro: price "\$40k"/);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('render writes a self-contained proposal.html with the page data and the DOCX writer', () => {
|
|
43
|
+
const l = lead();
|
|
44
|
+
const r = render(l);
|
|
45
|
+
assert.equal(r.status, 0, r.stderr);
|
|
46
|
+
const html = page(l);
|
|
47
|
+
assert.doesNotMatch(html, /<!-- slot:/);
|
|
48
|
+
assert.doesNotMatch(html, /<(link|script|img)[^>]+(href|src)="https?:/);
|
|
49
|
+
assert.match(html, /<title>Proposal — Sin Kowa<\/title>/);
|
|
50
|
+
assert.match(html, /<h1>Sin Kowa Digital Transformation — Systems & Workflows Proposal<\/h1>/);
|
|
51
|
+
assert.match(html, /function zipStore\(/);
|
|
52
|
+
assert.match(html, /function buildDocx\(/);
|
|
53
|
+
assert.doesNotMatch(html, /^\s*(?:export|import) /m);
|
|
54
|
+
const data = JSON.parse(/<script type="application\/json" id="proposal-data">([\s\S]*?)<\/script>/.exec(html)[1]);
|
|
55
|
+
assert.equal(data.cost.range, '$39,000 – $48,500');
|
|
56
|
+
assert.equal(data.systems.length, 2);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('a name cannot close the data script tag', () => {
|
|
60
|
+
const l = lead((i) => { i.scopeIntro = 'Ends here </script><script>alert(1)</script>'; });
|
|
61
|
+
assert.equal(render(l).status, 0);
|
|
62
|
+
const html = page(l);
|
|
63
|
+
assert.equal((html.match(/<script>alert/g) ?? []).length, 0);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('render refuses on a finding, or a bundle with a script terminator, and writes nothing', () => {
|
|
67
|
+
const bad = lead((i) => { delete i.milestones['M3 - Operations']; });
|
|
68
|
+
const r = render(bad);
|
|
69
|
+
assert.equal(r.status, 1);
|
|
70
|
+
assert.match(r.stderr, /milestone "M3 - Operations": needs a client "name" and "demonstrates"/);
|
|
71
|
+
assert.equal(existsSync(join(bad.dir, 'dist', 'proposal.html')), false);
|
|
72
|
+
const l = lead();
|
|
73
|
+
assert.equal(render(l, 'var x = "</script>";').status, 1);
|
|
74
|
+
assert.equal(existsSync(join(l.dir, 'dist', 'proposal.html')), false);
|
|
75
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// A computed sin-kowa-mini lead (the estimate's own workflow test lead) plus
|
|
2
|
+
// the proposal's sentences, in a temp folder.
|
|
3
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { staged } from '../../../estimate/workflow-based/scripts/test/stage.mjs';
|
|
6
|
+
|
|
7
|
+
export const passInputs = () => JSON.parse(readFileSync(new URL('./fixtures/proposal-inputs-pass.json', import.meta.url), 'utf8'));
|
|
8
|
+
|
|
9
|
+
export function lead(edit) {
|
|
10
|
+
const dir = staged();
|
|
11
|
+
const inputs = passInputs();
|
|
12
|
+
if (edit) edit(inputs);
|
|
13
|
+
writeFileSync(join(dir, 'proposal-inputs.json'), JSON.stringify(inputs));
|
|
14
|
+
return { dir, estimation: join(dir, 'estimation.json'), inputs: join(dir, 'proposal-inputs.json') };
|
|
15
|
+
}
|