From 0484d97dfbc3b8a2e7878d3ab35a9895decdf467 Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 28 Feb 2026 21:35:39 -0800 Subject: feat: **1 — `git.ts`:** Add exported `getCurrentBranch` helpe… (+8 more) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ✅ **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 --- src/main/ipc/handlers.ts | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/main/ipc') 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"; import * as sessions from "../db/sessions"; import * as claude from "../claude"; import * as settingsDb from "../db/settings"; -import { createSessionBranch, ensureGitIgnore } from "../git"; +import { createSessionBranch, ensureGitIgnore, ensureGitRepo, getCurrentBranch } from "../git"; import type { UserPermissionMode } from "../claude/phases"; import { getDefaultSystemPromptTemplate } from "../claude/phases"; @@ -113,10 +113,27 @@ export function registerIpcHandlers(mainWindow: BrowserWindow): void { if (nextPhase === "implement") { const project = projects.getProject(session.project_id); if (project) { - const branchName = createSessionBranch(project.path, session.name, session.id); - if (branchName) { - sessions.updateSession(sessionId, { git_branch: branchName }); - git_branch = branchName; + const branchingSetting = settingsDb.getSetting("git.branchingEnabled"); + const branchingEnabled = branchingSetting === "true"; // opt-in; default = off + + // Always ensure repo + gitignore so commits work regardless of mode + try { ensureGitIgnore(project.path); } catch { /* non-fatal */ } + try { ensureGitRepo(project.path); } catch { /* non-fatal */ } + + if (branchingEnabled) { + // createSessionBranch internally calls ensureGitIgnore/ensureGitRepo again + // (belt-and-suspenders), then checks out a new claude-flow/- branch + const branchName = createSessionBranch(project.path, session.name, session.id); + if (branchName) { + sessions.updateSession(sessionId, { git_branch: branchName }); + git_branch = branchName; + } + } else { + // No new branch — commit to whatever branch is currently checked out. + // Store the branch name so autoCommitTurn's boolean guard passes. + const currentBranch = getCurrentBranch(project.path) ?? "main"; + sessions.updateSession(sessionId, { git_branch: currentBranch }); + git_branch = currentBranch; } } } -- cgit v1.2.3