CLI agent: scope @-mention autocomplete to the active site path#3338
Open
CLI agent: scope @-mention autocomplete to the active site path#3338
Conversation
…dupe basePath updates
youknowriad
reviewed
May 5, 2026
| const { announce = true, emitEvent = true } = options; | ||
| this._activeSite = site; | ||
| this.editor.activeSiteName = site.name; | ||
| this.activeSite = site; |
Contributor
There was a problem hiding this comment.
Is this like an unrelated cleanup or something?
Contributor
Author
There was a problem hiding this comment.
Adjacent dedup, not random — it's part of "funnel site mutations through the activeSite setter" in this commit. The setter already does _activeSite = site + editor.activeSiteName = … + updateAutocompleteBasePath(), so setActiveSite/clearActiveSite were duplicating the first two and the original PR added the third in three places. Routing them through the setter means a single source of truth for "what happens when activeSite changes" — future code paths that mutate it can't forget to update the basePath. Happy to split into its own commit if you'd rather.
youknowriad
approved these changes
May 5, 2026
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.
Related issues
Follow-up to #3336.
Proposed Changes
When the user picks a different site mid-session via the site picker, the chat editor's
@-mention file completion now follows. Today, theCombinedAutocompleteProvideris constructed once atAiChatUIstartup withprocess.cwd()and is never updated, so completion stays anchored to the launch directory regardless of which site is active.updateAutocompleteBasePath()onAiChatUI. Picks_activeSite.pathfor local sites, falls back to a capturedinitialCwd(the launch cwd) for no-site and remote-site cases — remote sites have no local files to complete against.CombinedAutocompleteProviderexposesbasePathonly via the constructor — there's no public setter — so the helper replaces the whole provider on each call. The provider has no observable state beyond config, so reconstruction is cheap.activeSitesetter,setActiveSite, andclearActiveSite. The constructor also now goes through the helper instead of an inlinenew CombinedAutocompleteProvider(…, process.cwd()).Testing Instructions
npm installnpm run typecheck— passes.npm test -- apps/cli/ai/tests/ui.test.ts— 18 tests pass, including 4 new ones covering the basePath logic.@→ fuzzy completion is scoped to~(the launch cwd). Cancel with Esc.my-site).@→ fuzzy completion is now scoped to~/Studio/my-site/and lists files inside the site.other-site).@→ fuzzy completion now lists files in~/Studio/other-site/.@→ fuzzy completion falls back to~, since remote sites have no local files.Pre-merge Checklist