@planu/cli 4.14.1 → 5.1.1
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 +82 -0
- 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 +12 -3
- 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 +33 -19
- 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 +12 -1
- package/dist/engine/evidence-gates/artifact-reader.js +174 -4
- package/dist/engine/evidence-gates/evidence-autofill.d.ts +10 -0
- package/dist/engine/evidence-gates/evidence-autofill.js +148 -0
- package/dist/engine/evidence-gates/evidence-skeletons.d.ts +19 -0
- package/dist/engine/evidence-gates/evidence-skeletons.js +69 -0
- 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/operation-journal.js +10 -4
- 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/minimality/policy-loader.js +247 -6
- 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 +20 -20
- package/dist/engine/planu-core.darwin-x64.node.manifest.json +7 -7
- package/dist/engine/planu-core.darwin-x64.node.sbom.json +20 -20
- package/dist/engine/planu-core.linux-arm64-gnu.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-arm64-gnu.node.sbom.json +20 -20
- package/dist/engine/planu-core.linux-arm64-musl.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-arm64-musl.node.sbom.json +20 -20
- package/dist/engine/planu-core.linux-x64-gnu.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-x64-gnu.node.sbom.json +20 -20
- package/dist/engine/planu-core.linux-x64-musl.node.manifest.json +7 -7
- package/dist/engine/planu-core.linux-x64-musl.node.sbom.json +20 -20
- package/dist/engine/planu-core.win32-arm64-msvc.node.manifest.json +7 -7
- package/dist/engine/planu-core.win32-arm64-msvc.node.sbom.json +20 -20
- package/dist/engine/planu-core.win32-x64-msvc.node.manifest.json +7 -7
- package/dist/engine/planu-core.win32-x64-msvc.node.sbom.json +20 -20
- package/dist/engine/readiness-checker.d.ts +1 -16
- package/dist/engine/readiness-checker.js +27 -88
- package/dist/engine/reverse-engineer/api-detector.js +2 -13
- package/dist/engine/reverse-engineer/complexity-analyzer.js +2 -13
- package/dist/engine/reverse-engineer/config-analyzer.js +2 -13
- package/dist/engine/reverse-engineer/dependency-graph.js +2 -13
- package/dist/engine/reverse-engineer/test-analyzer.js +2 -13
- package/dist/engine/reverse-engineer/walk-ignore.d.ts +3 -0
- package/dist/engine/reverse-engineer/walk-ignore.js +26 -0
- 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 +82 -22
- 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/text-fences.js +20 -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/spec-state-syncer.js +1 -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 +31 -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 +13 -1
- 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-helpers.d.ts +10 -1
- package/dist/tools/challenge-spec-helpers.js +63 -22
- package/dist/tools/challenge-spec.js +23 -8
- package/dist/tools/check-readiness.js +38 -14
- package/dist/tools/configure-telemetry.js +30 -2
- package/dist/tools/create-spec/spec-builder.d.ts +7 -0
- package/dist/tools/create-spec/spec-builder.js +19 -15
- package/dist/tools/create-spec.d.ts +1 -0
- package/dist/tools/create-spec.js +584 -309
- 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 +29 -19
- 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 +50 -2
- 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/batch.d.ts +6 -2
- package/dist/tools/update-status/batch.js +58 -1
- package/dist/tools/update-status/dod-gates.d.ts +16 -1
- package/dist/tools/update-status/dod-gates.js +191 -1
- package/dist/tools/update-status/done-receipt-verifier.d.ts +8 -0
- package/dist/tools/update-status/done-receipt-verifier.js +75 -27
- package/dist/tools/update-status/evidence-gate.d.ts +4 -0
- package/dist/tools/update-status/evidence-gate.js +103 -3
- package/dist/tools/update-status/file-sync.d.ts +4 -3
- package/dist/tools/update-status/file-sync.js +57 -6
- package/dist/tools/update-status/index.d.ts +25 -1
- package/dist/tools/update-status/index.js +292 -78
- 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 +45 -16
- 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/tools/workspace-dashboard-handler.js +38 -0
- 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-autofill.d.ts +34 -0
- package/dist/types/evidence-autofill.js +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 +3 -6
- package/dist/types/index.js +2 -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 +20 -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 +35 -1
- package/dist/types/spec-format.d.ts +25 -1
- package/dist/types/telemetry.d.ts +4 -1
- package/dist/types/transition-log.d.ts +1 -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 +10 -4
- package/package.json +17 -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,195 +0,0 @@
|
|
|
1
|
-
// @crash-shield-ignore-file — config/cache reader for Planu-controlled JSON; writer is this codebase, shape guaranteed by build/seed.
|
|
2
|
-
// engine/ai-integration/gemini/settings-generator.ts — Gemini settings generator (SPEC-267)
|
|
3
|
-
import { writeFileSync, mkdirSync, existsSync, readFileSync } from 'node:fs';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
const HOOK_SCRIPTS_DIR = '.gemini/hooks';
|
|
6
|
-
// Shell scripts stored as plain strings — bash $ chars must NOT be template-interpolated
|
|
7
|
-
const HOOK_SCRIPT_SESSION_START = [
|
|
8
|
-
'#!/usr/bin/env bash',
|
|
9
|
-
'# Injected by Planu — session-start.sh',
|
|
10
|
-
'BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")',
|
|
11
|
-
'SPEC=$(echo "$BRANCH" | grep -oE \'SPEC-[0-9]+\' || echo "")',
|
|
12
|
-
'if [ -n "$SPEC" ]; then',
|
|
13
|
-
' echo "Active spec: $SPEC | Branch: $BRANCH"',
|
|
14
|
-
'else',
|
|
15
|
-
' echo "No active spec branch. Create a spec first."',
|
|
16
|
-
'fi',
|
|
17
|
-
].join('\n');
|
|
18
|
-
const HOOK_SCRIPT_SESSION_END = [
|
|
19
|
-
'#!/usr/bin/env bash',
|
|
20
|
-
'# session-end.sh — optionally auto-commit planu/ changes',
|
|
21
|
-
'if [ "$PLANU_ENABLE_AUTOCOMMIT" != "true" ]; then',
|
|
22
|
-
' exit 0',
|
|
23
|
-
'fi',
|
|
24
|
-
'if git diff --quiet HEAD -- planu/ 2>/dev/null; then',
|
|
25
|
-
' exit 0',
|
|
26
|
-
'fi',
|
|
27
|
-
'git add planu/specs/ planu/conventions.json && git commit -m "chore: auto-save planu session state" --no-verify 2>/dev/null || true',
|
|
28
|
-
].join('\n');
|
|
29
|
-
const HOOK_SCRIPT_BEFORE_AGENT = [
|
|
30
|
-
'#!/usr/bin/env bash',
|
|
31
|
-
'# before-agent.sh — inject active spec context',
|
|
32
|
-
'BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")',
|
|
33
|
-
'SPEC=$(echo "$BRANCH" | grep -oE \'SPEC-[0-9]+\' || echo "")',
|
|
34
|
-
'[ -n "$SPEC" ] && echo "Spec in scope: $SPEC" || echo "No spec branch active."',
|
|
35
|
-
].join('\n');
|
|
36
|
-
const HOOK_SCRIPT_NOOP = [
|
|
37
|
-
'#!/usr/bin/env bash',
|
|
38
|
-
'# noop.sh — placeholder for future hooks',
|
|
39
|
-
'exit 0',
|
|
40
|
-
].join('\n');
|
|
41
|
-
const HOOK_SCRIPT_BEFORE_TOOL_SELECTION = [
|
|
42
|
-
'#!/usr/bin/env bash',
|
|
43
|
-
'# before-tool-selection.sh — warn if no spec branch for write ops',
|
|
44
|
-
'BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")',
|
|
45
|
-
'if echo "$BRANCH" | grep -qE \'feat/SPEC-|fix/SPEC-\'; then',
|
|
46
|
-
' exit 0',
|
|
47
|
-
'fi',
|
|
48
|
-
'echo "WARNING: No spec branch active. Writing code without a spec is discouraged."',
|
|
49
|
-
].join('\n');
|
|
50
|
-
const HOOK_SCRIPT_BEFORE_TOOL = [
|
|
51
|
-
'#!/usr/bin/env bash',
|
|
52
|
-
'# before-tool.sh — scan for destructive operations',
|
|
53
|
-
'TOOL_NAME="${TOOL_NAME:-}"',
|
|
54
|
-
'if echo "$TOOL_NAME" | grep -qiE \'delete|remove|drop|truncate\'; then',
|
|
55
|
-
' echo "WARNING: Destructive operation detected: $TOOL_NAME"',
|
|
56
|
-
'fi',
|
|
57
|
-
].join('\n');
|
|
58
|
-
const HOOK_SCRIPT_AFTER_TOOL = [
|
|
59
|
-
'#!/usr/bin/env bash',
|
|
60
|
-
'# after-tool.sh — verify spec when modifying src/',
|
|
61
|
-
'TOOL_INPUT="${TOOL_INPUT:-}"',
|
|
62
|
-
'if echo "$TOOL_INPUT" | grep -q \'src/\'; then',
|
|
63
|
-
' BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")',
|
|
64
|
-
' if ! echo "$BRANCH" | grep -qE \'feat/SPEC-|fix/SPEC-\'; then',
|
|
65
|
-
' echo "NOTICE: src/ modified outside a spec branch."',
|
|
66
|
-
' fi',
|
|
67
|
-
'fi',
|
|
68
|
-
].join('\n');
|
|
69
|
-
const HOOK_SCRIPT_PRE_COMPRESS = [
|
|
70
|
-
'#!/usr/bin/env bash',
|
|
71
|
-
'# pre-compress.sh — trigger session_checkpoint',
|
|
72
|
-
'echo "Session checkpoint triggered before context compression."',
|
|
73
|
-
].join('\n');
|
|
74
|
-
const HOOK_SCRIPT_NOTIFICATION = [
|
|
75
|
-
'#!/usr/bin/env bash',
|
|
76
|
-
'# notification.sh — show approved specs queue when idle',
|
|
77
|
-
'echo "Planu queue: run \'list_specs --status approved\' to see pending specs."',
|
|
78
|
-
].join('\n');
|
|
79
|
-
function buildHooks() {
|
|
80
|
-
return [
|
|
81
|
-
{
|
|
82
|
-
event: 'SessionStart',
|
|
83
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/session-start.sh`,
|
|
84
|
-
timeout: 5000,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
event: 'SessionEnd',
|
|
88
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/session-end.sh`,
|
|
89
|
-
timeout: 10000,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
event: 'BeforeAgent',
|
|
93
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/before-agent.sh`,
|
|
94
|
-
timeout: 5000,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
event: 'AfterAgent',
|
|
98
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/noop.sh`,
|
|
99
|
-
timeout: 1000,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
event: 'BeforeModel',
|
|
103
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/noop.sh`,
|
|
104
|
-
timeout: 1000,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
event: 'AfterModel',
|
|
108
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/noop.sh`,
|
|
109
|
-
timeout: 1000,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
event: 'BeforeToolSelection',
|
|
113
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/before-tool-selection.sh`,
|
|
114
|
-
timeout: 3000,
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
event: 'BeforeTool',
|
|
118
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/before-tool.sh`,
|
|
119
|
-
timeout: 3000,
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
event: 'AfterTool',
|
|
123
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/after-tool.sh`,
|
|
124
|
-
timeout: 3000,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
event: 'PreCompress',
|
|
128
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/pre-compress.sh`,
|
|
129
|
-
timeout: 10000,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
event: 'Notification',
|
|
133
|
-
command: `bash ${HOOK_SCRIPTS_DIR}/notification.sh`,
|
|
134
|
-
timeout: 3000,
|
|
135
|
-
},
|
|
136
|
-
];
|
|
137
|
-
}
|
|
138
|
-
function buildHookScripts() {
|
|
139
|
-
return {
|
|
140
|
-
'session-start.sh': HOOK_SCRIPT_SESSION_START,
|
|
141
|
-
'session-end.sh': HOOK_SCRIPT_SESSION_END,
|
|
142
|
-
'before-agent.sh': HOOK_SCRIPT_BEFORE_AGENT,
|
|
143
|
-
'noop.sh': HOOK_SCRIPT_NOOP,
|
|
144
|
-
'before-tool-selection.sh': HOOK_SCRIPT_BEFORE_TOOL_SELECTION,
|
|
145
|
-
'before-tool.sh': HOOK_SCRIPT_BEFORE_TOOL,
|
|
146
|
-
'after-tool.sh': HOOK_SCRIPT_AFTER_TOOL,
|
|
147
|
-
'pre-compress.sh': HOOK_SCRIPT_PRE_COMPRESS,
|
|
148
|
-
'notification.sh': HOOK_SCRIPT_NOTIFICATION,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
export function generateGeminiSettings(_projectPath) {
|
|
152
|
-
return {
|
|
153
|
-
hooks: buildHooks(),
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
export function writeGeminiSettings(projectPath) {
|
|
157
|
-
const geminiDir = join(projectPath, '.gemini');
|
|
158
|
-
const hooksDir = join(projectPath, HOOK_SCRIPTS_DIR);
|
|
159
|
-
/* v8 ignore start */
|
|
160
|
-
if (!existsSync(geminiDir)) {
|
|
161
|
-
mkdirSync(geminiDir, { recursive: true });
|
|
162
|
-
}
|
|
163
|
-
if (!existsSync(hooksDir)) {
|
|
164
|
-
mkdirSync(hooksDir, { recursive: true });
|
|
165
|
-
}
|
|
166
|
-
/* v8 ignore stop */
|
|
167
|
-
const settingsPath = join(geminiDir, 'settings.json');
|
|
168
|
-
const settings = generateGeminiSettings(projectPath);
|
|
169
|
-
let existing = {};
|
|
170
|
-
/* v8 ignore start */
|
|
171
|
-
if (existsSync(settingsPath)) {
|
|
172
|
-
try {
|
|
173
|
-
existing = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
174
|
-
}
|
|
175
|
-
catch {
|
|
176
|
-
// ignore malformed JSON — overwrite
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/* v8 ignore stop */
|
|
180
|
-
const merged = {
|
|
181
|
-
...existing,
|
|
182
|
-
hooks: settings.hooks,
|
|
183
|
-
};
|
|
184
|
-
writeFileSync(settingsPath, JSON.stringify(merged, null, 2) + '\n', 'utf8');
|
|
185
|
-
const scripts = buildHookScripts();
|
|
186
|
-
for (const [filename, content] of Object.entries(scripts)) {
|
|
187
|
-
const scriptPath = join(hooksDir, filename);
|
|
188
|
-
/* v8 ignore start */
|
|
189
|
-
if (!existsSync(scriptPath)) {
|
|
190
|
-
writeFileSync(scriptPath, content, { encoding: 'utf8', mode: 0o755 });
|
|
191
|
-
}
|
|
192
|
-
/* v8 ignore stop */
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
//# sourceMappingURL=settings-generator.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { KiroHookDefinition } from '../../../types/kiro-integration.js';
|
|
2
|
-
/** Returns the standard set of Kiro hooks for Planu SDD workflow. */
|
|
3
|
-
export declare function generateKiroHooks(): KiroHookDefinition[];
|
|
4
|
-
/** Writes .kiro/hooks/planu-*.yaml files to the given project path */
|
|
5
|
-
export declare function writeKiroHooks(projectPath: string): void;
|
|
6
|
-
//# sourceMappingURL=hooks-generator.d.ts.map
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// engine/ai-integration/kiro/hooks-generator.ts — Kiro hooks generator (SPEC-270)
|
|
2
|
-
import { writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
const PROMPT_INJECT_SCRIPT = [
|
|
5
|
-
'SPEC=$(planu list --status=approved --compact 2>/dev/null | head -5 || echo "No approved specs");',
|
|
6
|
-
'BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown");',
|
|
7
|
-
'echo "=== Planu Context ===";',
|
|
8
|
-
'echo "Branch: $BRANCH";',
|
|
9
|
-
'echo "Approved specs: $SPEC"',
|
|
10
|
-
].join(' ');
|
|
11
|
-
const POST_TOOL_SCRIPT = [
|
|
12
|
-
'if echo "$KIRO_TOOL_NAME" | grep -qE "write|edit|create"; then',
|
|
13
|
-
' if echo "$KIRO_TOOL_PATH" | grep -qE "^src/"; then',
|
|
14
|
-
' planu validate --quick 2>/dev/null || echo "Reminder: validate spec compliance after editing src/";',
|
|
15
|
-
' fi;',
|
|
16
|
-
'fi',
|
|
17
|
-
].join(' ');
|
|
18
|
-
const STOP_SCRIPT = [
|
|
19
|
-
'planu session_checkpoint --auto 2>/dev/null;',
|
|
20
|
-
'if [ -d "planu/" ]; then',
|
|
21
|
-
' if [ "$PLANU_ENABLE_AUTOCOMMIT" != "true" ]; then exit 0; fi;',
|
|
22
|
-
' git add planu/specs/ planu/conventions.json 2>/dev/null;',
|
|
23
|
-
' git diff --staged --quiet || git commit -m "chore: auto-save planu state [kiro]" 2>/dev/null;',
|
|
24
|
-
'fi',
|
|
25
|
-
].join(' ');
|
|
26
|
-
/** Returns the standard set of Kiro hooks for Planu SDD workflow. */
|
|
27
|
-
export function generateKiroHooks() {
|
|
28
|
-
return [
|
|
29
|
-
{
|
|
30
|
-
id: 'planu-prompt-inject',
|
|
31
|
-
event: 'userPromptSubmit',
|
|
32
|
-
description: 'Inject active spec context into every Kiro prompt',
|
|
33
|
-
script: PROMPT_INJECT_SCRIPT,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: 'planu-post-tool',
|
|
37
|
-
event: 'postToolUse',
|
|
38
|
-
description: 'Auto-validate spec compliance after file writes to src/',
|
|
39
|
-
script: POST_TOOL_SCRIPT,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: 'planu-stop',
|
|
43
|
-
event: 'stop',
|
|
44
|
-
description: 'Save session checkpoint and optionally auto-commit planu state on session end',
|
|
45
|
-
script: STOP_SCRIPT,
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
function buildHookYaml(hook) {
|
|
50
|
-
const lines = [
|
|
51
|
-
`id: ${hook.id}`,
|
|
52
|
-
`event: ${hook.event}`,
|
|
53
|
-
`description: "${hook.description}"`,
|
|
54
|
-
'script: |',
|
|
55
|
-
];
|
|
56
|
-
for (const line of hook.script.split(' ')) {
|
|
57
|
-
lines.push(` ${line}`);
|
|
58
|
-
}
|
|
59
|
-
return lines.join('\n');
|
|
60
|
-
}
|
|
61
|
-
/** Writes .kiro/hooks/planu-*.yaml files to the given project path */
|
|
62
|
-
export function writeKiroHooks(projectPath) {
|
|
63
|
-
const hooksDir = join(projectPath, '.kiro', 'hooks');
|
|
64
|
-
/* v8 ignore start */
|
|
65
|
-
if (!existsSync(hooksDir)) {
|
|
66
|
-
mkdirSync(hooksDir, { recursive: true });
|
|
67
|
-
}
|
|
68
|
-
/* v8 ignore stop */
|
|
69
|
-
const hooks = generateKiroHooks();
|
|
70
|
-
for (const hook of hooks) {
|
|
71
|
-
const yaml = buildHookYaml(hook);
|
|
72
|
-
writeFileSync(join(hooksDir, `${hook.id}.yaml`), yaml + '\n', 'utf8');
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=hooks-generator.js.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { FullSpectrumHookConfig, HookScript } from '../../types/hooks-advanced.js';
|
|
2
|
-
/**
|
|
3
|
-
* Generates the Stop hook script. Planu housekeeping is opt-in so generated
|
|
4
|
-
* hooks cannot silently stage or commit user branches.
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateStopHookScript(projectPath: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Generates the PreCompact hook script — queues a session_checkpoint action.
|
|
9
|
-
*/
|
|
10
|
-
export declare function generatePreCompactHookScript(): string;
|
|
11
|
-
/**
|
|
12
|
-
* Generates the UserPromptSubmit hook script — injects active spec context.
|
|
13
|
-
*/
|
|
14
|
-
export declare function generateUserPromptSubmitHookScript(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Generates the Notification hook script — shown when Claude is idle.
|
|
17
|
-
*/
|
|
18
|
-
export declare function generateNotificationHookScript(): string;
|
|
19
|
-
/**
|
|
20
|
-
* Generates WorktreeCreate and WorktreeRemove hook scripts.
|
|
21
|
-
*/
|
|
22
|
-
export declare function generateWorktreeHookScripts(): {
|
|
23
|
-
create: string;
|
|
24
|
-
remove: string;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Generates all requested hook scripts based on the supplied config.
|
|
28
|
-
* Returns an array of HookScript objects, one per enabled hook type.
|
|
29
|
-
* The projectPath is used only for the Stop hook script.
|
|
30
|
-
*/
|
|
31
|
-
export declare function generateFullSpectrumHooks(config: FullSpectrumHookConfig, projectPath?: string): HookScript[];
|
|
32
|
-
//# sourceMappingURL=full-spectrum-generator.d.ts.map
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// engine/hooks/full-spectrum-generator.ts — Full-spectrum Claude Code hook generator (SPEC-265)
|
|
2
|
-
// ---------------------------------------------------------------------------
|
|
3
|
-
// Individual script builders
|
|
4
|
-
// ---------------------------------------------------------------------------
|
|
5
|
-
/**
|
|
6
|
-
* Generates the Stop hook script. Planu housekeeping is opt-in so generated
|
|
7
|
-
* hooks cannot silently stage or commit user branches.
|
|
8
|
-
*/
|
|
9
|
-
export function generateStopHookScript(projectPath) {
|
|
10
|
-
return `#!/bin/bash
|
|
11
|
-
# Optionally auto-commit planu/ if explicitly enabled (Planu Stop hook)
|
|
12
|
-
cd "${projectPath}"
|
|
13
|
-
if [ "$PLANU_ENABLE_AUTOCOMMIT" != "true" ]; then exit 0; fi
|
|
14
|
-
if git diff --quiet planu/ 2>/dev/null; then exit 0; fi
|
|
15
|
-
git add planu/specs/ planu/conventions.json && git commit -m "chore(planu): auto-commit session state [skip ci]" --no-verify
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Generates the PreCompact hook script — queues a session_checkpoint action.
|
|
20
|
-
*/
|
|
21
|
-
export function generatePreCompactHookScript() {
|
|
22
|
-
return `#!/bin/bash
|
|
23
|
-
# Queue session_checkpoint before context compression (Planu PreCompact hook)
|
|
24
|
-
echo '{"tool":"session_checkpoint","note":"auto-checkpoint before context compression"}' >> /tmp/planu-pending-actions.json
|
|
25
|
-
`;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Generates the UserPromptSubmit hook script — injects active spec context.
|
|
29
|
-
*/
|
|
30
|
-
export function generateUserPromptSubmitHookScript() {
|
|
31
|
-
return `#!/bin/bash
|
|
32
|
-
# Inject active spec context on each prompt (Planu UserPromptSubmit hook)
|
|
33
|
-
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
|
|
34
|
-
SPEC_ID=$(echo "$BRANCH" | grep -oE 'SPEC-[0-9]+' | head -1)
|
|
35
|
-
if [ -n "$SPEC_ID" ]; then
|
|
36
|
-
echo "## Active spec: $SPEC_ID | Branch: $BRANCH"
|
|
37
|
-
fi
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Generates the Notification hook script — shown when Claude is idle.
|
|
42
|
-
*/
|
|
43
|
-
export function generateNotificationHookScript() {
|
|
44
|
-
return `#!/bin/bash
|
|
45
|
-
# Show pending approved specs when Claude is idle (Planu Notification hook)
|
|
46
|
-
# Non-blocking: only outputs if there are pending specs
|
|
47
|
-
true
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Generates WorktreeCreate and WorktreeRemove hook scripts.
|
|
52
|
-
*/
|
|
53
|
-
export function generateWorktreeHookScripts() {
|
|
54
|
-
const create = `#!/bin/bash
|
|
55
|
-
# Log worktree creation in shared-context (Planu WorktreeCreate hook)
|
|
56
|
-
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Worktree created: $CLAUDE_WORKTREE_PATH" >> .claude/shared-context.md 2>/dev/null || true
|
|
57
|
-
`;
|
|
58
|
-
const remove = `#!/bin/bash
|
|
59
|
-
# Log worktree removal in shared-context (Planu WorktreeRemove hook)
|
|
60
|
-
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] Worktree removed: $CLAUDE_WORKTREE_PATH" >> .claude/shared-context.md 2>/dev/null || true
|
|
61
|
-
`;
|
|
62
|
-
return { create, remove };
|
|
63
|
-
}
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
// Public aggregator
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
/**
|
|
68
|
-
* Generates all requested hook scripts based on the supplied config.
|
|
69
|
-
* Returns an array of HookScript objects, one per enabled hook type.
|
|
70
|
-
* The projectPath is used only for the Stop hook script.
|
|
71
|
-
*/
|
|
72
|
-
export function generateFullSpectrumHooks(config, projectPath = '$CLAUDE_PROJECT_PATH') {
|
|
73
|
-
const scripts = [];
|
|
74
|
-
if (config.stopHook) {
|
|
75
|
-
scripts.push({
|
|
76
|
-
eventType: 'Stop',
|
|
77
|
-
scriptContent: generateStopHookScript(projectPath),
|
|
78
|
-
description: 'Optionally auto-commits planu/ changes at session end when enabled.',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (config.preCompactHook) {
|
|
82
|
-
scripts.push({
|
|
83
|
-
eventType: 'PreCompact',
|
|
84
|
-
scriptContent: generatePreCompactHookScript(),
|
|
85
|
-
description: 'Queues a session_checkpoint before context compression.',
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
if (config.userPromptSubmitHook) {
|
|
89
|
-
scripts.push({
|
|
90
|
-
eventType: 'UserPromptSubmit',
|
|
91
|
-
scriptContent: generateUserPromptSubmitHookScript(),
|
|
92
|
-
description: 'Injects active spec/branch context into each prompt.',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (config.notificationHook) {
|
|
96
|
-
scripts.push({
|
|
97
|
-
eventType: 'Notification',
|
|
98
|
-
scriptContent: generateNotificationHookScript(),
|
|
99
|
-
description: 'Shows pending approved specs when Claude is idle.',
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
if (config.worktreeHooks) {
|
|
103
|
-
const { create, remove } = generateWorktreeHookScripts();
|
|
104
|
-
scripts.push({
|
|
105
|
-
eventType: 'WorktreeCreate',
|
|
106
|
-
scriptContent: create,
|
|
107
|
-
description: 'Logs worktree creation in .claude/shared-context.md.',
|
|
108
|
-
});
|
|
109
|
-
scripts.push({
|
|
110
|
-
eventType: 'WorktreeRemove',
|
|
111
|
-
scriptContent: remove,
|
|
112
|
-
description: 'Logs worktree removal in .claude/shared-context.md.',
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return scripts;
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=full-spectrum-generator.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// engine/license-validator/config-loader.ts — Loads and caches license-plans.json config.
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
const require = createRequire(import.meta.url);
|
|
4
|
-
let cached = null;
|
|
5
|
-
export function loadLicensePlans() {
|
|
6
|
-
if (cached) {
|
|
7
|
-
return cached;
|
|
8
|
-
}
|
|
9
|
-
cached = require('../../config/license-plans.json');
|
|
10
|
-
return cached;
|
|
11
|
-
}
|
|
12
|
-
/** Reset cache — used in tests. */
|
|
13
|
-
export function resetPlanCache() {
|
|
14
|
-
cached = null;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=config-loader.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PricingTier, LicenseState, LicenseCheckResult, TierLimits } from '../../types/index.js';
|
|
2
|
-
export declare function resolveCurrentTier(state: LicenseState | null): PricingTier;
|
|
3
|
-
export declare function variantToTier(variantName: string): PricingTier;
|
|
4
|
-
/** Returns true if the promotional open-access window is currently active. */
|
|
5
|
-
export declare function isOpenAccessActive(): boolean;
|
|
6
|
-
export declare function isToolAllowed(toolName: string, tier: PricingTier, trialActive?: boolean): boolean;
|
|
7
|
-
export declare function checkToolAccess(toolName: string, tier: PricingTier, context?: {
|
|
8
|
-
trialActive?: boolean;
|
|
9
|
-
trialDaysRemaining?: number;
|
|
10
|
-
}): LicenseCheckResult;
|
|
11
|
-
export declare function getTierLimits(tier: PricingTier): TierLimits;
|
|
12
|
-
export declare function checkLimits(tier: PricingTier, currentCount: number, limitType: 'maxProjects' | 'maxActiveSpecs'): LicenseCheckResult;
|
|
13
|
-
export declare function isValidationFresh(state: LicenseState): boolean;
|
|
14
|
-
export declare function isInGracePeriod(state: LicenseState): boolean;
|
|
15
|
-
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
// engine/license-validator/core.ts — Offline-first license validation logic.
|
|
2
|
-
// Source of truth: local license state. Remote validation only on activation + every 30 days.
|
|
3
|
-
import { loadLicensePlans } from './config-loader.js';
|
|
4
|
-
import { verifyMachineFingerprint } from './fingerprint.js';
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// Constants
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
const VALIDATION_TTL_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
|
|
9
|
-
const GRACE_PERIOD_MS = 3 * 24 * 60 * 60 * 1000; // 3 days offline grace
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
// Tier resolution
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
export function resolveCurrentTier(state) {
|
|
14
|
-
if (!state) {
|
|
15
|
-
return 'free';
|
|
16
|
-
}
|
|
17
|
-
if (!verifyMachineFingerprint(state.machineFingerprint)) {
|
|
18
|
-
return 'free';
|
|
19
|
-
}
|
|
20
|
-
return state.tier;
|
|
21
|
-
}
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// Variant → tier mapping
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
const VARIANT_MAP = {
|
|
26
|
-
pro: 'pro',
|
|
27
|
-
'planu pro': 'pro',
|
|
28
|
-
'planu pro monthly': 'pro',
|
|
29
|
-
'planu pro yearly': 'pro',
|
|
30
|
-
team: 'team',
|
|
31
|
-
'planu team': 'team',
|
|
32
|
-
'planu team monthly': 'team',
|
|
33
|
-
'planu team yearly': 'team',
|
|
34
|
-
enterprise: 'enterprise',
|
|
35
|
-
'planu enterprise': 'enterprise',
|
|
36
|
-
'planu enterprise monthly': 'enterprise',
|
|
37
|
-
'planu enterprise yearly': 'enterprise',
|
|
38
|
-
};
|
|
39
|
-
export function variantToTier(variantName) {
|
|
40
|
-
const normalized = variantName.toLowerCase().trim();
|
|
41
|
-
return VARIANT_MAP[normalized] ?? 'pro';
|
|
42
|
-
}
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// Tool access
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
/** Returns true if the promotional open-access window is currently active. */
|
|
47
|
-
export function isOpenAccessActive() {
|
|
48
|
-
const config = loadLicensePlans();
|
|
49
|
-
if (!config.freeUntil) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return new Date(config.freeUntil) > new Date();
|
|
53
|
-
}
|
|
54
|
-
export function isToolAllowed(toolName, tier, trialActive = false) {
|
|
55
|
-
const config = loadLicensePlans();
|
|
56
|
-
if (config.alwaysAllowed.includes(toolName)) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
if (config.freeTools.includes(toolName)) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
// Promotional open-access window: all tools free until freeUntil date
|
|
63
|
-
if (isOpenAccessActive()) {
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
// Per-installation 30-day trial: full access on first run
|
|
67
|
-
if (trialActive) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
if (tier === 'free') {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
// Pro, team, enterprise have access to all tools
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
export function checkToolAccess(toolName, tier, context = {}) {
|
|
77
|
-
const trialActive = context.trialActive ?? false;
|
|
78
|
-
const allowed = isToolAllowed(toolName, tier, trialActive);
|
|
79
|
-
if (allowed) {
|
|
80
|
-
const config = loadLicensePlans();
|
|
81
|
-
// Show contextual message only for PRO tools that are temporarily unlocked
|
|
82
|
-
const normallyFree = config.freeTools.includes(toolName) || config.alwaysAllowed.includes(toolName);
|
|
83
|
-
const isProUnlocked = tier === 'free' && !normallyFree;
|
|
84
|
-
let message = 'Access granted.';
|
|
85
|
-
if (isProUnlocked && isOpenAccessActive() && config.freeUntil) {
|
|
86
|
-
message = `✅ Open access active until ${config.freeUntil} — all tools unlocked.`;
|
|
87
|
-
}
|
|
88
|
-
else if (isProUnlocked && trialActive) {
|
|
89
|
-
const daysLeft = context.trialDaysRemaining ?? 0;
|
|
90
|
-
message = `✅ Trial active — ${String(daysLeft)} day(s) left of full access. After expiry, upgrade to Pro for continued unlimited access.`;
|
|
91
|
-
}
|
|
92
|
-
return { allowed: true, currentTier: tier, requiredTier: tier, message };
|
|
93
|
-
}
|
|
94
|
-
const config = loadLicensePlans();
|
|
95
|
-
const freeCount = config.freeTools.length + config.alwaysAllowed.length;
|
|
96
|
-
const totalCount = freeCount + config.proTools.length;
|
|
97
|
-
return {
|
|
98
|
-
allowed: false,
|
|
99
|
-
currentTier: tier,
|
|
100
|
-
requiredTier: 'pro',
|
|
101
|
-
message: [
|
|
102
|
-
`🔒 "${toolName}" requires a Pro or higher plan.`,
|
|
103
|
-
`You are currently on the Free plan (${String(freeCount)} tools available).`,
|
|
104
|
-
`Pro plan includes unlimited projects and all ${String(totalCount)}+ tools.`,
|
|
105
|
-
`Upgrade to Pro → ${config.upgradeUrl}`,
|
|
106
|
-
'',
|
|
107
|
-
'To activate a license key:',
|
|
108
|
-
' → Use the activate_license tool with your license key.',
|
|
109
|
-
].join('\n'),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
// ---------------------------------------------------------------------------
|
|
113
|
-
// Limits
|
|
114
|
-
// ---------------------------------------------------------------------------
|
|
115
|
-
export function getTierLimits(tier) {
|
|
116
|
-
const config = loadLicensePlans();
|
|
117
|
-
return config.tiers[tier];
|
|
118
|
-
}
|
|
119
|
-
export function checkLimits(tier, currentCount, limitType) {
|
|
120
|
-
const limits = getTierLimits(tier);
|
|
121
|
-
const max = limits[limitType];
|
|
122
|
-
if (currentCount < max) {
|
|
123
|
-
return { allowed: true, currentTier: tier, requiredTier: tier, message: 'Within limits.' };
|
|
124
|
-
}
|
|
125
|
-
const config = loadLicensePlans();
|
|
126
|
-
const label = limitType === 'maxProjects' ? 'projects' : 'active specs';
|
|
127
|
-
const proLimits = config.tiers.pro;
|
|
128
|
-
const proMax = proLimits[limitType];
|
|
129
|
-
const proLabel = proMax >= 9999 ? 'unlimited' : String(proMax);
|
|
130
|
-
return {
|
|
131
|
-
allowed: false,
|
|
132
|
-
currentTier: tier,
|
|
133
|
-
requiredTier: 'pro',
|
|
134
|
-
message: [
|
|
135
|
-
`🔒 ${label.charAt(0).toUpperCase() + label.slice(1)} limit reached (${String(currentCount)}/${String(max)} on free plan).`,
|
|
136
|
-
`Upgrade to Pro for ${proLabel} ${label} and 85+ tools → ${config.upgradeUrl}`,
|
|
137
|
-
].join('\n'),
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
// ---------------------------------------------------------------------------
|
|
141
|
-
// Validation freshness
|
|
142
|
-
// ---------------------------------------------------------------------------
|
|
143
|
-
export function isValidationFresh(state) {
|
|
144
|
-
const lastValidated = new Date(state.lastValidatedAt).getTime();
|
|
145
|
-
return Date.now() - lastValidated < VALIDATION_TTL_MS;
|
|
146
|
-
}
|
|
147
|
-
export function isInGracePeriod(state) {
|
|
148
|
-
const lastValidated = new Date(state.lastValidatedAt).getTime();
|
|
149
|
-
return Date.now() - lastValidated < VALIDATION_TTL_MS + GRACE_PERIOD_MS;
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=core.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// engine/license-validator/fingerprint.ts — Deterministic machine identity for license binding.
|
|
2
|
-
// Uses only node:os and node:crypto — no external deps.
|
|
3
|
-
import { createHash } from 'node:crypto';
|
|
4
|
-
import { arch, hostname, platform, userInfo } from 'node:os';
|
|
5
|
-
export function computeMachineFingerprint() {
|
|
6
|
-
const raw = [hostname(), platform(), arch(), userInfo().username].join('|');
|
|
7
|
-
return createHash('sha256').update(raw).digest('hex');
|
|
8
|
-
}
|
|
9
|
-
export function verifyMachineFingerprint(stored) {
|
|
10
|
-
if (!stored) {
|
|
11
|
-
// Legacy state (pre-hardening) — no fingerprint stored yet.
|
|
12
|
-
// Allow access; fingerprint will be added on next revalidation.
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
return computeMachineFingerprint() === stored;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=fingerprint.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { LemonSqueezyActivateResponse, LemonSqueezyValidateResponse, LemonSqueezyDeactivateResponse } from '../../types/index.js';
|
|
2
|
-
export declare function activateLicense(licenseKey: string, instanceName: string): Promise<LemonSqueezyActivateResponse>;
|
|
3
|
-
export declare function validateLicense(licenseKey: string, instanceId: string): Promise<LemonSqueezyValidateResponse>;
|
|
4
|
-
export declare function deactivateLicense(licenseKey: string, instanceId: string): Promise<LemonSqueezyDeactivateResponse>;
|
|
5
|
-
//# sourceMappingURL=lemon-squeezy.d.ts.map
|