Skip to main content

Module path_suggest

Module path_suggest 

Source
Expand description

“Did you mean …?” for a path that does not exist.

A missing file is the most frequent tool failure in the field, and the usual causes are mechanical: a typo in the file name, a wrong extension, or a path written relative to the wrong directory (src/x.rs for rust/src/x.rs). Naming the existing file turns the agent’s next call into the right one instead of a ctx_tree round trip.

Bounded on purpose: one directory listing for the name check, and a capped, gitignore-respecting walk below the nearest existing ancestor only when that ancestor is a safe scan root (never ~, / or a TCC-protected folder).

Functions§

hint
The suggestions as a one-line suffix for an error message, or “”.
unambiguous_match_in
unambiguous_match, plus one more mechanical slip: a path built from a search result’s directory-relative hit on the wrong prefix (src/app/signal/test_x.py after a search under tests/ listed signal/test_x.py). The file is then looked up under the whole project_root; it is taken only when exactly one file there shares the longest trailing part with path, and that part names at least its directory and file (signal/test_x.py) — a bare file-name match stays a suggestion.