contextl 1.2.30 → 1.2.31

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.30",
3
+ "version": "1.2.31",
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",
@@ -130,10 +130,31 @@ def _ts_imports_python(root: "Node") -> list[str]:
130
130
  # from pathlib import Path
131
131
  # from . import utils
132
132
  # from ..models import User
133
+ rel_import = None
133
134
  for child in node.children:
134
- if child.type in ("dotted_name", "relative_import"):
135
- results.append(child.text.decode("utf-8", errors="replace"))
136
- break # only the module name, not the imported symbols
135
+ if child.type == "relative_import":
136
+ rel_import = child.text.decode("utf-8", errors="replace")
137
+ break
138
+
139
+ if rel_import and rel_import.replace(".", "") == "":
140
+ # Bare relative import like `.` or `..`
141
+ seen_import = False
142
+ for child in node.children:
143
+ if child.type == "import":
144
+ seen_import = True
145
+ elif seen_import:
146
+ if child.type == "dotted_name":
147
+ results.append(f"{rel_import}{child.text.decode('utf-8', errors='replace')}")
148
+ elif child.type == "aliased_import":
149
+ for sub in child.children:
150
+ if sub.type == "dotted_name":
151
+ results.append(f"{rel_import}{sub.text.decode('utf-8', errors='replace')}")
152
+ break
153
+ else:
154
+ for child in node.children:
155
+ if child.type in ("dotted_name", "relative_import"):
156
+ results.append(child.text.decode("utf-8", errors="replace"))
157
+ break # only the module name, not the imported symbols
137
158
 
138
159
  for child in node.children:
139
160
  visit(child)