diff options
| author | Clawd <ai@clawd.bot> | 2026-02-28 18:32:21 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-28 18:32:21 -0800 |
| commit | 4aaed77705081009fe9e3d7025b545108f7db205 (patch) | |
| tree | e485f3226aef77a5ac15eea25e2ac0a363660385 /src/main/ipc | |
| parent | fb307e8e31628d64603a7c65f398f55f1e8f93f2 (diff) | |
Remove git worktree/branch management
Session-scoped artifacts already solve the concurrent session problem.
No need for worktrees or branches. Simpler is better.
Diffstat (limited to 'src/main/ipc')
| -rw-r--r-- | src/main/ipc/handlers.ts | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/src/main/ipc/handlers.ts b/src/main/ipc/handlers.ts index bc0d024..2d5e3d3 100644 --- a/src/main/ipc/handlers.ts +++ b/src/main/ipc/handlers.ts | |||
| @@ -3,7 +3,6 @@ import * as projects from "../db/projects"; | |||
| 3 | import * as sessions from "../db/sessions"; | 3 | import * as sessions from "../db/sessions"; |
| 4 | import * as claude from "../claude"; | 4 | import * as claude from "../claude"; |
| 5 | import type { UserPermissionMode } from "../claude/phases"; | 5 | import type { UserPermissionMode } from "../claude/phases"; |
| 6 | import * as git from "../git/worktree"; | ||
| 7 | 6 | ||
| 8 | export function registerIpcHandlers(mainWindow: BrowserWindow): void { | 7 | export function registerIpcHandlers(mainWindow: BrowserWindow): void { |
| 9 | // Projects | 8 | // Projects |
| @@ -19,35 +18,16 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void { | |||
| 19 | ipcMain.handle("sessions:list", (_, projectId: string) => | 18 | ipcMain.handle("sessions:list", (_, projectId: string) => |
| 20 | sessions.listSessions(projectId) | 19 | sessions.listSessions(projectId) |
| 21 | ); | 20 | ); |
| 22 | 21 | ||
| 23 | ipcMain.handle("sessions:create", async (_, projectId: string, name: string) => { | 22 | ipcMain.handle("sessions:create", (_, projectId: string, name: string) => |
| 24 | const session = sessions.createSession(projectId, name); | 23 | sessions.createSession(projectId, name) |
| 25 | const project = projects.getProject(projectId); | 24 | ); |
| 26 | |||
| 27 | if (project && git.isGitRepo(project.path)) { | ||
| 28 | try { | ||
| 29 | // Create git worktree for this session | ||
| 30 | git.createWorktree(project.path, session.id); | ||
| 31 | } catch (error) { | ||
| 32 | console.error("Failed to create worktree:", error); | ||
| 33 | // Continue without worktree - not fatal | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | return session; | ||
| 38 | }); | ||
| 39 | 25 | ||
| 40 | ipcMain.handle("sessions:delete", (_, id: string) => { | 26 | ipcMain.handle("sessions:delete", (_, id: string) => { |
| 41 | const session = sessions.getSession(id); | 27 | const session = sessions.getSession(id); |
| 42 | if (session) { | 28 | if (session) { |
| 43 | const project = projects.getProject(session.project_id); | 29 | const project = projects.getProject(session.project_id); |
| 44 | if (project) { | 30 | if (project) { |
| 45 | // Clean up worktree if exists | ||
| 46 | try { | ||
| 47 | git.removeWorktree(project.path, id); | ||
| 48 | } catch { | ||
| 49 | // Worktree might not exist, that's ok | ||
| 50 | } | ||
| 51 | // Clean up session artifacts | 31 | // Clean up session artifacts |
| 52 | claude.clearSessionArtifacts(project.path, id); | 32 | claude.clearSessionArtifacts(project.path, id); |
| 53 | } | 33 | } |
| @@ -162,23 +142,6 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void { | |||
| 162 | } | 142 | } |
| 163 | ); | 143 | ); |
| 164 | 144 | ||
| 165 | // Git | ||
| 166 | ipcMain.handle("git:isRepo", (_, projectPath: string) => { | ||
| 167 | return git.isGitRepo(projectPath); | ||
| 168 | }); | ||
| 169 | |||
| 170 | ipcMain.handle("git:worktreeInfo", (_, projectPath: string, sessionId: string) => { | ||
| 171 | return git.getWorktreeInfo(projectPath, sessionId); | ||
| 172 | }); | ||
| 173 | |||
| 174 | ipcMain.handle("git:commit", (_, worktreePath: string, message: string, files?: string[]) => { | ||
| 175 | git.commitChanges(worktreePath, message, files); | ||
| 176 | }); | ||
| 177 | |||
| 178 | ipcMain.handle("git:hasChanges", (_, worktreePath: string) => { | ||
| 179 | return git.hasUncommittedChanges(worktreePath); | ||
| 180 | }); | ||
| 181 | |||
| 182 | // Dialogs | 145 | // Dialogs |
| 183 | ipcMain.handle("dialog:selectDirectory", async () => { | 146 | ipcMain.handle("dialog:selectDirectory", async () => { |
| 184 | const result = await dialog.showOpenDialog(mainWindow, { | 147 | const result = await dialog.showOpenDialog(mainWindow, { |
