mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 12:08:33 +00:00
refactor(commands): dedupe workspace config prompt
This commit is contained in:
@@ -323,14 +323,7 @@ export async function runConfigureWizard(
|
|||||||
logConfigUpdated(runtime);
|
logConfigUpdated(runtime);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (opts.sections) {
|
const configureWorkspace = async () => {
|
||||||
const selected = opts.sections;
|
|
||||||
if (!selected || selected.length === 0) {
|
|
||||||
outro("No changes selected.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selected.includes("workspace")) {
|
|
||||||
const workspaceInput = guardCancel(
|
const workspaceInput = guardCancel(
|
||||||
await text({
|
await text({
|
||||||
message: "Workspace directory",
|
message: "Workspace directory",
|
||||||
@@ -350,6 +343,17 @@ export async function runConfigureWizard(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
await ensureWorkspaceAndSessions(workspaceDir, runtime);
|
await ensureWorkspaceAndSessions(workspaceDir, runtime);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (opts.sections) {
|
||||||
|
const selected = opts.sections;
|
||||||
|
if (!selected || selected.length === 0) {
|
||||||
|
outro("No changes selected.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selected.includes("workspace")) {
|
||||||
|
await configureWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected.includes("model")) {
|
if (selected.includes("model")) {
|
||||||
@@ -420,25 +424,7 @@ export async function runConfigureWizard(
|
|||||||
ranSection = true;
|
ranSection = true;
|
||||||
|
|
||||||
if (choice === "workspace") {
|
if (choice === "workspace") {
|
||||||
const workspaceInput = guardCancel(
|
await configureWorkspace();
|
||||||
await text({
|
|
||||||
message: "Workspace directory",
|
|
||||||
initialValue: workspaceDir,
|
|
||||||
}),
|
|
||||||
runtime,
|
|
||||||
);
|
|
||||||
workspaceDir = resolveUserPath(String(workspaceInput ?? "").trim() || DEFAULT_WORKSPACE);
|
|
||||||
nextConfig = {
|
|
||||||
...nextConfig,
|
|
||||||
agents: {
|
|
||||||
...nextConfig.agents,
|
|
||||||
defaults: {
|
|
||||||
...nextConfig.agents?.defaults,
|
|
||||||
workspace: workspaceDir,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
await ensureWorkspaceAndSessions(workspaceDir, runtime);
|
|
||||||
await persistConfig();
|
await persistConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user