peaks-loop 4.0.0-beta.9 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +910 -141
- package/README-en.md +26 -7
- package/README.md +75 -6
- package/agents/karpathy-reviewer.md +33 -0
- package/bin/peaks.js +0 -0
- package/dist/cli/cli-helpers.d.ts +31 -6
- package/dist/cli/cli-helpers.js +48 -25
- package/dist/cli/commands/_register.d.ts +3 -0
- package/dist/cli/commands/_register.js +139 -0
- package/dist/cli/commands/_super.d.ts +10 -0
- package/dist/cli/commands/_super.js +97 -0
- package/dist/cli/commands/adapter-commands-s2a.js +1 -1
- package/dist/cli/commands/asset-commands.js +33 -16
- package/dist/cli/commands/audit-commands.js +2 -2
- package/dist/cli/commands/autonomous-swarm-commands.d.ts +12 -0
- package/dist/cli/commands/autonomous-swarm-commands.js +120 -0
- package/dist/cli/commands/bee-commands.js +1 -1
- package/dist/cli/commands/capability-commands.js +1 -1
- package/dist/cli/commands/capability-worker-config-sc-commands.js +0 -2
- package/dist/cli/commands/changeset-commands.d.ts +13 -0
- package/dist/cli/commands/changeset-commands.js +46 -0
- package/dist/cli/commands/code-commands.d.ts +11 -1
- package/dist/cli/commands/code-commands.js +19 -699
- package/dist/cli/commands/code-job-shape-commands.d.ts +9 -0
- package/dist/cli/commands/code-job-shape-commands.js +164 -0
- package/dist/cli/commands/code-mode-gate-commands.d.ts +9 -0
- package/dist/cli/commands/code-mode-gate-commands.js +223 -0
- package/dist/cli/commands/code-review-commands.js +2 -2
- package/dist/cli/commands/code-run-command.d.ts +12 -0
- package/dist/cli/commands/code-run-command.js +68 -0
- package/dist/cli/commands/code-runtime-commands.d.ts +11 -0
- package/dist/cli/commands/code-runtime-commands.js +391 -0
- package/dist/cli/commands/codegraph-commands.js +1 -1
- package/dist/cli/commands/compact-command.js +53 -1
- package/dist/cli/commands/complexity-commands.js +1 -1
- package/dist/cli/commands/config-commands.js +4 -75
- package/dist/cli/commands/container-commands.d.ts +28 -0
- package/dist/cli/commands/container-commands.js +221 -0
- package/dist/cli/commands/context-commands.js +3 -2
- package/dist/cli/commands/core/artifacts-command.js +1 -1
- package/dist/cli/commands/core/binding-commands.js +1 -1
- package/dist/cli/commands/core/doctor-command.js +63 -3
- package/dist/cli/commands/core/memory-command.js +1 -1
- package/dist/cli/commands/core/profile-command.js +1 -1
- package/dist/cli/commands/core/proxy-command.js +1 -1
- package/dist/cli/commands/core/session-command.js +9 -7
- package/dist/cli/commands/core/skill-command.js +7 -4
- package/dist/cli/commands/core/standards-command.js +1 -1
- package/dist/cli/commands/cron-commands.d.ts +57 -0
- package/dist/cli/commands/cron-commands.js +257 -0
- package/dist/cli/commands/cron-scheduler-commands.d.ts +47 -0
- package/dist/cli/commands/cron-scheduler-commands.js +284 -0
- package/dist/cli/commands/dashboard-commands.d.ts +4 -0
- package/dist/cli/commands/dashboard-commands.js +10 -0
- package/dist/cli/commands/dashboard-long-run.d.ts +25 -0
- package/dist/cli/commands/dashboard-long-run.js +122 -0
- package/dist/cli/commands/dashboard-summary.d.ts +12 -0
- package/dist/cli/commands/dashboard-summary.js +58 -0
- package/dist/cli/commands/dispatch-commands.d.ts +0 -7
- package/dist/cli/commands/dispatch-commands.js +372 -8
- package/dist/cli/commands/dispatch-from-dag.js +4 -1
- package/dist/cli/commands/doc-commands.js +1 -1
- package/dist/cli/commands/ecc-commands.d.ts +30 -0
- package/dist/cli/commands/ecc-commands.js +119 -0
- package/dist/cli/commands/evolution-commands.js +1 -1
- package/dist/cli/commands/feedback-commands.js +1 -1
- package/dist/cli/commands/final-review-commands.js +1 -1
- package/dist/cli/commands/fixture-commands.js +1 -1
- package/dist/cli/commands/fork-commands.js +1 -1
- package/dist/cli/commands/gate-commands.js +128 -6
- package/dist/cli/commands/governance-classify-contract-commands.d.ts +21 -0
- package/dist/cli/commands/governance-classify-contract-commands.js +273 -0
- package/dist/cli/commands/heartbeat-commands.js +76 -5
- package/dist/cli/commands/heartbeat-watch-command.d.ts +31 -0
- package/dist/cli/commands/heartbeat-watch-command.js +146 -0
- package/dist/cli/commands/hook-handle.js +1 -1
- package/dist/cli/commands/hooks-commands.js +126 -10
- package/dist/cli/commands/ide-commands.js +1 -1
- package/dist/cli/commands/impact-commands.js +1 -1
- package/dist/cli/commands/job-commands.js +34 -1
- package/dist/cli/commands/lease-metrics-commands.d.ts +67 -0
- package/dist/cli/commands/lease-metrics-commands.js +231 -0
- package/dist/cli/commands/lease-stats-commands.d.ts +65 -0
- package/dist/cli/commands/lease-stats-commands.js +107 -0
- package/dist/cli/commands/legacy-commands.js +1 -1
- package/dist/cli/commands/log-commands.js +1 -1
- package/dist/cli/commands/loop-commands.js +1 -1
- package/dist/cli/commands/loop-eval-commands.js +1 -1
- package/dist/cli/commands/memory-commands.js +1 -1
- package/dist/cli/commands/migrate-1-4-1-command.js +1 -1
- package/dist/cli/commands/migrate-v2-10-to-v2-11-command.js +1 -1
- package/dist/cli/commands/mut-commands.d.ts +1 -1
- package/dist/cli/commands/mut-commands.js +1 -5
- package/dist/cli/commands/observability-commands.js +1 -1
- package/dist/cli/commands/openspec-commands.js +65 -4
- package/dist/cli/commands/perf-audit-commands.js +3 -3
- package/dist/cli/commands/perf-commands.js +1 -1
- package/dist/cli/commands/polyrepo-commands.js +1 -1
- package/dist/cli/commands/prd-blocks-commands.js +1 -1
- package/dist/cli/commands/prd-commands.js +4 -2
- package/dist/cli/commands/preferences-commands.js +23 -3
- package/dist/cli/commands/project-commands.js +1 -1
- package/dist/cli/commands/qa-business-review-commands.js +1 -1
- package/dist/cli/commands/qa-commands.d.ts +1 -1
- package/dist/cli/commands/qa-commands.js +39 -3
- package/dist/cli/commands/release-commands.d.ts +15 -0
- package/dist/cli/commands/release-commands.js +113 -21
- package/dist/cli/commands/request-commands.js +1 -1
- package/dist/cli/commands/retrospective-commands.js +1 -1
- package/dist/cli/commands/reviewer-commands.js +1 -1
- package/dist/cli/commands/role-commands.js +1 -1
- package/dist/cli/commands/runtime-commands-helpers.d.ts +7 -0
- package/dist/cli/commands/runtime-commands-helpers.js +24 -0
- package/dist/cli/commands/runtime-commands.js +1 -2
- package/dist/cli/commands/sc-commands.js +4 -2
- package/dist/cli/commands/scan-commands.js +1 -1
- package/dist/cli/commands/security-audit-commands.js +3 -3
- package/dist/cli/commands/sediment-commands.js +10 -1
- package/dist/cli/commands/session-24h-mode.d.ts +26 -0
- package/dist/cli/commands/session-24h-mode.js +196 -0
- package/dist/cli/commands/share-commands.d.ts +19 -0
- package/dist/cli/commands/share-commands.js +121 -2
- package/dist/cli/commands/skill-conformance-commands.js +1 -1
- package/dist/cli/commands/skill-loop-engineering-readiness-commands.js +1 -1
- package/dist/cli/commands/skill-search-commands.js +4 -1
- package/dist/cli/commands/slice-commands.js +1 -1
- package/dist/cli/commands/slice-integrate-commands.js +1 -1
- package/dist/cli/commands/slice-review-commands.js +1 -1
- package/dist/cli/commands/smoke-commands.js +1 -1
- package/dist/cli/commands/sop-commands.js +1 -1
- package/dist/cli/commands/spill-demo-command.d.ts +7 -0
- package/dist/cli/commands/spill-demo-command.js +29 -0
- package/dist/cli/commands/statusline-commands.d.ts +12 -0
- package/dist/cli/commands/statusline-commands.js +79 -17
- package/dist/cli/commands/sub-agent-commands.js +2 -1
- package/dist/cli/commands/sub-agent-shared.d.ts +10 -0
- package/dist/cli/commands/sub-agent-shared.js +24 -1
- package/dist/cli/commands/swarm-commands.d.ts +13 -0
- package/dist/cli/commands/swarm-commands.js +77 -0
- package/dist/cli/commands/tech-commands.d.ts +64 -0
- package/dist/cli/commands/tech-commands.js +195 -0
- package/dist/cli/commands/understand-commands.js +1 -1
- package/dist/cli/commands/upgrade-commands.d.ts +2 -0
- package/dist/cli/commands/upgrade-commands.js +40 -5
- package/dist/cli/commands/user-touchpoint-commands.js +1 -1
- package/dist/cli/commands/verdict-aggregate-command.js +1 -1
- package/dist/cli/commands/vm-commands.d.ts +31 -0
- package/dist/cli/commands/vm-commands.js +274 -0
- package/dist/cli/commands/workflow-commands.js +24 -1
- package/dist/cli/commands/workflow-plan-commands.js +1 -1
- package/dist/cli/commands/workspace/init-command.js +1 -1
- package/dist/cli/commands/workspace/migrate-command.js +1 -1
- package/dist/cli/commands/workspace/reconcile-command.js +1 -1
- package/dist/cli/commands/worktree-auth-commands.d.ts +29 -0
- package/dist/cli/commands/worktree-auth-commands.js +652 -0
- package/dist/cli/index.js +58 -13
- package/dist/cli/program.d.ts +2 -2
- package/dist/cli/program.js +86 -281
- package/dist/services/24h-mode/decider.d.ts +103 -0
- package/dist/services/24h-mode/decider.js +144 -0
- package/dist/services/24h-mode/index.d.ts +12 -0
- package/dist/services/24h-mode/index.js +12 -0
- package/dist/services/24h-mode/state.d.ts +48 -0
- package/dist/services/24h-mode/state.js +51 -0
- package/dist/services/24h-mode/store.d.ts +27 -0
- package/dist/services/24h-mode/store.js +119 -0
- package/dist/services/artifacts/artifact-prerequisites.js +1 -1
- package/dist/services/artifacts/request-artifact-service.js +1 -1
- package/dist/services/artifacts/workspace-service.js +1 -1
- package/dist/services/audit/enforcers/lint-bee-runtime-contract.d.ts +25 -0
- package/dist/services/audit/enforcers/lint-bee-runtime-contract.js +91 -0
- package/dist/services/audit/enforcers/lint-peaks-code-runtime.d.ts +16 -0
- package/dist/services/audit/enforcers/lint-peaks-code-runtime.js +31 -0
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.d.ts +23 -0
- package/dist/services/audit/enforcers/lint-peaks-skill-runtime.js +59 -0
- package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.d.ts +28 -0
- package/dist/services/audit/enforcers/lint-peaks-ui-sc-txt-runtime.js +86 -0
- package/dist/services/audit/enforcers/lint-prd-artifact-handoff.d.ts +16 -0
- package/dist/services/audit/enforcers/lint-prd-artifact-handoff.js +41 -0
- package/dist/services/audit/enforcers/lint-prd-source-snapshot.d.ts +27 -0
- package/dist/services/audit/enforcers/lint-prd-source-snapshot.js +47 -0
- package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.d.ts +19 -0
- package/dist/services/audit/enforcers/lint-qa-gateguard-and-runtime.js +47 -0
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.d.ts +18 -0
- package/dist/services/audit/enforcers/lint-rd-handoff-coverage.js +70 -0
- package/dist/services/audit/enforcers/lint-skill-presence-mandatory.d.ts +25 -0
- package/dist/services/audit/enforcers/lint-skill-presence-mandatory.js +53 -0
- package/dist/services/audit/red-line-catalog-p2-a.d.ts +0 -6
- package/dist/services/audit/red-line-catalog-p2-a.js +230 -1
- package/dist/services/audit/static-service.d.ts +32 -25
- package/dist/services/audit/static-service.js +30 -109
- package/dist/services/audit-independent/index.d.ts +2 -0
- package/dist/services/audit-independent/index.js +2 -0
- package/dist/services/autonomous-swarm/autonomous-swarm-service.d.ts +127 -0
- package/dist/services/autonomous-swarm/autonomous-swarm-service.js +446 -0
- package/dist/services/changeset/changeset-check-service.d.ts +22 -0
- package/dist/services/changeset/changeset-check-service.js +47 -0
- package/dist/services/code/auto-compact-modes.d.ts +30 -0
- package/dist/services/code/auto-compact-modes.js +38 -0
- package/dist/services/code/auto-compact-orchestrator.d.ts +43 -5
- package/dist/services/code/auto-compact-orchestrator.js +101 -21
- package/dist/services/code/dag-orchestrator.d.ts +30 -1
- package/dist/services/code/dag-orchestrator.js +106 -1
- package/dist/services/code/status-line-renderer.d.ts +2 -0
- package/dist/services/code/status-line-renderer.js +21 -3
- package/dist/services/code-review/ocr-service.d.ts +1 -1
- package/dist/services/code-review/ocr-service.js +6 -3
- package/dist/services/compact-history/compact-history-service.d.ts +41 -0
- package/dist/services/compact-history/compact-history-service.js +62 -0
- package/dist/services/compact-statusline/compact-statusline-service.d.ts +16 -0
- package/dist/services/compact-statusline/compact-statusline-service.js +83 -0
- package/dist/services/config/config-service.d.ts +1 -12
- package/dist/services/config/config-service.js +3 -72
- package/dist/services/config/config-types.d.ts +2 -4
- package/dist/services/config/config-types.js +1 -1
- package/dist/services/container/container-lease.d.ts +67 -0
- package/dist/services/container/container-lease.js +135 -0
- package/dist/services/context/auto-compact-dispatcher.d.ts +40 -5
- package/dist/services/context/auto-compact-dispatcher.js +32 -102
- package/dist/services/context/auto-compact-reader.js +1 -1
- package/dist/services/context/auto-compact-types.d.ts +27 -2
- package/dist/services/context/auto-compact-types.js +8 -1
- package/dist/services/context/build-dispatch-system-prompt.d.ts +75 -0
- package/dist/services/context/build-dispatch-system-prompt.js +117 -0
- package/dist/services/context/collector.d.ts +2 -2
- package/dist/services/context/context-builder.d.ts +4 -4
- package/dist/services/context/context-schema.d.ts +48 -48
- package/dist/services/context/ide-detect.d.ts +4 -0
- package/dist/services/context/ide-detect.js +24 -0
- package/dist/services/context/main-session-monitor.d.ts +1 -4
- package/dist/services/context/main-session-monitor.js +1 -24
- package/dist/services/context/memory-index-reader.d.ts +8 -0
- package/dist/services/context/memory-index-reader.js +57 -0
- package/dist/services/context/memory-lru-cache.d.ts +12 -0
- package/dist/services/context/memory-lru-cache.js +60 -0
- package/dist/services/context/memory-preflight-config.d.ts +19 -0
- package/dist/services/context/memory-preflight-config.js +25 -0
- package/dist/services/context/memory-preflight-service.d.ts +19 -0
- package/dist/services/context/memory-preflight-service.js +120 -0
- package/dist/services/context/spillover-store.d.ts +23 -0
- package/dist/services/context/spillover-store.js +155 -0
- package/dist/services/context/spillover-types.d.ts +18 -0
- package/dist/services/context/spillover-types.js +1 -0
- package/dist/services/crystallization/crystallization-service.d.ts +22 -5
- package/dist/services/crystallization/crystallization-service.js +8 -14
- package/dist/services/crystallization/crystallization-types.d.ts +6 -6
- package/dist/services/crystallization/evidence-brief-builder.d.ts +1 -1
- package/dist/services/crystallization/index.d.ts +13 -0
- package/dist/services/crystallization/index.js +13 -0
- package/dist/services/dashboard/project-dashboard-service.js +2 -2
- package/dist/services/dispatch/await-batch.d.ts +70 -0
- package/dist/services/dispatch/await-batch.js +272 -0
- package/dist/services/dispatch/batch-counter.js +1 -1
- package/dist/services/dispatch/dispatch-record-writer.d.ts +126 -4
- package/dist/services/dispatch/dispatch-record-writer.js +239 -9
- package/dist/services/dispatch/slice-dag.d.ts +46 -0
- package/dist/services/dispatch/slice-dag.js +6 -0
- package/dist/services/dispatch/stage-enum.d.ts +27 -0
- package/dist/services/dispatch/stage-enum.js +48 -0
- package/dist/services/dispatch/startup-timeout.d.ts +86 -0
- package/dist/services/dispatch/startup-timeout.js +97 -0
- package/dist/services/dispatch/sub-agent-dispatcher.js +40 -89
- package/dist/services/dispatch/test-tool-detection.d.ts +25 -1
- package/dist/services/dispatch/test-tool-detection.js +80 -0
- package/dist/services/doctor/doctor-service/checks/check-id-schema.d.ts +18 -0
- package/dist/services/doctor/doctor-service/checks/check-id-schema.js +64 -0
- package/dist/services/doctor/doctor-service/checks/codegraph-capability.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/codegraph-capability.js +69 -0
- package/dist/services/doctor/doctor-service/checks/dist-source-version.d.ts +32 -0
- package/dist/services/doctor/doctor-service/checks/dist-source-version.js +110 -0
- package/dist/services/doctor/doctor-service/checks/gateguard-conflict.d.ts +24 -0
- package/dist/services/doctor/doctor-service/checks/gateguard-conflict.js +164 -0
- package/dist/services/doctor/doctor-service/checks/l3-memory-health.d.ts +16 -0
- package/dist/services/doctor/doctor-service/checks/l3-memory-health.js +57 -0
- package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.d.ts +19 -0
- package/dist/services/doctor/doctor-service/checks/l3-orphan-sessions.js +66 -0
- package/dist/services/doctor/doctor-service/checks/schema-validity.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/schema-validity.js +33 -0
- package/dist/services/doctor/doctor-service/checks/skill-apply-note.d.ts +20 -0
- package/dist/services/doctor/doctor-service/checks/skill-apply-note.js +85 -0
- package/dist/services/doctor/doctor-service/checks/skill-existence.d.ts +13 -0
- package/dist/services/doctor/doctor-service/checks/skill-existence.js +30 -0
- package/dist/services/doctor/doctor-service/checks/skill-name-match.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/skill-name-match.js +25 -0
- package/dist/services/doctor/doctor-service/checks/skill-parse.d.ts +10 -0
- package/dist/services/doctor/doctor-service/checks/skill-parse.js +19 -0
- package/dist/services/doctor/doctor-service/checks/skill-presence.d.ts +21 -0
- package/dist/services/doctor/doctor-service/checks/skill-presence.js +75 -0
- package/dist/services/doctor/doctor-service/checks/skill-runbook.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/skill-runbook.js +47 -0
- package/dist/services/doctor/doctor-service/checks/statusline-install.d.ts +14 -0
- package/dist/services/doctor/doctor-service/checks/statusline-install.js +32 -0
- package/dist/services/doctor/doctor-service/checks/statusline-runtime.d.ts +13 -0
- package/dist/services/doctor/doctor-service/checks/statusline-runtime.js +30 -0
- package/dist/services/doctor/doctor-service/checks/user-config.d.ts +11 -0
- package/dist/services/doctor/doctor-service/checks/user-config.js +27 -0
- package/dist/services/doctor/doctor-service/checks/workspace-init.d.ts +16 -0
- package/dist/services/doctor/doctor-service/checks/workspace-init.js +34 -0
- package/dist/services/doctor/doctor-service/checks/workspace-layout.d.ts +33 -0
- package/dist/services/doctor/doctor-service/checks/workspace-layout.js +180 -0
- package/dist/services/doctor/doctor-service/index.d.ts +48 -0
- package/dist/services/doctor/doctor-service/index.js +254 -0
- package/dist/services/doctor/doctor-service/plugin-registry.d.ts +41 -0
- package/dist/services/doctor/doctor-service/plugin-registry.js +77 -0
- package/dist/services/doctor/doctor-service/report/final-summary.d.ts +20 -0
- package/dist/services/doctor/doctor-service/report/final-summary.js +29 -0
- package/dist/services/doctor/doctor-service/types.d.ts +245 -0
- package/dist/services/doctor/doctor-service/types.js +15 -0
- package/dist/services/doctor/doctor-service.d.ts +15 -146
- package/dist/services/doctor/doctor-service.js +22 -926
- package/dist/services/doctor/index.d.ts +22 -0
- package/dist/services/doctor/index.js +22 -0
- package/dist/services/env/shell-probe.d.ts +71 -0
- package/dist/services/env/shell-probe.js +161 -0
- package/dist/services/evolution/evolution-types.d.ts +39 -39
- package/dist/services/final-review/final-review-service.d.ts +11 -1
- package/dist/services/final-review/index.d.ts +2 -0
- package/dist/services/final-review/index.js +1 -0
- package/dist/services/hooks/auto-compact-hook-install.d.ts +4 -5
- package/dist/services/hooks/auto-compact-hook-install.js +4 -5
- package/dist/services/hooks/worktree-authorization-gate.d.ts +205 -0
- package/dist/services/hooks/worktree-authorization-gate.js +492 -0
- package/dist/services/ide/adapters/claude-code-adapter.js +2 -2
- package/dist/services/ide/adapters/qoder-adapter.d.ts +25 -0
- package/dist/services/ide/adapters/qoder-adapter.js +57 -0
- package/dist/services/ide/adapters/tongyi-lingma-adapter.d.ts +16 -0
- package/dist/services/ide/adapters/tongyi-lingma-adapter.js +45 -0
- package/dist/services/ide/ide-registry.js +6 -0
- package/dist/services/ide/ide-types.d.ts +1 -1
- package/dist/services/job/job-types.d.ts +56 -56
- package/dist/services/job-snapshot/index.d.ts +8 -0
- package/dist/services/job-snapshot/index.js +7 -0
- package/dist/services/{job/job-resource-snapshot.d.ts → job-snapshot/snapshot.d.ts} +1 -1
- package/dist/services/job-snapshot/types.d.ts +7 -0
- package/dist/services/job-snapshot/types.js +1 -0
- package/dist/services/karpathy-cost/karpathy-cost-check-service.d.ts +67 -0
- package/dist/services/karpathy-cost/karpathy-cost-check-service.js +108 -0
- package/dist/services/log/retention.d.ts +16 -0
- package/dist/services/log/retention.js +17 -0
- package/dist/services/loop/loop-bee-relation-types.d.ts +6 -6
- package/dist/services/loop/loop-release-types.d.ts +24 -24
- package/dist/services/loop/monotonic-runner.d.ts +17 -11
- package/dist/services/loop/monotonic-runner.js +118 -79
- package/dist/services/memory/project-memory-service/index/kind-dispatch.d.ts +8 -0
- package/dist/services/memory/project-memory-service/index/kind-dispatch.js +253 -0
- package/dist/services/memory/project-memory-service/index/ranking.d.ts +6 -0
- package/dist/services/memory/project-memory-service/index/ranking.js +171 -0
- package/dist/services/memory/project-memory-service/index/search.d.ts +34 -0
- package/dist/services/memory/project-memory-service/index/search.js +194 -0
- package/dist/services/memory/project-memory-service/index.d.ts +9 -0
- package/dist/services/memory/project-memory-service/index.js +24 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter.d.ts +9 -0
- package/dist/services/memory/project-memory-service/parsers/frontmatter.js +106 -0
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.d.ts +7 -0
- package/dist/services/memory/project-memory-service/parsers/markdown-pure.js +96 -0
- package/dist/services/memory/project-memory-service/store/atomic-write.d.ts +5 -0
- package/dist/services/memory/project-memory-service/store/atomic-write.js +56 -0
- package/dist/services/memory/project-memory-service/store/paths.d.ts +8 -0
- package/dist/services/memory/project-memory-service/store/paths.js +116 -0
- package/dist/services/memory/project-memory-service/types.d.ts +128 -0
- package/dist/services/memory/project-memory-service/types.js +9 -0
- package/dist/services/memory/project-memory-service.d.ts +1 -167
- package/dist/services/memory/project-memory-service.js +19 -816
- package/dist/services/migrate-skill-name/schema.d.ts +2 -2
- package/dist/services/observability/aggregation.d.ts +27 -0
- package/dist/services/observability/aggregation.js +72 -0
- package/dist/services/observability/observability-service.d.ts +73 -7
- package/dist/services/observability/observability-service.js +87 -1
- package/dist/services/openspec/artifact-boundary.d.ts +138 -0
- package/dist/services/openspec/artifact-boundary.js +150 -0
- package/dist/services/openspec/coverage-evidence-reader.d.ts +191 -0
- package/dist/services/openspec/coverage-evidence-reader.js +386 -0
- package/dist/services/openspec/openspec-archive-service.d.ts +70 -0
- package/dist/services/openspec/openspec-archive-service.js +320 -8
- package/dist/services/openspec/openspec-bridge-service.js +1 -1
- package/dist/services/openspec/openspec-init-service.js +1 -1
- package/dist/services/openspec/openspec-propose-from-doctor-service.js +1 -1
- package/dist/services/openspec/openspec-render-service.js +7 -4
- package/dist/services/openspec/openspec-scan-service.js +1 -1
- package/dist/services/openspec/openspec-validate-service.js +5 -4
- package/dist/services/preferences/preferences-service.js +10 -0
- package/dist/services/preferences/preferences-types.d.ts +13 -0
- package/dist/services/preferences/preferences-types.js +11 -0
- package/dist/services/qa/screenshot-archive-service.d.ts +51 -0
- package/dist/services/qa/screenshot-archive-service.js +134 -0
- package/dist/services/rd/rd-service.js +10 -11
- package/dist/services/rd/types.d.ts +32 -32
- package/dist/services/rd-swarm/rd-swarm-service.d.ts +60 -0
- package/dist/services/rd-swarm/rd-swarm-service.js +93 -0
- package/dist/services/recommendations/capability-seed-items.js +0 -1
- package/dist/services/recommendations/capability-seed-mappings.js +0 -1
- package/dist/services/recommendations/capability-seed-sources.js +0 -1
- package/dist/services/release/version-precheck-service.d.ts +51 -0
- package/dist/services/release/version-precheck-service.js +257 -0
- package/dist/services/scan/acceptance-coverage-service.js +1 -1
- package/dist/services/scan/archetype-service.js +1 -1
- package/dist/services/scan/existing-system-service.js +1 -1
- package/dist/services/scan/libraries-service.js +1 -1
- package/dist/services/sediment/json-schema.d.ts +40 -40
- package/dist/services/share/bundle-types.d.ts +12 -12
- package/dist/services/share/run-state-contract.d.ts +2 -2
- package/dist/services/skill/skill-search-service.d.ts +12 -7
- package/dist/services/skill/skill-search-service.js +8 -4
- package/dist/services/skillhub/migrations/001-initial.sql +71 -0
- package/dist/services/skillhub/migrations/002-loop-release.sql +32 -0
- package/dist/services/skillhub/migrations/003-loop-bee-relation.sql +35 -0
- package/dist/services/skillhub/migrations/004-loop-bee-extension.sql +65 -0
- package/dist/services/skillhub/migrations/005-evolution-evaluation.sql +81 -0
- package/dist/services/skillhub/migrations/006-crystallization-event.sql +92 -0
- package/dist/services/skills/hooks-settings-service.d.ts +75 -0
- package/dist/services/skills/hooks-settings-service.js +230 -2
- package/dist/services/skills/skill-registry.d.ts +1 -0
- package/dist/services/skills/skill-registry.js +6 -4
- package/dist/services/skills/skill-runbook-service.js +1 -1
- package/dist/services/slice/slice-check-service.js +1 -1
- package/dist/services/standards/main-session-monitor-ban-hook.d.ts +14 -0
- package/dist/services/standards/main-session-monitor-ban-hook.js +19 -0
- package/dist/services/standards/missing-standards-detector.d.ts +25 -0
- package/dist/services/standards/missing-standards-detector.js +43 -12
- package/dist/services/tech/tech-change-id-service.d.ts +82 -0
- package/dist/services/tech/tech-change-id-service.js +117 -0
- package/dist/services/understand/understand-hybrid-service.js +1 -1
- package/dist/services/understand/understand-scan-service.js +2 -2
- package/dist/services/upgrade/upgrade-service.js +4 -3
- package/dist/services/verdict/envelopes.d.ts +2 -2
- package/dist/services/verdict/envelopes.js +2 -2
- package/dist/services/verdict/verdict-aggregator.d.ts +3 -3
- package/dist/services/vm/vm-lease.d.ts +40 -0
- package/dist/services/vm/vm-lease.js +137 -0
- package/dist/services/workflow/autonomous-resume-writer.js +1 -1
- package/dist/services/workflow/pipeline-verify-gate-support.d.ts +47 -0
- package/dist/services/workflow/pipeline-verify-gate-support.js +194 -0
- package/dist/services/workflow/pipeline-verify-service.d.ts +17 -81
- package/dist/services/workflow/pipeline-verify-service.js +42 -218
- package/dist/services/workflow/pipeline-verify-types.d.ts +90 -0
- package/dist/services/workflow/pipeline-verify-types.js +10 -0
- package/dist/services/workflow/plan-reader.d.ts +1 -1
- package/dist/services/workflow/plan-reader.js +1 -1
- package/dist/services/workflow/plan-refresher.d.ts +1 -1
- package/dist/services/workflow/plan-refresher.js +1 -1
- package/dist/services/workflow/plan-trigger-detector.d.ts +1 -1
- package/dist/services/workflow/plan-trigger-detector.js +1 -1
- package/dist/services/workflow/workflow-autonomous-resume-helpers.d.ts +1 -1
- package/dist/services/workflow/workflow-autonomous-service.d.ts +2 -98
- package/dist/services/workflow/workflow-autonomous-types.d.ts +114 -0
- package/dist/services/workflow/workflow-autonomous-types.js +21 -0
- package/dist/services/workflow/workflow-router-service.js +18 -16
- package/dist/services/workflow/workflow-spec-lint.d.ts +13 -0
- package/dist/services/workflow/workflow-spec-lint.js +75 -0
- package/dist/services/workflow/workflow-spec-types.d.ts +100 -0
- package/dist/services/workflow/workflow-spec-types.js +13 -0
- package/dist/services/workflow/workflow-spec-yaml.d.ts +17 -0
- package/dist/services/workflow/workflow-spec-yaml.js +88 -0
- package/dist/services/workflow/workflow-spec.d.ts +11 -91
- package/dist/services/workflow/workflow-spec.js +16 -145
- package/dist/services/workspace/migrate-service.js +1 -1
- package/dist/services/workspace/workspace-service.js +1 -1
- package/dist/services/worktree/worktree-lease.d.ts +170 -0
- package/dist/services/worktree/worktree-lease.js +242 -0
- package/package.json +47 -51
- package/scripts/clean-dist.mjs +31 -1
- package/scripts/copy-templates.mjs +16 -0
- package/scripts/sync-version.mjs +53 -2
- package/skills/bee/peaks-perf-audit/SKILL.md +17 -0
- package/skills/bee/peaks-prd/SKILL.md +16 -0
- package/skills/bee/peaks-prd/test-prompts.json +12 -0
- package/skills/bee/peaks-qa/SKILL.md +16 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +22 -0
- package/skills/bee/peaks-qa/test-prompts.json +12 -0
- package/skills/bee/peaks-rd/SKILL.md +29 -20
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +39 -0
- package/skills/bee/peaks-rd/test-prompts.json +12 -0
- package/skills/bee/peaks-reviewer/SKILL.md +17 -0
- package/skills/bee/peaks-sc/SKILL.md +16 -0
- package/skills/bee/peaks-security-audit/SKILL.md +17 -0
- package/skills/bee/peaks-txt/SKILL.md +16 -0
- package/skills/bee/peaks-txt/test-prompts.json +12 -0
- package/skills/bee/peaks-ui/SKILL.md +49 -43
- package/skills/bee/peaks-ui/test-prompts.json +12 -0
- package/skills/peaks-code/SKILL.md +54 -109
- package/skills/peaks-code/references/boundaries.md +15 -1
- package/skills/peaks-code/references/cron-scheduler-deployment.md +313 -0
- package/skills/peaks-code/references/external-skill-invocation.md +27 -0
- package/skills/peaks-code/references/lease-dashboard.html +224 -0
- package/skills/peaks-code/references/lease-stats.sample.json +26 -0
- package/skills/peaks-code/references/peaks-worktree-l2-enforcers.md +208 -0
- package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
- package/skills/peaks-code/references/runbook.md +63 -1
- package/skills/peaks-code/references/startup-sequence.md +110 -0
- package/skills/peaks-code/references/step-0-8-gate.md +1 -1
- package/skills/peaks-code/references/sub-agent-dispatch.md +92 -1
- package/skills/peaks-code/references/worktree-governance.md +123 -0
- package/skills/peaks-code/test-prompts.json +12 -0
- package/skills/peaks-doctor/SKILL.md +1 -1
- package/skills/peaks-ide/SKILL.md +1 -1
- package/skills/peaks-solo/SKILL.md +21 -0
- package/skills/peaks-solo/references/triage-decision-table.md +6 -0
- package/skills/peaks-sop/test-prompts.json +17 -0
- package/dist/cli/commands/agent-commands.d.ts +0 -20
- package/dist/cli/commands/agent-commands.js +0 -48
- package/dist/cli/commands/classify-classify-commands.d.ts +0 -19
- package/dist/cli/commands/classify-classify-commands.js +0 -151
- package/dist/cli/commands/contract-commands.d.ts +0 -26
- package/dist/cli/commands/contract-commands.js +0 -114
- package/dist/cli/commands/session-auto-compact-hook-command.d.ts +0 -37
- package/dist/cli/commands/session-auto-compact-hook-command.js +0 -127
- package/dist/cli/commands/worker-commands.d.ts +0 -3
- package/dist/cli/commands/worker-commands.js +0 -52
- package/dist/services/agent/ecc-agent-service.d.ts +0 -47
- package/dist/services/agent/ecc-agent-service.js +0 -143
- package/dist/services/config/provider-service.d.ts +0 -48
- package/dist/services/config/provider-service.js +0 -143
- package/dist/services/context/dispatch-context-guard.d.ts +0 -27
- package/dist/services/context/dispatch-context-guard.js +0 -192
- package/dist/services/context/shared-channel.d.ts +0 -93
- package/dist/services/context/shared-channel.js +0 -308
- package/dist/services/filesystem/file-lock.d.ts +0 -11
- package/dist/services/filesystem/file-lock.js +0 -152
- package/dist/services/mut/assert-scanner.d.ts +0 -6
- package/dist/services/mut/assert-scanner.js +0 -116
- package/dist/services/mut/index.d.ts +0 -8
- package/dist/services/mut/index.js +0 -7
- package/dist/services/mut/mut-runner.d.ts +0 -39
- package/dist/services/mut/mut-runner.js +0 -29
- package/dist/services/mut/production-stryker.d.ts +0 -2
- package/dist/services/mut/production-stryker.js +0 -75
- package/dist/services/mut/report-builder.d.ts +0 -11
- package/dist/services/mut/report-builder.js +0 -110
- package/dist/services/mut/report-loader.d.ts +0 -31
- package/dist/services/mut/report-loader.js +0 -78
- package/dist/services/mut/thresholds.d.ts +0 -21
- package/dist/services/mut/thresholds.js +0 -22
- package/dist/services/mut/types.d.ts +0 -336
- package/dist/services/mut/types.js +0 -59
- package/dist/services/providers/minimax-provider-service.d.ts +0 -24
- package/dist/services/providers/minimax-provider-service.js +0 -143
- package/dist/services/providers/minimax-worker-service.d.ts +0 -21
- package/dist/services/providers/minimax-worker-service.js +0 -83
- package/dist/shared/fs.d.ts +0 -4
- package/dist/shared/fs.js +0 -26
- package/dist/shared/paths.d.ts +0 -6
- package/dist/shared/paths.js +0 -50
- package/dist/shared/result.d.ts +0 -22
- package/dist/shared/result.js +0 -46
- package/dist/shared/version.d.ts +0 -1
- package/dist/shared/version.js +0 -1
- package/examples/video-demo/README.md +0 -142
- package/examples/video-demo/out/en-closing-960.png +0 -0
- package/examples/video-demo/out/zh-closing-960.png +0 -0
- package/examples/video-demo/preview/peaks-loop-demo-en.mp4 +0 -0
- package/examples/video-demo/preview/peaks-loop-demo.mp4 +0 -0
- /package/dist/services/{job/job-resource-snapshot.js → job-snapshot/snapshot.js} +0 -0
|
@@ -200,6 +200,126 @@ function resolveLegacySentinels(ide) {
|
|
|
200
200
|
}
|
|
201
201
|
return [HOOK_ENFORCE_SENTINEL, LEGACY_PROGRESS_START_SENTINEL];
|
|
202
202
|
}
|
|
203
|
+
// --- Slice 2026-07-29-worktree-layer3-deny -----------------------------------
|
|
204
|
+
// Layer 3 of the Worktree Governance 3-layer design (see
|
|
205
|
+
// .peaks/memory/2026-07-29-worktree-layer3-deny.md). The gateway is the IDE
|
|
206
|
+
// native `permissions.deny` list — Claude Code refuses to invoke any Skill
|
|
207
|
+
// listed there BEFORE the LLM even sees it. This is the strongest of the three
|
|
208
|
+
// layers because it bypasses the LLM's tool-call decision entirely: the IDE
|
|
209
|
+
// matches the deny entry against the Skill's namespace and returns a
|
|
210
|
+
// permission error, so the LLM observes "skill not available" rather than
|
|
211
|
+
// "skill denied" — true fail-closed.
|
|
212
|
+
//
|
|
213
|
+
// The list is intentionally tiny: only skills that the superpowers chain
|
|
214
|
+
// *forces* downstream from peaks-loop work paths. We do NOT deny every
|
|
215
|
+
// superpowers skill — only the one whose `description` field or SKILL.md body
|
|
216
|
+
// recommends `git worktree add` / native worktree tools as a step. Anything
|
|
217
|
+
// else stays available as a reference (peaks-code's
|
|
218
|
+
// references/external-skill-invocation.md already describes every other
|
|
219
|
+
// superpowers skill as informational).
|
|
220
|
+
//
|
|
221
|
+
// The IDE expects the deny entry in the form `UseSkill(<skill-id>)`. The
|
|
222
|
+
// prefix is fixed; the skill id is the namespace-qualified name. We render
|
|
223
|
+
// the entries at install time and at uninstall time so the sentinel list is
|
|
224
|
+
// the single source of truth.
|
|
225
|
+
/**
|
|
226
|
+
* The set of Skills whose use is denied at the IDE permissions layer for
|
|
227
|
+
* every `peaks hooks install` call. Each entry is the namespace-qualified
|
|
228
|
+
* skill id; the helper `formatSuperpowersDenyEntry` wraps it in the IDE's
|
|
229
|
+
* `UseSkill(...)` envelope.
|
|
230
|
+
*
|
|
231
|
+
* Slice 2026-07-29-worktree-layer3-deny: the list is empty-aware. To deny a
|
|
232
|
+
* new skill, append its id here and re-run `peaks hooks install`. The list
|
|
233
|
+
* is also the inverse for uninstall: `removeHookInstall` rebuilds the deny
|
|
234
|
+
* list by filtering out anything whose wrapped form matches one of these
|
|
235
|
+
* ids.
|
|
236
|
+
*/
|
|
237
|
+
export const SUPERPOWERS_DENIED_SKILLS = [
|
|
238
|
+
// superpowers:using-git-worktrees is the chain's "ground zero" — its
|
|
239
|
+
// SKILL.md (lines 47-99) literally instructs the LLM to run
|
|
240
|
+
// `git worktree add`. Denying this Skill at the IDE layer prevents the
|
|
241
|
+
// LLM from ever receiving that prompt.
|
|
242
|
+
'superpowers:using-git-worktrees'
|
|
243
|
+
];
|
|
244
|
+
function formatSuperpowersDenyEntry(skillId) {
|
|
245
|
+
return `UseSkill(${skillId})`;
|
|
246
|
+
}
|
|
247
|
+
const SUPERPOWERS_DENY_SENTINELS = new Set(SUPERPOWERS_DENIED_SKILLS.map(formatSuperpowersDenyEntry));
|
|
248
|
+
/**
|
|
249
|
+
* Merge the peaks-managed Skill denylist into the existing settings object.
|
|
250
|
+
* Preserves every other `permissions.deny` entry the user (or another tool)
|
|
251
|
+
* has written so the install is additive, not destructive. The output is
|
|
252
|
+
* always deterministic: the same input always yields the same output,
|
|
253
|
+
* regardless of insertion order in the source array.
|
|
254
|
+
*
|
|
255
|
+
* Defensive behavior:
|
|
256
|
+
* - `settings.permissions` is missing or non-object → install creates a
|
|
257
|
+
* fresh `permissions: { deny: [...our entries] }` object.
|
|
258
|
+
* - `settings.permissions.deny` is missing or non-array → install replaces
|
|
259
|
+
* the field with a fresh array containing only our entries.
|
|
260
|
+
* - Duplicate entries (any source) are collapsed to one via `new Set`.
|
|
261
|
+
*
|
|
262
|
+
* The function is pure: it does not mutate the input. Atomic write happens
|
|
263
|
+
* at the call site (`applyHookInstall`).
|
|
264
|
+
*/
|
|
265
|
+
export function withSuperpowersSkillDenylist(settings) {
|
|
266
|
+
const ourEntries = SUPERPOWERS_DENIED_SKILLS.map(formatSuperpowersDenyEntry);
|
|
267
|
+
const permissions = (settings.permissions && typeof settings.permissions === 'object' && !Array.isArray(settings.permissions))
|
|
268
|
+
? settings.permissions
|
|
269
|
+
: {};
|
|
270
|
+
const existingDeny = Array.isArray(permissions.deny)
|
|
271
|
+
? permissions.deny.filter((d) => typeof d === 'string')
|
|
272
|
+
: [];
|
|
273
|
+
const otherDeny = existingDeny.filter((d) => !SUPERPOWERS_DENY_SENTINELS.has(d));
|
|
274
|
+
const finalDeny = [...new Set([...otherDeny, ...ourEntries])];
|
|
275
|
+
return {
|
|
276
|
+
...settings,
|
|
277
|
+
permissions: { ...permissions, deny: finalDeny }
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Inverse of `withSuperpowersSkillDenylist`. Removes every peaks-managed
|
|
282
|
+
* `UseSkill(...)` entry from the deny list. If the resulting deny list is
|
|
283
|
+
* empty, the `deny` field itself is deleted; if the `permissions` object
|
|
284
|
+
* becomes empty, the `permissions` field itself is deleted. This is the
|
|
285
|
+
* uninstall path: every field we wrote must be removed exactly, and no
|
|
286
|
+
* other field may be touched.
|
|
287
|
+
*
|
|
288
|
+
* Pure (no mutation).
|
|
289
|
+
*/
|
|
290
|
+
export function withoutSuperpowersSkillDenylist(settings) {
|
|
291
|
+
const permissions = (settings.permissions && typeof settings.permissions === 'object' && !Array.isArray(settings.permissions))
|
|
292
|
+
? settings.permissions
|
|
293
|
+
: {};
|
|
294
|
+
if (!Array.isArray(permissions.deny)) {
|
|
295
|
+
return settings;
|
|
296
|
+
}
|
|
297
|
+
const remainingDeny = permissions.deny
|
|
298
|
+
.filter((d) => typeof d === 'string')
|
|
299
|
+
.filter((d) => !SUPERPOWERS_DENY_SENTINELS.has(d));
|
|
300
|
+
const nextPermissions = { ...permissions };
|
|
301
|
+
if (remainingDeny.length > 0) {
|
|
302
|
+
nextPermissions.deny = remainingDeny;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
delete nextPermissions.deny;
|
|
306
|
+
}
|
|
307
|
+
if (Object.keys(nextPermissions).length === 0) {
|
|
308
|
+
// The whole `permissions` object is empty (no deny, no allow, no other
|
|
309
|
+
// sub-fields). Drop it to avoid leaving an empty object on disk.
|
|
310
|
+
const { permissions: _omit, ...rest } = settings;
|
|
311
|
+
return rest;
|
|
312
|
+
}
|
|
313
|
+
return { ...settings, permissions: nextPermissions };
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Read-only introspection. Returns the deny entries that `peaks hooks
|
|
317
|
+
* install` would write today. Useful for `peaks hooks status` and the
|
|
318
|
+
* dry-run envelope.
|
|
319
|
+
*/
|
|
320
|
+
export function listSuperpowersDenyEntries() {
|
|
321
|
+
return SUPERPOWERS_DENIED_SKILLS.map(formatSuperpowersDenyEntry);
|
|
322
|
+
}
|
|
203
323
|
/** Default (claude-code) peaks-managed hook entries — kept as a stable export for tests. Slice #014: only the gate-enforce entry. */
|
|
204
324
|
export const PEAKS_HOOK_ENTRIES = (() => {
|
|
205
325
|
const spec = resolveHookSpec('claude-code');
|
|
@@ -341,7 +461,21 @@ export function applyHookInstall(scope, projectRoot, options) {
|
|
|
341
461
|
if (baseResult.alreadyInstalled) {
|
|
342
462
|
return { ...baseResult, applied: false };
|
|
343
463
|
}
|
|
344
|
-
|
|
464
|
+
// Slice 2026-07-29-worktree-layer3-deny: Layer 3 — write the
|
|
465
|
+
// `permissions.deny` block alongside the gate hook in a single atomic
|
|
466
|
+
// write so the two halves of the install are always co-located. The
|
|
467
|
+
// helper is idempotent and additive: any user-written deny entries
|
|
468
|
+
// are preserved.
|
|
469
|
+
//
|
|
470
|
+
// Slice 2026-07-29-worktree-l2-extended Part 29: also apply
|
|
471
|
+
// withTriggeredDenyList. If the existing settings file has a
|
|
472
|
+
// superpowers / git-worktree / podman-run entry (any source),
|
|
473
|
+
// the install appends a defensive `Edit(deny-trigger:<phrase>)`
|
|
474
|
+
// entry. The chain cannot run raw `git worktree add` (or
|
|
475
|
+
// `podman run`) without an explicit `peaks hooks uninstall`
|
|
476
|
+
// first. Both helpers are pure + idempotent.
|
|
477
|
+
const merged = withTriggeredDenyList(withSuperpowersSkillDenylist(withHooksInstalledForIde(settings, ide)));
|
|
478
|
+
atomicWriteJson(settingsPath, merged);
|
|
345
479
|
return { ...baseResult, alreadyInstalled: false, applied: true };
|
|
346
480
|
}
|
|
347
481
|
export function removeHookInstall(scope, projectRoot, options) {
|
|
@@ -382,7 +516,17 @@ export function removeHookInstall(scope, projectRoot, options) {
|
|
|
382
516
|
else {
|
|
383
517
|
delete nextSettings.hooks;
|
|
384
518
|
}
|
|
385
|
-
|
|
519
|
+
// Slice 2026-07-29-worktree-layer3-deny: Layer 3 — symmetric uninstall.
|
|
520
|
+
// Strips the peaks-managed `UseSkill(...)` deny entries alongside the
|
|
521
|
+
// hook entries; user-written entries are untouched. The helper self-
|
|
522
|
+
// decomposes an empty `permissions` object.
|
|
523
|
+
//
|
|
524
|
+
// Slice 2026-07-29-worktree-l2-extended Part 29: also strip the
|
|
525
|
+
// trigger-style deny entries via withoutTriggeredDenyList. The
|
|
526
|
+
// chain of helpers is order-independent (each is idempotent and
|
|
527
|
+
// additive over the same set of peaks-managed entries).
|
|
528
|
+
const finalSettings = withoutTriggeredDenyList(withoutSuperpowersSkillDenylist(nextSettings));
|
|
529
|
+
atomicWriteJson(settingsPath, finalSettings);
|
|
386
530
|
return { scope, settingsPath, removed: removedAny };
|
|
387
531
|
}
|
|
388
532
|
export function readHookStatus(scope, projectRoot, options) {
|
|
@@ -394,3 +538,87 @@ export function readHookStatus(scope, projectRoot, options) {
|
|
|
394
538
|
const settings = exists ? readJsonObjectFile(settingsPath) : {};
|
|
395
539
|
return { scope, settingsPath, exists, installed: isInstalledForIde(settings, ide) };
|
|
396
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* Slice 2026-07-29-worktree-l2-extended Part 27 — trigger-style deny.
|
|
543
|
+
*
|
|
544
|
+
* In addition to the static SUPERPOWERS_DENIED_SKILLS list, peaks
|
|
545
|
+
* scans the existing settings file for "trigger phrases" that
|
|
546
|
+
* indicate the user has configured the superpowers chain (or
|
|
547
|
+
* any other auto-run worktree-creating tool) and appends a
|
|
548
|
+
* defensive deny to prevent the chain from running raw
|
|
549
|
+
* `git worktree add` (or `podman run`) directly.
|
|
550
|
+
*
|
|
551
|
+
* Triggers detected (substring match on the existing
|
|
552
|
+
* permissions.deny / permissions.allow list):
|
|
553
|
+
*
|
|
554
|
+
* - `superpowers:using-git-worktrees` — the chain's ground zero
|
|
555
|
+
* - `superpowers:brainstorming` etc. — the upstream skill
|
|
556
|
+
* - `Bash(git worktree add` — the user has explicitly
|
|
557
|
+
* allowed raw git worktree, which our L2 lease-aware gate
|
|
558
|
+
* would also intercept (defense in depth)
|
|
559
|
+
*
|
|
560
|
+
* Append-only — never replaces, never re-orders, never removes
|
|
561
|
+
* existing entries. Idempotent: re-running the install with
|
|
562
|
+
* the same input yields the same output.
|
|
563
|
+
*/
|
|
564
|
+
export const TRIGGER_PHRASES = Object.freeze([
|
|
565
|
+
'superpowers:using-git-worktrees',
|
|
566
|
+
'superpowers:brainstorming',
|
|
567
|
+
'superpowers:writing-plans',
|
|
568
|
+
'superpowers:subagent-driven-development',
|
|
569
|
+
'Bash(git worktree add',
|
|
570
|
+
'Bash(podman run'
|
|
571
|
+
]);
|
|
572
|
+
/**
|
|
573
|
+
* Format a trigger-phrase into a stable `Edit` deny entry. We deny
|
|
574
|
+
* `Edit` (not `Bash`) on the *settings file* itself, so the
|
|
575
|
+
* user cannot edit the trigger away without an explicit
|
|
576
|
+
* `peaks hooks uninstall` first. The skill name (when
|
|
577
|
+
* applicable) is the value after the colon.
|
|
578
|
+
*/
|
|
579
|
+
function formatTriggerDenyEntry(phrase) {
|
|
580
|
+
return `Edit(deny-trigger:${phrase})`;
|
|
581
|
+
}
|
|
582
|
+
export function withTriggeredDenyList(settings) {
|
|
583
|
+
const existingDeny = Array.isArray(settings.permissions?.deny)
|
|
584
|
+
? (settings.permissions.deny
|
|
585
|
+
.filter((d) => typeof d === 'string'))
|
|
586
|
+
: [];
|
|
587
|
+
// Detect triggers in the existing allow + deny lists.
|
|
588
|
+
const existingAllow = Array.isArray(settings.permissions?.allow)
|
|
589
|
+
? (settings.permissions.allow
|
|
590
|
+
.filter((d) => typeof d === 'string'))
|
|
591
|
+
: [];
|
|
592
|
+
const haystack = [...existingDeny, ...existingAllow].join('|');
|
|
593
|
+
const triggered = TRIGGER_PHRASES.filter((p) => haystack.includes(p));
|
|
594
|
+
if (triggered.length === 0)
|
|
595
|
+
return settings;
|
|
596
|
+
const triggeredEntries = triggered.map(formatTriggerDenyEntry);
|
|
597
|
+
const permissions = (settings.permissions && typeof settings.permissions === 'object' && !Array.isArray(settings.permissions))
|
|
598
|
+
? settings.permissions
|
|
599
|
+
: {};
|
|
600
|
+
const otherDeny = existingDeny.filter((d) => !triggeredEntries.includes(d));
|
|
601
|
+
return {
|
|
602
|
+
...settings,
|
|
603
|
+
permissions: { ...permissions, deny: [...new Set([...otherDeny, ...triggeredEntries])] }
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
/** Inverse of withTriggeredDenyList: strip every deny-trigger entry. */
|
|
607
|
+
export function withoutTriggeredDenyList(settings) {
|
|
608
|
+
const permissions = (settings.permissions && typeof settings.permissions === 'object' && !Array.isArray(settings.permissions))
|
|
609
|
+
? settings.permissions
|
|
610
|
+
: {};
|
|
611
|
+
const existingDeny = Array.isArray(permissions.deny)
|
|
612
|
+
? permissions.deny.filter((d) => typeof d === 'string')
|
|
613
|
+
: [];
|
|
614
|
+
const kept = existingDeny.filter((d) => !d.startsWith('Edit(deny-trigger:'));
|
|
615
|
+
const next = { ...permissions, deny: kept };
|
|
616
|
+
if (kept.length === 0)
|
|
617
|
+
delete next.deny;
|
|
618
|
+
if (Object.keys(next).length === 0) {
|
|
619
|
+
const out = { ...settings };
|
|
620
|
+
delete out.permissions;
|
|
621
|
+
return out;
|
|
622
|
+
}
|
|
623
|
+
return { ...settings, permissions: next };
|
|
624
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import { listDirectories, pathExists, readText } from '
|
|
2
|
+
import { listDirectories, pathExists, readText } from 'peaks-loop-shared/fs';
|
|
3
3
|
import { parseFrontmatter } from '../../shared/frontmatter.js';
|
|
4
|
-
import { skillsDir } from '
|
|
4
|
+
import { skillsDir } from 'peaks-loop-shared/paths';
|
|
5
5
|
function getLoadFailureMessage(error) {
|
|
6
6
|
return error instanceof Error ? error.message : 'Unable to parse skill metadata';
|
|
7
7
|
}
|
|
@@ -31,7 +31,8 @@ export async function loadSkillRegistry(baseDir = skillsDir) {
|
|
|
31
31
|
name: frontmatter.name,
|
|
32
32
|
description: frontmatter.description,
|
|
33
33
|
directory: subDir,
|
|
34
|
-
skillPath
|
|
34
|
+
skillPath,
|
|
35
|
+
...(frontmatter.visibility !== undefined ? { visibility: frontmatter.visibility } : {})
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
catch (error) {
|
|
@@ -50,7 +51,8 @@ export async function loadSkillRegistry(baseDir = skillsDir) {
|
|
|
50
51
|
name: frontmatter.name,
|
|
51
52
|
description: frontmatter.description,
|
|
52
53
|
directory,
|
|
53
|
-
skillPath
|
|
54
|
+
skillPath,
|
|
55
|
+
...(frontmatter.visibility !== undefined ? { visibility: frontmatter.visibility } : {})
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
catch (error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dirname, join } from 'node:path';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import { readText } from '
|
|
3
|
+
import { readText } from 'peaks-loop-shared/fs';
|
|
4
4
|
import { loadSkillRegistry } from './skill-registry.js';
|
|
5
5
|
const DESTRUCTIVE_APPLY_PATTERNS = [
|
|
6
6
|
/peaks\s+memory\s+sync[^\n]*--apply/,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
2
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { isDirectory } from '
|
|
4
|
+
import { isDirectory } from 'peaks-loop-shared/fs';
|
|
5
5
|
// Slice 2026-06-29-change-id-root-removal: `getCurrentChangeId` was
|
|
6
6
|
// removed with the change-id axis. Slice check resolves the rid from
|
|
7
7
|
// `options.rid` only; the binding file at `.peaks/_runtime/current-change`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type MainSessionMonitorBanInput = {
|
|
2
|
+
readonly tool_name?: string;
|
|
3
|
+
readonly tool_input?: {
|
|
4
|
+
readonly file_path?: string;
|
|
5
|
+
readonly content?: string;
|
|
6
|
+
readonly new_string?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type MainSessionMonitorBanDecision = {
|
|
10
|
+
readonly allowed: boolean;
|
|
11
|
+
readonly reason?: string;
|
|
12
|
+
};
|
|
13
|
+
/** Reject Edit/Write calls that introduce a new import of the legacy monitor. */
|
|
14
|
+
export declare function checkMainSessionMonitorImport(input: MainSessionMonitorBanInput): MainSessionMonitorBanDecision;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const FORBIDDEN_IMPORT = /import\s*\{[^}]*\b(?:detectIdeFromEnv|IdeKind|IDE_KINDS|isIdeKind)\b[^}]*\}\s*from\s*['"][^'"]*main-session-monitor(?:\.js)?['"]/;
|
|
2
|
+
/** Reject Edit/Write calls that introduce a new import of the legacy monitor. */
|
|
3
|
+
export function checkMainSessionMonitorImport(input) {
|
|
4
|
+
if (input.tool_name !== 'Edit' && input.tool_name !== 'Write') {
|
|
5
|
+
return { allowed: true };
|
|
6
|
+
}
|
|
7
|
+
const filePath = input.tool_input?.file_path;
|
|
8
|
+
if (!filePath || /(?:^|[\\/])main-session-monitor\.ts$/.test(filePath)) {
|
|
9
|
+
return { allowed: true };
|
|
10
|
+
}
|
|
11
|
+
const candidate = input.tool_input?.new_string ?? input.tool_input?.content ?? '';
|
|
12
|
+
if (!FORBIDDEN_IMPORT.test(candidate)) {
|
|
13
|
+
return { allowed: true };
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
allowed: false,
|
|
17
|
+
reason: 'Import IDE detection from services/context/ide-detect.ts; main-session-monitor.ts is legacy-only.'
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -42,6 +42,31 @@ export type MissingProjectStandardsDiagnostic = {
|
|
|
42
42
|
readonly remediation: string;
|
|
43
43
|
readonly language: StandardsLanguage;
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* List which standards tree components are missing vs populated.
|
|
47
|
+
*
|
|
48
|
+
* Returns one of three stable shapes:
|
|
49
|
+
* - { kind: 'complete' } — both common + language overlay populated
|
|
50
|
+
* - { kind: 'common-missing' } — common dir absent/empty (universal)
|
|
51
|
+
* - { kind: 'language-missing', language } — common ok, language overlay absent/empty
|
|
52
|
+
*
|
|
53
|
+
* The detector previously returned a single boolean that flipped to
|
|
54
|
+
* "missing: true" the moment the language overlay was empty, but printed
|
|
55
|
+
* the remediation as if BOTH common AND language were missing — a UX bug
|
|
56
|
+
* that surfaced in ice-cola (common=4 .md files; typescript=1 .md file;
|
|
57
|
+
* javascript overlay absent → label said "no project-local standards found"
|
|
58
|
+
* even though common was clearly populated). This split lets the CLI emit
|
|
59
|
+
* a precise remediation string per kind.
|
|
60
|
+
*/
|
|
61
|
+
export type StandardsTreeDiagnostic = {
|
|
62
|
+
readonly kind: 'complete';
|
|
63
|
+
} | {
|
|
64
|
+
readonly kind: 'common-missing';
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: 'language-missing';
|
|
67
|
+
readonly language: StandardsLanguage;
|
|
68
|
+
};
|
|
69
|
+
export declare function diagnoseStandardsTree(projectRoot: string, language: StandardsLanguage): StandardsTreeDiagnostic;
|
|
45
70
|
/**
|
|
46
71
|
* Detect whether a consumer project's `.peaks/standards/` tree (2.0
|
|
47
72
|
* canonical) is missing or empty.
|
|
@@ -62,6 +62,26 @@ function hasPopulatedMarkdown(dir) {
|
|
|
62
62
|
const entries = readdirSync(dir);
|
|
63
63
|
return entries.some((entry) => entry.toLowerCase().endsWith('.md'));
|
|
64
64
|
}
|
|
65
|
+
export function diagnoseStandardsTree(projectRoot, language) {
|
|
66
|
+
if (!SUPPORTED_LANGUAGES.has(language)) {
|
|
67
|
+
throw new Error(`Unsupported standards language: ${String(language)}`);
|
|
68
|
+
}
|
|
69
|
+
const normalizedRoot = normalizeProjectRoot(projectRoot);
|
|
70
|
+
const commonDir = join(normalizedRoot, '.peaks', 'standards', 'common');
|
|
71
|
+
const languageDir = language === 'generic'
|
|
72
|
+
? null
|
|
73
|
+
: join(normalizedRoot, '.peaks', 'standards', language);
|
|
74
|
+
const commonOk = hasPopulatedMarkdown(commonDir);
|
|
75
|
+
const languageOk = languageDir === null ? true : hasPopulatedMarkdown(languageDir);
|
|
76
|
+
if (commonOk && languageOk) {
|
|
77
|
+
return { kind: 'complete' };
|
|
78
|
+
}
|
|
79
|
+
if (!commonOk) {
|
|
80
|
+
return { kind: 'common-missing' };
|
|
81
|
+
}
|
|
82
|
+
// common ok, language overlay empty/missing
|
|
83
|
+
return { kind: 'language-missing', language };
|
|
84
|
+
}
|
|
65
85
|
/**
|
|
66
86
|
* Detect whether a consumer project's `.peaks/standards/` tree (2.0
|
|
67
87
|
* canonical) is missing or empty.
|
|
@@ -84,18 +104,29 @@ export function detectMissingProjectStandards(projectRoot, language) {
|
|
|
84
104
|
}
|
|
85
105
|
const normalizedRoot = normalizeProjectRoot(projectRoot);
|
|
86
106
|
const renderedPath = renderForPlatform(normalizedRoot);
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
const diagnostic = diagnoseStandardsTree(projectRoot, language);
|
|
108
|
+
// Bug-01 fix (ice-cola surface check 2026-07-22): the previous
|
|
109
|
+
// remediation said "no project-local standards found" whenever EITHER
|
|
110
|
+
// common or the language overlay was empty, which misrepresented
|
|
111
|
+
// projects that have common populated but a missing language overlay
|
|
112
|
+
// (e.g. ice-cola has common/*.md + typescript/coding-style.md but no
|
|
113
|
+
// javascript/coding-style.md). The remediation now distinguishes the
|
|
114
|
+
// three kinds so the operator gets a precise hint.
|
|
115
|
+
let missing;
|
|
116
|
+
let remediation;
|
|
117
|
+
if (diagnostic.kind === 'complete') {
|
|
118
|
+
missing = false;
|
|
119
|
+
remediation = `Project-local standards already present at ${renderedPath}. Re-run \`peaks standards init --project ${normalizedRoot} --apply\` to refresh from the curated baseline.`;
|
|
120
|
+
}
|
|
121
|
+
else if (diagnostic.kind === 'common-missing') {
|
|
122
|
+
missing = true;
|
|
123
|
+
remediation = `⚠ no project-local common standards at ${renderedPath} — run \`peaks standards init --project ${normalizedRoot} --apply\` to scaffold (language: ${language}), or pass --init-standards to peaks workspace init for one-shot auto-apply.`;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
missing = true;
|
|
127
|
+
const overlayName = diagnostic.language;
|
|
128
|
+
remediation = `⚠ common standards present at ${renderedPath}\\common but ${overlayName} language overlay is missing — run \`peaks standards init --project ${normalizedRoot} --apply\` to scaffold the ${overlayName} overlay (or pass --init-standards to peaks workspace init for one-shot auto-apply).`;
|
|
129
|
+
}
|
|
99
130
|
return {
|
|
100
131
|
missing,
|
|
101
132
|
path: renderedPath,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tech-change-id-service — change-id-axis slice of the tech planner (rid-012).
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* The original `peaks tech plan` / `peaks tech status` (in `tech-service.ts`)
|
|
6
|
+
* is keyed by an active session id (the change-id axis was removed in
|
|
7
|
+
* v2.19.0). This module provides the *consumer-side wiring* that lets the
|
|
8
|
+
* same CLI surface be re-keyed by an explicit `--change-id <id>` for the
|
|
9
|
+
* OpenSpec / change-driven workflow. The path math, change-id validation,
|
|
10
|
+
* and workspace-unavailable response are all delegated to the rid-009
|
|
11
|
+
* helpers in `src/services/openspec/artifact-boundary.ts`.
|
|
12
|
+
*
|
|
13
|
+
* Style:
|
|
14
|
+
* - Named function exports (matches `artifact-boundary.ts`).
|
|
15
|
+
* - Hand-rolled `Result<T, E>` unions — no `neverthrow` dep.
|
|
16
|
+
* - Pure path math; never reads the filesystem.
|
|
17
|
+
*
|
|
18
|
+
* Hard ban:
|
|
19
|
+
* - This file MUST NOT import from `peaks-loop-shared` (stays inside
|
|
20
|
+
* peaks-loop per §9 of the rid-012 plan).
|
|
21
|
+
* - This file MUST NOT touch `src/services/openspec/artifact-boundary.ts`
|
|
22
|
+
* (rid-009 helpers are frozen; we only consume via import).
|
|
23
|
+
*/
|
|
24
|
+
import type { WorkspaceConfig } from '../config/config-types.js';
|
|
25
|
+
import { type BoundaryError, type ChangeIdError, type PlanArtifactPathOutput, type WorkspaceUnavailableResponse, type Result } from '../openspec/artifact-boundary.js';
|
|
26
|
+
export type TechArtifactPathResult = PlanArtifactPathOutput;
|
|
27
|
+
export type TechChangeArtifacts = {
|
|
28
|
+
taskGraph: TechArtifactPathResult;
|
|
29
|
+
waveManifests: TechArtifactPathResult[];
|
|
30
|
+
reviewChecklist: TechArtifactPathResult;
|
|
31
|
+
approvalTemplate: TechArtifactPathResult;
|
|
32
|
+
};
|
|
33
|
+
export type TechChangeStatusValue = 'unavailable' | 'missing' | 'blocked' | 'approved';
|
|
34
|
+
export type TechChangeStatus = {
|
|
35
|
+
changeId: string;
|
|
36
|
+
status: TechChangeStatusValue;
|
|
37
|
+
artifactRoot: string;
|
|
38
|
+
requiredArtifacts: string[];
|
|
39
|
+
missingArtifacts: string[];
|
|
40
|
+
approvalRecord: string | null;
|
|
41
|
+
blockedReasons: string[];
|
|
42
|
+
nextActions: string[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Validate a change-id string. This is a thin consumer-side wrapper that
|
|
46
|
+
* delegates to `validateChangeId` (rid-009). The wrapper exists so the
|
|
47
|
+
* change-id-axis service has a single named export point (`validateTechChangeId`)
|
|
48
|
+
* and so the test file can import it without reaching across to openspec.
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateTechChangeId(id: string): Result<{
|
|
51
|
+
changeId: string;
|
|
52
|
+
}, ChangeIdError>;
|
|
53
|
+
/**
|
|
54
|
+
* Plan the 5 artifact-relative paths the tech-change-id planner needs to
|
|
55
|
+
* expose:
|
|
56
|
+
* - `taskGraph` → `<id>/architecture/tech-task-graph.json`
|
|
57
|
+
* - `waveManifests` → `<id>/architecture/waves/wave-<n>-<wave>.json` (4)
|
|
58
|
+
* - `reviewChecklist` → `<id>/architecture/tech-review-checklist.md`
|
|
59
|
+
* - `approvalTemplate` → `<id>/architecture/tech-approval-record.template.md`
|
|
60
|
+
*
|
|
61
|
+
* Delegates to `planArtifactPath` (rid-009) for each one. Returns the FIRST
|
|
62
|
+
* failure (so callers get a single, deterministic BoundaryError).
|
|
63
|
+
*
|
|
64
|
+
* Pure path math — does not touch the filesystem.
|
|
65
|
+
*/
|
|
66
|
+
export declare function planTechArtifactPath(input: {
|
|
67
|
+
changeId: string;
|
|
68
|
+
workspaceRoot: string;
|
|
69
|
+
requestId: string;
|
|
70
|
+
}): Result<TechChangeArtifacts, BoundaryError>;
|
|
71
|
+
/**
|
|
72
|
+
* Build the workspace-unavailable response for the change-id-axis tech
|
|
73
|
+
* planner. Thin wrapper around `buildWorkspaceUnavailable` (rid-009) so
|
|
74
|
+
* the same single source of truth (nextActions constant) is reused.
|
|
75
|
+
*
|
|
76
|
+
* The `mode` discriminator matches the existing artifact-boundary shape
|
|
77
|
+
* (`'preview-only' | 'blocked'`).
|
|
78
|
+
*/
|
|
79
|
+
export declare function buildTechWorkspaceUnavailable(input: {
|
|
80
|
+
mode: WorkspaceUnavailableResponse['mode'];
|
|
81
|
+
}): WorkspaceUnavailableResponse;
|
|
82
|
+
export type { WorkspaceConfig };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tech-change-id-service — change-id-axis slice of the tech planner (rid-012).
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* The original `peaks tech plan` / `peaks tech status` (in `tech-service.ts`)
|
|
6
|
+
* is keyed by an active session id (the change-id axis was removed in
|
|
7
|
+
* v2.19.0). This module provides the *consumer-side wiring* that lets the
|
|
8
|
+
* same CLI surface be re-keyed by an explicit `--change-id <id>` for the
|
|
9
|
+
* OpenSpec / change-driven workflow. The path math, change-id validation,
|
|
10
|
+
* and workspace-unavailable response are all delegated to the rid-009
|
|
11
|
+
* helpers in `src/services/openspec/artifact-boundary.ts`.
|
|
12
|
+
*
|
|
13
|
+
* Style:
|
|
14
|
+
* - Named function exports (matches `artifact-boundary.ts`).
|
|
15
|
+
* - Hand-rolled `Result<T, E>` unions — no `neverthrow` dep.
|
|
16
|
+
* - Pure path math; never reads the filesystem.
|
|
17
|
+
*
|
|
18
|
+
* Hard ban:
|
|
19
|
+
* - This file MUST NOT import from `peaks-loop-shared` (stays inside
|
|
20
|
+
* peaks-loop per §9 of the rid-012 plan).
|
|
21
|
+
* - This file MUST NOT touch `src/services/openspec/artifact-boundary.ts`
|
|
22
|
+
* (rid-009 helpers are frozen; we only consume via import).
|
|
23
|
+
*/
|
|
24
|
+
import { buildWorkspaceUnavailable, planArtifactPath, validateChangeId, } from '../openspec/artifact-boundary.js';
|
|
25
|
+
/**
|
|
26
|
+
* Wave template names — must match the 4 waves the existing
|
|
27
|
+
* `tech-service.ts#createTechGraph` produces (scan / document / review /
|
|
28
|
+
* reducer). The relative path layout follows `design.md §Artifact Layout`
|
|
29
|
+
* verbatim: `<change-id>/architecture/waves/wave-<index>-<wave>.json`.
|
|
30
|
+
*/
|
|
31
|
+
const TECH_CHANGE_ID_WAVES = ['scan', 'document', 'review', 'reducer'];
|
|
32
|
+
const TECH_ARCHITECTURE_ROOT = '<changeId>/architecture';
|
|
33
|
+
/**
|
|
34
|
+
* Validate a change-id string. This is a thin consumer-side wrapper that
|
|
35
|
+
* delegates to `validateChangeId` (rid-009). The wrapper exists so the
|
|
36
|
+
* change-id-axis service has a single named export point (`validateTechChangeId`)
|
|
37
|
+
* and so the test file can import it without reaching across to openspec.
|
|
38
|
+
*/
|
|
39
|
+
export function validateTechChangeId(id) {
|
|
40
|
+
return validateChangeId(id);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Plan the 5 artifact-relative paths the tech-change-id planner needs to
|
|
44
|
+
* expose:
|
|
45
|
+
* - `taskGraph` → `<id>/architecture/tech-task-graph.json`
|
|
46
|
+
* - `waveManifests` → `<id>/architecture/waves/wave-<n>-<wave>.json` (4)
|
|
47
|
+
* - `reviewChecklist` → `<id>/architecture/tech-review-checklist.md`
|
|
48
|
+
* - `approvalTemplate` → `<id>/architecture/tech-approval-record.template.md`
|
|
49
|
+
*
|
|
50
|
+
* Delegates to `planArtifactPath` (rid-009) for each one. Returns the FIRST
|
|
51
|
+
* failure (so callers get a single, deterministic BoundaryError).
|
|
52
|
+
*
|
|
53
|
+
* Pure path math — does not touch the filesystem.
|
|
54
|
+
*/
|
|
55
|
+
export function planTechArtifactPath(input) {
|
|
56
|
+
const taskGraphResult = planArtifactPath({
|
|
57
|
+
changeId: input.changeId,
|
|
58
|
+
workspaceRoot: input.workspaceRoot,
|
|
59
|
+
role: 'architecture',
|
|
60
|
+
requestId: input.requestId,
|
|
61
|
+
template: `${TECH_ARCHITECTURE_ROOT}/tech-task-graph.json`,
|
|
62
|
+
});
|
|
63
|
+
if (!taskGraphResult.ok)
|
|
64
|
+
return taskGraphResult;
|
|
65
|
+
const waveManifestResults = [];
|
|
66
|
+
for (let index = 0; index < TECH_CHANGE_ID_WAVES.length; index += 1) {
|
|
67
|
+
const wave = TECH_CHANGE_ID_WAVES[index];
|
|
68
|
+
const waveResult = planArtifactPath({
|
|
69
|
+
changeId: input.changeId,
|
|
70
|
+
workspaceRoot: input.workspaceRoot,
|
|
71
|
+
role: 'architecture',
|
|
72
|
+
requestId: input.requestId,
|
|
73
|
+
template: `${TECH_ARCHITECTURE_ROOT}/waves/wave-${index + 1}-${wave}.json`,
|
|
74
|
+
});
|
|
75
|
+
if (!waveResult.ok)
|
|
76
|
+
return waveResult;
|
|
77
|
+
waveManifestResults.push(waveResult.value);
|
|
78
|
+
}
|
|
79
|
+
const reviewChecklistResult = planArtifactPath({
|
|
80
|
+
changeId: input.changeId,
|
|
81
|
+
workspaceRoot: input.workspaceRoot,
|
|
82
|
+
role: 'architecture',
|
|
83
|
+
requestId: input.requestId,
|
|
84
|
+
template: `${TECH_ARCHITECTURE_ROOT}/tech-review-checklist.md`,
|
|
85
|
+
});
|
|
86
|
+
if (!reviewChecklistResult.ok)
|
|
87
|
+
return reviewChecklistResult;
|
|
88
|
+
const approvalTemplateResult = planArtifactPath({
|
|
89
|
+
changeId: input.changeId,
|
|
90
|
+
workspaceRoot: input.workspaceRoot,
|
|
91
|
+
role: 'architecture',
|
|
92
|
+
requestId: input.requestId,
|
|
93
|
+
template: `${TECH_ARCHITECTURE_ROOT}/tech-approval-record.template.md`,
|
|
94
|
+
});
|
|
95
|
+
if (!approvalTemplateResult.ok)
|
|
96
|
+
return approvalTemplateResult;
|
|
97
|
+
return {
|
|
98
|
+
ok: true,
|
|
99
|
+
value: {
|
|
100
|
+
taskGraph: taskGraphResult.value,
|
|
101
|
+
waveManifests: waveManifestResults,
|
|
102
|
+
reviewChecklist: reviewChecklistResult.value,
|
|
103
|
+
approvalTemplate: approvalTemplateResult.value,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Build the workspace-unavailable response for the change-id-axis tech
|
|
109
|
+
* planner. Thin wrapper around `buildWorkspaceUnavailable` (rid-009) so
|
|
110
|
+
* the same single source of truth (nextActions constant) is reused.
|
|
111
|
+
*
|
|
112
|
+
* The `mode` discriminator matches the existing artifact-boundary shape
|
|
113
|
+
* (`'preview-only' | 'blocked'`).
|
|
114
|
+
*/
|
|
115
|
+
export function buildTechWorkspaceUnavailable(input) {
|
|
116
|
+
return buildWorkspaceUnavailable(input);
|
|
117
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCodegraphInvocation, executeCodegraphInvocation } from '../codegraph/codegraph-service.js';
|
|
2
2
|
import { scanUnderstandAnything, summarizeKnowledgeGraph } from './understand-scan-service.js';
|
|
3
|
-
import { getErrorMessage } from '
|
|
3
|
+
import { getErrorMessage } from 'peaks-loop-shared/result';
|
|
4
4
|
const DEFAULT_FILES = ['src/index.ts', 'package.json', 'README.md'];
|
|
5
5
|
function resolveFiles(files) {
|
|
6
6
|
if (files !== undefined && files.length > 0) {
|