tree-sitter-analyzer 1.9.17.1__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.
- tree_sitter_analyzer/__init__.py +132 -0
- tree_sitter_analyzer/__main__.py +11 -0
- tree_sitter_analyzer/api.py +853 -0
- tree_sitter_analyzer/cli/__init__.py +39 -0
- tree_sitter_analyzer/cli/__main__.py +12 -0
- tree_sitter_analyzer/cli/argument_validator.py +89 -0
- tree_sitter_analyzer/cli/commands/__init__.py +26 -0
- tree_sitter_analyzer/cli/commands/advanced_command.py +226 -0
- tree_sitter_analyzer/cli/commands/base_command.py +181 -0
- tree_sitter_analyzer/cli/commands/default_command.py +18 -0
- tree_sitter_analyzer/cli/commands/find_and_grep_cli.py +188 -0
- tree_sitter_analyzer/cli/commands/list_files_cli.py +133 -0
- tree_sitter_analyzer/cli/commands/partial_read_command.py +139 -0
- tree_sitter_analyzer/cli/commands/query_command.py +109 -0
- tree_sitter_analyzer/cli/commands/search_content_cli.py +161 -0
- tree_sitter_analyzer/cli/commands/structure_command.py +156 -0
- tree_sitter_analyzer/cli/commands/summary_command.py +116 -0
- tree_sitter_analyzer/cli/commands/table_command.py +414 -0
- tree_sitter_analyzer/cli/info_commands.py +124 -0
- tree_sitter_analyzer/cli_main.py +472 -0
- tree_sitter_analyzer/constants.py +85 -0
- tree_sitter_analyzer/core/__init__.py +15 -0
- tree_sitter_analyzer/core/analysis_engine.py +580 -0
- tree_sitter_analyzer/core/cache_service.py +333 -0
- tree_sitter_analyzer/core/engine.py +585 -0
- tree_sitter_analyzer/core/parser.py +293 -0
- tree_sitter_analyzer/core/query.py +605 -0
- tree_sitter_analyzer/core/query_filter.py +200 -0
- tree_sitter_analyzer/core/query_service.py +340 -0
- tree_sitter_analyzer/encoding_utils.py +530 -0
- tree_sitter_analyzer/exceptions.py +747 -0
- tree_sitter_analyzer/file_handler.py +246 -0
- tree_sitter_analyzer/formatters/__init__.py +1 -0
- tree_sitter_analyzer/formatters/base_formatter.py +201 -0
- tree_sitter_analyzer/formatters/csharp_formatter.py +367 -0
- tree_sitter_analyzer/formatters/formatter_config.py +197 -0
- tree_sitter_analyzer/formatters/formatter_factory.py +84 -0
- tree_sitter_analyzer/formatters/formatter_registry.py +377 -0
- tree_sitter_analyzer/formatters/formatter_selector.py +96 -0
- tree_sitter_analyzer/formatters/go_formatter.py +368 -0
- tree_sitter_analyzer/formatters/html_formatter.py +498 -0
- tree_sitter_analyzer/formatters/java_formatter.py +423 -0
- tree_sitter_analyzer/formatters/javascript_formatter.py +611 -0
- tree_sitter_analyzer/formatters/kotlin_formatter.py +268 -0
- tree_sitter_analyzer/formatters/language_formatter_factory.py +123 -0
- tree_sitter_analyzer/formatters/legacy_formatter_adapters.py +228 -0
- tree_sitter_analyzer/formatters/markdown_formatter.py +725 -0
- tree_sitter_analyzer/formatters/php_formatter.py +301 -0
- tree_sitter_analyzer/formatters/python_formatter.py +830 -0
- tree_sitter_analyzer/formatters/ruby_formatter.py +278 -0
- tree_sitter_analyzer/formatters/rust_formatter.py +233 -0
- tree_sitter_analyzer/formatters/sql_formatter_wrapper.py +689 -0
- tree_sitter_analyzer/formatters/sql_formatters.py +536 -0
- tree_sitter_analyzer/formatters/typescript_formatter.py +543 -0
- tree_sitter_analyzer/formatters/yaml_formatter.py +462 -0
- tree_sitter_analyzer/interfaces/__init__.py +9 -0
- tree_sitter_analyzer/interfaces/cli.py +535 -0
- tree_sitter_analyzer/interfaces/cli_adapter.py +359 -0
- tree_sitter_analyzer/interfaces/mcp_adapter.py +224 -0
- tree_sitter_analyzer/interfaces/mcp_server.py +428 -0
- tree_sitter_analyzer/language_detector.py +553 -0
- tree_sitter_analyzer/language_loader.py +271 -0
- tree_sitter_analyzer/languages/__init__.py +10 -0
- tree_sitter_analyzer/languages/csharp_plugin.py +1076 -0
- tree_sitter_analyzer/languages/css_plugin.py +449 -0
- tree_sitter_analyzer/languages/go_plugin.py +836 -0
- tree_sitter_analyzer/languages/html_plugin.py +496 -0
- tree_sitter_analyzer/languages/java_plugin.py +1299 -0
- tree_sitter_analyzer/languages/javascript_plugin.py +1622 -0
- tree_sitter_analyzer/languages/kotlin_plugin.py +656 -0
- tree_sitter_analyzer/languages/markdown_plugin.py +1928 -0
- tree_sitter_analyzer/languages/php_plugin.py +862 -0
- tree_sitter_analyzer/languages/python_plugin.py +1636 -0
- tree_sitter_analyzer/languages/ruby_plugin.py +757 -0
- tree_sitter_analyzer/languages/rust_plugin.py +673 -0
- tree_sitter_analyzer/languages/sql_plugin.py +2444 -0
- tree_sitter_analyzer/languages/typescript_plugin.py +1892 -0
- tree_sitter_analyzer/languages/yaml_plugin.py +695 -0
- tree_sitter_analyzer/legacy_table_formatter.py +860 -0
- tree_sitter_analyzer/mcp/__init__.py +34 -0
- tree_sitter_analyzer/mcp/resources/__init__.py +43 -0
- tree_sitter_analyzer/mcp/resources/code_file_resource.py +208 -0
- tree_sitter_analyzer/mcp/resources/project_stats_resource.py +586 -0
- tree_sitter_analyzer/mcp/server.py +869 -0
- tree_sitter_analyzer/mcp/tools/__init__.py +28 -0
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +779 -0
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +291 -0
- tree_sitter_analyzer/mcp/tools/base_tool.py +139 -0
- tree_sitter_analyzer/mcp/tools/fd_rg_utils.py +816 -0
- tree_sitter_analyzer/mcp/tools/find_and_grep_tool.py +686 -0
- tree_sitter_analyzer/mcp/tools/list_files_tool.py +413 -0
- tree_sitter_analyzer/mcp/tools/output_format_validator.py +148 -0
- tree_sitter_analyzer/mcp/tools/query_tool.py +443 -0
- tree_sitter_analyzer/mcp/tools/read_partial_tool.py +464 -0
- tree_sitter_analyzer/mcp/tools/search_content_tool.py +836 -0
- tree_sitter_analyzer/mcp/tools/table_format_tool.py +572 -0
- tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +653 -0
- tree_sitter_analyzer/mcp/utils/__init__.py +113 -0
- tree_sitter_analyzer/mcp/utils/error_handler.py +569 -0
- tree_sitter_analyzer/mcp/utils/file_output_factory.py +217 -0
- tree_sitter_analyzer/mcp/utils/file_output_manager.py +322 -0
- tree_sitter_analyzer/mcp/utils/gitignore_detector.py +358 -0
- tree_sitter_analyzer/mcp/utils/path_resolver.py +414 -0
- tree_sitter_analyzer/mcp/utils/search_cache.py +343 -0
- tree_sitter_analyzer/models.py +840 -0
- tree_sitter_analyzer/mypy_current_errors.txt +2 -0
- tree_sitter_analyzer/output_manager.py +255 -0
- tree_sitter_analyzer/platform_compat/__init__.py +3 -0
- tree_sitter_analyzer/platform_compat/adapter.py +324 -0
- tree_sitter_analyzer/platform_compat/compare.py +224 -0
- tree_sitter_analyzer/platform_compat/detector.py +67 -0
- tree_sitter_analyzer/platform_compat/fixtures.py +228 -0
- tree_sitter_analyzer/platform_compat/profiles.py +217 -0
- tree_sitter_analyzer/platform_compat/record.py +55 -0
- tree_sitter_analyzer/platform_compat/recorder.py +155 -0
- tree_sitter_analyzer/platform_compat/report.py +92 -0
- tree_sitter_analyzer/plugins/__init__.py +280 -0
- tree_sitter_analyzer/plugins/base.py +647 -0
- tree_sitter_analyzer/plugins/manager.py +384 -0
- tree_sitter_analyzer/project_detector.py +328 -0
- tree_sitter_analyzer/queries/__init__.py +27 -0
- tree_sitter_analyzer/queries/csharp.py +216 -0
- tree_sitter_analyzer/queries/css.py +615 -0
- tree_sitter_analyzer/queries/go.py +275 -0
- tree_sitter_analyzer/queries/html.py +543 -0
- tree_sitter_analyzer/queries/java.py +402 -0
- tree_sitter_analyzer/queries/javascript.py +724 -0
- tree_sitter_analyzer/queries/kotlin.py +192 -0
- tree_sitter_analyzer/queries/markdown.py +258 -0
- tree_sitter_analyzer/queries/php.py +95 -0
- tree_sitter_analyzer/queries/python.py +859 -0
- tree_sitter_analyzer/queries/ruby.py +92 -0
- tree_sitter_analyzer/queries/rust.py +223 -0
- tree_sitter_analyzer/queries/sql.py +555 -0
- tree_sitter_analyzer/queries/typescript.py +871 -0
- tree_sitter_analyzer/queries/yaml.py +236 -0
- tree_sitter_analyzer/query_loader.py +272 -0
- tree_sitter_analyzer/security/__init__.py +22 -0
- tree_sitter_analyzer/security/boundary_manager.py +277 -0
- tree_sitter_analyzer/security/regex_checker.py +297 -0
- tree_sitter_analyzer/security/validator.py +599 -0
- tree_sitter_analyzer/table_formatter.py +782 -0
- tree_sitter_analyzer/utils/__init__.py +53 -0
- tree_sitter_analyzer/utils/logging.py +433 -0
- tree_sitter_analyzer/utils/tree_sitter_compat.py +289 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/METADATA +485 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/RECORD +149 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/WHEEL +4 -0
- tree_sitter_analyzer-1.9.17.1.dist-info/entry_points.txt +25 -0
|
@@ -0,0 +1,132 @@
|
|
|
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__ = "1.9.17.1"
|
|
15
|
+
__author__ = "aisheng.yu"
|
|
16
|
+
__email__ = "aimasteracc@gmail.com"
|
|
17
|
+
|
|
18
|
+
# Legacy imports for backward compatibility
|
|
19
|
+
|
|
20
|
+
# Core Engine - temporary direct import
|
|
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 .language_detector import LanguageDetector
|
|
34
|
+
from .language_loader import get_loader
|
|
35
|
+
|
|
36
|
+
# Data Models (Java-specific for backward compatibility)
|
|
37
|
+
# Data Models (Generic)
|
|
38
|
+
from .models import (
|
|
39
|
+
AnalysisResult,
|
|
40
|
+
Class,
|
|
41
|
+
CodeElement,
|
|
42
|
+
Function,
|
|
43
|
+
Import,
|
|
44
|
+
JavaAnnotation,
|
|
45
|
+
JavaClass,
|
|
46
|
+
JavaField,
|
|
47
|
+
JavaImport,
|
|
48
|
+
JavaMethod,
|
|
49
|
+
JavaPackage,
|
|
50
|
+
Variable,
|
|
51
|
+
)
|
|
52
|
+
from .output_manager import (
|
|
53
|
+
OutputManager,
|
|
54
|
+
get_output_manager,
|
|
55
|
+
output_data,
|
|
56
|
+
output_error,
|
|
57
|
+
output_info,
|
|
58
|
+
output_warning,
|
|
59
|
+
set_output_mode,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Plugin System
|
|
63
|
+
from .plugins import ElementExtractor, LanguagePlugin
|
|
64
|
+
from .plugins.manager import PluginManager
|
|
65
|
+
from .query_loader import QueryLoader, get_query_loader
|
|
66
|
+
|
|
67
|
+
# Import new utility modules
|
|
68
|
+
from .utils import (
|
|
69
|
+
QuietMode,
|
|
70
|
+
log_debug,
|
|
71
|
+
log_error,
|
|
72
|
+
log_info,
|
|
73
|
+
log_performance,
|
|
74
|
+
log_warning,
|
|
75
|
+
safe_print,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
__all__ = [
|
|
79
|
+
# Core Models (optimized)
|
|
80
|
+
"JavaAnnotation",
|
|
81
|
+
"JavaClass",
|
|
82
|
+
"JavaImport",
|
|
83
|
+
"JavaMethod",
|
|
84
|
+
"JavaField",
|
|
85
|
+
"JavaPackage",
|
|
86
|
+
"AnalysisResult",
|
|
87
|
+
# Model classes
|
|
88
|
+
"Class",
|
|
89
|
+
"CodeElement",
|
|
90
|
+
"Function",
|
|
91
|
+
"Import",
|
|
92
|
+
"Variable",
|
|
93
|
+
# Plugin system
|
|
94
|
+
"ElementExtractor",
|
|
95
|
+
"LanguagePlugin",
|
|
96
|
+
"PluginManager",
|
|
97
|
+
"QueryLoader",
|
|
98
|
+
# Language detection
|
|
99
|
+
"LanguageDetector",
|
|
100
|
+
# Core Components (optimized)
|
|
101
|
+
# "AdvancedAnalyzer", # Removed - migrated to plugin system
|
|
102
|
+
"get_loader",
|
|
103
|
+
"get_query_loader",
|
|
104
|
+
# New Utilities
|
|
105
|
+
"log_info",
|
|
106
|
+
"log_warning",
|
|
107
|
+
"log_error",
|
|
108
|
+
"log_debug",
|
|
109
|
+
"QuietMode",
|
|
110
|
+
"safe_print",
|
|
111
|
+
"log_performance",
|
|
112
|
+
# Output Management
|
|
113
|
+
"OutputManager",
|
|
114
|
+
"set_output_mode",
|
|
115
|
+
"get_output_manager",
|
|
116
|
+
"output_info",
|
|
117
|
+
"output_warning",
|
|
118
|
+
"output_error",
|
|
119
|
+
"output_data",
|
|
120
|
+
# Legacy Components (backward compatibility)
|
|
121
|
+
"UniversalCodeAnalyzer",
|
|
122
|
+
# Version
|
|
123
|
+
"__version__",
|
|
124
|
+
# Encoding utilities
|
|
125
|
+
"EncodingManager",
|
|
126
|
+
"safe_encode",
|
|
127
|
+
"safe_decode",
|
|
128
|
+
"detect_encoding",
|
|
129
|
+
"read_file_safe",
|
|
130
|
+
"write_file_safe",
|
|
131
|
+
"extract_text_slice",
|
|
132
|
+
]
|