peaks-loop 4.1.3 → 4.1.5
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/.claude-plugin/marketplace.json +7 -2
- package/CHANGELOG.md +168 -0
- package/README-en.md +1 -1
- package/README.md +1 -1
- package/dist/cli/cli-helpers.d.ts +20 -0
- package/dist/cli/cli-helpers.js +34 -0
- package/dist/cli/commands/_register.js +2 -0
- package/dist/cli/commands/asset-command-shared.d.ts +12 -0
- package/dist/cli/commands/asset-command-shared.js +45 -0
- package/dist/cli/commands/asset-commands.d.ts +6 -1
- package/dist/cli/commands/asset-commands.js +11 -372
- package/dist/cli/commands/asset-crystallize-command.d.ts +3 -0
- package/dist/cli/commands/asset-crystallize-command.js +60 -0
- package/dist/cli/commands/asset-crystallize-payload.d.ts +47 -0
- package/dist/cli/commands/asset-crystallize-payload.js +85 -0
- package/dist/cli/commands/asset-crystallize-runner.d.ts +3 -0
- package/dist/cli/commands/asset-crystallize-runner.js +133 -0
- package/dist/cli/commands/asset-dispose-command.d.ts +3 -0
- package/dist/cli/commands/asset-dispose-command.js +99 -0
- package/dist/cli/commands/asset-status-command.d.ts +3 -0
- package/dist/cli/commands/asset-status-command.js +100 -0
- package/dist/cli/commands/baseline-audit-command.d.ts +3 -0
- package/dist/cli/commands/baseline-audit-command.js +64 -0
- package/dist/cli/commands/baseline-command-shared.d.ts +23 -0
- package/dist/cli/commands/baseline-command-shared.js +39 -0
- package/dist/cli/commands/baseline-commands.js +33 -313
- package/dist/cli/commands/baseline-freeze-commands.d.ts +4 -0
- package/dist/cli/commands/baseline-freeze-commands.js +81 -0
- package/dist/cli/commands/baseline-guard-command.d.ts +3 -0
- package/dist/cli/commands/baseline-guard-command.js +52 -0
- package/dist/cli/commands/baseline-read-commands.d.ts +5 -0
- package/dist/cli/commands/baseline-read-commands.js +72 -0
- package/dist/cli/commands/baseline-rollback-commands.d.ts +4 -0
- package/dist/cli/commands/baseline-rollback-commands.js +88 -0
- package/dist/cli/commands/classify-downgrade-command.d.ts +9 -0
- package/dist/cli/commands/classify-downgrade-command.js +21 -0
- package/dist/cli/commands/classify-run-command.d.ts +9 -0
- package/dist/cli/commands/classify-run-command.js +73 -0
- package/dist/cli/commands/classify-signals.d.ts +5 -0
- package/dist/cli/commands/classify-signals.js +104 -0
- package/dist/cli/commands/code-commands.d.ts +6 -4
- package/dist/cli/commands/code-commands.js +6 -4
- package/dist/cli/commands/code-emit-handoff-command.js +40 -3
- package/dist/cli/commands/code-gate-command.d.ts +5 -5
- package/dist/cli/commands/code-gate-command.js +49 -9
- package/dist/cli/commands/code-gate-step-08-command.js +25 -9
- package/dist/cli/commands/code-mode-gate-plan-command.d.ts +1 -1
- package/dist/cli/commands/code-mode-gate-plan-command.js +2 -2
- package/dist/cli/commands/codegraph-command-options.d.ts +22 -0
- package/dist/cli/commands/codegraph-command-options.js +22 -0
- package/dist/cli/commands/codegraph-commands.d.ts +2 -2
- package/dist/cli/commands/codegraph-commands.js +14 -397
- package/dist/cli/commands/codegraph-config-restore-command.d.ts +3 -0
- package/dist/cli/commands/codegraph-config-restore-command.js +200 -0
- package/dist/cli/commands/codegraph-proxy-commands.d.ts +10 -0
- package/dist/cli/commands/codegraph-proxy-commands.js +159 -0
- package/dist/cli/commands/codegraph-repair-commands.d.ts +3 -0
- package/dist/cli/commands/codegraph-repair-commands.js +94 -0
- package/dist/cli/commands/codegraph-status-command.d.ts +1 -1
- package/dist/cli/commands/codegraph-status-command.js +27 -214
- package/dist/cli/commands/codegraph-status-integrity.d.ts +44 -0
- package/dist/cli/commands/codegraph-status-integrity.js +121 -0
- package/dist/cli/commands/codegraph-status-json.d.ts +5 -0
- package/dist/cli/commands/codegraph-status-json.js +127 -0
- package/dist/cli/commands/container-command-shared.d.ts +60 -0
- package/dist/cli/commands/container-command-shared.js +52 -0
- package/dist/cli/commands/container-commands.d.ts +1 -1
- package/dist/cli/commands/container-commands.js +4 -216
- package/dist/cli/commands/container-release-command.d.ts +3 -0
- package/dist/cli/commands/container-release-command.js +105 -0
- package/dist/cli/commands/container-spawn-command.d.ts +3 -0
- package/dist/cli/commands/container-spawn-command.js +148 -0
- package/dist/cli/commands/context-check-command.d.ts +3 -0
- package/dist/cli/commands/context-check-command.js +81 -0
- package/dist/cli/commands/context-commands.d.ts +2 -7
- package/dist/cli/commands/context-commands.js +6 -276
- package/dist/cli/commands/context-layer-command.d.ts +3 -0
- package/dist/cli/commands/context-layer-command.js +34 -0
- package/dist/cli/commands/context-layer-fetchers.d.ts +15 -0
- package/dist/cli/commands/context-layer-fetchers.js +162 -0
- package/dist/cli/commands/context-status-command.d.ts +17 -0
- package/dist/cli/commands/context-status-command.js +41 -0
- package/dist/cli/commands/contract-write-command.d.ts +3 -0
- package/dist/cli/commands/contract-write-command.js +144 -0
- package/dist/cli/commands/core/doctor-bindings.d.ts +17 -0
- package/dist/cli/commands/core/doctor-bindings.js +30 -0
- package/dist/cli/commands/core/doctor-command.d.ts +4 -18
- package/dist/cli/commands/core/doctor-command.js +2 -323
- package/dist/cli/commands/core/doctor-logs.d.ts +8 -0
- package/dist/cli/commands/core/doctor-logs.js +32 -0
- package/dist/cli/commands/core/doctor-probes.d.ts +3 -0
- package/dist/cli/commands/core/doctor-probes.js +55 -0
- package/dist/cli/commands/core/doctor-run-command.d.ts +12 -0
- package/dist/cli/commands/core/doctor-run-command.js +172 -0
- package/dist/cli/commands/core/doctor-summary.d.ts +7 -0
- package/dist/cli/commands/core/doctor-summary.js +39 -0
- package/dist/cli/commands/core/memory-command-shared.d.ts +25 -0
- package/dist/cli/commands/core/memory-command-shared.js +20 -0
- package/dist/cli/commands/core/memory-command.d.ts +1 -1
- package/dist/cli/commands/core/memory-command.js +6 -227
- package/dist/cli/commands/core/memory-delegated-verbs.d.ts +4 -0
- package/dist/cli/commands/core/memory-delegated-verbs.js +178 -0
- package/dist/cli/commands/core/memory-extract-command.d.ts +3 -0
- package/dist/cli/commands/core/memory-extract-command.js +95 -0
- package/dist/cli/commands/core/memory-sync-command.d.ts +3 -0
- package/dist/cli/commands/core/memory-sync-command.js +38 -0
- package/dist/cli/commands/core/session-command.d.ts +1 -1
- package/dist/cli/commands/core/session-command.js +12 -206
- package/dist/cli/commands/core/session-info-command.d.ts +3 -0
- package/dist/cli/commands/core/session-info-command.js +142 -0
- package/dist/cli/commands/core/session-verb-commands.d.ts +5 -0
- package/dist/cli/commands/core/session-verb-commands.js +58 -0
- package/dist/cli/commands/core/standards-command.d.ts +1 -24
- package/dist/cli/commands/core/standards-command.js +33 -201
- package/dist/cli/commands/core/standards-init-command.d.ts +3 -0
- package/dist/cli/commands/core/standards-init-command.js +87 -0
- package/dist/cli/commands/core/standards-lint.d.ts +24 -0
- package/dist/cli/commands/core/standards-lint.js +57 -0
- package/dist/cli/commands/core/standards-migrate-command.d.ts +3 -0
- package/dist/cli/commands/core/standards-migrate-command.js +57 -0
- package/dist/cli/commands/cron-scheduler-commands.d.ts +5 -1
- package/dist/cli/commands/cron-scheduler-commands.js +36 -206
- package/dist/cli/commands/cron-scheduler-run-once-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-run-once-command.js +35 -0
- package/dist/cli/commands/cron-scheduler-shared.d.ts +6 -0
- package/dist/cli/commands/cron-scheduler-shared.js +48 -0
- package/dist/cli/commands/cron-scheduler-start-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-start-command.js +65 -0
- package/dist/cli/commands/cron-scheduler-status-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-status-command.js +46 -0
- package/dist/cli/commands/cron-scheduler-stop-command.d.ts +7 -0
- package/dist/cli/commands/cron-scheduler-stop-command.js +61 -0
- package/dist/cli/commands/dispatch-cli-invocation-check.d.ts +108 -0
- package/dist/cli/commands/dispatch-cli-invocation-check.js +87 -0
- package/dist/cli/commands/dispatch-cli-invocation-scan.d.ts +66 -0
- package/dist/cli/commands/dispatch-cli-invocation-scan.js +162 -0
- package/dist/cli/commands/dispatch-commands.js +12 -5
- package/dist/cli/commands/dispatch-dag-envelope.d.ts +41 -0
- package/dist/cli/commands/dispatch-dag-envelope.js +49 -0
- package/dist/cli/commands/dispatch-dag-failure.d.ts +18 -0
- package/dist/cli/commands/dispatch-dag-failure.js +16 -0
- package/dist/cli/commands/dispatch-dag-preflight.d.ts +51 -0
- package/dist/cli/commands/dispatch-dag-preflight.js +105 -0
- package/dist/cli/commands/dispatch-dag-runners.d.ts +48 -0
- package/dist/cli/commands/dispatch-dag-runners.js +73 -0
- package/dist/cli/commands/dispatch-from-dag.d.ts +27 -0
- package/dist/cli/commands/dispatch-from-dag.js +87 -257
- package/dist/cli/commands/dispatch-preflight.js +46 -0
- package/dist/cli/commands/dispatch-prompt-composition.d.ts +6 -0
- package/dist/cli/commands/dispatch-prompt-composition.js +29 -7
- package/dist/cli/commands/doc-commands.js +1 -1
- package/dist/cli/commands/feedback-commands-helpers.js +1 -1
- package/dist/cli/commands/final-review-command-envelopes.d.ts +44 -0
- package/dist/cli/commands/final-review-command-envelopes.js +100 -0
- package/dist/cli/commands/final-review-command-shared.d.ts +52 -0
- package/dist/cli/commands/final-review-command-shared.js +35 -0
- package/dist/cli/commands/final-review-commands.d.ts +7 -27
- package/dist/cli/commands/final-review-commands.js +13 -240
- package/dist/cli/commands/final-review-prepare-command.d.ts +3 -0
- package/dist/cli/commands/final-review-prepare-command.js +221 -0
- package/dist/cli/commands/gate-commands-enforce.js +3 -3
- package/dist/cli/commands/governance-classify-contract-commands.d.ts +23 -9
- package/dist/cli/commands/governance-classify-contract-commands.js +26 -269
- package/dist/cli/commands/hook-handle.js +41 -20
- package/dist/cli/commands/hooks-command-shared.d.ts +42 -0
- package/dist/cli/commands/hooks-command-shared.js +32 -0
- package/dist/cli/commands/hooks-commands.d.ts +20 -0
- package/dist/cli/commands/hooks-commands.js +75 -309
- package/dist/cli/commands/hooks-install-envelopes.d.ts +6 -0
- package/dist/cli/commands/hooks-install-envelopes.js +144 -0
- package/dist/cli/commands/hooks-status-command.d.ts +3 -0
- package/dist/cli/commands/hooks-status-command.js +93 -0
- package/dist/cli/commands/hooks-uninstall-command.d.ts +3 -0
- package/dist/cli/commands/hooks-uninstall-command.js +43 -0
- package/dist/cli/commands/lint-commands.js +3 -1
- package/dist/cli/commands/loop-command-shared.d.ts +31 -0
- package/dist/cli/commands/loop-command-shared.js +15 -0
- package/dist/cli/commands/loop-commands.d.ts +12 -17
- package/dist/cli/commands/loop-commands.js +56 -238
- package/dist/cli/commands/loop-eval-capture-index.js +2 -4
- package/dist/cli/commands/loop-export-command.d.ts +3 -0
- package/dist/cli/commands/loop-export-command.js +73 -0
- package/dist/cli/commands/loop-goal-compose-command.d.ts +3 -0
- package/dist/cli/commands/loop-goal-compose-command.js +36 -0
- package/dist/cli/commands/loop-import-command.d.ts +3 -0
- package/dist/cli/commands/loop-import-command.js +86 -0
- package/dist/cli/commands/loop-placeholder-commands.d.ts +3 -0
- package/dist/cli/commands/loop-placeholder-commands.js +52 -0
- package/dist/cli/commands/memory-command-shared.d.ts +59 -0
- package/dist/cli/commands/memory-command-shared.js +39 -0
- package/dist/cli/commands/memory-commands.d.ts +6 -79
- package/dist/cli/commands/memory-commands.js +19 -309
- package/dist/cli/commands/memory-ingest-command.d.ts +3 -0
- package/dist/cli/commands/memory-ingest-command.js +50 -0
- package/dist/cli/commands/memory-list-command.d.ts +16 -0
- package/dist/cli/commands/memory-list-command.js +129 -0
- package/dist/cli/commands/memory-reindex-command.d.ts +9 -0
- package/dist/cli/commands/memory-reindex-command.js +78 -0
- package/dist/cli/commands/memory-rotate-command.d.ts +3 -0
- package/dist/cli/commands/memory-rotate-command.js +55 -0
- package/dist/cli/commands/memory-search-command.d.ts +7 -0
- package/dist/cli/commands/memory-search-command.js +46 -0
- package/dist/cli/commands/openspec-archive-command.d.ts +3 -0
- package/dist/cli/commands/openspec-archive-command.js +55 -0
- package/dist/cli/commands/openspec-command-shared.d.ts +62 -0
- package/dist/cli/commands/openspec-command-shared.js +135 -0
- package/dist/cli/commands/openspec-commands.d.ts +1 -1
- package/dist/cli/commands/openspec-commands.js +33 -306
- package/dist/cli/commands/openspec-from-doctor-command.d.ts +3 -0
- package/dist/cli/commands/openspec-from-doctor-command.js +66 -0
- package/dist/cli/commands/openspec-init-command.d.ts +3 -0
- package/dist/cli/commands/openspec-init-command.js +49 -0
- package/dist/cli/commands/openspec-list-command.d.ts +3 -0
- package/dist/cli/commands/openspec-list-command.js +27 -0
- package/dist/cli/commands/openspec-render-command.d.ts +3 -0
- package/dist/cli/commands/openspec-render-command.js +33 -0
- package/dist/cli/commands/openspec-show-command.d.ts +3 -0
- package/dist/cli/commands/openspec-show-command.js +33 -0
- package/dist/cli/commands/openspec-to-rd-command.d.ts +3 -0
- package/dist/cli/commands/openspec-to-rd-command.js +33 -0
- package/dist/cli/commands/openspec-validate-command.d.ts +3 -0
- package/dist/cli/commands/openspec-validate-command.js +45 -0
- package/dist/cli/commands/perf-audit-commands.js +15 -5
- package/dist/cli/commands/playwright-browser-command.d.ts +8 -0
- package/dist/cli/commands/playwright-browser-command.js +61 -0
- package/dist/cli/commands/playwright-commands.d.ts +10 -62
- package/dist/cli/commands/playwright-commands.js +77 -400
- package/dist/cli/commands/playwright-envelope.d.ts +8 -0
- package/dist/cli/commands/playwright-envelope.js +29 -0
- package/dist/cli/commands/playwright-ls-stop-commands.d.ts +4 -0
- package/dist/cli/commands/playwright-ls-stop-commands.js +74 -0
- package/dist/cli/commands/playwright-session-store.d.ts +65 -0
- package/dist/cli/commands/playwright-session-store.js +189 -0
- package/dist/cli/commands/project-commands.d.ts +19 -0
- package/dist/cli/commands/project-commands.js +101 -259
- package/dist/cli/commands/project-context-command.d.ts +3 -0
- package/dist/cli/commands/project-context-command.js +44 -0
- package/dist/cli/commands/project-dashboard-command.d.ts +3 -0
- package/dist/cli/commands/project-dashboard-command.js +74 -0
- package/dist/cli/commands/project-knowledge-command.d.ts +3 -0
- package/dist/cli/commands/project-knowledge-command.js +48 -0
- package/dist/cli/commands/project-memories-show-command.d.ts +3 -0
- package/dist/cli/commands/project-memories-show-command.js +87 -0
- package/dist/cli/commands/project-memory-index-command.d.ts +3 -0
- package/dist/cli/commands/project-memory-index-command.js +31 -0
- package/dist/cli/commands/qa-archive-screenshots-command.d.ts +3 -0
- package/dist/cli/commands/qa-archive-screenshots-command.js +53 -0
- package/dist/cli/commands/qa-commands.d.ts +14 -87
- package/dist/cli/commands/qa-commands.js +17 -315
- package/dist/cli/commands/qa-context-prestep.d.ts +1 -0
- package/dist/cli/commands/qa-context-prestep.js +34 -0
- package/dist/cli/commands/qa-run-command.d.ts +3 -0
- package/dist/cli/commands/qa-run-command.js +105 -0
- package/dist/cli/commands/qa-run-options.d.ts +23 -0
- package/dist/cli/commands/qa-run-options.js +31 -0
- package/dist/cli/commands/qa-run-slice.d.ts +41 -0
- package/dist/cli/commands/qa-run-slice.js +145 -0
- package/dist/cli/commands/race-commands.d.ts +15 -0
- package/dist/cli/commands/race-commands.js +65 -0
- package/dist/cli/commands/race-pilot-gate-record-command.d.ts +3 -0
- package/dist/cli/commands/race-pilot-gate-record-command.js +81 -0
- package/dist/cli/commands/release-canary-command.d.ts +28 -0
- package/dist/cli/commands/release-canary-command.js +129 -0
- package/dist/cli/commands/release-command-shared.d.ts +13 -0
- package/dist/cli/commands/release-command-shared.js +18 -0
- package/dist/cli/commands/release-commands.d.ts +10 -18
- package/dist/cli/commands/release-commands.js +25 -298
- package/dist/cli/commands/release-done-command.d.ts +3 -0
- package/dist/cli/commands/release-done-command.js +64 -0
- package/dist/cli/commands/release-hotfix-command.d.ts +3 -0
- package/dist/cli/commands/release-hotfix-command.js +50 -0
- package/dist/cli/commands/release-plan-command.d.ts +3 -0
- package/dist/cli/commands/release-plan-command.js +33 -0
- package/dist/cli/commands/release-precheck-command.d.ts +3 -0
- package/dist/cli/commands/release-precheck-command.js +28 -0
- package/dist/cli/commands/release-promote-command.d.ts +3 -0
- package/dist/cli/commands/release-promote-command.js +34 -0
- package/dist/cli/commands/release-rollback-command.d.ts +3 -0
- package/dist/cli/commands/release-rollback-command.js +33 -0
- package/dist/cli/commands/release-watch-command.d.ts +3 -0
- package/dist/cli/commands/release-watch-command.js +44 -0
- package/dist/cli/commands/request-command-options.d.ts +8 -0
- package/dist/cli/commands/request-commands.js +2 -0
- package/dist/cli/commands/request-init-command.js +67 -12
- package/dist/cli/commands/request-retag-command.d.ts +3 -0
- package/dist/cli/commands/request-retag-command.js +50 -0
- package/dist/cli/commands/request-show-command.d.ts +8 -0
- package/dist/cli/commands/request-show-command.js +14 -1
- package/dist/cli/commands/request-transition-command.js +12 -4
- package/dist/cli/commands/request-transition-failures.d.ts +14 -0
- package/dist/cli/commands/request-transition-failures.js +45 -3
- package/dist/cli/commands/scan-scope-commands.js +2 -2
- package/dist/cli/commands/security-audit-commands.js +26 -6
- package/dist/cli/commands/sediment-argv-flags.d.ts +54 -0
- package/dist/cli/commands/sediment-argv-flags.js +116 -0
- package/dist/cli/commands/sediment-command-shared.d.ts +15 -0
- package/dist/cli/commands/sediment-command-shared.js +5 -0
- package/dist/cli/commands/sediment-commands.d.ts +35 -59
- package/dist/cli/commands/sediment-commands.js +36 -590
- package/dist/cli/commands/sediment-pool-commands.d.ts +9 -0
- package/dist/cli/commands/sediment-pool-commands.js +185 -0
- package/dist/cli/commands/sediment-query-commands.d.ts +4 -0
- package/dist/cli/commands/sediment-query-commands.js +94 -0
- package/dist/cli/commands/sediment-release-commands.d.ts +8 -0
- package/dist/cli/commands/sediment-release-commands.js +232 -0
- package/dist/cli/commands/sop-advance-command.d.ts +3 -0
- package/dist/cli/commands/sop-advance-command.js +160 -0
- package/dist/cli/commands/sop-check-command.d.ts +3 -0
- package/dist/cli/commands/sop-check-command.js +44 -0
- package/dist/cli/commands/sop-command-shared.d.ts +23 -0
- package/dist/cli/commands/sop-command-shared.js +18 -0
- package/dist/cli/commands/sop-commands.d.ts +15 -1
- package/dist/cli/commands/sop-commands.js +26 -240
- package/dist/cli/commands/sop-init-command.d.ts +3 -0
- package/dist/cli/commands/sop-init-command.js +51 -0
- package/dist/cli/commands/sop-lint-command.d.ts +3 -0
- package/dist/cli/commands/sop-lint-command.js +64 -0
- package/dist/cli/commands/sop-register-command.d.ts +3 -0
- package/dist/cli/commands/sop-register-command.js +48 -0
- package/dist/cli/commands/sop-registry-command.d.ts +3 -0
- package/dist/cli/commands/sop-registry-command.js +30 -0
- package/dist/cli/commands/statusline-command-shared.d.ts +73 -0
- package/dist/cli/commands/statusline-command-shared.js +90 -0
- package/dist/cli/commands/statusline-commands.d.ts +1 -19
- package/dist/cli/commands/statusline-commands.js +48 -287
- package/dist/cli/commands/statusline-compact-command.d.ts +4 -0
- package/dist/cli/commands/statusline-compact-command.js +54 -0
- package/dist/cli/commands/statusline-install-command.d.ts +3 -0
- package/dist/cli/commands/statusline-install-command.js +48 -0
- package/dist/cli/commands/statusline-render-command.d.ts +9 -0
- package/dist/cli/commands/statusline-render-command.js +55 -0
- package/dist/cli/commands/statusline-status-command.d.ts +3 -0
- package/dist/cli/commands/statusline-status-command.js +23 -0
- package/dist/cli/commands/statusline-uninstall-command.d.ts +3 -0
- package/dist/cli/commands/statusline-uninstall-command.js +23 -0
- package/dist/cli/commands/test-command-run-helpers.d.ts +27 -0
- package/dist/cli/commands/test-command-run-helpers.js +73 -0
- package/dist/cli/commands/test-command-runner-resolution.d.ts +57 -0
- package/dist/cli/commands/test-command-runner-resolution.js +183 -0
- package/dist/cli/commands/test-commands.d.ts +8 -56
- package/dist/cli/commands/test-commands.js +26 -249
- package/dist/cli/commands/vm-command-shared.d.ts +23 -0
- package/dist/cli/commands/vm-command-shared.js +23 -0
- package/dist/cli/commands/vm-commands.d.ts +1 -28
- package/dist/cli/commands/vm-commands.js +36 -270
- package/dist/cli/commands/vm-hypervisor-runtime.d.ts +15 -0
- package/dist/cli/commands/vm-hypervisor-runtime.js +64 -0
- package/dist/cli/commands/vm-release-command.d.ts +5 -0
- package/dist/cli/commands/vm-release-command.js +101 -0
- package/dist/cli/commands/vm-spawn-command.d.ts +5 -0
- package/dist/cli/commands/vm-spawn-command.js +177 -0
- package/dist/cli/commands/web-command-shared.d.ts +12 -0
- package/dist/cli/commands/web-command-shared.js +30 -0
- package/dist/cli/commands/web-commands.d.ts +7 -14
- package/dist/cli/commands/web-commands.js +6 -314
- package/dist/cli/commands/web-install-command.d.ts +10 -0
- package/dist/cli/commands/web-install-command.js +116 -0
- package/dist/cli/commands/web-lifecycle-commands.d.ts +9 -30
- package/dist/cli/commands/web-lifecycle-commands.js +14 -322
- package/dist/cli/commands/web-login-command.d.ts +14 -0
- package/dist/cli/commands/web-login-command.js +189 -0
- package/dist/cli/commands/web-op-payload.d.ts +22 -0
- package/dist/cli/commands/web-op-payload.js +89 -0
- package/dist/cli/commands/web-op-refusals.d.ts +37 -0
- package/dist/cli/commands/web-op-refusals.js +73 -0
- package/dist/cli/commands/web-op-runner.d.ts +14 -0
- package/dist/cli/commands/web-op-runner.js +166 -0
- package/dist/cli/commands/web-status-command.d.ts +4 -0
- package/dist/cli/commands/web-status-command.js +32 -0
- package/dist/cli/commands/web-stop-command.d.ts +10 -0
- package/dist/cli/commands/web-stop-command.js +59 -0
- package/dist/cli/commands/web-verb-specs.d.ts +18 -0
- package/dist/cli/commands/web-verb-specs.js +66 -0
- package/dist/cli/commands/workflow-command-shared.d.ts +102 -0
- package/dist/cli/commands/workflow-command-shared.js +74 -0
- package/dist/cli/commands/workflow-graph-commands.d.ts +3 -0
- package/dist/cli/commands/workflow-graph-commands.js +73 -0
- package/dist/cli/commands/workflow-init-command.d.ts +3 -0
- package/dist/cli/commands/workflow-init-command.js +68 -0
- package/dist/cli/commands/workflow-lifecycle-commands.d.ts +9 -59
- package/dist/cli/commands/workflow-lifecycle-commands.js +14 -348
- package/dist/cli/commands/workflow-node-commands.d.ts +3 -0
- package/dist/cli/commands/workflow-node-commands.js +154 -0
- package/dist/cli/commands/workflow-terminalize-command.d.ts +3 -0
- package/dist/cli/commands/workflow-terminalize-command.js +56 -0
- package/dist/cli/commands/worktree-lease-gc-command.js +1 -1
- package/dist/services/artifacts/artifact-contract-block.d.ts +53 -0
- package/dist/services/artifacts/artifact-contract-block.js +212 -0
- package/dist/services/artifacts/artifact-prerequisites.d.ts +27 -19
- package/dist/services/artifacts/artifact-prerequisites.js +63 -133
- package/dist/services/artifacts/artifact-templates.d.ts +1 -1
- package/dist/services/artifacts/artifact-templates.js +17 -10
- package/dist/services/artifacts/prerequisite-checks.d.ts +87 -0
- package/dist/services/artifacts/prerequisite-checks.js +198 -0
- package/dist/services/artifacts/prerequisite-transition-event.d.ts +20 -0
- package/dist/services/artifacts/prerequisite-transition-event.js +27 -0
- package/dist/services/artifacts/request-artifact-metadata.d.ts +31 -0
- package/dist/services/artifacts/request-artifact-metadata.js +44 -0
- package/dist/services/artifacts/request-artifact-service.d.ts +5 -0
- package/dist/services/artifacts/request-artifact-service.js +23 -51
- package/dist/services/artifacts/request-artifact-state-helpers.d.ts +12 -0
- package/dist/services/artifacts/request-artifact-state-helpers.js +28 -4
- package/dist/services/artifacts/request-retag-service.d.ts +68 -0
- package/dist/services/artifacts/request-retag-service.js +125 -0
- package/dist/services/artifacts/request-state-order.d.ts +38 -0
- package/dist/services/artifacts/request-state-order.js +99 -0
- package/dist/services/artifacts/request-type-demand.d.ts +44 -0
- package/dist/services/artifacts/request-type-demand.js +71 -0
- package/dist/services/audit/audit-goal-service.d.ts +7 -0
- package/dist/services/audit/enforcers/active-skill-resolver.d.ts +18 -0
- package/dist/services/audit/enforcers/active-skill-resolver.js +48 -1
- package/dist/services/audit/enforcers/code-ban.d.ts +11 -2
- package/dist/services/audit/enforcers/code-ban.js +21 -1
- package/dist/services/audit/red-line-catalog-p2-a-bee-runtime.d.ts +17 -0
- package/dist/services/audit/red-line-catalog-p2-a-bee-runtime.js +24 -7
- package/dist/services/audit-independent/handoff-missing-refusal.d.ts +26 -0
- package/dist/services/audit-independent/handoff-missing-refusal.js +109 -0
- package/dist/services/audit-independent/handoff-readers.d.ts +37 -0
- package/dist/services/audit-independent/handoff-readers.js +81 -0
- package/dist/services/audit-independent/index.d.ts +6 -1
- package/dist/services/audit-independent/index.js +6 -1
- package/dist/services/audit-independent/judged-declaration-build.d.ts +48 -0
- package/dist/services/audit-independent/judged-declaration-build.js +73 -0
- package/dist/services/audit-independent/judged-declaration-check.d.ts +79 -0
- package/dist/services/audit-independent/judged-declaration-check.js +155 -0
- package/dist/services/audit-independent/judged-declaration.d.ts +94 -0
- package/dist/services/audit-independent/judged-declaration.js +218 -0
- package/dist/services/audit-independent/perf-audit-service.js +12 -14
- package/dist/services/audit-independent/security-audit-artifact.d.ts +28 -0
- package/dist/services/audit-independent/security-audit-artifact.js +90 -0
- package/dist/services/audit-independent/security-audit-service.d.ts +6 -53
- package/dist/services/audit-independent/security-audit-service.js +34 -178
- package/dist/services/capability-guard-runner/contracts/J05.js +60 -14
- package/dist/services/code/auto-compact-artifacts.d.ts +54 -0
- package/dist/services/code/auto-compact-artifacts.js +135 -0
- package/dist/services/code/auto-compact-attempt.d.ts +46 -0
- package/dist/services/code/auto-compact-attempt.js +88 -0
- package/dist/services/code/auto-compact-decision.d.ts +74 -0
- package/dist/services/code/auto-compact-decision.js +149 -0
- package/dist/services/code/auto-compact-dispatch-gate.d.ts +36 -0
- package/dist/services/code/auto-compact-dispatch-gate.js +86 -0
- package/dist/services/code/auto-compact-envelopes.d.ts +33 -0
- package/dist/services/code/auto-compact-envelopes.js +134 -0
- package/dist/services/code/auto-compact-history.d.ts +46 -0
- package/dist/services/code/auto-compact-history.js +17 -0
- package/dist/services/code/auto-compact-orchestrator.d.ts +11 -240
- package/dist/services/code/auto-compact-orchestrator.js +165 -686
- package/dist/services/code/auto-compact-run-types.d.ts +123 -0
- package/dist/services/code/auto-compact-run-types.js +1 -0
- package/dist/services/code/emit-handoff.d.ts +35 -1
- package/dist/services/code/emit-handoff.js +128 -7
- package/dist/services/code/step-08-gate.d.ts +28 -19
- package/dist/services/code/step-08-gate.js +92 -35
- package/dist/services/codegraph/codegraph-index-integrity.js +2 -0
- package/dist/services/config/config-coercion.d.ts +7 -0
- package/dist/services/config/config-coercion.js +156 -0
- package/dist/services/config/config-file-io.d.ts +11 -0
- package/dist/services/config/config-file-io.js +61 -0
- package/dist/services/config/config-get.d.ts +2 -0
- package/dist/services/config/config-get.js +36 -0
- package/dist/services/config/config-global-loader.d.ts +15 -0
- package/dist/services/config/config-global-loader.js +111 -0
- package/dist/services/config/config-nested-path.d.ts +3 -0
- package/dist/services/config/config-nested-path.js +53 -0
- package/dist/services/config/config-primitives.d.ts +16 -0
- package/dist/services/config/config-primitives.js +24 -0
- package/dist/services/config/config-service.d.ts +9 -33
- package/dist/services/config/config-service.js +16 -665
- package/dist/services/config/config-validation.d.ts +19 -0
- package/dist/services/config/config-validation.js +152 -0
- package/dist/services/config/config-workspace.d.ts +10 -0
- package/dist/services/config/config-workspace.js +158 -0
- package/dist/services/context/build-dispatch-system-prompt.d.ts +3 -3
- package/dist/services/context/build-dispatch-system-prompt.js +7 -7
- package/dist/services/context/collector.js +5 -1
- package/dist/services/dispatch/active-dispatch-index.d.ts +36 -0
- package/dist/services/dispatch/active-dispatch-index.js +118 -0
- package/dist/services/dispatch/batch-counter.js +1 -2
- package/dist/services/dispatch/dispatch-record-writer.d.ts +29 -16
- package/dist/services/dispatch/dispatch-record-writer.js +58 -100
- package/dist/services/dispatch/dispatch-sub-agent.js +1 -1
- package/dist/services/dispatch/karpathy-block.d.ts +55 -0
- package/dist/services/dispatch/karpathy-block.js +101 -0
- package/dist/services/dispatch/ledger-reaper.d.ts +80 -0
- package/dist/services/dispatch/ledger-reaper.js +131 -0
- package/dist/services/evidence/evidence-generator.js +15 -8
- package/dist/services/feedback/feedback-promotion-service.d.ts +8 -11
- package/dist/services/feedback/feedback-promotion-service.js +30 -35
- package/dist/services/feedback/promotion-artifact-json-evidence.d.ts +18 -0
- package/dist/services/feedback/promotion-artifact-missing.d.ts +22 -0
- package/dist/services/feedback/promotion-artifact-missing.js +63 -0
- package/dist/services/final-review/final-review-contract.d.ts +95 -4
- package/dist/services/final-review/final-review-contract.js +64 -0
- package/dist/services/final-review/final-review-delivery.d.ts +13 -0
- package/dist/services/final-review/final-review-delivery.js +26 -12
- package/dist/services/final-review/final-review-evidence-collect.js +8 -53
- package/dist/services/final-review/final-review-evidence-records.d.ts +21 -0
- package/dist/services/final-review/final-review-evidence-records.js +67 -0
- package/dist/services/final-review/final-review-evidence-sources.d.ts +22 -0
- package/dist/services/final-review/final-review-evidence-sources.js +28 -4
- package/dist/services/final-review/final-review-prompt.js +19 -6
- package/dist/services/final-review/final-review-runner.js +5 -0
- package/dist/services/final-review/final-review-service.d.ts +2 -2
- package/dist/services/final-review/index.d.ts +1 -1
- package/dist/services/final-review/pre-post-diff.d.ts +2 -75
- package/dist/services/final-review/pre-post-diff.js +60 -59
- package/dist/services/hooks/pre-tool-code-gate.d.ts +7 -1
- package/dist/services/hooks/pre-tool-code-gate.js +21 -2
- package/dist/services/hooks/worktree-authorization-gate.js +6 -31
- package/dist/services/hooks/worktree-refusal-messages.d.ts +74 -0
- package/dist/services/hooks/worktree-refusal-messages.js +102 -0
- package/dist/services/lint/eslint-runner-support.d.ts +1 -1
- package/dist/services/lint/eslint-runner-support.js +2 -1
- package/dist/services/lint/eslint-runner-types.d.ts +8 -0
- package/dist/services/lint/eslint-runner.js +17 -4
- package/dist/services/llm/anthropic-runner.js +24 -7
- package/dist/services/loop/loop-observability.d.ts +39 -0
- package/dist/services/loop/loop-observability.js +55 -0
- package/dist/services/loop/monotonic-guard.js +6 -9
- package/dist/services/loop/monotonic-runner.js +8 -7
- package/dist/services/loop/run-driver.js +18 -22
- package/dist/services/memory/project-memory-service/index/kind-dispatch.js +14 -1
- package/dist/services/memory/project-memory-service/index/project-memory-plan-exec.js +13 -2
- package/dist/services/memory/project-memory-service/index.d.ts +2 -2
- package/dist/services/memory/project-memory-service/index.js +1 -1
- package/dist/services/memory/project-memory-service/parsers/frontmatter-parse.d.ts +36 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter-parse.js +48 -2
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +23 -1
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +37 -0
- package/dist/services/memory/project-memory-service/types.d.ts +32 -0
- package/dist/services/observability/observability-service.d.ts +7 -0
- package/dist/services/observability/observability-service.js +2 -1
- package/dist/services/prd/gate-evidence-derivation.d.ts +4 -3
- package/dist/services/prd/gate-evidence-derivation.js +4 -3
- package/dist/services/qa/bdd-test-style-verifier.js +22 -8
- package/dist/services/race/gate2-evaluator.d.ts +58 -0
- package/dist/services/race/gate2-evaluator.js +111 -0
- package/dist/services/race/gate2-policy.d.ts +17 -0
- package/dist/services/race/gate2-policy.js +31 -0
- package/dist/services/race/lane-phase.d.ts +19 -0
- package/dist/services/race/lane-phase.js +113 -0
- package/dist/services/race/pilot-gate-store.d.ts +67 -0
- package/dist/services/race/pilot-gate-store.js +227 -0
- package/dist/services/scan/file-size-baseline.d.ts +26 -0
- package/dist/services/scan/file-size-baseline.js +150 -0
- package/dist/services/scan/file-size-scan.d.ts +42 -3
- package/dist/services/scan/file-size-scan.js +58 -42
- package/dist/services/scan/type-sanity-service.js +13 -3
- package/dist/services/skill/resume-detector.js +3 -3
- package/dist/services/skills/hooks-codegate-superpowers.d.ts +5 -6
- package/dist/services/skills/hooks-codegate-superpowers.js +7 -8
- package/dist/services/skills/hooks-settings-deny-list.d.ts +61 -0
- package/dist/services/skills/hooks-settings-deny-list.js +173 -0
- package/dist/services/skills/hooks-settings-envelopes.d.ts +20 -0
- package/dist/services/skills/hooks-settings-envelopes.js +79 -0
- package/dist/services/skills/hooks-settings-file-shape.d.ts +43 -0
- package/dist/services/skills/hooks-settings-file-shape.js +207 -0
- package/dist/services/skills/hooks-settings-paths.d.ts +34 -0
- package/dist/services/skills/hooks-settings-paths.js +75 -0
- package/dist/services/skills/hooks-settings-read-installed.d.ts +39 -0
- package/dist/services/skills/hooks-settings-read-installed.js +60 -0
- package/dist/services/skills/hooks-settings-service.d.ts +13 -213
- package/dist/services/skills/hooks-settings-service.js +72 -658
- package/dist/services/skills/hooks-settings-types.d.ts +139 -0
- package/dist/services/skills/hooks-settings-types.js +1 -0
- package/dist/services/skills/presence-lease-order.d.ts +13 -0
- package/dist/services/skills/presence-lease-order.js +24 -0
- package/dist/services/skills/skill-conformance-service.js +1 -0
- package/dist/services/skills/skill-statusline-service.js +4 -7
- package/dist/services/slice/slice-check-service.js +8 -8
- package/dist/services/workflow/pipeline-verify-gate-support.js +2 -1
- package/dist/services/workflow/pipeline-verify-service.js +1 -1
- package/dist/services/workflow/workflow-skip-service.d.ts +0 -20
- package/dist/services/workflow/workflow-skip-service.js +3 -4
- package/dist/services/workspace/claude-settings-retirements.d.ts +54 -0
- package/dist/services/workspace/claude-settings-retirements.js +112 -0
- package/dist/services/workspace/claude-settings-template-merge.d.ts +109 -0
- package/dist/services/workspace/claude-settings-template-merge.js +223 -0
- package/dist/services/workspace/claude-settings-template.d.ts +79 -87
- package/dist/services/workspace/claude-settings-template.js +80 -235
- package/dist/services/workspace/migrate-1-4-1-service.js +3 -0
- package/dist/services/workspace/reconcile-service.js +0 -1
- package/dist/shared/incrementing-number.d.ts +10 -0
- package/dist/shared/incrementing-number.js +27 -0
- package/package.json +5 -5
- package/skills/bee/peaks-perf-audit/SKILL.md +1 -1
- package/skills/bee/peaks-prd/SKILL.md +1 -1
- package/skills/bee/peaks-qa/SKILL.md +1 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +2 -2
- package/skills/bee/peaks-qa/references/qa-transition-gates.md +1 -1
- package/skills/bee/peaks-rd/SKILL.md +2 -2
- package/skills/bee/peaks-rd/references/rd-fanout-contracts.md +1 -1
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +8 -4
- package/skills/bee/peaks-rd/references/rd-transition-gates.md +3 -3
- package/skills/bee/peaks-rd/references/v2-12-fanout-collapse.md +2 -2
- package/skills/bee/peaks-rd/references/writing-handoff-frontmatter.md +1 -1
- package/skills/bee/peaks-reviewer/SKILL.md +1 -1
- package/skills/bee/peaks-sc/SKILL.md +1 -1
- package/skills/bee/peaks-security-audit/SKILL.md +10 -2
- package/skills/bee/peaks-txt/SKILL.md +4 -3
- package/skills/bee/peaks-ui/SKILL.md +3 -3
- package/skills/peaks-audit/SKILL.md +29 -1
- package/skills/peaks-code/SKILL.md +5 -2
- package/skills/peaks-code/references/fast-lane-norm.md +42 -0
- package/skills/peaks-code/references/fast-mode.md +3 -2
- package/skills/peaks-code/references/local-artifact-workspace.md +3 -3
- package/skills/peaks-code/references/micro-cycle.md +3 -3
- package/skills/peaks-code/references/resume-detection.md +1 -1
- package/skills/peaks-code/references/runbook.md +12 -6
- package/skills/peaks-code/references/step-11-memory-sediment.md +4 -0
- package/skills/peaks-code/references/sub-agent-dispatch.md +1 -1
- package/skills/peaks-code/references/swarm-dispatch-contract.md +40 -16
- package/skills/peaks-code/references/workflow-gates-and-types.md +6 -6
- package/skills/peaks-code/references/worktree-governance.md +4 -4
- package/skills/peaks-content/SKILL.md +1 -1
- package/skills/peaks-doctor/SKILL.md +1 -1
- package/skills/peaks-final-review/SKILL.md +31 -11
- package/skills/peaks-ide/SKILL.md +1 -1
- package/skills/peaks-issue-fix-orchestrator/SKILL.md +1 -1
- package/skills/peaks-race-code/SKILL.md +185 -0
- package/skills/peaks-resume/SKILL.md +1 -1
- package/skills/peaks-slice-decompose/SKILL.md +1 -1
- package/skills/peaks-solo/SKILL.md +1 -1
- package/skills/peaks-sop/SKILL.md +1 -1
- package/skills/peaks-status/SKILL.md +1 -1
- package/skills/peaks-test/SKILL.md +7 -4
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.d.ts +0 -23
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.js +0 -64
|
@@ -34,15 +34,27 @@ export declare class TypeSanityViolationError extends Error {
|
|
|
34
34
|
}
|
|
35
35
|
export declare class FileSizeViolationError extends Error {
|
|
36
36
|
readonly code = "FILE_SIZE_VIOLATION";
|
|
37
|
+
/** `previousLines` is the file's size at the scan's base ref, or `null` when
|
|
38
|
+
* the change CREATED it over the cap. Carried so the message can name the
|
|
39
|
+
* growth — a refusal that does not say how much worse the file got reads as
|
|
40
|
+
* an absolute cap breach, which is the reading this gate no longer makes.
|
|
41
|
+
*
|
|
42
|
+
* The `violations` array also drives the sentence naming the AGGREGATE
|
|
43
|
+
* ratchet row this gate is easily confused with. This gate is PER FILE; that
|
|
44
|
+
* row is a sum over the census. In a working tree the two can disagree with
|
|
45
|
+
* neither being wrong, and the message says so rather than leaving a reader
|
|
46
|
+
* to conclude that one of them is broken. */
|
|
37
47
|
readonly violations: Array<{
|
|
38
48
|
file: string;
|
|
39
49
|
lines: number;
|
|
40
50
|
cap: number;
|
|
51
|
+
previousLines: number | null;
|
|
41
52
|
}>;
|
|
42
53
|
constructor(violations: Array<{
|
|
43
54
|
file: string;
|
|
44
55
|
lines: number;
|
|
45
56
|
cap: number;
|
|
57
|
+
previousLines: number | null;
|
|
46
58
|
}>);
|
|
47
59
|
}
|
|
48
60
|
export interface ArtifactStateLocation {
|
|
@@ -62,12 +62,36 @@ export class TypeSanityViolationError extends Error {
|
|
|
62
62
|
}
|
|
63
63
|
export class FileSizeViolationError extends Error {
|
|
64
64
|
code = 'FILE_SIZE_VIOLATION';
|
|
65
|
+
/** `previousLines` is the file's size at the scan's base ref, or `null` when
|
|
66
|
+
* the change CREATED it over the cap. Carried so the message can name the
|
|
67
|
+
* growth — a refusal that does not say how much worse the file got reads as
|
|
68
|
+
* an absolute cap breach, which is the reading this gate no longer makes.
|
|
69
|
+
*
|
|
70
|
+
* The `violations` array also drives the sentence naming the AGGREGATE
|
|
71
|
+
* ratchet row this gate is easily confused with. This gate is PER FILE; that
|
|
72
|
+
* row is a sum over the census. In a working tree the two can disagree with
|
|
73
|
+
* neither being wrong, and the message says so rather than leaving a reader
|
|
74
|
+
* to conclude that one of them is broken. */
|
|
65
75
|
violations;
|
|
66
76
|
constructor(violations) {
|
|
67
|
-
const summary = violations
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
const summary = violations
|
|
78
|
+
.map((v) => v.previousLines === null
|
|
79
|
+
? `${v.file} (${v.lines} lines, cap ${v.cap}, created over the cap)`
|
|
80
|
+
: `${v.file} (${v.lines} lines, cap ${v.cap}, grew +${v.lines - v.previousLines} from ${v.previousLines})`)
|
|
81
|
+
.join(', ');
|
|
82
|
+
super(`File size regression: ${violations.length} changed file(s) grew past (or were created over) their file-size cap: ${summary}. ` +
|
|
83
|
+
'This is the PER-FILE rule: each changed file is judged against its own size at the base ref. ' +
|
|
84
|
+
'It is a different measurement from the aggregate ratchet row `file-size excess lines` ' +
|
|
85
|
+
'(fileSizeExcessLines), which sums the whole census — so `node .husky/peaks-gate.mjs repo` ' +
|
|
86
|
+
'can print that row green at this same moment (it prints a ✓ for a held row), and ' +
|
|
87
|
+
'`node .husky/peaks-gate-baseline.mjs` can report "monotonicity: every ceiling held": one ' +
|
|
88
|
+
'file growing a few lines sits inside an aggregate fall and never reaches that row. Neither ' +
|
|
89
|
+
'reading is wrong and neither takes priority over the other; they measure different things, ' +
|
|
90
|
+
'and both must hold. ' +
|
|
91
|
+
'A file already over its cap at the base ref is accepted unless this change enlarges it; ' +
|
|
92
|
+
'a rename is measured against the size it had before the move. Split into smaller modules, ' +
|
|
93
|
+
'or consider reusing existing components / existing API data (karpathy-guidelines §2 ' +
|
|
94
|
+
'Simplicity First), or use --allow-incomplete to bypass.');
|
|
71
95
|
this.name = 'FileSizeViolationError';
|
|
72
96
|
this.violations = violations;
|
|
73
97
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { RequestType } from './artifact-prerequisites.js';
|
|
2
|
+
import { type RequestTypeSource } from './request-artifact-metadata.js';
|
|
3
|
+
import { type RequestArtifactRole } from './request-artifact-service.js';
|
|
4
|
+
export type RequestTypeChange = {
|
|
5
|
+
readonly from: RequestType;
|
|
6
|
+
readonly fromSource: RequestTypeSource;
|
|
7
|
+
readonly to: RequestType;
|
|
8
|
+
};
|
|
9
|
+
export type RetagImpact = {
|
|
10
|
+
/** Paths the new type demands and the old one did not. */
|
|
11
|
+
readonly added: ReadonlyArray<string>;
|
|
12
|
+
/** Paths the old type demanded and the new one does not. */
|
|
13
|
+
readonly removed: ReadonlyArray<string>;
|
|
14
|
+
/** Everything the new type's table demands that is not on disk, added or not. */
|
|
15
|
+
readonly missing: ReadonlyArray<string>;
|
|
16
|
+
};
|
|
17
|
+
export type RetagRequestArtifactOptions = {
|
|
18
|
+
projectRoot: string;
|
|
19
|
+
role: RequestArtifactRole;
|
|
20
|
+
requestId: string;
|
|
21
|
+
requestType: RequestType;
|
|
22
|
+
/**
|
|
23
|
+
* Required. Omitting it made `showRequestArtifact` resolve the first session
|
|
24
|
+
* holding a matching rid, so a WRITE verb could mutate an artifact nobody
|
|
25
|
+
* named. A write has to say which one.
|
|
26
|
+
*/
|
|
27
|
+
sessionId: string;
|
|
28
|
+
clock?: () => string;
|
|
29
|
+
};
|
|
30
|
+
export type RetagRequestArtifactResult = {
|
|
31
|
+
role: RequestArtifactRole;
|
|
32
|
+
requestId: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
path: string;
|
|
35
|
+
change: RequestTypeChange;
|
|
36
|
+
impact: RetagImpact;
|
|
37
|
+
/** The durable line appended to the artifact body; see `appendRetagNote`. */
|
|
38
|
+
note: string;
|
|
39
|
+
content: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Rewrite the artifact's type, changing the line the READER would take.
|
|
43
|
+
* `extractMetadata` scans every top-level `- type:` line and keeps the last
|
|
44
|
+
* usable one, so the writer targets the last line regardless of validity: if the
|
|
45
|
+
* last is a placeholder and an earlier one is real, the rewrite lands on the
|
|
46
|
+
* placeholder, which then becomes the usable one — the same line the reader
|
|
47
|
+
* picks up either way. With no such line at all (the shape a hand-written
|
|
48
|
+
* carrier has) one is inserted into the metadata block.
|
|
49
|
+
*
|
|
50
|
+
* The one other change it makes: lines are split on `\r?\n` and rejoined with
|
|
51
|
+
* `\n`, so a CRLF body comes back LF-terminated. Reproduced by an independent
|
|
52
|
+
* reviewer; named rather than implied.
|
|
53
|
+
*/
|
|
54
|
+
export declare function setRequestTypeInBody(markdown: string, requestType: RequestType): string;
|
|
55
|
+
/**
|
|
56
|
+
* The durable record of a retag, appended rather than rewritten so a later retag
|
|
57
|
+
* — or a transition's own `- transition note` — leaves every earlier one intact.
|
|
58
|
+
*
|
|
59
|
+
* It exists because the type line itself is overwritten and the difference it
|
|
60
|
+
* makes is not cosmetic: retagging down (`feature` → `chore`) stops nine
|
|
61
|
+
* artifacts being demanded. Without a line like this the only visible trace of
|
|
62
|
+
* that would be the envelope of the run that did it, and the artifact tree lives
|
|
63
|
+
* under a gitignored directory. Same idiom as `updateStatusBlock`'s note.
|
|
64
|
+
*/
|
|
65
|
+
export declare function appendRetagNote(markdown: string, change: RequestTypeChange, timestamp: string): string;
|
|
66
|
+
export declare function retagRequestArtifact(options: RetagRequestArtifactOptions): Promise<RetagRequestArtifactResult | null>;
|
|
67
|
+
/** The envelope lines a retag reports, so the change is not silent. */
|
|
68
|
+
export declare function describeRetag(result: RetagRequestArtifactResult): string[];
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import { extractMetadata } from './request-artifact-metadata.js';
|
|
3
|
+
import { demandDelta, unsatisfiedDemand } from './request-type-demand.js';
|
|
4
|
+
import { showRequestArtifact } from './request-artifact-service.js';
|
|
5
|
+
const TYPE_LINE_RE = /^-\s*type:\s*(.+?)\s*$/;
|
|
6
|
+
const SESSION_LINE_RE = /^-\s*session:\s*/;
|
|
7
|
+
const HEADING_RE = /^#\s/;
|
|
8
|
+
function defaultClock() {
|
|
9
|
+
return new Date().toISOString();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Rewrite the artifact's type, changing the line the READER would take.
|
|
13
|
+
* `extractMetadata` scans every top-level `- type:` line and keeps the last
|
|
14
|
+
* usable one, so the writer targets the last line regardless of validity: if the
|
|
15
|
+
* last is a placeholder and an earlier one is real, the rewrite lands on the
|
|
16
|
+
* placeholder, which then becomes the usable one — the same line the reader
|
|
17
|
+
* picks up either way. With no such line at all (the shape a hand-written
|
|
18
|
+
* carrier has) one is inserted into the metadata block.
|
|
19
|
+
*
|
|
20
|
+
* The one other change it makes: lines are split on `\r?\n` and rejoined with
|
|
21
|
+
* `\n`, so a CRLF body comes back LF-terminated. Reproduced by an independent
|
|
22
|
+
* reviewer; named rather than implied.
|
|
23
|
+
*/
|
|
24
|
+
export function setRequestTypeInBody(markdown, requestType) {
|
|
25
|
+
const lines = markdown.split(/\r?\n/);
|
|
26
|
+
let target = -1;
|
|
27
|
+
for (const [index, raw] of lines.entries()) {
|
|
28
|
+
if (TYPE_LINE_RE.test(raw.trim()))
|
|
29
|
+
target = index;
|
|
30
|
+
}
|
|
31
|
+
if (target >= 0) {
|
|
32
|
+
lines[target] = `- type: ${requestType}`;
|
|
33
|
+
return lines.join('\n');
|
|
34
|
+
}
|
|
35
|
+
lines.splice(insertionIndex(lines), 0, `- type: ${requestType}`);
|
|
36
|
+
return lines.join('\n');
|
|
37
|
+
}
|
|
38
|
+
/** After the `- session:` line the templates write, else below the title, else first. */
|
|
39
|
+
function insertionIndex(lines) {
|
|
40
|
+
const sessionIndex = lines.findIndex((raw) => SESSION_LINE_RE.test(raw.trim()));
|
|
41
|
+
if (sessionIndex >= 0)
|
|
42
|
+
return sessionIndex + 1;
|
|
43
|
+
const headingIndex = lines.findIndex((raw) => HEADING_RE.test(raw));
|
|
44
|
+
if (headingIndex < 0)
|
|
45
|
+
return 0;
|
|
46
|
+
let index = headingIndex + 1;
|
|
47
|
+
while (index < lines.length && lines[index]?.trim() === '')
|
|
48
|
+
index += 1;
|
|
49
|
+
return index;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The durable record of a retag, appended rather than rewritten so a later retag
|
|
53
|
+
* — or a transition's own `- transition note` — leaves every earlier one intact.
|
|
54
|
+
*
|
|
55
|
+
* It exists because the type line itself is overwritten and the difference it
|
|
56
|
+
* makes is not cosmetic: retagging down (`feature` → `chore`) stops nine
|
|
57
|
+
* artifacts being demanded. Without a line like this the only visible trace of
|
|
58
|
+
* that would be the envelope of the run that did it, and the artifact tree lives
|
|
59
|
+
* under a gitignored directory. Same idiom as `updateStatusBlock`'s note.
|
|
60
|
+
*/
|
|
61
|
+
export function appendRetagNote(markdown, change, timestamp) {
|
|
62
|
+
const body = markdown.replace(/\n+$/, '');
|
|
63
|
+
return `${body}\n- retag note (${timestamp}): ${change.from} (${change.fromSource}) -> ${change.to}\n`;
|
|
64
|
+
}
|
|
65
|
+
export async function retagRequestArtifact(options) {
|
|
66
|
+
const existing = await showRequestArtifact({
|
|
67
|
+
projectRoot: options.projectRoot,
|
|
68
|
+
role: options.role,
|
|
69
|
+
requestId: options.requestId,
|
|
70
|
+
sessionId: options.sessionId
|
|
71
|
+
});
|
|
72
|
+
if (existing === null)
|
|
73
|
+
return null;
|
|
74
|
+
const from = extractMetadata(existing.content).requestType;
|
|
75
|
+
const change = {
|
|
76
|
+
from,
|
|
77
|
+
fromSource: existing.requestTypeSource,
|
|
78
|
+
to: options.requestType
|
|
79
|
+
};
|
|
80
|
+
const delta = demandDelta(from, options.requestType);
|
|
81
|
+
// Measured before the write: a probe that throws must leave the type as it was.
|
|
82
|
+
const missing = await unsatisfiedDemand({
|
|
83
|
+
projectRoot: options.projectRoot,
|
|
84
|
+
sessionId: existing.sessionId,
|
|
85
|
+
requestId: options.requestId,
|
|
86
|
+
requestType: options.requestType
|
|
87
|
+
});
|
|
88
|
+
const timestamp = (options.clock ?? defaultClock)();
|
|
89
|
+
const note = `- retag note (${timestamp}): ${change.from} (${change.fromSource}) -> ${change.to}`;
|
|
90
|
+
const content = appendRetagNote(setRequestTypeInBody(existing.content, options.requestType), change, timestamp);
|
|
91
|
+
await writeFile(existing.path, content, 'utf8');
|
|
92
|
+
return {
|
|
93
|
+
role: options.role,
|
|
94
|
+
requestId: options.requestId,
|
|
95
|
+
sessionId: existing.sessionId,
|
|
96
|
+
path: existing.path,
|
|
97
|
+
change,
|
|
98
|
+
impact: {
|
|
99
|
+
added: delta.added.map((path) => path.replace('<rid>', options.requestId)),
|
|
100
|
+
removed: delta.removed.map((path) => path.replace('<rid>', options.requestId)),
|
|
101
|
+
missing
|
|
102
|
+
},
|
|
103
|
+
note,
|
|
104
|
+
content
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** The envelope lines a retag reports, so the change is not silent. */
|
|
108
|
+
export function describeRetag(result) {
|
|
109
|
+
const { change, impact } = result;
|
|
110
|
+
const lines = [
|
|
111
|
+
change.fromSource === 'default'
|
|
112
|
+
? `request type was the default '${change.from}' (the artifact recorded no type); it is now '${change.to}'.`
|
|
113
|
+
: `request type '${change.from}' is now '${change.to}'.`
|
|
114
|
+
];
|
|
115
|
+
if (impact.added.length > 0) {
|
|
116
|
+
lines.push(`now demanded (${impact.added.length}): ${impact.added.join(', ')}.`);
|
|
117
|
+
}
|
|
118
|
+
if (impact.removed.length > 0) {
|
|
119
|
+
lines.push(`no longer demanded (${impact.removed.length}): ${impact.removed.join(', ')}.`);
|
|
120
|
+
}
|
|
121
|
+
if (impact.missing.length > 0) {
|
|
122
|
+
lines.push(`unsatisfied at '${change.to}' (${impact.missing.length} not on disk): ${impact.missing.join(', ')} — the next gate reads the new table and will refuse until they exist.`);
|
|
123
|
+
}
|
|
124
|
+
return lines;
|
|
125
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type RequestArtifactState } from './request-artifact-state-helpers.js';
|
|
2
|
+
import type { RequestArtifactRole } from './artifact-templates.js';
|
|
3
|
+
export type StateOrderBreach = {
|
|
4
|
+
/** `jump` — the move skips past an intermediate state. `unreadable` — the
|
|
5
|
+
* current state could not be read, so the move cannot be shown to be legal. */
|
|
6
|
+
kind: 'jump' | 'unreadable';
|
|
7
|
+
/** The states this move skips over. Empty for `unreadable`. */
|
|
8
|
+
skipped: ReadonlyArray<RequestArtifactState>;
|
|
9
|
+
/** The one legal next state from a READABLE current one, else `null`. */
|
|
10
|
+
next: RequestArtifactState | null;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* `null` when the move is allowed, or the breach when it is not.
|
|
14
|
+
*
|
|
15
|
+
* FAIL-CLOSED on an unreadable current state. A carrier with no `- state:` line
|
|
16
|
+
* reads as the literal `'unknown'` (the `readArtifactState(...) ?? 'unknown'`
|
|
17
|
+
* fallback in the transition service), and this gate runs before every other
|
|
18
|
+
* one. Reading "I could not read it" as "no jump" would therefore hand the gate
|
|
19
|
+
* an off-switch that is one deleted line — re-opening the `rd → handed-off` jump
|
|
20
|
+
* this module exists to stop — so an unreadable state is refused, not allowed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function stateOrderViolation(role: RequestArtifactRole, from: string, to: RequestArtifactState): StateOrderBreach | null;
|
|
23
|
+
/** The breach kinds get their own codes: a refusal that cannot be named is a
|
|
24
|
+
* refusal a consumer cannot act on, and "jumped" is not "could not be read". */
|
|
25
|
+
export declare const STATE_ORDER_JUMP_CODE = "STATE_ORDER_JUMP";
|
|
26
|
+
export declare const STATE_ORDER_UNREADABLE_CODE = "STATE_ORDER_UNREADABLE";
|
|
27
|
+
export declare class StateOrderViolationError extends Error {
|
|
28
|
+
readonly code: string;
|
|
29
|
+
readonly role: RequestArtifactRole;
|
|
30
|
+
readonly from: string;
|
|
31
|
+
readonly to: RequestArtifactState;
|
|
32
|
+
readonly skipped: ReadonlyArray<RequestArtifactState>;
|
|
33
|
+
readonly kind: StateOrderBreach['kind'];
|
|
34
|
+
constructor(role: RequestArtifactRole, from: string, to: RequestArtifactState, breach: StateOrderBreach);
|
|
35
|
+
}
|
|
36
|
+
/** Throws when `to` skips an intermediate state or the current state is
|
|
37
|
+
* unreadable. `bypass` is the caller's `--allow-incomplete` escape hatch. */
|
|
38
|
+
export declare function assertLegalStateStep(role: RequestArtifactRole, from: string, to: RequestArtifactState, bypass: boolean): void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// src/services/artifacts/request-state-order.ts
|
|
2
|
+
//
|
|
3
|
+
// The request state machine's ORDER rule, in one place (S-14, session
|
|
4
|
+
// `2026-10-12-session-74bd69`).
|
|
5
|
+
//
|
|
6
|
+
// `ALLOWED_STATES_PER_ROLE` is a SEQUENCE, but `transitionRequestArtifact`
|
|
7
|
+
// tested only membership. Measured: with `rd → implemented` and
|
|
8
|
+
// `rd → qa-handoff` both refused, `rd → handed-off` still passed — a slice
|
|
9
|
+
// could report itself delivered past every intermediate gate. A FORWARD jump is
|
|
10
|
+
// refused here.
|
|
11
|
+
//
|
|
12
|
+
// Deliberately allowed: any move to or from `blocked` (a side state, not a
|
|
13
|
+
// step); the current state; and any move BACKWARD — the QA return-to-rd repair
|
|
14
|
+
// re-enters `rd: spec-locked` from `qa-handoff` (micro-cycle.md §"How Code
|
|
15
|
+
// routes QA findings back to RD"), so this is a skip test, not a rising-rank
|
|
16
|
+
// test. `--allow-incomplete` bypasses it, like every other transition gate —
|
|
17
|
+
// the flag opens FOUR gates now (order, prerequisites, lint, file size), so the
|
|
18
|
+
// refusal's own remedy line reads narrower than the flag actually is.
|
|
19
|
+
//
|
|
20
|
+
// FAIL-CLOSED. An unreadable current state is REFUSED, not allowed: allowing it
|
|
21
|
+
// would make a deleted `- state:` line an off-switch for this whole gate.
|
|
22
|
+
//
|
|
23
|
+
// Split out of `request-artifact-state-helpers.ts` (254 raw lines at the split)
|
|
24
|
+
// so that file stays under its 300-line cap while this rule has room to be
|
|
25
|
+
// stated in full.
|
|
26
|
+
import { ALLOWED_STATES_PER_ROLE } from './request-artifact-state-helpers.js';
|
|
27
|
+
/** The role's states in declared order, minus `blocked` (which has no rank). */
|
|
28
|
+
function orderedStatesForRole(role) {
|
|
29
|
+
return ALLOWED_STATES_PER_ROLE[role].filter((state) => state !== 'blocked');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `null` when the move is allowed, or the breach when it is not.
|
|
33
|
+
*
|
|
34
|
+
* FAIL-CLOSED on an unreadable current state. A carrier with no `- state:` line
|
|
35
|
+
* reads as the literal `'unknown'` (the `readArtifactState(...) ?? 'unknown'`
|
|
36
|
+
* fallback in the transition service), and this gate runs before every other
|
|
37
|
+
* one. Reading "I could not read it" as "no jump" would therefore hand the gate
|
|
38
|
+
* an off-switch that is one deleted line — re-opening the `rd → handed-off` jump
|
|
39
|
+
* this module exists to stop — so an unreadable state is refused, not allowed.
|
|
40
|
+
*/
|
|
41
|
+
export function stateOrderViolation(role, from, to) {
|
|
42
|
+
if (from === 'blocked' || to === 'blocked')
|
|
43
|
+
return null;
|
|
44
|
+
const order = orderedStatesForRole(role);
|
|
45
|
+
const toIndex = order.indexOf(to);
|
|
46
|
+
if (toIndex < 0)
|
|
47
|
+
return null;
|
|
48
|
+
const fromIndex = order.indexOf(from);
|
|
49
|
+
if (fromIndex < 0)
|
|
50
|
+
return { kind: 'unreadable', skipped: [], next: null };
|
|
51
|
+
if (toIndex <= fromIndex + 1)
|
|
52
|
+
return null;
|
|
53
|
+
return {
|
|
54
|
+
kind: 'jump',
|
|
55
|
+
skipped: order.slice(fromIndex + 1, toIndex),
|
|
56
|
+
next: order[fromIndex + 1] ?? null
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** The breach kinds get their own codes: a refusal that cannot be named is a
|
|
60
|
+
* refusal a consumer cannot act on, and "jumped" is not "could not be read". */
|
|
61
|
+
export const STATE_ORDER_JUMP_CODE = 'STATE_ORDER_JUMP';
|
|
62
|
+
export const STATE_ORDER_UNREADABLE_CODE = 'STATE_ORDER_UNREADABLE';
|
|
63
|
+
export class StateOrderViolationError extends Error {
|
|
64
|
+
code;
|
|
65
|
+
role;
|
|
66
|
+
from;
|
|
67
|
+
to;
|
|
68
|
+
skipped;
|
|
69
|
+
kind;
|
|
70
|
+
constructor(role, from, to, breach) {
|
|
71
|
+
super(`Cannot transition ${role} from '${from}' to '${to}': ` +
|
|
72
|
+
(breach.kind === 'unreadable'
|
|
73
|
+
? "the artifact's current state could not be read (no '- state:' line, " +
|
|
74
|
+
"or a state this role's machine does not define). Failing closed — a move " +
|
|
75
|
+
'that cannot be shown to be legal is refused, not allowed. '
|
|
76
|
+
: `that skips ${breach.skipped.map((state) => `'${state}'`).join(', ')}. ` +
|
|
77
|
+
(breach.next === null
|
|
78
|
+
? ''
|
|
79
|
+
: `Move one state at a time — the next legal state is '${breach.next}'. `)) +
|
|
80
|
+
'Walk the states in order, or bypass with --allow-incomplete --reason "<justification>".');
|
|
81
|
+
this.name = 'StateOrderViolationError';
|
|
82
|
+
this.code = breach.kind === 'unreadable' ? STATE_ORDER_UNREADABLE_CODE : STATE_ORDER_JUMP_CODE;
|
|
83
|
+
this.role = role;
|
|
84
|
+
this.from = from;
|
|
85
|
+
this.to = to;
|
|
86
|
+
this.kind = breach.kind;
|
|
87
|
+
this.skipped = breach.skipped;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** Throws when `to` skips an intermediate state or the current state is
|
|
91
|
+
* unreadable. `bypass` is the caller's `--allow-incomplete` escape hatch. */
|
|
92
|
+
export function assertLegalStateStep(role, from, to, bypass) {
|
|
93
|
+
if (bypass)
|
|
94
|
+
return;
|
|
95
|
+
const breach = stateOrderViolation(role, from, to);
|
|
96
|
+
if (breach !== null) {
|
|
97
|
+
throw new StateOrderViolationError(role, from, to, breach);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type RequestType } from './artifact-prerequisites.js';
|
|
2
|
+
import { type RequestArtifactState } from './request-artifact-state-helpers.js';
|
|
3
|
+
import type { RequestArtifactRole } from './artifact-templates.js';
|
|
4
|
+
export type DemandRow = {
|
|
5
|
+
role: RequestArtifactRole;
|
|
6
|
+
state: RequestArtifactState;
|
|
7
|
+
/** The table's own `relativePath` values, `<rid>` still unsubstituted. */
|
|
8
|
+
paths: ReadonlyArray<string>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Every row of `requestType`'s table that demands at least one artifact, in role
|
|
12
|
+
* then state declaration order. This is the answer to "which prerequisite table
|
|
13
|
+
* is being applied" that does not require opening `artifact-prerequisites.ts`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function demandRows(requestType: RequestType): DemandRow[];
|
|
16
|
+
export type DemandDelta = {
|
|
17
|
+
/** Demanded by `to` and not by `from`. */
|
|
18
|
+
added: string[];
|
|
19
|
+
/** Demanded by `from` and not by `to`. */
|
|
20
|
+
removed: string[];
|
|
21
|
+
};
|
|
22
|
+
/** The artifacts a type change starts demanding, and stops demanding. */
|
|
23
|
+
export declare function demandDelta(from: RequestType, to: RequestType): DemandDelta;
|
|
24
|
+
/**
|
|
25
|
+
* The artifacts `requestType` demands that are not on disk right now.
|
|
26
|
+
*
|
|
27
|
+
* Deliberately NOT restricted to the paths a retag just added. A request that
|
|
28
|
+
* recorded no type and is retagged to the effective type it already had — the
|
|
29
|
+
* commonest retag there is — changes nothing in the demand set, so a delta-only
|
|
30
|
+
* answer would be empty on exactly the input this check exists for.
|
|
31
|
+
*
|
|
32
|
+
* Answered with `checkPrerequisites` — the same resolver the transition gate
|
|
33
|
+
* runs — rather than a second path probe, so a retag cannot report a file
|
|
34
|
+
* present that the next transition would refuse. The rows also carry a
|
|
35
|
+
* declaration check against the PRD capsule; the result is filtered to the
|
|
36
|
+
* table's own paths, because that failure is not the type's. `emitEvents: false`
|
|
37
|
+
* because nothing transitions here.
|
|
38
|
+
*/
|
|
39
|
+
export declare function unsatisfiedDemand(options: {
|
|
40
|
+
projectRoot: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
requestId: string;
|
|
43
|
+
requestType: RequestType;
|
|
44
|
+
}): Promise<string[]>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { checkPrerequisites, getPrerequisitesFor } from './artifact-prerequisites.js';
|
|
2
|
+
import { ALLOWED_STATES_PER_ROLE } from './request-artifact-state-helpers.js';
|
|
3
|
+
const ROLES = Object.keys(ALLOWED_STATES_PER_ROLE);
|
|
4
|
+
/**
|
|
5
|
+
* Every row of `requestType`'s table that demands at least one artifact, in role
|
|
6
|
+
* then state declaration order. This is the answer to "which prerequisite table
|
|
7
|
+
* is being applied" that does not require opening `artifact-prerequisites.ts`.
|
|
8
|
+
*/
|
|
9
|
+
export function demandRows(requestType) {
|
|
10
|
+
const rows = [];
|
|
11
|
+
for (const role of ROLES) {
|
|
12
|
+
for (const state of ALLOWED_STATES_PER_ROLE[role]) {
|
|
13
|
+
const paths = getPrerequisitesFor(role, state, requestType).map((entry) => entry.relativePath);
|
|
14
|
+
if (paths.length > 0)
|
|
15
|
+
rows.push({ role, state, paths });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return rows;
|
|
19
|
+
}
|
|
20
|
+
function demandPaths(requestType) {
|
|
21
|
+
const paths = new Set();
|
|
22
|
+
for (const row of demandRows(requestType)) {
|
|
23
|
+
for (const path of row.paths)
|
|
24
|
+
paths.add(path);
|
|
25
|
+
}
|
|
26
|
+
return paths;
|
|
27
|
+
}
|
|
28
|
+
/** The artifacts a type change starts demanding, and stops demanding. */
|
|
29
|
+
export function demandDelta(from, to) {
|
|
30
|
+
const before = demandPaths(from);
|
|
31
|
+
const after = demandPaths(to);
|
|
32
|
+
return {
|
|
33
|
+
added: [...after].filter((path) => !before.has(path)),
|
|
34
|
+
removed: [...before].filter((path) => !after.has(path))
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The artifacts `requestType` demands that are not on disk right now.
|
|
39
|
+
*
|
|
40
|
+
* Deliberately NOT restricted to the paths a retag just added. A request that
|
|
41
|
+
* recorded no type and is retagged to the effective type it already had — the
|
|
42
|
+
* commonest retag there is — changes nothing in the demand set, so a delta-only
|
|
43
|
+
* answer would be empty on exactly the input this check exists for.
|
|
44
|
+
*
|
|
45
|
+
* Answered with `checkPrerequisites` — the same resolver the transition gate
|
|
46
|
+
* runs — rather than a second path probe, so a retag cannot report a file
|
|
47
|
+
* present that the next transition would refuse. The rows also carry a
|
|
48
|
+
* declaration check against the PRD capsule; the result is filtered to the
|
|
49
|
+
* table's own paths, because that failure is not the type's. `emitEvents: false`
|
|
50
|
+
* because nothing transitions here.
|
|
51
|
+
*/
|
|
52
|
+
export async function unsatisfiedDemand(options) {
|
|
53
|
+
const wanted = new Set([...demandPaths(options.requestType)].map((path) => path.replace('<rid>', options.requestId)));
|
|
54
|
+
const missing = new Set();
|
|
55
|
+
for (const row of demandRows(options.requestType)) {
|
|
56
|
+
const result = await checkPrerequisites({
|
|
57
|
+
projectRoot: options.projectRoot,
|
|
58
|
+
sessionId: options.sessionId,
|
|
59
|
+
role: row.role,
|
|
60
|
+
newState: row.state,
|
|
61
|
+
requestId: options.requestId,
|
|
62
|
+
requestType: options.requestType,
|
|
63
|
+
emitEvents: false
|
|
64
|
+
});
|
|
65
|
+
for (const entry of result.missing) {
|
|
66
|
+
if (wanted.has(entry.path))
|
|
67
|
+
missing.add(entry.path);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return [...missing];
|
|
71
|
+
}
|
|
@@ -22,9 +22,16 @@ export interface LlmRunner {
|
|
|
22
22
|
maxTokens: number;
|
|
23
23
|
}): Promise<{
|
|
24
24
|
output: string;
|
|
25
|
+
/**
|
|
26
|
+
* `input` / `output` are the counts an observability reader sums; `source`
|
|
27
|
+
* says whether the provider reported them or the runner had to estimate
|
|
28
|
+
* (optional so a runner that always has provider numbers — or a test fake —
|
|
29
|
+
* need not state it).
|
|
30
|
+
*/
|
|
25
31
|
tokens: {
|
|
26
32
|
input: number;
|
|
27
33
|
output: number;
|
|
34
|
+
source?: 'provider' | 'estimated';
|
|
28
35
|
};
|
|
29
36
|
}>;
|
|
30
37
|
}
|
|
@@ -54,3 +54,21 @@ export declare function resolveActiveSkillForCaller(projectRoot: string, opts?:
|
|
|
54
54
|
legacyPresence?: boolean;
|
|
55
55
|
callerId?: string | null;
|
|
56
56
|
}): ActiveSkillResolution;
|
|
57
|
+
/**
|
|
58
|
+
* Whether any in-flight lease in this session carries a `peaks-*` skill.
|
|
59
|
+
*
|
|
60
|
+
* Independent of `resolveActiveSkillForCaller` on purpose: that function is
|
|
61
|
+
* the one under suspicion when the identity cannot be resolved, so asking it
|
|
62
|
+
* whether peaks is present would be circular. Fails open — a bug in peaks
|
|
63
|
+
* must not brick the harness.
|
|
64
|
+
*/
|
|
65
|
+
export declare function hasPeaksLeaseInSession(projectRoot: string): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether this caller owns at least one in-flight lease in the session.
|
|
68
|
+
*
|
|
69
|
+
* `resolveActiveSkillForCaller` cannot answer this: it returns
|
|
70
|
+
* `{ skill: null, source: 'none' }` both when a caller has no lease and when
|
|
71
|
+
* the id handed over is not the lease's key. Those two need different
|
|
72
|
+
* decisions, so the call site asks directly.
|
|
73
|
+
*/
|
|
74
|
+
export declare function hasLeaseForCaller(projectRoot: string, callerId: string): boolean;
|
|
@@ -28,6 +28,7 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
|
28
28
|
import { join } from 'node:path';
|
|
29
29
|
import { getSessionIdCanonical } from '../../session/session-manager.js';
|
|
30
30
|
import { getSessionDir } from '../../session/getSessionDir.js';
|
|
31
|
+
import { comparePresenceLeases } from '../../skills/presence-lease-order.js';
|
|
31
32
|
import { readPresenceLease, listPresenceLeases } from '../../skills/presence-lease-service.js';
|
|
32
33
|
import { getCurrentSessionId, normalizeSkillPresenceMode } from '../../skills/skill-presence-service.js';
|
|
33
34
|
const ACTIVE_SKILL_PREFIX = 'active-skill-';
|
|
@@ -87,7 +88,13 @@ export function resolveActiveSkillForCaller(projectRoot, opts) {
|
|
|
87
88
|
catch {
|
|
88
89
|
canonicalLeases = [];
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
// Freshest first, through the same comparator the statusline reader uses.
|
|
92
|
+
// The two readers disagreed: that one sorted by heartbeat, this one took
|
|
93
|
+
// `readdirSync` order, so "who is driving" had two answers. Sorted here rather
|
|
94
|
+
// than in the shared `listPresenceLeases`, whose output order every consumer
|
|
95
|
+
// sees.
|
|
96
|
+
const orderedLeases = [...canonicalLeases].sort(comparePresenceLeases);
|
|
97
|
+
for (const lease of orderedLeases) {
|
|
91
98
|
if (lease.status !== 'preparing' && lease.status !== 'running')
|
|
92
99
|
continue;
|
|
93
100
|
if (typeof lease.skill !== 'string' || lease.skill.length === 0)
|
|
@@ -162,3 +169,43 @@ export function resolveActiveSkillForCaller(projectRoot, opts) {
|
|
|
162
169
|
void getCurrentSessionId;
|
|
163
170
|
return { skill: null, callerId: null, sessionId, mode: null, source: 'none' };
|
|
164
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Whether any in-flight lease in this session carries a `peaks-*` skill.
|
|
174
|
+
*
|
|
175
|
+
* Independent of `resolveActiveSkillForCaller` on purpose: that function is
|
|
176
|
+
* the one under suspicion when the identity cannot be resolved, so asking it
|
|
177
|
+
* whether peaks is present would be circular. Fails open — a bug in peaks
|
|
178
|
+
* must not brick the harness.
|
|
179
|
+
*/
|
|
180
|
+
export function hasPeaksLeaseInSession(projectRoot) {
|
|
181
|
+
try {
|
|
182
|
+
const sessionId = getSessionIdCanonical(projectRoot);
|
|
183
|
+
if (sessionId === null)
|
|
184
|
+
return false;
|
|
185
|
+
return listPresenceLeases(projectRoot, sessionId).some((lease) => (lease.status === 'preparing' || lease.status === 'running') &&
|
|
186
|
+
typeof lease.skill === 'string' &&
|
|
187
|
+
lease.skill.startsWith('peaks-'));
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Whether this caller owns at least one in-flight lease in the session.
|
|
195
|
+
*
|
|
196
|
+
* `resolveActiveSkillForCaller` cannot answer this: it returns
|
|
197
|
+
* `{ skill: null, source: 'none' }` both when a caller has no lease and when
|
|
198
|
+
* the id handed over is not the lease's key. Those two need different
|
|
199
|
+
* decisions, so the call site asks directly.
|
|
200
|
+
*/
|
|
201
|
+
export function hasLeaseForCaller(projectRoot, callerId) {
|
|
202
|
+
try {
|
|
203
|
+
const sessionId = getSessionIdCanonical(projectRoot);
|
|
204
|
+
if (sessionId === null)
|
|
205
|
+
return false;
|
|
206
|
+
return listPresenceLeases(projectRoot, sessionId).some((lease) => (lease.status === 'preparing' || lease.status === 'running') && lease.callerId === callerId);
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -12,12 +12,21 @@
|
|
|
12
12
|
* never bricked by a peaks bug.
|
|
13
13
|
*/
|
|
14
14
|
export interface CodeBanInput {
|
|
15
|
-
|
|
15
|
+
/** The resolved driving skill, or `null` when no skill could be resolved. */
|
|
16
|
+
readonly skill: string | null;
|
|
16
17
|
readonly command: string;
|
|
18
|
+
/** Whether a `peaks-*` lease exists in this peaks session. */
|
|
19
|
+
readonly peaksLeasePresent: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the caller's identity was resolved. When `true`, `skill === null`
|
|
22
|
+
* means "this caller resolved and has no peaks skill" — which is an allow.
|
|
23
|
+
* When `false`, we could not tell who is driving at all.
|
|
24
|
+
*/
|
|
25
|
+
readonly identityResolved: boolean;
|
|
17
26
|
}
|
|
18
27
|
export interface CodeBanResult {
|
|
19
28
|
readonly denied: boolean;
|
|
20
29
|
readonly reason: string;
|
|
21
30
|
}
|
|
22
|
-
export declare function isCodeCommit(skill: string, command: string): boolean;
|
|
31
|
+
export declare function isCodeCommit(skill: string | null, command: string): boolean;
|
|
23
32
|
export declare function evaluateCodeBan(input: CodeBanInput): CodeBanResult;
|