mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:58:28 +00:00
refactor(commands): centralize shared command formatting helpers
This commit is contained in:
@@ -6,7 +6,12 @@ import type { RuntimeEnv } from "../runtime.js";
|
||||
import { selectStyled } from "../terminal/prompt-select-styled.js";
|
||||
import { stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js";
|
||||
import { resolveCleanupPlanFromDisk } from "./cleanup-plan.js";
|
||||
import { listAgentSessionDirs, removePath } from "./cleanup-utils.js";
|
||||
import {
|
||||
listAgentSessionDirs,
|
||||
removePath,
|
||||
removeStateAndLinkedPaths,
|
||||
removeWorkspaceDirs,
|
||||
} from "./cleanup-utils.js";
|
||||
|
||||
export type ResetScope = "config" | "config+creds+sessions" | "full";
|
||||
|
||||
@@ -129,16 +134,12 @@ export async function resetCommand(runtime: RuntimeEnv, opts: ResetOptions) {
|
||||
}
|
||||
|
||||
if (scope === "full") {
|
||||
await removePath(stateDir, runtime, { dryRun, label: stateDir });
|
||||
if (!configInsideState) {
|
||||
await removePath(configPath, runtime, { dryRun, label: configPath });
|
||||
}
|
||||
if (!oauthInsideState) {
|
||||
await removePath(oauthDir, runtime, { dryRun, label: oauthDir });
|
||||
}
|
||||
for (const workspace of workspaceDirs) {
|
||||
await removePath(workspace, runtime, { dryRun, label: workspace });
|
||||
}
|
||||
await removeStateAndLinkedPaths(
|
||||
{ stateDir, configPath, oauthDir, configInsideState, oauthInsideState },
|
||||
runtime,
|
||||
{ dryRun },
|
||||
);
|
||||
await removeWorkspaceDirs(workspaceDirs, runtime, { dryRun });
|
||||
runtime.log(`Next: ${formatCliCommand("openclaw onboard --install-daemon")}`);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user