aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/ipc/handlers.ts
diff options
context:
space:
mode:
authorbndw <ben@bdw.to>2026-02-28 21:35:39 -0800
committerbndw <ben@bdw.to>2026-02-28 21:35:39 -0800
commit0484d97dfbc3b8a2e7878d3ab35a9895decdf467 (patch)
treecdc6fffe8b169c83058e8d64ca42723f6ccb6dcf /src/main/ipc/handlers.ts
parent04c63d4ef601876186e5d7fab980d76575c494ec (diff)
feat: **1 — `git.ts`:** Add exported `getCurrentBranch` helpe… (+8 more)
- ✅ **1 — `git.ts`:** Add exported `getCurrentBranch` helper after `ensureGitRepo` - ✅ **2a — `ipc/handlers.ts`:** Update git import to include `ensureGitRepo` and `getCurrentBranch` - ✅ **2b — `ipc/handlers.ts`:** Replace `workflow:advance` implement-phase block with branching-toggle logic - ✅ **3 — `GitSettings.tsx`:** Create new settings component with pill toggle - ✅ **4 — `SettingsPage.tsx`:** Add `"git"` section type, import, nav item, content render; fix both unicode glyphs - ✅ **5 — `globals.css`:** Append toggle-row + pill toggle + maximize-btn CSS - ✅ **6 — `index.ts`:** Add `ipcMain` to import; add `window:toggleMaximize` handler + maximize/unmaximize events inside `createWindow()` - ✅ **7 — `preload.ts`:** Add `toggleMaximize` + `onWindowMaximized` to interface and `api` object - ✅ **8 — `Header.tsx`:** Add `isMaximized` state + effect + maximize button in JSX
Diffstat (limited to 'src/main/ipc/handlers.ts')
-rw-r--r--src/main/ipc/handlers.ts27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/main/ipc/handlers.ts b/src/main/ipc/handlers.ts
index bc7d78d..e0863f3 100644
--- a/src/main/ipc/handlers.ts
+++ b/src/main/ipc/handlers.ts
@@ -3,7 +3,7 @@ import * as projects from "../db/projects";
3import * as sessions from "../db/sessions"; 3import * as sessions from "../db/sessions";
4import * as claude from "../claude"; 4import * as claude from "../claude";
5import * as settingsDb from "../db/settings"; 5import * as settingsDb from "../db/settings";
6import { createSessionBranch, ensureGitIgnore } from "../git"; 6import { createSessionBranch, ensureGitIgnore, ensureGitRepo, getCurrentBranch } from "../git";
7import type { UserPermissionMode } from "../claude/phases"; 7import type { UserPermissionMode } from "../claude/phases";
8import { getDefaultSystemPromptTemplate } from "../claude/phases"; 8import { getDefaultSystemPromptTemplate } from "../claude/phases";
9 9
@@ -113,10 +113,27 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void {
113 if (nextPhase === "implement") { 113 if (nextPhase === "implement") {
114 const project = projects.getProject(session.project_id); 114 const project = projects.getProject(session.project_id);
115 if (project) { 115 if (project) {
116 const branchName = createSessionBranch(project.path, session.name, session.id); 116 const branchingSetting = settingsDb.getSetting("git.branchingEnabled");
117 if (branchName) { 117 const branchingEnabled = branchingSetting === "true"; // opt-in; default = off
118 sessions.updateSession(sessionId, { git_branch: branchName }); 118
119 git_branch = branchName; 119 // Always ensure repo + gitignore so commits work regardless of mode
120 try { ensureGitIgnore(project.path); } catch { /* non-fatal */ }
121 try { ensureGitRepo(project.path); } catch { /* non-fatal */ }
122
123 if (branchingEnabled) {
124 // createSessionBranch internally calls ensureGitIgnore/ensureGitRepo again
125 // (belt-and-suspenders), then checks out a new claude-flow/<slug>-<id> branch
126 const branchName = createSessionBranch(project.path, session.name, session.id);
127 if (branchName) {
128 sessions.updateSession(sessionId, { git_branch: branchName });
129 git_branch = branchName;
130 }
131 } else {
132 // No new branch — commit to whatever branch is currently checked out.
133 // Store the branch name so autoCommitTurn's boolean guard passes.
134 const currentBranch = getCurrentBranch(project.path) ?? "main";
135 sessions.updateSession(sessionId, { git_branch: currentBranch });
136 git_branch = currentBranch;
120 } 137 }
121 } 138 }
122 } 139 }