diff options
| author | bndw <ben@bdw.to> | 2026-02-28 20:45:23 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-02-28 20:45:23 -0800 |
| commit | 0da42e4fa414ab3268d4f71896455097239f8590 (patch) | |
| tree | 72e951bdf8b591f4c949c6fd687ef780580c8783 /src/main/ipc/handlers.ts | |
| parent | dc4156fec54a8efdab84834fe2f5bc90120e32c1 (diff) | |
feat: Complete 9 tasks
- ✅ **Change 1** — `src/main/git.ts`: Add `LOCK_FILES`, `buildTaskSubject`, `getStagedFileNames`, `buildFileSubject` helpers; rewrite `commitMsg` block in `autoCommitTurn`
- ✅ **Change 2a** — `src/main/ipc/handlers.ts`: Update import to include `ensureGitIgnore`; strip branch creation from `sessions:create`; add bare `ensureGitIgnore` call
- ✅ **Change 2b** — `src/main/ipc/handlers.ts`: Update `workflow:advance` to create branch on implement transition; return `{ phase, git_branch }`
- ✅ **Change 3** — `src/main/preload.ts`: Update `advancePhase` return type in `ClaudeFlowAPI` interface
- ✅ **Change 4** — `renderer/src/App.tsx`: Destructure `{ phase, git_branch }` from advance result; spread `git_branch` into `setSelectedSession`
- ✅ **Change 5a** — `renderer/src/components/Header.tsx`: Remove branch from `<option>` text
- ✅ **Change 5b** — `renderer/src/components/Header.tsx`: Add `phase !== "implement"` guard to rename button
- ✅ **Change 5c** — `renderer/src/components/Header.tsx`: Gate badge on `gitBranch` truthy; remove disabled/unavailable state
- ✅ **Change 6** — `renderer/src/styles/globals.css`: Delete `.branch-badge.branch-unavailable` rule
Diffstat (limited to 'src/main/ipc/handlers.ts')
| -rw-r--r-- | src/main/ipc/handlers.ts | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/main/ipc/handlers.ts b/src/main/ipc/handlers.ts index f0a5b82..774eb63 100644 --- a/src/main/ipc/handlers.ts +++ b/src/main/ipc/handlers.ts | |||
| @@ -2,7 +2,7 @@ import { ipcMain, dialog, type BrowserWindow } from "electron"; | |||
| 2 | import * as projects from "../db/projects"; | 2 | 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 { createSessionBranch } from "../git"; | 5 | import { createSessionBranch, ensureGitIgnore } from "../git"; |
| 6 | import type { UserPermissionMode } from "../claude/phases"; | 6 | import type { UserPermissionMode } from "../claude/phases"; |
| 7 | 7 | ||
| 8 | export function registerIpcHandlers(mainWindow: BrowserWindow): void { | 8 | export function registerIpcHandlers(mainWindow: BrowserWindow): void { |
| @@ -26,12 +26,11 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void { | |||
| 26 | 26 | ||
| 27 | const session = sessions.createSession(projectId, name); | 27 | const session = sessions.createSession(projectId, name); |
| 28 | 28 | ||
| 29 | const branchName = createSessionBranch(project.path, session.name, session.id); | 29 | // Ensure .claude-flow/ is gitignored from day one. |
| 30 | if (branchName) { | 30 | // Branch creation is deferred until the session advances to implement. |
| 31 | sessions.updateSession(session.id, { git_branch: branchName }); | 31 | try { ensureGitIgnore(project.path); } catch { /* non-fatal */ } |
| 32 | } | ||
| 33 | 32 | ||
| 34 | return { ...session, git_branch: branchName ?? null }; | 33 | return session; |
| 35 | }); | 34 | }); |
| 36 | 35 | ||
| 37 | ipcMain.handle("sessions:delete", (_, id: string) => { | 36 | ipcMain.handle("sessions:delete", (_, id: string) => { |
| @@ -103,7 +102,24 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void { | |||
| 103 | ipcMain.handle("workflow:advance", (_, sessionId: string) => { | 102 | ipcMain.handle("workflow:advance", (_, sessionId: string) => { |
| 104 | const session = sessions.getSession(sessionId); | 103 | const session = sessions.getSession(sessionId); |
| 105 | if (!session) throw new Error("Session not found"); | 104 | if (!session) throw new Error("Session not found"); |
| 106 | return claude.advancePhase(session); | 105 | |
| 106 | const nextPhase = claude.advancePhase(session); | ||
| 107 | if (!nextPhase) return null; | ||
| 108 | |||
| 109 | let git_branch = session.git_branch; | ||
| 110 | |||
| 111 | if (nextPhase === "implement") { | ||
| 112 | const project = projects.getProject(session.project_id); | ||
| 113 | if (project) { | ||
| 114 | const branchName = createSessionBranch(project.path, session.name, session.id); | ||
| 115 | if (branchName) { | ||
| 116 | sessions.updateSession(sessionId, { git_branch: branchName }); | ||
| 117 | git_branch = branchName; | ||
| 118 | } | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | return { phase: nextPhase, git_branch }; | ||
| 107 | }); | 123 | }); |
| 108 | 124 | ||
| 109 | ipcMain.handle( | 125 | ipcMain.handle( |
