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,92 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Ruby Tree-sitter Queries
|
|
3
|
+
|
|
4
|
+
Defines tree-sitter queries for efficient Ruby element extraction.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# Query for Ruby classes and modules
|
|
8
|
+
RUBY_CLASS_QUERY = """
|
|
9
|
+
(class
|
|
10
|
+
name: (constant) @class.name) @class.definition
|
|
11
|
+
|
|
12
|
+
(module
|
|
13
|
+
name: (constant) @module.name) @module.definition
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
# Query for Ruby methods
|
|
17
|
+
RUBY_METHOD_QUERY = """
|
|
18
|
+
(method
|
|
19
|
+
name: (identifier) @method.name
|
|
20
|
+
parameters: (method_parameters)? @method.parameters) @method.definition
|
|
21
|
+
|
|
22
|
+
(singleton_method
|
|
23
|
+
name: (identifier) @singleton.method.name
|
|
24
|
+
parameters: (method_parameters)? @singleton.method.parameters) @singleton.method.definition
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
# Query for Ruby constants
|
|
28
|
+
RUBY_CONSTANT_QUERY = """
|
|
29
|
+
(assignment
|
|
30
|
+
left: (constant) @constant.name) @constant.definition
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
# Query for Ruby instance variables
|
|
34
|
+
RUBY_INSTANCE_VAR_QUERY = """
|
|
35
|
+
(assignment
|
|
36
|
+
left: (instance_variable) @instance.var.name) @instance.var.definition
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# Query for Ruby class variables
|
|
40
|
+
RUBY_CLASS_VAR_QUERY = """
|
|
41
|
+
(assignment
|
|
42
|
+
left: (class_variable) @class.var.name) @class.var.definition
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
# Query for Ruby require statements
|
|
46
|
+
RUBY_REQUIRE_QUERY = """
|
|
47
|
+
(call
|
|
48
|
+
method: (identifier) @require.method
|
|
49
|
+
(#match? @require.method "^(require|require_relative|load)$")
|
|
50
|
+
arguments: (argument_list
|
|
51
|
+
(string) @require.module)) @require.definition
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
# Query for Ruby attr_accessor, attr_reader, attr_writer
|
|
55
|
+
RUBY_ATTR_QUERY = """
|
|
56
|
+
(call
|
|
57
|
+
method: (identifier) @attr.method
|
|
58
|
+
(#match? @attr.method "^(attr_accessor|attr_reader|attr_writer)$")
|
|
59
|
+
arguments: (argument_list
|
|
60
|
+
(simple_symbol) @attr.name)) @attr.definition
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
# Query for Ruby blocks
|
|
64
|
+
RUBY_BLOCK_QUERY = """
|
|
65
|
+
(block) @block.definition
|
|
66
|
+
|
|
67
|
+
(do_block) @do.block.definition
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
# Query for Ruby procs and lambdas
|
|
71
|
+
RUBY_PROC_LAMBDA_QUERY = """
|
|
72
|
+
(call
|
|
73
|
+
method: (identifier) @proc.method
|
|
74
|
+
(#match? @proc.method "^(lambda|proc)$")) @proc.definition
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
# Combined query for all Ruby elements
|
|
78
|
+
RUBY_ALL_ELEMENTS_QUERY = f"""
|
|
79
|
+
{RUBY_CLASS_QUERY}
|
|
80
|
+
|
|
81
|
+
{RUBY_METHOD_QUERY}
|
|
82
|
+
|
|
83
|
+
{RUBY_CONSTANT_QUERY}
|
|
84
|
+
|
|
85
|
+
{RUBY_INSTANCE_VAR_QUERY}
|
|
86
|
+
|
|
87
|
+
{RUBY_CLASS_VAR_QUERY}
|
|
88
|
+
|
|
89
|
+
{RUBY_REQUIRE_QUERY}
|
|
90
|
+
|
|
91
|
+
{RUBY_ATTR_QUERY}
|
|
92
|
+
"""
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Rust Language Queries
|
|
4
|
+
|
|
5
|
+
Tree-sitter queries specific to Rust language constructs.
|
|
6
|
+
Covers modules, functions, structs, enums, traits, impl blocks, and other Rust-specific elements.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# Rust-specific query library
|
|
10
|
+
RUST_QUERIES: dict[str, str] = {
|
|
11
|
+
# --- Basic Structure ---
|
|
12
|
+
"mod": """
|
|
13
|
+
(mod_item) @mod
|
|
14
|
+
""",
|
|
15
|
+
"struct": """
|
|
16
|
+
(struct_item) @struct
|
|
17
|
+
""",
|
|
18
|
+
"enum": """
|
|
19
|
+
(enum_item) @enum
|
|
20
|
+
""",
|
|
21
|
+
"trait": """
|
|
22
|
+
(trait_item) @trait
|
|
23
|
+
""",
|
|
24
|
+
"impl": """
|
|
25
|
+
(impl_item) @impl
|
|
26
|
+
""",
|
|
27
|
+
"macro": """
|
|
28
|
+
(macro_definition) @macro
|
|
29
|
+
""",
|
|
30
|
+
# --- Functions ---
|
|
31
|
+
"fn": """
|
|
32
|
+
(function_item) @fn
|
|
33
|
+
""",
|
|
34
|
+
"async_fn": """
|
|
35
|
+
(function_item
|
|
36
|
+
(modifiers) @mod
|
|
37
|
+
(#match? @mod "async")) @async_fn
|
|
38
|
+
""",
|
|
39
|
+
# --- Fields and Variants ---
|
|
40
|
+
"field": """
|
|
41
|
+
(field_declaration) @field
|
|
42
|
+
""",
|
|
43
|
+
"enum_variant": """
|
|
44
|
+
(enum_variant) @enum_variant
|
|
45
|
+
""",
|
|
46
|
+
# --- Constants and Statics ---
|
|
47
|
+
"const": """
|
|
48
|
+
(const_item) @const
|
|
49
|
+
""",
|
|
50
|
+
"static": """
|
|
51
|
+
(static_item) @static
|
|
52
|
+
""",
|
|
53
|
+
"type_alias": """
|
|
54
|
+
(type_item) @type_alias
|
|
55
|
+
""",
|
|
56
|
+
# --- Attributes (Annotations) ---
|
|
57
|
+
"attribute": """
|
|
58
|
+
(attribute_item) @attribute
|
|
59
|
+
""",
|
|
60
|
+
"derive_attribute": """
|
|
61
|
+
(attribute_item
|
|
62
|
+
(meta_item
|
|
63
|
+
(identifier) @name
|
|
64
|
+
(#eq? @name "derive")
|
|
65
|
+
(meta_arguments) @arguments)) @derive_attribute
|
|
66
|
+
""",
|
|
67
|
+
# --- Detailed Queries ---
|
|
68
|
+
"struct_with_fields": """
|
|
69
|
+
(struct_item
|
|
70
|
+
name: (type_identifier) @name
|
|
71
|
+
body: (field_declaration_list) @body) @struct_with_fields
|
|
72
|
+
""",
|
|
73
|
+
"fn_with_body": """
|
|
74
|
+
(function_item
|
|
75
|
+
name: (identifier) @name
|
|
76
|
+
body: (block) @body) @fn_with_body
|
|
77
|
+
""",
|
|
78
|
+
"impl_trait": """
|
|
79
|
+
(impl_item
|
|
80
|
+
trait: (type_identifier) @trait
|
|
81
|
+
type: (type_identifier) @type) @impl_trait
|
|
82
|
+
""",
|
|
83
|
+
# --- Name-only Extraction ---
|
|
84
|
+
"mod_name": """
|
|
85
|
+
(mod_item
|
|
86
|
+
name: (identifier) @mod_name)
|
|
87
|
+
""",
|
|
88
|
+
"fn_name": """
|
|
89
|
+
(function_item
|
|
90
|
+
name: (identifier) @fn_name)
|
|
91
|
+
""",
|
|
92
|
+
"struct_name": """
|
|
93
|
+
(struct_item
|
|
94
|
+
name: (type_identifier) @struct_name)
|
|
95
|
+
""",
|
|
96
|
+
"trait_name": """
|
|
97
|
+
(trait_item
|
|
98
|
+
name: (type_identifier) @trait_name)
|
|
99
|
+
""",
|
|
100
|
+
# --- Visibility ---
|
|
101
|
+
"pub_fn": """
|
|
102
|
+
(function_item
|
|
103
|
+
(visibility_modifier) @vis
|
|
104
|
+
name: (identifier) @name) @pub_fn
|
|
105
|
+
""",
|
|
106
|
+
# --- Macros ---
|
|
107
|
+
"macro_call": """
|
|
108
|
+
(macro_invocation) @macro_call
|
|
109
|
+
""",
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Query descriptions
|
|
113
|
+
RUST_QUERY_DESCRIPTIONS: dict[str, str] = {
|
|
114
|
+
"mod": "Extract Rust module declarations",
|
|
115
|
+
"struct": "Extract Rust struct definitions",
|
|
116
|
+
"enum": "Extract Rust enum definitions",
|
|
117
|
+
"trait": "Extract Rust trait definitions",
|
|
118
|
+
"impl": "Extract Rust impl blocks",
|
|
119
|
+
"macro": "Extract Rust macro definitions",
|
|
120
|
+
"fn": "Extract Rust function declarations",
|
|
121
|
+
"async_fn": "Extract Rust async function declarations",
|
|
122
|
+
"field": "Extract Rust struct fields",
|
|
123
|
+
"enum_variant": "Extract Rust enum variants",
|
|
124
|
+
"const": "Extract Rust constants",
|
|
125
|
+
"static": "Extract Rust static variables",
|
|
126
|
+
"type_alias": "Extract Rust type aliases",
|
|
127
|
+
"attribute": "Extract Rust attributes",
|
|
128
|
+
"derive_attribute": "Extract Rust derive attributes",
|
|
129
|
+
"struct_with_fields": "Extract struct definitions with fields",
|
|
130
|
+
"fn_with_body": "Extract function declarations with body",
|
|
131
|
+
"impl_trait": "Extract trait implementation blocks",
|
|
132
|
+
"mod_name": "Extract module names only",
|
|
133
|
+
"fn_name": "Extract function names only",
|
|
134
|
+
"struct_name": "Extract struct names only",
|
|
135
|
+
"trait_name": "Extract trait names only",
|
|
136
|
+
"pub_fn": "Extract public functions",
|
|
137
|
+
"macro_call": "Extract macro invocations",
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def get_rust_query(name: str) -> str:
|
|
142
|
+
"""
|
|
143
|
+
Get the specified Rust query
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
name: Query name
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
Query string
|
|
150
|
+
|
|
151
|
+
Raises:
|
|
152
|
+
ValueError: When query is not found
|
|
153
|
+
"""
|
|
154
|
+
if name not in RUST_QUERIES:
|
|
155
|
+
available = list(RUST_QUERIES.keys())
|
|
156
|
+
raise ValueError(f"Rust query '{name}' does not exist. Available: {available}")
|
|
157
|
+
|
|
158
|
+
return RUST_QUERIES[name]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def get_rust_query_description(name: str) -> str:
|
|
162
|
+
"""
|
|
163
|
+
Get the description of the specified Rust query
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
name: Query name
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Query description
|
|
170
|
+
"""
|
|
171
|
+
return RUST_QUERY_DESCRIPTIONS.get(name, "No description")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
# Convert to ALL_QUERIES format for dynamic loader compatibility
|
|
175
|
+
ALL_QUERIES = {}
|
|
176
|
+
for query_name, query_string in RUST_QUERIES.items():
|
|
177
|
+
description = RUST_QUERY_DESCRIPTIONS.get(query_name, "No description")
|
|
178
|
+
ALL_QUERIES[query_name] = {"query": query_string, "description": description}
|
|
179
|
+
|
|
180
|
+
# Add common query aliases for cross-language compatibility
|
|
181
|
+
ALL_QUERIES["functions"] = {
|
|
182
|
+
"query": RUST_QUERIES["fn"],
|
|
183
|
+
"description": "Search all function declarations (alias for fn)",
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
ALL_QUERIES["methods"] = {
|
|
187
|
+
"query": RUST_QUERIES["fn"],
|
|
188
|
+
"description": "Search all method declarations (alias for fn)",
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
ALL_QUERIES["classes"] = {
|
|
192
|
+
"query": RUST_QUERIES["struct"],
|
|
193
|
+
"description": "Search all struct definitions (alias for struct)",
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def get_query(name: str) -> str:
|
|
198
|
+
"""Get a specific query by name."""
|
|
199
|
+
if name in ALL_QUERIES:
|
|
200
|
+
return ALL_QUERIES[name]["query"]
|
|
201
|
+
raise ValueError(
|
|
202
|
+
f"Query '{name}' not found. Available queries: {list(ALL_QUERIES.keys())}"
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def get_all_queries() -> dict:
|
|
207
|
+
"""Get all available queries."""
|
|
208
|
+
return ALL_QUERIES
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def list_queries() -> list:
|
|
212
|
+
"""List all available query names."""
|
|
213
|
+
return list(ALL_QUERIES.keys())
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def get_available_rust_queries() -> list[str]:
|
|
217
|
+
"""
|
|
218
|
+
Get list of available Rust queries
|
|
219
|
+
|
|
220
|
+
Returns:
|
|
221
|
+
List of query names
|
|
222
|
+
"""
|
|
223
|
+
return list(RUST_QUERIES.keys())
|