feat: add onboard reset option
This commit is contained in:
@@ -244,6 +244,10 @@ export function buildProgram() {
|
||||
"Interactive wizard to set up the gateway, workspace, and skills",
|
||||
)
|
||||
.option("--workspace <dir>", "Agent workspace directory (default: ~/clawd)")
|
||||
.option(
|
||||
"--reset",
|
||||
"Reset config + credentials + sessions + workspace before running wizard",
|
||||
)
|
||||
.option("--non-interactive", "Run without prompts", false)
|
||||
.option("--flow <flow>", "Wizard flow: quickstart|advanced")
|
||||
.option("--mode <mode>", "Wizard mode: local|remote")
|
||||
|
||||
@@ -33,6 +33,7 @@ export type OnboardOptions = {
|
||||
flow?: "quickstart" | "advanced";
|
||||
workspace?: string;
|
||||
nonInteractive?: boolean;
|
||||
reset?: boolean;
|
||||
authChoice?: AuthChoice;
|
||||
/** Used when `authChoice=token` in non-interactive mode. */
|
||||
tokenProvider?: string;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { readConfigFileSnapshot } from "../config/config.js";
|
||||
import { assertSupportedRuntime } from "../infra/runtime-guard.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
import { DEFAULT_WORKSPACE, handleReset } from "./onboard-helpers.js";
|
||||
import { runInteractiveOnboarding } from "./onboard-interactive.js";
|
||||
import { runNonInteractiveOnboarding } from "./onboard-non-interactive.js";
|
||||
import type { OnboardOptions } from "./onboard-types.js";
|
||||
@@ -15,6 +18,16 @@ export async function onboardCommand(
|
||||
const normalizedOpts =
|
||||
authChoice === opts.authChoice ? opts : { ...opts, authChoice };
|
||||
|
||||
if (normalizedOpts.reset) {
|
||||
const snapshot = await readConfigFileSnapshot();
|
||||
const baseConfig = snapshot.valid ? snapshot.config : {};
|
||||
const workspaceDefault =
|
||||
normalizedOpts.workspace ??
|
||||
baseConfig.agents?.defaults?.workspace ??
|
||||
DEFAULT_WORKSPACE;
|
||||
await handleReset("full", resolveUserPath(workspaceDefault), runtime);
|
||||
}
|
||||
|
||||
if (process.platform === "win32") {
|
||||
runtime.log(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user