peaks-loop 4.0.0-beta.9 → 4.0.3
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 +572 -234
- package/README-en.md +67 -30
- package/README.md +67 -30
- 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 +91 -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,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `peaks container spawn | release` — slice 2026-07-29-worktree-l2-extended Part 12.
|
|
3
|
+
*
|
|
4
|
+
* L4 container isolation bridge: Part 8 landed the CLI contract
|
|
5
|
+
* (`peaks sub-agent dispatch --isolation container` is accepted
|
|
6
|
+
* and fail-fasts with ISOLATION_CONTAINER_NOT_YET_IMPLEMENTED).
|
|
7
|
+
* Part 12 implements the spawn/release CLI surface so the
|
|
8
|
+
* dispatch command can shell out to it.
|
|
9
|
+
*
|
|
10
|
+
* This file is the `peaks container` parent command. Sub-commands:
|
|
11
|
+
* - spawn : `docker run <image> ...` + write container lease
|
|
12
|
+
* - release : `docker rm --force <id>` + transition lease to released
|
|
13
|
+
*
|
|
14
|
+
* Runtime requirement: `docker` CLI on PATH. The spawn checks
|
|
15
|
+
* `docker --version` first and returns CONTAINER_RUNTIME_UNAVAILABLE
|
|
16
|
+
* with a remediation hint when the daemon is not running. Windows
|
|
17
|
+
* is supported if Docker Desktop / WSL2 is installed; native podman
|
|
18
|
+
* is a follow-up (the container-lease module is runtime-agnostic).
|
|
19
|
+
*
|
|
20
|
+
* Lease is the source of truth: the dispatch record (v3) carries
|
|
21
|
+
* the leaseId; the PreToolUse gate (Part 2.B pattern) will read
|
|
22
|
+
* PEAKS_CONTAINER_LEASE_ID and consult the lease file before
|
|
23
|
+
* allowing docker-related tool calls. The gate bridge is a
|
|
24
|
+
* follow-up rid.
|
|
25
|
+
*/
|
|
26
|
+
import { execSync } from 'node:child_process';
|
|
27
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
28
|
+
import { fail, getErrorMessage, ok } from 'peaks-loop-shared/result';
|
|
29
|
+
import { addJsonOption, printResult } from '../cli-helpers.js';
|
|
30
|
+
import { findProjectRoot } from '../../services/config/config-safety.js';
|
|
31
|
+
import { getCurrentSessionId } from '../../services/skills/skill-presence-service.js';
|
|
32
|
+
import { atomicWriteJson } from '../../services/ide/shared/atomic-json.js';
|
|
33
|
+
import { containerLeaseFilePath, deserializeContainerLease, finalizeContainerLease, generateContainerLeaseId, markContainerReleased, ttlForContainerRole } from '../../services/container/container-lease.js';
|
|
34
|
+
const DEFAULT_DOCKER_IMAGE = 'node:22-slim';
|
|
35
|
+
function detectContainerRuntime(explicit) {
|
|
36
|
+
const tryOrder = explicit ? [explicit] : ['docker', 'podman'];
|
|
37
|
+
for (const r of tryOrder) {
|
|
38
|
+
try {
|
|
39
|
+
const version = execSync(`${r} --version`, { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf8' }).trim();
|
|
40
|
+
return { ok: true, runtime: r, binary: `${r} (${version.split('\n')[0] ?? ''})` };
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
/* try next */
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
stderr: explicit
|
|
49
|
+
? `explicit --runtime ${explicit} not on PATH`
|
|
50
|
+
: 'neither docker nor podman is on PATH',
|
|
51
|
+
hint: explicit
|
|
52
|
+
? `Install ${explicit} or pass a different --runtime.`
|
|
53
|
+
: 'Install docker (Docker Desktop on macOS / Windows) or podman (RHEL / Fedora).'
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function joinPathSession(projectRoot, sessionId) {
|
|
57
|
+
return `${projectRoot.replace(/[\\/]+$/, '')}/.peaks/_runtime/${sessionId}`;
|
|
58
|
+
}
|
|
59
|
+
function checkDockerAvailable() {
|
|
60
|
+
// Part 43: superseded by detectContainerRuntime above; this
|
|
61
|
+
// function is preserved for callers that imported it. The
|
|
62
|
+
// container-commands.ts action handlers all use
|
|
63
|
+
// detectContainerRuntime directly.
|
|
64
|
+
return { ok: false, stderr: 'deprecated — use detectContainerRuntime' };
|
|
65
|
+
}
|
|
66
|
+
export function registerContainerCommand(program, io) {
|
|
67
|
+
const cmd = program.command('container').description('L4 container isolation: spawn/release container leases (Part 12; pairs with --isolation container on dispatch).');
|
|
68
|
+
addJsonOption(cmd.command('spawn')
|
|
69
|
+
.description('Spawn a container via `docker run` and write a container lease. ' +
|
|
70
|
+
'The lease is the source of truth for the L4 PreToolUse gate (Part 12 follow-up). ' +
|
|
71
|
+
'Default TTL is role-aware (rd=30m / qa=15m / ui=1h); pass --ttl <ms> to override. ' +
|
|
72
|
+
'Default image is `node:22-slim`; pass --image <name> to override.')
|
|
73
|
+
.requiredOption('--rid <rid>', 'peaks request id the lease is associated with')
|
|
74
|
+
.requiredOption('--role <role>', 'sub-agent role (rd | qa | ui | sc | prd | general-purpose)')
|
|
75
|
+
.requiredOption('--purpose <text>', 'why this container was spawned (audit log)')
|
|
76
|
+
.option('--image <name>', `container image (default ${DEFAULT_DOCKER_IMAGE})`)
|
|
77
|
+
.option('--ttl <ms>', 'time-to-live in ms (default role-aware; override with positive number)')
|
|
78
|
+
.option('--mount <path>', 'host path to mount as the container working dir (default: <projectRoot>)')
|
|
79
|
+
.option('--session <sid>', 'override session id')
|
|
80
|
+
.option('--project <path>', 'project root (default: findProjectRoot(cwd))')).action(async (options) => {
|
|
81
|
+
const projectRoot = options.project ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
82
|
+
const sessionId = options.session ?? process.env.PEAKS_SESSION_ID ?? getCurrentSessionId(projectRoot) ?? 'unknown-sid';
|
|
83
|
+
try {
|
|
84
|
+
const explicitRuntime = (() => {
|
|
85
|
+
if (options.runtime === 'docker')
|
|
86
|
+
return 'docker';
|
|
87
|
+
if (options.runtime === 'podman')
|
|
88
|
+
return 'podman';
|
|
89
|
+
return undefined;
|
|
90
|
+
})();
|
|
91
|
+
const runtime = detectContainerRuntime(explicitRuntime);
|
|
92
|
+
if (!runtime.ok) {
|
|
93
|
+
printResult(io, fail('container.spawn', 'CONTAINER_RUNTIME_UNAVAILABLE', `${runtime.stderr}: ${runtime.hint}`, { rid: options.rid, role: options.role, sessionId }, [
|
|
94
|
+
'Install docker (Docker Desktop on macOS / Windows) or podman (RHEL / Fedora).',
|
|
95
|
+
'On Windows, ensure WSL2 backend is enabled and the daemon is running.',
|
|
96
|
+
'Pass --runtime docker|podman to force a specific runtime.'
|
|
97
|
+
]), options.json);
|
|
98
|
+
process.exitCode = 1;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const leaseId = generateContainerLeaseId();
|
|
102
|
+
const now = Date.now();
|
|
103
|
+
const ttlMs = options.ttl === undefined ? ttlForContainerRole(options.role) : Number.parseInt(options.ttl, 10);
|
|
104
|
+
if (!Number.isInteger(ttlMs) || ttlMs <= 0) {
|
|
105
|
+
printResult(io, fail('container.spawn', 'INVALID_TTL', '--ttl must be a positive integer (ms)', { ttl: options.ttl }, ['Re-run with --ttl 1800000 (30 min) or omit to use role default.']), options.json);
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const image = options.image ?? DEFAULT_DOCKER_IMAGE;
|
|
110
|
+
const mount = options.mount ?? projectRoot;
|
|
111
|
+
// `docker run --rm -d` so the container is detached and
|
|
112
|
+
// auto-removed when stopped; --cidfile writes the
|
|
113
|
+
// container id to a file we can read back. The
|
|
114
|
+
// `--label peaks.leaseId=<id>` lets `peaks container
|
|
115
|
+
// list` / `peaks container gc` find orphans by label
|
|
116
|
+
// when the lease file is missing.
|
|
117
|
+
const cidFile = `${joinPathSession(projectRoot, sessionId).replace(/\\/g, '/')}/.${runtime.runtime}-cid-${leaseId}`;
|
|
118
|
+
try {
|
|
119
|
+
execSync(`${runtime.runtime} run --rm -d --cidfile "${cidFile}" --label "peaks.leaseId=${leaseId}" --label "peaks.rid=${options.rid}" -v "${mount}:/work" -w /work ${image} sleep infinity`, { cwd: projectRoot, stdio: 'pipe', encoding: 'utf8' });
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
printResult(io, fail('container.spawn', 'DOCKER_RUN_FAILED', getErrorMessage(err), { rid: options.rid, image, runtime: runtime.runtime, sessionId }, [
|
|
123
|
+
'Verify the image name is reachable on the configured registry.',
|
|
124
|
+
'Verify the host path is mounted correctly (Windows: the path must be visible to WSL2).',
|
|
125
|
+
`Run \`${runtime.runtime} ps -a\` to inspect any leftover containers with the peaks.leaseId label.`
|
|
126
|
+
]), options.json);
|
|
127
|
+
process.exitCode = 1;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const containerId = readFileSync(cidFile, 'utf8').trim();
|
|
131
|
+
const lease = finalizeContainerLease({
|
|
132
|
+
leaseId,
|
|
133
|
+
rid: options.rid,
|
|
134
|
+
role: options.role,
|
|
135
|
+
path: mount,
|
|
136
|
+
image,
|
|
137
|
+
containerId,
|
|
138
|
+
createdAt: now,
|
|
139
|
+
expiresAt: now + ttlMs,
|
|
140
|
+
purpose: options.purpose
|
|
141
|
+
});
|
|
142
|
+
atomicWriteJson(containerLeaseFilePath(joinPathSession(projectRoot, sessionId), leaseId), lease);
|
|
143
|
+
printResult(io, ok('container.spawn', {
|
|
144
|
+
lease,
|
|
145
|
+
sessionId,
|
|
146
|
+
projectRoot,
|
|
147
|
+
runtime: runtime.runtime,
|
|
148
|
+
runtimeVersion: runtime.binary,
|
|
149
|
+
nextActions: [
|
|
150
|
+
`Container id: ${containerId}`,
|
|
151
|
+
`Image: ${image}`,
|
|
152
|
+
`Lease expires at: ${new Date(lease.expiresAt).toISOString()}`,
|
|
153
|
+
'Run `peaks container release --lease-id <id>` when done'
|
|
154
|
+
]
|
|
155
|
+
}, [], []), options.json);
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
printResult(io, fail('container.spawn', 'SPAWN_FAILED', getErrorMessage(err), { rid: options.rid, sessionId }, [
|
|
159
|
+
'See error message; if the lease was not written, retry after fixing the underlying issue.'
|
|
160
|
+
]), options.json);
|
|
161
|
+
process.exitCode = 1;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
addJsonOption(cmd.command('release')
|
|
165
|
+
.description('Transition a container lease to released and run `docker rm --force`. Idempotent on already-released leases.')
|
|
166
|
+
.requiredOption('--lease-id <id>', 'lease id returned by `peaks container spawn`')
|
|
167
|
+
.option('--session <sid>', 'override session id')
|
|
168
|
+
.option('--project <path>', 'project root (default: findProjectRoot(cwd))')).action((options) => {
|
|
169
|
+
const projectRoot = options.project ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
170
|
+
const sessionId = options.session ?? process.env.PEAKS_SESSION_ID ?? getCurrentSessionId(projectRoot) ?? 'unknown-sid';
|
|
171
|
+
try {
|
|
172
|
+
const file = containerLeaseFilePath(joinPathSession(projectRoot, sessionId), options.leaseId);
|
|
173
|
+
if (!existsSync(file)) {
|
|
174
|
+
printResult(io, fail('container.release', 'LEASE_NOT_FOUND', `no lease on disk at ${file}`, { leaseId: options.leaseId, file }, [
|
|
175
|
+
'Run `peaks container list` to inspect active leases.',
|
|
176
|
+
'For a never-spawned lease, this is a no-op — no further action needed.'
|
|
177
|
+
]), options.json);
|
|
178
|
+
process.exitCode = 1;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
let lease;
|
|
182
|
+
try {
|
|
183
|
+
lease = deserializeContainerLease(readFileSync(file, 'utf8'));
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
printResult(io, fail('container.release', 'LEASE_FILE_INVALID', getErrorMessage(err), { leaseId: options.leaseId, file }, [
|
|
187
|
+
'Delete the malformed lease file manually and re-issue spawn.',
|
|
188
|
+
'For security, release never fails open on a malformed lease.'
|
|
189
|
+
]), options.json);
|
|
190
|
+
process.exitCode = 1;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (lease.status === 'released') {
|
|
194
|
+
printResult(io, ok('container.release', { lease, sessionId, projectRoot, alreadyReleased: true }, [], [`Lease ${lease.leaseId} already released; nothing to do.`]), options.json);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
let dockerRmFailed = false;
|
|
198
|
+
try {
|
|
199
|
+
const releaseRuntime = detectContainerRuntime(undefined);
|
|
200
|
+
const runtimeCmd = releaseRuntime.ok ? releaseRuntime.runtime : 'docker';
|
|
201
|
+
execSync(`${runtimeCmd} rm --force "${lease.containerId}"`, { cwd: projectRoot, stdio: 'pipe', encoding: 'utf8' });
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
dockerRmFailed = true;
|
|
205
|
+
}
|
|
206
|
+
const released = markContainerReleased(lease);
|
|
207
|
+
atomicWriteJson(file, released);
|
|
208
|
+
printResult(io, ok('container.release', { lease: released, sessionId, projectRoot, dockerRmFailed }, dockerRmFailed ? ['docker rm failed (likely the container was already removed); lease marked released.'] : [], [
|
|
209
|
+
`Lease ${lease.leaseId} marked released.`,
|
|
210
|
+
dockerRmFailed ? 'Manual `docker ps -a` + `docker rm` may be needed.' : `Container ${lease.containerId} removed.`
|
|
211
|
+
]), options.json);
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
printResult(io, fail('container.release', 'RELEASE_FAILED', getErrorMessage(err), { leaseId: options.leaseId, sessionId }, [
|
|
215
|
+
'Verify the lease id and re-run.',
|
|
216
|
+
'If the lease was never spawned, no-op.'
|
|
217
|
+
]), options.json);
|
|
218
|
+
process.exitCode = 1;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
@@ -19,11 +19,12 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
|
19
19
|
import { join } from 'node:path';
|
|
20
20
|
import { searchMemory } from '../../services/memory/memory-search-service.js';
|
|
21
21
|
import { addJsonOption, getErrorMessage, printResult } from '../cli-helpers.js';
|
|
22
|
-
import { fail, ok } from '
|
|
22
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
23
23
|
import { emitObservabilityEvent } from '../../services/observability/observability-service.js';
|
|
24
24
|
import { findProjectRoot } from '../../services/config/config-safety.js';
|
|
25
25
|
import { getSessionIdCanonical } from '../../services/session/session-manager.js';
|
|
26
|
-
import { evaluateMainSessionThreshold, pickMainSessionTrigger, formatMainSessionTriggerLogLine
|
|
26
|
+
import { evaluateMainSessionThreshold, pickMainSessionTrigger, formatMainSessionTriggerLogLine } from '../../services/context/main-session-monitor.js';
|
|
27
|
+
import { detectIdeFromEnv } from '../../services/context/ide-detect.js';
|
|
27
28
|
const SKILLS_DIR = 'skills';
|
|
28
29
|
function readSkillsDir(projectRoot) {
|
|
29
30
|
const skillsRoot = join(projectRoot, SKILLS_DIR);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createArtifactInitPlan, getArtifactStatus, createGuidedArtifactSetup } from '../../../services/artifacts/artifact-service.js';
|
|
2
2
|
import { getArtifactWorkspaceStatus, planArtifactSync } from '../../../services/artifacts/workspace-service.js';
|
|
3
|
-
import { fail, ok } from '
|
|
3
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
4
4
|
import { addJsonOption, failUnsupportedNonDryRun, isArtifactProvider, isArtifactSetupStep, printResult } from '../../cli-helpers.js';
|
|
5
5
|
export function registerArtifactsCommand(program, io) {
|
|
6
6
|
const artifacts = program.command('artifacts').description('Manage intermediate artifact repositories');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addJsonOption, printResult } from '../../cli-helpers.js';
|
|
2
2
|
import { findProjectRoot } from '../../../services/config/config-safety.js';
|
|
3
3
|
import { loadBindingStatus, formatTable, formatJson } from '../../../services/session/binding-status-service.js';
|
|
4
|
-
import { fail, ok } from '
|
|
4
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
5
5
|
// v2.18.2 PATCH scope (follow-up issues #2). Read-only introspection
|
|
6
6
|
// CLI. Surface is intentionally minimal: one subcommand
|
|
7
7
|
// (`peaks binding status`), two output modes (table + json), one
|
|
@@ -1,8 +1,62 @@
|
|
|
1
|
-
import { runDoctor } from '../../../services/doctor/
|
|
1
|
+
import { runDoctor } from '../../../services/doctor/index.js';
|
|
2
2
|
import { readBinding, dropStale, rebuildBindingFromLegacy } from '../../../services/session/binding-store.js';
|
|
3
3
|
import { findProjectRoot } from '../../../services/config/config-safety.js';
|
|
4
|
+
import { loadSkillRegistry } from '../../../services/skills/skill-registry.js';
|
|
5
|
+
import { planStatusLineInstall } from '../../../services/skills/statusline-settings-service.js';
|
|
4
6
|
import { addJsonOption, printResult } from '../../cli-helpers.js';
|
|
5
|
-
import { fail, ok } from '
|
|
7
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
8
|
+
// slice-3b Option C: the doctor subpackage owns the check pipeline but
|
|
9
|
+
// does NOT import cross-domain utils from the main package (avoids
|
|
10
|
+
// circular deps). The CLI is the natural wiring point — every cross-
|
|
11
|
+
// domain util the doctor used to import directly is now injected as a
|
|
12
|
+
// probe on DoctorOptions at call-site:
|
|
13
|
+
//
|
|
14
|
+
// loadSkills ← loadSkillRegistry (main/services/skills/skill-registry.ts)
|
|
15
|
+
// skillPresenceProbe ← leave as-is; doctor-command does not own the presence probe
|
|
16
|
+
// statusLineInstalledProbe ← defaults to a `planStatusLineInstall` wrapper below
|
|
17
|
+
// projectRootResolver ← findProjectRoot (main/services/config/config-safety.ts)
|
|
18
|
+
// isValidSessionIdProbe ← the regex kept in main/services/workspace/sid-naming-guard.ts
|
|
19
|
+
//
|
|
20
|
+
// Inlining isValidSessionId via the doctor subpackage's default regex
|
|
21
|
+
// (which mirrors the upstream file byte-for-byte) keeps the L3 orphan
|
|
22
|
+
// check behaviour-identical without dragging sid-naming-guard into a
|
|
23
|
+
// workspace package. If sid-naming-guard is ever moved into
|
|
24
|
+
// peaks-loop-shared, swap this for a re-import.
|
|
25
|
+
function doctorIsValidSessionId(sid) {
|
|
26
|
+
return /^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])-session-[0-9a-z]{3,6}$/.test(sid);
|
|
27
|
+
}
|
|
28
|
+
function statusLineAlreadyInstalledForScope(scope, projectRoot) {
|
|
29
|
+
try {
|
|
30
|
+
if (scope === 'project') {
|
|
31
|
+
if (projectRoot === undefined)
|
|
32
|
+
return false;
|
|
33
|
+
return planStatusLineInstall('project', projectRoot).alreadyInstalled;
|
|
34
|
+
}
|
|
35
|
+
return planStatusLineInstall('global').alreadyInstalled;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function doctorStatusLineInstalledProbe() {
|
|
42
|
+
const projectRoot = findProjectRoot(process.cwd());
|
|
43
|
+
// Check both scopes: a user may have installed the statusLine globally, which
|
|
44
|
+
// the project-only check would miss and falsely report as "not installed".
|
|
45
|
+
try {
|
|
46
|
+
if (projectRoot !== null && statusLineAlreadyInstalledForScope('project', projectRoot)) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch { // TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
|
|
51
|
+
/* fall through to global */
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
return statusLineAlreadyInstalledForScope('global');
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
6
60
|
// Slice v2.16.0 AC-10: stale binding TTL is 5 minutes by default. The
|
|
7
61
|
// threshold is exposed as a CLI flag so users can tune it for
|
|
8
62
|
// long-running sessions.
|
|
@@ -129,7 +183,13 @@ export function registerDoctorCommand(program, io) {
|
|
|
129
183
|
}
|
|
130
184
|
return;
|
|
131
185
|
}
|
|
132
|
-
const report = await runDoctor(
|
|
186
|
+
const report = await runDoctor({
|
|
187
|
+
// slice-3b Option C: wire cross-domain probes at call-site.
|
|
188
|
+
loadSkills: loadSkillRegistry,
|
|
189
|
+
projectRootResolver: () => findProjectRoot(process.cwd()),
|
|
190
|
+
isValidSessionIdProbe: doctorIsValidSessionId,
|
|
191
|
+
statusLineInstalledProbe: doctorStatusLineInstalledProbe
|
|
192
|
+
});
|
|
133
193
|
let logsSection = null;
|
|
134
194
|
if (options.log === true) {
|
|
135
195
|
logsSection = await buildDoctorLogsSection();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { executeProjectMemoryBackup, executeProjectMemoryExtract, summarizeProjectMemoryBackupResult, summarizeProjectMemoryExtractResult } from '../../../services/memory/project-memory-service.js';
|
|
2
|
-
import { fail, ok } from '
|
|
2
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
3
3
|
import { addJsonOption, getErrorMessage, printResult } from '../../cli-helpers.js';
|
|
4
4
|
export function registerMemoryCommand(program, io) {
|
|
5
5
|
const memory = program.command('memory').description('Manage project-local Peaks memory');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { listProfiles } from '../../../services/profiles/profile-service.js';
|
|
2
|
-
import { ok } from '
|
|
2
|
+
import { ok } from 'peaks-loop-shared/result';
|
|
3
3
|
import { addJsonOption, printResult } from '../../cli-helpers.js';
|
|
4
4
|
export function registerProfileCommand(program, io) {
|
|
5
5
|
const profile = program.command('profile').description('Manage runtime profiles');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { planProxyTest } from '../../../services/proxy/proxy-service.js';
|
|
2
|
-
import { fail, ok } from '
|
|
2
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
3
3
|
import { addJsonOption, failUnsupportedNonDryRun, getErrorMessage, printResult } from '../../cli-helpers.js';
|
|
4
4
|
export function registerProxyCommand(program, io) {
|
|
5
5
|
const proxy = program.command('proxy').description('Manage proxy settings');
|
|
@@ -3,7 +3,7 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { getSessionMeta, rotateSessionBinding, setSessionTitle, listSessionMetas } from '../../../services/session/session-manager.js';
|
|
4
4
|
import { resolveCanonicalProjectRoot } from '../../../services/config/config-service.js';
|
|
5
5
|
import { findProjectRoot } from '../../../services/config/config-safety.js';
|
|
6
|
-
import { fail, ok } from '
|
|
6
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
7
7
|
import { addJsonOption, getErrorMessage, printResult } from '../../cli-helpers.js';
|
|
8
8
|
// Slice 2026-07-01-strategic-compact-cli fix: register the
|
|
9
9
|
// `peaks session checkpoint` and `peaks session resume` subcommands
|
|
@@ -13,13 +13,17 @@ import { addJsonOption, getErrorMessage, printResult } from '../../cli-helpers.j
|
|
|
13
13
|
// saw them — they were effectively hidden.
|
|
14
14
|
import { registerSessionCheckpointCommand } from '../session-checkpoint-command.js';
|
|
15
15
|
import { registerSessionResumeCommand } from '../session-resume-command.js';
|
|
16
|
-
import { registerSessionAutoCompactHookCommand } from '../session-auto-compact-hook-command.js';
|
|
17
16
|
// Slice 2 of the peaks-code → peaks-code rename plan: register the
|
|
18
17
|
// `peaks session migrate-skill-name` subcommand eagerly alongside
|
|
19
18
|
// checkpoint / resume / auto-compact-hook so it appears in
|
|
20
19
|
// `peaks session --help` for LLM `<TAB>`-discovery. See
|
|
21
20
|
// src/services/migrate-skill-name/.
|
|
22
21
|
import { registerSessionMigrateSkillNameCommand } from '../session-migrate-skill-name.js';
|
|
22
|
+
// rid-020a: register `peaks session 24h-mode` eagerly so the
|
|
23
|
+
// state-machine sub-actions (state / transition / attempts / reset)
|
|
24
|
+
// appear in `peaks session --help` for LLM `<TAB>`-discovery.
|
|
25
|
+
import { registerSession24hModeCommand } from '../session-24h-mode.js';
|
|
26
|
+
import { registerSpillDemoCommand } from '../spill-demo-command.js';
|
|
23
27
|
export function registerSessionCommand(program, io) {
|
|
24
28
|
const session = program.command('session').description('Manage Peaks session directories');
|
|
25
29
|
addJsonOption(session
|
|
@@ -193,17 +197,15 @@ export function registerSessionCommand(program, io) {
|
|
|
193
197
|
// `<TAB>`-discovery and the LLM never saw them.
|
|
194
198
|
registerSessionCheckpointCommand(session, io);
|
|
195
199
|
registerSessionResumeCommand(session, io);
|
|
196
|
-
// Slice 2026-07-02-auto-compact-zero-pause: the Bash command the
|
|
197
|
-
// PreToolUse hook in `.claude/settings.local.json` fires. Keeping
|
|
198
|
-
// it eager (same fix as checkpoint + resume) so `peaks session --help`
|
|
199
|
-
// lists it for LLM `<TAB>`-discovery.
|
|
200
|
-
registerSessionAutoCompactHookCommand(session);
|
|
201
200
|
// Slice 2 of the peaks-code → peaks-code rename plan:
|
|
202
201
|
// `peaks session migrate-skill-name --from <old> --to <new>
|
|
203
202
|
// [--apply] [--project <path>] [--json]`. Idempotent rewrite of
|
|
204
203
|
// .peaks/_runtime/** for the rename; skipped paths recorded in
|
|
205
204
|
// the response envelope. See src/services/migrate-skill-name/.
|
|
206
205
|
registerSessionMigrateSkillNameCommand(session);
|
|
206
|
+
// rid-020a: peaks session 24h-mode — state machine backbone.
|
|
207
|
+
registerSession24hModeCommand(session, io);
|
|
208
|
+
registerSpillDemoCommand(session, io);
|
|
207
209
|
addJsonOption(session
|
|
208
210
|
.command('rotate')
|
|
209
211
|
.description('Drop the project-level session binding so the next peaks call auto-generates a fresh session id. The on-disk session directory is left intact — only .peaks/.session.json is removed.')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runDoctor } from '../../../services/doctor/
|
|
1
|
+
import { runDoctor } from '../../../services/doctor/index.js';
|
|
2
2
|
import { listSkills } from '../../../services/skills/skill-registry.js';
|
|
3
3
|
import { runSkillSync, SYNC_PLATFORMS } from '../../../services/skills/sync-service.js';
|
|
4
4
|
import { inspectSkillRunbook } from '../../../services/skills/skill-runbook-service.js';
|
|
@@ -7,7 +7,7 @@ import { detectPresenceMarker } from '../../../services/hooks/presence-marker-de
|
|
|
7
7
|
import { findProjectRoot } from '../../../services/config/config-safety.js';
|
|
8
8
|
import { generateProjectContext } from '../../../services/memory/project-context-service.js';
|
|
9
9
|
import { getSessionId, setSessionMeta } from '../../../services/session/session-manager.js';
|
|
10
|
-
import { fail, ok } from '
|
|
10
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
11
11
|
import { addJsonOption, getErrorMessage, printResult } from '../../cli-helpers.js';
|
|
12
12
|
// Slice S0 (4.0.0-beta.5 peaks-solo dispatcher release):
|
|
13
13
|
// `peaks skill search` is the CLI primitive that feeds the
|
|
@@ -20,8 +20,11 @@ import { addJsonOption, getErrorMessage, printResult } from '../../cli-helpers.j
|
|
|
20
20
|
import { registerSkillSearchCommand } from '../skill-search-commands.js';
|
|
21
21
|
export function registerSkillCommand(program, io) {
|
|
22
22
|
const skill = program.command('skill').description('Manage Peaks skills');
|
|
23
|
-
addJsonOption(skill.command('list').description('List skills derived from skills/*/SKILL.md')).action(async (options) => {
|
|
24
|
-
|
|
23
|
+
addJsonOption(skill.command('list').description('List skills derived from skills/*/SKILL.md').option('--include-internal', 'include skills with visibility: internal (default: hide them)')).action(async (options) => {
|
|
24
|
+
let skills = await listSkills();
|
|
25
|
+
if (options.includeInternal !== true) {
|
|
26
|
+
skills = skills.filter((s) => s.visibility !== 'internal');
|
|
27
|
+
}
|
|
25
28
|
if (options.json === true) {
|
|
26
29
|
printResult(io, ok('skill.list', { skills }), true);
|
|
27
30
|
}
|
|
@@ -2,7 +2,7 @@ import { summarizeProjectStandardsInitResult, summarizeProjectStandardsUpdateRes
|
|
|
2
2
|
import { executeProjectStandardsInitIdeAware, executeProjectStandardsUpdateIdeAware } from '../../../services/standards/ide-aware-standards-service.js';
|
|
3
3
|
import { migrateStandards } from '../../../services/standards/migrate-service.js';
|
|
4
4
|
import { migrateClaudeRules } from '../../../services/standards/migrate-claude-rules-service.js';
|
|
5
|
-
import { fail, ok } from '
|
|
5
|
+
import { fail, ok } from 'peaks-loop-shared/result';
|
|
6
6
|
import { addJsonOption, getErrorMessage, printResult } from '../../cli-helpers.js';
|
|
7
7
|
export function registerStandardsCommand(program, io) {
|
|
8
8
|
const standards = program.command('standards').description('Manage project-local coding standards');
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `peaks cron` — slice 2026-07-29-worktree-l2-extended Part 14.
|
|
3
|
+
*
|
|
4
|
+
* Persistent scheduled-task system. Stores a JSON schedule at
|
|
5
|
+
* `.peaks/cron/schedule.json` and lets the LLM-side runner
|
|
6
|
+
* trigger tasks synchronously (`peaks cron run <id>`) or
|
|
7
|
+
* register a built-in periodic lease gc that the runbook
|
|
8
|
+
* (`skills/peaks-code/`) checks on every session start.
|
|
9
|
+
*
|
|
10
|
+
* Built-in tasks (the only ones auto-registered today):
|
|
11
|
+
* - `lease-gc-daily` — runs `peaks worktree gc --all-sessions
|
|
12
|
+
* --project .` once every 24h. Cleans up orphan leases that
|
|
13
|
+
* leaked past their auto-release hook (Part 3.A) — the
|
|
14
|
+
* safety net for the safety net.
|
|
15
|
+
*
|
|
16
|
+
* Why a JSON file (not a real cron daemon): peaks-loop is a CLI
|
|
17
|
+
* tool, not a service. The schedule is best-effort: the runbook
|
|
18
|
+
* checks it on session start and surfaces overdue tasks. A
|
|
19
|
+
* proper system cron / systemd timer is the production
|
|
20
|
+
* deployment story; this CLI is the portable fallback.
|
|
21
|
+
*
|
|
22
|
+
* File layout:
|
|
23
|
+
* .peaks/cron/schedule.json — registered tasks with their
|
|
24
|
+
* interval + lastRunAt
|
|
25
|
+
* .peaks/cron/history.jsonl — append-only run history
|
|
26
|
+
*/
|
|
27
|
+
import type { Command } from 'commander';
|
|
28
|
+
import { type ProgramIO } from '../cli-helpers.js';
|
|
29
|
+
declare const SCHEDULE_VERSION: 1;
|
|
30
|
+
export type ScheduleEntry = {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly command: string;
|
|
34
|
+
readonly args: ReadonlyArray<string>;
|
|
35
|
+
readonly intervalMs: number;
|
|
36
|
+
readonly lastRunAt: number | null;
|
|
37
|
+
readonly enabled: boolean;
|
|
38
|
+
readonly createdAt: number;
|
|
39
|
+
};
|
|
40
|
+
export type ScheduleFile = {
|
|
41
|
+
readonly version: typeof SCHEDULE_VERSION;
|
|
42
|
+
readonly entries: ReadonlyArray<ScheduleEntry>;
|
|
43
|
+
};
|
|
44
|
+
export type RunRecord = {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly taskId: string;
|
|
47
|
+
readonly startedAt: number;
|
|
48
|
+
readonly finishedAt: number;
|
|
49
|
+
readonly exitCode: number;
|
|
50
|
+
readonly stderr: string;
|
|
51
|
+
};
|
|
52
|
+
export declare function readSchedule(projectRoot: string): ScheduleFile;
|
|
53
|
+
export declare function appendHistory(projectRoot: string, record: RunRecord): void;
|
|
54
|
+
export declare function runTask(projectRoot: string, task: ScheduleEntry): RunRecord;
|
|
55
|
+
export declare function listDueTasks(projectRoot: string, now?: number): ReadonlyArray<ScheduleEntry>;
|
|
56
|
+
export declare function registerCronCommand(program: Command, io: ProgramIO): void;
|
|
57
|
+
export {};
|