tree-sitter-analyzer 0.2.0__py3-none-any.whl → 0.3.0__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 +133 -121
- tree_sitter_analyzer/__main__.py +11 -12
- tree_sitter_analyzer/api.py +531 -539
- tree_sitter_analyzer/cli/__init__.py +39 -39
- tree_sitter_analyzer/cli/__main__.py +12 -13
- tree_sitter_analyzer/cli/commands/__init__.py +26 -27
- tree_sitter_analyzer/cli/commands/advanced_command.py +88 -88
- tree_sitter_analyzer/cli/commands/base_command.py +160 -155
- tree_sitter_analyzer/cli/commands/default_command.py +18 -19
- tree_sitter_analyzer/cli/commands/partial_read_command.py +141 -133
- tree_sitter_analyzer/cli/commands/query_command.py +81 -82
- tree_sitter_analyzer/cli/commands/structure_command.py +138 -121
- tree_sitter_analyzer/cli/commands/summary_command.py +101 -93
- tree_sitter_analyzer/cli/commands/table_command.py +232 -233
- tree_sitter_analyzer/cli/info_commands.py +120 -121
- tree_sitter_analyzer/cli_main.py +277 -276
- tree_sitter_analyzer/core/__init__.py +15 -20
- tree_sitter_analyzer/core/analysis_engine.py +591 -574
- tree_sitter_analyzer/core/cache_service.py +320 -330
- tree_sitter_analyzer/core/engine.py +557 -560
- tree_sitter_analyzer/core/parser.py +293 -288
- tree_sitter_analyzer/core/query.py +494 -502
- tree_sitter_analyzer/encoding_utils.py +458 -460
- tree_sitter_analyzer/exceptions.py +337 -340
- tree_sitter_analyzer/file_handler.py +217 -222
- tree_sitter_analyzer/formatters/__init__.py +1 -1
- tree_sitter_analyzer/formatters/base_formatter.py +167 -168
- tree_sitter_analyzer/formatters/formatter_factory.py +78 -74
- tree_sitter_analyzer/formatters/java_formatter.py +287 -270
- tree_sitter_analyzer/formatters/python_formatter.py +255 -235
- tree_sitter_analyzer/interfaces/__init__.py +9 -10
- tree_sitter_analyzer/interfaces/cli.py +528 -557
- tree_sitter_analyzer/interfaces/cli_adapter.py +322 -319
- tree_sitter_analyzer/interfaces/mcp_adapter.py +180 -170
- tree_sitter_analyzer/interfaces/mcp_server.py +405 -416
- tree_sitter_analyzer/java_analyzer.py +218 -219
- tree_sitter_analyzer/language_detector.py +398 -400
- tree_sitter_analyzer/language_loader.py +224 -228
- tree_sitter_analyzer/languages/__init__.py +10 -11
- tree_sitter_analyzer/languages/java_plugin.py +1129 -1113
- tree_sitter_analyzer/languages/python_plugin.py +737 -712
- tree_sitter_analyzer/mcp/__init__.py +31 -32
- tree_sitter_analyzer/mcp/resources/__init__.py +44 -47
- tree_sitter_analyzer/mcp/resources/code_file_resource.py +212 -213
- tree_sitter_analyzer/mcp/resources/project_stats_resource.py +560 -550
- tree_sitter_analyzer/mcp/server.py +333 -345
- tree_sitter_analyzer/mcp/tools/__init__.py +30 -31
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +621 -557
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +242 -245
- tree_sitter_analyzer/mcp/tools/base_tool.py +54 -55
- tree_sitter_analyzer/mcp/tools/read_partial_tool.py +300 -302
- tree_sitter_analyzer/mcp/tools/table_format_tool.py +362 -359
- tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +543 -476
- tree_sitter_analyzer/mcp/utils/__init__.py +105 -106
- tree_sitter_analyzer/mcp/utils/error_handler.py +549 -549
- tree_sitter_analyzer/models.py +470 -481
- tree_sitter_analyzer/output_manager.py +261 -264
- tree_sitter_analyzer/plugins/__init__.py +333 -334
- tree_sitter_analyzer/plugins/base.py +477 -446
- tree_sitter_analyzer/plugins/java_plugin.py +608 -625
- tree_sitter_analyzer/plugins/javascript_plugin.py +446 -439
- tree_sitter_analyzer/plugins/manager.py +362 -355
- tree_sitter_analyzer/plugins/plugin_loader.py +85 -83
- tree_sitter_analyzer/plugins/python_plugin.py +606 -598
- tree_sitter_analyzer/plugins/registry.py +374 -366
- tree_sitter_analyzer/queries/__init__.py +26 -27
- tree_sitter_analyzer/queries/java.py +391 -394
- tree_sitter_analyzer/queries/javascript.py +148 -149
- tree_sitter_analyzer/queries/python.py +285 -286
- tree_sitter_analyzer/queries/typescript.py +229 -230
- tree_sitter_analyzer/query_loader.py +254 -260
- tree_sitter_analyzer/table_formatter.py +468 -448
- tree_sitter_analyzer/utils.py +277 -277
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.3.0.dist-info}/METADATA +21 -6
- tree_sitter_analyzer-0.3.0.dist-info/RECORD +77 -0
- tree_sitter_analyzer-0.2.0.dist-info/RECORD +0 -77
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.3.0.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.3.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,83 +1,85 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
from
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
java_plugin
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
python_plugin
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Plugin Loader for Tree-sitter Analyzer
|
|
4
|
+
|
|
5
|
+
Automatically loads and registers all available language plugins.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from ..utils import log_debug, log_error, log_info
|
|
11
|
+
from . import plugin_registry
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from .base import LanguagePlugin
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def load_all_plugins() -> list[str]:
|
|
18
|
+
"""Load and register all available language plugins"""
|
|
19
|
+
loaded_plugins = []
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
# Import and register Java plugin
|
|
23
|
+
from .java_plugin import JavaPlugin
|
|
24
|
+
|
|
25
|
+
java_plugin = JavaPlugin()
|
|
26
|
+
plugin_registry.register_plugin(java_plugin)
|
|
27
|
+
loaded_plugins.append("java")
|
|
28
|
+
log_debug("Loaded Java plugin")
|
|
29
|
+
except Exception as e:
|
|
30
|
+
log_error(f"Failed to load Java plugin: {e}")
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
# Import and register JavaScript plugin
|
|
34
|
+
from .javascript_plugin import JavaScriptPlugin
|
|
35
|
+
|
|
36
|
+
js_plugin = JavaScriptPlugin()
|
|
37
|
+
plugin_registry.register_plugin(js_plugin)
|
|
38
|
+
loaded_plugins.append("javascript")
|
|
39
|
+
log_debug("Loaded JavaScript plugin")
|
|
40
|
+
except Exception as e:
|
|
41
|
+
log_error(f"Failed to load JavaScript plugin: {e}")
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
# Import and register Python plugin
|
|
45
|
+
from .python_plugin import PythonPlugin
|
|
46
|
+
|
|
47
|
+
python_plugin = PythonPlugin()
|
|
48
|
+
plugin_registry.register_plugin(python_plugin)
|
|
49
|
+
loaded_plugins.append("python")
|
|
50
|
+
log_debug("Loaded Python plugin")
|
|
51
|
+
except Exception as e:
|
|
52
|
+
log_error(f"Failed to load Python plugin: {e}")
|
|
53
|
+
|
|
54
|
+
if loaded_plugins:
|
|
55
|
+
log_info(
|
|
56
|
+
f"Successfully loaded {len(loaded_plugins)} language plugins: {', '.join(loaded_plugins)}"
|
|
57
|
+
)
|
|
58
|
+
else:
|
|
59
|
+
log_error("No language plugins were loaded successfully")
|
|
60
|
+
|
|
61
|
+
return loaded_plugins
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def get_supported_languages() -> list[str]:
|
|
65
|
+
"""Get list of all supported languages"""
|
|
66
|
+
return plugin_registry.list_supported_languages()
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_supported_extensions() -> list[str]:
|
|
70
|
+
"""Get list of all supported file extensions"""
|
|
71
|
+
return plugin_registry.list_supported_extensions()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def get_plugin_for_file(file_path: str) -> "LanguagePlugin | None":
|
|
75
|
+
"""Get appropriate plugin for a file"""
|
|
76
|
+
return plugin_registry.get_plugin_for_file(file_path)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def get_plugin_by_language(language: str) -> "LanguagePlugin | None":
|
|
80
|
+
"""Get plugin by language name"""
|
|
81
|
+
return plugin_registry.get_plugin(language)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# Auto-load plugins when module is imported
|
|
85
|
+
_loaded_plugins = load_all_plugins()
|