@xulthekl/team-flow 0.22.4
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/.agents/plugins/marketplace.json +20 -0
- package/.agents/skills +1 -0
- package/.claude/always/phase-guard.md +3 -0
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +31 -0
- package/.codex-plugin/plugin.json +45 -0
- package/.codexignore +6 -0
- package/.cursor-plugin/marketplace.json +17 -0
- package/.cursor-plugin/plugin.json +31 -0
- package/.github/copilot-instructions.md +15 -0
- package/.github/dependabot.yml +10 -0
- package/.github/plugin/marketplace.json +42 -0
- package/.github/workflows/ci.yml +98 -0
- package/.github/workflows/hol-plugin-scanner.yml +17 -0
- package/.opencode/INSTALL.md +61 -0
- package/.opencode/plugins/team-flow.js +70 -0
- package/AGENTS.md +280 -0
- package/CHANGELOG.md +635 -0
- package/CONTRIBUTING.md +115 -0
- package/GEMINI.md +14 -0
- package/HANDOFF.md +219 -0
- package/INSTALL.md +810 -0
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/SECURITY.md +37 -0
- package/agents/bug-investigator.md +180 -0
- package/agents/change-split-auditor.md +257 -0
- package/agents/code-reviewer.md +171 -0
- package/agents/cross-change-consistency-checker.md +215 -0
- package/agents/prd-completeness-reviewer.md +197 -0
- package/agents/prototype-builder.md +230 -0
- package/agents/prototype-env-scout.md +156 -0
- package/agents/prototype-reviewer.md +226 -0
- package/assets/icon.svg +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +5 -0
- package/dist/parsing/change-parser.d.ts +12 -0
- package/dist/parsing/change-parser.js +54 -0
- package/dist/parsing/requirement-blocks.d.ts +31 -0
- package/dist/parsing/requirement-blocks.js +192 -0
- package/dist/schema/base.d.ts +7 -0
- package/dist/schema/base.js +1 -0
- package/dist/schema/change.d.ts +25 -0
- package/dist/schema/change.js +1 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/spec.d.ts +11 -0
- package/dist/schema/spec.js +1 -0
- package/dist/validation/constants.d.ts +42 -0
- package/dist/validation/constants.js +42 -0
- package/dist/validation/tokenizer.d.ts +17 -0
- package/dist/validation/tokenizer.js +173 -0
- package/dist/validation/types.d.ts +40 -0
- package/dist/validation/types.js +1 -0
- package/dist/validation/validator.d.ts +21 -0
- package/dist/validation/validator.js +489 -0
- package/docs/README_en.md +358 -0
- package/docs/artifact-contract.md +96 -0
- package/docs/decision-points.md +88 -0
- package/docs/e2e-integration-design.md +207 -0
- package/docs/examples/README.md +25 -0
- package/docs/examples/add-dark-mode/README.md +13 -0
- package/docs/examples/add-dark-mode/design.md +49 -0
- package/docs/examples/add-dark-mode/execution-contract.md +56 -0
- package/docs/examples/add-dark-mode/proposal.md +46 -0
- package/docs/examples/add-dark-mode/specs/ui-theme/spec.md +35 -0
- package/docs/examples/add-dark-mode/tasks.md +26 -0
- package/docs/examples/refactor-auth-boundary/README.md +15 -0
- package/docs/examples/refactor-auth-boundary/design.md +41 -0
- package/docs/examples/refactor-auth-boundary/execution-contract.md +61 -0
- package/docs/examples/refactor-auth-boundary/proposal.md +47 -0
- package/docs/examples/refactor-auth-boundary/specs/auth-boundary/spec.md +45 -0
- package/docs/examples/refactor-auth-boundary/tasks.md +25 -0
- package/docs/plans/2026-07-07-fix-batch-design.md +68 -0
- package/docs/plans/2026-07-20-001-refactor-skill-collaboration-protocol-plan.md +128 -0
- package/docs/platform-matrix.md +45 -0
- package/docs/prototype-design-research.md +206 -0
- package/docs/release-checklist.md +96 -0
- package/docs/showcase.html +699 -0
- package/docs/skill-rename-v0.8.0.md +49 -0
- package/docs/state-machine.md +162 -0
- package/gemini-extension.json +6 -0
- package/hooks/hooks-cursor.json +8 -0
- package/hooks/hooks.json +26 -0
- package/hooks/pre-tool-use-guard +116 -0
- package/hooks/session-start +14 -0
- package/llms.txt +51 -0
- package/package.json +48 -0
- package/plugin.json +27 -0
- package/prd/v1/plan.md +443 -0
- package/prd/v1/prd.md +580 -0
- package/scripts/check-update.mjs +91 -0
- package/scripts/check-version-consistency.mjs +345 -0
- package/scripts/ensure-branch.mjs +71 -0
- package/scripts/get-config +31 -0
- package/scripts/guard/checks/artifacts-exist.mjs +36 -0
- package/scripts/guard/checks/contract-current.mjs +33 -0
- package/scripts/guard/checks/contract-fresh.mjs +17 -0
- package/scripts/guard/checks/dp-gate-passed.mjs +35 -0
- package/scripts/guard/checks/dp3-approved.mjs +22 -0
- package/scripts/guard/checks/execution-plan-ready.mjs +40 -0
- package/scripts/guard/checks/execution-reviews-passed.mjs +36 -0
- package/scripts/guard/checks/schema-valid.mjs +63 -0
- package/scripts/guard/checks/specs-merged.mjs +51 -0
- package/scripts/guard/checks/tasks-complete.mjs +31 -0
- package/scripts/guard/checks/tests-passing.mjs +31 -0
- package/scripts/guard/design-token-guard.mjs +237 -0
- package/scripts/guard/guard.mjs +205 -0
- package/scripts/infer-workflow.mjs +136 -0
- package/scripts/install-amazon-q.mjs +9 -0
- package/scripts/install-cline.mjs +9 -0
- package/scripts/install-continue.mjs +9 -0
- package/scripts/install-cursor.mjs +265 -0
- package/scripts/install-git-hooks.mjs +82 -0
- package/scripts/install-kiro.mjs +9 -0
- package/scripts/install-pi.mjs +9 -0
- package/scripts/install-qoder.mjs +9 -0
- package/scripts/install-qwen.mjs +9 -0
- package/scripts/install-roocode.mjs +9 -0
- package/scripts/install-windsurf.mjs +9 -0
- package/scripts/install-zcode.mjs +265 -0
- package/scripts/lib/cmd-audit.mjs +127 -0
- package/scripts/lib/cmd-checkpoint.mjs +118 -0
- package/scripts/lib/cmd-config.mjs +88 -0
- package/scripts/lib/cmd-doctor.mjs +267 -0
- package/scripts/lib/cmd-execution.mjs +206 -0
- package/scripts/lib/cmd-handoff.mjs +94 -0
- package/scripts/lib/cmd-inject.mjs +310 -0
- package/scripts/lib/cmd-install-amazon-q.mjs +11 -0
- package/scripts/lib/cmd-install-cline.mjs +11 -0
- package/scripts/lib/cmd-install-continue.mjs +11 -0
- package/scripts/lib/cmd-install-cursor.mjs +14 -0
- package/scripts/lib/cmd-install-kiro.mjs +11 -0
- package/scripts/lib/cmd-install-pi.mjs +11 -0
- package/scripts/lib/cmd-install-qoder.mjs +11 -0
- package/scripts/lib/cmd-install-qwen.mjs +11 -0
- package/scripts/lib/cmd-install-roocode.mjs +11 -0
- package/scripts/lib/cmd-install-windsurf.mjs +11 -0
- package/scripts/lib/cmd-install-workbuddy.mjs +359 -0
- package/scripts/lib/cmd-install-zcode.mjs +14 -0
- package/scripts/lib/cmd-isolate.mjs +37 -0
- package/scripts/lib/cmd-list.mjs +71 -0
- package/scripts/lib/cmd-runtime.mjs +85 -0
- package/scripts/lib/cmd-solutions.mjs +71 -0
- package/scripts/lib/cmd-state.mjs +231 -0
- package/scripts/lib/cmd-sync.mjs +102 -0
- package/scripts/lib/cmd-validate.mjs +105 -0
- package/scripts/lib/cmd-version.mjs +148 -0
- package/scripts/lib/config-loader.mjs +107 -0
- package/scripts/lib/execution-plan.mjs +492 -0
- package/scripts/lib/execution-recommendation.mjs +221 -0
- package/scripts/lib/hash.mjs +74 -0
- package/scripts/lib/install.mjs +267 -0
- package/scripts/lib/platform-runtime-inventory.mjs +27 -0
- package/scripts/lib/platforms.mjs +165 -0
- package/scripts/lib/prototype-sync.mjs +192 -0
- package/scripts/lib/sdd-overlay.mjs +262 -0
- package/scripts/lib/shell-quote.mjs +4 -0
- package/scripts/lib/solutions-capture.mjs +102 -0
- package/scripts/lib/solutions-index-gen.mjs +112 -0
- package/scripts/lib/solutions-inject.mjs +77 -0
- package/scripts/lib/solutions-promote.mjs +145 -0
- package/scripts/lib/spec-paths.mjs +85 -0
- package/scripts/lib/state-loader.mjs +154 -0
- package/scripts/lint/lint-skills.mjs +149 -0
- package/scripts/lint/rules/behavior-consistency.mjs +56 -0
- package/scripts/lint/rules/dp-trigger-points.mjs +60 -0
- package/scripts/lint/rules/exception-handling.mjs +59 -0
- package/scripts/lint/rules/no-contradictory-instructions.mjs +67 -0
- package/scripts/lint/rules/no-redundant-checks.mjs +50 -0
- package/scripts/lint/rules/token-rules.mjs +122 -0
- package/scripts/review-package +44 -0
- package/scripts/task-brief +40 -0
- package/scripts/team-flow.mjs +164 -0
- package/scripts/token-baseline.mjs +158 -0
- package/scripts/validate-artifacts +96 -0
- package/scripts/verify-marketplace-release.mjs +59 -0
- package/skills/architecture-design/SKILL.md +140 -0
- package/skills/architecture-design/chapters/ch01-4a-domains.md +27 -0
- package/skills/architecture-design/chapters/ch02-change-cascade.md +27 -0
- package/skills/architecture-design/chapters/ch03-architecture-outputs.md +25 -0
- package/skills/architecture-design/chapters/ch04-entity-to-aggregate.md +27 -0
- package/skills/architecture-design/chapters/ch05-cqrs.md +32 -0
- package/skills/architecture-design/chapters/ch06-integration.md +54 -0
- package/skills/architecture-design/cheatsheet.md +51 -0
- package/skills/architecture-design/glossary.md +23 -0
- package/skills/architecture-design/patterns.md +32 -0
- package/skills/bug-investigator/SKILL.md +77 -0
- package/skills/build-executor/SKILL.md +163 -0
- package/skills/build-executor/implementer-prompt.md +162 -0
- package/skills/build-executor/references/execution-modes.md +86 -0
- package/skills/build-executor/task-reviewer-prompt.md +195 -0
- package/skills/ce-brainstorm/SKILL.md +415 -0
- package/skills/ce-brainstorm/references/agents/slack-researcher.md +127 -0
- package/skills/ce-brainstorm/references/blindspot-pass.md +70 -0
- package/skills/ce-brainstorm/references/brainstorm-sections.md +285 -0
- package/skills/ce-brainstorm/references/handoff.md +168 -0
- package/skills/ce-brainstorm/references/html-rendering.md +634 -0
- package/skills/ce-brainstorm/references/markdown-rendering.md +241 -0
- package/skills/ce-brainstorm/references/model-tiers.md +9 -0
- package/skills/ce-brainstorm/references/prd-mapping.md +71 -0
- package/skills/ce-brainstorm/references/product-pressure-test.md +42 -0
- package/skills/ce-brainstorm/references/reasoning-elevation.md +63 -0
- package/skills/ce-brainstorm/references/settled-decisions.md +45 -0
- package/skills/ce-brainstorm/references/synthesis-summary.md +282 -0
- package/skills/ce-brainstorm/references/universal-brainstorming.md +73 -0
- package/skills/ce-brainstorm/references/verdict-routing.md +26 -0
- package/skills/ce-brainstorm/references/visual-probes.md +158 -0
- package/skills/ce-brainstorm/scripts/visual-probe-server.js +418 -0
- package/skills/ce-compound/SKILL.md +114 -0
- package/skills/ce-compound/assets/resolution-template.md +94 -0
- package/skills/ce-compound/references/agents/best-practices-researcher.md +115 -0
- package/skills/ce-compound/references/agents/data-integrity-guardian.md +68 -0
- package/skills/ce-compound/references/agents/framework-docs-researcher.md +93 -0
- package/skills/ce-compound/references/agents/pattern-recognition-specialist.md +55 -0
- package/skills/ce-compound/references/agents/performance-oracle.md +108 -0
- package/skills/ce-compound/references/agents/security-sentinel.md +91 -0
- package/skills/ce-compound/references/agents/session-historian.md +83 -0
- package/skills/ce-compound/references/concepts-vocabulary.md +78 -0
- package/skills/ce-compound/references/full-mode-workflow.md +413 -0
- package/skills/ce-compound/references/grounding-validation.md +84 -0
- package/skills/ce-compound/references/lightweight-mode.md +53 -0
- package/skills/ce-compound/references/output-standards.md +182 -0
- package/skills/ce-compound/references/promotion-rules.md +38 -0
- package/skills/ce-compound/references/schema.yaml +231 -0
- package/skills/ce-compound/references/three-tier-index.md +55 -0
- package/skills/ce-compound/references/v0.5-upgrade.md +32 -0
- package/skills/ce-compound/references/write-flow.md +36 -0
- package/skills/ce-compound/references/yaml-schema.md +118 -0
- package/skills/ce-compound/scripts/session-history/discover-sessions.sh +130 -0
- package/skills/ce-compound/scripts/session-history/extract-errors.py +254 -0
- package/skills/ce-compound/scripts/session-history/extract-metadata.py +456 -0
- package/skills/ce-compound/scripts/session-history/extract-skeleton.py +575 -0
- package/skills/ce-compound/scripts/validate-doc-claims.py +346 -0
- package/skills/ce-compound/scripts/validate-frontmatter.py +137 -0
- package/skills/ce-ideate/SKILL.md +402 -0
- package/skills/ce-ideate/references/agents/issue-intelligence-analyst.md +200 -0
- package/skills/ce-ideate/references/agents/learnings-researcher.md +247 -0
- package/skills/ce-ideate/references/agents/slack-researcher.md +127 -0
- package/skills/ce-ideate/references/agents/web-researcher.md +121 -0
- package/skills/ce-ideate/references/divergent-ideation.md +89 -0
- package/skills/ce-ideate/references/html-rendering.md +634 -0
- package/skills/ce-ideate/references/ideation-sections.md +191 -0
- package/skills/ce-ideate/references/markdown-rendering.md +238 -0
- package/skills/ce-ideate/references/post-ideation-workflow.md +167 -0
- package/skills/ce-ideate/references/universal-ideation.md +107 -0
- package/skills/ce-ideate/references/web-research-cache.md +56 -0
- package/skills/ce-plan/SKILL.md +137 -0
- package/skills/ce-plan/references/agents/agent-native-planning-strategist.md +62 -0
- package/skills/ce-plan/references/agents/architecture-strategist.md +46 -0
- package/skills/ce-plan/references/agents/best-practices-researcher.md +114 -0
- package/skills/ce-plan/references/agents/data-integrity-guardian.md +68 -0
- package/skills/ce-plan/references/agents/data-migration-reviewer.md +103 -0
- package/skills/ce-plan/references/agents/deployment-verification-agent.md +157 -0
- package/skills/ce-plan/references/agents/framework-docs-researcher.md +93 -0
- package/skills/ce-plan/references/agents/git-history-analyzer.md +40 -0
- package/skills/ce-plan/references/agents/learnings-researcher.md +247 -0
- package/skills/ce-plan/references/agents/pattern-recognition-specialist.md +55 -0
- package/skills/ce-plan/references/agents/performance-oracle.md +108 -0
- package/skills/ce-plan/references/agents/repo-research-analyst.md +258 -0
- package/skills/ce-plan/references/agents/security-sentinel.md +91 -0
- package/skills/ce-plan/references/agents/slack-researcher.md +127 -0
- package/skills/ce-plan/references/agents/spec-flow-analyzer.md +80 -0
- package/skills/ce-plan/references/agents/web-researcher.md +121 -0
- package/skills/ce-plan/references/approach-altitude.md +55 -0
- package/skills/ce-plan/references/change-splitting.md +65 -0
- package/skills/ce-plan/references/completion-contract.md +33 -0
- package/skills/ce-plan/references/core-principles.md +40 -0
- package/skills/ce-plan/references/deepening-workflow.md +263 -0
- package/skills/ce-plan/references/dependency-graph.md +36 -0
- package/skills/ce-plan/references/html-rendering.md +634 -0
- package/skills/ce-plan/references/intake-routing.md +189 -0
- package/skills/ce-plan/references/markdown-rendering.md +238 -0
- package/skills/ce-plan/references/plan-handoff.md +150 -0
- package/skills/ce-plan/references/plan-sections.md +427 -0
- package/skills/ce-plan/references/plan-structure.md +120 -0
- package/skills/ce-plan/references/planning-modes.md +69 -0
- package/skills/ce-plan/references/reasoning-elevation.md +63 -0
- package/skills/ce-plan/references/research-workflow.md +165 -0
- package/skills/ce-plan/references/review-and-write.md +127 -0
- package/skills/ce-plan/references/settled-decisions.md +45 -0
- package/skills/ce-plan/references/synthesis-summary.md +418 -0
- package/skills/ce-plan/references/universal-planning.md +168 -0
- package/skills/ce-proof/SKILL.md +346 -0
- package/skills/ce-strategy/SKILL.md +97 -0
- package/skills/ce-strategy/references/interview.md +143 -0
- package/skills/ce-strategy/references/strategy-template.md +89 -0
- package/skills/code-reviewer/SKILL.md +84 -0
- package/skills/code-reviewer/code-reviewer-prompt.md +195 -0
- package/skills/contract-builder/SKILL.md +72 -0
- package/skills/design-system/SKILL.md +75 -0
- package/skills/design-system/references/agents/design-system-architect.md +138 -0
- package/skills/design-system/references/creation-flow.md +170 -0
- package/skills/design-system/references/preview-template.html +319 -0
- package/skills/design-system/references/token-derivation.md +115 -0
- package/skills/design-system/references/variant-schema.md +60 -0
- package/skills/e2e/SKILL.md +56 -0
- package/skills/e2e/references/test-verifier.md +40 -0
- package/skills/need-explorer/SKILL.md +79 -0
- package/skills/prototype/SKILL.md +98 -0
- package/skills/prototype/references/agents/design-system-architect.md +122 -0
- package/skills/prototype/references/checklist.md +82 -0
- package/skills/prototype/references/craft/accessibility-baseline.md +71 -0
- package/skills/prototype/references/craft/anti-ai-slop.md +87 -0
- package/skills/prototype/references/craft/laws-of-ux.md +60 -0
- package/skills/prototype/references/craft/state-coverage.md +81 -0
- package/skills/prototype/references/craft/typography-hierarchy.md +50 -0
- package/skills/prototype/references/layouts.md +223 -0
- package/skills/prototype/references/orchestration-flow.md +101 -0
- package/skills/prototype/references/prototype-scaffold/assets/design-tokens.css +19 -0
- package/skills/prototype/references/prototype-scaffold/components/button.html +3 -0
- package/skills/prototype/references/prototype-scaffold/design-system.md +7 -0
- package/skills/prototype/references/prototype-scaffold/flow.md +11 -0
- package/skills/prototype/references/prototype-scaffold/index.html +20 -0
- package/skills/prototype/references/prototype-scaffold/pages/index.html +11 -0
- package/skills/prototype/references/template.html +396 -0
- package/skills/release-archivist/SKILL.md +166 -0
- package/skills/release-archivist/references/closing-procedures.md +81 -0
- package/skills/session-handoff/SKILL.md +110 -0
- package/skills/session-handoff/references/context-extraction.md +70 -0
- package/skills/session-handoff/references/handoff-template.md +90 -0
- package/skills/session-handoff/references/skill-recommendation.md +43 -0
- package/skills/spec-merger/SKILL.md +66 -0
- package/skills/spec-writer/SKILL.md +149 -0
- package/skills/workflow-bootstrap/SKILL.md +148 -0
- package/skills/workflow-bootstrap/references/agents/codebase-recon-analyst.md +121 -0
- package/skills/workflow-bootstrap/references/b1-reconnaissance.md +80 -0
- package/skills/workflow-bootstrap/scripts/recon-probe.sh +328 -0
- package/skills/workflow-feedback/SKILL.md +120 -0
- package/skills/workflow-feedback/references/category-guide.md +121 -0
- package/skills/workflow-feedback/references/feedback-template.md +73 -0
- package/skills/workflow-feedback/references/review-mode.md +92 -0
- package/skills/workflow-orchestrator/SKILL.md +94 -0
- package/skills/workflow-orchestrator/references/feedback-loops.md +56 -0
- package/skills/workflow-orchestrator/references/s1-path-router.md +81 -0
- package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +96 -0
- package/skills/workflow-orchestrator/references/s3-plan-pipeline.md +50 -0
- package/skills/workflow-orchestrator/references/s4-split-validate.md +108 -0
- package/skills/workflow-orchestrator/references/s5-monitoring.md +61 -0
- package/skills/workflow-orchestrator/references/state-model.md +185 -0
- package/skills/workflow-start/SKILL.md +147 -0
- package/skills/workflow-start/references/routing-rules.md +155 -0
- package/src/index.ts +16 -0
- package/src/parsing/change-parser.ts +79 -0
- package/src/parsing/requirement-blocks.ts +244 -0
- package/src/schema/base.ts +8 -0
- package/src/schema/change.ts +29 -0
- package/src/schema/index.ts +3 -0
- package/src/schema/spec.ts +12 -0
- package/src/validation/constants.ts +53 -0
- package/src/validation/tokenizer.ts +180 -0
- package/src/validation/types.ts +47 -0
- package/src/validation/validator.ts +552 -0
- package/templates/abandonment-summary.md +29 -0
- package/templates/design.md +37 -0
- package/templates/execution-contract.md +99 -0
- package/templates/plan.md +86 -0
- package/templates/prd.md +468 -0
- package/templates/proposal.md +37 -0
- package/templates/spec.md +31 -0
- package/templates/tasks.md +47 -0
- package/tests/e2e.test.mjs +266 -0
- package/tests/lib/cmd-audit.test.mjs +202 -0
- package/tests/lib/cmd-checkpoint.test.mjs +98 -0
- package/tests/lib/cmd-config.test.mjs +101 -0
- package/tests/lib/cmd-doctor.test.mjs +450 -0
- package/tests/lib/cmd-execution.test.mjs +647 -0
- package/tests/lib/cmd-handoff.test.mjs +137 -0
- package/tests/lib/cmd-inject.test.mjs +218 -0
- package/tests/lib/cmd-install-workbuddy.test.mjs +113 -0
- package/tests/lib/cmd-install-zcode.test.mjs +42 -0
- package/tests/lib/cmd-isolate.test.mjs +68 -0
- package/tests/lib/cmd-list.test.mjs +127 -0
- package/tests/lib/cmd-runtime.test.mjs +83 -0
- package/tests/lib/cmd-state-missing.test.mjs +65 -0
- package/tests/lib/cmd-state.test.mjs +365 -0
- package/tests/lib/cmd-sync-paths.test.mjs +84 -0
- package/tests/lib/cmd-validate-paths.test.mjs +90 -0
- package/tests/lib/config-loader.test.mjs +175 -0
- package/tests/lib/ensure-branch.test.mjs +59 -0
- package/tests/lib/execution-control-plane.test.mjs +168 -0
- package/tests/lib/execution-plan.test.mjs +474 -0
- package/tests/lib/guard-specs-merged.test.mjs +108 -0
- package/tests/lib/guard-tests-passing.test.mjs +112 -0
- package/tests/lib/guard-transitions.test.mjs +262 -0
- package/tests/lib/guard.test.mjs +611 -0
- package/tests/lib/hash.test.mjs +138 -0
- package/tests/lib/infer-workflow.test.mjs +161 -0
- package/tests/lib/install-git-hooks.test.mjs +20 -0
- package/tests/lib/marketplace-release-docs.test.mjs +31 -0
- package/tests/lib/minimality-discipline.test.mjs +37 -0
- package/tests/lib/model-profiles-docs.test.mjs +33 -0
- package/tests/lib/node20-compatibility.test.mjs +73 -0
- package/tests/lib/node20-test-entry.test.mjs +17 -0
- package/tests/lib/platform-runtime-distribution.test.mjs +150 -0
- package/tests/lib/raw-mode-smoke.test.mjs +42 -0
- package/tests/lib/sdd-overlay.test.mjs +118 -0
- package/tests/lib/spec-paths.test.mjs +80 -0
- package/tests/lib/state-loader.test.mjs +251 -0
- package/tests/lib/token-baseline.test.mjs +72 -0
- package/tests/lib/token-rules.test.mjs +94 -0
- package/tests/lib/verify-marketplace-release.test.mjs +128 -0
- package/tests/tsconfig.json +12 -0
- package/token-baseline.json +95 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { tmpdir } from 'node:os';
|
|
7
|
+
import {
|
|
8
|
+
createPlan as createRawPlan, readPlan, recordReview, validatePlan, writePlan,
|
|
9
|
+
} from '../../scripts/lib/execution-plan.mjs';
|
|
10
|
+
import { createRecommendationReceipt, recommendExecutionModes } from '../../scripts/lib/execution-recommendation.mjs';
|
|
11
|
+
import { readState } from '../../scripts/lib/state-loader.mjs';
|
|
12
|
+
|
|
13
|
+
let changeDir;
|
|
14
|
+
let gitRefs;
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
changeDir = mkdtempSync(join(tmpdir(), 'execution-plan-'));
|
|
18
|
+
writeFileSync(join(changeDir, 'tasks.md'), '# Tasks\n\n- [ ] 1.1 First task\n- [ ] 1.2 Second task\n');
|
|
19
|
+
writeFileSync(join(changeDir, 'execution-contract.md'), '# Execution Contract\n\nCurrent contract.\n');
|
|
20
|
+
writeFileSync(join(changeDir, '.team-flow.yaml'), 'state: approved-for-build\nworkflow: full\nrevision: 2\n');
|
|
21
|
+
gitRefs = initializeGitRepository(changeDir);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
rmSync(changeDir, { recursive: true, force: true });
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function writeReviewReport(name, content = 'Review completed without blocking findings.\n') {
|
|
29
|
+
const reportsDir = join(changeDir, '.superpowers', 'sdd', 'reviews');
|
|
30
|
+
mkdirSync(reportsDir, { recursive: true });
|
|
31
|
+
const reportPath = join(reportsDir, name);
|
|
32
|
+
writeFileSync(reportPath, content);
|
|
33
|
+
return reportPath;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function runGit(directory, args) {
|
|
37
|
+
return execFileSync('git', args, { cwd: directory, encoding: 'utf8' }).trim();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function initializeGitRepository(directory) {
|
|
41
|
+
runGit(directory, ['init', '--quiet']);
|
|
42
|
+
runGit(directory, ['config', 'user.email', 'tests@example.invalid']);
|
|
43
|
+
runGit(directory, ['config', 'user.name', 'Execution Plan Test']);
|
|
44
|
+
runGit(directory, ['add', '--all']);
|
|
45
|
+
runGit(directory, ['commit', '--quiet', '--message', 'initial execution plan change']);
|
|
46
|
+
const base = runGit(directory, ['rev-parse', 'HEAD']);
|
|
47
|
+
writeFileSync(join(directory, 'git-range-marker.txt'), 'second commit\n');
|
|
48
|
+
runGit(directory, ['add', 'git-range-marker.txt']);
|
|
49
|
+
runGit(directory, ['commit', '--quiet', '--message', 'second execution plan change']);
|
|
50
|
+
return { base, head: runGit(directory, ['rev-parse', 'HEAD']) };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function createPlan(directory, input) {
|
|
54
|
+
const receipt = input.recommendationReceipt ?? createRecommendationReceipt(directory, input.waves);
|
|
55
|
+
const recommendation = input.recommendation ?? receipt.recommendation;
|
|
56
|
+
const followedRecommendation = input.mode === recommendation.recommendation.mode;
|
|
57
|
+
return createRawPlan(directory, {
|
|
58
|
+
...input,
|
|
59
|
+
source: input.source === 'default' ? 'user-confirmed' : input.source,
|
|
60
|
+
recommendation,
|
|
61
|
+
recommendationReceipt: receipt,
|
|
62
|
+
selection: input.selection ?? {
|
|
63
|
+
confirmed: true,
|
|
64
|
+
followed_recommendation: followedRecommendation,
|
|
65
|
+
acknowledged_non_recommendation: !followedRecommendation,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
describe('execution plan data contract', () => {
|
|
71
|
+
it('recommends inline for one small sequential task', () => {
|
|
72
|
+
const result = recommendExecutionModes({
|
|
73
|
+
workflow: 'full',
|
|
74
|
+
taskCount: 1,
|
|
75
|
+
inlineThreshold: 3,
|
|
76
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
assert.deepEqual(result.available_modes, ['inline', 'batch-inline', 'sdd']);
|
|
80
|
+
assert.equal(result.recommendation.mode, 'inline');
|
|
81
|
+
assert.match(result.recommendation.reasons.join('\n'), /single sequential task/i);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('recommends batch-inline for a bounded sequential batch', () => {
|
|
85
|
+
const result = recommendExecutionModes({
|
|
86
|
+
workflow: 'hotfix',
|
|
87
|
+
taskCount: 3,
|
|
88
|
+
inlineThreshold: 3,
|
|
89
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1', '1.2', '1.3'], depends_on: [] }],
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
assert.equal(result.recommendation.mode, 'batch-inline');
|
|
93
|
+
assert.match(result.recommendation.reasons.join('\n'), /within.*threshold/i);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('recommends SDD for independent parallel work', () => {
|
|
97
|
+
const result = recommendExecutionModes({
|
|
98
|
+
workflow: 'full',
|
|
99
|
+
taskCount: 2,
|
|
100
|
+
inlineThreshold: 3,
|
|
101
|
+
waves: [{ id: 'foundation', strategy: 'parallel', tasks: ['1.1', '1.2'], depends_on: [] }],
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
assert.equal(result.recommendation.mode, 'sdd');
|
|
105
|
+
assert.match(result.recommendation.reasons.join('\n'), /parallel/i);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('limits tweak recommendations to direct inline execution', () => {
|
|
109
|
+
const result = recommendExecutionModes({ workflow: 'tweak', taskCount: 2, inlineThreshold: 3, waves: [] });
|
|
110
|
+
|
|
111
|
+
assert.deepEqual(result.available_modes, ['inline']);
|
|
112
|
+
assert.equal(result.recommendation.mode, 'inline');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('creates a current SDD plan with an auditable parallel wave', () => {
|
|
116
|
+
const plan = createPlan(changeDir, {
|
|
117
|
+
mode: 'sdd',
|
|
118
|
+
source: 'default',
|
|
119
|
+
rationale: 'full workflow default',
|
|
120
|
+
waves: [{ id: 'wave-1', strategy: 'parallel', tasks: ['1.1', '1.2'], depends_on: [] }],
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
writePlan(changeDir, plan);
|
|
124
|
+
const result = validatePlan(changeDir, readPlan(changeDir));
|
|
125
|
+
|
|
126
|
+
assert.equal(result.valid, true, result.failures.join('\n'));
|
|
127
|
+
assert.equal(result.plan.mode, 'sdd');
|
|
128
|
+
assert.equal(readState(changeDir).execution_plan_hash, plan.hash);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('preserves a user-confirmed non-recommended selection in the plan hash', () => {
|
|
132
|
+
const plan = createPlan(changeDir, {
|
|
133
|
+
mode: 'inline',
|
|
134
|
+
source: 'user-confirmed',
|
|
135
|
+
rationale: 'operator accepts the serial execution risk',
|
|
136
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1', '1.2'], depends_on: [] }],
|
|
137
|
+
recommendation: {
|
|
138
|
+
available_modes: ['inline', 'batch-inline', 'sdd'],
|
|
139
|
+
recommendation: { mode: 'batch-inline', reasons: ['Two tasks are within the threshold.'] },
|
|
140
|
+
facts: { workflow: 'full' },
|
|
141
|
+
},
|
|
142
|
+
selection: {
|
|
143
|
+
confirmed: true,
|
|
144
|
+
followed_recommendation: false,
|
|
145
|
+
acknowledged_non_recommendation: true,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
assert.equal(plan.selection.acknowledged_non_recommendation, true);
|
|
150
|
+
assert.equal(plan.recommendation.recommendation.mode, 'batch-inline');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('invalidates a legacy full plan without recommendation and confirmation evidence', () => {
|
|
154
|
+
const plan = createRawPlan(changeDir, {
|
|
155
|
+
mode: 'sdd',
|
|
156
|
+
source: 'legacy',
|
|
157
|
+
rationale: 'legacy execution plan',
|
|
158
|
+
waves: [{ id: 'wave-1', strategy: 'parallel', tasks: ['1.1', '1.2'], depends_on: [] }],
|
|
159
|
+
});
|
|
160
|
+
writePlan(changeDir, plan);
|
|
161
|
+
|
|
162
|
+
const result = validatePlan(changeDir, readPlan(changeDir));
|
|
163
|
+
|
|
164
|
+
assert.equal(result.valid, false);
|
|
165
|
+
assert.match(result.failures.join('\n'), /recommendation.*required|selection.*required/i);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('invalidates a revision whose recommendation skips the immediately prior plan', () => {
|
|
169
|
+
const first = createPlan(changeDir, {
|
|
170
|
+
mode: 'sdd',
|
|
171
|
+
source: 'user-confirmed',
|
|
172
|
+
rationale: 'initial execution plan',
|
|
173
|
+
waves: [{ id: 'wave-1', strategy: 'parallel', tasks: ['1.1', '1.2'], depends_on: [] }],
|
|
174
|
+
});
|
|
175
|
+
writePlan(changeDir, first);
|
|
176
|
+
writeFileSync(join(changeDir, '.team-flow.yaml'), readFileSync(join(changeDir, '.team-flow.yaml'), 'utf8')
|
|
177
|
+
.replace(/^revision:.*$/m, 'revision: 4'));
|
|
178
|
+
const receipt = createRecommendationReceipt(changeDir, first.waves);
|
|
179
|
+
const revised = createRawPlan(changeDir, {
|
|
180
|
+
mode: 'sdd',
|
|
181
|
+
source: 'user-confirmed-revision',
|
|
182
|
+
rationale: 'skips an execution plan revision',
|
|
183
|
+
waves: first.waves,
|
|
184
|
+
revision: 4,
|
|
185
|
+
recommendation: receipt.recommendation,
|
|
186
|
+
recommendationReceipt: receipt,
|
|
187
|
+
selection: {
|
|
188
|
+
confirmed: true,
|
|
189
|
+
followed_recommendation: true,
|
|
190
|
+
acknowledged_non_recommendation: false,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
writePlan(changeDir, revised);
|
|
194
|
+
|
|
195
|
+
const result = validatePlan(changeDir, readPlan(changeDir));
|
|
196
|
+
|
|
197
|
+
assert.equal(result.valid, false);
|
|
198
|
+
assert.match(result.failures.join('\n'), /recommendation receipt.*prior|recommendation.*revision/i);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('rejects parallel waves with self and unknown dependencies', () => {
|
|
202
|
+
assert.throws(() => createPlan(changeDir, {
|
|
203
|
+
mode: 'sdd',
|
|
204
|
+
source: 'default',
|
|
205
|
+
rationale: 'invalid dependencies',
|
|
206
|
+
waves: [{ id: 'wave-1', strategy: 'parallel', tasks: ['1.1'], depends_on: ['wave-1'] }],
|
|
207
|
+
}), /cannot depend on itself/);
|
|
208
|
+
|
|
209
|
+
assert.throws(() => createPlan(changeDir, {
|
|
210
|
+
mode: 'sdd',
|
|
211
|
+
source: 'default',
|
|
212
|
+
rationale: 'invalid dependencies',
|
|
213
|
+
waves: [{ id: 'wave-1', strategy: 'parallel', tasks: ['1.1'], depends_on: ['missing'] }],
|
|
214
|
+
}), /unknown wave/);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('rejects dependency cycles and duplicate task IDs in any wave', () => {
|
|
218
|
+
assert.throws(() => createPlan(changeDir, {
|
|
219
|
+
mode: 'sdd',
|
|
220
|
+
source: 'default',
|
|
221
|
+
rationale: 'cyclic dependencies',
|
|
222
|
+
waves: [
|
|
223
|
+
{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: ['wave-2'] },
|
|
224
|
+
{ id: 'wave-2', strategy: 'serial', tasks: ['1.2'], depends_on: ['wave-1'] },
|
|
225
|
+
],
|
|
226
|
+
}), /dependency cycle/);
|
|
227
|
+
|
|
228
|
+
assert.throws(() => createPlan(changeDir, {
|
|
229
|
+
mode: 'sdd',
|
|
230
|
+
source: 'default',
|
|
231
|
+
rationale: 'duplicate parallel task',
|
|
232
|
+
waves: [{ id: 'wave-1', strategy: 'parallel', tasks: ['1.1', '1.1'], depends_on: [] }],
|
|
233
|
+
}), /duplicate tasks/);
|
|
234
|
+
|
|
235
|
+
assert.throws(() => createPlan(changeDir, {
|
|
236
|
+
mode: 'sdd',
|
|
237
|
+
source: 'default',
|
|
238
|
+
rationale: 'duplicate task across waves',
|
|
239
|
+
waves: [
|
|
240
|
+
{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] },
|
|
241
|
+
{ id: 'wave-2', strategy: 'parallel', tasks: ['1.1', '1.2'], depends_on: [] },
|
|
242
|
+
],
|
|
243
|
+
}), /duplicate task.*1\.1/i);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
it('changes the plan hash when plan content changes', () => {
|
|
247
|
+
const first = createPlan(changeDir, {
|
|
248
|
+
mode: 'sdd', source: 'default', rationale: 'first rationale',
|
|
249
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
250
|
+
});
|
|
251
|
+
const second = createPlan(changeDir, {
|
|
252
|
+
mode: 'sdd', source: 'default', rationale: 'second rationale',
|
|
253
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
assert.notEqual(first.hash, second.hash);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('marks a plan stale after its frozen artifacts change', () => {
|
|
260
|
+
const plan = createPlan(changeDir, {
|
|
261
|
+
mode: 'sdd', source: 'default', rationale: 'freeze current artifacts',
|
|
262
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
263
|
+
});
|
|
264
|
+
writePlan(changeDir, plan);
|
|
265
|
+
writeFileSync(join(changeDir, 'tasks.md'), '# Tasks\n\n- [ ] 1.1 Changed task\n');
|
|
266
|
+
|
|
267
|
+
const result = validatePlan(changeDir, readPlan(changeDir));
|
|
268
|
+
|
|
269
|
+
assert.equal(result.valid, false);
|
|
270
|
+
assert.ok(result.failures.includes('execution plan is stale: artifacts hash mismatch'));
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('marks a plan stale after its frozen contract changes', () => {
|
|
274
|
+
const plan = createPlan(changeDir, {
|
|
275
|
+
mode: 'sdd', source: 'default', rationale: 'freeze current contract',
|
|
276
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
277
|
+
});
|
|
278
|
+
writePlan(changeDir, plan);
|
|
279
|
+
writeFileSync(join(changeDir, 'execution-contract.md'), '# Execution Contract\n\nChanged contract.\n');
|
|
280
|
+
|
|
281
|
+
const result = validatePlan(changeDir, readPlan(changeDir));
|
|
282
|
+
|
|
283
|
+
assert.equal(result.valid, false);
|
|
284
|
+
assert.ok(result.failures.includes('execution plan is stale: contract hash mismatch'));
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it('marks a plan stale when the state revision changes', () => {
|
|
288
|
+
const plan = createPlan(changeDir, {
|
|
289
|
+
mode: 'sdd', source: 'default', rationale: 'freeze current revision',
|
|
290
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
291
|
+
});
|
|
292
|
+
writePlan(changeDir, plan);
|
|
293
|
+
writeFileSync(join(changeDir, '.team-flow.yaml'), [
|
|
294
|
+
'state: approved-for-build',
|
|
295
|
+
'workflow: full',
|
|
296
|
+
'revision: 3',
|
|
297
|
+
`execution_plan_hash: ${plan.hash}`,
|
|
298
|
+
'',
|
|
299
|
+
].join('\n'));
|
|
300
|
+
|
|
301
|
+
const result = validatePlan(changeDir, readPlan(changeDir));
|
|
302
|
+
|
|
303
|
+
assert.equal(result.valid, false);
|
|
304
|
+
assert.ok(result.failures.includes('execution plan revision does not match state'));
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it('rejects a persisted plan when its state plan revision is deleted or differs', () => {
|
|
308
|
+
const plan = createPlan(changeDir, {
|
|
309
|
+
mode: 'sdd', source: 'default', rationale: 'freeze persisted plan revision',
|
|
310
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
311
|
+
});
|
|
312
|
+
writePlan(changeDir, plan);
|
|
313
|
+
|
|
314
|
+
const stateVariants = [
|
|
315
|
+
[
|
|
316
|
+
'state: approved-for-build',
|
|
317
|
+
'workflow: full',
|
|
318
|
+
'revision: 2',
|
|
319
|
+
`execution_plan_hash: ${plan.hash}`,
|
|
320
|
+
],
|
|
321
|
+
[
|
|
322
|
+
'state: approved-for-build',
|
|
323
|
+
'workflow: full',
|
|
324
|
+
'revision: 2',
|
|
325
|
+
`execution_plan_hash: ${plan.hash}`,
|
|
326
|
+
'execution_plan_revision: null',
|
|
327
|
+
],
|
|
328
|
+
[
|
|
329
|
+
'state: approved-for-build',
|
|
330
|
+
'workflow: full',
|
|
331
|
+
'revision: 2',
|
|
332
|
+
`execution_plan_hash: ${plan.hash}`,
|
|
333
|
+
'execution_plan_revision:',
|
|
334
|
+
],
|
|
335
|
+
[
|
|
336
|
+
'state: approved-for-build',
|
|
337
|
+
'workflow: full',
|
|
338
|
+
'revision: 2',
|
|
339
|
+
`execution_plan_hash: ${plan.hash}`,
|
|
340
|
+
'execution_plan_revision: 3',
|
|
341
|
+
],
|
|
342
|
+
];
|
|
343
|
+
|
|
344
|
+
for (const state of stateVariants) {
|
|
345
|
+
writeFileSync(join(changeDir, '.team-flow.yaml'), `${state.join('\n')}\n`);
|
|
346
|
+
const result = validatePlan(changeDir, readPlan(changeDir));
|
|
347
|
+
assert.equal(result.valid, false);
|
|
348
|
+
assert.ok(result.failures.includes('execution plan revision does not match state'));
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it('records review receipts only for known waves', () => {
|
|
353
|
+
const plan = createPlan(changeDir, {
|
|
354
|
+
mode: 'sdd', source: 'default', rationale: 'review gate',
|
|
355
|
+
waves: [{ id: 'wave-1', strategy: 'parallel', tasks: ['1.1', '1.2'], depends_on: [] }],
|
|
356
|
+
});
|
|
357
|
+
writePlan(changeDir, plan);
|
|
358
|
+
|
|
359
|
+
const reportPath = writeReviewReport('wave-1.md');
|
|
360
|
+
const receipt = recordReview(changeDir, 'wave-1', {
|
|
361
|
+
status: 'pass', base: gitRefs.base, head: gitRefs.head, report: reportPath,
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
assert.equal(receipt.status, 'pass');
|
|
365
|
+
assert.ok(receipt.recorded_at);
|
|
366
|
+
const reviewsDir = join(changeDir, '.superpowers', 'sdd', 'reviews');
|
|
367
|
+
const receiptFiles = readdirSync(reviewsDir).filter(fileName => fileName.endsWith('.json'));
|
|
368
|
+
assert.equal(receiptFiles.length, 1);
|
|
369
|
+
assert.deepEqual(
|
|
370
|
+
JSON.parse(readFileSync(join(reviewsDir, receiptFiles[0]), 'utf8')),
|
|
371
|
+
receipt,
|
|
372
|
+
);
|
|
373
|
+
assert.throws(
|
|
374
|
+
() => recordReview(changeDir, 'unknown-wave', {
|
|
375
|
+
status: 'pass', base: gitRefs.base, head: gitRefs.head, report: reportPath,
|
|
376
|
+
}),
|
|
377
|
+
/unknown wave/,
|
|
378
|
+
);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('persists receipts independently for wave IDs with encoded-name collisions', () => {
|
|
382
|
+
const plan = createPlan(changeDir, {
|
|
383
|
+
mode: 'sdd', source: 'default', rationale: 'review receipt naming',
|
|
384
|
+
waves: [
|
|
385
|
+
{ id: 'a%', strategy: 'serial', tasks: ['1.1'], depends_on: [] },
|
|
386
|
+
{ id: 'a_25', strategy: 'serial', tasks: ['1.2'], depends_on: ['a%'] },
|
|
387
|
+
],
|
|
388
|
+
});
|
|
389
|
+
writePlan(changeDir, plan);
|
|
390
|
+
|
|
391
|
+
const percentReport = writeReviewReport('percent.md', 'Percent wave passed.\n');
|
|
392
|
+
const underscoreReport = writeReviewReport('underscore.md', 'Underscore wave failed.\n');
|
|
393
|
+
recordReview(changeDir, 'a%', {
|
|
394
|
+
status: 'pass', base: gitRefs.base, head: gitRefs.head, report: percentReport,
|
|
395
|
+
});
|
|
396
|
+
recordReview(changeDir, 'a_25', {
|
|
397
|
+
status: 'fail', base: gitRefs.base, head: gitRefs.head, report: underscoreReport,
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
const reviewsDir = join(changeDir, '.superpowers', 'sdd', 'reviews');
|
|
401
|
+
const receipts = readdirSync(reviewsDir)
|
|
402
|
+
.filter(fileName => fileName.endsWith('.json'))
|
|
403
|
+
.sort()
|
|
404
|
+
.map(fileName => JSON.parse(readFileSync(join(reviewsDir, fileName), 'utf8')));
|
|
405
|
+
assert.equal(receipts.length, 2);
|
|
406
|
+
assert.ok(receipts.some(receipt => receipt.report === join('.superpowers', 'sdd', 'reviews', 'percent.md')));
|
|
407
|
+
assert.ok(receipts.some(receipt => receipt.report === join('.superpowers', 'sdd', 'reviews', 'underscore.md')));
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
it('rejects missing, non-file, empty, and symbolic-link report evidence before writing a receipt', () => {
|
|
411
|
+
const plan = createPlan(changeDir, {
|
|
412
|
+
mode: 'sdd', source: 'default', rationale: 'review evidence must be durable',
|
|
413
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
414
|
+
});
|
|
415
|
+
writePlan(changeDir, plan);
|
|
416
|
+
|
|
417
|
+
const reportsDir = join(changeDir, '.superpowers', 'sdd', 'reviews');
|
|
418
|
+
mkdirSync(reportsDir, { recursive: true });
|
|
419
|
+
const emptyReport = join(reportsDir, 'empty.md');
|
|
420
|
+
const directoryReport = join(reportsDir, 'directory');
|
|
421
|
+
const validReport = writeReviewReport('valid.md');
|
|
422
|
+
const symlinkReport = join(reportsDir, 'symlink.md');
|
|
423
|
+
writeFileSync(emptyReport, '');
|
|
424
|
+
mkdirSync(directoryReport);
|
|
425
|
+
symlinkSync(validReport, symlinkReport);
|
|
426
|
+
|
|
427
|
+
for (const report of [
|
|
428
|
+
join(reportsDir, 'missing.md'),
|
|
429
|
+
directoryReport,
|
|
430
|
+
emptyReport,
|
|
431
|
+
symlinkReport,
|
|
432
|
+
]) {
|
|
433
|
+
assert.throws(() => recordReview(changeDir, 'wave-1', {
|
|
434
|
+
status: 'pass', base: gitRefs.base, head: gitRefs.head, report,
|
|
435
|
+
}), /report evidence|review report/i);
|
|
436
|
+
assert.equal(lstatSync(join(reportsDir, 'valid.md')).isFile(), true);
|
|
437
|
+
assert.equal(readdirSync(reportsDir).filter(fileName => fileName.endsWith('.json')).length, 0);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('preserves a legitimate review report path in the receipt', () => {
|
|
442
|
+
const plan = createPlan(changeDir, {
|
|
443
|
+
mode: 'sdd', source: 'default', rationale: 'retain report path for audit',
|
|
444
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: [] }],
|
|
445
|
+
});
|
|
446
|
+
writePlan(changeDir, plan);
|
|
447
|
+
const reportPath = writeReviewReport('audit.md');
|
|
448
|
+
|
|
449
|
+
const receipt = recordReview(changeDir, 'wave-1', {
|
|
450
|
+
status: 'pass', base: gitRefs.base, head: gitRefs.head, report: reportPath,
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
assert.equal(receipt.report, join('.superpowers', 'sdd', 'reviews', 'audit.md'));
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
it('returns validation failures instead of throwing for malformed plans', () => {
|
|
457
|
+
const result = validatePlan(changeDir, { mode: 'sdd', waves: 'not-an-array' });
|
|
458
|
+
|
|
459
|
+
assert.equal(result.valid, false);
|
|
460
|
+
assert.ok(result.failures.length > 0);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it('returns validation failures for malformed dependency data', () => {
|
|
464
|
+
const result = validatePlan(changeDir, {
|
|
465
|
+
mode: 'sdd',
|
|
466
|
+
source: 'default',
|
|
467
|
+
rationale: 'malformed dependency input',
|
|
468
|
+
waves: [{ id: 'wave-1', strategy: 'serial', tasks: ['1.1'], depends_on: {} }],
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
assert.equal(result.valid, false);
|
|
472
|
+
assert.ok(result.failures.includes('wave 1 depends_on must be an array'));
|
|
473
|
+
});
|
|
474
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// tests/lib/guard-specs-merged.test.mjs
|
|
2
|
+
// Regression for #28: `executing → closing` must be blocked while delta specs
|
|
3
|
+
// exist but spec-merger has not run (spec_merged not recorded).
|
|
4
|
+
|
|
5
|
+
import { describe, it, before, after } from 'node:test';
|
|
6
|
+
import assert from 'node:assert/strict';
|
|
7
|
+
import { execFileSync } from 'node:child_process';
|
|
8
|
+
import { mkdtempSync, writeFileSync, rmSync, mkdirSync, existsSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { tmpdir } from 'node:os';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import { dirname } from 'node:path';
|
|
13
|
+
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const ROOT = join(__dirname, '..', '..');
|
|
16
|
+
const GUARD = join(ROOT, 'scripts', 'guard', 'guard.mjs');
|
|
17
|
+
const CLI = join(ROOT, 'scripts', 'team-flow.mjs');
|
|
18
|
+
|
|
19
|
+
function makeChangeDir(withDelta) {
|
|
20
|
+
const dir = mkdtempSync(join(tmpdir(), 'tf-specs-merged-'));
|
|
21
|
+
mkdirSync(join(dir, 'specs'), { recursive: true });
|
|
22
|
+
writeFileSync(join(dir, 'proposal.md'), '# Test\n\n## Why\nTest.\n\n## What Changes\n- Test.\n');
|
|
23
|
+
writeFileSync(join(dir, 'design.md'), '# Design\n\n## Context\nTest.\n\n## Goals\nTest.\n\n## Decisions\n\n### Decision 1\n- Choice: Test\n- Rationale: Test\n\n## Risks And Trade-Offs\nNone.\n');
|
|
24
|
+
writeFileSync(join(dir, 'tasks.md'), '# Tasks\n\n- [x] Task 1\n- [x] Task 2\n');
|
|
25
|
+
writeFileSync(join(dir, 'execution-contract.md'), '# Execution Contract\n\n## Intent Lock\nTest.\n');
|
|
26
|
+
const specsContent = withDelta
|
|
27
|
+
? '## ADDED Requirements\n\n### Requirement: New\n\nThe system SHALL do new.\n\n#### Scenario: New\n- **WHEN** x\n- **THEN** y\n'
|
|
28
|
+
: '## Requirements\n\n### Requirement: Existing\n\nThe system SHALL exist.\n\n#### Scenario: Existing\n- **WHEN** a\n- **THEN** b\n';
|
|
29
|
+
writeFileSync(join(dir, 'specs', 'test.md'), specsContent);
|
|
30
|
+
initializeGitRepository(dir);
|
|
31
|
+
return dir;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function runGit(directory, args) {
|
|
35
|
+
return execFileSync('git', args, { cwd: directory, encoding: 'utf8' }).trim();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function initializeGitRepository(directory) {
|
|
39
|
+
runGit(directory, ['init', '--quiet']);
|
|
40
|
+
runGit(directory, ['config', 'user.email', 'tests@example.invalid']);
|
|
41
|
+
runGit(directory, ['config', 'user.name', 'Guard Specs Merged Test']);
|
|
42
|
+
runGit(directory, ['add', '--all']);
|
|
43
|
+
runGit(directory, ['commit', '--quiet', '--message', 'initial closing guard change']);
|
|
44
|
+
const base = runGit(directory, ['rev-parse', 'HEAD']);
|
|
45
|
+
writeFileSync(join(directory, 'git-range-marker.txt'), 'second commit\n');
|
|
46
|
+
runGit(directory, ['add', 'git-range-marker.txt']);
|
|
47
|
+
runGit(directory, ['commit', '--quiet', '--message', 'second closing guard change']);
|
|
48
|
+
return { base, head: runGit(directory, ['rev-parse', 'HEAD']) };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function cleanup(dir) {
|
|
52
|
+
if (existsSync(dir)) rmSync(dir, { recursive: true, force: true });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function runClosingGuard(dir, extraState = '') {
|
|
56
|
+
try {
|
|
57
|
+
rmSync(join(dir, '.superpowers'), { recursive: true, force: true });
|
|
58
|
+
writeFileSync(
|
|
59
|
+
join(dir, '.team-flow.yaml'),
|
|
60
|
+
`state: executing\nworkflow: full\nchange_name: test\ndp_6_result: pass: ok\n${extraState}`,
|
|
61
|
+
);
|
|
62
|
+
execFileSync('node', [CLI, 'execution', 'recommend', dir,
|
|
63
|
+
'--wave', 'close:serial:1.1'], { stdio: 'pipe', timeout: 5000 });
|
|
64
|
+
execFileSync('node', [CLI, 'execution', 'plan', dir, '--mode', 'sdd',
|
|
65
|
+
'--confirm', '--acknowledge-recommendation', '--reason', 'closing guard regression fixture',
|
|
66
|
+
'--wave', 'close:serial:1.1'], { stdio: 'pipe', timeout: 5000 });
|
|
67
|
+
const report = join(dir, '.superpowers', 'sdd', 'reviews', 'close-review.md');
|
|
68
|
+
mkdirSync(join(dir, '.superpowers', 'sdd', 'reviews'), { recursive: true });
|
|
69
|
+
writeFileSync(report, 'review passed\n');
|
|
70
|
+
const base = execFileSync('git', ['rev-parse', 'HEAD~1'], { cwd: dir, encoding: 'utf8' }).trim();
|
|
71
|
+
const head = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: dir, encoding: 'utf8' }).trim();
|
|
72
|
+
execFileSync('node', [CLI, 'execution', 'review', dir, '--wave', 'close',
|
|
73
|
+
'--base', base, '--head', head, '--report', report, '--verdict', 'pass'], { stdio: 'pipe', timeout: 5000 });
|
|
74
|
+
execFileSync('node', [GUARD, 'check', dir, 'executing', 'closing', '--json'], { stdio: 'pipe', timeout: 5000 });
|
|
75
|
+
return { ok: true, out: '' };
|
|
76
|
+
} catch (e) {
|
|
77
|
+
const out = `${e.stdout?.toString() || ''}\n${e.stderr?.toString() || ''}`;
|
|
78
|
+
return { ok: false, out: out || e.message };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
describe('BUG/#28: spec-merger gate before closing', () => {
|
|
83
|
+
let noDeltaDir, deltaDir;
|
|
84
|
+
before(() => {
|
|
85
|
+
noDeltaDir = makeChangeDir(false);
|
|
86
|
+
deltaDir = makeChangeDir(true);
|
|
87
|
+
});
|
|
88
|
+
after(() => {
|
|
89
|
+
cleanup(noDeltaDir);
|
|
90
|
+
cleanup(deltaDir);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('SHALL allow closing when there are no delta specs', () => {
|
|
94
|
+
const r = runClosingGuard(noDeltaDir);
|
|
95
|
+
assert.equal(r.ok, true, `closing should be allowed without delta specs, got: ${r.out}`);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('SHALL block closing when delta specs exist but spec-merger has not run', () => {
|
|
99
|
+
const r = runClosingGuard(deltaDir);
|
|
100
|
+
assert.equal(r.ok, false, 'closing must be blocked until delta specs are merged');
|
|
101
|
+
assert.match(r.out, /spec-merger|spec_merged|delta specs/i);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('SHALL allow closing when spec_merged is recorded', () => {
|
|
105
|
+
const r = runClosingGuard(deltaDir, 'spec_merged: true\n');
|
|
106
|
+
assert.equal(r.ok, true, `closing should be allowed once spec_merged=true, got: ${r.out}`);
|
|
107
|
+
});
|
|
108
|
+
});
|