feat(connect): list server filesystem roots/drives in directory browser - #100
Merged
Conversation
…er (closes #57) The directory browser could only descend from a manually-typed path since the SDK had no way to enumerate the server's filesystem roots (multiple drives on Windows, mount points, home dir). Add file.roots() to sdk.ts (GET /file/roots, added server-side in dzianisv/opencode#238) and show the results as pinned top-level chips in DirectoryBrowserSheet that jump straight into that root. Degrades gracefully: older servers 404 on the new endpoint, which the SDK turns into null, normalizeRoots() turns into an empty list, and the browser just shows no chips — manual "Jump to path" entry keeps working exactly as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #57.
Summary
file.roots()tosrc/lib/sdk.ts, callingGET /file/rootson the connected server (added server-side in dzianisv/opencode#238). Resolves tonullon a 404 (older servers without the endpoint) instead of throwing.src/lib/file-roots.ts(normalizeRoots) — pure validation/dedup of the raw response: drops malformed entries, falls back label to path, dedupes by path, and normalizes any non-array/nullinput to[].DirectoryBrowserSheet.tsxfetches roots when the sheet opens and renders them as pinned, tappable chips (home dir, drives, mount points) above the existing "Jump to path" input, so users no longer have to already know a path to start browsing multi-drive/multi-project servers.Depends on
This is client-only wiring for dzianisv/opencode#238 (
GET /file/roots). Until that server PR merges and ships,file.roots()gets a 404 from every server,normalizeRootsturns that into[], and the browser shows zero chips — the existing manual "Jump to path" flow is unaffected. No crash, no regression, degrades cleanly.Test plan
npm install && npm test— 160/160 pass (addssrc/lib/file-roots.test.ts: well-formed entries,null/undefined/non-array input, missing/blank path or label, non-string path, dedup by path, non-object array items)npx tsc --noEmit— clean#238build (multiple drives/mounts show as pinned chips; older server shows none, browser still works via manual path)🤖 Generated with Claude Code