@planu/cli 6.0.2 → 7.0.0
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/dist/index.d.ts +1 -2
- package/dist/index.js +1 -112
- package/dist/sdd-engine/contracts.d.ts +76 -0
- package/dist/sdd-engine/contracts.js +60 -0
- package/dist/sdd-engine/index.d.ts +5 -0
- package/dist/sdd-engine/index.js +5 -0
- package/dist/sdd-engine/patch-sandbox.d.ts +14 -0
- package/dist/sdd-engine/patch-sandbox.js +173 -0
- package/dist/sdd-engine/server.d.ts +5 -0
- package/dist/sdd-engine/server.js +30 -0
- package/dist/sdd-engine/task-window.d.ts +9 -0
- package/dist/sdd-engine/task-window.js +153 -0
- package/dist/sdd-engine/tools/execution-tools.d.ts +5 -0
- package/dist/sdd-engine/tools/execution-tools.js +138 -0
- package/dist/sdd-engine/tools/format-result.d.ts +4 -0
- package/dist/sdd-engine/tools/format-result.js +22 -0
- package/dist/sdd-engine/tools/workspace-tools.d.ts +3 -0
- package/dist/sdd-engine/tools/workspace-tools.js +193 -0
- package/dist/sdd-engine/tools.d.ts +3 -0
- package/dist/sdd-engine/tools.js +13 -0
- package/dist/types/sdd-engine.d.ts +91 -0
- package/dist/types/sdd-engine.js +2 -0
- package/package.json +60 -48
- package/dist/.planu-build.json +0 -1
- package/dist/cli/colors.d.ts +0 -14
- package/dist/cli/colors.js +0 -26
- package/dist/cli/commands/doctor.d.ts +0 -12
- package/dist/cli/commands/doctor.js +0 -91
- package/dist/cli/commands/init.d.ts +0 -3
- package/dist/cli/commands/init.js +0 -37
- package/dist/cli/commands/job.d.ts +0 -3
- package/dist/cli/commands/job.js +0 -112
- package/dist/cli/commands/list.d.ts +0 -3
- package/dist/cli/commands/list.js +0 -39
- package/dist/cli/commands/package-handoff.d.ts +0 -3
- package/dist/cli/commands/package-handoff.js +0 -75
- package/dist/cli/commands/spec.d.ts +0 -3
- package/dist/cli/commands/spec.js +0 -156
- package/dist/cli/commands/status.d.ts +0 -3
- package/dist/cli/commands/status.js +0 -113
- package/dist/cli/commands/validate.d.ts +0 -3
- package/dist/cli/commands/validate.js +0 -39
- package/dist/cli/formatter.d.ts +0 -26
- package/dist/cli/formatter.js +0 -126
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.js +0 -29
- package/dist/cli/project-detector.d.ts +0 -6
- package/dist/cli/project-detector.js +0 -12
- package/dist/cli/router.d.ts +0 -6
- package/dist/cli/router.js +0 -142
- package/dist/config/architecture-patterns.json +0 -324
- package/dist/config/detection-signals.json +0 -256
- package/dist/config/docs-registry.json +0 -94
- package/dist/config/dor-dod-items.json +0 -194
- package/dist/config/drift-severity.json +0 -22
- package/dist/config/event-brokers.json +0 -63
- package/dist/config/framework-registry/csharp-aspnet.json +0 -67
- package/dist/config/framework-registry/dart-flutter.json +0 -61
- package/dist/config/framework-registry/go-gin.json +0 -62
- package/dist/config/framework-registry/index.json +0 -164
- package/dist/config/framework-registry/java-springboot.json +0 -67
- package/dist/config/framework-registry/php-laravel.json +0 -67
- package/dist/config/framework-registry/python-django.json +0 -72
- package/dist/config/framework-registry/python-fastapi.json +0 -72
- package/dist/config/framework-registry/ruby-rails.json +0 -67
- package/dist/config/framework-registry/rust-actix.json +0 -61
- package/dist/config/framework-registry/swift-swiftui.json +0 -67
- package/dist/config/framework-registry/typescript-angular.json +0 -67
- package/dist/config/framework-registry/typescript-astro.json +0 -61
- package/dist/config/framework-registry/typescript-express.json +0 -67
- package/dist/config/framework-registry/typescript-nestjs.json +0 -62
- package/dist/config/framework-registry/typescript-nextjs.json +0 -82
- package/dist/config/framework-registry/typescript-nuxt.json +0 -67
- package/dist/config/framework-registry/typescript-react.json +0 -77
- package/dist/config/framework-registry/typescript-remix.json +0 -61
- package/dist/config/framework-registry/typescript-sveltekit.json +0 -67
- package/dist/config/framework-registry/typescript-vue.json +0 -72
- package/dist/config/hook-templates/planu-force-ask-user-question.sh +0 -14
- package/dist/config/hook-templates/planu-spec-sanctity.sh +0 -128
- package/dist/config/legacy-artifacts.json +0 -26
- package/dist/config/minimal-implementation-gate.json +0 -149
- package/dist/config/negative-predicate-phrases.json +0 -33
- package/dist/config/official-sdd-tools.d.ts +0 -7
- package/dist/config/official-sdd-tools.js +0 -44
- package/dist/config/out-of-scope-suggestions.json +0 -190
- package/dist/config/paradigm-registry.json +0 -380
- package/dist/config/project-knowledge-graph.json +0 -170
- package/dist/config/readiness-config.json +0 -22
- package/dist/config/registries/error-recovery.json +0 -114
- package/dist/config/registries/legacy-guidance.json +0 -118
- package/dist/config/registries/spec-folder-sanctity.json +0 -4
- package/dist/config/runtime-policy.json +0 -66
- package/dist/config/server-instructions.d.ts +0 -2
- package/dist/config/server-instructions.js +0 -18
- package/dist/config/skill-templates/planu-dogfood-bug.md +0 -43
- package/dist/config/skill-templates/planu-implement.md +0 -42
- package/dist/config/skill-templates/planu-native.md +0 -30
- package/dist/config/skill-templates/planu-new-spec.md +0 -56
- package/dist/config/skill-templates/planu-resume-work.md +0 -51
- package/dist/config/skill-templates/planu-review.md +0 -47
- package/dist/config/skill-templates/planu-validate.md +0 -59
- package/dist/config/stack-signatures.json +0 -793
- package/dist/config/subagent-templates/planu-challenger.md +0 -49
- package/dist/config/subagent-templates/planu-readiness-auditor.md +0 -51
- package/dist/config/subagent-templates/planu-spec-implementer.md +0 -50
- package/dist/config/subagent-templates/planu-validator.md +0 -56
- package/dist/config/technology-registry.json +0 -120
- package/dist/config/version.d.ts +0 -2
- package/dist/config/version.js +0 -20
- package/dist/core/shared/fs.d.ts +0 -10
- package/dist/core/shared/fs.js +0 -89
- package/dist/core/shared/object.d.ts +0 -3
- package/dist/core/shared/object.js +0 -12
- package/dist/core/shared/strings.d.ts +0 -3
- package/dist/core/shared/strings.js +0 -13
- package/dist/core/spec-validator.d.ts +0 -12
- package/dist/core/spec-validator.js +0 -250
- package/dist/engine/abortable-process-runner.d.ts +0 -26
- package/dist/engine/abortable-process-runner.js +0 -308
- package/dist/engine/ai-assurance/index.d.ts +0 -4
- package/dist/engine/ai-assurance/index.js +0 -3
- package/dist/engine/ai-assurance/new-code-gate.d.ts +0 -3
- package/dist/engine/ai-assurance/new-code-gate.js +0 -39
- package/dist/engine/ai-assurance/spec-assurance.d.ts +0 -3
- package/dist/engine/ai-assurance/spec-assurance.js +0 -138
- package/dist/engine/ai-integration/codex/agent-roles-generator.d.ts +0 -12
- package/dist/engine/ai-integration/codex/agent-roles-generator.js +0 -62
- package/dist/engine/ambiguity-scorer.d.ts +0 -13
- package/dist/engine/ambiguity-scorer.js +0 -155
- package/dist/engine/approval-workflow.d.ts +0 -21
- package/dist/engine/approval-workflow.js +0 -82
- package/dist/engine/audit-trail/hasher.d.ts +0 -18
- package/dist/engine/audit-trail/hasher.js +0 -46
- package/dist/engine/auditor-scoring.d.ts +0 -7
- package/dist/engine/auditor-scoring.js +0 -76
- package/dist/engine/build-freshness.d.ts +0 -4
- package/dist/engine/build-freshness.js +0 -170
- package/dist/engine/challenge-prioritizer.d.ts +0 -17
- package/dist/engine/challenge-prioritizer.js +0 -78
- package/dist/engine/clarification-gate/error-builder.d.ts +0 -12
- package/dist/engine/clarification-gate/error-builder.js +0 -33
- package/dist/engine/clarification-gate/gate.d.ts +0 -15
- package/dist/engine/clarification-gate/gate.js +0 -41
- package/dist/engine/clarification-gate/token-store.d.ts +0 -28
- package/dist/engine/clarification-gate/token-store.js +0 -67
- package/dist/engine/coach/i18n.d.ts +0 -11
- package/dist/engine/coach/i18n.js +0 -78
- package/dist/engine/code-scanner/gap-scorer.d.ts +0 -9
- package/dist/engine/code-scanner/gap-scorer.js +0 -89
- package/dist/engine/code-scanner/index.d.ts +0 -9
- package/dist/engine/code-scanner/index.js +0 -15
- package/dist/engine/code-scanner/keyword-extractor.d.ts +0 -11
- package/dist/engine/code-scanner/keyword-extractor.js +0 -88
- package/dist/engine/code-scanner/layer-scanner.d.ts +0 -24
- package/dist/engine/code-scanner/layer-scanner.js +0 -135
- package/dist/engine/compact/tool-list-compactor.d.ts +0 -7
- package/dist/engine/compact/tool-list-compactor.js +0 -87
- package/dist/engine/compact-obj.d.ts +0 -7
- package/dist/engine/compact-obj.js +0 -28
- package/dist/engine/complexity-budget/index.d.ts +0 -2
- package/dist/engine/complexity-budget/index.js +0 -3
- package/dist/engine/complexity-budget/trivial-detector.d.ts +0 -7
- package/dist/engine/complexity-budget/trivial-detector.js +0 -69
- package/dist/engine/config-loader.d.ts +0 -73
- package/dist/engine/config-loader.js +0 -239
- package/dist/engine/constitution/sdd-rules-registry.d.ts +0 -11
- package/dist/engine/constitution/sdd-rules-registry.js +0 -109
- package/dist/engine/context-merger.d.ts +0 -23
- package/dist/engine/context-merger.js +0 -197
- package/dist/engine/contradiction-detector.d.ts +0 -16
- package/dist/engine/contradiction-detector.js +0 -406
- package/dist/engine/convention-scanner/codebase-scanner.d.ts +0 -7
- package/dist/engine/convention-scanner/codebase-scanner.js +0 -390
- package/dist/engine/convention-scanner/convention-parser.d.ts +0 -7
- package/dist/engine/convention-scanner/convention-parser.js +0 -189
- package/dist/engine/convention-scanner/index.d.ts +0 -3
- package/dist/engine/convention-scanner/index.js +0 -5
- package/dist/engine/conventions-ttl.d.ts +0 -8
- package/dist/engine/conventions-ttl.js +0 -75
- package/dist/engine/core-bridge-duplicate-blocks.d.ts +0 -3
- package/dist/engine/core-bridge-duplicate-blocks.js +0 -56
- package/dist/engine/core-bridge-gaps.d.ts +0 -4
- package/dist/engine/core-bridge-gaps.js +0 -75
- package/dist/engine/core-bridge-project-graph.d.ts +0 -9
- package/dist/engine/core-bridge-project-graph.js +0 -499
- package/dist/engine/core-bridge.d.ts +0 -34
- package/dist/engine/core-bridge.js +0 -392
- package/dist/engine/criteria-quality-checker.d.ts +0 -8
- package/dist/engine/criteria-quality-checker.js +0 -55
- package/dist/engine/criterion-identity.d.ts +0 -7
- package/dist/engine/criterion-identity.js +0 -70
- package/dist/engine/data-projects-gc/pattern-matcher.d.ts +0 -21
- package/dist/engine/data-projects-gc/pattern-matcher.js +0 -68
- package/dist/engine/dep-guard/cycle-detector.d.ts +0 -29
- package/dist/engine/dep-guard/cycle-detector.js +0 -83
- package/dist/engine/dep-guard/index.d.ts +0 -3
- package/dist/engine/dep-guard/index.js +0 -3
- package/dist/engine/dependency-evaluator.d.ts +0 -15
- package/dist/engine/dependency-evaluator.js +0 -81
- package/dist/engine/detection-utils.d.ts +0 -13
- package/dist/engine/detection-utils.js +0 -255
- package/dist/engine/dor-dod/dod.d.ts +0 -17
- package/dist/engine/dor-dod/dod.js +0 -98
- package/dist/engine/dor-dod/dor.d.ts +0 -21
- package/dist/engine/dor-dod/dor.js +0 -149
- package/dist/engine/dor-dod/index.d.ts +0 -4
- package/dist/engine/dor-dod/index.js +0 -5
- package/dist/engine/dor-dod/items-loader.d.ts +0 -18
- package/dist/engine/dor-dod/items-loader.js +0 -55
- package/dist/engine/dor-dod/plan.d.ts +0 -8
- package/dist/engine/dor-dod/plan.js +0 -50
- package/dist/engine/dor-dod.d.ts +0 -2
- package/dist/engine/dor-dod.js +0 -4
- package/dist/engine/ears-gate.d.ts +0 -19
- package/dist/engine/ears-gate.js +0 -120
- package/dist/engine/elicitation/answer-extractor.d.ts +0 -4
- package/dist/engine/elicitation/answer-extractor.js +0 -225
- package/dist/engine/elicitation/capability.d.ts +0 -9
- package/dist/engine/elicitation/capability.js +0 -48
- package/dist/engine/elicitation/decision-gap-detector.d.ts +0 -3
- package/dist/engine/elicitation/decision-gap-detector.js +0 -142
- package/dist/engine/elicitation/elicit-helper.d.ts +0 -36
- package/dist/engine/elicitation/elicit-helper.js +0 -113
- package/dist/engine/elicitation/question-grounding-gate.d.ts +0 -3
- package/dist/engine/elicitation/question-grounding-gate.js +0 -103
- package/dist/engine/errors/error-result.d.ts +0 -4
- package/dist/engine/errors/error-result.js +0 -16
- package/dist/engine/errors/error-wrapper.d.ts +0 -4
- package/dist/engine/errors/error-wrapper.js +0 -82
- package/dist/engine/errors/recovery-registry.d.ts +0 -13
- package/dist/engine/errors/recovery-registry.js +0 -96
- package/dist/engine/errors/registry-loader.d.ts +0 -3
- package/dist/engine/errors/registry-loader.js +0 -22
- package/dist/engine/event-detector.d.ts +0 -33
- package/dist/engine/event-detector.js +0 -97
- package/dist/engine/evidence-gates/artifact-reader.d.ts +0 -133
- package/dist/engine/evidence-gates/artifact-reader.js +0 -387
- package/dist/engine/evidence-gates/evidence-autofill.d.ts +0 -15
- package/dist/engine/evidence-gates/evidence-autofill.js +0 -255
- package/dist/engine/evidence-gates/evidence-skeletons.d.ts +0 -19
- package/dist/engine/evidence-gates/evidence-skeletons.js +0 -78
- package/dist/engine/evidence-gates/lifecycle-gate.d.ts +0 -12
- package/dist/engine/evidence-gates/lifecycle-gate.js +0 -293
- package/dist/engine/evidence-gates/reconciliation-freshness.d.ts +0 -11
- package/dist/engine/evidence-gates/reconciliation-freshness.js +0 -73
- package/dist/engine/evidence-index/done-drift.d.ts +0 -7
- package/dist/engine/evidence-index/done-drift.js +0 -91
- package/dist/engine/evidence-index/index-builder.d.ts +0 -10
- package/dist/engine/evidence-index/index-builder.js +0 -202
- package/dist/engine/execution/context.d.ts +0 -19
- package/dist/engine/execution/context.js +0 -130
- package/dist/engine/execution/deadline-io.d.ts +0 -20
- package/dist/engine/execution/deadline-io.js +0 -30
- package/dist/engine/execution/durable-job-heartbeat-runtime.d.ts +0 -4
- package/dist/engine/execution/durable-job-heartbeat-runtime.js +0 -401
- package/dist/engine/execution/job-runtime.d.ts +0 -101
- package/dist/engine/execution/job-runtime.js +0 -319
- package/dist/engine/execution/operation-journal.d.ts +0 -67
- package/dist/engine/execution/operation-journal.js +0 -266
- package/dist/engine/execution/package-handoff-job-executor.d.ts +0 -22
- package/dist/engine/execution/package-handoff-job-executor.js +0 -510
- package/dist/engine/execution/public-job-sanitizer.d.ts +0 -4
- package/dist/engine/execution/public-job-sanitizer.js +0 -31
- package/dist/engine/execution/startup-recovery.d.ts +0 -3
- package/dist/engine/execution/startup-recovery.js +0 -15
- package/dist/engine/execution/validate-job-executor.d.ts +0 -37
- package/dist/engine/execution/validate-job-executor.js +0 -900
- package/dist/engine/execution/validate-job-payload.d.ts +0 -5
- package/dist/engine/execution/validate-job-payload.js +0 -145
- package/dist/engine/execution/validate-job-recovery.d.ts +0 -4
- package/dist/engine/execution/validate-job-recovery.js +0 -47
- package/dist/engine/execution/validate-worker-runtime.d.ts +0 -10
- package/dist/engine/execution/validate-worker-runtime.js +0 -188
- package/dist/engine/execution/validate-worker-thread.d.ts +0 -2
- package/dist/engine/execution/validate-worker-thread.js +0 -65
- package/dist/engine/framework-detector.d.ts +0 -35
- package/dist/engine/framework-detector.js +0 -268
- package/dist/engine/freeze/freeze-checker.d.ts +0 -14
- package/dist/engine/freeze/freeze-checker.js +0 -28
- package/dist/engine/freeze/unlock-token.d.ts +0 -17
- package/dist/engine/freeze/unlock-token.js +0 -30
- package/dist/engine/frontmatter-parser.d.ts +0 -32
- package/dist/engine/frontmatter-parser.js +0 -157
- package/dist/engine/frontmatter-sha/canonicalize.d.ts +0 -9
- package/dist/engine/frontmatter-sha/canonicalize.js +0 -20
- package/dist/engine/frontmatter-sha/compute-sha.d.ts +0 -8
- package/dist/engine/frontmatter-sha/compute-sha.js +0 -14
- package/dist/engine/frontmatter-sha/frozen-fields.d.ts +0 -6
- package/dist/engine/frontmatter-sha/frozen-fields.js +0 -14
- package/dist/engine/frontmatter-sha/index.d.ts +0 -2
- package/dist/engine/frontmatter-sha/index.js +0 -3
- package/dist/engine/git/branch-detector.d.ts +0 -7
- package/dist/engine/git/branch-detector.js +0 -45
- package/dist/engine/git/exec-git.d.ts +0 -2
- package/dist/engine/git/exec-git.js +0 -14
- package/dist/engine/git/git-command-guard.d.ts +0 -2
- package/dist/engine/git/git-command-guard.js +0 -43
- package/dist/engine/git/repository-probe.d.ts +0 -3
- package/dist/engine/git/repository-probe.js +0 -13
- package/dist/engine/handoff-artifacts/implementation-review-reader.d.ts +0 -4
- package/dist/engine/handoff-artifacts/implementation-review-reader.js +0 -86
- package/dist/engine/handoff-artifacts/io.d.ts +0 -51
- package/dist/engine/handoff-artifacts/io.js +0 -200
- package/dist/engine/handoff-artifacts/schema-skeleton.d.ts +0 -5
- package/dist/engine/handoff-artifacts/schema-skeleton.js +0 -108
- package/dist/engine/handoff-artifacts/schemas.d.ts +0 -164
- package/dist/engine/handoff-artifacts/schemas.js +0 -242
- package/dist/engine/handoff-artifacts/validation-result.d.ts +0 -18
- package/dist/engine/handoff-artifacts/validation-result.js +0 -3
- package/dist/engine/handoff-artifacts/version-policy.d.ts +0 -18
- package/dist/engine/handoff-artifacts/version-policy.js +0 -35
- package/dist/engine/handoff-format.d.ts +0 -26
- package/dist/engine/handoff-format.js +0 -253
- package/dist/engine/handoff-packager.d.ts +0 -30
- package/dist/engine/handoff-packager.js +0 -864
- package/dist/engine/host-detection/detect-host.d.ts +0 -10
- package/dist/engine/host-detection/detect-host.js +0 -34
- package/dist/engine/host-rules-templates/index.d.ts +0 -3
- package/dist/engine/host-rules-templates/index.js +0 -4
- package/dist/engine/host-rules-templates/inject-rules-block.d.ts +0 -3
- package/dist/engine/host-rules-templates/inject-rules-block.js +0 -29
- package/dist/engine/host-rules-templates/templates.d.ts +0 -12
- package/dist/engine/host-rules-templates/templates.js +0 -111
- package/dist/engine/host-tool-filter.d.ts +0 -28
- package/dist/engine/host-tool-filter.js +0 -162
- package/dist/engine/human-summary.d.ts +0 -18
- package/dist/engine/human-summary.js +0 -114
- package/dist/engine/implementation-contract/common.d.ts +0 -22
- package/dist/engine/implementation-contract/common.js +0 -47
- package/dist/engine/implementation-contract/evaluator.d.ts +0 -3
- package/dist/engine/implementation-contract/evaluator.js +0 -192
- package/dist/engine/implementation-contract/index.d.ts +0 -4
- package/dist/engine/implementation-contract/index.js +0 -4
- package/dist/engine/implementation-contract/renderer.d.ts +0 -4
- package/dist/engine/implementation-contract/renderer.js +0 -114
- package/dist/engine/keyword-matcher/boundary.d.ts +0 -18
- package/dist/engine/keyword-matcher/boundary.js +0 -30
- package/dist/engine/keyword-matcher/extractor.d.ts +0 -14
- package/dist/engine/keyword-matcher/extractor.js +0 -85
- package/dist/engine/keyword-matcher/index.d.ts +0 -5
- package/dist/engine/keyword-matcher/index.js +0 -11
- package/dist/engine/keyword-matcher/matcher.d.ts +0 -28
- package/dist/engine/keyword-matcher/matcher.js +0 -79
- package/dist/engine/keyword-matcher/stopwords.d.ts +0 -26
- package/dist/engine/keyword-matcher/stopwords.js +0 -100
- package/dist/engine/lifecycle-hints.d.ts +0 -12
- package/dist/engine/lifecycle-hints.js +0 -61
- package/dist/engine/lifecycle-reconciliation-io.d.ts +0 -11
- package/dist/engine/lifecycle-reconciliation-io.js +0 -181
- package/dist/engine/lifecycle-reconciliation.d.ts +0 -16
- package/dist/engine/lifecycle-reconciliation.js +0 -460
- package/dist/engine/living-spec-analyzer.d.ts +0 -10
- package/dist/engine/living-spec-analyzer.js +0 -397
- package/dist/engine/minimality/analyzer.d.ts +0 -3
- package/dist/engine/minimality/analyzer.js +0 -182
- package/dist/engine/minimality/formatter.d.ts +0 -3
- package/dist/engine/minimality/formatter.js +0 -25
- package/dist/engine/minimality/index.d.ts +0 -3
- package/dist/engine/minimality/index.js +0 -3
- package/dist/engine/minimality/policy-loader.d.ts +0 -3
- package/dist/engine/minimality/policy-loader.js +0 -364
- package/dist/engine/model-tier-resolver.d.ts +0 -4
- package/dist/engine/model-tier-resolver.js +0 -15
- package/dist/engine/network-policy.d.ts +0 -4
- package/dist/engine/network-policy.js +0 -96
- package/dist/engine/onboarding/new-project-resolver.d.ts +0 -6
- package/dist/engine/onboarding/new-project-resolver.js +0 -265
- package/dist/engine/opencode/config-scaffold.d.ts +0 -3
- package/dist/engine/opencode/config-scaffold.js +0 -99
- package/dist/engine/paradigm-detector.d.ts +0 -12
- package/dist/engine/paradigm-detector.js +0 -236
- package/dist/engine/paradigm-registry.d.ts +0 -20
- package/dist/engine/paradigm-registry.js +0 -44
- package/dist/engine/phase-tracker.d.ts +0 -41
- package/dist/engine/phase-tracker.js +0 -89
- package/dist/engine/planu-config-writer.d.ts +0 -33
- package/dist/engine/planu-config-writer.js +0 -68
- package/dist/engine/project-command-runtime.d.ts +0 -5
- package/dist/engine/project-command-runtime.js +0 -87
- package/dist/engine/project-graph/builder.d.ts +0 -7
- package/dist/engine/project-graph/builder.js +0 -320
- package/dist/engine/project-graph/cache.d.ts +0 -47
- package/dist/engine/project-graph/cache.js +0 -739
- package/dist/engine/project-graph/extractors/decision-store-extractor.d.ts +0 -3
- package/dist/engine/project-graph/extractors/decision-store-extractor.js +0 -58
- package/dist/engine/project-graph/extractors/git-extractor.d.ts +0 -7
- package/dist/engine/project-graph/extractors/git-extractor.js +0 -89
- package/dist/engine/project-graph/extractors/handoff-extractor.d.ts +0 -3
- package/dist/engine/project-graph/extractors/handoff-extractor.js +0 -55
- package/dist/engine/project-graph/extractors/spec-extractor.d.ts +0 -3
- package/dist/engine/project-graph/extractors/spec-extractor.js +0 -189
- package/dist/engine/project-graph/extractors/validation-extractor.d.ts +0 -3
- package/dist/engine/project-graph/extractors/validation-extractor.js +0 -36
- package/dist/engine/project-graph/freshness-projection.d.ts +0 -16
- package/dist/engine/project-graph/freshness-projection.js +0 -98
- package/dist/engine/project-graph/index.d.ts +0 -2
- package/dist/engine/project-graph/index.js +0 -2
- package/dist/engine/project-graph/native.d.ts +0 -3
- package/dist/engine/project-graph/native.js +0 -36
- package/dist/engine/project-graph/query.d.ts +0 -8
- package/dist/engine/project-graph/query.js +0 -193
- package/dist/engine/project-graph/redaction.d.ts +0 -4
- package/dist/engine/project-graph/redaction.js +0 -11
- package/dist/engine/project-scanner/convention-detector.d.ts +0 -3
- package/dist/engine/project-scanner/convention-detector.js +0 -149
- package/dist/engine/project-scanner/index.d.ts +0 -4
- package/dist/engine/project-scanner/index.js +0 -18
- package/dist/engine/project-scanner/quality-baseline.d.ts +0 -3
- package/dist/engine/project-scanner/quality-baseline.js +0 -72
- package/dist/engine/project-scanner/stack-detector.d.ts +0 -3
- package/dist/engine/project-scanner/stack-detector.js +0 -128
- package/dist/engine/readiness-checker.d.ts +0 -56
- package/dist/engine/readiness-checker.js +0 -566
- package/dist/engine/readiness-config-loader.d.ts +0 -23
- package/dist/engine/readiness-config-loader.js +0 -63
- package/dist/engine/reconcile/apply-changes.d.ts +0 -4
- package/dist/engine/reconcile/apply-changes.js +0 -106
- package/dist/engine/reconcile/propagate-mirrors.d.ts +0 -3
- package/dist/engine/reconcile/propagate-mirrors.js +0 -311
- package/dist/engine/reconcile/verify-write.d.ts +0 -10
- package/dist/engine/reconcile/verify-write.js +0 -49
- package/dist/engine/registry-extender.d.ts +0 -25
- package/dist/engine/registry-extender.js +0 -60
- package/dist/engine/reviewer-tokens/issuer.d.ts +0 -29
- package/dist/engine/reviewer-tokens/issuer.js +0 -88
- package/dist/engine/reviewer-tokens/signer.d.ts +0 -17
- package/dist/engine/reviewer-tokens/signer.js +0 -51
- package/dist/engine/reviewer-tokens/types.d.ts +0 -2
- package/dist/engine/reviewer-tokens/types.js +0 -2
- package/dist/engine/runtime-policy.d.ts +0 -9
- package/dist/engine/runtime-policy.js +0 -163
- package/dist/engine/safety/atomic-write-file.d.ts +0 -39
- package/dist/engine/safety/atomic-write-file.js +0 -195
- package/dist/engine/safety/atomic-writer.d.ts +0 -22
- package/dist/engine/safety/atomic-writer.js +0 -97
- package/dist/engine/safety/contained-project-file.d.ts +0 -3
- package/dist/engine/safety/contained-project-file.js +0 -23
- package/dist/engine/safety/cross-process-lock.d.ts +0 -13
- package/dist/engine/safety/cross-process-lock.js +0 -318
- package/dist/engine/safety/file-mutex.d.ts +0 -6
- package/dist/engine/safety/file-mutex.js +0 -182
- package/dist/engine/safety/lock-lease-store.d.ts +0 -84
- package/dist/engine/safety/lock-lease-store.js +0 -383
- package/dist/engine/safety/lock-scavenger.d.ts +0 -8
- package/dist/engine/safety/lock-scavenger.js +0 -198
- package/dist/engine/safety/lock-staleness.d.ts +0 -33
- package/dist/engine/safety/lock-staleness.js +0 -76
- package/dist/engine/safety/obsolete-lock-guard.d.ts +0 -8
- package/dist/engine/safety/obsolete-lock-guard.js +0 -31
- package/dist/engine/scope-boundaries/contradiction-checker.d.ts +0 -7
- package/dist/engine/scope-boundaries/contradiction-checker.js +0 -276
- package/dist/engine/scope-boundaries/index.d.ts +0 -4
- package/dist/engine/scope-boundaries/index.js +0 -5
- package/dist/engine/scope-boundaries/scope-validator.d.ts +0 -7
- package/dist/engine/scope-boundaries/scope-validator.js +0 -114
- package/dist/engine/scope-boundaries/suggester.d.ts +0 -8
- package/dist/engine/scope-boundaries/suggester.js +0 -27
- package/dist/engine/score-to-grade.d.ts +0 -2
- package/dist/engine/score-to-grade.js +0 -16
- package/dist/engine/sdd-model-routing.d.ts +0 -15
- package/dist/engine/sdd-model-routing.js +0 -200
- package/dist/engine/spec-dependency-graph.d.ts +0 -33
- package/dist/engine/spec-dependency-graph.js +0 -243
- package/dist/engine/spec-difficulty.d.ts +0 -3
- package/dist/engine/spec-difficulty.js +0 -17
- package/dist/engine/spec-folder-sanctity.d.ts +0 -5
- package/dist/engine/spec-folder-sanctity.js +0 -32
- package/dist/engine/spec-format/acceptance-criteria.d.ts +0 -10
- package/dist/engine/spec-format/acceptance-criteria.js +0 -157
- package/dist/engine/spec-format/bdd-parser.d.ts +0 -19
- package/dist/engine/spec-format/bdd-parser.js +0 -224
- package/dist/engine/spec-format/copula-blacklist.d.ts +0 -15
- package/dist/engine/spec-format/copula-blacklist.js +0 -31
- package/dist/engine/spec-format/criteria-drift.d.ts +0 -3
- package/dist/engine/spec-format/criteria-drift.js +0 -36
- package/dist/engine/spec-format/executable-test-path.d.ts +0 -2
- package/dist/engine/spec-format/executable-test-path.js +0 -5
- package/dist/engine/spec-format/lean-spec-generator.d.ts +0 -8
- package/dist/engine/spec-format/lean-spec-generator.js +0 -236
- package/dist/engine/spec-format/lean-technical-generator.d.ts +0 -5
- package/dist/engine/spec-format/lean-technical-generator.js +0 -45
- package/dist/engine/spec-format/markdown-sections.d.ts +0 -14
- package/dist/engine/spec-format/markdown-sections.js +0 -105
- package/dist/engine/spec-format/metadata-value-policy.d.ts +0 -156
- package/dist/engine/spec-format/metadata-value-policy.js +0 -86
- package/dist/engine/spec-format/read-technical-section.d.ts +0 -25
- package/dist/engine/spec-format/read-technical-section.js +0 -99
- package/dist/engine/spec-format/replace-section.d.ts +0 -17
- package/dist/engine/spec-format/replace-section.js +0 -79
- package/dist/engine/spec-format/retired-scaffold.d.ts +0 -3
- package/dist/engine/spec-format/retired-scaffold.js +0 -5
- package/dist/engine/spec-format/spec-id.d.ts +0 -8
- package/dist/engine/spec-format/spec-id.js +0 -25
- package/dist/engine/spec-format/technical-md-populator.d.ts +0 -17
- package/dist/engine/spec-format/technical-md-populator.js +0 -321
- package/dist/engine/spec-format/text-fences.d.ts +0 -6
- package/dist/engine/spec-format/text-fences.js +0 -28
- package/dist/engine/spec-format/unified-spec-builder.d.ts +0 -25
- package/dist/engine/spec-format/unified-spec-builder.js +0 -400
- package/dist/engine/spec-generator/fallback-generator.d.ts +0 -5
- package/dist/engine/spec-generator/fallback-generator.js +0 -41
- package/dist/engine/spec-generator/index.d.ts +0 -2
- package/dist/engine/spec-generator/index.js +0 -2
- package/dist/engine/spec-grounding/contract.d.ts +0 -24
- package/dist/engine/spec-grounding/contract.js +0 -278
- package/dist/engine/spec-grounding/grounding-entry-parser.d.ts +0 -4
- package/dist/engine/spec-grounding/grounding-entry-parser.js +0 -184
- package/dist/engine/spec-health-scorer.d.ts +0 -7
- package/dist/engine/spec-health-scorer.js +0 -134
- package/dist/engine/spec-language/english-only.d.ts +0 -30
- package/dist/engine/spec-language/english-only.js +0 -224
- package/dist/engine/spec-migrator/criteria-scanner.d.ts +0 -7
- package/dist/engine/spec-migrator/criteria-scanner.js +0 -113
- package/dist/engine/spec-migrator/drift-detector.d.ts +0 -10
- package/dist/engine/spec-migrator/drift-detector.js +0 -142
- package/dist/engine/spec-migrator/filesystem-import.d.ts +0 -10
- package/dist/engine/spec-migrator/filesystem-import.js +0 -205
- package/dist/engine/spec-migrator/flatten-specs.d.ts +0 -12
- package/dist/engine/spec-migrator/flatten-specs.js +0 -111
- package/dist/engine/spec-migrator/folder-operations.d.ts +0 -7
- package/dist/engine/spec-migrator/folder-operations.js +0 -109
- package/dist/engine/spec-migrator/frontmatter-parser.d.ts +0 -11
- package/dist/engine/spec-migrator/frontmatter-parser.js +0 -111
- package/dist/engine/spec-migrator/git-aware-fs.d.ts +0 -9
- package/dist/engine/spec-migrator/git-aware-fs.js +0 -20
- package/dist/engine/spec-migrator/index.d.ts +0 -10
- package/dist/engine/spec-migrator/index.js +0 -23
- package/dist/engine/spec-migrator/lean-migration.d.ts +0 -8
- package/dist/engine/spec-migrator/lean-migration.js +0 -405
- package/dist/engine/spec-migrator/legacy-classifier.d.ts +0 -4
- package/dist/engine/spec-migrator/legacy-classifier.js +0 -70
- package/dist/engine/spec-migrator/legacy-migration.d.ts +0 -13
- package/dist/engine/spec-migrator/legacy-migration.js +0 -88
- package/dist/engine/spec-migrator/path-utils.d.ts +0 -13
- package/dist/engine/spec-migrator/path-utils.js +0 -40
- package/dist/engine/spec-migrator/planu-canonical-policy.d.ts +0 -18
- package/dist/engine/spec-migrator/planu-canonical-policy.js +0 -105
- package/dist/engine/spec-migrator/prefix-migration.d.ts +0 -11
- package/dist/engine/spec-migrator/prefix-migration.js +0 -85
- package/dist/engine/spec-migrator/reconcile-paths.d.ts +0 -12
- package/dist/engine/spec-migrator/reconcile-paths.js +0 -77
- package/dist/engine/spec-migrator/strict-planu-cleanup.d.ts +0 -7
- package/dist/engine/spec-migrator/strict-planu-cleanup.js +0 -308
- package/dist/engine/spec-migrator/version-detection.d.ts +0 -5
- package/dist/engine/spec-migrator/version-detection.js +0 -19
- package/dist/engine/spec-migrator.d.ts +0 -2
- package/dist/engine/spec-migrator.js +0 -3
- package/dist/engine/spec-quality/generic-output-gate.d.ts +0 -9
- package/dist/engine/spec-quality/generic-output-gate.js +0 -350
- package/dist/engine/spec-quality-scorer.d.ts +0 -4
- package/dist/engine/spec-quality-scorer.js +0 -423
- package/dist/engine/spec-reader.d.ts +0 -7
- package/dist/engine/spec-reader.js +0 -23
- package/dist/engine/spec-state-machine/transition-spec.d.ts +0 -56
- package/dist/engine/spec-state-machine/transition-spec.js +0 -59
- package/dist/engine/spec-versioner.d.ts +0 -28
- package/dist/engine/spec-versioner.js +0 -92
- package/dist/engine/spec-versioning/bump-version.d.ts +0 -17
- package/dist/engine/spec-versioning/bump-version.js +0 -199
- package/dist/engine/spec-versioning/migrate-format.d.ts +0 -23
- package/dist/engine/spec-versioning/migrate-format.js +0 -96
- package/dist/engine/spec-versioning/render-history.d.ts +0 -14
- package/dist/engine/spec-versioning/render-history.js +0 -31
- package/dist/engine/technology-registry.d.ts +0 -11
- package/dist/engine/technology-registry.js +0 -142
- package/dist/engine/test-selection/policy.d.ts +0 -9
- package/dist/engine/test-selection/policy.js +0 -192
- package/dist/engine/text-signal-boundaries.d.ts +0 -8
- package/dist/engine/text-signal-boundaries.js +0 -122
- package/dist/engine/time/relative-date.d.ts +0 -3
- package/dist/engine/time/relative-date.js +0 -16
- package/dist/engine/timing/budget.d.ts +0 -29
- package/dist/engine/timing/budget.js +0 -129
- package/dist/engine/universal-rules/catalog.d.ts +0 -7
- package/dist/engine/universal-rules/catalog.js +0 -25
- package/dist/engine/universal-rules/host-writer.d.ts +0 -7
- package/dist/engine/universal-rules/host-writer.js +0 -113
- package/dist/engine/universal-rules/installer.d.ts +0 -5
- package/dist/engine/universal-rules/installer.js +0 -236
- package/dist/engine/universal-rules/rules/planu-approval-gates.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-approval-gates.js +0 -48
- package/dist/engine/universal-rules/rules/planu-bdd-criteria.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-bdd-criteria.js +0 -44
- package/dist/engine/universal-rules/rules/planu-dogfood-bugs.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-dogfood-bugs.js +0 -70
- package/dist/engine/universal-rules/rules/planu-english-specs.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-english-specs.js +0 -41
- package/dist/engine/universal-rules/rules/planu-minimal-change.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-minimal-change.js +0 -42
- package/dist/engine/universal-rules/rules/planu-modes.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-modes.js +0 -57
- package/dist/engine/universal-rules/rules/planu-sdd-model-routing.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-sdd-model-routing.js +0 -50
- package/dist/engine/universal-rules/rules/planu-workflow.d.ts +0 -3
- package/dist/engine/universal-rules/rules/planu-workflow.js +0 -92
- package/dist/engine/universal-rules/user-edit-detector.d.ts +0 -21
- package/dist/engine/universal-rules/user-edit-detector.js +0 -46
- package/dist/engine/validation/durable-validation.d.ts +0 -44
- package/dist/engine/validation/durable-validation.js +0 -344
- package/dist/engine/validation/validation-freshness.d.ts +0 -73
- package/dist/engine/validation/validation-freshness.js +0 -777
- package/dist/engine/validation/validation-receipt-codec.d.ts +0 -13
- package/dist/engine/validation/validation-receipt-codec.js +0 -184
- package/dist/engine/validation/validation-receipt.d.ts +0 -67
- package/dist/engine/validation/validation-receipt.js +0 -342
- package/dist/engine/validation/validation-source-digest.d.ts +0 -2
- package/dist/engine/validation/validation-source-digest.js +0 -86
- package/dist/engine/validation/validation-source-policy.d.ts +0 -4
- package/dist/engine/validation/validation-source-policy.js +0 -17
- package/dist/engine/validation/validation-submission.d.ts +0 -35
- package/dist/engine/validation/validation-submission.js +0 -142
- package/dist/engine/validation/validation-worktree.d.ts +0 -21
- package/dist/engine/validation/validation-worktree.js +0 -294
- package/dist/engine/validation-evidence-digest.d.ts +0 -4
- package/dist/engine/validation-evidence-digest.js +0 -83
- package/dist/engine/validation-evidence-ledger.d.ts +0 -30
- package/dist/engine/validation-evidence-ledger.js +0 -328
- package/dist/engine/validation-impact-planner.d.ts +0 -14
- package/dist/engine/validation-impact-planner.js +0 -74
- package/dist/engine/validation-loop.d.ts +0 -12
- package/dist/engine/validation-loop.js +0 -216
- package/dist/engine/validator/analyzer.d.ts +0 -23
- package/dist/engine/validator/analyzer.js +0 -490
- package/dist/engine/validator/blast-radius-gate.d.ts +0 -3
- package/dist/engine/validator/blast-radius-gate.js +0 -305
- package/dist/engine/validator/checklist.d.ts +0 -6
- package/dist/engine/validator/checklist.js +0 -147
- package/dist/engine/validator/deep-code-checker.d.ts +0 -49
- package/dist/engine/validator/deep-code-checker.js +0 -410
- package/dist/engine/validator/dor-dod.d.ts +0 -11
- package/dist/engine/validator/dor-dod.js +0 -338
- package/dist/engine/validator/executable-evidence.d.ts +0 -18
- package/dist/engine/validator/executable-evidence.js +0 -104
- package/dist/engine/validator/extractors.d.ts +0 -16
- package/dist/engine/validator/extractors.js +0 -105
- package/dist/engine/validator/gates/code-gates.d.ts +0 -14
- package/dist/engine/validator/gates/code-gates.js +0 -87
- package/dist/engine/validator/gates/convention-gates.d.ts +0 -13
- package/dist/engine/validator/gates/convention-gates.js +0 -84
- package/dist/engine/validator/gates/index.d.ts +0 -8
- package/dist/engine/validator/gates/index.js +0 -63
- package/dist/engine/validator/gates/test-gates.d.ts +0 -12
- package/dist/engine/validator/gates/test-gates.js +0 -105
- package/dist/engine/validator/holistic-report.d.ts +0 -11
- package/dist/engine/validator/holistic-report.js +0 -34
- package/dist/engine/validator/negative-predicate.d.ts +0 -17
- package/dist/engine/validator/negative-predicate.js +0 -240
- package/dist/engine/validator/reliability-gate.d.ts +0 -4
- package/dist/engine/validator/reliability-gate.js +0 -81
- package/dist/engine/validator/scope-resolver.d.ts +0 -30
- package/dist/engine/validator/scope-resolver.js +0 -67
- package/dist/engine/validator/spec-compliance-runner.d.ts +0 -9
- package/dist/engine/validator/spec-compliance-runner.js +0 -825
- package/dist/engine/validator/test-evidence-grounding.d.ts +0 -64
- package/dist/engine/validator/test-evidence-grounding.js +0 -221
- package/dist/engine/validator/validation-report-writer.d.ts +0 -27
- package/dist/engine/validator/validation-report-writer.js +0 -208
- package/dist/engine/validator.d.ts +0 -19
- package/dist/engine/validator.js +0 -244
- package/dist/engine/verifier/bdd-entity-extractor.d.ts +0 -23
- package/dist/engine/verifier/bdd-entity-extractor.js +0 -227
- package/dist/engine/verifier/compliance-scorer.d.ts +0 -17
- package/dist/engine/verifier/compliance-scorer.js +0 -131
- package/dist/engine/verifier/criterion-matcher.d.ts +0 -22
- package/dist/engine/verifier/criterion-matcher.js +0 -309
- package/dist/engine/web-fetcher/registry-loader.d.ts +0 -7
- package/dist/engine/web-fetcher/registry-loader.js +0 -44
- package/dist/engine/whats-new.d.ts +0 -2
- package/dist/engine/whats-new.js +0 -42
- package/dist/errors/classified-degradation.d.ts +0 -3
- package/dist/errors/classified-degradation.js +0 -10
- package/dist/errors/degradation-sink.d.ts +0 -3
- package/dist/errors/degradation-sink.js +0 -5
- package/dist/errors/error-taxonomy.d.ts +0 -11
- package/dist/errors/error-taxonomy.js +0 -59
- package/dist/hosts/claude-code/coach.d.ts +0 -6
- package/dist/hosts/claude-code/coach.js +0 -10
- package/dist/hosts/claude-code/ux/subagent-publisher.d.ts +0 -20
- package/dist/hosts/claude-code/ux/subagent-publisher.js +0 -117
- package/dist/hosts/codex/config-scaffold.d.ts +0 -10
- package/dist/hosts/codex/config-scaffold.js +0 -102
- package/dist/hosts/codex/workspace-scope.d.ts +0 -43
- package/dist/hosts/codex/workspace-scope.js +0 -89
- package/dist/hosts/gemini/config-scaffold.d.ts +0 -14
- package/dist/hosts/gemini/config-scaffold.js +0 -165
- package/dist/i18n/index.d.ts +0 -61
- package/dist/i18n/index.js +0 -288
- package/dist/prompts/index.d.ts +0 -6
- package/dist/prompts/index.js +0 -121
- package/dist/resources/process.d.ts +0 -11
- package/dist/resources/process.js +0 -80
- package/dist/resources/registry.d.ts +0 -6
- package/dist/resources/registry.js +0 -16
- package/dist/resources/specs.d.ts +0 -11
- package/dist/resources/specs.js +0 -58
- package/dist/security/adapters/environment.d.ts +0 -12
- package/dist/security/adapters/environment.js +0 -25
- package/dist/security/adapters/local-file.d.ts +0 -12
- package/dist/security/adapters/local-file.js +0 -56
- package/dist/security/adapters/macos-keychain.d.ts +0 -20
- package/dist/security/adapters/macos-keychain.js +0 -151
- package/dist/security/redactor.d.ts +0 -5
- package/dist/security/redactor.js +0 -58
- package/dist/security/secret-provider.d.ts +0 -22
- package/dist/security/secret-provider.js +0 -107
- package/dist/storage/approval-operation-lock.d.ts +0 -7
- package/dist/storage/approval-operation-lock.js +0 -47
- package/dist/storage/approval-store.d.ts +0 -14
- package/dist/storage/approval-store.js +0 -117
- package/dist/storage/audit-trail-store.d.ts +0 -20
- package/dist/storage/audit-trail-store.js +0 -83
- package/dist/storage/base-store.d.ts +0 -69
- package/dist/storage/base-store.js +0 -195
- package/dist/storage/compliance-gate-config-store.d.ts +0 -4
- package/dist/storage/compliance-gate-config-store.js +0 -20
- package/dist/storage/convention-baseline.d.ts +0 -20
- package/dist/storage/convention-baseline.js +0 -62
- package/dist/storage/current-project.d.ts +0 -3
- package/dist/storage/current-project.js +0 -21
- package/dist/storage/file-mutex.d.ts +0 -14
- package/dist/storage/file-mutex.js +0 -47
- package/dist/storage/global-projects-store.d.ts +0 -53
- package/dist/storage/global-projects-store.js +0 -181
- package/dist/storage/global-store.d.ts +0 -82
- package/dist/storage/global-store.js +0 -246
- package/dist/storage/index.d.ts +0 -15
- package/dist/storage/index.js +0 -16
- package/dist/storage/knowledge-store/knowledge.d.ts +0 -25
- package/dist/storage/knowledge-store/knowledge.js +0 -112
- package/dist/storage/knowledge-store/sessions.d.ts +0 -16
- package/dist/storage/knowledge-store/sessions.js +0 -155
- package/dist/storage/knowledge-store.d.ts +0 -3
- package/dist/storage/knowledge-store.js +0 -8
- package/dist/storage/migrations/canonical-storage.d.ts +0 -15
- package/dist/storage/migrations/canonical-storage.js +0 -754
- package/dist/storage/migrations/sdd-core-v6.d.ts +0 -11
- package/dist/storage/migrations/sdd-core-v6.js +0 -873
- package/dist/storage/pattern-store.d.ts +0 -38
- package/dist/storage/pattern-store.js +0 -136
- package/dist/storage/project-identity.d.ts +0 -60
- package/dist/storage/project-identity.js +0 -454
- package/dist/storage/project-resolver.d.ts +0 -17
- package/dist/storage/project-resolver.js +0 -134
- package/dist/storage/retention.d.ts +0 -13
- package/dist/storage/retention.js +0 -383
- package/dist/storage/runtime-db.d.ts +0 -207
- package/dist/storage/runtime-db.js +0 -1313
- package/dist/storage/schema-registry.d.ts +0 -5
- package/dist/storage/schema-registry.js +0 -74
- package/dist/storage/spec-index.d.ts +0 -23
- package/dist/storage/spec-index.js +0 -117
- package/dist/storage/spec-lock-store.d.ts +0 -22
- package/dist/storage/spec-lock-store.js +0 -99
- package/dist/storage/spec-store.d.ts +0 -170
- package/dist/storage/spec-store.js +0 -968
- package/dist/storage/storage-bundle.d.ts +0 -16
- package/dist/storage/storage-bundle.js +0 -117
- package/dist/storage/storage-catalog-validation.d.ts +0 -3
- package/dist/storage/storage-catalog-validation.js +0 -20
- package/dist/storage/storage-catalog.d.ts +0 -25
- package/dist/storage/storage-catalog.js +0 -421
- package/dist/storage/storage-layout.d.ts +0 -40
- package/dist/storage/storage-layout.js +0 -117
- package/dist/storage/technology-selection-store.d.ts +0 -5
- package/dist/storage/technology-selection-store.js +0 -46
- package/dist/storage/transition-log.d.ts +0 -11
- package/dist/storage/transition-log.js +0 -234
- package/dist/tools/bump-spec-version.d.ts +0 -31
- package/dist/tools/bump-spec-version.js +0 -132
- package/dist/tools/challenge-spec/agent-challenge-scenarios.d.ts +0 -12
- package/dist/tools/challenge-spec/agent-challenge-scenarios.js +0 -129
- package/dist/tools/challenge-spec/architecture-challenge-scenarios.d.ts +0 -12
- package/dist/tools/challenge-spec/architecture-challenge-scenarios.js +0 -113
- package/dist/tools/challenge-spec/challenge-report.d.ts +0 -26
- package/dist/tools/challenge-spec/challenge-report.js +0 -221
- package/dist/tools/challenge-spec/event-challenge-scenarios.d.ts +0 -14
- package/dist/tools/challenge-spec/event-challenge-scenarios.js +0 -68
- package/dist/tools/challenge-spec/implementation-contract-challenge-scenarios.d.ts +0 -3
- package/dist/tools/challenge-spec/implementation-contract-challenge-scenarios.js +0 -51
- package/dist/tools/challenge-spec/platform-challenge-scenarios-b.d.ts +0 -7
- package/dist/tools/challenge-spec/platform-challenge-scenarios-b.js +0 -48
- package/dist/tools/challenge-spec/platform-challenge-scenarios-b1.d.ts +0 -4
- package/dist/tools/challenge-spec/platform-challenge-scenarios-b1.js +0 -109
- package/dist/tools/challenge-spec/platform-challenge-scenarios-b2.d.ts +0 -5
- package/dist/tools/challenge-spec/platform-challenge-scenarios-b2.js +0 -191
- package/dist/tools/challenge-spec/platform-challenge-scenarios.d.ts +0 -7
- package/dist/tools/challenge-spec/platform-challenge-scenarios.js +0 -224
- package/dist/tools/challenge-spec/resilience-challenge-scenarios-a.d.ts +0 -28
- package/dist/tools/challenge-spec/resilience-challenge-scenarios-a.js +0 -183
- package/dist/tools/challenge-spec/resilience-challenge-scenarios-b.d.ts +0 -14
- package/dist/tools/challenge-spec/resilience-challenge-scenarios-b.js +0 -144
- package/dist/tools/challenge-spec/resilience-challenge-scenarios.d.ts +0 -8
- package/dist/tools/challenge-spec/resilience-challenge-scenarios.js +0 -37
- package/dist/tools/challenge-spec/scenario-collector.d.ts +0 -13
- package/dist/tools/challenge-spec/scenario-collector.js +0 -84
- package/dist/tools/challenge-spec/scenarios-data.d.ts +0 -3
- package/dist/tools/challenge-spec/scenarios-data.js +0 -73
- package/dist/tools/challenge-spec/scenarios-desktop.d.ts +0 -7
- package/dist/tools/challenge-spec/scenarios-desktop.js +0 -91
- package/dist/tools/challenge-spec/scenarios-failure.d.ts +0 -3
- package/dist/tools/challenge-spec/scenarios-failure.js +0 -136
- package/dist/tools/challenge-spec/scenarios-game.d.ts +0 -6
- package/dist/tools/challenge-spec/scenarios-game.js +0 -71
- package/dist/tools/challenge-spec/scenarios-scale.d.ts +0 -3
- package/dist/tools/challenge-spec/scenarios-scale.js +0 -37
- package/dist/tools/challenge-spec/scenarios-security.d.ts +0 -3
- package/dist/tools/challenge-spec/scenarios-security.js +0 -85
- package/dist/tools/challenge-spec/scenarios-utils.d.ts +0 -42
- package/dist/tools/challenge-spec/scenarios-utils.js +0 -250
- package/dist/tools/challenge-spec-helpers.d.ts +0 -16
- package/dist/tools/challenge-spec-helpers.js +0 -152
- package/dist/tools/challenge-spec-scenarios.d.ts +0 -7
- package/dist/tools/challenge-spec-scenarios.js +0 -9
- package/dist/tools/challenge-spec.d.ts +0 -4
- package/dist/tools/challenge-spec.js +0 -448
- package/dist/tools/check-readiness.d.ts +0 -5
- package/dist/tools/check-readiness.js +0 -343
- package/dist/tools/claude-settings-file.d.ts +0 -3
- package/dist/tools/claude-settings-file.js +0 -19
- package/dist/tools/create-skill.d.ts +0 -4
- package/dist/tools/create-skill.js +0 -151
- package/dist/tools/create-spec/autopilot-analyzer.d.ts +0 -33
- package/dist/tools/create-spec/autopilot-analyzer.js +0 -171
- package/dist/tools/create-spec/constitution-validator.d.ts +0 -4
- package/dist/tools/create-spec/constitution-validator.js +0 -31
- package/dist/tools/create-spec/question-generator.d.ts +0 -4
- package/dist/tools/create-spec/question-generator.js +0 -25
- package/dist/tools/create-spec/relevance-scorer.d.ts +0 -18
- package/dist/tools/create-spec/relevance-scorer.js +0 -156
- package/dist/tools/create-spec/spec-builder.d.ts +0 -20
- package/dist/tools/create-spec/spec-builder.js +0 -274
- package/dist/tools/create-spec-helpers.d.ts +0 -4
- package/dist/tools/create-spec-helpers.js +0 -24
- package/dist/tools/create-spec-tech/constitution.d.ts +0 -7
- package/dist/tools/create-spec-tech/constitution.js +0 -79
- package/dist/tools/create-spec-tech.d.ts +0 -2
- package/dist/tools/create-spec-tech.js +0 -3
- package/dist/tools/create-spec.d.ts +0 -25
- package/dist/tools/create-spec.js +0 -1698
- package/dist/tools/git/git-helpers.d.ts +0 -20
- package/dist/tools/git/git-helpers.js +0 -33
- package/dist/tools/init-project/agents-md-writer.d.ts +0 -18
- package/dist/tools/init-project/agents-md-writer.js +0 -123
- package/dist/tools/init-project/config-builder.d.ts +0 -14
- package/dist/tools/init-project/config-builder.js +0 -19
- package/dist/tools/init-project/conventions-writer.d.ts +0 -11
- package/dist/tools/init-project/conventions-writer.js +0 -61
- package/dist/tools/init-project/handler.d.ts +0 -4
- package/dist/tools/init-project/handler.js +0 -463
- package/dist/tools/init-project/helpers.d.ts +0 -31
- package/dist/tools/init-project/helpers.js +0 -223
- package/dist/tools/init-project/host-assets-writer.d.ts +0 -28
- package/dist/tools/init-project/host-assets-writer.js +0 -240
- package/dist/tools/init-project/legacy-guidance-scanner.d.ts +0 -9
- package/dist/tools/init-project/legacy-guidance-scanner.js +0 -218
- package/dist/tools/init-project/legacy-root-migration.d.ts +0 -16
- package/dist/tools/init-project/legacy-root-migration.js +0 -213
- package/dist/tools/init-project/lifecycle-helpers.d.ts +0 -12
- package/dist/tools/init-project/lifecycle-helpers.js +0 -37
- package/dist/tools/init-project/managed-guidance-refresher.d.ts +0 -9
- package/dist/tools/init-project/managed-guidance-refresher.js +0 -65
- package/dist/tools/init-project/migration-runner.d.ts +0 -43
- package/dist/tools/init-project/migration-runner.js +0 -227
- package/dist/tools/init-project/portable-index-reconciler.d.ts +0 -32
- package/dist/tools/init-project/portable-index-reconciler.js +0 -278
- package/dist/tools/init-project/result-builder.d.ts +0 -4
- package/dist/tools/init-project/result-builder.js +0 -271
- package/dist/tools/init-project/scaffold-verifier.d.ts +0 -6
- package/dist/tools/init-project/scaffold-verifier.js +0 -97
- package/dist/tools/init-project/scaffold-writer.d.ts +0 -49
- package/dist/tools/init-project/scaffold-writer.js +0 -50
- package/dist/tools/init-project.d.ts +0 -2
- package/dist/tools/init-project.js +0 -4
- package/dist/tools/jobs/handlers.d.ts +0 -11
- package/dist/tools/jobs/handlers.js +0 -152
- package/dist/tools/list-specs.d.ts +0 -3
- package/dist/tools/list-specs.js +0 -323
- package/dist/tools/output-formatter.d.ts +0 -34
- package/dist/tools/output-formatter.js +0 -171
- package/dist/tools/output-integrity-guard.d.ts +0 -3
- package/dist/tools/output-integrity-guard.js +0 -53
- package/dist/tools/package-handoff.d.ts +0 -4
- package/dist/tools/package-handoff.js +0 -215
- package/dist/tools/reconcile-spec-sanctity-hook.d.ts +0 -3
- package/dist/tools/reconcile-spec-sanctity-hook.js +0 -55
- package/dist/tools/reconcile-spec.d.ts +0 -4
- package/dist/tools/reconcile-spec.js +0 -502
- package/dist/tools/register-sdd-tools.d.ts +0 -4
- package/dist/tools/register-sdd-tools.js +0 -13
- package/dist/tools/resolve-project-id.d.ts +0 -58
- package/dist/tools/resolve-project-id.js +0 -103
- package/dist/tools/resolve-project-path.d.ts +0 -27
- package/dist/tools/resolve-project-path.js +0 -172
- package/dist/tools/response-helpers.d.ts +0 -70
- package/dist/tools/response-helpers.js +0 -139
- package/dist/tools/safe-handler.d.ts +0 -36
- package/dist/tools/safe-handler.js +0 -283
- package/dist/tools/sanitize-path.d.ts +0 -13
- package/dist/tools/sanitize-path.js +0 -60
- package/dist/tools/schemas/agents.d.ts +0 -21
- package/dist/tools/schemas/agents.js +0 -9
- package/dist/tools/schemas/analysis.d.ts +0 -28
- package/dist/tools/schemas/analysis.js +0 -22
- package/dist/tools/schemas/index.d.ts +0 -8
- package/dist/tools/schemas/index.js +0 -9
- package/dist/tools/schemas/infra.d.ts +0 -19
- package/dist/tools/schemas/infra.js +0 -18
- package/dist/tools/schemas/lifecycle.d.ts +0 -88
- package/dist/tools/schemas/lifecycle.js +0 -85
- package/dist/tools/schemas/output-schemas.d.ts +0 -115
- package/dist/tools/schemas/output-schemas.js +0 -136
- package/dist/tools/schemas/package-handoff-output-schema.d.ts +0 -41
- package/dist/tools/schemas/package-handoff-output-schema.js +0 -70
- package/dist/tools/schemas/spec-id.d.ts +0 -2
- package/dist/tools/schemas/spec-id.js +0 -2
- package/dist/tools/schemas/spec.d.ts +0 -51
- package/dist/tools/schemas/spec.js +0 -41
- package/dist/tools/schemas/validate-output-schema.d.ts +0 -276
- package/dist/tools/schemas/validate-output-schema.js +0 -225
- package/dist/tools/status-handler.d.ts +0 -3
- package/dist/tools/status-handler.js +0 -242
- package/dist/tools/tool-entry.d.ts +0 -52
- package/dist/tools/tool-entry.js +0 -46
- package/dist/tools/tool-registry/core-tools.d.ts +0 -4
- package/dist/tools/tool-registry/core-tools.js +0 -581
- package/dist/tools/tool-registry/inventory.d.ts +0 -2
- package/dist/tools/tool-registry/inventory.js +0 -2
- package/dist/tools/tool-registry-helpers.d.ts +0 -34
- package/dist/tools/tool-registry-helpers.js +0 -45
- package/dist/tools/update-status/approval-gates.d.ts +0 -13
- package/dist/tools/update-status/approval-gates.js +0 -108
- package/dist/tools/update-status/batch.d.ts +0 -7
- package/dist/tools/update-status/batch.js +0 -176
- package/dist/tools/update-status/dod-gates.d.ts +0 -117
- package/dist/tools/update-status/dod-gates.js +0 -847
- package/dist/tools/update-status/done-receipt-verifier.d.ts +0 -38
- package/dist/tools/update-status/done-receipt-verifier.js +0 -208
- package/dist/tools/update-status/evidence-gate.d.ts +0 -16
- package/dist/tools/update-status/evidence-gate.js +0 -361
- package/dist/tools/update-status/evidence-payload.d.ts +0 -180
- package/dist/tools/update-status/evidence-payload.js +0 -79
- package/dist/tools/update-status/file-sync.d.ts +0 -37
- package/dist/tools/update-status/file-sync.js +0 -223
- package/dist/tools/update-status/gate-harness.d.ts +0 -8
- package/dist/tools/update-status/gate-harness.js +0 -8
- package/dist/tools/update-status/index.d.ts +0 -25
- package/dist/tools/update-status/index.js +0 -1487
- package/dist/tools/update-status/response-builder.d.ts +0 -17
- package/dist/tools/update-status/response-builder.js +0 -297
- package/dist/tools/update-status/side-effects.d.ts +0 -16
- package/dist/tools/update-status/side-effects.js +0 -117
- package/dist/tools/update-status/transition-guard.d.ts +0 -85
- package/dist/tools/update-status/transition-guard.js +0 -752
- package/dist/tools/update-status-actions.d.ts +0 -6
- package/dist/tools/update-status-actions.js +0 -19
- package/dist/tools/update-status-convention-gate.d.ts +0 -9
- package/dist/tools/update-status-convention-gate.js +0 -330
- package/dist/tools/update-status.d.ts +0 -2
- package/dist/tools/update-status.js +0 -3
- package/dist/tools/validate-assurance.d.ts +0 -6
- package/dist/tools/validate-assurance.js +0 -55
- package/dist/tools/validate-graph-coverage.d.ts +0 -8
- package/dist/tools/validate-graph-coverage.js +0 -54
- package/dist/tools/validate-helpers.d.ts +0 -10
- package/dist/tools/validate-helpers.js +0 -65
- package/dist/tools/validate-lint.d.ts +0 -9
- package/dist/tools/validate-lint.js +0 -170
- package/dist/tools/validate-minimality.d.ts +0 -16
- package/dist/tools/validate-minimality.js +0 -22
- package/dist/tools/validate-structured-compat.d.ts +0 -19
- package/dist/tools/validate-structured-compat.js +0 -14
- package/dist/tools/validate.d.ts +0 -8
- package/dist/tools/validate.js +0 -1038
- package/dist/transports/transport-factory.d.ts +0 -5
- package/dist/transports/transport-factory.js +0 -182
- package/dist/types/abortable-process.d.ts +0 -29
- package/dist/types/abortable-process.js +0 -2
- package/dist/types/agent-team.d.ts +0 -17
- package/dist/types/agent-team.js +0 -3
- package/dist/types/ai-assurance.d.ts +0 -32
- package/dist/types/ai-assurance.js +0 -2
- package/dist/types/ai-native.d.ts +0 -16
- package/dist/types/ai-native.js +0 -3
- package/dist/types/analysis.d.ts +0 -238
- package/dist/types/analysis.js +0 -3
- package/dist/types/approval.d.ts +0 -66
- package/dist/types/approval.js +0 -6
- package/dist/types/architecture.d.ts +0 -101
- package/dist/types/architecture.js +0 -4
- package/dist/types/audit.d.ts +0 -38
- package/dist/types/audit.js +0 -4
- package/dist/types/build-freshness.d.ts +0 -11
- package/dist/types/build-freshness.js +0 -2
- package/dist/types/clarification-token.d.ts +0 -46
- package/dist/types/clarification-token.js +0 -2
- package/dist/types/clarification.d.ts +0 -23
- package/dist/types/clarification.js +0 -5
- package/dist/types/claude-code-runtime.d.ts +0 -91
- package/dist/types/claude-code-runtime.js +0 -5
- package/dist/types/claude-code-ux.d.ts +0 -62
- package/dist/types/claude-code-ux.js +0 -5
- package/dist/types/cli.d.ts +0 -40
- package/dist/types/cli.js +0 -3
- package/dist/types/codex.d.ts +0 -108
- package/dist/types/codex.js +0 -3
- package/dist/types/common/index.d.ts +0 -4
- package/dist/types/common/index.js +0 -6
- package/dist/types/common/learning.d.ts +0 -43
- package/dist/types/common/learning.js +0 -3
- package/dist/types/common/tech-enums.d.ts +0 -8
- package/dist/types/common/tech-enums.js +0 -2
- package/dist/types/complexity-budget.d.ts +0 -17
- package/dist/types/complexity-budget.js +0 -5
- package/dist/types/compliance-gate.d.ts +0 -5
- package/dist/types/compliance-gate.js +0 -3
- package/dist/types/context.d.ts +0 -52
- package/dist/types/context.js +0 -4
- package/dist/types/conventions.d.ts +0 -135
- package/dist/types/conventions.js +0 -5
- package/dist/types/core-bridge.d.ts +0 -130
- package/dist/types/core-bridge.js +0 -3
- package/dist/types/criterion-identity.d.ts +0 -12
- package/dist/types/criterion-identity.js +0 -2
- package/dist/types/cross-repo-search.d.ts +0 -81
- package/dist/types/cross-repo-search.js +0 -9
- package/dist/types/decisions.d.ts +0 -19
- package/dist/types/decisions.js +0 -4
- package/dist/types/durable-job.d.ts +0 -119
- package/dist/types/durable-job.js +0 -10
- package/dist/types/durable-validation.d.ts +0 -158
- package/dist/types/durable-validation.js +0 -166
- package/dist/types/edge-db.d.ts +0 -21
- package/dist/types/edge-db.js +0 -9
- package/dist/types/elicitation.d.ts +0 -115
- package/dist/types/elicitation.js +0 -13
- package/dist/types/env.d.ts +0 -94
- package/dist/types/env.js +0 -3
- package/dist/types/errors/structured-error.d.ts +0 -37
- package/dist/types/errors/structured-error.js +0 -3
- package/dist/types/estimation.d.ts +0 -29
- package/dist/types/estimation.js +0 -5
- package/dist/types/events.d.ts +0 -18
- package/dist/types/events.js +0 -4
- package/dist/types/evidence-autofill.d.ts +0 -40
- package/dist/types/evidence-autofill.js +0 -3
- package/dist/types/evidence-gates.d.ts +0 -103
- package/dist/types/evidence-gates.js +0 -2
- package/dist/types/evidence-index.d.ts +0 -26
- package/dist/types/evidence-index.js +0 -2
- package/dist/types/execution.d.ts +0 -103
- package/dist/types/execution.js +0 -2
- package/dist/types/frontmatter.d.ts +0 -5
- package/dist/types/frontmatter.js +0 -2
- package/dist/types/gemini.d.ts +0 -124
- package/dist/types/gemini.js +0 -3
- package/dist/types/handoff-artifacts.d.ts +0 -182
- package/dist/types/handoff-artifacts.js +0 -3
- package/dist/types/host-rules.d.ts +0 -10
- package/dist/types/host-rules.js +0 -3
- package/dist/types/host-tool-filter.d.ts +0 -31
- package/dist/types/host-tool-filter.js +0 -3
- package/dist/types/housekeeping.d.ts +0 -8
- package/dist/types/housekeeping.js +0 -22
- package/dist/types/index.d.ts +0 -81
- package/dist/types/index.js +0 -94
- package/dist/types/interactive-question.d.ts +0 -19
- package/dist/types/interactive-question.js +0 -3
- package/dist/types/keyword-matcher.d.ts +0 -38
- package/dist/types/keyword-matcher.js +0 -3
- package/dist/types/legacy-guidance.d.ts +0 -24
- package/dist/types/legacy-guidance.js +0 -3
- package/dist/types/legal.d.ts +0 -44
- package/dist/types/legal.js +0 -5
- package/dist/types/living-spec/annotations.d.ts +0 -36
- package/dist/types/living-spec/annotations.js +0 -23
- package/dist/types/living-spec.d.ts +0 -2
- package/dist/types/living-spec.js +0 -6
- package/dist/types/llm-security.d.ts +0 -19
- package/dist/types/llm-security.js +0 -4
- package/dist/types/local-first.d.ts +0 -25
- package/dist/types/local-first.js +0 -10
- package/dist/types/mcp.d.ts +0 -34
- package/dist/types/mcp.js +0 -4
- package/dist/types/migration/canonical-storage.d.ts +0 -38
- package/dist/types/migration/canonical-storage.js +0 -2
- package/dist/types/minimal-implementation-gate.d.ts +0 -98
- package/dist/types/minimal-implementation-gate.js +0 -2
- package/dist/types/model-routing.d.ts +0 -25
- package/dist/types/model-routing.js +0 -26
- package/dist/types/multi-agent.d.ts +0 -18
- package/dist/types/multi-agent.js +0 -18
- package/dist/types/nli-context.d.ts +0 -25
- package/dist/types/nli-context.js +0 -2
- package/dist/types/opencode.d.ts +0 -4
- package/dist/types/opencode.js +0 -3
- package/dist/types/paradigm.d.ts +0 -99
- package/dist/types/paradigm.js +0 -11
- package/dist/types/privacy.d.ts +0 -81
- package/dist/types/privacy.js +0 -25
- package/dist/types/project/agent.d.ts +0 -13
- package/dist/types/project/agent.js +0 -3
- package/dist/types/project/architecture-detection.d.ts +0 -24
- package/dist/types/project/architecture-detection.js +0 -2
- package/dist/types/project/config-metrics.d.ts +0 -10
- package/dist/types/project/config-metrics.js +0 -2
- package/dist/types/project/constitution.d.ts +0 -26
- package/dist/types/project/constitution.js +0 -3
- package/dist/types/project/core.d.ts +0 -137
- package/dist/types/project/core.js +0 -7
- package/dist/types/project/health-checker.d.ts +0 -13
- package/dist/types/project/health-checker.js +0 -3
- package/dist/types/project/inputs.d.ts +0 -39
- package/dist/types/project/inputs.js +0 -5
- package/dist/types/project/legacy-artifacts.d.ts +0 -7
- package/dist/types/project/legacy-artifacts.js +0 -2
- package/dist/types/project/library-groups.d.ts +0 -112
- package/dist/types/project/library-groups.js +0 -4
- package/dist/types/project/mfe-detection.d.ts +0 -19
- package/dist/types/project/mfe-detection.js +0 -3
- package/dist/types/project/planu-config.d.ts +0 -142
- package/dist/types/project/planu-config.js +0 -2
- package/dist/types/project/platform-exotic.d.ts +0 -108
- package/dist/types/project/platform-exotic.js +0 -3
- package/dist/types/project/platform-mobile.d.ts +0 -7
- package/dist/types/project/platform-mobile.js +0 -3
- package/dist/types/project/platform-specialty.d.ts +0 -17
- package/dist/types/project/platform-specialty.js +0 -3
- package/dist/types/project/scaffold-verification.d.ts +0 -15
- package/dist/types/project/scaffold-verification.js +0 -2
- package/dist/types/project-knowledge-graph.d.ts +0 -227
- package/dist/types/project-knowledge-graph.js +0 -2
- package/dist/types/project.d.ts +0 -11
- package/dist/types/project.js +0 -13
- package/dist/types/readiness.d.ts +0 -82
- package/dist/types/readiness.js +0 -7
- package/dist/types/reconcile.d.ts +0 -41
- package/dist/types/reconcile.js +0 -9
- package/dist/types/retention.d.ts +0 -12
- package/dist/types/retention.js +0 -3
- package/dist/types/reviewer-tokens.d.ts +0 -58
- package/dist/types/reviewer-tokens.js +0 -4
- package/dist/types/runtime-database.d.ts +0 -10
- package/dist/types/runtime-database.js +0 -2
- package/dist/types/runtime-policy.d.ts +0 -62
- package/dist/types/runtime-policy.js +0 -2
- package/dist/types/safe-schemas.d.ts +0 -12
- package/dist/types/safe-schemas.js +0 -27
- package/dist/types/safety.d.ts +0 -42
- package/dist/types/safety.js +0 -3
- package/dist/types/scan-project.d.ts +0 -20
- package/dist/types/scan-project.js +0 -4
- package/dist/types/schema-registry.d.ts +0 -12
- package/dist/types/schema-registry.js +0 -2
- package/dist/types/scope-boundaries.d.ts +0 -62
- package/dist/types/scope-boundaries.js +0 -3
- package/dist/types/scope.d.ts +0 -89
- package/dist/types/scope.js +0 -3
- package/dist/types/sdd-constitution.d.ts +0 -27
- package/dist/types/sdd-constitution.js +0 -2
- package/dist/types/sdd-core-v6.d.ts +0 -62
- package/dist/types/sdd-core-v6.js +0 -2
- package/dist/types/sdd-flow.d.ts +0 -3
- package/dist/types/sdd-flow.js +0 -3
- package/dist/types/sdd-model-routing.d.ts +0 -22
- package/dist/types/sdd-model-routing.js +0 -2
- package/dist/types/security.d.ts +0 -20
- package/dist/types/security.js +0 -4
- package/dist/types/skill-bootstrap.d.ts +0 -7
- package/dist/types/skill-bootstrap.js +0 -3
- package/dist/types/spec/clarification.d.ts +0 -86
- package/dist/types/spec/clarification.js +0 -2
- package/dist/types/spec/core.d.ts +0 -414
- package/dist/types/spec/core.js +0 -3
- package/dist/types/spec/health-score.d.ts +0 -25
- package/dist/types/spec/health-score.js +0 -2
- package/dist/types/spec/index-cache.d.ts +0 -25
- package/dist/types/spec/index-cache.js +0 -3
- package/dist/types/spec/index.d.ts +0 -7
- package/dist/types/spec/index.js +0 -9
- package/dist/types/spec/inputs.d.ts +0 -250
- package/dist/types/spec/inputs.js +0 -7
- package/dist/types/spec/versioning.d.ts +0 -39
- package/dist/types/spec/versioning.js +0 -3
- package/dist/types/spec-format.d.ts +0 -211
- package/dist/types/spec-format.js +0 -3
- package/dist/types/spec-generator.d.ts +0 -32
- package/dist/types/spec-generator.js +0 -2
- package/dist/types/spec-grounding.d.ts +0 -48
- package/dist/types/spec-grounding.js +0 -2
- package/dist/types/spec-language-translation.d.ts +0 -19
- package/dist/types/spec-language-translation.js +0 -5
- package/dist/types/spec-language.d.ts +0 -8
- package/dist/types/spec-language.js +0 -2
- package/dist/types/spec-lock-v2.d.ts +0 -66
- package/dist/types/spec-lock-v2.js +0 -4
- package/dist/types/spec-lock.d.ts +0 -14
- package/dist/types/spec-lock.js +0 -8
- package/dist/types/spec-quality.d.ts +0 -82
- package/dist/types/spec-quality.js +0 -6
- package/dist/types/stack/build-tool.d.ts +0 -13
- package/dist/types/stack/build-tool.js +0 -5
- package/dist/types/stack/hypermedia.d.ts +0 -4
- package/dist/types/stack/hypermedia.js +0 -3
- package/dist/types/stack/index.d.ts +0 -4
- package/dist/types/stack/index.js +0 -4
- package/dist/types/stack/recommend.d.ts +0 -38
- package/dist/types/stack/recommend.js +0 -3
- package/dist/types/status.d.ts +0 -27
- package/dist/types/status.js +0 -6
- package/dist/types/storage-catalog.d.ts +0 -21
- package/dist/types/storage-catalog.js +0 -2
- package/dist/types/supply-chain.d.ts +0 -49
- package/dist/types/supply-chain.js +0 -25
- package/dist/types/technology-registry.d.ts +0 -36
- package/dist/types/technology-registry.js +0 -2
- package/dist/types/technology-selection.d.ts +0 -78
- package/dist/types/technology-selection.js +0 -3
- package/dist/types/technology-symbols.generated.d.ts +0 -117
- package/dist/types/technology-symbols.generated.js +0 -2
- package/dist/types/testing.d.ts +0 -17
- package/dist/types/testing.js +0 -10
- package/dist/types/timing.d.ts +0 -18
- package/dist/types/timing.js +0 -3
- package/dist/types/transition-log.d.ts +0 -78
- package/dist/types/transition-log.js +0 -4
- package/dist/types/transport.d.ts +0 -6
- package/dist/types/transport.js +0 -4
- package/dist/types/universal-rules/index.d.ts +0 -69
- package/dist/types/universal-rules/index.js +0 -4
- package/dist/types/validate-worker.d.ts +0 -50
- package/dist/types/validate-worker.js +0 -2
- package/dist/types/validation-config.d.ts +0 -36
- package/dist/types/validation-config.js +0 -2
- package/dist/types/validation-evidence.d.ts +0 -177
- package/dist/types/validation-evidence.js +0 -2
- package/dist/types/validation-loop.d.ts +0 -26
- package/dist/types/validation-loop.js +0 -3
- package/dist/types/validation-receipt.d.ts +0 -126
- package/dist/types/validation-receipt.js +0 -2
- package/dist/types/validation.d.ts +0 -67
- package/dist/types/validation.js +0 -3
- package/dist/types/verifiable-criteria.d.ts +0 -31
- package/dist/types/verifiable-criteria.js +0 -10
- package/src/i18n/messages/en.json +0 -184
- package/src/i18n/messages/es.json +0 -184
- package/src/i18n/messages/pt.json +0 -184
|
@@ -1,1487 +0,0 @@
|
|
|
1
|
-
import { elicitOrFallback, buildEnumSchema } from '../../engine/elicitation/elicit-helper.js';
|
|
2
|
-
import { ti } from '../../i18n/index.js';
|
|
3
|
-
import { specStore, knowledgeStore } from '../../storage/index.js';
|
|
4
|
-
import { reportClassifiedDegradation } from '../../errors/classified-degradation.js';
|
|
5
|
-
import { rollbackTransitionSpec, transitionSpec, } from '../../engine/spec-state-machine/transition-spec.js';
|
|
6
|
-
import { cascadeCheck } from '../../engine/spec-versioner.js';
|
|
7
|
-
import { runComplianceGates } from '../update-status-convention-gate.js';
|
|
8
|
-
import { pruneRuntimeArtifactsOnTerminal } from '../update-status-actions.js';
|
|
9
|
-
import { compactObj } from '../../engine/compact-obj.js';
|
|
10
|
-
import { checkTransition, checkDorGate, checkAmbiguityGate, checkReadinessGate, checkChallengeGate, checkImplementationDependencyGate, checkSpecArtifactCommittedGate, resolveAutoAdvanceSteps, isReverseTransition, validateReverseTransition, } from './transition-guard.js';
|
|
11
|
-
import { checkApprovedDepGate } from '../../engine/dep-guard/index.js';
|
|
12
|
-
import { checkApprovalGate } from '../../engine/approval-workflow.js';
|
|
13
|
-
import { BoundaryFailure } from '../../errors/error-taxonomy.js';
|
|
14
|
-
import * as approvalStore from '../../storage/approval-store.js';
|
|
15
|
-
import { withApprovalSpecLock } from '../../storage/approval-operation-lock.js';
|
|
16
|
-
import { isLocked, getLock } from '../../storage/spec-lock-store.js';
|
|
17
|
-
import { checkDoneGates, checkComplianceGate, checkApprovedFormatGate, checkSpecReviewGate, deriveDoneReviewDigest, } from './dod-gates.js';
|
|
18
|
-
import { checkLifecycleEvidenceTransitionGate } from './evidence-gate.js';
|
|
19
|
-
import { autofillTraceabilityMatrix, toRepoRelativePath, } from '../../engine/evidence-gates/evidence-autofill.js';
|
|
20
|
-
import { buildStatusResponse, buildDryRunResponse } from './response-builder.js';
|
|
21
|
-
import { syncSpecFiles, recordTerminalTransitionEvent, } from './file-sync.js';
|
|
22
|
-
import { appendEntry, getLastHash } from '../../storage/audit-trail-store.js';
|
|
23
|
-
import { appendTransitionEvent } from '../../storage/transition-log.js';
|
|
24
|
-
import { createHash, randomUUID as uuid } from 'node:crypto';
|
|
25
|
-
import { atomicWriteFile, removeLifecycleArtifact } from '../../engine/safety/atomic-write-file.js';
|
|
26
|
-
import { readFile } from 'node:fs/promises';
|
|
27
|
-
import { queuePostCommitTasks } from './side-effects.js';
|
|
28
|
-
import { formatKeyValue } from '../output-formatter.js';
|
|
29
|
-
import { checkCodeReality } from '../../engine/code-scanner/index.js';
|
|
30
|
-
import { captureAttributionBaseline, resolveAttributableOwnedPaths, } from '../../engine/code-scanner/layer-scanner.js';
|
|
31
|
-
import { scoreUnavailableAttribution } from '../../engine/code-scanner/gap-scorer.js';
|
|
32
|
-
import { extractFilesFromSpecBody } from '../../engine/spec-format/technical-md-populator.js';
|
|
33
|
-
import { isAbsolute, join, resolve } from 'node:path';
|
|
34
|
-
import { readSpecContent } from '../../engine/spec-reader.js';
|
|
35
|
-
import { resolveProjectIdOrAutoDetect } from '../resolve-project-id.js';
|
|
36
|
-
import { withToolTimeout } from '../safe-handler.js';
|
|
37
|
-
import { detectHost } from '../../engine/host-detection/detect-host.js';
|
|
38
|
-
import { shellHygieneReminder } from '../../hosts/claude-code/coach.js';
|
|
39
|
-
import { buildTransitionEvidenceMeta, checkSddModelRoutingGate, } from '../../engine/sdd-model-routing.js';
|
|
40
|
-
import { acquireLock, releaseLock, isLocked as isCrossProcessLocked, LockBusyError, } from '../../engine/safety/cross-process-lock.js';
|
|
41
|
-
import { projectDataDir } from '../../storage/base-store.js';
|
|
42
|
-
import { assertExecutionCanCommit } from '../../engine/execution/context.js';
|
|
43
|
-
import { shouldSkipGateForExplicitLegacyHarness } from './gate-harness.js';
|
|
44
|
-
import { assertValidationFreshnessBarrier, closeValidationFreshnessLease, } from '../../engine/validation/validation-freshness.js';
|
|
45
|
-
import { currentReconciliationInvocationContext, reconcileImplementingSpec, } from '../../engine/lifecycle-reconciliation.js';
|
|
46
|
-
import { persistEvidencePayload } from './evidence-payload.js';
|
|
47
|
-
const IMPLEMENTATION_REVIEW_DIGEST = /^sha256:[a-f0-9]{64}$/u;
|
|
48
|
-
function lifecycleAuthorityError(code, message, fixHint) {
|
|
49
|
-
return {
|
|
50
|
-
content: [{ type: 'text', text: `${code}: ${message}\nFix: ${fixHint}` }],
|
|
51
|
-
isError: true,
|
|
52
|
-
structuredContent: { error: code, code: 422, fixHint },
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/** Select the lifecycle path before any transition, artifact, receipt, or log mutation. */
|
|
56
|
-
export async function runOwnershipBoundedCodeReality(spec, projectPath, baselineSha) {
|
|
57
|
-
const specPath = isAbsolute(spec.specPath) ? spec.specPath : join(projectPath, spec.specPath);
|
|
58
|
-
const specBody = await readSpecContent(specPath);
|
|
59
|
-
const ownership = specBody === null ? null : await extractFilesFromSpecBody(specBody, projectPath);
|
|
60
|
-
const ownedPaths = ownership === null
|
|
61
|
-
? []
|
|
62
|
-
: [
|
|
63
|
-
...new Set([...ownership.create, ...ownership.modify, ...ownership.test].map((e) => e.path)),
|
|
64
|
-
];
|
|
65
|
-
if (ownedPaths.length === 0) {
|
|
66
|
-
reportClassifiedDegradation('CODE_REALITY_OWNERSHIP_MISSING', new Error(`spec ${spec.id} declares no canonical owned paths`));
|
|
67
|
-
}
|
|
68
|
-
const attributable = await resolveAttributableOwnedPaths(projectPath, ownedPaths, baselineSha);
|
|
69
|
-
if (!attributable.available) {
|
|
70
|
-
reportClassifiedDegradation('CODE_REALITY_ATTRIBUTION_UNAVAILABLE', new Error(attributable.diagnostic));
|
|
71
|
-
return scoreUnavailableAttribution();
|
|
72
|
-
}
|
|
73
|
-
return checkCodeReality(projectPath, spec.title, attributable.paths);
|
|
74
|
-
}
|
|
75
|
-
export function classifyLifecycleAuthority(input, context, options = {}) {
|
|
76
|
-
const hasRequestId = input.reconciliationRequestId !== undefined;
|
|
77
|
-
const hasTransitionId = input.expectedImplementingTransitionId !== undefined;
|
|
78
|
-
const hasDigest = input.implementationReviewDigest !== undefined;
|
|
79
|
-
const hasAnyAuthority = hasRequestId || hasTransitionId || hasDigest;
|
|
80
|
-
if (input.status === 'done') {
|
|
81
|
-
if (hasRequestId || hasTransitionId) {
|
|
82
|
-
return {
|
|
83
|
-
route: 'error',
|
|
84
|
-
result: lifecycleAuthorityError('RECONCILIATION_TARGET_INVALID', 'Reconciliation authority is valid only for the review target.', 'Remove reconciliationRequestId and expectedImplementingTransitionId from the done request.'),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
// SPEC-1356: implementationReviewDigest is optional. When the caller omits it,
|
|
88
|
-
// the done gate (checkDoneGates via dod-gates.deriveDoneReviewDigest) derives
|
|
89
|
-
// it automatically from the persisted validation-report.json — the caller no
|
|
90
|
-
// longer has to compute the sha256 by hand. `options.requireDoneDigest` is
|
|
91
|
-
// retained only so legacy/explicit-authority callers can still demand it.
|
|
92
|
-
if (options.requireDoneDigest === true && !hasDigest) {
|
|
93
|
-
return {
|
|
94
|
-
route: 'error',
|
|
95
|
-
result: lifecycleAuthorityError('DONE_REVIEW_DIGEST_REQUIRED', 'A done transition requires the implementation review digest.', 'Supply the sha256 digest of the exact persisted validation-report.json bytes.'),
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (hasDigest &&
|
|
99
|
-
(typeof input.implementationReviewDigest !== 'string' ||
|
|
100
|
-
!IMPLEMENTATION_REVIEW_DIGEST.test(input.implementationReviewDigest))) {
|
|
101
|
-
return {
|
|
102
|
-
route: 'error',
|
|
103
|
-
result: lifecycleAuthorityError('DONE_REVIEW_DIGEST_INVALID', 'The implementation review digest must be sha256 followed by 64 lowercase hex characters.', 'Recompute the digest from the exact persisted validation-report.json bytes.'),
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return { route: 'ordinary' };
|
|
107
|
-
}
|
|
108
|
-
if (input.status === 'review' && hasAnyAuthority) {
|
|
109
|
-
if (!hasRequestId || !hasTransitionId || !hasDigest) {
|
|
110
|
-
return {
|
|
111
|
-
route: 'error',
|
|
112
|
-
result: lifecycleAuthorityError('RECONCILIATION_TUPLE_INCOMPLETE', 'Review reconciliation requires the complete authority tuple.', 'Supply reconciliationRequestId, expectedImplementingTransitionId, implementationReviewDigest, and a reason of at least 100 characters.'),
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (!input.reason || input.reason.trim().length < 100) {
|
|
116
|
-
return {
|
|
117
|
-
route: 'error',
|
|
118
|
-
result: lifecycleAuthorityError('RECONCILIATION_REASON_INVALID', 'Review reconciliation requires a non-blank reason of at least 100 characters.', 'Explain the reviewed implementation drift and required follow-up in at least 100 characters.'),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (context.surface !== 'local-mcp') {
|
|
122
|
-
return {
|
|
123
|
-
route: 'error',
|
|
124
|
-
result: lifecycleAuthorityError('RECONCILIATION_UNTRUSTED_SURFACE', 'Reconciliation is available only through trusted local MCP.', 'Retry the complete reconciliation request through the registered local MCP tool.'),
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
return { route: 'reconcile' };
|
|
128
|
-
}
|
|
129
|
-
if (hasAnyAuthority) {
|
|
130
|
-
return {
|
|
131
|
-
route: 'error',
|
|
132
|
-
result: lifecycleAuthorityError('RECONCILIATION_TARGET_INVALID', 'Lifecycle authority fields are invalid for this target.', 'Remove the authority fields or use implementationReviewDigest only with done.'),
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
return { route: 'ordinary' };
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* SPEC-280: Silently traverse intermediate states so callers can jump forward
|
|
139
|
-
* (e.g. draft → approved) without receiving an error.
|
|
140
|
-
* Returns the list of states executed, or an empty array if none were needed.
|
|
141
|
-
*/
|
|
142
|
-
function buildAutoAdvancePlan(currentStatus, targetStatus) {
|
|
143
|
-
const stepsExecuted = resolveAutoAdvanceSteps(currentStatus, targetStatus) ?? [];
|
|
144
|
-
return {
|
|
145
|
-
plannedStatuses: [...stepsExecuted, targetStatus],
|
|
146
|
-
stepsExecuted,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
async function runTraceabilityAutofillGate(args) {
|
|
150
|
-
try {
|
|
151
|
-
const specPath = isAbsolute(args.spec.specPath) || !args.projectPath
|
|
152
|
-
? args.spec.specPath
|
|
153
|
-
: join(args.projectPath, args.spec.specPath);
|
|
154
|
-
const specBody = await readSpecContent(specPath);
|
|
155
|
-
if (specBody === null) {
|
|
156
|
-
return { warning: null };
|
|
157
|
-
}
|
|
158
|
-
const result = await autofillTraceabilityMatrix({
|
|
159
|
-
projectId: args.projectId,
|
|
160
|
-
specId: args.specId,
|
|
161
|
-
projectPath: args.projectPath,
|
|
162
|
-
specBody,
|
|
163
|
-
ownSpecMdPath: toRepoRelativePath(args.spec.specPath, args.projectPath),
|
|
164
|
-
});
|
|
165
|
-
if (!result.written) {
|
|
166
|
-
return { warning: null };
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
warning: `traceability-matrix.json auto-generated (${String(result.rowCount)} rows) and bound via evidence-only rebind`,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
// reliability-optional: EVIDENCE_AUTOFILL_GATE — falls through to the ordinary evidence gate
|
|
174
|
-
reportClassifiedDegradation('EVIDENCE_AUTOFILL_GATE', error);
|
|
175
|
-
return { warning: null };
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* SPEC-301: Check if spec is locked by another agent.
|
|
180
|
-
* Returns an error ToolResult if locked, or null to continue.
|
|
181
|
-
*/
|
|
182
|
-
async function checkSpecLockGate(projectPath, specId) {
|
|
183
|
-
if (!projectPath) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
const locked = await isLocked(projectPath, specId);
|
|
187
|
-
if (!locked) {
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
const lock = await getLock(projectPath, specId);
|
|
191
|
-
if (lock === null) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
return {
|
|
195
|
-
content: [
|
|
196
|
-
{
|
|
197
|
-
type: 'text',
|
|
198
|
-
text: `Spec ${specId} is locked by "${lock.lockHolder}". ` +
|
|
199
|
-
`Use unlock_spec or force=true to override.`,
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
isError: true,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* SPEC-283: Verify the approval gate before transitioning to 'approved'.
|
|
207
|
-
* Returns an error ToolResult if the gate is not satisfied, or null to continue.
|
|
208
|
-
*/
|
|
209
|
-
async function checkApprovalPolicyGate(projectId, specId, newStatus) {
|
|
210
|
-
if (newStatus !== 'approved') {
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
try {
|
|
214
|
-
const policy = await approvalStore.getPolicy(projectId);
|
|
215
|
-
if (policy === null) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
const records = await approvalStore.getRecords(projectId, specId);
|
|
219
|
-
const gateError = checkApprovalGate(records, policy, specId);
|
|
220
|
-
if (gateError !== null) {
|
|
221
|
-
return {
|
|
222
|
-
content: [{ type: 'text', text: gateError }],
|
|
223
|
-
isError: true,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
return null;
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
if (error instanceof BoundaryFailure) {
|
|
230
|
-
return {
|
|
231
|
-
content: [{ type: 'text', text: error.message }],
|
|
232
|
-
isError: true,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
throw error;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/** SPEC-447: Build a blocked-by-compliance response. */
|
|
239
|
-
function buildBlockedByComplianceResponse(_specId, result) {
|
|
240
|
-
const scoreStr = result.score !== null ? String(result.score) : 'N/A';
|
|
241
|
-
const issueList = result.issues.length > 0
|
|
242
|
-
? `\n\nUnverified criteria:\n${result.issues.map((i) => `- ${i}`).join('\n')}`
|
|
243
|
-
: '';
|
|
244
|
-
return {
|
|
245
|
-
content: [
|
|
246
|
-
{
|
|
247
|
-
type: 'text',
|
|
248
|
-
text: `Compliance gate blocked: score ${scoreStr}/100 is below the required threshold.` +
|
|
249
|
-
` Fix unverified acceptance criteria or switch to soft mode to allow the transition.${issueList}`,
|
|
250
|
-
},
|
|
251
|
-
],
|
|
252
|
-
isError: true,
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
/** SPEC-448: Create a version snapshot of a spec when it is approved. */
|
|
256
|
-
async function createVersionSnapshot(specId, projectId, tag) {
|
|
257
|
-
const spec = await specStore.getSpec(projectId, specId);
|
|
258
|
-
if (!spec) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
const snapshotPath = join(projectDataDir(projectId), 'version-snapshots', `${tag}.json`);
|
|
262
|
-
await atomicWriteFile(snapshotPath, `${JSON.stringify(spec, null, 2)}\n`);
|
|
263
|
-
}
|
|
264
|
-
function checkIdempotentOrTransition(projectId, spec, target) {
|
|
265
|
-
if (spec.status === target) {
|
|
266
|
-
const latestReceipt = [...(spec.statusHistory ?? [])]
|
|
267
|
-
.reverse()
|
|
268
|
-
.find((entry) => entry.status === target);
|
|
269
|
-
const committedAt = latestReceipt?.changedAt ?? spec.updatedAt;
|
|
270
|
-
const transitionId = latestReceipt?.transitionId ??
|
|
271
|
-
createHash('sha256')
|
|
272
|
-
.update(['update_status:legacy:v1', projectId, spec.id, target, committedAt].join('\0'))
|
|
273
|
-
.digest('hex')
|
|
274
|
-
.slice(0, 24);
|
|
275
|
-
const pendingBackgroundActions = [...(latestReceipt?.pendingBackgroundActions ?? [])];
|
|
276
|
-
return {
|
|
277
|
-
content: [
|
|
278
|
-
{
|
|
279
|
-
type: 'text',
|
|
280
|
-
text: `Spec ${spec.id} is already ${target}; the committed transition was reused.`,
|
|
281
|
-
},
|
|
282
|
-
],
|
|
283
|
-
structuredContent: {
|
|
284
|
-
specId: spec.id,
|
|
285
|
-
previousStatus: latestReceipt?.fromStatus ?? target,
|
|
286
|
-
newStatus: target,
|
|
287
|
-
committed: true,
|
|
288
|
-
transitionId,
|
|
289
|
-
committedAt,
|
|
290
|
-
idempotent: true,
|
|
291
|
-
pendingBackgroundActions,
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
return checkTransition(spec.status, target);
|
|
296
|
-
}
|
|
297
|
-
function planBackgroundActions(args) {
|
|
298
|
-
return args.newStatus === 'approved' ? ['version-snapshot'] : [];
|
|
299
|
-
}
|
|
300
|
-
/** Bind deferred lifecycle work to one normalized absolute root without persisting that path. */
|
|
301
|
-
function computeTransitionRootBinding(projectPath) {
|
|
302
|
-
return createHash('sha256')
|
|
303
|
-
.update('planu:transition-root:v1\0')
|
|
304
|
-
.update(resolve(projectPath))
|
|
305
|
-
.digest('hex');
|
|
306
|
-
}
|
|
307
|
-
function receiptMatchesTransitionRoot(receipt, projectPath) {
|
|
308
|
-
return (projectPath !== undefined &&
|
|
309
|
-
receipt.transitionRootBinding !== undefined &&
|
|
310
|
-
receipt.transitionRootBinding === computeTransitionRootBinding(projectPath));
|
|
311
|
-
}
|
|
312
|
-
function buildPostCommitTasks(args) {
|
|
313
|
-
const enabled = new Set(args.actionNames);
|
|
314
|
-
const tasks = [];
|
|
315
|
-
const versionSnapshotTag = args.versionSnapshotTag ?? `approved-${args.committedAt.replace(/[-:]/g, '').slice(0, 13)}`;
|
|
316
|
-
if (enabled.delete('version-snapshot')) {
|
|
317
|
-
tasks.push({
|
|
318
|
-
name: 'version-snapshot',
|
|
319
|
-
run: () => createVersionSnapshot(args.spec.id, args.projectId, versionSnapshotTag),
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
for (const retiredName of enabled) {
|
|
323
|
-
tasks.push({
|
|
324
|
-
name: retiredName,
|
|
325
|
-
run: () => Promise.reject(new Error(`Retired post-commit task: ${retiredName}`)),
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
return tasks;
|
|
329
|
-
}
|
|
330
|
-
async function replayIdempotentPostCommitTasks(args) {
|
|
331
|
-
const receipt = [...(args.spec.statusHistory ?? [])]
|
|
332
|
-
.reverse()
|
|
333
|
-
.find((entry) => entry.status === args.spec.status);
|
|
334
|
-
if (!receipt?.transitionId || !receipt.pendingBackgroundActions?.length) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
const knowledge = await knowledgeStore.getKnowledge(args.projectId);
|
|
338
|
-
const effectiveProjectPath = args.projectPath ?? knowledge?.projectPath;
|
|
339
|
-
if (!receiptMatchesTransitionRoot(receipt, effectiveProjectPath)) {
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
const specAtTransition = { ...args.spec, status: receipt.status };
|
|
343
|
-
const tasks = buildPostCommitTasks({
|
|
344
|
-
actionNames: receipt.pendingBackgroundActions,
|
|
345
|
-
projectId: args.projectId,
|
|
346
|
-
spec: specAtTransition,
|
|
347
|
-
previousStatus: receipt.fromStatus ?? args.spec.status,
|
|
348
|
-
committedAt: receipt.changedAt,
|
|
349
|
-
knowledge,
|
|
350
|
-
allSpecs: await specStore.listSpecs(args.projectId),
|
|
351
|
-
validateScore: null,
|
|
352
|
-
effectiveProjectPath,
|
|
353
|
-
});
|
|
354
|
-
queuePostCommitTasks({
|
|
355
|
-
projectId: args.projectId,
|
|
356
|
-
specId: args.spec.id,
|
|
357
|
-
transitionId: receipt.transitionId,
|
|
358
|
-
tasks,
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
/** Recover durable post-commit work for every registered project after server startup. */
|
|
362
|
-
async function runTransitionMaintenance(transitionProjectPath) {
|
|
363
|
-
if (transitionProjectPath) {
|
|
364
|
-
try {
|
|
365
|
-
const { runStrictPlanuCleanup } = await import('../../engine/spec-migrator/index.js');
|
|
366
|
-
await runStrictPlanuCleanup(transitionProjectPath);
|
|
367
|
-
}
|
|
368
|
-
catch (error) {
|
|
369
|
-
/* reliability-cleanup: PRE_TRANSITION_STRICT_CLEANUP — validate remains fail-closed */
|
|
370
|
-
reportClassifiedDegradation('PRE_TRANSITION_STRICT_CLEANUP', error);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
function buildPersistenceFailureResponse(args) {
|
|
375
|
-
const committed = args.recoveryRequired ? null : false;
|
|
376
|
-
const message = args.recoveryRequired
|
|
377
|
-
? `Transition persistence became indeterminate for ${args.specId}; manual recovery is required.`
|
|
378
|
-
: `Transition ${args.specId} → ${args.newStatus} was not committed; the previous state was restored.`;
|
|
379
|
-
return {
|
|
380
|
-
isError: true,
|
|
381
|
-
content: [{ type: 'text', text: `${message} Detail: ${args.reason}` }],
|
|
382
|
-
structuredContent: {
|
|
383
|
-
error: args.recoveryRequired
|
|
384
|
-
? 'transition_recovery_required'
|
|
385
|
-
: 'transition_persistence_failed',
|
|
386
|
-
specId: args.specId,
|
|
387
|
-
previousStatus: args.previousStatus,
|
|
388
|
-
newStatus: args.newStatus,
|
|
389
|
-
committed,
|
|
390
|
-
recoveryRequired: args.recoveryRequired,
|
|
391
|
-
reason: args.reason,
|
|
392
|
-
fixHint: args.recoveryRequired
|
|
393
|
-
? 'Run repair_frontmatter_drift and inspect the canonical spec store before retrying.'
|
|
394
|
-
: 'Fix the persistence error and retry update_status; no transition was committed.',
|
|
395
|
-
},
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
export function resolveTransitionEventAudit(driftReconciled, baseReason, baseMeta) {
|
|
399
|
-
return driftReconciled
|
|
400
|
-
? { reason: 'drift-reconciliation', meta: { ...baseMeta, driftReconciled: true } }
|
|
401
|
-
: { reason: baseReason, meta: baseMeta };
|
|
402
|
-
}
|
|
403
|
-
export function buildDriftAppendFailureWarning(specId, specPath, error) {
|
|
404
|
-
return {
|
|
405
|
-
specId,
|
|
406
|
-
specPath,
|
|
407
|
-
reason: `drift-reconciliation audit marker not recorded: ${error instanceof Error ? error.message : String(error)}`,
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
async function commitTransitionWithNarrowLock(args) {
|
|
411
|
-
return withApprovalSpecLock(args.projectPath, args.specId, async () => {
|
|
412
|
-
const lock = await acquireLock(args.projectPath, args.specId, {
|
|
413
|
-
reason: `update_status(${args.newStatus}) commit`,
|
|
414
|
-
});
|
|
415
|
-
if (lock === null) {
|
|
416
|
-
return {
|
|
417
|
-
ok: false,
|
|
418
|
-
error: {
|
|
419
|
-
content: [
|
|
420
|
-
{
|
|
421
|
-
type: 'text',
|
|
422
|
-
text: `Spec ${args.specId} is locked by another process (cross-process lock). Retry later.`,
|
|
423
|
-
},
|
|
424
|
-
],
|
|
425
|
-
isError: true,
|
|
426
|
-
},
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
try {
|
|
430
|
-
const freshSpec = typeof specStore.getSpecFresh === 'function'
|
|
431
|
-
? await specStore.getSpecFresh(args.projectId, args.specId)
|
|
432
|
-
: await specStore.getSpec(args.projectId, args.specId);
|
|
433
|
-
if (freshSpec?.status !== args.expectedSpec.status ||
|
|
434
|
-
freshSpec.updatedAt !== args.expectedSpec.updatedAt) {
|
|
435
|
-
return {
|
|
436
|
-
ok: false,
|
|
437
|
-
error: {
|
|
438
|
-
content: [
|
|
439
|
-
{
|
|
440
|
-
type: 'text',
|
|
441
|
-
text: `Spec ${args.specId} changed while lifecycle gates were running. Retry with the fresh state.`,
|
|
442
|
-
},
|
|
443
|
-
],
|
|
444
|
-
isError: true,
|
|
445
|
-
structuredContent: { error: 'TRANSITION_CONFLICT', code: 409 },
|
|
446
|
-
},
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
if (args.newStatus === 'done' &&
|
|
450
|
-
(!args.freshnessLease || !(await assertValidationFreshnessBarrier(args.freshnessLease))) &&
|
|
451
|
-
!shouldSkipGateForExplicitLegacyHarness('evidence')) {
|
|
452
|
-
return {
|
|
453
|
-
ok: false,
|
|
454
|
-
error: {
|
|
455
|
-
content: [
|
|
456
|
-
{
|
|
457
|
-
type: 'text',
|
|
458
|
-
text: `Validation inputs for ${args.specId} changed before commit. Re-run validate.`,
|
|
459
|
-
},
|
|
460
|
-
],
|
|
461
|
-
isError: true,
|
|
462
|
-
structuredContent: { error: 'VALIDATION_RECEIPT_STALE', code: 409 },
|
|
463
|
-
},
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
const priorApprovalRecords = args.changeRequest
|
|
467
|
-
? await approvalStore.getRecords(args.projectId, args.specId)
|
|
468
|
-
: [];
|
|
469
|
-
const specFilePath = args.changeRequest
|
|
470
|
-
? isAbsolute(args.expectedSpec.specPath)
|
|
471
|
-
? args.expectedSpec.specPath
|
|
472
|
-
: join(args.projectPath, args.expectedSpec.specPath)
|
|
473
|
-
: '';
|
|
474
|
-
const priorSpecFile = args.changeRequest
|
|
475
|
-
? await readFile(specFilePath, 'utf8').catch((error) => {
|
|
476
|
-
if (error.code === 'ENOENT') {
|
|
477
|
-
return null;
|
|
478
|
-
}
|
|
479
|
-
throw error;
|
|
480
|
-
})
|
|
481
|
-
: null;
|
|
482
|
-
const evidencePaths = ['review_feedback.md', 'spec.lock.json'].map((name) => join(projectDataDir(args.projectId), 'handoffs', args.specId, name));
|
|
483
|
-
const priorEvidence = args.changeRequest
|
|
484
|
-
? await Promise.all(evidencePaths.map((path) => readFile(path).catch((error) => {
|
|
485
|
-
if (error.code === 'ENOENT') {
|
|
486
|
-
return null;
|
|
487
|
-
}
|
|
488
|
-
throw error;
|
|
489
|
-
})))
|
|
490
|
-
: [];
|
|
491
|
-
assertExecutionCanCommit();
|
|
492
|
-
const transitionRecord = await transitionSpec(args.projectId, args.specId, args.newStatus, {
|
|
493
|
-
...args.options,
|
|
494
|
-
expectedSpec: freshSpec,
|
|
495
|
-
});
|
|
496
|
-
const updatedSpec = transitionRecord.spec;
|
|
497
|
-
const frozenReasonArgs = isReverseTransition(args.originalStatus, args.newStatus)
|
|
498
|
-
? [args.options.reason]
|
|
499
|
-
: [];
|
|
500
|
-
const syncResult = await syncSpecFiles(updatedSpec, args.originalStatus, args.newStatus, args.projectPath, args.qualityWarnings, ...frozenReasonArgs);
|
|
501
|
-
if (args.changeRequest && !syncResult.warning) {
|
|
502
|
-
try {
|
|
503
|
-
await approvalStore.replaceRecords(args.projectId, args.specId, [
|
|
504
|
-
{
|
|
505
|
-
specId: args.specId,
|
|
506
|
-
reviewer: args.changeRequest.reviewer,
|
|
507
|
-
reviewerIdentity: {
|
|
508
|
-
displayName: args.changeRequest.reviewer,
|
|
509
|
-
verified: false,
|
|
510
|
-
legacy: true,
|
|
511
|
-
},
|
|
512
|
-
action: 'changes_requested',
|
|
513
|
-
timestamp: new Date().toISOString(),
|
|
514
|
-
comment: args.changeRequest.comment,
|
|
515
|
-
...(args.changeRequest.role ? { role: args.changeRequest.role } : {}),
|
|
516
|
-
},
|
|
517
|
-
]);
|
|
518
|
-
await Promise.all(evidencePaths.map(removeLifecycleArtifact));
|
|
519
|
-
if (!args.changeRequestAudit) {
|
|
520
|
-
throw new Error('change request audit context is required');
|
|
521
|
-
}
|
|
522
|
-
await appendTransitionEvent({
|
|
523
|
-
projectId: args.projectId,
|
|
524
|
-
specId: args.specId,
|
|
525
|
-
eventType: 'transition',
|
|
526
|
-
from: args.originalStatus,
|
|
527
|
-
to: args.newStatus,
|
|
528
|
-
actor: args.changeRequestAudit.actor,
|
|
529
|
-
reason: args.options.reason,
|
|
530
|
-
sessionId: args.changeRequestAudit.sessionId,
|
|
531
|
-
modelId: args.changeRequestAudit.modelId,
|
|
532
|
-
gateResults: args.changeRequestAudit.gateResults,
|
|
533
|
-
meta: {
|
|
534
|
-
...args.changeRequestAudit.meta,
|
|
535
|
-
transitionId: transitionRecord.transitionId,
|
|
536
|
-
committedAt: transitionRecord.timestamp,
|
|
537
|
-
request_changes: {
|
|
538
|
-
reviewer: args.changeRequest.reviewer,
|
|
539
|
-
comment: args.changeRequest.comment,
|
|
540
|
-
role: args.changeRequest.role ?? null,
|
|
541
|
-
changesRequested: true,
|
|
542
|
-
},
|
|
543
|
-
},
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
catch (error) {
|
|
547
|
-
let approvalRecordsRestored = false;
|
|
548
|
-
let lifecycleRestored = false;
|
|
549
|
-
try {
|
|
550
|
-
await approvalStore.replaceRecords(args.projectId, args.specId, priorApprovalRecords);
|
|
551
|
-
await Promise.all(evidencePaths.map(async (path, index) => {
|
|
552
|
-
const bytes = priorEvidence[index];
|
|
553
|
-
if (bytes) {
|
|
554
|
-
await atomicWriteFile(path, bytes);
|
|
555
|
-
}
|
|
556
|
-
}));
|
|
557
|
-
approvalRecordsRestored = true;
|
|
558
|
-
}
|
|
559
|
-
catch (compensationError) {
|
|
560
|
-
reportClassifiedDegradation('STATUS_APPROVAL_COMPENSATION_FAILURE', compensationError);
|
|
561
|
-
}
|
|
562
|
-
try {
|
|
563
|
-
await rollbackTransitionSpec(transitionRecord);
|
|
564
|
-
if (priorSpecFile !== null) {
|
|
565
|
-
await atomicWriteFile(specFilePath, priorSpecFile);
|
|
566
|
-
}
|
|
567
|
-
lifecycleRestored = true;
|
|
568
|
-
}
|
|
569
|
-
catch (compensationError) {
|
|
570
|
-
reportClassifiedDegradation('STATUS_LIFECYCLE_COMPENSATION_FAILURE', compensationError);
|
|
571
|
-
}
|
|
572
|
-
return {
|
|
573
|
-
ok: false,
|
|
574
|
-
error: {
|
|
575
|
-
content: [
|
|
576
|
-
{
|
|
577
|
-
type: 'text',
|
|
578
|
-
text: `Change request persistence failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
579
|
-
},
|
|
580
|
-
],
|
|
581
|
-
isError: true,
|
|
582
|
-
structuredContent: { approvalRecordsRestored, lifecycleRestored },
|
|
583
|
-
},
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
if (!syncResult.warning) {
|
|
588
|
-
if (syncResult.title) {
|
|
589
|
-
updatedSpec.title = syncResult.title;
|
|
590
|
-
await specStore.updateSpec(args.projectId, args.specId, { title: syncResult.title });
|
|
591
|
-
}
|
|
592
|
-
return {
|
|
593
|
-
ok: true,
|
|
594
|
-
transitionRecord,
|
|
595
|
-
updatedSpec,
|
|
596
|
-
driftReconciled: syncResult.driftReconciled === true,
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
try {
|
|
600
|
-
await rollbackTransitionSpec(transitionRecord);
|
|
601
|
-
return {
|
|
602
|
-
ok: false,
|
|
603
|
-
error: buildPersistenceFailureResponse({
|
|
604
|
-
specId: args.specId,
|
|
605
|
-
previousStatus: args.originalStatus,
|
|
606
|
-
newStatus: args.newStatus,
|
|
607
|
-
reason: syncResult.warning.reason,
|
|
608
|
-
recoveryRequired: false,
|
|
609
|
-
}),
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
catch (rollbackError) {
|
|
613
|
-
return {
|
|
614
|
-
ok: false,
|
|
615
|
-
error: buildPersistenceFailureResponse({
|
|
616
|
-
specId: args.specId,
|
|
617
|
-
previousStatus: args.originalStatus,
|
|
618
|
-
newStatus: args.newStatus,
|
|
619
|
-
reason: `${syncResult.warning.reason}; compensation failed: ` +
|
|
620
|
-
(rollbackError instanceof Error ? rollbackError.message : String(rollbackError)),
|
|
621
|
-
recoveryRequired: true,
|
|
622
|
-
}),
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
finally {
|
|
627
|
-
await releaseLock(lock).catch((error) => {
|
|
628
|
-
/* reliability-cleanup: UPDATE_STATUS_LOCK_RELEASE — lease expiry remains the recovery boundary */
|
|
629
|
-
reportClassifiedDegradation('UPDATE_STATUS_LOCK_RELEASE', error);
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
/** Build fallback interactiveQuestion for status confirmation (SPEC-595). */
|
|
635
|
-
function buildStatusConfirmFallback(specId, newStatus) {
|
|
636
|
-
return {
|
|
637
|
-
header: 'Confirm status',
|
|
638
|
-
question: `Transition ${specId} → ${newStatus}. Proceed?`,
|
|
639
|
-
multiSelect: false,
|
|
640
|
-
options: [
|
|
641
|
-
{ label: 'cancel', description: 'Keep current status (safe default)' },
|
|
642
|
-
{ label: 'confirm', description: `Transition to ${newStatus}` },
|
|
643
|
-
],
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
/** SPEC-595: Elicit user confirmation before a forced status transition. Returns ToolResult to short-circuit, or null to continue. */
|
|
647
|
-
async function runForceStatusElicitation(server, specId, newStatus, forceStatus) {
|
|
648
|
-
if (server === undefined || newStatus !== 'done' || !forceStatus) {
|
|
649
|
-
return null;
|
|
650
|
-
}
|
|
651
|
-
const { field, property } = buildEnumSchema('action', ['cancel', 'confirm'], [
|
|
652
|
-
'Cancel — keep current status (safe default)',
|
|
653
|
-
`Confirm → ${newStatus} (bypasses validate gate)`,
|
|
654
|
-
], 'Confirm forced transition', 'cancel');
|
|
655
|
-
const schema = { type: 'object', properties: { [field]: property } };
|
|
656
|
-
const fallback = buildStatusConfirmFallback(specId, newStatus);
|
|
657
|
-
const outcome = await elicitOrFallback(server, `Force transition ${specId} → ${newStatus}? This bypasses the validate score gate.`, schema, [fallback]);
|
|
658
|
-
if (outcome.mode === 'fallback') {
|
|
659
|
-
return {
|
|
660
|
-
content: [
|
|
661
|
-
{ type: 'text', text: `Transition ${specId} → ${newStatus} requires confirmation.` },
|
|
662
|
-
{
|
|
663
|
-
type: 'text',
|
|
664
|
-
text: '⚡ INTERACTIVE — call AskUserQuestion now with the interactiveQuestions from structuredContent',
|
|
665
|
-
},
|
|
666
|
-
],
|
|
667
|
-
structuredContent: { interactiveQuestions: outcome.interactiveQuestions },
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
const chosen = outcome.action === 'accept'
|
|
671
|
-
? (outcome.content?.action ?? 'cancel')
|
|
672
|
-
: 'cancel';
|
|
673
|
-
if (chosen !== 'confirm') {
|
|
674
|
-
return { content: [{ type: 'text', text: `Transition ${specId} → ${newStatus} cancelled.` }] };
|
|
675
|
-
}
|
|
676
|
-
return null;
|
|
677
|
-
}
|
|
678
|
-
/* eslint-disable complexity, max-lines-per-function */
|
|
679
|
-
export async function handleUpdateStatus(params, server) {
|
|
680
|
-
return (async () => {
|
|
681
|
-
const { specId, status: newStatus, reviewNotes } = params;
|
|
682
|
-
// SPEC-1356: implementationReviewDigest is derived automatically by the done
|
|
683
|
-
// gate when omitted (see dod-gates.deriveDoneReviewDigest), so it is never
|
|
684
|
-
// required here.
|
|
685
|
-
const authorityRoute = classifyLifecycleAuthority(params, currentReconciliationInvocationContext());
|
|
686
|
-
if (authorityRoute.route === 'error') {
|
|
687
|
-
return authorityRoute.result;
|
|
688
|
-
}
|
|
689
|
-
// SPEC-509: auto-detect project from git root when projectPath/projectId are omitted
|
|
690
|
-
const resolved = await resolveProjectIdOrAutoDetect({
|
|
691
|
-
projectId: params.projectId,
|
|
692
|
-
projectPath: params.projectPath,
|
|
693
|
-
});
|
|
694
|
-
if (!resolved.ok) {
|
|
695
|
-
return resolved.errorResult;
|
|
696
|
-
}
|
|
697
|
-
const projectId = resolved.projectId;
|
|
698
|
-
const effectiveProjectPath = resolved.projectPath;
|
|
699
|
-
const knowledge = await knowledgeStore.getKnowledge(projectId);
|
|
700
|
-
const transitionProjectPath = (params.projectPath?.trim()
|
|
701
|
-
? effectiveProjectPath
|
|
702
|
-
: (knowledge?.projectPath ?? effectiveProjectPath)) || undefined;
|
|
703
|
-
const implementationBaselineSha = newStatus === 'implementing' && transitionProjectPath
|
|
704
|
-
? await captureAttributionBaseline(transitionProjectPath)
|
|
705
|
-
: undefined;
|
|
706
|
-
if (authorityRoute.route === 'reconcile') {
|
|
707
|
-
if (params.evidence !== undefined) {
|
|
708
|
-
return {
|
|
709
|
-
content: [
|
|
710
|
-
{
|
|
711
|
-
type: 'text',
|
|
712
|
-
text: 'Evidence payload is not accepted on the reconcile route: write the artifacts with update_status before reconciling.',
|
|
713
|
-
},
|
|
714
|
-
],
|
|
715
|
-
isError: true,
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
return reconcileImplementingSpec({
|
|
719
|
-
input: params,
|
|
720
|
-
projectId,
|
|
721
|
-
projectPath: transitionProjectPath,
|
|
722
|
-
context: currentReconciliationInvocationContext(),
|
|
723
|
-
syncSpecFiles,
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
if (newStatus !== 'done') {
|
|
727
|
-
await runTransitionMaintenance(transitionProjectPath);
|
|
728
|
-
}
|
|
729
|
-
let doneFreshnessLease;
|
|
730
|
-
let persistedArtifacts = [];
|
|
731
|
-
return (async () => {
|
|
732
|
-
try {
|
|
733
|
-
// SPEC-301: Reject status changes when spec is locked by another holder (legacy manual lock)
|
|
734
|
-
const lockError = await checkSpecLockGate(transitionProjectPath, specId);
|
|
735
|
-
if (lockError) {
|
|
736
|
-
return lockError;
|
|
737
|
-
}
|
|
738
|
-
if (params.evidence !== undefined && params.dry_run !== true) {
|
|
739
|
-
const persisted = await persistEvidencePayload({
|
|
740
|
-
projectId,
|
|
741
|
-
specId,
|
|
742
|
-
evidence: params.evidence,
|
|
743
|
-
});
|
|
744
|
-
if (!persisted.ok) {
|
|
745
|
-
return {
|
|
746
|
-
content: [
|
|
747
|
-
{
|
|
748
|
-
type: 'text',
|
|
749
|
-
text: `Evidence payload rejected:\n${persisted.errors.map((error) => `- ${error}`).join('\n')}`,
|
|
750
|
-
},
|
|
751
|
-
],
|
|
752
|
-
isError: true,
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
persistedArtifacts = persisted.artifacts;
|
|
756
|
-
}
|
|
757
|
-
// Dry-run checks availability without acquiring. Real mutations acquire only
|
|
758
|
-
// around the compare-and-swap plus spec/store commit below.
|
|
759
|
-
const isDryRun = params.dry_run === true;
|
|
760
|
-
if (isDryRun) {
|
|
761
|
-
// SPEC-731: dry_run checks lock availability without acquiring it.
|
|
762
|
-
// isLocked returns null when no lockfile exists (available), or a LockInfo when locked.
|
|
763
|
-
const lockInfo = await isCrossProcessLocked(transitionProjectPath ?? projectId, specId).catch((error) => {
|
|
764
|
-
// reliability-optional: DRY_RUN_LOCK_PROBE — null conservatively avoids stale lock claims
|
|
765
|
-
reportClassifiedDegradation('DRY_RUN_LOCK_PROBE', error);
|
|
766
|
-
return null;
|
|
767
|
-
});
|
|
768
|
-
const lockIsBusy = lockInfo !== null && !lockInfo.stale;
|
|
769
|
-
if (lockIsBusy) {
|
|
770
|
-
// Lock is busy — return dry_run result indicating this without blocking
|
|
771
|
-
return buildDryRunResponse({
|
|
772
|
-
ok: true,
|
|
773
|
-
dryRun: true,
|
|
774
|
-
wouldTransition: false,
|
|
775
|
-
gates: {
|
|
776
|
-
dod: 'skip',
|
|
777
|
-
validate: 'skip',
|
|
778
|
-
qa: 'skip',
|
|
779
|
-
security: 'skip',
|
|
780
|
-
lock: 'busy',
|
|
781
|
-
compliance: 'skip',
|
|
782
|
-
},
|
|
783
|
-
blockingReasons: ['Cross-process lock is held by another process'],
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
try {
|
|
788
|
-
// Gates consume an unlocked snapshot. Commit revalidates this snapshot
|
|
789
|
-
// under the narrow mutation lock before compare-and-swap.
|
|
790
|
-
const spec = await specStore.getSpec(projectId, specId);
|
|
791
|
-
if (!spec) {
|
|
792
|
-
return {
|
|
793
|
-
content: [{ type: 'text', text: ti('spec.notFound', { id: specId }) }],
|
|
794
|
-
isError: true,
|
|
795
|
-
};
|
|
796
|
-
}
|
|
797
|
-
const originalStatus = spec.status;
|
|
798
|
-
const changeRequestReviewer = params.reviewer?.trim();
|
|
799
|
-
const changeRequestComment = params.comment?.trim();
|
|
800
|
-
const hasChangeRequestFields = params.reviewer !== undefined ||
|
|
801
|
-
params.comment !== undefined ||
|
|
802
|
-
params.role !== undefined;
|
|
803
|
-
const supportsChangeRequest = newStatus === 'draft' && (originalStatus === 'review' || originalStatus === 'approved');
|
|
804
|
-
const isChangeRequest = supportsChangeRequest;
|
|
805
|
-
if (isChangeRequest && (!changeRequestReviewer || !changeRequestComment)) {
|
|
806
|
-
return {
|
|
807
|
-
content: [
|
|
808
|
-
{
|
|
809
|
-
type: 'text',
|
|
810
|
-
text: 'reviewer and comment are required when returning review or approved work to draft.',
|
|
811
|
-
},
|
|
812
|
-
],
|
|
813
|
-
isError: true,
|
|
814
|
-
structuredContent: { error: 'CHANGE_REQUEST_FIELDS_REQUIRED', code: 422 },
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
if (!isChangeRequest && hasChangeRequestFields) {
|
|
818
|
-
return {
|
|
819
|
-
content: [
|
|
820
|
-
{
|
|
821
|
-
type: 'text',
|
|
822
|
-
text: 'reviewer, comment and role are accepted only for review→draft or approved→draft.',
|
|
823
|
-
},
|
|
824
|
-
],
|
|
825
|
-
isError: true,
|
|
826
|
-
structuredContent: { error: 'CHANGE_REQUEST_FIELDS_NOT_ALLOWED', code: 422 },
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
const changeRequest = isChangeRequest && changeRequestReviewer && changeRequestComment
|
|
830
|
-
? {
|
|
831
|
-
reviewer: changeRequestReviewer,
|
|
832
|
-
comment: changeRequestComment,
|
|
833
|
-
...(params.role ? { role: params.role } : {}),
|
|
834
|
-
}
|
|
835
|
-
: undefined;
|
|
836
|
-
if (spec.status === newStatus) {
|
|
837
|
-
await replayIdempotentPostCommitTasks({
|
|
838
|
-
projectId,
|
|
839
|
-
spec,
|
|
840
|
-
projectPath: transitionProjectPath,
|
|
841
|
-
});
|
|
842
|
-
const idempotentResult = checkIdempotentOrTransition(projectId, spec, newStatus);
|
|
843
|
-
if (idempotentResult) {
|
|
844
|
-
return idempotentResult;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
// SPEC-280/SPEC-1122: plan every intermediate state in memory. No status is
|
|
848
|
-
// persisted until all gates for the complete path have passed.
|
|
849
|
-
const { plannedStatuses, stepsExecuted } = buildAutoAdvancePlan(spec.status, newStatus);
|
|
850
|
-
let plannedFromStatus = spec.status;
|
|
851
|
-
for (const plannedStatus of plannedStatuses) {
|
|
852
|
-
const transitionError = checkTransition(plannedFromStatus, plannedStatus);
|
|
853
|
-
if (transitionError) {
|
|
854
|
-
return transitionError;
|
|
855
|
-
}
|
|
856
|
-
plannedFromStatus = plannedStatus;
|
|
857
|
-
}
|
|
858
|
-
// SPEC-733: Detect reverse transition and validate mandatory reason
|
|
859
|
-
const reverseTransition = isReverseTransition(spec.status, newStatus);
|
|
860
|
-
if (reverseTransition) {
|
|
861
|
-
const reverseValidation = validateReverseTransition({
|
|
862
|
-
from: spec.status,
|
|
863
|
-
to: newStatus,
|
|
864
|
-
reason: params.reason,
|
|
865
|
-
});
|
|
866
|
-
if (!reverseValidation.ok) {
|
|
867
|
-
return {
|
|
868
|
-
content: [
|
|
869
|
-
{
|
|
870
|
-
type: 'text',
|
|
871
|
-
text: formatKeyValue({
|
|
872
|
-
error: 'invalid_input',
|
|
873
|
-
message: reverseValidation.error,
|
|
874
|
-
fixHint: reverseValidation.fixHint,
|
|
875
|
-
}),
|
|
876
|
-
},
|
|
877
|
-
],
|
|
878
|
-
isError: true,
|
|
879
|
-
structuredContent: {
|
|
880
|
-
error: 'invalid_input',
|
|
881
|
-
code: 422,
|
|
882
|
-
fixHint: reverseValidation.fixHint,
|
|
883
|
-
},
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
// Gate: approval policy must be satisfied before transitioning to 'approved'
|
|
888
|
-
const approvalGateStatus = plannedStatuses.includes('approved') ? 'approved' : newStatus;
|
|
889
|
-
const approvalError = await checkApprovalPolicyGate(projectId, specId, approvalGateStatus);
|
|
890
|
-
if (approvalError) {
|
|
891
|
-
return approvalError;
|
|
892
|
-
}
|
|
893
|
-
// Gate: DoR must pass before transitioning to 'implementing'
|
|
894
|
-
const dorGateStatus = plannedStatuses.includes('implementing')
|
|
895
|
-
? 'implementing'
|
|
896
|
-
: newStatus;
|
|
897
|
-
const dorError = checkDorGate(spec, dorGateStatus);
|
|
898
|
-
if (dorError) {
|
|
899
|
-
return dorError;
|
|
900
|
-
}
|
|
901
|
-
// SPEC-716/SPEC-780: Format gate — block 'approved' unless forceApprove bypasses with warnings
|
|
902
|
-
const formatGate = await checkApprovedFormatGate(spec, approvalGateStatus, params.forceApprove, transitionProjectPath);
|
|
903
|
-
if (formatGate.blockResult) {
|
|
904
|
-
return formatGate.blockResult;
|
|
905
|
-
}
|
|
906
|
-
// SPEC-632: Ambiguity gate — block 'approved' if score < 70
|
|
907
|
-
const ambiguityError = await checkAmbiguityGate(spec, approvalGateStatus, transitionProjectPath);
|
|
908
|
-
if (ambiguityError) {
|
|
909
|
-
return ambiguityError;
|
|
910
|
-
}
|
|
911
|
-
// SPEC-769: Readiness gate — block 'approved' if spec has 0 criteria or score < 70
|
|
912
|
-
const readinessGate = await checkReadinessGate(spec, approvalGateStatus, params.forceApprove, transitionProjectPath);
|
|
913
|
-
if (readinessGate.blockResult) {
|
|
914
|
-
return readinessGate.blockResult;
|
|
915
|
-
}
|
|
916
|
-
// SPEC-728: DepGuard — block 'approved' if spec participates in a dependency cycle
|
|
917
|
-
let depGuardResult = null;
|
|
918
|
-
let allSpecsForDependencyGate = null;
|
|
919
|
-
if (plannedStatuses.includes('approved') || plannedStatuses.includes('implementing')) {
|
|
920
|
-
allSpecsForDependencyGate = await specStore.listSpecs(projectId);
|
|
921
|
-
}
|
|
922
|
-
if (plannedStatuses.includes('approved')) {
|
|
923
|
-
depGuardResult = checkApprovedDepGate(spec, allSpecsForDependencyGate ?? []);
|
|
924
|
-
if (depGuardResult.blocked) {
|
|
925
|
-
return {
|
|
926
|
-
content: [{ type: 'text', text: `DepGuard blocked: ${depGuardResult.narrative}` }],
|
|
927
|
-
isError: true,
|
|
928
|
-
structuredContent: {
|
|
929
|
-
error: 'DEP_GUARD_BLOCKED',
|
|
930
|
-
code: depGuardResult.code,
|
|
931
|
-
cyclePath: depGuardResult.cyclePath,
|
|
932
|
-
narrative: depGuardResult.narrative,
|
|
933
|
-
depGuard: depGuardResult,
|
|
934
|
-
},
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
if (plannedStatuses.includes('implementing')) {
|
|
939
|
-
const dependencyGate = checkImplementationDependencyGate(spec, allSpecsForDependencyGate ?? [], 'implementing');
|
|
940
|
-
if (dependencyGate) {
|
|
941
|
-
return dependencyGate;
|
|
942
|
-
}
|
|
943
|
-
const specArtifactGate = await checkSpecArtifactCommittedGate(spec, 'implementing', transitionProjectPath);
|
|
944
|
-
if (specArtifactGate) {
|
|
945
|
-
return specArtifactGate;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
// SPEC-964: Challenge gate — block 'review' if challenge_spec was never run
|
|
949
|
-
const challengeGateStatus = plannedStatuses.includes('review') ? 'review' : newStatus;
|
|
950
|
-
const challengeGate = checkChallengeGate(spec, challengeGateStatus);
|
|
951
|
-
if (challengeGate) {
|
|
952
|
-
return challengeGate;
|
|
953
|
-
}
|
|
954
|
-
if (plannedStatuses.includes('approved')) {
|
|
955
|
-
const specReviewError = await checkSpecReviewGate(specId, projectId, params.forceApprove, persistedArtifacts.find((artifact) => artifact.kind === 'review_feedback'));
|
|
956
|
-
if (specReviewError) {
|
|
957
|
-
return specReviewError;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
// SPEC-595: Elicit confirmation for destructive status transitions (→done with forceStatus)
|
|
961
|
-
const elicitResult = await runForceStatusElicitation(server, specId, newStatus, params.forceStatus);
|
|
962
|
-
if (elicitResult) {
|
|
963
|
-
return elicitResult;
|
|
964
|
-
}
|
|
965
|
-
// Resolve effective project path once — used across all gates below
|
|
966
|
-
const effectiveGatePath = transitionProjectPath;
|
|
967
|
-
// SPEC-1044: SDD model-routing + context continuity hard gate.
|
|
968
|
-
const sddRoutingGate = {
|
|
969
|
-
blockResult: null,
|
|
970
|
-
gateResults: { sddModelRouting: 'skip' },
|
|
971
|
-
forcedReasons: [],
|
|
972
|
-
};
|
|
973
|
-
if (!shouldSkipGateForExplicitLegacyHarness('routing')) {
|
|
974
|
-
const routedStatuses = plannedStatuses.filter((status) => status === 'approved' || status === 'implementing' || status === 'done');
|
|
975
|
-
for (const status of routedStatuses) {
|
|
976
|
-
const gate = await checkSddModelRoutingGate({
|
|
977
|
-
params,
|
|
978
|
-
status,
|
|
979
|
-
projectPath: effectiveGatePath,
|
|
980
|
-
});
|
|
981
|
-
if (gate.blockResult) {
|
|
982
|
-
return gate.blockResult;
|
|
983
|
-
}
|
|
984
|
-
Object.assign(sddRoutingGate.gateResults, gate.gateResults);
|
|
985
|
-
sddRoutingGate.forcedReasons.push(...gate.forcedReasons);
|
|
986
|
-
}
|
|
987
|
-
if (sddRoutingGate.forcedReasons.length > 0) {
|
|
988
|
-
sddRoutingGate.gateResults.sddModelRouting = 'forced';
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
let traceabilityAutofillWarning = null;
|
|
992
|
-
if (plannedStatuses.includes('done') &&
|
|
993
|
-
!shouldSkipGateForExplicitLegacyHarness('evidence')) {
|
|
994
|
-
const autofillGate = await runTraceabilityAutofillGate({
|
|
995
|
-
spec,
|
|
996
|
-
specId,
|
|
997
|
-
projectId,
|
|
998
|
-
projectPath: effectiveGatePath,
|
|
999
|
-
});
|
|
1000
|
-
traceabilityAutofillWarning = autofillGate.warning;
|
|
1001
|
-
}
|
|
1002
|
-
// SPEC-1054: BDD/SDD evidence gates. Non-trivial specs must carry
|
|
1003
|
-
// Discovery before approval, task-plan before implementation, and
|
|
1004
|
-
// traceability/contract evidence before done.
|
|
1005
|
-
if (!shouldSkipGateForExplicitLegacyHarness('evidence')) {
|
|
1006
|
-
const evidenceStatuses = plannedStatuses.filter((status) => status === 'approved' || status === 'implementing' || status === 'done');
|
|
1007
|
-
for (const transition of evidenceStatuses) {
|
|
1008
|
-
const evidenceGate = await checkLifecycleEvidenceTransitionGate({
|
|
1009
|
-
spec,
|
|
1010
|
-
specId,
|
|
1011
|
-
projectId,
|
|
1012
|
-
projectPath: effectiveGatePath,
|
|
1013
|
-
transition,
|
|
1014
|
-
});
|
|
1015
|
-
if (evidenceGate !== null) {
|
|
1016
|
-
return evidenceGate;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
// SPEC-1356 (T-A1): implementationReviewDigest is optional. When the
|
|
1021
|
-
// caller omits it, derive it automatically from the persisted
|
|
1022
|
-
// validation-report.json instead of requiring the caller to hand-compute
|
|
1023
|
-
// a sha256. Failure to derive it fails closed with a clear "run validate
|
|
1024
|
-
// first" message — identical strength to the explicit-digest path.
|
|
1025
|
-
let resolvedImplementationReviewDigest = params.implementationReviewDigest;
|
|
1026
|
-
if (newStatus === 'done' &&
|
|
1027
|
-
resolvedImplementationReviewDigest === undefined &&
|
|
1028
|
-
!shouldSkipGateForExplicitLegacyHarness('evidence')) {
|
|
1029
|
-
const derived = await deriveDoneReviewDigest(specId, projectId);
|
|
1030
|
-
if ('error' in derived) {
|
|
1031
|
-
return derived.error;
|
|
1032
|
-
}
|
|
1033
|
-
resolvedImplementationReviewDigest = derived.digest;
|
|
1034
|
-
}
|
|
1035
|
-
// ---------------------------------------------------------------------------
|
|
1036
|
-
// BATCH A (parallel): code-reality + done-gates — independent of each other
|
|
1037
|
-
// SPEC-441: Code reality check before transitioning to 'implementing'
|
|
1038
|
-
// SPEC-335: DoD + security gates before transitioning to 'done'
|
|
1039
|
-
// ---------------------------------------------------------------------------
|
|
1040
|
-
// `done` consumes the immutable validation receipt below. Validation, QA,
|
|
1041
|
-
// security and repository scans belong to the durable validation worker.
|
|
1042
|
-
let codeRealityWarning = null;
|
|
1043
|
-
let forcedBypassWarning = null;
|
|
1044
|
-
const [codeRealityResult, doneGatesResult] = await Promise.all([
|
|
1045
|
-
// Code reality: only relevant for 'implementing'
|
|
1046
|
-
newStatus === 'implementing' && !reverseTransition && effectiveGatePath
|
|
1047
|
-
? runOwnershipBoundedCodeReality(spec, effectiveGatePath, implementationBaselineSha).catch((error) => {
|
|
1048
|
-
// reliability-optional: CODE_REALITY_ENRICHMENT — downstream evidence gates remain binding
|
|
1049
|
-
reportClassifiedDegradation('CODE_REALITY_ENRICHMENT', error);
|
|
1050
|
-
return null;
|
|
1051
|
-
})
|
|
1052
|
-
: Promise.resolve(null),
|
|
1053
|
-
// Done gates: only relevant for 'done'
|
|
1054
|
-
newStatus === 'done' && !shouldSkipGateForExplicitLegacyHarness('evidence')
|
|
1055
|
-
? checkDoneGates(spec, specId, projectId, effectiveGatePath, params.force, params.forceStatusReason ?? params.reason ?? 'No force reason provided', undefined, resolvedImplementationReviewDigest)
|
|
1056
|
-
: Promise.resolve(null),
|
|
1057
|
-
]);
|
|
1058
|
-
// Process code reality result
|
|
1059
|
-
if (codeRealityResult?.status === 'complete' || codeRealityResult?.status === 'partial') {
|
|
1060
|
-
codeRealityWarning = codeRealityResult.warning;
|
|
1061
|
-
}
|
|
1062
|
-
// Process done gates result — may block
|
|
1063
|
-
if (doneGatesResult !== null) {
|
|
1064
|
-
if (doneGatesResult.blocked) {
|
|
1065
|
-
return doneGatesResult.blocked;
|
|
1066
|
-
}
|
|
1067
|
-
forcedBypassWarning = doneGatesResult.forcedBypassWarning;
|
|
1068
|
-
doneFreshnessLease = doneGatesResult.freshnessLease ?? undefined;
|
|
1069
|
-
}
|
|
1070
|
-
// ---------------------------------------------------------------------------
|
|
1071
|
-
// Review-only heuristic compliance. `done` must remain an O(1) receipt
|
|
1072
|
-
// consumer and therefore must not execute commands or scan the repository.
|
|
1073
|
-
// ---------------------------------------------------------------------------
|
|
1074
|
-
const validateScore = null;
|
|
1075
|
-
const validateScoreSource = null;
|
|
1076
|
-
const crashShieldWarning = null;
|
|
1077
|
-
let complianceGateResult = null;
|
|
1078
|
-
const complianceResult = plannedStatuses.includes('review')
|
|
1079
|
-
? await withToolTimeout(checkComplianceGate(specId, projectId, effectiveGatePath), 9_000, {
|
|
1080
|
-
skipped: true,
|
|
1081
|
-
blocked: false,
|
|
1082
|
-
score: null,
|
|
1083
|
-
issues: [],
|
|
1084
|
-
})
|
|
1085
|
-
: null;
|
|
1086
|
-
// Process compliance gate result — may block on 'review'
|
|
1087
|
-
if (complianceResult !== null) {
|
|
1088
|
-
complianceGateResult = complianceResult;
|
|
1089
|
-
if (plannedStatuses.includes('review') && complianceResult.blocked) {
|
|
1090
|
-
return buildBlockedByComplianceResponse(specId, complianceResult);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
// Approved still needs constitution warnings. Done relies exclusively on
|
|
1094
|
-
// the validation receipt and never invokes this legacy command runner.
|
|
1095
|
-
const { conventionWarnings, constitutionWarnings, compileWarnings, lintWarnings, testWarnings, } = plannedStatuses.includes('approved')
|
|
1096
|
-
? await runComplianceGates(projectId, spec.title, spec.tags, newStatus, specId)
|
|
1097
|
-
: {
|
|
1098
|
-
conventionWarnings: [],
|
|
1099
|
-
constitutionWarnings: [],
|
|
1100
|
-
compileWarnings: [],
|
|
1101
|
-
lintWarnings: [],
|
|
1102
|
-
testWarnings: [],
|
|
1103
|
-
};
|
|
1104
|
-
// SPEC-731: dry_run short-circuit — all gates have been evaluated above.
|
|
1105
|
-
// Do NOT call transitionSpec, appendTransitionEvent, or acquire any lock.
|
|
1106
|
-
if (isDryRun) {
|
|
1107
|
-
const dryRunGates = {
|
|
1108
|
-
dod: newStatus === 'done' ? (doneGatesResult?.blocked ? 'fail' : 'pass') : 'skip',
|
|
1109
|
-
validate: newStatus === 'done' ? 'pass' : 'skip',
|
|
1110
|
-
qa: newStatus === 'done' ? 'pass' : 'skip',
|
|
1111
|
-
security: newStatus === 'done' ? (doneGatesResult?.blocked ? 'fail' : 'pass') : 'skip',
|
|
1112
|
-
lock: 'available',
|
|
1113
|
-
compliance: complianceGateResult === null
|
|
1114
|
-
? 'skip'
|
|
1115
|
-
: complianceGateResult.skipped
|
|
1116
|
-
? 'skip'
|
|
1117
|
-
: complianceGateResult.blocked
|
|
1118
|
-
? 'fail'
|
|
1119
|
-
: 'pass',
|
|
1120
|
-
};
|
|
1121
|
-
return buildDryRunResponse({
|
|
1122
|
-
ok: true,
|
|
1123
|
-
dryRun: true,
|
|
1124
|
-
wouldTransition: true,
|
|
1125
|
-
gates: dryRunGates,
|
|
1126
|
-
blockingReasons: [],
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
// Run only fast, read-only transition checks before persistence.
|
|
1130
|
-
const trigger = reverseTransition
|
|
1131
|
-
? 'reopen'
|
|
1132
|
-
: stepsExecuted.length > 0
|
|
1133
|
-
? 'auto-advance'
|
|
1134
|
-
: (params.trigger ?? 'user');
|
|
1135
|
-
const actor = params.actor ?? 'system';
|
|
1136
|
-
const viaSync = params.viaSync ?? false;
|
|
1137
|
-
// SPEC-1044: Every phase transition records model/context evidence.
|
|
1138
|
-
const transitionEvidenceMeta = {
|
|
1139
|
-
...buildTransitionEvidenceMeta(params),
|
|
1140
|
-
...(sddRoutingGate.forcedReasons.length > 0 && {
|
|
1141
|
-
forcedSddModelRouting: true,
|
|
1142
|
-
forcedSddModelRoutingReasons: sddRoutingGate.forcedReasons,
|
|
1143
|
-
}),
|
|
1144
|
-
};
|
|
1145
|
-
const nonStatusUpdates = {};
|
|
1146
|
-
// Store review notes when sending back (review->draft or approved->review)
|
|
1147
|
-
const effectiveReviewNotes = isChangeRequest
|
|
1148
|
-
? `Changes requested by ${changeRequestReviewer}: ${changeRequestComment}`
|
|
1149
|
-
: reviewNotes;
|
|
1150
|
-
if (effectiveReviewNotes) {
|
|
1151
|
-
const existing = spec.reviewNotes ?? [];
|
|
1152
|
-
nonStatusUpdates.reviewNotes = [
|
|
1153
|
-
...existing,
|
|
1154
|
-
`[${new Date().toISOString()}] ${originalStatus}→${newStatus}: ${effectiveReviewNotes}`,
|
|
1155
|
-
];
|
|
1156
|
-
}
|
|
1157
|
-
const forceStatusAuditId = null;
|
|
1158
|
-
// SPEC-780: Audit-trail entry when forceApprove bypassed readiness/format gates
|
|
1159
|
-
let forceApproveAuditId = null;
|
|
1160
|
-
if (newStatus === 'approved' && params.forceApprove) {
|
|
1161
|
-
const bypassedGates = [];
|
|
1162
|
-
if (readinessGate.qualityWarnings.length > 0) {
|
|
1163
|
-
bypassedGates.push('readiness');
|
|
1164
|
-
}
|
|
1165
|
-
if (formatGate.qualityWarnings.length > 0) {
|
|
1166
|
-
bypassedGates.push('format');
|
|
1167
|
-
}
|
|
1168
|
-
if (bypassedGates.length > 0) {
|
|
1169
|
-
try {
|
|
1170
|
-
const auditId = uuid();
|
|
1171
|
-
const prevHash = getLastHash();
|
|
1172
|
-
const entry = {
|
|
1173
|
-
id: auditId,
|
|
1174
|
-
timestamp: new Date().toISOString(),
|
|
1175
|
-
toolName: 'update_status',
|
|
1176
|
-
inputSummary: `approve_gate_forced_bypass specId=${specId} bypassedGates=[${bypassedGates.join(',')}]`,
|
|
1177
|
-
outputType: 'success',
|
|
1178
|
-
durationMs: 0,
|
|
1179
|
-
specId,
|
|
1180
|
-
projectPath: effectiveGatePath,
|
|
1181
|
-
prevHash,
|
|
1182
|
-
hash: '',
|
|
1183
|
-
event: 'approve_gate_forced_bypass',
|
|
1184
|
-
details: {
|
|
1185
|
-
bypassedGates,
|
|
1186
|
-
fromStatus: originalStatus,
|
|
1187
|
-
toStatus: newStatus,
|
|
1188
|
-
originalBlockers: [
|
|
1189
|
-
...readinessGate.qualityWarnings,
|
|
1190
|
-
...formatGate.qualityWarnings,
|
|
1191
|
-
],
|
|
1192
|
-
},
|
|
1193
|
-
};
|
|
1194
|
-
appendEntry(entry);
|
|
1195
|
-
forceApproveAuditId = auditId;
|
|
1196
|
-
}
|
|
1197
|
-
catch (error) {
|
|
1198
|
-
/* reliability-optional: FORCE_APPROVAL_AUDIT — transition receipt remains authoritative */
|
|
1199
|
-
reportClassifiedDegradation('FORCE_APPROVAL_AUDIT', error);
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
// SPEC-1044: Audit forced SDD model/context gate bypasses.
|
|
1204
|
-
let sddRoutingAuditId = null;
|
|
1205
|
-
if (sddRoutingGate.forcedReasons.length > 0) {
|
|
1206
|
-
try {
|
|
1207
|
-
const auditId = uuid();
|
|
1208
|
-
const prevHash = getLastHash();
|
|
1209
|
-
const entry = {
|
|
1210
|
-
id: auditId,
|
|
1211
|
-
timestamp: new Date().toISOString(),
|
|
1212
|
-
toolName: 'update_status',
|
|
1213
|
-
inputSummary: `sdd_model_routing_forced_bypass specId=${specId} status=${newStatus}`,
|
|
1214
|
-
outputType: 'success',
|
|
1215
|
-
durationMs: 0,
|
|
1216
|
-
specId,
|
|
1217
|
-
projectPath: effectiveGatePath,
|
|
1218
|
-
prevHash,
|
|
1219
|
-
hash: '',
|
|
1220
|
-
event: 'sdd_model_routing_forced_bypass',
|
|
1221
|
-
details: {
|
|
1222
|
-
reasons: sddRoutingGate.forcedReasons,
|
|
1223
|
-
fromStatus: originalStatus,
|
|
1224
|
-
toStatus: newStatus,
|
|
1225
|
-
gateResults: sddRoutingGate.gateResults,
|
|
1226
|
-
evidence: buildTransitionEvidenceMeta(params),
|
|
1227
|
-
},
|
|
1228
|
-
};
|
|
1229
|
-
appendEntry(entry);
|
|
1230
|
-
sddRoutingAuditId = auditId;
|
|
1231
|
-
}
|
|
1232
|
-
catch (error) {
|
|
1233
|
-
/* reliability-optional: SDD_ROUTING_AUDIT — transition receipt remains authoritative */
|
|
1234
|
-
reportClassifiedDegradation('SDD_ROUTING_AUDIT', error);
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
const versionSnapshotTag = newStatus === 'approved'
|
|
1238
|
-
? `approved-${new Date().toISOString().replace(/[-:]/g, '').slice(0, 13)}`
|
|
1239
|
-
: null;
|
|
1240
|
-
const plannedBackgroundActions = planBackgroundActions({ newStatus });
|
|
1241
|
-
const transitionRootBinding = plannedBackgroundActions.length > 0 && effectiveGatePath
|
|
1242
|
-
? computeTransitionRootBinding(effectiveGatePath)
|
|
1243
|
-
: undefined;
|
|
1244
|
-
const qualityWarningsToWrite = newStatus === 'approved'
|
|
1245
|
-
? [...readinessGate.qualityWarnings, ...formatGate.qualityWarnings]
|
|
1246
|
-
: newStatus === 'done' && traceabilityAutofillWarning
|
|
1247
|
-
? [...new Set([...(spec.qualityWarnings ?? []), traceabilityAutofillWarning])]
|
|
1248
|
-
: [];
|
|
1249
|
-
const persistence = await commitTransitionWithNarrowLock({
|
|
1250
|
-
projectPath: effectiveGatePath ?? projectId,
|
|
1251
|
-
projectId,
|
|
1252
|
-
specId,
|
|
1253
|
-
newStatus,
|
|
1254
|
-
originalStatus,
|
|
1255
|
-
expectedSpec: spec,
|
|
1256
|
-
qualityWarnings: qualityWarningsToWrite,
|
|
1257
|
-
options: {
|
|
1258
|
-
trigger: trigger,
|
|
1259
|
-
actor,
|
|
1260
|
-
viaSync,
|
|
1261
|
-
reason: params.reason,
|
|
1262
|
-
updates: nonStatusUpdates,
|
|
1263
|
-
pendingBackgroundActions: plannedBackgroundActions,
|
|
1264
|
-
transitionRootBinding,
|
|
1265
|
-
expectedSpec: spec,
|
|
1266
|
-
},
|
|
1267
|
-
...(doneFreshnessLease ? { freshnessLease: doneFreshnessLease } : {}),
|
|
1268
|
-
...(changeRequest
|
|
1269
|
-
? {
|
|
1270
|
-
changeRequest,
|
|
1271
|
-
changeRequestAudit: {
|
|
1272
|
-
actor,
|
|
1273
|
-
sessionId: params.sessionId,
|
|
1274
|
-
modelId: params.modelId,
|
|
1275
|
-
gateResults: sddRoutingGate.gateResults,
|
|
1276
|
-
meta: transitionEvidenceMeta,
|
|
1277
|
-
},
|
|
1278
|
-
}
|
|
1279
|
-
: {}),
|
|
1280
|
-
});
|
|
1281
|
-
if (!persistence.ok) {
|
|
1282
|
-
return persistence.error;
|
|
1283
|
-
}
|
|
1284
|
-
const { transitionRecord, updatedSpec, driftReconciled } = persistence;
|
|
1285
|
-
if (updatedSpec.title && updatedSpec.title !== spec.title) {
|
|
1286
|
-
spec.title = updatedSpec.title;
|
|
1287
|
-
}
|
|
1288
|
-
const frontmatterSyncWarnings = [];
|
|
1289
|
-
const transitionId = transitionRecord.transitionId;
|
|
1290
|
-
const committedAt = transitionRecord.timestamp;
|
|
1291
|
-
if (newStatus === 'done') {
|
|
1292
|
-
await runTransitionMaintenance(transitionProjectPath);
|
|
1293
|
-
}
|
|
1294
|
-
const transitionEventAudit = resolveTransitionEventAudit(driftReconciled, params.reason, {
|
|
1295
|
-
...transitionEvidenceMeta,
|
|
1296
|
-
transitionId,
|
|
1297
|
-
committedAt,
|
|
1298
|
-
...(isChangeRequest
|
|
1299
|
-
? {
|
|
1300
|
-
request_changes: {
|
|
1301
|
-
reviewer: params.reviewer,
|
|
1302
|
-
comment: params.comment,
|
|
1303
|
-
role: params.role ?? null,
|
|
1304
|
-
changesRequested: true,
|
|
1305
|
-
},
|
|
1306
|
-
}
|
|
1307
|
-
: {}),
|
|
1308
|
-
});
|
|
1309
|
-
if (!isChangeRequest) {
|
|
1310
|
-
await appendTransitionEvent({
|
|
1311
|
-
projectId,
|
|
1312
|
-
specId,
|
|
1313
|
-
eventType: 'transition',
|
|
1314
|
-
from: originalStatus,
|
|
1315
|
-
to: newStatus,
|
|
1316
|
-
actor,
|
|
1317
|
-
reason: transitionEventAudit.reason,
|
|
1318
|
-
sessionId: params.sessionId,
|
|
1319
|
-
modelId: params.modelId,
|
|
1320
|
-
gateResults: sddRoutingGate.gateResults,
|
|
1321
|
-
meta: transitionEventAudit.meta,
|
|
1322
|
-
}).catch((error) => {
|
|
1323
|
-
/* reliability-optional: SDD_ROUTING_REPORT — never block committed acknowledgement */
|
|
1324
|
-
reportClassifiedDegradation('SDD_ROUTING_REPORT', error);
|
|
1325
|
-
if (driftReconciled) {
|
|
1326
|
-
frontmatterSyncWarnings.push(buildDriftAppendFailureWarning(specId, updatedSpec.specPath, error));
|
|
1327
|
-
}
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1330
|
-
if (reverseTransition && params.reason) {
|
|
1331
|
-
await appendTransitionEvent({
|
|
1332
|
-
projectId,
|
|
1333
|
-
specId,
|
|
1334
|
-
eventType: 'reopen',
|
|
1335
|
-
from: originalStatus,
|
|
1336
|
-
to: newStatus,
|
|
1337
|
-
actor,
|
|
1338
|
-
reason: params.reason,
|
|
1339
|
-
meta: { transitionId, committedAt },
|
|
1340
|
-
}).catch((err) => {
|
|
1341
|
-
/* reliability-optional: REOPEN_EVENT_APPEND — transition receipt remains authoritative */
|
|
1342
|
-
reportClassifiedDegradation('REOPEN_EVENT_APPEND', err);
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
// SPEC-723: Record terminal transition in hash-chained log (best-effort, fire-and-forget)
|
|
1346
|
-
// SPEC-734: Thread enriched payload — sessionId, modelId, gateResults
|
|
1347
|
-
if (newStatus === 'done' || newStatus === 'discarded') {
|
|
1348
|
-
// Build gateResults from gate outcomes resolved earlier in this handler
|
|
1349
|
-
const terminalGateResults = {};
|
|
1350
|
-
if (newStatus === 'done') {
|
|
1351
|
-
Object.assign(terminalGateResults, sddRoutingGate.gateResults);
|
|
1352
|
-
terminalGateResults.validate = 'pass';
|
|
1353
|
-
if (complianceGateResult !== null) {
|
|
1354
|
-
terminalGateResults.compliance = complianceGateResult.skipped
|
|
1355
|
-
? 'skip'
|
|
1356
|
-
: complianceGateResult.blocked
|
|
1357
|
-
? 'fail'
|
|
1358
|
-
: 'pass';
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
await recordTerminalTransitionEvent({
|
|
1362
|
-
projectId,
|
|
1363
|
-
specId,
|
|
1364
|
-
specPath: updatedSpec.specPath,
|
|
1365
|
-
newStatus,
|
|
1366
|
-
from: originalStatus,
|
|
1367
|
-
actor: actor,
|
|
1368
|
-
// SPEC-734: sessionId from MCP context params (best-effort)
|
|
1369
|
-
sessionId: params.sessionId,
|
|
1370
|
-
// SPEC-734: modelId from params or known convention
|
|
1371
|
-
modelId: params.modelId,
|
|
1372
|
-
gateResults: Object.keys(terminalGateResults).length > 0 ? terminalGateResults : undefined,
|
|
1373
|
-
meta: transitionEvidenceMeta,
|
|
1374
|
-
projectPath: effectiveGatePath,
|
|
1375
|
-
}).catch((error) => {
|
|
1376
|
-
/* reliability-optional: TERMINAL_VALIDATION_REPORT — canonical receipt is authoritative */
|
|
1377
|
-
reportClassifiedDegradation('TERMINAL_VALIDATION_REPORT', error);
|
|
1378
|
-
});
|
|
1379
|
-
try {
|
|
1380
|
-
await pruneRuntimeArtifactsOnTerminal(projectId, specId);
|
|
1381
|
-
}
|
|
1382
|
-
catch (error) {
|
|
1383
|
-
reportClassifiedDegradation('RETENTION_TERMINAL_PRUNE', error);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
const allSpecs = await specStore.listSpecs(projectId);
|
|
1387
|
-
const cascadeResult = cascadeCheck(specId, allSpecs, newStatus);
|
|
1388
|
-
const postCommitTasks = buildPostCommitTasks({
|
|
1389
|
-
actionNames: plannedBackgroundActions,
|
|
1390
|
-
projectId,
|
|
1391
|
-
spec: updatedSpec,
|
|
1392
|
-
previousStatus: originalStatus,
|
|
1393
|
-
committedAt,
|
|
1394
|
-
knowledge,
|
|
1395
|
-
allSpecs,
|
|
1396
|
-
validateScore,
|
|
1397
|
-
effectiveProjectPath: effectiveGatePath,
|
|
1398
|
-
versionSnapshotTag,
|
|
1399
|
-
});
|
|
1400
|
-
const pendingBackgroundActions = queuePostCommitTasks({
|
|
1401
|
-
projectId,
|
|
1402
|
-
specId,
|
|
1403
|
-
transitionId,
|
|
1404
|
-
tasks: postCommitTasks,
|
|
1405
|
-
});
|
|
1406
|
-
const result = compactObj({
|
|
1407
|
-
specId,
|
|
1408
|
-
projectId,
|
|
1409
|
-
previousStatus: originalStatus,
|
|
1410
|
-
newStatus,
|
|
1411
|
-
autoAdvanced: stepsExecuted.length > 0 ? true : null,
|
|
1412
|
-
stepsExecuted: stepsExecuted.length > 0 ? stepsExecuted : null,
|
|
1413
|
-
codeRealityWarning,
|
|
1414
|
-
crashShieldWarning,
|
|
1415
|
-
forcedBypassWarning,
|
|
1416
|
-
validateScore,
|
|
1417
|
-
validateScoreSource,
|
|
1418
|
-
// SPEC-721: audit ID for the forced validate bypass (null when no bypass occurred)
|
|
1419
|
-
forceStatusAuditId,
|
|
1420
|
-
// SPEC-780: audit ID for the forced approve bypass (null when no bypass occurred)
|
|
1421
|
-
forceApproveAuditId,
|
|
1422
|
-
// SPEC-1044: audit ID for forced SDD model/context routing bypasses.
|
|
1423
|
-
sddRoutingAuditId,
|
|
1424
|
-
sddRoutingGateResults: sddRoutingGate.gateResults,
|
|
1425
|
-
constitutionWarnings: constitutionWarnings.length > 0 ? constitutionWarnings : null,
|
|
1426
|
-
conventionWarnings: conventionWarnings.length > 0 ? conventionWarnings : null,
|
|
1427
|
-
compileWarnings: compileWarnings.length > 0 ? compileWarnings : null,
|
|
1428
|
-
lintWarnings: lintWarnings.length > 0 ? lintWarnings : null,
|
|
1429
|
-
testWarnings: testWarnings.length > 0 ? testWarnings : null,
|
|
1430
|
-
cascade: cascadeResult,
|
|
1431
|
-
complianceGateResult,
|
|
1432
|
-
versionSnapshotTag,
|
|
1433
|
-
committed: true,
|
|
1434
|
-
transitionId,
|
|
1435
|
-
committedAt,
|
|
1436
|
-
idempotent: false,
|
|
1437
|
-
pendingBackgroundActions,
|
|
1438
|
-
evidenceArtifacts: persistedArtifacts.length > 0
|
|
1439
|
-
? persistedArtifacts.map(({ kind, path, digest }) => ({ kind, path, digest }))
|
|
1440
|
-
: null,
|
|
1441
|
-
// SPEC-728: DepGuard result (null when gate was not applicable)
|
|
1442
|
-
depGuard: depGuardResult,
|
|
1443
|
-
// SPEC-698: surface frontmatter sync failures in the response
|
|
1444
|
-
frontmatterSyncWarnings: frontmatterSyncWarnings.length > 0 ? frontmatterSyncWarnings : null,
|
|
1445
|
-
qualityWarnings: qualityWarningsToWrite.length > 0 ? qualityWarningsToWrite : null,
|
|
1446
|
-
updatedAt: updatedSpec.updatedAt,
|
|
1447
|
-
message: ti('tools.update_status.success', { specId, status: newStatus }),
|
|
1448
|
-
});
|
|
1449
|
-
// SPEC-772 Scenario 4: surface validate failure from cascade as explicit warning
|
|
1450
|
-
// SPEC-754: Append shell-hygiene reminder when transitioning to done on claude-code host
|
|
1451
|
-
const shellHygieneHint = newStatus === 'done' && detectHost() === 'claude-code' ? shellHygieneReminder() : null;
|
|
1452
|
-
return buildStatusResponse(result, specId, originalStatus, newStatus, null, spec.title, shellHygieneHint);
|
|
1453
|
-
}
|
|
1454
|
-
finally {
|
|
1455
|
-
// Expensive gates intentionally execute without a mutation lock.
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
catch (error) {
|
|
1459
|
-
if (error instanceof LockBusyError) {
|
|
1460
|
-
return {
|
|
1461
|
-
content: [
|
|
1462
|
-
{
|
|
1463
|
-
type: 'text',
|
|
1464
|
-
text: `Spec ${specId} is locked by another process (LOCK_BUSY). Retry later.`,
|
|
1465
|
-
},
|
|
1466
|
-
],
|
|
1467
|
-
isError: true,
|
|
1468
|
-
};
|
|
1469
|
-
}
|
|
1470
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1471
|
-
return {
|
|
1472
|
-
content: [{ type: 'text', text: ti('errors.internalError', { message }) }],
|
|
1473
|
-
isError: true,
|
|
1474
|
-
};
|
|
1475
|
-
}
|
|
1476
|
-
finally {
|
|
1477
|
-
if (doneFreshnessLease) {
|
|
1478
|
-
await closeValidationFreshnessLease(doneFreshnessLease).catch((error) => {
|
|
1479
|
-
/* reliability-cleanup: freshness expiry remains the recovery boundary */
|
|
1480
|
-
reportClassifiedDegradation('VALIDATION_FRESHNESS_CHECK_FAILED', error);
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
})();
|
|
1485
|
-
})();
|
|
1486
|
-
}
|
|
1487
|
-
//# sourceMappingURL=index.js.map
|