Below are generated by agents:
Problem
The Files tab (FileTreeView) always shows directories first, then files by name. That order comes straight from the server: GET /file returns FileNode[] with only name, path, absolute, type, ignored, and upstream File.list sorts by a.name.localeCompare(b.name). The client does no local sorting (visibleNodes just flattens fileTreeRoot).
When revisiting a project, I usually want the most recently touched files on top, not an alphabetical walk.
Expected
A sort toggle in the Files tab: Name (current behavior, default) vs. Modified (most recent first). Keep directories-first to avoid confusion, only change ordering within each group. Persist the choice.
Suggested fix
Two small additive changes:
- Server: add optional mtime to File.Node in packages/opencode/src/file/index.ts (stat per entry in File.list). Old clients ignore unknown keys, so backward compatible.
- Client: decode let mtime: Double? in FileNode (Services/APIClient.swift:543), sort in FileTreeView.visibleNodes when the toggle is set, fall back to name when mtime is nil (older servers).
Below are generated by agents:
Problem
The Files tab (FileTreeView) always shows directories first, then files by name. That order comes straight from the server: GET /file returns FileNode[] with only name, path, absolute, type, ignored, and upstream File.list sorts by a.name.localeCompare(b.name). The client does no local sorting (visibleNodes just flattens fileTreeRoot).
When revisiting a project, I usually want the most recently touched files on top, not an alphabetical walk.
Expected
A sort toggle in the Files tab: Name (current behavior, default) vs. Modified (most recent first). Keep directories-first to avoid confusion, only change ordering within each group. Persist the choice.
Suggested fix
Two small additive changes: