diff --git a/src/commands/configure.wizard.ts b/src/commands/configure.wizard.ts index 06b2dcd1a3b..4961e0c5cf3 100644 --- a/src/commands/configure.wizard.ts +++ b/src/commands/configure.wizard.ts @@ -323,6 +323,28 @@ export async function runConfigureWizard( logConfigUpdated(runtime); }; + const configureWorkspace = async () => { + const workspaceInput = guardCancel( + 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); + }; + if (opts.sections) { const selected = opts.sections; if (!selected || selected.length === 0) { @@ -331,25 +353,7 @@ export async function runConfigureWizard( } if (selected.includes("workspace")) { - const workspaceInput = guardCancel( - 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 configureWorkspace(); } if (selected.includes("model")) { @@ -420,25 +424,7 @@ export async function runConfigureWizard( ranSection = true; if (choice === "workspace") { - const workspaceInput = guardCancel( - 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 configureWorkspace(); await persistConfig(); }