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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(canvas): the file-manager row degrades explicitly on a cwd-less project
albaneselorenzo41ce18172bb2
diff --git a/CLAUDE.md b/CLAUDE.mdindex b9166fd31..802c131cc 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -915,8 +915,14 @@ session.root remote terminals at a path from the wrong machine. On a RELAY tab there is no `ssh` torebind, so the row used to spawn a plain LOCAL terminal at the peer's remote path; it is nowwithheld there instead — spawning onto a peer's core is a real feature, not a one-liner.- - Creation is gated on the project having a directory (`hasCwd`) on every surface — pane menu,- Dock, sidebar "+", ⌘K, and the group-frame menu, where it inherits a bound **worktree's** cwd+ - Creation needs a project directory (`hasCwd`), and **the row degrades EXPLICITLY rather than+ vanishing** — disabled, carrying `FILES_NO_CWD_HINT` (an alias of `NEW_FILE_NO_CWD_HINT`), on+ the pane menu, the Dock and the sidebar "+". That is the rule #621 established for "New file…"+ and the SSH worktree row: a cwd-less project is a supported, persisted canvas, so a row that+ simply disappears takes its own reason with it while the fix ("Set folder…") sits one menu+ away. **⌘K is the deliberate exception** and hides the entry, exactly as main's "New file…"+ does — a disabled palette entry surfaces as a search result that does nothing, the same reason+ `sshAccountsHint` is omitted there. Inside a group frame it inherits a bound **worktree's** cwdvia `cwdForNewNodeIn`, so a frame per branch also means a file tree per branch.- **A node kind not registered in `lib/reopenNode.ts` is a trap, and this one fell in it.** Everykind must sit in exactly one of `UNRESTORABLE` or a `buildBase` `case` — `files` was in neither,diff --git a/src/renderer/lib/addMenuSpec.test.tsx b/src/renderer/lib/addMenuSpec.test.tsxindex 528c0ffd5..029b29d85 100644--- a/src/renderer/lib/addMenuSpec.test.tsx+++ b/src/renderer/lib/addMenuSpec.test.tsx@@ -3,6 +3,7 @@ import {CONTENT_ADD_ITEMS,contentAddItemsToMenuItems,contentAddItemsToDockRows,+ FILES_NO_CWD_HINT,NEW_FILE_NO_CWD_HINT,WORKTREE_NO_CWD_HINT,WORKTREE_SSH_HINT,@@ -72,12 +73,18 @@ describe('contentAddItemsToMenuItems', () => {])})- it('hides "New file manager" when the project has no cwd', () => {+ // Follows the rule main established for "New file…": a folder-shaped row on a cwd-less canvas+ // degrades EXPLICITLY. This test previously asserted the row was HIDDEN, which is the behaviour+ // that rule reversed.+ it('DISABLES "New file manager" with its reason when the project has no cwd — never hides it', () => {const items = contentAddItemsToMenuItems(CONTENT_ADD_ITEMS, handlers(), {hasCwd: false,isSshProject: false})- expect(items.some((i) => 'label' in i && i.label === 'New file manager')).toBe(false)+ const row = items.find((i) => 'label' in i && i.label === 'New file manager')+ expect(row).toBeDefined()+ expect(row && 'disabled' in row && row.disabled).toBe(true)+ expect(row && 'hint' in row && row.hint).toBe(FILES_NO_CWD_HINT)})// A cwd-less project is a supported, persisted canvas — the folder-shaped rows must degrade@@ -170,12 +177,15 @@ describe('contentAddItemsToDockRows', () => {expect(rows.some((r) => r.kind === 'remote')).toBe(false)})- it('hides "files" when there is no cwd', () => {+ it('DISABLES "files" with its reason when there is no cwd — the Dock keeps the row too', () => {const rows = contentAddItemsToDockRows(CONTENT_ADD_ITEMS, handlers(), {hasCwd: false,isSshProject: false})- expect(rows.some((r) => r.kind === 'files')).toBe(false)+ const row = rows.find((r) => r.kind === 'files')+ expect(row).toBeDefined()+ expect(row?.disabled).toBe(true)+ expect(row?.hint).toBe(FILES_NO_CWD_HINT)})it('DISABLES "new-file" with its reason when there is no cwd — the Dock keeps the row too', () => {diff --git a/src/renderer/lib/addMenuSpec.tsx b/src/renderer/lib/addMenuSpec.tsxindex ccc6fca07..6d158d071 100644--- a/src/renderer/lib/addMenuSpec.tsx+++ b/src/renderer/lib/addMenuSpec.tsx@@ -125,6 +125,8 @@ export const WORKTREE_SSH_HINT = 'Not supported in SSH projects yet'*/export const NEW_FILE_NO_CWD_HINT = 'This project has no folder — set one first (tab ⌄ → “Set folder…”)'export const WORKTREE_NO_CWD_HINT = NEW_FILE_NO_CWD_HINT+/** Same reason, same fix — a file manager has nothing to list without a project folder. */+export const FILES_NO_CWD_HINT = NEW_FILE_NO_CWD_HINT/*** Map the canonical content list to {@link MenuItem}s for the `ContextMenu` component.@@ -164,11 +166,18 @@ export function contentAddItemsToMenuItems(out.push({ label: 'New sticky note', icon: <IconNote />, onClick: () => handlers.sticky(at) })breakcase 'files':- // Needs a directory to root itself in — hidden on a cwd-less canvas for the same reason- // "New file…" is: an affordance that can only report "there is no folder" is not one.- if (ctx.hasCwd) {- out.push({ label: 'New file manager', icon: <IconExplorer />, onClick: () => handlers.files(at) })- }+ // A file manager needs a directory to root itself in. This row used to be HIDDEN on a+ // cwd-less canvas, reasoning that it was "the same as New file…" — and main has since+ // reversed exactly that rule (`NEW_FILE_NO_CWD_HINT`): a cwd-less project is a supported,+ // persisted canvas, so a folder-shaped row degrades EXPLICITLY rather than vanishing,+ // because a row that is gone takes its reason with it and the fix is one menu away.+ out.push({+ label: 'New file manager',+ icon: <IconExplorer />,+ disabled: !ctx.hasCwd,+ hint: ctx.hasCwd ? undefined : FILES_NO_CWD_HINT,+ onClick: () => handlers.files(at)+ })breakcase 'dino':out.push({ label: 'New dino game', icon: <IconDino />, onClick: () => handlers.dino(at) })@@ -258,9 +267,14 @@ export function contentAddItemsToDockRows(out.push({ kind: 'sticky', label: 'Sticky Note', icon: <IconNote />, onClick: () => handlers.sticky() })breakcase 'files':- if (ctx.hasCwd) {- out.push({ kind: 'files', label: 'File Manager', icon: <IconExplorer />, onClick: () => handlers.files() })- }+ out.push({+ kind: 'files',+ label: 'File Manager',+ icon: <IconExplorer />,+ disabled: !ctx.hasCwd,+ hint: ctx.hasCwd ? undefined : FILES_NO_CWD_HINT,+ onClick: () => handlers.files()+ })breakcase 'dino':out.push({ kind: 'dino', label: 'Dino Game', icon: <IconDino />, onClick: () => handlers.dino() })