tree-sitter-analyzer 0.2.0__py3-none-any.whl → 0.4.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 +134 -121
- tree_sitter_analyzer/__main__.py +11 -12
- tree_sitter_analyzer/api.py +533 -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 +235 -233
- tree_sitter_analyzer/cli/info_commands.py +120 -121
- tree_sitter_analyzer/cli_main.py +278 -276
- tree_sitter_analyzer/core/__init__.py +15 -20
- tree_sitter_analyzer/core/analysis_engine.py +555 -574
- tree_sitter_analyzer/core/cache_service.py +320 -330
- tree_sitter_analyzer/core/engine.py +559 -560
- tree_sitter_analyzer/core/parser.py +293 -288
- tree_sitter_analyzer/core/query.py +502 -502
- tree_sitter_analyzer/encoding_utils.py +456 -460
- tree_sitter_analyzer/exceptions.py +337 -340
- tree_sitter_analyzer/file_handler.py +210 -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 +291 -270
- tree_sitter_analyzer/formatters/python_formatter.py +259 -235
- tree_sitter_analyzer/interfaces/__init__.py +9 -10
- tree_sitter_analyzer/interfaces/cli.py +528 -557
- tree_sitter_analyzer/interfaces/cli_adapter.py +343 -319
- tree_sitter_analyzer/interfaces/mcp_adapter.py +206 -170
- tree_sitter_analyzer/interfaces/mcp_server.py +405 -416
- tree_sitter_analyzer/java_analyzer.py +187 -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 +1174 -1113
- tree_sitter_analyzer/{plugins → languages}/javascript_plugin.py +446 -439
- tree_sitter_analyzer/languages/python_plugin.py +747 -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 +209 -213
- tree_sitter_analyzer/mcp/resources/project_stats_resource.py +555 -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 +654 -557
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +247 -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 +107 -106
- tree_sitter_analyzer/mcp/utils/error_handler.py +549 -549
- tree_sitter_analyzer/models.py +470 -481
- tree_sitter_analyzer/output_manager.py +255 -264
- tree_sitter_analyzer/plugins/__init__.py +280 -334
- tree_sitter_analyzer/plugins/base.py +496 -446
- tree_sitter_analyzer/plugins/manager.py +379 -355
- 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 +257 -260
- tree_sitter_analyzer/table_formatter.py +471 -448
- tree_sitter_analyzer/utils.py +277 -277
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.4.0.dist-info}/METADATA +23 -8
- tree_sitter_analyzer-0.4.0.dist-info/RECORD +73 -0
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.4.0.dist-info}/entry_points.txt +2 -1
- tree_sitter_analyzer/plugins/java_plugin.py +0 -625
- tree_sitter_analyzer/plugins/plugin_loader.py +0 -83
- tree_sitter_analyzer/plugins/python_plugin.py +0 -598
- tree_sitter_analyzer/plugins/registry.py +0 -366
- tree_sitter_analyzer-0.2.0.dist-info/RECORD +0 -77
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.4.0.dist-info}/WHEEL +0 -0
tree_sitter_analyzer/__init__.py
CHANGED
|
@@ -1,121 +1,134 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
from .
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
from .
|
|
67
|
-
|
|
68
|
-
# Import new utility modules
|
|
69
|
-
from .utils import (
|
|
70
|
-
QuietMode,
|
|
71
|
-
log_debug,
|
|
72
|
-
log_error,
|
|
73
|
-
log_info,
|
|
74
|
-
log_performance,
|
|
75
|
-
log_warning,
|
|
76
|
-
safe_print,
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
__all__ = [
|
|
80
|
-
# Core Models (optimized)
|
|
81
|
-
"JavaAnnotation",
|
|
82
|
-
"JavaClass",
|
|
83
|
-
"JavaImport",
|
|
84
|
-
"JavaMethod",
|
|
85
|
-
"JavaField",
|
|
86
|
-
"JavaPackage",
|
|
87
|
-
"AnalysisResult",
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
#
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Tree-sitter Multi-Language Code Analyzer
|
|
4
|
+
|
|
5
|
+
A comprehensive Python library for analyzing code across multiple programming languages
|
|
6
|
+
using Tree-sitter. Features a plugin-based architecture for extensible language support.
|
|
7
|
+
|
|
8
|
+
Architecture:
|
|
9
|
+
- Core Engine: UniversalCodeAnalyzer, LanguageDetector, QueryLoader
|
|
10
|
+
- Plugin System: Extensible language-specific analyzers and extractors
|
|
11
|
+
- Data Models: Generic and language-specific code element representations
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__version__ = "0.4.0"
|
|
15
|
+
__author__ = "aisheng.yu"
|
|
16
|
+
__email__ = "aimasteracc@gmail.com"
|
|
17
|
+
|
|
18
|
+
# Legacy imports for backward compatibility
|
|
19
|
+
|
|
20
|
+
# Core Engine - 一時的に直接インポート
|
|
21
|
+
from .core.analysis_engine import UnifiedAnalysisEngine as UniversalCodeAnalyzer
|
|
22
|
+
from .encoding_utils import (
|
|
23
|
+
EncodingManager,
|
|
24
|
+
detect_encoding,
|
|
25
|
+
extract_text_slice,
|
|
26
|
+
read_file_safe,
|
|
27
|
+
safe_decode,
|
|
28
|
+
safe_encode,
|
|
29
|
+
write_file_safe,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# from .java_advanced_analyzer import AdvancedAnalyzer # Removed - migrated to plugin system
|
|
33
|
+
from .java_analyzer import CodeAnalyzer
|
|
34
|
+
from .language_detector import LanguageDetector
|
|
35
|
+
from .language_loader import get_loader
|
|
36
|
+
|
|
37
|
+
# Data Models (Java-specific for backward compatibility)
|
|
38
|
+
# Data Models (Generic)
|
|
39
|
+
from .models import (
|
|
40
|
+
AnalysisResult,
|
|
41
|
+
Class,
|
|
42
|
+
CodeElement,
|
|
43
|
+
Function,
|
|
44
|
+
Import,
|
|
45
|
+
JavaAnnotation,
|
|
46
|
+
JavaClass,
|
|
47
|
+
JavaField,
|
|
48
|
+
JavaImport,
|
|
49
|
+
JavaMethod,
|
|
50
|
+
JavaPackage,
|
|
51
|
+
Variable,
|
|
52
|
+
)
|
|
53
|
+
from .output_manager import (
|
|
54
|
+
OutputManager,
|
|
55
|
+
get_output_manager,
|
|
56
|
+
output_data,
|
|
57
|
+
output_error,
|
|
58
|
+
output_info,
|
|
59
|
+
output_warning,
|
|
60
|
+
set_output_mode,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Plugin System
|
|
64
|
+
from .plugins import ElementExtractor, LanguagePlugin
|
|
65
|
+
from .plugins.manager import PluginManager
|
|
66
|
+
from .query_loader import QueryLoader, get_query_loader
|
|
67
|
+
|
|
68
|
+
# Import new utility modules
|
|
69
|
+
from .utils import (
|
|
70
|
+
QuietMode,
|
|
71
|
+
log_debug,
|
|
72
|
+
log_error,
|
|
73
|
+
log_info,
|
|
74
|
+
log_performance,
|
|
75
|
+
log_warning,
|
|
76
|
+
safe_print,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
__all__ = [
|
|
80
|
+
# Core Models (optimized)
|
|
81
|
+
"JavaAnnotation",
|
|
82
|
+
"JavaClass",
|
|
83
|
+
"JavaImport",
|
|
84
|
+
"JavaMethod",
|
|
85
|
+
"JavaField",
|
|
86
|
+
"JavaPackage",
|
|
87
|
+
"AnalysisResult",
|
|
88
|
+
# Model classes
|
|
89
|
+
"Class",
|
|
90
|
+
"CodeElement",
|
|
91
|
+
"Function",
|
|
92
|
+
"Import",
|
|
93
|
+
"Variable",
|
|
94
|
+
# Plugin system
|
|
95
|
+
"ElementExtractor",
|
|
96
|
+
"LanguagePlugin",
|
|
97
|
+
"PluginManager",
|
|
98
|
+
"QueryLoader",
|
|
99
|
+
# Language detection
|
|
100
|
+
"LanguageDetector",
|
|
101
|
+
# Core Components (optimized)
|
|
102
|
+
# "AdvancedAnalyzer", # Removed - migrated to plugin system
|
|
103
|
+
"get_loader",
|
|
104
|
+
"get_query_loader",
|
|
105
|
+
# New Utilities
|
|
106
|
+
"log_info",
|
|
107
|
+
"log_warning",
|
|
108
|
+
"log_error",
|
|
109
|
+
"log_debug",
|
|
110
|
+
"QuietMode",
|
|
111
|
+
"safe_print",
|
|
112
|
+
"log_performance",
|
|
113
|
+
# Output Management
|
|
114
|
+
"OutputManager",
|
|
115
|
+
"set_output_mode",
|
|
116
|
+
"get_output_manager",
|
|
117
|
+
"output_info",
|
|
118
|
+
"output_warning",
|
|
119
|
+
"output_error",
|
|
120
|
+
"output_data",
|
|
121
|
+
# Legacy Components (backward compatibility)
|
|
122
|
+
"CodeAnalyzer",
|
|
123
|
+
"UniversalCodeAnalyzer",
|
|
124
|
+
# Version
|
|
125
|
+
"__version__",
|
|
126
|
+
# Encoding utilities
|
|
127
|
+
"EncodingManager",
|
|
128
|
+
"safe_encode",
|
|
129
|
+
"safe_decode",
|
|
130
|
+
"detect_encoding",
|
|
131
|
+
"read_file_safe",
|
|
132
|
+
"write_file_safe",
|
|
133
|
+
"extract_text_slice",
|
|
134
|
+
]
|
tree_sitter_analyzer/__main__.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
main()
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Tree-sitter Analyzer パッケージのメインエントリーポイント
|
|
4
|
+
|
|
5
|
+
このファイルにより、`python -m tree_sitter_analyzer` でパッケージを実行できます。
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .cli_main import main
|
|
9
|
+
|
|
10
|
+
if __name__ == "__main__":
|
|
11
|
+
main()
|