feat(cli): Prioritize shallow subfolders when scanning for completer#1286
feat(cli): Prioritize shallow subfolders when scanning for completer#1286hongquan wants to merge 10 commits intoMoonshotAI:mainfrom
Conversation
Assume that Windows users also use forward slashes (/)
There was a problem hiding this comment.
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 usePathTrieand cache results keyed by the current fragment. - Add unit tests for
PathTriebehavior 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 | |||
There was a problem hiding this comment.
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.
| # Config files | |
| # Config Files |
There was a problem hiding this comment.
This change is caused by make gen-docs.
There was a problem hiding this comment.
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.
Related Issue
Resolve #1276
Description
Collect files and save to a trie data structure as pool for autocomplete source.
Checklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.