style: format onboarding commands

This commit is contained in:
Peter Steinberger
2026-01-01 17:30:17 +00:00
parent c454f7ac0d
commit d642e90cdd
4 changed files with 40 additions and 14 deletions

View File

@@ -20,10 +20,10 @@ import {
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
import { resolveGatewayService } from "../daemon/service.js";
import { healthCommand } from "./health.js";
import type { RuntimeEnv } from "../runtime.js";
import { defaultRuntime } from "../runtime.js";
import { resolveUserPath, sleep } from "../utils.js";
import { healthCommand } from "./health.js";
import {
applyMinimaxConfig,
setAnthropicApiKey,
@@ -66,11 +66,15 @@ export async function runInteractiveOnboarding(
let baseConfig: ClawdisConfig = snapshot.valid ? snapshot.config : {};
if (snapshot.exists) {
const title = snapshot.valid ? "Existing config detected" : "Invalid config";
const title = snapshot.valid
? "Existing config detected"
: "Invalid config";
note(summarizeExistingConfig(baseConfig), title);
if (!snapshot.valid && snapshot.issues.length > 0) {
note(
snapshot.issues.map((iss) => `- ${iss.path}: ${iss.message}`).join("\n"),
snapshot.issues
.map((iss) => `- ${iss.path}: ${iss.message}`)
.join("\n"),
"Config issues",
);
}
@@ -94,7 +98,10 @@ export async function runInteractiveOnboarding(
message: "Reset scope",
options: [
{ value: "config", label: "Config only" },
{ value: "config+creds+sessions", label: "Config + creds + sessions" },
{
value: "config+creds+sessions",
label: "Config + creds + sessions",
},
{
value: "full",
label: "Full reset (config + creds + sessions + workspace)",
@@ -285,7 +292,10 @@ export async function runInteractiveOnboarding(
}
if (tailscaleMode !== "off" && bind !== "loopback") {
note("Tailscale requires bind=loopback. Adjusting bind to loopback.", "Note");
note(
"Tailscale requires bind=loopback. Adjusting bind to loopback.",
"Note",
);
bind = "loopback";
}
@@ -392,7 +402,10 @@ export async function runInteractiveOnboarding(
}
}
if (!loaded || (loaded && (await service.isLoaded({ env: process.env })) === false)) {
if (
!loaded ||
(loaded && (await service.isLoaded({ env: process.env })) === false)
) {
const devMode =
process.argv[1]?.includes(`${path.sep}src${path.sep}`) &&
process.argv[1]?.endsWith(".ts");
@@ -402,7 +415,9 @@ export async function runInteractiveOnboarding(
PATH: process.env.PATH,
CLAWDIS_GATEWAY_TOKEN: gatewayToken,
CLAWDIS_LAUNCHD_LABEL:
process.platform === "darwin" ? GATEWAY_LAUNCH_AGENT_LABEL : undefined,
process.platform === "darwin"
? GATEWAY_LAUNCH_AGENT_LABEL
: undefined,
};
await service.install({
env: process.env,

View File

@@ -1,17 +1,17 @@
import path from "node:path";
import {
type ClawdisConfig,
CONFIG_PATH_CLAWDIS,
readConfigFileSnapshot,
writeConfigFile,
type ClawdisConfig,
} from "../config/config.js";
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
import { resolveGatewayService } from "../daemon/service.js";
import { resolveUserPath, sleep } from "../utils.js";
import type { RuntimeEnv } from "../runtime.js";
import { defaultRuntime } from "../runtime.js";
import { resolveUserPath, sleep } from "../utils.js";
import { healthCommand } from "./health.js";
import { applyMinimaxConfig, setAnthropicApiKey } from "./onboard-auth.js";
import {
@@ -19,7 +19,11 @@ import {
ensureWorkspaceAndSessions,
randomToken,
} from "./onboard-helpers.js";
import type { AuthChoice, OnboardMode, OnboardOptions } from "./onboard-types.js";
import type {
AuthChoice,
OnboardMode,
OnboardOptions,
} from "./onboard-types.js";
export async function runNonInteractiveOnboarding(
opts: OnboardOptions,

View File

@@ -286,7 +286,7 @@ export async function setupProviders(
note(
[
"Link device with: signal-cli link -n \"Clawdis\"",
'Link device with: signal-cli link -n "Clawdis"',
"Scan QR in Signal → Linked Devices",
"Then run: clawdis gateway call providers.status --params '{\"probe\":true}'",
].join("\n"),

View File

@@ -1,4 +1,11 @@
import { confirm, multiselect, note, select, spinner, text } from "@clack/prompts";
import {
confirm,
multiselect,
note,
select,
spinner,
text,
} from "@clack/prompts";
import { installSkill } from "../agents/skills-install.js";
import { buildWorkspaceSkillStatus } from "../agents/skills-status.js";
@@ -121,8 +128,8 @@ export async function setupSkills(
const apiKey = String(
guardCancel(
await text({
message: `Enter ${skill.primaryEnv}`,
validate: (value) => (value?.trim() ? undefined : "Required"),
message: `Enter ${skill.primaryEnv}`,
validate: (value) => (value?.trim() ? undefined : "Required"),
}),
runtime,
),