contextl 1.2.47 → 1.2.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contextl",
3
- "version": "1.2.47",
3
+ "version": "1.2.48",
4
4
  "description": "contextl — finds the most relevant files in your codebase for any change request. MCP server for AI coding agents.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -606,9 +606,15 @@ def _find_file_in_repo(
606
606
 
607
607
  if matches:
608
608
  if source_file:
609
- matches.sort(key=lambda p: (p.count("/"), _path_distance(source_file, p), 0 if p.endswith("__init__.py") else 1))
609
+ def _sort_key(p):
610
+ is_init = 0 if p.endswith("__init__.py") else 1
611
+ if is_init == 0:
612
+ return (is_init, p.count("/"), _path_distance(source_file, p))
613
+ else:
614
+ return (is_init, _path_distance(source_file, p), p.count("/"))
615
+ matches.sort(key=_sort_key)
610
616
  else:
611
- matches.sort(key=lambda p: (p.count("/"), 0 if p.endswith("__init__.py") else 1))
617
+ matches.sort(key=lambda p: (0 if p.endswith("__init__.py") else 1, p.count("/")))
612
618
  return matches[0]
613
619
 
614
620
  # Fallback for Python cross-language imports (e.g. from tests to .ts/.js core logic)