@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
|
@@ -10,7 +10,7 @@ function parseArgs(argv) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const args = parseArgs(process.argv.slice(2));
|
|
13
|
-
const md = readFileSync(args.md, 'utf8');
|
|
13
|
+
const md = args.md ? readFileSync(args.md, 'utf8') : null;
|
|
14
14
|
const pkg = JSON.parse(readFileSync(args.json, 'utf8'));
|
|
15
15
|
const findings = checkPackage({ pkg, md });
|
|
16
16
|
if (findings.length) {
|
|
@@ -7,6 +7,9 @@ import math
|
|
|
7
7
|
import re
|
|
8
8
|
import sys
|
|
9
9
|
|
|
10
|
+
from scope_checks import check_scope, scope_ids
|
|
11
|
+
from scope_render import check_scope_md
|
|
12
|
+
|
|
10
13
|
STATUSES = ['DRAFT', 'CLARIFICATION_REQUIRED', 'ANALYZED', 'VALIDATED', 'READY_FOR_ARCHITECTURE']
|
|
11
14
|
DEPTHS = ['QUICK', 'STANDARD', 'DEEP']
|
|
12
15
|
MODES = ['greenfield', 'existing']
|
|
@@ -59,7 +62,7 @@ AMBIGUOUS = [
|
|
|
59
62
|
|
|
60
63
|
PARTS = ['Part 1', 'Part 2', 'Part 3', 'Part 4', 'Part 5']
|
|
61
64
|
QUICK_PARTS = ['Part 1', 'Part 3', 'Part 5']
|
|
62
|
-
ID_TOKEN = re.compile(r'\b(?:G|ACT|WF|FR|BR|SC|NFR|INT|DAT|CON|ASM|Q|CONFLICT)-\d{3}\b')
|
|
65
|
+
ID_TOKEN = re.compile(r'\b(?:G|ACT|WF|FR|BR|SC|NFR|INT|DAT|CON|ASM|Q|CONFLICT|SYS|FEAT)-\d{3}\b')
|
|
63
66
|
|
|
64
67
|
|
|
65
68
|
def rows(pkg, name):
|
|
@@ -228,7 +231,7 @@ def check_md(pkg, md):
|
|
|
228
231
|
elif not bodies[key].strip():
|
|
229
232
|
findings.append(f'md: empty section "## {part}"')
|
|
230
233
|
md_ids = {m.group(0) for m in ID_TOKEN.finditer(md)}
|
|
231
|
-
for rid in collect_ids(pkg):
|
|
234
|
+
for rid in collect_ids(pkg) + scope_ids(pkg):
|
|
232
235
|
if rid not in md_ids:
|
|
233
236
|
findings.append(f'md: id {rid} absent from requirements.md')
|
|
234
237
|
fm_status = frontmatter(md, 'status')
|
|
@@ -253,16 +256,20 @@ def check_package(pkg, md):
|
|
|
253
256
|
schema_findings = check_schema(pkg)
|
|
254
257
|
if schema_findings:
|
|
255
258
|
return schema_findings
|
|
256
|
-
ids = set(collect_ids(pkg))
|
|
257
|
-
|
|
259
|
+
ids = set(collect_ids(pkg)) | set(scope_ids(pkg))
|
|
260
|
+
scope = check_scope(pkg, ids)
|
|
261
|
+
json_findings = [
|
|
258
262
|
*check_duplicates(pkg),
|
|
259
263
|
*check_refs(pkg, ids),
|
|
260
264
|
*check_labels(pkg),
|
|
261
265
|
*check_ambiguity(pkg),
|
|
262
266
|
*check_readiness(pkg),
|
|
263
|
-
*
|
|
264
|
-
*check_md_orphan_ids(None, md, ids),
|
|
267
|
+
*scope,
|
|
265
268
|
]
|
|
269
|
+
if md is None:
|
|
270
|
+
return json_findings
|
|
271
|
+
return [*json_findings, *check_md(pkg, md), *check_md_orphan_ids(None, md, ids),
|
|
272
|
+
*([] if scope else check_scope_md(pkg, md))]
|
|
266
273
|
|
|
267
274
|
|
|
268
275
|
def main(argv):
|
|
@@ -273,8 +280,10 @@ def main(argv):
|
|
|
273
280
|
args[argv[i][2:]] = argv[i + 1]
|
|
274
281
|
i += 1
|
|
275
282
|
i += 1
|
|
276
|
-
|
|
277
|
-
|
|
283
|
+
md = None
|
|
284
|
+
if args.get('md'):
|
|
285
|
+
with open(args['md'], encoding='utf-8') as f:
|
|
286
|
+
md = f.read()
|
|
278
287
|
with open(args['json'], encoding='utf-8') as f:
|
|
279
288
|
pkg = json.load(f)
|
|
280
289
|
findings = check_package(pkg, md)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: draft-scope
|
|
3
|
+
description: Draft a workflow-based scope document (problems, systems, workflow steps, features, assumptions, client questions) from raw client emails, call transcripts or notes, as an editable DOCX the PO corrects before using the business-analyst skill. Use when the user has only raw client material, no scope document yet, and asks to draft the scope, systems, workflows or features from it.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# draft-scope
|
|
7
|
+
|
|
8
|
+
Turns raw client material into a first draft of the scope document a PO
|
|
9
|
+
would otherwise write by hand: systems, their workflow steps, features,
|
|
10
|
+
assumptions and exclusions, plus the problems heard and the questions to
|
|
11
|
+
ask the client. The PO edits the DOCX in Word or Google Docs, then uses it
|
|
12
|
+
with the business-analyst skill.
|
|
13
|
+
|
|
14
|
+
## Rules that hold in every step
|
|
15
|
+
|
|
16
|
+
1. Ask the user nothing. Every gap becomes a client question (step 3f).
|
|
17
|
+
2. Every line cites a source id (E1, C1, N1). Quotes are the source's exact
|
|
18
|
+
words. Anything you cannot source, cut.
|
|
19
|
+
3. One draft only. No alternative drafts, no ranking of features.
|
|
20
|
+
4. Follow `references/rules.md` for every text you write.
|
|
21
|
+
|
|
22
|
+
## Flow
|
|
23
|
+
|
|
24
|
+
0. **Intake.** Number every source: emails E1, E2…, calls C1…, other notes
|
|
25
|
+
N1…, in date order. Save each source's text as `sources/<id>.txt` in the
|
|
26
|
+
working folder (pasted text included), so quotes can be checked.
|
|
27
|
+
1. **Discover.** Read `steps/discover.md`. One note per source.
|
|
28
|
+
2. **Define** and 3. **Draft.** Read `steps/draft.md`, and
|
|
29
|
+
`steps/assumptions.md` for the assumptions. Write `draft.json` in the
|
|
30
|
+
shape of `references/draft-schema.md`.
|
|
31
|
+
4. **Check** and 5. **Build.** Read `steps/check.md`:
|
|
32
|
+
`python3 scripts/check.py --draft <dir>/draft.json` until it prints
|
|
33
|
+
`draft clean`, then
|
|
34
|
+
`python3 scripts/build_docx.py --draft <dir>/draft.json --out <dir>/draft-scope.docx`.
|
|
35
|
+
|
|
36
|
+
No shell or no Python (some sandboxes): skip the scripts, run the checks in
|
|
37
|
+
`steps/check.md` yourself, and show the draft in your reply in the same
|
|
38
|
+
section order as the docx.
|
|
39
|
+
|
|
40
|
+
## Finish
|
|
41
|
+
|
|
42
|
+
claude.ai: present `draft-scope.docx` and `discover-notes.md`. Claude Code:
|
|
43
|
+
give their paths. Then one line: "Edit it in Word or Google Docs, then use
|
|
44
|
+
it with the business-analyst skill."
|
|
45
|
+
|
|
46
|
+
Credits: `references/credits.md`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Credits
|
|
2
|
+
|
|
3
|
+
Ideas adapted, in our own words, from phuryn/pm-skills
|
|
4
|
+
(https://github.com/phuryn/pm-skills, MIT licence, Paweł Huryn):
|
|
5
|
+
|
|
6
|
+
- `summarize-interview` → the per-source note template (steps/discover.md):
|
|
7
|
+
its labels and order adapted, with three lines added for the draft.
|
|
8
|
+
- `analyze-feature-requests` → grouping requests into named themes (steps/draft.md 3a).
|
|
9
|
+
- `identify-assumptions-existing` → the four checks per feature (steps/assumptions.md).
|
|
10
|
+
- `prioritize-assumptions` → the impact × uncertainty grid (steps/assumptions.md).
|
|
11
|
+
|
|
12
|
+
Apart from the note template's labels, no text was copied.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# draft.json
|
|
2
|
+
|
|
3
|
+
All fields required unless marked optional. `check.py` enforces this file.
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"client": "Riverside Bakery",
|
|
8
|
+
"date": "2026-10-08",
|
|
9
|
+
"sources": [
|
|
10
|
+
{ "id": "E1", "kind": "email", "date": "2026-09-02", "who": "Dana Lee — Running out of flour", "file": "sources/E1.txt" }
|
|
11
|
+
],
|
|
12
|
+
"problems": [
|
|
13
|
+
{ "id": "P1", "text": "We run out of flour before we notice",
|
|
14
|
+
"quotes": [{ "source": "E1", "text": "exact words from E1" }] }
|
|
15
|
+
],
|
|
16
|
+
"scope": {
|
|
17
|
+
"covered": "…",
|
|
18
|
+
"pillars": [{ "system": "Stock", "pillar": "…" }],
|
|
19
|
+
"exclusions": [{ "text": "Delivery routes", "reason": "owned-elsewhere", "source": "C1" }]
|
|
20
|
+
},
|
|
21
|
+
"systems": [
|
|
22
|
+
{ "name": "Stock", "purpose": "…; closes P1", "problem": "P1",
|
|
23
|
+
"workflows": [
|
|
24
|
+
{ "kind": "main", "steps": ["Order In", "Bake"], "source": "C1" },
|
|
25
|
+
{ "kind": "side", "steps": ["Pack", "Short-pack alert"], "returnsTo": "Order In", "source": "C1" },
|
|
26
|
+
{ "kind": "sub", "name": "Custom cake", "steps": ["Quote", "Confirm Design"],
|
|
27
|
+
"startsAt": "Order In", "rejoinsAt": "Bake", "share": "~30% of orders", "source": "C1" }
|
|
28
|
+
],
|
|
29
|
+
"features": [{ "name": "Low-flour alert", "does": "Warns …", "problem": "P1", "source": "E1" }] }
|
|
30
|
+
],
|
|
31
|
+
"assumptions": [{ "text": "…", "feature": "Low-flour alert", "source": "E1" }],
|
|
32
|
+
"questions": [{ "text": "…", "why": "…", "assume": "…", "refs": ["P1", "E1"] }]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- `sources[].id`: `E`, `C` or `N` and a number. `kind`: `email`, `call`
|
|
37
|
+
or `note`. `file`: path relative to `draft.json`.
|
|
38
|
+
- `problems[].id`: `P` and a number.
|
|
39
|
+
- `scope.pillars`: optional. `exclusions[].reason`: `owned-elsewhere`,
|
|
40
|
+
`later-phase` or `no-detail`.
|
|
41
|
+
- `workflows[].kind`: `main`, `side` or `sub`. `returnsTo`, `name`,
|
|
42
|
+
`startsAt`, `rejoinsAt`, `share`: optional.
|
|
43
|
+
- `assumptions[].feature`: a feature `name` in the draft.
|
|
44
|
+
- `questions[].refs`: problem and source ids.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Writing rules
|
|
2
|
+
|
|
3
|
+
- **Problems**: 1–6, one sentence each, client's terms, never a solution.
|
|
4
|
+
At least one exact quote each.
|
|
5
|
+
- **Systems**: business areas the client would name; purpose = area + the
|
|
6
|
+
problem it closes.
|
|
7
|
+
- **Steps**: to-be only, 1–5 words each.
|
|
8
|
+
- **Features**: name 2–6 words; `does` = one verb-first sentence: who, the
|
|
9
|
+
client's number, what changes against today.
|
|
10
|
+
- **Assumptions**: at most 8; each names its feature and the source whose
|
|
11
|
+
words support it. Unsupported ones go in a client question's `assume`.
|
|
12
|
+
- **Exclusions**: only what a source names; each has a reason (owned by
|
|
13
|
+
someone else, later phase, no process detail yet) and that source.
|
|
14
|
+
- **Client questions**: about a real past case; say why it matters and what
|
|
15
|
+
to assume without an answer; conflicting sources quoted together.
|
|
16
|
+
- **Sources**: a cited source must say the thing it is cited for.
|
|
17
|
+
- **Quotes**: exact words. Never reword, never shorten inside the quote.
|
|
18
|
+
- **Numbers**: keep the client's numbers as written; never round them away.
|
|
19
|
+
- **Banned words** outside quotes (checked by `check.py`): fast, quick,
|
|
20
|
+
easy, simple, user-friendly, intuitive, flexible, robust, seamless,
|
|
21
|
+
efficient, optimal, appropriate, various, etc, some, many, several,
|
|
22
|
+
as needed. Say the measurable thing instead.
|
|
23
|
+
- **Ids**: only source ids (E1, C1, N1) and problem ids (P1…) appear in the
|
|
24
|
+
draft.
|
package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_body.cpython-312.pyc
ADDED
|
Binary file
|
package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_flow.cpython-312.pyc
ADDED
|
Binary file
|
package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_package.cpython-312.pyc
ADDED
|
Binary file
|
package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/docx_xml.cpython-312.pyc
ADDED
|
Binary file
|
package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_quotes.cpython-312.pyc
ADDED
|
Binary file
|
package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_rules.cpython-312.pyc
ADDED
|
Binary file
|
package/plugins/business-analyst/skills/draft-scope/scripts/__pycache__/draft_schema.cpython-312.pyc
ADDED
|
Binary file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Builds draft-scope.docx from a draft.json that check.py passed.
|
|
3
|
+
|
|
4
|
+
python3 build_docx.py --draft <dir>/draft.json --out <dir>/draft-scope.docx
|
|
5
|
+
|
|
6
|
+
Standard library only. Run check.py first: this script trusts the shape.
|
|
7
|
+
"""
|
|
8
|
+
import json
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
from docx_body import document_xml
|
|
12
|
+
from docx_package import write_docx
|
|
13
|
+
|
|
14
|
+
USAGE = 'usage: build_docx.py --draft <draft.json> --out <draft-scope.docx>'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def parse(argv):
|
|
18
|
+
if len(argv) != 4 or argv[0] != '--draft' or argv[2] != '--out':
|
|
19
|
+
return None
|
|
20
|
+
return argv[1], argv[3]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main(argv):
|
|
24
|
+
args = parse(argv)
|
|
25
|
+
if args is None:
|
|
26
|
+
print(USAGE, file=sys.stderr)
|
|
27
|
+
return 2
|
|
28
|
+
with open(args[0], encoding='utf-8') as f:
|
|
29
|
+
draft = json.load(f)
|
|
30
|
+
write_docx(args[1], document_xml(draft))
|
|
31
|
+
print(args[1])
|
|
32
|
+
return 0
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == '__main__':
|
|
36
|
+
sys.exit(main(sys.argv[1:]))
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Checks draft.json before the docx is built (steps/check.md).
|
|
3
|
+
|
|
4
|
+
python3 check.py --draft <dir>/draft.json
|
|
5
|
+
|
|
6
|
+
Source files are read relative to the draft's folder. Prints `draft clean`
|
|
7
|
+
and exits 0, or prints one finding per line on stderr and exits 1.
|
|
8
|
+
"""
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
from draft_quotes import quote_findings
|
|
14
|
+
from draft_rules import coverage_findings, limit_findings, ref_findings, word_findings
|
|
15
|
+
from draft_schema import shape_findings
|
|
16
|
+
|
|
17
|
+
USAGE = 'usage: check.py --draft <draft.json>'
|
|
18
|
+
RULES = [ref_findings, coverage_findings, limit_findings, word_findings]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def findings_for(draft, base):
|
|
22
|
+
out = shape_findings(draft)
|
|
23
|
+
if out:
|
|
24
|
+
return out
|
|
25
|
+
for rule in RULES:
|
|
26
|
+
out += rule(draft)
|
|
27
|
+
return out + quote_findings(draft, base)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def load(path):
|
|
31
|
+
with open(path, encoding='utf-8') as f:
|
|
32
|
+
return json.load(f)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def main(argv):
|
|
36
|
+
if len(argv) != 2 or argv[0] != '--draft':
|
|
37
|
+
print(USAGE, file=sys.stderr)
|
|
38
|
+
return 2
|
|
39
|
+
try:
|
|
40
|
+
draft = load(argv[1])
|
|
41
|
+
except (OSError, ValueError) as e:
|
|
42
|
+
print(f'{os.path.basename(argv[1])}: {e}', file=sys.stderr)
|
|
43
|
+
return 1
|
|
44
|
+
out = findings_for(draft, os.path.dirname(os.path.abspath(argv[1])))
|
|
45
|
+
if out:
|
|
46
|
+
print('\n'.join(out), file=sys.stderr)
|
|
47
|
+
return 1
|
|
48
|
+
print('draft clean')
|
|
49
|
+
return 0
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
if __name__ == '__main__':
|
|
53
|
+
sys.exit(main(sys.argv[1:]))
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""document.xml for draft-scope.docx, in the order of the spec's 'Document shape'."""
|
|
2
|
+
from docx_flow import flow_xml
|
|
3
|
+
from docx_xml import bullets, para, table
|
|
4
|
+
|
|
5
|
+
NS = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"'
|
|
6
|
+
SECTION = ('<w:sectPr><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:top="1134" w:right="1134" '
|
|
7
|
+
'w:bottom="1134" w:left="1134" w:header="709" w:footer="709" w:gutter="0"/></w:sectPr>')
|
|
8
|
+
NOTE = ('Drafted from the sources below. It holds only what the client said; '
|
|
9
|
+
'the PO adds value-add features while editing.')
|
|
10
|
+
REASONS = {'owned-elsewhere': 'Owned by someone else', 'later-phase': 'Later phase',
|
|
11
|
+
'no-detail': 'No process detail yet'}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def head_xml(d):
|
|
15
|
+
rows = [[s['id'], s['kind'], s['date'], s['who']] for s in d['sources']]
|
|
16
|
+
return (para(f"{d['client']} — Scope draft", 'Title') + para(d['date'], 'Subtitle') + para(NOTE)
|
|
17
|
+
+ para('Sources', 'Heading1') + table(['Source', 'Kind', 'Date', 'Who / subject'], rows))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def problems_xml(d):
|
|
21
|
+
out = para('Problems we heard', 'Heading1')
|
|
22
|
+
for p in d['problems']:
|
|
23
|
+
heard = ', '.join(sorted({q['source'] for q in p['quotes']}))
|
|
24
|
+
out += para(f"{p['id']} {p['text']}", 'Heading3')
|
|
25
|
+
out += bullets([f'"{q["text"]}" ({q["source"]})' for q in p['quotes']])
|
|
26
|
+
out += para(f'Heard in: {heard}')
|
|
27
|
+
return out
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def scope_xml(scope):
|
|
31
|
+
out = para('Scope', 'Heading1') + para(scope['covered'])
|
|
32
|
+
pillars = scope.get('pillars') or []
|
|
33
|
+
if pillars:
|
|
34
|
+
out += table(['System', 'Client pillar'], [[x['system'], x['pillar']] for x in pillars])
|
|
35
|
+
rows = [[x['text'], REASONS[x['reason']], x['source']] for x in scope['exclusions']]
|
|
36
|
+
return out + para('Exclusions', 'Heading2') + table(['Exclusion', 'Reason', 'From'], rows)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def system_xml(s, n):
|
|
40
|
+
rows = [[f['name'], f['does'], f['source']] for f in s['features']]
|
|
41
|
+
flows = ''.join(flow_xml(w) for w in s['workflows'])
|
|
42
|
+
return (para(f"System {n}: {s['name']}", 'Heading1') + para(s['purpose']) + flows
|
|
43
|
+
+ table(['Feature', 'What it does', 'From'], rows))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def closing_xml(d):
|
|
47
|
+
a = [[x['text'], x['feature'], x['source']] for x in d['assumptions']]
|
|
48
|
+
q = [[x['text'], x['why'], x['assume'], ', '.join(x['refs'])] for x in d['questions']]
|
|
49
|
+
return (para('Assumptions', 'Heading1') + table(['Assumption', 'For feature', 'From'], a)
|
|
50
|
+
+ para('Questions for the client', 'Heading1')
|
|
51
|
+
+ table(['Question', 'Why it matters', 'If no answer, assume', 'About'], q))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def document_xml(d):
|
|
55
|
+
systems = ''.join(system_xml(s, i + 1) for i, s in enumerate(d['systems']))
|
|
56
|
+
body = head_xml(d) + problems_xml(d) + scope_xml(d['scope']) + systems + closing_xml(d)
|
|
57
|
+
return ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'
|
|
58
|
+
f'<w:document {NS}><w:body>{body}{SECTION}</w:body></w:document>')
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Workflow step lines drawn as boxes: one bordered table cell per step, arrow
|
|
2
|
+
cells between (spec D3). A plain table, so Word and Google Docs both draw it
|
|
3
|
+
and the PO edits a step by typing in its box."""
|
|
4
|
+
from docx_xml import TEXT_WIDTH, para, run
|
|
5
|
+
|
|
6
|
+
PER_ROW = 5
|
|
7
|
+
ARROW_W = 400
|
|
8
|
+
STEP_W = (TEXT_WIDTH - ARROW_W * (PER_ROW - 1)) // PER_ROW
|
|
9
|
+
LINE = '<w:{0} w:val="single" w:sz="8" w:space="0" w:color="5C6470"/>'
|
|
10
|
+
BOX = '<w:tcBorders>' + ''.join(LINE.format(b) for b in ('top', 'left', 'bottom', 'right')) + '</w:tcBorders>'
|
|
11
|
+
NO_BORDERS = ('<w:tblBorders>' + ''.join(f'<w:{b} w:val="nil"/>'
|
|
12
|
+
for b in ('top', 'left', 'bottom', 'right', 'insideH', 'insideV')) + '</w:tblBorders>')
|
|
13
|
+
GAP = ('<w:tr><w:trPr><w:trHeight w:val="120" w:hRule="exact"/></w:trPr>'
|
|
14
|
+
+ '<w:tc><w:p/></w:tc>' * (PER_ROW * 2 - 1) + '</w:tr>')
|
|
15
|
+
CENTER = '<w:pPr><w:spacing w:before="60" w:after="60"/><w:jc w:val="center"/></w:pPr>'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def cell(text, width, box):
|
|
19
|
+
props = f'<w:tcPr><w:tcW w:w="{width}" w:type="dxa"/>{BOX if box else ""}<w:vAlign w:val="center"/></w:tcPr>'
|
|
20
|
+
return f'<w:tc>{props}<w:p>{CENTER}{run(text) if text else ""}</w:p></w:tc>'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def flow_row(steps):
|
|
24
|
+
"""Up to PER_ROW steps; a short row is padded with empty borderless cells."""
|
|
25
|
+
cells = ''
|
|
26
|
+
for i in range(PER_ROW):
|
|
27
|
+
step = steps[i] if i < len(steps) else ''
|
|
28
|
+
if i:
|
|
29
|
+
cells += cell('→' if step else '', ARROW_W, False)
|
|
30
|
+
cells += cell(step, STEP_W, bool(step))
|
|
31
|
+
return f'<w:tr><w:trPr><w:cantSplit/></w:trPr>{cells}</w:tr>'
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def flow_label(w):
|
|
35
|
+
if w['kind'] == 'main':
|
|
36
|
+
return 'Main workflow'
|
|
37
|
+
if w['kind'] == 'side':
|
|
38
|
+
return f"Side path, back to {w['returnsTo']}" if w.get('returnsTo') else 'Side path'
|
|
39
|
+
parts = [f"starts at {w['startsAt']}" if w.get('startsAt') else '',
|
|
40
|
+
f"rejoins at {w['rejoinsAt']}" if w.get('rejoinsAt') else '', w.get('share') or '']
|
|
41
|
+
where = ', '.join(p for p in parts if p)
|
|
42
|
+
name = w.get('name') or 'Sub-workflow'
|
|
43
|
+
return f'{name}: {where}' if where else name
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def flow_xml(w):
|
|
47
|
+
widths = [STEP_W] + [ARROW_W, STEP_W] * (PER_ROW - 1)
|
|
48
|
+
grid = ''.join(f'<w:gridCol w:w="{x}"/>' for x in widths)
|
|
49
|
+
rows = GAP.join(flow_row(w['steps'][i:i + PER_ROW]) for i in range(0, len(w['steps']), PER_ROW))
|
|
50
|
+
return (para(flow_label(w), 'Heading3')
|
|
51
|
+
+ f'<w:tbl><w:tblPr><w:tblW w:w="{sum(widths)}" w:type="dxa"/>{NO_BORDERS}'
|
|
52
|
+
f'<w:tblLayout w:type="fixed"/></w:tblPr><w:tblGrid>{grid}</w:tblGrid>{rows}</w:tbl><w:p/>')
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""The DOCX package around document.xml: content types, relationships, the
|
|
2
|
+
built-in styles the body uses, one bullet list. Standard Word styles only."""
|
|
3
|
+
import zipfile
|
|
4
|
+
|
|
5
|
+
XML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'
|
|
6
|
+
W = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"'
|
|
7
|
+
REL = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'
|
|
8
|
+
PKG_REL = 'http://schemas.openxmlformats.org/package/2006/relationships'
|
|
9
|
+
MAIN = 'application/vnd.openxmlformats-officedocument.wordprocessingml'
|
|
10
|
+
|
|
11
|
+
CONTENT_TYPES = (f'{XML}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">'
|
|
12
|
+
'<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>'
|
|
13
|
+
'<Default Extension="xml" ContentType="application/xml"/>'
|
|
14
|
+
f'<Override PartName="/word/document.xml" ContentType="{MAIN}.document.main+xml"/>'
|
|
15
|
+
f'<Override PartName="/word/styles.xml" ContentType="{MAIN}.styles+xml"/>'
|
|
16
|
+
f'<Override PartName="/word/numbering.xml" ContentType="{MAIN}.numbering+xml"/></Types>')
|
|
17
|
+
ROOT_RELS = (f'{XML}<Relationships xmlns="{PKG_REL}">'
|
|
18
|
+
f'<Relationship Id="rId1" Type="{REL}/officeDocument" Target="word/document.xml"/></Relationships>')
|
|
19
|
+
DOC_RELS = (f'{XML}<Relationships xmlns="{PKG_REL}">'
|
|
20
|
+
f'<Relationship Id="rIdStyles" Type="{REL}/styles" Target="styles.xml"/>'
|
|
21
|
+
f'<Relationship Id="rIdNumbering" Type="{REL}/numbering" Target="numbering.xml"/></Relationships>')
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def p_style(sid, name, props):
|
|
25
|
+
return (f'<w:style w:type="paragraph" w:styleId="{sid}"><w:name w:val="{name}"/>'
|
|
26
|
+
f'<w:basedOn w:val="Normal"/><w:next w:val="Normal"/>{props}</w:style>')
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def heading(level, size):
|
|
30
|
+
before = 360 if level == 1 else 240
|
|
31
|
+
return p_style(f'Heading{level}', f'heading {level}',
|
|
32
|
+
f'<w:pPr><w:keepNext/><w:spacing w:before="{before}" w:after="120"/>'
|
|
33
|
+
f'<w:outlineLvl w:val="{level - 1}"/></w:pPr><w:rPr><w:b/><w:sz w:val="{size}"/></w:rPr>')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
BORDER = ''.join(f'<w:{b} w:val="single" w:sz="4" w:space="0" w:color="D9DDE3"/>'
|
|
37
|
+
for b in ('top', 'left', 'bottom', 'right', 'insideH', 'insideV'))
|
|
38
|
+
STYLES = (f'{XML}<w:styles {W}><w:docDefaults><w:rPrDefault><w:rPr>'
|
|
39
|
+
'<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:cs="Calibri"/><w:sz w:val="22"/></w:rPr></w:rPrDefault>'
|
|
40
|
+
'<w:pPrDefault><w:pPr><w:spacing w:after="120" w:line="276" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults>'
|
|
41
|
+
'<w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/></w:style>'
|
|
42
|
+
+ p_style('Title', 'Title', '<w:pPr><w:spacing w:after="80"/></w:pPr><w:rPr><w:b/><w:sz w:val="44"/></w:rPr>')
|
|
43
|
+
+ p_style('Subtitle', 'Subtitle', '<w:rPr><w:color w:val="5C6470"/><w:sz w:val="24"/></w:rPr>')
|
|
44
|
+
+ heading(1, 32) + heading(2, 24) + heading(3, 22)
|
|
45
|
+
+ p_style('ListParagraph', 'List Paragraph', '<w:pPr><w:ind w:left="720"/></w:pPr>')
|
|
46
|
+
+ f'<w:style w:type="table" w:styleId="TableGrid"><w:name w:val="Table Grid"/><w:tblPr><w:tblBorders>{BORDER}</w:tblBorders>'
|
|
47
|
+
'<w:tblCellMar><w:top w:w="60" w:type="dxa"/><w:left w:w="100" w:type="dxa"/>'
|
|
48
|
+
'<w:bottom w:w="60" w:type="dxa"/><w:right w:w="100" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style></w:styles>')
|
|
49
|
+
NUMBERING = (f'{XML}<w:numbering {W}><w:abstractNum w:abstractNumId="0"><w:multiLevelType w:val="hybridMultilevel"/>'
|
|
50
|
+
'<w:lvl w:ilvl="0"><w:start w:val="1"/><w:numFmt w:val="bullet"/><w:lvlText w:val="•"/>'
|
|
51
|
+
'<w:lvlJc w:val="left"/><w:pPr><w:ind w:left="720" w:hanging="360"/></w:pPr></w:lvl>'
|
|
52
|
+
'</w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0"/></w:num></w:numbering>')
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def write_docx(path, document):
|
|
56
|
+
"""[Content_Types].xml first, as Word expects; deflate-compressed."""
|
|
57
|
+
parts = [('[Content_Types].xml', CONTENT_TYPES), ('_rels/.rels', ROOT_RELS),
|
|
58
|
+
('word/document.xml', document), ('word/_rels/document.xml.rels', DOC_RELS),
|
|
59
|
+
('word/styles.xml', STYLES), ('word/numbering.xml', NUMBERING)]
|
|
60
|
+
with zipfile.ZipFile(path, 'w', zipfile.ZIP_DEFLATED) as z:
|
|
61
|
+
for name, xml in parts:
|
|
62
|
+
z.writestr(name, xml.encode('utf-8'))
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""WordprocessingML pieces: paragraphs, bullet lists, tables (styles in docx_package.py)."""
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
TEXT_WIDTH = 9638 # twips: A4 width less two 2 cm margins
|
|
5
|
+
CONTROL = re.compile('[\x00-\x08\x0b\x0c\x0e-\x1f]')
|
|
6
|
+
BULLET = ('<w:pPr><w:pStyle w:val="ListParagraph"/>'
|
|
7
|
+
'<w:numPr><w:ilvl w:val="0"/><w:numId w:val="1"/></w:numPr></w:pPr>')
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def xml_text(text):
|
|
11
|
+
clean = CONTROL.sub('', str(text))
|
|
12
|
+
return clean.replace('&', '&').replace('<', '<').replace('>', '>')
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run(text, bold=False):
|
|
16
|
+
props = '<w:rPr><w:b/></w:rPr>' if bold else ''
|
|
17
|
+
return f'<w:r>{props}<w:t xml:space="preserve">{xml_text(text)}</w:t></w:r>'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def para(text, style=None):
|
|
21
|
+
if not text:
|
|
22
|
+
return ''
|
|
23
|
+
props = f'<w:pPr><w:pStyle w:val="{style}"/></w:pPr>' if style else ''
|
|
24
|
+
return f'<w:p>{props}{run(text)}</w:p>'
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def bullets(items):
|
|
28
|
+
return ''.join(f'<w:p>{BULLET}{run(t)}</w:p>' for t in items)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def row(cells, head):
|
|
32
|
+
props = '<w:trPr><w:tblHeader/></w:trPr>' if head else ''
|
|
33
|
+
tcs = ''.join(f'<w:tc><w:p>{run(c, head)}</w:p></w:tc>' for c in cells)
|
|
34
|
+
return f'<w:tr>{props}{tcs}</w:tr>'
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def table(head, rows):
|
|
38
|
+
"""A bordered table, or a 'None.' line when there are no rows."""
|
|
39
|
+
if not rows:
|
|
40
|
+
return para('None.')
|
|
41
|
+
grid = ''.join(f'<w:gridCol w:w="{TEXT_WIDTH // len(head)}"/>' for _ in head)
|
|
42
|
+
body = row(head, True) + ''.join(row(r, False) for r in rows)
|
|
43
|
+
return ('<w:tbl><w:tblPr><w:tblStyle w:val="TableGrid"/><w:tblW w:w="5000" w:type="pct"/></w:tblPr>'
|
|
44
|
+
f'<w:tblGrid>{grid}</w:tblGrid>{body}</w:tbl><w:p/>')
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Every problem quote must appear word for word in its source file."""
|
|
2
|
+
import difflib
|
|
3
|
+
import os
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
MARKS = str.maketrans({'“': '"', '”': '"', '‘': "'", '’': "'", '–': '-', '—': '-', '‑': '-'})
|
|
7
|
+
REPLY = re.compile(r'^[ \t]*>+[ \t]?', re.M)
|
|
8
|
+
SENTENCE = re.compile(r'(?<=[.!?])\s+|\n+')
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def plain(text):
|
|
12
|
+
"""Text as the PO reads it: no email reply markers, one kind of quote mark and dash, single spaces."""
|
|
13
|
+
return ' '.join(REPLY.sub('', text).translate(MARKS).split())
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def norm(text):
|
|
17
|
+
"""What a quote is matched on: plain text, any case, without wrapping quote marks."""
|
|
18
|
+
return plain(text).strip('"\'').casefold()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def read_sources(draft, base):
|
|
22
|
+
"""{id: text} for every source file found, plus findings for the missing ones."""
|
|
23
|
+
texts, out = {}, []
|
|
24
|
+
for s in draft['sources']:
|
|
25
|
+
path = os.path.join(base, s['file'])
|
|
26
|
+
if os.path.isfile(path):
|
|
27
|
+
with open(path, encoding='utf-8') as f:
|
|
28
|
+
texts[s['id']] = f.read()
|
|
29
|
+
else:
|
|
30
|
+
out.append(f"sources: {s['id']} file {s['file']} not found")
|
|
31
|
+
return texts, out
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def closest(quote, raw):
|
|
35
|
+
sentences = [plain(s) for s in SENTENCE.split(REPLY.sub('', raw)) if s.strip()]
|
|
36
|
+
score = lambda s: difflib.SequenceMatcher(None, norm(quote), s.casefold()).ratio()
|
|
37
|
+
return max(sentences, key=score, default='')
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def quote_findings(draft, base):
|
|
41
|
+
texts, out = read_sources(draft, base)
|
|
42
|
+
for i, p in enumerate(draft['problems']):
|
|
43
|
+
for j, q in enumerate(p['quotes']):
|
|
44
|
+
raw = texts.get(q['source'])
|
|
45
|
+
if raw is None or norm(q['text']) in norm(raw):
|
|
46
|
+
continue
|
|
47
|
+
hint = closest(q['text'], raw)
|
|
48
|
+
out.append(f"problems[{i}].quotes[{j}]: not word for word in {q['source']}; closest: \"{hint}\"")
|
|
49
|
+
return out
|