create-yss-spec 2.2.2 → 2.2.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/README.md +17 -1
- package/package.json +1 -1
- package/src/cli.js +15 -1
- package/src/self-update.js +277 -0
- package/template/.agents/skills/yss-domain/SKILL.md +5 -4
- package/template/.agents/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.agents/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.agents/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.agents/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.agents/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.agents/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.agents/skills/yss-router/SKILL.md +5 -3
- package/template/.agents/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.agents/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.agents/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.agents/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.agents/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.agents/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.agents/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.agents/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.agents/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.agents/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.agents/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.agents/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.agents/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.agents/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.agents/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.agents/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.agents/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.agents/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.agents/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.agents/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.agents/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.agents/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.agents/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.agents/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.agents/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.agents/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.agents/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.agents/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.agents/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.agents/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.agents/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/.claude/skills/yss-domain/SKILL.md +5 -4
- package/template/.claude/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.claude/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.claude/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.claude/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.claude/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.claude/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.claude/skills/yss-router/SKILL.md +5 -3
- package/template/.claude/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.claude/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.claude/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.claude/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.claude/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.claude/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.claude/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.claude/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.claude/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.claude/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.claude/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.claude/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.claude/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.claude/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.claude/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.claude/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.claude/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.claude/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.claude/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.claude/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.claude/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.claude/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.claude/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.claude/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.claude/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.claude/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.claude/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.claude/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.claude/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.claude/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.claude/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/.codex/skills/yss-domain/SKILL.md +5 -4
- package/template/.codex/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.codex/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.codex/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.codex/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.codex/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.codex/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.codex/skills/yss-router/SKILL.md +5 -3
- package/template/.codex/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.codex/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.codex/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.codex/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.codex/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.codex/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.codex/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.codex/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.codex/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.codex/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.codex/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.codex/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.codex/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.codex/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.codex/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.codex/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.codex/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.codex/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.codex/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.codex/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.codex/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.codex/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.codex/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.codex/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.codex/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.codex/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.codex/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.codex/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.codex/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.codex/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.codex/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/.cursor/skills/yss-domain/SKILL.md +5 -4
- package/template/.cursor/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.cursor/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.cursor/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.cursor/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.cursor/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.cursor/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.cursor/skills/yss-router/SKILL.md +5 -3
- package/template/.cursor/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.cursor/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.cursor/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.cursor/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.cursor/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.cursor/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.cursor/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.cursor/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.cursor/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.cursor/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.cursor/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.cursor/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.cursor/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.cursor/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.cursor/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.cursor/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.cursor/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.cursor/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.cursor/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.cursor/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.cursor/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.cursor/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.cursor/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.cursor/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.cursor/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.cursor/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.cursor/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.cursor/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.cursor/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.cursor/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.cursor/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/.hermes/skills/yss-domain/SKILL.md +5 -4
- package/template/.hermes/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.hermes/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.hermes/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.hermes/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.hermes/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.hermes/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.hermes/skills/yss-router/SKILL.md +5 -3
- package/template/.hermes/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.hermes/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.hermes/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.hermes/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.hermes/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.hermes/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.hermes/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.hermes/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.hermes/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.hermes/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.hermes/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.hermes/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.hermes/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.hermes/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.hermes/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.hermes/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.hermes/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.hermes/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.hermes/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.hermes/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.hermes/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.hermes/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.hermes/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.hermes/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.hermes/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.hermes/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.hermes/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.hermes/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.hermes/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.hermes/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.hermes/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/.pi/skills/yss-domain/SKILL.md +5 -4
- package/template/.pi/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.pi/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.pi/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.pi/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.pi/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.pi/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.pi/skills/yss-router/SKILL.md +5 -3
- package/template/.pi/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.pi/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.pi/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.pi/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.pi/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.pi/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.pi/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.pi/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.pi/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.pi/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.pi/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.pi/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.pi/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.pi/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.pi/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.pi/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.pi/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.pi/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.pi/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.pi/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.pi/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.pi/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.pi/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.pi/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.pi/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.pi/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.pi/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.pi/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.pi/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.pi/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.pi/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/.qoder/skills/yss-domain/SKILL.md +5 -4
- package/template/.qoder/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.qoder/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.qoder/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.qoder/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.qoder/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.qoder/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.qoder/skills/yss-router/SKILL.md +5 -3
- package/template/.qoder/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.qoder/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.qoder/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.qoder/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.qoder/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.qoder/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.qoder/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.qoder/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.qoder/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.qoder/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.qoder/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.qoder/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.qoder/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.qoder/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.qoder/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.qoder/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.qoder/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.qoder/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.qoder/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.qoder/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.qoder/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.qoder/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.qoder/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.qoder/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.qoder/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.qoder/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.qoder/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.qoder/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.qoder/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.qoder/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.qoder/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/.trae/skills/yss-domain/SKILL.md +5 -4
- package/template/.trae/skills/yss-product-lifecycle/SKILL.md +9 -9
- package/template/.trae/skills/yss-product-lifecycle/references/artifact-dependencies.md +4 -0
- package/template/.trae/skills/yss-product-lifecycle/references/matt-yss-adapter.md +3 -3
- package/template/.trae/skills/yss-product-lifecycle/references/orchestration-contract.yaml +139 -4
- package/template/.trae/skills/yss-product-lifecycle/references/orchestration.md +8 -5
- package/template/.trae/skills/yss-product-lifecycle/references/state-model.md +9 -4
- package/template/.trae/skills/yss-router/SKILL.md +5 -3
- package/template/.trae/skills/yss-router/references/router-contract.yaml +18 -3
- package/template/.trae/skills/yss-router/references/slice-implementation-contract.md +59 -1
- package/template/.trae/skills/yss-stage-decision/SKILL.md +50 -0
- package/template/.trae/skills/yss-stage-decision/references/domain-strategy-contract.md +26 -0
- package/template/.trae/skills/yss-stage-decision/references/domain-strategy.schema.json +128 -0
- package/template/.trae/skills/yss-stage-decision/references/stage-decision-package-contract.md +19 -0
- package/template/.trae/skills/yss-stage-decision/references/stage-decision-package.schema.json +86 -0
- package/template/.trae/skills/yss-stage-decision/references/validation-rules.md +18 -0
- package/template/.trae/skills/yss-stage-decision/scripts/validate-domain-strategy.mjs +169 -0
- package/template/.trae/skills/yss-stage-decision/scripts/validate-stage-decision-package.mjs +100 -0
- package/template/.trae/skills/yss-stage-decision/tests/fixtures/domain-strategy-approval.yaml +15 -0
- package/template/.trae/skills/yss-stage-decision/tests/fixtures/invalid-direction.yaml +58 -0
- package/template/.trae/skills/yss-stage-decision/tests/fixtures/invalid-stage-decision-blocker.yaml +44 -0
- package/template/.trae/skills/yss-stage-decision/tests/fixtures/stage-decision-approval.yaml +15 -0
- package/template/.trae/skills/yss-stage-decision/tests/fixtures/valid-stage-decision-package.yaml +49 -0
- package/template/.trae/skills/yss-stage-decision/tests/fixtures/valid-supplier-domain.yaml +108 -0
- package/template/.trae/skills/yss-stage-decision/tests/run-scenarios.mjs +68 -0
- package/template/.trae/skills/yss-tactical-design/SKILL.md +33 -0
- package/template/.trae/skills/yss-tactical-design/agents/openai.yaml +4 -0
- package/template/.trae/skills/yss-tactical-design/references/output-template.md +28 -0
- package/template/.trae/skills/yss-tactical-design/references/tactical-design-contract.md +41 -0
- package/template/.trae/skills/yss-tactical-design/references/tactical-design.schema.json +31 -0
- package/template/.trae/skills/yss-tactical-design/references/validation-rules.md +13 -0
- package/template/.trae/skills/yss-tactical-design/scripts/validate-tactical-design.mjs +213 -0
- package/template/.trae/skills/yss-tactical-design/tests/fixtures/invalid-api-leaks-aggregate.yaml +21 -0
- package/template/.trae/skills/yss-tactical-design/tests/fixtures/invalid-missing-consistency-policy.yaml +21 -0
- package/template/.trae/skills/yss-tactical-design/tests/fixtures/invalid-missing-invariant.yaml +21 -0
- package/template/.trae/skills/yss-tactical-design/tests/fixtures/invalid-stale-upstream-ref.yaml +21 -0
- package/template/.trae/skills/yss-tactical-design/tests/fixtures/invalid-strategic-as-tactical.yaml +21 -0
- package/template/.trae/skills/yss-tactical-design/tests/fixtures/valid-tactical-design.yaml +80 -0
- package/template/.trae/skills/yss-tactical-design/tests/run-scenarios.mjs +47 -0
- package/template/AGENTS.md +8 -4
- package/template/CONTEXT.md +14 -2
- package/template/docs/agents/digital-human-roles.md +83 -0
- package/template/docs/agents/digital-human-roles.yaml +259 -0
- package/template/docs/agents/triage-labels.md +5 -5
- package/template/docs/agents/yss-skill-registry.yaml +12 -0
- package/template/docs/architecture/templates/system-overview-design-template.md +1 -0
- package/template/docs/process/lifecycle-artifact-map.md +8 -0
- package/template/docs/process/lifecycle-registry-baseline.json +11 -1
- package/template/docs/process/lifecycle-registry.yaml +46 -2
- package/template/docs/process/schemas/digital-human-task-package.schema.json +107 -0
- package/template/docs/process/schemas/lifecycle-checkpoint.schema.json +2 -1
- package/template/docs/process/schemas/subagent-task-package.schema.json +6 -0
- package/template/docs/process/subagent-collaboration.md +5 -3
- package/template/docs/process/templates/stage-checkpoint-template.md +3 -1
- package/template/docs/templates/approval-record-template.yaml +14 -0
- package/template/docs/templates/digital-human-runtime-profile-template.md +38 -0
- package/template/docs/templates/grok-bot-profile-template.md +24 -0
- package/template/docs/templates/implementation-routing-template.md +3 -3
- package/template/docs/templates/local-parent-ticket-template.md +8 -0
- package/template/docs/templates/subagent-task-package-template.md +43 -1
- package/template/docs/templates/vertical-slice-ticket-template.md +7 -0
- package/template/docs/user-guide//344/272/247/345/223/201/347/240/224/345/217/221/345/205/250/347/224/237/345/221/275/345/221/250/346/234/237/346/234/200/344/275/263/345/256/236/350/267/265.md +2 -0
- package/template/scripts/lib/approval-record.mjs +123 -0
- package/template/scripts/lib/digital-human-roles.mjs +398 -0
- package/template/scripts/lib/lifecycle-transition.mjs +259 -0
- package/template/scripts/lib/scenario-checks.mjs +96 -2
- package/template/scripts/lib/task-package.mjs +214 -0
- package/template/scripts/verify-approval-record +13 -0
- package/template/scripts/verify-digital-human-roles +10 -0
- package/template/scripts/verify-digital-human-roles-scenarios +147 -0
- package/template/scripts/verify-digital-human-task-package +14 -0
- package/template/scripts/verify-digital-human-task-package-scenarios +8 -0
- package/template/scripts/verify-lifecycle-checkpoint +2 -0
- package/template/scripts/verify-lifecycle-transition-scenarios +105 -0
- package/template/scripts/verify-subagent-task-package +8 -0
- package/template/scripts/verify-subagent-task-package-scenarios +196 -0
- package/template/scripts/verify-template +16 -2
- package/template/skills-lock.json +35 -3
- package/template.snapshot.json +4 -4
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { parseDocument } from "../vendor/yaml.mjs";
|
|
4
|
+
import { loadRegistry, ROOT } from "./lifecycle-registry.mjs";
|
|
5
|
+
import { loadSkillRegistry } from "./skill-registry.mjs";
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_DIGITAL_HUMAN_ROLES = path.join(ROOT, "docs/agents/digital-human-roles.yaml");
|
|
8
|
+
|
|
9
|
+
const ROLE_ID = /^role\.[a-z0-9][a-z0-9-]*$/;
|
|
10
|
+
const GROUP_ID = /^group\.[a-z0-9][a-z0-9-]*$/;
|
|
11
|
+
const RUNTIME_ID = /^runtime\.[a-z0-9][a-z0-9-]*$/;
|
|
12
|
+
const REQUIRED_ROLES = [
|
|
13
|
+
"role.requirements-manager",
|
|
14
|
+
"role.product-manager",
|
|
15
|
+
"role.business",
|
|
16
|
+
"role.project-manager",
|
|
17
|
+
"role.frontend-engineer",
|
|
18
|
+
"role.backend-engineer",
|
|
19
|
+
"role.test-engineer"
|
|
20
|
+
];
|
|
21
|
+
const REQUIRED_RUNTIMES = ["runtime.generic", "runtime.skill-projection", "runtime.grok"];
|
|
22
|
+
const REQUIRED_DUAL_HAT_SPLIT = ["cross-repo-load", "responsibility-conflict"];
|
|
23
|
+
const STRING_GATE_BUCKETS = [
|
|
24
|
+
"evidence_only",
|
|
25
|
+
"orchestrator",
|
|
26
|
+
"product_digital_human_with_biological_veto",
|
|
27
|
+
"biological_human"
|
|
28
|
+
];
|
|
29
|
+
const COUNTERSIGN_STRING_BUCKETS = ["product_digital_human_with_biological_veto", "biological_human"];
|
|
30
|
+
export const BIOLOGICAL_ROLE_ID = "role.biological-human";
|
|
31
|
+
const OVERFLOWS = new Set(["not-applicable", "one-to-one-handoff", "forbid"]);
|
|
32
|
+
const GROK_FIELDS = ["grok_title", "grok_description", "grok_default_dual_hat", "grok_runtime_root", "grok_platform_approval"];
|
|
33
|
+
|
|
34
|
+
function fail(message) {
|
|
35
|
+
throw new TypeError(message);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function yamlFromFile(filePath, label) {
|
|
39
|
+
let source;
|
|
40
|
+
try {
|
|
41
|
+
source = readFileSync(filePath, "utf8");
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (error.code === "ENOENT") fail(`缺少${label}: ${filePath}`);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
const document = parseDocument(source, { maxAliasCount: 0, uniqueKeys: true });
|
|
47
|
+
if (document.errors.length > 0) fail(`无法解析${label}: ${document.errors[0].message}`);
|
|
48
|
+
const value = document.toJS({ maxAliasCount: 0 });
|
|
49
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) fail(`${label}必须是对象`);
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function requireString(value, field) {
|
|
54
|
+
if (typeof value !== "string" || !value.trim()) fail(`${field} 不能为空`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function requireStringArray(value, field) {
|
|
58
|
+
if (!Array.isArray(value) || value.length === 0 || value.some((item) => typeof item !== "string" || !item.trim())) {
|
|
59
|
+
fail(`${field} 必须是非空字符串数组`);
|
|
60
|
+
}
|
|
61
|
+
if (new Set(value).size !== value.length) fail(`${field} 包含重复项`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function idsFromCollection(records, kind) {
|
|
65
|
+
if (!Array.isArray(records)) fail(`生命周期注册表缺少 ${kind}`);
|
|
66
|
+
return new Set(records.map((record) => record.id));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function skillIdsFromRegistry(skillRegistry) {
|
|
70
|
+
const ids = new Set();
|
|
71
|
+
for (const collection of ["skills", "platform_skills", "external_skills"]) {
|
|
72
|
+
const records = skillRegistry[collection];
|
|
73
|
+
if (!records) continue;
|
|
74
|
+
if (!Array.isArray(records)) fail(`技能注册表 ${collection} 必须是数组`);
|
|
75
|
+
for (const record of records) {
|
|
76
|
+
if (!record?.id) fail(`技能注册表 ${collection} 缺少 id`);
|
|
77
|
+
ids.add(record.id);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return ids;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function rejectGrokCoupling(object, label) {
|
|
84
|
+
if (!object || typeof object !== "object") return;
|
|
85
|
+
for (const field of GROK_FIELDS) {
|
|
86
|
+
if (Object.hasOwn(object, field)) fail(`${label} 不得包含平台耦合字段 ${field}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function knownActorIds(doc) {
|
|
91
|
+
return new Set([doc.orchestrator.id, ...doc.roles.map((role) => role.id)]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function validateSkills(list, field, skillIds) {
|
|
95
|
+
requireStringArray(list, field);
|
|
96
|
+
for (const skill of list) {
|
|
97
|
+
if (!skillIds.has(skill)) fail(`${field} 引用了未登记技能: ${skill}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function validateActor(actor, { skillIds, stageIds, artifactIds, evidenceIds, expectedKind }) {
|
|
102
|
+
rejectGrokCoupling(actor, actor?.id || expectedKind);
|
|
103
|
+
requireString(actor.id, `${expectedKind}.id`);
|
|
104
|
+
if (!ROLE_ID.test(actor.id)) fail(`${actor.id} 不符合 role.*`);
|
|
105
|
+
requireString(actor.name, `${actor.id}.name`);
|
|
106
|
+
if (actor.kind !== expectedKind) fail(`${actor.id}.kind 必须为 ${expectedKind}`);
|
|
107
|
+
requireString(actor.title, `${actor.id}.title`);
|
|
108
|
+
requireString(actor.description, `${actor.id}.description`);
|
|
109
|
+
requireStringArray(actor.stages, `${actor.id}.stages`);
|
|
110
|
+
for (const stage of actor.stages) {
|
|
111
|
+
if (!stageIds.has(stage)) fail(`${actor.id} 引用了未知阶段: ${stage}`);
|
|
112
|
+
}
|
|
113
|
+
if (actor.draft_artifact_ids) {
|
|
114
|
+
requireStringArray(actor.draft_artifact_ids, `${actor.id}.draft_artifact_ids`);
|
|
115
|
+
for (const artifact of actor.draft_artifact_ids) {
|
|
116
|
+
if (!artifactIds.has(artifact)) fail(`${actor.id} 引用了未知产物: ${artifact}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (actor.owned_evidence_ids) {
|
|
120
|
+
requireStringArray(actor.owned_evidence_ids, `${actor.id}.owned_evidence_ids`);
|
|
121
|
+
for (const evidence of actor.owned_evidence_ids) {
|
|
122
|
+
if (!evidenceIds || !evidenceIds.has(evidence)) fail(`${actor.id} 引用了未知证据: ${evidence}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
validateSkills(actor.core_skills, `${actor.id}.core_skills`, skillIds);
|
|
126
|
+
validateSkills(actor.forbidden_skills, `${actor.id}.forbidden_skills`, skillIds);
|
|
127
|
+
const overlap = actor.core_skills.filter((skill) => actor.forbidden_skills.includes(skill));
|
|
128
|
+
if (overlap.length > 0) fail(`${actor.id} 的 core_skills 与 forbidden_skills 重叠: ${overlap.join(", ")}`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function validateRuntimes(doc, skillRegistry, groupSizes) {
|
|
132
|
+
if (!Array.isArray(doc.runtimes) || doc.runtimes.length === 0) fail("缺少 runtimes");
|
|
133
|
+
const ids = [];
|
|
134
|
+
let sawProjection = false;
|
|
135
|
+
for (const runtime of doc.runtimes) {
|
|
136
|
+
requireString(runtime.id, "runtimes.id");
|
|
137
|
+
if (!RUNTIME_ID.test(runtime.id)) fail(`${runtime.id} 不符合 runtime.*`);
|
|
138
|
+
ids.push(runtime.id);
|
|
139
|
+
requireString(runtime.kind, `${runtime.id}.kind`);
|
|
140
|
+
requireString(runtime.instance_kind, `${runtime.id}.instance_kind`);
|
|
141
|
+
requireString(runtime.collaboration, `${runtime.id}.collaboration`);
|
|
142
|
+
requireString(runtime.side_effect_approval, `${runtime.id}.side_effect_approval`);
|
|
143
|
+
if (runtime.side_effect_approval !== "biological-human") {
|
|
144
|
+
fail(`${runtime.id}.side_effect_approval 必须为 biological-human`);
|
|
145
|
+
}
|
|
146
|
+
if (!OVERFLOWS.has(runtime.overflow)) fail(`${runtime.id}.overflow 无效`);
|
|
147
|
+
if (typeof runtime.covers_skill_registry_roots !== "boolean") {
|
|
148
|
+
fail(`${runtime.id}.covers_skill_registry_roots 必须是布尔值`);
|
|
149
|
+
}
|
|
150
|
+
if (runtime.covers_skill_registry_roots) sawProjection = true;
|
|
151
|
+
const max = runtime.max_collaboration_group_size;
|
|
152
|
+
if (max == null) {
|
|
153
|
+
if (runtime.overflow !== "not-applicable") fail(`${runtime.id} 无人数上限时 overflow 必须为 not-applicable`);
|
|
154
|
+
} else {
|
|
155
|
+
if (!Number.isInteger(max) || max < 2) fail(`${runtime.id}.max_collaboration_group_size 必须是 >=2 的整数`);
|
|
156
|
+
if (runtime.overflow === "not-applicable") fail(`${runtime.id} 有人数上限时必须声明 overflow`);
|
|
157
|
+
if (runtime.overflow === "forbid") {
|
|
158
|
+
for (const [groupId, size] of groupSizes) {
|
|
159
|
+
if (size > max) fail(`${runtime.id} 禁止超过 ${max} 人的阶段协作组: ${groupId} 有 ${size} 人`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (runtime.id === "runtime.grok") {
|
|
164
|
+
if (runtime.kind !== "grok-bot") fail("runtime.grok.kind 必须为 grok-bot");
|
|
165
|
+
if (runtime.max_collaboration_group_size !== 6) fail("runtime.grok 群聊上限必须为 6");
|
|
166
|
+
if (runtime.shared_workspace_is_not_security_boundary !== true) {
|
|
167
|
+
fail("runtime.grok 必须声明共享工作区不是安全边界");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (runtime.id === "runtime.generic" && runtime.max_collaboration_group_size != null) {
|
|
171
|
+
fail("runtime.generic 不得设置平台群聊上限");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (new Set(ids).size !== ids.length) fail("runtimes.id 重复");
|
|
175
|
+
for (const required of REQUIRED_RUNTIMES) {
|
|
176
|
+
if (!ids.includes(required)) fail(`缺少运行时绑定: ${required}`);
|
|
177
|
+
}
|
|
178
|
+
if (!sawProjection) fail("必须有 covers_skill_registry_roots=true 的运行时,以覆盖技能注册表投影根");
|
|
179
|
+
const roots = skillRegistry.agent_runtime_roots;
|
|
180
|
+
if (!roots || typeof roots !== "object") fail("技能注册表缺少 agent_runtime_roots");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function validateSignRule(rule, { actors, gateIds, claimed, field }) {
|
|
184
|
+
if (!rule || typeof rule !== "object") fail(`${field} 必须是对象`);
|
|
185
|
+
requireString(rule.gate, `${field}.gate`);
|
|
186
|
+
if (!gateIds.has(rule.gate)) fail(`${field} 引用了未知门禁: ${rule.gate}`);
|
|
187
|
+
if (claimed.has(rule.gate)) fail(`门禁被多个会签桶重复占用: ${rule.gate}`);
|
|
188
|
+
claimed.add(rule.gate);
|
|
189
|
+
if (rule.drafter != null) {
|
|
190
|
+
requireString(rule.drafter, `${rule.gate}.drafter`);
|
|
191
|
+
if (!actors.has(rule.drafter)) fail(`${rule.gate} 起草者未知: ${rule.drafter}`);
|
|
192
|
+
}
|
|
193
|
+
requireStringArray(rule.countersigners, `${rule.gate}.countersigners`);
|
|
194
|
+
if (rule.drafter && rule.countersigners.includes(rule.drafter)) fail(`${rule.gate} 起草者不得会签自己`);
|
|
195
|
+
for (const signer of rule.countersigners) {
|
|
196
|
+
if (!actors.has(signer)) fail(`${rule.gate} 会签人未知: ${signer}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function collectCountersignGateIds(policy) {
|
|
201
|
+
const ids = [];
|
|
202
|
+
for (const bucket of COUNTERSIGN_STRING_BUCKETS) {
|
|
203
|
+
const gates = policy?.[bucket];
|
|
204
|
+
if (Array.isArray(gates)) ids.push(...gates);
|
|
205
|
+
}
|
|
206
|
+
for (const rule of policy?.digital_human_review || []) {
|
|
207
|
+
if (rule?.gate) ids.push(rule.gate);
|
|
208
|
+
}
|
|
209
|
+
for (const rule of policy?.dual_digital_human || []) {
|
|
210
|
+
if (rule?.gate) ids.push(rule.gate);
|
|
211
|
+
}
|
|
212
|
+
return ids;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function countersignRuleForGate(policy, gateId) {
|
|
216
|
+
const dual = (policy?.dual_digital_human || []).find((rule) => rule.gate === gateId);
|
|
217
|
+
if (dual) return { bucket: "dual_digital_human", ...dual };
|
|
218
|
+
const review = (policy?.digital_human_review || []).find((rule) => rule.gate === gateId);
|
|
219
|
+
if (review) return { bucket: "digital_human_review", ...review };
|
|
220
|
+
if ((policy?.product_digital_human_with_biological_veto || []).includes(gateId)) {
|
|
221
|
+
return { bucket: "product_digital_human_with_biological_veto", gate: gateId, countersigners: ["role.product-manager"] };
|
|
222
|
+
}
|
|
223
|
+
if ((policy?.biological_human || []).includes(gateId)) {
|
|
224
|
+
return { bucket: "biological_human", gate: gateId, countersigners: [BIOLOGICAL_ROLE_ID] };
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function taskPackageDefaults(roleId, doc) {
|
|
230
|
+
const registry = doc || loadDigitalHumanRoles();
|
|
231
|
+
const actor = roleId === registry.orchestrator.id
|
|
232
|
+
? registry.orchestrator
|
|
233
|
+
: registry.roles.find((role) => role.id === roleId);
|
|
234
|
+
if (!actor) fail(`未知角色: ${roleId}`);
|
|
235
|
+
return {
|
|
236
|
+
role_id: actor.id,
|
|
237
|
+
kind: actor.kind,
|
|
238
|
+
stages: [...actor.stages],
|
|
239
|
+
core_skills: [...actor.core_skills],
|
|
240
|
+
forbidden_skills: [...actor.forbidden_skills],
|
|
241
|
+
draft_artifact_ids: actor.draft_artifact_ids ? [...actor.draft_artifact_ids] : [],
|
|
242
|
+
owned_evidence_ids: actor.owned_evidence_ids ? [...actor.owned_evidence_ids] : []
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function validateDigitalHumanRoles(doc, { skillIds, stageIds, gateIds, artifactIds, evidenceIds, workUnitIds, skillRegistry } = {}) {
|
|
247
|
+
if (!doc || typeof doc !== "object" || Array.isArray(doc)) fail("数字人角色注册表必须是对象");
|
|
248
|
+
if (doc.schema_version !== 1) fail("schema_version 必须为 1");
|
|
249
|
+
if (doc.registry_id !== "yss.digital-human-roles") fail("registry_id 必须为 yss.digital-human-roles");
|
|
250
|
+
if (doc.status !== "active") fail("status 必须为 active");
|
|
251
|
+
requireString(doc.description, "description");
|
|
252
|
+
if (doc.canonical_path !== "docs/agents/digital-human-roles.yaml") fail("canonical_path 必须为 docs/agents/digital-human-roles.yaml");
|
|
253
|
+
rejectGrokCoupling(doc.runtime_policy, "runtime_policy");
|
|
254
|
+
rejectGrokCoupling(doc.gate_policy, "gate_policy");
|
|
255
|
+
const runtime = doc.runtime_policy;
|
|
256
|
+
if (!runtime || typeof runtime !== "object") fail("缺少 runtime_policy");
|
|
257
|
+
if (runtime.overlay_on_lifecycle !== true) fail("runtime_policy.overlay_on_lifecycle 必须为 true");
|
|
258
|
+
if (runtime.git_is_ssot !== true) fail("runtime_policy.git_is_ssot 必须为 true");
|
|
259
|
+
if (runtime.default_invocation !== "orchestrator") fail("default_invocation 必须为 orchestrator");
|
|
260
|
+
if (runtime.dispatch !== "orchestrator-one-to-one") fail("dispatch 必须为 orchestrator-one-to-one");
|
|
261
|
+
if (runtime.per_feature_instances !== "forbidden") fail("per_feature_instances 必须为 forbidden");
|
|
262
|
+
if (runtime.implementer_must_differ !== true) fail("implementer_must_differ 必须为 true");
|
|
263
|
+
if (runtime.biological_veto !== true) fail("biological_veto 必须为 true");
|
|
264
|
+
if (runtime.write_isolation !== "task-package-policy") fail("write_isolation 必须为 task-package-policy");
|
|
265
|
+
requireStringArray(runtime.dual_hat_split_when, "runtime_policy.dual_hat_split_when");
|
|
266
|
+
for (const required of REQUIRED_DUAL_HAT_SPLIT) {
|
|
267
|
+
if (!runtime.dual_hat_split_when.includes(required)) {
|
|
268
|
+
fail(`runtime_policy.dual_hat_split_when 必须包含 ${required}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (runtime.max_group_size != null || runtime.min_group_size != null) {
|
|
272
|
+
fail("平台群聊人数上限属于 runtimes,不得写在 runtime_policy");
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const orchestrator = doc.orchestrator;
|
|
276
|
+
if (!orchestrator || typeof orchestrator !== "object") fail("缺少 orchestrator");
|
|
277
|
+
validateActor(orchestrator, { skillIds, stageIds, artifactIds, evidenceIds, expectedKind: "orchestrator" });
|
|
278
|
+
requireStringArray(orchestrator.default_dual_hat, "orchestrator.default_dual_hat");
|
|
279
|
+
if (!Array.isArray(doc.roles) || doc.roles.length === 0) fail("roles 不能为空");
|
|
280
|
+
const roleIds = [];
|
|
281
|
+
for (const role of doc.roles) {
|
|
282
|
+
validateActor(role, { skillIds, stageIds, artifactIds, evidenceIds, expectedKind: "digital-human" });
|
|
283
|
+
roleIds.push(role.id);
|
|
284
|
+
}
|
|
285
|
+
if (new Set(roleIds).size !== roleIds.length) fail("roles.id 重复");
|
|
286
|
+
if (roleIds.slice().sort().join("\0") !== REQUIRED_ROLES.slice().sort().join("\0")) {
|
|
287
|
+
fail(`v1 必须恰好包含: ${REQUIRED_ROLES.join(", ")}`);
|
|
288
|
+
}
|
|
289
|
+
if (roleIds.includes(orchestrator.id)) fail("orchestrator 不得再出现在 roles");
|
|
290
|
+
for (const dual of orchestrator.default_dual_hat) {
|
|
291
|
+
if (!roleIds.includes(dual)) fail(`default_dual_hat 引用了未知角色: ${dual}`);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const actors = knownActorIds(doc);
|
|
295
|
+
if (!Array.isArray(doc.stage_groups) || doc.stage_groups.length === 0) fail("缺少 stage_groups");
|
|
296
|
+
const groupIds = [];
|
|
297
|
+
const groupSizes = [];
|
|
298
|
+
for (const group of doc.stage_groups) {
|
|
299
|
+
requireString(group.id, "stage_groups.id");
|
|
300
|
+
if (!GROUP_ID.test(group.id)) fail(`${group.id} 不符合 group.*`);
|
|
301
|
+
groupIds.push(group.id);
|
|
302
|
+
requireString(group.name, `${group.id}.name`);
|
|
303
|
+
if (!stageIds.has(group.stage)) fail(`${group.id} 引用了未知阶段: ${group.stage}`);
|
|
304
|
+
requireStringArray(group.members, `${group.id}.members`);
|
|
305
|
+
if (group.members.length < 2) fail(`${group.id} 逻辑协作组至少 2 人`);
|
|
306
|
+
groupSizes.push([group.id, group.members.length]);
|
|
307
|
+
for (const member of group.members) {
|
|
308
|
+
if (!actors.has(member)) fail(`${group.id} 包含未知成员: ${member}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (new Set(groupIds).size !== groupIds.length) fail("stage_groups.id 重复");
|
|
312
|
+
validateRuntimes(doc, skillRegistry, groupSizes);
|
|
313
|
+
|
|
314
|
+
const policy = doc.gate_policy;
|
|
315
|
+
if (!policy || typeof policy !== "object") fail("缺少 gate_policy");
|
|
316
|
+
if (policy.default_if_unlisted !== "biological-human") fail("default_if_unlisted 必须为 biological-human");
|
|
317
|
+
if (policy.runtime_side_effect_approval !== "biological-human") fail("runtime_side_effect_approval 必须为 biological-human");
|
|
318
|
+
if (policy.commercial_contract !== "biological-human") fail("commercial_contract 必须为 biological-human");
|
|
319
|
+
if (policy.unlisted_kept_biological) {
|
|
320
|
+
requireStringArray(policy.unlisted_kept_biological, "gate_policy.unlisted_kept_biological");
|
|
321
|
+
for (const gate of policy.unlisted_kept_biological) {
|
|
322
|
+
if (!gateIds.has(gate)) fail(`unlisted_kept_biological 引用了未知门禁: ${gate}`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const claimed = new Set();
|
|
326
|
+
for (const bucket of STRING_GATE_BUCKETS) {
|
|
327
|
+
requireStringArray(policy[bucket], `gate_policy.${bucket}`);
|
|
328
|
+
for (const gate of policy[bucket]) {
|
|
329
|
+
if (!gateIds.has(gate)) fail(`gate_policy.${bucket} 引用了未知门禁: ${gate}`);
|
|
330
|
+
if (claimed.has(gate)) fail(`门禁被多个会签桶重复占用: ${gate}`);
|
|
331
|
+
claimed.add(gate);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (!Array.isArray(policy.digital_human_review) || policy.digital_human_review.length === 0) {
|
|
335
|
+
fail("缺少 digital_human_review");
|
|
336
|
+
}
|
|
337
|
+
for (const [index, rule] of policy.digital_human_review.entries()) {
|
|
338
|
+
if (typeof rule === "string") fail("digital_human_review 必须是含 gate 与 countersigners 的规则");
|
|
339
|
+
validateSignRule(rule, { actors, gateIds, claimed, field: `digital_human_review[${index}]` });
|
|
340
|
+
if (rule.gate === "gate.release-ready") fail("gate.release-ready 不得放入 digital_human_review");
|
|
341
|
+
}
|
|
342
|
+
if (!policy.biological_human.includes("gate.release-ready")) {
|
|
343
|
+
fail("gate.release-ready 必须属于 biological_human");
|
|
344
|
+
}
|
|
345
|
+
if (!Array.isArray(policy.digital_human_review_work_units) || policy.digital_human_review_work_units.length === 0) {
|
|
346
|
+
fail("缺少 digital_human_review_work_units");
|
|
347
|
+
}
|
|
348
|
+
const workUnitSeen = new Set();
|
|
349
|
+
for (const [index, rule] of policy.digital_human_review_work_units.entries()) {
|
|
350
|
+
if (typeof rule === "string") fail("digital_human_review_work_units 必须是含 work_unit 与 countersigners 的规则");
|
|
351
|
+
requireString(rule.work_unit, `digital_human_review_work_units[${index}].work_unit`);
|
|
352
|
+
if (!workUnitIds.has(rule.work_unit)) fail(`未知工作单元: ${rule.work_unit}`);
|
|
353
|
+
if (workUnitSeen.has(rule.work_unit)) fail(`工作单元重复: ${rule.work_unit}`);
|
|
354
|
+
workUnitSeen.add(rule.work_unit);
|
|
355
|
+
requireStringArray(rule.countersigners, `${rule.work_unit}.countersigners`);
|
|
356
|
+
for (const signer of rule.countersigners) {
|
|
357
|
+
if (!actors.has(signer)) fail(`${rule.work_unit} 会签人未知: ${signer}`);
|
|
358
|
+
}
|
|
359
|
+
if (rule.implementer_must_differ !== true) {
|
|
360
|
+
fail(`${rule.work_unit}.implementer_must_differ 必须为 true`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (!Array.isArray(policy.dual_digital_human) || policy.dual_digital_human.length === 0) {
|
|
364
|
+
fail("缺少 dual_digital_human");
|
|
365
|
+
}
|
|
366
|
+
for (const [index, rule] of policy.dual_digital_human.entries()) {
|
|
367
|
+
validateSignRule(rule, { actors, gateIds, claimed, field: `dual_digital_human[${index}]` });
|
|
368
|
+
if (!rule.drafter) fail(`${rule.gate} 双数字人会签必须有 drafter`);
|
|
369
|
+
}
|
|
370
|
+
for (const gate of policy.unlisted_kept_biological || []) {
|
|
371
|
+
if (claimed.has(gate)) fail(`unlisted_kept_biological 与会签桶重复: ${gate}`);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return {
|
|
375
|
+
role_count: doc.roles.length,
|
|
376
|
+
group_count: doc.stage_groups.length,
|
|
377
|
+
runtime_count: doc.runtimes.length,
|
|
378
|
+
claimed_gates: claimed.size
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export function loadDigitalHumanRoles(filePath = DEFAULT_DIGITAL_HUMAN_ROLES) {
|
|
383
|
+
return yamlFromFile(filePath, "数字人角色注册表");
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export function validateDefaultDigitalHumanRoles() {
|
|
387
|
+
const lifecycle = loadRegistry();
|
|
388
|
+
const skills = loadSkillRegistry();
|
|
389
|
+
return validateDigitalHumanRoles(loadDigitalHumanRoles(), {
|
|
390
|
+
skillIds: skillIdsFromRegistry(skills),
|
|
391
|
+
stageIds: idsFromCollection(lifecycle.stages, "stages"),
|
|
392
|
+
gateIds: idsFromCollection(lifecycle.gates, "gates"),
|
|
393
|
+
artifactIds: idsFromCollection(lifecycle.artifacts, "artifacts"),
|
|
394
|
+
evidenceIds: idsFromCollection(lifecycle.evidence, "evidence"),
|
|
395
|
+
workUnitIds: idsFromCollection(lifecycle.work_units, "work_units"),
|
|
396
|
+
skillRegistry: skills
|
|
397
|
+
});
|
|
398
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { parseDocument } from "../vendor/yaml.mjs";
|
|
3
|
+
|
|
4
|
+
const IMPLEMENTATION_WORK_UNIT = "work-unit.slice-implementation";
|
|
5
|
+
const TICKET_DECOMPOSITION_WORK_UNIT = "work-unit.ticket-decomposition";
|
|
6
|
+
|
|
7
|
+
function deepFreeze(value) {
|
|
8
|
+
if (!value || typeof value !== "object" || Object.isFrozen(value)) return value;
|
|
9
|
+
Object.freeze(value);
|
|
10
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const NEXT_ROUTES = deepFreeze({
|
|
15
|
+
"work-unit.entry-triage": ["work-unit.discovery-opportunity", "work-unit.discovery-requirements"],
|
|
16
|
+
"work-unit.ssot-update": ["work-unit.skill-projection-sync", "work-unit.intensity-aware-verification"],
|
|
17
|
+
"work-unit.skill-projection-sync": ["work-unit.template-snapshot-build", "work-unit.intensity-aware-verification"],
|
|
18
|
+
"work-unit.template-snapshot-build": ["work-unit.attach-sync-integration", "work-unit.intensity-aware-verification"],
|
|
19
|
+
"work-unit.attach-sync-integration": ["work-unit.intensity-aware-verification"],
|
|
20
|
+
"work-unit.intensity-aware-verification": ["work-unit.intensity-aware-review"],
|
|
21
|
+
"work-unit.intensity-aware-review": ["work-unit.release-and-rollback"],
|
|
22
|
+
"work-unit.release-and-rollback": [],
|
|
23
|
+
"work-unit.discovery-opportunity": ["work-unit.discovery-requirements", "work-unit.domain-strategy-design", "work-unit.stage-decision", "work-unit.spec-synthesis"],
|
|
24
|
+
"work-unit.discovery-requirements": ["work-unit.domain-strategy-design", "work-unit.stage-decision", "work-unit.spec-synthesis"],
|
|
25
|
+
"work-unit.domain-strategy-design": ["work-unit.stage-decision", "work-unit.spec-synthesis"],
|
|
26
|
+
"work-unit.stage-decision": ["work-unit.spec-synthesis"],
|
|
27
|
+
"work-unit.spec-synthesis": ["work-unit.prototype-design", "work-unit.technical-analysis", TICKET_DECOMPOSITION_WORK_UNIT],
|
|
28
|
+
"work-unit.prototype-design": ["work-unit.technical-analysis", TICKET_DECOMPOSITION_WORK_UNIT],
|
|
29
|
+
"work-unit.technical-analysis": [TICKET_DECOMPOSITION_WORK_UNIT],
|
|
30
|
+
[TICKET_DECOMPOSITION_WORK_UNIT]: [IMPLEMENTATION_WORK_UNIT],
|
|
31
|
+
[IMPLEMENTATION_WORK_UNIT]: ["work-unit.frontend-implementation-verification", "work-unit.code-review"],
|
|
32
|
+
"work-unit.frontend-implementation-verification": ["work-unit.code-review"],
|
|
33
|
+
"work-unit.code-review": ["work-unit.release-and-retrospective", IMPLEMENTATION_WORK_UNIT],
|
|
34
|
+
"work-unit.release-and-retrospective": [],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const BLOCKING_SIGNALS = Object.freeze({
|
|
38
|
+
invalidRoute: "illegal-next-route",
|
|
39
|
+
implementationBeforeTickets: "ticket-formalization-required",
|
|
40
|
+
invalidPredecessor: "invalid-implementation-predecessor",
|
|
41
|
+
decompositionIncomplete: "ticket-decomposition-incomplete",
|
|
42
|
+
decompositionRefMissing: "ticket-decomposition-result-ref-missing",
|
|
43
|
+
missingSlice: "vertical-slice-ticket-required",
|
|
44
|
+
sliceRefMissing: "vertical-slice-ticket-ref-missing",
|
|
45
|
+
parentTicket: "parent-ticket-forbidden",
|
|
46
|
+
wrongKind: "vertical-slice-ticket-kind-invalid",
|
|
47
|
+
kindMissing: "vertical-slice-ticket-kind-missing",
|
|
48
|
+
unreadableSlice: "vertical-slice-ticket-unreadable",
|
|
49
|
+
wrongRole: "ticket-not-ready-for-agent",
|
|
50
|
+
roleMissing: "vertical-slice-ticket-role-missing",
|
|
51
|
+
contractMismatch: "slice-contract-ticket-mismatch",
|
|
52
|
+
contractNotApproved: "slice-contract-not-approved",
|
|
53
|
+
contractNotPersisted: "slice-contract-not-persisted",
|
|
54
|
+
contractNotCurrent: "slice-contract-not-current",
|
|
55
|
+
missingEvidence: "ticket-formalization-evidence-missing",
|
|
56
|
+
stale: "ticket-formalization-stale",
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const allowedResult = (evidenceRefs = []) => ({
|
|
60
|
+
result: "allowed",
|
|
61
|
+
blocking_signals: [],
|
|
62
|
+
missing_requirements: [],
|
|
63
|
+
evidence_refs: evidenceRefs,
|
|
64
|
+
next_work_unit: null,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const blockedResult = (signals, missing = [], evidenceRefs = []) => ({
|
|
68
|
+
result: "blocked",
|
|
69
|
+
blocking_signals: [...new Set(signals)],
|
|
70
|
+
missing_requirements: [...new Set(missing)],
|
|
71
|
+
evidence_refs: evidenceRefs,
|
|
72
|
+
next_work_unit: null,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
function hasText(value) {
|
|
76
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isReadable(ref, exists) {
|
|
80
|
+
return hasText(ref) && exists(ref);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function readDecompositionResult(ref, read) {
|
|
84
|
+
if (!hasText(ref)) return null;
|
|
85
|
+
try {
|
|
86
|
+
const document = parseDocument(read(ref), { maxAliasCount: 0, uniqueKeys: true });
|
|
87
|
+
if (document.errors.length > 0) return null;
|
|
88
|
+
const value = document.toJS({ maxAliasCount: 0 });
|
|
89
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function validateTicketPath(ref) {
|
|
96
|
+
if (!hasText(ref)) return false;
|
|
97
|
+
return /^docs\/\.scratch\/[^/]+\/issues\/[^/]+\.md$/.test(ref);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function validateTicketReference(ref, trackerKind) {
|
|
101
|
+
if (trackerKind === "github" || trackerKind === "gitlab") {
|
|
102
|
+
return /^(https?:\/\/|(?:github|gitlab):)[^\s]+$/.test(ref);
|
|
103
|
+
}
|
|
104
|
+
return validateTicketPath(ref);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Validate a lifecycle work-unit transition without mutating state.
|
|
109
|
+
* `nextRoute` is null only for a terminal work unit. A blocked or needs-human
|
|
110
|
+
* Workflow Execution Result may omit a route; completed results are checked
|
|
111
|
+
* by `validateWorkflowExecutionResult` before this function is called.
|
|
112
|
+
*/
|
|
113
|
+
export function validateNextRoute(currentWorkUnit, nextRoute) {
|
|
114
|
+
const routes = NEXT_ROUTES[currentWorkUnit];
|
|
115
|
+
if (!routes) return blockedResult([BLOCKING_SIGNALS.invalidRoute], ["known_current_work_unit"]);
|
|
116
|
+
if (nextRoute === null && routes.length === 0) return allowedResult();
|
|
117
|
+
if (!hasText(nextRoute) || !routes.includes(nextRoute)) {
|
|
118
|
+
const signals = [BLOCKING_SIGNALS.invalidRoute];
|
|
119
|
+
if (nextRoute === IMPLEMENTATION_WORK_UNIT && currentWorkUnit !== TICKET_DECOMPOSITION_WORK_UNIT) {
|
|
120
|
+
signals.push(BLOCKING_SIGNALS.implementationBeforeTickets);
|
|
121
|
+
}
|
|
122
|
+
return blockedResult(signals, ["allowed_next_route"]);
|
|
123
|
+
}
|
|
124
|
+
return allowedResult();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Validate that Ticket formalization produced a real, implementable vertical slice.
|
|
129
|
+
* `exists` is injectable so external adapters can resolve their own tracker refs.
|
|
130
|
+
*/
|
|
131
|
+
export function validateTicketFormalization(state, { exists = existsSync, read = (ref) => readFileSync(ref, "utf8") } = {}) {
|
|
132
|
+
const decomposition = state?.ticket_decomposition_result;
|
|
133
|
+
const ticket = state?.vertical_slice_ticket;
|
|
134
|
+
const contract = state?.slice_contract;
|
|
135
|
+
const decompositionRef = state?.ticket_decomposition_result_ref;
|
|
136
|
+
const sliceRef = state?.vertical_slice_ticket_ref;
|
|
137
|
+
const sliceRole = state?.vertical_slice_ticket_role;
|
|
138
|
+
const sliceKind = state?.vertical_slice_ticket_kind;
|
|
139
|
+
const trackerKind = state?.tracker_kind ?? "local-markdown";
|
|
140
|
+
const evidenceRefs = decomposition?.evidence_refs ?? [];
|
|
141
|
+
const persistedDecomposition = readDecompositionResult(decompositionRef, read);
|
|
142
|
+
const signals = [];
|
|
143
|
+
const missing = [];
|
|
144
|
+
|
|
145
|
+
if (decomposition?.result !== "completed") {
|
|
146
|
+
signals.push(BLOCKING_SIGNALS.decompositionIncomplete);
|
|
147
|
+
missing.push("ticket_decomposition_result.result=completed");
|
|
148
|
+
}
|
|
149
|
+
if (!persistedDecomposition || persistedDecomposition.result_schema !== "workflow-execution-result-v1" || persistedDecomposition.result !== "completed" || persistedDecomposition.work_unit !== TICKET_DECOMPOSITION_WORK_UNIT) {
|
|
150
|
+
signals.push(BLOCKING_SIGNALS.decompositionIncomplete);
|
|
151
|
+
missing.push("ticket_decomposition_result_ref must contain completed work-unit.ticket-decomposition result");
|
|
152
|
+
}
|
|
153
|
+
if (persistedDecomposition && Array.isArray(persistedDecomposition.evidence_refs)) {
|
|
154
|
+
if (persistedDecomposition.evidence_refs.some((ref) => !isReadable(ref, exists))) {
|
|
155
|
+
signals.push(BLOCKING_SIGNALS.missingEvidence);
|
|
156
|
+
missing.push("persisted decomposition result evidence_refs must be readable");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (!isReadable(decompositionRef, exists) || !evidenceRefs.includes(decompositionRef)) {
|
|
160
|
+
signals.push(BLOCKING_SIGNALS.decompositionRefMissing);
|
|
161
|
+
missing.push("readable ticket_decomposition_result_ref included in evidence_refs");
|
|
162
|
+
}
|
|
163
|
+
if (!Array.isArray(evidenceRefs) || evidenceRefs.length === 0 || evidenceRefs.some((ref) => !isReadable(ref, exists))) {
|
|
164
|
+
signals.push(BLOCKING_SIGNALS.missingEvidence);
|
|
165
|
+
missing.push("readable ticket_decomposition_result.evidence_refs");
|
|
166
|
+
}
|
|
167
|
+
if (!hasText(sliceRef)) {
|
|
168
|
+
signals.push(BLOCKING_SIGNALS.sliceRefMissing);
|
|
169
|
+
missing.push("vertical_slice_ticket_ref");
|
|
170
|
+
}
|
|
171
|
+
if (!hasText(sliceKind)) {
|
|
172
|
+
signals.push(BLOCKING_SIGNALS.kindMissing);
|
|
173
|
+
missing.push("vertical_slice_ticket_kind");
|
|
174
|
+
}
|
|
175
|
+
if (!hasText(sliceRole)) {
|
|
176
|
+
signals.push(BLOCKING_SIGNALS.roleMissing);
|
|
177
|
+
missing.push("vertical_slice_ticket_role");
|
|
178
|
+
}
|
|
179
|
+
if (!ticket || !hasText(ticket.ref)) {
|
|
180
|
+
signals.push(BLOCKING_SIGNALS.missingSlice);
|
|
181
|
+
missing.push("vertical_slice_ticket.ref");
|
|
182
|
+
} else {
|
|
183
|
+
if (sliceRef !== ticket.ref) {
|
|
184
|
+
signals.push(BLOCKING_SIGNALS.contractMismatch);
|
|
185
|
+
missing.push("vertical_slice_ticket_ref=vertical_slice_ticket.ref");
|
|
186
|
+
}
|
|
187
|
+
if (sliceKind !== ticket.kind) {
|
|
188
|
+
signals.push(BLOCKING_SIGNALS.wrongKind);
|
|
189
|
+
missing.push("vertical_slice_ticket_kind=vertical_slice_ticket.kind");
|
|
190
|
+
}
|
|
191
|
+
if (sliceRole !== ticket.role) {
|
|
192
|
+
signals.push(BLOCKING_SIGNALS.wrongRole);
|
|
193
|
+
missing.push("vertical_slice_ticket_role=vertical_slice_ticket.role");
|
|
194
|
+
}
|
|
195
|
+
if (!validateTicketReference(ticket.ref, trackerKind)) {
|
|
196
|
+
signals.push(ticket.kind === "parent-ticket" || ticket.ref.endsWith("/parent-ticket.md") ? BLOCKING_SIGNALS.parentTicket : BLOCKING_SIGNALS.missingSlice);
|
|
197
|
+
missing.push(trackerKind === "local-markdown" ? "vertical_slice_ticket.ref under docs/.scratch/<feature>/issues/" : "remote tracker Ticket reference");
|
|
198
|
+
}
|
|
199
|
+
if (ticket.kind === "parent-ticket" || ticket.ref.endsWith("/parent-ticket.md")) {
|
|
200
|
+
signals.push(BLOCKING_SIGNALS.parentTicket);
|
|
201
|
+
missing.push("vertical_slice_ticket.kind=vertical-slice-ticket");
|
|
202
|
+
} else if (ticket.kind !== "vertical-slice-ticket") {
|
|
203
|
+
signals.push(BLOCKING_SIGNALS.wrongKind);
|
|
204
|
+
missing.push("vertical_slice_ticket.kind=vertical-slice-ticket");
|
|
205
|
+
}
|
|
206
|
+
if (ticket.role !== "ready-for-agent") {
|
|
207
|
+
signals.push(BLOCKING_SIGNALS.wrongRole);
|
|
208
|
+
missing.push("vertical_slice_ticket.role=ready-for-agent");
|
|
209
|
+
}
|
|
210
|
+
if (trackerKind === "local-markdown" && !isReadable(ticket.ref, exists)) {
|
|
211
|
+
signals.push(BLOCKING_SIGNALS.unreadableSlice);
|
|
212
|
+
missing.push("readable vertical_slice_ticket.ref");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (!contract || !hasText(contract.ticket_ref) || contract.ticket_ref !== ticket?.ref) {
|
|
216
|
+
signals.push(BLOCKING_SIGNALS.contractMismatch);
|
|
217
|
+
missing.push("slice_contract.ticket_ref=vertical_slice_ticket.ref");
|
|
218
|
+
}
|
|
219
|
+
if (contract?.status !== "approved") {
|
|
220
|
+
signals.push(BLOCKING_SIGNALS.contractNotApproved);
|
|
221
|
+
missing.push("slice_contract.status=approved");
|
|
222
|
+
}
|
|
223
|
+
if (contract?.persisted !== true) {
|
|
224
|
+
signals.push(BLOCKING_SIGNALS.contractNotPersisted);
|
|
225
|
+
missing.push("slice_contract.persisted=true");
|
|
226
|
+
}
|
|
227
|
+
if (contract?.current_version !== true) {
|
|
228
|
+
signals.push(BLOCKING_SIGNALS.contractNotCurrent);
|
|
229
|
+
missing.push("slice_contract.current_version=true");
|
|
230
|
+
}
|
|
231
|
+
if (state?.stale === true || (Array.isArray(state?.stale_inputs) && state.stale_inputs.length > 0)) {
|
|
232
|
+
signals.push(BLOCKING_SIGNALS.stale);
|
|
233
|
+
missing.push("ticket formalization inputs are current");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return signals.length === 0 ? allowedResult(evidenceRefs) : blockedResult(signals, missing, evidenceRefs);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Validate the complete implementation entry seam after ready-for-agent promotion.
|
|
241
|
+
*/
|
|
242
|
+
export function validateImplementationEntry(state, options = {}) {
|
|
243
|
+
const ticketResult = validateTicketFormalization(state, options);
|
|
244
|
+
if (ticketResult.result === "blocked") return ticketResult;
|
|
245
|
+
if (state?.predecessor_work_unit !== TICKET_DECOMPOSITION_WORK_UNIT) {
|
|
246
|
+
return blockedResult([BLOCKING_SIGNALS.invalidPredecessor], ["predecessor_work_unit=work-unit.ticket-decomposition"], ticketResult.evidence_refs);
|
|
247
|
+
}
|
|
248
|
+
if (state?.ready_for_agent !== true) {
|
|
249
|
+
return blockedResult([BLOCKING_SIGNALS.wrongRole], ["ready_for_agent=true"], ticketResult.evidence_refs);
|
|
250
|
+
}
|
|
251
|
+
return ticketResult;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export const lifecycleTransitionContract = Object.freeze({
|
|
255
|
+
implementation_work_unit: IMPLEMENTATION_WORK_UNIT,
|
|
256
|
+
ticket_decomposition_work_unit: TICKET_DECOMPOSITION_WORK_UNIT,
|
|
257
|
+
next_routes: NEXT_ROUTES,
|
|
258
|
+
blocking_signals: BLOCKING_SIGNALS,
|
|
259
|
+
});
|