@planu/cli 4.14.1 → 5.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/CHANGELOG.md +35 -1
- package/LICENSE +55 -12
- package/README.md +10 -2
- package/dist/cli/commands/install.d.ts +1 -12
- package/dist/cli/commands/install.js +9 -65
- package/dist/cli/commands/job.js +4 -3
- package/dist/cli/commands/spec.js +2 -2
- package/dist/cli/commands/validate.js +2 -2
- package/dist/cli/router.js +1 -3
- package/dist/config/environment-schema.json +1 -3
- package/dist/config/official-sdd-tools.d.ts +4 -0
- package/dist/config/official-sdd-tools.js +35 -0
- package/dist/config/product-public.d.ts +139 -3
- package/dist/config/product-public.js +8 -1
- package/dist/config/product-public.json +7 -36
- package/dist/config/registries/hosts/codex.json +20 -363
- package/dist/config/release-policy.json +84 -2
- package/dist/config/runtime-policy.json +12 -1
- package/dist/config/skill-templates/planu-resume-work.md +2 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/core/spec-validator.d.ts +4 -4
- package/dist/core/spec-validator.js +1 -1
- package/dist/engine/abortable-process-runner.d.ts +20 -2
- package/dist/engine/abortable-process-runner.js +243 -74
- package/dist/engine/ambiguity-scorer.js +4 -26
- package/dist/engine/auth/scope-mapper.js +1 -7
- package/dist/engine/autopilot/state-updater.js +4 -4
- package/dist/engine/cascade-hooks/hooks/review-enricher.hook.js +9 -6
- package/dist/engine/cascade-hooks/state-drift-detector.d.ts +3 -3
- package/dist/engine/cascade-hooks/state-drift-detector.js +1 -1
- package/dist/engine/ci-generator/planu-config.js +1 -7
- package/dist/engine/clarification-gate/gate.d.ts +3 -3
- package/dist/engine/code-scanner/layer-scanner.js +6 -22
- package/dist/engine/core-bridge.d.ts +3 -3
- package/dist/engine/cost-guardrails.d.ts +1 -1
- package/dist/engine/cost-guardrails.js +1 -1
- package/dist/engine/criterion-identity.d.ts +1 -0
- package/dist/engine/criterion-identity.js +7 -0
- package/dist/engine/dashboard/data-loader.js +2 -7
- package/dist/engine/dashboard/templates-layout.js +0 -3
- package/dist/engine/dashboard/templates-project.js +1 -13
- package/dist/engine/docs-site-generator/data-collector.d.ts +1 -1
- package/dist/engine/docs-site-generator/data-collector.js +7 -28
- package/dist/engine/docs-site-generator/tools-renderer.js +3 -10
- package/dist/engine/evidence-gates/artifact-reader.d.ts +10 -1
- package/dist/engine/evidence-gates/artifact-reader.js +115 -2
- package/dist/engine/evidence-gates/lifecycle-gate.js +4 -3
- package/dist/engine/evidence-gates/reconciliation-freshness.d.ts +11 -0
- package/dist/engine/evidence-gates/reconciliation-freshness.js +72 -0
- package/dist/engine/evidence-index/done-drift.d.ts +1 -1
- package/dist/engine/evidence-index/done-drift.js +40 -18
- package/dist/engine/execution/context.js +3 -0
- package/dist/engine/execution/durable-job-heartbeat-runtime.d.ts +4 -0
- package/dist/engine/execution/durable-job-heartbeat-runtime.js +400 -0
- package/dist/engine/execution/job-runtime.d.ts +30 -0
- package/dist/engine/execution/job-runtime.js +114 -6
- package/dist/engine/execution/public-job-sanitizer.d.ts +4 -0
- package/dist/engine/execution/public-job-sanitizer.js +31 -0
- package/dist/engine/execution/validate-job-executor.d.ts +12 -1
- package/dist/engine/execution/validate-job-executor.js +549 -86
- package/dist/engine/execution/validate-job-payload.js +107 -50
- package/dist/engine/execution/validate-job-recovery.js +1 -1
- package/dist/engine/execution/validate-worker-runtime.d.ts +5 -0
- package/dist/engine/execution/validate-worker-runtime.js +90 -2
- package/dist/engine/execution/validate-worker-thread.js +17 -24
- package/dist/engine/handoff-artifacts/schemas.d.ts +2 -1
- package/dist/engine/handoff-artifacts/schemas.js +33 -0
- package/dist/engine/handoff-packager.d.ts +19 -0
- package/dist/engine/handoff-packager.js +415 -13
- package/dist/engine/hooks/effort-configurator.js +1 -1
- package/dist/engine/impact-detector/test-break-predictor.js +3 -3
- package/dist/engine/impact-detector/tool-registration.js +1 -1
- package/dist/engine/implementation-contract/renderer.js +23 -8
- package/dist/engine/lifecycle-reconciliation-io.d.ts +11 -0
- package/dist/engine/lifecycle-reconciliation-io.js +180 -0
- package/dist/engine/lifecycle-reconciliation.d.ts +16 -0
- package/dist/engine/lifecycle-reconciliation.js +406 -0
- package/dist/engine/local-first/tool-classification.js +2 -0
- package/dist/engine/macos-keychain-native-port.d.ts +5 -0
- package/dist/engine/macos-keychain-native-port.js +19 -7
- package/dist/engine/migrations/remove-commercial-state.d.ts +3 -0
- package/dist/engine/migrations/remove-commercial-state.js +343 -0
- package/dist/engine/network-policy.js +1 -0
- package/dist/engine/planu-core.darwin-arm64.node.manifest.json +7 -7
- package/dist/engine/planu-core.darwin-arm64.node.sbom.json +10 -10
- package/dist/engine/planu-core.darwin-x64.node.manifest.json +7 -7
- package/dist/engine/planu-core.darwin-x64.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-arm64-gnu.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-arm64-gnu.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-arm64-musl.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-arm64-musl.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-x64-gnu.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-x64-gnu.node.sbom.json +10 -10
- package/dist/engine/planu-core.linux-x64-musl.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-x64-musl.node.sbom.json +10 -10
- package/dist/engine/planu-core.win32-arm64-msvc.node.manifest.json +7 -7
- package/dist/engine/planu-core.win32-arm64-msvc.node.sbom.json +10 -10
- package/dist/engine/planu-core.win32-x64-msvc.node.manifest.json +7 -7
- package/dist/engine/planu-core.win32-x64-msvc.node.sbom.json +10 -10
- package/dist/engine/readiness-checker.d.ts +1 -16
- package/dist/engine/readiness-checker.js +27 -88
- package/dist/engine/runtime-policy.d.ts +2 -0
- package/dist/engine/runtime-policy.js +42 -5
- package/dist/engine/runtime-security/rate-limiter.js +0 -1
- package/dist/engine/safety/contained-project-file.d.ts +3 -0
- package/dist/engine/safety/contained-project-file.js +23 -0
- package/dist/engine/scope-boundaries/contradiction-checker.js +63 -1
- package/dist/engine/scope-boundaries/scope-validator.js +45 -7
- package/dist/engine/session/checkpoint-writer.js +0 -9
- package/dist/engine/spec-format/acceptance-criteria.d.ts +6 -2
- package/dist/engine/spec-format/acceptance-criteria.js +77 -18
- package/dist/engine/spec-format/markdown-sections.d.ts +14 -0
- package/dist/engine/spec-format/markdown-sections.js +105 -0
- package/dist/engine/spec-format/read-technical-section.js +33 -5
- package/dist/engine/spec-format/technical-md-populator.js +3 -2
- package/dist/engine/spec-format/unified-spec-builder.d.ts +7 -0
- package/dist/engine/spec-format/unified-spec-builder.js +202 -0
- package/dist/engine/spec-migrator/canonical-deduplicator.d.ts +18 -0
- package/dist/engine/spec-migrator/canonical-deduplicator.js +479 -0
- package/dist/engine/spec-migrator/filesystem-import.d.ts +4 -8
- package/dist/engine/spec-migrator/filesystem-import.js +121 -14
- package/dist/engine/spec-migrator/frontmatter-parser.js +32 -15
- package/dist/engine/spec-migrator/index.d.ts +1 -0
- package/dist/engine/spec-migrator/index.js +1 -0
- package/dist/engine/spec-state-machine/transition-spec.d.ts +6 -1
- package/dist/engine/spec-state-machine/transition-spec.js +10 -1
- package/dist/engine/technical-enricher/index.js +16 -8
- package/dist/engine/technical-enricher/render-enriched.d.ts +1 -0
- package/dist/engine/technical-enricher/render-enriched.js +42 -14
- package/dist/engine/telemetry/health-checker.js +53 -17
- package/dist/engine/telemetry/telemetry-client.js +26 -8
- package/dist/engine/text-signal-boundaries.d.ts +2 -0
- package/dist/engine/text-signal-boundaries.js +25 -2
- package/dist/engine/time/relative-date.d.ts +3 -0
- package/dist/engine/time/relative-date.js +16 -0
- package/dist/engine/timing/budget.d.ts +11 -0
- package/dist/engine/timing/budget.js +27 -9
- package/dist/engine/token-optimizer/analytics.d.ts +1 -1
- package/dist/engine/token-optimizer/analytics.js +5 -6
- package/dist/engine/usage-tracker/core.d.ts +2 -2
- package/dist/engine/usage-tracker/core.js +1 -2
- package/dist/engine/usage-tracker/index.d.ts +0 -3
- package/dist/engine/usage-tracker/index.js +0 -3
- package/dist/engine/usage-tracker/stats.d.ts +2 -2
- package/dist/engine/usage-tracker/stats.js +1 -28
- package/dist/engine/validation/durable-validation.d.ts +1 -1
- package/dist/engine/validation/durable-validation.js +3 -82
- package/dist/engine/validation/validation-freshness.d.ts +11 -1
- package/dist/engine/validation/validation-freshness.js +231 -91
- package/dist/engine/validation/validation-receipt.d.ts +9 -6
- package/dist/engine/validation/validation-receipt.js +84 -24
- package/dist/engine/validation/validation-source-digest.d.ts +2 -0
- package/dist/engine/validation/validation-source-digest.js +86 -0
- package/dist/engine/validation/validation-submission.d.ts +5 -4
- package/dist/engine/validation/validation-submission.js +25 -11
- package/dist/engine/validation/validation-worktree.d.ts +21 -0
- package/dist/engine/validation/validation-worktree.js +260 -0
- package/dist/engine/validation-impact-planner.d.ts +14 -2
- package/dist/engine/validation-impact-planner.js +0 -3
- package/dist/engine/validator/dor-dod.d.ts +1 -0
- package/dist/engine/validator/dor-dod.js +5 -3
- package/dist/engine/validator/extractors.d.ts +1 -5
- package/dist/engine/validator/extractors.js +24 -69
- package/dist/engine/validator/spec-compliance-runner.d.ts +12 -24
- package/dist/engine/validator/spec-compliance-runner.js +429 -211
- package/dist/engine/validator.js +35 -22
- package/dist/index.js +4 -16
- package/dist/resources/usage-stats-resource.js +2 -18
- package/dist/security/adapters/linux-secret-service.js +7 -3
- package/dist/security/adapters/windows-credential-manager.js +6 -4
- package/dist/server/routes/specs.js +10 -0
- package/dist/storage/base-store.d.ts +1 -1
- package/dist/storage/base-store.js +1 -1
- package/dist/storage/feedback-remote.d.ts +2 -3
- package/dist/storage/feedback-remote.js +45 -31
- package/dist/storage/global-store.d.ts +1 -17
- package/dist/storage/global-store.js +1 -42
- package/dist/storage/index.d.ts +0 -2
- package/dist/storage/index.js +0 -2
- package/dist/storage/migrations/canonical-storage.js +124 -11
- package/dist/storage/runtime-db.d.ts +9 -0
- package/dist/storage/runtime-db.js +64 -8
- package/dist/storage/spec-store.d.ts +14 -2
- package/dist/storage/spec-store.js +104 -14
- package/dist/storage/status-store/atomic-status-write.d.ts +5 -0
- package/dist/storage/status-store/atomic-status-write.js +57 -0
- package/dist/storage/status-store/file-lock.js +30 -11
- package/dist/storage/status-store/self-healing.js +3 -3
- package/dist/storage/status-store/version-sync.d.ts +2 -1
- package/dist/storage/status-store/version-sync.js +35 -40
- package/dist/storage/usage-store.d.ts +1 -5
- package/dist/storage/usage-store.js +0 -35
- package/dist/tools/auto-update-handler.d.ts +3 -3
- package/dist/tools/auto-update-handler.js +3 -3
- package/dist/tools/challenge-spec/resilience-challenge-scenarios.d.ts +2 -1
- package/dist/tools/challenge-spec/resilience-challenge-scenarios.js +10 -7
- package/dist/tools/challenge-spec/scenario-collector.js +1 -1
- package/dist/tools/challenge-spec/scenarios-data.js +1 -1
- package/dist/tools/challenge-spec/scenarios-utils.d.ts +1 -1
- package/dist/tools/challenge-spec/scenarios-utils.js +35 -11
- package/dist/tools/challenge-spec.js +5 -5
- package/dist/tools/check-readiness.js +1 -1
- package/dist/tools/configure-telemetry.js +30 -2
- package/dist/tools/create-spec/spec-builder.js +0 -11
- package/dist/tools/create-spec.d.ts +1 -0
- package/dist/tools/create-spec.js +444 -239
- package/dist/tools/git/branch-ops.d.ts +1 -1
- package/dist/tools/git/branch-ops.js +3 -2
- package/dist/tools/init-project/handler.js +10 -12
- package/dist/tools/init-project/host-assets-writer.js +26 -1
- package/dist/tools/init-project/lint-scaffolder.d.ts +3 -3
- package/dist/tools/init-project/migration-runner.d.ts +2 -4
- package/dist/tools/init-project/migration-runner.js +3 -2
- package/dist/tools/init-project/portable-index-reconciler.d.ts +4 -0
- package/dist/tools/init-project/portable-index-reconciler.js +14 -0
- package/dist/tools/init-project/result-builder.js +1 -3
- package/dist/tools/jobs/handlers.js +38 -6
- package/dist/tools/list-specs.js +5 -26
- package/dist/tools/merge-risk-handler.js +2 -2
- package/dist/tools/package-handoff.js +2 -0
- package/dist/tools/reconcile-spec.js +0 -27
- package/dist/tools/register-agent-squad-tools.js +2 -2
- package/dist/tools/register-platform-tools/design-stack-tools.js +11 -11
- package/dist/tools/register-platform-tools/lifecycle-infra-tools.js +7 -7
- package/dist/tools/register-sdd-tools.d.ts +1 -1
- package/dist/tools/register-sdd-tools.js +2 -29
- package/dist/tools/register-spec-tools/analysis-tools.js +8 -8
- package/dist/tools/register-spec-tools/core-spec-tools.js +17 -8
- package/dist/tools/safe-handler.d.ts +5 -13
- package/dist/tools/safe-handler.js +7 -23
- package/dist/tools/schemas/index.d.ts +1 -1
- package/dist/tools/schemas/index.js +1 -1
- package/dist/tools/schemas/output-schemas.d.ts +0 -23
- package/dist/tools/schemas/output-schemas.js +0 -28
- package/dist/tools/schemas/spec.d.ts +4 -0
- package/dist/tools/schemas/spec.js +3 -0
- package/dist/tools/schemas/validate-output-schema.d.ts +11 -0
- package/dist/tools/schemas/validate-output-schema.js +7 -0
- package/dist/tools/spec-prompt-handler.js +3 -3
- package/dist/tools/sync-spec-state-handler.d.ts +1 -1
- package/dist/tools/sync-spec-state-handler.js +1 -1
- package/dist/tools/tool-entry.d.ts +4 -4
- package/dist/tools/tool-entry.js +3 -3
- package/dist/tools/tool-registry/core-tools.js +31 -15
- package/dist/tools/tool-registry/group-infra.js +27 -110
- package/dist/tools/tool-registry/group-quality-compliance.js +26 -26
- package/dist/tools/tool-registry/inventory.d.ts +2 -0
- package/dist/tools/tool-registry/inventory.js +2 -0
- package/dist/tools/tool-registry-helpers.d.ts +3 -3
- package/dist/tools/tool-registry-helpers.js +3 -3
- package/dist/tools/tool-usage-report/registered-tools.d.ts +1 -1
- package/dist/tools/tool-usage-report/registered-tools.js +3 -15
- package/dist/tools/update-status/approval-gates.js +3 -0
- package/dist/tools/update-status/done-receipt-verifier.js +40 -27
- package/dist/tools/update-status/evidence-gate.js +36 -1
- package/dist/tools/update-status/file-sync.d.ts +2 -1
- package/dist/tools/update-status/file-sync.js +57 -6
- package/dist/tools/update-status/index.d.ts +2 -0
- package/dist/tools/update-status/index.js +95 -58
- package/dist/tools/update-status/response-builder.js +3 -3
- package/dist/tools/update-status/side-effects.d.ts +2 -0
- package/dist/tools/update-status/side-effects.js +2 -2
- package/dist/tools/update-status/transition-guard.js +32 -15
- package/dist/tools/update-status-actions.d.ts +4 -2
- package/dist/tools/update-status-actions.js +16 -14
- package/dist/tools/usage-report.js +1 -16
- package/dist/tools/usage-stats.js +1 -18
- package/dist/tools/usage-tracking.d.ts +4 -0
- package/dist/tools/usage-tracking.js +20 -0
- package/dist/tools/validate-lint.d.ts +1 -0
- package/dist/tools/validate-lint.js +1 -1
- package/dist/tools/validate.d.ts +2 -1
- package/dist/tools/validate.js +114 -34
- package/dist/transports/http-transport.js +6 -8
- package/dist/transports/mcp-types.d.ts +0 -2
- package/dist/transports/session-context.js +1 -1
- package/dist/types/cascade-hooks.d.ts +1 -1
- package/dist/types/ci.d.ts +0 -4
- package/dist/types/clarification-token.d.ts +1 -1
- package/dist/types/claude-code-runtime.d.ts +0 -27
- package/dist/types/commercial-migration.d.ts +17 -0
- package/dist/types/commercial-migration.js +2 -0
- package/dist/types/common/primitives.d.ts +0 -2
- package/dist/types/core-bridge.d.ts +4 -10
- package/dist/types/dashboard.d.ts +3 -7
- package/dist/types/docs.d.ts +0 -1
- package/dist/types/durable-job.d.ts +4 -4
- package/dist/types/durable-validation.d.ts +100 -2
- package/dist/types/durable-validation.js +165 -1
- package/dist/types/errors/structured-error.d.ts +3 -3
- package/dist/types/estimation.d.ts +2 -0
- package/dist/types/evidence-gates.d.ts +9 -1
- package/dist/types/execution.d.ts +2 -0
- package/dist/types/gemini-integration.d.ts +0 -11
- package/dist/types/handoff-artifacts.d.ts +41 -0
- package/dist/types/hooks-advanced.d.ts +0 -13
- package/dist/types/impact-detection.d.ts +2 -2
- package/dist/types/index.d.ts +2 -6
- package/dist/types/index.js +1 -5
- package/dist/types/kiro-integration.d.ts +0 -6
- package/dist/types/network-policy.d.ts +1 -1
- package/dist/types/project/lint-scaffolder.d.ts +1 -1
- package/dist/types/runtime-policy.d.ts +11 -0
- package/dist/types/session-safeguard.d.ts +0 -31
- package/dist/types/spec/canonical-repair.d.ts +81 -0
- package/dist/types/spec/canonical-repair.js +2 -0
- package/dist/types/spec/core.d.ts +14 -0
- package/dist/types/spec/index.d.ts +1 -0
- package/dist/types/spec/index.js +1 -0
- package/dist/types/spec/inputs.d.ts +29 -0
- package/dist/types/spec-format.d.ts +24 -0
- package/dist/types/telemetry.d.ts +4 -1
- package/dist/types/transport.d.ts +0 -2
- package/dist/types/usage.d.ts +1 -36
- package/dist/types/usage.js +1 -1
- package/dist/types/validate-worker.d.ts +6 -0
- package/dist/types/validation-receipt.d.ts +1 -1
- package/dist/types/validation.d.ts +2 -2
- package/package.json +16 -12
- package/planu-native.json +1 -1
- package/planu-plugin.json +23 -40
- package/scripts/lib/pending-release-file.mjs +93 -0
- package/src/i18n/messages/en.json +0 -41
- package/src/i18n/messages/es.json +0 -41
- package/src/i18n/messages/pt.json +0 -41
- package/dist/cli/commands/activate.d.ts +0 -14
- package/dist/cli/commands/activate.js +0 -174
- package/dist/config/license-plans.json +0 -251
- package/dist/config/product-public.ts +0 -148
- package/dist/config/server-instructions.ts +0 -121
- package/dist/config/version-defaults.ts +0 -76
- package/dist/config/version.ts +0 -21
- package/dist/engine/ai-integration/gemini/settings-generator.d.ts +0 -4
- package/dist/engine/ai-integration/gemini/settings-generator.js +0 -195
- package/dist/engine/ai-integration/kiro/hooks-generator.d.ts +0 -6
- package/dist/engine/ai-integration/kiro/hooks-generator.js +0 -75
- package/dist/engine/hooks/full-spectrum-generator.d.ts +0 -32
- package/dist/engine/hooks/full-spectrum-generator.js +0 -117
- package/dist/engine/license-validator/config-loader.d.ts +0 -5
- package/dist/engine/license-validator/config-loader.js +0 -16
- package/dist/engine/license-validator/core.d.ts +0 -15
- package/dist/engine/license-validator/core.js +0 -151
- package/dist/engine/license-validator/fingerprint.d.ts +0 -3
- package/dist/engine/license-validator/fingerprint.js +0 -17
- package/dist/engine/license-validator/lemon-squeezy.d.ts +0 -5
- package/dist/engine/license-validator/lemon-squeezy.js +0 -55
- package/dist/engine/license-validator.d.ts +0 -5
- package/dist/engine/license-validator.js +0 -6
- package/dist/engine/product-intelligence/index.d.ts +0 -7
- package/dist/engine/product-intelligence/index.js +0 -211
- package/dist/engine/session/auto-save.d.ts +0 -18
- package/dist/engine/session/auto-save.js +0 -98
- package/dist/engine/session/context-snapshot.d.ts +0 -8
- package/dist/engine/session/context-snapshot.js +0 -49
- package/dist/engine/session/memory-sync.d.ts +0 -12
- package/dist/engine/session/memory-sync.js +0 -34
- package/dist/engine/session/session-diff.d.ts +0 -11
- package/dist/engine/session/session-diff.js +0 -42
- package/dist/engine/session/session-merge.d.ts +0 -12
- package/dist/engine/session/session-merge.js +0 -55
- package/dist/engine/session-safeguard/checkpoint-runner.d.ts +0 -4
- package/dist/engine/session-safeguard/checkpoint-runner.js +0 -70
- package/dist/engine/session-safeguard/learnings-buffer.d.ts +0 -15
- package/dist/engine/session-safeguard/learnings-buffer.js +0 -91
- package/dist/engine/session-safeguard/precompaction-drain.d.ts +0 -10
- package/dist/engine/session-safeguard/precompaction-drain.js +0 -82
- package/dist/engine/session-safeguard/unpushed-detector.d.ts +0 -7
- package/dist/engine/session-safeguard/unpushed-detector.js +0 -59
- package/dist/engine/spec-changelog/core.d.ts +0 -16
- package/dist/engine/spec-changelog/core.js +0 -176
- package/dist/engine/spec-changelog/diff.d.ts +0 -18
- package/dist/engine/spec-changelog/diff.js +0 -121
- package/dist/engine/spec-changelog/index.d.ts +0 -3
- package/dist/engine/spec-changelog/index.js +0 -4
- package/dist/engine/trial-engine.d.ts +0 -5
- package/dist/engine/trial-engine.js +0 -14
- package/dist/engine/usage-tracker/rate-check.d.ts +0 -7
- package/dist/engine/usage-tracker/rate-check.js +0 -18
- package/dist/engine/usage-tracker/rate-limiter.d.ts +0 -14
- package/dist/engine/usage-tracker/rate-limiter.js +0 -73
- package/dist/engine/usage-tracker/trial.d.ts +0 -27
- package/dist/engine/usage-tracker/trial.js +0 -49
- package/dist/engine/webhook/event-handlers.d.ts +0 -25
- package/dist/engine/webhook/event-handlers.js +0 -89
- package/dist/engine/webhook/index.d.ts +0 -4
- package/dist/engine/webhook/index.js +0 -5
- package/dist/engine/webhook/server.d.ts +0 -12
- package/dist/engine/webhook/server.js +0 -249
- package/dist/engine/webhook/signature.d.ts +0 -16
- package/dist/engine/webhook/signature.js +0 -49
- package/dist/storage/license-store.d.ts +0 -6
- package/dist/storage/license-store.js +0 -63
- package/dist/storage/session-store.d.ts +0 -20
- package/dist/storage/session-store.js +0 -136
- package/dist/tools/activate-license.d.ts +0 -6
- package/dist/tools/activate-license.js +0 -132
- package/dist/tools/checkpoint-handler.d.ts +0 -3
- package/dist/tools/checkpoint-handler.js +0 -130
- package/dist/tools/export-session.d.ts +0 -3
- package/dist/tools/export-session.js +0 -90
- package/dist/tools/license-gate.d.ts +0 -18
- package/dist/tools/license-gate.js +0 -222
- package/dist/tools/license-status.d.ts +0 -3
- package/dist/tools/license-status.js +0 -93
- package/dist/tools/list-sessions.d.ts +0 -3
- package/dist/tools/list-sessions.js +0 -46
- package/dist/tools/planu-session-checkpoint.d.ts +0 -6
- package/dist/tools/planu-session-checkpoint.js +0 -42
- package/dist/tools/restore-session.d.ts +0 -3
- package/dist/tools/restore-session.js +0 -71
- package/dist/tools/spec-history.d.ts +0 -3
- package/dist/tools/spec-history.js +0 -59
- package/dist/tools/webhook.d.ts +0 -6
- package/dist/tools/webhook.js +0 -150
- package/dist/types/changelog.d.ts +0 -49
- package/dist/types/changelog.js +0 -3
- package/dist/types/licensing.d.ts +0 -109
- package/dist/types/licensing.js +0 -4
- package/dist/types/product-intelligence.d.ts +0 -60
- package/dist/types/product-intelligence.js +0 -3
- package/dist/types/session.d.ts +0 -84
- package/dist/types/session.js +0 -3
- package/dist/types/webhook.d.ts +0 -62
- package/dist/types/webhook.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolResult, GitConfig } from '../../types/index.js';
|
|
2
|
-
export declare function handleCreateBranch(projectId: string, specId: string | undefined, config?: GitConfig): Promise<ToolResult>;
|
|
2
|
+
export declare function handleCreateBranch(projectId: string, specId: string | undefined, config?: GitConfig, resolvedProjectPath?: string): Promise<ToolResult>;
|
|
3
3
|
export declare function handleCheckBranch(projectId: string, _specId: string | undefined, config?: GitConfig): Promise<ToolResult>;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-setup: detect git workflow, sync base branch, create feature branch.
|
|
@@ -19,11 +19,12 @@ function randomSuffix() {
|
|
|
19
19
|
.toString(16)
|
|
20
20
|
.padStart(8, '0');
|
|
21
21
|
}
|
|
22
|
-
export async function handleCreateBranch(projectId, specId, config) {
|
|
22
|
+
export async function handleCreateBranch(projectId, specId, config, resolvedProjectPath) {
|
|
23
23
|
if (!specId) {
|
|
24
24
|
return compactError('❌ Error: specId is required for create-branch action');
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const suppliedPath = resolvedProjectPath?.trim();
|
|
27
|
+
const projectPath = suppliedPath && suppliedPath.length > 0 ? suppliedPath : await resolveProjectPath(projectId);
|
|
27
28
|
const spec = await specStore.getSpec(projectId, specId);
|
|
28
29
|
if (!spec) {
|
|
29
30
|
return compactError(`❌ Error: Spec '${specId}' not found`);
|
|
@@ -2,13 +2,11 @@ import { technologyValue } from '../../engine/technology-registry.js';
|
|
|
2
2
|
import { elicitOrFallback, questionsToFormSchema } from '../../engine/elicitation/elicit-helper.js';
|
|
3
3
|
import { ti } from '../../i18n/index.js';
|
|
4
4
|
import { AutopilotSummaryCollector } from '../../engine/autopilot/summary-collector.js';
|
|
5
|
-
import { knowledgeStore, globalStore,
|
|
5
|
+
import { knowledgeStore, globalStore, technologySelectionStore, projectDataDir, } from '../../storage/index.js';
|
|
6
6
|
import { migrateCanonicalStorage } from '../../storage/migrations/canonical-storage.js';
|
|
7
7
|
import { deriveWorkspaceKey, ensureProjectIdentity } from '../../storage/project-identity.js';
|
|
8
8
|
import { resolveStorageLayout } from '../../storage/storage-layout.js';
|
|
9
9
|
import { addProject } from '../../storage/global-projects-store.js';
|
|
10
|
-
import { getCurrentTier } from '../license-gate.js';
|
|
11
|
-
import { checkLimits } from '../../engine/license-validator.js';
|
|
12
10
|
import { analyzeProject, checkProjectCompleteness } from '../../engine/analyzer.js';
|
|
13
11
|
import { parseProjectQualityRules } from '../../engine/auditor-claude-md.js';
|
|
14
12
|
import { detectMissingAreas, buildRequestPrompt } from '../../engine/context-merger.js';
|
|
@@ -22,6 +20,7 @@ import { regeneratePages } from '../../engine/doc-generator/portal/index.js';
|
|
|
22
20
|
import { detectStackPatterns } from './stack-detector.js';
|
|
23
21
|
import { buildProjectConfig } from './config-builder.js';
|
|
24
22
|
import { runSpecMigrations, listProjectSpecs } from './migration-runner.js';
|
|
23
|
+
import { reconcilePortableSpecIndex } from './portable-index-reconciler.js';
|
|
25
24
|
import { runScaffoldWriter } from './scaffold-writer.js';
|
|
26
25
|
import { readAutoInstallFlag, orchestrateSkillInstalls, runHealthCheckWithBaseline, runConventionScanSafe, fireTelemetry, } from './lifecycle-helpers.js';
|
|
27
26
|
import { injectProactiveRules } from '../../engine/claude-md-injector/index.js';
|
|
@@ -195,20 +194,26 @@ export async function handleInitProject(params, server) {
|
|
|
195
194
|
const isUpdate = hadProjectIdentity || existing !== null;
|
|
196
195
|
const authorizedMigrations = params.authorizedMigrations ?? [];
|
|
197
196
|
if (isUpdate && authorizedMigrations.length === 0) {
|
|
197
|
+
const reconciliation = await reconcilePortableSpecIndex(projectPath, projectId);
|
|
198
198
|
return {
|
|
199
199
|
content: [
|
|
200
200
|
{
|
|
201
201
|
type: 'text',
|
|
202
|
-
text:
|
|
202
|
+
text: reconciliation.failures.length === 0
|
|
203
|
+
? 'Project already initialized. Safe update reconciled the portable spec index without changing repository files.'
|
|
204
|
+
: `Portable spec index reconciliation failed for ${String(reconciliation.failures.length)} contract(s).`,
|
|
203
205
|
},
|
|
204
206
|
],
|
|
205
207
|
structuredContent: {
|
|
206
208
|
projectId,
|
|
207
|
-
projectPath,
|
|
209
|
+
...(reconciliation.failures.length === 0 ? { projectPath } : {}),
|
|
208
210
|
isUpdate: true,
|
|
209
211
|
repositoryFilesChanged: [],
|
|
210
212
|
authorizedMigrations: [],
|
|
213
|
+
importedSpecIds: reconciliation.importedSpecIds,
|
|
214
|
+
failures: reconciliation.failures,
|
|
211
215
|
},
|
|
216
|
+
...(reconciliation.failures.length > 0 ? { isError: true } : {}),
|
|
212
217
|
};
|
|
213
218
|
}
|
|
214
219
|
if (isUpdate) {
|
|
@@ -247,13 +252,6 @@ export async function handleInitProject(params, server) {
|
|
|
247
252
|
...(migrationResult.criticalMigrationFailures.length > 0 ? { isError: true } : {}),
|
|
248
253
|
};
|
|
249
254
|
}
|
|
250
|
-
// The update branches returned above; only new projects reach the limit gate.
|
|
251
|
-
const tier = await getCurrentTier();
|
|
252
|
-
const projectCount = await licenseStore.countActiveProjects();
|
|
253
|
-
const limitCheck = checkLimits(tier, projectCount, 'maxProjects');
|
|
254
|
-
if (!limitCheck.allowed) {
|
|
255
|
-
return { content: [{ type: 'text', text: limitCheck.message }], isError: true };
|
|
256
|
-
}
|
|
257
255
|
// Get global config for defaults
|
|
258
256
|
const globalConfig = await globalStore.getGlobalConfig();
|
|
259
257
|
const effectiveLocale = locale ?? globalConfig.defaultLocale;
|
|
@@ -99,6 +99,28 @@ async function readCoreSkillTemplate(fileName) {
|
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
function coreSkillPath(projectPath, host, name) {
|
|
103
|
+
if (host === 'codex') {
|
|
104
|
+
return join(projectPath, 'AGENTS.md');
|
|
105
|
+
}
|
|
106
|
+
if (host === 'gemini') {
|
|
107
|
+
return join(projectPath, '.gemini', 'skills', `${name}.md`);
|
|
108
|
+
}
|
|
109
|
+
return join(projectPath, '.claude', 'skills', name, 'SKILL.md');
|
|
110
|
+
}
|
|
111
|
+
async function canRefreshCoreSkill(projectPath, host, name) {
|
|
112
|
+
try {
|
|
113
|
+
const existing = await readFile(coreSkillPath(projectPath, host, name), 'utf-8');
|
|
114
|
+
if (host === 'codex') {
|
|
115
|
+
return (existing.includes(`<!-- planu:skills:${name} -->`) ||
|
|
116
|
+
!existing.includes(`## Skill: ${name}`));
|
|
117
|
+
}
|
|
118
|
+
return existing.includes(`name: ${name}`) && existing.includes(`# /${name}`);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
102
124
|
async function installCoreSkillsForHost(projectPath, host) {
|
|
103
125
|
const installed = [];
|
|
104
126
|
for (const fileName of CORE_SKILL_TEMPLATES) {
|
|
@@ -106,13 +128,16 @@ async function installCoreSkillsForHost(projectPath, host) {
|
|
|
106
128
|
if (template === null) {
|
|
107
129
|
continue;
|
|
108
130
|
}
|
|
131
|
+
if (!(await canRefreshCoreSkill(projectPath, host, template.name))) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
109
134
|
const result = await handleCreateSkill({
|
|
110
135
|
projectPath,
|
|
111
136
|
host,
|
|
112
137
|
name: template.name,
|
|
113
138
|
description: template.description,
|
|
114
139
|
content: template.content,
|
|
115
|
-
overwriteExisting:
|
|
140
|
+
overwriteExisting: true,
|
|
116
141
|
});
|
|
117
142
|
if (result.isError === true) {
|
|
118
143
|
continue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProjectKnowledge } from '../../types/project/core.js';
|
|
2
|
-
import type {
|
|
3
|
-
export type { ScaffoldResult };
|
|
4
|
-
export declare function scaffoldLintConfig(projectPath: string, knowledge: ProjectKnowledge): Promise<
|
|
2
|
+
import type { LintScaffoldResult } from '../../types/project/lint-scaffolder.js';
|
|
3
|
+
export type { LintScaffoldResult as ScaffoldResult };
|
|
4
|
+
export declare function scaffoldLintConfig(projectPath: string, knowledge: ProjectKnowledge): Promise<LintScaffoldResult>;
|
|
5
5
|
//# sourceMappingURL=lint-scaffolder.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { reconcilePortableSpecIndex } from './portable-index-reconciler.js';
|
|
1
2
|
import type { ProjectKnowledge, Spec } from '../../types/index.js';
|
|
2
3
|
export interface MigrationRunIssue {
|
|
3
4
|
phase: string;
|
|
@@ -11,10 +12,7 @@ export interface MigrationRunResult {
|
|
|
11
12
|
renamedCount: number;
|
|
12
13
|
errors: string[];
|
|
13
14
|
} | null;
|
|
14
|
-
filesystemImportResult:
|
|
15
|
-
importedCount: number;
|
|
16
|
-
errors: string[];
|
|
17
|
-
} | null;
|
|
15
|
+
filesystemImportResult: Awaited<ReturnType<typeof reconcilePortableSpecIndex>> | null;
|
|
18
16
|
migrationResult: {
|
|
19
17
|
migratedCount: number;
|
|
20
18
|
errors: string[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// tools/init-project/migration-runner.ts — Spec migration orchestration during init_project
|
|
2
2
|
import { specStore, knowledgeStore } from '../../storage/index.js';
|
|
3
3
|
import { projectDataDir, writeJson } from '../../storage/base-store.js';
|
|
4
|
-
import { filterLegacySpecs, migrateSpecs, filterUnprefixedSpecs, migrateSpecFolderNames, discoverAndFlattenSpecs, reconcileSpecPaths, migrateAllSpecsToLean,
|
|
4
|
+
import { filterLegacySpecs, migrateSpecs, filterUnprefixedSpecs, migrateSpecFolderNames, discoverAndFlattenSpecs, reconcileSpecPaths, migrateAllSpecsToLean, } from '../../engine/spec-migrator.js';
|
|
5
|
+
import { reconcilePortableSpecIndex } from './portable-index-reconciler.js';
|
|
5
6
|
import { createHash } from 'node:crypto';
|
|
6
7
|
import { lstat, readFile, readdir, readlink } from 'node:fs/promises';
|
|
7
8
|
import { join, relative } from 'node:path';
|
|
@@ -78,7 +79,7 @@ export async function runSpecMigrations(projectPath, projectId, knowledge, optio
|
|
|
78
79
|
// This is required after a storage-root migration or a clean-machine import.
|
|
79
80
|
let filesystemImportResult = null;
|
|
80
81
|
try {
|
|
81
|
-
filesystemImportResult = await
|
|
82
|
+
filesystemImportResult = await reconcilePortableSpecIndex(projectPath, projectId);
|
|
82
83
|
criticalMigrationFailures.push(...issuesFromMessages('filesystem-spec-import', 'critical', filesystemImportResult.errors));
|
|
83
84
|
}
|
|
84
85
|
catch (err) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FilesystemImportDeps, PortableIndexReconciliationResult } from '../../types/index.js';
|
|
2
|
+
/** Rebuild the mutable external index from the repository-owned portable contracts. */
|
|
3
|
+
export declare function reconcilePortableSpecIndex(projectPath: string, projectId: string, deps?: FilesystemImportDeps): Promise<PortableIndexReconciliationResult>;
|
|
4
|
+
//# sourceMappingURL=portable-index-reconciler.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { specStore } from '../../storage/index.js';
|
|
2
|
+
import { importFilesystemSpecs } from '../../engine/spec-migrator/filesystem-import.js';
|
|
3
|
+
/** Rebuild the mutable external index from the repository-owned portable contracts. */
|
|
4
|
+
export async function reconcilePortableSpecIndex(projectPath, projectId, deps = {
|
|
5
|
+
listSpecs: specStore.listSpecs,
|
|
6
|
+
createSpec: specStore.createSpec,
|
|
7
|
+
getSpecFresh: specStore.getSpecFresh,
|
|
8
|
+
}) {
|
|
9
|
+
const result = await importFilesystemSpecs(projectPath, deps, projectId, {
|
|
10
|
+
strictPortableContract: true,
|
|
11
|
+
});
|
|
12
|
+
return { ...result, repositoryFilesChanged: [] };
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=portable-index-reconciler.js.map
|
|
@@ -193,9 +193,8 @@ export function buildInitProjectResult(input) {
|
|
|
193
193
|
const framework = result.framework ?? 'no framework detected';
|
|
194
194
|
const action = isUpdate ? 'updated' : 'initialized';
|
|
195
195
|
const telemetryNote = input.telemetryOptInPrompt
|
|
196
|
-
? `\n\n---\n💡 **Help improve Planu** — run \`configure_telemetry\` with action=enable to share anonymous usage stats (no paths, no emails, no personal data). You can opt out anytime.`
|
|
196
|
+
? `\n\n---\n💡 **Help improve Planu** — run \`configure_telemetry\` with action=enable, then set a valid \`PLANU_TELEMETRY_ENDPOINT\` and secret \`PLANU_TELEMETRY_TOKEN\` to share anonymous usage stats (no paths, no emails, no personal data). You can opt out anytime.`
|
|
197
197
|
: '';
|
|
198
|
-
const trialNote = '';
|
|
199
198
|
const tokenTip = `\n\n💡 Token tip: Add CLAUDE_CODE_SUBAGENT_MODEL=haiku to your .env — makes all read-only subagents ` +
|
|
200
199
|
`(search, grep, file reads) use Haiku instead of your session model (4–18x cheaper for those tasks).`;
|
|
201
200
|
const narrative = ti('tools.init_project.success', { projectPath: result.projectPath }) +
|
|
@@ -206,7 +205,6 @@ export function buildInitProjectResult(input) {
|
|
|
206
205
|
`See migrationReportPath in structuredContent${input.migrationReportPath ? ` (${input.migrationReportPath})` : ''}.`
|
|
207
206
|
: '') +
|
|
208
207
|
telemetryNote +
|
|
209
|
-
trialNote +
|
|
210
208
|
tokenTip;
|
|
211
209
|
// SPEC-491: Build interactiveQuestions for decisions that require user input
|
|
212
210
|
const interactiveQuestions = [];
|
|
@@ -50,20 +50,44 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
50
50
|
var e = new Error(message);
|
|
51
51
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
52
|
});
|
|
53
|
-
import {
|
|
53
|
+
import { DurableJobRuntime, publicJobCursor } from '../../engine/execution/job-runtime.js';
|
|
54
54
|
import { scheduleValidateJobExecution } from '../../engine/execution/validate-job-executor.js';
|
|
55
|
+
import { isValidationReceiptPendingIntent, parseValidationReceiptPendingCheckpoint, } from '../../types/durable-validation.js';
|
|
56
|
+
import { redactText } from '../../security/redactor.js';
|
|
57
|
+
import { getRuntimePolicy } from '../../engine/runtime-policy.js';
|
|
55
58
|
function result(payload) {
|
|
56
59
|
return {
|
|
57
60
|
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
|
|
58
61
|
structuredContent: payload,
|
|
59
62
|
};
|
|
60
63
|
}
|
|
64
|
+
function publicJob(runtime, job) {
|
|
65
|
+
const sanitized = runtime.observe(job);
|
|
66
|
+
if (job.state === 'completed') {
|
|
67
|
+
const { checkpoint: _checkpoint, error: _error, ...completed } = sanitized;
|
|
68
|
+
return completed;
|
|
69
|
+
}
|
|
70
|
+
if (!parseValidationReceiptPendingCheckpoint(job.checkpoint, checkpointLimits())) {
|
|
71
|
+
return sanitized;
|
|
72
|
+
}
|
|
73
|
+
const errorMessage = job.error === undefined ? RECEIPT_PENDING_MESSAGE : redactText(job.error);
|
|
74
|
+
return { ...sanitized, error: errorMessage, errorMessage };
|
|
75
|
+
}
|
|
76
|
+
const RECEIPT_PENDING_MESSAGE = '[Planu] VALIDATION_RECEIPT_PENDING action=restart_job';
|
|
77
|
+
function checkpointLimits() {
|
|
78
|
+
const policy = getRuntimePolicy().validation;
|
|
79
|
+
return {
|
|
80
|
+
logMaxBytes: policy.receiptCheckpointLogMaxBytes,
|
|
81
|
+
resultMaxBytes: policy.receiptCheckpointResultMaxBytes,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
61
84
|
export function handleGetJob(input) {
|
|
62
85
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
63
86
|
try {
|
|
64
87
|
const runtime = __addDisposableResource(env_1, new DurableJobRuntime(), false);
|
|
65
88
|
const job = runtime.get(input);
|
|
66
|
-
|
|
89
|
+
const observation = publicJob(runtime, job);
|
|
90
|
+
return Promise.resolve(result({ schemaVersion: 1, job: observation, cursor: publicJobCursor(observation) }));
|
|
67
91
|
}
|
|
68
92
|
catch (e_1) {
|
|
69
93
|
env_1.error = e_1;
|
|
@@ -78,7 +102,8 @@ export async function handleWatchJob(input) {
|
|
|
78
102
|
try {
|
|
79
103
|
const runtime = __addDisposableResource(env_2, new DurableJobRuntime(), false);
|
|
80
104
|
const job = await runtime.watch(input);
|
|
81
|
-
|
|
105
|
+
const observation = publicJob(runtime, job);
|
|
106
|
+
return result({ schemaVersion: 1, job: observation, cursor: publicJobCursor(observation) });
|
|
82
107
|
}
|
|
83
108
|
catch (e_2) {
|
|
84
109
|
env_2.error = e_2;
|
|
@@ -93,7 +118,8 @@ export function handleCancelJob(input) {
|
|
|
93
118
|
try {
|
|
94
119
|
const runtime = __addDisposableResource(env_3, new DurableJobRuntime(), false);
|
|
95
120
|
const job = runtime.cancel(input);
|
|
96
|
-
|
|
121
|
+
const observation = publicJob(runtime, job);
|
|
122
|
+
return Promise.resolve(result({ schemaVersion: 1, job: observation, cursor: publicJobCursor(observation) }));
|
|
97
123
|
}
|
|
98
124
|
catch (e_3) {
|
|
99
125
|
env_3.error = e_3;
|
|
@@ -107,13 +133,19 @@ export function handleRestartJob(input) {
|
|
|
107
133
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
108
134
|
try {
|
|
109
135
|
const runtime = __addDisposableResource(env_4, new DurableJobRuntime(), false);
|
|
110
|
-
const
|
|
136
|
+
const current = runtime.get(input);
|
|
137
|
+
const pending = parseValidationReceiptPendingCheckpoint(current.checkpoint, checkpointLimits());
|
|
138
|
+
if (!pending && isValidationReceiptPendingIntent(current.checkpoint)) {
|
|
139
|
+
throw new Error('[Planu] Invalid validation receipt checkpoint');
|
|
140
|
+
}
|
|
141
|
+
const job = pending ? runtime.restartReceiptPublication(input) : runtime.restart(input);
|
|
111
142
|
if (job.payload &&
|
|
112
143
|
typeof job.payload === 'object' &&
|
|
113
144
|
job.payload.kind === 'validate') {
|
|
114
145
|
scheduleValidateJobExecution(job.projectId, job.workspaceId);
|
|
115
146
|
}
|
|
116
|
-
|
|
147
|
+
const observation = publicJob(runtime, job);
|
|
148
|
+
return Promise.resolve(result({ schemaVersion: 1, job: observation, cursor: publicJobCursor(observation) }));
|
|
117
149
|
}
|
|
118
150
|
catch (e_4) {
|
|
119
151
|
env_4.error = e_4;
|
package/dist/tools/list-specs.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { ti } from '../i18n/index.js';
|
|
2
2
|
import { specStore, knowledgeStore } from '../storage/index.js';
|
|
3
3
|
import { buildListSpecsSummary } from '../engine/human-summary.js';
|
|
4
|
-
import { dirname } from 'node:path';
|
|
5
4
|
import { checkBundledVersionGap } from '../engine/version-detector/bundled-version-checker.js';
|
|
6
|
-
import {
|
|
5
|
+
import { formatRelativeDate } from '../engine/time/relative-date.js';
|
|
7
6
|
import { scanForAmbiguousCriteria } from '../engine/spec-migrator.js';
|
|
8
7
|
import { detectDrift, formatDriftMessage } from '../engine/spec-migrator/drift-detector.js';
|
|
9
8
|
import { AutopilotSummaryCollector } from '../engine/autopilot/summary-collector.js';
|
|
10
9
|
import { trackCost } from '../engine/cost-tracking/operation-tracker.js';
|
|
11
10
|
import { resolveProjectIdOrAutoDetect } from './resolve-project-id.js';
|
|
12
|
-
import { isNativeActive, fastScanSpecs } from '../engine/core-bridge.js';
|
|
13
11
|
/** Track which projects have been auto-discovered this session (once per project). */
|
|
14
12
|
const discoveredProjects = new Set();
|
|
15
13
|
const MAX_STRUCTURED_SPECS = 50;
|
|
@@ -94,11 +92,6 @@ export async function handleListSpecs(params) {
|
|
|
94
92
|
isError: true,
|
|
95
93
|
};
|
|
96
94
|
}
|
|
97
|
-
// ─── Native optimized scan (SPEC-1004) ──────────────────────────────────
|
|
98
|
-
let nativeBriefs = null;
|
|
99
|
-
if (detail === 'full' && isNativeActive() && knowledge.projectPath) {
|
|
100
|
-
nativeBriefs = fastScanSpecs(knowledge.projectPath);
|
|
101
|
-
}
|
|
102
95
|
// Read-only project signals only. Mutating discovery/migration/repair belongs
|
|
103
96
|
// to init, validate, housekeeping, or explicit migration tools.
|
|
104
97
|
if (detail === 'full' && knowledge.projectPath) {
|
|
@@ -129,27 +122,13 @@ export async function handleListSpecs(params) {
|
|
|
129
122
|
const totalDevHours = safeSpecs.reduce((sum, s) => sum + (s.estimation?.devHours ?? 0), 0);
|
|
130
123
|
const totalReviewHours = safeSpecs.reduce((sum, s) => sum + (s.estimation?.reviewHours ?? 0), 0);
|
|
131
124
|
const totalCostUsd = safeSpecs.reduce((sum, s) => sum + (s.estimation?.totalCostUsd ?? 0), 0);
|
|
132
|
-
//
|
|
125
|
+
// Render canonical spec metadata without reading spec-local sidecars.
|
|
133
126
|
const lastModifiedMap = new Map();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
lastModifiedMap.set(b.id, formatRelativeDate(b.lastModified));
|
|
138
|
-
}
|
|
127
|
+
for (const spec of safeSpecs) {
|
|
128
|
+
if (spec.updatedAt) {
|
|
129
|
+
lastModifiedMap.set(spec.id, formatRelativeDate(spec.updatedAt));
|
|
139
130
|
}
|
|
140
131
|
}
|
|
141
|
-
else {
|
|
142
|
-
await Promise.all(safeSpecs.map(async (s) => {
|
|
143
|
-
if (!s.specPath) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const specDir = dirname(s.specPath);
|
|
147
|
-
const timestamp = await readLastModifiedTimestamp(specDir);
|
|
148
|
-
if (timestamp) {
|
|
149
|
-
lastModifiedMap.set(s.id, formatRelativeDate(timestamp));
|
|
150
|
-
}
|
|
151
|
-
}));
|
|
152
|
-
}
|
|
153
132
|
// SPEC-091: Auto-suggest Agent Teams when 3+ approved specs exist
|
|
154
133
|
const approvedSpecs = allSpecs.filter((s) => s.status === 'approved');
|
|
155
134
|
let teamSuggestion = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { safeGoverned } from './safe-handler.js';
|
|
3
3
|
import { assessMergeRisk } from '../engine/merge-risk-assessor/index.js';
|
|
4
4
|
// ── Zod schema ────────────────────────────────────────────────────────────────
|
|
5
5
|
const AssessMergeRiskInputSchema = {
|
|
@@ -75,6 +75,6 @@ export function registerMergeRiskTools(server) {
|
|
|
75
75
|
destructiveHint: false,
|
|
76
76
|
openWorldHint: false,
|
|
77
77
|
},
|
|
78
|
-
},
|
|
78
|
+
}, safeGoverned('assess_merge_risk', async (args) => handleAssessMergeRisk(args)));
|
|
79
79
|
}
|
|
80
80
|
//# sourceMappingURL=merge-risk-handler.js.map
|
|
@@ -383,6 +383,7 @@ export async function handlePackageHandoff(args) {
|
|
|
383
383
|
/* best-effort — handoff rendering should not fail because telemetry failed */
|
|
384
384
|
});
|
|
385
385
|
const topBlockers = topItems(pkgWithScore.blockers, 3);
|
|
386
|
+
const ownershipBlockers = pkgWithScore.blockers.filter((blocker) => blocker.startsWith('handoff_ownership_invalid'));
|
|
386
387
|
const topRisks = topItems(pkgWithScore.risks, 5);
|
|
387
388
|
const minimalitySummary = summarizeMinimality(minimalityReport);
|
|
388
389
|
const tokenWasteSummary = summarizeTokenWaste(tokenWasteReport);
|
|
@@ -406,6 +407,7 @@ export async function handlePackageHandoff(args) {
|
|
|
406
407
|
readinessScore: pkgWithScore.readinessScore,
|
|
407
408
|
blockersCount: pkgWithScore.blockers.length,
|
|
408
409
|
blockersTop3: topBlockers,
|
|
410
|
+
ownershipBlockers,
|
|
409
411
|
risksTop5: topRisks,
|
|
410
412
|
criteriaTop5: topItems(pkgWithScore.criteria, 5),
|
|
411
413
|
constraintsTop5: topItems(pkgWithScore.constraints, 5),
|
|
@@ -5,10 +5,8 @@ import { specStore, knowledgeStore } from '../storage/index.js';
|
|
|
5
5
|
import { createVersion } from '../engine/spec-versioner.js';
|
|
6
6
|
import { readFile } from 'node:fs/promises';
|
|
7
7
|
import { atomicWriteFile } from '../engine/safety/atomic-write-file.js';
|
|
8
|
-
import { dirname } from 'node:path';
|
|
9
8
|
import { replaceSectionInSpec } from '../engine/spec-format/replace-section.js';
|
|
10
9
|
import { extractSectionBody } from '../engine/spec-format/read-technical-section.js';
|
|
11
|
-
import { appendChangelogEntry } from '../engine/spec-changelog/index.js';
|
|
12
10
|
import { stripFrontmatter } from '../engine/frontmatter-parser.js';
|
|
13
11
|
import { analyzeLivingSpec } from '../engine/living-spec-analyzer.js';
|
|
14
12
|
import { notifyStoreChange } from '../engine/doc-generator/portal/regen-hook.js';
|
|
@@ -347,27 +345,6 @@ export async function handleReconcileSpec(params, server) {
|
|
|
347
345
|
: 'No changes to apply',
|
|
348
346
|
reconciledAt: new Date().toISOString(),
|
|
349
347
|
};
|
|
350
|
-
// Generate changelog entry if there were approved changes (AC-02, AC-08)
|
|
351
|
-
let changelogUpdated = false;
|
|
352
|
-
if (approvedChanges.length > 0 && spec.specPath) {
|
|
353
|
-
const specDir = dirname(spec.specPath);
|
|
354
|
-
changelogUpdated = await appendChangelogEntry({
|
|
355
|
-
specDir,
|
|
356
|
-
specId,
|
|
357
|
-
entry: {
|
|
358
|
-
timestamp: new Date().toISOString(),
|
|
359
|
-
type: 'reconciled',
|
|
360
|
-
description: `Se reconcilio la spec. ${approvedChanges.length} cambio(s) aplicado(s): ${approvedChanges.map((c) => c.section).join(', ')}.`,
|
|
361
|
-
triggeredBy: 'reconcile_spec',
|
|
362
|
-
before: { criteriaCount: allChanges.length, completedCount: 0, status: spec.status },
|
|
363
|
-
after: {
|
|
364
|
-
criteriaCount: allChanges.length,
|
|
365
|
-
completedCount: 0,
|
|
366
|
-
status: hasStatusChange ? hasStatusChange.newValue : spec.status,
|
|
367
|
-
},
|
|
368
|
-
},
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
348
|
// Living spec analysis: compare criteria against codebase
|
|
372
349
|
let livingSpecReport = null;
|
|
373
350
|
if (livingSpec) {
|
|
@@ -379,7 +356,6 @@ export async function handleReconcileSpec(params, server) {
|
|
|
379
356
|
const result = {
|
|
380
357
|
...report,
|
|
381
358
|
versionCreated: createdVersion,
|
|
382
|
-
changelogUpdated,
|
|
383
359
|
specBodyWritten,
|
|
384
360
|
...(bodySkippedChanges.length > 0 ? { skippedTextChanges: bodySkippedChanges } : {}),
|
|
385
361
|
...(livingSpecReport ? { livingSpec: livingSpecReport } : {}),
|
|
@@ -410,9 +386,6 @@ export async function handleReconcileSpec(params, server) {
|
|
|
410
386
|
if (result.versionCreated !== null) {
|
|
411
387
|
summaryLines.push(`**${t('tools.reconcileSpec.versionCreated')}:** v${String(result.versionCreated)}`);
|
|
412
388
|
}
|
|
413
|
-
if (result.changelogUpdated) {
|
|
414
|
-
summaryLines.push(`**${t('tools.reconcileSpec.changelogUpdated')}:** ${t('tools.reconcileSpec.yes')}`);
|
|
415
|
-
}
|
|
416
389
|
if (result.livingSpec) {
|
|
417
390
|
summaryLines.push(`**${t('tools.reconcileSpec.livingSpec')}:** ${String(result.livingSpec.completionPercent)}% ${t('tools.reconcileSpec.coverage')}`);
|
|
418
391
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { safeGoverned, safeTracked } from './safe-handler.js';
|
|
3
3
|
import { SpecIdSchema } from './schemas/index.js';
|
|
4
4
|
import { onAutopilotEvent } from '../engine/autopilot/event-bus.js';
|
|
5
5
|
import { dispatchSquadForPhase } from '../engine/agent-squad/dispatcher.js';
|
|
@@ -83,7 +83,7 @@ export function registerAgentSquadTools(server) {
|
|
|
83
83
|
.boolean()
|
|
84
84
|
.describe('Set to true to enable the agent, false to disable it for this project.'),
|
|
85
85
|
},
|
|
86
|
-
},
|
|
86
|
+
}, safeGoverned('configure_squad', async (args) => {
|
|
87
87
|
const { projectPath, agentId, enabled } = args;
|
|
88
88
|
const projectId = hashProjectPath(projectPath);
|
|
89
89
|
await setAgentEnabled(projectId, agentId, enabled);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { t } from '../../i18n/index.js';
|
|
3
|
-
import { safeTracked,
|
|
3
|
+
import { safeTracked, safeGoverned } from '../safe-handler.js';
|
|
4
4
|
import { AgentPlatformEnum, SubAgentFrameworkEnum, ChallengeSpecFocusEnum, SpecIdSchema, } from '../schemas/index.js';
|
|
5
5
|
import { handleGenerateADR } from '../generate-adr.js';
|
|
6
6
|
import { handleDesignSchema } from '../design-schema.js';
|
|
@@ -33,7 +33,7 @@ export function registerDesignStackTools(server) {
|
|
|
33
33
|
.optional()
|
|
34
34
|
.describe('Specific decisions to document'),
|
|
35
35
|
},
|
|
36
|
-
},
|
|
36
|
+
}, safeGoverned('generate_adr', async (args) => handleGenerateADR(args)));
|
|
37
37
|
// 21. design_schema
|
|
38
38
|
server.registerTool('design_schema', {
|
|
39
39
|
description: t('tools.design_schema.description'),
|
|
@@ -47,7 +47,7 @@ export function registerDesignStackTools(server) {
|
|
|
47
47
|
.optional()
|
|
48
48
|
.describe('Additional schema context or requirements'),
|
|
49
49
|
},
|
|
50
|
-
},
|
|
50
|
+
}, safeGoverned('design_schema', async (args) => handleDesignSchema(args)));
|
|
51
51
|
// 22. define_ui_contract
|
|
52
52
|
server.registerTool('define_ui_contract', {
|
|
53
53
|
description: t('tools.define_ui_contract.description'),
|
|
@@ -61,7 +61,7 @@ export function registerDesignStackTools(server) {
|
|
|
61
61
|
.optional()
|
|
62
62
|
.describe('Specific screens to define contracts for'),
|
|
63
63
|
},
|
|
64
|
-
},
|
|
64
|
+
}, safeGoverned('define_ui_contract', async (args) => handleDefineUIContract(args)));
|
|
65
65
|
// 23. challenge_spec
|
|
66
66
|
server.registerTool('challenge_spec', {
|
|
67
67
|
description: t('tools.challenge_spec.description'),
|
|
@@ -84,7 +84,7 @@ export function registerDesignStackTools(server) {
|
|
|
84
84
|
.optional()
|
|
85
85
|
.describe('Focus areas for the challenge'),
|
|
86
86
|
},
|
|
87
|
-
},
|
|
87
|
+
}, safeGoverned('challenge_spec', async (args) => handleChallengeSpec(args)));
|
|
88
88
|
// 24. generate_execution_plan
|
|
89
89
|
server.registerTool('generate_execution_plan', {
|
|
90
90
|
description: t('tools.generate_execution_plan.description'),
|
|
@@ -147,7 +147,7 @@ export function registerDesignStackTools(server) {
|
|
|
147
147
|
description: z.string().max(10_000).describe('Skill description'),
|
|
148
148
|
specId: SpecIdSchema.optional().describe('Spec ID for context'),
|
|
149
149
|
},
|
|
150
|
-
},
|
|
150
|
+
}, safeGoverned('generate_skill', async (args) => handleGenerateSkill(args)));
|
|
151
151
|
// 28. detect_agent
|
|
152
152
|
server.registerTool('detect_agent', {
|
|
153
153
|
description: t('tools.detect_agent.description'),
|
|
@@ -155,7 +155,7 @@ export function registerDesignStackTools(server) {
|
|
|
155
155
|
inputSchema: {
|
|
156
156
|
projectId: z.string().max(500).describe('Project ID'),
|
|
157
157
|
},
|
|
158
|
-
},
|
|
158
|
+
}, safeGoverned('detect_agent', async (args) => handleDetectAgent(args)));
|
|
159
159
|
// 29. generate_sub_agent
|
|
160
160
|
server.registerTool('generate_sub_agent', {
|
|
161
161
|
description: t('tools.generate_sub_agent.description'),
|
|
@@ -177,7 +177,7 @@ export function registerDesignStackTools(server) {
|
|
|
177
177
|
.optional()
|
|
178
178
|
.describe('When true, adds autoMemory: true to the agent frontmatter and includes memory path info in the response'),
|
|
179
179
|
},
|
|
180
|
-
},
|
|
180
|
+
}, safeGoverned('generate_sub_agent', async (args) => handleGenerateSubAgent(args)));
|
|
181
181
|
// 30. generate_rules
|
|
182
182
|
server.registerTool('generate_rules', {
|
|
183
183
|
description: t('tools.generate_rules.description'),
|
|
@@ -201,7 +201,7 @@ export function registerDesignStackTools(server) {
|
|
|
201
201
|
.optional()
|
|
202
202
|
.describe('Additional custom rules'),
|
|
203
203
|
},
|
|
204
|
-
},
|
|
204
|
+
}, safeGoverned('generate_rules', async (args) => handleGenerateRules(args)));
|
|
205
205
|
// 31. generate_orchestration_script
|
|
206
206
|
server.registerTool('generate_orchestration_script', {
|
|
207
207
|
description: t('tools.generate_orchestration_script.description'),
|
|
@@ -220,7 +220,7 @@ export function registerDesignStackTools(server) {
|
|
|
220
220
|
.optional()
|
|
221
221
|
.describe('Base branch for worktrees (default: develop)'),
|
|
222
222
|
},
|
|
223
|
-
},
|
|
223
|
+
}, safeGoverned('generate_orchestration_script', (args) => Promise.resolve(handleGenerateOrchestrationScript(args))));
|
|
224
224
|
// 32. red_team
|
|
225
225
|
server.registerTool('red_team', {
|
|
226
226
|
description: 'Adversarial review — argues against the spec from first principles before approval. Runs pre-mortem, surfaces hidden assumptions, proposes alternatives.',
|
|
@@ -233,6 +233,6 @@ export function registerDesignStackTools(server) {
|
|
|
233
233
|
.optional()
|
|
234
234
|
.describe('light: top objections only (default). full: exhaustive analysis across all 6 lenses'),
|
|
235
235
|
},
|
|
236
|
-
},
|
|
236
|
+
}, safeGoverned('red_team', async (args) => handleRedTeam(args)));
|
|
237
237
|
}
|
|
238
238
|
//# sourceMappingURL=design-stack-tools.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { t } from '../../i18n/index.js';
|
|
3
|
-
import { safeTracked,
|
|
3
|
+
import { safeTracked, safeGoverned } from '../safe-handler.js';
|
|
4
4
|
import { DocumentationTypeEnum, GitActionEnum, DevLifecycleCategoryEnum, PMPlatformEnum, PMActionEnum, OrchestrateActionEnum, ManageContextActionEnum, ContextBudgetActionEnum, SpecIdSchema, } from '../schemas/index.js';
|
|
5
5
|
import { handleSuggestTooling } from '../suggest-tooling.js';
|
|
6
6
|
import { handleGenerateTests } from '../generate-tests.js';
|
|
@@ -27,7 +27,7 @@ export function registerLifecycleInfraTools(server) {
|
|
|
27
27
|
.optional()
|
|
28
28
|
.describe('Specific categories to assess'),
|
|
29
29
|
},
|
|
30
|
-
},
|
|
30
|
+
}, safeGoverned('suggest_tooling', async (args) => handleSuggestTooling(args)));
|
|
31
31
|
// 32. generate_tests
|
|
32
32
|
server.registerTool('generate_tests', {
|
|
33
33
|
description: t('tools.generate_tests.description'),
|
|
@@ -80,7 +80,7 @@ export function registerLifecycleInfraTools(server) {
|
|
|
80
80
|
.describe('Content to save (required for save action)'),
|
|
81
81
|
ttlDays: z.number().optional().describe('Time-to-live in days (optional for save)'),
|
|
82
82
|
},
|
|
83
|
-
},
|
|
83
|
+
}, safeGoverned('manage_context', async (args) => handleManageContext(args)));
|
|
84
84
|
// 35. manage_git
|
|
85
85
|
server.registerTool('manage_git', {
|
|
86
86
|
description: t('tools.manage_git.description'),
|
|
@@ -154,7 +154,7 @@ export function registerLifecycleInfraTools(server) {
|
|
|
154
154
|
eventType: z.string().max(500).optional().describe('Journal event type for emit action'),
|
|
155
155
|
commitHash: z.string().max(500).optional().describe('Commit hash to record in journal'),
|
|
156
156
|
},
|
|
157
|
-
},
|
|
157
|
+
}, safeGoverned('orchestrate', async (args) => handleOrchestrate(args)));
|
|
158
158
|
// 37. integrate_pm
|
|
159
159
|
server.registerTool('integrate_pm', {
|
|
160
160
|
description: t('tools.integrate_pm.description'),
|
|
@@ -169,7 +169,7 @@ export function registerLifecycleInfraTools(server) {
|
|
|
169
169
|
.optional()
|
|
170
170
|
.describe('Platform-specific configuration'),
|
|
171
171
|
},
|
|
172
|
-
},
|
|
172
|
+
}, safeGoverned('integrate_pm', async (args) => handleIntegratePM(args)));
|
|
173
173
|
// 38. paradigm_report
|
|
174
174
|
server.registerTool('paradigm_report', {
|
|
175
175
|
description: t('tools.paradigm_report.description'),
|
|
@@ -177,7 +177,7 @@ export function registerLifecycleInfraTools(server) {
|
|
|
177
177
|
projectId: z.string().max(500).describe('Project ID to analyse for paradigms'),
|
|
178
178
|
},
|
|
179
179
|
annotations: { readOnlyHint: true },
|
|
180
|
-
},
|
|
180
|
+
}, safeGoverned('paradigm_report', async (args) => handleParadigmReport(args)));
|
|
181
181
|
// 39. context_budget
|
|
182
182
|
server.registerTool('context_budget', {
|
|
183
183
|
description: t('tools.context_budget.description'),
|
|
@@ -232,6 +232,6 @@ export function registerLifecycleInfraTools(server) {
|
|
|
232
232
|
.optional()
|
|
233
233
|
.describe('Pending work items'),
|
|
234
234
|
},
|
|
235
|
-
},
|
|
235
|
+
}, safeGoverned('context_budget', async (args) => handleContextBudget(args)));
|
|
236
236
|
}
|
|
237
237
|
//# sourceMappingURL=lifecycle-infra-tools.js.map
|