Skip to content

feat(artifacts): open binary files & the folder with the OS app#108

Merged
juacker merged 1 commit into
mainfrom
feat/artifacts-open-external
Jul 12, 2026
Merged

feat(artifacts): open binary files & the folder with the OS app#108
juacker merged 1 commit into
mainfrom
feat/artifacts-open-external

Conversation

@juacker

@juacker juacker commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

What

Two artifacts-drawer improvements (PR A of the three you raised):

1. Open binary/rich files with the OS app (fixes the PDF error)

Clicking a .pdf (or any non-text file) in the artifacts tree used to open the in-app text preview, which then failed with "does not contain UTF-8 text". Now such files launch the OS default application instead.

  • viewer_for_path gains an "external" class for documents (pdf, doc/docx, xls/xlsx, ppt/pptx, odt/ods/odp, rtf, epub), images (png/jpg/gif/webp/…), audio/video, archives (zip/tar/7z/…), and binaries (exe/dll/so/wasm/jar/sqlite/db/parquet/fonts).
  • Clicking an external tree row calls open_workspace_path(ws, path, "system") — the injection-safe OS-open machinery from fix(system-apps): make "open in editor/terminal" cross-platform #80 (xdg-open / explorer.exe / open).
  • Belt-and-braces: the preview error state now shows an "Open with the system app" button, so an unrecognized binary extension that still falls through to the text reader has an escape hatch.
  • Note: images are routed externally for now (no inline image preview yet — that's a separate follow-up).

2. Open the workspace folder in the file browser

New icon in the artifacts drawer header (next to open-in-editor / open-in-terminal) that opens the workspace root in the OS file manager — open_workspace_path(ws, null, "system"), which on a directory opens Files/Explorer/Finder.

Verification

  • Backend: cargo fmt + new unit test viewer_for_path_classifies_binary_as_external (pdf/png/zip/sqlite → external; md/rs/json unchanged).
  • FE: tsc / eslint / vitest (132) / vite build clean.
  • No bindings change (viewer was already a string field).

Test locally

  • Click a PDF/image/zip artifact → it opens in the OS app, no error.
  • Artifacts drawer header → the new folder icon opens your file manager at the workspace root.
  • (Edge) open a binary with an extension not in the list via the preview → the error card offers "Open with the system app".

Next up (separately, as agreed): PR B — drag-and-drop copy of artifacts between workspaces.

Two artifacts-drawer improvements:

1. Binary/rich files (pdf, office docs, images, archives, media, db,
   fonts, binaries) now open in the OS default application instead of the
   in-app text preview, which failed with a UTF-8 error. viewer_for_path
   classifies these as "external"; clicking such a tree row launches the
   OS app (open_workspace_path target "system", from the #80 machinery).
   The preview error state also gains an "Open with the system app" button
   for unrecognized binary extensions that still fall through.

2. New "open the workspace folder in your file browser" icon in the
   artifacts drawer header (Files/Explorer/Finder), alongside the existing
   open-in-editor / open-in-terminal actions.
@juacker
juacker marked this pull request as ready for review July 12, 2026 14:51
@juacker
juacker merged commit 1011834 into main Jul 12, 2026
2 checks 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.

1 participant