Add a folder explorer to Index Project so nobody has to paste a path - #34
Merged
Merged
Conversation
Browsers never reveal a folder's real path to a page, so a native picker cannot hand a server a directory to index. Instead the API gains a directory-listing endpoint locked to the user's home directory (and any configured browse roots): real paths resolved before containment checks, directories only, hidden folders opt-in, out-of-root symlinks omitted and refused, traversal rejected, listings capped with a truncation flag, errors sanitized. The dashboard's Index Project flow gains a Browse button opening a proper dialog (Radix semantics, focus trapped and restored) with breadcrumbs, keyboard descent, project markers badged so real projects stand out, a hidden-folder toggle, and honest loading, error, empty, and truncated states. The path field stays for pasting, with the last five indexed paths one click away. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A Browse button on the Index Project flow that opens a server-backed folder explorer, replacing the copy-a-path-from-Finder routine. Browsers deliberately never reveal a folder's real path to a page, so a native picker or drag-and-drop cannot hand the server a directory; a localhost tool can browse the filesystem server-side instead.
API: GET /api/fs/directories
Lists immediate subdirectories of a path, or the browse roots without one (the home directory by default; CODEGRAPH_BROWSE_ROOTS can add more). Security posture, since this lists the filesystem: real paths resolved before containment checks; directories only, never files; hidden folders opt-in; out-of-root symlinks omitted from listings and refused if requested; traversal rejected; listings capped with a truncation flag; errors sanitized through the existing safe-error path. 16 route and helper tests against real temp directories.
Dashboard
A proper dialog (Radix semantics: focus trapped, Escape closes, focus returns to Browse) with breadcrumbs, keyboard descent, project markers badged so real projects stand out, a hidden-folder toggle, and honest loading, error, empty, and truncated states. The path field stays for pasting, and the last five indexed paths are one click away.
Verification
pnpm turbo build 21/21, test 36/36, typecheck 20/20. API suite 260 tests, dashboard suite with full dialog coverage including focus return and recent paths.
🤖 Generated with Claude Code