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,581 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-analyzer
3
+ Version: 0.1.0
4
+ Summary: Extensible multi-language code analyzer framework using Tree-sitter with dynamic plugin architecture
5
+ Project-URL: Homepage, https://github.com/aimasteracc/tree-sitter-analyzer
6
+ Project-URL: Documentation, https://github.com/aimasteracc/tree-sitter-analyzer#readme
7
+ Project-URL: Repository, https://github.com/aimasteracc/tree-sitter-analyzer.git
8
+ Project-URL: Issues, https://github.com/aimasteracc/tree-sitter-analyzer/issues
9
+ Project-URL: Changelog, https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/CHANGELOG.md
10
+ Author-email: "aisheng.yu" <aimasteracc@gmail.com>
11
+ License-Expression: MIT
12
+ Keywords: ai-tools,ast,code-analysis,mcp,mcp-server,model-context-protocol,multi-language,parsing,static-analysis,tree-sitter
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Framework :: AsyncIO
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Communications
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Code Generators
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: Software Development :: Quality Assurance
26
+ Classifier: Topic :: Text Processing :: Linguistic
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: cachetools>=5.0.0
29
+ Requires-Dist: chardet>=5.0.0
30
+ Requires-Dist: tree-sitter-java>=0.23.5
31
+ Requires-Dist: tree-sitter>=0.20.0
32
+ Provides-Extra: all
33
+ Requires-Dist: tree-sitter-c>=0.20.0; extra == 'all'
34
+ Requires-Dist: tree-sitter-cpp>=0.20.0; extra == 'all'
35
+ Requires-Dist: tree-sitter-go>=0.20.0; extra == 'all'
36
+ Requires-Dist: tree-sitter-java>=0.21.0; extra == 'all'
37
+ Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'all'
38
+ Requires-Dist: tree-sitter-python>=0.23.0; extra == 'all'
39
+ Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'all'
40
+ Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'all'
41
+ Provides-Extra: c
42
+ Requires-Dist: tree-sitter-c>=0.20.0; extra == 'c'
43
+ Provides-Extra: cpp
44
+ Requires-Dist: tree-sitter-cpp>=0.20.0; extra == 'cpp'
45
+ Provides-Extra: dev
46
+ Requires-Dist: black>=23.0.0; extra == 'dev'
47
+ Requires-Dist: flake8>=6.0.0; extra == 'dev'
48
+ Requires-Dist: isort>=5.12.0; extra == 'dev'
49
+ Requires-Dist: memory-profiler>=0.61.0; extra == 'dev'
50
+ Requires-Dist: mypy>=1.17.0; extra == 'dev'
51
+ Requires-Dist: psutil>=7.0.0; extra == 'dev'
52
+ Requires-Dist: pytest-asyncio>=1.1.0; extra == 'dev'
53
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
54
+ Requires-Dist: pytest-mock>=3.14.1; extra == 'dev'
55
+ Requires-Dist: pytest>=8.3.5; extra == 'dev'
56
+ Requires-Dist: types-psutil>=5.9.0; extra == 'dev'
57
+ Provides-Extra: go
58
+ Requires-Dist: tree-sitter-go>=0.20.0; extra == 'go'
59
+ Provides-Extra: java
60
+ Requires-Dist: tree-sitter-java>=0.21.0; extra == 'java'
61
+ Provides-Extra: javascript
62
+ Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'javascript'
63
+ Provides-Extra: mcp
64
+ Requires-Dist: mcp>=1.0.0; extra == 'mcp'
65
+ Requires-Dist: pytest-asyncio>=1.1.0; extra == 'mcp'
66
+ Provides-Extra: popular
67
+ Requires-Dist: tree-sitter-java>=0.21.0; extra == 'popular'
68
+ Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'popular'
69
+ Requires-Dist: tree-sitter-python>=0.23.0; extra == 'popular'
70
+ Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'popular'
71
+ Provides-Extra: python
72
+ Requires-Dist: tree-sitter-python>=0.23.0; extra == 'python'
73
+ Provides-Extra: rust
74
+ Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'rust'
75
+ Provides-Extra: systems
76
+ Requires-Dist: tree-sitter-c>=0.20.0; extra == 'systems'
77
+ Requires-Dist: tree-sitter-cpp>=0.20.0; extra == 'systems'
78
+ Requires-Dist: tree-sitter-go>=0.20.0; extra == 'systems'
79
+ Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'systems'
80
+ Provides-Extra: test
81
+ Requires-Dist: pytest-asyncio>=1.1.0; extra == 'test'
82
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
83
+ Requires-Dist: pytest-mock>=3.14.1; extra == 'test'
84
+ Requires-Dist: pytest>=8.3.5; extra == 'test'
85
+ Requires-Dist: tree-sitter-java>=0.21.0; extra == 'test'
86
+ Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'test'
87
+ Requires-Dist: tree-sitter-python>=0.23.0; extra == 'test'
88
+ Provides-Extra: typescript
89
+ Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'typescript'
90
+ Provides-Extra: web
91
+ Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'web'
92
+ Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'web'
93
+ Description-Content-Type: text/markdown
94
+
95
+ # Tree-sitter Analyzer
96
+
97
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
98
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
99
+ [![Tests](https://img.shields.io/badge/tests-1268%20passed-brightgreen.svg)](#测试)
100
+
101
+ An extensible multi-language code analyzer framework using Tree-sitter with dynamic plugin architecture, designed to solve the problem of large code files exceeding LLM single-pass token limits.
102
+
103
+ **Available as both CLI tool and MCP server.**
104
+
105
+ ## Core Features
106
+
107
+ 1. **Code Scale Analysis** - Get overall structure without reading complete files
108
+ 2. **Targeted Code Extraction** - Extract specific line ranges efficiently
109
+ 3. **Code Position Information** - Get detailed position data for precise extraction
110
+
111
+ ## Installation
112
+
113
+ ### Prerequisites
114
+
115
+ First, install uv (a fast Python package manager):
116
+
117
+ ```bash
118
+ # On macOS and Linux
119
+ curl -LsSf https://astral.sh/uv/install.sh | sh
120
+
121
+ # On Windows
122
+ powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
123
+
124
+ # Or using pip
125
+ pip install uv
126
+ ```
127
+
128
+ ### Install from GitHub
129
+
130
+ ```bash
131
+ # Basic installation with Java support
132
+ # Clone and install the project
133
+ git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
134
+ cd tree-sitter-analyzer
135
+
136
+ # Install with Java support
137
+ uv sync
138
+ uv add tree-sitter-java
139
+
140
+ # With popular languages (Java, Python, JavaScript, TypeScript)
141
+ uv sync --extra popular
142
+
143
+ # With MCP server support
144
+ uv sync --extra mcp
145
+
146
+ # Full installation with all features
147
+ uv sync --extra all --extra mcp
148
+ ```
149
+
150
+ ### Alternative: Using pip
151
+
152
+ ```bash
153
+ # After the project is published to PyPI
154
+ pip install "tree-sitter-analyzer[java]"
155
+ ```
156
+
157
+ ## Usage
158
+
159
+ ### CLI Commands
160
+
161
+ ```bash
162
+ # Code scale analysis
163
+ python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text
164
+
165
+ # Partial code extraction
166
+ python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
167
+
168
+ # Position information table
169
+ python -m tree_sitter_analyzer examples/Sample.java --table=full
170
+ ```
171
+
172
+ #### CLI Output Examples
173
+
174
+ **Code Scale Analysis (`--advanced --output-format=text`):**
175
+
176
+ >```
177
+ >PS C:\git-public\tree-sitter-analyzer> python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text
178
+ >2025-07-30 16:57:47,827 - tree_sitter_analyzer - INFO - Successfully loaded 3 language plugins: java, javascript, python
179
+ >2025-07-30 16:57:47,916 - tree_sitter_analyzer - INFO - CacheService initialized: L1=100, L2=1000, L3=10000, TTL=3600s
180
+ >2025-07-30 16:57:47,917 - tree_sitter_analyzer - INFO - Loading plugins...
181
+ >2025-07-30 16:57:47,920 - tree_sitter_analyzer - INFO - Plugin registered for language: java
182
+ >2025-07-30 16:57:47,920 - tree_sitter_analyzer - INFO - Plugin registered for language: javascript
183
+ >2025-07-30 16:57:47,922 - tree_sitter_analyzer - INFO - Plugin registered for language: python
184
+ >2025-07-30 16:57:47,922 - tree_sitter_analyzer - INFO - Successfully loaded 3 language plugins: java, javascript, python
185
+ >2025-07-30 16:57:47,923 - tree_sitter_analyzer - INFO - UnifiedAnalysisEngine initialized
186
+ >INFO: 拡張子から言語を自動判定しました: java
187
+ >2025-07-30 16:57:47,925 - tree_sitter_analyzer - INFO - Starting analysis for examples/Sample.java
188
+ >2025-07-30 16:57:47,945 - tree_sitter_analyzer.core.parser - INFO - Parser initialized successfully
189
+ >2025-07-30 16:57:47,951 - PERF - analyze_java: 0.0253s - Operation completed
190
+ >2025-07-30 16:57:47,951 - tree_sitter_analyzer.performance - INFO - analyze_java: 0.0253s - Operation completed
191
+ >2025-07-30 16:57:47,958 - PERF - unified_analysis: 0.0253s - Analyzed examples/Sample.java (java)
192
+ >2025-07-30 16:57:47,958 - tree_sitter_analyzer.performance - INFO - unified_analysis: 0.0253s - Analyzed examples/Sample.java (java)
193
+ >
194
+ >--- 高度な解析結果 ---
195
+ >"ファイル: examples/Sample.java"
196
+ >"パッケージ: (default)"
197
+ >"行数: 178"
198
+ >"\nクラス数: 8"
199
+ >"メソッド数: 24"
200
+ >"フィールド数: 5"
201
+ >"インポート数: 2"
202
+ >"アノテーション数: 0"
203
+ >```
204
+
205
+ **Partial Code Extraction (`--partial-read`):**
206
+ >```
207
+ >PS C:\git-public\tree-sitter-analyzer> python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
208
+ >2025-07-30 16:58:22,948 - tree_sitter_analyzer - INFO - Successfully loaded 3 language plugins: java, javascript, python
209
+ >2025-07-30 16:58:23,056 - tree_sitter_analyzer - INFO - Successfully read partial file examples/Sample.java: lines 84-86
210
+ >{
211
+ > "file_path": "examples/Sample.java",
212
+ > "range": {
213
+ > "start_line": 84,
214
+ > "end_line": 86,
215
+ > "start_column": null,
216
+ > "end_column": null
217
+ > },
218
+ > "content": " public void innerMethod() {\n System.out.println(\"Inner class method, value: \" + value);\n }\n",
219
+ > "content_length": 117
220
+ >}
221
+ >```
222
+
223
+ **Table Format Analysis (`--table=full`):**
224
+
225
+ The `--table=full` command produces detailed analysis tables:
226
+
227
+
228
+ ># Sample.java
229
+ >
230
+ >## Imports
231
+ >```java
232
+ >java.util.List
233
+ >java.util.ArrayList
234
+ >```
235
+ >
236
+ >## Classes
237
+ >| Class | Type | Visibility | Lines | Methods | Fields |
238
+ >|-------|------|------------|-------|---------|--------|
239
+ >| AbstractParentClass | class | public | 7-15 | 2 | 0 |
240
+ >| ParentClass | class | public | 18-45 | 4 | 2 |
241
+ >| TestInterface | class | public | 48-64 | 3 | 0 |
242
+ >| AnotherInterface | class | public | 67-69 | 1 | 0 |
243
+ >| Test | class | public | 72-159 | 14 | 3 |
244
+ >| InnerClass | class | public | 83-87 | 1 | 0 |
245
+ >| StaticNestedClass | class | public | 90-94 | 1 | 0 |
246
+ >| TestEnum | class | public | 162-178 | 0 | 0 |
247
+ >
248
+ >## Fields
249
+ >| Name | Type | Vis | Modifiers | Line | Doc |
250
+ >|------|------|-----|-----------|------|-----|
251
+ >| CONSTANT | String | ~ | static,final | 20 | - |
252
+ >| parentField | String | # | protected | 23 | - |
253
+ >| value | int | - | private | 74 | - |
254
+ >| staticValue | int | + | public,static | 77 | - |
255
+ >| finalField | String | - | private,final | 80 | - |
256
+ >
257
+ >## Constructor
258
+ >| Method | Signature | Vis | Lines | Cols | Cx | Doc |
259
+ >|--------|-----------|-----|-------|------|----|----|
260
+ >| ParentClass | ():void | + | 26-28 | 5-6 | 1 | - |
261
+ >| Test | (value:int):void | + | 97-100 | 5-6 | 1 | - |
262
+ >| Test | ():void | + | 103-105 | 5-6 | 1 | - |
263
+ >
264
+ >## Public Methods
265
+ >| Method | Signature | Vis | Lines | Cols | Cx | Doc |
266
+ >|--------|-----------|-----|-------|------|----|----|
267
+ >| innerMethod | ():void | + | 84-86 | 5-6 | 1 | - |
268
+ >| nestedMethod | ():void | + | 91-93 | 5-6 | 1 | - |
269
+ >| getValue | ():String | + | 108-110 | 5-6 | 1 | - |
270
+ >| staticMethod | ():void [static] | + | 128-130 | 5-6 | 1 | - |
271
+ >| finalMethod | ():void | + | 133-135 | 5-6 | 1 | - |
272
+ >| doSomething | ():void | + | 138-141 | 5-6 | 1 | - |
273
+ >| anotherMethod | ():void | + | 143-146 | 5-6 | 1 | - |
274
+ >| genericMethod | (input:T):void | + | 149-151 | 5-6 | 1 | - |
275
+ >| createList | (item:T):List<T> | + | 154-158 | 5-6 | 1 | - |
276
+ >
277
+ >## Private Methods
278
+ >| Method | Signature | Vis | Lines | Cols | Cx | Doc |
279
+ >|--------|-----------|-----|-------|------|----|----|
280
+ >| privateMethod | ():void | - | 123-125 | 5-6 | 1 | - |
281
+
282
+
283
+ ### MCP Server
284
+
285
+ The Tree-sitter Analyzer provides an MCP (Model Context Protocol) server that enables AI assistants to analyze code files directly.
286
+
287
+ ```bash
288
+ # Start MCP server
289
+ python -m tree_sitter_analyzer.mcp.server
290
+ ```
291
+
292
+
293
+
294
+ ### MCP Configuration
295
+
296
+ Add to your Claude Desktop config file:
297
+
298
+ ```json
299
+ {
300
+ "mcpServers": {
301
+ "tree-sitter-analyzer": {
302
+ "command": "uv",
303
+ "args": [
304
+ "run",
305
+ "--with",
306
+ "tree-sitter-analyzer[mcp]",
307
+ "python",
308
+ "-m",
309
+ "tree_sitter_analyzer.mcp.server"
310
+ ]
311
+ }
312
+ }
313
+ }
314
+ ```
315
+
316
+ #### Available MCP Tools
317
+
318
+ 1. **analyze_code_scale** - Get code scale and complexity metrics
319
+ 2. **format_table** - Generate table-formatted analysis (equivalent to CLI `--table=full`)
320
+ 3. **read_code_partial** - Extract specific line ranges from files
321
+ 4. **get_code_positions** - Get precise position information for code elements
322
+ 5. **analyze_code_universal** - Universal code analysis with automatic language detection
323
+
324
+ #### MCP Usage Examples
325
+
326
+ **Code Scale Analysis:**
327
+ ```json
328
+ {
329
+ "tool": "analyze_code_scale",
330
+ "arguments": {
331
+ "file_path": "examples/Sample.java",
332
+ "include_complexity": true,
333
+ "include_details": true
334
+ }
335
+ }
336
+ ```
337
+
338
+ >```json
339
+ >{
340
+ > "file_path": "examples/Sample.java",
341
+ > "language": "java",
342
+ > "analyzer_type": "advanced",
343
+ > "analysis_type": "basic",
344
+ > "metrics": {
345
+ > "lines_total": 178,
346
+ > "lines_code": 0,
347
+ > "lines_comment": 0,
348
+ > "lines_blank": 0,
349
+ > "elements": {
350
+ > "classes": 8,
351
+ > "methods": 24,
352
+ > "fields": 5,
353
+ > "imports": 2,
354
+ > "annotations": 0
355
+ > }
356
+ > }
357
+ >}
358
+ >```
359
+
360
+ **Table Format Analysis:**
361
+ ```json
362
+ {
363
+ "tool": "format_table",
364
+ "arguments": {
365
+ "file_path": "examples/Sample.java",
366
+ "format_type": "full"
367
+ }
368
+ }
369
+ ```
370
+ >```json
371
+ >{
372
+ > "table_output": "# Sample.java\n\n## Imports\n```java\njava.util.List\njava.util.ArrayList\n```\n\n## Classes\n| Class | Type | >Visibility | Lines | Methods | Fields |\n|-------|------|------------|-------|---------|--------|\n| AbstractParentClass | class | public | >7-15 | 2 | 0 |\n| ParentClass | class | public | 18-45 | 4 | 2 |\n| TestInterface | interface | public | 48-64 | 3 | 0 |\n| >AnotherInterface | interface | public | 67-69 | 1 | 0 |\n| Test | class | public | 72-159 | 14 | 3 |\n| InnerClass | class | public | >83-87 | 1 | 0 |\n| StaticNestedClass | class | public | 90-94 | 1 | 0 |\n| TestEnum | enum | public | 162-178 | 0 | 0 |\n\n## Fields\n| >Name | Type | Vis | Modifiers | Line | Doc |\n|------|------|-----|-----------|------|-----|\n| CONSTANT | String | ~ | static,final | 20 | >- |\n| parentField | String | # | protected | 23 | - |\n| value | int | - | private | 74 | - |\n| staticValue | int | + | public,static | >77 | - |\n| finalField | String | - | private,final | 80 | - |\n\n## Constructor\n| Method | Signature | Vis | Lines | Cols | Cx | Doc |\n|>--------|-----------|-----|-------|------|----|----|\n| ParentClass | ():void | + | 26-28 | 5-6 | 1 | - |\n| Test | (value:int):void | + | >97-100 | 5-6 | 1 | - |\n| Test | ():void | + | 103-105 | 5-6 | 1 | - |\n\n## Public Methods\n| Method | Signature | Vis | Lines | Cols | >Cx | Doc |\n|--------|-----------|-----|-------|------|----|----|\n| innerMethod | ():void | + | 84-86 | 5-6 | 1 | - |\n| nestedMethod | ()>:void | + | 91-93 | 5-6 | 1 | - |\n| getValue | ():String | + | 108-110 | 5-6 | 1 | - |\n| staticMethod | ():void [static] | + | 128-130 | >5-6 | 1 | - |\n| finalMethod | ():void | + | 133-135 | 5-6 | 1 | - |\n| doSomething | ():void | + | 138-141 | 5-6 | 1 | - |\n| >anotherMethod | ():void | + | 143-146 | 5-6 | 1 | - |\n| genericMethod | (input:T):void | + | 149-151 | 5-6 | 1 | - |\n| createList | >(item:T):List<T> | + | 154-158 | 5-6 | 1 | - |\n\n## Private Methods\n| Method | Signature | Vis | Lines | Cols | Cx | Doc |\n|--------|>-----------|-----|-------|------|----|----|\n| privateMethod | ():void | - | 123-125 | 5-6 | 1 | - |",
373
+ > "format_type": "full",
374
+ > "file_path": "examples/Sample.java",
375
+ > "language": "java",
376
+ > "metadata": {
377
+ > "classes_count": 8,
378
+ > "methods_count": 24,
379
+ > "fields_count": 5,
380
+ > "total_lines": 178
381
+ > }
382
+ >}
383
+ >```
384
+
385
+
386
+ **Partial Code Reading:**
387
+ ```json
388
+ {
389
+ "tool": "read_code_partial",
390
+ "arguments": {
391
+ "file_path": "examples/Sample.java",
392
+ "start_line": 84,
393
+ "end_line": 86
394
+ }
395
+ }
396
+ ```
397
+ >```json
398
+ >{
399
+ > "partial_content_result": "--- 部分読み込み結果 ---\nファイル: examples/Sample.java\n範囲: 行 84-86\n読み込み文字数: 117\n{\n \"file_path\": >\"examples/Sample.java\",\n \"range\": {\n \"start_line\": 84,\n \"end_line\": 86,\n \"start_column\": null,\n \"end_column\": >null\n },\n \"content\": \" public void innerMethod() {\\n System.out.println(\\\"Inner class method, value: \\\" + >value);\\n }\\n\",\n \"content_length\": 117\n}"
400
+ >}
401
+ >```
402
+
403
+
404
+ **Get Code Positions:**
405
+ ```json
406
+ {
407
+ "tool": "get_code_positions",
408
+ "arguments": {
409
+ "file_path": "examples/Sample.java",
410
+ "element_types": ["methods", "classes"],
411
+ "include_details": true
412
+ }
413
+ }
414
+ ```
415
+ >```json
416
+ >{
417
+ > "file_path": "examples/Sample.java",
418
+ > "language": "java",
419
+ > "element_types": [
420
+ > "methods",
421
+ > "classes"
422
+ > ],
423
+ > "include_details": true,
424
+ > "format": "json",
425
+ > "total_elements": 32,
426
+ > "positions": {
427
+ > "methods": [
428
+ > {
429
+ > "name": "abstractMethod",
430
+ > "start_line": 9,
431
+ > "end_line": 9,
432
+ > "start_column": 0,
433
+ > "end_column": 0,
434
+ > "signature": "abstractMethod()",
435
+ > "return_type": "void",
436
+ > "visibility": "package",
437
+ > "is_static": false,
438
+ > "is_constructor": false,
439
+ > "complexity": 1,
440
+ > "annotations": []
441
+ > },
442
+ > ...
443
+ > {
444
+ > "name": "createList",
445
+ > "start_line": 154,
446
+ > "end_line": 158,
447
+ > "start_column": 0,
448
+ > "end_column": 0,
449
+ > "signature": "createList(T item)",
450
+ > "return_type": "List<T>",
451
+ > "visibility": "public",
452
+ > "is_static": false,
453
+ > "is_constructor": false,
454
+ > "complexity": 1,
455
+ > "annotations": []
456
+ > }
457
+ > ],
458
+ > "classes": [
459
+ > {
460
+ > "name": "AbstractParentClass",
461
+ > "start_line": 7,
462
+ > "end_line": 15,
463
+ > "start_column": 0,
464
+ > "end_column": 0,
465
+ > "type": "class",
466
+ > "visibility": "package",
467
+ > "extends": null,
468
+ > "implements": [],
469
+ > "annotations": []
470
+ > },
471
+ > {
472
+ > "name": "ParentClass",
473
+ > "start_line": 18,
474
+ > "end_line": 45,
475
+ > "start_column": 0,
476
+ > "end_column": 0,
477
+ > "type": "class",
478
+ > "visibility": "package",
479
+ > "extends": "AbstractParentClass",
480
+ > "implements": [],
481
+ > "annotations": []
482
+ > },
483
+ > {
484
+ > "name": "TestInterface",
485
+ > "start_line": 48,
486
+ > "end_line": 64,
487
+ > "start_column": 0,
488
+ > "end_column": 0,
489
+ > "type": "interface",
490
+ > "visibility": "package",
491
+ > "extends": null,
492
+ > "implements": [],
493
+ > "annotations": []
494
+ > },
495
+ > {
496
+ > "name": "AnotherInterface",
497
+ > "start_line": 67,
498
+ > "end_line": 69,
499
+ > "start_column": 0,
500
+ > "end_column": 0,
501
+ > "type": "interface",
502
+ > "visibility": "package",
503
+ > "extends": null,
504
+ > "implements": [],
505
+ > "annotations": []
506
+ > },
507
+ > {
508
+ > "name": "Test",
509
+ > "start_line": 72,
510
+ > "end_line": 159,
511
+ > "start_column": 0,
512
+ > "end_column": 0,
513
+ > "type": "class",
514
+ > "visibility": "public",
515
+ > "extends": "ParentClass",
516
+ > "implements": [
517
+ > "TestInterface",
518
+ > "AnotherInterface"
519
+ > ],
520
+ > "annotations": []
521
+ > },
522
+ > {
523
+ > "name": "InnerClass",
524
+ > "start_line": 83,
525
+ > "end_line": 87,
526
+ > "start_column": 0,
527
+ > "end_column": 0,
528
+ > "type": "class",
529
+ > "visibility": "public",
530
+ > "extends": null,
531
+ > "implements": [],
532
+ > "annotations": []
533
+ > },
534
+ > {
535
+ > "name": "StaticNestedClass",
536
+ > "start_line": 90,
537
+ > "end_line": 94,
538
+ > "start_column": 0,
539
+ > "end_column": 0,
540
+ > "type": "class",
541
+ > "visibility": "public",
542
+ > "extends": null,
543
+ > "implements": [],
544
+ > "annotations": []
545
+ > },
546
+ > {
547
+ > "name": "TestEnum",
548
+ > "start_line": 162,
549
+ > "end_line": 178,
550
+ > "start_column": 0,
551
+ > "end_column": 0,
552
+ > "type": "enum",
553
+ > "visibility": "package",
554
+ > "extends": null,
555
+ > "implements": [],
556
+ > "annotations": []
557
+ > }
558
+ > ]
559
+ > }
560
+ > }
561
+ > ```
562
+
563
+ ## Development
564
+
565
+ For developers and contributors:
566
+
567
+ ```bash
568
+ # Clone the repository
569
+ git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
570
+ cd tree-sitter-analyzer
571
+
572
+ # Install development dependencies
573
+ uv sync
574
+
575
+ # Run tests
576
+ pytest tests/ -v
577
+ ```
578
+
579
+ ## License
580
+
581
+ MIT License
@@ -0,0 +1,78 @@
1
+ tree_sitter_analyzer/__init__.py,sha256=I3c5IemBF8dbkjRUZY-pELQipGRsTj39Nt2feVZBwss,3003
2
+ tree_sitter_analyzer/__main__.py,sha256=25E8WFUzTFAYqwT5Pdlq6cn8Aa25ogHP3w_5ybbHbNc,317
3
+ tree_sitter_analyzer/api.py,sha256=-Np6khuxbzBA_T2FN-Z8WDEXz7260OcwKIMP3iz2Kaw,17870
4
+ tree_sitter_analyzer/cli_main.py,sha256=G75GblQnD-k_hJTOhMV31bUB_yApEfpBgAhO-67BLbU,9748
5
+ tree_sitter_analyzer/encoding_utils.py,sha256=bgzyec3Rm1oxyRpTmXS_B5GOcA6rU54YCPRxv-2Z3q0,15017
6
+ tree_sitter_analyzer/exceptions.py,sha256=s--JRYJXH8Ui7ChtWuMS4npM4V0-L3aW831xQO5v6RM,10219
7
+ tree_sitter_analyzer/file_handler.py,sha256=P2S0AOCeo1mzVj_gDrntCSWGt9E3cflSfaxsPRx2EPM,7620
8
+ tree_sitter_analyzer/java_analyzer.py,sha256=axYh_OUidqrSWbqpXwAXU327_zhx4VmIgORoUuTpVxM,8699
9
+ tree_sitter_analyzer/language_detector.py,sha256=KJfB8AMe9Kn0Y8hJyRRv7x3Onu5IvBGhoNI4gGKnEjM,12608
10
+ tree_sitter_analyzer/language_loader.py,sha256=okZeUmEeJo_OQJSYCfjzDf29-RuNM9K8-JNlFD18CMs,8296
11
+ tree_sitter_analyzer/models.py,sha256=2JZAQXM4nJVu7rfnsZFwpvPpv8fpk0POVHKCKeOMLMY,17039
12
+ tree_sitter_analyzer/output_manager.py,sha256=dh_yfAmvn-XuF7RP5DM5vnqHGRzBUDOsuiVvTjcaOwg,8769
13
+ tree_sitter_analyzer/query_loader.py,sha256=KrpNnf-plrtymDAfUF6ukw8ELtGWnqhikwPLW_z9vY8,10225
14
+ tree_sitter_analyzer/table_formatter.py,sha256=FpYywpJOkXv3FfHEDFSWjfP5ZFa1WJZ6QqN_H0YtUC4,18274
15
+ tree_sitter_analyzer/utils.py,sha256=Qh9kpFzxvKNTbLfmdl5jsIqVxuBIarIgZdBbizDOKH8,5978
16
+ tree_sitter_analyzer/cli/__init__.py,sha256=zCYwQW0hKFfZ4w-qoSOnqVKZGtdZ-ziH60Ax0QBE2iQ,886
17
+ tree_sitter_analyzer/cli/__main__.py,sha256=Sa02Ye57FhkDVTlGrb6U3m9V6II_TIuyzoQIwZtBkZ0,254
18
+ tree_sitter_analyzer/cli/info_commands.py,sha256=B9fBryAJ2Ctt-wo8Tko86BKOfFCCBPhAWz9vz_3r1fs,4521
19
+ tree_sitter_analyzer/cli/commands/__init__.py,sha256=duw37uHXggCRf08vaGQeY4dy7krZrc7YpXBNmlzhSQw,722
20
+ tree_sitter_analyzer/cli/commands/advanced_command.py,sha256=c-r406B6NlHoDvlu9vCpMpFA-r-d3MgWPXbiHqXgLhg,3587
21
+ tree_sitter_analyzer/cli/commands/base_command.py,sha256=4upfagY8xGvg4vWUmyaYvBt0sEcj143fSjADQgdjde0,6055
22
+ tree_sitter_analyzer/cli/commands/default_command.py,sha256=lRy3WnCYZe3G4wpz4ZXyDc_wHByCHBhB0kdLdPJbKt0,601
23
+ tree_sitter_analyzer/cli/commands/partial_read_command.py,sha256=ZX-ML22CIsK3sL9fms7JvSPdpEZJsqX3_JCgJ2JyRvE,4952
24
+ tree_sitter_analyzer/cli/commands/query_command.py,sha256=Z3QFVD8pYauW7oUHr-X6zZqUM_GYfBXSNYdSqyEjHP8,3294
25
+ tree_sitter_analyzer/cli/commands/structure_command.py,sha256=mRCn9E01C4dCu4oaIU3YpX4h5WK1dJXLc6wMyVbzC-w,5223
26
+ tree_sitter_analyzer/cli/commands/summary_command.py,sha256=rTUX6-ejWouiKHWnel4eca8dhgSCDTEhdXPmai1_6Tc,3715
27
+ tree_sitter_analyzer/cli/commands/table_command.py,sha256=vehgW7nEIF5x_ghUHytdQX5pl7_uKO1Qwmwj4OjFFx0,9604
28
+ tree_sitter_analyzer/core/__init__.py,sha256=raWtpBZJFxo_G1q3WJxdzmcbQK0TqqDycm-GLrjv4OA,479
29
+ tree_sitter_analyzer/core/analysis_engine.py,sha256=5xwGRd-Blkyp3M4CIkFHbD6jULm3bbnv2Hn15fRyk-8,21256
30
+ tree_sitter_analyzer/core/cache_service.py,sha256=1TZm3YfyQJIhBAC-3GDmsMJBGsIVb9SFDYG74imZGlk,10836
31
+ tree_sitter_analyzer/core/engine.py,sha256=nUQa_-Gjx0QSpbvYT17Tpo1Gp5Us9O1ohSLw5z_0NTM,19688
32
+ tree_sitter_analyzer/core/parser.py,sha256=5MIP18Kx8jYgzkDOGsKXoN0aObNetbYjsLqGTkrhGNU,9733
33
+ tree_sitter_analyzer/core/query.py,sha256=ye9MV5zH4qnA1Zrut3pWgCt9DWVAtI4JjepNyMSr7Uw,17306
34
+ tree_sitter_analyzer/formatters/__init__.py,sha256=ILBoX4Fj2M8xdLuKsS0JIkhML0cNo7EziNWU8h--kfA,30
35
+ tree_sitter_analyzer/formatters/base_formatter.py,sha256=5nbjJVyAJq4RPJjnqRhrR0buW31eRxhvMccEDIUTD2c,6132
36
+ tree_sitter_analyzer/formatters/formatter_factory.py,sha256=_jw9Emd7t0vM3DroJwBxqPlNTpq2BDtUvE4juKOHlTI,2491
37
+ tree_sitter_analyzer/formatters/java_formatter.py,sha256=HmbQJgYsswg3whZ61p-M_CuHxg72yY-EtszOBVnjsw8,11285
38
+ tree_sitter_analyzer/formatters/python_formatter.py,sha256=Fz84SHDExP2nSx3Iq43XbbY8Z9dWYQj5zJS9cmPLysA,9898
39
+ tree_sitter_analyzer/interfaces/__init__.py,sha256=YrVFjBhhOkcJ4bRGmQnRBHwOSyPUsBLVy77Bc9eUYC8,303
40
+ tree_sitter_analyzer/interfaces/cli.py,sha256=1eP1Ji4CnMMK9Iabatw0UrDqdhnncRGqF5dWkKBl5OU,17841
41
+ tree_sitter_analyzer/interfaces/cli_adapter.py,sha256=0lxm8dQuzTohlXptFq2bZEjnL7YAmOnli2iN3C8V0TA,11461
42
+ tree_sitter_analyzer/interfaces/mcp_adapter.py,sha256=vZcZy5FRYrSjJkRvdyu28OtqoESwiXkTqH9Nv7irRqM,6515
43
+ tree_sitter_analyzer/interfaces/mcp_server.py,sha256=3zj02Ur00ceJvKSG5bkuxlU2bHLaiCWjW2367dNPlLM,16907
44
+ tree_sitter_analyzer/languages/__init__.py,sha256=MAZEb-ifvdttqAQts_n3Cj9jtMd1cyAtDgbEde63p4A,373
45
+ tree_sitter_analyzer/languages/java_plugin.py,sha256=2VdS2ZoNhd8q-Dqlc08vpfhoGqpN-vqEkRkFF4uuczE,46174
46
+ tree_sitter_analyzer/languages/python_plugin.py,sha256=to_mg-x4nJZO27i7geP5sTmHCLXiv2_gjFCCPB0ELZU,28839
47
+ tree_sitter_analyzer/mcp/__init__.py,sha256=QX4WA9HrxASLW1q-aVKhmXyONBy__2X9jOj9YctEj9Q,783
48
+ tree_sitter_analyzer/mcp/server.py,sha256=Si8Vado3N3v9oXa-7zof0216ZRE0pT9s_FQ1WBjUaPo,12033
49
+ tree_sitter_analyzer/mcp/resources/__init__.py,sha256=caWz1n3l22IaxBZ1plSjIUfroassWNNDRWEwEp1vaMw,1490
50
+ tree_sitter_analyzer/mcp/resources/code_file_resource.py,sha256=p3XrTAHPasl92f7mdiWnRv2nl338GPeKlYdCIzLyYqg,6541
51
+ tree_sitter_analyzer/mcp/resources/project_stats_resource.py,sha256=CkvfOSr7Bk6mJlJt-MkXw3kmUC0VAAsw8w1-AcGO0ek,19854
52
+ tree_sitter_analyzer/mcp/tools/__init__.py,sha256=SQ6VPIID-pj93tKGF5EvcKul20-C_KKdhTZIhcVlQmk,1025
53
+ tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py,sha256=0jCLyxmS70z2NRKKoOagaQAGCoiYD9qVcBgieuutE4M,23543
54
+ tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py,sha256=xwXuy72FEfoY2TW6URddfdS9Ha_lq8_ZgG0UxC26mLM,8954
55
+ tree_sitter_analyzer/mcp/tools/base_tool.py,sha256=LpY_QPWbpm8ZGe3SPK7TIBFZMiwkUMpHa8zcswld2ag,1295
56
+ tree_sitter_analyzer/mcp/tools/get_positions_tool.py,sha256=wjRU26w1F5ta-uZ8IrU6Re3zeGmNAHhz8uAMkuQpoxs,16914
57
+ tree_sitter_analyzer/mcp/tools/read_partial_tool.py,sha256=Xkk90JVFpZfW3cPyHLo1OpU8Fq671RPOO_zGbTmcrdM,11116
58
+ tree_sitter_analyzer/mcp/tools/table_format_tool.py,sha256=IUF7N5Je_rV88RkEVz5wet37PZLaDdzXoAC5j1xI3EI,14428
59
+ tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py,sha256=asH_2BLzT-ACLLampyHF61WFn5nSVKL94wE0mU-uui8,19635
60
+ tree_sitter_analyzer/mcp/utils/__init__.py,sha256=f1WkdJ3XNWgh2NDN0LGNdwk5O-ChqEvnOQ-mINlHPG8,3064
61
+ tree_sitter_analyzer/mcp/utils/error_handler.py,sha256=VXVutTKA8AvtP_yiX__gqkbsSmK8_pfH3rF_H7yFsVI,18012
62
+ tree_sitter_analyzer/plugins/__init__.py,sha256=HOxO8UVYexzkaxNTqKlWDXyrMy1cxnK7P-brQSh5WGU,12650
63
+ tree_sitter_analyzer/plugins/base.py,sha256=ixGtS5uKmMArofK1G6xtqbtOdDjbNCHhjIgVNVqIx4c,15968
64
+ tree_sitter_analyzer/plugins/java_plugin.py,sha256=9wAjLoj6uEsLupUz7l7xp5VppLG5TpapWpshJtmncjA,24137
65
+ tree_sitter_analyzer/plugins/javascript_plugin.py,sha256=7LfNfuA-ygl_M5PbJz-QPMf7mnmGYRfSqrFwujiVhuo,16031
66
+ tree_sitter_analyzer/plugins/manager.py,sha256=BjhdgNhS8ev2YtrG_awusNxmRXJSn6p5PraH5cLRhMk,12521
67
+ tree_sitter_analyzer/plugins/plugin_loader.py,sha256=KZYEJCUo1w3w83YWRIh2lI1TRoS0CDQAtXWhdKrrVjM,2478
68
+ tree_sitter_analyzer/plugins/python_plugin.py,sha256=UutWJGlw3GsTunzF5eTPjEugELynkJpwnkEnVwEbJLY,23457
69
+ tree_sitter_analyzer/plugins/registry.py,sha256=ifKlvD4IFcwcvKcAoIJRVlLel-pg6ey97i1Nx_uic7s,12048
70
+ tree_sitter_analyzer/queries/__init__.py,sha256=HavpqPqK5M4j8PjRWgkUm_9fTHqftDCHuz2zcG63Cc4,747
71
+ tree_sitter_analyzer/queries/java.py,sha256=hmaj7jKQ_m9nmOAnyiWQhzH-6g41xIi3fwt5ZTUTrQQ,12979
72
+ tree_sitter_analyzer/queries/javascript.py,sha256=TSe6uSHhBuQU0r2B8YBqpEYkU4q9CYRuTUqRK0WfM5o,4183
73
+ tree_sitter_analyzer/queries/python.py,sha256=V5MsKmI9A_FqAT2PKkrSL_Xp9bGKBUSpyVPoBmLxxWg,8018
74
+ tree_sitter_analyzer/queries/typescript.py,sha256=T8a9PwqqGkwLr8clVsAfu0IUIrLKH8u4sBqlU1Cz-FE,7138
75
+ tree_sitter_analyzer-0.1.0.dist-info/METADATA,sha256=Lae0km9mLIkZ_2omwxhIkOv1iUv9wRZFDOa5iWJCHG8,20459
76
+ tree_sitter_analyzer-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
77
+ tree_sitter_analyzer-0.1.0.dist-info/entry_points.txt,sha256=SJQuz4-IsroAsZHTfT1Q9BnAyEIULOSUiB_NaUSrjPE,354
78
+ tree_sitter_analyzer-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,8 @@
1
+ [console_scripts]
2
+ code-analyzer = tree_sitter_analyzer.interfaces.cli:main
3
+ java-analyzer = tree_sitter_analyzer.interfaces.cli:main
4
+ tree-sitter-analyzer = tree_sitter_analyzer.interfaces.cli:main
5
+
6
+ [tree_sitter_analyzer.plugins]
7
+ java = tree_sitter_analyzer.languages.java_plugin:JavaPlugin
8
+ python = tree_sitter_analyzer.plugins.python_plugin:PythonPlugin