@boxes-dev/dvb-runtime 1.0.298 → 1.0.299
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/dist/bin/.bundle-state.json +2 -2
- package/dist/bin/dvb.cjs +6 -6
- package/dist/bin/dvbd.cjs +6 -6
- package/package.json +7 -5
- package/dist/devbox/auth.d.ts +0 -22
- package/dist/devbox/auth.d.ts.map +0 -1
- package/dist/devbox/auth.js +0 -233
- package/dist/devbox/auth.js.map +0 -1
- package/dist/devbox/browser.d.ts +0 -19
- package/dist/devbox/browser.d.ts.map +0 -1
- package/dist/devbox/browser.js +0 -60
- package/dist/devbox/browser.js.map +0 -1
- package/dist/devbox/cli.d.ts +0 -7
- package/dist/devbox/cli.d.ts.map +0 -1
- package/dist/devbox/cli.js +0 -124
- package/dist/devbox/cli.js.map +0 -1
- package/dist/devbox/commandRegistry/args.d.ts +0 -18
- package/dist/devbox/commandRegistry/args.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/args.js +0 -107
- package/dist/devbox/commandRegistry/args.js.map +0 -1
- package/dist/devbox/commandRegistry/catalog.d.ts +0 -4
- package/dist/devbox/commandRegistry/catalog.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/catalog.js +0 -763
- package/dist/devbox/commandRegistry/catalog.js.map +0 -1
- package/dist/devbox/commandRegistry/dispatch.d.ts +0 -3
- package/dist/devbox/commandRegistry/dispatch.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/dispatch.js +0 -61
- package/dist/devbox/commandRegistry/dispatch.js.map +0 -1
- package/dist/devbox/commandRegistry/errors.d.ts +0 -8
- package/dist/devbox/commandRegistry/errors.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/errors.js +0 -26
- package/dist/devbox/commandRegistry/errors.js.map +0 -1
- package/dist/devbox/commandRegistry/help.d.ts +0 -5
- package/dist/devbox/commandRegistry/help.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/help.js +0 -94
- package/dist/devbox/commandRegistry/help.js.map +0 -1
- package/dist/devbox/commandRegistry/resolve.d.ts +0 -7
- package/dist/devbox/commandRegistry/resolve.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/resolve.js +0 -32
- package/dist/devbox/commandRegistry/resolve.js.map +0 -1
- package/dist/devbox/commandRegistry/tab.d.ts +0 -10
- package/dist/devbox/commandRegistry/tab.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/tab.js +0 -83
- package/dist/devbox/commandRegistry/tab.js.map +0 -1
- package/dist/devbox/commandRegistry/types.d.ts +0 -32
- package/dist/devbox/commandRegistry/types.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/types.js +0 -2
- package/dist/devbox/commandRegistry/types.js.map +0 -1
- package/dist/devbox/commands/agent.d.ts +0 -52
- package/dist/devbox/commands/agent.d.ts.map +0 -1
- package/dist/devbox/commands/agent.js +0 -397
- package/dist/devbox/commands/agent.js.map +0 -1
- package/dist/devbox/commands/boxSelect.d.ts +0 -25
- package/dist/devbox/commands/boxSelect.d.ts.map +0 -1
- package/dist/devbox/commands/boxSelect.js +0 -94
- package/dist/devbox/commands/boxSelect.js.map +0 -1
- package/dist/devbox/commands/checkpoint.d.ts +0 -9
- package/dist/devbox/commands/checkpoint.d.ts.map +0 -1
- package/dist/devbox/commands/checkpoint.js +0 -105
- package/dist/devbox/commands/checkpoint.js.map +0 -1
- package/dist/devbox/commands/commandProvider.d.ts +0 -33
- package/dist/devbox/commands/commandProvider.d.ts.map +0 -1
- package/dist/devbox/commands/commandProvider.js +0 -156
- package/dist/devbox/commands/commandProvider.js.map +0 -1
- package/dist/devbox/commands/connect.d.ts +0 -39
- package/dist/devbox/commands/connect.d.ts.map +0 -1
- package/dist/devbox/commands/connect.js +0 -1367
- package/dist/devbox/commands/connect.js.map +0 -1
- package/dist/devbox/commands/connectSessionMapping.d.ts +0 -64
- package/dist/devbox/commands/connectSessionMapping.d.ts.map +0 -1
- package/dist/devbox/commands/connectSessionMapping.js +0 -153
- package/dist/devbox/commands/connectSessionMapping.js.map +0 -1
- package/dist/devbox/commands/cp.d.ts +0 -60
- package/dist/devbox/commands/cp.d.ts.map +0 -1
- package/dist/devbox/commands/cp.js +0 -383
- package/dist/devbox/commands/cp.js.map +0 -1
- package/dist/devbox/commands/daemon.d.ts +0 -4
- package/dist/devbox/commands/daemon.d.ts.map +0 -1
- package/dist/devbox/commands/daemon.js +0 -49
- package/dist/devbox/commands/daemon.js.map +0 -1
- package/dist/devbox/commands/destroy.d.ts +0 -2
- package/dist/devbox/commands/destroy.d.ts.map +0 -1
- package/dist/devbox/commands/destroy.js +0 -204
- package/dist/devbox/commands/destroy.js.map +0 -1
- package/dist/devbox/commands/destroyE2b.d.ts +0 -22
- package/dist/devbox/commands/destroyE2b.d.ts.map +0 -1
- package/dist/devbox/commands/destroyE2b.js +0 -12
- package/dist/devbox/commands/destroyE2b.js.map +0 -1
- package/dist/devbox/commands/destroyLocalState.d.ts +0 -34
- package/dist/devbox/commands/destroyLocalState.d.ts.map +0 -1
- package/dist/devbox/commands/destroyLocalState.js +0 -187
- package/dist/devbox/commands/destroyLocalState.js.map +0 -1
- package/dist/devbox/commands/destroyModal.d.ts +0 -21
- package/dist/devbox/commands/destroyModal.d.ts.map +0 -1
- package/dist/devbox/commands/destroyModal.js +0 -13
- package/dist/devbox/commands/destroyModal.js.map +0 -1
- package/dist/devbox/commands/destroyShared.d.ts +0 -14
- package/dist/devbox/commands/destroyShared.d.ts.map +0 -1
- package/dist/devbox/commands/destroyShared.js +0 -37
- package/dist/devbox/commands/destroyShared.js.map +0 -1
- package/dist/devbox/commands/fork.d.ts +0 -9
- package/dist/devbox/commands/fork.d.ts.map +0 -1
- package/dist/devbox/commands/fork.js +0 -94
- package/dist/devbox/commands/fork.js.map +0 -1
- package/dist/devbox/commands/ide.d.ts +0 -35
- package/dist/devbox/commands/ide.d.ts.map +0 -1
- package/dist/devbox/commands/ide.js +0 -987
- package/dist/devbox/commands/ide.js.map +0 -1
- package/dist/devbox/commands/init/args.d.ts +0 -18
- package/dist/devbox/commands/init/args.d.ts.map +0 -1
- package/dist/devbox/commands/init/args.js +0 -44
- package/dist/devbox/commands/init/args.js.map +0 -1
- package/dist/devbox/commands/init/clack.d.ts +0 -22
- package/dist/devbox/commands/init/clack.d.ts.map +0 -1
- package/dist/devbox/commands/init/clack.js +0 -158
- package/dist/devbox/commands/init/clack.js.map +0 -1
- package/dist/devbox/commands/init/claudeBootstrap.d.ts +0 -49
- package/dist/devbox/commands/init/claudeBootstrap.d.ts.map +0 -1
- package/dist/devbox/commands/init/claudeBootstrap.js +0 -504
- package/dist/devbox/commands/init/claudeBootstrap.js.map +0 -1
- package/dist/devbox/commands/init/codex/artifacts.d.ts +0 -49
- package/dist/devbox/commands/init/codex/artifacts.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/artifacts.js +0 -278
- package/dist/devbox/commands/init/codex/artifacts.js.map +0 -1
- package/dist/devbox/commands/init/codex/config.d.ts +0 -6
- package/dist/devbox/commands/init/codex/config.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/config.js +0 -43
- package/dist/devbox/commands/init/codex/config.js.map +0 -1
- package/dist/devbox/commands/init/codex/events.d.ts +0 -14
- package/dist/devbox/commands/init/codex/events.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/events.js +0 -435
- package/dist/devbox/commands/init/codex/events.js.map +0 -1
- package/dist/devbox/commands/init/codex/execConfig.d.ts +0 -5
- package/dist/devbox/commands/init/codex/execConfig.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/execConfig.js +0 -10
- package/dist/devbox/commands/init/codex/execConfig.js.map +0 -1
- package/dist/devbox/commands/init/codex/index.d.ts +0 -136
- package/dist/devbox/commands/init/codex/index.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/index.js +0 -1115
- package/dist/devbox/commands/init/codex/index.js.map +0 -1
- package/dist/devbox/commands/init/codex/local.d.ts +0 -124
- package/dist/devbox/commands/init/codex/local.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/local.js +0 -1381
- package/dist/devbox/commands/init/codex/local.js.map +0 -1
- package/dist/devbox/commands/init/codex/localExecArgs.d.ts +0 -25
- package/dist/devbox/commands/init/codex/localExecArgs.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/localExecArgs.js +0 -48
- package/dist/devbox/commands/init/codex/localExecArgs.js.map +0 -1
- package/dist/devbox/commands/init/codex/plan.d.ts +0 -99
- package/dist/devbox/commands/init/codex/plan.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/plan.js +0 -231
- package/dist/devbox/commands/init/codex/plan.js.map +0 -1
- package/dist/devbox/commands/init/codex/prompts.d.ts +0 -9
- package/dist/devbox/commands/init/codex/prompts.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/prompts.js +0 -51
- package/dist/devbox/commands/init/codex/prompts.js.map +0 -1
- package/dist/devbox/commands/init/codex/proxy.d.ts +0 -10
- package/dist/devbox/commands/init/codex/proxy.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/proxy.js +0 -32
- package/dist/devbox/commands/init/codex/proxy.js.map +0 -1
- package/dist/devbox/commands/init/codex/remote.d.ts +0 -96
- package/dist/devbox/commands/init/codex/remote.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/remote.js +0 -927
- package/dist/devbox/commands/init/codex/remote.js.map +0 -1
- package/dist/devbox/commands/init/codex/retry.d.ts +0 -17
- package/dist/devbox/commands/init/codex/retry.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/retry.js +0 -17
- package/dist/devbox/commands/init/codex/retry.js.map +0 -1
- package/dist/devbox/commands/init/codex/scanStatus.d.ts +0 -5
- package/dist/devbox/commands/init/codex/scanStatus.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/scanStatus.js +0 -27
- package/dist/devbox/commands/init/codex/scanStatus.js.map +0 -1
- package/dist/devbox/commands/init/codex/shellHistory.d.ts +0 -39
- package/dist/devbox/commands/init/codex/shellHistory.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/shellHistory.js +0 -258
- package/dist/devbox/commands/init/codex/shellHistory.js.map +0 -1
- package/dist/devbox/commands/init/codex/template.d.ts +0 -3
- package/dist/devbox/commands/init/codex/template.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/template.js +0 -3
- package/dist/devbox/commands/init/codex/template.js.map +0 -1
- package/dist/devbox/commands/init/finalizeFlow.d.ts +0 -95
- package/dist/devbox/commands/init/finalizeFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/finalizeFlow.js +0 -786
- package/dist/devbox/commands/init/finalizeFlow.js.map +0 -1
- package/dist/devbox/commands/init/index.d.ts +0 -11
- package/dist/devbox/commands/init/index.d.ts.map +0 -1
- package/dist/devbox/commands/init/index.js +0 -1058
- package/dist/devbox/commands/init/index.js.map +0 -1
- package/dist/devbox/commands/init/modal.d.ts +0 -5
- package/dist/devbox/commands/init/modal.d.ts.map +0 -1
- package/dist/devbox/commands/init/modal.js +0 -4
- package/dist/devbox/commands/init/modal.js.map +0 -1
- package/dist/devbox/commands/init/packaging.d.ts +0 -5
- package/dist/devbox/commands/init/packaging.d.ts.map +0 -1
- package/dist/devbox/commands/init/packaging.js +0 -81
- package/dist/devbox/commands/init/packaging.js.map +0 -1
- package/dist/devbox/commands/init/progress.d.ts +0 -31
- package/dist/devbox/commands/init/progress.d.ts.map +0 -1
- package/dist/devbox/commands/init/progress.js +0 -205
- package/dist/devbox/commands/init/progress.js.map +0 -1
- package/dist/devbox/commands/init/provider/e2b.d.ts +0 -29
- package/dist/devbox/commands/init/provider/e2b.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/e2b.js +0 -130
- package/dist/devbox/commands/init/provider/e2b.js.map +0 -1
- package/dist/devbox/commands/init/provider/e2bRuntime.d.ts +0 -39
- package/dist/devbox/commands/init/provider/e2bRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/e2bRuntime.js +0 -679
- package/dist/devbox/commands/init/provider/e2bRuntime.js.map +0 -1
- package/dist/devbox/commands/init/provider/index.d.ts +0 -8
- package/dist/devbox/commands/init/provider/index.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/index.js +0 -5
- package/dist/devbox/commands/init/provider/index.js.map +0 -1
- package/dist/devbox/commands/init/provider/modal.d.ts +0 -34
- package/dist/devbox/commands/init/provider/modal.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/modal.js +0 -274
- package/dist/devbox/commands/init/provider/modal.js.map +0 -1
- package/dist/devbox/commands/init/provider/modalRuntime.d.ts +0 -3
- package/dist/devbox/commands/init/provider/modalRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/modalRuntime.js +0 -2
- package/dist/devbox/commands/init/provider/modalRuntime.js.map +0 -1
- package/dist/devbox/commands/init/provider/resolve.d.ts +0 -44
- package/dist/devbox/commands/init/provider/resolve.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/resolve.js +0 -172
- package/dist/devbox/commands/init/provider/resolve.js.map +0 -1
- package/dist/devbox/commands/init/provider/shared.d.ts +0 -10
- package/dist/devbox/commands/init/provider/shared.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/shared.js +0 -2
- package/dist/devbox/commands/init/provider/shared.js.map +0 -1
- package/dist/devbox/commands/init/provider/sprites.d.ts +0 -30
- package/dist/devbox/commands/init/provider/sprites.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/sprites.js +0 -183
- package/dist/devbox/commands/init/provider/sprites.js.map +0 -1
- package/dist/devbox/commands/init/provider/types.d.ts +0 -19
- package/dist/devbox/commands/init/provider/types.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/types.js +0 -2
- package/dist/devbox/commands/init/provider/types.js.map +0 -1
- package/dist/devbox/commands/init/provisionFlow.d.ts +0 -53
- package/dist/devbox/commands/init/provisionFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/provisionFlow.js +0 -541
- package/dist/devbox/commands/init/provisionFlow.js.map +0 -1
- package/dist/devbox/commands/init/registry.d.ts +0 -15
- package/dist/devbox/commands/init/registry.d.ts.map +0 -1
- package/dist/devbox/commands/init/registry.js +0 -38
- package/dist/devbox/commands/init/registry.js.map +0 -1
- package/dist/devbox/commands/init/remote.d.ts +0 -48
- package/dist/devbox/commands/init/remote.d.ts.map +0 -1
- package/dist/devbox/commands/init/remote.js +0 -766
- package/dist/devbox/commands/init/remote.js.map +0 -1
- package/dist/devbox/commands/init/repo.d.ts +0 -45
- package/dist/devbox/commands/init/repo.d.ts.map +0 -1
- package/dist/devbox/commands/init/repo.js +0 -235
- package/dist/devbox/commands/init/repo.js.map +0 -1
- package/dist/devbox/commands/init/retryableErrors.d.ts +0 -4
- package/dist/devbox/commands/init/retryableErrors.d.ts.map +0 -1
- package/dist/devbox/commands/init/retryableErrors.js +0 -42
- package/dist/devbox/commands/init/retryableErrors.js.map +0 -1
- package/dist/devbox/commands/init/scanProgress.d.ts +0 -18
- package/dist/devbox/commands/init/scanProgress.d.ts.map +0 -1
- package/dist/devbox/commands/init/scanProgress.js +0 -47
- package/dist/devbox/commands/init/scanProgress.js.map +0 -1
- package/dist/devbox/commands/init/session.d.ts +0 -72
- package/dist/devbox/commands/init/session.d.ts.map +0 -1
- package/dist/devbox/commands/init/session.js +0 -348
- package/dist/devbox/commands/init/session.js.map +0 -1
- package/dist/devbox/commands/init/setupArtifactsValidation.d.ts +0 -28
- package/dist/devbox/commands/init/setupArtifactsValidation.d.ts.map +0 -1
- package/dist/devbox/commands/init/setupArtifactsValidation.js +0 -113
- package/dist/devbox/commands/init/setupArtifactsValidation.js.map +0 -1
- package/dist/devbox/commands/init/setupPlanFlow.d.ts +0 -34
- package/dist/devbox/commands/init/setupPlanFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/setupPlanFlow.js +0 -967
- package/dist/devbox/commands/init/setupPlanFlow.js.map +0 -1
- package/dist/devbox/commands/init/ssh.d.ts +0 -19
- package/dist/devbox/commands/init/ssh.d.ts.map +0 -1
- package/dist/devbox/commands/init/ssh.js +0 -276
- package/dist/devbox/commands/init/ssh.js.map +0 -1
- package/dist/devbox/commands/init/state.d.ts +0 -73
- package/dist/devbox/commands/init/state.d.ts.map +0 -1
- package/dist/devbox/commands/init/state.js +0 -118
- package/dist/devbox/commands/init/state.js.map +0 -1
- package/dist/devbox/commands/init/statusFlow.d.ts +0 -27
- package/dist/devbox/commands/init/statusFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/statusFlow.js +0 -160
- package/dist/devbox/commands/init/statusFlow.js.map +0 -1
- package/dist/devbox/commands/list.d.ts +0 -35
- package/dist/devbox/commands/list.d.ts.map +0 -1
- package/dist/devbox/commands/list.js +0 -311
- package/dist/devbox/commands/list.js.map +0 -1
- package/dist/devbox/commands/listFormatting.d.ts +0 -27
- package/dist/devbox/commands/listFormatting.d.ts.map +0 -1
- package/dist/devbox/commands/listFormatting.js +0 -155
- package/dist/devbox/commands/listFormatting.js.map +0 -1
- package/dist/devbox/commands/logout.d.ts +0 -2
- package/dist/devbox/commands/logout.d.ts.map +0 -1
- package/dist/devbox/commands/logout.js +0 -64
- package/dist/devbox/commands/logout.js.map +0 -1
- package/dist/devbox/commands/managedProviderClient.d.ts +0 -24
- package/dist/devbox/commands/managedProviderClient.d.ts.map +0 -1
- package/dist/devbox/commands/managedProviderClient.js +0 -42
- package/dist/devbox/commands/managedProviderClient.js.map +0 -1
- package/dist/devbox/commands/managedProviderContext.d.ts +0 -34
- package/dist/devbox/commands/managedProviderContext.d.ts.map +0 -1
- package/dist/devbox/commands/managedProviderContext.js +0 -34
- package/dist/devbox/commands/managedProviderContext.js.map +0 -1
- package/dist/devbox/commands/mount.d.ts +0 -25
- package/dist/devbox/commands/mount.d.ts.map +0 -1
- package/dist/devbox/commands/mount.js +0 -200
- package/dist/devbox/commands/mount.js.map +0 -1
- package/dist/devbox/commands/ports.d.ts +0 -11
- package/dist/devbox/commands/ports.d.ts.map +0 -1
- package/dist/devbox/commands/ports.js +0 -183
- package/dist/devbox/commands/ports.js.map +0 -1
- package/dist/devbox/commands/power.d.ts +0 -10
- package/dist/devbox/commands/power.d.ts.map +0 -1
- package/dist/devbox/commands/power.js +0 -139
- package/dist/devbox/commands/power.js.map +0 -1
- package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts +0 -25
- package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts.map +0 -1
- package/dist/devbox/commands/provider/daemonRuntimeShared.js +0 -217
- package/dist/devbox/commands/provider/daemonRuntimeShared.js.map +0 -1
- package/dist/devbox/commands/provider/directDaemonRuntime.d.ts +0 -106
- package/dist/devbox/commands/provider/directDaemonRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/provider/directDaemonRuntime.js +0 -1442
- package/dist/devbox/commands/provider/directDaemonRuntime.js.map +0 -1
- package/dist/devbox/commands/provider/e2bCommandContext.d.ts +0 -11
- package/dist/devbox/commands/provider/e2bCommandContext.d.ts.map +0 -1
- package/dist/devbox/commands/provider/e2bCommandContext.js +0 -16
- package/dist/devbox/commands/provider/e2bCommandContext.js.map +0 -1
- package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts +0 -20
- package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts.map +0 -1
- package/dist/devbox/commands/provider/e2bLifecycleShared.js +0 -42
- package/dist/devbox/commands/provider/e2bLifecycleShared.js.map +0 -1
- package/dist/devbox/commands/provider/modalCommandContext.d.ts +0 -22
- package/dist/devbox/commands/provider/modalCommandContext.d.ts.map +0 -1
- package/dist/devbox/commands/provider/modalCommandContext.js +0 -47
- package/dist/devbox/commands/provider/modalCommandContext.js.map +0 -1
- package/dist/devbox/commands/provider/modalLifecycle.d.ts +0 -158
- package/dist/devbox/commands/provider/modalLifecycle.d.ts.map +0 -1
- package/dist/devbox/commands/provider/modalLifecycle.js +0 -702
- package/dist/devbox/commands/provider/modalLifecycle.js.map +0 -1
- package/dist/devbox/commands/provider/modalRuntime.d.ts +0 -25
- package/dist/devbox/commands/provider/modalRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/provider/modalRuntime.js +0 -791
- package/dist/devbox/commands/provider/modalRuntime.js.map +0 -1
- package/dist/devbox/commands/provider/runtimeTypes.d.ts +0 -8
- package/dist/devbox/commands/provider/runtimeTypes.d.ts.map +0 -1
- package/dist/devbox/commands/provider/runtimeTypes.js +0 -2
- package/dist/devbox/commands/provider/runtimeTypes.js.map +0 -1
- package/dist/devbox/commands/providerClient.d.ts +0 -82
- package/dist/devbox/commands/providerClient.d.ts.map +0 -1
- package/dist/devbox/commands/providerClient.js +0 -719
- package/dist/devbox/commands/providerClient.js.map +0 -1
- package/dist/devbox/commands/reboot.d.ts +0 -8
- package/dist/devbox/commands/reboot.d.ts.map +0 -1
- package/dist/devbox/commands/reboot.js +0 -100
- package/dist/devbox/commands/reboot.js.map +0 -1
- package/dist/devbox/commands/reset.d.ts +0 -30
- package/dist/devbox/commands/reset.d.ts.map +0 -1
- package/dist/devbox/commands/reset.js +0 -114
- package/dist/devbox/commands/reset.js.map +0 -1
- package/dist/devbox/commands/runtimeClient.d.ts +0 -65
- package/dist/devbox/commands/runtimeClient.d.ts.map +0 -1
- package/dist/devbox/commands/runtimeClient.js +0 -127
- package/dist/devbox/commands/runtimeClient.js.map +0 -1
- package/dist/devbox/commands/sentryTest.d.ts +0 -2
- package/dist/devbox/commands/sentryTest.d.ts.map +0 -1
- package/dist/devbox/commands/sentryTest.js +0 -117
- package/dist/devbox/commands/sentryTest.js.map +0 -1
- package/dist/devbox/commands/services.d.ts +0 -2
- package/dist/devbox/commands/services.d.ts.map +0 -1
- package/dist/devbox/commands/services.js +0 -619
- package/dist/devbox/commands/services.js.map +0 -1
- package/dist/devbox/commands/servicesConfig.d.ts +0 -19
- package/dist/devbox/commands/servicesConfig.d.ts.map +0 -1
- package/dist/devbox/commands/servicesConfig.js +0 -61
- package/dist/devbox/commands/servicesConfig.js.map +0 -1
- package/dist/devbox/commands/servicesToml.d.ts +0 -13
- package/dist/devbox/commands/servicesToml.d.ts.map +0 -1
- package/dist/devbox/commands/servicesToml.js +0 -201
- package/dist/devbox/commands/servicesToml.js.map +0 -1
- package/dist/devbox/commands/sessionUtils.d.ts +0 -10
- package/dist/devbox/commands/sessionUtils.d.ts.map +0 -1
- package/dist/devbox/commands/sessionUtils.js +0 -48
- package/dist/devbox/commands/sessionUtils.js.map +0 -1
- package/dist/devbox/commands/sessions.d.ts +0 -3
- package/dist/devbox/commands/sessions.d.ts.map +0 -1
- package/dist/devbox/commands/sessions.js +0 -490
- package/dist/devbox/commands/sessions.js.map +0 -1
- package/dist/devbox/commands/setup.d.ts +0 -36
- package/dist/devbox/commands/setup.d.ts.map +0 -1
- package/dist/devbox/commands/setup.js +0 -816
- package/dist/devbox/commands/setup.js.map +0 -1
- package/dist/devbox/commands/setupClaude.d.ts +0 -51
- package/dist/devbox/commands/setupClaude.d.ts.map +0 -1
- package/dist/devbox/commands/setupClaude.js +0 -202
- package/dist/devbox/commands/setupClaude.js.map +0 -1
- package/dist/devbox/commands/setupTooling.d.ts +0 -56
- package/dist/devbox/commands/setupTooling.d.ts.map +0 -1
- package/dist/devbox/commands/setupTooling.js +0 -187
- package/dist/devbox/commands/setupTooling.js.map +0 -1
- package/dist/devbox/commands/sshAccess.d.ts +0 -31
- package/dist/devbox/commands/sshAccess.d.ts.map +0 -1
- package/dist/devbox/commands/sshAccess.js +0 -353
- package/dist/devbox/commands/sshAccess.js.map +0 -1
- package/dist/devbox/commands/sshConfig.d.ts +0 -23
- package/dist/devbox/commands/sshConfig.d.ts.map +0 -1
- package/dist/devbox/commands/sshConfig.js +0 -366
- package/dist/devbox/commands/sshConfig.js.map +0 -1
- package/dist/devbox/commands/sshProxy.d.ts +0 -2
- package/dist/devbox/commands/sshProxy.d.ts.map +0 -1
- package/dist/devbox/commands/sshProxy.js +0 -215
- package/dist/devbox/commands/sshProxy.js.map +0 -1
- package/dist/devbox/commands/uninstall.d.ts +0 -2
- package/dist/devbox/commands/uninstall.d.ts.map +0 -1
- package/dist/devbox/commands/uninstall.js +0 -365
- package/dist/devbox/commands/uninstall.js.map +0 -1
- package/dist/devbox/commands/upgrade.d.ts +0 -14
- package/dist/devbox/commands/upgrade.d.ts.map +0 -1
- package/dist/devbox/commands/upgrade.js +0 -60
- package/dist/devbox/commands/upgrade.js.map +0 -1
- package/dist/devbox/commands/version.d.ts +0 -8
- package/dist/devbox/commands/version.d.ts.map +0 -1
- package/dist/devbox/commands/version.js +0 -134
- package/dist/devbox/commands/version.js.map +0 -1
- package/dist/devbox/commands/whoami.d.ts +0 -2
- package/dist/devbox/commands/whoami.d.ts.map +0 -1
- package/dist/devbox/commands/whoami.js +0 -114
- package/dist/devbox/commands/whoami.js.map +0 -1
- package/dist/devbox/completions/cache.d.ts +0 -53
- package/dist/devbox/completions/cache.d.ts.map +0 -1
- package/dist/devbox/completions/cache.js +0 -227
- package/dist/devbox/completions/cache.js.map +0 -1
- package/dist/devbox/completions/index.d.ts +0 -18
- package/dist/devbox/completions/index.d.ts.map +0 -1
- package/dist/devbox/completions/index.js +0 -759
- package/dist/devbox/completions/index.js.map +0 -1
- package/dist/devbox/controlPlane.d.ts +0 -460
- package/dist/devbox/controlPlane.d.ts.map +0 -1
- package/dist/devbox/controlPlane.js +0 -1910
- package/dist/devbox/controlPlane.js.map +0 -1
- package/dist/devbox/daemonClient.d.ts +0 -44
- package/dist/devbox/daemonClient.d.ts.map +0 -1
- package/dist/devbox/daemonClient.js +0 -677
- package/dist/devbox/daemonClient.js.map +0 -1
- package/dist/devbox/e2bExecErrors.d.ts +0 -11
- package/dist/devbox/e2bExecErrors.d.ts.map +0 -1
- package/dist/devbox/e2bExecErrors.js +0 -19
- package/dist/devbox/e2bExecErrors.js.map +0 -1
- package/dist/devbox/latency.d.ts +0 -25
- package/dist/devbox/latency.d.ts.map +0 -1
- package/dist/devbox/latency.js +0 -186
- package/dist/devbox/latency.js.map +0 -1
- package/dist/devbox/logger.d.ts +0 -2
- package/dist/devbox/logger.d.ts.map +0 -1
- package/dist/devbox/logger.js +0 -3
- package/dist/devbox/logger.js.map +0 -1
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts +0 -11
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts.map +0 -1
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js +0 -118
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js.map +0 -1
- package/dist/devbox/terminal/osc.d.ts +0 -11
- package/dist/devbox/terminal/osc.d.ts.map +0 -1
- package/dist/devbox/terminal/osc.js +0 -84
- package/dist/devbox/terminal/osc.js.map +0 -1
- package/dist/devbox/terminal/sessionProtocol.d.ts +0 -46
- package/dist/devbox/terminal/sessionProtocol.d.ts.map +0 -1
- package/dist/devbox/terminal/sessionProtocol.js +0 -631
- package/dist/devbox/terminal/sessionProtocol.js.map +0 -1
- package/dist/devbox/ui/colors.d.ts +0 -19
- package/dist/devbox/ui/colors.d.ts.map +0 -1
- package/dist/devbox/ui/colors.js +0 -22
- package/dist/devbox/ui/colors.js.map +0 -1
- package/dist/devbox/ui/copyableUrl.d.ts +0 -4
- package/dist/devbox/ui/copyableUrl.d.ts.map +0 -1
- package/dist/devbox/ui/copyableUrl.js +0 -10
- package/dist/devbox/ui/copyableUrl.js.map +0 -1
- package/dist/devbox/ui/qr.d.ts +0 -3
- package/dist/devbox/ui/qr.d.ts.map +0 -1
- package/dist/devbox/ui/qr.js +0 -17
- package/dist/devbox/ui/qr.js.map +0 -1
- package/dist/devbox/ui/statusLine.d.ts +0 -14
- package/dist/devbox/ui/statusLine.d.ts.map +0 -1
- package/dist/devbox/ui/statusLine.js +0 -92
- package/dist/devbox/ui/statusLine.js.map +0 -1
- package/dist/devbox/updateNotice.d.ts +0 -2
- package/dist/devbox/updateNotice.d.ts.map +0 -1
- package/dist/devbox/updateNotice.js +0 -43
- package/dist/devbox/updateNotice.js.map +0 -1
|
@@ -1,759 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import readline from "node:readline/promises";
|
|
5
|
-
import { addDevboxClientVersionHeader, createSecretStore, loadConfig, loadRegistry, resolveRelayBaseUrl, resolveSocketInfo, } from "@boxes-dev/core";
|
|
6
|
-
import { mergeSessionEntries, resolveCompletionsDir, saveCompletionCache, loadCompletionCache, updateCompletionCacheSessionsFromMap, updateCompletionCacheSessionsFromViews, } from "./cache.js";
|
|
7
|
-
import { DAEMON_TIMEOUT_MS, ensureDaemonUpToDateIfRunning, requestJson, } from "../daemonClient.js";
|
|
8
|
-
import { parseCommandArgs, readStringFlag } from "../commandRegistry/args.js";
|
|
9
|
-
import { usageError } from "../commandRegistry/errors.js";
|
|
10
|
-
import { createCompletionRoot, } from "../commandRegistry/tab.js";
|
|
11
|
-
const SESSION_TTL_MS = 30_000;
|
|
12
|
-
const REMOTE_ATTEMPT_INTERVAL_MS = 30_000;
|
|
13
|
-
const REMOTE_TIMEOUT_MS = 500;
|
|
14
|
-
const PRIME_SESSION_LIMIT = 5;
|
|
15
|
-
const ALIAS_TTL_MS = 60_000;
|
|
16
|
-
const ALIAS_ATTEMPT_INTERVAL_MS = 30_000;
|
|
17
|
-
const ALIAS_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
18
|
-
const RESERVED_ALIAS_PATTERN = /^dvb-[a-f0-9]{12}-/;
|
|
19
|
-
const resolveCliName = () => {
|
|
20
|
-
const raw = process.env.DEVBOX_CLI_NAME?.trim();
|
|
21
|
-
if (!raw)
|
|
22
|
-
return "dvb";
|
|
23
|
-
// Limit to a safe filename / shell marker subset.
|
|
24
|
-
const normalized = raw.replace(/[^A-Za-z0-9_-]+/g, "").slice(0, 32);
|
|
25
|
-
return normalized.length > 0 ? normalized : "dvb";
|
|
26
|
-
};
|
|
27
|
-
const rcMarkers = (cliName) => ({
|
|
28
|
-
begin: `# >>> ${cliName} completions >>>`,
|
|
29
|
-
end: `# <<< ${cliName} completions <<<`,
|
|
30
|
-
});
|
|
31
|
-
const SUPPORTED_SHELLS = ["bash", "zsh", "fish"];
|
|
32
|
-
const normalizeShell = (value) => {
|
|
33
|
-
if (!value)
|
|
34
|
-
return null;
|
|
35
|
-
const trimmed = value.trim();
|
|
36
|
-
if (!trimmed)
|
|
37
|
-
return null;
|
|
38
|
-
const base = path.basename(trimmed);
|
|
39
|
-
const lower = base.toLowerCase();
|
|
40
|
-
if (lower === "bash" || lower === "zsh" || lower === "fish") {
|
|
41
|
-
return lower;
|
|
42
|
-
}
|
|
43
|
-
return null;
|
|
44
|
-
};
|
|
45
|
-
const resolveShellFromEnv = () => normalizeShell(process.env.SHELL);
|
|
46
|
-
const nowIso = () => new Date().toISOString();
|
|
47
|
-
const normalizeAlias = (value) => value.trim().toLowerCase();
|
|
48
|
-
const isValidAlias = (value) => {
|
|
49
|
-
const normalized = normalizeAlias(value);
|
|
50
|
-
if (!normalized)
|
|
51
|
-
return false;
|
|
52
|
-
if (RESERVED_ALIAS_PATTERN.test(normalized))
|
|
53
|
-
return false;
|
|
54
|
-
return ALIAS_PATTERN.test(normalized);
|
|
55
|
-
};
|
|
56
|
-
const dedupeAliases = (values) => {
|
|
57
|
-
const seen = new Set();
|
|
58
|
-
for (const raw of values) {
|
|
59
|
-
const alias = normalizeAlias(raw);
|
|
60
|
-
if (!isValidAlias(alias))
|
|
61
|
-
continue;
|
|
62
|
-
seen.add(alias);
|
|
63
|
-
}
|
|
64
|
-
return [...seen];
|
|
65
|
-
};
|
|
66
|
-
const sameAliasSet = (left, right) => {
|
|
67
|
-
if (left.length !== right.length)
|
|
68
|
-
return false;
|
|
69
|
-
const leftSet = new Set(left);
|
|
70
|
-
if (leftSet.size !== right.length)
|
|
71
|
-
return false;
|
|
72
|
-
for (const alias of right) {
|
|
73
|
-
if (!leftSet.has(alias))
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
};
|
|
78
|
-
const isStale = (timestamp, ttlMs) => {
|
|
79
|
-
if (!timestamp)
|
|
80
|
-
return true;
|
|
81
|
-
const parsed = Date.parse(timestamp);
|
|
82
|
-
if (!Number.isFinite(parsed))
|
|
83
|
-
return true;
|
|
84
|
-
return Date.now() - parsed > ttlMs;
|
|
85
|
-
};
|
|
86
|
-
const readTextFile = async (filePath) => {
|
|
87
|
-
try {
|
|
88
|
-
return await fs.readFile(filePath, "utf8");
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const writeTextFile = async (filePath, contents) => {
|
|
95
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true, mode: 0o700 });
|
|
96
|
-
await fs.writeFile(filePath, contents, { mode: 0o600 });
|
|
97
|
-
};
|
|
98
|
-
const captureConsole = (fn) => {
|
|
99
|
-
const lines = [];
|
|
100
|
-
const original = console.log;
|
|
101
|
-
console.log = (...args) => {
|
|
102
|
-
lines.push(args.map((arg) => String(arg)).join(" "));
|
|
103
|
-
};
|
|
104
|
-
try {
|
|
105
|
-
fn();
|
|
106
|
-
}
|
|
107
|
-
finally {
|
|
108
|
-
console.log = original;
|
|
109
|
-
}
|
|
110
|
-
return lines.join("\n");
|
|
111
|
-
};
|
|
112
|
-
const parseCompletionContext = (words) => {
|
|
113
|
-
const cleaned = words[0] === "--" ? words.slice(1) : words;
|
|
114
|
-
if (cleaned.length === 0)
|
|
115
|
-
return { token: "" };
|
|
116
|
-
const hasTrailingEmpty = cleaned[cleaned.length - 1] === "";
|
|
117
|
-
const token = hasTrailingEmpty ? "" : (cleaned[cleaned.length - 1] ?? "");
|
|
118
|
-
const tokens = hasTrailingEmpty ? cleaned.slice(0, -1) : cleaned.slice(0, -1);
|
|
119
|
-
const command = tokens[0];
|
|
120
|
-
const subcommand = command === "sessions" ? tokens[1] : undefined;
|
|
121
|
-
const context = { token };
|
|
122
|
-
if (command)
|
|
123
|
-
context.command = command;
|
|
124
|
-
if (subcommand)
|
|
125
|
-
context.subcommand = subcommand;
|
|
126
|
-
return context;
|
|
127
|
-
};
|
|
128
|
-
const listAliasesFromRegistry = async () => {
|
|
129
|
-
// Use local registry alias keys only for box-name hints. Canonical values are
|
|
130
|
-
// intentionally ignored and never written into completion cache.
|
|
131
|
-
const homeDir = process.env.HOME ? { homeDir: process.env.HOME } : undefined;
|
|
132
|
-
try {
|
|
133
|
-
const registry = await loadRegistry(homeDir);
|
|
134
|
-
return dedupeAliases(Object.keys(registry.aliases ?? {}));
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
return [];
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
const createRelayAuth = async () => {
|
|
141
|
-
const homeDir = process.env.HOME ? { homeDir: process.env.HOME } : undefined;
|
|
142
|
-
const config = await loadConfig(homeDir);
|
|
143
|
-
const store = await createSecretStore(config?.tokenStore, process.env.HOME ? { homeDir: process.env.HOME } : undefined);
|
|
144
|
-
const token = await store.getControlPlaneToken();
|
|
145
|
-
if (!token)
|
|
146
|
-
return null;
|
|
147
|
-
return { token, relayBaseUrl: resolveRelayBaseUrl(config) };
|
|
148
|
-
};
|
|
149
|
-
const fetchWithTimeout = async (url, token, timeoutMs) => {
|
|
150
|
-
const controller = new AbortController();
|
|
151
|
-
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
152
|
-
try {
|
|
153
|
-
const headers = {
|
|
154
|
-
authorization: `Bearer ${token}`,
|
|
155
|
-
};
|
|
156
|
-
addDevboxClientVersionHeader(headers);
|
|
157
|
-
const response = await fetch(url, {
|
|
158
|
-
signal: controller.signal,
|
|
159
|
-
headers,
|
|
160
|
-
});
|
|
161
|
-
const body = await response.text();
|
|
162
|
-
return { status: response.status, body };
|
|
163
|
-
}
|
|
164
|
-
catch {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
finally {
|
|
168
|
-
clearTimeout(timeout);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
export const resolveRemoteSessionMapPath = (computeProvider) => {
|
|
172
|
-
switch (computeProvider) {
|
|
173
|
-
case "modal":
|
|
174
|
-
return "/root/.devbox/sessions.json";
|
|
175
|
-
case "e2b":
|
|
176
|
-
return "/home/boxes/.devbox/sessions.json";
|
|
177
|
-
case "sprites":
|
|
178
|
-
default:
|
|
179
|
-
return "/home/sprite/.devbox/sessions.json";
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
const fetchRemoteSessionMap = async (relayBaseUrl, token, box, computeProvider) => {
|
|
183
|
-
const url = new URL(`/v1/sprites/${encodeURIComponent(box)}/fs/read`, relayBaseUrl);
|
|
184
|
-
url.searchParams.set("path", resolveRemoteSessionMapPath(computeProvider));
|
|
185
|
-
const result = await fetchWithTimeout(url, token, REMOTE_TIMEOUT_MS);
|
|
186
|
-
if (!result)
|
|
187
|
-
return null;
|
|
188
|
-
if (result.status === 404)
|
|
189
|
-
return {};
|
|
190
|
-
if (result.status !== 200 || !result.body)
|
|
191
|
-
return null;
|
|
192
|
-
try {
|
|
193
|
-
const parsed = JSON.parse(result.body);
|
|
194
|
-
const mapped = {};
|
|
195
|
-
for (const [key, value] of Object.entries(parsed ?? {})) {
|
|
196
|
-
if (typeof value === "string")
|
|
197
|
-
mapped[key] = value;
|
|
198
|
-
}
|
|
199
|
-
return mapped;
|
|
200
|
-
}
|
|
201
|
-
catch {
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
const shouldAttemptRemote = (updatedAt, lastAttemptAt, ttlMs, attemptIntervalMs = REMOTE_ATTEMPT_INTERVAL_MS) => isStale(updatedAt, ttlMs) && isStale(lastAttemptAt, attemptIntervalMs);
|
|
206
|
-
const refreshAliasesFromDaemonIfNeeded = async (cache) => {
|
|
207
|
-
if (!shouldAttemptRemote(cache.boxes?.updatedAt, cache.boxes?.lastAttemptAt, ALIAS_TTL_MS, ALIAS_ATTEMPT_INTERVAL_MS)) {
|
|
208
|
-
return {
|
|
209
|
-
cache,
|
|
210
|
-
changed: false,
|
|
211
|
-
aliases: cache.boxes?.remote ?? [],
|
|
212
|
-
providerByAlias: {},
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
const attemptAt = nowIso();
|
|
216
|
-
cache.boxes = {
|
|
217
|
-
...(cache.boxes ?? {}),
|
|
218
|
-
lastAttemptAt: attemptAt,
|
|
219
|
-
};
|
|
220
|
-
try {
|
|
221
|
-
const socketInfo = resolveSocketInfo();
|
|
222
|
-
await ensureDaemonUpToDateIfRunning(socketInfo.socketPath);
|
|
223
|
-
const response = await requestJson(socketInfo.socketPath, "GET", "/boxes", DAEMON_TIMEOUT_MS.quick);
|
|
224
|
-
if (response.status !== 200) {
|
|
225
|
-
return {
|
|
226
|
-
cache,
|
|
227
|
-
changed: true,
|
|
228
|
-
aliases: cache.boxes?.remote ?? [],
|
|
229
|
-
providerByAlias: {},
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
if (!Array.isArray(response.body.boxes)) {
|
|
233
|
-
return {
|
|
234
|
-
cache,
|
|
235
|
-
changed: true,
|
|
236
|
-
aliases: cache.boxes?.remote ?? [],
|
|
237
|
-
providerByAlias: {},
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
const providerByAlias = {};
|
|
241
|
-
for (const box of response.body.boxes) {
|
|
242
|
-
const alias = typeof box.alias === "string" ? normalizeAlias(box.alias) : "";
|
|
243
|
-
if (!isValidAlias(alias))
|
|
244
|
-
continue;
|
|
245
|
-
if (box.computeProvider === "sprites" ||
|
|
246
|
-
box.computeProvider === "modal") {
|
|
247
|
-
providerByAlias[alias] = box.computeProvider;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
const aliases = dedupeAliases(response.body.boxes
|
|
251
|
-
.map((box) => (typeof box.alias === "string" ? box.alias : ""))
|
|
252
|
-
.filter((alias) => alias.length > 0));
|
|
253
|
-
cache.boxes = {
|
|
254
|
-
...(cache.boxes ?? {}),
|
|
255
|
-
remote: aliases,
|
|
256
|
-
updatedAt: nowIso(),
|
|
257
|
-
lastAttemptAt: attemptAt,
|
|
258
|
-
};
|
|
259
|
-
return { cache, changed: true, aliases, providerByAlias };
|
|
260
|
-
}
|
|
261
|
-
catch {
|
|
262
|
-
return {
|
|
263
|
-
cache,
|
|
264
|
-
changed: true,
|
|
265
|
-
aliases: cache.boxes?.remote ?? [],
|
|
266
|
-
providerByAlias: {},
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
const refreshRemoteSessionsIfNeeded = async (cache, spriteAlias, computeProvider) => {
|
|
271
|
-
const alias = normalizeAlias(spriteAlias);
|
|
272
|
-
if (!isValidAlias(alias)) {
|
|
273
|
-
return { cache, changed: false };
|
|
274
|
-
}
|
|
275
|
-
const existing = cache.sessions?.[alias];
|
|
276
|
-
if (!shouldAttemptRemote(existing?.updatedAt, existing?.lastAttemptAt, SESSION_TTL_MS)) {
|
|
277
|
-
return { cache, changed: false };
|
|
278
|
-
}
|
|
279
|
-
const auth = await createRelayAuth();
|
|
280
|
-
const attemptAt = nowIso();
|
|
281
|
-
cache.sessions = {
|
|
282
|
-
...cache.sessions,
|
|
283
|
-
[alias]: {
|
|
284
|
-
...existing,
|
|
285
|
-
entries: existing?.entries ?? [],
|
|
286
|
-
lastAttemptAt: attemptAt,
|
|
287
|
-
},
|
|
288
|
-
};
|
|
289
|
-
if (!auth)
|
|
290
|
-
return { cache, changed: true };
|
|
291
|
-
const remote = await fetchRemoteSessionMap(auth.relayBaseUrl, auth.token, alias, computeProvider);
|
|
292
|
-
if (!remote)
|
|
293
|
-
return { cache, changed: true };
|
|
294
|
-
const entries = Object.entries(remote).map(([name, id]) => ({ name, id }));
|
|
295
|
-
const merged = mergeSessionEntries(existing?.entries ?? [], entries);
|
|
296
|
-
cache.sessions[alias] = {
|
|
297
|
-
entries: merged,
|
|
298
|
-
updatedAt: nowIso(),
|
|
299
|
-
lastAttemptAt: attemptAt,
|
|
300
|
-
};
|
|
301
|
-
return { cache, changed: true };
|
|
302
|
-
};
|
|
303
|
-
const primeCompletionCache = async () => {
|
|
304
|
-
const homeDir = process.env.HOME ? { homeDir: process.env.HOME } : undefined;
|
|
305
|
-
const localAliases = await listAliasesFromRegistry();
|
|
306
|
-
let cache = await loadCompletionCache(homeDir);
|
|
307
|
-
let cacheDirty = false;
|
|
308
|
-
const aliasRefresh = await refreshAliasesFromDaemonIfNeeded(cache);
|
|
309
|
-
cache = aliasRefresh.cache;
|
|
310
|
-
cacheDirty = cacheDirty || aliasRefresh.changed;
|
|
311
|
-
const attemptAt = nowIso();
|
|
312
|
-
const mergedAliases = dedupeAliases([
|
|
313
|
-
...localAliases,
|
|
314
|
-
...aliasRefresh.aliases,
|
|
315
|
-
...(cache.boxes?.remote ?? []),
|
|
316
|
-
]);
|
|
317
|
-
const existingAliases = cache.boxes?.remote ?? [];
|
|
318
|
-
const aliasChanged = !sameAliasSet(mergedAliases, existingAliases);
|
|
319
|
-
if (aliasChanged) {
|
|
320
|
-
cache.boxes = {
|
|
321
|
-
...(cache.boxes ?? {}),
|
|
322
|
-
remote: mergedAliases,
|
|
323
|
-
updatedAt: attemptAt,
|
|
324
|
-
lastAttemptAt: attemptAt,
|
|
325
|
-
};
|
|
326
|
-
cacheDirty = true;
|
|
327
|
-
}
|
|
328
|
-
const auth = await createRelayAuth();
|
|
329
|
-
if (auth) {
|
|
330
|
-
const targets = mergedAliases.slice(0, PRIME_SESSION_LIMIT);
|
|
331
|
-
for (const alias of targets) {
|
|
332
|
-
const remote = await fetchRemoteSessionMap(auth.relayBaseUrl, auth.token, alias, aliasRefresh.providerByAlias[alias]);
|
|
333
|
-
if (!remote) {
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
const entries = Object.entries(remote).map(([name, id]) => ({
|
|
337
|
-
name,
|
|
338
|
-
id,
|
|
339
|
-
}));
|
|
340
|
-
cache.sessions = {
|
|
341
|
-
...cache.sessions,
|
|
342
|
-
[alias]: {
|
|
343
|
-
entries,
|
|
344
|
-
updatedAt: attemptAt,
|
|
345
|
-
lastAttemptAt: attemptAt,
|
|
346
|
-
},
|
|
347
|
-
};
|
|
348
|
-
cacheDirty = true;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (cacheDirty) {
|
|
352
|
-
await saveCompletionCache(cache, homeDir);
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
const loadCompletionData = async (words) => {
|
|
356
|
-
const homeDir = process.env.HOME ? { homeDir: process.env.HOME } : undefined;
|
|
357
|
-
const localAliases = await listAliasesFromRegistry();
|
|
358
|
-
let cache = await loadCompletionCache(homeDir);
|
|
359
|
-
let cacheDirty = false;
|
|
360
|
-
const aliasRefresh = await refreshAliasesFromDaemonIfNeeded(cache);
|
|
361
|
-
cache = aliasRefresh.cache;
|
|
362
|
-
cacheDirty = cacheDirty || aliasRefresh.changed;
|
|
363
|
-
const boxes = new Set(dedupeAliases([...localAliases, ...aliasRefresh.aliases]));
|
|
364
|
-
const context = parseCompletionContext(words);
|
|
365
|
-
if ((context.command === "connect" ||
|
|
366
|
-
(context.command === "sessions" &&
|
|
367
|
-
(context.subcommand === "rename" || context.subcommand === "kill"))) &&
|
|
368
|
-
context.token.includes("/")) {
|
|
369
|
-
const boxPart = normalizeAlias(context.token.split("/", 1)[0] ?? "");
|
|
370
|
-
if (boxes.has(boxPart)) {
|
|
371
|
-
const provider = aliasRefresh.providerByAlias[boxPart];
|
|
372
|
-
const result = await refreshRemoteSessionsIfNeeded(cache, boxPart, provider);
|
|
373
|
-
cache = result.cache;
|
|
374
|
-
cacheDirty = cacheDirty || result.changed;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
if (cacheDirty) {
|
|
378
|
-
await saveCompletionCache(cache, homeDir);
|
|
379
|
-
}
|
|
380
|
-
const boxSessionNames = new Set();
|
|
381
|
-
const boxSessionRefs = new Set();
|
|
382
|
-
const sessionRefs = new Set();
|
|
383
|
-
for (const [alias, sessionData] of Object.entries(cache.sessions ?? {})) {
|
|
384
|
-
if (!boxes.has(alias))
|
|
385
|
-
continue;
|
|
386
|
-
const entries = sessionData.entries ?? [];
|
|
387
|
-
for (const entry of entries) {
|
|
388
|
-
if (entry.name) {
|
|
389
|
-
boxSessionNames.add(`${alias}/${entry.name}`);
|
|
390
|
-
boxSessionRefs.add(`${alias}/${entry.name}`);
|
|
391
|
-
sessionRefs.add(entry.name);
|
|
392
|
-
}
|
|
393
|
-
if (entry.id) {
|
|
394
|
-
boxSessionRefs.add(`${alias}/${entry.id}`);
|
|
395
|
-
sessionRefs.add(entry.id);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return {
|
|
400
|
-
boxes: [...boxes].sort(),
|
|
401
|
-
boxSessionNames: [...boxSessionNames].sort(),
|
|
402
|
-
boxSessionRefs: [...boxSessionRefs].sort(),
|
|
403
|
-
sessionRefs: [...sessionRefs].sort(),
|
|
404
|
-
};
|
|
405
|
-
};
|
|
406
|
-
const resolveShellPaths = (shell) => {
|
|
407
|
-
const cliName = resolveCliName();
|
|
408
|
-
const home = os.homedir();
|
|
409
|
-
if (shell === "fish") {
|
|
410
|
-
const configHome = process.env.XDG_CONFIG_HOME ?? path.join(home, ".config");
|
|
411
|
-
return {
|
|
412
|
-
scriptPath: path.join(configHome, "fish", "completions", `${cliName}.fish`),
|
|
413
|
-
rcPath: undefined,
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
const completionsDir = resolveCompletionsDir(home);
|
|
417
|
-
const scriptPath = shell === "zsh"
|
|
418
|
-
? path.join(completionsDir, `${cliName}.zsh`)
|
|
419
|
-
: path.join(completionsDir, `${cliName}.bash`);
|
|
420
|
-
const rcPath = shell === "zsh"
|
|
421
|
-
? path.join(process.env.ZDOTDIR ?? home, ".zshrc")
|
|
422
|
-
: path.join(home, ".bashrc");
|
|
423
|
-
return { scriptPath, rcPath };
|
|
424
|
-
};
|
|
425
|
-
const buildRcBlock = (scriptPath, markers) => [
|
|
426
|
-
markers.begin,
|
|
427
|
-
`if [ -f "${scriptPath}" ]; then`,
|
|
428
|
-
` source "${scriptPath}"`,
|
|
429
|
-
"fi",
|
|
430
|
-
markers.end,
|
|
431
|
-
].join("\n");
|
|
432
|
-
const updateRcFile = async (rcPath, block, markers) => {
|
|
433
|
-
const existing = (await readTextFile(rcPath)) ?? "";
|
|
434
|
-
if (existing.includes(markers.begin) && existing.includes(markers.end)) {
|
|
435
|
-
const updated = existing.replace(new RegExp(`${markers.begin}[\\s\\S]*?${markers.end}`, "m"), block);
|
|
436
|
-
await writeTextFile(rcPath, updated);
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
const suffix = existing.endsWith("\n") || existing.length === 0 ? "" : "\n";
|
|
440
|
-
await writeTextFile(rcPath, `${existing}${suffix}${block}\n`);
|
|
441
|
-
};
|
|
442
|
-
const removeRcBlock = async (rcPath, markers) => {
|
|
443
|
-
const existing = await readTextFile(rcPath);
|
|
444
|
-
if (!existing)
|
|
445
|
-
return;
|
|
446
|
-
if (!existing.includes(markers.begin) || !existing.includes(markers.end)) {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
const updated = existing.replace(new RegExp(`\\n?${markers.begin}[\\s\\S]*?${markers.end}\\n?`, "m"), "\n");
|
|
450
|
-
await writeTextFile(rcPath, updated.trimEnd() + "\n");
|
|
451
|
-
};
|
|
452
|
-
const generateCompletionScript = (shell) => {
|
|
453
|
-
const cliName = resolveCliName();
|
|
454
|
-
const root = createCompletionRoot({
|
|
455
|
-
boxes: [],
|
|
456
|
-
boxSessionNames: [],
|
|
457
|
-
boxSessionRefs: [],
|
|
458
|
-
sessionRefs: [],
|
|
459
|
-
});
|
|
460
|
-
return captureConsole(() => {
|
|
461
|
-
root.setup(cliName, cliName, shell);
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
|
-
const installCompletions = async (shell) => {
|
|
465
|
-
const cliName = resolveCliName();
|
|
466
|
-
const markers = rcMarkers(cliName);
|
|
467
|
-
const { scriptPath, rcPath } = resolveShellPaths(shell);
|
|
468
|
-
const script = generateCompletionScript(shell);
|
|
469
|
-
await writeTextFile(scriptPath, script);
|
|
470
|
-
if (rcPath) {
|
|
471
|
-
await updateRcFile(rcPath, buildRcBlock(scriptPath, markers), markers);
|
|
472
|
-
}
|
|
473
|
-
try {
|
|
474
|
-
await primeCompletionCache();
|
|
475
|
-
}
|
|
476
|
-
catch {
|
|
477
|
-
// ignore cache prime failures
|
|
478
|
-
}
|
|
479
|
-
const cache = await loadCompletionCache();
|
|
480
|
-
cache.install = {
|
|
481
|
-
shell,
|
|
482
|
-
scriptPath,
|
|
483
|
-
...(rcPath ? { rcPath } : {}),
|
|
484
|
-
installedAt: nowIso(),
|
|
485
|
-
updatedAt: nowIso(),
|
|
486
|
-
};
|
|
487
|
-
await saveCompletionCache(cache);
|
|
488
|
-
return { scriptPath, rcPath };
|
|
489
|
-
};
|
|
490
|
-
const uninstallCompletions = async (shell) => {
|
|
491
|
-
const cliName = resolveCliName();
|
|
492
|
-
const markers = rcMarkers(cliName);
|
|
493
|
-
const { scriptPath, rcPath } = resolveShellPaths(shell);
|
|
494
|
-
try {
|
|
495
|
-
await fs.unlink(scriptPath);
|
|
496
|
-
}
|
|
497
|
-
catch {
|
|
498
|
-
// ignore missing file
|
|
499
|
-
}
|
|
500
|
-
if (rcPath) {
|
|
501
|
-
await removeRcBlock(rcPath, markers);
|
|
502
|
-
}
|
|
503
|
-
const cache = await loadCompletionCache();
|
|
504
|
-
if (cache.install?.shell === shell) {
|
|
505
|
-
delete cache.install;
|
|
506
|
-
await saveCompletionCache(cache);
|
|
507
|
-
}
|
|
508
|
-
return { scriptPath, rcPath };
|
|
509
|
-
};
|
|
510
|
-
const detectStatusForShell = async (shell) => {
|
|
511
|
-
const cliName = resolveCliName();
|
|
512
|
-
const markers = rcMarkers(cliName);
|
|
513
|
-
const { scriptPath, rcPath } = resolveShellPaths(shell);
|
|
514
|
-
const scriptExists = Boolean(await readTextFile(scriptPath));
|
|
515
|
-
let rcConfigured = scriptExists;
|
|
516
|
-
if (rcPath) {
|
|
517
|
-
const rcContents = await readTextFile(rcPath);
|
|
518
|
-
rcConfigured = Boolean(rcContents?.includes(markers.begin) && rcContents?.includes(markers.end));
|
|
519
|
-
}
|
|
520
|
-
const status = {
|
|
521
|
-
shell,
|
|
522
|
-
scriptPath,
|
|
523
|
-
scriptExists,
|
|
524
|
-
rcConfigured,
|
|
525
|
-
};
|
|
526
|
-
if (rcPath)
|
|
527
|
-
status.rcPath = rcPath;
|
|
528
|
-
return status;
|
|
529
|
-
};
|
|
530
|
-
const resolveCompletionStatus = async () => {
|
|
531
|
-
const cache = await loadCompletionCache();
|
|
532
|
-
if (cache.install?.shell) {
|
|
533
|
-
return detectStatusForShell(cache.install.shell);
|
|
534
|
-
}
|
|
535
|
-
for (const shell of SUPPORTED_SHELLS) {
|
|
536
|
-
const status = await detectStatusForShell(shell);
|
|
537
|
-
if (status.scriptExists)
|
|
538
|
-
return status;
|
|
539
|
-
}
|
|
540
|
-
return { scriptExists: false, rcConfigured: false };
|
|
541
|
-
};
|
|
542
|
-
export const maybeAutoUpdateCompletions = async () => {
|
|
543
|
-
try {
|
|
544
|
-
const cache = await loadCompletionCache();
|
|
545
|
-
const install = cache.install;
|
|
546
|
-
if (!install)
|
|
547
|
-
return;
|
|
548
|
-
const script = await readTextFile(install.scriptPath);
|
|
549
|
-
if (!script)
|
|
550
|
-
return;
|
|
551
|
-
const desired = generateCompletionScript(install.shell);
|
|
552
|
-
if (script === desired)
|
|
553
|
-
return;
|
|
554
|
-
await writeTextFile(install.scriptPath, desired);
|
|
555
|
-
cache.install = {
|
|
556
|
-
...install,
|
|
557
|
-
updatedAt: nowIso(),
|
|
558
|
-
};
|
|
559
|
-
await saveCompletionCache(cache);
|
|
560
|
-
}
|
|
561
|
-
catch {
|
|
562
|
-
// ignore auto-update failures
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
const promptYesNo = async (label) => {
|
|
566
|
-
if (!process.stdin.isTTY)
|
|
567
|
-
return false;
|
|
568
|
-
const rl = readline.createInterface({
|
|
569
|
-
input: process.stdin,
|
|
570
|
-
output: process.stdout,
|
|
571
|
-
});
|
|
572
|
-
const answer = await rl.question(label);
|
|
573
|
-
rl.close();
|
|
574
|
-
return parsePromptYesNoAnswer(answer);
|
|
575
|
-
};
|
|
576
|
-
export const parsePromptYesNoAnswer = (answer, { defaultValue = true } = {}) => {
|
|
577
|
-
const normalized = answer.trim().toLowerCase();
|
|
578
|
-
if (normalized.length === 0)
|
|
579
|
-
return defaultValue;
|
|
580
|
-
return normalized === "y" || normalized === "yes";
|
|
581
|
-
};
|
|
582
|
-
export const maybeOfferCompletionsInstall = async () => {
|
|
583
|
-
if (!process.stdin.isTTY)
|
|
584
|
-
return;
|
|
585
|
-
const status = await resolveCompletionStatus();
|
|
586
|
-
if (status.scriptExists)
|
|
587
|
-
return;
|
|
588
|
-
const shell = resolveShellFromEnv();
|
|
589
|
-
if (!shell)
|
|
590
|
-
return;
|
|
591
|
-
const approved = await promptYesNo("Install shell completions? (Y/n): ");
|
|
592
|
-
if (!approved)
|
|
593
|
-
return;
|
|
594
|
-
try {
|
|
595
|
-
await installCompletions(shell);
|
|
596
|
-
console.log(`Shell completions installed for ${shell}.`);
|
|
597
|
-
}
|
|
598
|
-
catch (error) {
|
|
599
|
-
console.error(`Failed to install completions: ${error instanceof Error ? error.message : String(error)}`);
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
const usage = () => {
|
|
603
|
-
const cliName = resolveCliName();
|
|
604
|
-
console.log("Usage:");
|
|
605
|
-
console.log(` ${cliName} completions status`);
|
|
606
|
-
console.log(` ${cliName} completions install [--shell <bash|zsh|fish>]`);
|
|
607
|
-
console.log(` ${cliName} completions uninstall [--shell <bash|zsh|fish>]`);
|
|
608
|
-
console.log(` ${cliName} completions generate <bash|zsh|fish>`);
|
|
609
|
-
};
|
|
610
|
-
const parseCompletionsArgs = (args) => {
|
|
611
|
-
const parsed = {
|
|
612
|
-
subcommand: "status",
|
|
613
|
-
};
|
|
614
|
-
const hasSubcommand = Boolean(args[0] && !args[0].startsWith("-"));
|
|
615
|
-
if (hasSubcommand && args[0]) {
|
|
616
|
-
parsed.subcommand = args[0];
|
|
617
|
-
}
|
|
618
|
-
const commandPath = parsed.subcommand === "status" ||
|
|
619
|
-
parsed.subcommand === "install" ||
|
|
620
|
-
parsed.subcommand === "uninstall" ||
|
|
621
|
-
parsed.subcommand === "generate"
|
|
622
|
-
? ["completions", parsed.subcommand]
|
|
623
|
-
: ["completions"];
|
|
624
|
-
const { flags, positionals } = parseCommandArgs({
|
|
625
|
-
args: args.slice(hasSubcommand ? 1 : 0),
|
|
626
|
-
commandPath,
|
|
627
|
-
flagLabel: "completions",
|
|
628
|
-
string: ["shell"],
|
|
629
|
-
aliases: { s: "shell" },
|
|
630
|
-
});
|
|
631
|
-
const shellFromFlag = normalizeShell(readStringFlag(flags, "shell"));
|
|
632
|
-
if (readStringFlag(flags, "shell") && !shellFromFlag) {
|
|
633
|
-
throw usageError(commandPath, "Unknown shell. Use bash, zsh, or fish.");
|
|
634
|
-
}
|
|
635
|
-
if (shellFromFlag) {
|
|
636
|
-
parsed.shell = shellFromFlag;
|
|
637
|
-
}
|
|
638
|
-
if (positionals.length > 0) {
|
|
639
|
-
if (parsed.subcommand === "generate" &&
|
|
640
|
-
!parsed.shell &&
|
|
641
|
-
positionals.length === 1) {
|
|
642
|
-
const shell = normalizeShell(positionals[0]);
|
|
643
|
-
if (!shell) {
|
|
644
|
-
throw usageError(["completions", "generate"], "Unknown shell. Use bash, zsh, or fish.");
|
|
645
|
-
}
|
|
646
|
-
parsed.shell = shell;
|
|
647
|
-
return parsed;
|
|
648
|
-
}
|
|
649
|
-
if (parsed.subcommand === "status") {
|
|
650
|
-
throw usageError(["completions", "status"], "Usage: dvb completions status");
|
|
651
|
-
}
|
|
652
|
-
throw usageError(["completions"], `Unknown completions flag: ${positionals[0]}`);
|
|
653
|
-
}
|
|
654
|
-
return parsed;
|
|
655
|
-
};
|
|
656
|
-
export const runCompletions = async (args) => {
|
|
657
|
-
const parsed = parseCompletionsArgs(args);
|
|
658
|
-
if (parsed.subcommand === "status") {
|
|
659
|
-
const status = await resolveCompletionStatus();
|
|
660
|
-
if (!status.scriptExists) {
|
|
661
|
-
console.log("Shell completions are not installed.");
|
|
662
|
-
return;
|
|
663
|
-
}
|
|
664
|
-
console.log(`shell: ${status.shell ?? "unknown"}`);
|
|
665
|
-
if (status.scriptPath)
|
|
666
|
-
console.log(`script: ${status.scriptPath}`);
|
|
667
|
-
if (status.rcPath) {
|
|
668
|
-
console.log(status.rcConfigured
|
|
669
|
-
? `rc: ${status.rcPath}`
|
|
670
|
-
: `rc: missing (${status.rcPath})`);
|
|
671
|
-
}
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
if (parsed.subcommand === "generate") {
|
|
675
|
-
if (!parsed.shell)
|
|
676
|
-
throw new Error("Usage: dvb completions generate <shell>");
|
|
677
|
-
console.log(generateCompletionScript(parsed.shell));
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
const shell = parsed.shell ?? resolveShellFromEnv();
|
|
681
|
-
if (!shell) {
|
|
682
|
-
throw new Error("Unable to detect shell. Use --shell <bash|zsh|fish>.");
|
|
683
|
-
}
|
|
684
|
-
if (parsed.subcommand === "install") {
|
|
685
|
-
const { scriptPath, rcPath } = await installCompletions(shell);
|
|
686
|
-
console.log(`Installed completions for ${shell}.`);
|
|
687
|
-
console.log(`script: ${scriptPath}`);
|
|
688
|
-
if (rcPath)
|
|
689
|
-
console.log(`rc: ${rcPath}`);
|
|
690
|
-
return;
|
|
691
|
-
}
|
|
692
|
-
if (parsed.subcommand === "uninstall") {
|
|
693
|
-
const { scriptPath, rcPath } = await uninstallCompletions(shell);
|
|
694
|
-
console.log(`Removed completions for ${shell}.`);
|
|
695
|
-
console.log(`script: ${scriptPath}`);
|
|
696
|
-
if (rcPath)
|
|
697
|
-
console.log(`rc: ${rcPath}`);
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
usage();
|
|
701
|
-
process.exitCode = 1;
|
|
702
|
-
};
|
|
703
|
-
export const runComplete = async (args) => {
|
|
704
|
-
if (args.length === 0) {
|
|
705
|
-
process.exitCode = 1;
|
|
706
|
-
return;
|
|
707
|
-
}
|
|
708
|
-
if (args.length === 1) {
|
|
709
|
-
const shell = normalizeShell(args[0]);
|
|
710
|
-
if (!shell) {
|
|
711
|
-
process.exitCode = 1;
|
|
712
|
-
return;
|
|
713
|
-
}
|
|
714
|
-
console.log(generateCompletionScript(shell));
|
|
715
|
-
return;
|
|
716
|
-
}
|
|
717
|
-
const words = args[0] === "--" ? args.slice(1) : args.slice(0);
|
|
718
|
-
let data;
|
|
719
|
-
try {
|
|
720
|
-
data = await loadCompletionData(words);
|
|
721
|
-
}
|
|
722
|
-
catch {
|
|
723
|
-
data = {
|
|
724
|
-
boxes: [],
|
|
725
|
-
boxSessionNames: [],
|
|
726
|
-
boxSessionRefs: [],
|
|
727
|
-
sessionRefs: [],
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
const root = createCompletionRoot(data);
|
|
731
|
-
root.parse(words);
|
|
732
|
-
};
|
|
733
|
-
export const recordCompletionAliases = async (boxes) => {
|
|
734
|
-
const aliases = dedupeAliases(boxes
|
|
735
|
-
.map((box) => (typeof box.alias === "string" ? box.alias : ""))
|
|
736
|
-
.filter((alias) => alias.length > 0));
|
|
737
|
-
const cache = await loadCompletionCache();
|
|
738
|
-
const existing = cache.boxes?.remote ?? [];
|
|
739
|
-
const aliasChanged = !sameAliasSet(aliases, existing);
|
|
740
|
-
if (!aliasChanged)
|
|
741
|
-
return;
|
|
742
|
-
cache.boxes = {
|
|
743
|
-
...(cache.boxes ?? {}),
|
|
744
|
-
remote: aliases,
|
|
745
|
-
updatedAt: nowIso(),
|
|
746
|
-
};
|
|
747
|
-
await saveCompletionCache(cache);
|
|
748
|
-
};
|
|
749
|
-
export const recordCompletionSessionsFromMap = async (spriteAlias, sessions) => {
|
|
750
|
-
await updateCompletionCacheSessionsFromMap(spriteAlias, sessions, {
|
|
751
|
-
mode: "replace",
|
|
752
|
-
});
|
|
753
|
-
};
|
|
754
|
-
export const recordCompletionSessionsFromViews = async (spriteAlias, sessions) => {
|
|
755
|
-
await updateCompletionCacheSessionsFromViews(spriteAlias, sessions, {
|
|
756
|
-
mode: "replace",
|
|
757
|
-
});
|
|
758
|
-
};
|
|
759
|
-
//# sourceMappingURL=index.js.map
|