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(files-node): keep ~-relative breadcrumbs relative
reviewb1c54ae86b22
diff --git a/src/renderer/lib/filesNode.test.ts b/src/renderer/lib/filesNode.test.tsindex 4092790ba..ddb2dfcd1 100644--- a/src/renderer/lib/filesNode.test.ts+++ b/src/renderer/lib/filesNode.test.ts@@ -42,6 +42,29 @@ describe('breadcrumbs', () => {it('does not collapse a path that exactly fits', () => {expect(breadcrumbs('/a/b/c', 3).map((c) => c.name)).toEqual(['/', 'a', 'b', 'c'])})++ // An SSH project's remoteCwd DEFAULTS to `~`, so a remote files node routinely stands on a+ // `~`-relative path. Prefixing `/` to such crumbs produced `/~/remotion-app` — a literal path+ // that does not exist on the host — so clicking any crumb but the last answered "Could not+ // reach this folder." The crumbs must keep the path's own root instead of inventing one.+ it('keeps a ~-relative path relative (no invented / root)', () => {+ expect(breadcrumbs('~/remotion-app/OUT-1.0.14')).toEqual([+ { name: '~', path: '~' },+ { name: 'remotion-app', path: '~/remotion-app' },+ { name: 'OUT-1.0.14', path: '~/remotion-app/OUT-1.0.14' }+ ])+ })++ it('is just home at a bare ~', () => {+ expect(breadcrumbs('~')).toEqual([{ name: '~', path: '~' }])+ })++ it('collapses a deep relative path without an absolute ellipsis target', () => {+ const crumbs = breadcrumbs('~/one/two/three/four/five', 3)+ expect(crumbs.map((c) => c.name)).toEqual(['~', '…', 'three', 'four', 'five'])+ expect(crumbs[1].path).toBe('~/one/two')+ expect(crumbs[crumbs.length - 1].path).toBe('~/one/two/three/four/five')+ })})describe('folderTitle', () => {diff --git a/src/renderer/lib/filesNode.ts b/src/renderer/lib/filesNode.tsindex b91184c6e..2d85f4e1b 100644--- a/src/renderer/lib/filesNode.ts+++ b/src/renderer/lib/filesNode.ts@@ -37,15 +37,23 @@ export interface Crumb {*/export function breadcrumbs(path: string, max = 3): Crumb[] {const segs = path.split('/').filter(Boolean)- const all: Crumb[] = [{ name: '/', path: '/' }]+ // The crumbs keep the path's OWN root rather than inventing `/`. An SSH project's `remoteCwd`+ // defaults to `~` (SshSection), so a remote files node routinely stands on `~/a/b`; prefixing+ // every crumb with `/` turned the `a` crumb into the literal `/~/a`, which exists on no host —+ // the listing came back empty, so did its parent `/~`, and the node reported "Could not reach+ // this folder." for a directory it had been showing a second earlier. A relative path has no+ // root crumb: its first segment (`~`) IS the top the user can climb to from here.+ const absolute = path.startsWith('/')+ const all: Crumb[] = absolute ? [{ name: '/', path: '/' }] : []let acc = ''for (const s of segs) {- acc += `/${s}`+ acc = (acc || absolute) ? `${acc}/${s}` : s // first relative segment carries no separatorall.push({ name: s, path: acc })}if (all.length <= max + 1) return all- // Keep root, then an ellipsis crumb that navigates to the deepest hidden directory, then the- // tail. `max + 1` accounts for root, which is never dropped.+ // Keep the first crumb (root, or the relative top), then an ellipsis crumb that navigates to+ // the deepest hidden directory, then the tail. `max + 1` accounts for that first crumb, which is+ // never dropped.const hidden = all.slice(1, all.length - max)const ellipsis: Crumb = { name: '…', path: hidden[hidden.length - 1].path }return [all[0], ellipsis, ...all.slice(all.length - max)]