contextl 1.2.33 → 1.2.34

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.33",
3
+ "version": "1.2.34",
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",
@@ -1185,16 +1185,57 @@ def _skeleton_ts_js(root: "Node") -> dict:
1185
1185
  "is_exported": is_exported,
1186
1186
  }
1187
1187
 
1188
+ def visit_enum(node: "Node") -> dict:
1189
+ name = ""
1190
+ properties: list[dict] = []
1191
+ for child in node.children:
1192
+ if child.type == "identifier":
1193
+ name = _node_text(child)
1194
+ elif child.type == "enum_body":
1195
+ for member in child.children:
1196
+ if member.type == "property_identifier":
1197
+ properties.append({
1198
+ "name": _node_text(member),
1199
+ "type": "",
1200
+ "visibility": "public",
1201
+ })
1202
+ elif member.type == "enum_assignment":
1203
+ member_name = ""
1204
+ member_val = ""
1205
+ for sub in member.children:
1206
+ if sub.type == "property_identifier":
1207
+ member_name = _node_text(sub)
1208
+ elif sub.type not in ("=",):
1209
+ member_val = _node_text(sub)
1210
+ if member_name:
1211
+ properties.append({
1212
+ "name": member_name,
1213
+ "type": member_val,
1214
+ "visibility": "public",
1215
+ })
1216
+ return {
1217
+ "name": name,
1218
+ "extends": "",
1219
+ "implements": [],
1220
+ "methods": [],
1221
+ "properties": properties,
1222
+ }
1223
+
1188
1224
  def visit(node: "Node"):
1189
1225
  if node.type == "class_declaration":
1190
1226
  c = visit_class(node)
1191
1227
  classes.append(c)
1192
1228
  return
1193
- if node.type in ("function_declaration", "function"):
1229
+ if node.type in ("function_declaration", "function", "generator_function_declaration", "generator_function"):
1194
1230
  f = visit_function(node)
1195
1231
  if f["name"]:
1196
1232
  functions.append(f)
1197
1233
  return
1234
+ if node.type == "enum_declaration":
1235
+ c = visit_enum(node)
1236
+ if c["name"]:
1237
+ classes.append(c)
1238
+ return
1198
1239
  if node.type == "export_statement":
1199
1240
  # Track what is exported
1200
1241
  for child in node.children:
@@ -1205,13 +1246,37 @@ def _skeleton_ts_js(root: "Node") -> dict:
1205
1246
  if c["name"]:
1206
1247
  exports.append(c["name"])
1207
1248
  return
1208
- if child.type in ("function_declaration", "function"):
1249
+ if child.type in ("function_declaration", "function", "generator_function_declaration", "generator_function"):
1209
1250
  f = visit_function(child)
1210
1251
  if f["name"]:
1211
1252
  f["is_exported"] = True
1212
1253
  functions.append(f)
1213
1254
  exports.append(f["name"])
1214
1255
  return
1256
+ if child.type == "enum_declaration":
1257
+ c = visit_enum(child)
1258
+ if c["name"]:
1259
+ classes.append(c)
1260
+ exports.append(c["name"])
1261
+ return
1262
+ if child.type == "lexical_declaration":
1263
+ for sub in child.children:
1264
+ if sub.type == "variable_declarator":
1265
+ for sub2 in sub.children:
1266
+ if sub2.type == "identifier":
1267
+ name = _node_text(sub2)
1268
+ exports.append(name)
1269
+ is_callable = any(c.type in ("arrow_function", "function", "generator_function") for c in sub.children)
1270
+ if is_callable:
1271
+ functions.append({
1272
+ "name": name,
1273
+ "params": "",
1274
+ "return_type": "",
1275
+ "is_async": False,
1276
+ "is_exported": True,
1277
+ })
1278
+ break
1279
+ return
1215
1280
  if child.type == "export_clause":
1216
1281
  for spec in child.children:
1217
1282
  if spec.type == "export_specifier":