@v11g/agents-rock 1.0.9 → 1.0.11
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 +3 -1
- package/package.json +2 -2
- package/plugins/business-analyst/.claude-plugin/plugin.json +2 -2
- 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/evals/draft-scope-rich/case.yaml +4 -0
- package/plugins/business-analyst/evals/draft-scope-rich/fixture.sh +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/conflict-question.md +11 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/keep-and-exclude.md +14 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/noise-and-shape.md +13 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/problem-not-solution.md +13 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/share-kept.md +11 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/skill-fired.md +7 -0
- package/plugins/business-analyst/evals/draft-scope-rich/graders/vague-word.md +13 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/C1.txt +10 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/E1.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/E2.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/inputs/E3.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-rich/prompt.md +9 -0
- package/plugins/business-analyst/evals/draft-scope-thin/case.yaml +4 -0
- package/plugins/business-analyst/evals/draft-scope-thin/fixture.sh +4 -0
- package/plugins/business-analyst/evals/draft-scope-thin/graders/no-invention.md +18 -0
- package/plugins/business-analyst/evals/draft-scope-thin/graders/skill-fired.md +7 -0
- package/plugins/business-analyst/evals/draft-scope-thin/inputs/E1.txt +5 -0
- package/plugins/business-analyst/evals/draft-scope-thin/prompt.md +8 -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/business-analyst/skills/draft-scope/SKILL.md +46 -0
- package/plugins/business-analyst/skills/draft-scope/references/credits.md +12 -0
- package/plugins/business-analyst/skills/draft-scope/references/draft-schema.md +44 -0
- package/plugins/business-analyst/skills/draft-scope/references/rules.md +24 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-312.pyc +0 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/build_docx.py +36 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/check.py +53 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_body.py +58 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_flow.py +52 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_package.py +62 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/docx_xml.py +44 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/draft_quotes.py +49 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/draft_rules.py +106 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/draft_schema.py +87 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/build-docx.test.mjs +76 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/check-rules.test.mjs +131 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/check-shape.test.mjs +70 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/draft-pass.json +40 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/C1.txt +7 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/fixtures/sources/E1.txt +5 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/gates.test.mjs +39 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/helpers.mjs +30 -0
- package/plugins/business-analyst/skills/draft-scope/scripts/test/skill-files.test.mjs +59 -0
- package/plugins/business-analyst/skills/draft-scope/steps/assumptions.md +24 -0
- package/plugins/business-analyst/skills/draft-scope/steps/check.md +24 -0
- package/plugins/business-analyst/skills/draft-scope/steps/discover.md +53 -0
- package/plugins/business-analyst/skills/draft-scope/steps/draft.md +64 -0
- package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
- 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/SKILL.md +8 -7
- package/plugins/solution-architect/skills/analyze-requirements/assets/section-help.json +5 -5
- package/plugins/solution-architect/skills/analyze-requirements/assets/viewer-template.html +26 -4
- package/plugins/solution-architect/skills/analyze-requirements/evals/evals.json +50 -6
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.json +31 -0
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/ba-package-citations/requirements.md +17 -0
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/C1-kickoff-call.txt +16 -0
- package/plugins/solution-architect/skills/analyze-requirements/evals/fixtures/transcript-citations/E1-intro-email.md +9 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/extract.md +108 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/interview.md +39 -5
- package/plugins/solution-architect/skills/analyze-requirements/references/project-types.md +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/references/quality-goals.md +84 -0
- package/plugins/solution-architect/skills/analyze-requirements/references/research.md +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/references/rewriting.md +7 -2
- package/plugins/solution-architect/skills/analyze-requirements/references/viewer.md +10 -6
- package/plugins/solution-architect/skills/analyze-requirements/references/writing.md +45 -3
- package/plugins/solution-architect/skills/analyze-requirements/scripts/ba-facts.mjs +32 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/check-quotes.mjs +39 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/ba-package.mjs +75 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-links.mjs +19 -7
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/doc-routes.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/inputs.mjs +42 -11
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/md-render.mjs +15 -4
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/section-help.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/strategy-sections.mjs +30 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs +14 -2
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-quotes.mjs +55 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-strategy.mjs +65 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/render.mjs +18 -5
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-facts-cli.test.mjs +55 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package-cli.test.mjs +101 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-package.test.mjs +115 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/browser.test.mjs +77 -2
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/check-quotes-cli.test.mjs +49 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/doc-links.test.mjs +49 -4
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/extract-workflow.test.mjs +69 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/inputs.test.mjs +14 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/md-render.test.mjs +19 -5
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/record-cli.test.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/render.test.mjs +69 -2
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rewriting.test.mjs +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/section-help.test.mjs +6 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-provenance.test.mjs +19 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes-cli.test.mjs +58 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-quotes.test.mjs +81 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy-cli.test.mjs +32 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/validate-strategy.test.mjs +118 -0
- package/plugins/solution-architect/skills/analyze-requirements/scripts/validate.mjs +17 -6
- package/plugins/solution-architect/skills/analyze-requirements/workflows/extract.js +51 -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,32 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { isPackage, baRows, isStated } from './lib/ba-package.mjs';
|
|
3
|
+
|
|
4
|
+
// Reads a business-analyst requirements.json into facts, split by the BA's
|
|
5
|
+
// label: `facts` may be cited `stated`, `proposed` never is
|
|
6
|
+
// (references/extract.md §2.2). No agent reads the package.
|
|
7
|
+
|
|
8
|
+
function parseArgs(argv) {
|
|
9
|
+
const args = {};
|
|
10
|
+
for (let i = 0; i < argv.length; i += 2) args[argv[i].slice(2)] = argv[i + 1];
|
|
11
|
+
return args;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function readPackage(path) {
|
|
15
|
+
try { return JSON.parse(readFileSync(path, 'utf8')); } catch { return null; }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const args = parseArgs(process.argv.slice(2));
|
|
19
|
+
if (!args.json || !args.out) {
|
|
20
|
+
console.log('FAIL usage: ba-facts.mjs --json <requirements.json> --out <file>');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
const pkg = readPackage(args.json);
|
|
24
|
+
if (!isPackage(pkg)) {
|
|
25
|
+
console.log(`FAIL ${args.json} is not a requirements package`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const rows = baRows(pkg).map((r) => ({ ...r, path: args.json }));
|
|
29
|
+
const facts = rows.filter(isStated);
|
|
30
|
+
const proposed = rows.filter((r) => !isStated(r));
|
|
31
|
+
writeFileSync(args.out, JSON.stringify({ facts, proposed }, null, 2));
|
|
32
|
+
console.log(`ok ${facts.length} confirmed facts, ${proposed.length} not confirmed (assumed or recommended)`);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { normalize, closestSentence } from './lib/validate-quotes.mjs';
|
|
3
|
+
|
|
4
|
+
// Gate between extraction and the interview (references/extract.md): a fact
|
|
5
|
+
// whose quote is not in its file never reaches the main agent as `stated`.
|
|
6
|
+
// Misses go back to their extract agent once; what still misses is dropped.
|
|
7
|
+
|
|
8
|
+
function parseArgs(argv) {
|
|
9
|
+
const args = {};
|
|
10
|
+
for (let i = 0; i < argv.length; i += 2) args[argv[i].slice(2)] = argv[i + 1];
|
|
11
|
+
return args;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function readSource(path, cache) {
|
|
15
|
+
if (!cache.has(path)) {
|
|
16
|
+
try { cache.set(path, readFileSync(path, 'utf8')); } catch { cache.set(path, null); }
|
|
17
|
+
}
|
|
18
|
+
return cache.get(path);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function missOf(fact, cache) {
|
|
22
|
+
if (!normalize(fact.quote ?? '')) return { ...fact, closest: 'empty quote' };
|
|
23
|
+
const text = readSource(fact.path, cache);
|
|
24
|
+
if (text === null) return { ...fact, closest: `file not readable: ${fact.path}` };
|
|
25
|
+
if (normalize(text).includes(normalize(fact.quote))) return null;
|
|
26
|
+
return { ...fact, closest: closestSentence(text, fact.quote) };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const args = parseArgs(process.argv.slice(2));
|
|
30
|
+
const { facts } = JSON.parse(readFileSync(args.facts, 'utf8'));
|
|
31
|
+
const cache = new Map();
|
|
32
|
+
const checked = facts.map((f) => ({ fact: f, miss: missOf(f, cache) }));
|
|
33
|
+
const kept = checked.filter((c) => !c.miss).map((c) => c.fact);
|
|
34
|
+
const misses = checked.filter((c) => c.miss).map((c) => c.miss);
|
|
35
|
+
|
|
36
|
+
for (const m of misses) console.log(`MISS [${m.src}] "${m.quote}" — closest: "${m.closest}"`);
|
|
37
|
+
console.log(`ok ${kept.length} quotes verified, ${misses.length} missed`);
|
|
38
|
+
writeFileSync(args.out, JSON.stringify({ facts: kept, misses }, null, 2));
|
|
39
|
+
process.exit(misses.length ? 1 : 0);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// A business-analyst package (requirements.json) arrives already sourced:
|
|
2
|
+
// each row has an id, a label and where it came from. A script reads it, so
|
|
3
|
+
// no extract agent and no quote matching: the id is the anchor. Only a row
|
|
4
|
+
// the BA confirmed may become `stated` (references/extract.md §2.2).
|
|
5
|
+
const SECTIONS = {
|
|
6
|
+
requirements: 'goals and scope',
|
|
7
|
+
systems: 'goals and scope',
|
|
8
|
+
features: 'goals and scope',
|
|
9
|
+
businessRules: 'goals and scope',
|
|
10
|
+
constraints: 'constraints',
|
|
11
|
+
nfrs: 'quality',
|
|
12
|
+
integrations: 'external systems and integrations',
|
|
13
|
+
data: 'data and its sensitivity',
|
|
14
|
+
};
|
|
15
|
+
const FACT = {
|
|
16
|
+
integrations: (r) => `${r.system} (${r.direction})`,
|
|
17
|
+
data: (r) => [r.entity, r.sensitivity, r.volume].filter(Boolean).join(', '),
|
|
18
|
+
};
|
|
19
|
+
const textOf = (r) => r.text ?? r.rule ?? r.purpose ?? r.name ?? '';
|
|
20
|
+
|
|
21
|
+
export function isPackage(value) {
|
|
22
|
+
return Boolean(value && value.schemaVersion && Array.isArray(value.requirements));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Constraints and business rules carry a source but no label: the BA records
|
|
26
|
+
// them only once confirmed (business-analyst references/writing.md).
|
|
27
|
+
function rowOf(row, key, updated) {
|
|
28
|
+
const label = row.label ?? (row.source ? 'confirmed' : 'unlabelled');
|
|
29
|
+
const fact = (FACT[key] ?? textOf)(row);
|
|
30
|
+
const source = row.source ?? null;
|
|
31
|
+
return { id: row.id, fact, label, source, section: SECTIONS[key], cite: `${row.id} · ${source ?? updated}` };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function baRows(pkg) {
|
|
35
|
+
return Object.keys(SECTIONS).flatMap((key) => (Array.isArray(pkg[key]) ? pkg[key] : [])
|
|
36
|
+
.filter((row) => row && typeof row === 'object')
|
|
37
|
+
.map((row) => rowOf(row, key, pkg.updated))
|
|
38
|
+
.filter((r) => r.id));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function isStated(row) {
|
|
42
|
+
return row.label === 'confirmed';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The text a quote may match: confirmed rows only, never assumed or recommended.
|
|
46
|
+
export function statedText(rows) {
|
|
47
|
+
return rows.filter(isStated).map((r) => r.fact).join('\n');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// packages maps root-relative path → baRows. A citation's label starts with
|
|
51
|
+
// the row id (`FR-001 · kickoff call`); any quote it carries is checked by
|
|
52
|
+
// validate-quotes against the package's row texts, not here.
|
|
53
|
+
// The pair rule (D22): when requirements.json sits beside requirements.md, the
|
|
54
|
+
// .md is for people and is never cited.
|
|
55
|
+
function pairRule(c, packages) {
|
|
56
|
+
const json = c.path.replace(/(^|\/)requirements\.md$/, '$1requirements.json');
|
|
57
|
+
if (json === c.path || !packages.has(json)) return null;
|
|
58
|
+
return [{ check: 'quotes', message: `${c.path} is the BA package for people; cite ${json} by row id` }];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function validateBaCitations({ citations, packages }) {
|
|
62
|
+
const paired = citations.flatMap((c) => pairRule(c, packages) ?? []);
|
|
63
|
+
return [...paired, ...citedRows({ citations, packages })];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function citedRows({ citations, packages }) {
|
|
67
|
+
return citations.filter((c) => packages.has(c.path)).flatMap((c) => {
|
|
68
|
+
const id = c.label.split('·')[0].trim();
|
|
69
|
+
const row = packages.get(c.path).find((r) => r.id === id);
|
|
70
|
+
if (!row) return [{ check: 'quotes', message: `${id} is not in ${c.path}` }];
|
|
71
|
+
if (!isStated(row)) return [{ check: 'quotes', message: `${id} is ${row.label} in ${c.path}; only confirmed rows are stated` }];
|
|
72
|
+
if (c.label.trim() === row.cite) return [];
|
|
73
|
+
return [{ check: 'quotes', message: `${c.label.trim()} does not match ${c.path}; cite it as ${row.cite}` }];
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -11,16 +11,28 @@ import { dirname, resolve } from 'node:path';
|
|
|
11
11
|
const HREF = /<a href="([^"#]*)(#[^"]*)?">([\s\S]*?)<\/a>/g;
|
|
12
12
|
const ABSOLUTE = /^([a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
13
13
|
|
|
14
|
+
// idByPath maps a document's absolute path to its id, and `<path>#<slug>` to the
|
|
15
|
+
// id that heading carries (prefixed by its document, D18). Authors write a
|
|
16
|
+
// fragment against the target's own headings (#q3) — or, with no path, against
|
|
17
|
+
// their own — so the fragment is looked up, never trusted.
|
|
14
18
|
export function rewriteDocLinks(html, fromPath, idByPath) {
|
|
15
19
|
const dir = dirname(fromPath);
|
|
16
20
|
return html.replace(HREF, (whole, path, fragment, label) => {
|
|
17
|
-
//
|
|
18
|
-
if (
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const id = idByPath.get(
|
|
23
|
-
if (id) return
|
|
21
|
+
// A scheme or // means it leaves the page.
|
|
22
|
+
if (ABSOLUTE.test(path)) return whole;
|
|
23
|
+
// No path: a heading in this same document; anything else keeps its id.
|
|
24
|
+
if (!path) return linkTo(idByPath.get(fromPath + fragment), label) ?? whole;
|
|
25
|
+
const target = resolve(dir, path);
|
|
26
|
+
const id = idByPath.get(target);
|
|
27
|
+
if (id) return linkTo(idByPath.get(target + (fragment ?? '')) || id, label);
|
|
24
28
|
return `<span class="ext-ref" title="${path}${fragment ?? ''}">${label}</span>`;
|
|
25
29
|
});
|
|
26
30
|
}
|
|
31
|
+
|
|
32
|
+
function linkTo(id, label) {
|
|
33
|
+
return id ? `<a href="#${id}">${label}</a>` : null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function anchorIds({ path, headings }) {
|
|
37
|
+
return headings.map((h) => [`${path}#${h.local}`, h.slug]);
|
|
38
|
+
}
|
|
@@ -7,7 +7,7 @@ import { nextSlug } from './slug-registry.mjs';
|
|
|
7
7
|
// reworded, a filename is the thing every other document already links to.
|
|
8
8
|
// A section's index page takes the section slug instead, so #/decision-records
|
|
9
9
|
// lands on the list rather than on a file called index.
|
|
10
|
-
function fileSlug(path) {
|
|
10
|
+
export function fileSlug(path) {
|
|
11
11
|
return slugOf(basename(path ?? '', extname(path ?? '')));
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1,26 +1,55 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { relative } from 'node:path';
|
|
2
|
+
import { dirname, join, relative } from 'node:path';
|
|
3
3
|
import { parseFrontmatter } from './frontmatter.mjs';
|
|
4
4
|
import { parseTables } from './md-tables.mjs';
|
|
5
5
|
import { extractLinks } from './md-links.mjs';
|
|
6
6
|
import { erEntities } from './er-entities.mjs';
|
|
7
7
|
import { extractModel } from './likec4-extract.mjs';
|
|
8
8
|
import { nextSlug } from './slug-registry.mjs';
|
|
9
|
+
import { parseCitations } from './validate-quotes.mjs';
|
|
10
|
+
import { isPackage, baRows, statedText } from './ba-package.mjs';
|
|
9
11
|
|
|
10
|
-
export async function buildInputs({ root, archPath, modelPath, docPaths = [] }) {
|
|
12
|
+
export async function buildInputs({ root, archPath, modelPath, docPaths = [], inputPaths = [] }) {
|
|
11
13
|
const arch = await readFile(archPath, 'utf8');
|
|
12
14
|
const docs = await readDocs(root, [archPath, ...docPaths]);
|
|
15
|
+
const sources = await readDocs(root, inputPaths);
|
|
16
|
+
const packages = packagesOf(sources);
|
|
13
17
|
return {
|
|
18
|
+
archMd: arch,
|
|
14
19
|
frontmatter: parseFrontmatter(arch).data ?? {},
|
|
15
20
|
tables: parseTables(arch),
|
|
16
21
|
erNames: erEntities(arch),
|
|
17
22
|
model: extractModel(JSON.parse(await readFile(modelPath, 'utf8'))),
|
|
18
23
|
links: docs.flatMap((d) => extractLinks(d.md).map((l) => ({ fromDoc: d.path, href: l.href }))),
|
|
19
|
-
files: docs.map((d) => d.path),
|
|
24
|
+
files: [...docs, ...sources].map((d) => d.path),
|
|
20
25
|
anchors: Object.fromEntries(docs.map((d) => [d.path, headingSlugs(d.md)])),
|
|
26
|
+
sources: new Map(sources.map((d) => [d.path, packages.has(d.path)
|
|
27
|
+
? statedText(packages.get(d.path)) : d.md])),
|
|
28
|
+
packages,
|
|
29
|
+
citations: citationsOf(root, archPath, arch),
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
32
|
|
|
33
|
+
// Citations are written relative to ARCHITECTURE.md; sources are keyed
|
|
34
|
+
// relative to the root. Same frame as validate-links, or a nested set fails.
|
|
35
|
+
function citationsOf(root, archPath, md) {
|
|
36
|
+
return parseCitations(md).map((c) => ({ ...c, path: relative(root, join(dirname(archPath), c.path)) }));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// A requirements.json is cited by row id (ba-package.mjs). Its row texts stand
|
|
40
|
+
// in for its source text, so a quote or Brief says from a row still matches.
|
|
41
|
+
// A .json that is not a BA package stays plain text.
|
|
42
|
+
function packagesOf(docs) {
|
|
43
|
+
return new Map(docs.filter((d) => d.path.endsWith('.json'))
|
|
44
|
+
.map((d) => [d.path, parseJson(d.md)])
|
|
45
|
+
.filter(([, pkg]) => isPackage(pkg))
|
|
46
|
+
.map(([path, pkg]) => [path, baRows(pkg)]));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function parseJson(text) {
|
|
50
|
+
try { return JSON.parse(text); } catch { return null; }
|
|
51
|
+
}
|
|
52
|
+
|
|
24
53
|
async function readDocs(root, paths) {
|
|
25
54
|
return Promise.all(paths.map(async (p) => ({
|
|
26
55
|
path: relative(root, p),
|
|
@@ -28,14 +57,16 @@ async function readDocs(root, paths) {
|
|
|
28
57
|
})));
|
|
29
58
|
}
|
|
30
59
|
|
|
31
|
-
// Mirrors md-render.mjs
|
|
32
|
-
// with
|
|
33
|
-
//
|
|
34
|
-
// cross-doc dedupe is a viewer-side concern (D6, out of scope).
|
|
60
|
+
// Mirrors md-render.mjs: frontmatter stripped, fenced code skipped, only h2/h3,
|
|
61
|
+
// deduped per document with the shared -N rule (slug-registry.mjs). These are
|
|
62
|
+
// the `local` slugs the renderer keys its anchors on (doc-links.mjs anchorIds).
|
|
35
63
|
function headingSlugs(md) {
|
|
36
64
|
const registry = new Map();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
.
|
|
65
|
+
let fenced = false;
|
|
66
|
+
return md.replace(/^---\n[\s\S]*?\n---\n?/, '').split('\n').flatMap((l) => {
|
|
67
|
+
// Opens on any ``` line, closes only on a bare one — as md-render does.
|
|
68
|
+
if (fenced ? l.trim() === '```' : l.trim().startsWith('```')) fenced = !fenced;
|
|
69
|
+
const m = !fenced && l.match(/^(#{2,3})\s+(.*)$/);
|
|
70
|
+
return m ? [nextSlug(m[2].trim(), registry)] : [];
|
|
71
|
+
});
|
|
41
72
|
}
|
|
@@ -9,10 +9,14 @@ import { readFlowGroup } from './md-flows.mjs';
|
|
|
9
9
|
|
|
10
10
|
export { escapeHtml };
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// `slugs` dedupes h2/h3 within one document; `prefix` names that document, so an
|
|
13
|
+
// id is unique across the whole set by construction (0007-cache__context). The
|
|
14
|
+
// separator is `__` because slugify never emits `_`, so a prefixed id cannot
|
|
15
|
+
// collide with a bare one.
|
|
16
|
+
export function renderMarkdown(md, { slugs = new Map(), docSlugs = new Map(), prefix = '' } = {}) {
|
|
13
17
|
const ctx = {
|
|
14
18
|
lines: md.replace(/^---\n[\s\S]*?\n---\n?/, '').split('\n'),
|
|
15
|
-
i: 0, html: [], headings: [], slugs, docSlugs, title: null, docId: null,
|
|
19
|
+
i: 0, html: [], headings: [], slugs, docSlugs, prefix, title: null, docId: null,
|
|
16
20
|
};
|
|
17
21
|
while (ctx.i < ctx.lines.length) dispatch(ctx);
|
|
18
22
|
return {
|
|
@@ -56,9 +60,16 @@ function renderHeading(ctx) {
|
|
|
56
60
|
ctx.html.push(`<h${level}>${inline(text)}</h${level}>`);
|
|
57
61
|
return;
|
|
58
62
|
}
|
|
59
|
-
const slug =
|
|
63
|
+
const { slug, local } = headingId(ctx, text);
|
|
60
64
|
ctx.html.push(`<h${level} id="${slug}">${inline(text)}</h${level}>`);
|
|
61
|
-
ctx.headings.push({ level, text, slug });
|
|
65
|
+
ctx.headings.push({ level, text, slug, local });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// `local` is what an author writes after `#` inside the document and what the
|
|
69
|
+
// link validator knows; `slug` is the id the page carries.
|
|
70
|
+
function headingId(ctx, text) {
|
|
71
|
+
const local = nextSlug(text, ctx.slugs);
|
|
72
|
+
return { local, slug: ctx.prefix ? `${ctx.prefix}__${local}` : local };
|
|
62
73
|
}
|
|
63
74
|
|
|
64
75
|
function renderFence(ctx) {
|
|
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
|
|
|
2
2
|
|
|
3
3
|
// The lookup keys on heading text rather than on a slug for two reasons: slugify
|
|
4
4
|
// keeps both spaces around a stripped "&", so "Goals & Scope" becomes
|
|
5
|
-
// goals--scope; and h2/h3 ids
|
|
5
|
+
// goals--scope; and h2/h3 ids in one document share a dedupe registry, so an h3 named Security
|
|
6
6
|
// under Crosscutting Concepts would take `security` and demote §12's h2 to
|
|
7
7
|
// security-2.
|
|
8
8
|
//
|
package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/strategy-sections.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { parseTables } from './md-tables.mjs';
|
|
2
|
+
|
|
3
|
+
// `^## ` never matches `### `, so a subheading stays inside its section.
|
|
4
|
+
export function sectionBody(md, title) {
|
|
5
|
+
const chunk = md.split(/^## /m).find((c) => title.test(c.split('\n')[0]));
|
|
6
|
+
return chunk ? chunk.slice(chunk.indexOf('\n') + 1) : '';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Tables anywhere in the `## ` section, subheadings included. The table
|
|
10
|
+
// holding `column` wins; otherwise the first table, so a legacy shape is
|
|
11
|
+
// still seen.
|
|
12
|
+
export function sectionTable(md, title, column) {
|
|
13
|
+
const tables = parseTables(sectionBody(md, title));
|
|
14
|
+
const has = (t) => t.headers.some((h) => column.test(h));
|
|
15
|
+
return tables.find(has) ?? tables[0];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const GIVES_WAY = /\(gives way first\)/i;
|
|
19
|
+
const NOT_PROVIDED = /^Not provided/i;
|
|
20
|
+
|
|
21
|
+
// Cells compare without markdown emphasis, so **Speed** matches Speed.
|
|
22
|
+
const plain = (cell) => cell.replace(/[*_]/g, '');
|
|
23
|
+
export const isGivesWay = (cell) => GIVES_WAY.test(plain(cell));
|
|
24
|
+
export const isNotProvided = (cell) => NOT_PROVIDED.test(plain(cell));
|
|
25
|
+
export const nameOf = (cell) => plain(cell).replace(GIVES_WAY, '').trim().toLowerCase();
|
|
26
|
+
|
|
27
|
+
export function goalCells(t) {
|
|
28
|
+
const col = (t?.headers ?? []).findIndex((h) => /^goal$/i.test(h));
|
|
29
|
+
return col === -1 ? null : t.rows.map((r) => r[col] ?? '');
|
|
30
|
+
}
|
package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-provenance.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const ALLOWED = ['observed', 'stated', 'researched', 'proposed'];
|
|
2
2
|
const EXEMPT = ['Decisions', 'Glossary'];
|
|
3
|
+
const CITED = /\[[^\]]+\]\([^)\s]+\)/;
|
|
3
4
|
|
|
4
5
|
export function validateProvenance({ tables }) {
|
|
5
6
|
const findings = [];
|
|
@@ -15,6 +16,17 @@ function checkTable(t) {
|
|
|
15
16
|
if (col === -1) {
|
|
16
17
|
return [{ check: 'provenance', message: `table in "${t.section}" has no src column` }];
|
|
17
18
|
}
|
|
18
|
-
return t.rows.
|
|
19
|
-
|
|
19
|
+
return t.rows.flatMap((r) => checkCell(t.section, r[0], r[col] ?? ''));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Bare `stated` only warns: every set written before citations existed has it
|
|
23
|
+
// in every table, and failing them all would block every re-render at once.
|
|
24
|
+
function checkCell(section, name, cell) {
|
|
25
|
+
if (!ALLOWED.some((a) => cell.startsWith(a))) {
|
|
26
|
+
return [{ check: 'provenance', message: `"${section}" row "${name}": bad src "${cell}"` }];
|
|
27
|
+
}
|
|
28
|
+
if (cell.startsWith('stated') && !CITED.test(cell)) {
|
|
29
|
+
return [{ check: 'provenance', message: `"${section}" row "${name}": stated has no citation`, level: 'warn' }];
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
20
32
|
}
|
package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-quotes.mjs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// A `stated` fact that quotes a source must quote it word for word: a model
|
|
2
|
+
// that paraphrases and still says "the client said" is what citations exist
|
|
3
|
+
// to catch. Matching text is free and deterministic, so no agent checks it.
|
|
4
|
+
// Exact apart from whitespace and curly quotes — transcripts wrap lines and
|
|
5
|
+
// Word exports curl apostrophes; neither changes what was said.
|
|
6
|
+
const CITATION = /stated \[([^\]]+)\]\(([^)\s#]+)(?:#[^)\s]*)?\)(?: "([^"]+)")?/g;
|
|
7
|
+
const EMPTY = /^(—|-|Not provided.*)?$/;
|
|
8
|
+
|
|
9
|
+
export function normalize(text) {
|
|
10
|
+
return text.replace(/[“”]/g, '"').replace(/[‘’]/g, "'")
|
|
11
|
+
.replace(/\s+/g, ' ').trim();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function parseCitations(md) {
|
|
15
|
+
return [...md.matchAll(CITATION)].map((m) => ({ label: m[1], path: m[2], quote: m[3] ?? null }));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function closestSentence(text, quote) {
|
|
19
|
+
const words = new Set(normalize(quote).toLowerCase().split(' '));
|
|
20
|
+
const score = (s) => s.toLowerCase().split(' ').filter((w) => words.has(w)).length;
|
|
21
|
+
const sentences = normalize(text).split(/(?<=[.!?])\s+/);
|
|
22
|
+
return sentences.reduce((best, s) => (score(s) > score(best) ? s : best), sentences[0] ?? '');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function briefQuotesOf(tables) {
|
|
26
|
+
const t = tables.find((x) => /Quality Requirements/i.test(x.section));
|
|
27
|
+
const col = (t?.headers ?? []).findIndex((h) => /^brief says$/i.test(h));
|
|
28
|
+
if (col === -1) return [];
|
|
29
|
+
return t.rows.map((r) => (r[col] ?? '').trim().replace(/^["“]|["”]$/g, ''))
|
|
30
|
+
.filter((q) => !EMPTY.test(q));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// sources maps root-relative path → text. A citation to a file not in the map
|
|
34
|
+
// is left to the links check, which already fails a missing target.
|
|
35
|
+
export function validateQuotes({ citations, briefQuotes, sources }) {
|
|
36
|
+
return [...citationFindings(citations, sources), ...briefFindings(briefQuotes, sources)];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function citationFindings(citations, sources) {
|
|
40
|
+
return citations.filter((c) => c.quote && sources.has(c.path))
|
|
41
|
+
.filter((c) => !normalize(sources.get(c.path)).includes(normalize(c.quote)))
|
|
42
|
+
.map((c) => ({
|
|
43
|
+
check: 'quotes',
|
|
44
|
+
message: `"${c.quote}" not found in ${c.path}; closest: "${closestSentence(sources.get(c.path), c.quote)}"`,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// A Brief says quote names no file, so any input may hold it. With no inputs
|
|
49
|
+
// at all (the brief arrived in chat) there is nothing to check it against.
|
|
50
|
+
function briefFindings(quotes, sources) {
|
|
51
|
+
if (!sources.size) return [];
|
|
52
|
+
const all = [...sources.values()].map(normalize);
|
|
53
|
+
return quotes.filter((q) => !all.some((t) => t.includes(normalize(q))))
|
|
54
|
+
.map((q) => ({ check: 'quotes', message: `Brief says "${q}" is in no input file` }));
|
|
55
|
+
}
|
package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/validate-strategy.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Ties §4 Solution Strategy to §13's top-3 quality goals: every decision names
|
|
2
|
+
// a goal it serves, every goal is served by some decision. A set written before
|
|
3
|
+
// top-3 goals existed (§13 with no Goal column, §4 as bullets) warns instead of
|
|
4
|
+
// failing, so a rewrite the user declined never blocks the viewer.
|
|
5
|
+
import {
|
|
6
|
+
sectionBody, sectionTable, goalCells, isGivesWay, isNotProvided, nameOf,
|
|
7
|
+
} from './strategy-sections.mjs';
|
|
8
|
+
|
|
9
|
+
const fail = (message) => ({ check: 'strategy', message });
|
|
10
|
+
|
|
11
|
+
// `tables` is ignored: tables are read from archMd so a table under a ###
|
|
12
|
+
// subheading of §4 or §13 is found.
|
|
13
|
+
export function validateStrategy({ archMd }) {
|
|
14
|
+
const goals = sectionTable(archMd, /Quality Requirements/i, /^goal$/i);
|
|
15
|
+
const strategy = sectionTable(archMd, /Solution Strategy/i, /^serves$/i);
|
|
16
|
+
const cells = goalCells(goals);
|
|
17
|
+
const real = (cells ?? []).filter((c) => !isNotProvided(c));
|
|
18
|
+
return [
|
|
19
|
+
...checkGoals(goals, cells),
|
|
20
|
+
...checkStrategyShape(strategy, sectionBody(archMd, /Solution Strategy/i)),
|
|
21
|
+
...(real.length && strategy ? checkServes(real, strategy) : []),
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function checkGoals(t, cells) {
|
|
26
|
+
if (!t) return [];
|
|
27
|
+
if (!cells) return [{ ...fail('§13 predates top-3 goals (no Goal column); rewrite as Goal · Target · Brief says · src'), level: 'warn' }];
|
|
28
|
+
const out = cells.length === 3 ? [] : [fail(`§13 has ${cells.length} goal rows, expected 3`)];
|
|
29
|
+
const marked = cells.filter(isGivesWay).length;
|
|
30
|
+
const needOne = cells.filter((c) => !isNotProvided(c)).length >= 2;
|
|
31
|
+
if (needOne ? marked !== 1 : marked > 1) {
|
|
32
|
+
out.push(fail(`§13 marks ${marked} goals "(gives way first)", expected ${needOne ? 'exactly 1' : 'at most 1'}`));
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function checkStrategyShape(strategy, body) {
|
|
38
|
+
if (strategy || !/^\s*[-*] /m.test(body)) return [];
|
|
39
|
+
return [{ ...fail('§4 is a list; rewrite as a Decision · Serves · ADR · src table'), level: 'warn' }];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function checkServes(real, strategy) {
|
|
43
|
+
const col = strategy.headers.findIndex((h) => /^serves$/i.test(h));
|
|
44
|
+
if (col === -1) return [fail('§4 table has no Serves column')];
|
|
45
|
+
const goals = real.map(nameOf);
|
|
46
|
+
const rows = strategy.rows.map((r) => ({
|
|
47
|
+
decision: r[0],
|
|
48
|
+
serves: (r[col] ?? '').split(',').map(nameOf).filter(Boolean),
|
|
49
|
+
}));
|
|
50
|
+
return [...rowFindings(rows, goals), ...unservedFindings(rows, goals)];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function rowFindings(rows, goals) {
|
|
54
|
+
return rows.flatMap(({ decision, serves }) => {
|
|
55
|
+
if (!serves.length) return [fail(`§4 "${decision}" serves no goal`)];
|
|
56
|
+
return serves.filter((s) => !goals.includes(s))
|
|
57
|
+
.map((s) => fail(`§4 "${decision}" serves "${s}", not a §13 goal`));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function unservedFindings(rows, goals) {
|
|
62
|
+
const served = new Set(rows.flatMap((r) => r.serves));
|
|
63
|
+
return goals.filter((g) => !served.has(g))
|
|
64
|
+
.map((g) => fail(`§13 goal "${g}" is served by no §4 decision`));
|
|
65
|
+
}
|
|
@@ -2,9 +2,10 @@ import { readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { renderMarkdown } from './lib/md-render.mjs';
|
|
4
4
|
import { buildNav } from './lib/nav.mjs';
|
|
5
|
-
import { rewriteDocLinks } from './lib/doc-links.mjs';
|
|
5
|
+
import { rewriteDocLinks, anchorIds } from './lib/doc-links.mjs';
|
|
6
6
|
import { buildDoc } from './lib/doc-sections.mjs';
|
|
7
|
-
import { routeMap } from './lib/doc-routes.mjs';
|
|
7
|
+
import { routeMap, fileSlug } from './lib/doc-routes.mjs';
|
|
8
|
+
import { nextSlug } from './lib/slug-registry.mjs';
|
|
8
9
|
import { parseFrontmatter } from './lib/frontmatter.mjs';
|
|
9
10
|
import { embed } from './lib/embed.mjs';
|
|
10
11
|
import { kindOf } from './lib/doc-kinds.mjs';
|
|
@@ -70,10 +71,22 @@ function drawerOf(path, index) {
|
|
|
70
71
|
const args = parseArgs(process.argv.slice(2));
|
|
71
72
|
const archMd = readFileSync(args.arch, 'utf8');
|
|
72
73
|
const docPaths = [args.arch, ...args.docs];
|
|
73
|
-
const
|
|
74
|
+
const prefixes = new Map();
|
|
75
|
+
// The spine keeps bare ids: it is the document every other one links into, and
|
|
76
|
+
// its rail, section help and tests name `core-components`, not a prefixed id.
|
|
77
|
+
// A prefix is never reused or empty: `notes-2.md` beside two `notes.md` would
|
|
78
|
+
// otherwise repeat one, and a non-ASCII filename would collide with the spine.
|
|
79
|
+
const usedPrefixes = new Set();
|
|
80
|
+
function headingPrefix(path, index) {
|
|
81
|
+
if (index === 0) return '';
|
|
82
|
+
let prefix;
|
|
83
|
+
do prefix = nextSlug(fileSlug(path) || 'doc', prefixes); while (usedPrefixes.has(prefix));
|
|
84
|
+
usedPrefixes.add(prefix);
|
|
85
|
+
return prefix;
|
|
86
|
+
}
|
|
74
87
|
const docSlugs = new Map();
|
|
75
88
|
const pages = docPaths.map((p, i) => ({
|
|
76
|
-
...renderMarkdown(readFileSync(p, 'utf8'), slugs, docSlugs),
|
|
89
|
+
...renderMarkdown(readFileSync(p, 'utf8'), { slugs: new Map(), docSlugs, prefix: headingPrefix(p, i) }),
|
|
77
90
|
section: sectionOf(p, i, args.root),
|
|
78
91
|
path: resolve(p),
|
|
79
92
|
spine: i === 0,
|
|
@@ -83,7 +96,7 @@ const pages = docPaths.map((p, i) => ({
|
|
|
83
96
|
|
|
84
97
|
// Second pass, because a link's target id is only known once every document has
|
|
85
98
|
// been rendered: the id comes from the target's H1, not from its filename.
|
|
86
|
-
const idByPath = new Map(pages.map((p) => [p.path, p.docId]));
|
|
99
|
+
const idByPath = new Map([...pages.map((p) => [p.path, p.docId]), ...pages.flatMap((p) => anchorIds(p))]);
|
|
87
100
|
const linked = pages.map((p) => ({
|
|
88
101
|
...p,
|
|
89
102
|
html: estimateLink(p, args.out) + rewriteDocLinks(p.html, p.path, idByPath),
|
package/plugins/solution-architect/skills/analyze-requirements/scripts/test/ba-facts-cli.test.mjs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { 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
|
+
|
|
8
|
+
const CLI = 'plugins/solution-architect/skills/analyze-requirements/scripts/ba-facts.mjs';
|
|
9
|
+
const PKG = {
|
|
10
|
+
schemaVersion: '1.0', updated: '2026-10-01',
|
|
11
|
+
requirements: [
|
|
12
|
+
{ id: 'FR-001', text: 'Members book up to 4 courts per week.', label: 'confirmed', source: 'kickoff call 2026-09-20' },
|
|
13
|
+
{ id: 'FR-002', text: 'Members pay a deposit online.', label: 'recommended' },
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function run(content) {
|
|
18
|
+
const dir = mkdtempSync(join(tmpdir(), 'ba-facts-'));
|
|
19
|
+
writeFileSync(join(dir, 'requirements.json'), content);
|
|
20
|
+
const out = join(dir, 'ba.json');
|
|
21
|
+
const r = spawnSync('node', [CLI, '--json', join(dir, 'requirements.json'), '--out', out], { encoding: 'utf8' });
|
|
22
|
+
return { r, out, dir };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
test('splits confirmed facts from proposed rows', () => {
|
|
26
|
+
const { r, out, dir } = run(JSON.stringify(PKG));
|
|
27
|
+
assert.equal(r.status, 0, r.stdout);
|
|
28
|
+
assert.match(r.stdout, /^ok 1 confirmed facts, 1 not confirmed/m);
|
|
29
|
+
const { facts, proposed } = JSON.parse(readFileSync(out, 'utf8'));
|
|
30
|
+
assert.deepEqual(facts.map((f) => [f.id, f.cite, f.path]), [
|
|
31
|
+
['FR-001', 'FR-001 · kickoff call 2026-09-20', join(dir, 'requirements.json')],
|
|
32
|
+
]);
|
|
33
|
+
assert.deepEqual(proposed.map((f) => [f.id, f.label]), [['FR-002', 'recommended']]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('a file that is not a package fails', () => {
|
|
37
|
+
const { r } = run('{"port": 8080}');
|
|
38
|
+
assert.equal(r.status, 1);
|
|
39
|
+
assert.match(r.stdout, /^FAIL .* is not a requirements package/m);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('invalid JSON fails the same way', () => {
|
|
43
|
+
const { r } = run('{"port": ');
|
|
44
|
+
assert.equal(r.status, 1);
|
|
45
|
+
assert.match(r.stdout, /is not a requirements package/);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('a missing --json or --out prints usage and exits 1', () => {
|
|
49
|
+
const usage = 'FAIL usage: ba-facts.mjs --json <requirements.json> --out <file>';
|
|
50
|
+
for (const args of [[], ['--json', 'x.json'], ['--out', 'o.json']]) {
|
|
51
|
+
const r = spawnSync('node', [CLI, ...args], { encoding: 'utf8' });
|
|
52
|
+
assert.equal(r.status, 1);
|
|
53
|
+
assert.equal(r.stdout.trim(), usage);
|
|
54
|
+
}
|
|
55
|
+
});
|