mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 22:44:36 +00:00
refactor(commands): share cleanup plan resolver
This commit is contained in:
25
src/commands/cleanup-plan.ts
Normal file
25
src/commands/cleanup-plan.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
loadConfig,
|
||||
resolveConfigPath,
|
||||
resolveOAuthDir,
|
||||
resolveStateDir,
|
||||
} from "../config/config.js";
|
||||
import { buildCleanupPlan } from "./cleanup-utils.js";
|
||||
|
||||
export function resolveCleanupPlanFromDisk(): {
|
||||
cfg: OpenClawConfig;
|
||||
stateDir: string;
|
||||
configPath: string;
|
||||
oauthDir: string;
|
||||
configInsideState: boolean;
|
||||
oauthInsideState: boolean;
|
||||
workspaceDirs: string[];
|
||||
} {
|
||||
const cfg = loadConfig();
|
||||
const stateDir = resolveStateDir();
|
||||
const configPath = resolveConfigPath();
|
||||
const oauthDir = resolveOAuthDir();
|
||||
const plan = buildCleanupPlan({ cfg, stateDir, configPath, oauthDir });
|
||||
return { cfg, stateDir, configPath, oauthDir, ...plan };
|
||||
}
|
||||
Reference in New Issue
Block a user