Add a native workspace directory picker to onboarding
Onboarding only accepted a typed workspace path, which is error-prone and diverged from the original wizard. Add a pickDirectory IPC backed by Electron's open-directory dialog and a Choose button beside the path field, so the founder can select a real folder for agent artifacts.
This commit is contained in:
1 parent
b65e059da6
commit
db679cfeb9
5 files changed
+23
-2
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { ipcMain, shell, type BrowserWindow } from "electron";
|
||||
import { dialog, ipcMain, shell, type BrowserWindow } from "electron";
|
||||
import type { DatabaseConnection } from "../database/connection";
|
||||
import { IPC_CHANNELS } from "../../shared/ipc";
|
||||
import { fail, ok, type DesktopResult } from "../../shared/result";
|
||||
@@ -196,6 +196,16 @@ export function registerIpcHandlers(deps: IpcDeps): void {
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.pickDirectory, async () => {
|
||||
try {
|
||||
const result = await dialog.showOpenDialog(deps.mainWindow, { properties: ["openDirectory", "createDirectory"] });
|
||||
if (result.canceled || result.filePaths.length === 0) return ok(null);
|
||||
return ok(result.filePaths[0]);
|
||||
} catch (error) {
|
||||
return fail("pick_directory_failed", error instanceof Error ? error.message : String(error));
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.createMigrationReport, (_event, input) => mutate(() => migrations.createReport(input)));
|
||||
ipcMain.handle(IPC_CHANNELS.createRollbackSnapshot, (_event, input) => mutate(() => rollback.createSnapshot(input)));
|
||||
ipcMain.handle(IPC_CHANNELS.setRollbackSnapshotActive, (_event, input) => mutate(() => rollback.setActive(input)));
|
||||
|
||||
Reference in new issue
Block a user