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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
3
|
+
export declare function runCronSchedulerStop(io: ProgramIO, options: {
|
|
4
|
+
project?: string;
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}): void;
|
|
7
|
+
export declare function registerCronSchedulerStopCommand(cmd: Command, io: ProgramIO): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/cli/commands/cron-scheduler-stop-command.ts
|
|
2
|
+
//
|
|
3
|
+
// `peaks cron-scheduler stop` — SIGTERM the scheduler pid (best-effort) and
|
|
4
|
+
// remove the pid file either way. Split out of `cron-scheduler-commands.ts`;
|
|
5
|
+
// the signal, the unlink and both envelopes are unchanged.
|
|
6
|
+
import { unlinkSync } from 'node:fs';
|
|
7
|
+
import { addJsonOption, getErrorMessage, printResult } from '../cli-helpers.js';
|
|
8
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
9
|
+
import { findProjectRoot } from '../../services/config/config-safety.js';
|
|
10
|
+
import { isPidAlive, readSchedulerPid, schedulerPidPath } from './cron-scheduler-shared.js';
|
|
11
|
+
/** The no-pid-file outcome: nothing to signal, nothing to unlink. */
|
|
12
|
+
function emitNoPidFile(io, options, projectRoot) {
|
|
13
|
+
printResult(io, ok('cron-scheduler.stop', { projectRoot, stopped: false, reason: 'no-pid-file' }, [], ['No scheduler pid file found; nothing to stop.']), options.json ?? false);
|
|
14
|
+
}
|
|
15
|
+
/** SIGTERM the pid (best-effort) and remove the pid file either way. */
|
|
16
|
+
function terminateScheduler(projectRoot, pid) {
|
|
17
|
+
let signalSent = false;
|
|
18
|
+
if (isPidAlive(pid)) {
|
|
19
|
+
try {
|
|
20
|
+
process.kill(pid, 'SIGTERM');
|
|
21
|
+
signalSent = true;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
signalSent = false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const pidFile = schedulerPidPath(projectRoot);
|
|
28
|
+
try {
|
|
29
|
+
unlinkSync(pidFile);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
/* best-effort */
|
|
33
|
+
}
|
|
34
|
+
return { signalSent, pidFile };
|
|
35
|
+
}
|
|
36
|
+
export function runCronSchedulerStop(io, options) {
|
|
37
|
+
try {
|
|
38
|
+
const projectRoot = options.project ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
39
|
+
const pid = readSchedulerPid(projectRoot);
|
|
40
|
+
if (pid === null) {
|
|
41
|
+
emitNoPidFile(io, options, projectRoot);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const { signalSent, pidFile } = terminateScheduler(projectRoot, pid);
|
|
45
|
+
printResult(io, ok('cron-scheduler.stop', { projectRoot, stopped: signalSent, pid, pidFile }, [], [
|
|
46
|
+
signalSent
|
|
47
|
+
? `Sent SIGTERM to pid ${pid}; pid file removed.`
|
|
48
|
+
: `pid ${pid} was not alive; pid file removed.`
|
|
49
|
+
]), options.json ?? false);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
printResult(io, fail('cron-scheduler.stop', 'SCHEDULER_STOP_FAILED', getErrorMessage(err), { projectRoot: options.project }, ['Verify the pid file is readable / the process is yours.']), options.json ?? false);
|
|
53
|
+
process.exitCode = 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function registerCronSchedulerStopCommand(cmd, io) {
|
|
57
|
+
addJsonOption(cmd
|
|
58
|
+
.command('stop')
|
|
59
|
+
.description('Send SIGTERM to the scheduler pid (best-effort; removes the pid file either way).')
|
|
60
|
+
.option('--project <path>', 'project root (default: findProjectRoot(cwd))')).action((options) => runCronSchedulerStop(io, options));
|
|
61
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the invocations a dispatch prompt names are commands this CLI will
|
|
3
|
+
* accept, with the flags the prompt gives them.
|
|
4
|
+
*
|
|
5
|
+
* A dispatch brief tells a sub-agent which commands to run, and those quotations
|
|
6
|
+
* are prose to every other reader — no gate parses them. A brief naming a flag
|
|
7
|
+
* the command does not declare therefore reaches the sub-agent intact and costs
|
|
8
|
+
* it a failed run, and nothing measures it. This module makes the quotation
|
|
9
|
+
* checkable: each run `./dispatch-cli-invocation-scan.ts` cut out of the prompt
|
|
10
|
+
* is resolved against the registered command tree, and the flags it carries are
|
|
11
|
+
* compared with the ones the resolved command declares.
|
|
12
|
+
*
|
|
13
|
+
* The source of truth is the REGISTERED CLI, never a hand-kept flag table. The
|
|
14
|
+
* caller passes the real root `Command`; declared flags are read off
|
|
15
|
+
* `option.long` / `option.short` and gathered up the parent chain, so a flag an
|
|
16
|
+
* ancestor declares counts as declared. Measured on this CLI: `peaks code
|
|
17
|
+
* context-now --verbose` is accepted and `--verbose` is declared only on the
|
|
18
|
+
* root program, while `peaks worktree auth grant --rid x` is refused — with
|
|
19
|
+
* `error: required option '--operation <op>' not specified` in that form, and
|
|
20
|
+
* with `error: unknown option '--rid'` only once `--operation` and `--reason`
|
|
21
|
+
* are supplied, because commander reports a missing required option first. Both
|
|
22
|
+
* halves were run.
|
|
23
|
+
*
|
|
24
|
+
* The `option.mandatory` distinction recorded in
|
|
25
|
+
* `tests/unit/services/artifacts/artifact-contract-block.test.ts` does NOT apply
|
|
26
|
+
* here. That test asks which flags a command REQUIRES; this one asks which flags
|
|
27
|
+
* a command DECLARES. `option.required` — true for every option that takes a
|
|
28
|
+
* value — is never read, so the trap of reading it in place of `mandatory`
|
|
29
|
+
* cannot arise.
|
|
30
|
+
*
|
|
31
|
+
* WHAT THIS CHECK DOES NOT SEE, each one measured and each one deliberate:
|
|
32
|
+
*
|
|
33
|
+
* - A sentence that NAMES a flag without invoking a command.
|
|
34
|
+
* - A flag COMMANDER itself supplies. `--help` (and its short form) is accepted by
|
|
35
|
+
* every registered command but is not one of `command.options`, so
|
|
36
|
+
* `peaks worktree auth grant --help` is reported as an undeclared flag. Measured
|
|
37
|
+
* while correcting the dispatch block, where a pointer at `--help` was a
|
|
38
|
+
* candidate rewording and had to be rejected for this reason alone. Recorded
|
|
39
|
+
* rather than fixed: the same walk up the parent chain is what makes an
|
|
40
|
+
* inherited flag count as declared, so a targeted excuse for `--help` belongs to
|
|
41
|
+
* its own slice with its own corpus measurement.
|
|
42
|
+
* - An invocation of a program that is not `peaks` (`git`, `pnpm`, `npx` — this
|
|
43
|
+
* CLI holds no registry for them), and an invocation that reaches this CLI by
|
|
44
|
+
* PATH rather than by name. The corpus spells the perf-audit run it ought to
|
|
45
|
+
* have flagged as `node node_modules/tsx/dist/cli.mjs src/cli/index.ts
|
|
46
|
+
* perf-audit run --rid …`, with no `peaks` token at all, so no run is
|
|
47
|
+
* extracted and that line is unchecked today.
|
|
48
|
+
* - Whether a quoted invocation is meant as an INSTRUCTION or as a quotation of
|
|
49
|
+
* a defect. This is the check's known false-positive class, measured rather
|
|
50
|
+
* than hidden: a brief that documents a rejected invocation quotes it, and
|
|
51
|
+
* reads exactly like a brief that instructs it.
|
|
52
|
+
* - A run longer than the scan's bound, a flag spelled past a line break that is
|
|
53
|
+
* not a continuation, and a capitalised `Peaks`. Each is measured and argued
|
|
54
|
+
* in `./dispatch-cli-invocation-scan.ts`, where the boundary lives.
|
|
55
|
+
* - `--mode detached` and `--from-dag`, which return before the pipeline that
|
|
56
|
+
* composes a prompt (`dispatch-commands.ts`), so a brief handed over on either
|
|
57
|
+
* path is never checked. The in-process path is the one that writes the
|
|
58
|
+
* dispatch record the corpus is drawn from.
|
|
59
|
+
*
|
|
60
|
+
* TWO DECISIONS ARE RECORDED HERE BECAUSE BOTH ARE MEASUREMENTS, NOT TASTE.
|
|
61
|
+
*
|
|
62
|
+
* 1. The subject is the CALLER's prompt, not the assembled one. Measured over
|
|
63
|
+
* the 147 dispatch records under `.peaks/_sub_agents/`: 176 undeclared-flag
|
|
64
|
+
* findings, of which 147 sit inside the machine-injected worktree block this
|
|
65
|
+
* CLI writes into every prompt and 29 inside caller-authored text. Only the
|
|
66
|
+
* 29 belong to the caller who is warned, and only they make the check
|
|
67
|
+
* discriminating — a check reading the assembled string warns on every
|
|
68
|
+
* dispatch, whatever the brief says.
|
|
69
|
+
* 2. A finding WARNS; it does not refuse. Of those 29, ONE is a false positive:
|
|
70
|
+
* a CORRECT brief (the record for this very slice) that quotes
|
|
71
|
+
* `peaks request init --rid <rid>` inside a table documenting the defect. A
|
|
72
|
+
* corpus that cannot be made clean is the branch that must not refuse, and
|
|
73
|
+
* narrowing the check until it is green would stop it firing on the input it
|
|
74
|
+
* exists for. The false positive is named rather than engineered away.
|
|
75
|
+
*/
|
|
76
|
+
import type { Command } from 'commander';
|
|
77
|
+
import { type PromptCliInvocation } from './dispatch-cli-invocation-scan.js';
|
|
78
|
+
/**
|
|
79
|
+
* What the registered CLI said about one invocation. `unknown-command` is a
|
|
80
|
+
* distinct state on purpose: a check that folded "could not resolve" into
|
|
81
|
+
* "clean" would pass every prompt it failed to read.
|
|
82
|
+
*/
|
|
83
|
+
export type PromptCliVerdict = {
|
|
84
|
+
readonly kind: 'clean';
|
|
85
|
+
readonly command: string;
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: 'undeclared-flag';
|
|
88
|
+
readonly command: string;
|
|
89
|
+
readonly flags: readonly string[];
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: 'unknown-command';
|
|
92
|
+
readonly attempted: string;
|
|
93
|
+
};
|
|
94
|
+
/** One invocation and the verdict on it. */
|
|
95
|
+
export interface PromptCliFinding {
|
|
96
|
+
readonly text: string;
|
|
97
|
+
readonly verdict: PromptCliVerdict;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Resolve one invocation against `root` and compare its flags with the ones the
|
|
101
|
+
* resolved command declares. Operands stop the descent; options are skipped
|
|
102
|
+
* during it, since a flag may sit between two subcommand words.
|
|
103
|
+
*/
|
|
104
|
+
export declare function checkPromptCliInvocation(invocation: PromptCliInvocation, root: Command): PromptCliVerdict;
|
|
105
|
+
/** Every invocation `text` carries, each with the verdict on it. */
|
|
106
|
+
export declare function checkPromptCliInvocations(text: string, root: Command): PromptCliFinding[];
|
|
107
|
+
/** The warning list a dispatch envelope carries for the prompt it is handing over. */
|
|
108
|
+
export declare function cliInvocationWarnings(text: string, root: Command): string[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { extractPromptCliInvocations } from './dispatch-cli-invocation-scan.js';
|
|
2
|
+
/** How many undeclared flags a warning names before it counts the rest instead. */
|
|
3
|
+
const FLAG_LIMIT = 8;
|
|
4
|
+
/** The flag a token carries, or null when the token is an operand rather than an option. */
|
|
5
|
+
function optionName(token) {
|
|
6
|
+
if (!/^--?[A-Za-z]/.test(token))
|
|
7
|
+
return null;
|
|
8
|
+
const equals = token.indexOf('=');
|
|
9
|
+
return equals === -1 ? token : token.slice(0, equals);
|
|
10
|
+
}
|
|
11
|
+
/** The subcommand of `command` that answers to `name`, matching aliases too. */
|
|
12
|
+
function childNamed(command, name) {
|
|
13
|
+
return command.commands.find((candidate) => candidate.name() === name || candidate.aliases().includes(name));
|
|
14
|
+
}
|
|
15
|
+
/** The flags `command` declares, plus every flag its ancestors declare. */
|
|
16
|
+
function declaredFlags(command) {
|
|
17
|
+
const flags = new Set();
|
|
18
|
+
let current = command;
|
|
19
|
+
while (current !== null) {
|
|
20
|
+
for (const option of current.options) {
|
|
21
|
+
if (option.long !== undefined)
|
|
22
|
+
flags.add(option.long);
|
|
23
|
+
if (option.short !== undefined)
|
|
24
|
+
flags.add(option.short);
|
|
25
|
+
}
|
|
26
|
+
current = current.parent;
|
|
27
|
+
}
|
|
28
|
+
return flags;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolve one invocation against `root` and compare its flags with the ones the
|
|
32
|
+
* resolved command declares. Operands stop the descent; options are skipped
|
|
33
|
+
* during it, since a flag may sit between two subcommand words.
|
|
34
|
+
*/
|
|
35
|
+
export function checkPromptCliInvocation(invocation, root) {
|
|
36
|
+
const path = [];
|
|
37
|
+
let current = root;
|
|
38
|
+
for (const token of invocation.tokens) {
|
|
39
|
+
if (optionName(token) !== null)
|
|
40
|
+
continue;
|
|
41
|
+
const next = childNamed(current, token);
|
|
42
|
+
if (next === undefined)
|
|
43
|
+
break;
|
|
44
|
+
path.push(token);
|
|
45
|
+
current = next;
|
|
46
|
+
}
|
|
47
|
+
if (path.length === 0) {
|
|
48
|
+
return { kind: 'unknown-command', attempted: invocation.tokens[0] ?? '' };
|
|
49
|
+
}
|
|
50
|
+
const declared = declaredFlags(current);
|
|
51
|
+
const flags = [];
|
|
52
|
+
for (const token of invocation.tokens) {
|
|
53
|
+
const flag = optionName(token);
|
|
54
|
+
if (flag !== null && !declared.has(flag))
|
|
55
|
+
flags.push(flag);
|
|
56
|
+
}
|
|
57
|
+
if (flags.length > 0)
|
|
58
|
+
return { kind: 'undeclared-flag', command: path.join(' '), flags };
|
|
59
|
+
return { kind: 'clean', command: path.join(' ') };
|
|
60
|
+
}
|
|
61
|
+
/** Every invocation `text` carries, each with the verdict on it. */
|
|
62
|
+
export function checkPromptCliInvocations(text, root) {
|
|
63
|
+
return extractPromptCliInvocations(text).map((invocation) => ({
|
|
64
|
+
text: invocation.text,
|
|
65
|
+
verdict: checkPromptCliInvocation(invocation, root)
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
/** The warning list a dispatch envelope carries for the prompt it is handing over. */
|
|
69
|
+
export function cliInvocationWarnings(text, root) {
|
|
70
|
+
const warnings = [];
|
|
71
|
+
for (const { text: quoted, verdict } of checkPromptCliInvocations(text, root)) {
|
|
72
|
+
if (verdict.kind === 'undeclared-flag') {
|
|
73
|
+
const rest = verdict.flags.length - FLAG_LIMIT;
|
|
74
|
+
const named = verdict.flags
|
|
75
|
+
.slice(0, FLAG_LIMIT)
|
|
76
|
+
.map((flag) => `\`${flag}\``)
|
|
77
|
+
.join(', ');
|
|
78
|
+
const flags = rest > 0 ? `${named} (and ${rest} more)` : named;
|
|
79
|
+
warnings.push(`PROMPT_CLI_FLAG_NOT_DECLARED: \`${quoted}\` — \`peaks ${verdict.command}\` declares no ${flags}.`);
|
|
80
|
+
}
|
|
81
|
+
else if (verdict.kind === 'unknown-command') {
|
|
82
|
+
warnings.push(`PROMPT_CLI_COMMAND_NOT_FOUND: \`${quoted}\` — no registered command resolves from ` +
|
|
83
|
+
`\`${verdict.attempted}\`.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return warnings;
|
|
87
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `peaks …` runs a dispatch prompt carries, cut out of prose.
|
|
3
|
+
*
|
|
4
|
+
* Extraction only: it finds the runs, keeps the quotation boundaries that make a
|
|
5
|
+
* quoted command quoted, and hands back tokens. It knows nothing about which
|
|
6
|
+
* commands exist — that half lives in `./dispatch-cli-invocation-check.ts`. The
|
|
7
|
+
* split is the repository's file-cap rule rather than a design statement.
|
|
8
|
+
*
|
|
9
|
+
* THE RUN BOUNDARY. A run ends at the backtick that closed its quotation, or at
|
|
10
|
+
* a line break no continuation follows. Both ends matter: without the backtick
|
|
11
|
+
* the sentence after a quoted command would be read as its arguments, and
|
|
12
|
+
* without the continuation rule a wrapped invocation is read only to its first
|
|
13
|
+
* line — a FALSE NEGATIVE that still reports clean, measured on the real corpus
|
|
14
|
+
* text `peaks workflow verify-pipeline --rid <rid>` wrapping onto
|
|
15
|
+
* `--project <root> --type <type>`.
|
|
16
|
+
*
|
|
17
|
+
* THE CASE IS DELIBERATE. Matching is case-sensitive, and the decision is
|
|
18
|
+
* measured: the corpus carries 51 lines using `Peaks` as this project's own name
|
|
19
|
+
* in prose (`… bypassed Peaks worktree governance`, `the active Peaks skill`) and
|
|
20
|
+
* NOT ONE of them is an invocation. Matching them case-insensitively would add 51
|
|
21
|
+
* findings — 47 that happen to resolve onto a command word and read clean, and 4
|
|
22
|
+
* that resolve onto nothing and would warn — every one of them on prose.
|
|
23
|
+
*
|
|
24
|
+
* COST IS BOUNDED IN TWO PLACES, both put there by a measurement on
|
|
25
|
+
* caller-supplied text, and both recorded on the functions that carry them.
|
|
26
|
+
*
|
|
27
|
+
* CITATIONS. This file names the SHAPE of a corpus record rather than the record;
|
|
28
|
+
* the tests name the record in full. That is not tidiness, it is a collision
|
|
29
|
+
* between two of this campaign's own rules, and it has now bitten twice in one
|
|
30
|
+
* night on two different slices. The rule that a red-direction case be built from
|
|
31
|
+
* the REAL input makes a source comment want to cite the record it came from, and
|
|
32
|
+
* real records are named with a request-id prefix — the very substring the
|
|
33
|
+
* comment-hygiene marker for a request id matches. So the citation that gives a
|
|
34
|
+
* reader the evidence is the line that raises a ceiling. Putting it in the test
|
|
35
|
+
* file resolves it in the right direction: `tests/**` is outside the
|
|
36
|
+
* comment-hygiene scope, the case is built from that record anyway, and the
|
|
37
|
+
* source keeps the shape. A wording bent around the detector would have lowered
|
|
38
|
+
* the ceiling by making the guard unable to see the case that raised it.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* How much of a run is read, in characters.
|
|
42
|
+
*
|
|
43
|
+
* Without it a prompt carrying many invocations on one long line makes the scan
|
|
44
|
+
* quadratic, because a run ends only at a delimiter: the 1772 runs in the corpus
|
|
45
|
+
* never exceed 167 characters (mean 36.4), but a synthetic 123 KB prompt with
|
|
46
|
+
* 5024 invocations on a single line took 7.2 seconds and an 800 KB one exhausted
|
|
47
|
+
* a 4 GB heap. Its cost is stated rather than hidden: a run longer than this is
|
|
48
|
+
* read only to the bound, so a flag spelled past it is not seen.
|
|
49
|
+
*/
|
|
50
|
+
export declare const PROMPT_CLI_RUN_LIMIT = 512;
|
|
51
|
+
/** One `peaks …` run found in a prompt. */
|
|
52
|
+
export interface PromptCliInvocation {
|
|
53
|
+
/** The run with the command word restored, as the prompt spells it. */
|
|
54
|
+
readonly text: string;
|
|
55
|
+
/** The run's whitespace-separated tokens, each with trailing sentence punctuation trimmed. */
|
|
56
|
+
readonly tokens: readonly string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Every invocation of this CLI that `text` carries, in the order it carries them.
|
|
60
|
+
*
|
|
61
|
+
* A run end already found is reused by every later match inside it, because the
|
|
62
|
+
* first delimiter after a later start is the same one. That reuse is the second
|
|
63
|
+
* half of the cost bound: measured, 50024 invocations on one 958 KB line took
|
|
64
|
+
* 4216 ms without it and 53 ms with it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function extractPromptCliInvocations(text: string): PromptCliInvocation[];
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `peaks …` runs a dispatch prompt carries, cut out of prose.
|
|
3
|
+
*
|
|
4
|
+
* Extraction only: it finds the runs, keeps the quotation boundaries that make a
|
|
5
|
+
* quoted command quoted, and hands back tokens. It knows nothing about which
|
|
6
|
+
* commands exist — that half lives in `./dispatch-cli-invocation-check.ts`. The
|
|
7
|
+
* split is the repository's file-cap rule rather than a design statement.
|
|
8
|
+
*
|
|
9
|
+
* THE RUN BOUNDARY. A run ends at the backtick that closed its quotation, or at
|
|
10
|
+
* a line break no continuation follows. Both ends matter: without the backtick
|
|
11
|
+
* the sentence after a quoted command would be read as its arguments, and
|
|
12
|
+
* without the continuation rule a wrapped invocation is read only to its first
|
|
13
|
+
* line — a FALSE NEGATIVE that still reports clean, measured on the real corpus
|
|
14
|
+
* text `peaks workflow verify-pipeline --rid <rid>` wrapping onto
|
|
15
|
+
* `--project <root> --type <type>`.
|
|
16
|
+
*
|
|
17
|
+
* THE CASE IS DELIBERATE. Matching is case-sensitive, and the decision is
|
|
18
|
+
* measured: the corpus carries 51 lines using `Peaks` as this project's own name
|
|
19
|
+
* in prose (`… bypassed Peaks worktree governance`, `the active Peaks skill`) and
|
|
20
|
+
* NOT ONE of them is an invocation. Matching them case-insensitively would add 51
|
|
21
|
+
* findings — 47 that happen to resolve onto a command word and read clean, and 4
|
|
22
|
+
* that resolve onto nothing and would warn — every one of them on prose.
|
|
23
|
+
*
|
|
24
|
+
* COST IS BOUNDED IN TWO PLACES, both put there by a measurement on
|
|
25
|
+
* caller-supplied text, and both recorded on the functions that carry them.
|
|
26
|
+
*
|
|
27
|
+
* CITATIONS. This file names the SHAPE of a corpus record rather than the record;
|
|
28
|
+
* the tests name the record in full. That is not tidiness, it is a collision
|
|
29
|
+
* between two of this campaign's own rules, and it has now bitten twice in one
|
|
30
|
+
* night on two different slices. The rule that a red-direction case be built from
|
|
31
|
+
* the REAL input makes a source comment want to cite the record it came from, and
|
|
32
|
+
* real records are named with a request-id prefix — the very substring the
|
|
33
|
+
* comment-hygiene marker for a request id matches. So the citation that gives a
|
|
34
|
+
* reader the evidence is the line that raises a ceiling. Putting it in the test
|
|
35
|
+
* file resolves it in the right direction: `tests/**` is outside the
|
|
36
|
+
* comment-hygiene scope, the case is built from that record anyway, and the
|
|
37
|
+
* source keeps the shape. A wording bent around the detector would have lowered
|
|
38
|
+
* the ceiling by making the guard unable to see the case that raised it.
|
|
39
|
+
*/
|
|
40
|
+
/** The word an invocation starts with. `peaks-loop` cannot match: the run must follow a space. */
|
|
41
|
+
const CLI_START = /\bpeaks\b[ \t]+/g;
|
|
42
|
+
/** Ends a run: the backtick that closed the quotation, or a line break nothing continues. */
|
|
43
|
+
const RUN_END = new Set(['`', '\n', '\r']);
|
|
44
|
+
/**
|
|
45
|
+
* How much of a run is read, in characters.
|
|
46
|
+
*
|
|
47
|
+
* Without it a prompt carrying many invocations on one long line makes the scan
|
|
48
|
+
* quadratic, because a run ends only at a delimiter: the 1772 runs in the corpus
|
|
49
|
+
* never exceed 167 characters (mean 36.4), but a synthetic 123 KB prompt with
|
|
50
|
+
* 5024 invocations on a single line took 7.2 seconds and an 800 KB one exhausted
|
|
51
|
+
* a 4 GB heap. Its cost is stated rather than hidden: a run longer than this is
|
|
52
|
+
* read only to the bound, so a flag spelled past it is not seen.
|
|
53
|
+
*/
|
|
54
|
+
export const PROMPT_CLI_RUN_LIMIT = 512;
|
|
55
|
+
/** Bound on the text a finding quotes back, so one long run cannot flood an envelope. */
|
|
56
|
+
const QUOTED_LIMIT = 200;
|
|
57
|
+
/** Punctuation that ends a sentence rather than a token, and so is not part of an option name. */
|
|
58
|
+
const TRAILING_PUNCTUATION = new Set(['.', ',', ';', ':', ')', ']', '}', "'", '"']);
|
|
59
|
+
/**
|
|
60
|
+
* Drop the sentence punctuation a run's final token carries.
|
|
61
|
+
*
|
|
62
|
+
* A `…+$` regex reads better but is quadratic on a long punctuation run that
|
|
63
|
+
* does not reach the end of its token: measured here, `'.'.repeat(n) + 'x'`
|
|
64
|
+
* costs 0.4 ms at n=1000 and 94.8 ms at n=16000. The prompt is caller-supplied
|
|
65
|
+
* text, so a crafted run would turn a dispatch into a stall. A backwards scan
|
|
66
|
+
* is linear and charges nothing for the ordinary case.
|
|
67
|
+
*/
|
|
68
|
+
function trimTrailingPunctuation(token) {
|
|
69
|
+
let end = token.length;
|
|
70
|
+
while (end > 0) {
|
|
71
|
+
const last = token[end - 1];
|
|
72
|
+
if (last === undefined || !TRAILING_PUNCTUATION.has(last))
|
|
73
|
+
break;
|
|
74
|
+
end -= 1;
|
|
75
|
+
}
|
|
76
|
+
return token.slice(0, end);
|
|
77
|
+
}
|
|
78
|
+
/** Split a run into tokens, dropping the punctuation that ends a sentence. */
|
|
79
|
+
function tokenize(run) {
|
|
80
|
+
const tokens = [];
|
|
81
|
+
for (const raw of run.split(/[ \t\r\n]+/)) {
|
|
82
|
+
const token = trimTrailingPunctuation(raw);
|
|
83
|
+
if (token.length > 0)
|
|
84
|
+
tokens.push(token);
|
|
85
|
+
}
|
|
86
|
+
return tokens;
|
|
87
|
+
}
|
|
88
|
+
function shorten(text) {
|
|
89
|
+
return text.length <= QUOTED_LIMIT ? text : `${text.slice(0, QUOTED_LIMIT)}…`;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* True when the line beginning at `at` continues the invocation above it.
|
|
93
|
+
*
|
|
94
|
+
* A wrapped invocation puts the rest of its flags on the next line opening with
|
|
95
|
+
* a long option. The corpus carries that shape — a `workflow verify-pipeline`
|
|
96
|
+
* run whose `--project` and `--type` sit on the following line — and without this
|
|
97
|
+
* rule every flag after the break goes unchecked while the invocation still
|
|
98
|
+
* reports CLEAN. The case that pins it,
|
|
99
|
+
* `tests/unit/cli/commands/dispatch-cli-invocation-scan.test.ts`, quotes the
|
|
100
|
+
* record it was taken from; this comment does not, on purpose: see the note on
|
|
101
|
+
* citations below the exports.
|
|
102
|
+
*
|
|
103
|
+
* Requiring two dashes is what separates a continuation from a markdown bullet,
|
|
104
|
+
* which opens with one, so a prose list under a command is still not read as its
|
|
105
|
+
* arguments.
|
|
106
|
+
*/
|
|
107
|
+
function continuesAfterBreak(text, at) {
|
|
108
|
+
let index = at;
|
|
109
|
+
while (index < text.length) {
|
|
110
|
+
const character = text[index];
|
|
111
|
+
if (character !== '\n' && character !== '\r' && character !== ' ' && character !== '\t')
|
|
112
|
+
break;
|
|
113
|
+
index += 1;
|
|
114
|
+
}
|
|
115
|
+
return text.startsWith('--', index) && /[A-Za-z]/.test(text[index + 2] ?? '');
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Where the run starting at `from` ends.
|
|
119
|
+
*
|
|
120
|
+
* The scan stops at {@link PROMPT_CLI_RUN_LIMIT} characters, and that bound is
|
|
121
|
+
* what makes it linear. Scanning to the next line break instead costs a walk to
|
|
122
|
+
* the END OF THE TEXT per match, so a prompt of many short lines is quadratic in
|
|
123
|
+
* the number of lines: measured on that shape, `'peaks test --json\n'.repeat(n)`
|
|
124
|
+
* took 2.7 ms at 2000 lines / 35 KB, 26.4 ms at 8000, 101.0 ms at 16000 / 281 KB,
|
|
125
|
+
* 493 ms at 32000, and 109.9 s at 200000 / 3.5 MB — synchronously, inside
|
|
126
|
+
* `composeDispatchPrompt`, on caller-supplied text.
|
|
127
|
+
*/
|
|
128
|
+
function runEnd(text, from) {
|
|
129
|
+
const limit = Math.min(text.length, from + PROMPT_CLI_RUN_LIMIT);
|
|
130
|
+
let index = from;
|
|
131
|
+
while (index < limit) {
|
|
132
|
+
const character = text[index];
|
|
133
|
+
if (character === undefined)
|
|
134
|
+
break;
|
|
135
|
+
if (RUN_END.has(character) && !continuesAfterBreak(text, index))
|
|
136
|
+
return index;
|
|
137
|
+
index += 1;
|
|
138
|
+
}
|
|
139
|
+
return limit;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Every invocation of this CLI that `text` carries, in the order it carries them.
|
|
143
|
+
*
|
|
144
|
+
* A run end already found is reused by every later match inside it, because the
|
|
145
|
+
* first delimiter after a later start is the same one. That reuse is the second
|
|
146
|
+
* half of the cost bound: measured, 50024 invocations on one 958 KB line took
|
|
147
|
+
* 4216 ms without it and 53 ms with it.
|
|
148
|
+
*/
|
|
149
|
+
export function extractPromptCliInvocations(text) {
|
|
150
|
+
const invocations = [];
|
|
151
|
+
let runEndsAt = -1;
|
|
152
|
+
for (const match of text.matchAll(CLI_START)) {
|
|
153
|
+
const start = (match.index ?? 0) + match[0].length;
|
|
154
|
+
if (start >= runEndsAt)
|
|
155
|
+
runEndsAt = runEnd(text, start);
|
|
156
|
+
const run = text.slice(start, runEndsAt);
|
|
157
|
+
const tokens = tokenize(run);
|
|
158
|
+
if (tokens.length > 0)
|
|
159
|
+
invocations.push({ text: shorten(`peaks ${run.trim()}`), tokens });
|
|
160
|
+
}
|
|
161
|
+
return invocations;
|
|
162
|
+
}
|
|
@@ -67,7 +67,8 @@ async function composePromptPhase(io, options, ctx, input) {
|
|
|
67
67
|
worktreePath: input.lease.worktreePath,
|
|
68
68
|
worktreeBranch: input.lease.worktreeBranch,
|
|
69
69
|
decision: input.decision,
|
|
70
|
-
asJson: ctx.asJson
|
|
70
|
+
asJson: ctx.asJson,
|
|
71
|
+
rootCommand: input.rootCommand
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
function buildToolCallPhase(io, ctx, input) {
|
|
@@ -106,7 +107,8 @@ async function runDispatchPipeline(io, options, role, input) {
|
|
|
106
107
|
const composed = await composePromptPhase(io, options, ctx, {
|
|
107
108
|
prompt: input.prompt,
|
|
108
109
|
decision: input.decision,
|
|
109
|
-
lease
|
|
110
|
+
lease,
|
|
111
|
+
rootCommand: input.rootCommand
|
|
110
112
|
});
|
|
111
113
|
if (composed === null)
|
|
112
114
|
return;
|
|
@@ -137,7 +139,7 @@ async function runDispatchPipeline(io, options, role, input) {
|
|
|
137
139
|
emitDispatchEnvelope(io, envelopeInput, warnings, input.asJson);
|
|
138
140
|
writeDispatchLogEntry(ctx, counter.count, input.decision.forcedAt);
|
|
139
141
|
}
|
|
140
|
-
async function runDispatchAction(role, options, io) {
|
|
142
|
+
async function runDispatchAction(role, options, io, rootCommand) {
|
|
141
143
|
const asJson = options.json === true;
|
|
142
144
|
// explicitly requested, lazy-import the detached handler and short-
|
|
143
145
|
// circuit before the warm-path in-process pipeline runs. Branch
|
|
@@ -162,7 +164,7 @@ async function runDispatchAction(role, options, io) {
|
|
|
162
164
|
return;
|
|
163
165
|
const { decision, prompt } = preflight;
|
|
164
166
|
try {
|
|
165
|
-
await runDispatchPipeline(io, options, role, { decision, prompt, asJson });
|
|
167
|
+
await runDispatchPipeline(io, options, role, { decision, prompt, asJson, rootCommand });
|
|
166
168
|
}
|
|
167
169
|
catch (error) {
|
|
168
170
|
printResult(io, fail('sub-agent.dispatch', 'DISPATCH_ERROR', getErrorMessage(error), { role, toolCall: null, dispatchRecordPath: null }, [
|
|
@@ -172,7 +174,12 @@ async function runDispatchAction(role, options, io) {
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
export function registerDispatchCommand(parent, io) {
|
|
175
|
-
|
|
177
|
+
// `parent` is the `sub-agent` group, so its parent is the registered root —
|
|
178
|
+
// the real command tree the prompt's quotations are resolved against. A caller
|
|
179
|
+
// that mounted the group on a bare `Command` (as the unit tests do) gets that
|
|
180
|
+
// Command, which is the whole tree it has.
|
|
181
|
+
const rootCommand = parent.parent ?? parent;
|
|
182
|
+
buildDispatchCommandSpec(parent).action((role, options) => runDispatchAction(role, options, io, rootCommand));
|
|
176
183
|
}
|
|
177
184
|
/**
|
|
178
185
|
* 2.7.0 slice-dag-dispatcher MVP — see `dispatch-from-dag.ts`.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SubAgentToolCall } from '../../services/dispatch/sub-agent-dispatcher.js';
|
|
2
|
+
import type { SliceDag } from '../../services/dispatch/slice-dag.js';
|
|
3
|
+
import type { SliceComplexity } from '../../services/dispatch/slice-dag-types.js';
|
|
4
|
+
/** Everything the `--from-dag` success envelope reports, already resolved. */
|
|
5
|
+
export type DagEnvelopeInput = {
|
|
6
|
+
readonly role: string;
|
|
7
|
+
readonly ide: string;
|
|
8
|
+
readonly fromDag: string;
|
|
9
|
+
readonly batchId: string;
|
|
10
|
+
readonly levelsTotal: number;
|
|
11
|
+
readonly emittedSliceIds: readonly string[];
|
|
12
|
+
readonly emittedToolCalls: readonly SubAgentToolCall[];
|
|
13
|
+
readonly firstLevelWaves: unknown;
|
|
14
|
+
readonly existingContractCount: number;
|
|
15
|
+
readonly dag: SliceDag;
|
|
16
|
+
readonly isSliceComplexity: (value: string) => value is SliceComplexity;
|
|
17
|
+
};
|
|
18
|
+
/** The `ok('sub-agent.dispatch', …)` envelope for a completed `--from-dag` run. */
|
|
19
|
+
export declare function buildDagSuccessEnvelope(input: DagEnvelopeInput): import("peaks-loop-shared/result").ResultEnvelope<{
|
|
20
|
+
envelopeVersion: string;
|
|
21
|
+
role: string;
|
|
22
|
+
ide: string;
|
|
23
|
+
fromDag: string;
|
|
24
|
+
batchId: string;
|
|
25
|
+
dispatchCount: number;
|
|
26
|
+
levelsTotal: number;
|
|
27
|
+
firstLevel: readonly string[];
|
|
28
|
+
firstLevelWaves: unknown;
|
|
29
|
+
toolCalls: readonly SubAgentToolCall[];
|
|
30
|
+
existingContractCount: number;
|
|
31
|
+
expectedCompletionSeconds: number;
|
|
32
|
+
artifactsPublicPaths: never[];
|
|
33
|
+
orchestratorVisibleHint: string;
|
|
34
|
+
sliceMeta: {
|
|
35
|
+
id: string;
|
|
36
|
+
foundation: boolean;
|
|
37
|
+
upstreamSync: boolean;
|
|
38
|
+
complexity: SliceComplexity | null;
|
|
39
|
+
}[];
|
|
40
|
+
nextActions: string[];
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ok } from 'peaks-loop-shared/result';
|
|
2
|
+
/**
|
|
3
|
+
* Per-slice scheduling metadata (foundation / upstreamSync / complexity) for
|
|
4
|
+
* the level-1 slices the envelope surfaces.
|
|
5
|
+
*/
|
|
6
|
+
function sliceMetaFor(ids, dag, isSliceComplexity) {
|
|
7
|
+
return ids.map((id) => {
|
|
8
|
+
const node = dag.nodes.find((n) => n.id === id);
|
|
9
|
+
return {
|
|
10
|
+
id,
|
|
11
|
+
foundation: node?.foundation === true,
|
|
12
|
+
upstreamSync: node?.upstreamSync === true,
|
|
13
|
+
complexity: node?.complexity !== undefined && isSliceComplexity(node.complexity)
|
|
14
|
+
? node.complexity
|
|
15
|
+
: null
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** The `ok('sub-agent.dispatch', …)` envelope for a completed `--from-dag` run. */
|
|
20
|
+
export function buildDagSuccessEnvelope(input) {
|
|
21
|
+
const { role, ide, fromDag, batchId, levelsTotal, emittedSliceIds, emittedToolCalls, firstLevelWaves, existingContractCount, dag, isSliceComplexity } = input;
|
|
22
|
+
const dispatchCount = emittedSliceIds.length;
|
|
23
|
+
return ok('sub-agent.dispatch', {
|
|
24
|
+
envelopeVersion: '2.1.0',
|
|
25
|
+
role,
|
|
26
|
+
ide,
|
|
27
|
+
fromDag,
|
|
28
|
+
batchId,
|
|
29
|
+
dispatchCount,
|
|
30
|
+
levelsTotal,
|
|
31
|
+
firstLevel: emittedSliceIds,
|
|
32
|
+
firstLevelWaves,
|
|
33
|
+
toolCalls: emittedToolCalls,
|
|
34
|
+
existingContractCount,
|
|
35
|
+
expectedCompletionSeconds: 60,
|
|
36
|
+
artifactsPublicPaths: [],
|
|
37
|
+
orchestratorVisibleHint: `⏳ Spawning ${dispatchCount} sub-agents via Task tool from DAG ${fromDag}, batch-id=${batchId} (ETA ~60s)`,
|
|
38
|
+
sliceMeta: sliceMetaFor(emittedSliceIds, dag, isSliceComplexity),
|
|
39
|
+
nextActions: [
|
|
40
|
+
'Execute each toolCall in your IDE; on completion, write the slice contract to .peaks/_runtime/<sid>/dispatch/contracts/<slice-id>.json.',
|
|
41
|
+
'Re-invoke `peaks sub-agent dispatch --from-dag <file>` with the same batch-id to advance to the next level once all current-level slices have written contracts.'
|
|
42
|
+
]
|
|
43
|
+
}, [], [
|
|
44
|
+
'MVP (1.2) plans the first level via runLayeredDag orchestrator (cancel-on-fail path active); the LLM drives subsequent levels by re-invoking this command after contract writes.',
|
|
45
|
+
existingContractCount > 0
|
|
46
|
+
? `Injected ${existingContractCount} upstream contract(s) into downstream-level prompts via formatContractInjection.`
|
|
47
|
+
: 'No upstream contracts found; first-level prompts have empty ancestor blocks.'
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
2
|
+
/** One refusal from the `--from-dag` path, as the fields the envelope needs. */
|
|
3
|
+
export type DagFailure = {
|
|
4
|
+
readonly role: string;
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly extra?: Record<string, unknown>;
|
|
8
|
+
readonly nextActions: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Emit a `sub-agent.dispatch` failure envelope and mark the process failed.
|
|
12
|
+
*
|
|
13
|
+
* Returns `null` so every caller can read `if (readDag(...) === null) return;`
|
|
14
|
+
* — the three statements (print, exit code, return) are one decision and stay
|
|
15
|
+
* together, which is also what keeps each call site inside
|
|
16
|
+
* `max-lines-per-function`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function emitDagFailure(io: ProgramIO, asJson: boolean, failure: DagFailure): null;
|