harnery 0.0.1 → 0.2.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/LICENSE +21 -0
- package/README.md +84 -2
- package/bin/agent-coord +42 -0
- package/bin/agent-hook +44 -0
- package/bin/harn +40 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/commander.d.ts +128 -0
- package/dist/commander.d.ts.map +1 -0
- package/dist/commander.js +126 -0
- package/dist/commands/agents.d.ts +18 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +3946 -0
- package/dist/commands/backup.d.ts +22 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +262 -0
- package/dist/commands/browse-ai.d.ts +4 -0
- package/dist/commands/browse-ai.d.ts.map +1 -0
- package/dist/commands/browse-ai.js +156 -0
- package/dist/commands/browse.d.ts +4 -0
- package/dist/commands/browse.d.ts.map +1 -0
- package/dist/commands/browse.js +590 -0
- package/dist/commands/callers.d.ts +4 -0
- package/dist/commands/callers.d.ts.map +1 -0
- package/dist/commands/callers.js +276 -0
- package/dist/commands/completion.d.ts +17 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +158 -0
- package/dist/commands/config-get.d.ts +4 -0
- package/dist/commands/config-get.d.ts.map +1 -0
- package/dist/commands/config-get.js +131 -0
- package/dist/commands/context.d.ts +11 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +185 -0
- package/dist/commands/cookies.d.ts +4 -0
- package/dist/commands/cookies.d.ts.map +1 -0
- package/dist/commands/cookies.js +140 -0
- package/dist/commands/docs.d.ts +4 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +137 -0
- package/dist/commands/doctor.d.ts +25 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +200 -0
- package/dist/commands/edit-batch.d.ts +18 -0
- package/dist/commands/edit-batch.d.ts.map +1 -0
- package/dist/commands/edit-batch.js +172 -0
- package/dist/commands/eml.d.ts +4 -0
- package/dist/commands/eml.d.ts.map +1 -0
- package/dist/commands/eml.js +428 -0
- package/dist/commands/env.d.ts +4 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +201 -0
- package/dist/commands/fetch.d.ts +4 -0
- package/dist/commands/fetch.d.ts.map +1 -0
- package/dist/commands/fetch.js +99 -0
- package/dist/commands/file-history.d.ts +4 -0
- package/dist/commands/file-history.d.ts.map +1 -0
- package/dist/commands/file-history.js +152 -0
- package/dist/commands/grep.d.ts +4 -0
- package/dist/commands/grep.d.ts.map +1 -0
- package/dist/commands/grep.js +317 -0
- package/dist/commands/init.d.ts +82 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +288 -0
- package/dist/commands/outline.d.ts +4 -0
- package/dist/commands/outline.d.ts.map +1 -0
- package/dist/commands/outline.js +494 -0
- package/dist/commands/presence.d.ts +12 -0
- package/dist/commands/presence.d.ts.map +1 -0
- package/dist/commands/presence.js +123 -0
- package/dist/commands/read.d.ts +7 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +46 -0
- package/dist/commands/scratch.d.ts +4 -0
- package/dist/commands/scratch.d.ts.map +1 -0
- package/dist/commands/scratch.js +426 -0
- package/dist/commands/session.d.ts +4 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +162 -0
- package/dist/commands/sync.d.ts +24 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +275 -0
- package/dist/commands/toc.d.ts +5 -0
- package/dist/commands/toc.d.ts.map +1 -0
- package/dist/commands/toc.js +153 -0
- package/dist/commands/tokens.d.ts +4 -0
- package/dist/commands/tokens.d.ts.map +1 -0
- package/dist/commands/tokens.js +48 -0
- package/dist/commands/tunnel.d.ts +4 -0
- package/dist/commands/tunnel.d.ts.map +1 -0
- package/dist/commands/tunnel.js +513 -0
- package/dist/commands/uninstall.d.ts +22 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +126 -0
- package/dist/commands/web.d.ts +4 -0
- package/dist/commands/web.d.ts.map +1 -0
- package/dist/commands/web.js +165 -0
- package/dist/core/agents/canonical-emit.d.ts +27 -0
- package/dist/core/agents/canonical-emit.d.ts.map +1 -0
- package/dist/core/agents/canonical-emit.js +72 -0
- package/dist/core/agents/cli-emit.d.ts +27 -0
- package/dist/core/agents/cli-emit.d.ts.map +1 -0
- package/dist/core/agents/cli-emit.js +57 -0
- package/dist/core/agents/cli.d.ts +10 -0
- package/dist/core/agents/cli.d.ts.map +1 -0
- package/dist/core/agents/cli.js +757 -0
- package/dist/core/agents/codex-replay.d.ts +29 -0
- package/dist/core/agents/codex-replay.d.ts.map +1 -0
- package/dist/core/agents/codex-replay.js +138 -0
- package/dist/core/agents/coord-client.d.ts +98 -0
- package/dist/core/agents/coord-client.d.ts.map +1 -0
- package/dist/core/agents/coord-client.js +212 -0
- package/dist/core/agents/events/consume.d.ts +59 -0
- package/dist/core/agents/events/consume.d.ts.map +1 -0
- package/dist/core/agents/events/consume.js +147 -0
- package/dist/core/agents/events/emit.d.ts +42 -0
- package/dist/core/agents/events/emit.d.ts.map +1 -0
- package/dist/core/agents/events/emit.js +70 -0
- package/dist/core/agents/events/ulid.d.ts +11 -0
- package/dist/core/agents/events/ulid.d.ts.map +1 -0
- package/dist/core/agents/events/ulid.js +47 -0
- package/dist/core/agents/index.d.ts +14 -0
- package/dist/core/agents/index.d.ts.map +1 -0
- package/dist/core/agents/index.js +13 -0
- package/dist/core/agents/paths.d.ts +6 -0
- package/dist/core/agents/paths.d.ts.map +1 -0
- package/dist/core/agents/paths.js +17 -0
- package/dist/core/agents/render/prompt-context.d.ts +43 -0
- package/dist/core/agents/render/prompt-context.d.ts.map +1 -0
- package/dist/core/agents/render/prompt-context.js +335 -0
- package/dist/core/agents/render/session-context.d.ts +39 -0
- package/dist/core/agents/render/session-context.d.ts.map +1 -0
- package/dist/core/agents/render/session-context.js +283 -0
- package/dist/core/agents/rules/claim-conflict.d.ts +35 -0
- package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -0
- package/dist/core/agents/rules/claim-conflict.js +244 -0
- package/dist/core/agents/rules/commit-conflict.d.ts +59 -0
- package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -0
- package/dist/core/agents/rules/commit-conflict.js +244 -0
- package/dist/core/agents/rules/stop-hook.d.ts +44 -0
- package/dist/core/agents/rules/stop-hook.d.ts.map +1 -0
- package/dist/core/agents/rules/stop-hook.js +161 -0
- package/dist/core/agents/session-events.d.ts +41 -0
- package/dist/core/agents/session-events.d.ts.map +1 -0
- package/dist/core/agents/session-events.js +205 -0
- package/dist/core/agents/state/activity-log.d.ts +18 -0
- package/dist/core/agents/state/activity-log.d.ts.map +1 -0
- package/dist/core/agents/state/activity-log.js +34 -0
- package/dist/core/agents/state/council.d.ts +39 -0
- package/dist/core/agents/state/council.d.ts.map +1 -0
- package/dist/core/agents/state/council.js +216 -0
- package/dist/core/agents/state/heartbeat-projector.d.ts +59 -0
- package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -0
- package/dist/core/agents/state/heartbeat-projector.js +436 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts +64 -0
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -0
- package/dist/core/agents/state/heartbeat-writer.js +271 -0
- package/dist/core/agents/state/names.d.ts +35 -0
- package/dist/core/agents/state/names.d.ts.map +1 -0
- package/dist/core/agents/state/names.js +376 -0
- package/dist/core/agents/state/pidmap.d.ts +11 -0
- package/dist/core/agents/state/pidmap.d.ts.map +1 -0
- package/dist/core/agents/state/pidmap.js +32 -0
- package/dist/core/agents/state/scratch.d.ts +27 -0
- package/dist/core/agents/state/scratch.d.ts.map +1 -0
- package/dist/core/agents/state/scratch.js +90 -0
- package/dist/core/agents/state/shell-mutation.d.ts +17 -0
- package/dist/core/agents/state/shell-mutation.d.ts.map +1 -0
- package/dist/core/agents/state/shell-mutation.js +41 -0
- package/dist/core/agents/state/stale-sweep.d.ts +16 -0
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -0
- package/dist/core/agents/state/stale-sweep.js +166 -0
- package/dist/core/config.d.ts +29 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +108 -0
- package/dist/core/hooks/cli.d.ts +21 -0
- package/dist/core/hooks/cli.d.ts.map +1 -0
- package/dist/core/hooks/cli.js +1123 -0
- package/dist/core/hooks/effects/image-capture.d.ts +43 -0
- package/dist/core/hooks/effects/image-capture.d.ts.map +1 -0
- package/dist/core/hooks/effects/image-capture.js +288 -0
- package/dist/core/hooks/effects/index.d.ts +64 -0
- package/dist/core/hooks/effects/index.d.ts.map +1 -0
- package/dist/core/hooks/effects/index.js +197 -0
- package/dist/core/hooks/events/emit.d.ts +31 -0
- package/dist/core/hooks/events/emit.d.ts.map +1 -0
- package/dist/core/hooks/events/emit.js +89 -0
- package/dist/core/hooks/events/schema.d.ts +235 -0
- package/dist/core/hooks/events/schema.d.ts.map +1 -0
- package/dist/core/hooks/events/schema.js +12 -0
- package/dist/core/hooks/events/ulid.d.ts +10 -0
- package/dist/core/hooks/events/ulid.d.ts.map +1 -0
- package/dist/core/hooks/events/ulid.js +47 -0
- package/dist/core/hooks/harness/detect.d.ts +9 -0
- package/dist/core/hooks/harness/detect.d.ts.map +1 -0
- package/dist/core/hooks/harness/detect.js +29 -0
- package/dist/core/hooks/harness/events.d.ts +45 -0
- package/dist/core/hooks/harness/events.d.ts.map +1 -0
- package/dist/core/hooks/harness/events.js +71 -0
- package/dist/core/hooks/harness/output.d.ts +46 -0
- package/dist/core/hooks/harness/output.d.ts.map +1 -0
- package/dist/core/hooks/harness/output.js +87 -0
- package/dist/core/hooks/harness/parse.d.ts +67 -0
- package/dist/core/hooks/harness/parse.d.ts.map +1 -0
- package/dist/core/hooks/harness/parse.js +132 -0
- package/dist/core/hooks/index.d.ts +8 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +7 -0
- package/dist/core/hooks/resolve/anchor.d.ts +37 -0
- package/dist/core/hooks/resolve/anchor.d.ts.map +1 -0
- package/dist/core/hooks/resolve/anchor.js +48 -0
- package/dist/core/hooks/resolve/coord-root.d.ts +6 -0
- package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -0
- package/dist/core/hooks/resolve/coord-root.js +27 -0
- package/dist/core/hooks/resolve/intent.d.ts +33 -0
- package/dist/core/hooks/resolve/intent.d.ts.map +1 -0
- package/dist/core/hooks/resolve/intent.js +79 -0
- package/dist/core/hooks/resolve/owner.d.ts +42 -0
- package/dist/core/hooks/resolve/owner.d.ts.map +1 -0
- package/dist/core/hooks/resolve/owner.js +140 -0
- package/dist/core/hooks/resolve/transcript.d.ts +26 -0
- package/dist/core/hooks/resolve/transcript.d.ts.map +1 -0
- package/dist/core/hooks/resolve/transcript.js +73 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/lib/agent-browser/client.d.ts +99 -0
- package/dist/lib/agent-browser/client.d.ts.map +1 -0
- package/dist/lib/agent-browser/client.js +177 -0
- package/dist/lib/agent-browser/index.d.ts +2 -0
- package/dist/lib/agent-browser/index.d.ts.map +1 -0
- package/dist/lib/agent-browser/index.js +1 -0
- package/dist/lib/browser/client.d.ts +193 -0
- package/dist/lib/browser/client.d.ts.map +1 -0
- package/dist/lib/browser/client.js +325 -0
- package/dist/lib/browser/dev-overlay.d.ts +23 -0
- package/dist/lib/browser/dev-overlay.d.ts.map +1 -0
- package/dist/lib/browser/dev-overlay.js +153 -0
- package/dist/lib/browser/index.d.ts +5 -0
- package/dist/lib/browser/index.d.ts.map +1 -0
- package/dist/lib/browser/index.js +2 -0
- package/dist/lib/browser/layout.d.ts +79 -0
- package/dist/lib/browser/layout.d.ts.map +1 -0
- package/dist/lib/browser/layout.js +220 -0
- package/dist/lib/browser/visibility.d.ts +86 -0
- package/dist/lib/browser/visibility.d.ts.map +1 -0
- package/dist/lib/browser/visibility.js +333 -0
- package/dist/lib/browser/visual-diff.d.ts +38 -0
- package/dist/lib/browser/visual-diff.d.ts.map +1 -0
- package/dist/lib/browser/visual-diff.js +107 -0
- package/dist/lib/completion/bash.d.ts +25 -0
- package/dist/lib/completion/bash.d.ts.map +1 -0
- package/dist/lib/completion/bash.js +284 -0
- package/dist/lib/completion/fish.d.ts +16 -0
- package/dist/lib/completion/fish.d.ts.map +1 -0
- package/dist/lib/completion/fish.js +118 -0
- package/dist/lib/completion/index.d.ts +5 -0
- package/dist/lib/completion/index.d.ts.map +1 -0
- package/dist/lib/completion/index.js +4 -0
- package/dist/lib/completion/walk.d.ts +68 -0
- package/dist/lib/completion/walk.d.ts.map +1 -0
- package/dist/lib/completion/walk.js +102 -0
- package/dist/lib/completion/zsh.d.ts +13 -0
- package/dist/lib/completion/zsh.d.ts.map +1 -0
- package/dist/lib/completion/zsh.js +249 -0
- package/dist/lib/context/index.d.ts +107 -0
- package/dist/lib/context/index.d.ts.map +1 -0
- package/dist/lib/context/index.js +275 -0
- package/dist/lib/cookies/client.d.ts +131 -0
- package/dist/lib/cookies/client.d.ts.map +1 -0
- package/dist/lib/cookies/client.js +239 -0
- package/dist/lib/cookies/index.d.ts +2 -0
- package/dist/lib/cookies/index.d.ts.map +1 -0
- package/dist/lib/cookies/index.js +1 -0
- package/dist/lib/council/index.d.ts +266 -0
- package/dist/lib/council/index.d.ts.map +1 -0
- package/dist/lib/council/index.js +674 -0
- package/dist/lib/docs-index.d.ts +28 -0
- package/dist/lib/docs-index.d.ts.map +1 -0
- package/dist/lib/docs-index.js +169 -0
- package/dist/lib/docs-lint.d.ts +26 -0
- package/dist/lib/docs-lint.d.ts.map +1 -0
- package/dist/lib/docs-lint.js +378 -0
- package/dist/lib/docs-sweep.d.ts +34 -0
- package/dist/lib/docs-sweep.d.ts.map +1 -0
- package/dist/lib/docs-sweep.js +304 -0
- package/dist/lib/docs.d.ts +27 -0
- package/dist/lib/docs.d.ts.map +1 -0
- package/dist/lib/docs.js +142 -0
- package/dist/lib/env.d.ts +11 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/env.js +12 -0
- package/dist/lib/exec.d.ts +32 -0
- package/dist/lib/exec.d.ts.map +1 -0
- package/dist/lib/exec.js +54 -0
- package/dist/lib/format.d.ts +29 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +139 -0
- package/dist/lib/http/client.d.ts +56 -0
- package/dist/lib/http/client.d.ts.map +1 -0
- package/dist/lib/http/client.js +160 -0
- package/dist/lib/http/index.d.ts +2 -0
- package/dist/lib/http/index.d.ts.map +1 -0
- package/dist/lib/http/index.js +1 -0
- package/dist/lib/identities/index.d.ts +77 -0
- package/dist/lib/identities/index.d.ts.map +1 -0
- package/dist/lib/identities/index.js +190 -0
- package/dist/lib/machine.d.ts +19 -0
- package/dist/lib/machine.d.ts.map +1 -0
- package/dist/lib/machine.js +61 -0
- package/dist/lib/presence.d.ts +48 -0
- package/dist/lib/presence.d.ts.map +1 -0
- package/dist/lib/presence.js +123 -0
- package/dist/lib/readability/client.d.ts +32 -0
- package/dist/lib/readability/client.d.ts.map +1 -0
- package/dist/lib/readability/client.js +119 -0
- package/dist/lib/readability/index.d.ts +2 -0
- package/dist/lib/readability/index.d.ts.map +1 -0
- package/dist/lib/readability/index.js +1 -0
- package/dist/lib/scratch/index.d.ts +74 -0
- package/dist/lib/scratch/index.d.ts.map +1 -0
- package/dist/lib/scratch/index.js +393 -0
- package/dist/lib/tunnel/gate.d.ts +12 -0
- package/dist/lib/tunnel/gate.d.ts.map +1 -0
- package/dist/lib/tunnel/gate.js +101 -0
- package/dist/lib/tunnel/state.d.ts +34 -0
- package/dist/lib/tunnel/state.d.ts.map +1 -0
- package/dist/lib/tunnel/state.js +132 -0
- package/package.json +160 -8
- package/schemas/.gitkeep +0 -0
- package/schemas/config.schema.json +109 -0
- package/src/cli.ts +22 -0
- package/src/commander.ts +242 -0
- package/src/commands/.gitkeep +0 -0
- package/src/commands/agents.ts +4567 -0
- package/src/commands/backup.ts +305 -0
- package/src/commands/browse-ai.ts +198 -0
- package/src/commands/browse.ts +849 -0
- package/src/commands/callers.ts +363 -0
- package/src/commands/completion.ts +193 -0
- package/src/commands/config-get.ts +161 -0
- package/src/commands/context.ts +209 -0
- package/src/commands/cookies.ts +198 -0
- package/src/commands/docs.ts +174 -0
- package/src/commands/doctor.ts +231 -0
- package/src/commands/edit-batch.ts +233 -0
- package/src/commands/eml.ts +519 -0
- package/src/commands/env.ts +254 -0
- package/src/commands/fetch.ts +136 -0
- package/src/commands/file-history.ts +202 -0
- package/src/commands/grep.ts +371 -0
- package/src/commands/init.ts +335 -0
- package/src/commands/outline.ts +564 -0
- package/src/commands/presence.ts +152 -0
- package/src/commands/read.ts +64 -0
- package/src/commands/scratch.ts +445 -0
- package/src/commands/session.ts +187 -0
- package/src/commands/sync.ts +306 -0
- package/src/commands/toc.ts +218 -0
- package/src/commands/tokens.ts +79 -0
- package/src/commands/tunnel.ts +633 -0
- package/src/commands/uninstall.ts +144 -0
- package/src/commands/web.ts +193 -0
- package/src/core/agents/canonical-emit.ts +77 -0
- package/src/core/agents/cli-emit.ts +64 -0
- package/src/core/agents/cli.ts +838 -0
- package/src/core/agents/codex-replay.ts +163 -0
- package/src/core/agents/coord-client.ts +249 -0
- package/src/core/agents/events/consume.ts +196 -0
- package/src/core/agents/events/emit.ts +108 -0
- package/src/core/agents/events/ulid.ts +51 -0
- package/src/core/agents/index.ts +14 -0
- package/src/core/agents/paths.ts +16 -0
- package/src/core/agents/render/prompt-context.ts +401 -0
- package/src/core/agents/render/session-context.ts +341 -0
- package/src/core/agents/rules/claim-conflict.ts +282 -0
- package/src/core/agents/rules/commit-conflict.ts +303 -0
- package/src/core/agents/rules/stop-hook.ts +229 -0
- package/src/core/agents/session-events.ts +228 -0
- package/src/core/agents/state/activity-log.ts +33 -0
- package/src/core/agents/state/council.ts +265 -0
- package/src/core/agents/state/heartbeat-projector.ts +488 -0
- package/src/core/agents/state/heartbeat-writer.ts +333 -0
- package/src/core/agents/state/names.ts +399 -0
- package/src/core/agents/state/pidmap.ts +38 -0
- package/src/core/agents/state/scratch.ts +121 -0
- package/src/core/agents/state/shell-mutation.ts +44 -0
- package/src/core/agents/state/stale-sweep.ts +190 -0
- package/src/core/config.ts +111 -0
- package/src/core/hooks/cli.ts +1247 -0
- package/src/core/hooks/effects/image-capture.ts +330 -0
- package/src/core/hooks/effects/index.ts +210 -0
- package/src/core/hooks/events/emit.ts +120 -0
- package/src/core/hooks/events/schema.ts +430 -0
- package/src/core/hooks/events/ulid.ts +51 -0
- package/src/core/hooks/harness/detect.ts +30 -0
- package/src/core/hooks/harness/events.ts +102 -0
- package/src/core/hooks/harness/output.ts +100 -0
- package/src/core/hooks/harness/parse.ts +180 -0
- package/src/core/hooks/index.ts +16 -0
- package/src/core/hooks/resolve/anchor.ts +51 -0
- package/src/core/hooks/resolve/coord-root.ts +25 -0
- package/src/core/hooks/resolve/intent.ts +89 -0
- package/src/core/hooks/resolve/owner.ts +140 -0
- package/src/core/hooks/resolve/transcript.ts +72 -0
- package/src/hooks/.gitkeep +0 -0
- package/src/index.ts +15 -0
- package/src/lib/agent-browser/client.ts +239 -0
- package/src/lib/agent-browser/index.ts +1 -0
- package/src/lib/browser/client.ts +449 -0
- package/src/lib/browser/dev-overlay.ts +207 -0
- package/src/lib/browser/index.ts +24 -0
- package/src/lib/browser/layout.ts +288 -0
- package/src/lib/browser/visibility.ts +419 -0
- package/src/lib/browser/visual-diff.ts +150 -0
- package/src/lib/completion/bash.ts +291 -0
- package/src/lib/completion/fish.ts +134 -0
- package/src/lib/completion/index.ts +10 -0
- package/src/lib/completion/walk.ts +184 -0
- package/src/lib/completion/zsh.ts +262 -0
- package/src/lib/context/index.ts +386 -0
- package/src/lib/cookies/client.ts +301 -0
- package/src/lib/cookies/index.ts +13 -0
- package/src/lib/council/index.ts +803 -0
- package/src/lib/docs-index.ts +216 -0
- package/src/lib/docs-lint.ts +413 -0
- package/src/lib/docs-sweep.ts +348 -0
- package/src/lib/docs.ts +199 -0
- package/src/lib/env.ts +12 -0
- package/src/lib/exec.ts +74 -0
- package/src/lib/format.ts +147 -0
- package/src/lib/http/client.ts +211 -0
- package/src/lib/http/index.ts +1 -0
- package/src/lib/identities/index.ts +210 -0
- package/src/lib/machine.ts +61 -0
- package/src/lib/presence.ts +154 -0
- package/src/lib/readability/client.ts +156 -0
- package/src/lib/readability/index.ts +5 -0
- package/src/lib/readability/turndown-plugin-gfm.d.ts +10 -0
- package/src/lib/scratch/index.ts +470 -0
- package/src/lib/tunnel/gate.ts +113 -0
- package/src/lib/tunnel/state.ts +167 -0
- package/src/web/.gitkeep +0 -0
- package/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,13 +1,165 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harnery",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "Multi-agent coordination + harness adapters for Claude Code / Cursor / Codex
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Multi-agent coordination + harness adapters + portable CLI utilities for Claude Code / Cursor / Codex.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Ryan Kelly",
|
|
7
|
+
"homepage": "https://harnery.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ryanjkelly/harnery.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/ryanjkelly/harnery/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cli",
|
|
17
|
+
"multi-agent",
|
|
18
|
+
"coordination",
|
|
19
|
+
"claude-code",
|
|
20
|
+
"cursor",
|
|
21
|
+
"codex",
|
|
22
|
+
"agent-hooks",
|
|
23
|
+
"developer-tools"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"//exports": "Each entry resolves to TS source under Bun (zero-build dev + an embedding host) and to the built dist/ on Node/npm. The `bun` condition must stay first.",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"bun": "./src/index.ts",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./commander": {
|
|
36
|
+
"bun": "./src/commander.ts",
|
|
37
|
+
"types": "./dist/commander.d.ts",
|
|
38
|
+
"import": "./dist/commander.js"
|
|
39
|
+
},
|
|
40
|
+
"./core/agents": {
|
|
41
|
+
"bun": "./src/core/agents/index.ts",
|
|
42
|
+
"types": "./dist/core/agents/index.d.ts",
|
|
43
|
+
"import": "./dist/core/agents/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./core/agents/session-events": {
|
|
46
|
+
"bun": "./src/core/agents/session-events.ts",
|
|
47
|
+
"types": "./dist/core/agents/session-events.d.ts",
|
|
48
|
+
"import": "./dist/core/agents/session-events.js"
|
|
49
|
+
},
|
|
50
|
+
"./core/hooks": {
|
|
51
|
+
"bun": "./src/core/hooks/index.ts",
|
|
52
|
+
"types": "./dist/core/hooks/index.d.ts",
|
|
53
|
+
"import": "./dist/core/hooks/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./lib/agent-browser": {
|
|
56
|
+
"bun": "./src/lib/agent-browser/index.ts",
|
|
57
|
+
"types": "./dist/lib/agent-browser/index.d.ts",
|
|
58
|
+
"import": "./dist/lib/agent-browser/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./lib/browser": {
|
|
61
|
+
"bun": "./src/lib/browser/index.ts",
|
|
62
|
+
"types": "./dist/lib/browser/index.d.ts",
|
|
63
|
+
"import": "./dist/lib/browser/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./lib/cookies": {
|
|
66
|
+
"bun": "./src/lib/cookies/index.ts",
|
|
67
|
+
"types": "./dist/lib/cookies/index.d.ts",
|
|
68
|
+
"import": "./dist/lib/cookies/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./lib/format": {
|
|
71
|
+
"bun": "./src/lib/format.ts",
|
|
72
|
+
"types": "./dist/lib/format.d.ts",
|
|
73
|
+
"import": "./dist/lib/format.js"
|
|
74
|
+
},
|
|
75
|
+
"./lib/http": {
|
|
76
|
+
"bun": "./src/lib/http/index.ts",
|
|
77
|
+
"types": "./dist/lib/http/index.d.ts",
|
|
78
|
+
"import": "./dist/lib/http/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./lib/machine": {
|
|
81
|
+
"bun": "./src/lib/machine.ts",
|
|
82
|
+
"types": "./dist/lib/machine.d.ts",
|
|
83
|
+
"import": "./dist/lib/machine.js"
|
|
84
|
+
},
|
|
85
|
+
"./lib/readability": {
|
|
86
|
+
"bun": "./src/lib/readability/index.ts",
|
|
87
|
+
"types": "./dist/lib/readability/index.d.ts",
|
|
88
|
+
"import": "./dist/lib/readability/index.js"
|
|
89
|
+
},
|
|
90
|
+
"./lib/scratch": {
|
|
91
|
+
"bun": "./src/lib/scratch/index.ts",
|
|
92
|
+
"types": "./dist/lib/scratch/index.d.ts",
|
|
93
|
+
"import": "./dist/lib/scratch/index.js"
|
|
94
|
+
},
|
|
95
|
+
"./lib/tunnel/state": {
|
|
96
|
+
"bun": "./src/lib/tunnel/state.ts",
|
|
97
|
+
"types": "./dist/lib/tunnel/state.d.ts",
|
|
98
|
+
"import": "./dist/lib/tunnel/state.js"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"bin": {
|
|
102
|
+
"harn": "./bin/harn",
|
|
103
|
+
"agent-coord": "./bin/agent-coord",
|
|
104
|
+
"agent-hook": "./bin/agent-hook"
|
|
105
|
+
},
|
|
106
|
+
"//files": "src ships as TS so the `bun` export condition resolves to source; negate co-located tests so they don't ride into the tarball (a .npmignore is inert for paths already inside the files allowlist).",
|
|
107
|
+
"files": [
|
|
108
|
+
"bin",
|
|
109
|
+
"src",
|
|
110
|
+
"dist",
|
|
111
|
+
"schemas",
|
|
112
|
+
"README.md",
|
|
113
|
+
"LICENSE",
|
|
114
|
+
"!src/**/*.test.ts",
|
|
115
|
+
"!src/**/*.test.tsx"
|
|
116
|
+
],
|
|
117
|
+
"engines": {
|
|
118
|
+
"node": ">=20"
|
|
119
|
+
},
|
|
120
|
+
"publishConfig": {
|
|
121
|
+
"access": "public",
|
|
122
|
+
"provenance": true
|
|
123
|
+
},
|
|
124
|
+
"packageManager": "bun@1.3.3",
|
|
6
125
|
"scripts": {
|
|
7
|
-
"
|
|
126
|
+
"build": "tsc -p tsconfig.build.json && node scripts/rewrite-dts-extensions.mjs",
|
|
127
|
+
"clean": "rm -rf dist",
|
|
128
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
129
|
+
"typecheck": "bun x tsc --noEmit",
|
|
130
|
+
"lint": "bun x @biomejs/biome check src",
|
|
131
|
+
"format": "bun x @biomejs/biome format --write src",
|
|
132
|
+
"test": "bun test src tests",
|
|
133
|
+
"test:web": "cd web && bun install && bun test",
|
|
134
|
+
"test:integration": "bash tests/integration/run.sh",
|
|
135
|
+
"docs:dev": "bun --cwd docs run dev",
|
|
136
|
+
"docs:build": "bun --cwd docs run build",
|
|
137
|
+
"brand:showcase": "node scripts/build-brand-showcase.mjs"
|
|
138
|
+
},
|
|
139
|
+
"dependencies": {
|
|
140
|
+
"@mozilla/readability": "^0.6.0",
|
|
141
|
+
"commander": "^15.0.0",
|
|
142
|
+
"gpt-tokenizer": "^3.4.0",
|
|
143
|
+
"js-yaml": "^4.1.1",
|
|
144
|
+
"jsdom": "^29.0.2",
|
|
145
|
+
"mailparser": "^3.9.8",
|
|
146
|
+
"pixelmatch": "^7.2.0",
|
|
147
|
+
"playwright": "^1.59.1",
|
|
148
|
+
"pngjs": "^7.0.0",
|
|
149
|
+
"turndown": "^7.2.4",
|
|
150
|
+
"turndown-plugin-gfm": "^1.0.2"
|
|
8
151
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
152
|
+
"devDependencies": {
|
|
153
|
+
"@biomejs/biome": "^2.5.0",
|
|
154
|
+
"@changesets/cli": "^2.27.0",
|
|
155
|
+
"@types/bun": "^1.2.0",
|
|
156
|
+
"@types/js-yaml": "^4.0.9",
|
|
157
|
+
"@types/jsdom": "^28.0.1",
|
|
158
|
+
"@types/mailparser": "^3.4.6",
|
|
159
|
+
"@types/node": "^26.0.0",
|
|
160
|
+
"@types/pixelmatch": "^5.2.6",
|
|
161
|
+
"@types/pngjs": "^6.0.5",
|
|
162
|
+
"@types/turndown": "^5.0.6",
|
|
163
|
+
"typescript": "^6.0.0"
|
|
164
|
+
}
|
|
13
165
|
}
|
package/schemas/.gitkeep
ADDED
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://harnery.com/schemas/config.schema.json",
|
|
4
|
+
"title": "harnery configuration",
|
|
5
|
+
"description": "Settings file format for harnery. Lives at ~/.config/harnery/config.jsonc (user-global) or <project-root>/.harnery/config.jsonc (project). Project values override user values.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "URL of this schema. Included so editors provide autocomplete + validation."
|
|
12
|
+
},
|
|
13
|
+
"project_name": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Project identity surfaced to peers and in log lines. Defaults to the basename of the monorepo root."
|
|
16
|
+
},
|
|
17
|
+
"binName": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "harn",
|
|
20
|
+
"description": "Host CLI bin name used in agent-facing strings (council prompts, end-of-turn nudges, command help). The coord binaries + web UI run as harnery and read this back since they can't see a consumer CLI's name. Stamped by `harn init` for a consumer. Resolution: HARNERY_BIN env -> this field -> 'harn'."
|
|
21
|
+
},
|
|
22
|
+
"coord": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"properties": {
|
|
26
|
+
"freshness_seconds": {
|
|
27
|
+
"type": "integer",
|
|
28
|
+
"minimum": 30,
|
|
29
|
+
"default": 600,
|
|
30
|
+
"description": "How stale a peer heartbeat can get before the sweeper prunes it."
|
|
31
|
+
},
|
|
32
|
+
"name_pool": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"default": "default",
|
|
35
|
+
"description": "Which agent-name pool to draw from. 'default' / 'hurricane' / a custom pool id."
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"web": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"properties": {
|
|
43
|
+
"port": {
|
|
44
|
+
"type": "integer",
|
|
45
|
+
"minimum": 1024,
|
|
46
|
+
"maximum": 65535,
|
|
47
|
+
"default": 7777,
|
|
48
|
+
"description": "Port that `harn web up` binds to."
|
|
49
|
+
},
|
|
50
|
+
"bind": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"default": "127.0.0.1",
|
|
53
|
+
"description": "Bind address. Default localhost-only. Override with --bind 0.0.0.0 + gated IP allowlist to expose."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"files": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"additionalProperties": false,
|
|
60
|
+
"description": "Universal file viewer (web dashboard) path-serving policy. The shipped secret denylist is a baked-in, non-removable floor in code; these knobs are ADDITIVE ONLY (they extend the floor, never replace or shrink it).",
|
|
61
|
+
"properties": {
|
|
62
|
+
"deny_globs": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"items": { "type": "string" },
|
|
65
|
+
"default": [],
|
|
66
|
+
"description": "Extra deny patterns on top of the shipped floor. Must be `**/`-anchored; supported shapes are `**/SEG` and `**/SEG/**` where SEG may use `*` and one `{a,b}` alternation. Matched case-insensitively against the canonical repo-relative path. Operator-added denies are treated as hard tier (never overridable). An entry that fails to compile disables the file viewer entirely (fail-closed) until fixed."
|
|
67
|
+
},
|
|
68
|
+
"allow_overrides": {
|
|
69
|
+
"type": "array",
|
|
70
|
+
"items": { "type": "string" },
|
|
71
|
+
"default": [],
|
|
72
|
+
"description": "Rescue globs consulted ONLY when a deny came from a soft-tier floor pattern (the deliberately over-broad nets like `**/.env.*` or `**/*secret*.json`). Hard-tier matches (credentials, key/cert files, `.ssh`/`.aws`/`.gnupg`, SA-key/oauth/token JSON, `.git`) are never overridable; an override that names a hard family is loudly dropped at config load."
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"backup": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"additionalProperties": false,
|
|
79
|
+
"properties": {
|
|
80
|
+
"repo": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "restic repository URL. Common: 'rclone:gdrive:harnery-backup/<project>' for Google Drive."
|
|
83
|
+
},
|
|
84
|
+
"schedule": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"enum": ["off", "daily", "hourly"],
|
|
87
|
+
"default": "off",
|
|
88
|
+
"description": "Auto-snapshot cadence. 'off' = manual only."
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"sync": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"additionalProperties": false,
|
|
95
|
+
"properties": {
|
|
96
|
+
"enabled": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"default": false,
|
|
99
|
+
"description": "Enable cross-machine sync via Google Drive."
|
|
100
|
+
},
|
|
101
|
+
"drive_folder": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"default": "harnery-sync",
|
|
104
|
+
"description": "Folder name in Google Drive that holds the synced subset."
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `harn` CLI entry point.
|
|
3
|
+
*
|
|
4
|
+
* Parses argv, runs the Commander program returned by createHarneryProgram().
|
|
5
|
+
* Consumer CLIs import createHarneryProgram() from `harnery/commander` and
|
|
6
|
+
* compose their own commands on top. See examples/extending-with-commander.ts.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { createHarneryProgram } from "./commander.ts";
|
|
10
|
+
|
|
11
|
+
async function main(): Promise<void> {
|
|
12
|
+
const program = createHarneryProgram({
|
|
13
|
+
binName: "harn",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
await program.parseAsync(process.argv);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main().catch((err) => {
|
|
20
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
});
|
package/src/commander.ts
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createHarneryProgram` is the composition point.
|
|
3
|
+
*
|
|
4
|
+
* harn (this package's CLI) calls this with `binName: 'harn'`.
|
|
5
|
+
* Consumer CLIs call this with their own binName, then `.addCommand()`
|
|
6
|
+
* their domain-specific subcommands and `parseAsync()`.
|
|
7
|
+
*
|
|
8
|
+
* The returned Commander program is harnery's full command tree. Adding
|
|
9
|
+
* a command with the same name on the consumer side overrides it, which is
|
|
10
|
+
* useful for project-specific overlays but uncommon.
|
|
11
|
+
*
|
|
12
|
+
* Future commands wire in via `registerXxxCommand(program)` calls below.
|
|
13
|
+
* Each subdirectory under src/commands/ exports its `register…` function
|
|
14
|
+
* (Commander pattern).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Command } from "commander";
|
|
18
|
+
import { registerAgentsCommand } from "./commands/agents.ts";
|
|
19
|
+
import { registerBackupCommand } from "./commands/backup.ts";
|
|
20
|
+
import { registerBrowseCommand } from "./commands/browse.ts";
|
|
21
|
+
import { registerBrowseAiCommand } from "./commands/browse-ai.ts";
|
|
22
|
+
import { registerCallersCommand } from "./commands/callers.ts";
|
|
23
|
+
import { registerCompletionCommand } from "./commands/completion.ts";
|
|
24
|
+
import { registerConfigGetCommand } from "./commands/config-get.ts";
|
|
25
|
+
import { registerContextCommand } from "./commands/context.ts";
|
|
26
|
+
import { registerCookiesCommand } from "./commands/cookies.ts";
|
|
27
|
+
import { registerDocsCommand } from "./commands/docs.ts";
|
|
28
|
+
import { registerDoctorCommand } from "./commands/doctor.ts";
|
|
29
|
+
import { registerEditBatchCommand } from "./commands/edit-batch.ts";
|
|
30
|
+
import { registerEmlCommand } from "./commands/eml.ts";
|
|
31
|
+
import { registerEnvCommand } from "./commands/env.ts";
|
|
32
|
+
import { registerFetchCommand } from "./commands/fetch.ts";
|
|
33
|
+
import { registerFileHistoryCommand } from "./commands/file-history.ts";
|
|
34
|
+
import { registerGrepCommand } from "./commands/grep.ts";
|
|
35
|
+
import { registerInitCommand } from "./commands/init.ts";
|
|
36
|
+
import { registerOutlineCommand } from "./commands/outline.ts";
|
|
37
|
+
import { registerPresenceCommand } from "./commands/presence.ts";
|
|
38
|
+
import { registerReadCommand } from "./commands/read.ts";
|
|
39
|
+
import { registerScratchCommand } from "./commands/scratch.ts";
|
|
40
|
+
import { registerSessionCommand } from "./commands/session.ts";
|
|
41
|
+
import { registerSyncCommand } from "./commands/sync.ts";
|
|
42
|
+
import { registerSectionCommand, registerTocCommand } from "./commands/toc.ts";
|
|
43
|
+
import { registerTokensCommand } from "./commands/tokens.ts";
|
|
44
|
+
import { registerTunnelCommand } from "./commands/tunnel.ts";
|
|
45
|
+
import { registerUninstallCommand } from "./commands/uninstall.ts";
|
|
46
|
+
import { registerWebCommand } from "./commands/web.ts";
|
|
47
|
+
|
|
48
|
+
export interface HarneryContextOpts {
|
|
49
|
+
/**
|
|
50
|
+
* The binary name shown in --help output. Defaults to "harn". Consumer
|
|
51
|
+
* CLIs pass their own, e.g. `binName: "mycli"`.
|
|
52
|
+
*/
|
|
53
|
+
binName?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Project-scoped context. Commands that touch state (.harnery/agents/,
|
|
57
|
+
* .harnery/config.jsonc) consult this to resolve paths + project identity.
|
|
58
|
+
* Optional: harn standalone runs without it.
|
|
59
|
+
*/
|
|
60
|
+
context?: HarneryProgramContext;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Adapter that lets consumers route structured emissions into their own
|
|
64
|
+
* OutputContext (e.g. an AsyncLocalStorage-bound writer). When omitted,
|
|
65
|
+
* harn standalone falls back to a default JSON-to-stdout emitter (see
|
|
66
|
+
* `defaultEmit` below).
|
|
67
|
+
*/
|
|
68
|
+
emit?: EmitContext;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Top-level command names harnery should NOT register. Use when a
|
|
72
|
+
* consumer wants to replace harnery's implementation with its own
|
|
73
|
+
* (Commander throws on duplicate registration). Example: the host CLI has
|
|
74
|
+
* a project-specific `harn web` (docker stack shim) and passes
|
|
75
|
+
* `skipCommands: ["web"]` so harnery's generic `web` doesn't collide.
|
|
76
|
+
*/
|
|
77
|
+
skipCommands?: readonly string[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface HarneryProgramContext {
|
|
81
|
+
/** Project name (e.g., "my-monorepo"). Used in user-facing log lines + telemetry tags. */
|
|
82
|
+
projectName?: string;
|
|
83
|
+
/** Override the monorepo-root resolver. Default: walk up looking for `.harnery/`. */
|
|
84
|
+
resolveCoordRoot?: () => string | null;
|
|
85
|
+
/**
|
|
86
|
+
* Absolute path to the monorepo root. Commands like `env` use this as the
|
|
87
|
+
* default `cwd` for `git` invocations. When omitted, commands fall back to
|
|
88
|
+
* `process.cwd()`.
|
|
89
|
+
*/
|
|
90
|
+
repoRoot?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Submodule directory names relative to `repoRoot`. Consumed by `env` to
|
|
93
|
+
* report N/M initialized. When omitted, the `env` command skips the
|
|
94
|
+
* submodule row.
|
|
95
|
+
*/
|
|
96
|
+
submodules?: readonly string[];
|
|
97
|
+
/**
|
|
98
|
+
* Optional callback that returns extra HTTP headers to attach to outbound
|
|
99
|
+
* `fetch` calls based on the target URL. Useful for consumers that need
|
|
100
|
+
* to inject auth or bypass headers on certain hostnames (e.g. private
|
|
101
|
+
* zones behind a WAF). harn standalone skips the callback entirely.
|
|
102
|
+
*/
|
|
103
|
+
extraHeaders?: (url: string) => Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* Shell-completion provider-key lookup. Consumers wire this to a function
|
|
106
|
+
* mapping (commandPath, option/positional) to a provider key, so that
|
|
107
|
+
* `--workspace` / `--env` etc. tab-complete dynamically against
|
|
108
|
+
* consumer-specific data sources. harn standalone falls back to no-op
|
|
109
|
+
* (static completion only).
|
|
110
|
+
*/
|
|
111
|
+
completionLookup?: (key: {
|
|
112
|
+
commandPath: string;
|
|
113
|
+
option?: string;
|
|
114
|
+
positional?: number;
|
|
115
|
+
}) => string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Shell-completion provider runner. Invoked by the hidden `__complete`
|
|
118
|
+
* subcommand at tab-time to produce the actual list of completions for
|
|
119
|
+
* a given provider key.
|
|
120
|
+
*/
|
|
121
|
+
completionRunner?: (key: string, partial: string) => Promise<string[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Extra path prefixes that should be excluded from `harn docs lint`
|
|
124
|
+
* convention checks (auto-generated API reference dumps, vendored
|
|
125
|
+
* content directories, etc.). Combined with harnery's built-in
|
|
126
|
+
* exclusions (`.claude/`, `.harnery/`, `.codex/`, `.cursor/`).
|
|
127
|
+
*/
|
|
128
|
+
extraDocsExcludedPrefixes?: readonly string[];
|
|
129
|
+
/**
|
|
130
|
+
* Default Host header for `tunnel up` when `--vhost` is omitted: a literal
|
|
131
|
+
* host, or a resolver evaluated at start time (e.g. read a dev stack's
|
|
132
|
+
* configured hostname so the tunnel lands on the right vhost). When unset, or
|
|
133
|
+
* the resolver returns null, the tunnel falls back to harnery's built-in
|
|
134
|
+
* default (`localhost`).
|
|
135
|
+
*/
|
|
136
|
+
tunnelDefaultVhost?: string | (() => string | null | undefined);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Minimum emission surface harnery commands need to talk to a host CLI's
|
|
141
|
+
* OutputContext. Intentionally tiny: just the methods commands actually
|
|
142
|
+
* call. Designed to grow additively: consumers that want richer output
|
|
143
|
+
* routing implement these methods; everyone else gets `defaultEmit`'s
|
|
144
|
+
* JSON-to-stdout fallback.
|
|
145
|
+
*/
|
|
146
|
+
export interface EmitContext {
|
|
147
|
+
config(opts: { format?: string }): void;
|
|
148
|
+
data(payload: unknown): void;
|
|
149
|
+
rows(rows: Record<string, unknown>[]): void;
|
|
150
|
+
text(s: string): void;
|
|
151
|
+
file(path: string, summary: Record<string, unknown>): void;
|
|
152
|
+
error(err: { code: string; message: string; hint?: string } | Error | unknown): void;
|
|
153
|
+
log(msg: string, level?: "debug" | "info" | "warn" | "error"): void;
|
|
154
|
+
setExitCode(n: number): void;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const defaultEmit: EmitContext = {
|
|
158
|
+
config() {
|
|
159
|
+
// No-op for harn standalone: there's only one format (JSON) and it's
|
|
160
|
+
// already the default. Consumer adapters route this to their own
|
|
161
|
+
// output-context configurator.
|
|
162
|
+
},
|
|
163
|
+
data(payload) {
|
|
164
|
+
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
165
|
+
},
|
|
166
|
+
rows(rows) {
|
|
167
|
+
process.stdout.write(`${JSON.stringify(rows)}\n`);
|
|
168
|
+
},
|
|
169
|
+
text(s) {
|
|
170
|
+
process.stdout.write(s.endsWith("\n") ? s : `${s}\n`);
|
|
171
|
+
},
|
|
172
|
+
file(path, summary) {
|
|
173
|
+
process.stdout.write(`${JSON.stringify({ ok: true, file: path, ...summary })}\n`);
|
|
174
|
+
},
|
|
175
|
+
error(err) {
|
|
176
|
+
const payload =
|
|
177
|
+
err instanceof Error
|
|
178
|
+
? { code: err.name || "error", message: err.message }
|
|
179
|
+
: typeof err === "object" && err !== null
|
|
180
|
+
? err
|
|
181
|
+
: { code: "error", message: String(err) };
|
|
182
|
+
process.stderr.write(`${JSON.stringify({ error: payload })}\n`);
|
|
183
|
+
process.exitCode = 1;
|
|
184
|
+
},
|
|
185
|
+
log(msg, level = "info") {
|
|
186
|
+
process.stderr.write(`[${level}] ${msg}\n`);
|
|
187
|
+
},
|
|
188
|
+
setExitCode(n) {
|
|
189
|
+
process.exitCode = n;
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export function createHarneryProgram(opts: HarneryContextOpts = {}): Command {
|
|
194
|
+
const program = new Command();
|
|
195
|
+
const emit = opts.emit ?? defaultEmit;
|
|
196
|
+
const skip = new Set(opts.skipCommands ?? []);
|
|
197
|
+
const include = (name: string) => !skip.has(name);
|
|
198
|
+
|
|
199
|
+
program
|
|
200
|
+
.name(opts.binName ?? "harn")
|
|
201
|
+
.description("Multi-agent coordination + harness adapters + portable CLI utilities.")
|
|
202
|
+
.version(readVersion());
|
|
203
|
+
|
|
204
|
+
registerTokensCommand(program, emit);
|
|
205
|
+
registerEmlCommand(program, emit);
|
|
206
|
+
registerEnvCommand(program, emit, opts.context);
|
|
207
|
+
registerPresenceCommand(program, emit);
|
|
208
|
+
registerConfigGetCommand(program, emit);
|
|
209
|
+
registerFileHistoryCommand(program, emit);
|
|
210
|
+
registerOutlineCommand(program, emit);
|
|
211
|
+
registerTocCommand(program, emit);
|
|
212
|
+
registerSectionCommand(program, emit);
|
|
213
|
+
registerCallersCommand(program, emit, opts.context);
|
|
214
|
+
registerEditBatchCommand(program, emit);
|
|
215
|
+
registerGrepCommand(program, emit, opts.context);
|
|
216
|
+
registerCookiesCommand(program, emit);
|
|
217
|
+
registerFetchCommand(program, emit, opts.context);
|
|
218
|
+
registerReadCommand(program, emit);
|
|
219
|
+
registerBrowseCommand(program, emit, opts.context);
|
|
220
|
+
registerBrowseAiCommand(program, emit);
|
|
221
|
+
registerSessionCommand(program, emit);
|
|
222
|
+
registerCompletionCommand(program, emit, opts.context);
|
|
223
|
+
registerContextCommand(program, emit, opts.context);
|
|
224
|
+
registerScratchCommand(program, emit);
|
|
225
|
+
registerTunnelCommand(program, emit, opts.context);
|
|
226
|
+
registerDocsCommand(program, emit, opts.context);
|
|
227
|
+
registerAgentsCommand(program, emit);
|
|
228
|
+
registerDoctorCommand(program, emit);
|
|
229
|
+
registerInitCommand(program, emit, opts.binName);
|
|
230
|
+
registerUninstallCommand(program, emit);
|
|
231
|
+
registerBackupCommand(program, emit);
|
|
232
|
+
registerSyncCommand(program, emit);
|
|
233
|
+
if (include("web")) registerWebCommand(program, emit);
|
|
234
|
+
|
|
235
|
+
return program;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function readVersion(): string {
|
|
239
|
+
// Static for the empty scaffold. Will be replaced by a build-time substitution
|
|
240
|
+
// (or a JSON import) once we have any command shipping.
|
|
241
|
+
return "0.1.0";
|
|
242
|
+
}
|
|
File without changes
|