Skip to content

feat(cli): Prioritize shallow subfolders when scanning for completer#1286

Open
hongquan wants to merge 10 commits intoMoonshotAI:mainfrom
hongquan:fix/missing-file-autocomplete
Open

feat(cli): Prioritize shallow subfolders when scanning for completer#1286
hongquan wants to merge 10 commits intoMoonshotAI:mainfrom
hongquan:fix/missing-file-autocomplete

Conversation

@hongquan
Copy link

@hongquan hongquan commented Feb 27, 2026

Related Issue

Resolve #1276

Description

Collect files and save to a trie data structure as pool for autocomplete source.

asciicast

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

@hongquan hongquan marked this pull request as ready for review February 28, 2026 12:30
Copilot AI review requested due to automatic review settings February 28, 2026 12:30
Assume that Windows users also use forward slashes (/)
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 addresses issue #1276 by changing how the shell @ file mention completer collects and orders workspace paths so that shallow paths are prioritized and deeper paths can be expanded incrementally.

Changes:

  • Add a trie-based path collector (PathTrie) that scans directories in BFS order with incremental depth expansion.
  • Update the shell @ completer to use PathTrie and cache results keyed by the current fragment.
  • Add unit tests for PathTrie behavior and update changelogs/docs entries.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/kimi_cli/utils/path.py Introduces PathTrie/PathTrieNode with BFS, staged collection, and directory lookup for formatting.
src/kimi_cli/ui/shell/prompt.py Switches local file mention completion from os.walk to PathTrie, adds fragment-aware caching and directory formatting.
tests/ui_and_conv/test_path_trie.py Adds tests for trie node behavior, BFS ordering, incremental depth expansion, and limit handling.
CHANGELOG.md Notes the shell completion fix in Unreleased.
docs/en/release-notes/changelog.md Mirrors changelog entry for English docs.
docs/zh/release-notes/changelog.md Mirrors changelog entry for Chinese docs.
docs/en/configuration/config-files.md Adjusts the H1 casing.
pyproject.toml Re-formats/re-orders configuration blocks without apparent semantic changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,4 +1,4 @@
# Config Files
# Config files
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

This page’s top-level heading was changed to sentence case (# Config files), but other pages in this same section use title case (e.g. # Data Locations, # Environment Variables). If the docs convention is title case for H1s, consider keeping # Config Files for consistency.

Suggested change
# Config files
# Config Files

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

This change is caused by make gen-docs.

devin-ai-integration[bot]

This comment was marked as resolved.

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

@ is missing files in autocomplete

2 participants