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,123 @@
|
|
|
1
|
+
# Worktree governance — 3-layer design
|
|
2
|
+
|
|
3
|
+
> **Source of truth.** This document is the canonical reference for peaks-loop's worktree posture. The SKILL.md `## Worktree governance` chapter carries the heading + 1-line pointers; the full design lives here. Editing peaks-loop source propagates to every consumer project on `npm install`.
|
|
4
|
+
|
|
5
|
+
## The problem this solves
|
|
6
|
+
|
|
7
|
+
Sub-agents using raw `git worktree add` to escape governance:
|
|
8
|
+
|
|
9
|
+
1. The superpowers chain ends in `superpowers:using-git-worktrees` SKILL.md line 96 (`git worktree add "$path" -b "$BRANCH_NAME"`). An LLM that follows `brainstorming` → `writing-plans` → `subagent-driven-development` → `using-git-worktrees` will land on raw `git worktree add` without ever touching peaks-loop's hooks.
|
|
10
|
+
2. Worktrees created outside peaks-loop's governance are invisible to `peaks worktree auth grant|revoke|status` — the L2 hook gate cannot deny or grant them.
|
|
11
|
+
3. Worktree-only artifacts (`.peaks/_runtime/<sessionId>/<role>/requests/<rid>.md` written from inside a worktree) may be lost when the worktree is pruned mid-run. Lesson 1 of [[2026-07-27-rid-016-monorepo-delete-5-subpackages]] documents the failure mode.
|
|
12
|
+
|
|
13
|
+
## Three-layer design (defence in depth)
|
|
14
|
+
|
|
15
|
+
| Layer | Mechanism | Strength | Failure mode |
|
|
16
|
+
|---|---|---|---|
|
|
17
|
+
| L1 | Sub-agent system prompt `MUST NOT` on the superpowers chain | Weak — LLM may forget | Prose-only; no enforcement |
|
|
18
|
+
| L2 | PreToolUse hook → `peaks gate enforce` → `evaluateWorktreeAuth` | Medium — sees every tool call but cannot intercept Skill selection | Hook bypassed if user disables `peaks hooks install` |
|
|
19
|
+
| L3 | IDE `permissions.deny: ["UseSkill(superpowers:using-git-worktrees)"]` | Strongest — IDE refuses Skill BEFORE LLM sees it | Requires `peaks hooks install` to have run; bypassed by `--dangerously-skip-permissions` |
|
|
20
|
+
|
|
21
|
+
The 3 layers stack. L3 is the strongest because it operates BELOW the LLM's tool-call decision: the Skill never appears in the LLM's tool list, so the LLM cannot choose to invoke it.
|
|
22
|
+
|
|
23
|
+
## L1 — Sub-agent system prompt
|
|
24
|
+
|
|
25
|
+
The explicit `MUST NOT` block lives in:
|
|
26
|
+
- `peaks-rd/references/rd-sub-agent-dispatch.md`
|
|
27
|
+
- `peaks-qa/...`
|
|
28
|
+
- `peaks-ui/...`
|
|
29
|
+
- `peaks sub-agent dispatch` CLI prompt template
|
|
30
|
+
|
|
31
|
+
Each prompt template carries the block:
|
|
32
|
+
> MUST NOT follow the superpowers chain (`brainstorming` → `writing-plans` → `subagent-driven-development` → `using-git-worktrees`) for worktree decisions. The chain is reference material, not a workflow. For worktree operations, use `peaks worktree spawn --rid <id> --ttl <duration> --purpose <text>` (or, until that ships, fall back to L2 hook gate + manual `peaks worktree auth grant`).
|
|
33
|
+
|
|
34
|
+
L1 is the weakest layer because the LLM is the decision-maker and may forget the block under load. L3 exists to catch L1 failures.
|
|
35
|
+
|
|
36
|
+
## L2 — Hook + lifecycle gate
|
|
37
|
+
|
|
38
|
+
`peaks hooks install` writes a PreToolUse hook that calls `peaks gate enforce` BEFORE the IDE permission system. For worktree operations:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# User authorizes a worktree operation
|
|
42
|
+
peaks worktree auth grant \
|
|
43
|
+
--rid rid-2026-07-29-worktree-spawn \
|
|
44
|
+
--reason "RD sub-agent for worktree spawn slice" \
|
|
45
|
+
--ttl 5m
|
|
46
|
+
# Output: grant token, single-use by default
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The token authorizes exactly one `git worktree add` matching the granted scope (path / branch / rid). 5 deny codes:
|
|
50
|
+
- `REQUIRED` — no grant on file, request denied
|
|
51
|
+
- `EXPIRED` — TTL elapsed, re-authorize
|
|
52
|
+
- `REQUEST_MISMATCH` — git args don't match the granted scope
|
|
53
|
+
- `CONSUMED` — token already used (single-use)
|
|
54
|
+
- `FILE_INVALID` — grant file unreadable / corrupted
|
|
55
|
+
|
|
56
|
+
Implementation: `src/services/hooks/worktree-authorization-gate.ts`. Sediment: `.peaks/memory/2026-07-27-worktree-user-auth-hard-gate.md`.
|
|
57
|
+
|
|
58
|
+
## L3 — IDE `permissions.deny`
|
|
59
|
+
|
|
60
|
+
`peaks hooks install` ALSO writes a `permissions.deny` block into the IDE settings.json:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"permissions": {
|
|
65
|
+
"deny": [
|
|
66
|
+
"UseSkill(superpowers:using-git-worktrees)"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The deny entry is wrapped in the IDE's `UseSkill(...)` envelope (Claude Code's permission-system syntax). Claude Code refuses to invoke any Skill listed there BEFORE the LLM sees the Skill's name in the available-tool list.
|
|
73
|
+
|
|
74
|
+
Single source of truth: `SUPERPOWERS_DENIED_SKILLS` in `src/services/skills/hooks-settings-service.ts`. To deny a new skill, append its id there and re-run `peaks hooks install`.
|
|
75
|
+
|
|
76
|
+
Sediment: `.peaks/memory/2026-07-29-worktree-layer3-deny.md`.
|
|
77
|
+
|
|
78
|
+
## Sub-agent worktree contract (mandatory)
|
|
79
|
+
|
|
80
|
+
Every sub-agent dispatched by peaks-rd / peaks-qa / peaks-ui / peaks-sc / peaks-txt MUST:
|
|
81
|
+
|
|
82
|
+
1. **Use `peaks worktree spawn --rid <rid> --ttl <duration> --purpose <text>`** for any worktree operation. Raw `git worktree add` is forbidden.
|
|
83
|
+
2. **Treat the superpowers chain as reference material only.** It MAY inform PRD / RD planning but MUST NOT drive tool selection.
|
|
84
|
+
3. **Write artifacts under `.peaks/_runtime/<sessionId>/<role>/requests/` in the MAIN checkout.** Dispatch with `--project .` (the main workdir), NOT `--project .claude/worktrees/...`. Worktrees are ephemeral; main is durable.
|
|
85
|
+
|
|
86
|
+
## Operator runbook
|
|
87
|
+
|
|
88
|
+
- **Manual authorization**: `peaks worktree auth grant|revoke|status` (L2 surface).
|
|
89
|
+
- **Inspect L3 state**: `peaks hooks status` reports `permissionsDenyEntries` (desired) + `permissionsDenyOnDisk` (reality).
|
|
90
|
+
- **Refresh L3 deny block**: `peaks hooks uninstall && peaks hooks install` re-writes the block from `SUPERPOWERS_DENIED_SKILLS`.
|
|
91
|
+
- **Diagnose L3 failures**: the on-disk `permissions.deny` is the source of truth. If a Skill bypasses the deny, the IDE permission system is broken (not peaks-loop's problem).
|
|
92
|
+
|
|
93
|
+
## Future rid path
|
|
94
|
+
|
|
95
|
+
| rid | Layer | Goal | Status |
|
|
96
|
+
|---|---|---|---|
|
|
97
|
+
| rid-L1 | L1 | Hard-coded prompt hardening across all dispatch templates | Pending |
|
|
98
|
+
| rid-L2-extended | L2 | `peaks worktree spawn` with lease lifecycle, removing manual `peaks worktree auth grant` loop | Pending |
|
|
99
|
+
| rid-L3-extended | L3 | Append new deny skills to `SUPERPOWERS_DENIED_SKILLS` as needed | Trigger-only |
|
|
100
|
+
|
|
101
|
+
## Related memories
|
|
102
|
+
|
|
103
|
+
- [[2026-07-27-worktree-user-auth-hard-gate]] — L2 baseline, shipped earlier.
|
|
104
|
+
- [[2026-07-29-worktree-layer3-deny]] — L3 Minimal Viable rationale.
|
|
105
|
+
- [[2026-07-29-worktree-l2-extended-part1]] — lease foundation + spawn/release CLI.
|
|
106
|
+
- [[2026-07-29-worktree-l2-extended-part2]] — renew/list/gc/status + hook integration + dispatch bridge + lifecycle e2e.
|
|
107
|
+
- [[2026-07-29-worktree-l2-extended-part3]] — auto-release on terminal finalization.
|
|
108
|
+
- [[2026-07-29-worktree-l2-extended-part4]] — observability emitter + v3 schema.
|
|
109
|
+
- [[2026-07-29-worktree-l2-extended-part5]] — leak rate + cross-session aggregation.
|
|
110
|
+
- [[2026-07-29-worktree-l2-extended-part6-9]] — stats summary + v3.1 schema + container contract bridge.
|
|
111
|
+
|
|
112
|
+
## Lease observability (Parts 4-6)
|
|
113
|
+
|
|
114
|
+
The L2 ecosystem emits a `lease` category into the existing observability stream (`.peaks/_runtime/<sid>/metrics/slices.jsonl`). Seven `kind` values: `spawn` / `renew` / `release` / `gc` / `autoRelease` / `autoRelease-failed` / `autoRelease-skipped`. Two CLIs read the stream:
|
|
115
|
+
|
|
116
|
+
- `peaks lease-metrics [--session <sid>] [--project <root>] [--rate] [--all-sessions] [--json]` — per-kind counts + 5-event tail. With `--rate`, adds `estimatedActive` / `estimatedLeaked` / `avgLifetimeMs` / `p99LifetimeMs`. With `--all-sessions`, aggregates across every session under `.peaks/_runtime/`. The two flags are independent; `--rate --all-sessions` is the project-wide leak view.
|
|
117
|
+
- `peaks lease-stats --project <root> --json` — project-wide summary: counts + rate + per-rid (top 20) + per-role + per-isolation breakdown. Always aggregates cross-session. Use this when you want a "status board" rather than the raw event stream.
|
|
118
|
+
|
|
119
|
+
The `estimated` prefix is intentional: the canonical "alive" set is the on-disk lease files in `.peaks/_runtime/<sid>/worktree-leases/` (queryable via `peaks worktree list`). The aggregation is a metrics-stream view — useful for time-series dashboards, but the FS state is the source of truth for "is this lease still alive right now?".
|
|
120
|
+
|
|
121
|
+
For dashboards: pipe the JSON envelope into `jq`, paste into a `peaks lease-stats --json` reader, or feed into the `peaks audit metrics` flow. The schema is the same `ObservabilityEvent` v1 used by slice / dispatch / cycle events.
|
|
122
|
+
- [[2026-07-27-rid-016-monorepo-delete-5-subpackages]] — Lesson 1: worktree-only artifact fragility.
|
|
123
|
+
- [[2026-07-24-peaks-code-bridge-002-rootcause]] — peaks-code ↔ superpowers bridge baseline.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"prompt": "/peaks-code https://example.feishu.cn/wiki/PRODUCT_DOC_ID 是产品文档。请根据这份产品文档,对 /Users/yuanyuan/Desktop/work/platform-rag-web 这个前端项目进行迭代开发。目前只是前端项目,没有后端 swagger.json,可以先 mock,等后面有真实 swagger.json 数据时再联调替换。允许修改目标仓代码,这是实战测试。",
|
|
5
|
+
"expected": "peaks-code 选择 full-auto/实战路径,使用本仓 skills 目录下的 peaks-prd/rd/ui/qa/sc/txt,Feishu 走 headed gstack/browse/dist/browse 可见浏览器登录 handoff,先校验 https 和批准的 Feishu/Lark tenant 域名,生成 .peaks/_runtime/<session-id>/prd|rd|qa|txt 脱敏中间产物;RD 完成实现、单测、CR、安全检查、dry-run 后必须进入 QA;前端 RD 自测和 QA 验证都必须使用 headed gstack/browse/dist/browse 有头浏览器端到端验证并确认可见浏览器;QA 完成 API/mock 验证、浏览器 E2E、报告、安全和性能检查。若 QA 报告存在失败、阻塞、缺失或未验证项,必须回到 RD 修复并再次 QA,直到 QA 全部通过或生成 blocked handoff;full-auto 可用 Claude Code goal 维持 RD fixes until QA passes all acceptance items 的控制目标;不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、raw browser/network state 或 PII/SSO/MFA 截图/日志。"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": 2,
|
|
9
|
+
"prompt": "/peaks-code 对 /Users/yuanyuan/Desktop/work/platform-rag-web 做前端需求迭代,需求来自需要登录的 Feishu 产品文档;如果浏览器登录没打开或文档仍不可读,需要阻塞并告诉我具体要做什么,不要用 unauthenticated fetch,也不要绕过 SSO/MFA。",
|
|
10
|
+
"expected": "流程必须验证可见浏览器 handoff,不能降级到 fetch;登录或访问失败时生成 blocked PRD/TXT 胶囊,只记录脱敏状态和下一步,不保存登录 URL、cookie、headers、tokens、storage state、浏览器 traces,或包含 PII/SSO/MFA 内容的截图和日志。"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: peaks-doctor
|
|
3
3
|
description: Orchestrate peaks-loop's L3 doctor (peaks audit + peaks doctor + peaks openspec from-doctor) for project health. Use when the user asks for a project health check, doctor report, audit, or wants to convert doctor findings into OpenSpec change records. Coordinates the L2 audit framework + the L3.2 doctor + the L3.3 from-doctor proposal generator. Triggers on `/peaks-doctor`, "peaks doctor", "项目健康", "doctor report", "health check", "check the project", "audit my repo".
|
|
4
|
-
|
|
4
|
+
visibility: internal
|
|
5
5
|
---
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: peaks-ide
|
|
3
3
|
description: Orchestrate peaks-loop's IDE-aware behavior (hooks + statusline + handle) for a user's specific IDE. Detects the current state (which IDE the user is on, what peaks has already installed), plans the install / switch / status / uninstall actions, and invokes the existing peaks CLI primitives. Triggers on `/peaks-ide`, "set up peaks for my IDE", "switch peaks to Trae", "what did peaks install", "uninstall peaks hooks". Sits between the user and `peaks hooks install` / `peaks statusline install` / `peaks hook handle` — those are the CLI primitives; this skill is the user-facing surface.
|
|
4
|
-
|
|
4
|
+
visibility: internal
|
|
5
5
|
---
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -163,6 +163,27 @@ multiSelect: false
|
|
|
163
163
|
| 用户主动说"沉淀这个" | **立即问** | `user_explicit` |
|
|
164
164
|
| LLM 识别 ≥ 2 个 reuse signals | **附带 4-section brief 问** | `llm_suggested` |
|
|
165
165
|
|
|
166
|
+
### 5.3 4-level precedence for keyword triage (rid-020b)
|
|
167
|
+
|
|
168
|
+
When the user's NL description contains a 24h-mode keyword (`24h` / `通宵` / `夜跑` / `通宵跑` / `夜机` / `不计成本` / `不停机`) AND a code-domain keyword, apply the 4-level precedence table to pick the leaf:
|
|
169
|
+
|
|
170
|
+
| # | Precedence | If matched | Routes to |
|
|
171
|
+
|---|---|---|---|
|
|
172
|
+
| 1 | peaks-* skill name (highest) | user names `/peaks-code` or `/peaks-content` or `/peaks-doctor` explicitly | named leaf, regardless of 24h keyword |
|
|
173
|
+
| 2 | keyword match | `24h` / `通宵` / `夜跑` etc. present | add `code-domain-evidence` column to triage table; default to `/peaks-code` for code work |
|
|
174
|
+
| 3 | code-domain evidence | change-id / src path / `peaks-code` mention in NL | `/peaks-code` (with `--24h` flag passed via `peaks code run --24h`) |
|
|
175
|
+
| 4 | default (lowest) | none of the above | peaks-solo self-planning fallback (§4) |
|
|
176
|
+
|
|
177
|
+
### 5.4 24h keyword sub-section (special cases)
|
|
178
|
+
|
|
179
|
+
Three explicit edge cases — peaks-solo still routes to the named leaf, but the LLM MUST add the 24h flag at the right invocation:
|
|
180
|
+
|
|
181
|
+
| 24h keyword NL snippet | Default leaf | 24h flag injection |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| `24h 跑 dispatcher` / `24h triage` | /peaks-solo (self) | — (peaks-solo has no 24h flag; record sediment) |
|
|
184
|
+
| `24h 内容` / `24h 公众号` / `24h 博客` | /peaks-content | peaks-solo surfaces `AskUserQuestion` asking the user to add the 24h flag at the leaf dispatch |
|
|
185
|
+
| `24h 体检` / `24h doctor` / `24h health` | /peaks-doctor | peaks-solo surfaces `AskUserQuestion` asking the user to add the 24h flag at the leaf dispatch |
|
|
186
|
+
|
|
166
187
|
---
|
|
167
188
|
|
|
168
189
|
## 6. Out of scope (HC-11 锁死)
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
| 跑测试 / test / vitest / unit test | → | /peaks-test |
|
|
17
17
|
| 恢复 / resume / 继续 / 接上次 | → | /peaks-resume |
|
|
18
18
|
| 不知道 / 随便 / 帮我 / 你帮我决定 / 我想做点东西 | → | peaks-solo triage (this skill) |
|
|
19
|
+
| 24h / 通宵 / 通宵跑 / 夜跑 / 夜机 / 不计成本 / 不停机 (code-domain-evidence) | → | /peaks-code (with `--24h` via `peaks code run --24h`; see SKILL.md §5.3) |
|
|
19
20
|
| 切片 / slice / 拆解任务 / 大任务拆小 | → | /peaks-slice-decompose |
|
|
20
21
|
| 想法 / brain-storm / 创意 / 探索思路 | → | /peaks-ide |
|
|
21
22
|
| 最终审查 / final review / 验收 / 4-dim evidence | → | /peaks-final-review |
|
|
@@ -29,3 +30,8 @@
|
|
|
29
30
|
3. **(e) "都不对" → 自规划兜底。** 走 SKILL.md §4。
|
|
30
31
|
4. **空表条目:** "研究 / 信息查询 / GitHub trending / top 10" 等一次性信息查询,**当前 skill 池没有专属 leaf**,peaks-solo 直接走自规划(deep-search / WebSearch)。
|
|
31
32
|
5. **本表是 opportunistic 表,**不是 exhaustive 表。S2/S3 后续可在 dogfood 中发现新关键词补行。
|
|
33
|
+
6. **24h keyword row (rid-020b):** when the NL contains a 24h keyword AND code-domain evidence (e.g. `peaks-code` mentioned, a `src/` change-id, or `peaks code run`), add a `code-domain-evidence` column to the AskUserQuestion and pre-select `/peaks-code` with the `--24h` flag surfaced as a follow-up. The 4-level precedence in SKILL.md §5.3 wins on ties.
|
|
34
|
+
7. **Special case rows (rid-020b):**
|
|
35
|
+
- `24h dispatcher` / `24h triage` → peaks-solo (self); record sediment after.
|
|
36
|
+
- `24h 内容` / `24h 公众号` / `24h 博客` → /peaks-content; surface AskUserQuestion asking the user to add the 24h flag.
|
|
37
|
+
- `24h 体检` / `24h doctor` → /peaks-doctor; surface AskUserQuestion asking the user to add the 24h flag.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"prompt": "我想要一个发布流程:先写好 CHANGELOG,再跑通测试,最后才能发布。帮我做成一个 SOP,我不想自己写 JSON。",
|
|
5
|
+
"expected": "peaks-sop 访谈出 phases(如 draft/review/ship)和门禁,调用 peaks sop init --apply 生成骨架,把门禁写进 sop.json(changelog 用 file-exists、tests 用 command 并提示需要 --allow-commands),跑 peaks sop lint 到 ok:true,用 peaks sop check 验证每个门禁,再 peaks sop register 注册。全程不让用户手写 JSON。"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": 2,
|
|
9
|
+
"prompt": "我的 SOP lint 报错说门禁绑定了未知阶段,帮我修。",
|
|
10
|
+
"expected": "peaks-sop 读 lint findings 定位违例门禁,在 sop.json 里把门禁的 phase 改成已声明的阶段(或补声明该阶段),重新 peaks sop lint 直到 ok:true,不直接 register 未通过 lint 的 SOP。"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": 3,
|
|
14
|
+
"prompt": "这个发布 SOP 真的能在测试没过时把我拦住吗?我想先确认再用。",
|
|
15
|
+
"expected": "peaks-sop 用 peaks sop check 在好/坏两种状态下验证门禁返回 pass/fail,再用 peaks sop advance --to ship --dry-run 干跑确认门禁未通过时阻断推进且不落盘,向用户展示阻断行为后再交付。"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* peaks agent * CLI surface — Slice: ECC 64 agents soft-optional
|
|
3
|
-
* integration (per spec §7.2 line 818).
|
|
4
|
-
*
|
|
5
|
-
* Registers the new `peaks agent` top-level command with two
|
|
6
|
-
* subcommands:
|
|
7
|
-
* - `peaks agent run <name> [--target <path>]` — shell out to
|
|
8
|
-
* `npx ecc agent run <name> --target <path> --json` when ECC
|
|
9
|
-
* is installed; soft-fail with the 4-option install prompt
|
|
10
|
-
* when it isn't.
|
|
11
|
-
* - `peaks agent list` — emit the 12
|
|
12
|
-
* canonical ECC agents (the wrapper hardcodes the
|
|
13
|
-
* most-used subset; the full 64-agent list is
|
|
14
|
-
* discoverable at runtime via `npx ecc agent list`).
|
|
15
|
-
*
|
|
16
|
-
* The wrapper service is `src/services/agent/ecc-agent-service.ts`.
|
|
17
|
-
*/
|
|
18
|
-
import { Command } from 'commander';
|
|
19
|
-
import { type ProgramIO } from '../cli-helpers.js';
|
|
20
|
-
export declare function registerAgentCommands(program: Command, io: ProgramIO): void;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { runEccAgent, validateEccAgent, CANONICAL_ECC_AGENTS, } from '../../services/agent/ecc-agent-service.js';
|
|
2
|
-
import { addJsonOption, getErrorMessage, printResult } from '../cli-helpers.js';
|
|
3
|
-
import { fail, ok } from '../../shared/result.js';
|
|
4
|
-
export function registerAgentCommands(program, io) {
|
|
5
|
-
const agent = program
|
|
6
|
-
.command('agent')
|
|
7
|
-
.description('Run an ECC agent (soft-optional per spec §7.2). 64 agents are npm-installable via npx ecc; peaks-loop shells out when ECC is installed and soft-fails with a 4-option install prompt when it is not. Native peaks-loop diagnostics still run via `peaks doctor scan`.');
|
|
8
|
-
addJsonOption(agent
|
|
9
|
-
.command('run <name>')
|
|
10
|
-
.description(`Run an ECC agent by name (e.g. 'security-reviewer', 'code-reviewer'). The canonical subprocess is \`npx ecc agent run <name> --target <path> --json\`.`)
|
|
11
|
-
.option('--target <path>', 'project root or file to analyze (default: cwd)')
|
|
12
|
-
.option('--enable', 'enable the ECC subprocess for this call (overrides default-off; soft-fails with the 4-option install prompt when ECC is missing)')).action(async (name, options) => {
|
|
13
|
-
const validationError = validateEccAgent(name);
|
|
14
|
-
if (validationError !== null) {
|
|
15
|
-
printResult(io, fail('agent.run', 'INVALID_AGENT_NAME', validationError, { agent: name }, [
|
|
16
|
-
'Use `peaks agent list` to see the canonical 12 agents',
|
|
17
|
-
]), options.json);
|
|
18
|
-
process.exitCode = 1;
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const projectRoot = options.target ?? process.cwd();
|
|
22
|
-
try {
|
|
23
|
-
const result = runEccAgent({
|
|
24
|
-
agent: name,
|
|
25
|
-
projectRoot,
|
|
26
|
-
enableAgent: options.enable === true,
|
|
27
|
-
});
|
|
28
|
-
const data = { ...result, projectRoot };
|
|
29
|
-
const nextActions = [];
|
|
30
|
-
if (result.reason === 'flag-enabled-but-ecc-missing') {
|
|
31
|
-
nextActions.push('ECC not installed. Pick one of the four options below:', ' a) Install: run `npx ecc --help` to install, then re-run `peaks agent run`.', ' b) Skip this run: use the peaks-loop native diagnostic via `peaks doctor scan`.', ' c) Skip forever: run `peaks preferences set agentShieldEnabled false`.', ' d) Learn more: see docs/superpowers/specs/2026-06-11-peaks-loop-l1-l2-l3-redesign.md §7.2.');
|
|
32
|
-
}
|
|
33
|
-
const envelope = ok('agent.run', data, [...result.warnings], nextActions);
|
|
34
|
-
printResult(io, envelope, options.json);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
const message = getErrorMessage(error);
|
|
38
|
-
printResult(io, fail('agent.run', 'AGENT_RUN_FAILED', message, { agent: name, projectRoot, spawned: false }, [message]), options.json);
|
|
39
|
-
process.exitCode = 1;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
addJsonOption(agent
|
|
43
|
-
.command('list')
|
|
44
|
-
.description(`List the 12 canonical ECC agents (peaks-loop ships a static subset; the full 64 are ECC-discovered).`)).action((options) => {
|
|
45
|
-
const envelope = ok('agent.list', { agents: CANONICAL_ECC_AGENTS.map((a) => ({ name: a.name, description: a.description })) }, [], ['Run any agent with: `peaks agent run <name> --target <path>`']);
|
|
46
|
-
printResult(io, envelope, options.json);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* peaks classify CLI (Slice L1a + L1b).
|
|
3
|
-
*
|
|
4
|
-
* Subcommands:
|
|
5
|
-
* - peaks classify run --project <path> [--override <level> --reason "<text>"]
|
|
6
|
-
* Classify the current diff via the heuristic + return a JSON envelope
|
|
7
|
-
* with the chosen level, gate set, and audit log.
|
|
8
|
-
* - peaks classify override --level <level> --reason "<text>" --project <path>
|
|
9
|
-
* Force a level; writes the override to the audit log.
|
|
10
|
-
* - peaks classify upgrade --level <level> --reason "<text>" --project <path>
|
|
11
|
-
* Same as override but explicitly framed as an upgrade (audit log
|
|
12
|
-
* records the upgrade event separately from override).
|
|
13
|
-
*
|
|
14
|
-
* Downgrade is REFUSED (per spec §4: "peaks classify downgrade" always
|
|
15
|
-
* errors out). LLM may ask; the CLI never grants.
|
|
16
|
-
*/
|
|
17
|
-
import { Command } from 'commander';
|
|
18
|
-
import { type ProgramIO } from '../cli-helpers.js';
|
|
19
|
-
export declare function registerClassifyCommands(program: Command, io: ProgramIO): void;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* peaks classify CLI (Slice L1a + L1b).
|
|
3
|
-
*
|
|
4
|
-
* Subcommands:
|
|
5
|
-
* - peaks classify run --project <path> [--override <level> --reason "<text>"]
|
|
6
|
-
* Classify the current diff via the heuristic + return a JSON envelope
|
|
7
|
-
* with the chosen level, gate set, and audit log.
|
|
8
|
-
* - peaks classify override --level <level> --reason "<text>" --project <path>
|
|
9
|
-
* Force a level; writes the override to the audit log.
|
|
10
|
-
* - peaks classify upgrade --level <level> --reason "<text>" --project <path>
|
|
11
|
-
* Same as override but explicitly framed as an upgrade (audit log
|
|
12
|
-
* records the upgrade event separately from override).
|
|
13
|
-
*
|
|
14
|
-
* Downgrade is REFUSED (per spec §4: "peaks classify downgrade" always
|
|
15
|
-
* errors out). LLM may ask; the CLI never grants.
|
|
16
|
-
*/
|
|
17
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
18
|
-
import { join } from 'node:path';
|
|
19
|
-
import { classifyTask } from '../../services/classify/classify-service.js';
|
|
20
|
-
import { TASK_LEVELS } from '../../services/classify/classify-types.js';
|
|
21
|
-
import { loadPreferences } from '../../services/preferences/preferences-service.js';
|
|
22
|
-
import { addJsonOption, getErrorMessage, printResult } from '../cli-helpers.js';
|
|
23
|
-
import { fail, ok } from '../../shared/result.js';
|
|
24
|
-
const CLASSIFY_AUDIT_FILE = 'classify-audit.jsonl';
|
|
25
|
-
function getSignalsFromGitDiff(projectRoot) {
|
|
26
|
-
// Use git diff --stat to extract file count + line count. Fall back to
|
|
27
|
-
// zeros if git is unavailable (e.g. fresh repo with no commits).
|
|
28
|
-
let stdout;
|
|
29
|
-
try {
|
|
30
|
-
const { execFileSync } = require('node:child_process');
|
|
31
|
-
stdout = execFileSync('git', ['diff', '--shortstat', 'HEAD'], {
|
|
32
|
-
cwd: projectRoot,
|
|
33
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
34
|
-
maxBuffer: 32 * 1024 * 1024,
|
|
35
|
-
}).toString('utf8');
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return { filesChanged: 0, linesChanged: 0, touchesDependencies: false, touchesMigrationScripts: false, isPureRefactor: true, keywords: [] };
|
|
39
|
-
}
|
|
40
|
-
const lines = stdout.split('\n').filter((l) => l.trim().length > 0);
|
|
41
|
-
const filesChanged = lines.length;
|
|
42
|
-
let added = 0;
|
|
43
|
-
let removed = 0;
|
|
44
|
-
let touchesDependencies = false;
|
|
45
|
-
let touchesMigrationScripts = false;
|
|
46
|
-
for (const line of lines) {
|
|
47
|
-
const match = /(\d+)\s+insertion.*?(\d+)\s+deletion/.exec(line);
|
|
48
|
-
if (match) {
|
|
49
|
-
added += Number(match[1]);
|
|
50
|
-
removed += Number(match[2]);
|
|
51
|
-
}
|
|
52
|
-
if (/(package\.json|pnpm-lock\.yaml|yarn\.lock|requirements\.txt|go\.mod)/.test(line)) {
|
|
53
|
-
touchesDependencies = true;
|
|
54
|
-
}
|
|
55
|
-
if (/(migrate|codemod|backfill|schema)/.test(line)) {
|
|
56
|
-
touchesMigrationScripts = true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// isPureRefactor: heuristic — if added lines / removed lines < 0.1 OR
|
|
60
|
-
// no new exports were added, treat as refactor. For L2.2 the signal is
|
|
61
|
-
// binary (true/false). Default: true (no behavior change is the safe
|
|
62
|
-
// assumption; flip to false when keyword 'add' / 'new' / 'feature' present).
|
|
63
|
-
const isPureRefactor = true;
|
|
64
|
-
return {
|
|
65
|
-
filesChanged,
|
|
66
|
-
linesChanged: added + removed,
|
|
67
|
-
touchesDependencies,
|
|
68
|
-
touchesMigrationScripts,
|
|
69
|
-
isPureRefactor,
|
|
70
|
-
keywords: [],
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function appendAuditEntry(projectRoot, entry) {
|
|
74
|
-
const auditDir = join(projectRoot, '.peaks/_runtime');
|
|
75
|
-
if (!existsSync(auditDir)) {
|
|
76
|
-
try {
|
|
77
|
-
mkdirSync(auditDir, { recursive: true });
|
|
78
|
-
}
|
|
79
|
-
catch { /* ignore */ } // TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
|
|
80
|
-
}
|
|
81
|
-
const auditPath = join(auditDir, CLASSIFY_AUDIT_FILE);
|
|
82
|
-
let body = '';
|
|
83
|
-
try {
|
|
84
|
-
if (existsSync(auditPath)) {
|
|
85
|
-
body = readFileSync(auditPath, 'utf8');
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch { /* ignore */ } // TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
|
|
89
|
-
body += JSON.stringify(entry) + '\n';
|
|
90
|
-
try {
|
|
91
|
-
writeFileSync(auditPath, body);
|
|
92
|
-
}
|
|
93
|
-
catch { /* best-effort */ } // TODO(g2): legacy silent catch — grace: 1 minor release (v2.14.0)
|
|
94
|
-
}
|
|
95
|
-
function isTaskLevel(value) {
|
|
96
|
-
return TASK_LEVELS.includes(value);
|
|
97
|
-
}
|
|
98
|
-
export function registerClassifyCommands(program, io) {
|
|
99
|
-
const classify = program
|
|
100
|
-
.command('classify')
|
|
101
|
-
.description('L1a task classification: 5-level heuristic (typo/bug/feature/refactor/migration) + override/upgrade + audit log');
|
|
102
|
-
addJsonOption(classify
|
|
103
|
-
.command('run')
|
|
104
|
-
.description('Classify the current diff (git diff HEAD) into one of 5 task levels')
|
|
105
|
-
.requiredOption('--project <path>', 'target project root')
|
|
106
|
-
.option('--override <level>', 'force a level (one of typo|bug|feature|refactor|migration); requires --reason')
|
|
107
|
-
.option('--reason <text>', 'reason for the override (mandatory when --override is set)')).action(async (options) => {
|
|
108
|
-
try {
|
|
109
|
-
const prefs = await loadPreferences(options.project);
|
|
110
|
-
const signals = getSignalsFromGitDiff(options.project);
|
|
111
|
-
let override;
|
|
112
|
-
if (options.override !== undefined) {
|
|
113
|
-
if (!isTaskLevel(options.override)) {
|
|
114
|
-
printResult(io, fail('classify.run', 'INVALID_LEVEL', `level must be one of: ${TASK_LEVELS.join(', ')}`, { provided: options.override }, ['Pass one of typo, bug, feature, refactor, migration']), options.json);
|
|
115
|
-
process.exitCode = 1;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (options.reason === undefined || options.reason.length === 0) {
|
|
119
|
-
printResult(io, fail('classify.run', 'REASON_REQUIRED', '--reason is required when --override is set', {}, ['Provide a non-empty reason for the override']), options.json);
|
|
120
|
-
process.exitCode = 1;
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
override = { level: options.override, reason: options.reason };
|
|
124
|
-
}
|
|
125
|
-
const result = classifyTask(override !== undefined
|
|
126
|
-
? { signals, conservatism: prefs.classifyConservatism, override }
|
|
127
|
-
: { signals, conservatism: prefs.classifyConservatism }, prefs.classifyRules.feature_threshold_files, prefs.classifyRules.feature_threshold_lines);
|
|
128
|
-
appendAuditEntry(options.project, result.audit);
|
|
129
|
-
printResult(io, ok('classify.run', result, [], [
|
|
130
|
-
`gate set for level "${result.level}": ${result.gateSet.stages.join(', ')}`,
|
|
131
|
-
`audit log: .peaks/_runtime/${CLASSIFY_AUDIT_FILE}`,
|
|
132
|
-
]), options.json);
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
printResult(io, fail('classify.run', 'CLASSIFY_RUN_FAILED', getErrorMessage(error), { projectRoot: options.project }, ['Run peaks classify --help for usage']), options.json);
|
|
136
|
-
process.exitCode = 1;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
// Downgrade is REFUSED per spec §4. Surface this as a hard fail.
|
|
140
|
-
classify
|
|
141
|
-
.command('downgrade')
|
|
142
|
-
.description('REFUSED per spec §4 — peaks-loop never downgrades a classification; ask the user to override explicitly')
|
|
143
|
-
.requiredOption('--level <level>', 'attempted level')
|
|
144
|
-
.requiredOption('--reason <text>', 'reason for the attempt (always rejected)')
|
|
145
|
-
.requiredOption('--project <path>', 'target project root')
|
|
146
|
-
.option('--json', 'print machine-readable JSON envelope')
|
|
147
|
-
.action(async (options) => {
|
|
148
|
-
printResult(io, fail('classify.downgrade', 'DOWNGRADE_REFUSED', 'peaks classify downgrade is refused per spec §4. Use --override (with reason) on `classify run` to force a level; the CLI never downgrades a classification unilaterally.', { attemptedLevel: options.level, reason: options.reason }, ['Use `peaks classify run --override <level> --reason "<text>"` instead']), options.json);
|
|
149
|
-
process.exitCode = 2;
|
|
150
|
-
});
|
|
151
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `peaks contract` CLI commands — 2.7.0 slice-dag-dispatcher MVP
|
|
3
|
-
* (slice 1.2.c — LLM-side contract writer).
|
|
4
|
-
*
|
|
5
|
-
* Round-2 fix #5 (upgrade placeholder prompt) tells the LLM-side
|
|
6
|
-
* runner to execute `peaks contract write --project <root> ...` to
|
|
7
|
-
* persist its slice's public surface so the orchestrator can splice
|
|
8
|
-
* the contract into downstream dispatch prompts via
|
|
9
|
-
* `formatContractInjection`. This file is the actual implementation
|
|
10
|
-
* of that command — without it, the round-2 prompt would direct the
|
|
11
|
-
* LLM to a CLI that doesn't exist (the round-5 audit caught this).
|
|
12
|
-
*
|
|
13
|
-
* The command is a thin wrapper over `writeContract` from
|
|
14
|
-
* `src/services/dispatch/contract-store.ts`; it accepts the same
|
|
15
|
-
* shape, splits the comma-separated `--exports` / `--types` /
|
|
16
|
-
* `--signatures` flag values into arrays, and surfaces the result
|
|
17
|
-
* via the standard `ok` / `fail` envelope used across peaks-loop.
|
|
18
|
-
*
|
|
19
|
-
* Skill-first / CLI-auxiliary red line: users do not invoke this
|
|
20
|
-
* directly. The peaks-code / peaks-rd LLM-side runner (the
|
|
21
|
-
* IDE-resident sub-agent that finished a slice) calls this command
|
|
22
|
-
* after the slice completes.
|
|
23
|
-
*/
|
|
24
|
-
import { Command } from 'commander';
|
|
25
|
-
import { type ProgramIO } from '../cli-helpers.js';
|
|
26
|
-
export declare function registerContractCommands(program: Command, io: ProgramIO): void;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { fail, ok, getErrorMessage } from '../../shared/result.js';
|
|
2
|
-
import { addJsonOption, printResult } from '../cli-helpers.js';
|
|
3
|
-
import { writeContract } from '../../services/dispatch/contract-store.js';
|
|
4
|
-
import { getCurrentSessionId } from '../../services/skills/skill-presence-service.js';
|
|
5
|
-
const INPUT_LIMIT_BYTES = 256 * 1024;
|
|
6
|
-
/** Split a comma-separated flag value into a trimmed string array. */
|
|
7
|
-
function splitCsv(value) {
|
|
8
|
-
if (value === undefined)
|
|
9
|
-
return [];
|
|
10
|
-
return value
|
|
11
|
-
.split(',')
|
|
12
|
-
.map((s) => s.trim())
|
|
13
|
-
.filter((s) => s.length > 0);
|
|
14
|
-
}
|
|
15
|
-
export function registerContractCommands(program, io) {
|
|
16
|
-
const contract = program
|
|
17
|
-
.command('contract')
|
|
18
|
-
.description('Slice contract store (skill-first / CLI-auxiliary). These commands ' +
|
|
19
|
-
'are primitives that peaks-code / peaks-rd SKILL.md compose. The LLM-side ' +
|
|
20
|
-
'runner (the IDE-resident sub-agent that finished a slice) calls ' +
|
|
21
|
-
'`peaks contract write` to persist the slice\'s public surface; the ' +
|
|
22
|
-
'orchestrator picks it up on the next dispatch run via listContracts() ' +
|
|
23
|
-
'and splices it into downstream prompts via formatContractInjection().');
|
|
24
|
-
// ─────────────────────────────────────────────────────────────────
|
|
25
|
-
// peaks contract write --project <root> --session-id <sid>
|
|
26
|
-
// --slice-id <id> --exports <a,b> --types <x,y> --signatures <s1,s2>
|
|
27
|
-
// [--broadcast-to <b1,b2>] [--completed-at <iso>]
|
|
28
|
-
// ─────────────────────────────────────────────────────────────────
|
|
29
|
-
addJsonOption(contract
|
|
30
|
-
.command('write')
|
|
31
|
-
.description('2.7.0 slice-dag-dispatcher MVP: persist a finished slice\'s public ' +
|
|
32
|
-
'surface (exports / types / publicSignatures) to disk at ' +
|
|
33
|
-
'.peaks/_runtime/<sessionId>/dispatch/contracts/<slice-id>.json. ' +
|
|
34
|
-
'The orchestrator picks it up on the next dispatch run. Idempotent: ' +
|
|
35
|
-
're-running with the same inputs overwrites in place; the SHA-256 ' +
|
|
36
|
-
'contractHash is content-derived so a contract write from a different ' +
|
|
37
|
-
'runner (re-execution) is detected as a content change.')
|
|
38
|
-
.option('--project <path>', 'target project root (defaults to cwd)')
|
|
39
|
-
.option('--session-id <sid>', 'session id (default: resolve from .peaks/_runtime/session.json; falls back to PEAKS_SESSION_ID env var; final fallback "unknown-sid")')
|
|
40
|
-
.requiredOption('--slice-id <id>', 'slice id; must be non-empty; used as the contract filename basename')
|
|
41
|
-
.option('--exports <list>', 'comma-separated public export names (e.g. "validateDag,topologicalLevels")')
|
|
42
|
-
.option('--types <list>', 'comma-separated public type names (e.g. "SliceDag,SliceNode")')
|
|
43
|
-
.option('--signatures <list>', 'comma-separated public function/method signatures (e.g. "validateDag(dag: SliceDag): void")')
|
|
44
|
-
.option('--broadcast-to <list>', 'comma-separated downstream slice ids that should auto-inherit this contract (e.g. "B,C,D")')
|
|
45
|
-
.option('--completed-at <iso>', 'ISO 8601 timestamp; defaults to now()')).action((options) => {
|
|
46
|
-
const asJson = options.json === true;
|
|
47
|
-
const projectRoot = options.project ?? process.cwd();
|
|
48
|
-
// Slice 2026-06-26-unknown-sid-fallback-fix: see dispatch-commands.ts.
|
|
49
|
-
const sid = options.sessionId
|
|
50
|
-
?? process.env.PEAKS_SESSION_ID
|
|
51
|
-
?? getCurrentSessionId(projectRoot)
|
|
52
|
-
?? 'unknown-sid';
|
|
53
|
-
const sliceId = options.sliceId;
|
|
54
|
-
if (sliceId === undefined || sliceId.length === 0) {
|
|
55
|
-
printResult(io, fail('contract.write', 'MISSING_SLICE_ID', '--slice-id is required', { path: null, contract: null }, [
|
|
56
|
-
'Re-run with --slice-id <id> (must be non-empty; used as the contract filename basename).'
|
|
57
|
-
]), asJson);
|
|
58
|
-
process.exitCode = 1;
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const exports = splitCsv(options.exports);
|
|
62
|
-
const types = splitCsv(options.types);
|
|
63
|
-
const signatures = splitCsv(options.signatures);
|
|
64
|
-
const broadcastTo = splitCsv(options.broadcastTo);
|
|
65
|
-
// Cap the combined input to protect the file IO from runaway values
|
|
66
|
-
// (e.g. a 10MB comma-separated --signatures flag).
|
|
67
|
-
const inputSize = sliceId.length +
|
|
68
|
-
sid.length +
|
|
69
|
-
exports.join(',').length +
|
|
70
|
-
types.join(',').length +
|
|
71
|
-
signatures.join(',').length +
|
|
72
|
-
broadcastTo.join(',').length +
|
|
73
|
-
(options.completedAt?.length ?? 0);
|
|
74
|
-
if (inputSize > INPUT_LIMIT_BYTES) {
|
|
75
|
-
printResult(io, fail('contract.write', 'INPUT_TOO_LARGE', `combined input size ${inputSize} bytes exceeds ${INPUT_LIMIT_BYTES} (likely oversized --exports/--types/--signatures lists)`, { path: null, contract: null }, [
|
|
76
|
-
'Split the slice into smaller surfaces or omit optional fields.'
|
|
77
|
-
]), asJson);
|
|
78
|
-
process.exitCode = 1;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
const input = {
|
|
83
|
-
sliceId,
|
|
84
|
-
sessionId: sid,
|
|
85
|
-
exports,
|
|
86
|
-
types,
|
|
87
|
-
publicSignatures: signatures,
|
|
88
|
-
...(broadcastTo.length > 0 ? { broadcastTo } : {}),
|
|
89
|
-
...(options.completedAt !== undefined ? { completedAt: options.completedAt } : {})
|
|
90
|
-
};
|
|
91
|
-
const result = writeContract(projectRoot, sid, input);
|
|
92
|
-
printResult(io, ok('contract.write', {
|
|
93
|
-
path: result.path,
|
|
94
|
-
contractHash: result.contract.contractHash,
|
|
95
|
-
sliceId: result.contract.sliceId,
|
|
96
|
-
sessionId: result.contract.sessionId,
|
|
97
|
-
completedAt: result.contract.completedAt,
|
|
98
|
-
exportCount: result.contract.exports.length,
|
|
99
|
-
typeCount: result.contract.types.length,
|
|
100
|
-
signatureCount: result.contract.publicSignatures.length,
|
|
101
|
-
broadcastTo: result.contract.broadcastTo ?? []
|
|
102
|
-
}, [], [
|
|
103
|
-
`Contract written; orchestrator will pick it up on the next \`peaks sub-agent dispatch --from-dag\` run.`,
|
|
104
|
-
`Re-running with the same inputs is idempotent (overwrites in place).`
|
|
105
|
-
]), asJson);
|
|
106
|
-
}
|
|
107
|
-
catch (err) {
|
|
108
|
-
printResult(io, fail('contract.write', 'WRITE_ERROR', getErrorMessage(err), { path: null, contract: null }, [
|
|
109
|
-
'See error message; check that --project is a writable directory and --slice-id is a valid filename basename (no path separators).'
|
|
110
|
-
]), asJson);
|
|
111
|
-
process.exitCode = 1;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|