tree-sitter-analyzer 1.6.0__py3-none-any.whl → 1.6.1.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.
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/utils.py +161 -44
- tree_sitter_analyzer-1.6.1.1.dist-info/METADATA +845 -0
- {tree_sitter_analyzer-1.6.0.dist-info → tree_sitter_analyzer-1.6.1.1.dist-info}/RECORD +6 -6
- tree_sitter_analyzer-1.6.0.dist-info/METADATA +0 -1284
- {tree_sitter_analyzer-1.6.0.dist-info → tree_sitter_analyzer-1.6.1.1.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-1.6.0.dist-info → tree_sitter_analyzer-1.6.1.1.dist-info}/entry_points.txt +0 -0
|
@@ -1,1284 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tree-sitter-analyzer
|
|
3
|
-
Version: 1.6.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
|
-
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: mcp>=1.12.3
|
|
37
|
-
Requires-Dist: tree-sitter-cpp<0.25.0,>=0.23.4
|
|
38
|
-
Requires-Dist: tree-sitter-java<0.25.0,>=0.23.5
|
|
39
|
-
Requires-Dist: tree-sitter-javascript<0.25.0,>=0.23.1
|
|
40
|
-
Requires-Dist: tree-sitter-python<0.25.0,>=0.23.6
|
|
41
|
-
Requires-Dist: tree-sitter==0.24.0
|
|
42
|
-
Provides-Extra: all
|
|
43
|
-
Requires-Dist: anyio>=4.0.0; extra == 'all'
|
|
44
|
-
Requires-Dist: black>=24.0.0; extra == 'all'
|
|
45
|
-
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'all'
|
|
46
|
-
Requires-Dist: isort>=5.13.0; extra == 'all'
|
|
47
|
-
Requires-Dist: mcp>=1.12.2; extra == 'all'
|
|
48
|
-
Requires-Dist: memory-profiler>=0.61.0; extra == 'all'
|
|
49
|
-
Requires-Dist: mypy>=1.17.0; extra == 'all'
|
|
50
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'all'
|
|
51
|
-
Requires-Dist: psutil<6,>=5.9.6; extra == 'all'
|
|
52
|
-
Requires-Dist: pydantic-settings>=2.2.1; extra == 'all'
|
|
53
|
-
Requires-Dist: pydantic>=2.5.0; extra == 'all'
|
|
54
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'all'
|
|
55
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'all'
|
|
56
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'all'
|
|
57
|
-
Requires-Dist: pytest>=8.4.1; extra == 'all'
|
|
58
|
-
Requires-Dist: ruff>=0.5.0; extra == 'all'
|
|
59
|
-
Requires-Dist: tree-sitter-c<0.25.0,>=0.20.0; extra == 'all'
|
|
60
|
-
Requires-Dist: tree-sitter-cpp<0.25.0,>=0.23.4; extra == 'all'
|
|
61
|
-
Requires-Dist: tree-sitter-go<0.25.0,>=0.20.0; extra == 'all'
|
|
62
|
-
Requires-Dist: tree-sitter-java<0.25.0,>=0.23.5; extra == 'all'
|
|
63
|
-
Requires-Dist: tree-sitter-javascript<0.25.0,>=0.23.1; extra == 'all'
|
|
64
|
-
Requires-Dist: tree-sitter-python<0.25.0,>=0.23.0; extra == 'all'
|
|
65
|
-
Requires-Dist: tree-sitter-rust<0.25.0,>=0.20.0; extra == 'all'
|
|
66
|
-
Requires-Dist: tree-sitter-typescript<0.25.0,>=0.20.0; extra == 'all'
|
|
67
|
-
Requires-Dist: types-psutil>=5.9.0; extra == 'all'
|
|
68
|
-
Provides-Extra: all-languages
|
|
69
|
-
Requires-Dist: tree-sitter-c<0.25.0,>=0.20.0; extra == 'all-languages'
|
|
70
|
-
Requires-Dist: tree-sitter-cpp<0.25.0,>=0.23.4; extra == 'all-languages'
|
|
71
|
-
Requires-Dist: tree-sitter-go<0.25.0,>=0.20.0; extra == 'all-languages'
|
|
72
|
-
Requires-Dist: tree-sitter-java<0.25.0,>=0.23.5; extra == 'all-languages'
|
|
73
|
-
Requires-Dist: tree-sitter-javascript<0.25.0,>=0.23.1; extra == 'all-languages'
|
|
74
|
-
Requires-Dist: tree-sitter-python<0.25.0,>=0.23.0; extra == 'all-languages'
|
|
75
|
-
Requires-Dist: tree-sitter-rust<0.25.0,>=0.20.0; extra == 'all-languages'
|
|
76
|
-
Requires-Dist: tree-sitter-typescript<0.25.0,>=0.20.0; extra == 'all-languages'
|
|
77
|
-
Provides-Extra: c
|
|
78
|
-
Requires-Dist: tree-sitter-c<0.25.0,>=0.20.0; extra == 'c'
|
|
79
|
-
Provides-Extra: cpp
|
|
80
|
-
Requires-Dist: tree-sitter-cpp<0.25.0,>=0.23.4; extra == 'cpp'
|
|
81
|
-
Provides-Extra: dev
|
|
82
|
-
Requires-Dist: black>=24.0.0; extra == 'dev'
|
|
83
|
-
Requires-Dist: isort>=5.13.0; extra == 'dev'
|
|
84
|
-
Requires-Dist: memory-profiler>=0.61.0; extra == 'dev'
|
|
85
|
-
Requires-Dist: mypy>=1.17.0; extra == 'dev'
|
|
86
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
87
|
-
Requires-Dist: psutil<6,>=5.9.6; extra == 'dev'
|
|
88
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'dev'
|
|
89
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
90
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'dev'
|
|
91
|
-
Requires-Dist: pytest>=8.4.1; extra == 'dev'
|
|
92
|
-
Requires-Dist: ruff>=0.5.0; extra == 'dev'
|
|
93
|
-
Requires-Dist: types-psutil>=5.9.0; extra == 'dev'
|
|
94
|
-
Provides-Extra: full
|
|
95
|
-
Requires-Dist: anyio>=4.0.0; extra == 'full'
|
|
96
|
-
Requires-Dist: black>=24.0.0; extra == 'full'
|
|
97
|
-
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'full'
|
|
98
|
-
Requires-Dist: isort>=5.13.0; extra == 'full'
|
|
99
|
-
Requires-Dist: mcp>=1.12.2; extra == 'full'
|
|
100
|
-
Requires-Dist: memory-profiler>=0.61.0; extra == 'full'
|
|
101
|
-
Requires-Dist: mypy>=1.17.0; extra == 'full'
|
|
102
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'full'
|
|
103
|
-
Requires-Dist: psutil<6,>=5.9.6; extra == 'full'
|
|
104
|
-
Requires-Dist: pydantic-settings>=2.2.1; extra == 'full'
|
|
105
|
-
Requires-Dist: pydantic>=2.5.0; extra == 'full'
|
|
106
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'full'
|
|
107
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'full'
|
|
108
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'full'
|
|
109
|
-
Requires-Dist: pytest>=8.4.1; extra == 'full'
|
|
110
|
-
Requires-Dist: ruff>=0.5.0; extra == 'full'
|
|
111
|
-
Requires-Dist: tree-sitter-c<0.25.0,>=0.20.0; extra == 'full'
|
|
112
|
-
Requires-Dist: tree-sitter-cpp<0.25.0,>=0.23.4; extra == 'full'
|
|
113
|
-
Requires-Dist: tree-sitter-go<0.25.0,>=0.20.0; extra == 'full'
|
|
114
|
-
Requires-Dist: tree-sitter-java<0.25.0,>=0.23.5; extra == 'full'
|
|
115
|
-
Requires-Dist: tree-sitter-javascript<0.25.0,>=0.23.1; extra == 'full'
|
|
116
|
-
Requires-Dist: tree-sitter-python<0.25.0,>=0.23.0; extra == 'full'
|
|
117
|
-
Requires-Dist: tree-sitter-rust<0.25.0,>=0.20.0; extra == 'full'
|
|
118
|
-
Requires-Dist: tree-sitter-typescript<0.25.0,>=0.20.0; extra == 'full'
|
|
119
|
-
Requires-Dist: types-psutil>=5.9.0; extra == 'full'
|
|
120
|
-
Provides-Extra: go
|
|
121
|
-
Requires-Dist: tree-sitter-go<0.25.0,>=0.20.0; extra == 'go'
|
|
122
|
-
Provides-Extra: java
|
|
123
|
-
Requires-Dist: tree-sitter-java<0.25.0,>=0.23.5; extra == 'java'
|
|
124
|
-
Provides-Extra: javascript
|
|
125
|
-
Requires-Dist: tree-sitter-javascript<0.25.0,>=0.23.1; extra == 'javascript'
|
|
126
|
-
Provides-Extra: mcp
|
|
127
|
-
Requires-Dist: anyio>=4.0.0; extra == 'mcp'
|
|
128
|
-
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'mcp'
|
|
129
|
-
Requires-Dist: mcp>=1.12.2; extra == 'mcp'
|
|
130
|
-
Requires-Dist: pydantic-settings>=2.2.1; extra == 'mcp'
|
|
131
|
-
Requires-Dist: pydantic>=2.5.0; extra == 'mcp'
|
|
132
|
-
Provides-Extra: popular
|
|
133
|
-
Requires-Dist: tree-sitter-java<0.25.0,>=0.23.5; extra == 'popular'
|
|
134
|
-
Requires-Dist: tree-sitter-javascript<0.25.0,>=0.23.1; extra == 'popular'
|
|
135
|
-
Requires-Dist: tree-sitter-python<0.25.0,>=0.23.0; extra == 'popular'
|
|
136
|
-
Requires-Dist: tree-sitter-typescript<0.25.0,>=0.20.0; extra == 'popular'
|
|
137
|
-
Provides-Extra: python
|
|
138
|
-
Requires-Dist: tree-sitter-python<0.25.0,>=0.23.0; extra == 'python'
|
|
139
|
-
Provides-Extra: rust
|
|
140
|
-
Requires-Dist: tree-sitter-rust<0.25.0,>=0.20.0; extra == 'rust'
|
|
141
|
-
Provides-Extra: systems
|
|
142
|
-
Requires-Dist: tree-sitter-c<0.25.0,>=0.20.0; extra == 'systems'
|
|
143
|
-
Requires-Dist: tree-sitter-cpp<0.25.0,>=0.23.4; extra == 'systems'
|
|
144
|
-
Requires-Dist: tree-sitter-go<0.25.0,>=0.20.0; extra == 'systems'
|
|
145
|
-
Requires-Dist: tree-sitter-rust<0.25.0,>=0.20.0; extra == 'systems'
|
|
146
|
-
Provides-Extra: test
|
|
147
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'test'
|
|
148
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
149
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'test'
|
|
150
|
-
Requires-Dist: pytest>=8.4.1; extra == 'test'
|
|
151
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'test'
|
|
152
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'test'
|
|
153
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'test'
|
|
154
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'test'
|
|
155
|
-
Provides-Extra: typescript
|
|
156
|
-
Requires-Dist: tree-sitter-typescript<0.25.0,>=0.20.0; extra == 'typescript'
|
|
157
|
-
Provides-Extra: web
|
|
158
|
-
Requires-Dist: tree-sitter-javascript<0.25.0,>=0.23.1; extra == 'web'
|
|
159
|
-
Requires-Dist: tree-sitter-typescript<0.25.0,>=0.20.0; extra == 'web'
|
|
160
|
-
Description-Content-Type: text/markdown
|
|
161
|
-
|
|
162
|
-
# Tree-sitter Analyzer
|
|
163
|
-
|
|
164
|
-
[](https://python.org)
|
|
165
|
-
[](LICENSE)
|
|
166
|
-
[](#quality-assurance)
|
|
167
|
-
[](#quality-assurance)
|
|
168
|
-
[](#quality-assurance)
|
|
169
|
-
[](https://pypi.org/project/tree-sitter-analyzer/)
|
|
170
|
-
[](https://github.com/aimasteracc/tree-sitter-analyzer/releases)
|
|
171
|
-
[](https://github.com/aimasteracc/tree-sitter-analyzer)
|
|
172
|
-
|
|
173
|
-
## 🚀 Break LLM Token Limits, Let AI Understand Code Files of Any Size
|
|
174
|
-
|
|
175
|
-
> **Revolutionary Code Analysis Tool Designed for the AI Era**
|
|
176
|
-
|
|
177
|
-
## 📋 Table of Contents
|
|
178
|
-
|
|
179
|
-
- [🚀 Break LLM Token Limits](#-break-llm-token-limits-let-ai-understand-code-files-of-any-size)
|
|
180
|
-
- [📋 Table of Contents](#-table-of-contents)
|
|
181
|
-
- [💡 Unique Features](#-unique-features)
|
|
182
|
-
- [📊 Real-time Demo and Results](#-real-time-demo-and-results)
|
|
183
|
-
- [🚀 30-Second Quick Start](#-30-second-quick-start)
|
|
184
|
-
- [🤖 AI Users (Claude Desktop, Cursor, etc.)](#-ai-users-claude-desktop-cursor-etc)
|
|
185
|
-
- [💻 Developers (CLI)](#-developers-cli)
|
|
186
|
-
- [❓ Why Choose Tree-sitter Analyzer](#-why-choose-tree-sitter-analyzer)
|
|
187
|
-
- [📖 Practical Usage Examples](#-practical-usage-examples)
|
|
188
|
-
- [🛠️ Core Features](#️-core-features)
|
|
189
|
-
- [📦 Installation Guide](#-installation-guide)
|
|
190
|
-
- [🔒 Security and Configuration](#-security-and-configuration)
|
|
191
|
-
- [🏆 Quality Assurance](#-quality-assurance)
|
|
192
|
-
- [🤖 AI Collaboration Support](#-ai-collaboration-support)
|
|
193
|
-
- [📚 Documentation](#-documentation)
|
|
194
|
-
- [🤝 Contributing](#-contributing)
|
|
195
|
-
- [📄 License](#-license)
|
|
196
|
-
|
|
197
|
-
## 💡 Unique Features
|
|
198
|
-
|
|
199
|
-
Imagine this: you have a Java service class with over 1400 lines, and Claude or ChatGPT can't analyze it due to token limits. Now, Tree-sitter Analyzer enables AI assistants to:
|
|
200
|
-
|
|
201
|
-
- ⚡ **Get complete code structure overview in 3 seconds**
|
|
202
|
-
- 🎯 **Accurate extraction** of code snippets from any line range
|
|
203
|
-
- 📍 **Smart positioning** of exact locations for classes, methods, and fields
|
|
204
|
-
- 🔗 **Seamless integration** with Claude Desktop, Cursor, Roo Code, and other AI IDEs
|
|
205
|
-
- 🏗️ **Unified element management** - All code elements (classes, methods, fields, imports) in a unified system
|
|
206
|
-
|
|
207
|
-
**No more AI being helpless with large files!**
|
|
208
|
-
|
|
209
|
-
## 📊 Real-time Demo and Results
|
|
210
|
-
|
|
211
|
-
### ⚡ **Lightning-fast Analysis Speed**
|
|
212
|
-
```bash
|
|
213
|
-
# Analysis result of 1419-line large Java service class (< 1 second)
|
|
214
|
-
Lines: 1419 | Classes: 1 | Methods: 66 | Fields: 9 | Imports: 8 | Packages: 1
|
|
215
|
-
Total Elements: 85 | Complexity: 348 (avg: 5.27, max: 15)
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### 📊 **Precise Structure Table**
|
|
219
|
-
| Class Name | Type | Visibility | Line Range | Method Count | Field Count |
|
|
220
|
-
|------------|------|------------|------------|--------------|-------------|
|
|
221
|
-
| BigService | class | public | 17-1419 | 66 | 9 |
|
|
222
|
-
|
|
223
|
-
### 🔄 **AI Assistant SMART Workflow**
|
|
224
|
-
- **S**: `set_project_path` - Setup project root directory
|
|
225
|
-
- **M**: `list_files`, `search_content`, `find_and_grep` - Map target files with precision
|
|
226
|
-
- **A**: `analyze_code_structure` - Analyze core structure with unified elements (supports file output)
|
|
227
|
-
- **R**: `extract_code_section` - Retrieve essential code snippets on demand
|
|
228
|
-
- **T**: Advanced dependency tracing (when needed)
|
|
229
|
-
|
|
230
|
-
---
|
|
231
|
-
|
|
232
|
-
## 🆕 New CLI Commands (v1.3.8+)
|
|
233
|
-
|
|
234
|
-
### 🔧 **Standalone CLI Tools for File System Operations**
|
|
235
|
-
|
|
236
|
-
Tree-sitter Analyzer now provides dedicated CLI commands that wrap powerful MCP tools for file system operations:
|
|
237
|
-
|
|
238
|
-
> **💡 Usage Note**: In development environments, use `uv run` prefix to execute CLI commands:
|
|
239
|
-
> - `uv run list-files` instead of `list-files`
|
|
240
|
-
> - `uv run search-content` instead of `search-content`
|
|
241
|
-
> - `uv run find-and-grep` instead of `find-and-grep`
|
|
242
|
-
>
|
|
243
|
-
> After installing from PyPI, these commands will be available directly in your PATH.
|
|
244
|
-
|
|
245
|
-
#### 📁 **`list-files`** - File Discovery with fd
|
|
246
|
-
```bash
|
|
247
|
-
# List all Java files in current directory
|
|
248
|
-
uv run list-files . --extensions java
|
|
249
|
-
|
|
250
|
-
# Find test files with specific naming patterns
|
|
251
|
-
uv run list-files src --pattern "test_*" --extensions java --types f
|
|
252
|
-
|
|
253
|
-
# Find large files modified in the last week
|
|
254
|
-
uv run list-files . --types f --size "+1k" --changed-within "1week"
|
|
255
|
-
|
|
256
|
-
# Find service classes with specific naming patterns
|
|
257
|
-
uv run list-files src --pattern "*Service*" --extensions java --output-format json
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
#### 🔍 **`search-content`** - Content Search with ripgrep
|
|
261
|
-
```bash
|
|
262
|
-
# Search for class definitions in Java files
|
|
263
|
-
uv run search-content --roots . --query "class.*extends" --include-globs "*.java"
|
|
264
|
-
|
|
265
|
-
# Find TODO comments with context
|
|
266
|
-
uv run search-content --roots src --query "TODO|FIXME" --context-before 2 --context-after 2
|
|
267
|
-
|
|
268
|
-
# Search in specific files with case-insensitive matching
|
|
269
|
-
uv run search-content --files file1.java file2.java --query "public.*method" --case insensitive
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
#### 🎯 **`find-and-grep`** - Two-Stage Search (fd → ripgrep)
|
|
273
|
-
```bash
|
|
274
|
-
# Find Java files first, then search for Spring annotations
|
|
275
|
-
uv run find-and-grep --roots . --query "@SpringBootApplication" --extensions java
|
|
276
|
-
|
|
277
|
-
# Combined file filtering and content search with limits
|
|
278
|
-
uv run find-and-grep --roots src --query "import.*spring" --extensions java --file-limit 10 --max-count 5
|
|
279
|
-
|
|
280
|
-
# Advanced search with multiple filters
|
|
281
|
-
uv run find-and-grep --roots . --query "public.*static.*void" --extensions java --types f --size "+500" --output-format json
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### 🛡️ **Security & Safety Features**
|
|
285
|
-
- **Project Boundary Detection**: All commands automatically detect and respect project boundaries
|
|
286
|
-
- **Input Validation**: Comprehensive parameter validation and sanitization
|
|
287
|
-
- **Error Handling**: Graceful error handling with informative messages
|
|
288
|
-
- **Resource Limits**: Built-in limits to prevent resource exhaustion
|
|
289
|
-
|
|
290
|
-
### 📊 **Output Formats**
|
|
291
|
-
- **JSON**: Structured output for programmatic processing
|
|
292
|
-
- **Text**: Human-readable output for terminal use
|
|
293
|
-
- **Quiet Mode**: Suppress non-essential output for scripting
|
|
294
|
-
|
|
295
|
-
---
|
|
296
|
-
|
|
297
|
-
## 🚀 30-Second Quick Start
|
|
298
|
-
|
|
299
|
-
### 🤖 AI Users (Claude Desktop, Cursor, etc.)
|
|
300
|
-
|
|
301
|
-
**📋 0. Prerequisites (for Advanced MCP Tools)**
|
|
302
|
-
For advanced file search and content analysis features, install these tools first:
|
|
303
|
-
```bash
|
|
304
|
-
# Install fd and ripgrep (see Prerequisites section for detailed instructions)
|
|
305
|
-
# macOS
|
|
306
|
-
brew install fd ripgrep
|
|
307
|
-
|
|
308
|
-
# Windows (using winget - recommended)
|
|
309
|
-
winget install sharkdp.fd BurntSushi.ripgrep.MSVC
|
|
310
|
-
|
|
311
|
-
# Windows (alternative methods)
|
|
312
|
-
# choco install fd ripgrep
|
|
313
|
-
# scoop install fd ripgrep
|
|
314
|
-
|
|
315
|
-
# Ubuntu/Debian
|
|
316
|
-
sudo apt install fd-find ripgrep
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**📦 1. One-click Installation**
|
|
320
|
-
```bash
|
|
321
|
-
# macOS/Linux
|
|
322
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
323
|
-
|
|
324
|
-
# Windows PowerShell
|
|
325
|
-
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
**⚙️ 2. AI Client Configuration**
|
|
329
|
-
|
|
330
|
-
**Claude Desktop Configuration:**
|
|
331
|
-
|
|
332
|
-
Add the following to your configuration file:
|
|
333
|
-
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
334
|
-
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
335
|
-
- **Linux**: `~/.config/claude/claude_desktop_config.json`
|
|
336
|
-
|
|
337
|
-
**Basic Configuration (Recommended):**
|
|
338
|
-
```json
|
|
339
|
-
{
|
|
340
|
-
"mcpServers": {
|
|
341
|
-
"tree-sitter-analyzer": {
|
|
342
|
-
"command": "uv",
|
|
343
|
-
"args": [
|
|
344
|
-
"run", "--with", "tree-sitter-analyzer[mcp]",
|
|
345
|
-
"python", "-m", "tree_sitter_analyzer.mcp.server"
|
|
346
|
-
]
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
**Advanced Configuration (Specify Project Root Directory):**
|
|
353
|
-
```json
|
|
354
|
-
{
|
|
355
|
-
"mcpServers": {
|
|
356
|
-
"tree-sitter-analyzer": {
|
|
357
|
-
"command": "uv",
|
|
358
|
-
"args": [
|
|
359
|
-
"run", "--with", "tree-sitter-analyzer[mcp]",
|
|
360
|
-
"python", "-m", "tree_sitter_analyzer.mcp.server"
|
|
361
|
-
],
|
|
362
|
-
"env": {
|
|
363
|
-
"TREE_SITTER_PROJECT_ROOT": "/absolute/path/to/your/project",
|
|
364
|
-
"TREE_SITTER_OUTPUT_PATH": "/absolute/path/to/output/directory"
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
**Other AI Clients:**
|
|
372
|
-
- **Cursor**: Built-in MCP support, refer to Cursor documentation for configuration
|
|
373
|
-
- **Roo Code**: Supports MCP protocol, check corresponding configuration guides
|
|
374
|
-
- **Other MCP-compatible clients**: Use the same server configuration
|
|
375
|
-
|
|
376
|
-
**⚠️ Configuration Notes:**
|
|
377
|
-
- **Basic Configuration**: Tool automatically detects project root directory (recommended)
|
|
378
|
-
- **Advanced Configuration**: If you need to specify a particular directory, replace `/absolute/path/to/your/project` with an absolute path
|
|
379
|
-
- **Avoid Using**: Variables like `${workspaceFolder}` may not be supported in some clients
|
|
380
|
-
|
|
381
|
-
**🎉 3. Restart AI client and start analyzing large code files!**
|
|
382
|
-
|
|
383
|
-
### 💻 Developers (CLI)
|
|
384
|
-
|
|
385
|
-
```bash
|
|
386
|
-
# Installation
|
|
387
|
-
uv add "tree-sitter-analyzer[popular]"
|
|
388
|
-
|
|
389
|
-
# Check file size (1419-line large service class, completed instantly)
|
|
390
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --advanced --output-format=text
|
|
391
|
-
|
|
392
|
-
# Generate structure table (1 class, 66 methods, clearly displayed)
|
|
393
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --table=full
|
|
394
|
-
|
|
395
|
-
# Precise code extraction
|
|
396
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --partial-read --start-line 100 --end-line 105
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
---
|
|
400
|
-
|
|
401
|
-
## ❓ Why Choose Tree-sitter Analyzer
|
|
402
|
-
|
|
403
|
-
### 🎯 Solve Real Pain Points
|
|
404
|
-
|
|
405
|
-
**Traditional Method Difficulties:**
|
|
406
|
-
- ❌ Large files exceed LLM token limits
|
|
407
|
-
- ❌ AI cannot understand code structure
|
|
408
|
-
- ❌ Need to manually split files
|
|
409
|
-
- ❌ Context loss leads to inaccurate analysis
|
|
410
|
-
|
|
411
|
-
**Tree-sitter Analyzer Breakthrough:**
|
|
412
|
-
- ✅ **Smart Analysis**: Understand structure without reading complete files
|
|
413
|
-
- ✅ **Precise Positioning**: Accurate line-by-line code extraction
|
|
414
|
-
- ✅ **AI Native**: Optimized for LLM workflows
|
|
415
|
-
- ✅ **Multi-language Support**: Java, Python, JavaScript/TypeScript, etc.
|
|
416
|
-
|
|
417
|
-
## 📖 Practical Usage Examples
|
|
418
|
-
|
|
419
|
-
### 💬 AI IDE Prompts (SMART Analysis Workflow)
|
|
420
|
-
|
|
421
|
-
> **✅ Test Verification Status:** All prompts below have been tested and verified in real environments, ensuring 100% availability
|
|
422
|
-
>
|
|
423
|
-
> **🎯 SMART Analysis Workflow:**
|
|
424
|
-
> - **S** - Setup project (set_project_path)
|
|
425
|
-
> - **M** - Map target files (precision pattern matching)
|
|
426
|
-
> - **A** - Analyze core structure (analyze_code_structure with optional file output)
|
|
427
|
-
> - **R** - Retrieve essential code (extract_code_section)
|
|
428
|
-
> - **T** - Trace dependencies (when needed)
|
|
429
|
-
>
|
|
430
|
-
> **⚠️ Important Notes:**
|
|
431
|
-
> - Follow SMART workflow sequence for optimal results
|
|
432
|
-
> - For files within the project, use **relative paths** (e.g., `examples/BigService.java`)
|
|
433
|
-
> - For files outside the project, use **absolute paths** (e.g., `C:\git-public\tree-sitter-analyzer\examples\BigService.java`)
|
|
434
|
-
> - All tools support both Windows and Unix style paths
|
|
435
|
-
> - Project path should point to your code repository root directory
|
|
436
|
-
|
|
437
|
-
#### 🔧 **S - Setup Project (Required First Step)**
|
|
438
|
-
|
|
439
|
-
**Option 1: Configure in MCP Settings**
|
|
440
|
-
```json
|
|
441
|
-
{
|
|
442
|
-
"mcpServers": {
|
|
443
|
-
"tree-sitter-analyzer": {
|
|
444
|
-
"command": "uv",
|
|
445
|
-
"args": ["run", "python", "-m", "tree_sitter_analyzer.mcp.server"],
|
|
446
|
-
"env": {
|
|
447
|
-
"TREE_SITTER_PROJECT_ROOT": "/path/to/your/project",
|
|
448
|
-
"TREE_SITTER_OUTPUT_PATH": "/path/to/output/directory"
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
**Option 2: Tell AI Directly (Recommended, More Natural)**
|
|
456
|
-
|
|
457
|
-
**Method 1: Explicit Setup Request**
|
|
458
|
-
```
|
|
459
|
-
Please help me set the project root directory, the path is: C:\git-public\tree-sitter-analyzer
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
**Method 2: Provide Project Information**
|
|
463
|
-
```
|
|
464
|
-
My project is at: C:\git-public\tree-sitter-analyzer
|
|
465
|
-
Please set this path as the project root
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
**Method 3: Simple Statement**
|
|
469
|
-
```
|
|
470
|
-
Project path: C:\git-public\tree-sitter-analyzer
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
**AI will automatically call the appropriate tool to set the path, no need to remember complex command formats**
|
|
474
|
-
|
|
475
|
-
**⚠️ Important Notes:**
|
|
476
|
-
- After setting project path, you can use relative paths to reference files within the project
|
|
477
|
-
- Example: `examples/BigService.java` instead of full paths
|
|
478
|
-
- Once project path is successfully set, all subsequent analysis commands will automatically use this root directory
|
|
479
|
-
|
|
480
|
-
#### 🗺️ **M - Map Target Files (Precision Pattern Matching)**
|
|
481
|
-
|
|
482
|
-
> **📋 Prerequisites:** This step requires `fd` and `ripgrep` tools to be installed. See [Prerequisites](#prerequisites) section for installation instructions.
|
|
483
|
-
|
|
484
|
-
**Smart File Discovery:**
|
|
485
|
-
```
|
|
486
|
-
Find all Python files in the project
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
```
|
|
490
|
-
List all Java files larger than 10KB
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
```
|
|
494
|
-
Find configuration files (*.json, *.yaml, *.toml) in the project
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
**Intelligent Content Search:**
|
|
498
|
-
```
|
|
499
|
-
Search for "def authenticate" in all Python files with context
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
```
|
|
503
|
-
Find all TODO comments in source files
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
```
|
|
507
|
-
Search for "class.*Service" patterns in all files, case insensitive
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
**Combined Discovery & Search:**
|
|
511
|
-
```
|
|
512
|
-
Find all Python files and search for "async def" functions
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
```
|
|
516
|
-
Search for "class.*Service" in all source files
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
**Return Format:**
|
|
520
|
-
```json
|
|
521
|
-
{
|
|
522
|
-
"success": true,
|
|
523
|
-
"results": [
|
|
524
|
-
{
|
|
525
|
-
"file": "tree_sitter_analyzer/core/query_service.py",
|
|
526
|
-
"line": 20,
|
|
527
|
-
"text": "class QueryService:",
|
|
528
|
-
"matches": [[0, 18]]
|
|
529
|
-
}
|
|
530
|
-
],
|
|
531
|
-
"count": 25,
|
|
532
|
-
"meta": {
|
|
533
|
-
"searched_file_count": 256,
|
|
534
|
-
"truncated": false,
|
|
535
|
-
"fd_elapsed_ms": 225,
|
|
536
|
-
"rg_elapsed_ms": 2969
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
#### 🔍 **A - Analyze Core Structure**
|
|
542
|
-
|
|
543
|
-
**Method 1: Explicit Analysis Request**
|
|
544
|
-
```
|
|
545
|
-
Please help me analyze this file: examples/BigService.java
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
**Method 2: Describe Analysis Needs**
|
|
549
|
-
```
|
|
550
|
-
I want to understand the size and structure of this Java file: examples/BigService.java
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
**Method 3: Simple Request**
|
|
554
|
-
```
|
|
555
|
-
Analyze this file: examples/BigService.java
|
|
556
|
-
```
|
|
557
|
-
|
|
558
|
-
**Alternative using absolute path:**
|
|
559
|
-
```
|
|
560
|
-
Please analyze this file: C:\git-public\tree-sitter-analyzer\examples\BigService.java
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
**💡 Tip: After setting project path, using relative paths is recommended, more concise and convenient**
|
|
564
|
-
|
|
565
|
-
**Return Format:**
|
|
566
|
-
```json
|
|
567
|
-
{
|
|
568
|
-
"file_path": "examples/BigService.java",
|
|
569
|
-
"language": "java",
|
|
570
|
-
"metrics": {
|
|
571
|
-
"lines_total": 1419,
|
|
572
|
-
"lines_code": 907,
|
|
573
|
-
"lines_comment": 246,
|
|
574
|
-
"lines_blank": 267,
|
|
575
|
-
"elements": {
|
|
576
|
-
"classes": 1,
|
|
577
|
-
"methods": 66,
|
|
578
|
-
"fields": 9,
|
|
579
|
-
"imports": 8,
|
|
580
|
-
"packages": 1,
|
|
581
|
-
"total": 85
|
|
582
|
-
},
|
|
583
|
-
"complexity": {
|
|
584
|
-
"total": 348,
|
|
585
|
-
"average": 5.27,
|
|
586
|
-
"max": 15
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
#### 📊 **R - Retrieve Essential Code**
|
|
593
|
-
|
|
594
|
-
**Method 1: Explicit Table Request**
|
|
595
|
-
```
|
|
596
|
-
Please generate a detailed structure table for this file: examples/BigService.java
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
**Method 2: Describe Table Needs**
|
|
600
|
-
```
|
|
601
|
-
I want to see the complete structure of this Java file, including all classes, methods, and fields: examples/BigService.java
|
|
602
|
-
```
|
|
603
|
-
|
|
604
|
-
**Method 3: Simple Request**
|
|
605
|
-
```
|
|
606
|
-
Generate structure table: examples/BigService.java
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
**Alternative using absolute path:**
|
|
610
|
-
```
|
|
611
|
-
Please generate a detailed structure table: C:\git-public\tree-sitter-analyzer\examples\BigService.java
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
**💡 Tip: After setting project path, using relative paths is recommended, more concise and convenient**
|
|
615
|
-
|
|
616
|
-
**Return Format:**
|
|
617
|
-
- Complete Markdown table
|
|
618
|
-
- Including class information, method list (with line numbers), field list
|
|
619
|
-
- Method signatures, visibility, line ranges, complexity, and other detailed information
|
|
620
|
-
|
|
621
|
-
#### ✂️ **Precise Code Extraction**
|
|
622
|
-
|
|
623
|
-
**Method 1: Explicit Extraction Request**
|
|
624
|
-
```
|
|
625
|
-
Please extract lines 93-105 of this file: examples/BigService.java
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
**Method 2: Describe Extraction Needs**
|
|
629
|
-
```
|
|
630
|
-
I want to see the code content from lines 93 to 105 of this Java file: examples/BigService.java
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
**Method 3: Simple Request**
|
|
634
|
-
```
|
|
635
|
-
Extract lines 93-105: examples/BigService.java
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
**Alternative using absolute path:**
|
|
639
|
-
```
|
|
640
|
-
Please extract code snippet: C:\git-public\tree-sitter-analyzer\examples\BigService.java, lines 93-105
|
|
641
|
-
```
|
|
642
|
-
|
|
643
|
-
**💡 Tip: After setting project path, using relative paths is recommended, more concise and convenient**
|
|
644
|
-
|
|
645
|
-
**Return Format:**
|
|
646
|
-
```json
|
|
647
|
-
{
|
|
648
|
-
"file_path": "examples/BigService.java",
|
|
649
|
-
"range": {
|
|
650
|
-
"start_line": 93,
|
|
651
|
-
"end_line": 105,
|
|
652
|
-
"start_column": null,
|
|
653
|
-
"end_column": null
|
|
654
|
-
},
|
|
655
|
-
"content": " private void checkMemoryUsage() {\n Runtime runtime = Runtime.getRuntime();\n long totalMemory = runtime.totalMemory();\n long freeMemory = runtime.freeMemory();\n long usedMemory = totalMemory - freeMemory;\n\n System.out.println(\"Total Memory: \" + totalMemory);\n System.out.println(\"Free Memory: \" + freeMemory);\n System.out.println(\"Used Memory: \" + usedMemory);\n\n if (usedMemory > totalMemory * 0.8) {\n System.out.println(\"WARNING: High memory usage detected!\");\n }\n",
|
|
656
|
-
"content_length": 542
|
|
657
|
-
}
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
#### 🔗 **T - Trace Dependencies (Advanced Analysis)**
|
|
661
|
-
|
|
662
|
-
**Error Handling Enhancement (v0.9.7):**
|
|
663
|
-
- Improved `@handle_mcp_errors` decorator with tool name recognition
|
|
664
|
-
- Better error context for easier debugging and troubleshooting
|
|
665
|
-
- Enhanced file path security validation
|
|
666
|
-
|
|
667
|
-
**Find Specific Methods:**
|
|
668
|
-
```
|
|
669
|
-
Please help me find the main method in this file: examples/BigService.java
|
|
670
|
-
```
|
|
671
|
-
|
|
672
|
-
**Find Authentication-related Methods:**
|
|
673
|
-
```
|
|
674
|
-
I want to find all authentication-related methods: examples/BigService.java
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
**Find Public Methods with No Parameters:**
|
|
678
|
-
```
|
|
679
|
-
Please help me find all public getter methods with no parameters: examples/BigService.java
|
|
680
|
-
```
|
|
681
|
-
|
|
682
|
-
**Return Format:**
|
|
683
|
-
```json
|
|
684
|
-
{
|
|
685
|
-
"success": true,
|
|
686
|
-
"results": [
|
|
687
|
-
{
|
|
688
|
-
"capture_name": "method",
|
|
689
|
-
"node_type": "method_declaration",
|
|
690
|
-
"start_line": 1385,
|
|
691
|
-
"end_line": 1418,
|
|
692
|
-
"content": "public static void main(String[] args) {\n System.out.println(\"BigService Demo Application\");\n System.out.println(\"==========================\");\n\n BigService service = new BigService();\n\n // Test basic functions\n System.out.println(\"\\n--- Testing Basic Functions ---\");\n service.authenticateUser(\"testuser\", \"password123\");\n service.createSession(\"testuser\");\n\n // Test customer management\n System.out.println(\"\\n--- Testing Customer Management ---\");\n service.updateCustomerName(\"CUST001\", \"New Customer Name\");\n Map<String, Object> customerInfo = service.getCustomerInfo(\"CUST001\");\n\n // Test report generation\n System.out.println(\"\\n--- Testing Report Generation ---\");\n Map<String, Object> reportParams = new HashMap<>();\n reportParams.put(\"start_date\", \"2024-01-01\");\n reportParams.put(\"end_date\", \"2024-12-31\");\n service.generateReport(\"sales\", reportParams);\n\n // Test performance monitoring\n System.out.println(\"\\n--- Testing Performance Monitoring ---\");\n service.monitorPerformance();\n\n // Test security check\n System.out.println(\"\\n--- Testing Security Check ---\");\n service.performSecurityCheck();\n\n System.out.println(\"\\n--- Demo Completed ---\");\n System.out.println(\"BigService demo application finished successfully.\");\n }"
|
|
693
|
-
}
|
|
694
|
-
],
|
|
695
|
-
"count": 1,
|
|
696
|
-
"file_path": "examples/BigService.java",
|
|
697
|
-
"language": "java",
|
|
698
|
-
"query": "methods"
|
|
699
|
-
}
|
|
700
|
-
```
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
#### 💡 **SMART Workflow Best Practices**
|
|
704
|
-
- **Natural Language**: Tell AI directly in natural language what you want, no need to remember complex parameter formats
|
|
705
|
-
- **Sequential Flow**: Follow S→M→A→R→T sequence for optimal analysis results
|
|
706
|
-
- **Path Processing**: After setting project path, relative paths automatically resolve to project root directory
|
|
707
|
-
- **Security Protection**: Tool automatically performs project boundary checks to ensure security
|
|
708
|
-
- **Smart Understanding**: AI automatically understands your needs and calls appropriate tools
|
|
709
|
-
- **Performance**: All MCP tools are optimized for speed with built-in timeouts and result limits
|
|
710
|
-
- **Dependency Tracing**: Use T step only when you need to understand complex relationships between code elements
|
|
711
|
-
|
|
712
|
-
### 🛠️ CLI Command Examples
|
|
713
|
-
|
|
714
|
-
```bash
|
|
715
|
-
# Quick analysis (1419-line large file, completed instantly)
|
|
716
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --advanced --output-format=text
|
|
717
|
-
|
|
718
|
-
# Detailed structure table (66 methods clearly displayed)
|
|
719
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --table=full
|
|
720
|
-
|
|
721
|
-
# Precise code extraction (memory usage monitoring code snippet)
|
|
722
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --partial-read --start-line 100 --end-line 105
|
|
723
|
-
|
|
724
|
-
# Multi-language support test (Python file)
|
|
725
|
-
uv run python -m tree_sitter_analyzer examples/sample.py --table=full
|
|
726
|
-
|
|
727
|
-
# Small file quick analysis (54-line Java file)
|
|
728
|
-
uv run python -m tree_sitter_analyzer examples/MultiClass.java --advanced
|
|
729
|
-
|
|
730
|
-
# Silent mode (only show results)
|
|
731
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --table=full --quiet
|
|
732
|
-
|
|
733
|
-
# 🔍 Query Filter Examples (v0.9.6+)
|
|
734
|
-
# Find specific methods
|
|
735
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "name=main"
|
|
736
|
-
|
|
737
|
-
# Find authentication-related methods
|
|
738
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "name=~auth*"
|
|
739
|
-
|
|
740
|
-
# Find public methods with no parameters
|
|
741
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "params=0,public=true"
|
|
742
|
-
|
|
743
|
-
# Find static methods
|
|
744
|
-
uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "static=true"
|
|
745
|
-
|
|
746
|
-
# View filter syntax help
|
|
747
|
-
uv run python -m tree_sitter_analyzer --filter-help
|
|
748
|
-
|
|
749
|
-
# 🆕 New CLI Commands (v1.3.8+)
|
|
750
|
-
# File listing with fd functionality
|
|
751
|
-
uv run list-files . --extensions java --output-format json
|
|
752
|
-
|
|
753
|
-
# Content search with ripgrep functionality
|
|
754
|
-
uv run search-content --roots . --query "class.*extends" --include-globs "*.java" --output-format text
|
|
755
|
-
|
|
756
|
-
# Two-stage search: find files first, then search content
|
|
757
|
-
uv run find-and-grep --roots . --query "public.*method" --extensions java --output-format json
|
|
758
|
-
|
|
759
|
-
# Advanced file filtering
|
|
760
|
-
uv run list-files . --types f --size "+1k" --changed-within "1week" --hidden --output-format text
|
|
761
|
-
|
|
762
|
-
# Content search with context
|
|
763
|
-
uv run search-content --roots src --query "TODO|FIXME" --context-before 2 --context-after 2 --output-format json
|
|
764
|
-
|
|
765
|
-
# Combined file and content search with limits
|
|
766
|
-
uv run find-and-grep --roots . --query "import.*spring" --extensions java --file-limit 10 --max-count 5 --output-format text
|
|
767
|
-
```
|
|
768
|
-
|
|
769
|
-
---
|
|
770
|
-
|
|
771
|
-
## 🏗️ Architecture Improvements (v1.2.0+)
|
|
772
|
-
|
|
773
|
-
### 🔄 **Unified Element Management System**
|
|
774
|
-
|
|
775
|
-
Tree-sitter Analyzer now features a revolutionary unified architecture that integrates all code elements into a unified system:
|
|
776
|
-
|
|
777
|
-
#### **Before (Traditional Architecture):**
|
|
778
|
-
- Independent collections of classes, methods, fields, and imports
|
|
779
|
-
- Inconsistent data structures across different analysis modes
|
|
780
|
-
- Complex maintenance and potential inconsistencies
|
|
781
|
-
|
|
782
|
-
#### **After (Unified Architecture):**
|
|
783
|
-
- **Single `elements` list**: All code elements (classes, methods, fields, imports, packages) unified
|
|
784
|
-
- **Consistent element types**: Each element has an `element_type` attribute for easy identification
|
|
785
|
-
- **Simplified API**: Clearer interfaces and reduced complexity
|
|
786
|
-
- **Better maintainability**: Single source of truth for all code elements
|
|
787
|
-
|
|
788
|
-
#### **Benefits:**
|
|
789
|
-
- ✅ **Consistency**: Unified data structures across all analysis modes
|
|
790
|
-
- ✅ **Simplicity**: Easier to use and understand
|
|
791
|
-
- ✅ **Extensibility**: Easy to add new element types
|
|
792
|
-
- ✅ **Performance**: Optimized memory usage and processing
|
|
793
|
-
- ✅ **Backward compatibility**: Existing APIs continue to work seamlessly
|
|
794
|
-
|
|
795
|
-
#### **Supported Element Types:**
|
|
796
|
-
- `class` - Classes and interfaces
|
|
797
|
-
- `function` - Methods and functions
|
|
798
|
-
- `variable` - Fields and variables
|
|
799
|
-
- `import` - Import statements
|
|
800
|
-
- `package` - Package declarations
|
|
801
|
-
|
|
802
|
-
---
|
|
803
|
-
|
|
804
|
-
## 🛠️ Core Features
|
|
805
|
-
|
|
806
|
-
### 📊 **Code Structure Analysis**
|
|
807
|
-
Get insights without reading complete files:
|
|
808
|
-
- Class, method, and field statistics
|
|
809
|
-
- Package information and import dependencies
|
|
810
|
-
- Complexity metrics
|
|
811
|
-
- Precise line number positioning
|
|
812
|
-
|
|
813
|
-
### ✂️ **Smart Code Extraction**
|
|
814
|
-
- Precise extraction by line range
|
|
815
|
-
- Maintains original format and indentation
|
|
816
|
-
- Includes position metadata
|
|
817
|
-
- Supports efficient processing of large files
|
|
818
|
-
|
|
819
|
-
### 🔍 **Advanced Query Filtering**
|
|
820
|
-
Powerful code element query and filtering system:
|
|
821
|
-
- **Exact matching**: `--filter "name=main"` to find specific methods
|
|
822
|
-
- **Pattern matching**: `--filter "name=~auth*"` to find authentication-related methods
|
|
823
|
-
- **Parameter filtering**: `--filter "params=2"` to find methods with specific parameter counts
|
|
824
|
-
- **Modifier filtering**: `--filter "static=true,public=true"` to find static public methods
|
|
825
|
-
- **Compound conditions**: `--filter "name=~get*,params=0,public=true"` to combine multiple conditions
|
|
826
|
-
- **CLI/MCP consistency**: Same filtering syntax used in command line and AI assistants
|
|
827
|
-
|
|
828
|
-
### 🔗 **AI Assistant Integration**
|
|
829
|
-
Deep integration through MCP protocol:
|
|
830
|
-
- Claude Desktop
|
|
831
|
-
- Cursor IDE
|
|
832
|
-
- Roo Code
|
|
833
|
-
- Other MCP-compatible AI tools
|
|
834
|
-
|
|
835
|
-
### 🔍 **Advanced File Search & Content Analysis (v1.2.4+)**
|
|
836
|
-
Powerful file discovery and content search capabilities powered by fd and ripgrep:
|
|
837
|
-
|
|
838
|
-
#### **📋 Prerequisites**
|
|
839
|
-
To use the advanced MCP tools (ListFilesTool, SearchContentTool, FindAndGrepTool), you need to install the following command-line tools:
|
|
840
|
-
|
|
841
|
-
**Install fd (fast file finder):**
|
|
842
|
-
```bash
|
|
843
|
-
# macOS (using Homebrew)
|
|
844
|
-
brew install fd
|
|
845
|
-
|
|
846
|
-
# Windows (using winget - recommended)
|
|
847
|
-
winget install sharkdp.fd
|
|
848
|
-
|
|
849
|
-
# Windows (using Chocolatey)
|
|
850
|
-
choco install fd
|
|
851
|
-
|
|
852
|
-
# Windows (using Scoop)
|
|
853
|
-
scoop install fd
|
|
854
|
-
|
|
855
|
-
# Ubuntu/Debian
|
|
856
|
-
sudo apt install fd-find
|
|
857
|
-
|
|
858
|
-
# CentOS/RHEL/Fedora
|
|
859
|
-
sudo dnf install fd-find
|
|
860
|
-
|
|
861
|
-
# Arch Linux
|
|
862
|
-
sudo pacman -S fd
|
|
863
|
-
```
|
|
864
|
-
|
|
865
|
-
**Install ripgrep (fast text search):**
|
|
866
|
-
```bash
|
|
867
|
-
# macOS (using Homebrew)
|
|
868
|
-
brew install ripgrep
|
|
869
|
-
|
|
870
|
-
# Windows (using winget - recommended)
|
|
871
|
-
winget install BurntSushi.ripgrep.MSVC
|
|
872
|
-
|
|
873
|
-
# Windows (using Chocolatey)
|
|
874
|
-
choco install ripgrep
|
|
875
|
-
|
|
876
|
-
# Windows (using Scoop)
|
|
877
|
-
scoop install ripgrep
|
|
878
|
-
|
|
879
|
-
# Ubuntu/Debian
|
|
880
|
-
sudo apt install ripgrep
|
|
881
|
-
|
|
882
|
-
# CentOS/RHEL/Fedora
|
|
883
|
-
sudo dnf install ripgrep
|
|
884
|
-
|
|
885
|
-
# Arch Linux
|
|
886
|
-
sudo pacman -S ripgrep
|
|
887
|
-
```
|
|
888
|
-
|
|
889
|
-
**Verify Installation:**
|
|
890
|
-
```bash
|
|
891
|
-
# Check fd installation
|
|
892
|
-
fd --version
|
|
893
|
-
|
|
894
|
-
# Check ripgrep installation
|
|
895
|
-
rg --version
|
|
896
|
-
```
|
|
897
|
-
|
|
898
|
-
> **⚠️ Important:** Without these tools installed, the advanced MCP file search and content analysis features will not work. The basic MCP tools (analyze_code_structure, extract_code_section, etc.) will continue to work normally.
|
|
899
|
-
|
|
900
|
-
### 📁 **File Output Support (v1.5.1+)**
|
|
901
|
-
|
|
902
|
-
The `analyze_code_structure` tool now supports saving analysis results to files with automatic format detection:
|
|
903
|
-
|
|
904
|
-
#### **🎯 Key Features:**
|
|
905
|
-
- **Automatic Extension Detection**: Based on content type (JSON → `.json`, CSV → `.csv`, Markdown → `.md`, Text → `.txt`)
|
|
906
|
-
- **Smart Output Path**: Uses `TREE_SITTER_OUTPUT_PATH` environment variable or project root as fallback
|
|
907
|
-
- **Security Validation**: Ensures output files are written to safe, authorized locations
|
|
908
|
-
- **Content Type Detection**: Automatically detects content format and applies appropriate file extension
|
|
909
|
-
|
|
910
|
-
#### **📋 Usage Examples:**
|
|
911
|
-
|
|
912
|
-
**Basic File Output:**
|
|
913
|
-
```json
|
|
914
|
-
{
|
|
915
|
-
"tool": "analyze_code_structure",
|
|
916
|
-
"arguments": {
|
|
917
|
-
"file_path": "src/BigService.java",
|
|
918
|
-
"output_file": "service_analysis"
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
```
|
|
922
|
-
|
|
923
|
-
**With Format Control:**
|
|
924
|
-
```json
|
|
925
|
-
{
|
|
926
|
-
"tool": "analyze_code_structure",
|
|
927
|
-
"arguments": {
|
|
928
|
-
"file_path": "src/BigService.java",
|
|
929
|
-
"format_type": "csv",
|
|
930
|
-
"output_file": "service_data"
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
```
|
|
934
|
-
|
|
935
|
-
#### **🔧 Environment Configuration:**
|
|
936
|
-
```json
|
|
937
|
-
{
|
|
938
|
-
"env": {
|
|
939
|
-
"TREE_SITTER_PROJECT_ROOT": "/path/to/your/project",
|
|
940
|
-
"TREE_SITTER_OUTPUT_PATH": "/path/to/output/directory"
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
```
|
|
944
|
-
|
|
945
|
-
**Output Path Priority:**
|
|
946
|
-
1. `TREE_SITTER_OUTPUT_PATH` environment variable (highest priority)
|
|
947
|
-
2. Project root directory (from `TREE_SITTER_PROJECT_ROOT` or auto-detected)
|
|
948
|
-
3. Current working directory (fallback)
|
|
949
|
-
|
|
950
|
-
#### **🗂️ ListFilesTool - Smart File Discovery**
|
|
951
|
-
- **Advanced filtering**: File type, size, modification time, extension-based filtering
|
|
952
|
-
- **Pattern matching**: Glob patterns and regex support for flexible file discovery
|
|
953
|
-
- **Metadata enrichment**: File size, modification time, directory status, and extension information
|
|
954
|
-
- **Performance optimized**: Built on fd for lightning-fast file system traversal
|
|
955
|
-
|
|
956
|
-
#### **🔎 SearchContentTool - Intelligent Content Search**
|
|
957
|
-
- **Regex & literal search**: Flexible pattern matching with case sensitivity controls
|
|
958
|
-
- **Context-aware results**: Configurable before/after context lines for better understanding
|
|
959
|
-
- **Multiple output formats**: Standard results, count-only, summary, and grouped by file
|
|
960
|
-
- **Encoding support**: Handle files with different text encodings
|
|
961
|
-
- **Performance limits**: Built-in timeout and result limits for responsive operation
|
|
962
|
-
|
|
963
|
-
#### **🎯 FindAndGrepTool - Combined Discovery & Search**
|
|
964
|
-
- **Two-stage workflow**: First discover files with fd, then search content with ripgrep
|
|
965
|
-
- **Comprehensive filtering**: Combine file discovery filters with content search patterns
|
|
966
|
-
- **Advanced options**: Multiline patterns, word boundaries, fixed strings, and case controls
|
|
967
|
-
- **Rich metadata**: File discovery timing, search timing, and result statistics
|
|
968
|
-
- **Token optimization**: Path optimization and result grouping to minimize AI token usage
|
|
969
|
-
|
|
970
|
-
#### **✨ Key Benefits:**
|
|
971
|
-
- 🚀 **Enterprise-grade reliability**: 50+ comprehensive test cases ensuring stability
|
|
972
|
-
- 🎯 **Token-efficient**: Multiple output formats optimized for AI assistant interactions
|
|
973
|
-
- 🔧 **Highly configurable**: Extensive parameter support for precise control
|
|
974
|
-
- 📊 **Performance monitoring**: Built-in timing and result statistics
|
|
975
|
-
- 🛡️ **Error resilient**: Comprehensive error handling and validation
|
|
976
|
-
|
|
977
|
-
### 🌍 **Multi-language Support**
|
|
978
|
-
- **Java** - Full support, including Spring, JPA frameworks
|
|
979
|
-
- **Python** - Full support, including type annotations, decorators
|
|
980
|
-
- **JavaScript** - 🆕 **Enterprise-grade support**, including modern ES6+ features, React/Vue/Angular frameworks, JSX, async functions, generators, arrow functions, classes, module systems
|
|
981
|
-
- **TypeScript** - Full support, including type annotations, interfaces
|
|
982
|
-
- **C/C++, Rust, Go** - Basic support
|
|
983
|
-
|
|
984
|
-
---
|
|
985
|
-
|
|
986
|
-
## 🆕 JavaScript Enterprise Support (v1.5.0+)
|
|
987
|
-
|
|
988
|
-
### 🚀 **Modern JavaScript Complete Support**
|
|
989
|
-
|
|
990
|
-
Tree-sitter Analyzer now provides enterprise-level JavaScript support at the same level as Java, including:
|
|
991
|
-
|
|
992
|
-
#### **📋 Core Language Features**
|
|
993
|
-
- **Function Types**: Traditional functions, arrow functions, async functions, generator functions
|
|
994
|
-
- **Class System**: ES6 classes, inheritance, static methods, getters/setters, constructors
|
|
995
|
-
- **Variable Declarations**: var, let, const, destructuring assignment, template literals
|
|
996
|
-
- **Module System**: ES6 import/export, CommonJS require/module.exports
|
|
997
|
-
- **Modern Features**: Spread/rest operators, Promises, async/await
|
|
998
|
-
|
|
999
|
-
#### **🎨 Framework & Ecosystem**
|
|
1000
|
-
- **React Support**: JSX syntax, component analysis, Hook recognition, lifecycle methods
|
|
1001
|
-
- **Vue.js Support**: Single-file components, template syntax, reactive data
|
|
1002
|
-
- **Angular Support**: Components, services, dependency injection pattern recognition
|
|
1003
|
-
- **Node.js Support**: Server-side patterns, Express routing, middleware
|
|
1004
|
-
|
|
1005
|
-
#### **🔍 Advanced Analysis Capabilities**
|
|
1006
|
-
- **JSDoc Extraction**: Complete documentation comment parsing and type information
|
|
1007
|
-
- **Complexity Analysis**: Cyclomatic complexity calculation and code quality metrics
|
|
1008
|
-
- **Framework Detection**: Automatic recognition of React, Vue, Angular project types
|
|
1009
|
-
- **Export Analysis**: Module export mapping and dependency relationship tracking
|
|
1010
|
-
|
|
1011
|
-
#### **💼 Enterprise Features**
|
|
1012
|
-
- **Table Formatting**: Dedicated JavaScript table formatter for clear code structure display
|
|
1013
|
-
- **Performance Optimization**: Caching mechanisms, iterative traversal, efficient large file handling
|
|
1014
|
-
- **Error Handling**: Robust exception handling and detailed error reporting
|
|
1015
|
-
- **Type Safety**: TypeScript-style type annotation support
|
|
1016
|
-
|
|
1017
|
-
### 📊 **JavaScript Analysis Examples**
|
|
1018
|
-
|
|
1019
|
-
```bash
|
|
1020
|
-
# Analyze modern JavaScript files
|
|
1021
|
-
uv run python -m tree_sitter_analyzer examples/ModernJavaScript.js --language javascript --advanced
|
|
1022
|
-
|
|
1023
|
-
# Generate detailed structure tables
|
|
1024
|
-
uv run python -m tree_sitter_analyzer examples/ModernJavaScript.js --language javascript --table full
|
|
1025
|
-
|
|
1026
|
-
# Analyze React components
|
|
1027
|
-
uv run python -m tree_sitter_analyzer examples/ReactComponent.jsx --language javascript --table full
|
|
1028
|
-
|
|
1029
|
-
# Query specific function types
|
|
1030
|
-
uv run python -m tree_sitter_analyzer examples/ModernJavaScript.js --language javascript --query-key async_function
|
|
1031
|
-
```
|
|
1032
|
-
|
|
1033
|
-
### 🎯 **Supported JavaScript Query Types**
|
|
1034
|
-
- `function_declaration` - Traditional function declarations
|
|
1035
|
-
- `arrow_function` - Arrow functions
|
|
1036
|
-
- `async_function` - Async functions
|
|
1037
|
-
- `generator_function` - Generator functions
|
|
1038
|
-
- `class_declaration` - Class declarations
|
|
1039
|
-
- `variable_declaration` - Variable declarations
|
|
1040
|
-
- `import_statement` - Import statements
|
|
1041
|
-
- `export_statement` - Export statements
|
|
1042
|
-
- `jsx_element` - JSX elements
|
|
1043
|
-
- `method_definition` - Method definitions
|
|
1044
|
-
|
|
1045
|
-
### 🏗️ **AI Assistant JavaScript Workflow**
|
|
1046
|
-
|
|
1047
|
-
```
|
|
1048
|
-
I want to analyze the structure of this JavaScript file: examples/ModernJavaScript.js
|
|
1049
|
-
```
|
|
1050
|
-
|
|
1051
|
-
**Example Response Format:**
|
|
1052
|
-
```json
|
|
1053
|
-
{
|
|
1054
|
-
"file_path": "examples/ModernJavaScript.js",
|
|
1055
|
-
"language": "javascript",
|
|
1056
|
-
"element_count": 24,
|
|
1057
|
-
"elements": [
|
|
1058
|
-
{
|
|
1059
|
-
"name": "fetchUserData",
|
|
1060
|
-
"type": "function",
|
|
1061
|
-
"start_line": 208,
|
|
1062
|
-
"end_line": 211,
|
|
1063
|
-
"is_async": true,
|
|
1064
|
-
"framework_type": "vanilla"
|
|
1065
|
-
},
|
|
1066
|
-
{
|
|
1067
|
-
"name": "ModernComponent",
|
|
1068
|
-
"type": "class",
|
|
1069
|
-
"start_line": 31,
|
|
1070
|
-
"end_line": 200,
|
|
1071
|
-
"is_react_component": true,
|
|
1072
|
-
"framework_type": "react"
|
|
1073
|
-
}
|
|
1074
|
-
],
|
|
1075
|
-
"success": true
|
|
1076
|
-
}
|
|
1077
|
-
```
|
|
1078
|
-
|
|
1079
|
-
---
|
|
1080
|
-
|
|
1081
|
-
## 📦 Installation Guide
|
|
1082
|
-
|
|
1083
|
-
### 👤 **End Users**
|
|
1084
|
-
```bash
|
|
1085
|
-
# Basic installation
|
|
1086
|
-
uv add tree-sitter-analyzer
|
|
1087
|
-
|
|
1088
|
-
# Popular language packages (recommended)
|
|
1089
|
-
uv add "tree-sitter-analyzer[popular]"
|
|
1090
|
-
|
|
1091
|
-
# MCP server support
|
|
1092
|
-
uv add "tree-sitter-analyzer[mcp]"
|
|
1093
|
-
|
|
1094
|
-
# Complete installation
|
|
1095
|
-
uv add "tree-sitter-analyzer[all,mcp]"
|
|
1096
|
-
```
|
|
1097
|
-
|
|
1098
|
-
### 👨💻 **Developers**
|
|
1099
|
-
```bash
|
|
1100
|
-
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
|
|
1101
|
-
cd tree-sitter-analyzer
|
|
1102
|
-
uv sync --extra all --extra mcp
|
|
1103
|
-
```
|
|
1104
|
-
|
|
1105
|
-
---
|
|
1106
|
-
|
|
1107
|
-
## 🔒 Security and Configuration
|
|
1108
|
-
|
|
1109
|
-
### 🛡️ **Project Boundary Protection**
|
|
1110
|
-
|
|
1111
|
-
Tree-sitter Analyzer automatically detects and protects project boundaries:
|
|
1112
|
-
|
|
1113
|
-
- **Auto-detection**: Based on `.git`, `pyproject.toml`, `package.json`, etc.
|
|
1114
|
-
- **CLI control**: `--project-root /path/to/project`
|
|
1115
|
-
- **MCP integration**: `TREE_SITTER_PROJECT_ROOT=/path/to/project` or use auto-detection
|
|
1116
|
-
- **Security guarantee**: Only analyze files within project boundaries
|
|
1117
|
-
|
|
1118
|
-
**Recommended MCP Configuration:**
|
|
1119
|
-
|
|
1120
|
-
**Option 1: Auto-detection (Recommended)**
|
|
1121
|
-
```json
|
|
1122
|
-
{
|
|
1123
|
-
"mcpServers": {
|
|
1124
|
-
"tree-sitter-analyzer": {
|
|
1125
|
-
"command": "uv",
|
|
1126
|
-
"args": ["run", "--with", "tree-sitter-analyzer[mcp]", "python", "-m", "tree_sitter_analyzer.mcp.server"]
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
```
|
|
1131
|
-
|
|
1132
|
-
**Option 2: Manually specify project root directory**
|
|
1133
|
-
```json
|
|
1134
|
-
{
|
|
1135
|
-
"mcpServers": {
|
|
1136
|
-
"tree-sitter-analyzer": {
|
|
1137
|
-
"command": "uv",
|
|
1138
|
-
"args": ["run", "--with", "tree-sitter-analyzer[mcp]", "python", "-m", "tree_sitter_analyzer.mcp.server"],
|
|
1139
|
-
"env": {
|
|
1140
|
-
"TREE_SITTER_PROJECT_ROOT": "/path/to/your/project",
|
|
1141
|
-
"TREE_SITTER_OUTPUT_PATH": "/path/to/output/directory"
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
```
|
|
1147
|
-
|
|
1148
|
-
---
|
|
1149
|
-
|
|
1150
|
-
## 🏆 Quality Assurance
|
|
1151
|
-
|
|
1152
|
-
### 📊 **Quality Metrics**
|
|
1153
|
-
- **1,893 tests** - 100% pass rate ✅
|
|
1154
|
-
- **71.48% code coverage** - Industry-leading level
|
|
1155
|
-
- **Zero test failures** - Fully CI/CD ready
|
|
1156
|
-
- **Cross-platform compatibility** - Windows, macOS, Linux
|
|
1157
|
-
|
|
1158
|
-
### ⚡ **Latest Quality Achievements (v1.6.0)**
|
|
1159
|
-
- ✅ **Cross-platform path compatibility** - Fixed Windows short path names and macOS symbolic link differences
|
|
1160
|
-
- ✅ **Windows environment** - Implemented robust path normalization using Windows API
|
|
1161
|
-
- ✅ **macOS environment** - Fixed `/var` vs `/private/var` symbolic link differences
|
|
1162
|
-
- ✅ **Comprehensive test coverage** - 1797 tests, 74.45% coverage
|
|
1163
|
-
- ✅ **GitFlow implementation** - Professional development/release branch strategy. See [GitFlow documentation](GITFLOW.md) for details.
|
|
1164
|
-
|
|
1165
|
-
### ⚙️ **Running Tests**
|
|
1166
|
-
```bash
|
|
1167
|
-
# Run all tests
|
|
1168
|
-
uv run pytest tests/ -v
|
|
1169
|
-
|
|
1170
|
-
# Generate coverage report
|
|
1171
|
-
uv run pytest tests/ --cov=tree_sitter_analyzer --cov-report=html --cov-report=term-missing
|
|
1172
|
-
|
|
1173
|
-
# Run specific tests
|
|
1174
|
-
uv run pytest tests/test_mcp_server_initialization.py -v
|
|
1175
|
-
```
|
|
1176
|
-
|
|
1177
|
-
### 📈 **Coverage Highlights**
|
|
1178
|
-
- **Language detector**: 98.41% (Excellent)
|
|
1179
|
-
- **CLI main entry**: 94.36% (Excellent)
|
|
1180
|
-
- **Query filtering system**: 96.06% (Excellent)
|
|
1181
|
-
- **MCP fd/rg tools**: 93.04% (Excellent) - *Enhanced in v1.3.2 with cache format compatibility fix*
|
|
1182
|
-
- **Query service**: 86.25% (Good)
|
|
1183
|
-
- **Error handling**: 82.76% (Good)
|
|
1184
|
-
|
|
1185
|
-
---
|
|
1186
|
-
|
|
1187
|
-
## 🤖 AI Collaboration Support
|
|
1188
|
-
|
|
1189
|
-
### ⚡ **Optimized for AI Development**
|
|
1190
|
-
|
|
1191
|
-
This project supports AI-assisted development with dedicated quality control:
|
|
1192
|
-
|
|
1193
|
-
```bash
|
|
1194
|
-
# AI system code generation pre-check
|
|
1195
|
-
uv run python check_quality.py --new-code-only
|
|
1196
|
-
uv run python llm_code_checker.py --check-all
|
|
1197
|
-
|
|
1198
|
-
# AI-generated code review
|
|
1199
|
-
uv run python llm_code_checker.py path/to/new_file.py
|
|
1200
|
-
```
|
|
1201
|
-
|
|
1202
|
-
📖 **Detailed Guides**:
|
|
1203
|
-
- [AI Collaboration Guide](AI_COLLABORATION_GUIDE.md)
|
|
1204
|
-
- [LLM Coding Guidelines](LLM_CODING_GUIDELINES.md)
|
|
1205
|
-
|
|
1206
|
-
---
|
|
1207
|
-
|
|
1208
|
-
## 📚 Documentation
|
|
1209
|
-
|
|
1210
|
-
- **[User MCP Setup Guide](MCP_SETUP_USERS.md)** - Simple configuration guide
|
|
1211
|
-
- **[Developer MCP Setup Guide](MCP_SETUP_DEVELOPERS.md)** - Local development configuration
|
|
1212
|
-
- **[Project Root Configuration](PROJECT_ROOT_CONFIG.md)** - Complete configuration reference
|
|
1213
|
-
- **[API Documentation](docs/api.md)** - Detailed API reference
|
|
1214
|
-
- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute
|
|
1215
|
-
- **[Takeover and Training Guide](training/README.md)** - System onboarding materials for new members/maintainers
|
|
1216
|
-
|
|
1217
|
-
---
|
|
1218
|
-
|
|
1219
|
-
## 💝 Sponsors & Acknowledgments
|
|
1220
|
-
|
|
1221
|
-
We are grateful to our sponsors who make this project possible:
|
|
1222
|
-
|
|
1223
|
-
### 🌟 **Special Thanks**
|
|
1224
|
-
|
|
1225
|
-
**[@o93](https://github.com/o93)** - *Primary Sponsor & Supporter*
|
|
1226
|
-
- 🚀 **MCP Tools Enhancement**: Sponsored the comprehensive MCP fd/ripgrep tools development
|
|
1227
|
-
- 🧪 **Testing Infrastructure**: Enabled enterprise-grade test coverage (50+ comprehensive test cases)
|
|
1228
|
-
- 🔧 **Quality Assurance**: Supported bug fixes and performance improvements
|
|
1229
|
-
- 💡 **Innovation Support**: Made early release of advanced file search and content analysis features possible
|
|
1230
|
-
|
|
1231
|
-
*"Thanks to @o93's generous support, we were able to deliver powerful MCP tools that revolutionize how AI assistants interact with codebases. This sponsorship directly enabled the development of ListFilesTool, SearchContentTool, and FindAndGrepTool with comprehensive test coverage."*
|
|
1232
|
-
|
|
1233
|
-
### 🤝 **Become a Sponsor**
|
|
1234
|
-
|
|
1235
|
-
Your support helps us:
|
|
1236
|
-
- 🔬 Develop new features and tools
|
|
1237
|
-
- 🧪 Maintain comprehensive test coverage
|
|
1238
|
-
- 📚 Create better documentation
|
|
1239
|
-
- 🚀 Accelerate development cycles
|
|
1240
|
-
|
|
1241
|
-
**[💖 Sponsor this project](https://github.com/sponsors/aimasteracc)** to help us continue building amazing tools for the developer community!
|
|
1242
|
-
|
|
1243
|
-
---
|
|
1244
|
-
|
|
1245
|
-
## 🤝 Contributing
|
|
1246
|
-
|
|
1247
|
-
We welcome all forms of contributions! Please see [Contributing Guide](CONTRIBUTING.md) for details.
|
|
1248
|
-
|
|
1249
|
-
### ⭐ **Give Us a Star!**
|
|
1250
|
-
|
|
1251
|
-
If this project has been helpful to you, please give us a ⭐ on GitHub - this is the greatest support for us!
|
|
1252
|
-
|
|
1253
|
-
---
|
|
1254
|
-
|
|
1255
|
-
## 📄 License
|
|
1256
|
-
|
|
1257
|
-
MIT License - See [LICENSE](LICENSE) file for details.
|
|
1258
|
-
|
|
1259
|
-
---
|
|
1260
|
-
|
|
1261
|
-
**🎯 Built for developers dealing with large codebases and AI assistants**
|
|
1262
|
-
|
|
1263
|
-
*Let every line of code be understood by AI, let every project break through token limits*
|
|
1264
|
-
|
|
1265
|
-
---
|
|
1266
|
-
|
|
1267
|
-
## ✅ Prompt Testing Verification
|
|
1268
|
-
|
|
1269
|
-
All AI prompts in this document have been thoroughly tested in real environments, ensuring:
|
|
1270
|
-
|
|
1271
|
-
- **100% Availability** - All prompts work correctly
|
|
1272
|
-
- **Multi-language Support** - Supports Java, Python, JavaScript and other mainstream languages
|
|
1273
|
-
- **Path Compatibility** - Both relative and absolute paths are fully supported
|
|
1274
|
-
- **Windows/Linux Compatibility** - Cross-platform path formats are automatically handled
|
|
1275
|
-
- **Real-time Verification** - Tested using real code files
|
|
1276
|
-
|
|
1277
|
-
**Test Environment:**
|
|
1278
|
-
- Operating System: Windows 10
|
|
1279
|
-
- Project: tree-sitter-analyzer v1.6.0
|
|
1280
|
-
- Test Files: BigService.java (1419 lines), sample.py (256 lines), MultiClass.java (54 lines)
|
|
1281
|
-
- Test Coverage: 1797 tests passed, 74.45% coverage
|
|
1282
|
-
- Test Tools: All MCP tools (check_code_scale, analyze_code_structure, extract_code_section, query_code, list_files, search_content, find_and_grep)
|
|
1283
|
-
|
|
1284
|
-
**🚀 Start Now** → [30-Second Quick Start](#-30-second-quick-start)
|