Skip to content

feat: add Files tab for inline project file browsing#3470

Open
dcieslak19973 wants to merge 1 commit into
coder:mainfrom
dcieslak19973:feat/file-browser
Open

feat: add Files tab for inline project file browsing#3470
dcieslak19973 wants to merge 1 commit into
coder:mainfrom
dcieslak19973:feat/file-browser

Conversation

@dcieslak19973
Copy link
Copy Markdown

Closes #3443

Summary

  • Adds a Files tab to the right sidebar, feature-gated behind a new FILE_BROWSER experiment flag (disabled by default, user-toggleable in Settings → Experiments)
  • New listProjectFiles and readProjectFile IPC endpoints on the backend with path-traversal protection and binary file detection
  • File tree shows directories first, then files alphabetically; clicking a directory navigates into it with breadcrumb navigation
  • Markdown files rendered via the existing MarkdownRenderer; all other files syntax-highlighted via HighlightedCode (Shiki) — HTML is shown as highlighted source, never live-rendered (XSS prevention)
  • Breadcrumb uses pathDirname walk rather than string splitting — correct on both Windows (backslash) and POSIX paths
  • Stale request cancellation: AbortController cleanup in useEffect for directory listing; load-ID counter for file reads

Design decisions

  • Follows the existing Agent Browser / Portable Desktop featureFlag gating pattern exactly
  • Reuses MarkdownRenderer and HighlightedCode rather than adding new renderers
  • Separate listProjectFiles endpoint (returns files + dirs) rather than reusing the existing listDirectory (dirs only) to avoid breaking DirectoryPickerModal
  • 512 KB read cap with truncation warning; binary files (null-byte detection) rejected with a user-visible error

Test plan

  • Enable "File Browser" in Settings → Experiments
  • Files tab appears in right sidebar
  • Can browse directories and navigate with breadcrumbs
  • Markdown files render formatted
  • Code files render with syntax highlighting and line numbers
  • HTML files show as highlighted source (not rendered)
  • Binary files show an error message
  • Disabling the experiment removes the tab

🤖 Generated with Claude Code

Adds a feature-gated Files tab to the right sidebar that lets users
browse and read project files (markdown, code, HTML) inline without
leaving mux.

- New FILE_BROWSER experiment flag (disabled by default, user-toggleable)
- listProjectFiles + readProjectFile IPC endpoints with path-traversal
  protection (path.relative guard) and binary file detection (null-byte scan)
- Files tab registered in tabConfig/tabRegistry with featureFlag gate,
  mirroring the existing Agent Browser and Portable Desktop pattern
- FilesTab component: collapsible file tree (dirs-first) + content viewer
- Markdown rendered via MarkdownRenderer, code via HighlightedCode (Shiki)
- HTML shown as syntax-highlighted source, never live-rendered (XSS prevention)
- Breadcrumb navigation via pathDirname walk — Windows-safe, no separator assumptions
- Stale request cancellation: AbortController for dir listing, load-ID counter for file reads

Closes coder#3443

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

(Feature Request) - File Browser / rendering

1 participant