Backend for file-picking UIs.
This namespace owns the NON-UI parts of the @ picker:
git binaryChannels render and keybind on top of this data; they should not reimplement repository walking or git-status logic themselves.
Backend for file-picking UIs. This namespace owns the NON-UI parts of the `@` picker: - repository discovery - git dirty / ignored metadata via the native `git` binary - filesystem indexing via java.nio.file - filtering, ranking, sorting - compact display labels for size / age / git status Channels render and keybind on top of this data; they should not reimplement repository walking or git-status logic themselves.
(->wire {:keys [path size-label age-label status-label]})Project ONE rich fuzzy/picker row (:path :size-label :age-label :status-label, the shape fuzzy-file-rows yields) into the channel-agnostic
WIRE shape {:name :size :age :status} the gateway /v1/sessions/:sid/suggest
service serves to the web composer.
This is the SINGLE web-specific step: both the web and the TUI start from the
SAME rich rows; the TUI renders them in-process (richer size · age · status
chip), the web projects them last through here.
Project ONE rich fuzzy/picker row (`:path :size-label :age-label
:status-label`, the shape `fuzzy-file-rows` yields) into the channel-agnostic
WIRE shape `{:name :size :age :status}` the gateway `/v1/sessions/:sid/suggest`
service serves to the web composer.
This is the SINGLE web-specific step: both the web and the TUI start from the
SAME rich rows; the TUI renders them in-process (richer `size · age · status`
chip), the web projects them last through here.(collect-file-picker-entries)Index regular files under the current working directory. Skips .git
internals unconditionally; everything else stays eligible so the UI can
toggle ignored files on/off without rebuilding the index.
Index regular files under the current working directory. Skips `.git` internals unconditionally; everything else stays eligible so the UI can toggle ignored files on/off without rebuilding the index.
(cwd-path)Current explicit workspace cwd as a Path. Indirected for tests.
Current explicit workspace cwd as a Path. Indirected for tests.
(cycle-sort-mode sort-mode)Advance to the next picker sort mode.
Advance to the next picker sort mode.
(decorate-entry entry now-ms query)Attach derived display fields used by the picker renderer.
Attach derived display fields used by the picker renderer.
(display-path root path)path relativized against root, normalized to / separators.
`path` relativized against `root`, normalized to `/` separators.
(file-picker-entry cwd {:keys [repo-root path-status] :as git-info} path attrs)Build one picker entry from a filesystem path + attrs. cwd is the
scan root; git-info is from git-status-snapshot.
Build one picker entry from a filesystem path + attrs. `cwd` is the scan root; `git-info` is from `git-status-snapshot`.
(file-picker-items entries
query
{:keys [include-ignored? sort-mode now-ms]
:or {include-ignored? false
sort-mode :recent
now-ms (System/currentTimeMillis)}})Filter, score, and sort picker entries.
Options:
Filter, score, and sort picker entries. Options: - :include-ignored? include gitignored files - :sort-mode :recent | :relevance - :now-ms override current time for deterministic tests
(file-picker-score path query)Heuristic fuzzy score for query against path. Nil means no match.
Heuristic fuzzy score for `query` against `path`. Nil means no match.
(format-bytes n)Human-ish byte string for picker rows.
Human-ish byte string for picker rows.
(format-relative-age now-ms mtime-ms)Compact relative age for picker rows.
Compact relative age for picker rows.
(fuzzy-file-rows idx query)(fuzzy-file-rows idx
query
{:keys [now-ms limit]
:or {now-ms (System/currentTimeMillis) limit max-results}})Frecency-ranked, typo-tolerant fuzzy file search via fff against an already
OPEN index idx (see open-fuzzy-index) — the SAME engine behind the
find_files tool. Returns rows shaped like file-picker-items
(:path :label :status-label :size-label :age-label), capped at limit.
A blank query yields fff's default frecency/recency ordering.
Frecency-ranked, typo-tolerant fuzzy file search via fff against an already OPEN index `idx` (see `open-fuzzy-index`) — the SAME engine behind the `find_files` tool. Returns rows shaped like `file-picker-items` (`:path :label :status-label :size-label :age-label`), capped at `limit`. A blank `query` yields fff's default frecency/recency ordering.
(git-status-snapshot cwd)Git metadata for the repository containing cwd, or a reduced empty shape
when the directory is not in git. Backed by one git status subprocess.
Git metadata for the repository containing `cwd`, or a reduced empty shape when the directory is not in git. Backed by one `git status` subprocess.
(ignored-path? {:keys [ignored-exact ignored-prefixes]} repo-rel-path)True when repo-rel-path is ignored according to the snapshot map
from git-status-snapshot.
True when `repo-rel-path` is ignored according to the snapshot map from `git-status-snapshot`.
(open-fuzzy-index)Open a FRESH fff instance scoped to the current workspace cwd, blocking
until its initial scan completes. The caller OWNS the instance and MUST
close it — but NEVER while a search may still be running on it: fff's
native search crashes the JVM (SIGSEGV) on a closed handle.
Open a FRESH fff instance scoped to the current workspace cwd, blocking until its initial scan completes. The caller OWNS the instance and MUST close it — but NEVER while a search may still be running on it: fff's native `search` crashes the JVM (SIGSEGV) on a closed handle.
(resolved-sort-mode sort-mode query)Relevance falls back to path order when the query is blank; recent is the default newest-first ordering.
Relevance falls back to path order when the query is blank; recent is the default newest-first ordering.
(sort-label sort-mode query)Human label for the current sort mode.
Human label for the current sort mode.
(status-label status)Human-readable git status for picker table rows.
Human-readable git status for picker table rows.
(status-priority status)Higher = more visually important in the picker.
Higher = more visually important in the picker.
(suggest-file-rows query)(suggest-file-rows query {:keys [limit] :or {limit max-results}})Self-contained fuzzy file suggestion for the shared @/suggest surface.
Opens a FRESH fff index, searches query, and closes it SAFELY — the whole
dance the gateway /v1/sessions/:sid/suggest service and any other caller
would otherwise hand-roll. Reuses the SAME fuzzy-file-rows engine the TUI
picker uses, then projects each rich row through ->wire, so the web and TUI
never diverge on ranking or field derivation — only on the final shape.
Returns the channel-agnostic WIRE rows {:name :size :age :status} (bare
relative path in :name), realized eagerly so nothing lazy escapes the closed
native handle. Never throws; on any error yields [].
A blank query yields fff's default frecency/recency ordering.
Self-contained fuzzy file suggestion for the shared `@`/suggest surface.
Opens a FRESH fff index, searches `query`, and closes it SAFELY — the whole
dance the gateway `/v1/sessions/:sid/suggest` service and any other caller
would otherwise hand-roll. Reuses the SAME `fuzzy-file-rows` engine the TUI
picker uses, then projects each rich row through `->wire`, so the web and TUI
never diverge on ranking or field derivation — only on the final shape.
Returns the channel-agnostic WIRE rows `{:name :size :age :status}` (bare
relative path in `:name`), realized eagerly so nothing lazy escapes the closed
native handle. Never throws; on any error yields `[]`.
A blank `query` yields fff's default frecency/recency ordering.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |