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
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { type Dirent, lstatSync, readdirSync, type Stats } from "node:fs";
|
|
3
|
+
import { dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
4
|
+
|
|
5
|
+
export const DISK_GIT_STATES = [
|
|
6
|
+
"tracked",
|
|
7
|
+
"untracked",
|
|
8
|
+
"ignored",
|
|
9
|
+
"git-metadata",
|
|
10
|
+
"non-repository",
|
|
11
|
+
"unknown",
|
|
12
|
+
] as const;
|
|
13
|
+
export type DiskGitState = (typeof DISK_GIT_STATES)[number];
|
|
14
|
+
export type DiskGroup = "directory" | "repository" | "extension" | "git" | "files";
|
|
15
|
+
|
|
16
|
+
export interface DiskOptions {
|
|
17
|
+
git?: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
exclude?: string[];
|
|
20
|
+
group?: DiskGroup;
|
|
21
|
+
depth?: number;
|
|
22
|
+
top?: number;
|
|
23
|
+
minSize?: number;
|
|
24
|
+
apparent?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface DiskTotals {
|
|
28
|
+
files: number;
|
|
29
|
+
apparent_bytes: number;
|
|
30
|
+
allocated_bytes: number | null;
|
|
31
|
+
}
|
|
32
|
+
export interface DiskRow extends DiskTotals {
|
|
33
|
+
path: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DiskReport {
|
|
36
|
+
schema: "harnery.disk-usage/v1";
|
|
37
|
+
root: string;
|
|
38
|
+
measurement: "allocated" | "apparent" | "apparent-fallback";
|
|
39
|
+
complete: boolean;
|
|
40
|
+
filters: DiskOptions;
|
|
41
|
+
totals: DiskTotals;
|
|
42
|
+
git: Record<DiskGitState, DiskTotals>;
|
|
43
|
+
groups: DiskRow[];
|
|
44
|
+
group_count: number;
|
|
45
|
+
largest_files: (DiskRow & { git: DiskGitState; repository: string | null })[];
|
|
46
|
+
repositories: string[];
|
|
47
|
+
skipped: { symlinks: number; special_files: number; excluded: number };
|
|
48
|
+
issues: { path: string; message: string }[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const TYPES: Record<string, Set<string>> = {
|
|
52
|
+
video: new Set(["mp4", "mov", "mkv", "webm", "avi", "m4v", "mxf"]),
|
|
53
|
+
audio: new Set(["mp3", "wav", "m4a", "aac", "flac", "ogg", "aiff"]),
|
|
54
|
+
image: new Set([
|
|
55
|
+
"png",
|
|
56
|
+
"jpg",
|
|
57
|
+
"jpeg",
|
|
58
|
+
"webp",
|
|
59
|
+
"gif",
|
|
60
|
+
"tif",
|
|
61
|
+
"tiff",
|
|
62
|
+
"svg",
|
|
63
|
+
"avif",
|
|
64
|
+
"heic",
|
|
65
|
+
"bmp",
|
|
66
|
+
"psd",
|
|
67
|
+
]),
|
|
68
|
+
archive: new Set(["zip", "gz", "tgz", "tar", "bz2", "xz", "7z", "rar"]),
|
|
69
|
+
};
|
|
70
|
+
TYPES.media = new Set([...TYPES.video!, ...TYPES.audio!, ...TYPES.image!]);
|
|
71
|
+
|
|
72
|
+
interface Repository {
|
|
73
|
+
root: string;
|
|
74
|
+
tracked: Set<string>;
|
|
75
|
+
untracked: Set<string>;
|
|
76
|
+
valid: boolean;
|
|
77
|
+
}
|
|
78
|
+
const portable = (path: string): string => path.split(sep).join("/");
|
|
79
|
+
const empty = (allocated: boolean): DiskTotals => ({
|
|
80
|
+
files: 0,
|
|
81
|
+
apparent_bytes: 0,
|
|
82
|
+
allocated_bytes: allocated ? 0 : null,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export function parseDiskSize(value: string): number {
|
|
86
|
+
const match = /^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB|KiB|MiB|GiB|TiB)?$/i.exec(value);
|
|
87
|
+
if (!match) throw new Error("--min-size requires bytes or a size such as 10MB or 1GiB");
|
|
88
|
+
const units: Record<string, number> = {
|
|
89
|
+
b: 1,
|
|
90
|
+
kb: 1e3,
|
|
91
|
+
mb: 1e6,
|
|
92
|
+
gb: 1e9,
|
|
93
|
+
tb: 1e12,
|
|
94
|
+
kib: 1024,
|
|
95
|
+
mib: 1024 ** 2,
|
|
96
|
+
gib: 1024 ** 3,
|
|
97
|
+
tib: 1024 ** 4,
|
|
98
|
+
};
|
|
99
|
+
const bytes = Number(match[1]) * units[(match[2] ?? "b").toLowerCase()]!;
|
|
100
|
+
if (!Number.isSafeInteger(bytes) || bytes < 0)
|
|
101
|
+
throw new Error("--min-size must resolve to a non-negative whole byte count");
|
|
102
|
+
return bytes;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Inspect regular files only. No bodies are read and no symlinks are followed. */
|
|
106
|
+
export function diskUsage(input = ".", options: DiskOptions = {}): DiskReport {
|
|
107
|
+
const root = resolve(input);
|
|
108
|
+
const rootStat = lstatSync(root);
|
|
109
|
+
if (rootStat.isSymbolicLink() || (!rootStat.isDirectory() && !rootStat.isFile())) {
|
|
110
|
+
throw new Error("disk requires a regular file or directory, not a symlink or special file");
|
|
111
|
+
}
|
|
112
|
+
const group = options.group ?? "directory";
|
|
113
|
+
if (!["directory", "repository", "extension", "git", "files"].includes(group))
|
|
114
|
+
throw new Error("invalid --group; use directory, repository, extension, git, or files");
|
|
115
|
+
const depth = options.depth ?? 1;
|
|
116
|
+
const top = options.top ?? 20;
|
|
117
|
+
if (!Number.isSafeInteger(depth) || depth < 1)
|
|
118
|
+
throw new Error("--depth must be a positive integer");
|
|
119
|
+
if (!Number.isSafeInteger(top) || top < 1) throw new Error("--top must be a positive integer");
|
|
120
|
+
if (
|
|
121
|
+
options.minSize !== undefined &&
|
|
122
|
+
(!Number.isSafeInteger(options.minSize) || options.minSize < 0)
|
|
123
|
+
)
|
|
124
|
+
throw new Error("invalid --min-size");
|
|
125
|
+
const states = options.git ? new Set(options.git.split(",")) : null;
|
|
126
|
+
if (states && [...states].some((s) => !DISK_GIT_STATES.includes(s as DiskGitState)))
|
|
127
|
+
throw new Error(`invalid --git; use ${DISK_GIT_STATES.join(", ")}`);
|
|
128
|
+
const extensions = options.type
|
|
129
|
+
? new Set(
|
|
130
|
+
options.type
|
|
131
|
+
.toLowerCase()
|
|
132
|
+
.split(",")
|
|
133
|
+
.flatMap((type) => [...(TYPES[type] ?? new Set([type.replace(/^\./, "")]))]),
|
|
134
|
+
)
|
|
135
|
+
: null;
|
|
136
|
+
const excludes = (options.exclude ?? [])
|
|
137
|
+
.flatMap((value) => value.split(","))
|
|
138
|
+
.map((value) => value.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/$/, ""));
|
|
139
|
+
if (excludes.some((value) => !value || isAbsolute(value) || value.split("/").includes("..")))
|
|
140
|
+
throw new Error("--exclude requires directory names or paths relative to the scan root");
|
|
141
|
+
let allocatedAvailable = process.platform !== "win32" && Number.isFinite(rootStat.blocks);
|
|
142
|
+
const report: DiskReport = {
|
|
143
|
+
schema: "harnery.disk-usage/v1",
|
|
144
|
+
root,
|
|
145
|
+
measurement: options.apparent
|
|
146
|
+
? "apparent"
|
|
147
|
+
: allocatedAvailable
|
|
148
|
+
? "allocated"
|
|
149
|
+
: "apparent-fallback",
|
|
150
|
+
complete: true,
|
|
151
|
+
filters: { ...options, group, depth, top },
|
|
152
|
+
totals: empty(allocatedAvailable),
|
|
153
|
+
git: Object.fromEntries(
|
|
154
|
+
DISK_GIT_STATES.map((state) => [state, empty(allocatedAvailable)]),
|
|
155
|
+
) as Record<DiskGitState, DiskTotals>,
|
|
156
|
+
groups: [],
|
|
157
|
+
group_count: 0,
|
|
158
|
+
largest_files: [],
|
|
159
|
+
repositories: [],
|
|
160
|
+
skipped: { symlinks: 0, special_files: 0, excluded: 0 },
|
|
161
|
+
issues: [],
|
|
162
|
+
};
|
|
163
|
+
const groups = new Map<string, DiskRow>();
|
|
164
|
+
const repositories = new Map<string, Repository>();
|
|
165
|
+
const seen = new Set<string>();
|
|
166
|
+
const issue = (path: string, error: unknown): void => {
|
|
167
|
+
report.complete = false;
|
|
168
|
+
report.issues.push({ path, message: error instanceof Error ? error.message : String(error) });
|
|
169
|
+
};
|
|
170
|
+
const git = (cwd: string, args: string[]) =>
|
|
171
|
+
spawnSync("git", ["-C", cwd, "-c", "core.fsmonitor=false", ...args], {
|
|
172
|
+
encoding: "utf8",
|
|
173
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
174
|
+
timeout: 60_000,
|
|
175
|
+
windowsHide: true,
|
|
176
|
+
});
|
|
177
|
+
const loadRepo = (repoRoot: string): Repository => {
|
|
178
|
+
const cached = repositories.get(repoRoot);
|
|
179
|
+
if (cached) return cached;
|
|
180
|
+
const repo: Repository = {
|
|
181
|
+
root: repoRoot,
|
|
182
|
+
tracked: new Set(),
|
|
183
|
+
untracked: new Set(),
|
|
184
|
+
valid: false,
|
|
185
|
+
};
|
|
186
|
+
repositories.set(repoRoot, repo);
|
|
187
|
+
for (const [args, target] of [
|
|
188
|
+
[["ls-files", "--cached", "-z"], repo.tracked],
|
|
189
|
+
[["ls-files", "--others", "--exclude-standard", "-z"], repo.untracked],
|
|
190
|
+
] as const) {
|
|
191
|
+
const result = git(repoRoot, [...args]);
|
|
192
|
+
if (result.status !== 0) {
|
|
193
|
+
issue(
|
|
194
|
+
portable(relative(root, repoRoot)) || ".",
|
|
195
|
+
result.error ?? new Error(`Git classification failed: ${result.stderr.trim()}`),
|
|
196
|
+
);
|
|
197
|
+
return repo;
|
|
198
|
+
}
|
|
199
|
+
for (const path of result.stdout.split("\0")) if (path) target.add(path);
|
|
200
|
+
}
|
|
201
|
+
repo.valid = true;
|
|
202
|
+
return repo;
|
|
203
|
+
};
|
|
204
|
+
const startDir = rootStat.isDirectory() ? root : dirname(root);
|
|
205
|
+
const detected = git(startDir, ["rev-parse", "--show-toplevel"]);
|
|
206
|
+
if (detected.error) issue(".", detected.error);
|
|
207
|
+
const initialRepo = detected.status === 0 ? loadRepo(resolve(detected.stdout.trim())) : null;
|
|
208
|
+
const repoLabel = (repo: Repository | null): string | null => {
|
|
209
|
+
if (!repo) return null;
|
|
210
|
+
const label = portable(relative(root, repo.root));
|
|
211
|
+
return !label || label === ".." || label.startsWith("../") ? "." : label;
|
|
212
|
+
};
|
|
213
|
+
const metric = (row: DiskTotals): number =>
|
|
214
|
+
options.apparent || row.allocated_bytes === null ? row.apparent_bytes : row.allocated_bytes;
|
|
215
|
+
const compare = (a: DiskRow, b: DiskRow): number =>
|
|
216
|
+
metric(b) - metric(a) || a.path.localeCompare(b.path);
|
|
217
|
+
const add = (totals: DiskTotals, size: number, allocated: number): void => {
|
|
218
|
+
totals.files++;
|
|
219
|
+
totals.apparent_bytes += size;
|
|
220
|
+
if (totals.allocated_bytes !== null) totals.allocated_bytes += allocated;
|
|
221
|
+
};
|
|
222
|
+
const excluded = (path: string): boolean =>
|
|
223
|
+
excludes.some((value) =>
|
|
224
|
+
value.includes("/")
|
|
225
|
+
? path === value || path.startsWith(`${value}/`)
|
|
226
|
+
: path.split("/").includes(value),
|
|
227
|
+
);
|
|
228
|
+
const file = (path: string, metadata: Stats, repo: Repository | null, inGit: boolean): void => {
|
|
229
|
+
const rel = portable(relative(root, path)) || ".";
|
|
230
|
+
const extension = extname(path).slice(1).toLowerCase();
|
|
231
|
+
const repoPath = repo ? portable(relative(repo.root, path)) : "";
|
|
232
|
+
const state: DiskGitState = inGit
|
|
233
|
+
? "git-metadata"
|
|
234
|
+
: !repo
|
|
235
|
+
? "non-repository"
|
|
236
|
+
: !repo.valid
|
|
237
|
+
? "unknown"
|
|
238
|
+
: repo.tracked.has(repoPath)
|
|
239
|
+
? "tracked"
|
|
240
|
+
: repo.untracked.has(repoPath)
|
|
241
|
+
? "untracked"
|
|
242
|
+
: "ignored";
|
|
243
|
+
if ((states && !states.has(state)) || (extensions && !extensions.has(extension))) return;
|
|
244
|
+
const blocksAvailable = process.platform !== "win32" && Number.isFinite(metadata.blocks);
|
|
245
|
+
if (!blocksAvailable) allocatedAvailable = false;
|
|
246
|
+
const allocation = blocksAvailable ? metadata.blocks * 512 : metadata.size;
|
|
247
|
+
if (
|
|
248
|
+
(options.apparent || !blocksAvailable ? metadata.size : allocation) < (options.minSize ?? 0)
|
|
249
|
+
)
|
|
250
|
+
return;
|
|
251
|
+
const identity = metadata.ino ? `${metadata.dev}:${metadata.ino}` : path;
|
|
252
|
+
const allocated = seen.has(identity) ? 0 : allocation;
|
|
253
|
+
seen.add(identity);
|
|
254
|
+
add(report.totals, metadata.size, allocated);
|
|
255
|
+
add(report.git[state], metadata.size, allocated);
|
|
256
|
+
const row: DiskReport["largest_files"][number] = {
|
|
257
|
+
path: rel,
|
|
258
|
+
files: 1,
|
|
259
|
+
apparent_bytes: metadata.size,
|
|
260
|
+
allocated_bytes: blocksAvailable ? allocation : null,
|
|
261
|
+
git: state,
|
|
262
|
+
repository: repoLabel(repo),
|
|
263
|
+
};
|
|
264
|
+
report.largest_files.push(row);
|
|
265
|
+
report.largest_files.sort(compare);
|
|
266
|
+
if (report.largest_files.length > top) report.largest_files.pop();
|
|
267
|
+
if (group === "files") return;
|
|
268
|
+
const parts = rel.split("/");
|
|
269
|
+
const label =
|
|
270
|
+
group === "git"
|
|
271
|
+
? state
|
|
272
|
+
: group === "repository"
|
|
273
|
+
? (repoLabel(repo) ?? "(non-repository)")
|
|
274
|
+
: group === "extension"
|
|
275
|
+
? extension
|
|
276
|
+
? `.${extension}`
|
|
277
|
+
: "(no extension)"
|
|
278
|
+
: parts.length > 1
|
|
279
|
+
? parts.slice(0, Math.min(depth, parts.length - 1)).join("/")
|
|
280
|
+
: ".";
|
|
281
|
+
let bucket = groups.get(label);
|
|
282
|
+
if (!bucket) {
|
|
283
|
+
bucket = { path: label, ...empty(allocatedAvailable) };
|
|
284
|
+
groups.set(label, bucket);
|
|
285
|
+
}
|
|
286
|
+
add(bucket, metadata.size, allocated);
|
|
287
|
+
};
|
|
288
|
+
const walk = (dir: string, parentRepo: Repository | null, inGit: boolean): void => {
|
|
289
|
+
let entries: Dirent[];
|
|
290
|
+
try {
|
|
291
|
+
// A directory can turn into a link between reading its parent and visiting it.
|
|
292
|
+
if (lstatSync(dir).isSymbolicLink()) {
|
|
293
|
+
report.skipped.symlinks++;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
entries = readdirSync(dir, { withFileTypes: true }).sort((a, b) =>
|
|
297
|
+
a.name.localeCompare(b.name),
|
|
298
|
+
);
|
|
299
|
+
} catch (error) {
|
|
300
|
+
issue(portable(relative(root, dir)) || ".", error);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const marker = entries.find((entry) => entry.name === ".git");
|
|
304
|
+
const repo = !inGit && marker && !marker.isSymbolicLink() ? loadRepo(dir) : parentRepo;
|
|
305
|
+
for (const entry of entries) {
|
|
306
|
+
const path = resolve(dir, entry.name);
|
|
307
|
+
const rel = portable(relative(root, path));
|
|
308
|
+
if (excluded(rel)) {
|
|
309
|
+
report.skipped.excluded++;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
if (entry.isSymbolicLink()) {
|
|
313
|
+
report.skipped.symlinks++;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
const gitMetadata = inGit || entry.name === ".git";
|
|
317
|
+
if (entry.isDirectory()) {
|
|
318
|
+
if (gitMetadata && states && !states.has("git-metadata")) continue;
|
|
319
|
+
walk(path, repo, gitMetadata);
|
|
320
|
+
} else if (entry.isFile()) {
|
|
321
|
+
try {
|
|
322
|
+
const metadata = lstatSync(path);
|
|
323
|
+
if (metadata.isSymbolicLink()) report.skipped.symlinks++;
|
|
324
|
+
else if (metadata.isFile()) file(path, metadata, repo, gitMetadata);
|
|
325
|
+
else report.skipped.special_files++;
|
|
326
|
+
} catch (error) {
|
|
327
|
+
issue(rel, error);
|
|
328
|
+
}
|
|
329
|
+
} else report.skipped.special_files++;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
const inMetadata = startDir.split(sep).includes(".git");
|
|
333
|
+
if (rootStat.isDirectory()) walk(root, initialRepo, inMetadata);
|
|
334
|
+
else if (!excluded("."))
|
|
335
|
+
file(root, rootStat, initialRepo, inMetadata || root.endsWith(`${sep}.git`));
|
|
336
|
+
if (!allocatedAvailable) {
|
|
337
|
+
report.totals.allocated_bytes = null;
|
|
338
|
+
for (const totals of Object.values(report.git)) totals.allocated_bytes = null;
|
|
339
|
+
for (const row of groups.values()) row.allocated_bytes = null;
|
|
340
|
+
report.measurement = options.apparent ? "apparent" : "apparent-fallback";
|
|
341
|
+
}
|
|
342
|
+
report.repositories = [...repositories.values()].map((repo) => repoLabel(repo)!).sort();
|
|
343
|
+
report.group_count = group === "files" ? report.totals.files : groups.size;
|
|
344
|
+
report.groups =
|
|
345
|
+
group === "files" ? report.largest_files : [...groups.values()].sort(compare).slice(0, top);
|
|
346
|
+
return report;
|
|
347
|
+
}
|
package/src/lib/docs-lint.ts
CHANGED
|
@@ -166,9 +166,14 @@ function findMarkdownFiles(view: DocsRepositoryView): string[] {
|
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
/**
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Detect whether a file declares itself an intentional monolith. The banner
|
|
171
|
+
* must sit in the first 10 lines of the body; leading YAML frontmatter does
|
|
172
|
+
* not count toward those lines, since a v2 header alone can fill them.
|
|
173
|
+
*/
|
|
174
|
+
export function isDeclaredMonolith(content: string): boolean {
|
|
175
|
+
const body = content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "");
|
|
176
|
+
const head = body.split("\n").slice(0, 10).join("\n");
|
|
172
177
|
return /INTENTIONAL-MONOLITH/i.test(head);
|
|
173
178
|
}
|
|
174
179
|
|
|
@@ -5,6 +5,26 @@ function normalized(path: string): string {
|
|
|
5
5
|
return path.replaceAll("\\", "/");
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/** Host-supplied path prefixes that carry another system's frontmatter.
|
|
9
|
+
*
|
|
10
|
+
* Hosts declare these once (harnery's `extraDocsExcludedPrefixes`) for
|
|
11
|
+
* generated reference dumps and vendored upstream trees. Every metadata
|
|
12
|
+
* consumer reads them through `isExcludedDocsMetadataPath`, so a prefix
|
|
13
|
+
* listed by the host is honored by the audit and the sync, not only by the
|
|
14
|
+
* lint's own file discovery.
|
|
15
|
+
*/
|
|
16
|
+
let EXTRA_EXCLUDED_PREFIXES: readonly string[] = [];
|
|
17
|
+
|
|
18
|
+
export function initDocsMetadataExclusions(prefixes: readonly string[] | undefined): void {
|
|
19
|
+
EXTRA_EXCLUDED_PREFIXES = prefixes ?? [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function hasExcludedPrefix(rel: string): boolean {
|
|
23
|
+
return EXTRA_EXCLUDED_PREFIXES.some(
|
|
24
|
+
(prefix) => rel.startsWith(prefix) || rel.includes(`/${prefix}`),
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
/**
|
|
9
29
|
* Paths whose Markdown carries frontmatter belonging to another system:
|
|
10
30
|
* generated mirrors of documents that live elsewhere, vendored vendor
|
|
@@ -14,6 +34,7 @@ export function isExcludedDocsMetadataPath(path: string): boolean {
|
|
|
14
34
|
const rel = normalized(path);
|
|
15
35
|
const segments = rel.split("/");
|
|
16
36
|
return (
|
|
37
|
+
hasExcludedPrefix(rel) ||
|
|
17
38
|
segments.includes(".wiki-data") ||
|
|
18
39
|
// Dashboard surfaces render from copies of other repositories' documents.
|
|
19
40
|
/(?:^|\/)content\/dashboards\//.test(rel) ||
|