tree-sitter-analyzer 0.8.3__py3-none-any.whl → 0.9.2__py3-none-any.whl
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.
Potentially problematic release.
This version of tree-sitter-analyzer might be problematic. Click here for more details.
- tree_sitter_analyzer/__init__.py +132 -132
- tree_sitter_analyzer/__main__.py +11 -11
- tree_sitter_analyzer/api.py +533 -533
- tree_sitter_analyzer/cli/__init__.py +39 -39
- tree_sitter_analyzer/cli/__main__.py +12 -12
- tree_sitter_analyzer/cli/commands/__init__.py +26 -26
- tree_sitter_analyzer/cli/commands/advanced_command.py +88 -88
- tree_sitter_analyzer/cli/commands/base_command.py +182 -180
- tree_sitter_analyzer/cli/commands/structure_command.py +138 -138
- tree_sitter_analyzer/cli/commands/summary_command.py +101 -101
- tree_sitter_analyzer/core/__init__.py +15 -15
- tree_sitter_analyzer/core/analysis_engine.py +74 -78
- tree_sitter_analyzer/core/cache_service.py +320 -320
- tree_sitter_analyzer/core/engine.py +566 -566
- tree_sitter_analyzer/core/parser.py +293 -293
- tree_sitter_analyzer/encoding_utils.py +459 -459
- tree_sitter_analyzer/file_handler.py +210 -210
- tree_sitter_analyzer/formatters/__init__.py +1 -1
- tree_sitter_analyzer/formatters/base_formatter.py +167 -167
- tree_sitter_analyzer/formatters/formatter_factory.py +78 -78
- tree_sitter_analyzer/formatters/java_formatter.py +18 -18
- tree_sitter_analyzer/formatters/python_formatter.py +19 -19
- tree_sitter_analyzer/interfaces/__init__.py +9 -9
- tree_sitter_analyzer/interfaces/cli.py +528 -528
- tree_sitter_analyzer/interfaces/cli_adapter.py +344 -343
- tree_sitter_analyzer/interfaces/mcp_adapter.py +206 -206
- tree_sitter_analyzer/language_detector.py +53 -53
- tree_sitter_analyzer/languages/__init__.py +10 -10
- tree_sitter_analyzer/languages/java_plugin.py +1 -1
- tree_sitter_analyzer/languages/javascript_plugin.py +446 -446
- tree_sitter_analyzer/languages/python_plugin.py +755 -755
- tree_sitter_analyzer/mcp/__init__.py +34 -31
- tree_sitter_analyzer/mcp/resources/__init__.py +44 -44
- tree_sitter_analyzer/mcp/resources/code_file_resource.py +209 -209
- tree_sitter_analyzer/mcp/server.py +623 -436
- tree_sitter_analyzer/mcp/tools/__init__.py +30 -30
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +10 -6
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +247 -242
- tree_sitter_analyzer/mcp/tools/base_tool.py +54 -54
- tree_sitter_analyzer/mcp/tools/read_partial_tool.py +310 -308
- tree_sitter_analyzer/mcp/tools/table_format_tool.py +386 -379
- tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +563 -559
- tree_sitter_analyzer/mcp/utils/__init__.py +107 -107
- tree_sitter_analyzer/models.py +10 -10
- tree_sitter_analyzer/output_manager.py +253 -253
- tree_sitter_analyzer/plugins/__init__.py +280 -280
- tree_sitter_analyzer/plugins/base.py +529 -529
- tree_sitter_analyzer/plugins/manager.py +379 -379
- tree_sitter_analyzer/queries/__init__.py +26 -26
- tree_sitter_analyzer/queries/java.py +391 -391
- tree_sitter_analyzer/queries/javascript.py +148 -148
- tree_sitter_analyzer/queries/python.py +285 -285
- tree_sitter_analyzer/queries/typescript.py +229 -229
- tree_sitter_analyzer/query_loader.py +257 -257
- tree_sitter_analyzer/security/boundary_manager.py +237 -279
- tree_sitter_analyzer/security/validator.py +60 -58
- tree_sitter_analyzer/utils.py +294 -277
- {tree_sitter_analyzer-0.8.3.dist-info → tree_sitter_analyzer-0.9.2.dist-info}/METADATA +28 -19
- tree_sitter_analyzer-0.9.2.dist-info/RECORD +77 -0
- {tree_sitter_analyzer-0.8.3.dist-info → tree_sitter_analyzer-0.9.2.dist-info}/entry_points.txt +1 -0
- tree_sitter_analyzer-0.8.3.dist-info/RECORD +0 -77
- {tree_sitter_analyzer-0.8.3.dist-info → tree_sitter_analyzer-0.9.2.dist-info}/WHEEL +0 -0
|
@@ -9,20 +9,20 @@ from .base_formatter import BaseTableFormatter
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class PythonTableFormatter(BaseTableFormatter):
|
|
12
|
-
"""Python
|
|
12
|
+
"""Table formatter specialized for Python"""
|
|
13
13
|
|
|
14
14
|
def _format_full_table(self, data: dict[str, Any]) -> str:
|
|
15
|
-
"""Python
|
|
15
|
+
"""Full table format for Python"""
|
|
16
16
|
lines = []
|
|
17
17
|
|
|
18
|
-
#
|
|
18
|
+
# Header - Python (multi-class supported)
|
|
19
19
|
classes = data.get("classes", [])
|
|
20
20
|
if len(classes) > 1:
|
|
21
|
-
#
|
|
21
|
+
# If multiple classes exist, use filename
|
|
22
22
|
file_name = data.get("file_path", "Unknown").split("/")[-1].split("\\")[-1]
|
|
23
23
|
lines.append(f"# {file_name}")
|
|
24
24
|
else:
|
|
25
|
-
#
|
|
25
|
+
# Single class: use class name
|
|
26
26
|
class_name = classes[0].get("name", "Unknown") if classes else "Unknown"
|
|
27
27
|
lines.append(f"# {class_name}")
|
|
28
28
|
lines.append("")
|
|
@@ -37,7 +37,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
37
37
|
lines.append("```")
|
|
38
38
|
lines.append("")
|
|
39
39
|
|
|
40
|
-
# Classes - Python
|
|
40
|
+
# Classes - Python (multi-class aware)
|
|
41
41
|
if len(classes) > 1:
|
|
42
42
|
lines.append("## Classes")
|
|
43
43
|
lines.append("| Class | Type | Visibility | Lines | Methods | Fields |")
|
|
@@ -50,7 +50,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
50
50
|
line_range = class_info.get("line_range", {})
|
|
51
51
|
lines_str = f"{line_range.get('start', 0)}-{line_range.get('end', 0)}"
|
|
52
52
|
|
|
53
|
-
#
|
|
53
|
+
# Count methods/fields within the class range
|
|
54
54
|
class_methods = [
|
|
55
55
|
m
|
|
56
56
|
for m in data.get("methods", [])
|
|
@@ -70,7 +70,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
70
70
|
f"| {name} | {class_type} | {visibility} | {lines_str} | {len(class_methods)} | {len(class_fields)} |"
|
|
71
71
|
)
|
|
72
72
|
else:
|
|
73
|
-
#
|
|
73
|
+
# Single class details
|
|
74
74
|
lines.append("## Class Info")
|
|
75
75
|
lines.append("| Property | Value |")
|
|
76
76
|
lines.append("|----------|-------|")
|
|
@@ -112,7 +112,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
112
112
|
)
|
|
113
113
|
lines.append("")
|
|
114
114
|
|
|
115
|
-
# Methods - Python
|
|
115
|
+
# Methods - Python (no constructor separation)
|
|
116
116
|
methods = data.get("methods", [])
|
|
117
117
|
if methods:
|
|
118
118
|
lines.append("## Methods")
|
|
@@ -123,17 +123,17 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
123
123
|
lines.append(self._format_method_row(method))
|
|
124
124
|
lines.append("")
|
|
125
125
|
|
|
126
|
-
#
|
|
126
|
+
# Trim trailing blank lines
|
|
127
127
|
while lines and lines[-1] == "":
|
|
128
128
|
lines.pop()
|
|
129
129
|
|
|
130
130
|
return "\n".join(lines)
|
|
131
131
|
|
|
132
132
|
def _format_compact_table(self, data: dict[str, Any]) -> str:
|
|
133
|
-
"""Python
|
|
133
|
+
"""Compact table format for Python"""
|
|
134
134
|
lines = []
|
|
135
135
|
|
|
136
|
-
#
|
|
136
|
+
# Header
|
|
137
137
|
classes = data.get("classes", [])
|
|
138
138
|
if len(classes) > 1:
|
|
139
139
|
file_name = data.get("file_path", "Unknown").split("/")[-1].split("\\")[-1]
|
|
@@ -143,7 +143,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
143
143
|
lines.append(f"# {class_name}")
|
|
144
144
|
lines.append("")
|
|
145
145
|
|
|
146
|
-
#
|
|
146
|
+
# Info
|
|
147
147
|
stats = data.get("statistics") or {}
|
|
148
148
|
lines.append("## Info")
|
|
149
149
|
lines.append("| Property | Value |")
|
|
@@ -153,7 +153,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
153
153
|
lines.append(f"| Fields | {stats.get('field_count', 0)} |")
|
|
154
154
|
lines.append("")
|
|
155
155
|
|
|
156
|
-
#
|
|
156
|
+
# Methods (compact)
|
|
157
157
|
methods = data.get("methods", [])
|
|
158
158
|
if methods:
|
|
159
159
|
lines.append("## Methods")
|
|
@@ -176,20 +176,20 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
176
176
|
)
|
|
177
177
|
lines.append("")
|
|
178
178
|
|
|
179
|
-
#
|
|
179
|
+
# Trim trailing blank lines
|
|
180
180
|
while lines and lines[-1] == "":
|
|
181
181
|
lines.pop()
|
|
182
182
|
|
|
183
183
|
return "\n".join(lines)
|
|
184
184
|
|
|
185
185
|
def _format_method_row(self, method: dict[str, Any]) -> str:
|
|
186
|
-
"""Python
|
|
186
|
+
"""Format a method table row for Python"""
|
|
187
187
|
name = str(method.get("name", ""))
|
|
188
188
|
signature = self._create_full_signature(method)
|
|
189
189
|
visibility = self._convert_visibility(str(method.get("visibility", "")))
|
|
190
190
|
line_range = method.get("line_range", {})
|
|
191
191
|
lines_str = f"{line_range.get('start', 0)}-{line_range.get('end', 0)}"
|
|
192
|
-
cols_str = "5-6" #
|
|
192
|
+
cols_str = "5-6" # default placeholder
|
|
193
193
|
complexity = method.get("complexity_score", 0)
|
|
194
194
|
doc = self._clean_csv_text(
|
|
195
195
|
self._extract_doc_summary(str(method.get("javadoc", "")))
|
|
@@ -198,7 +198,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
198
198
|
return f"| {name} | {signature} | {visibility} | {lines_str} | {cols_str} | {complexity} | {doc} |"
|
|
199
199
|
|
|
200
200
|
def _create_compact_signature(self, method: dict[str, Any]) -> str:
|
|
201
|
-
"""Python
|
|
201
|
+
"""Create compact method signature for Python"""
|
|
202
202
|
params = method.get("parameters", [])
|
|
203
203
|
param_types = []
|
|
204
204
|
|
|
@@ -214,7 +214,7 @@ class PythonTableFormatter(BaseTableFormatter):
|
|
|
214
214
|
return f"({params_str}):{return_type}"
|
|
215
215
|
|
|
216
216
|
def _shorten_type(self, type_name: Any) -> str:
|
|
217
|
-
"""Python
|
|
217
|
+
"""Shorten type name for Python tables"""
|
|
218
218
|
if type_name is None:
|
|
219
219
|
return "Any"
|
|
220
220
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Interfaces Package
|
|
4
|
-
|
|
5
|
-
This package contains the external interfaces for the tree-sitter analyzer.
|
|
6
|
-
Each interface provides a different way to interact with the core analysis engine.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
# This file makes the interfaces directory a Python package
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Interfaces Package
|
|
4
|
+
|
|
5
|
+
This package contains the external interfaces for the tree-sitter analyzer.
|
|
6
|
+
Each interface provides a different way to interact with the core analysis engine.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# This file makes the interfaces directory a Python package
|