fix: narrow onboarding prompt types

This commit is contained in:
Peter Steinberger
2026-01-01 17:14:02 +00:00
parent 8ea27968d7
commit f10abc8ee0

View File

@@ -23,7 +23,7 @@ import {
DEFAULT_AGENT_WORKSPACE_DIR, DEFAULT_AGENT_WORKSPACE_DIR,
ensureAgentWorkspace, ensureAgentWorkspace,
} from "../agents/workspace.js"; } from "../agents/workspace.js";
import type { ClawdisConfig } from "../config/config.js"; import type { BridgeBindMode, ClawdisConfig } from "../config/config.js";
import { import {
CONFIG_PATH_CLAWDIS, CONFIG_PATH_CLAWDIS,
readConfigFileSnapshot, readConfigFileSnapshot,
@@ -65,12 +65,12 @@ type OnboardOptions = {
json?: boolean; json?: boolean;
}; };
function guardCancel<T>(value: T, runtime: RuntimeEnv): T { function guardCancel<T>(value: T, runtime: RuntimeEnv): Exclude<T, symbol> {
if (isCancel(value)) { if (isCancel(value)) {
cancel("Setup cancelled."); cancel("Setup cancelled.");
runtime.exit(0); runtime.exit(0);
} }
return value; return value as Exclude<T, symbol>;
} }
function summarizeExistingConfig(config: ClawdisConfig): string { function summarizeExistingConfig(config: ClawdisConfig): string {
@@ -751,7 +751,7 @@ export async function onboardCommand(
], ],
}), }),
runtime, runtime,
); ) as BridgeBindMode;
let authMode = guardCancel( let authMode = guardCancel(
await select({ await select({
@@ -851,7 +851,7 @@ export async function onboardCommand(
...nextConfig, ...nextConfig,
gateway: { gateway: {
...nextConfig.gateway, ...nextConfig.gateway,
bind: String(bind), bind,
tailscale: { tailscale: {
...nextConfig.gateway?.tailscale, ...nextConfig.gateway?.tailscale,
mode: tailscaleMode, mode: tailscaleMode,