tree-sitter-analyzer 0.1.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.

Files changed (78) hide show
  1. tree_sitter_analyzer/__init__.py +121 -0
  2. tree_sitter_analyzer/__main__.py +12 -0
  3. tree_sitter_analyzer/api.py +539 -0
  4. tree_sitter_analyzer/cli/__init__.py +39 -0
  5. tree_sitter_analyzer/cli/__main__.py +13 -0
  6. tree_sitter_analyzer/cli/commands/__init__.py +27 -0
  7. tree_sitter_analyzer/cli/commands/advanced_command.py +88 -0
  8. tree_sitter_analyzer/cli/commands/base_command.py +155 -0
  9. tree_sitter_analyzer/cli/commands/default_command.py +19 -0
  10. tree_sitter_analyzer/cli/commands/partial_read_command.py +133 -0
  11. tree_sitter_analyzer/cli/commands/query_command.py +82 -0
  12. tree_sitter_analyzer/cli/commands/structure_command.py +121 -0
  13. tree_sitter_analyzer/cli/commands/summary_command.py +93 -0
  14. tree_sitter_analyzer/cli/commands/table_command.py +233 -0
  15. tree_sitter_analyzer/cli/info_commands.py +121 -0
  16. tree_sitter_analyzer/cli_main.py +276 -0
  17. tree_sitter_analyzer/core/__init__.py +20 -0
  18. tree_sitter_analyzer/core/analysis_engine.py +574 -0
  19. tree_sitter_analyzer/core/cache_service.py +330 -0
  20. tree_sitter_analyzer/core/engine.py +560 -0
  21. tree_sitter_analyzer/core/parser.py +288 -0
  22. tree_sitter_analyzer/core/query.py +502 -0
  23. tree_sitter_analyzer/encoding_utils.py +460 -0
  24. tree_sitter_analyzer/exceptions.py +340 -0
  25. tree_sitter_analyzer/file_handler.py +222 -0
  26. tree_sitter_analyzer/formatters/__init__.py +1 -0
  27. tree_sitter_analyzer/formatters/base_formatter.py +168 -0
  28. tree_sitter_analyzer/formatters/formatter_factory.py +74 -0
  29. tree_sitter_analyzer/formatters/java_formatter.py +270 -0
  30. tree_sitter_analyzer/formatters/python_formatter.py +235 -0
  31. tree_sitter_analyzer/interfaces/__init__.py +10 -0
  32. tree_sitter_analyzer/interfaces/cli.py +557 -0
  33. tree_sitter_analyzer/interfaces/cli_adapter.py +319 -0
  34. tree_sitter_analyzer/interfaces/mcp_adapter.py +170 -0
  35. tree_sitter_analyzer/interfaces/mcp_server.py +416 -0
  36. tree_sitter_analyzer/java_analyzer.py +219 -0
  37. tree_sitter_analyzer/language_detector.py +400 -0
  38. tree_sitter_analyzer/language_loader.py +228 -0
  39. tree_sitter_analyzer/languages/__init__.py +11 -0
  40. tree_sitter_analyzer/languages/java_plugin.py +1113 -0
  41. tree_sitter_analyzer/languages/python_plugin.py +712 -0
  42. tree_sitter_analyzer/mcp/__init__.py +32 -0
  43. tree_sitter_analyzer/mcp/resources/__init__.py +47 -0
  44. tree_sitter_analyzer/mcp/resources/code_file_resource.py +213 -0
  45. tree_sitter_analyzer/mcp/resources/project_stats_resource.py +550 -0
  46. tree_sitter_analyzer/mcp/server.py +319 -0
  47. tree_sitter_analyzer/mcp/tools/__init__.py +36 -0
  48. tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +558 -0
  49. tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +245 -0
  50. tree_sitter_analyzer/mcp/tools/base_tool.py +55 -0
  51. tree_sitter_analyzer/mcp/tools/get_positions_tool.py +448 -0
  52. tree_sitter_analyzer/mcp/tools/read_partial_tool.py +302 -0
  53. tree_sitter_analyzer/mcp/tools/table_format_tool.py +359 -0
  54. tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +476 -0
  55. tree_sitter_analyzer/mcp/utils/__init__.py +106 -0
  56. tree_sitter_analyzer/mcp/utils/error_handler.py +549 -0
  57. tree_sitter_analyzer/models.py +481 -0
  58. tree_sitter_analyzer/output_manager.py +264 -0
  59. tree_sitter_analyzer/plugins/__init__.py +334 -0
  60. tree_sitter_analyzer/plugins/base.py +446 -0
  61. tree_sitter_analyzer/plugins/java_plugin.py +625 -0
  62. tree_sitter_analyzer/plugins/javascript_plugin.py +439 -0
  63. tree_sitter_analyzer/plugins/manager.py +355 -0
  64. tree_sitter_analyzer/plugins/plugin_loader.py +83 -0
  65. tree_sitter_analyzer/plugins/python_plugin.py +598 -0
  66. tree_sitter_analyzer/plugins/registry.py +366 -0
  67. tree_sitter_analyzer/queries/__init__.py +27 -0
  68. tree_sitter_analyzer/queries/java.py +394 -0
  69. tree_sitter_analyzer/queries/javascript.py +149 -0
  70. tree_sitter_analyzer/queries/python.py +286 -0
  71. tree_sitter_analyzer/queries/typescript.py +230 -0
  72. tree_sitter_analyzer/query_loader.py +260 -0
  73. tree_sitter_analyzer/table_formatter.py +448 -0
  74. tree_sitter_analyzer/utils.py +201 -0
  75. tree_sitter_analyzer-0.1.0.dist-info/METADATA +581 -0
  76. tree_sitter_analyzer-0.1.0.dist-info/RECORD +78 -0
  77. tree_sitter_analyzer-0.1.0.dist-info/WHEEL +4 -0
  78. tree_sitter_analyzer-0.1.0.dist-info/entry_points.txt +8 -0
@@ -0,0 +1,394 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Java Language Queries
5
+
6
+ Tree-sitter queries specific to Java language constructs.
7
+ Covers classes, methods, annotations, imports, and other Java-specific elements.
8
+ """
9
+
10
+ from typing import Dict
11
+
12
+ # Java専用クエリライブラリ
13
+ JAVA_QUERIES: Dict[str, str] = {
14
+ # --- 基本構造 ---
15
+ "class": """
16
+ (class_declaration) @class
17
+ """,
18
+ "interface": """
19
+ (interface_declaration) @interface
20
+ """,
21
+ "enum": """
22
+ (enum_declaration) @enum
23
+ """,
24
+ "annotation_type": """
25
+ (annotation_type_declaration) @annotation_type
26
+ """,
27
+ # --- メソッドと構築子 ---
28
+ "method": """
29
+ (method_declaration) @method
30
+ """,
31
+ "constructor": """
32
+ (constructor_declaration) @constructor
33
+ """,
34
+ "abstract_method": """
35
+ (method_declaration
36
+ (modifiers) @mod
37
+ (#match? @mod "abstract")) @abstract_method
38
+ """,
39
+ # --- フィールドと変数 ---
40
+ "field": """
41
+ (field_declaration) @field
42
+ """,
43
+ "static_field": """
44
+ (field_declaration
45
+ (modifiers) @mod
46
+ (#match? @mod "static")) @static_field
47
+ """,
48
+ "final_field": """
49
+ (field_declaration
50
+ (modifiers) @mod
51
+ (#match? @mod "final")) @final_field
52
+ """,
53
+ # --- インポートとパッケージ ---
54
+ "import": """
55
+ (import_declaration) @import
56
+ """,
57
+ "static_import": """
58
+ (import_declaration
59
+ "static") @static_import
60
+ """,
61
+ "package": """
62
+ (package_declaration) @package
63
+ """,
64
+ # --- アノテーション ---
65
+ "annotation": """
66
+ (annotation) @annotation
67
+ """,
68
+ "marker_annotation": """
69
+ (marker_annotation) @marker_annotation
70
+ """,
71
+ "annotation_with_params": """
72
+ (annotation
73
+ (annotation_argument_list)) @annotation_with_params
74
+ """,
75
+ # --- Java特有のコンストラクト ---
76
+ "lambda": """
77
+ (lambda_expression) @lambda
78
+ """,
79
+ "try_catch": """
80
+ (try_statement) @try_catch
81
+ """,
82
+ "synchronized_block": """
83
+ (synchronized_statement) @synchronized_block
84
+ """,
85
+ "generic_type": """
86
+ (generic_type) @generic_type
87
+ """,
88
+ # --- 名前のみ抽出 ---
89
+ "class_name": """
90
+ (class_declaration
91
+ name: (identifier) @class_name)
92
+ """,
93
+ "method_name": """
94
+ (method_declaration
95
+ name: (identifier) @method_name)
96
+ """,
97
+ "field_name": """
98
+ (field_declaration
99
+ declarator: (variable_declarator
100
+ name: (identifier) @field_name))
101
+ """,
102
+ # --- 詳細付きクエリ ---
103
+ "class_with_body": """
104
+ (class_declaration
105
+ name: (identifier) @name
106
+ body: (class_body) @body) @class_with_body
107
+ """,
108
+ "method_with_body": """
109
+ (method_declaration
110
+ name: (identifier) @name
111
+ body: (block) @body) @method_with_body
112
+ """,
113
+ "method_with_annotations": """
114
+ (method_declaration
115
+ (modifiers (annotation) @annotation)*
116
+ name: (identifier) @name) @method_with_annotations
117
+ """,
118
+ # --- 継承関係 ---
119
+ "extends_clause": """
120
+ (class_declaration
121
+ (superclass) @extends_clause)
122
+ """,
123
+ "implements_clause": """
124
+ (class_declaration
125
+ (super_interfaces) @implements_clause)
126
+ """,
127
+ # --- 修飾子別 ---
128
+ "public_methods": """
129
+ (method_declaration
130
+ (modifiers) @mod
131
+ (#match? @mod "public")
132
+ name: (identifier) @name) @public_methods
133
+ """,
134
+ "private_methods": """
135
+ (method_declaration
136
+ (modifiers) @mod
137
+ (#match? @mod "private")
138
+ name: (identifier) @name) @private_methods
139
+ """,
140
+ "static_methods": """
141
+ (method_declaration
142
+ (modifiers) @mod
143
+ (#match? @mod "static")
144
+ name: (identifier) @name) @static_methods
145
+ """,
146
+ # --- Spring Framework アノテーション ---
147
+ "spring_controller": """
148
+ (class_declaration
149
+ (modifiers (annotation
150
+ name: (identifier) @annotation_name
151
+ (#match? @annotation_name "Controller|RestController")))
152
+ name: (identifier) @controller_name) @spring_controller
153
+ """,
154
+ "spring_service": """
155
+ (class_declaration
156
+ (modifiers (annotation
157
+ name: (identifier) @annotation_name
158
+ (#match? @annotation_name "Service")))
159
+ name: (identifier) @service_name) @spring_service
160
+ """,
161
+ "spring_repository": """
162
+ (class_declaration
163
+ (modifiers (annotation
164
+ name: (identifier) @annotation_name
165
+ (#match? @annotation_name "Repository")))
166
+ name: (identifier) @repository_name) @spring_repository
167
+ """,
168
+ # --- JPA アノテーション ---
169
+ "jpa_entity": """
170
+ (class_declaration
171
+ (modifiers (annotation
172
+ name: (identifier) @annotation_name
173
+ (#match? @annotation_name "Entity")))
174
+ name: (identifier) @entity_name) @jpa_entity
175
+ """,
176
+ "jpa_id_field": """
177
+ (field_declaration
178
+ (modifiers (annotation
179
+ name: (identifier) @annotation_name
180
+ (#match? @annotation_name "Id")))
181
+ declarator: (variable_declarator
182
+ name: (identifier) @field_name)) @jpa_id_field
183
+ """,
184
+ # --- 構造情報抽出用クエリ ---
185
+ "javadoc_comment": """
186
+ (block_comment) @javadoc_comment
187
+ (#match? @javadoc_comment "^/\\*\\*")
188
+ """,
189
+ "class_with_javadoc": """
190
+ (class_declaration
191
+ name: (identifier) @class_name
192
+ body: (class_body) @class_body) @class_with_javadoc
193
+ """,
194
+ "method_with_javadoc": """
195
+ (method_declaration
196
+ name: (identifier) @method_name
197
+ parameters: (formal_parameters) @parameters
198
+ body: (block) @method_body) @method_with_javadoc
199
+ """,
200
+ "field_with_javadoc": """
201
+ (field_declaration
202
+ type: (_) @field_type
203
+ declarator: (variable_declarator
204
+ name: (identifier) @field_name)) @field_with_javadoc
205
+ """,
206
+ "method_parameters_detailed": """
207
+ (method_declaration
208
+ name: (identifier) @method_name
209
+ parameters: (formal_parameters
210
+ (formal_parameter
211
+ type: (_) @param_type
212
+ name: (identifier) @param_name)*) @parameters) @method_parameters_detailed
213
+ """,
214
+ "class_inheritance_detailed": """
215
+ (class_declaration
216
+ name: (identifier) @class_name
217
+ (superclass
218
+ (type_identifier) @extends_class)?
219
+ (super_interfaces
220
+ (interface_type_list
221
+ (type_identifier) @implements_interface)*)?
222
+ body: (class_body) @class_body) @class_inheritance_detailed
223
+ """,
224
+ "annotation_detailed": """
225
+ (annotation
226
+ name: (identifier) @annotation_name
227
+ (annotation_argument_list
228
+ (element_value_pair
229
+ key: (identifier) @param_key
230
+ value: (_) @param_value)*)?
231
+ ) @annotation_detailed
232
+ """,
233
+ "import_detailed": """
234
+ (import_declaration
235
+ "static"? @static_modifier
236
+ (scoped_identifier) @import_path) @import_detailed
237
+ """,
238
+ "package_detailed": """
239
+ (package_declaration
240
+ (scoped_identifier) @package_name) @package_detailed
241
+ """,
242
+ "constructor_detailed": """
243
+ (constructor_declaration
244
+ name: (identifier) @constructor_name
245
+ parameters: (formal_parameters) @parameters
246
+ body: (constructor_body) @constructor_body) @constructor_detailed
247
+ """,
248
+ "enum_constant": """
249
+ (enum_declaration
250
+ body: (enum_body
251
+ (enum_constant
252
+ name: (identifier) @constant_name)*)) @enum_constant
253
+ """,
254
+ "interface_method": """
255
+ (interface_declaration
256
+ body: (interface_body
257
+ (method_declaration
258
+ name: (identifier) @method_name
259
+ parameters: (formal_parameters) @parameters)*)) @interface_method
260
+ """,
261
+ }
262
+
263
+ # クエリの説明
264
+ JAVA_QUERY_DESCRIPTIONS: Dict[str, str] = {
265
+ "class": "Javaクラス宣言を抽出",
266
+ "interface": "Javaインターフェース宣言を抽出",
267
+ "enum": "Java列挙型宣言を抽出",
268
+ "annotation_type": "Javaアノテーション型宣言を抽出",
269
+ "method": "Javaメソッド宣言を抽出",
270
+ "constructor": "Javaコンストラクタ宣言を抽出",
271
+ "field": "Javaフィールド宣言を抽出",
272
+ "import": "Javaインポート文を抽出",
273
+ "package": "Javaパッケージ宣言を抽出",
274
+ "annotation": "Javaアノテーションを抽出",
275
+ "lambda": "Javaラムダ式を抽出",
276
+ "try_catch": "Java try-catch文を抽出",
277
+ "class_name": "クラス名のみを抽出",
278
+ "method_name": "メソッド名のみを抽出",
279
+ "field_name": "フィールド名のみを抽出",
280
+ "class_with_body": "クラス宣言と本体を抽出",
281
+ "method_with_body": "メソッド宣言と本体を抽出",
282
+ "extends_clause": "クラスの継承句を抽出",
283
+ "implements_clause": "クラスの実装句を抽出",
284
+ "public_methods": "publicメソッドを抽出",
285
+ "private_methods": "privateメソッドを抽出",
286
+ "static_methods": "staticメソッドを抽出",
287
+ # 構造情報抽出用クエリの説明
288
+ "javadoc_comment": "JavaDocコメントを抽出",
289
+ "class_with_javadoc": "JavaDoc付きクラスを抽出",
290
+ "method_with_javadoc": "JavaDoc付きメソッドを抽出",
291
+ "field_with_javadoc": "JavaDoc付きフィールドを抽出",
292
+ "method_parameters_detailed": "メソッドパラメータの詳細情報を抽出",
293
+ "class_inheritance_detailed": "クラスの継承関係詳細を抽出",
294
+ "annotation_detailed": "アノテーションの詳細情報を抽出",
295
+ "import_detailed": "インポート文の詳細情報を抽出",
296
+ "package_detailed": "パッケージ宣言の詳細情報を抽出",
297
+ "constructor_detailed": "コンストラクタの詳細情報を抽出",
298
+ "enum_constant": "列挙型定数を抽出",
299
+ "interface_method": "インターフェースメソッドを抽出",
300
+ "spring_controller": "Spring Controllerクラスを抽出",
301
+ "spring_service": "Spring Serviceクラスを抽出",
302
+ "spring_repository": "Spring Repositoryクラスを抽出",
303
+ "jpa_entity": "JPA Entityクラスを抽出",
304
+ "abstract_method": "抽象メソッドを抽出",
305
+ "static_field": "静的フィールドを抽出",
306
+ "final_field": "finalフィールドを抽出",
307
+ "static_import": "静的インポート文を抽出",
308
+ "marker_annotation": "マーカーアノテーションを抽出",
309
+ "annotation_with_params": "パラメータ付きアノテーションを抽出",
310
+ "synchronized_block": "synchronized文を抽出",
311
+ "generic_type": "ジェネリック型を抽出",
312
+ "method_with_annotations": "アノテーション付きメソッドを抽出",
313
+ "jpa_id_field": "JPA IDフィールドを抽出",
314
+ }
315
+
316
+
317
+ def get_java_query(name: str) -> str:
318
+ """
319
+ 指定されたJavaクエリを取得
320
+
321
+ Args:
322
+ name: クエリ名
323
+
324
+ Returns:
325
+ クエリ文字列
326
+
327
+ Raises:
328
+ ValueError: クエリが見つからない場合
329
+ """
330
+ if name not in JAVA_QUERIES:
331
+ available = list(JAVA_QUERIES.keys())
332
+ raise ValueError(f"Javaクエリ '{name}' は存在しません。利用可能: {available}")
333
+
334
+ return JAVA_QUERIES[name]
335
+
336
+
337
+ def get_java_query_description(name: str) -> str:
338
+ """
339
+ 指定されたJavaクエリの説明を取得
340
+
341
+ Args:
342
+ name: クエリ名
343
+
344
+ Returns:
345
+ クエリの説明
346
+ """
347
+ return JAVA_QUERY_DESCRIPTIONS.get(name, "説明なし")
348
+
349
+
350
+ # Convert to ALL_QUERIES format for dynamic loader compatibility
351
+ ALL_QUERIES = {}
352
+ for query_name, query_string in JAVA_QUERIES.items():
353
+ description = JAVA_QUERY_DESCRIPTIONS.get(query_name, "説明なし")
354
+ ALL_QUERIES[query_name] = {"query": query_string, "description": description}
355
+
356
+ # Add common query aliases for cross-language compatibility
357
+ ALL_QUERIES["functions"] = {
358
+ "query": JAVA_QUERIES["method"],
359
+ "description": "すべての関数/メソッド宣言を検索(methodのエイリアス)",
360
+ }
361
+
362
+ ALL_QUERIES["classes"] = {
363
+ "query": JAVA_QUERIES["class"],
364
+ "description": "すべてのクラス宣言を検索(classのエイリアス)",
365
+ }
366
+
367
+
368
+ def get_query(name: str) -> str:
369
+ """Get a specific query by name."""
370
+ if name in ALL_QUERIES:
371
+ return ALL_QUERIES[name]["query"]
372
+ raise ValueError(
373
+ f"Query '{name}' not found. Available queries: {list(ALL_QUERIES.keys())}"
374
+ )
375
+
376
+
377
+ def get_all_queries() -> dict:
378
+ """Get all available queries."""
379
+ return ALL_QUERIES
380
+
381
+
382
+ def list_queries() -> list:
383
+ """List all available query names."""
384
+ return list(ALL_QUERIES.keys())
385
+
386
+
387
+ def get_available_java_queries() -> list[str]:
388
+ """
389
+ 利用可能なJavaクエリ一覧を取得
390
+
391
+ Returns:
392
+ クエリ名のリスト
393
+ """
394
+ return list(JAVA_QUERIES.keys())
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ JavaScript Tree-sitter queries for code analysis.
5
+ """
6
+
7
+ # Function declarations and expressions
8
+ FUNCTIONS = """
9
+ (function_declaration
10
+ name: (identifier) @function.name
11
+ parameters: (formal_parameters) @function.params
12
+ body: (statement_block) @function.body) @function.declaration
13
+
14
+ (function_expression
15
+ name: (identifier)? @function.name
16
+ parameters: (formal_parameters) @function.params
17
+ body: (statement_block) @function.body) @function.expression
18
+
19
+ (arrow_function
20
+ parameters: (formal_parameters) @function.params
21
+ body: (_) @function.body) @function.arrow
22
+
23
+ (method_definition
24
+ name: (property_identifier) @function.name
25
+ parameters: (formal_parameters) @function.params
26
+ body: (statement_block) @function.body) @method.definition
27
+ """
28
+
29
+ # Class declarations
30
+ CLASSES = """
31
+ (class_declaration
32
+ name: (identifier) @class.name
33
+ superclass: (class_heritage)? @class.superclass
34
+ body: (class_body) @class.body) @class.declaration
35
+
36
+ (class_expression
37
+ name: (identifier)? @class.name
38
+ superclass: (class_heritage)? @class.superclass
39
+ body: (class_body) @class.body) @class.expression
40
+ """
41
+
42
+ # Variable declarations
43
+ VARIABLES = """
44
+ (variable_declaration
45
+ (variable_declarator
46
+ name: (identifier) @variable.name
47
+ value: (_)? @variable.value)) @variable.declaration
48
+
49
+ (lexical_declaration
50
+ (variable_declarator
51
+ name: (identifier) @variable.name
52
+ value: (_)? @variable.value)) @variable.lexical
53
+ """
54
+
55
+ # Import and export statements
56
+ IMPORTS = """
57
+ (import_statement
58
+ source: (string) @import.source) @import.statement
59
+
60
+ (import_statement
61
+ (import_clause
62
+ (named_imports
63
+ (import_specifier
64
+ name: (identifier) @import.name
65
+ alias: (identifier)? @import.alias))) @import.named
66
+
67
+ (import_statement
68
+ (import_clause
69
+ (import_default_specifier
70
+ (identifier) @import.default))) @import.default
71
+
72
+ (import_statement
73
+ (import_clause
74
+ (namespace_import
75
+ (identifier) @import.namespace))) @import.namespace
76
+ """
77
+
78
+ EXPORTS = """
79
+ (export_statement
80
+ declaration: (_) @export.declaration) @export.statement
81
+
82
+ (export_statement
83
+ (export_clause
84
+ (export_specifier
85
+ name: (identifier) @export.name
86
+ alias: (identifier)? @export.alias))) @export.named
87
+ """
88
+
89
+ # Object and property definitions
90
+ OBJECTS = """
91
+ (object
92
+ (pair
93
+ key: (_) @property.key
94
+ value: (_) @property.value)) @object.literal
95
+
96
+ (property_definition
97
+ property: (_) @property.name
98
+ value: (_)? @property.value) @property.definition
99
+ """
100
+
101
+ # Comments
102
+ COMMENTS = """
103
+ (comment) @comment
104
+ """
105
+
106
+ # All queries combined
107
+ ALL_QUERIES = {
108
+ "functions": {
109
+ "query": FUNCTIONS,
110
+ "description": "すべての関数宣言、式、メソッドを検索",
111
+ },
112
+ "classes": {
113
+ "query": CLASSES,
114
+ "description": "すべてのクラス宣言と式を検索",
115
+ },
116
+ "variables": {
117
+ "query": VARIABLES,
118
+ "description": "すべての変数宣言(var、let、const)を検索",
119
+ },
120
+ "imports": {
121
+ "query": IMPORTS,
122
+ "description": "すべてのインポート文と句を検索",
123
+ },
124
+ "exports": {"query": EXPORTS, "description": "すべてのエクスポート文を検索"},
125
+ "objects": {
126
+ "query": OBJECTS,
127
+ "description": "オブジェクトリテラルとプロパティ定義を検索",
128
+ },
129
+ "comments": {"query": COMMENTS, "description": "すべてのコメントを検索"},
130
+ }
131
+
132
+
133
+ def get_query(name: str) -> str:
134
+ """Get a specific query by name."""
135
+ if name in ALL_QUERIES:
136
+ return ALL_QUERIES[name]["query"]
137
+ raise ValueError(
138
+ f"Query '{name}' not found. Available queries: {list(ALL_QUERIES.keys())}"
139
+ )
140
+
141
+
142
+ def get_all_queries() -> dict:
143
+ """Get all available queries."""
144
+ return ALL_QUERIES
145
+
146
+
147
+ def list_queries() -> list:
148
+ """List all available query names."""
149
+ return list(ALL_QUERIES.keys())