Skip to content

feat(connect): list server filesystem roots/drives in directory browser - #100

Merged
dzianisv merged 1 commit into
mainfrom
fix/issue-57-drives
Jul 17, 2026
Merged

feat(connect): list server filesystem roots/drives in directory browser#100
dzianisv merged 1 commit into
mainfrom
fix/issue-57-drives

Conversation

@dzianisv

Copy link
Copy Markdown
Owner

Closes #57.

Summary

  • Adds file.roots() to src/lib/sdk.ts, calling GET /file/roots on the connected server (added server-side in dzianisv/opencode#238). Resolves to null on a 404 (older servers without the endpoint) instead of throwing.
  • Adds 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/null input to [].
  • DirectoryBrowserSheet.tsx fetches 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, normalizeRoots turns 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 (adds src/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
  • Manual verification against a server running the #238 build (multiple drives/mounts show as pinned chips; older server shows none, browser still works via manual path)

🤖 Generated with Claude Code

…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>
@dzianisv
dzianisv merged commit 9a24cea into main Jul 17, 2026
5 of 6 checks passed
@dzianisv
dzianisv deleted the fix/issue-57-drives branch July 17, 2026 17:24
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.

Multiple drives/projects not shown on connection - only default drives appear

1 participant