Skip to content

Commit fe287a2

Browse files
committed
persist settings for quicker session creation
1 parent 4ce0384 commit fe287a2

File tree

4 files changed

+309
-1
lines changed

4 files changed

+309
-1
lines changed

main.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { app, BrowserWindow, ipcMain, dialog } from "electron";
22
import * as pty from "node-pty";
33
import * as os from "os";
44
import { simpleGit } from "simple-git";
5+
import Store from "electron-store";
56

67
interface SessionConfig {
78
projectDir: string;
@@ -11,6 +12,7 @@ interface SessionConfig {
1112

1213
let mainWindow: BrowserWindow;
1314
const sessions = new Map<string, pty.IPty>();
15+
const store = new Store();
1416

1517
// Open directory picker
1618
ipcMain.handle("select-directory", async () => {
@@ -37,6 +39,20 @@ ipcMain.handle("get-branches", async (_event, dirPath: string) => {
3739
}
3840
});
3941

42+
// Get last used settings
43+
ipcMain.handle("get-last-settings", () => {
44+
return (store as any).get("lastSessionConfig", {
45+
projectDir: "",
46+
parentBranch: "",
47+
codingAgent: "claude",
48+
});
49+
});
50+
51+
// Save settings
52+
ipcMain.on("save-settings", (_event, config: SessionConfig) => {
53+
(store as any).set("lastSessionConfig", config);
54+
});
55+
4056
// Create new session
4157
ipcMain.on("create-session", (event, config: SessionConfig) => {
4258
const sessionId = `session-${Date.now()}`;

0 commit comments

Comments
 (0)