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