Skip to content

Conversation

@catrielmuller
Copy link
Contributor

@catrielmuller catrielmuller commented Nov 4, 2025

Context

Resolve #3244

Implementation

  • Implemented a new FileSearchService with caching, fuzzy search, and gitignore support
  • Extended the autocomplete system to detect and handle file mentions (text starting with @)
  • Updated UI components to display file mention suggestions with file/folder icons
  • Added comprehensive test coverage for file search and mention detection

Screenshots

Screenshot 2025-11-04 at 11 06 31 AM Screenshot 2025-11-04 at 11 06 39 AM

How to Test

  • Type @ on any part of the text to initialize the suggestion.
  • Autocomplete the filename with TAB or ENTER
  • Cancel the suggestion with ESC

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: 5d5cbf1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kilocode/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds file mention autocomplete functionality that allows users to reference files using @ mentions with fuzzy search and autocomplete support. The feature integrates with the existing autocomplete system and respects .gitignore patterns.

Key changes:

  • Implemented a new FileSearchService with caching, fuzzy search, and gitignore support
  • Extended the autocomplete system to detect and handle file mentions (text starting with @)
  • Updated UI components to display file mention suggestions with file/folder icons
  • Added comprehensive test coverage for file search and mention detection

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
cli/src/services/fileSearch.ts New service providing file search with caching and gitignore filtering
cli/src/services/autocomplete.ts Added file mention detection and suggestion generation
cli/src/state/hooks/useCommandInput.ts Integrated file mention context detection and cursor tracking
cli/src/state/atoms/ui.ts Added atoms for file mention suggestions and context state
cli/src/state/atoms/keyboard.ts Updated keyboard handling for file mention autocomplete and ESC behavior
cli/src/ui/components/CommandInput.tsx Added file mention suggestions to the autocomplete flow
cli/src/ui/components/AutocompleteMenu.tsx Added UI rendering for file mention suggestions
cli/src/state/atoms/tests/keyboard.test.ts Added tests for file mention ESC key behavior
cli/src/services/tests/fileSearch.test.ts Tests for file search service core functionality
cli/src/services/tests/fileSearch.gitignore.test.ts Tests for gitignore filtering
cli/src/services/tests/autocomplete.file-mention.test.ts Tests for file mention detection and suggestions
cli/package.json Added fast-glob dependency
pnpm-lock.yaml Updated lockfile with new dependencies
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

cli/src/services/tests/fileSearch.test.ts:1

  • This new test file is missing the // kilocode_change - new file comment at the top as required by the coding guidelines for Kilocode-specific files.
/**

cli/src/state/hooks/useCommandInput.ts:1

  • These new lines are missing // kilocode_change markers as required by the coding guidelines since they are additions to an existing file.
/**

* @param maxResults Maximum number of results to return (default: 50)
* @returns Array of matching file search results
*/
async searchFiles(query: string, cwd: string, maxResults = 50): Promise<FileSearchResult[]> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can cache this, as well as the loadGitIgnore, I think? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's cached by the getAllFiles, the loadGitIgnore is a private function only used by the getAllFiles when is not cached.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about caching searchFiles, or do you not think that's needed? 🤔

@catrielmuller catrielmuller force-pushed the catrielmuller/cli-localfile-mention branch from 355d995 to 5d5cbf1 Compare November 4, 2025 15:25
@catrielmuller catrielmuller merged commit b9782ae into main Nov 5, 2025
12 checks passed
@catrielmuller catrielmuller deleted the catrielmuller/cli-localfile-mention branch November 5, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to @ mention local files

3 participants