peaks-loop 4.0.0-beta.9 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +910 -141
- package/README-en.md +26 -7
- package/README.md +75 -6
- package/agents/karpathy-reviewer.md +33 -0
- package/bin/peaks.js +0 -0
- package/dist/cli/cli-helpers.d.ts +31 -6
- package/dist/cli/cli-helpers.js +48 -25
- package/dist/cli/commands/_register.d.ts +3 -0
- package/dist/cli/commands/_register.js +139 -0
- package/dist/cli/commands/_super.d.ts +10 -0
- package/dist/cli/commands/_super.js +97 -0
- package/dist/cli/commands/adapter-commands-s2a.js +1 -1
- package/dist/cli/commands/asset-commands.js +33 -16
- package/dist/cli/commands/audit-commands.js +2 -2
- package/dist/cli/commands/autonomous-swarm-commands.d.ts +12 -0
- package/dist/cli/commands/autonomous-swarm-commands.js +120 -0
- package/dist/cli/commands/bee-commands.js +1 -1
- package/dist/cli/commands/capability-commands.js +1 -1
- package/dist/cli/commands/capability-worker-config-sc-commands.js +0 -2
- package/dist/cli/commands/changeset-commands.d.ts +13 -0
- package/dist/cli/commands/changeset-commands.js +46 -0
- package/dist/cli/commands/code-commands.d.ts +11 -1
- package/dist/cli/commands/code-commands.js +19 -699
- package/dist/cli/commands/code-job-shape-commands.d.ts +9 -0
- package/dist/cli/commands/code-job-shape-commands.js +164 -0
- package/dist/cli/commands/code-mode-gate-commands.d.ts +9 -0
- package/dist/cli/commands/code-mode-gate-commands.js +223 -0
- package/dist/cli/commands/code-review-commands.js +2 -2
- package/dist/cli/commands/code-run-command.d.ts +12 -0
- package/dist/cli/commands/code-run-command.js +68 -0
- package/dist/cli/commands/code-runtime-commands.d.ts +11 -0
- package/dist/cli/commands/code-runtime-commands.js +391 -0
- package/dist/cli/commands/codegraph-commands.js +1 -1
- package/dist/cli/commands/compact-command.js +53 -1
- package/dist/cli/commands/complexity-commands.js +1 -1
- package/dist/cli/commands/config-commands.js +4 -75
- package/dist/cli/commands/container-commands.d.ts +28 -0
- package/dist/cli/commands/container-commands.js +221 -0
- package/dist/cli/commands/context-commands.js +3 -2
- package/dist/cli/commands/core/artifacts-command.js +1 -1
- package/dist/cli/commands/core/binding-commands.js +1 -1
- package/dist/cli/commands/core/doctor-command.js +63 -3
- package/dist/cli/commands/core/memory-command.js +1 -1
- package/dist/cli/commands/core/profile-command.js +1 -1
- package/dist/cli/commands/core/proxy-command.js +1 -1
- package/dist/cli/commands/core/session-command.js +9 -7
- package/dist/cli/commands/core/skill-command.js +7 -4
- package/dist/cli/commands/core/standards-command.js +1 -1
- package/dist/cli/commands/cron-commands.d.ts +57 -0
- package/dist/cli/commands/cron-commands.js +257 -0
- package/dist/cli/commands/cron-scheduler-commands.d.ts +47 -0
- package/dist/cli/commands/cron-scheduler-commands.js +284 -0
- package/dist/cli/commands/dashboard-commands.d.ts +4 -0
- package/dist/cli/commands/dashboard-commands.js +10 -0
- package/dist/cli/commands/dashboard-long-run.d.ts +25 -0
- package/dist/cli/commands/dashboard-long-run.js +122 -0
- package/dist/cli/commands/dashboard-summary.d.ts +12 -0
- package/dist/cli/commands/dashboard-summary.js +58 -0
- package/dist/cli/commands/dispatch-commands.d.ts +0 -7
- package/dist/cli/commands/dispatch-commands.js +372 -8
- package/dist/cli/commands/dispatch-from-dag.js +4 -1
- package/dist/cli/commands/doc-commands.js +1 -1
- package/dist/cli/commands/ecc-commands.d.ts +30 -0
- package/dist/cli/commands/ecc-commands.js +119 -0
- package/dist/cli/commands/evolution-commands.js +1 -1
- package/dist/cli/commands/feedback-commands.js +1 -1
- package/dist/cli/commands/final-review-commands.js +1 -1
- package/dist/cli/commands/fixture-commands.js +1 -1
- package/dist/cli/commands/fork-commands.js +1 -1
- package/dist/cli/commands/gate-commands.js +128 -6
- package/dist/cli/commands/governance-classify-contract-commands.d.ts +21 -0
- package/dist/cli/commands/governance-classify-contract-commands.js +273 -0
- package/dist/cli/commands/heartbeat-commands.js +76 -5
- package/dist/cli/commands/heartbeat-watch-command.d.ts +31 -0
- package/dist/cli/commands/heartbeat-watch-command.js +146 -0
- package/dist/cli/commands/hook-handle.js +1 -1
- package/dist/cli/commands/hooks-commands.js +126 -10
- package/dist/cli/commands/ide-commands.js +1 -1
- package/dist/cli/commands/impact-commands.js +1 -1
- package/dist/cli/commands/job-commands.js +34 -1
- package/dist/cli/commands/lease-metrics-commands.d.ts +67 -0
- package/dist/cli/commands/lease-metrics-commands.js +231 -0
- package/dist/cli/commands/lease-stats-commands.d.ts +65 -0
- package/dist/cli/commands/lease-stats-commands.js +107 -0
- package/dist/cli/commands/legacy-commands.js +1 -1
- package/dist/cli/commands/log-commands.js +1 -1
- package/dist/cli/commands/loop-commands.js +1 -1
- package/dist/cli/commands/loop-eval-commands.js +1 -1
- package/dist/cli/commands/memory-commands.js +1 -1
- package/dist/cli/commands/migrate-1-4-1-command.js +1 -1
- package/dist/cli/commands/migrate-v2-10-to-v2-11-command.js +1 -1
- package/dist/cli/commands/mut-commands.d.ts +1 -1
- package/dist/cli/commands/mut-commands.js +1 -5
- package/dist/cli/commands/observability-commands.js +1 -1
- package/dist/cli/commands/openspec-commands.js +65 -4
- package/dist/cli/commands/perf-audit-commands.js +3 -3
- package/dist/cli/commands/perf-commands.js +1 -1
- package/dist/cli/commands/polyrepo-commands.js +1 -1
- package/dist/cli/commands/prd-blocks-commands.js +1 -1
- package/dist/cli/commands/prd-commands.js +4 -2
- package/dist/cli/commands/preferences-commands.js +23 -3
- package/dist/cli/commands/project-commands.js +1 -1
- package/dist/cli/commands/qa-business-review-commands.js +1 -1
- package/dist/cli/commands/qa-commands.d.ts +1 -1
- package/dist/cli/commands/qa-commands.js +39 -3
- package/dist/cli/commands/release-commands.d.ts +15 -0
- package/dist/cli/commands/release-commands.js +113 -21
- package/dist/cli/commands/request-commands.js +1 -1
- package/dist/cli/commands/retrospective-commands.js +1 -1
- package/dist/cli/commands/reviewer-commands.js +1 -1
- package/dist/cli/commands/role-commands.js +1 -1
- package/dist/cli/commands/runtime-commands-helpers.d.ts +7 -0
- package/dist/cli/commands/runtime-commands-helpers.js +24 -0
- package/dist/cli/commands/runtime-commands.js +1 -2
- package/dist/cli/commands/sc-commands.js +4 -2
- package/dist/cli/commands/scan-commands.js +1 -1
- package/dist/cli/commands/security-audit-commands.js +3 -3
- package/dist/cli/commands/sediment-commands.js +10 -1
- package/dist/cli/commands/session-24h-mode.d.ts +26 -0
- package/dist/cli/commands/session-24h-mode.js +196 -0
- package/dist/cli/commands/share-commands.d.ts +19 -0
- package/dist/cli/commands/share-commands.js +121 -2
- package/dist/cli/commands/skill-conformance-commands.js +1 -1
- package/dist/cli/commands/skill-loop-engineering-readiness-commands.js +1 -1
- package/dist/cli/commands/skill-search-commands.js +4 -1
- package/dist/cli/commands/slice-commands.js +1 -1
- package/dist/cli/commands/slice-integrate-commands.js +1 -1
- package/dist/cli/commands/slice-review-commands.js +1 -1
- package/dist/cli/commands/smoke-commands.js +1 -1
- package/dist/cli/commands/sop-commands.js +1 -1
- package/dist/cli/commands/spill-demo-command.d.ts +7 -0
- package/dist/cli/commands/spill-demo-command.js +29 -0
- package/dist/cli/commands/statusline-commands.d.ts +12 -0
- package/dist/cli/commands/statusline-commands.js +79 -17
- package/dist/cli/commands/sub-agent-commands.js +2 -1
- package/dist/cli/commands/sub-agent-shared.d.ts +10 -0
- package/dist/cli/commands/sub-agent-shared.js +24 -1
- package/dist/cli/commands/swarm-commands.d.ts +13 -0
- package/dist/cli/commands/swarm-commands.js +77 -0
- package/dist/cli/commands/tech-commands.d.ts +64 -0
- package/dist/cli/commands/tech-commands.js +195 -0
- package/dist/cli/commands/understand-commands.js +1 -1
- package/dist/cli/commands/upgrade-commands.d.ts +2 -0
- package/dist/cli/commands/upgrade-commands.js +40 -5
- package/dist/cli/commands/user-touchpoint-commands.js +1 -1
- package/dist/cli/commands/verdict-aggregate-command.js +1 -1
- package/dist/cli/commands/vm-commands.d.ts +31 -0
- package/dist/cli/commands/vm-commands.js +274 -0
- package/dist/cli/commands/workflow-commands.js +24 -1
- package/dist/cli/commands/workflow-plan-commands.js +1 -1
- package/dist/cli/commands/workspace/init-command.js +1 -1
- package/dist/cli/commands/workspace/migrate-command.js +1 -1
- package/dist/cli/commands/workspace/reconcile-command.js +1 -1
- package/dist/cli/commands/worktree-auth-commands.d.ts +29 -0
- package/dist/cli/commands/worktree-auth-commands.js +652 -0
- package/dist/cli/index.js +58 -13
- package/dist/cli/program.d.ts +2 -2
- package/dist/cli/program.js +86 -281
- package/dist/services/24h-mode/decider.d.ts +103 -0
- package/dist/services/24h-mode/decider.js +144 -0
- package/dist/services/24h-mode/index.d.ts +12 -0
- package/dist/services/24h-mode/index.js +12 -0
- package/dist/services/24h-mode/state.d.ts +48 -0
- package/dist/services/24h-mode/state.js +51 -0
- package/dist/services/24h-mode/store.d.ts +27 -0
- package/dist/services/24h-mode/store.js +119 -0
- package/dist/services/artifacts/artifact-prerequisites.js +1 -1
- package/dist/services/artifacts/request-artifact-service.js +1 -1
- package/dist/services/artifacts/workspace-service.js +1 -1
- package/dist/services/audit/enforcers/lint-bee-runtime-contract.d.ts +25 -0
- package/dist/services/audit/enforcers/lint-bee-runtime-contract.js +91 -0
- package/dist/services/audit/enforcers/lint-peaks-code-runtime.d.ts +16 -0
- package/dist/services/audit/enforcers/lint-peaks-code-runtime.js +31 -0
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.d.ts +23 -0
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.js +59 -0
- package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.d.ts +28 -0
- package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.js +86 -0
- package/dist/services/audit/enforcers/lint-prd-artifact-handoff.d.ts +16 -0
- package/dist/services/audit/enforcers/lint-prd-artifact-handoff.js +41 -0
- package/dist/services/audit/enforcers/lint-prd-source-snapshot.d.ts +27 -0
- package/dist/services/audit/enforcers/lint-prd-source-snapshot.js +47 -0
- package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.d.ts +19 -0
- package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.js +47 -0
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.d.ts +18 -0
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.js +70 -0
- package/dist/services/audit/enforcers/lint-skill-presence-mandatory.d.ts +25 -0
- package/dist/services/audit/enforcers/lint-skill-presence-mandatory.js +53 -0
- package/dist/services/audit/red-line-catalog-p2-a.d.ts +0 -6
- package/dist/services/audit/red-line-catalog-p2-a.js +230 -1
- package/dist/services/audit/static-service.d.ts +32 -25
- package/dist/services/audit/static-service.js +30 -109
- package/dist/services/audit-independent/index.d.ts +2 -0
- package/dist/services/audit-independent/index.js +2 -0
- package/dist/services/autonomous-swarm/autonomous-swarm-service.d.ts +127 -0
- package/dist/services/autonomous-swarm/autonomous-swarm-service.js +446 -0
- package/dist/services/changeset/changeset-check-service.d.ts +22 -0
- package/dist/services/changeset/changeset-check-service.js +47 -0
- package/dist/services/code/auto-compact-modes.d.ts +30 -0
- package/dist/services/code/auto-compact-modes.js +38 -0
- package/dist/services/code/auto-compact-orchestrator.d.ts +43 -5
- package/dist/services/code/auto-compact-orchestrator.js +101 -21
- package/dist/services/code/dag-orchestrator.d.ts +30 -1
- package/dist/services/code/dag-orchestrator.js +106 -1
- package/dist/services/code/status-line-renderer.d.ts +2 -0
- package/dist/services/code/status-line-renderer.js +21 -3
- package/dist/services/code-review/ocr-service.d.ts +1 -1
- package/dist/services/code-review/ocr-service.js +6 -3
- package/dist/services/compact-history/compact-history-service.d.ts +41 -0
- package/dist/services/compact-history/compact-history-service.js +62 -0
- package/dist/services/compact-statusline/compact-statusline-service.d.ts +16 -0
- package/dist/services/compact-statusline/compact-statusline-service.js +83 -0
- package/dist/services/config/config-service.d.ts +1 -12
- package/dist/services/config/config-service.js +3 -72
- package/dist/services/config/config-types.d.ts +2 -4
- package/dist/services/config/config-types.js +1 -1
- package/dist/services/container/container-lease.d.ts +67 -0
- package/dist/services/container/container-lease.js +135 -0
- package/dist/services/context/auto-compact-dispatcher.d.ts +40 -5
- package/dist/services/context/auto-compact-dispatcher.js +32 -102
- package/dist/services/context/auto-compact-reader.js +1 -1
- package/dist/services/context/auto-compact-types.d.ts +27 -2
- package/dist/services/context/auto-compact-types.js +8 -1
- package/dist/services/context/build-dispatch-system-prompt.d.ts +75 -0
- package/dist/services/context/build-dispatch-system-prompt.js +117 -0
- package/dist/services/context/collector.d.ts +2 -2
- package/dist/services/context/context-builder.d.ts +4 -4
- package/dist/services/context/context-schema.d.ts +48 -48
- package/dist/services/context/ide-detect.d.ts +4 -0
- package/dist/services/context/ide-detect.js +24 -0
- package/dist/services/context/main-session-monitor.d.ts +1 -4
- package/dist/services/context/main-session-monitor.js +1 -24
- package/dist/services/context/memory-index-reader.d.ts +8 -0
- package/dist/services/context/memory-index-reader.js +57 -0
- package/dist/services/context/memory-lru-cache.d.ts +12 -0
- package/dist/services/context/memory-lru-cache.js +60 -0
- package/dist/services/context/memory-preflight-config.d.ts +19 -0
- package/dist/services/context/memory-preflight-config.js +25 -0
- package/dist/services/context/memory-preflight-service.d.ts +19 -0
- package/dist/services/context/memory-preflight-service.js +120 -0
- package/dist/services/context/spillover-store.d.ts +23 -0
- package/dist/services/context/spillover-store.js +155 -0
- package/dist/services/context/spillover-types.d.ts +18 -0
- package/dist/services/context/spillover-types.js +1 -0
- package/dist/services/crystallization/crystallization-service.d.ts +22 -5
- package/dist/services/crystallization/crystallization-service.js +8 -14
- package/dist/services/crystallization/crystallization-types.d.ts +6 -6
- package/dist/services/crystallization/evidence-brief-builder.d.ts +1 -1
- package/dist/services/crystallization/index.d.ts +13 -0
- package/dist/services/crystallization/index.js +13 -0
- package/dist/services/dashboard/project-dashboard-service.js +2 -2
- package/dist/services/dispatch/await-batch.d.ts +70 -0
- package/dist/services/dispatch/await-batch.js +272 -0
- package/dist/services/dispatch/batch-counter.js +1 -1
- package/dist/services/dispatch/dispatch-record-writer.d.ts +126 -4
- package/dist/services/dispatch/dispatch-record-writer.js +239 -9
- package/dist/services/dispatch/slice-dag.d.ts +46 -0
- package/dist/services/dispatch/slice-dag.js +6 -0
- package/dist/services/dispatch/stage-enum.d.ts +27 -0
- package/dist/services/dispatch/stage-enum.js +48 -0
- package/dist/services/dispatch/startup-timeout.d.ts +86 -0
- package/dist/services/dispatch/startup-timeout.js +97 -0
- package/dist/services/dispatch/sub-agent-dispatcher.js +40 -89
- package/dist/services/dispatch/test-tool-detection.d.ts +25 -1
- package/dist/services/dispatch/test-tool-detection.js +80 -0
- package/dist/services/doctor/doctor-service/checks/check-id-schema.d.ts +18 -0
- package/dist/services/doctor/doctor-service/checks/check-id-schema.js +64 -0
- package/dist/services/doctor/doctor-service/checks/codegraph-capability.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/codegraph-capability.js +69 -0
- package/dist/services/doctor/doctor-service/checks/dist-source-version.d.ts +32 -0
- package/dist/services/doctor/doctor-service/checks/dist-source-version.js +110 -0
- package/dist/services/doctor/doctor-service/checks/gateguard-conflict.d.ts +24 -0
- package/dist/services/doctor/doctor-service/checks/gateguard-conflict.js +164 -0
- package/dist/services/doctor/doctor-service/checks/l3-memory-health.d.ts +16 -0
- package/dist/services/doctor/doctor-service/checks/l3-memory-health.js +57 -0
- package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.d.ts +19 -0
- package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.js +66 -0
- package/dist/services/doctor/doctor-service/checks/schema-validity.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/schema-validity.js +33 -0
- package/dist/services/doctor/doctor-service/checks/skill-apply-note.d.ts +20 -0
- package/dist/services/doctor/doctor-service/checks/skill-apply-note.js +85 -0
- package/dist/services/doctor/doctor-service/checks/skill-existence.d.ts +13 -0
- package/dist/services/doctor/doctor-service/checks/skill-existence.js +30 -0
- package/dist/services/doctor/doctor-service/checks/skill-name-match.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/skill-name-match.js +25 -0
- package/dist/services/doctor/doctor-service/checks/skill-parse.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/skill-parse.js +19 -0
- package/dist/services/doctor/doctor-service/checks/skill-presence.d.ts +21 -0
- package/dist/services/doctor/doctor-service/checks/skill-presence.js +75 -0
- package/dist/services/doctor/doctor-service/checks/skill-runbook.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/skill-runbook.js +47 -0
- package/dist/services/doctor/doctor-service/checks/statusline-install.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/statusline-install.js +32 -0
- package/dist/services/doctor/doctor-service/checks/statusline-runtime.d.ts +13 -0
- package/dist/services/doctor/doctor-service/checks/statusline-runtime.js +30 -0
- package/dist/services/doctor/doctor-service/checks/user-config.d.ts +11 -0
- package/dist/services/doctor/doctor-service/checks/user-config.js +27 -0
- package/dist/services/doctor/doctor-service/checks/workspace-init.d.ts +16 -0
- package/dist/services/doctor/doctor-service/checks/workspace-init.js +34 -0
- package/dist/services/doctor/doctor-service/checks/workspace-layout.d.ts +33 -0
- package/dist/services/doctor/doctor-service/checks/workspace-layout.js +180 -0
- package/dist/services/doctor/doctor-service/index.d.ts +48 -0
- package/dist/services/doctor/doctor-service/index.js +254 -0
- package/dist/services/doctor/doctor-service/plugin-registry.d.ts +41 -0
- package/dist/services/doctor/doctor-service/plugin-registry.js +77 -0
- package/dist/services/doctor/doctor-service/report/final-summary.d.ts +20 -0
- package/dist/services/doctor/doctor-service/report/final-summary.js +29 -0
- package/dist/services/doctor/doctor-service/types.d.ts +245 -0
- package/dist/services/doctor/doctor-service/types.js +15 -0
- package/dist/services/doctor/doctor-service.d.ts +15 -146
- package/dist/services/doctor/doctor-service.js +22 -926
- package/dist/services/doctor/index.d.ts +22 -0
- package/dist/services/doctor/index.js +22 -0
- package/dist/services/env/shell-probe.d.ts +71 -0
- package/dist/services/env/shell-probe.js +161 -0
- package/dist/services/evolution/evolution-types.d.ts +39 -39
- package/dist/services/final-review/final-review-service.d.ts +11 -1
- package/dist/services/final-review/index.d.ts +2 -0
- package/dist/services/final-review/index.js +1 -0
- package/dist/services/hooks/auto-compact-hook-install.d.ts +4 -5
- package/dist/services/hooks/auto-compact-hook-install.js +4 -5
- package/dist/services/hooks/worktree-authorization-gate.d.ts +205 -0
- package/dist/services/hooks/worktree-authorization-gate.js +492 -0
- package/dist/services/ide/adapters/claude-code-adapter.js +2 -2
- package/dist/services/ide/adapters/qoder-adapter.d.ts +25 -0
- package/dist/services/ide/adapters/qoder-adapter.js +57 -0
- package/dist/services/ide/adapters/tongyi-lingma-adapter.d.ts +16 -0
- package/dist/services/ide/adapters/tongyi-lingma-adapter.js +45 -0
- package/dist/services/ide/ide-registry.js +6 -0
- package/dist/services/ide/ide-types.d.ts +1 -1
- package/dist/services/job/job-types.d.ts +56 -56
- package/dist/services/job-snapshot/index.d.ts +8 -0
- package/dist/services/job-snapshot/index.js +7 -0
- package/dist/services/{job/job-resource-snapshot.d.ts → job-snapshot/snapshot.d.ts} +1 -1
- package/dist/services/job-snapshot/types.d.ts +7 -0
- package/dist/services/job-snapshot/types.js +1 -0
- package/dist/services/karpathy-cost/karpathy-cost-check-service.d.ts +67 -0
- package/dist/services/karpathy-cost/karpathy-cost-check-service.js +108 -0
- package/dist/services/log/retention.d.ts +16 -0
- package/dist/services/log/retention.js +17 -0
- package/dist/services/loop/loop-bee-relation-types.d.ts +6 -6
- package/dist/services/loop/loop-release-types.d.ts +24 -24
- package/dist/services/loop/monotonic-runner.d.ts +17 -11
- package/dist/services/loop/monotonic-runner.js +118 -79
- package/dist/services/memory/project-memory-service/index/kind-dispatch.d.ts +8 -0
- package/dist/services/memory/project-memory-service/index/kind-dispatch.js +253 -0
- package/dist/services/memory/project-memory-service/index/ranking.d.ts +6 -0
- package/dist/services/memory/project-memory-service/index/ranking.js +171 -0
- package/dist/services/memory/project-memory-service/index/search.d.ts +34 -0
- package/dist/services/memory/project-memory-service/index/search.js +194 -0
- package/dist/services/memory/project-memory-service/index.d.ts +9 -0
- package/dist/services/memory/project-memory-service/index.js +24 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter.d.ts +9 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter.js +106 -0
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +7 -0
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +96 -0
- package/dist/services/memory/project-memory-service/store/atomic-write.d.ts +5 -0
- package/dist/services/memory/project-memory-service/store/atomic-write.js +56 -0
- package/dist/services/memory/project-memory-service/store/paths.d.ts +8 -0
- package/dist/services/memory/project-memory-service/store/paths.js +116 -0
- package/dist/services/memory/project-memory-service/types.d.ts +128 -0
- package/dist/services/memory/project-memory-service/types.js +9 -0
- package/dist/services/memory/project-memory-service.d.ts +1 -167
- package/dist/services/memory/project-memory-service.js +19 -816
- package/dist/services/migrate-skill-name/schema.d.ts +2 -2
- package/dist/services/observability/aggregation.d.ts +27 -0
- package/dist/services/observability/aggregation.js +72 -0
- package/dist/services/observability/observability-service.d.ts +73 -7
- package/dist/services/observability/observability-service.js +87 -1
- package/dist/services/openspec/artifact-boundary.d.ts +138 -0
- package/dist/services/openspec/artifact-boundary.js +150 -0
- package/dist/services/openspec/coverage-evidence-reader.d.ts +191 -0
- package/dist/services/openspec/coverage-evidence-reader.js +386 -0
- package/dist/services/openspec/openspec-archive-service.d.ts +70 -0
- package/dist/services/openspec/openspec-archive-service.js +320 -8
- package/dist/services/openspec/openspec-bridge-service.js +1 -1
- package/dist/services/openspec/openspec-init-service.js +1 -1
- package/dist/services/openspec/openspec-propose-from-doctor-service.js +1 -1
- package/dist/services/openspec/openspec-render-service.js +7 -4
- package/dist/services/openspec/openspec-scan-service.js +1 -1
- package/dist/services/openspec/openspec-validate-service.js +5 -4
- package/dist/services/preferences/preferences-service.js +10 -0
- package/dist/services/preferences/preferences-types.d.ts +13 -0
- package/dist/services/preferences/preferences-types.js +11 -0
- package/dist/services/qa/screenshot-archive-service.d.ts +51 -0
- package/dist/services/qa/screenshot-archive-service.js +134 -0
- package/dist/services/rd/rd-service.js +10 -11
- package/dist/services/rd/types.d.ts +32 -32
- package/dist/services/rd-swarm/rd-swarm-service.d.ts +60 -0
- package/dist/services/rd-swarm/rd-swarm-service.js +93 -0
- package/dist/services/recommendations/capability-seed-items.js +0 -1
- package/dist/services/recommendations/capability-seed-mappings.js +0 -1
- package/dist/services/recommendations/capability-seed-sources.js +0 -1
- package/dist/services/release/version-precheck-service.d.ts +51 -0
- package/dist/services/release/version-precheck-service.js +257 -0
- package/dist/services/scan/acceptance-coverage-service.js +1 -1
- package/dist/services/scan/archetype-service.js +1 -1
- package/dist/services/scan/existing-system-service.js +1 -1
- package/dist/services/scan/libraries-service.js +1 -1
- package/dist/services/sediment/json-schema.d.ts +40 -40
- package/dist/services/share/bundle-types.d.ts +12 -12
- package/dist/services/share/run-state-contract.d.ts +2 -2
- package/dist/services/skill/skill-search-service.d.ts +12 -7
- package/dist/services/skill/skill-search-service.js +8 -4
- package/dist/services/skillhub/migrations/001-initial.sql +71 -0
- package/dist/services/skillhub/migrations/002-loop-release.sql +32 -0
- package/dist/services/skillhub/migrations/003-loop-bee-relation.sql +35 -0
- package/dist/services/skillhub/migrations/004-loop-bee-extension.sql +65 -0
- package/dist/services/skillhub/migrations/005-evolution-evaluation.sql +81 -0
- package/dist/services/skillhub/migrations/006-crystallization-event.sql +92 -0
- package/dist/services/skills/hooks-settings-service.d.ts +75 -0
- package/dist/services/skills/hooks-settings-service.js +230 -2
- package/dist/services/skills/skill-registry.d.ts +1 -0
- package/dist/services/skills/skill-registry.js +6 -4
- package/dist/services/skills/skill-runbook-service.js +1 -1
- package/dist/services/slice/slice-check-service.js +1 -1
- package/dist/services/standards/main-session-monitor-ban-hook.d.ts +14 -0
- package/dist/services/standards/main-session-monitor-ban-hook.js +19 -0
- package/dist/services/standards/missing-standards-detector.d.ts +25 -0
- package/dist/services/standards/missing-standards-detector.js +43 -12
- package/dist/services/tech/tech-change-id-service.d.ts +82 -0
- package/dist/services/tech/tech-change-id-service.js +117 -0
- package/dist/services/understand/understand-hybrid-service.js +1 -1
- package/dist/services/understand/understand-scan-service.js +2 -2
- package/dist/services/upgrade/upgrade-service.js +4 -3
- package/dist/services/verdict/envelopes.d.ts +2 -2
- package/dist/services/verdict/envelopes.js +2 -2
- package/dist/services/verdict/verdict-aggregator.d.ts +3 -3
- package/dist/services/vm/vm-lease.d.ts +40 -0
- package/dist/services/vm/vm-lease.js +137 -0
- package/dist/services/workflow/autonomous-resume-writer.js +1 -1
- package/dist/services/workflow/pipeline-verify-gate-support.d.ts +47 -0
- package/dist/services/workflow/pipeline-verify-gate-support.js +194 -0
- package/dist/services/workflow/pipeline-verify-service.d.ts +17 -81
- package/dist/services/workflow/pipeline-verify-service.js +42 -218
- package/dist/services/workflow/pipeline-verify-types.d.ts +90 -0
- package/dist/services/workflow/pipeline-verify-types.js +10 -0
- package/dist/services/workflow/plan-reader.d.ts +1 -1
- package/dist/services/workflow/plan-reader.js +1 -1
- package/dist/services/workflow/plan-refresher.d.ts +1 -1
- package/dist/services/workflow/plan-refresher.js +1 -1
- package/dist/services/workflow/plan-trigger-detector.d.ts +1 -1
- package/dist/services/workflow/plan-trigger-detector.js +1 -1
- package/dist/services/workflow/workflow-autonomous-resume-helpers.d.ts +1 -1
- package/dist/services/workflow/workflow-autonomous-service.d.ts +2 -98
- package/dist/services/workflow/workflow-autonomous-types.d.ts +114 -0
- package/dist/services/workflow/workflow-autonomous-types.js +21 -0
- package/dist/services/workflow/workflow-router-service.js +18 -16
- package/dist/services/workflow/workflow-spec-lint.d.ts +13 -0
- package/dist/services/workflow/workflow-spec-lint.js +75 -0
- package/dist/services/workflow/workflow-spec-types.d.ts +100 -0
- package/dist/services/workflow/workflow-spec-types.js +13 -0
- package/dist/services/workflow/workflow-spec-yaml.d.ts +17 -0
- package/dist/services/workflow/workflow-spec-yaml.js +88 -0
- package/dist/services/workflow/workflow-spec.d.ts +11 -91
- package/dist/services/workflow/workflow-spec.js +16 -145
- package/dist/services/workspace/migrate-service.js +1 -1
- package/dist/services/workspace/workspace-service.js +1 -1
- package/dist/services/worktree/worktree-lease.d.ts +170 -0
- package/dist/services/worktree/worktree-lease.js +242 -0
- package/package.json +47 -51
- package/scripts/clean-dist.mjs +31 -1
- package/scripts/copy-templates.mjs +16 -0
- package/scripts/sync-version.mjs +53 -2
- package/skills/bee/peaks-perf-audit/SKILL.md +17 -0
- package/skills/bee/peaks-prd/SKILL.md +16 -0
- package/skills/bee/peaks-prd/test-prompts.json +12 -0
- package/skills/bee/peaks-qa/SKILL.md +16 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +22 -0
- package/skills/bee/peaks-qa/test-prompts.json +12 -0
- package/skills/bee/peaks-rd/SKILL.md +29 -20
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +39 -0
- package/skills/bee/peaks-rd/test-prompts.json +12 -0
- package/skills/bee/peaks-reviewer/SKILL.md +17 -0
- package/skills/bee/peaks-sc/SKILL.md +16 -0
- package/skills/bee/peaks-security-audit/SKILL.md +17 -0
- package/skills/bee/peaks-txt/SKILL.md +16 -0
- package/skills/bee/peaks-txt/test-prompts.json +12 -0
- package/skills/bee/peaks-ui/SKILL.md +49 -43
- package/skills/bee/peaks-ui/test-prompts.json +12 -0
- package/skills/peaks-code/SKILL.md +54 -109
- package/skills/peaks-code/references/boundaries.md +15 -1
- package/skills/peaks-code/references/cron-scheduler-deployment.md +313 -0
- package/skills/peaks-code/references/external-skill-invocation.md +27 -0
- package/skills/peaks-code/references/lease-dashboard.html +224 -0
- package/skills/peaks-code/references/lease-stats.sample.json +26 -0
- package/skills/peaks-code/references/peaks-worktree-l2-enforcers.md +208 -0
- package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
- package/skills/peaks-code/references/runbook.md +63 -1
- package/skills/peaks-code/references/startup-sequence.md +110 -0
- package/skills/peaks-code/references/step-0-8-gate.md +1 -1
- package/skills/peaks-code/references/sub-agent-dispatch.md +92 -1
- package/skills/peaks-code/references/worktree-governance.md +123 -0
- package/skills/peaks-code/test-prompts.json +12 -0
- package/skills/peaks-doctor/SKILL.md +1 -1
- package/skills/peaks-ide/SKILL.md +1 -1
- package/skills/peaks-solo/SKILL.md +21 -0
- package/skills/peaks-solo/references/triage-decision-table.md +6 -0
- package/skills/peaks-sop/test-prompts.json +17 -0
- package/dist/cli/commands/agent-commands.d.ts +0 -20
- package/dist/cli/commands/agent-commands.js +0 -48
- package/dist/cli/commands/classify-classify-commands.d.ts +0 -19
- package/dist/cli/commands/classify-classify-commands.js +0 -151
- package/dist/cli/commands/contract-commands.d.ts +0 -26
- package/dist/cli/commands/contract-commands.js +0 -114
- package/dist/cli/commands/session-auto-compact-hook-command.d.ts +0 -37
- package/dist/cli/commands/session-auto-compact-hook-command.js +0 -127
- package/dist/cli/commands/worker-commands.d.ts +0 -3
- package/dist/cli/commands/worker-commands.js +0 -52
- package/dist/services/agent/ecc-agent-service.d.ts +0 -47
- package/dist/services/agent/ecc-agent-service.js +0 -143
- package/dist/services/config/provider-service.d.ts +0 -48
- package/dist/services/config/provider-service.js +0 -143
- package/dist/services/context/dispatch-context-guard.d.ts +0 -27
- package/dist/services/context/dispatch-context-guard.js +0 -192
- package/dist/services/context/shared-channel.d.ts +0 -93
- package/dist/services/context/shared-channel.js +0 -308
- package/dist/services/filesystem/file-lock.d.ts +0 -11
- package/dist/services/filesystem/file-lock.js +0 -152
- package/dist/services/mut/assert-scanner.d.ts +0 -6
- package/dist/services/mut/assert-scanner.js +0 -116
- package/dist/services/mut/index.d.ts +0 -8
- package/dist/services/mut/index.js +0 -7
- package/dist/services/mut/mut-runner.d.ts +0 -39
- package/dist/services/mut/mut-runner.js +0 -29
- package/dist/services/mut/production-stryker.d.ts +0 -2
- package/dist/services/mut/production-stryker.js +0 -75
- package/dist/services/mut/report-builder.d.ts +0 -11
- package/dist/services/mut/report-builder.js +0 -110
- package/dist/services/mut/report-loader.d.ts +0 -31
- package/dist/services/mut/report-loader.js +0 -78
- package/dist/services/mut/thresholds.d.ts +0 -21
- package/dist/services/mut/thresholds.js +0 -22
- package/dist/services/mut/types.d.ts +0 -336
- package/dist/services/mut/types.js +0 -59
- package/dist/services/providers/minimax-provider-service.d.ts +0 -24
- package/dist/services/providers/minimax-provider-service.js +0 -143
- package/dist/services/providers/minimax-worker-service.d.ts +0 -21
- package/dist/services/providers/minimax-worker-service.js +0 -83
- package/dist/shared/fs.d.ts +0 -4
- package/dist/shared/fs.js +0 -26
- package/dist/shared/paths.d.ts +0 -6
- package/dist/shared/paths.js +0 -50
- package/dist/shared/result.d.ts +0 -22
- package/dist/shared/result.js +0 -46
- package/dist/shared/version.d.ts +0 -1
- package/dist/shared/version.js +0 -1
- package/examples/video-demo/README.md +0 -142
- package/examples/video-demo/out/en-closing-960.png +0 -0
- package/examples/video-demo/out/zh-closing-960.png +0 -0
- package/examples/video-demo/preview/peaks-loop-demo-en.mp4 +0 -0
- package/examples/video-demo/preview/peaks-loop-demo.mp4 +0 -0
- /package/dist/services/{job/job-resource-snapshot.js → job-snapshot/snapshot.js} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice rid-024 — `peaks code detect-job` + `peaks code read-job-shape`.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from code-commands.ts (rid-024 split).
|
|
5
|
+
* Owns: detect-job (write JobShapeDecision), read-job-shape (read+print).
|
|
6
|
+
*/
|
|
7
|
+
import type { Command } from 'commander';
|
|
8
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
9
|
+
export declare function registerCodeJobShapeCommands(code: Command, io: ProgramIO): void;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice rid-024 — `peaks code detect-job` + `peaks code read-job-shape`.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from code-commands.ts (rid-024 split).
|
|
5
|
+
* Owns: detect-job (write JobShapeDecision), read-job-shape (read+print).
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { addJsonOption, getErrorMessage, printResult } from '../cli-helpers.js';
|
|
10
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
11
|
+
import { readJobShapeDecision, writeJobShapeDecision, JobShapeDecisionError, JOB_SHAPE_NOT_DECIDED, JOB_SHAPE_ALREADY_DECIDED } from '../../services/code/job-shape-decision.js';
|
|
12
|
+
import { findProjectRoot } from '../../services/config/config-safety.js';
|
|
13
|
+
import { getSkillPresence } from '../../services/skills/skill-presence-service.js';
|
|
14
|
+
export function registerCodeJobShapeCommands(code, io) {
|
|
15
|
+
// v3.1.1 Step 0.8 — Job-shape decision recorder.
|
|
16
|
+
// The CLI is a *recorder*, not a judge. The LLM supplies the verdict
|
|
17
|
+
// (--is-job, --rationale, --suggested-job-id, --suggested-strategy,
|
|
18
|
+
// --confidence); the CLI validates the shape, stamps `decidedAt`
|
|
19
|
+
// server-side, and writes to `.peaks/_runtime/<sessionId>/job-shape.json`.
|
|
20
|
+
addJsonOption(code
|
|
21
|
+
.command('detect-job')
|
|
22
|
+
.description('v3.1.1 Step 0.8: record the LLM\'s Job-shape judgement. CLI is a recorder, NOT a detector. ' +
|
|
23
|
+
'Pass --is-job true|false, --rationale <text>, --suggested-job-id <slug>. ' +
|
|
24
|
+
'Downstream steps call `peaks code read-job-shape` and refuse to proceed if missing.')
|
|
25
|
+
.requiredOption('--is-job <bool>', 'true | false (the LLM\'s semantic verdict)')
|
|
26
|
+
.requiredOption('--rationale <text>', '1-3 sentences the LLM writes explaining the call')
|
|
27
|
+
.requiredOption('--suggested-job-id <jid>', 'LLM-chosen stable id, slug-safe (/^[a-z0-9][a-z0-9-]{2,40}$/)')
|
|
28
|
+
.option('--suggested-strategy <single|rotating>', 'single | rotating', 'single')
|
|
29
|
+
.option('--confidence <high|medium|low>', 'high | medium | low', 'medium')
|
|
30
|
+
.option('--force', 'overwrite an existing decision file')
|
|
31
|
+
.option('--session-id <sid>', 'override session id (default: read from active presence)')
|
|
32
|
+
.option('--project <path>', 'target project root (default: findProjectRoot(cwd))')
|
|
33
|
+
.option('--prompt <text>', 'override the prompt hashed into promptHash (default: read last-prompt.txt if present, else empty)')).action(async (opts) => {
|
|
34
|
+
try {
|
|
35
|
+
if (opts.isJob !== 'true' && opts.isJob !== 'false') {
|
|
36
|
+
printResult(io, fail('code.detect-job', 'INVALID_FLAG', `--is-job must be true | false (got "${opts.isJob}")`, { provided: opts.isJob }, ['Pass --is-job true or --is-job false']), opts.json);
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (opts.suggestedStrategy !== 'single' && opts.suggestedStrategy !== 'rotating') {
|
|
41
|
+
printResult(io, fail('code.detect-job', 'INVALID_FLAG', `--suggested-strategy must be single | rotating (got "${opts.suggestedStrategy}")`, { provided: opts.suggestedStrategy }, ['Pass --suggested-strategy single or --suggested-strategy rotating']), opts.json);
|
|
42
|
+
process.exitCode = 1;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (opts.confidence !== 'high' && opts.confidence !== 'medium' && opts.confidence !== 'low') {
|
|
46
|
+
printResult(io, fail('code.detect-job', 'INVALID_FLAG', `--confidence must be high | medium | low (got "${opts.confidence}")`, { provided: opts.confidence }, ['Pass --confidence high | medium | low']), opts.json);
|
|
47
|
+
process.exitCode = 1;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const jidRe = /^[a-z0-9][a-z0-9-]{2,40}$/;
|
|
51
|
+
if (!jidRe.test(opts.suggestedJobId)) {
|
|
52
|
+
printResult(io, fail('code.detect-job', 'INVALID_FLAG', `--suggested-job-id must match /^[a-z0-9][a-z0-9-]{2,40}$/ (got "${opts.suggestedJobId}")`, { provided: opts.suggestedJobId }, ['Pass a slug-safe id (lowercase, digits, dashes; 3-41 chars)']), opts.json);
|
|
53
|
+
process.exitCode = 1;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const projectRoot = opts.project ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
57
|
+
const sessionId = opts.sessionId ?? readActiveSidForJobShape(projectRoot);
|
|
58
|
+
if (sessionId === null) {
|
|
59
|
+
printResult(io, fail('code.detect-job', 'NO_ACTIVE_SESSION', 'no active session id; pass --session-id or set presence via `peaks skill presence:set peaks-code`', null, ['Re-run with --session-id <sid>']), opts.json);
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Prompt source: explicit --prompt > last-prompt.txt > empty.
|
|
64
|
+
let promptText = opts.prompt ?? '';
|
|
65
|
+
if (opts.prompt === undefined) {
|
|
66
|
+
const lastPromptPath = join(projectRoot, '.peaks', '_runtime', sessionId, 'txt', 'last-prompt.txt');
|
|
67
|
+
if (existsSync(lastPromptPath)) {
|
|
68
|
+
try {
|
|
69
|
+
promptText = readFileSync(lastPromptPath, 'utf8');
|
|
70
|
+
}
|
|
71
|
+
catch { // TODO(g2): legacy silent catch — grace: 1 minor release
|
|
72
|
+
promptText = '';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const record = writeJobShapeDecision(projectRoot, sessionId, {
|
|
77
|
+
isJob: opts.isJob === 'true',
|
|
78
|
+
rationale: opts.rationale,
|
|
79
|
+
suggestedJobId: opts.suggestedJobId,
|
|
80
|
+
suggestedStrategy: opts.suggestedStrategy,
|
|
81
|
+
confidence: opts.confidence,
|
|
82
|
+
prompt: promptText
|
|
83
|
+
}, { force: opts.force === true });
|
|
84
|
+
printResult(io, ok('code.detect-job', {
|
|
85
|
+
sessionId: record.sessionId,
|
|
86
|
+
promptHash: record.promptHash,
|
|
87
|
+
decision: record.decision,
|
|
88
|
+
schemaVersion: record.schemaVersion
|
|
89
|
+
}, [], [
|
|
90
|
+
`Decision recorded: isJob=${record.decision.isJob} strategy=${record.decision.suggestedStrategy} confidence=${record.decision.confidence}`,
|
|
91
|
+
`File: .peaks/_runtime/${record.sessionId}/job-shape.json`
|
|
92
|
+
]), opts.json);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
if (err instanceof JobShapeDecisionError) {
|
|
96
|
+
const code = err.code === JOB_SHAPE_ALREADY_DECIDED ? JOB_SHAPE_ALREADY_DECIDED : err.code === JOB_SHAPE_NOT_DECIDED ? JOB_SHAPE_NOT_DECIDED : err.code;
|
|
97
|
+
printResult(io, fail('code.detect-job', code, err.message, err.details ?? null, [
|
|
98
|
+
err.code === JOB_SHAPE_ALREADY_DECIDED
|
|
99
|
+
? 'Re-run with --force to overwrite the existing decision.'
|
|
100
|
+
: 'Re-run with valid flags.'
|
|
101
|
+
]), opts.json);
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
printResult(io, fail('code.detect-job', 'DETECT_JOB_FAILED', getErrorMessage(err), null, ['Verify the flags and try again']), opts.json);
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
// v3.1.1 Step 0.8 — read-only validator. Downstream steps call this
|
|
110
|
+
// to refuse to proceed if the LLM has not yet recorded a decision.
|
|
111
|
+
addJsonOption(code
|
|
112
|
+
.command('read-job-shape')
|
|
113
|
+
.description('v3.1.1 Step 0.8: return the recorded Job-shape decision. ' +
|
|
114
|
+
'Returns JOB_SHAPE_NOT_DECIDED when the LLM has not yet recorded a verdict.')
|
|
115
|
+
.option('--session-id <sid>', 'override session id (default: read from active presence)')
|
|
116
|
+
.option('--project <path>', 'target project root (default: findProjectRoot(cwd))')).action((opts) => {
|
|
117
|
+
try {
|
|
118
|
+
const projectRoot = opts.project ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
119
|
+
const sessionId = opts.sessionId ?? readActiveSidForJobShape(projectRoot);
|
|
120
|
+
if (sessionId === null) {
|
|
121
|
+
printResult(io, fail('code.read-job-shape', 'NO_ACTIVE_SESSION', 'no active session id; pass --session-id or set presence via `peaks skill presence:set peaks-code`', null, ['Re-run with --session-id <sid>']), opts.json);
|
|
122
|
+
process.exitCode = 1;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const record = readJobShapeDecision(projectRoot, sessionId);
|
|
126
|
+
printResult(io, ok('code.read-job-shape', {
|
|
127
|
+
sessionId: record.sessionId,
|
|
128
|
+
promptHash: record.promptHash,
|
|
129
|
+
decision: record.decision,
|
|
130
|
+
schemaVersion: record.schemaVersion
|
|
131
|
+
}, [], [
|
|
132
|
+
`Decision on file: isJob=${record.decision.isJob} strategy=${record.decision.suggestedStrategy} confidence=${record.decision.confidence}`
|
|
133
|
+
]), opts.json);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
if (err instanceof JobShapeDecisionError) {
|
|
137
|
+
printResult(io, fail('code.read-job-shape', err.code, err.message, err.details ?? null, [
|
|
138
|
+
err.code === JOB_SHAPE_NOT_DECIDED
|
|
139
|
+
? 'Run `peaks code detect-job` to record a decision.'
|
|
140
|
+
: 'Investigate the decision file integrity.'
|
|
141
|
+
]), opts.json);
|
|
142
|
+
process.exitCode = 1;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
printResult(io, fail('code.read-job-shape', 'READ_JOB_SHAPE_FAILED', getErrorMessage(err), null, ['Verify the project path and try again']), opts.json);
|
|
146
|
+
process.exitCode = 1;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// Local helper (was `readActiveSid` in code-commands.ts before rid-024 split).
|
|
151
|
+
// Both detect-job and read-job-shape need to read the active sid from
|
|
152
|
+
// presence. We re-import getSkillPresence here to avoid the cross-file
|
|
153
|
+
// helper import.
|
|
154
|
+
function readActiveSidForJobShape(projectRoot) {
|
|
155
|
+
try {
|
|
156
|
+
const presence = getSkillPresence(projectRoot);
|
|
157
|
+
if (presence === null || presence === undefined)
|
|
158
|
+
return null;
|
|
159
|
+
return presence.sessionId ?? null;
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice rid-024 — `peaks code plan` + `peaks code should-pause` (mode-gate).
|
|
3
|
+
*
|
|
4
|
+
* Extracted from code-commands.ts (rid-024 split).
|
|
5
|
+
* Owns: `plan` (build+print CodePlan), `should-pause` (D5 mode-gate).
|
|
6
|
+
*/
|
|
7
|
+
import type { Command } from 'commander';
|
|
8
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
9
|
+
export declare function registerCodeModeGateCommands(code: Command, io: ProgramIO): void;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice rid-024 — `peaks code plan` + `peaks code should-pause` (mode-gate).
|
|
3
|
+
*
|
|
4
|
+
* Extracted from code-commands.ts (rid-024 split).
|
|
5
|
+
* Owns: `plan` (build+print CodePlan), `should-pause` (D5 mode-gate).
|
|
6
|
+
*/
|
|
7
|
+
import { addJsonOption, getErrorMessage, printResult } from '../cli-helpers.js';
|
|
8
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
9
|
+
import { GATED_STEPS, isHardFloorCategory, isCodeMode, isCommitBoundaryAction, shouldPauseAtGate, formatAutoProceedLogLine } from '../../services/code/mode-gate.js';
|
|
10
|
+
import { checkStalePresence } from '../../services/skills/skill-presence-service.js';
|
|
11
|
+
import { findProjectRoot } from '../../services/config/config-safety.js';
|
|
12
|
+
import { emitObservabilityEvent } from '../../services/observability/observability-service.js';
|
|
13
|
+
import { buildCodePlan } from './code-commands.js';
|
|
14
|
+
export function registerCodeModeGateCommands(code, io) {
|
|
15
|
+
code
|
|
16
|
+
.command('plan')
|
|
17
|
+
.description('Build and print a CodePlan without executing it')
|
|
18
|
+
.argument('<change-id>', 'change id to plan against')
|
|
19
|
+
.option('--fast', 'fast mode: skip memory full-load, standards preflight, and QA repair loop', false)
|
|
20
|
+
.option('--json', 'emit JSON envelope')
|
|
21
|
+
.action((sessionId, opts) => {
|
|
22
|
+
const plan = buildCodePlan({ sessionId, fast: opts.fast === true });
|
|
23
|
+
if (opts.json === true) {
|
|
24
|
+
process.stdout.write(JSON.stringify({ ok: true, data: plan }) + '\n');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
process.stdout.write(`change-id: ${plan.sessionId}\n`);
|
|
28
|
+
for (const step of plan.steps) {
|
|
29
|
+
const flag = step.skipped ? 'SKIP' : 'RUN ';
|
|
30
|
+
const repair = step.id === 'qa-cycle' ? ` repair=${step.repairLoop === true ? 'on' : 'off'}` : '';
|
|
31
|
+
process.stdout.write(` [${flag}] ${step.id}${repair}\n`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
addJsonOption(code
|
|
36
|
+
.command('should-pause')
|
|
37
|
+
.description('v2.11.0 D5: ask the mode-gate whether the LLM should pause for an AskUserQuestion at a given step. ' +
|
|
38
|
+
'full-auto / swarm auto-proceed (recommended = chosen); assisted / strict pause. ' +
|
|
39
|
+
'The 3 hard-floor categories always pause regardless of mode. ' +
|
|
40
|
+
'v2.15.0 slice 002 AC-2: when --step step-1-mode-select AND the recorded skill presence is stale ' +
|
|
41
|
+
'(outer-session-mismatch / no-presence), the gate returns shouldPause: true with reason "stale-presence" ' +
|
|
42
|
+
'even if the user passed --mode full-auto. The re-ask is mandatory — sticky-mode from a previous ' +
|
|
43
|
+
'session is NOT authoritative.')
|
|
44
|
+
.requiredOption('--step <step>', `one of: ${GATED_STEPS.join(', ')}`)
|
|
45
|
+
// v2.18.4 slice 002-fix-first-run-step-gates (Bug 2):
|
|
46
|
+
// `--mode` is now OPTIONAL. Step 1's SEMANTIC is "ask the user
|
|
47
|
+
// what mode to use" — requiring --mode to ask mode is a
|
|
48
|
+
// chicken-and-egg. When --mode is omitted, default to
|
|
49
|
+
// 'full-auto' so the gate can still evaluate; the gate's hard-
|
|
50
|
+
// pause on `step-1-mode-select` (mode-selection-itself) will
|
|
51
|
+
// pause regardless, and the LLM-side caller can present
|
|
52
|
+
// AskUserQuestion without first knowing the mode.
|
|
53
|
+
.option('--mode <mode>', 'one of: full-auto, assisted, swarm, strict. Defaults to full-auto when omitted (Step 1 chicken-and-egg fix).')
|
|
54
|
+
.option('--hard-floor <category>', 'optional hard-floor override (irreversible-external-side-effect | authentication-credential | multi-day-investment | commit-boundary-side-effect)')
|
|
55
|
+
.option('--recommended <option>', 'recommended option label to log when auto-proceeding', 'recommended-option')
|
|
56
|
+
.option('--project <path>', 'v2.15.0 slice 002 AC-2: project root for presence:check-stale. Default: cwd. Pass only when step=step-1-mode-select.')
|
|
57
|
+
.option('--ignore-stale-presence', 'v2.15.0 slice 002 AC-2: skip the stale-presence check (test seam). Default false.')
|
|
58
|
+
.option('--commit-boundary-action <id>', 'v2.15.0 slice 002 AC-4 CLI seam (slice 002 repair): when the LLM is about to run a commit-boundary action (git push / tag / npm publish / global install), pass the action id here to force the hard-floor pause. Valid: git-push | git-tag | npm-publish | npm-install-global | peaks-global-install. Default: omitted (no override).')).action((opts) => {
|
|
59
|
+
try {
|
|
60
|
+
// v2.18.4 slice 002-fix-first-run-step-gates (Bug 2):
|
|
61
|
+
// --mode is optional. Default to 'full-auto' when omitted
|
|
62
|
+
// so step-1-mode-select can run without forcing the caller
|
|
63
|
+
// to know the mode up front. The gate's hard-pause on
|
|
64
|
+
// step-1-mode-select will still pause regardless.
|
|
65
|
+
const mode = opts.mode ?? 'full-auto';
|
|
66
|
+
if (!isCodeMode(mode)) {
|
|
67
|
+
printResult(io, fail('code.should-pause', 'INVALID_MODE', `mode must be one of full-auto, assisted, swarm, strict (got "${mode}")`, { provided: mode }, ['Pass --mode full-auto | assisted | swarm | strict']), opts.json);
|
|
68
|
+
process.exitCode = 1;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!GATED_STEPS.includes(opts.step)) {
|
|
72
|
+
printResult(io, fail('code.should-pause', 'INVALID_STEP', `step must be one of the 14 GATED_STEPS (got "${opts.step}")`, { provided: opts.step, allowed: [...GATED_STEPS] }, ['Pass --step <one of the 14 GATED_STEPS>']), opts.json);
|
|
73
|
+
process.exitCode = 1;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const hardFloor = opts.hardFloor;
|
|
77
|
+
if (hardFloor !== undefined && !isHardFloorCategory(hardFloor)) {
|
|
78
|
+
printResult(io, fail('code.should-pause', 'INVALID_HARD_FLOOR', `hard-floor must be one of: irreversible-external-side-effect | authentication-credential | multi-day-investment | commit-boundary-side-effect (got "${hardFloor}")`, { provided: hardFloor }, ['Omit --hard-floor or pass a valid category']), opts.json);
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// v2.15.0 slice 002 repair (QA blocker): validate the
|
|
83
|
+
// --commit-boundary-action flag at the CLI boundary. The
|
|
84
|
+
// service-layer `shouldPauseAtGate` accepts a boolean
|
|
85
|
+
// `commitBoundaryAction: true`; this flag tells the CLI to
|
|
86
|
+
// pass it through. An unknown action id is rejected here
|
|
87
|
+
// (not silently ignored) so typos fail loud.
|
|
88
|
+
const commitBoundaryActionId = opts.commitBoundaryAction;
|
|
89
|
+
if (commitBoundaryActionId !== undefined && !isCommitBoundaryAction(commitBoundaryActionId)) {
|
|
90
|
+
printResult(io, fail('code.should-pause', 'INVALID_COMMIT_BOUNDARY_ACTION', `--commit-boundary-action must be one of: git-push | git-tag | npm-publish | npm-install-global | peaks-global-install (got "${commitBoundaryActionId}")`, { provided: commitBoundaryActionId }, ['Omit --commit-boundary-action or pass a valid action id']), opts.json);
|
|
91
|
+
process.exitCode = 1;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const step = opts.step;
|
|
95
|
+
// Slice 002 (v2.15.0) AC-2: when the caller is asking about
|
|
96
|
+
// Step 1 AND the recorded presence is stale, OVERRIDE the
|
|
97
|
+
// gate decision to PAUSE with reason='stale-presence'. The
|
|
98
|
+
// hard-pause on step-1-mode-select (defect #1 fix from
|
|
99
|
+
// 2026-06-28-code-mode-bypass-fix) is already in effect, so
|
|
100
|
+
// this only adds the structured `stale` reason + an
|
|
101
|
+
// envelope-level `stalePresence` field so downstream tooling
|
|
102
|
+
// (statusline, sub-agent dispatch) can act on it.
|
|
103
|
+
let stalePresence = null;
|
|
104
|
+
if (opts.step === 'step-1-mode-select' && opts.ignoreStalePresence !== true) {
|
|
105
|
+
const projectRoot = opts.project ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
106
|
+
stalePresence = checkStalePresence({ projectRootOverride: projectRoot });
|
|
107
|
+
}
|
|
108
|
+
if (stalePresence !== null && stalePresence.stale) {
|
|
109
|
+
// Build the envelope manually so we can attach the extra
|
|
110
|
+
// structured fields (stalePresence, logLine) and emit a
|
|
111
|
+
// dedicated observability event tagged with reason='stale-presence'.
|
|
112
|
+
const sid = readActiveSidForModeGate(opts.project ?? findProjectRoot(process.cwd()) ?? process.cwd()) ?? '';
|
|
113
|
+
if (sid.length > 0) {
|
|
114
|
+
emitObservabilityEvent({
|
|
115
|
+
schemaVersion: 1,
|
|
116
|
+
ts: new Date().toISOString(),
|
|
117
|
+
sessionId: sid,
|
|
118
|
+
category: 'mode-gate',
|
|
119
|
+
detail: {
|
|
120
|
+
mode: mode,
|
|
121
|
+
step,
|
|
122
|
+
shouldPause: true,
|
|
123
|
+
reason: 'stale-presence',
|
|
124
|
+
staleReason: stalePresence.reason,
|
|
125
|
+
recordedOuterSessionId: stalePresence.recordedOuterSessionId,
|
|
126
|
+
currentOuterSessionId: stalePresence.currentOuterSessionId
|
|
127
|
+
}
|
|
128
|
+
}, { projectRoot: opts.project ?? process.cwd() });
|
|
129
|
+
}
|
|
130
|
+
printResult(io, ok('code.should-pause', {
|
|
131
|
+
shouldPause: true,
|
|
132
|
+
reason: `stale-presence — re-ask Step 1 (${stalePresence.reason}; recorded outer session id does not match current)`,
|
|
133
|
+
gateKind: 'mode-selection-itself',
|
|
134
|
+
logLine: `auto-pause (${mode}, stale-presence:${stalePresence.reason}): ${step} → re-ask`,
|
|
135
|
+
stalePresence: {
|
|
136
|
+
stale: true,
|
|
137
|
+
reason: stalePresence.reason,
|
|
138
|
+
recordedOuterSessionId: stalePresence.recordedOuterSessionId,
|
|
139
|
+
currentOuterSessionId: stalePresence.currentOuterSessionId
|
|
140
|
+
}
|
|
141
|
+
}, [], [
|
|
142
|
+
`Recorded outer session id "${stalePresence.recordedOuterSessionId ?? '?'}" does not match current outer session id "${stalePresence.currentOuterSessionId ?? '?'}".`,
|
|
143
|
+
`peaks-code Step 1 must AskUserQuestion to confirm the mode for THIS session (slice 002 AC-2).`
|
|
144
|
+
]), opts.json);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const decision = shouldPauseAtGate({
|
|
148
|
+
mode: mode,
|
|
149
|
+
step,
|
|
150
|
+
hardFloorCategory: hardFloor,
|
|
151
|
+
// v2.15.0 slice 002 repair (QA blocker): translate the CLI
|
|
152
|
+
// --commit-boundary-action flag into the service-layer
|
|
153
|
+
// boolean. The CLI accepts the action id (e.g. "git-push")
|
|
154
|
+
// for ergonomic machine consumption; the service layer only
|
|
155
|
+
// cares that *some* commit-boundary action triggered the
|
|
156
|
+
// override. The actual action id is echoed in the JSON
|
|
157
|
+
// envelope below.
|
|
158
|
+
commitBoundaryAction: commitBoundaryActionId !== undefined
|
|
159
|
+
});
|
|
160
|
+
// Slice C of v2.11.1 — observability hook #4/7. Fire-and-forget
|
|
161
|
+
// per PRD Q4 (full-auto must never fail-loud). projectRoot
|
|
162
|
+
// resolution mirrors observability-commands.ts (findProjectRoot
|
|
163
|
+
// → cwd fallback).
|
|
164
|
+
const projectRoot = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
165
|
+
const sid = readActiveSidForModeGate(projectRoot) ?? '';
|
|
166
|
+
if (sid.length > 0) {
|
|
167
|
+
emitObservabilityEvent({
|
|
168
|
+
schemaVersion: 1,
|
|
169
|
+
ts: new Date().toISOString(),
|
|
170
|
+
sessionId: sid,
|
|
171
|
+
category: 'mode-gate',
|
|
172
|
+
detail: {
|
|
173
|
+
mode: mode,
|
|
174
|
+
step,
|
|
175
|
+
shouldPause: decision.shouldPause,
|
|
176
|
+
reason: decision.reason,
|
|
177
|
+
...(decision.hardFloorCategory !== undefined ? { hardFloorCategory: decision.hardFloorCategory } : {})
|
|
178
|
+
}
|
|
179
|
+
}, { projectRoot });
|
|
180
|
+
}
|
|
181
|
+
const logLine = formatAutoProceedLogLine({
|
|
182
|
+
mode: mode,
|
|
183
|
+
step,
|
|
184
|
+
recommendedOption: opts.recommended ?? 'recommended-option',
|
|
185
|
+
hardFloorCategory: hardFloor
|
|
186
|
+
});
|
|
187
|
+
printResult(io,
|
|
188
|
+
// v2.15.0 slice 002 repair: include the commit-boundary
|
|
189
|
+
// action id in the envelope (when provided) so the LLM-side
|
|
190
|
+
// caller can echo which boundary was checked. Null when no
|
|
191
|
+
// --commit-boundary-action flag was passed.
|
|
192
|
+
ok('code.should-pause', {
|
|
193
|
+
...decision,
|
|
194
|
+
logLine,
|
|
195
|
+
...(commitBoundaryActionId !== undefined ? { commitBoundaryAction: commitBoundaryActionId } : {})
|
|
196
|
+
}, [], [
|
|
197
|
+
decision.shouldPause
|
|
198
|
+
? `Mode ${mode} + step ${opts.step} → PAUSE for AskUserQuestion${commitBoundaryActionId !== undefined ? ` (commit-boundary: ${commitBoundaryActionId})` : ''}`
|
|
199
|
+
: `Mode ${mode} + step ${opts.step} → AUTO-PROCEED with recommended option`
|
|
200
|
+
]), opts.json);
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
printResult(io, fail('code.should-pause', 'SHOULD_PAUSE_FAILED', getErrorMessage(err), null, ['Re-run with --json for envelope shape']), opts.json);
|
|
204
|
+
process.exitCode = 1;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
// Local helper (was `readActiveSid` in code-commands.ts before rid-024 split).
|
|
209
|
+
// The mode-gate stale-presence check needs the active sid for the
|
|
210
|
+
// observability event; we re-import getSkillPresence here to avoid the
|
|
211
|
+
// cross-file helper import.
|
|
212
|
+
import { getSkillPresence } from '../../services/skills/skill-presence-service.js';
|
|
213
|
+
function readActiveSidForModeGate(projectRoot) {
|
|
214
|
+
try {
|
|
215
|
+
const presence = getSkillPresence(projectRoot);
|
|
216
|
+
if (presence === null || presence === undefined)
|
|
217
|
+
return null;
|
|
218
|
+
return presence.sessionId ?? null;
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getOcrConfigTemplate, detectOcr, runOcrReview } from '../../services/code-review/ocr-service.js';
|
|
2
2
|
import { getOcrLlmConfig, getUserConfigPath, redactConfigSecrets } from '../../services/config/config-service.js';
|
|
3
3
|
import { addJsonOption, getErrorMessage, printResult } from '../cli-helpers.js';
|
|
4
|
-
import { fail, ok } from '
|
|
4
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
5
5
|
export function registerCodeReviewCommands(program, io) {
|
|
6
6
|
const codeReview = program
|
|
7
|
-
.command('code-review')
|
|
7
|
+
.command('code-review', { hidden: true })
|
|
8
8
|
.description('Code-review primitives for peaks-rd Gate B3. Wraps the soft-optional `@alibaba-group/open-code-review` (ocr) tool when it is installed + configured; peaks-rd uses the structured JSON output as a second-opinion review alongside its own LLM review. ocr is a peerDependency of peaks-loop 2.8.2+ (was briefly promoted to a hard dependency in 2.0.1/2.0.2, then demoted to optionalDependencies 2.0.3+ — peer in 2.8.2 because its postinstall downloads a Go binary via HTTPS and would otherwise slow `npm i -g peaks-loop` in restricted environments). Install manually with `npm i -g @alibaba-group/open-code-review` if you want second-opinion reviews. LLM endpoint config lives under `peaksConfig.ocr.llm` in the user config — run `peaks code-review config-template` to see the JSON snippet to paste.');
|
|
9
9
|
addJsonOption(codeReview
|
|
10
10
|
.command('detect-ocr')
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
3
|
+
export type CodeRun24hOptions = {
|
|
4
|
+
json?: boolean;
|
|
5
|
+
'24h'?: boolean;
|
|
6
|
+
project?: string;
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
tier?: string;
|
|
9
|
+
trigger?: string;
|
|
10
|
+
};
|
|
11
|
+
/** Registers `peaks code run`, the thin 24h-mode bridge for peaks-code. */
|
|
12
|
+
export declare function registerCodeRunCommand(code: Command, io: ProgramIO): void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { resolveCanonicalProjectRoot } from '../../services/config/config-service.js';
|
|
2
|
+
import { read24hState, write24hState } from '../../services/24h-mode/index.js';
|
|
3
|
+
import { getErrorMessage } from '../cli-helpers.js';
|
|
4
|
+
function emit(io, payload, json) {
|
|
5
|
+
io.stdout((json === true ? JSON.stringify(payload) : JSON.stringify(payload, null, 2)) + '\n');
|
|
6
|
+
}
|
|
7
|
+
async function sessionId(options, projectRoot) {
|
|
8
|
+
if (options.sessionId)
|
|
9
|
+
return options.sessionId;
|
|
10
|
+
const { getSessionIdCanonical } = await import('../../services/session/session-manager.js');
|
|
11
|
+
return getSessionIdCanonical(projectRoot);
|
|
12
|
+
}
|
|
13
|
+
/** Registers `peaks code run`, the thin 24h-mode bridge for peaks-code. */
|
|
14
|
+
export function registerCodeRunCommand(code, io) {
|
|
15
|
+
code
|
|
16
|
+
.command('run')
|
|
17
|
+
.description('Run a code change; --24h enables the 24h orchestration bridge')
|
|
18
|
+
.argument('[change-id]', 'change id or natural-language work reference')
|
|
19
|
+
.option('--24h', 'enable 24h mode')
|
|
20
|
+
.option('--tier <tier>', 'routing tier (T1, T2, T3, or T4)')
|
|
21
|
+
.option('--trigger <trigger>', 'auto-engage trigger (T3 or T4)')
|
|
22
|
+
.option('--project <path>', 'project root (defaults to current directory)')
|
|
23
|
+
.option('--session-id <sessionId>', 'explicit session id')
|
|
24
|
+
.option('--json', 'emit machine-readable JSON')
|
|
25
|
+
.action(async (changeId, options) => {
|
|
26
|
+
if (options['24h'] !== true) {
|
|
27
|
+
emit(io, { ok: false, code: 'CODE_RUN_24H_REQUIRED', message: 'code run requires --24h for this integration surface' }, options.json);
|
|
28
|
+
process.exitCode = 1;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const projectRoot = resolveCanonicalProjectRoot(options.project ?? process.cwd());
|
|
32
|
+
const sid = await sessionId(options, projectRoot);
|
|
33
|
+
if (!sid) {
|
|
34
|
+
emit(io, { ok: false, code: 'NO_ACTIVE_SESSION', message: 'no --session-id and no canonical binding' }, options.json);
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const autoEngage = options.tier === 'T3' || options.tier === 'T4' || options.trigger === 'T3' || options.trigger === 'T4';
|
|
39
|
+
try {
|
|
40
|
+
const current = read24hState(projectRoot, sid);
|
|
41
|
+
if (!autoEngage) {
|
|
42
|
+
emit(io, {
|
|
43
|
+
ok: true,
|
|
44
|
+
data: { changeId: changeId ?? null, mode: '24H_REQUESTED', state: current.state, brainstorming: 'reference-only', sessionId: sid },
|
|
45
|
+
next: 'Use the brainstorming reference-only bridge, then let peaks-code continue the normal runbook.'
|
|
46
|
+
}, options.json);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const nextState = '24H_ACTIVE';
|
|
50
|
+
const next = write24hState(projectRoot, sid, {
|
|
51
|
+
...current,
|
|
52
|
+
state: nextState,
|
|
53
|
+
enteredAt: new Date().toISOString(),
|
|
54
|
+
enteredFrom: current.state,
|
|
55
|
+
exitCondition: null
|
|
56
|
+
});
|
|
57
|
+
emit(io, {
|
|
58
|
+
ok: true,
|
|
59
|
+
data: { changeId: changeId ?? null, mode: '24H_ACTIVE', state: nextState, autoEngaged: true, trigger: options.trigger ?? options.tier, sessionId: sid, path: next.path },
|
|
60
|
+
next: 'Continue the existing 24H_ACTIVE flow; no brainstorming gate is required for T3/T4.'
|
|
61
|
+
}, options.json);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
emit(io, { ok: false, code: 'CODE_RUN_24H_FAILED', message: getErrorMessage(error), sessionId: sid }, options.json);
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice rid-024 — runtime probes: post-compact-detect / auto-compact /
|
|
3
|
+
* context-now / gate-step-08 / emit-handoff.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from code-commands.ts (rid-024 split).
|
|
6
|
+
* Owns: 5 sub-commands that read or mutate runtime state.
|
|
7
|
+
* Owns the `readActiveSid` helper (only used by these runtime probes).
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from 'commander';
|
|
10
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
11
|
+
export declare function registerCodeRuntimeCommands(code: Command, io: ProgramIO): void;
|