aboutsummaryrefslogtreecommitdiff
path: root/.ai/scripts/route_recommend.py
diff options
context:
space:
mode:
Diffstat (limited to '.ai/scripts/route_recommend.py')
-rw-r--r--.ai/scripts/route_recommend.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/.ai/scripts/route_recommend.py b/.ai/scripts/route_recommend.py
index 7b36405..12ab132 100644
--- a/.ai/scripts/route_recommend.py
+++ b/.ai/scripts/route_recommend.py
@@ -71,6 +71,15 @@ def recommend(item: str, projects: list[str]) -> tuple[str | None, str]:
if not projects:
return (None, "none")
+ # Collapse identical names first. Projects are addressed by bare basename, so
+ # two projects sharing one across roots (~/code/notes, ~/projects/notes) arrive
+ # twice; both literal-match, and the tie test below then read that as ambiguity
+ # and downgraded a correct strong match to weak. Deduping here rather than in
+ # discover_destination_names protects every caller of the pure core, not just
+ # the CLI path. Order-preserving, and it collapses only identical names — two
+ # *different* projects matching is real ambiguity and still downgrades.
+ projects = list(dict.fromkeys(projects))
+
item_lower = item.lower()
item_tokens = _tokens(item)