tree-sitter-analyzer 0.1.2__py3-none-any.whl → 0.2.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.
- tree_sitter_analyzer/__init__.py +1 -1
- tree_sitter_analyzer/cli/commands/advanced_command.py +10 -10
- tree_sitter_analyzer/cli/commands/base_command.py +11 -11
- tree_sitter_analyzer/cli/commands/partial_read_command.py +12 -12
- tree_sitter_analyzer/cli/commands/structure_command.py +13 -13
- tree_sitter_analyzer/cli/commands/summary_command.py +8 -8
- tree_sitter_analyzer/cli_main.py +6 -6
- tree_sitter_analyzer/mcp/tools/read_partial_tool.py +5 -5
- tree_sitter_analyzer/mcp/tools/table_format_tool.py +9 -9
- tree_sitter_analyzer/table_formatter.py +26 -26
- tree_sitter_analyzer-0.2.0.dist-info/METADATA +331 -0
- {tree_sitter_analyzer-0.1.2.dist-info → tree_sitter_analyzer-0.2.0.dist-info}/RECORD +14 -14
- tree_sitter_analyzer-0.1.2.dist-info/METADATA +0 -444
- {tree_sitter_analyzer-0.1.2.dist-info → tree_sitter_analyzer-0.2.0.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-0.1.2.dist-info → tree_sitter_analyzer-0.2.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tree-sitter-analyzer
|
|
3
|
-
Version: 0.1.2
|
|
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
|
-
Project-URL: Bug Reports, https://github.com/aimasteracc/tree-sitter-analyzer/issues
|
|
11
|
-
Project-URL: Source Code, https://github.com/aimasteracc/tree-sitter-analyzer
|
|
12
|
-
Author-email: "aisheng.yu" <aimasteracc@gmail.com>
|
|
13
|
-
Maintainer-email: "aisheng.yu" <aimasteracc@gmail.com>
|
|
14
|
-
License: MIT
|
|
15
|
-
Keywords: ai-tools,ast,code-analysis,mcp,mcp-server,model-context-protocol,multi-language,parsing,static-analysis,tree-sitter
|
|
16
|
-
Classifier: Development Status :: 4 - Beta
|
|
17
|
-
Classifier: Framework :: AsyncIO
|
|
18
|
-
Classifier: Intended Audience :: Developers
|
|
19
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
-
Classifier: Operating System :: OS Independent
|
|
21
|
-
Classifier: Programming Language :: Python :: 3
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
-
Classifier: Topic :: Communications
|
|
27
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
28
|
-
Classifier: Topic :: Software Development :: Code Generators
|
|
29
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
30
|
-
Classifier: Topic :: Software Development :: Quality Assurance
|
|
31
|
-
Classifier: Topic :: Text Processing :: Linguistic
|
|
32
|
-
Classifier: Typing :: Typed
|
|
33
|
-
Requires-Python: >=3.10
|
|
34
|
-
Requires-Dist: cachetools>=5.0.0
|
|
35
|
-
Requires-Dist: chardet>=5.0.0
|
|
36
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4
|
|
37
|
-
Requires-Dist: tree-sitter-java>=0.23.5
|
|
38
|
-
Requires-Dist: tree-sitter>=0.20.0
|
|
39
|
-
Provides-Extra: all-languages
|
|
40
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'all-languages'
|
|
41
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'all-languages'
|
|
42
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'all-languages'
|
|
43
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'all-languages'
|
|
44
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'all-languages'
|
|
45
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'all-languages'
|
|
46
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'all-languages'
|
|
47
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'all-languages'
|
|
48
|
-
Provides-Extra: c
|
|
49
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'c'
|
|
50
|
-
Provides-Extra: cpp
|
|
51
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'cpp'
|
|
52
|
-
Provides-Extra: dev
|
|
53
|
-
Requires-Dist: black>=24.0.0; extra == 'dev'
|
|
54
|
-
Requires-Dist: flake8>=7.0.0; extra == 'dev'
|
|
55
|
-
Requires-Dist: isort>=5.13.0; extra == 'dev'
|
|
56
|
-
Requires-Dist: memory-profiler>=0.61.0; extra == 'dev'
|
|
57
|
-
Requires-Dist: mypy>=1.17.0; extra == 'dev'
|
|
58
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
59
|
-
Requires-Dist: psutil>=7.0.0; extra == 'dev'
|
|
60
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'dev'
|
|
61
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
62
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'dev'
|
|
63
|
-
Requires-Dist: pytest>=8.4.1; extra == 'dev'
|
|
64
|
-
Requires-Dist: types-psutil>=5.9.0; extra == 'dev'
|
|
65
|
-
Provides-Extra: full
|
|
66
|
-
Requires-Dist: anyio>=4.9.0; extra == 'full'
|
|
67
|
-
Requires-Dist: black>=24.0.0; extra == 'full'
|
|
68
|
-
Requires-Dist: flake8>=7.0.0; extra == 'full'
|
|
69
|
-
Requires-Dist: httpx>=0.28.1; extra == 'full'
|
|
70
|
-
Requires-Dist: isort>=5.13.0; extra == 'full'
|
|
71
|
-
Requires-Dist: mcp>=1.12.2; extra == 'full'
|
|
72
|
-
Requires-Dist: memory-profiler>=0.61.0; extra == 'full'
|
|
73
|
-
Requires-Dist: mypy>=1.17.0; extra == 'full'
|
|
74
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'full'
|
|
75
|
-
Requires-Dist: psutil>=7.0.0; extra == 'full'
|
|
76
|
-
Requires-Dist: pydantic-settings>=2.10.1; extra == 'full'
|
|
77
|
-
Requires-Dist: pydantic>=2.11.7; extra == 'full'
|
|
78
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'full'
|
|
79
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'full'
|
|
80
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'full'
|
|
81
|
-
Requires-Dist: pytest>=8.4.1; extra == 'full'
|
|
82
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'full'
|
|
83
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'full'
|
|
84
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'full'
|
|
85
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'full'
|
|
86
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'full'
|
|
87
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'full'
|
|
88
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'full'
|
|
89
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'full'
|
|
90
|
-
Requires-Dist: types-psutil>=5.9.0; extra == 'full'
|
|
91
|
-
Provides-Extra: go
|
|
92
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'go'
|
|
93
|
-
Provides-Extra: java
|
|
94
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'java'
|
|
95
|
-
Provides-Extra: javascript
|
|
96
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'javascript'
|
|
97
|
-
Provides-Extra: mcp
|
|
98
|
-
Requires-Dist: anyio>=4.9.0; extra == 'mcp'
|
|
99
|
-
Requires-Dist: httpx>=0.28.1; extra == 'mcp'
|
|
100
|
-
Requires-Dist: mcp>=1.12.2; extra == 'mcp'
|
|
101
|
-
Requires-Dist: pydantic-settings>=2.10.1; extra == 'mcp'
|
|
102
|
-
Requires-Dist: pydantic>=2.11.7; extra == 'mcp'
|
|
103
|
-
Provides-Extra: popular
|
|
104
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'popular'
|
|
105
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'popular'
|
|
106
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'popular'
|
|
107
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'popular'
|
|
108
|
-
Provides-Extra: python
|
|
109
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'python'
|
|
110
|
-
Provides-Extra: rust
|
|
111
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'rust'
|
|
112
|
-
Provides-Extra: systems
|
|
113
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'systems'
|
|
114
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'systems'
|
|
115
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'systems'
|
|
116
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'systems'
|
|
117
|
-
Provides-Extra: test
|
|
118
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'test'
|
|
119
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
120
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'test'
|
|
121
|
-
Requires-Dist: pytest>=8.4.1; extra == 'test'
|
|
122
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'test'
|
|
123
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'test'
|
|
124
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'test'
|
|
125
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'test'
|
|
126
|
-
Provides-Extra: typescript
|
|
127
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'typescript'
|
|
128
|
-
Provides-Extra: web
|
|
129
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'web'
|
|
130
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'web'
|
|
131
|
-
Description-Content-Type: text/markdown
|
|
132
|
-
|
|
133
|
-
# Tree-sitter Analyzer
|
|
134
|
-
|
|
135
|
-
[](https://python.org)
|
|
136
|
-
[](LICENSE)
|
|
137
|
-
[](#测试)
|
|
138
|
-
|
|
139
|
-
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.
|
|
140
|
-
|
|
141
|
-
**Available as both CLI tool and MCP server.**
|
|
142
|
-
|
|
143
|
-
## Core Features
|
|
144
|
-
|
|
145
|
-
1. **Code Scale Analysis** - Get overall structure without reading complete files
|
|
146
|
-
2. **Targeted Code Extraction** - Extract specific line ranges efficiently
|
|
147
|
-
3. **Code Position Information** - Get detailed position data for precise extraction
|
|
148
|
-
|
|
149
|
-
## Installation
|
|
150
|
-
|
|
151
|
-
### Prerequisites
|
|
152
|
-
|
|
153
|
-
First, install uv (a fast Python package manager):
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
# On macOS and Linux
|
|
157
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
158
|
-
|
|
159
|
-
# On Windows
|
|
160
|
-
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
161
|
-
|
|
162
|
-
# Or using pip
|
|
163
|
-
pip install uv
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Install from GitHub
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
# Basic installation with Java support
|
|
170
|
-
# Clone and install the project
|
|
171
|
-
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
|
|
172
|
-
cd tree-sitter-analyzer
|
|
173
|
-
|
|
174
|
-
# Install with Java support
|
|
175
|
-
uv sync
|
|
176
|
-
|
|
177
|
-
# With popular languages (Java, Python, JavaScript, TypeScript)
|
|
178
|
-
uv sync --extra popular
|
|
179
|
-
|
|
180
|
-
# With MCP server support
|
|
181
|
-
uv sync --extra mcp
|
|
182
|
-
|
|
183
|
-
# Full installation with all features
|
|
184
|
-
uv sync --extra all --extra mcp
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Usage
|
|
188
|
-
|
|
189
|
-
### CLI Commands
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
# Code scale analysis
|
|
193
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text
|
|
194
|
-
|
|
195
|
-
# Partial code extraction
|
|
196
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
|
|
197
|
-
|
|
198
|
-
# Position information table
|
|
199
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --table=full
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
#### CLI Output Examples
|
|
203
|
-
|
|
204
|
-
**Code Scale Analysis (`--advanced --output-format=text`):**
|
|
205
|
-
|
|
206
|
-
>```
|
|
207
|
-
>PS C:\git-public\tree-sitter-analyzer> uv run python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text
|
|
208
|
-
>2025-07-30 16:57:47,827 - tree_sitter_analyzer - INFO - Successfully loaded 3 language plugins: java, javascript, python
|
|
209
|
-
>2025-07-30 16:57:47,916 - tree_sitter_analyzer - INFO - CacheService initialized: L1=100, L2=1000, L3=10000, TTL=3600s
|
|
210
|
-
>2025-07-30 16:57:47,917 - tree_sitter_analyzer - INFO - Loading plugins...
|
|
211
|
-
>2025-07-30 16:57:47,920 - tree_sitter_analyzer - INFO - Plugin registered for language: java
|
|
212
|
-
>2025-07-30 16:57:47,920 - tree_sitter_analyzer - INFO - Plugin registered for language: javascript
|
|
213
|
-
>2025-07-30 16:57:47,922 - tree_sitter_analyzer - INFO - Plugin registered for language: python
|
|
214
|
-
>2025-07-30 16:57:47,922 - tree_sitter_analyzer - INFO - Successfully loaded 3 language plugins: java, javascript, python
|
|
215
|
-
>2025-07-30 16:57:47,923 - tree_sitter_analyzer - INFO - UnifiedAnalysisEngine initialized
|
|
216
|
-
>INFO: 拡張子から言語を自動判定しました: java
|
|
217
|
-
>2025-07-30 16:57:47,925 - tree_sitter_analyzer - INFO - Starting analysis for examples/Sample.java
|
|
218
|
-
>2025-07-30 16:57:47,945 - tree_sitter_analyzer.core.parser - INFO - Parser initialized successfully
|
|
219
|
-
>2025-07-30 16:57:47,951 - PERF - analyze_java: 0.0253s - Operation completed
|
|
220
|
-
>2025-07-30 16:57:47,951 - tree_sitter_analyzer.performance - INFO - analyze_java: 0.0253s - Operation completed
|
|
221
|
-
>2025-07-30 16:57:47,958 - PERF - unified_analysis: 0.0253s - Analyzed examples/Sample.java (java)
|
|
222
|
-
>2025-07-30 16:57:47,958 - tree_sitter_analyzer.performance - INFO - unified_analysis: 0.0253s - Analyzed examples/Sample.java (java)
|
|
223
|
-
>
|
|
224
|
-
>--- 高度な解析結果 ---
|
|
225
|
-
>"ファイル: examples/Sample.java"
|
|
226
|
-
>"パッケージ: (default)"
|
|
227
|
-
>"行数: 178"
|
|
228
|
-
>"\nクラス数: 8"
|
|
229
|
-
>"メソッド数: 24"
|
|
230
|
-
>"フィールド数: 5"
|
|
231
|
-
>"インポート数: 2"
|
|
232
|
-
>"アノテーション数: 0"
|
|
233
|
-
>```
|
|
234
|
-
|
|
235
|
-
**Partial Code Extraction (`--partial-read`):**
|
|
236
|
-
>```
|
|
237
|
-
>PS C:\git-public\tree-sitter-analyzer> uv run python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
|
|
238
|
-
>2025-07-30 16:58:22,948 - tree_sitter_analyzer - INFO - Successfully loaded 3 language plugins: java, javascript, python
|
|
239
|
-
>2025-07-30 16:58:23,056 - tree_sitter_analyzer - INFO - Successfully read partial file examples/Sample.java: lines 84-86
|
|
240
|
-
>{
|
|
241
|
-
> "file_path": "examples/Sample.java",
|
|
242
|
-
> "range": {
|
|
243
|
-
> "start_line": 84,
|
|
244
|
-
> "end_line": 86,
|
|
245
|
-
> "start_column": null,
|
|
246
|
-
> "end_column": null
|
|
247
|
-
> },
|
|
248
|
-
> "content": " public void innerMethod() {\n System.out.println(\"Inner class method, value: \" + value);\n }\n",
|
|
249
|
-
> "content_length": 117
|
|
250
|
-
>}
|
|
251
|
-
>```
|
|
252
|
-
|
|
253
|
-
**Table Format Analysis (`--table=full`):**
|
|
254
|
-
|
|
255
|
-
The `--table=full` command produces detailed analysis tables:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
># Sample.java
|
|
259
|
-
>
|
|
260
|
-
>## Imports
|
|
261
|
-
>```java
|
|
262
|
-
>java.util.List
|
|
263
|
-
>java.util.ArrayList
|
|
264
|
-
>```
|
|
265
|
-
>
|
|
266
|
-
>## Classes
|
|
267
|
-
>| Class | Type | Visibility | Lines | Methods | Fields |
|
|
268
|
-
>|-------|------|------------|-------|---------|--------|
|
|
269
|
-
>| AbstractParentClass | class | public | 7-15 | 2 | 0 |
|
|
270
|
-
>| ParentClass | class | public | 18-45 | 4 | 2 |
|
|
271
|
-
>| TestInterface | class | public | 48-64 | 3 | 0 |
|
|
272
|
-
>| AnotherInterface | class | public | 67-69 | 1 | 0 |
|
|
273
|
-
>| Test | class | public | 72-159 | 14 | 3 |
|
|
274
|
-
>| InnerClass | class | public | 83-87 | 1 | 0 |
|
|
275
|
-
>| StaticNestedClass | class | public | 90-94 | 1 | 0 |
|
|
276
|
-
>| TestEnum | class | public | 162-178 | 0 | 0 |
|
|
277
|
-
>
|
|
278
|
-
>## Fields
|
|
279
|
-
>| Name | Type | Vis | Modifiers | Line | Doc |
|
|
280
|
-
>|------|------|-----|-----------|------|-----|
|
|
281
|
-
>| CONSTANT | String | ~ | static,final | 20 | - |
|
|
282
|
-
>| parentField | String | # | protected | 23 | - |
|
|
283
|
-
>| value | int | - | private | 74 | - |
|
|
284
|
-
>| staticValue | int | + | public,static | 77 | - |
|
|
285
|
-
>| finalField | String | - | private,final | 80 | - |
|
|
286
|
-
>
|
|
287
|
-
>## Constructor
|
|
288
|
-
>| Method | Signature | Vis | Lines | Cols | Cx | Doc |
|
|
289
|
-
>|--------|-----------|-----|-------|------|----|----|
|
|
290
|
-
>| ParentClass | ():void | + | 26-28 | 5-6 | 1 | - |
|
|
291
|
-
>| Test | (value:int):void | + | 97-100 | 5-6 | 1 | - |
|
|
292
|
-
>| Test | ():void | + | 103-105 | 5-6 | 1 | - |
|
|
293
|
-
>
|
|
294
|
-
>## Public Methods
|
|
295
|
-
>| Method | Signature | Vis | Lines | Cols | Cx | Doc |
|
|
296
|
-
>|--------|-----------|-----|-------|------|----|----|
|
|
297
|
-
>| innerMethod | ():void | + | 84-86 | 5-6 | 1 | - |
|
|
298
|
-
>| nestedMethod | ():void | + | 91-93 | 5-6 | 1 | - |
|
|
299
|
-
>| getValue | ():String | + | 108-110 | 5-6 | 1 | - |
|
|
300
|
-
>| staticMethod | ():void [static] | + | 128-130 | 5-6 | 1 | - |
|
|
301
|
-
>| finalMethod | ():void | + | 133-135 | 5-6 | 1 | - |
|
|
302
|
-
>| doSomething | ():void | + | 138-141 | 5-6 | 1 | - |
|
|
303
|
-
>| anotherMethod | ():void | + | 143-146 | 5-6 | 1 | - |
|
|
304
|
-
>| genericMethod | (input:T):void | + | 149-151 | 5-6 | 1 | - |
|
|
305
|
-
>| createList | (item:T):List<T> | + | 154-158 | 5-6 | 1 | - |
|
|
306
|
-
>
|
|
307
|
-
>## Private Methods
|
|
308
|
-
>| Method | Signature | Vis | Lines | Cols | Cx | Doc |
|
|
309
|
-
>|--------|-----------|-----|-------|------|----|----|
|
|
310
|
-
>| privateMethod | ():void | - | 123-125 | 5-6 | 1 | - |
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
### MCP Server
|
|
314
|
-
|
|
315
|
-
The Tree-sitter Analyzer provides an MCP (Model Context Protocol) server that enables AI assistants to analyze code files directly.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
#### MCP Configuration
|
|
319
|
-
|
|
320
|
-
Add to your Claude Desktop config file:
|
|
321
|
-
|
|
322
|
-
```json
|
|
323
|
-
{
|
|
324
|
-
"mcpServers": {
|
|
325
|
-
"tree-sitter-analyzer": {
|
|
326
|
-
"command": "uv",
|
|
327
|
-
"args": [
|
|
328
|
-
"run",
|
|
329
|
-
"--with",
|
|
330
|
-
"tree-sitter-analyzer[mcp]",
|
|
331
|
-
"python",
|
|
332
|
-
"-m",
|
|
333
|
-
"tree_sitter_analyzer.mcp.server"
|
|
334
|
-
]
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
#### Available MCP Tools
|
|
341
|
-
|
|
342
|
-
1. **analyze_code_scale** - Get code scale and complexity metrics
|
|
343
|
-
2. **format_table** - Generate table-formatted analysis (equivalent to CLI `--table=full`)
|
|
344
|
-
3. **read_code_partial** - Extract specific line ranges from files
|
|
345
|
-
4. **analyze_code_universal** - Universal code analysis with automatic language detection
|
|
346
|
-
|
|
347
|
-
#### MCP Usage Examples
|
|
348
|
-
|
|
349
|
-
**Code Scale Analysis:**
|
|
350
|
-
```json
|
|
351
|
-
{
|
|
352
|
-
"tool": "analyze_code_scale",
|
|
353
|
-
"arguments": {
|
|
354
|
-
"file_path": "examples/Sample.java",
|
|
355
|
-
"include_complexity": true,
|
|
356
|
-
"include_details": true
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
>```json
|
|
362
|
-
>{
|
|
363
|
-
> "file_path": "examples/Sample.java",
|
|
364
|
-
> "language": "java",
|
|
365
|
-
> "analyzer_type": "advanced",
|
|
366
|
-
> "analysis_type": "basic",
|
|
367
|
-
> "metrics": {
|
|
368
|
-
> "lines_total": 178,
|
|
369
|
-
> "lines_code": 0,
|
|
370
|
-
> "lines_comment": 0,
|
|
371
|
-
> "lines_blank": 0,
|
|
372
|
-
> "elements": {
|
|
373
|
-
> "classes": 8,
|
|
374
|
-
> "methods": 24,
|
|
375
|
-
> "fields": 5,
|
|
376
|
-
> "imports": 2,
|
|
377
|
-
> "annotations": 0
|
|
378
|
-
> }
|
|
379
|
-
> }
|
|
380
|
-
>}
|
|
381
|
-
>```
|
|
382
|
-
|
|
383
|
-
**Table Format Analysis:**
|
|
384
|
-
```json
|
|
385
|
-
{
|
|
386
|
-
"tool": "format_table",
|
|
387
|
-
"arguments": {
|
|
388
|
-
"file_path": "examples/Sample.java",
|
|
389
|
-
"format_type": "full"
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
```
|
|
393
|
-
>```json
|
|
394
|
-
>{
|
|
395
|
-
> "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 | - |",
|
|
396
|
-
> "format_type": "full",
|
|
397
|
-
> "file_path": "examples/Sample.java",
|
|
398
|
-
> "language": "java",
|
|
399
|
-
> "metadata": {
|
|
400
|
-
> "classes_count": 8,
|
|
401
|
-
> "methods_count": 24,
|
|
402
|
-
> "fields_count": 5,
|
|
403
|
-
> "total_lines": 178
|
|
404
|
-
> }
|
|
405
|
-
>}
|
|
406
|
-
>```
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
**Partial Code Reading:**
|
|
410
|
-
```json
|
|
411
|
-
{
|
|
412
|
-
"tool": "read_code_partial",
|
|
413
|
-
"arguments": {
|
|
414
|
-
"file_path": "examples/Sample.java",
|
|
415
|
-
"start_line": 84,
|
|
416
|
-
"end_line": 86
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
```
|
|
420
|
-
>```json
|
|
421
|
-
>{
|
|
422
|
-
> "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}"
|
|
423
|
-
>}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
## Development
|
|
427
|
-
|
|
428
|
-
For developers and contributors:
|
|
429
|
-
|
|
430
|
-
```bash
|
|
431
|
-
# Clone the repository
|
|
432
|
-
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
|
|
433
|
-
cd tree-sitter-analyzer
|
|
434
|
-
|
|
435
|
-
# Install development dependencies
|
|
436
|
-
uv sync
|
|
437
|
-
|
|
438
|
-
# Run tests
|
|
439
|
-
pytest tests/ -v
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
## License
|
|
443
|
-
|
|
444
|
-
MIT License
|
|
File without changes
|
{tree_sitter_analyzer-0.1.2.dist-info → tree_sitter_analyzer-0.2.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|