feat(cli): @path tab-completion in REPL input#198
Merged
emal-avala merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
`@path` expansion on submit has worked for a while, but users had to
type the full path. Tab-completion now works anywhere in the input
line whenever the cursor is inside an `@token`:
> explain @src/m<TAB>
> explain @src/main.rs ← after tab
Rules:
* The `@` must be at the start of the line or preceded by whitespace
(so `user@example.com` doesn't accidentally trigger path completion)
* Directories are listed first with a trailing `/` so Tab-tab descends
* Dotfiles are hidden unless the partial starts with `.`
* Absolute paths and `..` components are rejected (stays within cwd)
* Up to 50 candidates returned; ordering: dirs alpha, then files alpha
* Multiple `@` tokens on a line — only the one the cursor is in
completes
Display format: `src/main.rs` for files, `src/ (dir)` for directories.
Slash-command completion is unchanged; `@` completion only fires when
the cursor is in an `@` context, slash completion handles everything
else.
Tests: 13 unit tests covering context detection (start of line, after
whitespace, rejected mid-word, multi-@, whitespace in partial, no @,
empty partial) and path completion (listing, prefix filter, subdir
descent, dotfile gating, traversal rejection, missing dir).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
@pathexpansion on submit has worked for a while — typing@src/foo.rsin a prompt inlines the file's contents. But users had to type the full path. This PR adds tab-completion for@paths anywhere in the input line.Rules
@must be at the start of the line or preceded by whitespace, souser@example.comdoesn't accidentally trigger path completion mid-word/so Tab-tab descends into them.(matches shell convention)..components are rejected — stays within cwd@tokens on a line — only the one the cursor is in completesDisplay format:
src/main.rssrc/ (dir)Interaction with existing completers
Slash-command completion (the fuzzy scorer from #195) is unchanged.
@completion only fires when the cursor is in an@context — slash completion handles everything else. The@expansion on submit path (from #…) is also unchanged; this PR just makes it easier to produce a valid@pathin the first place.Test plan
cargo fmt --all— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test -p agent-code --bin agent at_completion_tests— 13/13 passexplain @s<TAB>listssrc/,sdks/, etc.;explain @src/m<TAB>expands to@src/main.rs