Skip to content

feat(files): add Show in Finder to file tree context menu#2869

Merged
arnestrickmann merged 1 commit into
generalaction:mainfrom
piter10p:emdash/show-file-in-explorer-0s6g3
Jul 15, 2026
Merged

feat(files): add Show in Finder to file tree context menu#2869
arnestrickmann merged 1 commit into
generalaction:mainfrom
piter10p:emdash/show-file-in-explorer-0s6g3

Conversation

@piter10p

@piter10p piter10p commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a platform-aware "Show in Finder" / "Show in File Explorer" / "Show in File Manager" item to the Files tab right-click menu. The renderer resolves the absolute path through the workspace-scoped getAbsolutePath RPC, then a new app.showItemInFolder RPC calls Electron's shell.showItemInFolder behind the same home-jail path validation as openPath. Hidden for SSH workspaces since the file does not exist on the local disk.

This feature is a nice have. I'm often creating report files in md formats and this change allows me to quickly show them in finder allowing for copying, sending them to someone etc.

Related issues

No issue related

Testing

  • App service unit tests: vitest run src/main/core/app/service.test.ts — 6 tests passed, including the 2 new showItemInFolder ones
  • Full desktop app suite: @emdash/emdash-desktop test target (node, main-db, migrations, browser, scripts projects) — 315/315 test files passed
  • Full workspace suite: root Nx pnpm run test — all packages green except 5 pre-existing failures that also exist on main and are unrelated to this change (@emdash/runtime session-manager ×2, @emdash/ui serialize ×1, @emdash/plugins Claude ACP ×2)
  • Root Nx pnpm run typecheck — 9 projects
  • Root Nx pnpm run lint — 9 projects
  • Root Nx pnpm run format — 9 projects
  • Manual end-to-end check: launched the dev app and verified "Show in Finder" works. Only on macOS.

Screenshot/Recording (if applicable)

obraz obraz
Checklist
  • I kept this PR small and focused
  • I ran a self-review before opening this PR
  • I ran the relevant local checks or explained why not
  • I updated docs when behavior or setup changed
  • I added or updated tests when behavior changed, or explained why not
  • I only added comments where the logic is not obvious
  • I used Conventional Commits for commit
    messages and, when possible, the PR title

Adds a platform-aware "Show in Finder" / "Show in File Explorer" /
"Show in File Manager" item to the Files tab right-click menu. The
renderer resolves the absolute path through the workspace-scoped
getAbsolutePath RPC, then a new app.showItemInFolder RPC calls
Electron's shell.showItemInFolder behind the same home-jail path
validation as openPath. Hidden for SSH workspaces since the file does
not exist on the local disk.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a file-manager reveal action to the file tree context menu. The main changes are:

  • Platform-specific labels for Finder, File Explorer, and File Manager.
  • A renderer action that resolves the selected workspace file path.
  • A new app.showItemInFolder RPC backed by Electron shell.
  • Unit tests for the new app service method.

Confidence Score: 4/5

The new reveal flow needs a validation fix before merging.

  • Valid local workspace files can be rejected when the workspace is outside the user's home directory.
  • The new shell reveal RPC is home-scoped, while the UI flow is workspace-scoped.
  • The renderer menu wiring and platform label logic otherwise follow existing patterns.

apps/emdash-desktop/src/main/core/app/service.ts

Security Review

The new app RPC exposes a home-scoped shell reveal operation to renderer callers. It is guarded by the existing home-jail check, but it is not scoped to the workspace that the UI action represents.

Important Files Changed

Filename Overview
apps/emdash-desktop/src/main/core/app/controller.ts Adds a new showItemInFolder RPC handler with the same result shape as nearby app handlers.
apps/emdash-desktop/src/main/core/app/service.ts Adds the Electron shell reveal call, but applies home-scoped validation to a workspace-scoped UI flow.
apps/emdash-desktop/src/main/core/app/service.test.ts Adds service tests for revealing a home path and rejecting a path outside home.
apps/emdash-desktop/src/renderer/features/tasks/editor/editor-file-tree.tsx Adds the context-menu item, platform label, SSH guard, and async reveal flow.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/emdash-desktop/src/main/core/app/service.ts:227-228
**Workspace Paths Outside Home Fail**

When a local workspace lives outside the user's home directory, `workspace.files.getAbsolutePath` can resolve a valid workspace file, but this new service path rejects it with `Path must be inside the user home directory`. The context-menu action then shows a failure toast instead of revealing a valid local file.

### Issue 2 of 2
apps/emdash-desktop/src/main/core/app/service.ts:227-228
**Reveal Scope Is Home-Wide**

This RPC accepts any renderer-supplied path and only checks that the real path is under the user's home directory. If renderer code calls `rpc.app.showItemInFolder` directly with a home path unrelated to the current workspace, Electron will reveal it, so the new shell capability is broader than the workspace-scoped file-tree action that reaches it.

Reviews (1): Last reviewed commit: "feat(files): add Show in Finder to file ..." | Re-trigger Greptile

Comment on lines +227 to +228
const realPath = await resolveHomeJailedPath(rawPath);
shell.showItemInFolder(realPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Workspace Paths Outside Home Fail

When a local workspace lives outside the user's home directory, workspace.files.getAbsolutePath can resolve a valid workspace file, but this new service path rejects it with Path must be inside the user home directory. The context-menu action then shows a failure toast instead of revealing a valid local file.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/emdash-desktop/src/main/core/app/service.ts
Line: 227-228

Comment:
**Workspace Paths Outside Home Fail**

When a local workspace lives outside the user's home directory, `workspace.files.getAbsolutePath` can resolve a valid workspace file, but this new service path rejects it with `Path must be inside the user home directory`. The context-menu action then shows a failure toast instead of revealing a valid local file.

**Context Used:** AGENTS.md ([source](https://app.greptile.com/emdash/github/generalaction/emdash/-/custom-context?memory=c9624c9f-4bb0-42b3-aa19-4ea456b59255))

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a deliberate consistency choice rather than an oversight: showItemInFolder reuses the exact home-jail policy that openPath already applies (terminal file links have the same limitation today), so this PR doesn't introduce a new restriction, it inherits an existing one.

Comment on lines +227 to +228
const realPath = await resolveHomeJailedPath(rawPath);
shell.showItemInFolder(realPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 security Reveal Scope Is Home-Wide

This RPC accepts any renderer-supplied path and only checks that the real path is under the user's home directory. If renderer code calls rpc.app.showItemInFolder directly with a home path unrelated to the current workspace, Electron will reveal it, so the new shell capability is broader than the workspace-scoped file-tree action that reaches it.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/emdash-desktop/src/main/core/app/service.ts
Line: 227-228

Comment:
**Reveal Scope Is Home-Wide**

This RPC accepts any renderer-supplied path and only checks that the real path is under the user's home directory. If renderer code calls `rpc.app.showItemInFolder` directly with a home path unrelated to the current workspace, Electron will reveal it, so the new shell capability is broader than the workspace-scoped file-tree action that reaches it.

**Context Used:** AGENTS.md ([source](https://app.greptile.com/emdash/github/generalaction/emdash/-/custom-context?memory=c9624c9f-4bb0-42b3-aa19-4ea456b59255))

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't widen the renderer's existing capability surface: rpc.app.openPath already accepts any home-jailed path and opens the file with its default handler, which is strictly more powerful than revealing it in Finder, and readUserFile can already read any file under home. showItemInFolder follows the same established policy and is the least powerful of the three.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair and correct point. openPath is indeed strictly more powerful — it can trigger execution via the OS default handler — and readUserFile can exfiltrate content. showItemInFolder is read-only metadata exposure at most, and the home-jail policy is consistently applied across all three. The new RPC doesn't expand the attack surface beyond what's already present.

I'll withdraw the concern.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@arnestrickmann

Copy link
Copy Markdown
Contributor

Thank you for the PR - I think this is a great addition. Especially for opening one specific file in the Finder rather than opening the whole project via the "Open in Finder" option from the header bar.
CleanShot 2026-07-15 at 16 16 44@2x

@arnestrickmann
arnestrickmann merged commit c6dc70b into generalaction:main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants