diff options
| author | bndw <ben@bdw.to> | 2026-02-28 21:35:39 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-02-28 21:35:39 -0800 |
| commit | 0484d97dfbc3b8a2e7878d3ab35a9895decdf467 (patch) | |
| tree | cdc6fffe8b169c83058e8d64ca42723f6ccb6dcf /src/main/git.ts | |
| parent | 04c63d4ef601876186e5d7fab980d76575c494ec (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/git.ts')
| -rw-r--r-- | src/main/git.ts | 23 |
1 files changed, 23 insertions, 0 deletions
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 | |||
| @@ -58,6 +58,29 @@ export function ensureGitRepo(projectPath: string): void { | |||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | // --------------------------------------------------------------------------- | 60 | // --------------------------------------------------------------------------- |
| 61 | // Current branch query | ||
| 62 | // --------------------------------------------------------------------------- | ||
| 63 | |||
| 64 | /** | ||
| 65 | * Returns the name of the currently checked-out branch, | ||
| 66 | * or null if git is unavailable or HEAD is detached. | ||
| 67 | */ | ||
| 68 | export function getCurrentBranch(projectPath: string): string | null { | ||
| 69 | try { | ||
| 70 | return ( | ||
| 71 | execFileSync("git", ["branch", "--show-current"], { | ||
| 72 | cwd: projectPath, | ||
| 73 | stdio: "pipe", | ||
| 74 | }) | ||
| 75 | .toString() | ||
| 76 | .trim() || null | ||
| 77 | ); | ||
| 78 | } catch { | ||
| 79 | return null; | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | // --------------------------------------------------------------------------- | ||
| 61 | // Branch creation | 84 | // Branch creation |
| 62 | // --------------------------------------------------------------------------- | 85 | // --------------------------------------------------------------------------- |
| 63 | 86 | ||
