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/git.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/main/git.ts') diff --git a/src/main/git.ts b/src/main/git.ts index 20362a7..ec81e8f 100644 --- a/src/main/git.ts +++ b/src/main/git.ts @@ -57,6 +57,29 @@ export function ensureGitRepo(projectPath: string): void { } } +// --------------------------------------------------------------------------- +// Current branch query +// --------------------------------------------------------------------------- + +/** + * Returns the name of the currently checked-out branch, + * or null if git is unavailable or HEAD is detached. + */ +export function getCurrentBranch(projectPath: string): string | null { + try { + return ( + execFileSync("git", ["branch", "--show-current"], { + cwd: projectPath, + stdio: "pipe", + }) + .toString() + .trim() || null + ); + } catch { + return null; + } +} + // --------------------------------------------------------------------------- // Branch creation // --------------------------------------------------------------------------- -- cgit v1.2.3