Repository navigation
feat(files): list a pane folder's Markdown files in Files, opt-in (#1196) - #3073
Conversation
) Settings > Chat > Documents in Files (off by default) adds a Documents tab to Files: the .md/.markdown files under the pane's folder, newest first, with a filter and Refresh; a row opens the file viewer. Read only. GET /api/pane/docs filters the @-mention inventory and reads sizes and times on a file thread, capped at 2,000 names looked at and 500 listed. It is gated like /api/pane/files: refused to a watching device, forwarded to other PCs, 501 on a herdr-core machine's own server.
# Conflicts: # server/file-pool.ts # server/file-tasks.ts # server/machine-api.ts # shared/files.ts # src/lib/api.ts # src/lib/i18n.test.ts # src/lib/i18n/files.ja.ts # src/lib/i18n/files.ko.ts # src/lib/i18n/files.zh.ts # src/lib/settings.legacy-fixture.ts # src/lib/settings.ts
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
… wherever it sorts (#1196) Review round: a listing reads on its file thread for at most 2 s and counts as a scan (at most two threads), and the request's abort reaches it. It stats every Markdown file git lists, asked afresh, instead of the first 2,000 names, and outside a repository walks Markdown files only, so other files no longer crowd a note out; any cap or the time limit marks the list cut, which the tab says without claiming the newest are shown.
# Conflicts: # src/lib/settings.legacy-fixture.ts # src/lib/settings.ts
|
Review round (omo + Codex Terra) on 9456ed6, fixed in 7ff0796:
CodeRabbit hit its review limit on this PR, so it did not review this head. |
A listing counted against the two scan threads, so two stalled listings left a commands scan waiting until it timed out. It now runs only while no other listing does, outside the scan count: commands scans keep both their threads and file tasks keep one.
|
Second review round on b8d4fa7 (omo: CLEAR; Codex Terra: BLOCK on one HIGH), fixed in c94745f:
Left as they are (MEDIUM/LOW, not user-facing in normal use; no follow-up issue):
|
# Conflicts: # src/components/SettingsDialog.tsx # src/lib/i18n.test.ts # src/lib/i18n/files.ja.ts # src/lib/i18n/files.ko.ts # src/lib/i18n/files.zh.ts # src/lib/settings.legacy-fixture.ts # src/lib/settings.ts
|
Local merge gate (owner-approved): origin/main merged (settings/i18n lists only), |
What changes
Part of #1196. The first slice of the Markdown documents panel: list, search and open. The safe
write route of #771 (#3064) merged while this was in progress, and a document opened from the new
tab opens in that same file viewer: with Settings > Edit text files on, it can be edited and saved
there, with #3064's revision check. Creating and deleting a document are not in this PR (follow-ups
on #1196).
exactly as it is today: three tabs, no new request.
.md,.markdown) under thepane's folder, newest first, each with the folder it is in and when it changed. A Filter
documents field narrows them by path (Escape clears it before it closes Files), a Refresh button
reads the list again (nothing polls), and a row opens the file in the existing file viewer, which
renders it with its outline. It works in the dialog, in Files beside the pane, and on a phone's
sheet.
GET /api/pane/docs?pane_id=->PaneDocuments(
shared/files.ts). In a repository it asks git afresh (git ls-files -co --exclude-standard,the same safe invocation as @-mentions), so ignored build output and
node_modulesstay out andRefresh sees a file made a moment ago. Outside a repository, it walks with the same caps but
counts only Markdown files, so a folder of other files cannot crowd a note out. Every file found
is statted and the newest 500 kept. The reads run on a file thread (a new
documentstask),stop after 2 s (a fixed bound), and count as a scan in the file pool, so at most two
threads run them and file routes keep the rest. The request's abort reaches the task.
truncatedsays when a cap or the time limit left files out; the tab then says "Some Markdownfiles here are not listed." and never claims the newest are shown.
/api/pane/files. It is refused (403read_only) to awatching device, on this PC and through another PC's route. It is forwarded to other PCs
(
MACHINE_PROXY_PATH). On a herdr-core machine's own server, whose files are on anothermachine, it answers 501
unsupported.the narrowest docked panel (320px). There, and only while the fourth tab is shown, the tabs take
the row under the title. With three tabs (the setting off), the header is unchanged.
documents yet.").
No new control is visible by default: the tab exists only behind its setting, and the composer is
not touched.
Design reference: Paseo's
paseo-markdown-viewerplugin (a read-only Markdown list beside theagent that opens each file in a reader) and the Codex app's side panel, which opens a
.mdfilenext to Review. This slice follows Paseo's read-only list, inside Files, and leaves editing to
#771. @vibewriter-hand offered to build the editing slice on #771's write API: this PR adds no
editor and no write route, so create, save-a-new-note and delete remain open for that slice.
Screenshots
Demo fixtures, setting on (
scripts/files-documents-demo-regression.ts).Validation
server/device-access.contract.test.ts(a watching device refusedon this PC, its alias and another PC's route; a driving one answered),
server/machine-proxy.test.ts(never forwarded for a watching device),
server/hc-machines.test.ts(501 on a herdr-coremachine's own server) and the
paneDocumentscases inserver/files.test.ts(newest first withsizes and times, skipped folders and git-ignored files left out, the cap and
truncated) failedon the base (2d8581e) and pass now. New
src/components/MarkdownDocuments.test.tsx(server order,open by absolute path, filter, an older PC's 404 told apart from a missing pane) and the
filesDocumentsrows insrc/lib/settings.test.ts(off by default, kept in its own key).scripts/files-documents-demo-regression.ts(added toscripts/ci-browser.sh): off bydefault no Documents tab; on, the list in order, the folder named, no sideways scroll, the filter
and Escape, a row opening the viewer; in the dialog, beside the pane at 320px and on a 390px sheet,
where it checks that the four tabs and Close fit; light and dark.
server/files.test.tsgained a repository of 2,000 old notes plus a newerzz-newest.md(listed first), a non-git folder of 1,000.txtfiles plusz-note.md(listed, notcut) and the 2 s budget (a zero budget answers cut);
server/file-pool.test.tsgained "a Markdownlisting counts as a scan". The three behaviour tests failed on 9456ed6 and pass now.
server/file-pool.test.ts"runs one Markdown listing at a time, and a stuck oneleaves commands scans both their threads" failed on b8d4fa7 and passes now.
bun run check fast: passed at c94745f (origin/main merged): workflow syntax, generated files,typecheck, build, unit tests 12420 pass, 0 fail.
and resolutions in the PR comments).
Settings) in the self-hosted CI runner image (
herdr-ci-runner:local,scripts/ci-browser-parallel.ts, afterbun run build, insidebun run check run), 12/12passed at 9456ed6 (files-documents again at 7ff0796, 4/4 locally): files-documents, files-panel, files-prompt, file-viewer, file-viewer-mobile,
deep-link, diff-find, diff-line-notes, palette-local-page, settings-pages, file-text-size,
text-file-edit.
bun run check integrationand the full browser lane (CI runs them).