feat(cli): hint gateway reachability for local/remote

This commit is contained in:
Peter Steinberger
2026-01-01 23:30:02 +01:00
parent a39ef7181d
commit ca81d94b90
3 changed files with 99 additions and 4 deletions

View File

@@ -37,6 +37,7 @@ import {
handleReset,
openUrl,
printWizardHeader,
probeGatewayReachable,
randomToken,
summarizeExistingConfig,
} from "./onboard-helpers.js";
@@ -113,14 +114,44 @@ export async function runInteractiveOnboarding(
}
}
const localUrl = "ws://127.0.0.1:18789";
const localProbe = await probeGatewayReachable({
url: localUrl,
token: process.env.CLAWDIS_GATEWAY_TOKEN,
password:
baseConfig.gateway?.auth?.password ??
process.env.CLAWDIS_GATEWAY_PASSWORD,
});
const remoteUrl = baseConfig.gateway?.remote?.url?.trim() ?? "";
const remoteProbe = remoteUrl
? await probeGatewayReachable({
url: remoteUrl,
token: baseConfig.gateway?.remote?.token,
})
: null;
const mode =
opts.mode ??
(guardCancel(
await select({
message: "Where will the Gateway run?",
options: [
{ value: "local", label: "Local (this machine)" },
{ value: "remote", label: "Remote (info-only)" },
{
value: "local",
label: "Local (this machine)",
hint: localProbe.ok
? `Gateway reachable (${localUrl})`
: `No gateway detected (${localUrl})`,
},
{
value: "remote",
label: "Remote (info-only)",
hint: !remoteUrl
? "No remote URL configured yet"
: remoteProbe?.ok
? `Gateway reachable (${remoteUrl})`
: `Configured but unreachable (${remoteUrl})`,
},
],
}),
runtime,