Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(worktree): default bind path to userData base, not filesystem root

enes0359de024ca7
diff --git a/src/main/index.ts b/src/main/index.ts
index e75f99ced..d35adc852 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -202,6 +202,9 @@ app.whenReady().then(async () => {
ipcMain.handle(IPC.announcementsFetch, async () => (await fetchCheck()).messages)
ipcMain.handle(IPC.appUpdatePolicy, async () => (await fetchCheck()).update)
+ // Writable base dir for app-managed files (e.g. default git worktree location).
+ ipcMain.handle(IPC.appUserDataDir, () => app.getPath('userData'))
+
ipcMain.on(IPC.shellReveal, (_e, p: string) => {
if (p) shell.showItemInFolder(p)
})
diff --git a/src/preload/index.ts b/src/preload/index.ts
index d96f032c6..273c0ef5c 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -287,6 +287,7 @@ const api: NodeTerminalApi = {
setBadgeCount: (count) => ipcRenderer.send(IPC.appSetBadge, count),
// Absolute path of a dropped/picked File (File.path was removed in Electron 30+).
getPathForFile: (file: File) => webUtils.getPathForFile(file),
+ userDataDir: () => ipcRenderer.invoke(IPC.appUserDataDir),
notify: (payload) => ipcRenderer.invoke(IPC.appNotify, payload),
onFocusNode: (listener) => {
const handler = (_e: unknown, nodeId: string) => listener(nodeId)
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index a070727a5..890ec4773 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -186,6 +186,13 @@ export function Canvas() {
const [consentOpen, setConsentOpen] = useState(false)
// Group id awaiting a worktree bind (drives BindWorktreeDialog).
const [bindTarget, setBindTarget] = useState<string | null>(null)
+ // Writable base dir for the default worktree path (Electron userData), fetched once on mount.
+ const userDataDirRef = useRef('')
+ useEffect(() => {
+ void window.nodeTerminal.userDataDir().then((d) => {
+ userDataDirRef.current = d
+ })
+ }, [])
// Terminal node id awaiting confirmation to move into its group's worktree.
const [moveTarget, setMoveTarget] = useState<string | null>(null)
// Group awaiting confirmation to remove its worktree (drives the ask-first safety dialog).
@@ -2547,7 +2554,11 @@ export function Canvas() {
(nodesRef.current.find((n) => n.id === bindTarget)?.data.cwd as string) || ''
}
defaultPath={(repoPath, branch) =>
- computeWorktreePath('', repoPath.split('/').pop() || 'repo', sanitizeWorktreeBranch(branch))
+ computeWorktreePath(
+ userDataDirRef.current,
+ repoPath.split('/').pop() || 'repo',
+ sanitizeWorktreeBranch(branch)
+ )
}
onConfirm={confirmBind}
onCancel={() => setBindTarget(null)}
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index 0c33a62f9..3b0e11cba 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -29,6 +29,7 @@ export const IPC = {
appUpdateNotAvailable: 'app:update-not-available',
appCheckForUpdates: 'app:check-for-updates',
appGetVersion: 'app:get-version',
+ appUserDataDir: 'app:user-data-dir',
appUpdatePolicy: 'app:update-policy',
licenseActivate: 'license:activate',
licenseDeactivate: 'license:deactivate',
diff --git a/src/shared/types.ts b/src/shared/types.ts
index aa217d1cd..35d8f7a31 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -732,6 +732,8 @@ export interface NodeTerminalApi {
setBadgeCount(count: number): void
/** Absolute filesystem path for a dropped/picked File (for drag-into-terminal). */
getPathForFile(file: File): string
+ /** Absolute writable base dir (Electron userData) for app-managed files like default worktrees. */
+ userDataDir(): Promise<string>
/** Show an OS notification (main suppresses it if the window is focused). Returns whether shown. */
notify(payload: NotifyPayload): Promise<boolean>
/** Fires when a notification is clicked, asking the renderer to focus a node. Returns unsubscribe. */