openclaw/src/commands/onboard-interactive.ts

23 lines
698 B
TypeScript
Raw Normal View History

2026-01-01 18:23:16 +01:00
import type { RuntimeEnv } from "../runtime.js";
import { defaultRuntime } from "../runtime.js";
2026-01-03 16:04:19 +01:00
import { createClackPrompter } from "../wizard/clack-prompter.js";
import { runOnboardingWizard } from "../wizard/onboarding.js";
import { WizardCancelledError } from "../wizard/prompts.js";
import type { OnboardOptions } from "./onboard-types.js";
2026-01-01 18:23:16 +01:00
export async function runInteractiveOnboarding(
opts: OnboardOptions,
runtime: RuntimeEnv = defaultRuntime,
) {
2026-01-03 16:04:19 +01:00
const prompter = createClackPrompter();
2026-01-01 18:23:16 +01:00
try {
2026-01-03 16:04:19 +01:00
await runOnboardingWizard(opts, runtime, prompter);
2026-01-01 18:23:16 +01:00
} catch (err) {
2026-01-03 16:04:19 +01:00
if (err instanceof WizardCancelledError) {
runtime.exit(0);
return;
}
throw err;
}
2026-01-01 18:23:16 +01:00
}