Repository navigation
feat(tui): @-mention files in the composer with autocomplete (ATO-665) - #1428
Merged
Merged
Conversation
Typing @ in the composer now opens a palette of the working directory's files, filtered with fuzzysort. Up/Down move, Tab/Enter/Right complete, Esc closes. The list comes from git ls-files (respects .gitignore) or a bounded walk outside a repository, capped at 20k paths and a 200 ms walk budget, cached per folder and refreshed in the background. On an idle submit every @path that is a real file inside the working directory is inlined under the message in a <mentioned-files> block, capped at 32 KB per file and 96 KB / 8 files per message, with the cut stated in the message. Paths outside the folder are never read (checked on the written path and again after symlinks); unresolved @words stay plain text. The chat bubble folds the block to one line per file and input history recalls only the typed text, while the transcript keeps the full message so retry and rollback still match the stored prompt. Until now the TUI had no way to put a file in context: the composer deferred @file for opencode parity and the only route was asking the agent to read the path itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
@-mention files in the TUI composer, with autocomplete.@(at the start of the buffer or after a space) opens a palette of the working directory's files above the composer, filtered with fuzzysort. Up/Down move, Tab, Enter or Right complete the highlighted path, Esc closes it until the buffer changes. Clicks follow the usual list rule (first selects, second completes).src/tui/file-mentions/file-index.ts):git ls-files --cached --others --exclude-standardinside a repository (so.gitignoreis respected), otherwise a breadth-first walk that skipsnode_modules,.git, build and cache folders. Capped at 20k paths and a 200 ms walk budget; one cached list per folder, refreshed in the background after 15 s. Paths containing whitespace are left out, since a mention ends at whitespace.submit-handler.ts), each@paththat resolves to a real file inside the working directory is inlined after the typed text in a<mentioned-files>block (same placement as the channels'[attachments]block). Caps: 32 KB per file, 96 KB and 8 files per message. A cut file says so in the message ([truncated: showing the first 32 KB of 195 KB; read the file itself for the rest]); a binary file or one over the message budget is listed but not inlined.@../x,@/etc/passwd) and again on the real path, so a symlink inside the folder that points out of it is refused. Unresolved@words(@team, a folder, a missing file) stay plain text.[try again]and rollback still match the stored prompt.Why
ATO-665. The TUI had no way to put a file in context:
prompt-shell.tsxdeferred@filefor opencode parity, and the only route was asking the agent to read a path itself.Not covered here:
@pathreaches the model as words it can read with its own tools.Tests
Added (not run on this machine):
src/tui/file-mentions/mention-query.test.ts: finding and completing the trailing@token, email addresses ignored.src/tui/file-mentions/mention-block.test.ts: block format, truncation and skip notes, split/collapse round trip, history text.src/tui/file-mentions/expand-mentions.test.ts: inlining, unresolved words left alone, trailing punctuation, paths outside the folder and an escaping symlink refused, per-file cut, binary file, message budget, file cap.src/tui/file-mentions/file-index.test.ts: walk skips dependency folders, file cap, time budget; index cache, background refresh, whitespace filter, failed listing.src/tui/file-mentions/rank-mention-files.test.ts: empty-query ordering, fuzzy match, result cap.src/tui/file-mentions/file-mention-palette.test.tsx: loading, no match, rows, windowing.src/tui/file-mentions/mention-display.test.tsx: folded bubble, height estimate, transcript vs history.src/tui/submit-handler.test.ts: idle submit sends the expanded text, falls back when unwired, slash commands untouched.Not yet checked on the second Mac.