harnery 0.40.0 → 0.42.0
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/README.md +1 -1
- package/dist/commander.js +4 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +34 -20
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +113 -12
- package/dist/commands/browse-ai.d.ts.map +1 -1
- package/dist/commands/browse-ai.js +4 -0
- package/dist/commands/browse.d.ts +164 -0
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +388 -45
- package/dist/commands/checkpoint.js +8 -12
- package/dist/commands/claude-desktop.d.ts.map +1 -1
- package/dist/commands/claude-desktop.js +52 -0
- package/dist/commands/deinit.d.ts +1 -1
- package/dist/commands/deinit.d.ts.map +1 -1
- package/dist/commands/deinit.js +8 -4
- package/dist/commands/disk.d.ts +6 -0
- package/dist/commands/disk.d.ts.map +1 -0
- package/dist/commands/disk.js +80 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +2 -0
- package/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +58 -3
- package/dist/commands/fetch.d.ts.map +1 -1
- package/dist/commands/fetch.js +10 -0
- package/dist/commands/files.d.ts +16 -0
- package/dist/commands/files.d.ts.map +1 -1
- package/dist/commands/files.js +54 -2
- package/dist/commands/init.d.ts +21 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +271 -109
- package/dist/commands/instructions.js +5 -4
- package/dist/commands/ledger-v3.d.ts.map +1 -1
- package/dist/commands/ledger-v3.js +2 -1
- package/dist/commands/rm.d.ts +4 -0
- package/dist/commands/rm.d.ts.map +1 -0
- package/dist/commands/rm.js +87 -0
- package/dist/commands/servers.d.ts +7 -0
- package/dist/commands/servers.d.ts.map +1 -0
- package/dist/commands/servers.js +394 -0
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +82 -2
- package/dist/commands/webview.d.ts +4 -0
- package/dist/commands/webview.d.ts.map +1 -0
- package/dist/commands/webview.js +94 -0
- package/dist/core/adapter.d.ts +50 -1
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +59 -1
- package/dist/core/adapters/attestation.d.ts.map +1 -1
- package/dist/core/adapters/attestation.js +3 -2
- package/dist/core/adapters/profiles.d.ts +29 -3
- package/dist/core/adapters/profiles.d.ts.map +1 -1
- package/dist/core/adapters/profiles.js +53 -1
- package/dist/core/adapters/registry.d.ts.map +1 -1
- package/dist/core/adapters/registry.js +33 -0
- package/dist/core/adapters/types.d.ts +9 -0
- package/dist/core/adapters/types.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.d.ts +1 -1
- package/dist/core/agents/canonical-emit.d.ts.map +1 -1
- package/dist/core/agents/canonical-emit.js +2 -7
- package/dist/core/agents/cli.js +25 -16
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +7 -2
- package/dist/core/agents/render/session-context.d.ts.map +1 -1
- package/dist/core/agents/render/session-context.js +2 -0
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/claim-conflict.js +3 -9
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -1
- package/dist/core/agents/rules/commit-conflict.js +2 -8
- package/dist/core/agents/rules/stop-hook.d.ts +2 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
- package/dist/core/agents/rules/stop-hook.js +1 -1
- package/dist/core/agents/session-events.d.ts +6 -2
- package/dist/core/agents/session-events.d.ts.map +1 -1
- package/dist/core/agents/session-events.js +105 -26
- package/dist/core/agents/session-finalization-state-v3.d.ts.map +1 -1
- package/dist/core/agents/session-finalization-state-v3.js +2 -1
- package/dist/core/agents/session-finalizer-v3.d.ts.map +1 -1
- package/dist/core/agents/session-finalizer-v3.js +5 -4
- package/dist/core/agents/session-name-display.d.ts +28 -0
- package/dist/core/agents/session-name-display.d.ts.map +1 -1
- package/dist/core/agents/session-name-display.js +43 -0
- package/dist/core/agents/state/heartbeat-reader.d.ts +7 -0
- package/dist/core/agents/state/heartbeat-reader.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.d.ts +10 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +21 -2
- package/dist/core/agents/state/live-coordination-view.d.ts +20 -0
- package/dist/core/agents/state/live-coordination-view.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-view.js +61 -0
- package/dist/core/agents/state/live-coordination-writer.js +3 -0
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +2 -10
- package/dist/core/agents/turn-changes.d.ts +17 -0
- package/dist/core/agents/turn-changes.d.ts.map +1 -0
- package/dist/core/agents/turn-changes.js +76 -0
- package/dist/core/artifacts/delivery-card.d.ts.map +1 -1
- package/dist/core/artifacts/delivery-card.js +11 -3
- package/dist/core/artifacts/index.d.ts +140 -4
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +526 -52
- package/dist/core/config.d.ts +73 -11
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +142 -3
- package/dist/core/context/index.d.ts.map +1 -1
- package/dist/core/context/index.js +2 -1
- package/dist/core/conversations/archive.d.ts.map +1 -1
- package/dist/core/conversations/archive.js +4 -3
- package/dist/core/diagnostics/bundle.d.ts.map +1 -1
- package/dist/core/diagnostics/bundle.js +5 -4
- package/dist/core/events/legacy-storage/canary.d.ts.map +1 -1
- package/dist/core/events/legacy-storage/canary.js +5 -4
- package/dist/core/events/legacy-storage/compression.d.ts.map +1 -1
- package/dist/core/events/legacy-storage/compression.js +2 -1
- package/dist/core/events/v3/adapter-id.d.ts +10 -2
- package/dist/core/events/v3/adapter-id.d.ts.map +1 -1
- package/dist/core/events/v3/adapter-id.js +16 -0
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +2 -1
- package/dist/core/events/v3/bootstrap.d.ts.map +1 -1
- package/dist/core/events/v3/bootstrap.js +5 -4
- package/dist/core/events/v3/capabilities.d.ts.map +1 -1
- package/dist/core/events/v3/capabilities.js +17 -0
- package/dist/core/events/v3/contract.d.ts +5 -0
- package/dist/core/events/v3/contract.d.ts.map +1 -1
- package/dist/core/events/v3/contract.js +7 -1
- package/dist/core/events/v3/control-witness.d.ts.map +1 -1
- package/dist/core/events/v3/control-witness.js +3 -2
- package/dist/core/events/v3/coordination-transaction-recovery.d.ts.map +1 -1
- package/dist/core/events/v3/coordination-transaction-recovery.js +4 -3
- package/dist/core/events/v3/fingerprint-keys.d.ts.map +1 -1
- package/dist/core/events/v3/fingerprint-keys.js +7 -6
- package/dist/core/events/v3/generated.d.ts +1 -1
- package/dist/core/events/v3/generated.js +1 -1
- package/dist/core/events/v3/live-feed.d.ts.map +1 -1
- package/dist/core/events/v3/live-feed.js +5 -4
- package/dist/core/events/v3/producers/command-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/command-recorder.js +8 -7
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +8 -7
- package/dist/core/events/v3/producers/diagnostic-summaries.d.ts.map +1 -1
- package/dist/core/events/v3/producers/diagnostic-summaries.js +5 -4
- package/dist/core/events/v3/producers/hook-base.d.ts +1 -0
- package/dist/core/events/v3/producers/hook-base.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook-base.js +10 -4
- package/dist/core/events/v3/producers/hook.d.ts +2 -0
- package/dist/core/events/v3/producers/hook.d.ts.map +1 -1
- package/dist/core/events/v3/producers/hook.js +16 -1
- package/dist/core/events/v3/producers/intake.d.ts.map +1 -1
- package/dist/core/events/v3/producers/intake.js +16 -6
- package/dist/core/events/v3/producers/recorder.d.ts +2 -4
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +125 -101
- package/dist/core/events/v3/projection.js +9 -1
- package/dist/core/events/v3/recovery.d.ts.map +1 -1
- package/dist/core/events/v3/recovery.js +4 -3
- package/dist/core/events/v3/support-storage/inventory.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/inventory.js +2 -1
- package/dist/core/events/v3/support-storage/maintenance.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/maintenance.js +4 -3
- package/dist/core/events/v3/support-storage/pack-reader.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/pack-reader.js +4 -3
- package/dist/core/events/v3/support-storage/pack-writer.d.ts.map +1 -1
- package/dist/core/events/v3/support-storage/pack-writer.js +6 -5
- package/dist/core/events/v3/tool-line-changes.d.ts +8 -0
- package/dist/core/events/v3/tool-line-changes.d.ts.map +1 -0
- package/dist/core/events/v3/tool-line-changes.js +135 -0
- package/dist/core/events/v3/writer.d.ts.map +1 -1
- package/dist/core/events/v3/writer.js +8 -7
- package/dist/core/governor/planning.d.ts.map +1 -1
- package/dist/core/governor/planning.js +6 -5
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +12 -11
- package/dist/core/governor/state.d.ts.map +1 -1
- package/dist/core/governor/state.js +7 -6
- package/dist/core/guard/evaluator.js +1 -0
- package/dist/core/guard/storage.d.ts.map +1 -1
- package/dist/core/guard/storage.js +3 -2
- package/dist/core/hooks/adapter/behaviors/claude-code.d.ts +4 -0
- package/dist/core/hooks/adapter/behaviors/claude-code.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/claude-code.js +31 -0
- package/dist/core/hooks/adapter/behaviors/codex.d.ts +15 -0
- package/dist/core/hooks/adapter/behaviors/codex.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/codex.js +82 -0
- package/dist/core/hooks/adapter/behaviors/cursor.d.ts +7 -0
- package/dist/core/hooks/adapter/behaviors/cursor.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/cursor.js +35 -0
- package/dist/core/hooks/adapter/behaviors/index.d.ts +11 -0
- package/dist/core/hooks/adapter/behaviors/index.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/index.js +20 -0
- package/dist/core/hooks/adapter/behaviors/openclaw.d.ts +7 -0
- package/dist/core/hooks/adapter/behaviors/openclaw.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/openclaw.js +34 -0
- package/dist/core/hooks/adapter/behaviors/opencode.d.ts +7 -0
- package/dist/core/hooks/adapter/behaviors/opencode.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/opencode.js +34 -0
- package/dist/core/hooks/adapter/behaviors/types.d.ts +89 -0
- package/dist/core/hooks/adapter/behaviors/types.d.ts.map +1 -0
- package/dist/core/hooks/adapter/behaviors/types.js +1 -0
- package/dist/core/hooks/adapter/detect.d.ts +1 -1
- package/dist/core/hooks/adapter/detect.d.ts.map +1 -1
- package/dist/core/hooks/adapter/detect.js +2 -3
- package/dist/core/hooks/adapter/events.d.ts +46 -1
- package/dist/core/hooks/adapter/events.d.ts.map +1 -1
- package/dist/core/hooks/adapter/events.js +36 -0
- package/dist/core/hooks/adapter/opencode-plugin.d.ts +60 -0
- package/dist/core/hooks/adapter/opencode-plugin.d.ts.map +1 -0
- package/dist/core/hooks/adapter/opencode-plugin.js +129 -0
- package/dist/core/hooks/adapter/output.d.ts +7 -0
- package/dist/core/hooks/adapter/output.d.ts.map +1 -1
- package/dist/core/hooks/adapter/output.js +8 -1
- package/dist/core/hooks/adapter/runtime-telemetry.js +3 -1
- package/dist/core/hooks/adapter/wiring.d.ts +52 -8
- package/dist/core/hooks/adapter/wiring.d.ts.map +1 -1
- package/dist/core/hooks/adapter/wiring.js +133 -12
- package/dist/core/hooks/cli.js +676 -531
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
- package/dist/core/hooks/effects/image-capture.js +2 -1
- package/dist/core/hooks/prompt-context/contract.d.ts.map +1 -1
- package/dist/core/hooks/prompt-context/contract.js +1 -0
- package/dist/core/hooks/resolve/transcript.d.ts +1 -1
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -1
- package/dist/core/hooks/resolve/transcript.js +35 -4
- package/dist/core/hooks/run-markers.d.ts +37 -0
- package/dist/core/hooks/run-markers.d.ts.map +1 -0
- package/dist/core/hooks/run-markers.js +109 -0
- package/dist/core/hooks/session-name-presence.d.ts +3 -1
- package/dist/core/hooks/session-name-presence.d.ts.map +1 -1
- package/dist/core/hooks/session-name-presence.js +7 -2
- package/dist/core/hooks/shell-waiter.d.ts +2 -0
- package/dist/core/hooks/shell-waiter.d.ts.map +1 -0
- package/dist/core/hooks/shell-waiter.js +173 -0
- package/dist/core/resources/service.d.ts.map +1 -1
- package/dist/core/resources/service.js +5 -4
- package/dist/core/semantic/review.d.ts.map +1 -1
- package/dist/core/semantic/review.js +5 -4
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +15 -14
- package/dist/core/semantic/storage.d.ts.map +1 -1
- package/dist/core/semantic/storage.js +5 -4
- package/dist/core/servers/index.d.ts +211 -0
- package/dist/core/servers/index.d.ts.map +1 -0
- package/dist/core/servers/index.js +560 -0
- package/dist/core/servers/net.d.ts +58 -0
- package/dist/core/servers/net.d.ts.map +1 -0
- package/dist/core/servers/net.js +270 -0
- package/dist/core/servers/tunnels.d.ts +14 -0
- package/dist/core/servers/tunnels.d.ts.map +1 -0
- package/dist/core/servers/tunnels.js +33 -0
- package/dist/core/storage/atomic-json.d.ts.map +1 -1
- package/dist/core/storage/atomic-json.js +7 -3
- package/dist/core/storage/builtins.js +1 -0
- package/dist/core/storage/durable-history.d.ts.map +1 -1
- package/dist/core/storage/durable-history.js +6 -5
- package/dist/core/storage/maintenance-providers.d.ts.map +1 -1
- package/dist/core/storage/maintenance-providers.js +2 -1
- package/dist/core/storage/maintenance.d.ts.map +1 -1
- package/dist/core/storage/maintenance.js +7 -6
- package/dist/core/storage/metrics.d.ts.map +1 -1
- package/dist/core/storage/metrics.js +5 -1
- package/dist/core/storage/modes.d.ts +17 -0
- package/dist/core/storage/modes.d.ts.map +1 -0
- package/dist/core/storage/modes.js +47 -0
- package/dist/core/storage/process-log.d.ts.map +1 -1
- package/dist/core/storage/process-log.js +3 -2
- package/dist/core/storage/receipts.d.ts.map +1 -1
- package/dist/core/storage/receipts.js +4 -3
- package/dist/core/storage/segments.d.ts.map +1 -1
- package/dist/core/storage/segments.js +7 -6
- package/dist/core/supervisor/hook-health.d.ts +2 -1
- package/dist/core/supervisor/hook-health.d.ts.map +1 -1
- package/dist/core/supervisor/hook-health.js +4 -3
- package/dist/core/supervisor/service.d.ts.map +1 -1
- package/dist/core/supervisor/service.js +7 -6
- package/dist/core/work/state.d.ts.map +1 -1
- package/dist/core/work/state.js +8 -7
- package/dist/core/workflow/adapters.d.ts +7 -0
- package/dist/core/workflow/adapters.d.ts.map +1 -1
- package/dist/core/workflow/adapters.js +9 -0
- package/dist/core/workflow/approvals.d.ts.map +1 -1
- package/dist/core/workflow/approvals.js +6 -5
- package/dist/core/workflow/billing.d.ts.map +1 -1
- package/dist/core/workflow/billing.js +33 -4
- package/dist/core/workflow/durable-record.d.ts.map +1 -1
- package/dist/core/workflow/durable-record.js +4 -3
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +30 -1
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +2 -3
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +3 -2
- package/dist/core/workflow/sandbox-projection.d.ts +13 -2
- package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
- package/dist/core/workflow/sandbox-projection.js +23 -0
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +6 -1
- package/dist/core/workflow/spawn-codex.d.ts +2 -0
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +20 -1
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +6 -1
- package/dist/core/workflow/spawn-opencode.d.ts +36 -0
- package/dist/core/workflow/spawn-opencode.d.ts.map +1 -0
- package/dist/core/workflow/spawn-opencode.js +135 -0
- package/dist/core/workflow/transcript.d.ts.map +1 -1
- package/dist/core/workflow/transcript.js +3 -2
- package/dist/core/workflow/types.d.ts +47 -2
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/worker-access.d.ts +92 -0
- package/dist/core/workflow/worker-access.d.ts.map +1 -0
- package/dist/core/workflow/worker-access.js +450 -0
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +5 -4
- package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/local-git.js +3 -2
- package/dist/core/workflow/workspaces/paths.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/paths.js +2 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +10 -9
- package/dist/lazy-commands.js +8 -1
- package/dist/lib/agent-browser/client.d.ts +9 -0
- package/dist/lib/agent-browser/client.d.ts.map +1 -1
- package/dist/lib/agent-browser/client.js +13 -0
- package/dist/lib/browser/batch-steps.d.ts +18 -0
- package/dist/lib/browser/batch-steps.d.ts.map +1 -0
- package/dist/lib/browser/batch-steps.js +82 -0
- package/dist/lib/browser/client.d.ts +35 -1
- package/dist/lib/browser/client.d.ts.map +1 -1
- package/dist/lib/browser/client.js +117 -8
- package/dist/lib/browser/collect/collector.d.ts +99 -0
- package/dist/lib/browser/collect/collector.d.ts.map +1 -0
- package/dist/lib/browser/collect/collector.js +202 -0
- package/dist/lib/browser/collect/fields.d.ts +31 -0
- package/dist/lib/browser/collect/fields.d.ts.map +1 -0
- package/dist/lib/browser/collect/fields.js +75 -0
- package/dist/lib/browser/collect/index.d.ts +6 -0
- package/dist/lib/browser/collect/index.d.ts.map +1 -0
- package/dist/lib/browser/collect/index.js +5 -0
- package/dist/lib/browser/collect/page-driver.d.ts +14 -0
- package/dist/lib/browser/collect/page-driver.d.ts.map +1 -0
- package/dist/lib/browser/collect/page-driver.js +306 -0
- package/dist/lib/browser/collect/presets.d.ts +52 -0
- package/dist/lib/browser/collect/presets.d.ts.map +1 -0
- package/dist/lib/browser/collect/presets.js +176 -0
- package/dist/lib/browser/collect/scroll-plan.d.ts +85 -0
- package/dist/lib/browser/collect/scroll-plan.d.ts.map +1 -0
- package/dist/lib/browser/collect/scroll-plan.js +118 -0
- package/dist/lib/browser/identity.d.ts +25 -0
- package/dist/lib/browser/identity.d.ts.map +1 -0
- package/dist/lib/browser/identity.js +66 -0
- package/dist/lib/browser/index.d.ts +3 -2
- package/dist/lib/browser/index.d.ts.map +1 -1
- package/dist/lib/browser/index.js +2 -1
- package/dist/lib/browser/launch-args.d.ts +26 -0
- package/dist/lib/browser/launch-args.d.ts.map +1 -1
- package/dist/lib/browser/launch-args.js +41 -1
- package/dist/lib/browser/page-review-judge.d.ts +2 -0
- package/dist/lib/browser/page-review-judge.d.ts.map +1 -1
- package/dist/lib/browser/page-review-judge.js +13 -0
- package/dist/lib/browser/qa-run-contracts.d.ts +10 -0
- package/dist/lib/browser/qa-run-contracts.d.ts.map +1 -1
- package/dist/lib/browser/qa-run.d.ts.map +1 -1
- package/dist/lib/browser/qa-run.js +1 -0
- package/dist/lib/browser/user-agent.d.ts +53 -0
- package/dist/lib/browser/user-agent.d.ts.map +1 -0
- package/dist/lib/browser/user-agent.js +79 -0
- package/dist/lib/browser/windows-chrome.d.ts +59 -0
- package/dist/lib/browser/windows-chrome.d.ts.map +1 -0
- package/dist/lib/browser/windows-chrome.js +179 -0
- package/dist/lib/claude-desktop-share.d.ts +136 -0
- package/dist/lib/claude-desktop-share.d.ts.map +1 -0
- package/dist/lib/claude-desktop-share.js +394 -0
- package/dist/lib/disk-usage.d.ts +50 -0
- package/dist/lib/disk-usage.d.ts.map +1 -0
- package/dist/lib/disk-usage.js +303 -0
- package/dist/lib/docs-lint.d.ts +6 -0
- package/dist/lib/docs-lint.d.ts.map +1 -1
- package/dist/lib/docs-lint.js +8 -3
- package/dist/lib/docs-metadata-managed.d.ts +1 -0
- package/dist/lib/docs-metadata-managed.d.ts.map +1 -1
- package/dist/lib/docs-metadata-managed.js +17 -1
- package/dist/lib/guarded-remove.d.ts +34 -0
- package/dist/lib/guarded-remove.d.ts.map +1 -0
- package/dist/lib/guarded-remove.js +310 -0
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +4 -9
- package/dist/lib/instructions/apply.d.ts.map +1 -1
- package/dist/lib/instructions/apply.js +2 -0
- package/dist/lib/instructions/templates.js +8 -8
- package/dist/lib/pace/index.d.ts +2 -0
- package/dist/lib/pace/index.d.ts.map +1 -0
- package/dist/lib/pace/index.js +1 -0
- package/dist/lib/pace/pace.d.ts +95 -0
- package/dist/lib/pace/pace.d.ts.map +1 -0
- package/dist/lib/pace/pace.js +313 -0
- package/dist/lib/tunnel/error-page.d.ts +1 -1
- package/dist/lib/tunnel/error-page.d.ts.map +1 -1
- package/dist/lib/tunnel/error-page.js +19 -8
- package/dist/lib/tunnel/forward-headers.d.ts +11 -0
- package/dist/lib/tunnel/forward-headers.d.ts.map +1 -0
- package/dist/lib/tunnel/forward-headers.js +17 -0
- package/dist/lib/tunnel/gate.js +34 -10
- package/dist/lib/tunnel/path-scope.d.ts +22 -0
- package/dist/lib/tunnel/path-scope.d.ts.map +1 -0
- package/dist/lib/tunnel/path-scope.js +62 -0
- package/dist/lib/tunnel/state.d.ts +5 -0
- package/dist/lib/tunnel/state.d.ts.map +1 -1
- package/dist/lib/tunnel/state.js +17 -3
- package/dist/lib/webview/index.d.ts +2 -0
- package/dist/lib/webview/index.d.ts.map +1 -0
- package/dist/lib/webview/index.js +1 -0
- package/dist/lib/webview/webview.d.ts +116 -0
- package/dist/lib/webview/webview.d.ts.map +1 -0
- package/dist/lib/webview/webview.js +289 -0
- package/opencode-plugin/package.json +19 -0
- package/opencode-plugin/src/index.ts +791 -0
- package/package.json +16 -4
- package/schemas/config.schema.json +104 -0
- package/schemas/event-v3.schema.json +164 -0
- package/src/commander.ts +26 -0
- package/src/commands/agents.ts +47 -18
- package/src/commands/artifacts.ts +171 -19
- package/src/commands/browse-ai.ts +8 -0
- package/src/commands/browse.ts +570 -48
- package/src/commands/checkpoint.ts +7 -9
- package/src/commands/claude-desktop.ts +61 -0
- package/src/commands/deinit.ts +9 -4
- package/src/commands/disk.ts +114 -0
- package/src/commands/docs.ts +2 -0
- package/src/commands/doctor.ts +63 -3
- package/src/commands/fetch.ts +14 -0
- package/src/commands/files.ts +93 -2
- package/src/commands/init.ts +334 -122
- package/src/commands/instructions.ts +8 -4
- package/src/commands/ledger-v3.ts +2 -1
- package/src/commands/rm.ts +115 -0
- package/src/commands/servers.ts +506 -0
- package/src/commands/tunnel.ts +102 -2
- package/src/commands/webview.ts +159 -0
- package/src/core/adapter.ts +102 -1
- package/src/core/adapters/attestation.ts +3 -2
- package/src/core/adapters/profiles.ts +63 -1
- package/src/core/adapters/registry.ts +37 -0
- package/src/core/adapters/types.ts +10 -0
- package/src/core/agents/canonical-emit.ts +2 -5
- package/src/core/agents/cli.ts +26 -17
- package/src/core/agents/coord-client.ts +9 -3
- package/src/core/agents/render/session-context.ts +1 -0
- package/src/core/agents/rules/claim-conflict.ts +3 -8
- package/src/core/agents/rules/commit-conflict.ts +2 -7
- package/src/core/agents/rules/stop-hook.ts +3 -1
- package/src/core/agents/session-events.ts +120 -26
- package/src/core/agents/session-finalization-state-v3.ts +2 -1
- package/src/core/agents/session-finalizer-v3.ts +5 -4
- package/src/core/agents/session-name-display.ts +48 -0
- package/src/core/agents/state/heartbeat-reader.ts +7 -0
- package/src/core/agents/state/heartbeat-writer.ts +24 -2
- package/src/core/agents/state/live-coordination-view.ts +74 -0
- package/src/core/agents/state/live-coordination-writer.ts +3 -0
- package/src/core/agents/state/stale-sweep.ts +2 -9
- package/src/core/agents/turn-changes.ts +97 -0
- package/src/core/artifacts/delivery-card.ts +12 -3
- package/src/core/artifacts/index.ts +701 -47
- package/src/core/config.ts +206 -4
- package/src/core/context/index.ts +2 -1
- package/src/core/conversations/archive.ts +4 -3
- package/src/core/diagnostics/bundle.ts +5 -3
- package/src/core/events/legacy-storage/canary.ts +5 -4
- package/src/core/events/legacy-storage/compression.ts +2 -1
- package/src/core/events/v3/adapter-id.ts +29 -1
- package/src/core/events/v3/authority-outbox.ts +2 -1
- package/src/core/events/v3/bootstrap.ts +5 -4
- package/src/core/events/v3/capabilities.ts +17 -0
- package/src/core/events/v3/contract.ts +9 -1
- package/src/core/events/v3/control-witness.ts +3 -2
- package/src/core/events/v3/coordination-transaction-recovery.ts +4 -3
- package/src/core/events/v3/fingerprint-keys.ts +7 -6
- package/src/core/events/v3/generated.ts +1 -1
- package/src/core/events/v3/live-feed.ts +5 -4
- package/src/core/events/v3/producers/command-recorder.ts +8 -6
- package/src/core/events/v3/producers/coordination-recorder.ts +8 -7
- package/src/core/events/v3/producers/diagnostic-summaries.ts +5 -4
- package/src/core/events/v3/producers/hook-base.ts +11 -4
- package/src/core/events/v3/producers/hook.ts +19 -1
- package/src/core/events/v3/producers/intake.ts +18 -6
- package/src/core/events/v3/producers/recorder.ts +139 -114
- package/src/core/events/v3/projection.ts +11 -1
- package/src/core/events/v3/recovery.ts +4 -3
- package/src/core/events/v3/support-storage/inventory.ts +2 -1
- package/src/core/events/v3/support-storage/maintenance.ts +8 -3
- package/src/core/events/v3/support-storage/pack-reader.ts +4 -3
- package/src/core/events/v3/support-storage/pack-writer.ts +6 -5
- package/src/core/events/v3/tool-line-changes.ts +139 -0
- package/src/core/events/v3/writer.ts +8 -7
- package/src/core/governor/planning.ts +6 -5
- package/src/core/governor/service.ts +12 -11
- package/src/core/governor/state.ts +7 -6
- package/src/core/guard/evaluator.ts +1 -0
- package/src/core/guard/storage.ts +3 -2
- package/src/core/hooks/adapter/behaviors/claude-code.ts +33 -0
- package/src/core/hooks/adapter/behaviors/codex.ts +96 -0
- package/src/core/hooks/adapter/behaviors/cursor.ts +37 -0
- package/src/core/hooks/adapter/behaviors/index.ts +31 -0
- package/src/core/hooks/adapter/behaviors/openclaw.ts +36 -0
- package/src/core/hooks/adapter/behaviors/opencode.ts +36 -0
- package/src/core/hooks/adapter/behaviors/types.ts +110 -0
- package/src/core/hooks/adapter/detect.ts +2 -3
- package/src/core/hooks/adapter/events.ts +72 -1
- package/src/core/hooks/adapter/opencode-plugin.ts +177 -0
- package/src/core/hooks/adapter/output.ts +8 -1
- package/src/core/hooks/adapter/runtime-telemetry.ts +3 -1
- package/src/core/hooks/adapter/wiring.ts +198 -16
- package/src/core/hooks/cli.ts +776 -539
- package/src/core/hooks/effects/image-capture.ts +2 -1
- package/src/core/hooks/prompt-context/contract.ts +1 -0
- package/src/core/hooks/resolve/transcript.ts +42 -5
- package/src/core/hooks/run-markers.ts +132 -0
- package/src/core/hooks/session-name-presence.ts +10 -3
- package/src/core/hooks/shell-waiter.ts +166 -0
- package/src/core/resources/service.ts +5 -4
- package/src/core/semantic/review.ts +5 -4
- package/src/core/semantic/service.ts +15 -14
- package/src/core/semantic/storage.ts +5 -4
- package/src/core/servers/index.ts +712 -0
- package/src/core/servers/net.ts +283 -0
- package/src/core/servers/tunnels.ts +39 -0
- package/src/core/storage/atomic-json.ts +7 -3
- package/src/core/storage/builtins.ts +1 -0
- package/src/core/storage/durable-history.ts +6 -5
- package/src/core/storage/maintenance-providers.ts +2 -1
- package/src/core/storage/maintenance.ts +7 -6
- package/src/core/storage/metrics.ts +5 -1
- package/src/core/storage/modes.ts +53 -0
- package/src/core/storage/process-log.ts +3 -2
- package/src/core/storage/receipts.ts +4 -3
- package/src/core/storage/segments.ts +7 -6
- package/src/core/supervisor/hook-health.ts +4 -4
- package/src/core/supervisor/service.ts +7 -6
- package/src/core/work/state.ts +8 -7
- package/src/core/workflow/adapters.ts +15 -0
- package/src/core/workflow/approvals.ts +6 -5
- package/src/core/workflow/billing.ts +34 -4
- package/src/core/workflow/durable-record.ts +4 -3
- package/src/core/workflow/engine.ts +38 -1
- package/src/core/workflow/live-session-v3.ts +2 -3
- package/src/core/workflow/run-state.ts +3 -2
- package/src/core/workflow/sandbox-projection.ts +38 -2
- package/src/core/workflow/spawn-claude.ts +5 -1
- package/src/core/workflow/spawn-codex.ts +18 -1
- package/src/core/workflow/spawn-cursor.ts +5 -1
- package/src/core/workflow/spawn-opencode.ts +153 -0
- package/src/core/workflow/transcript.ts +3 -2
- package/src/core/workflow/types.ts +62 -2
- package/src/core/workflow/worker-access.ts +525 -0
- package/src/core/workflow/workspaces/leases.ts +5 -4
- package/src/core/workflow/workspaces/local-git.ts +3 -2
- package/src/core/workflow/workspaces/paths.ts +2 -1
- package/src/core/workflow/workspaces/state.ts +10 -9
- package/src/lazy-commands.ts +11 -1
- package/src/lib/agent-browser/client.ts +18 -0
- package/src/lib/browser/batch-steps.ts +79 -0
- package/src/lib/browser/client.ts +147 -9
- package/src/lib/browser/collect/collector.ts +306 -0
- package/src/lib/browser/collect/fields.ts +87 -0
- package/src/lib/browser/collect/index.ts +47 -0
- package/src/lib/browser/collect/page-driver.ts +327 -0
- package/src/lib/browser/collect/presets.ts +237 -0
- package/src/lib/browser/collect/scroll-plan.ts +179 -0
- package/src/lib/browser/identity.ts +64 -0
- package/src/lib/browser/index.ts +16 -1
- package/src/lib/browser/launch-args.ts +53 -1
- package/src/lib/browser/page-review-judge.ts +16 -0
- package/src/lib/browser/qa-run-contracts.ts +11 -0
- package/src/lib/browser/qa-run.ts +1 -0
- package/src/lib/browser/user-agent.ts +130 -0
- package/src/lib/browser/windows-chrome.ts +227 -0
- package/src/lib/claude-desktop-share.ts +511 -0
- package/src/lib/disk-usage.ts +347 -0
- package/src/lib/docs-lint.ts +8 -3
- package/src/lib/docs-metadata-managed.ts +21 -0
- package/src/lib/guarded-remove.ts +376 -0
- package/src/lib/identities/assume.ts +7 -7
- package/src/lib/instructions/apply.ts +2 -0
- package/src/lib/instructions/templates.ts +8 -8
- package/src/lib/pace/index.ts +14 -0
- package/src/lib/pace/pace.ts +370 -0
- package/src/lib/tunnel/error-page.ts +25 -9
- package/src/lib/tunnel/forward-headers.ts +16 -0
- package/src/lib/tunnel/gate.ts +39 -10
- package/src/lib/tunnel/path-scope.ts +73 -0
- package/src/lib/tunnel/state.ts +20 -3
- package/src/lib/webview/index.ts +13 -0
- package/src/lib/webview/webview.ts +457 -0
package/src/commands/init.ts
CHANGED
|
@@ -7,9 +7,13 @@
|
|
|
7
7
|
* null and every hook no-ops forever.
|
|
8
8
|
* 2. Register the agent-hook entries in the adapter settings file.
|
|
9
9
|
*
|
|
10
|
-
* Wires
|
|
11
|
-
* Cursor `.cursor/hooks.json`,
|
|
12
|
-
* file path, event list,
|
|
10
|
+
* Wires every adapter in the resolved set (Claude Code `.claude/settings.json`,
|
|
11
|
+
* Cursor `.cursor/hooks.json`, Codex `.codex/hooks.json`, or the OpenCode plugin
|
|
12
|
+
* directory `.opencode/plugins/harnery/`): the per-adapter file path, event list,
|
|
13
|
+
* and hook-entry shape all come from ADAPTER_SPECS. `--adapter` is repeatable (or
|
|
14
|
+
* comma-separated, or `all`); with no flag, init wires every adapter whose CLI is
|
|
15
|
+
* installed on this machine, plus any adapter the project already has wired, else
|
|
16
|
+
* claude-code.
|
|
13
17
|
*
|
|
14
18
|
* `harn init` does both, non-destructively: it merges hook entries into an
|
|
15
19
|
* existing settings file (preserving any other hooks) and skips entries that are
|
|
@@ -23,7 +27,12 @@ import { dirname, relative, resolve } from "node:path";
|
|
|
23
27
|
import { fileURLToPath } from "node:url";
|
|
24
28
|
import type { Command } from "commander";
|
|
25
29
|
import type { EmitContext } from "../commander.ts";
|
|
26
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
codexWindowsBridgeConfig,
|
|
32
|
+
DEFAULT_BIN_NAME,
|
|
33
|
+
pinnedBinName,
|
|
34
|
+
stripJsonComments,
|
|
35
|
+
} from "../core/config.ts";
|
|
27
36
|
import { canonicalJsonV3 } from "../core/events/v3/canonical.ts";
|
|
28
37
|
import { ADAPTER_CAPABILITY_PROFILES_V3 } from "../core/events/v3/capabilities.ts";
|
|
29
38
|
import type { EventV3ControlState } from "../core/events/v3/control.ts";
|
|
@@ -34,17 +43,29 @@ import {
|
|
|
34
43
|
sha256V3,
|
|
35
44
|
} from "../core/events/v3/index.ts";
|
|
36
45
|
import { ADAPTER_SPECS, type AdapterId, type AdapterSpec } from "../core/hooks/adapter/events.ts";
|
|
46
|
+
import {
|
|
47
|
+
checkOpenCodePlugin,
|
|
48
|
+
installOpenCodePlugin,
|
|
49
|
+
} from "../core/hooks/adapter/opencode-plugin.ts";
|
|
37
50
|
import {
|
|
38
51
|
agentHookPathForProject,
|
|
52
|
+
applyCursorStopLoopLimit,
|
|
53
|
+
CURSOR_STOP_FOLLOWUP_LOOP_LIMIT,
|
|
39
54
|
commandWiresSubcommand,
|
|
40
55
|
diffWiring,
|
|
56
|
+
expectedCommandWindows,
|
|
41
57
|
groupCommands,
|
|
42
58
|
type HookGroup,
|
|
43
59
|
hookCommand,
|
|
60
|
+
hookTimeoutFor,
|
|
44
61
|
isAgentHookCommand,
|
|
45
62
|
makeEntry,
|
|
63
|
+
orderHandlerKeys,
|
|
46
64
|
type SettingsFile,
|
|
65
|
+
summarizeAdapterWiring,
|
|
66
|
+
type WiringOptions,
|
|
47
67
|
} from "../core/hooks/adapter/wiring.ts";
|
|
68
|
+
import { detectInstalledAdapters } from "../core/workflow/adapters.ts";
|
|
48
69
|
import { applyIndexerExclusions } from "../lib/indexer-exclusions.ts";
|
|
49
70
|
import {
|
|
50
71
|
type ApplyResult,
|
|
@@ -58,13 +79,144 @@ import { HostAddendumError } from "../lib/instructions/host-addendum.ts";
|
|
|
58
79
|
const HARNERY_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
59
80
|
|
|
60
81
|
interface InitOpts {
|
|
61
|
-
adapter: string;
|
|
82
|
+
adapter: string[];
|
|
62
83
|
dryRun?: boolean;
|
|
63
84
|
check?: boolean;
|
|
64
85
|
instructionsOnly?: boolean;
|
|
65
86
|
projectRoot?: string;
|
|
66
87
|
}
|
|
67
88
|
|
|
89
|
+
const ADAPTER_IDS = Object.keys(ADAPTER_SPECS) as AdapterId[];
|
|
90
|
+
|
|
91
|
+
/** Parse explicit `--adapter` values; `all` expands and order is preserved, deduplicated. */
|
|
92
|
+
function parseAdapterIds(requested: string[]): { adapters: AdapterId[]; error?: string } {
|
|
93
|
+
const adapters: AdapterId[] = [];
|
|
94
|
+
for (const raw of requested) {
|
|
95
|
+
const ids = raw === "all" ? ADAPTER_IDS : [raw as AdapterId];
|
|
96
|
+
for (const id of ids) {
|
|
97
|
+
if (!(id in ADAPTER_SPECS)) {
|
|
98
|
+
return {
|
|
99
|
+
adapters: [],
|
|
100
|
+
error: `Unknown adapter '${raw}'. Expected: ${ADAPTER_IDS.join(" | ")} | all.`,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (!adapters.includes(id)) adapters.push(id);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { adapters };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Which adapters `init` should wire. An explicit `--adapter` wins. Without one:
|
|
111
|
+
* every adapter whose CLI is installed on this machine, plus every adapter the
|
|
112
|
+
* project already has wired (committed wiring stays current on a box whose CLI is
|
|
113
|
+
* absent, e.g. CI). A machine with neither falls back to the historical
|
|
114
|
+
* claude-code default. `installed` is injectable so tests never key on the host's
|
|
115
|
+
* toolchain.
|
|
116
|
+
*/
|
|
117
|
+
export function resolveInitAdapters(
|
|
118
|
+
projectRoot: string,
|
|
119
|
+
requested: string[],
|
|
120
|
+
installed?: AdapterId[],
|
|
121
|
+
): { adapters: AdapterId[]; error?: string } {
|
|
122
|
+
if (requested.length > 0) return parseAdapterIds(requested);
|
|
123
|
+
const detected = installed ?? detectInstalledAdapters();
|
|
124
|
+
const wired = summarizeAdapterWiring(projectRoot).wired;
|
|
125
|
+
const adapters = ADAPTER_IDS.filter((id) => detected.includes(id) || wired.includes(id));
|
|
126
|
+
return { adapters: adapters.length > 0 ? adapters : ["claude-code"] };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Drift check for one adapter's runtime wiring (settings hooks or the OpenCode plugin). */
|
|
130
|
+
function checkAdapterHooks(
|
|
131
|
+
projectRoot: string,
|
|
132
|
+
adapter: AdapterId,
|
|
133
|
+
bin: string,
|
|
134
|
+
): { drift: boolean; error: boolean; issues: string[] } {
|
|
135
|
+
const spec = ADAPTER_SPECS[adapter];
|
|
136
|
+
const agentHook = agentHookPathForProject(projectRoot, HARNERY_ROOT);
|
|
137
|
+
if (spec.installMode === "opencode-plugin") {
|
|
138
|
+
// No hooks map to diff: the plugin directory is the wiring.
|
|
139
|
+
const plugin = checkOpenCodePlugin(projectRoot, { binName: bin, agentHook });
|
|
140
|
+
if (plugin.status === "missing") {
|
|
141
|
+
return {
|
|
142
|
+
drift: true,
|
|
143
|
+
error: false,
|
|
144
|
+
issues: [`${spec.settingsFile}: missing (re-run \`init --adapter opencode\`)`],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (plugin.status === "foreign") return { drift: false, error: true, issues: plugin.issues };
|
|
148
|
+
if (plugin.status === "stale") return { drift: true, error: false, issues: plugin.issues };
|
|
149
|
+
return { drift: false, error: false, issues: [] };
|
|
150
|
+
}
|
|
151
|
+
const settingsPath = resolve(projectRoot, spec.settingsFile);
|
|
152
|
+
if (!existsSync(settingsPath)) {
|
|
153
|
+
return { drift: true, error: false, issues: [`${spec.settingsFile}: missing (re-run init)`] };
|
|
154
|
+
}
|
|
155
|
+
const issues: string[] = [];
|
|
156
|
+
let drift = false;
|
|
157
|
+
try {
|
|
158
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf8")) as SettingsFile;
|
|
159
|
+
const hookDiff = diffWiring(settings, spec, {
|
|
160
|
+
agentHookPath: agentHook,
|
|
161
|
+
adapter,
|
|
162
|
+
windowsBridgeEntryPoint: codexWindowsBridgeConfig(projectRoot).entryPoint,
|
|
163
|
+
});
|
|
164
|
+
drift =
|
|
165
|
+
hookDiff.missing.length > 0 ||
|
|
166
|
+
hookDiff.stale.length > 0 ||
|
|
167
|
+
hookDiff.duplicates.length > 0 ||
|
|
168
|
+
hookDiff.misplaced.length > 0 ||
|
|
169
|
+
hookDiff.orphans.length > 0 ||
|
|
170
|
+
hookDiff.invalidTopLevelKeys.length > 0 ||
|
|
171
|
+
hookDiff.invalidEventKeys.length > 0;
|
|
172
|
+
if (hookDiff.missing.length > 0) {
|
|
173
|
+
issues.push(
|
|
174
|
+
`${spec.settingsFile}: missing hooks (${hookDiff.missing.map((e) => e.settingsKey).join(", ")})`,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
if (hookDiff.stale.length > 0) {
|
|
178
|
+
issues.push(
|
|
179
|
+
`${spec.settingsFile}: stale hook commands (${hookDiff.stale.map((e) => e.settingsKey).join(", ")})`,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
if (hookDiff.duplicates.length > 0) {
|
|
183
|
+
issues.push(
|
|
184
|
+
`${spec.settingsFile}: duplicate hooks (${hookDiff.duplicates.map((e) => e.settingsKey).join(", ")})`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
if (hookDiff.misplaced.length > 0) {
|
|
188
|
+
issues.push(
|
|
189
|
+
`${spec.settingsFile}: hooks under the wrong event (${hookDiff.misplaced.map((e) => e.subcommand).join(", ")})`,
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
if (hookDiff.orphans.length > 0) {
|
|
193
|
+
issues.push(`${spec.settingsFile}: obsolete hooks (${hookDiff.orphans.join(", ")})`);
|
|
194
|
+
}
|
|
195
|
+
if (hookDiff.invalidTopLevelKeys.length > 0) {
|
|
196
|
+
issues.push(
|
|
197
|
+
`${spec.settingsFile}: invalid fields (${hookDiff.invalidTopLevelKeys.join(", ")})`,
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
if (hookDiff.invalidEventKeys.length > 0) {
|
|
201
|
+
issues.push(
|
|
202
|
+
`${spec.settingsFile}: unsupported events (${hookDiff.invalidEventKeys.join(", ")})`,
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return {
|
|
207
|
+
drift: false,
|
|
208
|
+
error: true,
|
|
209
|
+
issues: [`${spec.settingsFile}: invalid JSON (${(error as Error).message})`],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return { drift, error: false, issues };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Preserve first-seen order while dropping repeats (one pass per adapter repeats lines). */
|
|
216
|
+
function dedupe(values: string[]): string[] {
|
|
217
|
+
return [...new Set(values)];
|
|
218
|
+
}
|
|
219
|
+
|
|
68
220
|
export function registerInitCommand(program: Command, emit: EmitContext, binName?: string): void {
|
|
69
221
|
program
|
|
70
222
|
.command("init")
|
|
@@ -74,7 +226,19 @@ export function registerInitCommand(program: Command, emit: EmitContext, binName
|
|
|
74
226
|
"(idempotent; safe to re-run). Use --dry-run to preview, --check to " +
|
|
75
227
|
"report drift without writing (exit 0 fresh / 2 drift / 1 error).",
|
|
76
228
|
)
|
|
77
|
-
.option(
|
|
229
|
+
.option(
|
|
230
|
+
"--adapter <id>",
|
|
231
|
+
"claude-code | cursor | codex | opencode | all; repeatable or comma-separated. " +
|
|
232
|
+
"Default: every adapter installed on this machine plus every adapter already wired, else claude-code",
|
|
233
|
+
(value: string, previous: string[]) =>
|
|
234
|
+
previous.concat(
|
|
235
|
+
value
|
|
236
|
+
.split(",")
|
|
237
|
+
.map((id) => id.trim())
|
|
238
|
+
.filter(Boolean),
|
|
239
|
+
),
|
|
240
|
+
[] as string[],
|
|
241
|
+
)
|
|
78
242
|
.option("--dry-run", "Show what would change without writing")
|
|
79
243
|
.option("--check", "Report managed-surface drift without writing; exit 0/2/1")
|
|
80
244
|
.option(
|
|
@@ -83,14 +247,6 @@ export function registerInitCommand(program: Command, emit: EmitContext, binName
|
|
|
83
247
|
)
|
|
84
248
|
.option("--project-root <path>", "Project root (default: git toplevel, else cwd)")
|
|
85
249
|
.action((opts: InitOpts) => {
|
|
86
|
-
const adapter = opts.adapter as AdapterId;
|
|
87
|
-
const spec = ADAPTER_SPECS[adapter];
|
|
88
|
-
if (!spec) {
|
|
89
|
-
emit.text(`Unknown adapter '${opts.adapter}'. Expected: claude-code | cursor | codex.`);
|
|
90
|
-
emit.setExitCode(1);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
250
|
const projectRoot = resolve(opts.projectRoot ?? gitTopLevel() ?? process.cwd());
|
|
95
251
|
// A binName already pinned in this project's config.jsonc beats the
|
|
96
252
|
// invoking CLI's name: the pin is a committed, deliberate declaration;
|
|
@@ -105,6 +261,15 @@ export function registerInitCommand(program: Command, emit: EmitContext, binName
|
|
|
105
261
|
// before every coord-root, config, ledger, adapter-settings, and Git-hook
|
|
106
262
|
// operation so its no-runtime-writes contract is structural.
|
|
107
263
|
if (opts.instructionsOnly === true) {
|
|
264
|
+
// Narrow by design: host sync tooling depends on one deterministic
|
|
265
|
+
// guidance layout, so this mode stays single-adapter and never detects.
|
|
266
|
+
const parsed = parseAdapterIds(opts.adapter);
|
|
267
|
+
if (parsed.error) {
|
|
268
|
+
emit.text(parsed.error);
|
|
269
|
+
emit.setExitCode(1);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const adapter = parsed.adapters[0] ?? "claude-code";
|
|
108
273
|
if (opts.check === true) {
|
|
109
274
|
const { status, issues } = checkInstructions(projectRoot, { binName: bin, adapter });
|
|
110
275
|
const head =
|
|
@@ -137,65 +302,31 @@ export function registerInitCommand(program: Command, emit: EmitContext, binName
|
|
|
137
302
|
return;
|
|
138
303
|
}
|
|
139
304
|
|
|
305
|
+
const resolved = resolveInitAdapters(projectRoot, opts.adapter);
|
|
306
|
+
if (resolved.error) {
|
|
307
|
+
emit.text(resolved.error);
|
|
308
|
+
emit.setExitCode(1);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const adapters = resolved.adapters;
|
|
312
|
+
|
|
140
313
|
// ── --check: read-only drift report on every init-managed surface ─────
|
|
141
314
|
if (opts.check === true) {
|
|
142
|
-
const
|
|
315
|
+
const issues: string[] = [];
|
|
316
|
+
let instructionStatus: "fresh" | "drift" | "error" = "fresh";
|
|
143
317
|
let hookCheckError = false;
|
|
144
318
|
let hookDrift = false;
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} else {
|
|
151
|
-
try {
|
|
152
|
-
const settings = JSON.parse(readFileSync(settingsPath, "utf8")) as SettingsFile;
|
|
153
|
-
const hookDiff = diffWiring(settings, spec, { agentHookPath: agentHook, adapter });
|
|
154
|
-
hookDrift =
|
|
155
|
-
hookDiff.missing.length > 0 ||
|
|
156
|
-
hookDiff.stale.length > 0 ||
|
|
157
|
-
hookDiff.duplicates.length > 0 ||
|
|
158
|
-
hookDiff.misplaced.length > 0 ||
|
|
159
|
-
hookDiff.orphans.length > 0 ||
|
|
160
|
-
hookDiff.invalidTopLevelKeys.length > 0 ||
|
|
161
|
-
hookDiff.invalidEventKeys.length > 0;
|
|
162
|
-
if (hookDiff.missing.length > 0) {
|
|
163
|
-
issues.push(
|
|
164
|
-
`${spec.settingsFile}: missing hooks (${hookDiff.missing.map((e) => e.settingsKey).join(", ")})`,
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
if (hookDiff.stale.length > 0) {
|
|
168
|
-
issues.push(
|
|
169
|
-
`${spec.settingsFile}: stale hook commands (${hookDiff.stale.map((e) => e.settingsKey).join(", ")})`,
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
if (hookDiff.duplicates.length > 0) {
|
|
173
|
-
issues.push(
|
|
174
|
-
`${spec.settingsFile}: duplicate hooks (${hookDiff.duplicates.map((e) => e.settingsKey).join(", ")})`,
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
if (hookDiff.misplaced.length > 0) {
|
|
178
|
-
issues.push(
|
|
179
|
-
`${spec.settingsFile}: hooks under the wrong event (${hookDiff.misplaced.map((e) => e.subcommand).join(", ")})`,
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
if (hookDiff.orphans.length > 0) {
|
|
183
|
-
issues.push(`${spec.settingsFile}: obsolete hooks (${hookDiff.orphans.join(", ")})`);
|
|
184
|
-
}
|
|
185
|
-
if (hookDiff.invalidTopLevelKeys.length > 0) {
|
|
186
|
-
issues.push(
|
|
187
|
-
`${spec.settingsFile}: invalid fields (${hookDiff.invalidTopLevelKeys.join(", ")})`,
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
if (hookDiff.invalidEventKeys.length > 0) {
|
|
191
|
-
issues.push(
|
|
192
|
-
`${spec.settingsFile}: unsupported events (${hookDiff.invalidEventKeys.join(", ")})`,
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
} catch (error) {
|
|
196
|
-
hookCheckError = true;
|
|
197
|
-
issues.push(`${spec.settingsFile}: invalid JSON (${(error as Error).message})`);
|
|
319
|
+
for (const adapter of adapters) {
|
|
320
|
+
const instructions = checkInstructions(projectRoot, { binName: bin, adapter });
|
|
321
|
+
if (instructions.status === "error") instructionStatus = "error";
|
|
322
|
+
else if (instructions.status === "drift" && instructionStatus !== "error") {
|
|
323
|
+
instructionStatus = "drift";
|
|
198
324
|
}
|
|
325
|
+
issues.push(...instructions.issues);
|
|
326
|
+
const hooks = checkAdapterHooks(projectRoot, adapter, bin);
|
|
327
|
+
hookCheckError = hookCheckError || hooks.error;
|
|
328
|
+
hookDrift = hookDrift || hooks.drift;
|
|
329
|
+
issues.push(...hooks.issues);
|
|
199
330
|
}
|
|
200
331
|
const gitHooks = checkGitHooks(projectRoot);
|
|
201
332
|
if (gitHooks.status !== "fresh") issues.push(...gitHooks.issues);
|
|
@@ -206,21 +337,26 @@ export function registerInitCommand(program: Command, emit: EmitContext, binName
|
|
|
206
337
|
issues.push(`event ledger V3 is runtime-stale (${ledgerRuntimeIssues.join(", ")})`);
|
|
207
338
|
}
|
|
208
339
|
const merged =
|
|
209
|
-
|
|
340
|
+
instructionStatus === "error" || hookCheckError
|
|
210
341
|
? "error"
|
|
211
342
|
: hookDrift ||
|
|
343
|
+
instructionStatus === "drift" ||
|
|
212
344
|
gitHooks.status !== "fresh" ||
|
|
213
345
|
ledger.state !== "active" ||
|
|
214
346
|
ledgerRuntimeIssues.length > 0
|
|
215
347
|
? "drift"
|
|
216
|
-
:
|
|
348
|
+
: "fresh";
|
|
217
349
|
const head =
|
|
218
350
|
merged === "fresh"
|
|
219
351
|
? "harn init --check: hooks + instructions + skills + event ledger V3 are current"
|
|
220
352
|
: merged === "drift"
|
|
221
353
|
? "harn init --check: drift found (re-run `init` to refresh)"
|
|
222
354
|
: "harn init --check: error";
|
|
223
|
-
const lines = issues.length
|
|
355
|
+
const lines = issues.length
|
|
356
|
+
? `\n${dedupe(issues)
|
|
357
|
+
.map((i) => ` ✗ ${i}`)
|
|
358
|
+
.join("\n")}`
|
|
359
|
+
: "";
|
|
224
360
|
emit.text(`${head}${lines}`);
|
|
225
361
|
emit.setExitCode(merged === "fresh" ? 0 : merged === "drift" ? 2 : 1);
|
|
226
362
|
return;
|
|
@@ -305,60 +441,93 @@ export function registerInitCommand(program: Command, emit: EmitContext, binName
|
|
|
305
441
|
}
|
|
306
442
|
|
|
307
443
|
// ── 2. adapter hooks ───────────────────────────────────────────────────
|
|
308
|
-
const
|
|
309
|
-
|
|
444
|
+
for (const adapter of adapters) {
|
|
445
|
+
const spec = ADAPTER_SPECS[adapter];
|
|
446
|
+
const settingsPath = resolve(projectRoot, spec.settingsFile);
|
|
447
|
+
const agentHook = agentHookPathForProject(projectRoot, HARNERY_ROOT);
|
|
310
448
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
449
|
+
if (spec.installMode === "opencode-plugin") {
|
|
450
|
+
// OpenCode has no hooks map. Install the plugin directory instead; the
|
|
451
|
+
// instructions + skills step below still runs (AGENTS.md and
|
|
452
|
+
// .agents/skills are read natively, so no shim or mirror is needed).
|
|
453
|
+
const plugin = installOpenCodePlugin(projectRoot, { binName: bin, agentHook, dryRun });
|
|
454
|
+
if (plugin.error) {
|
|
455
|
+
emit.text(plugin.error);
|
|
456
|
+
emit.setExitCode(1);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
actions.push(...plugin.actions);
|
|
460
|
+
} else {
|
|
461
|
+
let settings: SettingsFile;
|
|
462
|
+
if (existsSync(settingsPath)) {
|
|
463
|
+
try {
|
|
464
|
+
settings = JSON.parse(readFileSync(settingsPath, "utf8")) as SettingsFile;
|
|
465
|
+
} catch (err) {
|
|
466
|
+
emit.text(
|
|
467
|
+
`✗ ${rel(projectRoot, settingsPath)} exists but isn't valid JSON; refusing to ` +
|
|
468
|
+
`overwrite. Fix it and re-run.\n (${(err as Error).message})`,
|
|
469
|
+
);
|
|
470
|
+
emit.setExitCode(1);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
settings = {};
|
|
475
|
+
}
|
|
476
|
+
const bridge = codexWindowsBridgeConfig(projectRoot);
|
|
477
|
+
if (bridge.error && spec.windowsBridgeHooks) {
|
|
478
|
+
actions.push(`⚠ ${bridge.error}; writing ${adapter} hooks without commandWindows`);
|
|
479
|
+
}
|
|
480
|
+
const { wired, already, removed, upgraded } = wireHooks(
|
|
481
|
+
settings,
|
|
482
|
+
spec,
|
|
483
|
+
agentHook,
|
|
484
|
+
adapter,
|
|
485
|
+
{ windowsBridgeEntryPoint: bridge.entryPoint },
|
|
319
486
|
);
|
|
320
|
-
emit.setExitCode(1);
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
} else {
|
|
324
|
-
settings = {};
|
|
325
|
-
}
|
|
326
|
-
const { wired, already, removed, upgraded } = wireHooks(settings, spec, agentHook, adapter);
|
|
327
487
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
488
|
+
if (wired === 0 && removed === 0 && upgraded === 0) {
|
|
489
|
+
actions.push(
|
|
490
|
+
`· all ${spec.events.length} ${adapter} hooks already wired in ${rel(projectRoot, settingsPath)}`,
|
|
491
|
+
);
|
|
492
|
+
} else if (dryRun) {
|
|
493
|
+
actions.push(
|
|
494
|
+
`+ would wire ${wired} hook(s), upgrade ${upgraded} stale command(s), and remove ` +
|
|
495
|
+
`${removed} obsolete/duplicate command(s) in ${rel(projectRoot, settingsPath)} (${already} already present)`,
|
|
496
|
+
);
|
|
497
|
+
} else {
|
|
498
|
+
mkdirSync(dirname(settingsPath), { recursive: true });
|
|
499
|
+
writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}\n`);
|
|
500
|
+
actions.push(
|
|
501
|
+
`+ wired ${wired} hook(s), upgraded ${upgraded} stale command(s), and removed ` +
|
|
502
|
+
`${removed} obsolete/duplicate command(s) in ${rel(projectRoot, settingsPath)} (${already} already present)`,
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
const authorizationReview = codexHookReviewAction(adapter);
|
|
506
|
+
if (authorizationReview) actions.push(authorizationReview);
|
|
507
|
+
}
|
|
344
508
|
}
|
|
345
|
-
const authorizationReview = codexHookReviewAction(adapter);
|
|
346
|
-
if (authorizationReview) actions.push(authorizationReview);
|
|
347
509
|
|
|
348
510
|
// ── 3. agent-facing instructions block + skills ────────────────────────
|
|
349
|
-
//
|
|
350
|
-
//
|
|
351
|
-
//
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
511
|
+
// Idempotent per adapter: the AGENTS.md block is adapter-independent, the
|
|
512
|
+
// harn-* skills land in each adapter's directory, and the CLAUDE.md shim and
|
|
513
|
+
// Cursor rule exist only for their own adapter. A misconfigured host addendum
|
|
514
|
+
// aborts here rather than half-writing: the apply step validates the
|
|
515
|
+
// configured source before it touches a file, so a bad path leaves the repo
|
|
516
|
+
// exactly as it found it.
|
|
517
|
+
const warnings: string[] = [];
|
|
518
|
+
for (const adapter of adapters) {
|
|
519
|
+
let applied: ApplyResult;
|
|
520
|
+
try {
|
|
521
|
+
applied = applyInstructions(projectRoot, { binName: bin, adapter, dryRun });
|
|
522
|
+
} catch (err) {
|
|
523
|
+
if (!(err instanceof HostAddendumError)) throw err;
|
|
524
|
+
emit.text(`${bin} init: ${err.message}`);
|
|
525
|
+
emit.setExitCode(1);
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
actions.push(...applied.actions);
|
|
529
|
+
warnings.push(...applied.warnings);
|
|
360
530
|
}
|
|
361
|
-
actions.push(...applied.actions);
|
|
362
531
|
|
|
363
532
|
// ── 4. git-hook managed regions ────────────────────────────────────────
|
|
364
533
|
// Same lifecycle contract as the instructions block: the coordination
|
|
@@ -367,7 +536,9 @@ export function registerInitCommand(program: Command, emit: EmitContext, binName
|
|
|
367
536
|
const gitHooks = applyGitHooks(projectRoot, { dryRun });
|
|
368
537
|
actions.push(...gitHooks.actions);
|
|
369
538
|
|
|
370
|
-
emit.text(
|
|
539
|
+
emit.text(
|
|
540
|
+
render(projectRoot, dryRun, dedupe(actions), dedupe([...warnings, ...gitHooks.warnings])),
|
|
541
|
+
);
|
|
371
542
|
});
|
|
372
543
|
}
|
|
373
544
|
|
|
@@ -435,6 +606,7 @@ export function wireHooks(
|
|
|
435
606
|
spec: AdapterSpec,
|
|
436
607
|
agentHookPath: string,
|
|
437
608
|
adapter: AdapterId,
|
|
609
|
+
options?: WiringOptions,
|
|
438
610
|
): { wired: number; already: number; removed: number; upgraded: number } {
|
|
439
611
|
if (spec.rootVersion !== undefined && settings.version === undefined) {
|
|
440
612
|
settings.version = spec.rootVersion;
|
|
@@ -453,6 +625,19 @@ export function wireHooks(
|
|
|
453
625
|
}
|
|
454
626
|
for (const { settingsKey, subcommand } of spec.events) {
|
|
455
627
|
const command = hookCommand(spec, agentHookPath, subcommand, adapter);
|
|
628
|
+
const timeout = hookTimeoutFor(spec, subcommand);
|
|
629
|
+
const commandWindows = expectedCommandWindows(
|
|
630
|
+
spec,
|
|
631
|
+
agentHookPath,
|
|
632
|
+
subcommand,
|
|
633
|
+
adapter,
|
|
634
|
+
options,
|
|
635
|
+
);
|
|
636
|
+
const handlerFields = {
|
|
637
|
+
timeout,
|
|
638
|
+
commandWindows,
|
|
639
|
+
windowsBridge: spec.windowsBridgeHooks === true,
|
|
640
|
+
};
|
|
456
641
|
let present = false;
|
|
457
642
|
for (const key of Object.keys(settings.hooks)) {
|
|
458
643
|
if (key === settingsKey) continue;
|
|
@@ -463,7 +648,7 @@ export function wireHooks(
|
|
|
463
648
|
const groups = settings.hooks[settingsKey] ?? [];
|
|
464
649
|
const nextGroups: HookGroup[] = [];
|
|
465
650
|
for (const group of groups) {
|
|
466
|
-
const normalized = normalizeEventGroup(group, subcommand, command, present);
|
|
651
|
+
const normalized = normalizeEventGroup(group, subcommand, command, handlerFields, present);
|
|
467
652
|
if (normalized.found && !present) present = true;
|
|
468
653
|
upgraded += normalized.upgraded;
|
|
469
654
|
removed += normalized.removed;
|
|
@@ -476,7 +661,15 @@ export function wireHooks(
|
|
|
476
661
|
continue;
|
|
477
662
|
}
|
|
478
663
|
const current = settings.hooks[settingsKey] ?? [];
|
|
479
|
-
current.push(
|
|
664
|
+
current.push(
|
|
665
|
+
makeEntry(
|
|
666
|
+
spec.entryShape,
|
|
667
|
+
command,
|
|
668
|
+
spec.entryShape === "cursor" && subcommand === "stop"
|
|
669
|
+
? { loop_limit: CURSOR_STOP_FOLLOWUP_LOOP_LIMIT }
|
|
670
|
+
: { timeout, commandWindows },
|
|
671
|
+
),
|
|
672
|
+
);
|
|
480
673
|
settings.hooks[settingsKey] = current;
|
|
481
674
|
wired++;
|
|
482
675
|
}
|
|
@@ -497,6 +690,7 @@ function normalizeEventGroup(
|
|
|
497
690
|
group: HookGroup,
|
|
498
691
|
subcommand: string,
|
|
499
692
|
canonical: string,
|
|
693
|
+
fields: { timeout?: number; commandWindows?: string; windowsBridge: boolean },
|
|
500
694
|
alreadyFound: boolean,
|
|
501
695
|
): { group: HookGroup | null; found: boolean; upgraded: number; removed: number } {
|
|
502
696
|
let found = false;
|
|
@@ -510,11 +704,13 @@ function normalizeEventGroup(
|
|
|
510
704
|
group.command = canonical;
|
|
511
705
|
upgraded++;
|
|
512
706
|
}
|
|
707
|
+
if (applyCursorStopLoopLimit(group, subcommand)) upgraded++;
|
|
513
708
|
}
|
|
514
709
|
}
|
|
515
710
|
if ("hooks" in group && Array.isArray(group.hooks)) {
|
|
516
711
|
const kept = [] as typeof group.hooks;
|
|
517
|
-
for (const
|
|
712
|
+
for (const original of group.hooks) {
|
|
713
|
+
let hook = original;
|
|
518
714
|
if (typeof hook.command !== "string" || !commandWiresSubcommand(hook.command, subcommand)) {
|
|
519
715
|
kept.push(hook);
|
|
520
716
|
continue;
|
|
@@ -524,8 +720,24 @@ function normalizeEventGroup(
|
|
|
524
720
|
continue;
|
|
525
721
|
}
|
|
526
722
|
found = true;
|
|
723
|
+
let changed = false;
|
|
527
724
|
if (hook.command !== canonical) {
|
|
528
725
|
hook.command = canonical;
|
|
726
|
+
changed = true;
|
|
727
|
+
}
|
|
728
|
+
if (fields.timeout !== undefined && hook.timeout !== fields.timeout) {
|
|
729
|
+
hook.timeout = fields.timeout;
|
|
730
|
+
changed = true;
|
|
731
|
+
}
|
|
732
|
+
// Harnery owns commandWindows on its own handlers for adapters that run
|
|
733
|
+
// it: write the opted-in command, or remove one a project opted out of.
|
|
734
|
+
if (fields.windowsBridge && hook.commandWindows !== fields.commandWindows) {
|
|
735
|
+
if (fields.commandWindows === undefined) delete hook.commandWindows;
|
|
736
|
+
else hook.commandWindows = fields.commandWindows;
|
|
737
|
+
changed = true;
|
|
738
|
+
}
|
|
739
|
+
if (changed) {
|
|
740
|
+
hook = orderHandlerKeys(hook);
|
|
529
741
|
upgraded++;
|
|
530
742
|
}
|
|
531
743
|
kept.push(hook);
|
|
@@ -27,7 +27,7 @@ export function registerInstructionsCommand(program: Command, emit: EmitContext)
|
|
|
27
27
|
command
|
|
28
28
|
.command("manifest [paths...]")
|
|
29
29
|
.description("Emit a machine-readable bundle manifest for one or more working paths")
|
|
30
|
-
.option("--adapter <adapter>", "claude-code, cursor, codex, or all", "all")
|
|
30
|
+
.option("--adapter <adapter>", "claude-code, cursor, codex, opencode, or all", "all")
|
|
31
31
|
.option("--format <type>", "Output format: json or table", "json")
|
|
32
32
|
.option("-o, --output <file>", "Write the complete JSON manifest to a file")
|
|
33
33
|
.action((paths: string[], options: ManifestOptions) => {
|
|
@@ -71,9 +71,13 @@ export function registerInstructionsCommand(program: Command, emit: EmitContext)
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function parseAdapters(value: string): Adapter[] {
|
|
74
|
-
if (value === "all") return ["claude-code", "cursor", "codex"];
|
|
75
|
-
if (value === "claude-code" || value === "cursor" || value === "codex"
|
|
76
|
-
|
|
74
|
+
if (value === "all") return ["claude-code", "cursor", "codex", "opencode"];
|
|
75
|
+
if (value === "claude-code" || value === "cursor" || value === "codex" || value === "opencode") {
|
|
76
|
+
return [value];
|
|
77
|
+
}
|
|
78
|
+
throw new Error(
|
|
79
|
+
`unsupported adapter '${value}' (expected claude-code, cursor, codex, opencode, or all)`,
|
|
80
|
+
);
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
function enrichBundle(bundle: ReturnType<typeof buildInstructionBundle>, coordRoot: string) {
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
verifyEventV3SupportTransactionShadow,
|
|
34
34
|
writeEventV3SupportTransactionShadow,
|
|
35
35
|
} from "../core/events/v3/support-storage/index.ts";
|
|
36
|
+
import { stateDirMode } from "../core/storage/modes.ts";
|
|
36
37
|
|
|
37
38
|
type SupportEvidence = Record<
|
|
38
39
|
string,
|
|
@@ -272,7 +273,7 @@ export function registerLedgerV3Command(
|
|
|
272
273
|
}
|
|
273
274
|
const root = resolve(options.root ?? coordRoot(context));
|
|
274
275
|
const transactions = transactionRoot(root);
|
|
275
|
-
mkdirSync(transactions, { recursive: true, mode:
|
|
276
|
+
mkdirSync(transactions, { recursive: true, mode: stateDirMode() });
|
|
276
277
|
emit.data(
|
|
277
278
|
await planEventV3SupportTransaction({
|
|
278
279
|
transaction_root: transactions,
|