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(windows): name File Explorer in OS-reveal actions and hints

review435faec6bd80
diff --git a/src/renderer/components/ExplorerPanel.tsx b/src/renderer/components/ExplorerPanel.tsx
index 237f1449b..d547fbbcd 100644
--- a/src/renderer/components/ExplorerPanel.tsx
+++ b/src/renderer/components/ExplorerPanel.tsx
@@ -13,6 +13,7 @@ import { ROW_DOWNLOAD_TITLE, useDownloads, type RowDownloadState } from '../lib/
import { DownloadStrip } from './DownloadStrip'
import { explorerOverlayClickCloses } from '../lib/explorerPin'
import { isBrowserRuntime } from '../bridge/runtime'
+import { osRevealLabel } from '../lib/osReveal'
import { IconClose, IconPin, IconReload } from './icons'
export interface ExplorerPanelProps {
@@ -552,7 +553,7 @@ export function ExplorerPanel({
setMenu(null)
}}
>
- Reveal in Finder
+ {osRevealLabel()}
</button>
</>
)}
diff --git a/src/renderer/components/SourceControlPanel.tsx b/src/renderer/components/SourceControlPanel.tsx
index 4efb040ce..d485ecae3 100644
--- a/src/renderer/components/SourceControlPanel.tsx
+++ b/src/renderer/components/SourceControlPanel.tsx
@@ -21,6 +21,7 @@ import { defaultScmScope, type ScmScope } from '@shared/scm-scope'
import { chipFor, effectiveBindings } from '../lib/keybindingOverrides'
import { matchesShortcut } from '@shared/shortcut'
import { isMacPlatform } from '@shared/platform-utils'
+import { localRevealPath, osRevealLabel } from '../lib/osReveal'
import { gitStatusColor } from '../lib/gitStatusColors'
export interface SourceControlPanelProps {
@@ -781,11 +782,11 @@ export function SourceControlPanel({
<button
className="ctx-item"
onClick={() => {
- window.nodeTerminal.shell.reveal(`${cwd}/${fileMenu.path}`)
+ window.nodeTerminal.shell.reveal(localRevealPath(cwd, fileMenu.path))
setFileMenu(null)
}}
>
- Reveal in Finder
+ {osRevealLabel()}
</button>
</div>
</>,
diff --git a/src/renderer/lib/osReveal.test.ts b/src/renderer/lib/osReveal.test.ts
new file mode 100644
index 000000000..872340f17
--- /dev/null
+++ b/src/renderer/lib/osReveal.test.ts
@@ -0,0 +1,34 @@
+import { describe, expect, it } from 'vitest'
+import { localRevealPath, osFileManagerName, osRevealLabel } from './osReveal'
+
+describe('osRevealLabel', () => {
+ it('names each OS file manager', () => {
+ expect(osRevealLabel('darwin')).toBe('Reveal in Finder')
+ expect(osRevealLabel('win32')).toBe('Show in File Explorer')
+ expect(osRevealLabel('other')).toBe('Reveal in file manager')
+ })
+
+ it('never collides with the in-app Explorer drawer row on Windows', () => {
+ expect(osRevealLabel('win32')).not.toBe('Reveal in Explorer')
+ })
+})
+
+describe('osFileManagerName', () => {
+ it('is Finder / File Explorer / file manager', () => {
+ expect(osFileManagerName('darwin')).toBe('Finder')
+ expect(osFileManagerName('win32')).toBe('File Explorer')
+ expect(osFileManagerName('other')).toBe('file manager')
+ })
+})
+
+describe('localRevealPath', () => {
+ it('keeps the historical join on macOS and Linux byte for byte', () => {
+ expect(localRevealPath('/repo', 'src/a.ts', 'darwin')).toBe('/repo/src/a.ts')
+ expect(localRevealPath('/repo/', 'src/a.ts', 'other')).toBe('/repo//src/a.ts')
+ })
+
+ it('uses native separators on Windows', () => {
+ expect(localRevealPath('C:\\repo', 'src/dir/a.ts', 'win32')).toBe('C:\\repo\\src\\dir\\a.ts')
+ expect(localRevealPath('C:\\repo\\', 'a.ts', 'win32')).toBe('C:\\repo\\a.ts')
+ })
+})
diff --git a/src/renderer/lib/osReveal.ts b/src/renderer/lib/osReveal.ts
new file mode 100644
index 000000000..480f8b872
--- /dev/null
+++ b/src/renderer/lib/osReveal.ts
@@ -0,0 +1,39 @@
+import { isMacPlatform, isWindowsPlatform } from '@shared/platform-utils'
+
+/**
+ * Naming THIS machine's file manager. Viewer-platform is correct here (unlike file-link dialects,
+ * which follow the filesystem-owning core): every caller is already gated by `canRevealLocally` /
+ * `canUseLocalShell`, i.e. "the desktop app hands a local path to its own OS".
+ */
+export type RevealOs = 'darwin' | 'win32' | 'other'
+
+export function viewerRevealOs(): RevealOs {
+ if (isMacPlatform()) return 'darwin'
+ if (isWindowsPlatform()) return 'win32'
+ return 'other'
+}
+
+/** "Finder" / "File Explorer" / "file manager". */
+export function osFileManagerName(os: RevealOs = viewerRevealOs()): string {
+ return os === 'darwin' ? 'Finder' : os === 'win32' ? 'File Explorer' : 'file manager'
+}
+
+/**
+ * The OS-reveal menu label. Windows says "Show in File Explorer" — deliberately NOT "Reveal in
+ * Explorer", which is the link menu's row for the in-app Explorer DRAWER.
+ */
+export function osRevealLabel(os: RevealOs = viewerRevealOs()): string {
+ if (os === 'darwin') return 'Reveal in Finder'
+ if (os === 'win32') return 'Show in File Explorer'
+ return 'Reveal in file manager'
+}
+
+/**
+ * Join a repo-relative git path (always `/`-separated) onto a local checkout for the OS reveal.
+ * Windows gets one native separator throughout; every other platform keeps the historical
+ * `${cwd}/${rel}` byte for byte.
+ */
+export function localRevealPath(cwd: string, rel: string, os: RevealOs = viewerRevealOs()): string {
+ if (os !== 'win32') return `${cwd}/${rel}`
+ return `${cwd.replace(/[\\/]+$/, '')}\\${rel.replace(/\//g, '\\')}`
+}
diff --git a/src/renderer/nodes/FilesNode.tsx b/src/renderer/nodes/FilesNode.tsx
index 24540f58b..b84c5a58c 100644
--- a/src/renderer/nodes/FilesNode.tsx
+++ b/src/renderer/nodes/FilesNode.tsx
@@ -55,6 +55,7 @@ import { promptDialog } from '../components/promptDialog'
import { ContextMenu, type MenuItem } from '../components/ContextMenu'
import { isBrowserRuntime } from '../bridge/runtime'
import { canUseLocalShell, downloadRoute } from '../lib/download'
+import { osRevealLabel } from '../lib/osReveal'
import { ROW_DOWNLOAD_TITLE, useDownloads, type RowDownloadState } from '../lib/useDownloads'
import { DownloadStrip } from '../components/DownloadStrip'
@@ -368,7 +369,7 @@ export function FilesNode({ id, data, selected }: NodeProps<CanvasNode>) {
onClick: () => api.clipboard.writeText(path)
})
if (localShell) {
- items.push({ label: 'Reveal in file manager', onClick: () => api.shell.reveal(path) })
+ items.push({ label: osRevealLabel(), onClick: () => api.shell.reveal(path) })
}
setMenu({ x: e.clientX, y: e.clientY, items })
},
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index 7a49858f8..c04579534 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -3275,6 +3275,7 @@ export function TerminalNode({
abs: target.abs,
dir: target.dir,
mac: isMac,
+ windows: isWindowsPlatform(),
systemOpen: systemOpenRefusal(shellCtx(), target.abs) === null
}),
ev.clientX,
diff --git a/src/renderer/terminal/link-hover.test.ts b/src/renderer/terminal/link-hover.test.ts
index ca61a5b53..44fc40ca7 100644
--- a/src/renderer/terminal/link-hover.test.ts
+++ b/src/renderer/terminal/link-hover.test.ts
@@ -47,6 +47,9 @@ describe('fileLinkHint', () => {
expect(fileLinkHint({ abs: '/p/src', dir: true, mac: false, systemOpen: true })).toBe(
'/p/src (Ctrl-click to reveal · Shift+Ctrl-click to open in file manager)'
)
+ expect(fileLinkHint({ abs: 'C:\\p\\src', dir: true, mac: false, windows: true, systemOpen: true })).toBe(
+ 'C:\\p\\src (Ctrl-click to reveal · Shift+Ctrl-click to open in File Explorer)'
+ )
})
it('does not advertise the OS-app gesture where it cannot work', () => {
expect(fileLinkHint({ abs: '/p/a.ts', dir: false, mac: true, systemOpen: false })).toBe(
diff --git a/src/renderer/terminal/link-hover.ts b/src/renderer/terminal/link-hover.ts
index ac6579daa..0328cbaa7 100644
--- a/src/renderer/terminal/link-hover.ts
+++ b/src/renderer/terminal/link-hover.ts
@@ -12,6 +12,7 @@
// Pure pieces (the modifier routing, the hint text, the per-surface refusal) are separate from the
// one DOM piece (the tooltip), so every decision is unit-testable without a terminal.
import { canUseLocalShell, type DownloadContext } from '../lib/download'
+import { osFileManagerName } from '../lib/osReveal'
/** What a modified click on a link asks for. `system` = hand it to the OS default app. */
export type LinkOpenIntent = 'none' | 'open' | 'system'
@@ -37,6 +38,8 @@ export interface FileHintOpts {
dir: boolean
/** macOS glyphs (⌘ ⇧) vs spelled-out Ctrl/Shift. */
mac: boolean
+ /** Windows names its file manager "File Explorer" in the directory hint. */
+ windows?: boolean
/** Shift+modifier-click can hand the path to the OS here (`systemOpenRefusal` answered null).
* When it cannot, the gesture is not advertised — a hint promising a click that only toasts
* would be worse than no hint. */
@@ -44,14 +47,15 @@ export interface FileHintOpts {
}
/** The hover text for a file or directory link. */
-export function fileLinkHint({ abs, dir, mac, systemOpen }: FileHintOpts): string {
+export function fileLinkHint({ abs, dir, mac, windows, systemOpen }: FileHintOpts): string {
const m = mod(mac)
const shift = mac ? '⇧⌘' : 'Shift+Ctrl'
// A plain modified click on a directory reveals it in the Explorer drawer (TerminalNode's
// `openFile`), not an editor — say so.
const parts = [dir ? `${m}-click to reveal` : `${m}-click to open`]
if (systemOpen) {
- parts.push(dir ? `${shift}-click to open in ${mac ? 'Finder' : 'file manager'}` : `${shift}-click to open with default app`)
+ const manager = osFileManagerName(mac ? 'darwin' : windows ? 'win32' : 'other')
+ parts.push(dir ? `${shift}-click to open in ${manager}` : `${shift}-click to open with default app`)
}
return `${abs} (${parts.join(' · ')})`
}
diff --git a/src/renderer/terminal/link-menu.test.ts b/src/renderer/terminal/link-menu.test.ts
index 9c5c6e733..80083f67c 100644
--- a/src/renderer/terminal/link-menu.test.ts
+++ b/src/renderer/terminal/link-menu.test.ts
@@ -30,6 +30,7 @@ function recorder(): { calls: string[]; act: LinkMenuActions } {
const LOCAL_DESKTOP: LinkMenuContext = {
route: 'none',
localShell: true,
+ os: 'darwin',
explorerRoot: '/home/me/proj',
terminals: true,
downloading: () => false
@@ -121,6 +122,14 @@ describe('linkMenuItems — file', () => {
])
})
+ it('Windows desktop names File Explorer, distinct from the in-app Explorer drawer row', () => {
+ const target: LinkMenuTarget = { kind: 'file', abs: '/home/me/proj/a.csv', dir: false }
+ const items = labels(linkMenuItems(target, { ...LOCAL_DESKTOP, os: 'win32' }, recorder().act))
+ expect(items).toContain('Show in File Explorer')
+ expect(items).toContain('Reveal in Explorer')
+ expect(items).not.toContain('Reveal in Finder')
+ })
+
it('Server Edition: the HTTP route has no "Download to…" and no OS reveal', () => {
const ctx: LinkMenuContext = { ...LOCAL_DESKTOP, route: 'http', localShell: false }
const items = linkMenuItems({ kind: 'file', abs: '/home/me/proj/a.csv', dir: false }, ctx, recorder().act)
diff --git a/src/renderer/terminal/link-menu.ts b/src/renderer/terminal/link-menu.ts
index 7a3afc80e..74e1256ac 100644
--- a/src/renderer/terminal/link-menu.ts
+++ b/src/renderer/terminal/link-menu.ts
@@ -15,6 +15,7 @@ import type { MenuItem } from '../components/ContextMenu'
import type { DownloadRoute } from '../lib/download'
import { downloadMenuEntries } from '../lib/filesNode'
import { tidySeparators } from '../lib/tidySeparators'
+import { osRevealLabel, type RevealOs } from '../lib/osReveal'
import { findExistingForHit, type LinkHit, type PathResolution } from './file-links'
/** What a right-click resolved to, once a path's existence is known. */
@@ -34,6 +35,8 @@ export interface LinkMenuContext {
route: DownloadRoute
/** `canUseLocalShell` — this machine's file manager can act on the path. */
localShell: boolean
+ /** Which OS file manager the reveal row names; defaults to the viewer's. */
+ os?: RevealOs
/** The Explorer drawer's root. Its reveal only works INSIDE that root (anything else opens the
* drawer onto nothing), so the row is withheld outside it. */
explorerRoot?: string
@@ -139,6 +142,6 @@ export function linkMenuItems(
items.push({ type: 'separator' })
items.push({ label: 'Copy path', onClick: () => act.copy(abs) })
if (rel !== null) items.push({ label: 'Copy relative path', onClick: () => act.copy(rel) })
- if (ctx.localShell) items.push({ label: 'Reveal in Finder', onClick: () => act.revealInOs(abs) })
+ if (ctx.localShell) items.push({ label: osRevealLabel(ctx.os), onClick: () => act.revealInOs(abs) })
return tidySeparators(items)
}