Repository navigation
feat(composer): pick a project file from an @ menu - #449
Merged
Merged
Conversation
A list_files command sends the frame for the chat's project dir through exchange() and answers the paths the worker offers for @<path> expansion. It answers an empty list on any failure, so an infer without the frame offers nothing, and fixed paths in DESKTOP_MOCK.
Typing @ in the composer opens a menu of the project's files, filtered by the text after it. The arrows move, Enter inserts @<path> and Escape closes, as in the slash menu. The list is fetched once per project. Token detection, filtering and the menu keys live in lib/mentions.
Contributor
|
🎉 This PR is included in version 0.55.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Resolves #440
Summary
Typing
@in the composer opens a menu of the project's files, the same menu theinferchat TUI offers. Picking one inserts@<path>, which the CLI's worker already expands into the file's content before the run (inference-gateway/cli#1717, infer v0.246.0).Changes
backend/src/composer.rs(new): alist_filesTauri command. It sends{"type":"list_files","project_dir":...}for the chat's project dir throughexchange()and returns thefilesreply. Any failure answers an empty list, and aninferthat never answers the frame times out after 15 s in the background.DESKTOP_MOCKanswers four fixed paths.frontend/lib/mentions.ts(new): finds the@token before the cursor (only at the start or after whitespace, so an email address opens nothing), filters the files (at most 50 rows), inserts the pick, and maps the menu keys.frontend/components/Composer.tsx: the@menu, with ArrowUp/ArrowDown, Enter and Escape like the slash menu. The file list is fetched once per project and cleared when the project changes. The textarea and the DOM contract are unchanged.frontend/lib/tauri.ts:listFiles.frontend/lib/mentions.test.ts(token detection, filtering, insertion, keys), Rust parser tests, ande2e/tests/composer-file-menu.yaml.Verification
bun run build,cargo fmt --check,cargo clippy -- -D warnings,cargo check,cargo test.bun test209 passed,cargo test -p desktop-e2epasses.composer-file-menu.yaml7/7, plushistory-recall.yaml,bash-mode.yamlandnext-step-suggestion.yamlfor the composer keys around it.Notes for review
DESKTOP_MOCK, so it shows the menu over the mock list. The frame matches the "Project files" section of inference-gateway/clidocs/browser-extension-protocol.mdand is covered by the Rust tests.type, which presses Return. Arrow-key navigation is covered bybun test.!!menus keep their own key handling. Moving them ontomenuKeyis a follow-up that would delete code.#issue menu ([FEATURE] Pick an open GitHub issue from a # menu in the composer #441) is stacked on this branch.Docs ticket
inference-gateway/docs#1118