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,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Language-specific Tree-sitter queries package.
|
|
4
|
+
|
|
5
|
+
This package provides Tree-sitter queries for various programming languages.
|
|
6
|
+
Each language has its own module with predefined queries for common code elements.
|
|
7
|
+
|
|
8
|
+
Supported languages:
|
|
9
|
+
- Java
|
|
10
|
+
- JavaScript
|
|
11
|
+
- Python
|
|
12
|
+
- SQL
|
|
13
|
+
- TypeScript
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
from tree_sitter_analyzer.queries import get_query, list_queries
|
|
17
|
+
|
|
18
|
+
# Get a specific query
|
|
19
|
+
query = get_query('java', 'classes')
|
|
20
|
+
|
|
21
|
+
# List all queries for a language
|
|
22
|
+
queries = list_queries('python')
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from ..query_loader import get_query, is_language_supported, list_queries, query_loader
|
|
26
|
+
|
|
27
|
+
__all__ = ["get_query", "list_queries", "is_language_supported", "query_loader"]
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
C# Language Queries
|
|
4
|
+
|
|
5
|
+
Comprehensive Tree-sitter queries for C# language constructs.
|
|
6
|
+
Covers classes, methods, properties, fields, and modern C# features.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# C#-specific query library
|
|
10
|
+
CSHARP_QUERIES: dict[str, str] = {
|
|
11
|
+
# --- Class Declarations ---
|
|
12
|
+
"class": """
|
|
13
|
+
(class_declaration
|
|
14
|
+
name: (identifier) @class_name) @class
|
|
15
|
+
""",
|
|
16
|
+
"interface": """
|
|
17
|
+
(interface_declaration
|
|
18
|
+
name: (identifier) @interface_name) @interface
|
|
19
|
+
""",
|
|
20
|
+
"record": """
|
|
21
|
+
(record_declaration
|
|
22
|
+
name: (identifier) @record_name) @record
|
|
23
|
+
""",
|
|
24
|
+
"enum": """
|
|
25
|
+
(enum_declaration
|
|
26
|
+
name: (identifier) @enum_name) @enum
|
|
27
|
+
""",
|
|
28
|
+
"struct": """
|
|
29
|
+
(struct_declaration
|
|
30
|
+
name: (identifier) @struct_name) @struct
|
|
31
|
+
""",
|
|
32
|
+
# --- Methods ---
|
|
33
|
+
"method": """
|
|
34
|
+
(method_declaration
|
|
35
|
+
name: (identifier) @method_name) @method
|
|
36
|
+
""",
|
|
37
|
+
"constructor": """
|
|
38
|
+
(constructor_declaration
|
|
39
|
+
name: (identifier) @constructor_name) @constructor
|
|
40
|
+
""",
|
|
41
|
+
"async_method": """
|
|
42
|
+
(method_declaration
|
|
43
|
+
(modifier)* @modifier
|
|
44
|
+
(#match? @modifier "async")
|
|
45
|
+
name: (identifier) @method_name) @async_method
|
|
46
|
+
""",
|
|
47
|
+
"public_method": """
|
|
48
|
+
(method_declaration
|
|
49
|
+
(modifier)* @modifier
|
|
50
|
+
(#match? @modifier "public")
|
|
51
|
+
name: (identifier) @method_name) @public_method
|
|
52
|
+
""",
|
|
53
|
+
"private_method": """
|
|
54
|
+
(method_declaration
|
|
55
|
+
(modifier)* @modifier
|
|
56
|
+
(#match? @modifier "private")
|
|
57
|
+
name: (identifier) @method_name) @private_method
|
|
58
|
+
""",
|
|
59
|
+
"static_method": """
|
|
60
|
+
(method_declaration
|
|
61
|
+
(modifier)* @modifier
|
|
62
|
+
(#match? @modifier "static")
|
|
63
|
+
name: (identifier) @method_name) @static_method
|
|
64
|
+
""",
|
|
65
|
+
# --- Properties ---
|
|
66
|
+
"property": """
|
|
67
|
+
(property_declaration
|
|
68
|
+
name: (identifier) @property_name) @property
|
|
69
|
+
""",
|
|
70
|
+
"auto_property": """
|
|
71
|
+
(property_declaration
|
|
72
|
+
name: (identifier) @property_name
|
|
73
|
+
(accessor_list)) @auto_property
|
|
74
|
+
""",
|
|
75
|
+
"computed_property": """
|
|
76
|
+
(property_declaration
|
|
77
|
+
name: (identifier) @property_name
|
|
78
|
+
(arrow_expression_clause)) @computed_property
|
|
79
|
+
""",
|
|
80
|
+
# --- Fields ---
|
|
81
|
+
"field": """
|
|
82
|
+
(field_declaration) @field
|
|
83
|
+
""",
|
|
84
|
+
"const_field": """
|
|
85
|
+
(field_declaration
|
|
86
|
+
(modifier)* @modifier
|
|
87
|
+
(#match? @modifier "const")) @const_field
|
|
88
|
+
""",
|
|
89
|
+
"readonly_field": """
|
|
90
|
+
(field_declaration
|
|
91
|
+
(modifier)* @modifier
|
|
92
|
+
(#match? @modifier "readonly")) @readonly_field
|
|
93
|
+
""",
|
|
94
|
+
"event": """
|
|
95
|
+
(event_field_declaration) @event
|
|
96
|
+
""",
|
|
97
|
+
# --- Using Directives ---
|
|
98
|
+
"using": """
|
|
99
|
+
(using_directive) @using
|
|
100
|
+
""",
|
|
101
|
+
"static_using": """
|
|
102
|
+
(using_directive
|
|
103
|
+
"static") @static_using
|
|
104
|
+
""",
|
|
105
|
+
# --- Namespaces ---
|
|
106
|
+
"namespace": """
|
|
107
|
+
(namespace_declaration
|
|
108
|
+
name: (identifier) @namespace_name) @namespace
|
|
109
|
+
""",
|
|
110
|
+
# --- Attributes ---
|
|
111
|
+
"attribute": """
|
|
112
|
+
(attribute_list) @attribute
|
|
113
|
+
""",
|
|
114
|
+
"http_attribute": """
|
|
115
|
+
(attribute_list
|
|
116
|
+
(attribute
|
|
117
|
+
name: (identifier) @attr_name
|
|
118
|
+
(#match? @attr_name "^Http(Get|Post|Put|Delete|Patch)$"))) @http_attribute
|
|
119
|
+
""",
|
|
120
|
+
"authorize_attribute": """
|
|
121
|
+
(attribute_list
|
|
122
|
+
(attribute
|
|
123
|
+
name: (identifier) @attr_name
|
|
124
|
+
(#match? @attr_name "^Authorize$"))) @authorize_attribute
|
|
125
|
+
""",
|
|
126
|
+
# --- Generic Types ---
|
|
127
|
+
"generic_class": """
|
|
128
|
+
(class_declaration
|
|
129
|
+
name: (identifier) @class_name
|
|
130
|
+
type_parameters: (type_parameter_list)) @generic_class
|
|
131
|
+
""",
|
|
132
|
+
"generic_method": """
|
|
133
|
+
(method_declaration
|
|
134
|
+
name: (identifier) @method_name
|
|
135
|
+
type_parameters: (type_parameter_list)) @generic_method
|
|
136
|
+
""",
|
|
137
|
+
# --- LINQ Queries ---
|
|
138
|
+
"linq_query": """
|
|
139
|
+
(query_expression) @linq_query
|
|
140
|
+
""",
|
|
141
|
+
"from_clause": """
|
|
142
|
+
(from_clause) @from_clause
|
|
143
|
+
""",
|
|
144
|
+
"where_clause": """
|
|
145
|
+
(where_clause) @where_clause
|
|
146
|
+
""",
|
|
147
|
+
"select_clause": """
|
|
148
|
+
(select_clause) @select_clause
|
|
149
|
+
""",
|
|
150
|
+
# --- Lambda Expressions ---
|
|
151
|
+
"lambda": """
|
|
152
|
+
(lambda_expression) @lambda
|
|
153
|
+
""",
|
|
154
|
+
"arrow_function": """
|
|
155
|
+
(arrow_expression_clause) @arrow_function
|
|
156
|
+
""",
|
|
157
|
+
# --- Control Flow ---
|
|
158
|
+
"if_statement": """
|
|
159
|
+
(if_statement) @if_statement
|
|
160
|
+
""",
|
|
161
|
+
"for_statement": """
|
|
162
|
+
(for_statement) @for_statement
|
|
163
|
+
""",
|
|
164
|
+
"foreach_statement": """
|
|
165
|
+
(foreach_statement) @foreach_statement
|
|
166
|
+
""",
|
|
167
|
+
"while_statement": """
|
|
168
|
+
(while_statement) @while_statement
|
|
169
|
+
""",
|
|
170
|
+
"switch_statement": """
|
|
171
|
+
(switch_statement) @switch_statement
|
|
172
|
+
""",
|
|
173
|
+
"try_statement": """
|
|
174
|
+
(try_statement) @try_statement
|
|
175
|
+
""",
|
|
176
|
+
"catch_clause": """
|
|
177
|
+
(catch_clause) @catch_clause
|
|
178
|
+
""",
|
|
179
|
+
# --- Nullable Reference Types ---
|
|
180
|
+
"nullable_type": """
|
|
181
|
+
(nullable_type) @nullable_type
|
|
182
|
+
""",
|
|
183
|
+
# --- Pattern Matching ---
|
|
184
|
+
"switch_expression": """
|
|
185
|
+
(switch_expression) @switch_expression
|
|
186
|
+
""",
|
|
187
|
+
"pattern": """
|
|
188
|
+
(pattern) @pattern
|
|
189
|
+
""",
|
|
190
|
+
# --- Delegates ---
|
|
191
|
+
"delegate": """
|
|
192
|
+
(delegate_declaration
|
|
193
|
+
name: (identifier) @delegate_name) @delegate
|
|
194
|
+
""",
|
|
195
|
+
# --- Comments ---
|
|
196
|
+
"comment": """
|
|
197
|
+
(comment) @comment
|
|
198
|
+
""",
|
|
199
|
+
"xml_documentation": """
|
|
200
|
+
(comment
|
|
201
|
+
(#match? @comment "^///")) @xml_documentation
|
|
202
|
+
""",
|
|
203
|
+
# --- All Declarations ---
|
|
204
|
+
"all_declarations": """
|
|
205
|
+
[
|
|
206
|
+
(class_declaration)
|
|
207
|
+
(interface_declaration)
|
|
208
|
+
(record_declaration)
|
|
209
|
+
(enum_declaration)
|
|
210
|
+
(struct_declaration)
|
|
211
|
+
(method_declaration)
|
|
212
|
+
(property_declaration)
|
|
213
|
+
(field_declaration)
|
|
214
|
+
] @declaration
|
|
215
|
+
""",
|
|
216
|
+
}
|