@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,968 +0,0 @@
|
|
|
1
|
-
import { reportClassifiedDegradation } from '../errors/classified-degradation.js';
|
|
2
|
-
import { CriticalJsonReadError, readCriticalJson, readJson, writeJson, projectDataDir, } from './base-store.js';
|
|
3
|
-
import { enforceRetention } from './retention.js';
|
|
4
|
-
import { decodeCriticalSchema, registerCriticalSchema } from './schema-registry.js';
|
|
5
|
-
import { BoundaryFailure } from '../errors/error-taxonomy.js';
|
|
6
|
-
import { withFileLock } from './file-mutex.js';
|
|
7
|
-
// eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
|
|
8
|
-
import { computeHealthScore } from '../engine/spec-health-scorer.js';
|
|
9
|
-
// eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
|
|
10
|
-
import { loadSpecContent } from '../engine/validation-loop.js';
|
|
11
|
-
import { createHash, randomUUID } from 'node:crypto';
|
|
12
|
-
import { readFile } from 'node:fs/promises';
|
|
13
|
-
import { basename, dirname, isAbsolute, join } from 'node:path';
|
|
14
|
-
import { glob } from 'glob';
|
|
15
|
-
// eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
|
|
16
|
-
import { acquireLock, releaseLock } from '../engine/safety/cross-process-lock.js';
|
|
17
|
-
import { resolvePortableSpecPath, resolveVerifiedSpecPath, toPortableSpecPath, PortablePathError, } from './project-identity.js';
|
|
18
|
-
import { digestOf, readFrontmatterScalars } from './spec-index.js';
|
|
19
|
-
import { appendEntry, getLastHash } from './audit-trail-store.js';
|
|
20
|
-
// eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
|
|
21
|
-
import { hashEntry } from '../engine/audit-trail/hasher.js';
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// SPEC-720: Guard error — direct status write forbidden
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
/**
|
|
26
|
-
* Thrown when code tries to write `status` via `updateSpec` directly.
|
|
27
|
-
* All status transitions must go through `handleUpdateStatus` → `transitionSpec`.
|
|
28
|
-
*/
|
|
29
|
-
export class DirectStatusWriteForbiddenError extends Error {
|
|
30
|
-
constructor(specId, attemptedStatus, caller) {
|
|
31
|
-
super(`Direct status write to ${specId} (status=${attemptedStatus}) forbidden. ` +
|
|
32
|
-
`Caller "${caller}" must invoke handleUpdateStatus instead. ` +
|
|
33
|
-
`See SPEC-720.`);
|
|
34
|
-
this.name = 'DirectStatusWriteForbiddenError';
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/** Stable, privacy-safe canonical identity failure. */
|
|
38
|
-
export class DuplicateSpecIdError extends Error {
|
|
39
|
-
code = 'DUPLICATE_SPEC_ID';
|
|
40
|
-
constructor(projectId, specIds) {
|
|
41
|
-
const ids = [...new Set(specIds)].sort((left, right) => left.localeCompare(right));
|
|
42
|
-
super(`[Planu] Canonical spec identity conflict in project ${projectId}: ${ids.join(', ')}`);
|
|
43
|
-
this.name = 'DuplicateSpecIdError';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// --- internal helpers ---
|
|
47
|
-
function specsFile(projectId) {
|
|
48
|
-
return `${projectDataDir(projectId)}/specs.json`;
|
|
49
|
-
}
|
|
50
|
-
/** Normalize legacy specs: map huPath→specPath, fichaTecnicaPath→technicalPath */
|
|
51
|
-
function normalizeSpec(raw) {
|
|
52
|
-
// The raw object is parsed JSON; we perform field migration before treating it as Spec.
|
|
53
|
-
// Direct cast via intermediate `any` is necessary because Record<string,unknown> does
|
|
54
|
-
// not structurally overlap with the specific Spec interface.
|
|
55
|
-
const spec = raw;
|
|
56
|
-
// Lazy migration: legacy field names → modern field names
|
|
57
|
-
if (!spec.specPath && spec.huPath) {
|
|
58
|
-
spec.specPath = spec.huPath;
|
|
59
|
-
}
|
|
60
|
-
if (!spec.technicalPath && spec.fichaTecnicaPath) {
|
|
61
|
-
spec.technicalPath = spec.fichaTecnicaPath;
|
|
62
|
-
}
|
|
63
|
-
// SPEC-601: Lazy UUID migration — generate if missing
|
|
64
|
-
spec.uuid ??= crypto.randomUUID();
|
|
65
|
-
if (!Array.isArray(raw.dependencies)) {
|
|
66
|
-
spec.dependencies = [];
|
|
67
|
-
}
|
|
68
|
-
if (!Array.isArray(raw.blockedBy)) {
|
|
69
|
-
spec.blockedBy = [];
|
|
70
|
-
}
|
|
71
|
-
if (spec.uuidAliases !== undefined) {
|
|
72
|
-
spec.uuidAliases = [
|
|
73
|
-
...new Set(spec.uuidAliases.filter((alias) => typeof alias === 'string' && alias)),
|
|
74
|
-
].sort((left, right) => left.localeCompare(right));
|
|
75
|
-
}
|
|
76
|
-
return spec;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Validate the single canonical identity namespace shared by every spec row.
|
|
80
|
-
* Keep the diagnostic deliberately small: UUIDs and storage paths are private.
|
|
81
|
-
*/
|
|
82
|
-
function validateCanonicalSpecRows(projectId, specs) {
|
|
83
|
-
const ids = new Map();
|
|
84
|
-
const uuids = new Map();
|
|
85
|
-
const conflicts = new Set();
|
|
86
|
-
for (const spec of specs) {
|
|
87
|
-
const priorId = ids.get(spec.id);
|
|
88
|
-
if (priorId !== undefined) {
|
|
89
|
-
conflicts.add(spec.id);
|
|
90
|
-
conflicts.add(priorId);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
ids.set(spec.id, spec.id);
|
|
94
|
-
}
|
|
95
|
-
if (spec.projectId !== projectId) {
|
|
96
|
-
conflicts.add(spec.id);
|
|
97
|
-
}
|
|
98
|
-
const identities = [spec.uuid, ...(spec.uuidAliases ?? [])];
|
|
99
|
-
for (const identity of identities) {
|
|
100
|
-
if (typeof identity !== 'string' || identity.length === 0) {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
const owner = uuids.get(identity);
|
|
104
|
-
if (owner !== undefined) {
|
|
105
|
-
conflicts.add(owner);
|
|
106
|
-
conflicts.add(spec.id);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
uuids.set(identity, spec.id);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (conflicts.size > 0) {
|
|
114
|
-
throw new DuplicateSpecIdError(projectId, [...conflicts]);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// Write-through in-memory cache: projectId → Spec[].
|
|
118
|
-
// Populated on first read; invalidated (updated) on every mutation.
|
|
119
|
-
// Eliminates repeated disk I/O for a local single-user MCP server.
|
|
120
|
-
const specsCache = new Map();
|
|
121
|
-
const STORE_LOCK_RETRY_MS = 25;
|
|
122
|
-
const STORE_LOCK_TIMEOUT_MS = 2_000;
|
|
123
|
-
const STORE_LOCK_ID = '__project-spec-store__';
|
|
124
|
-
const DEFAULT_POST_COMMIT_LEASE_MS = 30_000;
|
|
125
|
-
const MAX_POST_COMMIT_ATTEMPTS = 3;
|
|
126
|
-
const COMPLETED_OUTBOX_RETENTION = 20;
|
|
127
|
-
registerCriticalSchema({
|
|
128
|
-
name: 'spec-store',
|
|
129
|
-
currentVersion: 1,
|
|
130
|
-
createDefault: () => [],
|
|
131
|
-
validate: (value) => Array.isArray(value),
|
|
132
|
-
migrate: (value, fromVersion) => {
|
|
133
|
-
if (fromVersion === 0 && Array.isArray(value)) {
|
|
134
|
-
return value;
|
|
135
|
-
}
|
|
136
|
-
throw new Error('[Planu] Unsupported spec-store schema migration');
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
async function withSpecMutationLock(projectId, fn) {
|
|
140
|
-
return withFileLock(specsFile(projectId), async () => {
|
|
141
|
-
const deadline = Date.now() + STORE_LOCK_TIMEOUT_MS;
|
|
142
|
-
let handle = await acquireLock(projectId, STORE_LOCK_ID, {
|
|
143
|
-
reason: `spec-store mutation for ${projectId}`,
|
|
144
|
-
});
|
|
145
|
-
while (handle === null && Date.now() < deadline) {
|
|
146
|
-
await new Promise((resolve) => setTimeout(resolve, STORE_LOCK_RETRY_MS));
|
|
147
|
-
handle = await acquireLock(projectId, STORE_LOCK_ID, {
|
|
148
|
-
reason: `spec-store mutation for ${projectId}`,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (handle === null) {
|
|
152
|
-
throw new Error(`[Planu] Spec store is busy for project ${projectId}; retry the operation.`);
|
|
153
|
-
}
|
|
154
|
-
try {
|
|
155
|
-
// Another process may have written since this process populated its cache.
|
|
156
|
-
specsCache.delete(projectId);
|
|
157
|
-
return await fn();
|
|
158
|
-
}
|
|
159
|
-
finally {
|
|
160
|
-
await releaseLock(handle).catch((error) => {
|
|
161
|
-
// reliability-cleanup: SPEC_MUTATION_LOCK_RELEASE — mutation outcome is already durable
|
|
162
|
-
reportClassifiedDegradation('SPEC_MUTATION_LOCK_RELEASE', error);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
/** Administrative-only lock boundary for the digest-bound raw-store repair. */
|
|
168
|
-
/**
|
|
169
|
-
* Load all specs — from cache on subsequent calls, disk only on first access.
|
|
170
|
-
*
|
|
171
|
-
* Cwd-tolerant fallback: when the cwd-relative `specs.json` is missing or empty,
|
|
172
|
-
* walk up from cwd and consult the registered projectPath before giving up.
|
|
173
|
-
* Writes always go through the cwd-relative path (specsFile) — only reads
|
|
174
|
-
* fall back, so divergent on-disk locations remain visible to the caller.
|
|
175
|
-
*/
|
|
176
|
-
async function loadAll(projectId) {
|
|
177
|
-
const cached = specsCache.get(projectId);
|
|
178
|
-
if (cached !== undefined) {
|
|
179
|
-
return cached;
|
|
180
|
-
}
|
|
181
|
-
const directFile = specsFile(projectId);
|
|
182
|
-
let persisted;
|
|
183
|
-
try {
|
|
184
|
-
persisted = await readCriticalJson(directFile, []);
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
if (error instanceof CriticalJsonReadError) {
|
|
188
|
-
const cause = new BoundaryFailure('Corrupt', 'critical JSON parse', 'The persisted bytes did not contain a valid JSON document.');
|
|
189
|
-
throw new BoundaryFailure('Corrupt', 'read spec-store', 'Recover specs.json; Planu will not replace corrupt state with defaults.', cause);
|
|
190
|
-
}
|
|
191
|
-
throw error;
|
|
192
|
-
}
|
|
193
|
-
const raw = decodeCriticalSchema(persisted, 'spec-store').data;
|
|
194
|
-
const specs = raw.map(normalizeSpec);
|
|
195
|
-
validateCanonicalSpecRows(projectId, specs);
|
|
196
|
-
specsCache.set(projectId, specs);
|
|
197
|
-
return specs;
|
|
198
|
-
}
|
|
199
|
-
async function saveAll(projectId, specs) {
|
|
200
|
-
const normalized = specs.map((spec) => normalizeSpec(spec));
|
|
201
|
-
validateCanonicalSpecRows(projectId, normalized);
|
|
202
|
-
await writeJson(specsFile(projectId), { schemaVersion: 1, data: normalized });
|
|
203
|
-
await enforceRetention({ kind: 'spec-store-backup', path: specsFile(projectId) });
|
|
204
|
-
specsCache.set(projectId, normalized);
|
|
205
|
-
}
|
|
206
|
-
/** Evict the cache for a project (e.g. after external file changes). */
|
|
207
|
-
export function invalidateSpecsCache(projectId) {
|
|
208
|
-
specsCache.delete(projectId);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Discover the canonical `planu/specs/<specId[-slug]>/spec.md` for a spec by ID,
|
|
212
|
-
* independent of any stale or missing registry record. Fails closed (returns
|
|
213
|
-
* `null`) on zero or ambiguous matches, matching the fail-closed contract of
|
|
214
|
-
* {@link resolveVerifiedSpecPath}.
|
|
215
|
-
*/
|
|
216
|
-
export async function discoverCanonicalSpecPath(specId, canonicalRoot) {
|
|
217
|
-
const pattern = join(canonicalRoot, 'planu', 'specs', '*', 'spec.md');
|
|
218
|
-
const matches = await glob(pattern, { absolute: true });
|
|
219
|
-
const candidates = matches.filter((path) => {
|
|
220
|
-
const dir = basename(dirname(path));
|
|
221
|
-
return dir === specId || dir.startsWith(`${specId}-`);
|
|
222
|
-
});
|
|
223
|
-
return candidates.length === 1 ? (candidates[0] ?? null) : null;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Persist a digest-refresh in isolation from whatever mutation the caller of
|
|
227
|
-
* getSpec/listSpecs is otherwise doing. Best-effort: failure to persist never
|
|
228
|
-
* blocks the caller — the freshly parsed value is already what gets returned.
|
|
229
|
-
*/
|
|
230
|
-
async function persistDigestRefresh(projectId, specId, title, specVersion, contentDigest) {
|
|
231
|
-
await withSpecMutationLock(projectId, async () => {
|
|
232
|
-
const specs = await loadAll(projectId);
|
|
233
|
-
const idx = specs.findIndex((s) => s.id === specId);
|
|
234
|
-
if (idx === -1) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
const nextSpecs = specs.map((current, currentIdx) => currentIdx === idx
|
|
238
|
-
? { ...current, title, spec_version: specVersion, contentDigest }
|
|
239
|
-
: current);
|
|
240
|
-
await saveAll(projectId, nextSpecs);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* SPEC-1699: single-source-of-truth choke point. spec.md is authoritative for
|
|
245
|
-
* the fields it carries — before returning a record, verify the persisted
|
|
246
|
-
* `contentDigest` still matches the current spec.md on disk. On a mismatch or
|
|
247
|
-
* missing digest, re-parse spec.md and return the fresh title/digest instead
|
|
248
|
-
* of the possibly-stale specs.json copy. Requires `canonicalRoot` to locate
|
|
249
|
-
* spec.md; callers that omit it get the specs.json record unchecked (matching
|
|
250
|
-
* the existing canonicalRoot-gated legacy-migration behavior on this same path).
|
|
251
|
-
*/
|
|
252
|
-
function frontmatterScalarsDrifted(fields, spec) {
|
|
253
|
-
return ((fields.spec_version !== undefined && fields.spec_version !== spec.spec_version) ||
|
|
254
|
-
(fields.title !== undefined && fields.title !== spec.title));
|
|
255
|
-
}
|
|
256
|
-
async function refreshSpecFromDisk(projectId, spec, canonicalRoot) {
|
|
257
|
-
let specMdPath;
|
|
258
|
-
try {
|
|
259
|
-
specMdPath = await resolveVerifiedSpecPath(spec.id, spec.specPath, canonicalRoot);
|
|
260
|
-
}
|
|
261
|
-
catch (error) {
|
|
262
|
-
if (error instanceof PortablePathError && error.code === 'NOT_FOUND') {
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
reportClassifiedDegradation('SPEC_CONTENT_DIGEST_CHECK_SKIPPED', error);
|
|
266
|
-
return spec;
|
|
267
|
-
}
|
|
268
|
-
let content;
|
|
269
|
-
try {
|
|
270
|
-
content = await readFile(specMdPath, 'utf-8');
|
|
271
|
-
}
|
|
272
|
-
catch (error) {
|
|
273
|
-
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
274
|
-
return null;
|
|
275
|
-
}
|
|
276
|
-
reportClassifiedDegradation('SPEC_CONTENT_DIGEST_CHECK_SKIPPED', error);
|
|
277
|
-
return spec;
|
|
278
|
-
}
|
|
279
|
-
if (content.length === 0) {
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
const digest = digestOf(content);
|
|
283
|
-
const fields = readFrontmatterScalars(content);
|
|
284
|
-
if (digest === spec.contentDigest && !frontmatterScalarsDrifted(fields, spec)) {
|
|
285
|
-
return spec;
|
|
286
|
-
}
|
|
287
|
-
const refreshed = {
|
|
288
|
-
...spec,
|
|
289
|
-
title: fields.title ?? spec.title,
|
|
290
|
-
spec_version: fields.spec_version ?? spec.spec_version,
|
|
291
|
-
contentDigest: digest,
|
|
292
|
-
};
|
|
293
|
-
await persistDigestRefresh(projectId, spec.id, refreshed.title, refreshed.spec_version, digest).catch((error) => {
|
|
294
|
-
reportClassifiedDegradation('SPEC_CONTENT_DIGEST_REFRESH_PERSIST', error);
|
|
295
|
-
});
|
|
296
|
-
return refreshed;
|
|
297
|
-
}
|
|
298
|
-
// --- public API ---
|
|
299
|
-
/**
|
|
300
|
-
* List every spec for a project.
|
|
301
|
-
*
|
|
302
|
-
* When `canonicalRoot` is supplied, every record's content-derived fields are
|
|
303
|
-
* verified against the current spec.md before being returned (SPEC-1699).
|
|
304
|
-
*/
|
|
305
|
-
export async function listSpecs(projectId, canonicalRoot) {
|
|
306
|
-
if (canonicalRoot === undefined) {
|
|
307
|
-
return loadAll(projectId);
|
|
308
|
-
}
|
|
309
|
-
const { specs } = await listSpecsWithGhosts(projectId, canonicalRoot);
|
|
310
|
-
return specs;
|
|
311
|
-
}
|
|
312
|
-
export async function listSpecsWithGhosts(projectId, canonicalRoot) {
|
|
313
|
-
const specs = await loadAll(projectId);
|
|
314
|
-
const refreshed = await Promise.all(specs.map((spec) => refreshSpecFromDisk(projectId, spec, canonicalRoot)));
|
|
315
|
-
const listing = { specs: [], ghosts: [] };
|
|
316
|
-
refreshed.forEach((refreshedSpec, index) => {
|
|
317
|
-
if (refreshedSpec === null) {
|
|
318
|
-
const original = specs[index];
|
|
319
|
-
if (original) {
|
|
320
|
-
listing.ghosts.push(original);
|
|
321
|
-
}
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
listing.specs.push(refreshedSpec);
|
|
325
|
-
});
|
|
326
|
-
return listing;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Run a read-modify side effect against a fresh spec snapshot while holding the
|
|
330
|
-
* same cross-process lock used by status mutations.
|
|
331
|
-
*/
|
|
332
|
-
export async function withFreshSpecsLock(projectId, fn) {
|
|
333
|
-
return withSpecMutationLock(projectId, async () => fn(await loadAll(projectId)));
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Get a single spec by ID. Returns `null` when not found.
|
|
337
|
-
*
|
|
338
|
-
* When `canonicalRoot` is supplied: a legacy absolute `specPath`/`technicalPath`
|
|
339
|
-
* for this spec is migrated to its portable project-relative identity first
|
|
340
|
-
* (best-effort — a failed migration attempt never blocks the read), and the
|
|
341
|
-
* returned record's content-derived fields are verified against the current
|
|
342
|
-
* spec.md before being returned (SPEC-1699).
|
|
343
|
-
*/
|
|
344
|
-
export async function getSpec(projectId, specId, canonicalRoot) {
|
|
345
|
-
if (canonicalRoot !== undefined) {
|
|
346
|
-
await migrateLegacySpecPaths(projectId, canonicalRoot, [specId]).catch((error) => {
|
|
347
|
-
reportClassifiedDegradation('SPEC_PATH_MIGRATION_DEFERRED', error);
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
const specs = await loadAll(projectId);
|
|
351
|
-
const spec = specs.find((s) => s.id === specId) ?? null;
|
|
352
|
-
if (spec && canonicalRoot !== undefined) {
|
|
353
|
-
return refreshSpecFromDisk(projectId, spec, canonicalRoot);
|
|
354
|
-
}
|
|
355
|
-
return spec;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Record one hash-chained audit event for a legacy specPath migration batch.
|
|
359
|
-
* Best-effort: an audit failure never rolls back an already-persisted migration.
|
|
360
|
-
*/
|
|
361
|
-
function recordSpecPathMigrationAudit(projectId, specIds) {
|
|
362
|
-
try {
|
|
363
|
-
const partial = {
|
|
364
|
-
id: randomUUID(),
|
|
365
|
-
timestamp: new Date().toISOString(),
|
|
366
|
-
toolName: 'spec-store.migrateLegacySpecPaths',
|
|
367
|
-
inputSummary: `projectId=${projectId} specIds=${specIds.join(',')}`.slice(0, 200),
|
|
368
|
-
outputType: 'success',
|
|
369
|
-
durationMs: 0,
|
|
370
|
-
prevHash: getLastHash(),
|
|
371
|
-
};
|
|
372
|
-
appendEntry({ ...partial, hash: hashEntry(partial) });
|
|
373
|
-
}
|
|
374
|
-
catch (error) {
|
|
375
|
-
reportClassifiedDegradation('SPEC_PATH_MIGRATION_AUDIT', error);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Atomically migrate every eligible legacy absolute `specPath`/`technicalPath`
|
|
380
|
-
* in this project to its portable project-relative identity.
|
|
381
|
-
*
|
|
382
|
-
* Runs under the existing cross-process spec-store lock. A record migrates only
|
|
383
|
-
* when its normalized relative suffix identifies the same spec and the file
|
|
384
|
-
* exists under the verified `canonicalRoot` — never by guessing. Migration
|
|
385
|
-
* changes only the stored path identity; it never touches spec content.
|
|
386
|
-
* Idempotent: a spec already holding a portable path is a no-op. Emits at
|
|
387
|
-
* most one audit event per call, regardless of how many specs migrated.
|
|
388
|
-
*/
|
|
389
|
-
export async function migrateLegacySpecPaths(projectId, canonicalRoot, specIds) {
|
|
390
|
-
return withSpecMutationLock(projectId, async () => {
|
|
391
|
-
const specs = await loadAll(projectId);
|
|
392
|
-
const scope = specIds ? new Set(specIds) : null;
|
|
393
|
-
const migratedIds = [];
|
|
394
|
-
const next = await Promise.all(specs.map(async (spec) => {
|
|
395
|
-
if (scope && !scope.has(spec.id)) {
|
|
396
|
-
return spec;
|
|
397
|
-
}
|
|
398
|
-
if (typeof spec.specPath !== 'string' || !isAbsolute(spec.specPath)) {
|
|
399
|
-
return spec;
|
|
400
|
-
}
|
|
401
|
-
try {
|
|
402
|
-
await resolvePortableSpecPath(spec.id, spec.specPath, canonicalRoot);
|
|
403
|
-
}
|
|
404
|
-
catch (error) {
|
|
405
|
-
reportClassifiedDegradation('SPEC_PATH_MIGRATION_SKIPPED', error);
|
|
406
|
-
return spec;
|
|
407
|
-
}
|
|
408
|
-
const portableSpecPath = toPortableSpecPath(spec.id, spec.specPath);
|
|
409
|
-
let portableTechnicalPath = spec.technicalPath;
|
|
410
|
-
if (typeof spec.technicalPath === 'string' && isAbsolute(spec.technicalPath)) {
|
|
411
|
-
try {
|
|
412
|
-
portableTechnicalPath = toPortableSpecPath(spec.id, spec.technicalPath);
|
|
413
|
-
}
|
|
414
|
-
catch (error) {
|
|
415
|
-
reportClassifiedDegradation('TECHNICAL_PATH_MIGRATION_SKIPPED', error);
|
|
416
|
-
portableTechnicalPath = spec.technicalPath;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
migratedIds.push(spec.id);
|
|
420
|
-
return { ...spec, specPath: portableSpecPath, technicalPath: portableTechnicalPath };
|
|
421
|
-
}));
|
|
422
|
-
if (migratedIds.length > 0) {
|
|
423
|
-
await saveAll(projectId, next);
|
|
424
|
-
recordSpecPathMigrationAudit(projectId, migratedIds);
|
|
425
|
-
}
|
|
426
|
-
return { migrated: migratedIds.length, specIds: migratedIds };
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
/** Reload a spec from disk after the caller acquires its cross-process lock. */
|
|
430
|
-
export async function getSpecFresh(projectId, specId, canonicalRoot) {
|
|
431
|
-
specsCache.delete(projectId);
|
|
432
|
-
return getSpec(projectId, specId, canonicalRoot);
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* Lifecycle reads cross an explicit visibility barrier: discard the process-local
|
|
436
|
-
* index and re-resolve the persisted spec against the caller's checkout.
|
|
437
|
-
*/
|
|
438
|
-
export async function getLifecycleSpec(projectId, specId, projectPath) {
|
|
439
|
-
return getSpecFresh(projectId, specId, projectPath);
|
|
440
|
-
}
|
|
441
|
-
/** SPEC-601: Lookup a spec by its globally unique UUID. */
|
|
442
|
-
export async function getSpecByUuid(projectId, uuid) {
|
|
443
|
-
const specs = await loadAll(projectId);
|
|
444
|
-
return (specs.find((spec) => spec.uuid === uuid || spec.uuidAliases?.includes(uuid) === true) ?? null);
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Normalize an incoming absolute `specPath`/`technicalPath` — rooted in whatever
|
|
448
|
-
* checkout the caller invoked from — to its portable project-relative identity
|
|
449
|
-
* before it ever reaches disk. A value that is not the standard
|
|
450
|
-
* `planu/specs/<specId[-slug]>/<file>` shape is left untouched (best-effort):
|
|
451
|
-
* the shared resolver still fails closed for it at read time.
|
|
452
|
-
*/
|
|
453
|
-
function portableizeSpecPaths(spec) {
|
|
454
|
-
let specPath = spec.specPath;
|
|
455
|
-
let technicalPath = spec.technicalPath;
|
|
456
|
-
if (typeof specPath === 'string' && isAbsolute(specPath)) {
|
|
457
|
-
try {
|
|
458
|
-
specPath = toPortableSpecPath(spec.id, specPath);
|
|
459
|
-
}
|
|
460
|
-
catch (error) {
|
|
461
|
-
if (!(error instanceof PortablePathError)) {
|
|
462
|
-
throw error;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
if (typeof technicalPath === 'string' && isAbsolute(technicalPath)) {
|
|
467
|
-
try {
|
|
468
|
-
technicalPath = toPortableSpecPath(spec.id, technicalPath);
|
|
469
|
-
}
|
|
470
|
-
catch (error) {
|
|
471
|
-
if (!(error instanceof PortablePathError)) {
|
|
472
|
-
throw error;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
return specPath === spec.specPath && technicalPath === spec.technicalPath
|
|
477
|
-
? spec
|
|
478
|
-
: { ...spec, specPath, technicalPath };
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Create a new spec. Throws if a spec with the same ID already exists.
|
|
482
|
-
*/
|
|
483
|
-
export async function createSpec(projectId, spec) {
|
|
484
|
-
return withSpecMutationLock(projectId, async () => {
|
|
485
|
-
const specs = await loadAll(projectId);
|
|
486
|
-
if (specs.some((s) => s.id === spec.id)) {
|
|
487
|
-
throw new Error(`Spec "${spec.id}" already exists in project "${projectId}"`);
|
|
488
|
-
}
|
|
489
|
-
const { criteria } = await loadSpecContent(spec);
|
|
490
|
-
const portableSpec = portableizeSpecPaths(spec);
|
|
491
|
-
const specWithScore = {
|
|
492
|
-
...portableSpec,
|
|
493
|
-
healthScore: computeHealthScore(portableSpec, criteria.length > 0 ? criteria : undefined)
|
|
494
|
-
.score,
|
|
495
|
-
};
|
|
496
|
-
const nextSpecs = [...specs, specWithScore];
|
|
497
|
-
await saveAll(projectId, nextSpecs);
|
|
498
|
-
return specWithScore;
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Internal implementation — updates any Spec field including status.
|
|
503
|
-
* NOT exported from the barrel. Called only by `__internalSetStatus` and itself.
|
|
504
|
-
* All external callers must use `updateSpec` (non-status) or `transitionSpec` (status).
|
|
505
|
-
*/
|
|
506
|
-
function snapshotChanged(spec, expectedSnapshot) {
|
|
507
|
-
return Boolean(expectedSnapshot &&
|
|
508
|
-
(spec.status !== expectedSnapshot.status || spec.updatedAt !== expectedSnapshot.updatedAt));
|
|
509
|
-
}
|
|
510
|
-
// eslint-disable-next-line max-lines-per-function -- lifecycle status persistence is one atomic mutation boundary
|
|
511
|
-
async function __internalUpdateSpec(projectId, specId, updates, pendingBackgroundActions = [], expectedSnapshot, transitionRootBinding, reconciliation) {
|
|
512
|
-
return withSpecMutationLock(projectId, async () => {
|
|
513
|
-
const specs = await loadAll(projectId);
|
|
514
|
-
const idx = specs.findIndex((s) => s.id === specId);
|
|
515
|
-
if (idx === -1) {
|
|
516
|
-
throw new Error(`Spec "${specId}" not found in project "${projectId}"`);
|
|
517
|
-
}
|
|
518
|
-
const existing = specs[idx];
|
|
519
|
-
if (!existing) {
|
|
520
|
-
throw new Error(`Spec "${specId}" not found in project "${projectId}"`);
|
|
521
|
-
}
|
|
522
|
-
if (snapshotChanged(existing, expectedSnapshot)) {
|
|
523
|
-
throw new Error(`Spec "${specId}" changed after lifecycle gates ran; retry update_status with the fresh state.`);
|
|
524
|
-
}
|
|
525
|
-
const now = new Date().toISOString();
|
|
526
|
-
const incomingStatus = updates.status;
|
|
527
|
-
let updatedStatusHistory = existing.statusHistory;
|
|
528
|
-
if (incomingStatus !== undefined && incomingStatus !== existing.status) {
|
|
529
|
-
const transitionId = createHash('sha256')
|
|
530
|
-
.update([
|
|
531
|
-
'update_status:v1',
|
|
532
|
-
projectId,
|
|
533
|
-
specId,
|
|
534
|
-
existing.status,
|
|
535
|
-
incomingStatus,
|
|
536
|
-
now,
|
|
537
|
-
randomUUID(),
|
|
538
|
-
].join('\0'))
|
|
539
|
-
.digest('hex')
|
|
540
|
-
.slice(0, 24);
|
|
541
|
-
const entry = {
|
|
542
|
-
status: incomingStatus,
|
|
543
|
-
changedAt: now,
|
|
544
|
-
fromStatus: existing.status,
|
|
545
|
-
transitionId,
|
|
546
|
-
...(pendingBackgroundActions.length > 0 && { pendingBackgroundActions }),
|
|
547
|
-
...(pendingBackgroundActions.length > 0 &&
|
|
548
|
-
transitionRootBinding && { transitionRootBinding }),
|
|
549
|
-
...(pendingBackgroundActions.length > 0 && {
|
|
550
|
-
postCommitTasks: pendingBackgroundActions.map((name) => ({
|
|
551
|
-
name,
|
|
552
|
-
status: 'pending',
|
|
553
|
-
attempts: 0,
|
|
554
|
-
updatedAt: now,
|
|
555
|
-
})),
|
|
556
|
-
}),
|
|
557
|
-
...(reconciliation?.reconciliationRequestId
|
|
558
|
-
? {
|
|
559
|
-
reconciliationRequestId: reconciliation.reconciliationRequestId,
|
|
560
|
-
reconciliationBindingDigest: reconciliation.reconciliationBindingDigest,
|
|
561
|
-
trigger: reconciliation.trigger,
|
|
562
|
-
}
|
|
563
|
-
: {}),
|
|
564
|
-
};
|
|
565
|
-
updatedStatusHistory = [...(existing.statusHistory ?? []), entry];
|
|
566
|
-
}
|
|
567
|
-
const merged = {
|
|
568
|
-
...existing,
|
|
569
|
-
...updates,
|
|
570
|
-
id: specId, // never allow id override
|
|
571
|
-
updatedAt: now,
|
|
572
|
-
statusHistory: updatedStatusHistory,
|
|
573
|
-
};
|
|
574
|
-
const { criteria } = await loadSpecContent(merged);
|
|
575
|
-
const updated = {
|
|
576
|
-
...merged,
|
|
577
|
-
healthScore: computeHealthScore(merged, criteria.length > 0 ? criteria : undefined).score,
|
|
578
|
-
};
|
|
579
|
-
const nextSpecs = specs.map((current, currentIdx) => (currentIdx === idx ? updated : current));
|
|
580
|
-
await saveAll(projectId, nextSpecs);
|
|
581
|
-
return updated;
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* SPEC-720: Internal-only status write. NOT exported from the barrel.
|
|
586
|
-
* Importable exclusively from `src/engine/spec-state-machine/transition-spec.ts`.
|
|
587
|
-
* All status transitions must flow through `transitionSpec` → `__internalSetStatus`.
|
|
588
|
-
*/
|
|
589
|
-
export async function __internalSetStatus(projectId, specId, status, updates = {}, pendingBackgroundActions = [], expectedSnapshot, transitionRootBinding, reconciliation) {
|
|
590
|
-
return __internalUpdateSpec(projectId, specId, { ...updates, status }, pendingBackgroundActions, expectedSnapshot, transitionRootBinding, reconciliation);
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* Restore the exact snapshot captured before a lifecycle transition.
|
|
594
|
-
* This is only used by transitionSpec compensation while the caller still
|
|
595
|
-
* holds the per-spec cross-process lock.
|
|
596
|
-
*/
|
|
597
|
-
export async function __internalRestoreSpecSnapshot(projectId, specId, snapshot, expectedCurrentSnapshot) {
|
|
598
|
-
return withSpecMutationLock(projectId, async () => {
|
|
599
|
-
const specs = await loadAll(projectId);
|
|
600
|
-
const idx = specs.findIndex((candidate) => candidate.id === specId);
|
|
601
|
-
if (idx === -1) {
|
|
602
|
-
throw new Error(`Spec "${specId}" not found in project "${projectId}"`);
|
|
603
|
-
}
|
|
604
|
-
if (snapshot.id !== specId) {
|
|
605
|
-
throw new Error(`Cannot restore snapshot "${snapshot.id}" over "${specId}" in project "${projectId}"`);
|
|
606
|
-
}
|
|
607
|
-
const existing = specs[idx];
|
|
608
|
-
if (!existing) {
|
|
609
|
-
throw new Error(`Spec "${specId}" not found in project "${projectId}"`);
|
|
610
|
-
}
|
|
611
|
-
if (JSON.stringify(existing) !== JSON.stringify(expectedCurrentSnapshot)) {
|
|
612
|
-
throw new Error(`Spec "${specId}" changed after the transition commit; refusing unsafe compensation.`);
|
|
613
|
-
}
|
|
614
|
-
const restored = { ...snapshot };
|
|
615
|
-
const nextSpecs = specs.map((current, currentIdx) => (currentIdx === idx ? restored : current));
|
|
616
|
-
await saveAll(projectId, nextSpecs);
|
|
617
|
-
return restored;
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
function updateOutboxReceipt(history, transitionId, update) {
|
|
621
|
-
if (!history) {
|
|
622
|
-
return null;
|
|
623
|
-
}
|
|
624
|
-
const index = history.findIndex((entry) => entry.transitionId === transitionId);
|
|
625
|
-
if (index === -1) {
|
|
626
|
-
return null;
|
|
627
|
-
}
|
|
628
|
-
return history.map((entry, currentIndex) => (currentIndex === index ? update(entry) : entry));
|
|
629
|
-
}
|
|
630
|
-
function materializePostCommitTasks(entry) {
|
|
631
|
-
if (entry.postCommitTasks) {
|
|
632
|
-
return entry.postCommitTasks;
|
|
633
|
-
}
|
|
634
|
-
return (entry.pendingBackgroundActions ?? []).map((name) => ({
|
|
635
|
-
name,
|
|
636
|
-
status: 'pending',
|
|
637
|
-
attempts: 0,
|
|
638
|
-
updatedAt: entry.changedAt,
|
|
639
|
-
}));
|
|
640
|
-
}
|
|
641
|
-
function isPendingPostCommitTask(task) {
|
|
642
|
-
return (task.status !== 'done' &&
|
|
643
|
-
task.status !== 'dead-letter' &&
|
|
644
|
-
!(task.status === 'failed' && task.attempts >= MAX_POST_COMMIT_ATTEMPTS));
|
|
645
|
-
}
|
|
646
|
-
function terminalizeExhaustedPostCommitTask(entry, tasks, taskIndex, current, now) {
|
|
647
|
-
const failedTask = {
|
|
648
|
-
name: current.name,
|
|
649
|
-
status: 'failed',
|
|
650
|
-
attempts: current.attempts,
|
|
651
|
-
updatedAt: now,
|
|
652
|
-
...(current.lastError ? { lastError: current.lastError } : {}),
|
|
653
|
-
};
|
|
654
|
-
const nextTasks = tasks.map((task, index) => (index === taskIndex ? failedTask : task));
|
|
655
|
-
return {
|
|
656
|
-
...entry,
|
|
657
|
-
postCommitTasks: nextTasks,
|
|
658
|
-
pendingBackgroundActions: nextTasks.filter(isPendingPostCommitTask).map((task) => task.name),
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
function pruneCompletedOutbox(history) {
|
|
662
|
-
let completedOutboxesKept = 0;
|
|
663
|
-
return [...history]
|
|
664
|
-
.reverse()
|
|
665
|
-
.map((entry) => {
|
|
666
|
-
const tasks = entry.postCommitTasks;
|
|
667
|
-
const isCompletedOutbox = tasks !== undefined && tasks.length > 0 && tasks.every((task) => task.status === 'done');
|
|
668
|
-
if (!isCompletedOutbox) {
|
|
669
|
-
return entry;
|
|
670
|
-
}
|
|
671
|
-
completedOutboxesKept += 1;
|
|
672
|
-
if (completedOutboxesKept <= COMPLETED_OUTBOX_RETENTION) {
|
|
673
|
-
return entry;
|
|
674
|
-
}
|
|
675
|
-
const { postCommitTasks: _postCommitTasks, pendingBackgroundActions: _pending, ...receipt } = entry;
|
|
676
|
-
return receipt;
|
|
677
|
-
})
|
|
678
|
-
.reverse();
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Atomically claim one durable post-commit task.
|
|
682
|
-
* Legacy transition receipts are materialized only when the task was explicitly planned.
|
|
683
|
-
*/
|
|
684
|
-
// eslint-disable-next-line max-lines-per-function -- claim and exhaustion normalization share one atomic mutation boundary
|
|
685
|
-
export async function claimPostCommitTask(projectId, specId, transitionId, taskName, options = {}) {
|
|
686
|
-
return withSpecMutationLock(projectId, async () => {
|
|
687
|
-
const specs = await loadAll(projectId);
|
|
688
|
-
const specIndex = specs.findIndex((candidate) => candidate.id === specId);
|
|
689
|
-
const existing = specs[specIndex];
|
|
690
|
-
if (!existing) {
|
|
691
|
-
return { claimed: false, reason: 'missing' };
|
|
692
|
-
}
|
|
693
|
-
const now = options.now ?? new Date().toISOString();
|
|
694
|
-
const nowMs = Date.parse(now);
|
|
695
|
-
const claimResult = {
|
|
696
|
-
value: { claimed: false, reason: 'missing' },
|
|
697
|
-
};
|
|
698
|
-
const normalizedExhausted = { value: false };
|
|
699
|
-
const nextHistory = updateOutboxReceipt(existing.statusHistory, transitionId, (entry) => {
|
|
700
|
-
const tasks = materializePostCommitTasks(entry);
|
|
701
|
-
const taskIndex = tasks.findIndex((task) => task.name === taskName);
|
|
702
|
-
const current = tasks[taskIndex];
|
|
703
|
-
if (!current) {
|
|
704
|
-
return entry;
|
|
705
|
-
}
|
|
706
|
-
if (current.status === 'done') {
|
|
707
|
-
claimResult.value = { claimed: false, reason: 'done' };
|
|
708
|
-
return entry;
|
|
709
|
-
}
|
|
710
|
-
if (current.status === 'running' &&
|
|
711
|
-
current.leaseExpiresAt &&
|
|
712
|
-
Date.parse(current.leaseExpiresAt) > nowMs) {
|
|
713
|
-
claimResult.value = {
|
|
714
|
-
claimed: false,
|
|
715
|
-
reason: 'running',
|
|
716
|
-
retryAt: current.leaseExpiresAt,
|
|
717
|
-
};
|
|
718
|
-
return entry;
|
|
719
|
-
}
|
|
720
|
-
if (current.attempts >= MAX_POST_COMMIT_ATTEMPTS) {
|
|
721
|
-
claimResult.value = { claimed: false, reason: 'done' };
|
|
722
|
-
normalizedExhausted.value = true;
|
|
723
|
-
return terminalizeExhaustedPostCommitTask(entry, tasks, taskIndex, current, now);
|
|
724
|
-
}
|
|
725
|
-
const executionId = randomUUID();
|
|
726
|
-
const attempts = current.attempts + 1;
|
|
727
|
-
const claimedTask = {
|
|
728
|
-
name: current.name,
|
|
729
|
-
status: 'running',
|
|
730
|
-
attempts,
|
|
731
|
-
updatedAt: now,
|
|
732
|
-
executionId,
|
|
733
|
-
leaseExpiresAt: new Date(nowMs + (options.leaseMs ?? DEFAULT_POST_COMMIT_LEASE_MS)).toISOString(),
|
|
734
|
-
};
|
|
735
|
-
claimResult.value = { claimed: true, executionId, attempts };
|
|
736
|
-
const nextTasks = tasks.map((task, index) => (index === taskIndex ? claimedTask : task));
|
|
737
|
-
return {
|
|
738
|
-
...entry,
|
|
739
|
-
postCommitTasks: nextTasks,
|
|
740
|
-
pendingBackgroundActions: nextTasks
|
|
741
|
-
.filter(isPendingPostCommitTask)
|
|
742
|
-
.map((task) => task.name),
|
|
743
|
-
};
|
|
744
|
-
});
|
|
745
|
-
if (!nextHistory || (!claimResult.value.claimed && !normalizedExhausted.value)) {
|
|
746
|
-
return claimResult.value;
|
|
747
|
-
}
|
|
748
|
-
const updated = { ...existing, statusHistory: nextHistory };
|
|
749
|
-
await saveAll(projectId, specs.map((spec, index) => (index === specIndex ? updated : spec)));
|
|
750
|
-
return claimResult.value;
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
/** Extend a running task lease while the owning execution is still alive. */
|
|
754
|
-
export async function renewPostCommitTaskLease(projectId, specId, transitionId, taskName, executionId, options = {}) {
|
|
755
|
-
return withSpecMutationLock(projectId, async () => {
|
|
756
|
-
const specs = await loadAll(projectId);
|
|
757
|
-
const specIndex = specs.findIndex((candidate) => candidate.id === specId);
|
|
758
|
-
const existing = specs[specIndex];
|
|
759
|
-
if (!existing) {
|
|
760
|
-
return false;
|
|
761
|
-
}
|
|
762
|
-
const now = options.now ?? new Date().toISOString();
|
|
763
|
-
const nowMs = Date.parse(now);
|
|
764
|
-
const renewed = { value: false };
|
|
765
|
-
const nextHistory = updateOutboxReceipt(existing.statusHistory, transitionId, (entry) => {
|
|
766
|
-
const tasks = materializePostCommitTasks(entry);
|
|
767
|
-
const taskIndex = tasks.findIndex((task) => task.name === taskName);
|
|
768
|
-
const current = tasks[taskIndex];
|
|
769
|
-
if (current?.status !== 'running' || current.executionId !== executionId) {
|
|
770
|
-
return entry;
|
|
771
|
-
}
|
|
772
|
-
renewed.value = true;
|
|
773
|
-
const renewedTask = {
|
|
774
|
-
...current,
|
|
775
|
-
updatedAt: now,
|
|
776
|
-
leaseExpiresAt: new Date(nowMs + (options.leaseMs ?? DEFAULT_POST_COMMIT_LEASE_MS)).toISOString(),
|
|
777
|
-
};
|
|
778
|
-
return {
|
|
779
|
-
...entry,
|
|
780
|
-
postCommitTasks: tasks.map((task, index) => (index === taskIndex ? renewedTask : task)),
|
|
781
|
-
};
|
|
782
|
-
});
|
|
783
|
-
if (!nextHistory || !renewed.value) {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
await saveAll(projectId, specs.map((spec, index) => index === specIndex ? { ...existing, statusHistory: nextHistory } : spec));
|
|
787
|
-
return true;
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
/** Finalize a claimed task if the execution lease still belongs to the caller. */
|
|
791
|
-
export async function settlePostCommitTask(projectId, specId, transitionId, taskName, executionId, outcome) {
|
|
792
|
-
return withSpecMutationLock(projectId, async () => {
|
|
793
|
-
const specs = await loadAll(projectId);
|
|
794
|
-
const specIndex = specs.findIndex((candidate) => candidate.id === specId);
|
|
795
|
-
const existing = specs[specIndex];
|
|
796
|
-
if (!existing) {
|
|
797
|
-
return false;
|
|
798
|
-
}
|
|
799
|
-
const now = outcome.now ?? new Date().toISOString();
|
|
800
|
-
const settlement = { completed: false };
|
|
801
|
-
const nextHistory = updateOutboxReceipt(existing.statusHistory, transitionId, (entry) => {
|
|
802
|
-
const tasks = materializePostCommitTasks(entry);
|
|
803
|
-
const taskIndex = tasks.findIndex((task) => task.name === taskName);
|
|
804
|
-
const current = tasks[taskIndex];
|
|
805
|
-
if (current?.status !== 'running' || current.executionId !== executionId) {
|
|
806
|
-
return entry;
|
|
807
|
-
}
|
|
808
|
-
settlement.completed = true;
|
|
809
|
-
const settledTask = {
|
|
810
|
-
name: current.name,
|
|
811
|
-
status: outcome.status,
|
|
812
|
-
attempts: current.attempts,
|
|
813
|
-
updatedAt: now,
|
|
814
|
-
...(outcome.status === 'failed' && outcome.error ? { lastError: outcome.error } : {}),
|
|
815
|
-
};
|
|
816
|
-
const nextTasks = tasks.map((task, index) => (index === taskIndex ? settledTask : task));
|
|
817
|
-
return {
|
|
818
|
-
...entry,
|
|
819
|
-
postCommitTasks: nextTasks,
|
|
820
|
-
pendingBackgroundActions: nextTasks
|
|
821
|
-
.filter(isPendingPostCommitTask)
|
|
822
|
-
.map((task) => task.name),
|
|
823
|
-
};
|
|
824
|
-
});
|
|
825
|
-
if (!nextHistory || !settlement.completed) {
|
|
826
|
-
return false;
|
|
827
|
-
}
|
|
828
|
-
const updated = {
|
|
829
|
-
...existing,
|
|
830
|
-
statusHistory: pruneCompletedOutbox(nextHistory),
|
|
831
|
-
};
|
|
832
|
-
await saveAll(projectId, specs.map((spec, index) => (index === specIndex ? updated : spec)));
|
|
833
|
-
return true;
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Replace an existing spec entirely (non-status fields only).
|
|
838
|
-
* Throws `DirectStatusWriteForbiddenError` if `updates` contains a `status` field.
|
|
839
|
-
* To change status, call `handleUpdateStatus` from the tool layer.
|
|
840
|
-
*/
|
|
841
|
-
export async function updateSpec(projectId, specId, updates) {
|
|
842
|
-
// SPEC-720: Guard — reject any attempt to write status via this path
|
|
843
|
-
if ('status' in updates) {
|
|
844
|
-
throw new DirectStatusWriteForbiddenError(specId, String(updates.status), new Error().stack?.split('\n')[2]?.trim() ?? 'unknown');
|
|
845
|
-
}
|
|
846
|
-
return __internalUpdateSpec(projectId, specId, updates);
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
* @deprecated SPEC-720: updateSpecStatus is removed from the public API.
|
|
850
|
-
* Use `handleUpdateStatus` from `src/tools/update-status/index.ts` instead.
|
|
851
|
-
* This stub remains only to produce a descriptive compile error for any
|
|
852
|
-
* remaining callers until they are migrated.
|
|
853
|
-
* @throws {DirectStatusWriteForbiddenError} Always.
|
|
854
|
-
*/
|
|
855
|
-
// eslint-disable-next-line @typescript-eslint/require-await -- always throws, async signature required for API compatibility
|
|
856
|
-
export async function updateSpecStatus(_projectId, specId, status) {
|
|
857
|
-
throw new DirectStatusWriteForbiddenError(specId, status, 'updateSpecStatus (deprecated — use handleUpdateStatus, see SPEC-720)');
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Delete a spec by ID. Returns `true` if removed, `false` if not found.
|
|
861
|
-
*/
|
|
862
|
-
export async function deleteSpec(projectId, specId) {
|
|
863
|
-
return withSpecMutationLock(projectId, async () => {
|
|
864
|
-
const specs = await loadAll(projectId);
|
|
865
|
-
const idx = specs.findIndex((s) => s.id === specId);
|
|
866
|
-
if (idx === -1) {
|
|
867
|
-
return false;
|
|
868
|
-
}
|
|
869
|
-
const nextSpecs = specs.filter((_, currentIdx) => currentIdx !== idx);
|
|
870
|
-
await saveAll(projectId, nextSpecs);
|
|
871
|
-
return true;
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* Find specs matching a predicate.
|
|
876
|
-
*/
|
|
877
|
-
export async function findSpecs(projectId, predicate) {
|
|
878
|
-
const specs = await loadAll(projectId);
|
|
879
|
-
return specs.filter(predicate);
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Count specs for a project, optionally filtered by status.
|
|
883
|
-
*/
|
|
884
|
-
export async function countSpecs(projectId, status) {
|
|
885
|
-
const specs = await loadAll(projectId);
|
|
886
|
-
if (status) {
|
|
887
|
-
return specs.filter((s) => s.status === status).length;
|
|
888
|
-
}
|
|
889
|
-
return specs.length;
|
|
890
|
-
}
|
|
891
|
-
// --- DoR/DoD persistence ---
|
|
892
|
-
function dorFile(projectId, specId) {
|
|
893
|
-
return `${projectDataDir(projectId)}/specs/${specId}/dor.json`;
|
|
894
|
-
}
|
|
895
|
-
function dodFile(projectId, specId) {
|
|
896
|
-
return `${projectDataDir(projectId)}/specs/${specId}/dod.json`;
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* Persist a DoR checklist for a spec.
|
|
900
|
-
*/
|
|
901
|
-
export async function saveDor(projectId, specId, dor) {
|
|
902
|
-
await withFileLock(dorFile(projectId, specId), () => writeJson(dorFile(projectId, specId), dor));
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* Load the persisted DoR checklist for a spec. Returns null if not found.
|
|
906
|
-
*/
|
|
907
|
-
export async function loadDor(projectId, specId) {
|
|
908
|
-
return readJson(dorFile(projectId, specId), null);
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Persist a DoD checklist for a spec.
|
|
912
|
-
*/
|
|
913
|
-
export async function saveDoD(projectId, specId, dod) {
|
|
914
|
-
await withFileLock(dodFile(projectId, specId), () => writeJson(dodFile(projectId, specId), dod));
|
|
915
|
-
}
|
|
916
|
-
/**
|
|
917
|
-
* Load the persisted DoD checklist for a spec. Returns null if not found.
|
|
918
|
-
*/
|
|
919
|
-
export async function loadDoD(projectId, specId) {
|
|
920
|
-
return readJson(dodFile(projectId, specId), null);
|
|
921
|
-
}
|
|
922
|
-
// --- Version persistence ---
|
|
923
|
-
function versionsFile(projectId, specId) {
|
|
924
|
-
return `${projectDataDir(projectId)}/specs/${specId}/versions.json`;
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* Append a new SpecVersion to the version history for a spec.
|
|
928
|
-
*/
|
|
929
|
-
export async function saveVersion(projectId, specId, version) {
|
|
930
|
-
await withFileLock(versionsFile(projectId, specId), async () => {
|
|
931
|
-
const existing = await loadVersions(projectId, specId);
|
|
932
|
-
existing.push(version);
|
|
933
|
-
await writeJson(versionsFile(projectId, specId), existing);
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* Load all persisted versions for a spec. Returns empty array if none exist.
|
|
938
|
-
*/
|
|
939
|
-
export async function loadVersions(projectId, specId) {
|
|
940
|
-
return readJson(versionsFile(projectId, specId), []);
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Get the latest version number for a spec (0 if no versions exist).
|
|
944
|
-
*/
|
|
945
|
-
export async function getLatestVersion(projectId, specId) {
|
|
946
|
-
const versions = await loadVersions(projectId, specId);
|
|
947
|
-
if (versions.length === 0) {
|
|
948
|
-
return 0;
|
|
949
|
-
}
|
|
950
|
-
return Math.max(...versions.map((v) => v.version));
|
|
951
|
-
}
|
|
952
|
-
// --- Summary persistence ---
|
|
953
|
-
function summaryFile(projectId, specId) {
|
|
954
|
-
return `${projectDataDir(projectId)}/specs/${specId}/summary.json`;
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* Persist a SpecSummary for a spec. Used by summarize_spec to cache results.
|
|
958
|
-
*/
|
|
959
|
-
export async function saveSummary(projectId, specId, summary) {
|
|
960
|
-
await withFileLock(summaryFile(projectId, specId), () => writeJson(summaryFile(projectId, specId), summary));
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* Load the persisted SpecSummary for a spec. Returns null if not found.
|
|
964
|
-
*/
|
|
965
|
-
export async function loadSummary(projectId, specId) {
|
|
966
|
-
return readJson(summaryFile(projectId, specId), null);
|
|
967
|
-
}
|
|
968
|
-
//# sourceMappingURL=spec-store.js.map
|