codegraphcontext 0.1.40__tar.gz → 0.1.41__tar.gz
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.
- {codegraphcontext-0.1.40/src/codegraphcontext.egg-info → codegraphcontext-0.1.41}/PKG-INFO +2 -2
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/README.md +1 -1
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/pyproject.toml +1 -1
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/main.py +35 -35
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/setup_wizard.py +6 -6
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/visualizer.py +17 -17
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/core/cgc_bundle.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/prompts.py +4 -4
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tool_definitions.py +1 -1
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/code_finder.py +96 -96
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/graph_builder.py +66 -66
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/handlers/analysis_handlers.py +4 -4
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/c.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/cpp.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/csharp.py +30 -30
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/go.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/haskell.py +24 -24
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/java.py +23 -23
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/javascript.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/kotlin.py +24 -24
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/php.py +18 -18
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/python.py +14 -14
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/ruby.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/rust.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/scala.py +27 -27
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/swift.py +23 -23
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/typescript.py +9 -9
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/languages/typescriptjsx.py +7 -7
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +14 -14
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/system.py +2 -2
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41/src/codegraphcontext.egg-info}/PKG-INFO +2 -2
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/LICENSE +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/MANIFEST.in +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/setup.cfg +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/__init__.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/__main__.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/__init__.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/cli_helpers.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/config_manager.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/registry_commands.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/setup_macos.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/core/__init__.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/core/database.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/core/database_falkordb.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/core/falkor_worker.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/core/jobs.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/core/watcher.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/server.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/__init__.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/advanced_language_query_tool.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/handlers/indexing_handlers.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/handlers/management_handlers.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/handlers/query_handlers.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/handlers/watcher_handlers.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/package_resolver.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/c_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/go_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/haskell_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/java_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/python_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/rust_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/scala_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/swift_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/utils/debug_log.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/utils/tree_sitter_manager.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/utils/visualize_graph.py +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext.egg-info/SOURCES.txt +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext.egg-info/dependency_links.txt +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext.egg-info/entry_points.txt +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext.egg-info/requires.txt +0 -0
- {codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codegraphcontext
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.41
|
|
4
4
|
Summary: An MCP server that indexes local code into a graph database to provide context to AI assistants.
|
|
5
5
|
Author-email: Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -139,7 +139,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
|
|
|
139
139
|
---
|
|
140
140
|
|
|
141
141
|
## Project Details
|
|
142
|
-
- **Version:** 0.1.
|
|
142
|
+
- **Version:** 0.1.41
|
|
143
143
|
- **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
144
144
|
- **License:** MIT License (See [LICENSE](LICENSE) for details)
|
|
145
145
|
- **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
|
|
@@ -77,7 +77,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
|
|
|
77
77
|
---
|
|
78
78
|
|
|
79
79
|
## Project Details
|
|
80
|
-
- **Version:** 0.1.
|
|
80
|
+
- **Version:** 0.1.41
|
|
81
81
|
- **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
82
82
|
- **License:** MIT License (See [LICENSE](LICENSE) for details)
|
|
83
83
|
- **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "codegraphcontext"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.41"
|
|
4
4
|
description = "An MCP server that indexes local code into a graph database to provide context to AI assistants."
|
|
5
5
|
authors = [{ name = "Shashank Shekhar Singh", email = "shashankshekharsingh1205@gmail.com" }]
|
|
6
6
|
readme = "README.md"
|
|
@@ -1049,7 +1049,7 @@ def find_by_name(
|
|
|
1049
1049
|
for f in funcs: f['type'] = 'Function'
|
|
1050
1050
|
for c in classes: c['type'] = 'Class'
|
|
1051
1051
|
for v in variables: v['type'] = 'Variable'
|
|
1052
|
-
for m in modules: m['type'] = 'Module'; m['
|
|
1052
|
+
for m in modules: m['type'] = 'Module'; m['path'] = m.get('name', 'External') # Modules might differ
|
|
1053
1053
|
for i in imports:
|
|
1054
1054
|
i['type'] = 'Import'
|
|
1055
1055
|
i['name'] = i.get('alias') or i.get('imported_name')
|
|
@@ -1076,12 +1076,12 @@ def find_by_name(
|
|
|
1076
1076
|
results = code_finder.find_by_module_name(name)
|
|
1077
1077
|
for r in results:
|
|
1078
1078
|
r['type'] = 'Module'
|
|
1079
|
-
r['
|
|
1079
|
+
r['path'] = r.get('name')
|
|
1080
1080
|
|
|
1081
1081
|
elif type.lower() == 'file':
|
|
1082
1082
|
# Quick query for file
|
|
1083
1083
|
with db_manager.get_driver().session() as session:
|
|
1084
|
-
res = session.run("MATCH (n:File) WHERE n.name = $name RETURN n.name as name, n.path as
|
|
1084
|
+
res = session.run("MATCH (n:File) WHERE n.name = $name RETURN n.name as name, n.path as path, n.is_dependency as is_dependency", name=name)
|
|
1085
1085
|
results = [dict(record) for record in res]
|
|
1086
1086
|
for r in results: r['type'] = 'File'
|
|
1087
1087
|
|
|
@@ -1100,9 +1100,9 @@ def find_by_name(
|
|
|
1100
1100
|
table.add_column("Location", style="dim", overflow="fold")
|
|
1101
1101
|
|
|
1102
1102
|
for res in results:
|
|
1103
|
-
|
|
1103
|
+
path = res.get('path', '') or ''
|
|
1104
1104
|
line_str = str(res.get('line_number', ''))
|
|
1105
|
-
location_str = f"{
|
|
1105
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1106
1106
|
|
|
1107
1107
|
table.add_row(
|
|
1108
1108
|
res.get('name', ''),
|
|
@@ -1148,7 +1148,7 @@ def find_by_pattern(
|
|
|
1148
1148
|
RETURN
|
|
1149
1149
|
labels(n)[0] as type,
|
|
1150
1150
|
n.name as name,
|
|
1151
|
-
n.
|
|
1151
|
+
n.path as path,
|
|
1152
1152
|
n.line_number as line_number,
|
|
1153
1153
|
n.is_dependency as is_dependency
|
|
1154
1154
|
ORDER BY n.is_dependency ASC, n.name
|
|
@@ -1161,7 +1161,7 @@ def find_by_pattern(
|
|
|
1161
1161
|
RETURN
|
|
1162
1162
|
labels(n)[0] as type,
|
|
1163
1163
|
n.name as name,
|
|
1164
|
-
n.
|
|
1164
|
+
n.path as path,
|
|
1165
1165
|
n.line_number as line_number,
|
|
1166
1166
|
n.is_dependency as is_dependency
|
|
1167
1167
|
ORDER BY n.is_dependency ASC, n.name
|
|
@@ -1191,9 +1191,9 @@ def find_by_pattern(
|
|
|
1191
1191
|
table.add_column("Source", style="yellow")
|
|
1192
1192
|
|
|
1193
1193
|
for res in results:
|
|
1194
|
-
|
|
1194
|
+
path = res.get('path', '') or ''
|
|
1195
1195
|
line_str = str(res.get('line_number', '') if res.get('line_number') is not None else '')
|
|
1196
|
-
location_str = f"{
|
|
1196
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1197
1197
|
|
|
1198
1198
|
table.add_row(
|
|
1199
1199
|
res.get('name', ''),
|
|
@@ -1250,9 +1250,9 @@ def find_by_type(
|
|
|
1250
1250
|
table.add_column("Source", style="yellow")
|
|
1251
1251
|
|
|
1252
1252
|
for res in results:
|
|
1253
|
-
|
|
1253
|
+
path = res.get('path', '') or ''
|
|
1254
1254
|
line_str = str(res.get('line_number', ''))
|
|
1255
|
-
location_str = f"{
|
|
1255
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1256
1256
|
|
|
1257
1257
|
table.add_row(
|
|
1258
1258
|
res.get('name', ''),
|
|
@@ -1295,9 +1295,9 @@ def find_by_variable(
|
|
|
1295
1295
|
table.add_column("Context", style="yellow")
|
|
1296
1296
|
|
|
1297
1297
|
for res in results:
|
|
1298
|
-
|
|
1298
|
+
path = res.get('path', '') or ''
|
|
1299
1299
|
line_str = str(res.get('line_number', ''))
|
|
1300
|
-
location_str = f"{
|
|
1300
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1301
1301
|
|
|
1302
1302
|
table.add_row(
|
|
1303
1303
|
res.get('name', ''),
|
|
@@ -1355,9 +1355,9 @@ def find_by_content_search(
|
|
|
1355
1355
|
table.add_column("Location", style="dim", overflow="fold")
|
|
1356
1356
|
|
|
1357
1357
|
for res in results:
|
|
1358
|
-
|
|
1358
|
+
path = res.get('path', '') or ''
|
|
1359
1359
|
line_str = str(res.get('line_number', ''))
|
|
1360
|
-
location_str = f"{
|
|
1360
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1361
1361
|
|
|
1362
1362
|
table.add_row(
|
|
1363
1363
|
res.get('name', ''),
|
|
@@ -1402,9 +1402,9 @@ def find_by_decorator_search(
|
|
|
1402
1402
|
|
|
1403
1403
|
for res in results:
|
|
1404
1404
|
decorators_str = ", ".join(res.get('decorators', []))
|
|
1405
|
-
|
|
1405
|
+
path = res.get('path', '') or ''
|
|
1406
1406
|
line_str = str(res.get('line_number', ''))
|
|
1407
|
-
location_str = f"{
|
|
1407
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1408
1408
|
|
|
1409
1409
|
table.add_row(
|
|
1410
1410
|
res.get('function_name', ''),
|
|
@@ -1447,9 +1447,9 @@ def find_by_argument_search(
|
|
|
1447
1447
|
table.add_column("Location", style="dim", overflow="fold")
|
|
1448
1448
|
|
|
1449
1449
|
for res in results:
|
|
1450
|
-
|
|
1450
|
+
path = res.get('path', '') or ''
|
|
1451
1451
|
line_str = str(res.get('line_number', ''))
|
|
1452
|
-
location_str = f"{
|
|
1452
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1453
1453
|
|
|
1454
1454
|
table.add_row(
|
|
1455
1455
|
res.get('function_name', ''),
|
|
@@ -1508,9 +1508,9 @@ def analyze_calls(
|
|
|
1508
1508
|
table.add_column("Type", style="yellow")
|
|
1509
1509
|
|
|
1510
1510
|
for result in results:
|
|
1511
|
-
|
|
1511
|
+
path = result.get("called_file_path", "")
|
|
1512
1512
|
line_str = str(result.get("called_line_number", ""))
|
|
1513
|
-
location_str = f"{
|
|
1513
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1514
1514
|
|
|
1515
1515
|
table.add_row(
|
|
1516
1516
|
result.get("called_function", ""),
|
|
@@ -1564,10 +1564,10 @@ def analyze_callers(
|
|
|
1564
1564
|
|
|
1565
1565
|
|
|
1566
1566
|
for result in results:
|
|
1567
|
-
|
|
1567
|
+
path = result.get("caller_file_path", "")
|
|
1568
1568
|
line_number = result.get("caller_line_number")
|
|
1569
1569
|
|
|
1570
|
-
location = f"{
|
|
1570
|
+
location = f"{path}:{line_number}" if line_number else path
|
|
1571
1571
|
|
|
1572
1572
|
table.add_row(
|
|
1573
1573
|
result.get("caller_function", ""),
|
|
@@ -1627,7 +1627,7 @@ def analyze_chain(
|
|
|
1627
1627
|
indent = " " * i
|
|
1628
1628
|
|
|
1629
1629
|
# Print function
|
|
1630
|
-
console.print(f"{indent}[cyan]{func.get('name', 'Unknown')}[/cyan] [dim]({func.get('
|
|
1630
|
+
console.print(f"{indent}[cyan]{func.get('name', 'Unknown')}[/cyan] [dim]({func.get('path', '')}:{func.get('line_number', '')})[/dim]")
|
|
1631
1631
|
|
|
1632
1632
|
# If there is a next step, print the connecting call detail
|
|
1633
1633
|
if i < len(functions) - 1 and i < len(call_details):
|
|
@@ -1694,9 +1694,9 @@ def analyze_dependencies(
|
|
|
1694
1694
|
table.add_column("Location", style="cyan", overflow="fold")
|
|
1695
1695
|
|
|
1696
1696
|
for imp in results['importers']:
|
|
1697
|
-
|
|
1697
|
+
path = imp.get('importer_file_path', '')
|
|
1698
1698
|
line_str = str(imp.get('import_line_number', ''))
|
|
1699
|
-
location_str = f"{
|
|
1699
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1700
1700
|
|
|
1701
1701
|
table.add_row(
|
|
1702
1702
|
location_str
|
|
@@ -1799,7 +1799,7 @@ def analyze_complexity(
|
|
|
1799
1799
|
if result:
|
|
1800
1800
|
console.print(f"\n[bold cyan]Complexity for '{path}':[/bold cyan]")
|
|
1801
1801
|
console.print(f" Cyclomatic Complexity: [yellow]{result.get('complexity', 'N/A')}[/yellow]")
|
|
1802
|
-
console.print(f" File: [dim]{result.get('
|
|
1802
|
+
console.print(f" File: [dim]{result.get('path', '')}[/dim]")
|
|
1803
1803
|
console.print(f" Line: [dim]{result.get('line_number', '')}[/dim]")
|
|
1804
1804
|
else:
|
|
1805
1805
|
console.print(f"[yellow]Function '{path}' not found or has no complexity data[/yellow]")
|
|
@@ -1819,9 +1819,9 @@ def analyze_complexity(
|
|
|
1819
1819
|
for func in results:
|
|
1820
1820
|
complexity = func.get('complexity', 0)
|
|
1821
1821
|
color = "red" if complexity > threshold else "yellow" if complexity > threshold/2 else "green"
|
|
1822
|
-
|
|
1822
|
+
path = func.get('path', '')
|
|
1823
1823
|
line_str = str(func.get('line_number', ''))
|
|
1824
|
-
location_str = f"{
|
|
1824
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1825
1825
|
|
|
1826
1826
|
table.add_row(
|
|
1827
1827
|
func.get('function_name', ''),
|
|
@@ -1868,9 +1868,9 @@ def analyze_dead_code(
|
|
|
1868
1868
|
table.add_column("Location", style="dim", overflow="fold")
|
|
1869
1869
|
|
|
1870
1870
|
for func in unused_funcs:
|
|
1871
|
-
|
|
1871
|
+
path = func.get('path', '')
|
|
1872
1872
|
line_str = str(func.get('line_number', ''))
|
|
1873
|
-
location_str = f"{
|
|
1873
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1874
1874
|
|
|
1875
1875
|
table.add_row(
|
|
1876
1876
|
func.get('function_name', ''),
|
|
@@ -1924,9 +1924,9 @@ def analyze_overrides(
|
|
|
1924
1924
|
table.add_column("Location", style="dim", overflow="fold")
|
|
1925
1925
|
|
|
1926
1926
|
for res in results:
|
|
1927
|
-
|
|
1927
|
+
path = res.get('class_file_path', '')
|
|
1928
1928
|
line_str = str(res.get('function_line_number', ''))
|
|
1929
|
-
location_str = f"{
|
|
1929
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1930
1930
|
|
|
1931
1931
|
table.add_row(
|
|
1932
1932
|
res.get('class_name', ''),
|
|
@@ -1989,9 +1989,9 @@ def analyze_variable_usage(
|
|
|
1989
1989
|
table.add_column("Value", style="yellow")
|
|
1990
1990
|
|
|
1991
1991
|
for item in items:
|
|
1992
|
-
|
|
1992
|
+
path = item.get('path', '')
|
|
1993
1993
|
line_str = str(item.get('line_number', ''))
|
|
1994
|
-
location_str = f"{
|
|
1994
|
+
location_str = f"{path}:{line_str}" if line_str else path
|
|
1995
1995
|
|
|
1996
1996
|
table.add_row(
|
|
1997
1997
|
item.get('scope_name', ''),
|
{codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/cli/setup_wizard.py
RENAMED
|
@@ -466,9 +466,9 @@ def setup_existing_db():
|
|
|
466
466
|
{"type": "input", "message": "Please enter the path to your credentials file:", "name": "cred_file_path"}
|
|
467
467
|
]
|
|
468
468
|
file_path_str = prompt(path_questions).get("cred_file_path", "")
|
|
469
|
-
|
|
470
|
-
if
|
|
471
|
-
file_to_parse =
|
|
469
|
+
path = Path(file_path_str.strip())
|
|
470
|
+
if path.exists() and path.is_file():
|
|
471
|
+
file_to_parse = path
|
|
472
472
|
else:
|
|
473
473
|
console.print("[red]❌ The specified file path does not exist or is not a file.[/red]")
|
|
474
474
|
return
|
|
@@ -584,9 +584,9 @@ def setup_hosted_db():
|
|
|
584
584
|
{"type": "input", "message": "Please enter the path to your credentials file:", "name": "cred_file_path"}
|
|
585
585
|
]
|
|
586
586
|
file_path_str = prompt(path_questions).get("cred_file_path", "")
|
|
587
|
-
|
|
588
|
-
if
|
|
589
|
-
file_to_parse =
|
|
587
|
+
path = Path(file_path_str.strip())
|
|
588
|
+
if path.exists() and path.is_file():
|
|
589
|
+
file_to_parse = path
|
|
590
590
|
else:
|
|
591
591
|
console.print("[red]❌ The specified file path does not exist or is not a file.[/red]")
|
|
592
592
|
return
|
|
@@ -486,13 +486,13 @@ def visualize_call_graph(
|
|
|
486
486
|
if direction == "outgoing":
|
|
487
487
|
# calls: function_name -> called_function
|
|
488
488
|
func_name = result.get("called_function", f"unknown_{idx}")
|
|
489
|
-
|
|
489
|
+
path = result.get("called_file_path", "")
|
|
490
490
|
line_num = result.get("called_line_number", "")
|
|
491
491
|
is_dep = result.get("called_is_dependency", False)
|
|
492
492
|
else:
|
|
493
493
|
# callers: caller_function -> function_name
|
|
494
494
|
func_name = result.get("caller_function", f"unknown_{idx}")
|
|
495
|
-
|
|
495
|
+
path = result.get("caller_file_path", "")
|
|
496
496
|
line_num = result.get("caller_line_number", "")
|
|
497
497
|
is_dep = result.get("caller_is_dependency", False)
|
|
498
498
|
|
|
@@ -507,7 +507,7 @@ def visualize_call_graph(
|
|
|
507
507
|
"id": node_id,
|
|
508
508
|
"label": func_name,
|
|
509
509
|
"group": node_type,
|
|
510
|
-
"title": f"{func_name}\nFile: {
|
|
510
|
+
"title": f"{func_name}\nFile: {path}\nLine: {line_num}",
|
|
511
511
|
"color": color
|
|
512
512
|
})
|
|
513
513
|
seen_nodes.add(node_id)
|
|
@@ -563,7 +563,7 @@ def visualize_call_chain(
|
|
|
563
563
|
|
|
564
564
|
for idx, func in enumerate(functions):
|
|
565
565
|
func_name = func.get("name", f"unknown_{idx}")
|
|
566
|
-
|
|
566
|
+
path = func.get("path", "")
|
|
567
567
|
line_num = func.get("line_number", "")
|
|
568
568
|
|
|
569
569
|
node_id = f"chain{chain_idx}_{func_name}_{idx}"
|
|
@@ -582,7 +582,7 @@ def visualize_call_chain(
|
|
|
582
582
|
"id": node_id,
|
|
583
583
|
"label": func_name,
|
|
584
584
|
"group": node_type,
|
|
585
|
-
"title": f"{func_name}\nFile: {
|
|
585
|
+
"title": f"{func_name}\nFile: {path}\nLine: {line_num}",
|
|
586
586
|
"color": color,
|
|
587
587
|
"level": idx # For hierarchical layout
|
|
588
588
|
})
|
|
@@ -647,8 +647,8 @@ def visualize_dependencies(
|
|
|
647
647
|
|
|
648
648
|
# Files that import this module
|
|
649
649
|
for idx, imp in enumerate(importers):
|
|
650
|
-
|
|
651
|
-
file_name = Path(
|
|
650
|
+
path = imp.get("importer_file_path", f"file_{idx}")
|
|
651
|
+
file_name = Path(path).name if path else f"file_{idx}"
|
|
652
652
|
node_id = f"importer_{idx}"
|
|
653
653
|
|
|
654
654
|
if node_id not in seen_nodes:
|
|
@@ -657,7 +657,7 @@ def visualize_dependencies(
|
|
|
657
657
|
"id": node_id,
|
|
658
658
|
"label": file_name,
|
|
659
659
|
"group": "Importer",
|
|
660
|
-
"title": f"File: {
|
|
660
|
+
"title": f"File: {path}\nLine: {imp.get('import_line_number', '')}",
|
|
661
661
|
"color": color
|
|
662
662
|
})
|
|
663
663
|
seen_nodes.add(node_id)
|
|
@@ -747,7 +747,7 @@ def visualize_inheritance_tree(
|
|
|
747
747
|
# Parent classes (above)
|
|
748
748
|
for idx, parent in enumerate(parents):
|
|
749
749
|
parent_name = parent.get("parent_class", f"Parent_{idx}")
|
|
750
|
-
|
|
750
|
+
path = parent.get("parent_file_path", "")
|
|
751
751
|
node_id = f"parent_{idx}"
|
|
752
752
|
|
|
753
753
|
if node_id not in seen_nodes:
|
|
@@ -756,7 +756,7 @@ def visualize_inheritance_tree(
|
|
|
756
756
|
"id": node_id,
|
|
757
757
|
"label": parent_name,
|
|
758
758
|
"group": "Parent",
|
|
759
|
-
"title": f"Parent: {parent_name}\nFile: {
|
|
759
|
+
"title": f"Parent: {parent_name}\nFile: {path}",
|
|
760
760
|
"color": color,
|
|
761
761
|
"level": 0 # Top level
|
|
762
762
|
})
|
|
@@ -772,7 +772,7 @@ def visualize_inheritance_tree(
|
|
|
772
772
|
# Child classes (below)
|
|
773
773
|
for idx, child in enumerate(children):
|
|
774
774
|
child_name = child.get("child_class", f"Child_{idx}")
|
|
775
|
-
|
|
775
|
+
path = child.get("child_file_path", "")
|
|
776
776
|
node_id = f"child_{idx}"
|
|
777
777
|
|
|
778
778
|
if node_id not in seen_nodes:
|
|
@@ -781,7 +781,7 @@ def visualize_inheritance_tree(
|
|
|
781
781
|
"id": node_id,
|
|
782
782
|
"label": child_name,
|
|
783
783
|
"group": "Child",
|
|
784
|
-
"title": f"Child: {child_name}\nFile: {
|
|
784
|
+
"title": f"Child: {child_name}\nFile: {path}",
|
|
785
785
|
"color": color,
|
|
786
786
|
"level": 2 # Bottom level
|
|
787
787
|
})
|
|
@@ -839,7 +839,7 @@ def visualize_overrides(
|
|
|
839
839
|
# Classes implementing this method
|
|
840
840
|
for idx, res in enumerate(results):
|
|
841
841
|
class_name = res.get("class_name", f"Class_{idx}")
|
|
842
|
-
|
|
842
|
+
path = res.get("class_file_path", "")
|
|
843
843
|
line_num = res.get("function_line_number", "")
|
|
844
844
|
node_id = f"class_{idx}"
|
|
845
845
|
|
|
@@ -849,7 +849,7 @@ def visualize_overrides(
|
|
|
849
849
|
"id": node_id,
|
|
850
850
|
"label": class_name,
|
|
851
851
|
"group": "Class",
|
|
852
|
-
"title": f"Class: {class_name}\nFile: {
|
|
852
|
+
"title": f"Class: {class_name}\nFile: {path}\nLine: {line_num}",
|
|
853
853
|
"color": color
|
|
854
854
|
})
|
|
855
855
|
seen_nodes.add(node_id)
|
|
@@ -877,7 +877,7 @@ def visualize_search_results(
|
|
|
877
877
|
Visualize search/find results as a cluster of nodes.
|
|
878
878
|
|
|
879
879
|
Args:
|
|
880
|
-
results: List of search results with name, type,
|
|
880
|
+
results: List of search results with name, type, path, etc.
|
|
881
881
|
search_term: The search term used
|
|
882
882
|
search_type: Type of search (name, pattern, type)
|
|
883
883
|
|
|
@@ -908,7 +908,7 @@ def visualize_search_results(
|
|
|
908
908
|
for idx, res in enumerate(results):
|
|
909
909
|
name = res.get("name", f"result_{idx}")
|
|
910
910
|
node_type = res.get("type", "Unknown")
|
|
911
|
-
|
|
911
|
+
path = res.get("path", "")
|
|
912
912
|
line_num = res.get("line_number", "")
|
|
913
913
|
is_dep = res.get("is_dependency", False)
|
|
914
914
|
|
|
@@ -920,7 +920,7 @@ def visualize_search_results(
|
|
|
920
920
|
"id": node_id,
|
|
921
921
|
"label": name,
|
|
922
922
|
"group": node_type,
|
|
923
|
-
"title": f"{node_type}: {name}\nFile: {
|
|
923
|
+
"title": f"{node_type}: {name}\nFile: {path}\nLine: {line_num}",
|
|
924
924
|
"color": color
|
|
925
925
|
})
|
|
926
926
|
seen_nodes.add(node_id)
|
|
@@ -351,7 +351,7 @@ class CGCBundle:
|
|
|
351
351
|
if repo_path:
|
|
352
352
|
query = """
|
|
353
353
|
MATCH (n)
|
|
354
|
-
WHERE n.path STARTS WITH $repo_path OR n.
|
|
354
|
+
WHERE n.path STARTS WITH $repo_path OR n.path STARTS WITH $repo_path
|
|
355
355
|
RETURN n, labels(n) as labels
|
|
356
356
|
"""
|
|
357
357
|
params = {"repo_path": str(repo_path.resolve())}
|
|
@@ -404,8 +404,8 @@ class CGCBundle:
|
|
|
404
404
|
if repo_path:
|
|
405
405
|
query = """
|
|
406
406
|
MATCH (n)-[r]->(m)
|
|
407
|
-
WHERE (n.path STARTS WITH $repo_path OR n.
|
|
408
|
-
OR (m.path STARTS WITH $repo_path OR m.
|
|
407
|
+
WHERE (n.path STARTS WITH $repo_path OR n.path STARTS WITH $repo_path)
|
|
408
|
+
OR (m.path STARTS WITH $repo_path OR m.path STARTS WITH $repo_path)
|
|
409
409
|
RETURN n, r, m, type(r) as rel_type
|
|
410
410
|
"""
|
|
411
411
|
params = {"repo_path": str(repo_path.resolve())}
|
|
@@ -556,10 +556,10 @@ cgc import <bundle-file>.cgc
|
|
|
556
556
|
def _create_zip(self, source_dir: Path, output_file: Path):
|
|
557
557
|
"""Create a ZIP archive from the bundle directory."""
|
|
558
558
|
with zipfile.ZipFile(output_file, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
|
559
|
-
for
|
|
560
|
-
if
|
|
561
|
-
arcname =
|
|
562
|
-
zipf.write(
|
|
559
|
+
for path in source_dir.rglob('*'):
|
|
560
|
+
if path.is_file():
|
|
561
|
+
arcname = path.relative_to(source_dir)
|
|
562
|
+
zipf.write(path, arcname)
|
|
563
563
|
|
|
564
564
|
# ========================================================================
|
|
565
565
|
# IMPORT HELPERS
|
|
@@ -55,7 +55,7 @@ You are an expert AI pair programmer. Your primary goal is to help a developer u
|
|
|
55
55
|
| **`execute_cypher_query`** | **Expert Fallback Tool.** Use this *only* when other tools cannot answer a very specific or complex question about the code graph. Requires knowledge of Cypher. |
|
|
56
56
|
|
|
57
57
|
## 4. Graph Schema Reference
|
|
58
|
-
**CRITICAL FOR CYPHER QUERIES:** The database schema uses specific property names
|
|
58
|
+
**CRITICAL FOR CYPHER QUERIES:** The database schema uses specific property names.
|
|
59
59
|
|
|
60
60
|
### Nodes & Properties
|
|
61
61
|
* **`Repository`**
|
|
@@ -69,7 +69,7 @@ You are an expert AI pair programmer. Your primary goal is to help a developer u
|
|
|
69
69
|
* `is_dependency` (boolean)
|
|
70
70
|
* **`Function`**
|
|
71
71
|
* `name` (string)
|
|
72
|
-
* `
|
|
72
|
+
* `path` (string, absolute path) **<-- NOTE: Use `path`, NOT `path`**
|
|
73
73
|
* `line_number` (int)
|
|
74
74
|
* `end_line` (int)
|
|
75
75
|
* `args` (list)
|
|
@@ -79,7 +79,7 @@ You are an expert AI pair programmer. Your primary goal is to help a developer u
|
|
|
79
79
|
* `is_dependency` (boolean)
|
|
80
80
|
* **`Class`**
|
|
81
81
|
* `name` (string)
|
|
82
|
-
* `
|
|
82
|
+
* `path` (string, absolute path) **<-- NOTE: Use `path`, NOT `path`**
|
|
83
83
|
* `line_number` (int)
|
|
84
84
|
* `end_line` (int)
|
|
85
85
|
* `bases` (list)
|
|
@@ -118,6 +118,6 @@ You are an expert AI pair programmer. Your primary goal is to help a developer u
|
|
|
118
118
|
### SOP-4: Using the Cypher Fallback
|
|
119
119
|
1. **Attempt Standard Tools:** First, always try to use `find_code` and `analyze_code_relationships`.
|
|
120
120
|
2. **Identify Failure:** If the standard tools cannot answer a complex, multi-step relationship query (e.g., "Find all functions that are called by a method in a class that inherits from 'BaseHandler'"), then and only then, resort to the fallback.
|
|
121
|
-
3. **Formulate & Execute:** Construct a Cypher query to find the answer and execute it using `execute_cypher_query`. **Consult the Graph Schema Reference above to ensure you use the correct property names (e.g. `
|
|
121
|
+
3. **Formulate & Execute:** Construct a Cypher query to find the answer and execute it using `execute_cypher_query`. **Consult the Graph Schema Reference above to ensure you use the correct property names (e.g. `path` vs `path`).**
|
|
122
122
|
4. **Present Results:** Explain the results to the user based on the query output.
|
|
123
123
|
"""
|
{codegraphcontext-0.1.40 → codegraphcontext-0.1.41}/src/codegraphcontext/tool_definitions.py
RENAMED
|
@@ -96,7 +96,7 @@ TOOLS = {
|
|
|
96
96
|
"type": "object",
|
|
97
97
|
"properties": {
|
|
98
98
|
"function_name": {"type": "string", "description": "The name of the function to analyze."},
|
|
99
|
-
"
|
|
99
|
+
"path": {"type": "string", "description": "Optional: The full path to the file containing the function for a more specific query."}
|
|
100
100
|
},
|
|
101
101
|
"required": ["function_name"]
|
|
102
102
|
}
|