Skip to content

feat(files): let the path picker jump to a typed path and sort by name or date - #399

Open
shenlvkang-collab wants to merge 1 commit into
Ark0N:masterfrom
shenlvkang-collab:pr/path-picker-sort-jump
Open

feat(files): let the path picker jump to a typed path and sort by name or date#399
shenlvkang-collab wants to merge 1 commit into
Ark0N:masterfrom
shenlvkang-collab:pr/path-picker-sort-jump

Conversation

@shenlvkang-collab

Copy link
Copy Markdown
Contributor

Summary

The shared filesystem path picker (Link Existing, the mobile keyboard's 📁 Path key, the Docker workspace picker) had two gaps that made it slow to use on a phone:

  • The current-folder line was a read-only breadcrumb, so reaching a deep folder meant tapping through every level.
  • The listing was fixed to name order, so the file an agent had just written was somewhere in a 500-entry list.

This PR:

  • Editable path field. The current folder is an <input>: type or paste a path and press Enter (or Go) to jump there. A full file path lands in its folder with that file selected (one Enter away from Select). A path that does not resolve keeps the listing you had and shows the server's message, instead of the reset-to-root that a stale initialPath gets (that fallback is unchanged for non-typed loads). The listing is fetched only on submit, never per keystroke.
  • Sort control. Name A→Z / Z→A, Newest / Oldest first. Folders always come first (a date sort is for finding the file you just made; the folders are the way past it). The choice is remembered per device (codeman:pathPickerSort), like the show-hidden toggle. Re-sorting is client-side, no round trip, selection kept.
  • Modified time per entry, compact (time of day today, month-day this year, else the date), with the full timestamp on hover.
  • GET /api/filesystem/browse entries carry mtimeMs. The stat that already fetched a file's size now serves both, so it is still one stat per entry. Entries without an mtime (an older server, the in-container listing) sort after dated ones and then by name, so the order is always stable.

Docs: docs/wiki/Working-With-Files.md (path picker section). Changeset: minor.

Test plan

  • test/path-picker-sort.test.ts (new, jsdom): default order, re-sort without a request, persistence, corrupt/throwing localStorage, undated entries, modified label, typed-path jump, error keeps listing, file path → parent + selected, Select Current Folder / Refresh use the field.
  • test/routes/file-routes.test.ts: entries stamped with mtimeMs (file, directory, symlink) with exactly one stat per entry.
  • test/path-picker-hidden.test.ts, test/path-picker-ui.test.ts, test/frontend-public-tooling.test.ts unchanged and green.
  • tsc --noEmit, eslint on the touched TS, prettier on all touched files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01McLWqCWBuQYGuPMScb4Aou

…e or date

The picker's current-folder line was a read-only breadcrumb, so reaching a
deep folder meant tapping through every level, and the listing was fixed to
name order, so the file an agent had just written was somewhere in a
500-entry list.

The current folder is now an editable field: Enter or Go jumps there, a full
file path lands in its folder with that file selected, and a path that does
not resolve keeps the listing you had and says so, instead of the reset to
the root that a stale initialPath gets. A Sort control orders the listing by
name or modified time in either direction, folders always first, and the
choice is remembered per device like the hidden toggle. Each entry shows a
compact modified time (time of day today, month-day this year, else the
date).

GET /api/filesystem/browse stamps every entry with mtimeMs to make that
possible; the stat that already fetched a file's size now serves both, so
it is still one stat per entry. Entries without an mtime (an older server,
the in-container listing) sort after dated ones and then by name.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01McLWqCWBuQYGuPMScb4Aou
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