borgmcp 1.1.15 → 2.0.2
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/CONTRIBUTING.md +15 -0
- package/LICENSE +201 -33
- package/NOTICE +2 -0
- package/README.md +85 -36
- package/SECURITY.md +7 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +63 -1
- package/dist/agent-runtime.js.map +1 -0
- package/dist/assimilate-cmd.d.ts +96 -17
- package/dist/assimilate-cmd.d.ts.map +1 -0
- package/dist/assimilate-cmd.js +1396 -48
- package/dist/assimilate-cmd.js.map +1 -0
- package/dist/assimilate-deps.d.ts.map +1 -0
- package/dist/assimilate-deps.js +384 -3
- package/dist/assimilate-deps.js.map +1 -0
- package/dist/assimilate-guard.d.ts +5 -7
- package/dist/assimilate-guard.d.ts.map +1 -0
- package/dist/assimilate-guard.js +60 -2
- package/dist/assimilate-guard.js.map +1 -0
- package/dist/assimilate-welcome.d.ts +1 -1
- package/dist/assimilate-welcome.d.ts.map +1 -0
- package/dist/assimilate-welcome.js +32 -2
- package/dist/assimilate-welcome.js.map +1 -0
- package/dist/auth-env.d.ts +7 -50
- package/dist/auth-env.d.ts.map +1 -0
- package/dist/auth-env.js +22 -1
- package/dist/auth-env.js.map +1 -0
- package/dist/backends/launch-all-pastelist.d.ts.map +1 -0
- package/dist/backends/launch-all-pastelist.js +11 -4
- package/dist/backends/launch-all-pastelist.js.map +1 -0
- package/dist/backends/launch-all-tmux.d.ts.map +1 -0
- package/dist/backends/launch-all-tmux.js +49 -1
- package/dist/backends/launch-all-tmux.js.map +1 -0
- package/dist/backends/launch-all-windows.d.ts.map +1 -0
- package/dist/backends/launch-all-windows.js +86 -12
- package/dist/backends/launch-all-windows.js.map +1 -0
- package/dist/bare-launch-menu.d.ts.map +1 -0
- package/dist/bare-launch-menu.js +83 -6
- package/dist/bare-launch-menu.js.map +1 -0
- package/dist/claude-launch-args.d.ts.map +1 -0
- package/dist/claude-launch-args.js +34 -1
- package/dist/claude-launch-args.js.map +1 -0
- package/dist/claude.d.ts.map +1 -0
- package/dist/claude.js +486 -14
- package/dist/claude.js.map +1 -0
- package/dist/cleanup-cmd.d.ts +5 -5
- package/dist/cleanup-cmd.d.ts.map +1 -0
- package/dist/cleanup-cmd.js +453 -14
- package/dist/cleanup-cmd.js.map +1 -0
- package/dist/clear-rewake-core.d.ts.map +1 -0
- package/dist/clear-rewake-core.js +23 -2
- package/dist/clear-rewake-core.js.map +1 -0
- package/dist/clear-rewake.d.ts.map +1 -0
- package/dist/clear-rewake.js +19 -1
- package/dist/clear-rewake.js.map +1 -0
- package/dist/cli-help.d.ts +5 -0
- package/dist/cli-help.d.ts.map +1 -0
- package/dist/cli-help.js +104 -56
- package/dist/cli-help.js.map +1 -0
- package/dist/cli-platform.d.ts.map +1 -0
- package/dist/cli-platform.js +106 -4
- package/dist/cli-platform.js.map +1 -0
- package/dist/cli-tool-approval.d.ts +84 -0
- package/dist/cli-tool-approval.d.ts.map +1 -0
- package/dist/cli-tool-approval.js +583 -0
- package/dist/cli-tool-approval.js.map +1 -0
- package/dist/codex-app-server.d.ts.map +1 -0
- package/dist/codex-app-server.js +228 -4
- package/dist/codex-app-server.js.map +1 -0
- package/dist/codex-app-wake.d.ts +9 -11
- package/dist/codex-app-wake.d.ts.map +1 -0
- package/dist/codex-app-wake.js +436 -2
- package/dist/codex-app-wake.js.map +1 -0
- package/dist/codex-launch.d.ts.map +1 -0
- package/dist/codex-launch.js +102 -2
- package/dist/codex-launch.js.map +1 -0
- package/dist/codex-remote.d.ts +6 -1
- package/dist/codex-remote.d.ts.map +1 -0
- package/dist/codex-remote.js +394 -1
- package/dist/codex-remote.js.map +1 -0
- package/dist/codex-wake-resolve.d.ts +4 -4
- package/dist/codex-wake-resolve.d.ts.map +1 -0
- package/dist/codex-wake-resolve.js +127 -1
- package/dist/codex-wake-resolve.js.map +1 -0
- package/dist/config-utils.d.ts +2 -2
- package/dist/config-utils.d.ts.map +1 -0
- package/dist/config-utils.js +766 -3
- package/dist/config-utils.js.map +1 -0
- package/dist/config.d.ts +98 -61
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +426 -1
- package/dist/config.js.map +1 -0
- package/dist/console-prefix.d.ts.map +1 -0
- package/dist/console-prefix.js +96 -1
- package/dist/console-prefix.js.map +1 -0
- package/dist/cube-name.d.ts.map +1 -0
- package/dist/cube-name.js +67 -1
- package/dist/cube-name.js.map +1 -0
- package/dist/cubes.d.ts +126 -18
- package/dist/cubes.d.ts.map +1 -0
- package/dist/cubes.js +412 -4
- package/dist/cubes.js.map +1 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +71 -1
- package/dist/debug.js.map +1 -0
- package/dist/direct-log.d.ts.map +1 -0
- package/dist/direct-log.js +11 -1
- package/dist/direct-log.js.map +1 -0
- package/dist/docs-sections.d.ts +11 -10
- package/dist/docs-sections.d.ts.map +1 -0
- package/dist/docs-sections.js +113 -3
- package/dist/docs-sections.js.map +1 -0
- package/dist/drone-lifecycle.d.ts +5 -21
- package/dist/drone-lifecycle.d.ts.map +1 -0
- package/dist/drone-lifecycle.js +57 -8
- package/dist/drone-lifecycle.js.map +1 -0
- package/dist/drone-management.d.ts +29 -0
- package/dist/drone-management.d.ts.map +1 -0
- package/dist/drone-management.js +109 -0
- package/dist/drone-management.js.map +1 -0
- package/dist/ensure-mcp-config.d.ts.map +1 -0
- package/dist/ensure-mcp-config.js +36 -1
- package/dist/ensure-mcp-config.js.map +1 -0
- package/dist/evict-drone.d.ts +10 -2
- package/dist/evict-drone.d.ts.map +1 -0
- package/dist/evict-drone.js +60 -1
- package/dist/evict-drone.js.map +1 -0
- package/dist/gc-orphan-inboxes.d.ts.map +1 -0
- package/dist/gc-orphan-inboxes.js +177 -1
- package/dist/gc-orphan-inboxes.js.map +1 -0
- package/dist/inbox-monitor.d.ts +1 -1
- package/dist/inbox-monitor.d.ts.map +1 -0
- package/dist/inbox-monitor.js +856 -3
- package/dist/inbox-monitor.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1034 -37
- package/dist/index.js.map +1 -0
- package/dist/launch-all-cmd.d.ts.map +1 -0
- package/dist/launch-all-cmd.js +377 -37
- package/dist/launch-all-cmd.js.map +1 -0
- package/dist/launch-all-command.d.ts.map +1 -0
- package/dist/launch-all-command.js +24 -1
- package/dist/launch-all-command.js.map +1 -0
- package/dist/launch-all-deps.d.ts +3 -8
- package/dist/launch-all-deps.d.ts.map +1 -0
- package/dist/launch-all-deps.js +99 -1
- package/dist/launch-all-deps.js.map +1 -0
- package/dist/launch-all-discovery.d.ts +1 -0
- package/dist/launch-all-discovery.d.ts.map +1 -0
- package/dist/launch-all-discovery.js +90 -4
- package/dist/launch-all-discovery.js.map +1 -0
- package/dist/launch-all-locks.d.ts.map +1 -0
- package/dist/launch-all-locks.js +54 -1
- package/dist/launch-all-locks.js.map +1 -0
- package/dist/launch-gate.d.ts +2 -2
- package/dist/launch-gate.d.ts.map +1 -0
- package/dist/launch-gate.js +73 -1
- package/dist/launch-gate.js.map +1 -0
- package/dist/lifecycle-log-guard.d.ts.map +1 -0
- package/dist/lifecycle-log-guard.js +93 -2
- package/dist/lifecycle-log-guard.js.map +1 -0
- package/dist/list-roles-render.d.ts.map +1 -0
- package/dist/list-roles-render.js +40 -6
- package/dist/list-roles-render.js.map +1 -0
- package/dist/local-log-routing.d.ts +19 -0
- package/dist/local-log-routing.d.ts.map +1 -0
- package/dist/local-log-routing.js +67 -0
- package/dist/local-log-routing.js.map +1 -0
- package/dist/local-manage-tool-result.d.ts +8 -0
- package/dist/local-manage-tool-result.d.ts.map +1 -0
- package/dist/local-manage-tool-result.js +10 -0
- package/dist/local-manage-tool-result.js.map +1 -0
- package/dist/local-server-cursor.d.ts +34 -0
- package/dist/local-server-cursor.d.ts.map +1 -0
- package/dist/local-server-cursor.js +151 -0
- package/dist/local-server-cursor.js.map +1 -0
- package/dist/log-audit.d.ts.map +1 -0
- package/dist/log-audit.js +194 -3
- package/dist/log-audit.js.map +1 -0
- package/dist/log-stream.d.ts +35 -18
- package/dist/log-stream.d.ts.map +1 -0
- package/dist/log-stream.js +1270 -12
- package/dist/log-stream.js.map +1 -0
- package/dist/model-presets.d.ts.map +1 -0
- package/dist/model-presets.js +19 -1
- package/dist/model-presets.js.map +1 -0
- package/dist/name-validator.d.ts.map +1 -0
- package/dist/name-validator.js +22 -1
- package/dist/name-validator.js.map +1 -0
- package/dist/opencode-drone.d.ts.map +1 -0
- package/dist/opencode-drone.js +438 -4
- package/dist/opencode-drone.js.map +1 -0
- package/dist/opencode-plugin.d.ts +1 -1
- package/dist/opencode-plugin.d.ts.map +1 -0
- package/dist/opencode-plugin.js +29 -4
- package/dist/opencode-plugin.js.map +1 -0
- package/dist/parse-assimilate-args.d.ts +1 -1
- package/dist/parse-assimilate-args.d.ts.map +1 -0
- package/dist/parse-assimilate-args.js +125 -1
- package/dist/parse-assimilate-args.js.map +1 -0
- package/dist/parse-launch-all-args.d.ts.map +1 -0
- package/dist/parse-launch-all-args.js +70 -1
- package/dist/parse-launch-all-args.js.map +1 -0
- package/dist/postinstall-banner.d.ts.map +1 -0
- package/dist/postinstall-banner.js +27 -2
- package/dist/postinstall-banner.js.map +1 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +32 -5
- package/dist/postinstall.js.map +1 -0
- package/dist/readiness-probe.d.ts.map +1 -0
- package/dist/readiness-probe.js +9 -1
- package/dist/readiness-probe.js.map +1 -0
- package/dist/regen-format.d.ts.map +1 -0
- package/dist/regen-format.js +545 -13
- package/dist/regen-format.js.map +1 -0
- package/dist/regen.d.ts.map +1 -0
- package/dist/regen.js +141 -5
- package/dist/regen.js.map +1 -0
- package/dist/remote-client.d.ts +88 -173
- package/dist/remote-client.d.ts.map +1 -0
- package/dist/remote-client.js +997 -1
- package/dist/remote-client.js.map +1 -0
- package/dist/reset-local-seat-cmd.d.ts +50 -0
- package/dist/reset-local-seat-cmd.d.ts.map +1 -0
- package/dist/reset-local-seat-cmd.js +169 -0
- package/dist/reset-local-seat-cmd.js.map +1 -0
- package/dist/role-match.d.ts.map +1 -0
- package/dist/role-match.js +23 -1
- package/dist/role-match.js.map +1 -0
- package/dist/role-resolver.d.ts.map +1 -0
- package/dist/role-resolver.js +60 -1
- package/dist/role-resolver.js.map +1 -0
- package/dist/roster-render.d.ts.map +1 -0
- package/dist/roster-render.js +121 -3
- package/dist/roster-render.js.map +1 -0
- package/dist/seat-probe.d.ts +32 -13
- package/dist/seat-probe.d.ts.map +1 -0
- package/dist/seat-probe.js +78 -1
- package/dist/seat-probe.js.map +1 -0
- package/dist/seat-store.d.ts +76 -0
- package/dist/seat-store.d.ts.map +1 -0
- package/dist/seat-store.js +309 -0
- package/dist/seat-store.js.map +1 -0
- package/dist/seats.d.ts +375 -0
- package/dist/seats.d.ts.map +1 -0
- package/dist/seats.js +670 -0
- package/dist/seats.js.map +1 -0
- package/dist/self-path.d.ts +27 -0
- package/dist/self-path.d.ts.map +1 -0
- package/dist/self-path.js +43 -0
- package/dist/self-path.js.map +1 -0
- package/dist/server-endpoint.d.ts +9 -0
- package/dist/server-endpoint.d.ts.map +1 -0
- package/dist/server-endpoint.js +38 -0
- package/dist/server-endpoint.js.map +1 -0
- package/dist/server-errors.d.ts +50 -0
- package/dist/server-errors.d.ts.map +1 -0
- package/dist/server-errors.js +79 -0
- package/dist/server-errors.js.map +1 -0
- package/dist/server-handshake.d.ts +197 -0
- package/dist/server-handshake.d.ts.map +1 -0
- package/dist/server-handshake.js +533 -0
- package/dist/server-handshake.js.map +1 -0
- package/dist/server-response.d.ts +3 -0
- package/dist/server-response.d.ts.map +1 -0
- package/dist/server-response.js +67 -0
- package/dist/server-response.js.map +1 -0
- package/dist/server-trust.d.ts +14 -0
- package/dist/server-trust.d.ts.map +1 -0
- package/dist/server-trust.js +225 -0
- package/dist/server-trust.js.map +1 -0
- package/dist/session-continuity.d.ts +33 -0
- package/dist/session-continuity.d.ts.map +1 -0
- package/dist/session-continuity.js +220 -0
- package/dist/session-continuity.js.map +1 -0
- package/dist/setup-confirm.d.ts +3 -3
- package/dist/setup-confirm.d.ts.map +1 -0
- package/dist/setup-confirm.js +126 -2
- package/dist/setup-confirm.js.map +1 -0
- package/dist/setup.d.ts +5 -3
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +169 -46
- package/dist/setup.js.map +1 -0
- package/dist/shell-escape.d.ts.map +1 -0
- package/dist/shell-escape.js +22 -1
- package/dist/shell-escape.js.map +1 -0
- package/dist/spawn.d.ts +2 -2
- package/dist/spawn.d.ts.map +1 -0
- package/dist/spawn.js +29 -10
- package/dist/spawn.js.map +1 -0
- package/dist/startup-services.d.ts +0 -1
- package/dist/startup-services.d.ts.map +1 -0
- package/dist/startup-services.js +26 -1
- package/dist/startup-services.js.map +1 -0
- package/dist/stream-owner.d.ts +6 -2
- package/dist/stream-owner.d.ts.map +1 -0
- package/dist/stream-owner.js +547 -2
- package/dist/stream-owner.js.map +1 -0
- package/dist/stream-status.d.ts +1 -1
- package/dist/stream-status.d.ts.map +1 -0
- package/dist/stream-status.js +268 -3
- package/dist/stream-status.js.map +1 -0
- package/dist/sync-roles-render.d.ts.map +1 -0
- package/dist/sync-roles-render.js +118 -3
- package/dist/sync-roles-render.js.map +1 -0
- package/dist/sync.d.ts +1 -1
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +286 -22
- package/dist/sync.js.map +1 -0
- package/dist/terminal-title.d.ts.map +1 -0
- package/dist/terminal-title.js +68 -1
- package/dist/terminal-title.js.map +1 -0
- package/dist/token-store.d.ts +17 -111
- package/dist/token-store.d.ts.map +1 -0
- package/dist/token-store.js +81 -1
- package/dist/token-store.js.map +1 -0
- package/dist/tool-manifest.d.ts +4 -8
- package/dist/tool-manifest.d.ts.map +1 -0
- package/dist/tool-manifest.js +554 -1
- package/dist/tool-manifest.js.map +1 -0
- package/dist/tool-scope.d.ts +8 -12
- package/dist/tool-scope.d.ts.map +1 -0
- package/dist/tool-scope.js +97 -1
- package/dist/tool-scope.js.map +1 -0
- package/dist/types.d.ts +1 -5
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/unknown-subcommand.d.ts +1 -1
- package/dist/unknown-subcommand.d.ts.map +1 -0
- package/dist/unknown-subcommand.js +37 -1
- package/dist/unknown-subcommand.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +78 -2
- package/dist/version.js.map +1 -0
- package/dist/working-repo.d.ts.map +1 -0
- package/dist/working-repo.js +81 -1
- package/dist/working-repo.js.map +1 -0
- package/dist/worktree-lifecycle.d.ts.map +1 -0
- package/dist/worktree-lifecycle.js +205 -2
- package/dist/worktree-lifecycle.js.map +1 -0
- package/docs/EXTRACTION_PROVENANCE.md +42 -0
- package/docs/LOCAL_SERVER.md +103 -0
- package/docs/RELEASING.md +129 -0
- package/package.json +52 -34
- package/src/agent-runtime.ts +69 -0
- package/src/assimilate-cmd.ts +1864 -0
- package/src/assimilate-deps.ts +444 -0
- package/src/assimilate-guard.ts +84 -0
- package/src/assimilate-welcome.ts +39 -0
- package/src/auth-env.ts +21 -0
- package/src/backends/launch-all-pastelist.ts +18 -0
- package/src/backends/launch-all-tmux.ts +75 -0
- package/src/backends/launch-all-windows.ts +110 -0
- package/src/bare-launch-menu.ts +148 -0
- package/src/claude-launch-args.ts +35 -0
- package/src/claude.ts +561 -0
- package/src/cleanup-cmd.ts +581 -0
- package/src/clear-rewake-core.ts +34 -0
- package/src/clear-rewake.ts +18 -0
- package/src/cli-help.ts +116 -0
- package/src/cli-platform.ts +127 -0
- package/src/cli-tool-approval.ts +716 -0
- package/src/codex-app-server.ts +238 -0
- package/src/codex-app-wake.ts +524 -0
- package/src/codex-launch.ts +140 -0
- package/src/codex-remote.ts +500 -0
- package/src/codex-wake-resolve.ts +155 -0
- package/src/config-utils.ts +811 -0
- package/src/config.ts +595 -0
- package/src/console-prefix.ts +99 -0
- package/src/cube-name.ts +69 -0
- package/src/cubes.ts +583 -0
- package/src/debug.ts +73 -0
- package/src/direct-log.ts +9 -0
- package/src/docs-sections.ts +129 -0
- package/src/drone-lifecycle.ts +62 -0
- package/src/drone-management.ts +162 -0
- package/src/ensure-mcp-config.ts +54 -0
- package/src/evict-drone.ts +82 -0
- package/src/gc-orphan-inboxes.ts +229 -0
- package/src/inbox-monitor.ts +1005 -0
- package/src/index.ts +1201 -0
- package/src/launch-all-cmd.ts +450 -0
- package/src/launch-all-command.ts +30 -0
- package/src/launch-all-deps.ts +188 -0
- package/src/launch-all-discovery.ts +118 -0
- package/src/launch-all-locks.ts +74 -0
- package/src/launch-gate.ts +80 -0
- package/src/lifecycle-log-guard.ts +144 -0
- package/src/list-roles-render.ts +52 -0
- package/src/local-log-routing.ts +106 -0
- package/src/local-manage-tool-result.ts +10 -0
- package/src/local-server-cursor.ts +188 -0
- package/src/log-audit.ts +207 -0
- package/src/log-stream.ts +1567 -0
- package/src/model-presets.ts +22 -0
- package/src/name-validator.ts +23 -0
- package/src/opencode-drone.ts +528 -0
- package/src/opencode-plugin.ts +38 -0
- package/src/parse-assimilate-args.ts +125 -0
- package/src/parse-launch-all-args.ts +100 -0
- package/src/postinstall-banner.ts +37 -0
- package/src/postinstall.ts +36 -0
- package/src/readiness-probe.ts +12 -0
- package/src/regen-format.ts +651 -0
- package/src/regen.ts +150 -0
- package/src/remote-client.ts +1457 -0
- package/src/reset-local-seat-cmd.ts +227 -0
- package/src/role-match.ts +29 -0
- package/src/role-resolver.ts +93 -0
- package/src/roster-render.ts +196 -0
- package/src/seat-probe.ts +115 -0
- package/src/seat-store.ts +333 -0
- package/src/seats.ts +911 -0
- package/src/self-path.ts +51 -0
- package/src/server-endpoint.ts +38 -0
- package/src/server-errors.ts +95 -0
- package/src/server-handshake.ts +816 -0
- package/src/server-response.ts +76 -0
- package/src/server-trust.ts +245 -0
- package/src/session-continuity.ts +280 -0
- package/src/setup-confirm.ts +171 -0
- package/src/setup.ts +186 -0
- package/src/shell-escape.ts +22 -0
- package/src/spawn.ts +31 -0
- package/src/startup-services.ts +36 -0
- package/src/stream-owner.ts +686 -0
- package/src/stream-status.ts +337 -0
- package/src/sync-roles-render.ts +163 -0
- package/src/sync.ts +363 -0
- package/src/terminal-title.ts +76 -0
- package/src/token-store.ts +102 -0
- package/src/tool-manifest.ts +610 -0
- package/src/tool-scope.ts +110 -0
- package/src/types.ts +5 -0
- package/src/unknown-subcommand.ts +35 -0
- package/src/version.ts +82 -0
- package/src/working-repo.ts +99 -0
- package/src/worktree-lifecycle.ts +254 -0
- package/dist/auth-recovery.d.ts +0 -33
- package/dist/auth-recovery.js +0 -1
- package/dist/auth.d.ts +0 -103
- package/dist/auth.js +0 -39
- package/dist/device-auth.d.ts +0 -75
- package/dist/device-auth.js +0 -1
- package/dist/drone-address.d.ts +0 -26
- package/dist/drone-address.js +0 -1
- package/dist/get-started.d.ts +0 -20
- package/dist/get-started.js +0 -2
- package/dist/health-beat.d.ts +0 -134
- package/dist/health-beat.js +0 -1
- package/dist/role-section.d.ts +0 -110
- package/dist/role-section.js +0 -8
- package/dist/setup-action.d.ts +0 -20
- package/dist/setup-action.js +0 -1
- package/dist/stale-version-check.d.ts +0 -40
- package/dist/stale-version-check.js +0 -1
- package/dist/subscription-retry.d.ts +0 -40
- package/dist/subscription-retry.js +0 -1
- package/dist/templates.d.ts +0 -107
- package/dist/templates.js +0 -359
- package/dist/token-crypto.d.ts +0 -50
- package/dist/token-crypto.js +0 -1
package/src/cli-help.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure CLI help-text + flag helpers.
|
|
3
|
+
*
|
|
4
|
+
* Kept in its own module (not in claude.ts) so importing them in tests does NOT
|
|
5
|
+
* run claude.ts's `main()` side effects — the same pattern as parse-assimilate-args.ts
|
|
6
|
+
* and cli-platform.ts.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** True for the standard help flags `--help` / `-h`. */
|
|
10
|
+
export function isHelpFlag(arg: string | undefined): boolean {
|
|
11
|
+
return arg === '--help' || arg === '-h';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Help text for top-level `borg --help`.
|
|
16
|
+
*
|
|
17
|
+
* Kept pure so tests can pin user-facing discoverability without importing
|
|
18
|
+
* claude.ts, which launches agent CLIs as a side effect.
|
|
19
|
+
*/
|
|
20
|
+
export function topLevelHelpText(version: string): string {
|
|
21
|
+
return (
|
|
22
|
+
`borgmcp ${version} — run several AI coding agents on one project, together.\n` +
|
|
23
|
+
` They coordinate through a shared log (a "cube"). For Claude Code, Codex & OpenCode.\n\n` +
|
|
24
|
+
`Docs & quickstart: https://github.com/Byte-Ventures/borg-mcp-client#readme\n\n` +
|
|
25
|
+
`Install Claude Code, Codex, or OpenCode first. Type \`borg ...\` in your terminal;\n` +
|
|
26
|
+
`type \`borg_...\` inside your agent session once you've joined a cube ("assimilate").\n\n` +
|
|
27
|
+
`Usage:\n` +
|
|
28
|
+
` borg Launch your agent CLI; in a TTY, bare borg may show the launch menu\n` +
|
|
29
|
+
` borg setup Set up borg MCP server + agent CLI integration\n` +
|
|
30
|
+
` borg assimilate [role] Join or create a cube\n` +
|
|
31
|
+
` borg assimilate --host <host> Join or create on an explicit server\n` +
|
|
32
|
+
` borg assimilate --worktree <name> Spawn a worktree drone (in ~/.borg/worktrees/<repo>/<name>)\n` +
|
|
33
|
+
` borg reset-local-seat Clear ONLY this worktree's saved local seat (offline; after a rejection)\n` +
|
|
34
|
+
` borg sync [--prune] Sync this worktree's branch to origin/main\n` +
|
|
35
|
+
` borg cleanup [--prune] Report (or --prune) worktrees orphaned by evicted drones\n` +
|
|
36
|
+
` borg launch-all [cube] Launch all drone worktrees of a cube (default: active cube)\n` +
|
|
37
|
+
` borg launch-all [cube] --cli claude|codex|opencode\n` +
|
|
38
|
+
` Launch all drone worktrees with that agent CLI\n` +
|
|
39
|
+
` borg --cli claude|codex|opencode Launch that agent CLI directly\n` +
|
|
40
|
+
` borg --version Show installed version\n\n` +
|
|
41
|
+
`All other arguments are passed through to the selected agent CLI.\n`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Help text for `borg assimilate --help` — the home for the full assimilate flag
|
|
47
|
+
* set. Model/provider configuration belongs to the selected agent CLI.
|
|
48
|
+
*/
|
|
49
|
+
export function assimilateHelpText(version: string): string {
|
|
50
|
+
return (
|
|
51
|
+
`borg assimilate (borgmcp ${version}) — join or create a cube under a role\n\n` +
|
|
52
|
+
`Usage:\n` +
|
|
53
|
+
` borg assimilate [role] Join the active cube under [role] (default role if omitted)\n` +
|
|
54
|
+
` borg assimilate [role] --worktree <name> Spawn the drone in an isolated git worktree\n` +
|
|
55
|
+
` (~/.borg/worktrees/<repo>/<name>)\n` +
|
|
56
|
+
` borg assimilate --here Assimilate in the current worktree (no sibling spawn)\n` +
|
|
57
|
+
` borg assimilate --host <host> Join an authorized self-hosted cube\n` +
|
|
58
|
+
` borg assimilate --host <host> --enroll Operator-terminal enrollment, then create/join (preview)\n` +
|
|
59
|
+
` borg assimilate --help Show this help\n\n` +
|
|
60
|
+
`Flags:\n` +
|
|
61
|
+
` --worktree <name> Create + launch the drone in a sibling git worktree\n` +
|
|
62
|
+
` --here Stay in the current worktree (no sibling spawn)\n` +
|
|
63
|
+
` --cube-name <name> Cube to join/create (otherwise confirm repo basename)\n` +
|
|
64
|
+
` --host <host> Borg server host or URL (bare hosts default to HTTPS)\n` +
|
|
65
|
+
` --enroll Prompt for a hidden enrollment invitation in the operator terminal\n` +
|
|
66
|
+
` --template <name> Bootstrap a new cube from a bundled role template\n` +
|
|
67
|
+
` --no-template Create the cube with no template roles\n` +
|
|
68
|
+
` --cli claude|codex|opencode Agent CLI to launch (default: claude)\n` +
|
|
69
|
+
` --model claude:<model> Legacy Claude model override (configure models in the agent CLI)\n` +
|
|
70
|
+
` --yes, -y Skip confirmation prompts\n\n` +
|
|
71
|
+
`An enrolled owner client may create an idempotent repository cube; ordinary clients\n` +
|
|
72
|
+
`require an explicit cube grant. Agent seats begin only after enrollment. Preview only.\n` +
|
|
73
|
+
`See docs/LOCAL_SERVER.md for self-hosted setup and current status.\n\n` +
|
|
74
|
+
`For local or provider-specific models, configure the selected agent CLI directly.\n` +
|
|
75
|
+
`OpenCode supports Ollama and other providers through its own model configuration.\n`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Help text for `borg reset-local-seat --help`. The offline, network-free seat
|
|
81
|
+
* reset recommended by the pin-matched SESSION_REJECTED diagnostic (#1082).
|
|
82
|
+
*/
|
|
83
|
+
export function resetLocalSeatHelpText(version: string): string {
|
|
84
|
+
return (
|
|
85
|
+
`borg reset-local-seat (borgmcp ${version}) — clear ONLY this worktree's saved local seat\n\n` +
|
|
86
|
+
`Offline and network-free: it contacts no server and revokes nothing server-side. It clears\n` +
|
|
87
|
+
`just this worktree's saved local seat — its credential and cube binding together — from the\n` +
|
|
88
|
+
`local seat store on this machine. Server, trust anchor, cube, and every sibling worktree are\n` +
|
|
89
|
+
`left untouched.\n\n` +
|
|
90
|
+
`Use it after \`borg assimilate\` reports this worktree's seat was revoked or taken over\n` +
|
|
91
|
+
`(a pin-matched rejection), then ask the operator for a new invitation and re-enroll.\n\n` +
|
|
92
|
+
`Usage:\n` +
|
|
93
|
+
` borg reset-local-seat Reset this worktree's saved seat (TTY confirms [y/N])\n` +
|
|
94
|
+
` borg reset-local-seat --host <host> No-op unless this worktree's seat is on <host>\n` +
|
|
95
|
+
` borg reset-local-seat --yes Reset without a prompt (required when non-interactive)\n` +
|
|
96
|
+
` borg reset-local-seat --help Show this help\n\n` +
|
|
97
|
+
`Flags:\n` +
|
|
98
|
+
` --host <host> Only act if this worktree's saved seat is on <host> (else no-op)\n` +
|
|
99
|
+
` --yes, -y Skip the confirmation prompt (required in non-TTY contexts)\n`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Help text for `borg setup --help` (gh#520 — previously this ran the setup
|
|
105
|
+
* wizard instead of showing help). Mirrors the `borg setup` description in the
|
|
106
|
+
* top-level `borg --help`.
|
|
107
|
+
*/
|
|
108
|
+
export function setupHelpText(version: string): string {
|
|
109
|
+
return (
|
|
110
|
+
`borg setup (borgmcp ${version}) — set up borg MCP server + agent CLI integration\n\n` +
|
|
111
|
+
`Borg MCP needs Claude Code, Codex, or OpenCode installed first.\n\n` +
|
|
112
|
+
`Usage:\n` +
|
|
113
|
+
` borg setup Run the interactive setup wizard\n` +
|
|
114
|
+
` borg setup --help Show this help\n`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import which from 'which';
|
|
2
|
+
import type { BorgCli } from './cubes.js';
|
|
3
|
+
import { getProjectCliPreference, setProjectCliPreference } from './cubes.js';
|
|
4
|
+
|
|
5
|
+
export interface CliAvailability {
|
|
6
|
+
claude: string | null;
|
|
7
|
+
codex: string | null;
|
|
8
|
+
opencode: string | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CliChoiceDeps {
|
|
12
|
+
detectCli: () => CliAvailability;
|
|
13
|
+
getPreference: () => Promise<BorgCli | null>;
|
|
14
|
+
setPreference: (cli: BorgCli) => Promise<void>;
|
|
15
|
+
prompt: (message: string) => Promise<string>;
|
|
16
|
+
isTTY: () => boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function detectCliAvailability(): CliAvailability {
|
|
20
|
+
return {
|
|
21
|
+
claude: findCommand('claude'),
|
|
22
|
+
codex: findCommand('codex'),
|
|
23
|
+
opencode: findCommand('opencode'),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function findCommand(name: string): string | null {
|
|
28
|
+
try {
|
|
29
|
+
return which.sync(name);
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function installedCliNames(availability: CliAvailability): BorgCli[] {
|
|
36
|
+
const out: BorgCli[] = [];
|
|
37
|
+
if (availability.claude) out.push('claude');
|
|
38
|
+
if (availability.codex) out.push('codex');
|
|
39
|
+
if (availability.opencode) out.push('opencode');
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function setPreferenceAndReturn(cli: BorgCli, deps: CliChoiceDeps): Promise<BorgCli> {
|
|
44
|
+
await deps.setPreference(cli);
|
|
45
|
+
return cli;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function resolveCliChoice(
|
|
49
|
+
explicit: BorgCli | undefined,
|
|
50
|
+
deps: CliChoiceDeps
|
|
51
|
+
): Promise<BorgCli> {
|
|
52
|
+
const availability = deps.detectCli();
|
|
53
|
+
const installed = installedCliNames(availability);
|
|
54
|
+
if (installed.length === 0) {
|
|
55
|
+
throw new Error('No supported agent CLI found (claude, codex, opencode). Install one of them, then run borg again.');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (explicit) {
|
|
59
|
+
if (!installed.includes(explicit)) {
|
|
60
|
+
throw new Error(`${explicit} CLI is not installed.`);
|
|
61
|
+
}
|
|
62
|
+
await deps.setPreference(explicit);
|
|
63
|
+
return explicit;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const stored = await deps.getPreference();
|
|
67
|
+
if (stored && installed.includes(stored)) return stored;
|
|
68
|
+
|
|
69
|
+
if (installed.length === 1) {
|
|
70
|
+
await deps.setPreference(installed[0]);
|
|
71
|
+
return installed[0];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!deps.isTTY()) {
|
|
75
|
+
throw new Error('Multiple agent CLIs detected. Pass --cli claude, --cli codex, or --cli opencode to choose.');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const promptLines = installed.map((cli, i) => ` ${i + 1}) ${cli}`);
|
|
79
|
+
const answer = (await deps.prompt(`Use which CLI for this project?\n${promptLines.join('\n')}\n[1]: `)).trim();
|
|
80
|
+
if (answer === '' || answer === '1') return setPreferenceAndReturn(installed[0], deps);
|
|
81
|
+
const num = parseInt(answer, 10);
|
|
82
|
+
if (!Number.isNaN(num) && num >= 1 && num <= installed.length) {
|
|
83
|
+
return setPreferenceAndReturn(installed[num - 1], deps);
|
|
84
|
+
}
|
|
85
|
+
const lower = answer.toLowerCase();
|
|
86
|
+
for (const cli of installed) {
|
|
87
|
+
if (lower === cli) return setPreferenceAndReturn(cli, deps);
|
|
88
|
+
}
|
|
89
|
+
throw new Error(`invalid CLI choice "${answer}"`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function defaultCliChoiceDeps(prompt: (message: string) => Promise<string>, isTTY: () => boolean): CliChoiceDeps {
|
|
93
|
+
return {
|
|
94
|
+
detectCli: detectCliAvailability,
|
|
95
|
+
getPreference: getProjectCliPreference,
|
|
96
|
+
setPreference: setProjectCliPreference,
|
|
97
|
+
prompt,
|
|
98
|
+
isTTY,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const VALID_CLIS: readonly BorgCli[] = ['claude', 'codex', 'opencode'];
|
|
103
|
+
|
|
104
|
+
export function parseCliFlag(args: string[]): { cli?: BorgCli; rest: string[]; error?: string } {
|
|
105
|
+
const rest: string[] = [];
|
|
106
|
+
let cli: BorgCli | undefined;
|
|
107
|
+
for (let i = 0; i < args.length; i++) {
|
|
108
|
+
const arg = args[i];
|
|
109
|
+
if (arg === '--cli') {
|
|
110
|
+
const next = args[i + 1];
|
|
111
|
+
if (!next || !(VALID_CLIS as readonly string[]).includes(next)) {
|
|
112
|
+
return { rest, error: `--cli requires one of: ${VALID_CLIS.join(', ')}` };
|
|
113
|
+
}
|
|
114
|
+
cli = next as BorgCli;
|
|
115
|
+
i += 1;
|
|
116
|
+
} else if (arg.startsWith('--cli=')) {
|
|
117
|
+
const value = arg.slice('--cli='.length);
|
|
118
|
+
if (!(VALID_CLIS as readonly string[]).includes(value)) {
|
|
119
|
+
return { rest, error: `--cli requires one of: ${VALID_CLIS.join(', ')}` };
|
|
120
|
+
}
|
|
121
|
+
cli = value as BorgCli;
|
|
122
|
+
} else {
|
|
123
|
+
rest.push(arg);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return { cli, rest };
|
|
127
|
+
}
|