tree-sitter-analyzer 0.9.4__py3-none-any.whl → 0.9.5__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/encoding_utils.py +7 -4
- tree_sitter_analyzer/security/boundary_manager.py +10 -2
- tree_sitter_analyzer/table_formatter.py +6 -1
- tree_sitter_analyzer/utils.py +51 -40
- tree_sitter_analyzer-0.9.5.dist-info/METADATA +567 -0
- {tree_sitter_analyzer-0.9.4.dist-info → tree_sitter_analyzer-0.9.5.dist-info}/RECORD +8 -8
- tree_sitter_analyzer-0.9.4.dist-info/METADATA +0 -409
- {tree_sitter_analyzer-0.9.4.dist-info → tree_sitter_analyzer-0.9.5.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-0.9.4.dist-info → tree_sitter_analyzer-0.9.5.dist-info}/entry_points.txt +0 -0
|
@@ -29,10 +29,13 @@ def _setup_encoding_environment() -> None:
|
|
|
29
29
|
sys.stderr.reconfigure(encoding="utf-8", errors="replace")
|
|
30
30
|
except Exception as e:
|
|
31
31
|
# Ignore setup errors, use defaults; log at debug when possible
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
msg = f"[encoding_setup] non-fatal setup error: {e}\n"
|
|
33
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
34
|
+
try:
|
|
35
|
+
sys.stderr.write(msg)
|
|
36
|
+
except Exception:
|
|
37
|
+
# Swallow secondary I/O errors intentionally
|
|
38
|
+
...
|
|
36
39
|
|
|
37
40
|
|
|
38
41
|
# Set up environment when module is imported
|
|
@@ -189,7 +189,15 @@ class ProjectBoundaryManager:
|
|
|
189
189
|
if not os.path.exists(file_path):
|
|
190
190
|
return True # Non-existent files are safe
|
|
191
191
|
|
|
192
|
-
#
|
|
192
|
+
# If the fully resolved path is within project boundaries, we treat it as safe.
|
|
193
|
+
# This makes the check tolerant to system-level symlinks like
|
|
194
|
+
# /var -> /private/var on macOS runners.
|
|
195
|
+
resolved = os.path.realpath(file_path)
|
|
196
|
+
if self.is_within_project(resolved):
|
|
197
|
+
return True
|
|
198
|
+
|
|
199
|
+
# Otherwise, inspect each path component symlink to ensure no hop jumps outside
|
|
200
|
+
# the allowed directories.
|
|
193
201
|
path_parts = Path(file_path).parts
|
|
194
202
|
current_path = ""
|
|
195
203
|
|
|
@@ -199,7 +207,6 @@ class ProjectBoundaryManager:
|
|
|
199
207
|
)
|
|
200
208
|
|
|
201
209
|
if os.path.islink(current_path):
|
|
202
|
-
# Check if symlink target is within boundaries
|
|
203
210
|
target = os.path.realpath(current_path)
|
|
204
211
|
if not self.is_within_project(target):
|
|
205
212
|
log_warning(
|
|
@@ -207,6 +214,7 @@ class ProjectBoundaryManager:
|
|
|
207
214
|
)
|
|
208
215
|
return False
|
|
209
216
|
|
|
217
|
+
# If no unsafe hop found, consider safe
|
|
210
218
|
return True
|
|
211
219
|
|
|
212
220
|
except Exception as e:
|
|
@@ -616,7 +616,12 @@ class TableFormatter:
|
|
|
616
616
|
type_name = str(type_name)
|
|
617
617
|
|
|
618
618
|
# At this point, type_name is guaranteed to be a string
|
|
619
|
-
|
|
619
|
+
# Defensive check (avoid using assert for runtime safety and security checks)
|
|
620
|
+
if not isinstance(type_name, str):
|
|
621
|
+
try:
|
|
622
|
+
type_name = str(type_name)
|
|
623
|
+
except Exception:
|
|
624
|
+
type_name = "O"
|
|
620
625
|
|
|
621
626
|
type_mapping = {
|
|
622
627
|
"String": "S",
|
tree_sitter_analyzer/utils.py
CHANGED
|
@@ -51,10 +51,13 @@ def setup_logger(
|
|
|
51
51
|
logger.addHandler(file_handler)
|
|
52
52
|
except Exception as e:
|
|
53
53
|
# Never let logging configuration break runtime behavior; log to stderr if possible
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
55
|
+
try:
|
|
56
|
+
sys.stderr.write(
|
|
57
|
+
f"[logging_setup] file handler init skipped: {e}\n"
|
|
58
|
+
)
|
|
59
|
+
except Exception:
|
|
60
|
+
...
|
|
58
61
|
|
|
59
62
|
logger.setLevel(level)
|
|
60
63
|
|
|
@@ -111,17 +114,19 @@ def setup_safe_logging_shutdown() -> None:
|
|
|
111
114
|
handler.close()
|
|
112
115
|
logger.removeHandler(handler)
|
|
113
116
|
except Exception as e:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
118
|
+
try:
|
|
119
|
+
sys.stderr.write(
|
|
120
|
+
f"[logging_cleanup] handler close/remove skipped: {e}\n"
|
|
121
|
+
)
|
|
122
|
+
except Exception:
|
|
123
|
+
...
|
|
120
124
|
except Exception as e:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
126
|
+
try:
|
|
127
|
+
sys.stderr.write(f"[logging_cleanup] cleanup skipped: {e}\n")
|
|
128
|
+
except Exception:
|
|
129
|
+
...
|
|
125
130
|
|
|
126
131
|
# Register cleanup function
|
|
127
132
|
atexit.register(cleanup_logging)
|
|
@@ -140,10 +145,11 @@ def log_info(message: str, *args: Any, **kwargs: Any) -> None:
|
|
|
140
145
|
try:
|
|
141
146
|
logger.info(message, *args, **kwargs)
|
|
142
147
|
except (ValueError, OSError) as e:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
149
|
+
try:
|
|
150
|
+
sys.stderr.write(f"[log_info] suppressed: {e}\n")
|
|
151
|
+
except Exception:
|
|
152
|
+
...
|
|
147
153
|
|
|
148
154
|
|
|
149
155
|
def log_warning(message: str, *args: Any, **kwargs: Any) -> None:
|
|
@@ -151,10 +157,11 @@ def log_warning(message: str, *args: Any, **kwargs: Any) -> None:
|
|
|
151
157
|
try:
|
|
152
158
|
logger.warning(message, *args, **kwargs)
|
|
153
159
|
except (ValueError, OSError) as e:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
161
|
+
try:
|
|
162
|
+
sys.stderr.write(f"[log_warning] suppressed: {e}\n")
|
|
163
|
+
except Exception:
|
|
164
|
+
...
|
|
158
165
|
|
|
159
166
|
|
|
160
167
|
def log_error(message: str, *args: Any, **kwargs: Any) -> None:
|
|
@@ -162,10 +169,11 @@ def log_error(message: str, *args: Any, **kwargs: Any) -> None:
|
|
|
162
169
|
try:
|
|
163
170
|
logger.error(message, *args, **kwargs)
|
|
164
171
|
except (ValueError, OSError) as e:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
172
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
173
|
+
try:
|
|
174
|
+
sys.stderr.write(f"[log_error] suppressed: {e}\n")
|
|
175
|
+
except Exception:
|
|
176
|
+
...
|
|
169
177
|
|
|
170
178
|
|
|
171
179
|
def log_debug(message: str, *args: Any, **kwargs: Any) -> None:
|
|
@@ -173,10 +181,11 @@ def log_debug(message: str, *args: Any, **kwargs: Any) -> None:
|
|
|
173
181
|
try:
|
|
174
182
|
logger.debug(message, *args, **kwargs)
|
|
175
183
|
except (ValueError, OSError) as e:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
184
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
185
|
+
try:
|
|
186
|
+
sys.stderr.write(f"[log_debug] suppressed: {e}\n")
|
|
187
|
+
except Exception:
|
|
188
|
+
...
|
|
180
189
|
|
|
181
190
|
|
|
182
191
|
def suppress_output(func: Any) -> Any:
|
|
@@ -199,12 +208,13 @@ def suppress_output(func: Any) -> Any:
|
|
|
199
208
|
try:
|
|
200
209
|
sys.stdout.close()
|
|
201
210
|
except Exception as e:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
212
|
+
try:
|
|
213
|
+
sys.stderr.write(
|
|
214
|
+
f"[suppress_output] stdout close suppressed: {e}\n"
|
|
215
|
+
)
|
|
216
|
+
except Exception:
|
|
217
|
+
...
|
|
208
218
|
sys.stdout = old_stdout
|
|
209
219
|
|
|
210
220
|
return result
|
|
@@ -282,10 +292,11 @@ def log_performance(
|
|
|
282
292
|
message += f" - {detail_str}"
|
|
283
293
|
perf_logger.debug(message) # Change to DEBUG level
|
|
284
294
|
except (ValueError, OSError) as e:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
295
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
296
|
+
try:
|
|
297
|
+
sys.stderr.write(f"[log_performance] suppressed: {e}\n")
|
|
298
|
+
except Exception:
|
|
299
|
+
...
|
|
289
300
|
|
|
290
301
|
|
|
291
302
|
def setup_performance_logger() -> logging.Logger:
|
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tree-sitter-analyzer
|
|
3
|
+
Version: 0.9.5
|
|
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.23.4
|
|
38
|
+
Requires-Dist: tree-sitter-java>=0.23.5
|
|
39
|
+
Requires-Dist: tree-sitter-javascript>=0.23.1
|
|
40
|
+
Requires-Dist: tree-sitter-python>=0.23.6
|
|
41
|
+
Requires-Dist: tree-sitter==0.24.0
|
|
42
|
+
Provides-Extra: all-languages
|
|
43
|
+
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'all-languages'
|
|
44
|
+
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'all-languages'
|
|
45
|
+
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'all-languages'
|
|
46
|
+
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'all-languages'
|
|
47
|
+
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'all-languages'
|
|
48
|
+
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'all-languages'
|
|
49
|
+
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'all-languages'
|
|
50
|
+
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'all-languages'
|
|
51
|
+
Provides-Extra: c
|
|
52
|
+
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'c'
|
|
53
|
+
Provides-Extra: cpp
|
|
54
|
+
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'cpp'
|
|
55
|
+
Provides-Extra: dev
|
|
56
|
+
Requires-Dist: black>=24.0.0; extra == 'dev'
|
|
57
|
+
Requires-Dist: isort>=5.13.0; extra == 'dev'
|
|
58
|
+
Requires-Dist: memory-profiler>=0.61.0; extra == 'dev'
|
|
59
|
+
Requires-Dist: mypy>=1.17.0; extra == 'dev'
|
|
60
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
61
|
+
Requires-Dist: psutil<6,>=5.9.6; extra == 'dev'
|
|
62
|
+
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'dev'
|
|
63
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
64
|
+
Requires-Dist: pytest-mock>=3.14.1; extra == 'dev'
|
|
65
|
+
Requires-Dist: pytest>=8.4.1; extra == 'dev'
|
|
66
|
+
Requires-Dist: ruff>=0.5.0; extra == 'dev'
|
|
67
|
+
Requires-Dist: types-psutil>=5.9.0; extra == 'dev'
|
|
68
|
+
Provides-Extra: full
|
|
69
|
+
Requires-Dist: anyio>=4.0.0; extra == 'full'
|
|
70
|
+
Requires-Dist: black>=24.0.0; extra == 'full'
|
|
71
|
+
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'full'
|
|
72
|
+
Requires-Dist: isort>=5.13.0; extra == 'full'
|
|
73
|
+
Requires-Dist: mcp>=1.12.2; extra == 'full'
|
|
74
|
+
Requires-Dist: memory-profiler>=0.61.0; extra == 'full'
|
|
75
|
+
Requires-Dist: mypy>=1.17.0; extra == 'full'
|
|
76
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'full'
|
|
77
|
+
Requires-Dist: psutil<6,>=5.9.6; extra == 'full'
|
|
78
|
+
Requires-Dist: pydantic-settings>=2.2.1; extra == 'full'
|
|
79
|
+
Requires-Dist: pydantic>=2.5.0; extra == 'full'
|
|
80
|
+
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'full'
|
|
81
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'full'
|
|
82
|
+
Requires-Dist: pytest-mock>=3.14.1; extra == 'full'
|
|
83
|
+
Requires-Dist: pytest>=8.4.1; extra == 'full'
|
|
84
|
+
Requires-Dist: ruff>=0.5.0; extra == 'full'
|
|
85
|
+
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'full'
|
|
86
|
+
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'full'
|
|
87
|
+
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'full'
|
|
88
|
+
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'full'
|
|
89
|
+
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'full'
|
|
90
|
+
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'full'
|
|
91
|
+
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'full'
|
|
92
|
+
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'full'
|
|
93
|
+
Requires-Dist: types-psutil>=5.9.0; extra == 'full'
|
|
94
|
+
Provides-Extra: go
|
|
95
|
+
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'go'
|
|
96
|
+
Provides-Extra: java
|
|
97
|
+
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'java'
|
|
98
|
+
Provides-Extra: javascript
|
|
99
|
+
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'javascript'
|
|
100
|
+
Provides-Extra: mcp
|
|
101
|
+
Requires-Dist: anyio>=4.0.0; extra == 'mcp'
|
|
102
|
+
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'mcp'
|
|
103
|
+
Requires-Dist: mcp>=1.12.2; extra == 'mcp'
|
|
104
|
+
Requires-Dist: pydantic-settings>=2.2.1; extra == 'mcp'
|
|
105
|
+
Requires-Dist: pydantic>=2.5.0; extra == 'mcp'
|
|
106
|
+
Provides-Extra: popular
|
|
107
|
+
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'popular'
|
|
108
|
+
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'popular'
|
|
109
|
+
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'popular'
|
|
110
|
+
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'popular'
|
|
111
|
+
Provides-Extra: python
|
|
112
|
+
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'python'
|
|
113
|
+
Provides-Extra: rust
|
|
114
|
+
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'rust'
|
|
115
|
+
Provides-Extra: systems
|
|
116
|
+
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'systems'
|
|
117
|
+
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'systems'
|
|
118
|
+
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'systems'
|
|
119
|
+
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'systems'
|
|
120
|
+
Provides-Extra: test
|
|
121
|
+
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'test'
|
|
122
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
123
|
+
Requires-Dist: pytest-mock>=3.14.1; extra == 'test'
|
|
124
|
+
Requires-Dist: pytest>=8.4.1; extra == 'test'
|
|
125
|
+
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'test'
|
|
126
|
+
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'test'
|
|
127
|
+
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'test'
|
|
128
|
+
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'test'
|
|
129
|
+
Provides-Extra: typescript
|
|
130
|
+
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'typescript'
|
|
131
|
+
Provides-Extra: web
|
|
132
|
+
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'web'
|
|
133
|
+
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'web'
|
|
134
|
+
Description-Content-Type: text/markdown
|
|
135
|
+
|
|
136
|
+
# Tree-sitter Analyzer
|
|
137
|
+
|
|
138
|
+
[](https://python.org)
|
|
139
|
+
[](LICENSE)
|
|
140
|
+
[](#quality-assurance)
|
|
141
|
+
[](#quality-assurance)
|
|
142
|
+
[](#quality-assurance)
|
|
143
|
+
[](https://pypi.org/project/tree-sitter-analyzer/)
|
|
144
|
+
[](https://github.com/aimasteracc/tree-sitter-analyzer)
|
|
145
|
+
|
|
146
|
+
## 🚀 Break Through LLM Token Limits, Let AI Understand Code Files of Any Size
|
|
147
|
+
|
|
148
|
+
> **A revolutionary code analysis tool designed for the AI era**
|
|
149
|
+
|
|
150
|
+
## 📋 Table of Contents
|
|
151
|
+
|
|
152
|
+
- [🚀 Break Through LLM Token Limits](#-break-through-llm-token-limits-let-ai-understand-code-files-of-any-size)
|
|
153
|
+
- [📋 Table of Contents](#-table-of-contents)
|
|
154
|
+
- [💡 What Makes This Special](#-what-makes-this-special)
|
|
155
|
+
- [📊 Live Demo & Results](#-live-demo--results)
|
|
156
|
+
- [🚀 30-Second Quick Start](#-30-second-quick-start)
|
|
157
|
+
- [🤖 For AI Users (Claude Desktop, Cursor, etc.)](#-for-ai-users-claude-desktop-cursor-etc)
|
|
158
|
+
- [💻 For Developers (CLI)](#-for-developers-cli)
|
|
159
|
+
- [❓ Why Choose Tree-sitter Analyzer](#-why-choose-tree-sitter-analyzer)
|
|
160
|
+
- [📖 Practical Usage Examples](#-practical-usage-examples)
|
|
161
|
+
- [🛠️ Core Features](#️-core-features)
|
|
162
|
+
- [📦 Installation Guide](#-installation-guide)
|
|
163
|
+
- [🔒 Security & Configuration](#-security--configuration)
|
|
164
|
+
- [🏆 Quality Assurance](#-quality-assurance)
|
|
165
|
+
- [🤖 AI Collaboration Support](#-ai-collaboration-support)
|
|
166
|
+
- [📚 Documentation](#-documentation)
|
|
167
|
+
- [🤝 Contributing](#-contributing)
|
|
168
|
+
- [📄 License](#-license)
|
|
169
|
+
|
|
170
|
+
## 💡 What Makes This Special
|
|
171
|
+
|
|
172
|
+
Imagine: You have a 1,400+ line Java service class that Claude or ChatGPT can't analyze due to token limits. Now, Tree-sitter Analyzer enables AI assistants to:
|
|
173
|
+
|
|
174
|
+
- ⚡ **Get complete code structure overview in 3 seconds**
|
|
175
|
+
- 🎯 **Precisely extract** any line range of code snippets
|
|
176
|
+
- 📍 **Smart positioning** exact locations of classes, methods, fields
|
|
177
|
+
- 🔗 **Seamless integration** with Claude Desktop, Cursor, Roo Code and other AI IDEs
|
|
178
|
+
|
|
179
|
+
**No more AI helplessness due to large files!**
|
|
180
|
+
|
|
181
|
+
## 📊 Live Demo & Results
|
|
182
|
+
|
|
183
|
+
### ⚡ **Lightning-Fast Analysis Speed**
|
|
184
|
+
```bash
|
|
185
|
+
# 1419-line large Java service class analysis result (< 1 second)
|
|
186
|
+
Lines: 1419 | Classes: 1 | Methods: 66 | Fields: 9 | Imports: 8
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### 📊 **Precise Structure Tables**
|
|
190
|
+
| Class Name | Type | Visibility | Line Range | Methods | Fields |
|
|
191
|
+
|------------|------|------------|------------|---------|--------|
|
|
192
|
+
| BigService | class | public | 17-1419 | 66 | 9 |
|
|
193
|
+
|
|
194
|
+
### 🔄 **AI Assistant Three-Step Workflow**
|
|
195
|
+
- **Step 1**: `check_code_scale` - Check file scale and complexity
|
|
196
|
+
- **Step 2**: `analyze_code_structure` - Generate detailed structure tables
|
|
197
|
+
- **Step 3**: `extract_code_section` - Extract code snippets on demand
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 🚀 30-Second Quick Start
|
|
202
|
+
|
|
203
|
+
### 🤖 For AI Users (Claude Desktop, Cursor, etc.)
|
|
204
|
+
|
|
205
|
+
**📦 1. One-Click Installation**
|
|
206
|
+
```bash
|
|
207
|
+
# macOS/Linux
|
|
208
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
209
|
+
|
|
210
|
+
# Windows PowerShell
|
|
211
|
+
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**⚙️ 2. Configure AI Client**
|
|
215
|
+
|
|
216
|
+
**Claude Desktop Configuration:**
|
|
217
|
+
|
|
218
|
+
Add the following to your config file:
|
|
219
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
220
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
221
|
+
- **Linux**: `~/.config/claude/claude_desktop_config.json`
|
|
222
|
+
|
|
223
|
+
**Basic Configuration (Recommended):**
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"mcpServers": {
|
|
227
|
+
"tree-sitter-analyzer": {
|
|
228
|
+
"command": "uv",
|
|
229
|
+
"args": [
|
|
230
|
+
"run", "--with", "tree-sitter-analyzer[mcp]",
|
|
231
|
+
"python", "-m", "tree_sitter_analyzer.mcp.server"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Advanced Configuration (Specify Project Root):**
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"mcpServers": {
|
|
242
|
+
"tree-sitter-analyzer": {
|
|
243
|
+
"command": "uv",
|
|
244
|
+
"args": [
|
|
245
|
+
"run", "--with", "tree-sitter-analyzer[mcp]",
|
|
246
|
+
"python", "-m", "tree_sitter_analyzer.mcp.server"
|
|
247
|
+
],
|
|
248
|
+
"env": {
|
|
249
|
+
"TREE_SITTER_PROJECT_ROOT": "/absolute/path/to/your/project"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Other AI Clients:**
|
|
257
|
+
- **Cursor**: Built-in MCP support, refer to Cursor documentation for configuration
|
|
258
|
+
- **Roo Code**: Supports MCP protocol, check respective configuration guides
|
|
259
|
+
- **Other MCP-compatible clients**: Use the same server configuration
|
|
260
|
+
|
|
261
|
+
**⚠️ Configuration Notes:**
|
|
262
|
+
- **Basic Configuration**: Tool will auto-detect project root (recommended)
|
|
263
|
+
- **Advanced Configuration**: If you need to specify a particular directory, use absolute path to replace `/absolute/path/to/your/project`
|
|
264
|
+
- **Avoid using**: Variables like `${workspaceFolder}` may not be supported in some clients
|
|
265
|
+
|
|
266
|
+
**🎉 3. Restart AI client and start analyzing massive code files!**
|
|
267
|
+
|
|
268
|
+
### 💻 For Developers (CLI)
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Install
|
|
272
|
+
uv add "tree-sitter-analyzer[popular]"
|
|
273
|
+
|
|
274
|
+
# Check file scale (1419-line large service class, instant completion)
|
|
275
|
+
uv run python -m tree_sitter_analyzer examples/BigService.java --advanced --output-format=text
|
|
276
|
+
|
|
277
|
+
# Generate structure table (1 class, 66 methods, clearly displayed)
|
|
278
|
+
uv run python -m tree_sitter_analyzer examples/BigService.java --table=full
|
|
279
|
+
|
|
280
|
+
# Precise code extraction
|
|
281
|
+
uv run python -m tree_sitter_analyzer examples/BigService.java --partial-read --start-line 100 --end-line 105
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## ❓ Why Choose Tree-sitter Analyzer
|
|
287
|
+
|
|
288
|
+
### 🎯 Solving Real Pain Points
|
|
289
|
+
|
|
290
|
+
**Traditional Approach Dilemmas:**
|
|
291
|
+
- ❌ Large files exceed LLM token limits
|
|
292
|
+
- ❌ AI cannot understand code structure
|
|
293
|
+
- ❌ Manual file splitting required
|
|
294
|
+
- ❌ Context loss leads to inaccurate analysis
|
|
295
|
+
|
|
296
|
+
**Tree-sitter Analyzer's Breakthrough:**
|
|
297
|
+
- ✅ **Smart Analysis**: Understand structure without reading complete files
|
|
298
|
+
- ✅ **Precise Positioning**: Accurate line-by-line code extraction
|
|
299
|
+
- ✅ **AI Native**: Optimized for LLM workflows
|
|
300
|
+
- ✅ **Multi-language Support**: Java, Python, JavaScript/TypeScript, etc.
|
|
301
|
+
|
|
302
|
+
## 📖 Practical Usage Examples
|
|
303
|
+
|
|
304
|
+
### 💬 AI IDE Prompts (Copy and Use)
|
|
305
|
+
|
|
306
|
+
#### 🔍 **Step 1: Check File Scale**
|
|
307
|
+
|
|
308
|
+
**Prompt:**
|
|
309
|
+
```
|
|
310
|
+
Use MCP tool check_code_scale to analyze file scale
|
|
311
|
+
Parameters: {"file_path": "examples/BigService.java"}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Return Format:**
|
|
315
|
+
```json
|
|
316
|
+
{
|
|
317
|
+
"file_path": "examples/BigService.java",
|
|
318
|
+
"language": "java",
|
|
319
|
+
"metrics": {
|
|
320
|
+
"lines_total": 1419,
|
|
321
|
+
"lines_code": 1419,
|
|
322
|
+
"elements": {
|
|
323
|
+
"classes": 1,
|
|
324
|
+
"methods": 66,
|
|
325
|
+
"fields": 9
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
#### 📊 **Step 2: Generate Structure Table**
|
|
332
|
+
|
|
333
|
+
**Prompt:**
|
|
334
|
+
```
|
|
335
|
+
Use MCP tool analyze_code_structure to generate detailed structure
|
|
336
|
+
Parameters: {"file_path": "examples/BigService.java"}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Return Format:**
|
|
340
|
+
- Complete Markdown table
|
|
341
|
+
- Including class info, method list (with line numbers), field list
|
|
342
|
+
- Method signatures, visibility, line ranges, complexity and other detailed information
|
|
343
|
+
|
|
344
|
+
#### ✂️ **Step 3: Extract Code Snippets**
|
|
345
|
+
|
|
346
|
+
**Prompt:**
|
|
347
|
+
```
|
|
348
|
+
Use MCP tool extract_code_section to extract specified code section
|
|
349
|
+
Parameters: {"file_path": "examples/BigService.java", "start_line": 100, "end_line": 105}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Return Format:**
|
|
353
|
+
```json
|
|
354
|
+
{
|
|
355
|
+
"file_path": "examples/BigService.java",
|
|
356
|
+
"range": {"start_line": 100, "end_line": 105},
|
|
357
|
+
"content": "Actual code content...",
|
|
358
|
+
"content_length": 245
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### 💡 **Important Notes**
|
|
363
|
+
- **Parameter Format**: Use snake_case (`file_path`, `start_line`, `end_line`)
|
|
364
|
+
- **Path Handling**: Relative paths auto-resolve to project root
|
|
365
|
+
- **Security Protection**: Tool automatically performs project boundary checks
|
|
366
|
+
- **Workflow**: Recommended to use in order: Step 1 → 2 → 3
|
|
367
|
+
|
|
368
|
+
### 🛠️ CLI Command Examples
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# Quick analysis (1419-line large file, instant completion)
|
|
372
|
+
uv run python -m tree_sitter_analyzer examples/BigService.java --advanced --output-format=text
|
|
373
|
+
|
|
374
|
+
# Detailed structure table (66 methods clearly displayed)
|
|
375
|
+
uv run python -m tree_sitter_analyzer examples/BigService.java --table=full
|
|
376
|
+
|
|
377
|
+
# Precise code extraction (memory usage monitoring code snippet)
|
|
378
|
+
uv run python -m tree_sitter_analyzer examples/BigService.java --partial-read --start-line 100 --end-line 105
|
|
379
|
+
|
|
380
|
+
# Silent mode (display results only)
|
|
381
|
+
uv run python -m tree_sitter_analyzer examples/BigService.java --table=full --quiet
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## 🛠️ Core Features
|
|
387
|
+
|
|
388
|
+
### 📊 **Code Structure Analysis**
|
|
389
|
+
Get insights without reading complete files:
|
|
390
|
+
- Class, method, field statistics
|
|
391
|
+
- Package information and import dependencies
|
|
392
|
+
- Complexity metrics
|
|
393
|
+
- Precise line number positioning
|
|
394
|
+
|
|
395
|
+
### ✂️ **Smart Code Extraction**
|
|
396
|
+
- Extract by line range precisely
|
|
397
|
+
- Maintain original formatting and indentation
|
|
398
|
+
- Include position metadata
|
|
399
|
+
- Support efficient processing of large files
|
|
400
|
+
|
|
401
|
+
### 🔗 **AI Assistant Integration**
|
|
402
|
+
Deep integration via MCP protocol:
|
|
403
|
+
- Claude Desktop
|
|
404
|
+
- Cursor IDE
|
|
405
|
+
- Roo Code
|
|
406
|
+
- Other MCP-supporting AI tools
|
|
407
|
+
|
|
408
|
+
### 🌍 **Multi-Language Support**
|
|
409
|
+
- **Java** - Full support, including Spring, JPA frameworks
|
|
410
|
+
- **Python** - Complete support, including type annotations, decorators
|
|
411
|
+
- **JavaScript/TypeScript** - Full support, including ES6+ features
|
|
412
|
+
- **C/C++, Rust, Go** - Basic support
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## 📦 Installation Guide
|
|
417
|
+
|
|
418
|
+
### 👤 **End Users**
|
|
419
|
+
```bash
|
|
420
|
+
# Basic installation
|
|
421
|
+
uv add tree-sitter-analyzer
|
|
422
|
+
|
|
423
|
+
# Popular languages package (recommended)
|
|
424
|
+
uv add "tree-sitter-analyzer[popular]"
|
|
425
|
+
|
|
426
|
+
# MCP server support
|
|
427
|
+
uv add "tree-sitter-analyzer[mcp]"
|
|
428
|
+
|
|
429
|
+
# Full installation
|
|
430
|
+
uv add "tree-sitter-analyzer[all,mcp]"
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### 👨💻 **Developers**
|
|
434
|
+
```bash
|
|
435
|
+
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
|
|
436
|
+
cd tree-sitter-analyzer
|
|
437
|
+
uv sync --extra all --extra mcp
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## 🔒 Security & Configuration
|
|
443
|
+
|
|
444
|
+
### 🛡️ **Project Boundary Protection**
|
|
445
|
+
|
|
446
|
+
Tree-sitter Analyzer automatically detects and protects project boundaries:
|
|
447
|
+
|
|
448
|
+
- **Auto-detection**: Based on `.git`, `pyproject.toml`, `package.json`, etc.
|
|
449
|
+
- **CLI Control**: `--project-root /path/to/project`
|
|
450
|
+
- **MCP Integration**: `TREE_SITTER_PROJECT_ROOT=/path/to/project` or use auto-detection
|
|
451
|
+
- **Security Guarantee**: Only analyze files within project boundaries
|
|
452
|
+
|
|
453
|
+
**Recommended MCP Configuration:**
|
|
454
|
+
|
|
455
|
+
**Option 1: Auto-detection (Recommended)**
|
|
456
|
+
```json
|
|
457
|
+
{
|
|
458
|
+
"mcpServers": {
|
|
459
|
+
"tree-sitter-analyzer": {
|
|
460
|
+
"command": "uv",
|
|
461
|
+
"args": ["run", "--with", "tree-sitter-analyzer[mcp]", "python", "-m", "tree_sitter_analyzer.mcp.server"]
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**Option 2: Manual Project Root Specification**
|
|
468
|
+
```json
|
|
469
|
+
{
|
|
470
|
+
"mcpServers": {
|
|
471
|
+
"tree-sitter-analyzer": {
|
|
472
|
+
"command": "uv",
|
|
473
|
+
"args": ["run", "--with", "tree-sitter-analyzer[mcp]", "python", "-m", "tree_sitter_analyzer.mcp.server"],
|
|
474
|
+
"env": {"TREE_SITTER_PROJECT_ROOT": "/path/to/your/project"}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## 🏆 Quality Assurance
|
|
483
|
+
|
|
484
|
+
### 📊 **Quality Metrics**
|
|
485
|
+
- **1,358 Tests** - 100% pass rate ✅
|
|
486
|
+
- **74.54% Code Coverage** - Industry-leading level
|
|
487
|
+
- **Zero Test Failures** - Complete CI/CD ready
|
|
488
|
+
- **Cross-platform Compatible** - Windows, macOS, Linux
|
|
489
|
+
|
|
490
|
+
### ⚡ **Latest Quality Achievements (v0.9.4)**
|
|
491
|
+
- ✅ **Test Suite Completely Stable** - Fixed all historical issues
|
|
492
|
+
- ✅ **Formatter Module Breakthrough** - Coverage significantly improved
|
|
493
|
+
- ✅ **Error Handling Optimization** - Enterprise-grade exception handling
|
|
494
|
+
- ✅ **100+ New Comprehensive Tests** - Covering critical modules
|
|
495
|
+
|
|
496
|
+
### ⚙️ **Running Tests**
|
|
497
|
+
```bash
|
|
498
|
+
# Run all tests
|
|
499
|
+
uv run pytest tests/ -v
|
|
500
|
+
|
|
501
|
+
# Generate coverage report
|
|
502
|
+
uv run pytest tests/ --cov=tree_sitter_analyzer --cov-report=html
|
|
503
|
+
|
|
504
|
+
# Run specific tests
|
|
505
|
+
uv run pytest tests/test_mcp_server_initialization.py -v
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### 📈 **Coverage Highlights**
|
|
509
|
+
- **Language Detector**: 98.41% (Excellent)
|
|
510
|
+
- **CLI Main Entry**: 97.78% (Excellent)
|
|
511
|
+
- **Error Handling**: 82.76% (Good)
|
|
512
|
+
- **Security Framework**: 78%+ (Reliable)
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
## 🤖 AI Collaboration Support
|
|
517
|
+
|
|
518
|
+
### ⚡ **Optimized for AI Development**
|
|
519
|
+
|
|
520
|
+
This project supports AI-assisted development with specialized quality controls:
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
# AI system pre-code generation checks
|
|
524
|
+
uv run python check_quality.py --new-code-only
|
|
525
|
+
uv run python llm_code_checker.py --check-all
|
|
526
|
+
|
|
527
|
+
# AI-generated code review
|
|
528
|
+
uv run python llm_code_checker.py path/to/new_file.py
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
📖 **Detailed Guides**:
|
|
532
|
+
- [AI Collaboration Guide](AI_COLLABORATION_GUIDE.md)
|
|
533
|
+
- [LLM Coding Guidelines](LLM_CODING_GUIDELINES.md)
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## 📚 Documentation
|
|
538
|
+
|
|
539
|
+
- **[User MCP Setup Guide](MCP_SETUP_USERS.md)** - Simple configuration guide
|
|
540
|
+
- **[Developer MCP Setup Guide](MCP_SETUP_DEVELOPERS.md)** - Local development configuration
|
|
541
|
+
- **[Project Root Configuration](PROJECT_ROOT_CONFIG.md)** - Complete configuration reference
|
|
542
|
+
- **[API Documentation](docs/api.md)** - Detailed API reference
|
|
543
|
+
- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## 🤝 Contributing
|
|
548
|
+
|
|
549
|
+
We welcome all forms of contributions! Please check the [Contributing Guide](CONTRIBUTING.md) for details.
|
|
550
|
+
|
|
551
|
+
### ⭐ **Give Us a Star!**
|
|
552
|
+
|
|
553
|
+
If this project helps you, please give us a ⭐ on GitHub - it's the greatest support for us!
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## 📄 License
|
|
558
|
+
|
|
559
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
**🎯 Built for developers dealing with large codebases and AI assistants**
|
|
564
|
+
|
|
565
|
+
*Let every line of code be understood by AI, let every project break through token limits*
|
|
566
|
+
|
|
567
|
+
**🚀 Start Now** → [30-Second Quick Start](#-30-second-quick-start)
|
|
@@ -2,7 +2,7 @@ tree_sitter_analyzer/__init__.py,sha256=ElX-1qL0OI5EuUf2XVkdqvLuWwRgTVYDGDnyeuLU
|
|
|
2
2
|
tree_sitter_analyzer/__main__.py,sha256=Zl79tpe4UaMu-7yeztc06tgP0CVMRnvGgas4ZQP5SCs,228
|
|
3
3
|
tree_sitter_analyzer/api.py,sha256=naRtGuZ27AIVfn6Rid0zQcHDI71UpO9Nh4NQM9JyD3c,16954
|
|
4
4
|
tree_sitter_analyzer/cli_main.py,sha256=R03sPnWD_39u1wxpr7nd97EHe8jlp2npViiPbfm_cHo,9644
|
|
5
|
-
tree_sitter_analyzer/encoding_utils.py,sha256=
|
|
5
|
+
tree_sitter_analyzer/encoding_utils.py,sha256=NHkqOt7GdrxgMsd3k0rVxSO0mWJZXODw3uwl2Qk9ufc,14803
|
|
6
6
|
tree_sitter_analyzer/exceptions.py,sha256=AZryCQyKXekAg8lQZd3zqULnjhCKovBNNpnUlNGDhcI,11615
|
|
7
7
|
tree_sitter_analyzer/file_handler.py,sha256=nUD17QIdOJ2bnXekuo-QzGQFv0f2rxCSJi-zWeQFSAs,6636
|
|
8
8
|
tree_sitter_analyzer/language_detector.py,sha256=pn3nQClo8b_Ar8dS5X3hq9_t5IIlIcizIC0twMaowU4,11693
|
|
@@ -11,8 +11,8 @@ tree_sitter_analyzer/models.py,sha256=SrPxiRvlcH0uyOao47tzK-rVqK82JkmmxdU6yJlucS
|
|
|
11
11
|
tree_sitter_analyzer/output_manager.py,sha256=saZ8Ss6PhUJgjjwviLgrePFL7CCLMixxdKtdrpuFgHM,8146
|
|
12
12
|
tree_sitter_analyzer/project_detector.py,sha256=VdZTnY25M2fJTA3MLUzPIjXJtOCPATKlkshEF3eUV7U,9444
|
|
13
13
|
tree_sitter_analyzer/query_loader.py,sha256=jcJc6_kIMeZINfTVGuiEmDii9LViP_pbJfg4A9phJY4,9863
|
|
14
|
-
tree_sitter_analyzer/table_formatter.py,sha256=
|
|
15
|
-
tree_sitter_analyzer/utils.py,sha256=
|
|
14
|
+
tree_sitter_analyzer/table_formatter.py,sha256=Pcow5vNQtX4lTgdQ-DaNd5Wc2xnWwv7KkjNxnfZPxAQ,27551
|
|
15
|
+
tree_sitter_analyzer/utils.py,sha256=3TvlQpzOiuesRI_HD0C-BON4NKvvC8yhutV2ssjWmwo,10753
|
|
16
16
|
tree_sitter_analyzer/cli/__init__.py,sha256=O_3URpbdu5Ilb2-r48LjbZuWtOWQu_BhL3pa6C0G3Bk,871
|
|
17
17
|
tree_sitter_analyzer/cli/__main__.py,sha256=Xq8o8-0dPnMDU9WZqmqhzr98rx8rvoffTUHAkAwl-L8,218
|
|
18
18
|
tree_sitter_analyzer/cli/info_commands.py,sha256=Eev5iG9upn9id1nE2W7Z6-Q5s-o2pDDnMvoyZxh8nmg,4284
|
|
@@ -68,10 +68,10 @@ tree_sitter_analyzer/queries/javascript.py,sha256=pnXrgISwDE5GhPHDbUKEGI3thyLmeb
|
|
|
68
68
|
tree_sitter_analyzer/queries/python.py,sha256=L33KRUyV3sAvA3_HFkPyGgtiq0ygSpNY_n2YojodPlc,7570
|
|
69
69
|
tree_sitter_analyzer/queries/typescript.py,sha256=eersyAF7TladuCWa8WE_-cO9YTF1LUSjLIl-tk2fZDo,6708
|
|
70
70
|
tree_sitter_analyzer/security/__init__.py,sha256=ZTqTt24hsljCpTXAZpJC57L7MU5lJLTf_XnlvEzXwEE,623
|
|
71
|
-
tree_sitter_analyzer/security/boundary_manager.py,sha256=
|
|
71
|
+
tree_sitter_analyzer/security/boundary_manager.py,sha256=CUQWU5j1zdjEbN9UmArcYkq9HbemhttQzk0pVk-vxZs,8153
|
|
72
72
|
tree_sitter_analyzer/security/regex_checker.py,sha256=jWK6H8PTPgzbwRPfK_RZ8bBTS6rtEbgjY5vr3YWjQ_U,9616
|
|
73
73
|
tree_sitter_analyzer/security/validator.py,sha256=UPAPcrnmI2mNzbYOm0MabnJMGllK6HlOQ9KX-2bRfgU,8986
|
|
74
|
-
tree_sitter_analyzer-0.9.
|
|
75
|
-
tree_sitter_analyzer-0.9.
|
|
76
|
-
tree_sitter_analyzer-0.9.
|
|
77
|
-
tree_sitter_analyzer-0.9.
|
|
74
|
+
tree_sitter_analyzer-0.9.5.dist-info/METADATA,sha256=j7tFOFQLvwciwHpyidLtuy4t8oKp_rkhLuKWgBMzgg8,20191
|
|
75
|
+
tree_sitter_analyzer-0.9.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
76
|
+
tree_sitter_analyzer-0.9.5.dist-info/entry_points.txt,sha256=U4tfLGXgCWubKm2PyEb3zxhQ2pm7zVotMyfyS0CodD8,486
|
|
77
|
+
tree_sitter_analyzer-0.9.5.dist-info/RECORD,,
|
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tree-sitter-analyzer
|
|
3
|
-
Version: 0.9.4
|
|
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.23.4
|
|
38
|
-
Requires-Dist: tree-sitter-java>=0.23.5
|
|
39
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1
|
|
40
|
-
Requires-Dist: tree-sitter-python>=0.23.6
|
|
41
|
-
Requires-Dist: tree-sitter==0.24.0
|
|
42
|
-
Provides-Extra: all-languages
|
|
43
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'all-languages'
|
|
44
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'all-languages'
|
|
45
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'all-languages'
|
|
46
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'all-languages'
|
|
47
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'all-languages'
|
|
48
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'all-languages'
|
|
49
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'all-languages'
|
|
50
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'all-languages'
|
|
51
|
-
Provides-Extra: c
|
|
52
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'c'
|
|
53
|
-
Provides-Extra: cpp
|
|
54
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'cpp'
|
|
55
|
-
Provides-Extra: dev
|
|
56
|
-
Requires-Dist: black>=24.0.0; extra == 'dev'
|
|
57
|
-
Requires-Dist: isort>=5.13.0; extra == 'dev'
|
|
58
|
-
Requires-Dist: memory-profiler>=0.61.0; extra == 'dev'
|
|
59
|
-
Requires-Dist: mypy>=1.17.0; extra == 'dev'
|
|
60
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
61
|
-
Requires-Dist: psutil<6,>=5.9.6; extra == 'dev'
|
|
62
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'dev'
|
|
63
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
64
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'dev'
|
|
65
|
-
Requires-Dist: pytest>=8.4.1; extra == 'dev'
|
|
66
|
-
Requires-Dist: ruff>=0.5.0; extra == 'dev'
|
|
67
|
-
Requires-Dist: types-psutil>=5.9.0; extra == 'dev'
|
|
68
|
-
Provides-Extra: full
|
|
69
|
-
Requires-Dist: anyio>=4.0.0; extra == 'full'
|
|
70
|
-
Requires-Dist: black>=24.0.0; extra == 'full'
|
|
71
|
-
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'full'
|
|
72
|
-
Requires-Dist: isort>=5.13.0; extra == 'full'
|
|
73
|
-
Requires-Dist: mcp>=1.12.2; extra == 'full'
|
|
74
|
-
Requires-Dist: memory-profiler>=0.61.0; extra == 'full'
|
|
75
|
-
Requires-Dist: mypy>=1.17.0; extra == 'full'
|
|
76
|
-
Requires-Dist: pre-commit>=3.0.0; extra == 'full'
|
|
77
|
-
Requires-Dist: psutil<6,>=5.9.6; extra == 'full'
|
|
78
|
-
Requires-Dist: pydantic-settings>=2.2.1; extra == 'full'
|
|
79
|
-
Requires-Dist: pydantic>=2.5.0; extra == 'full'
|
|
80
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'full'
|
|
81
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'full'
|
|
82
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'full'
|
|
83
|
-
Requires-Dist: pytest>=8.4.1; extra == 'full'
|
|
84
|
-
Requires-Dist: ruff>=0.5.0; extra == 'full'
|
|
85
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'full'
|
|
86
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'full'
|
|
87
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'full'
|
|
88
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'full'
|
|
89
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'full'
|
|
90
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'full'
|
|
91
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'full'
|
|
92
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'full'
|
|
93
|
-
Requires-Dist: types-psutil>=5.9.0; extra == 'full'
|
|
94
|
-
Provides-Extra: go
|
|
95
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'go'
|
|
96
|
-
Provides-Extra: java
|
|
97
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'java'
|
|
98
|
-
Provides-Extra: javascript
|
|
99
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'javascript'
|
|
100
|
-
Provides-Extra: mcp
|
|
101
|
-
Requires-Dist: anyio>=4.0.0; extra == 'mcp'
|
|
102
|
-
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'mcp'
|
|
103
|
-
Requires-Dist: mcp>=1.12.2; extra == 'mcp'
|
|
104
|
-
Requires-Dist: pydantic-settings>=2.2.1; extra == 'mcp'
|
|
105
|
-
Requires-Dist: pydantic>=2.5.0; extra == 'mcp'
|
|
106
|
-
Provides-Extra: popular
|
|
107
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'popular'
|
|
108
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'popular'
|
|
109
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'popular'
|
|
110
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'popular'
|
|
111
|
-
Provides-Extra: python
|
|
112
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'python'
|
|
113
|
-
Provides-Extra: rust
|
|
114
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'rust'
|
|
115
|
-
Provides-Extra: systems
|
|
116
|
-
Requires-Dist: tree-sitter-c>=0.20.0; extra == 'systems'
|
|
117
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'systems'
|
|
118
|
-
Requires-Dist: tree-sitter-go>=0.20.0; extra == 'systems'
|
|
119
|
-
Requires-Dist: tree-sitter-rust>=0.20.0; extra == 'systems'
|
|
120
|
-
Provides-Extra: test
|
|
121
|
-
Requires-Dist: pytest-asyncio>=1.1.0; extra == 'test'
|
|
122
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
123
|
-
Requires-Dist: pytest-mock>=3.14.1; extra == 'test'
|
|
124
|
-
Requires-Dist: pytest>=8.4.1; extra == 'test'
|
|
125
|
-
Requires-Dist: tree-sitter-cpp>=0.23.4; extra == 'test'
|
|
126
|
-
Requires-Dist: tree-sitter-java>=0.23.5; extra == 'test'
|
|
127
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'test'
|
|
128
|
-
Requires-Dist: tree-sitter-python>=0.23.0; extra == 'test'
|
|
129
|
-
Provides-Extra: typescript
|
|
130
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'typescript'
|
|
131
|
-
Provides-Extra: web
|
|
132
|
-
Requires-Dist: tree-sitter-javascript>=0.23.1; extra == 'web'
|
|
133
|
-
Requires-Dist: tree-sitter-typescript>=0.20.0; extra == 'web'
|
|
134
|
-
Description-Content-Type: text/markdown
|
|
135
|
-
|
|
136
|
-
# Tree-sitter Analyzer
|
|
137
|
-
|
|
138
|
-
[](https://python.org)
|
|
139
|
-
[](LICENSE)
|
|
140
|
-
[](#testing)
|
|
141
|
-
[](#testing)
|
|
142
|
-
[](#quality)
|
|
143
|
-
|
|
144
|
-
**Solve the LLM token limit problem for large code files.**
|
|
145
|
-
|
|
146
|
-
An extensible multi-language code analyzer that helps AI assistants understand code structure without reading entire files. Get code overview, extract specific sections, and analyze complexity - all optimized for LLM workflows.
|
|
147
|
-
|
|
148
|
-
## ✨ Why Tree-sitter Analyzer?
|
|
149
|
-
|
|
150
|
-
**The Problem:** Large code files exceed LLM token limits, making code analysis inefficient or impossible.
|
|
151
|
-
|
|
152
|
-
**The Solution:** Smart code analysis that provides:
|
|
153
|
-
- 📊 **Code overview** without reading complete files
|
|
154
|
-
- 🎯 **Targeted extraction** of specific line ranges
|
|
155
|
-
- 📍 **Precise positioning** for accurate code operations
|
|
156
|
-
- 🤖 **AI assistant integration** via MCP protocol
|
|
157
|
-
|
|
158
|
-
## 🚀 Quick Start (5 minutes)
|
|
159
|
-
|
|
160
|
-
### For AI Assistant Users (Claude Desktop)
|
|
161
|
-
|
|
162
|
-
1. **Install the package:**
|
|
163
|
-
```bash
|
|
164
|
-
# Install uv (fast Python package manager)
|
|
165
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS/Linux
|
|
166
|
-
# or: powershell -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows
|
|
167
|
-
|
|
168
|
-
# No need to install the package separately - uv handles it
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
2. **Configure Claude Desktop:**
|
|
172
|
-
|
|
173
|
-
Add to your Claude Desktop config file:
|
|
174
|
-
|
|
175
|
-
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
176
|
-
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
177
|
-
**Linux:** `~/.config/claude/claude_desktop_config.json`
|
|
178
|
-
|
|
179
|
-
```json
|
|
180
|
-
{
|
|
181
|
-
"mcpServers": {
|
|
182
|
-
"tree-sitter-analyzer": {
|
|
183
|
-
"command": "uv",
|
|
184
|
-
"args": [
|
|
185
|
-
"run",
|
|
186
|
-
"--with",
|
|
187
|
-
"tree-sitter-analyzer[mcp]",
|
|
188
|
-
"python",
|
|
189
|
-
"-m",
|
|
190
|
-
"tree_sitter_analyzer.mcp.server"
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
3. **Restart Claude Desktop** and start analyzing code!
|
|
198
|
-
|
|
199
|
-
### For CLI Users
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
# Install with uv (recommended)
|
|
203
|
-
uv add "tree-sitter-analyzer[popular]"
|
|
204
|
-
|
|
205
|
-
# Step 1: Check file scale
|
|
206
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text
|
|
207
|
-
|
|
208
|
-
# Step 2: Analyze structure (for large files)
|
|
209
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --table=full
|
|
210
|
-
|
|
211
|
-
# Step 3: Extract specific lines
|
|
212
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
## 🛠️ Core Features
|
|
216
|
-
|
|
217
|
-
### 1. Code Structure Analysis
|
|
218
|
-
Get comprehensive overview without reading entire files:
|
|
219
|
-
- Classes, methods, fields count
|
|
220
|
-
- Package information
|
|
221
|
-
- Import dependencies
|
|
222
|
-
- Complexity metrics
|
|
223
|
-
|
|
224
|
-
### 2. Targeted Code Extraction
|
|
225
|
-
Extract specific code sections efficiently:
|
|
226
|
-
- Line range extraction
|
|
227
|
-
- Precise positioning data
|
|
228
|
-
- Content length information
|
|
229
|
-
|
|
230
|
-
### 3. AI Assistant Integration
|
|
231
|
-
Three-step workflow MCP tools for AI assistants:
|
|
232
|
-
- `check_code_scale` - **Step 1:** Get code metrics and complexity
|
|
233
|
-
- `analyze_code_structure` - **Step 2:** Generate detailed structure tables with line positions
|
|
234
|
-
- `extract_code_section` - **Step 3:** Extract specific code sections by line range
|
|
235
|
-
|
|
236
|
-
### 4. Multi-Language Support
|
|
237
|
-
- **Java** - Full support with advanced analysis
|
|
238
|
-
- **Python** - Complete support
|
|
239
|
-
- **JavaScript/TypeScript** - Full support
|
|
240
|
-
- **C/C++, Rust, Go** - Basic support
|
|
241
|
-
|
|
242
|
-
## 📖 Usage Examples
|
|
243
|
-
|
|
244
|
-
### AI Assistant Usage (via Claude Desktop)
|
|
245
|
-
|
|
246
|
-
**Step 1: Check code scale**
|
|
247
|
-
```
|
|
248
|
-
Use tool: check_code_scale
|
|
249
|
-
Parameters: {"file_path": "examples/Sample.java"}
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**Step 2: Analyze structure (for large files >100 lines)**
|
|
253
|
-
```
|
|
254
|
-
Use tool: analyze_code_structure
|
|
255
|
-
Parameters: {"file_path": "examples/Sample.java", "format_type": "full"}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
**Step 3: Extract specific code (using line positions from step 2)**
|
|
259
|
-
```
|
|
260
|
-
Use tool: extract_code_section
|
|
261
|
-
Parameters: {"file_path": "examples/Sample.java", "start_line": 84, "end_line": 86}
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
> **Note:** Always use snake_case parameter names: `file_path`, `start_line`, `end_line`, `format_type`
|
|
265
|
-
|
|
266
|
-
### CLI Usage
|
|
267
|
-
|
|
268
|
-
**Step 1: Basic analysis (Check file scale):**
|
|
269
|
-
```bash
|
|
270
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**Step 2: Structure analysis (For large files that exceed LLM limits):**
|
|
274
|
-
```bash
|
|
275
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --table=full
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
**Step 3: Targeted extraction (Read specific code sections):**
|
|
279
|
-
```bash
|
|
280
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
**Additional Options:**
|
|
284
|
-
```bash
|
|
285
|
-
# Quiet mode (suppress INFO messages, show only errors)
|
|
286
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text --quiet
|
|
287
|
-
|
|
288
|
-
# Table output with quiet mode
|
|
289
|
-
uv run python -m tree_sitter_analyzer examples/Sample.java --table=full --quiet
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
## 🔧 Installation Options
|
|
293
|
-
|
|
294
|
-
### For End Users
|
|
295
|
-
```bash
|
|
296
|
-
# Basic installation
|
|
297
|
-
uv add tree-sitter-analyzer
|
|
298
|
-
|
|
299
|
-
# With popular languages (Java, Python, JS, TS)
|
|
300
|
-
uv add "tree-sitter-analyzer[popular]"
|
|
301
|
-
|
|
302
|
-
# With MCP server support
|
|
303
|
-
uv add "tree-sitter-analyzer[mcp]"
|
|
304
|
-
|
|
305
|
-
# Full installation
|
|
306
|
-
uv add "tree-sitter-analyzer[all,mcp]"
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### For Developers
|
|
310
|
-
```bash
|
|
311
|
-
# Clone and install for development
|
|
312
|
-
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
|
|
313
|
-
cd tree-sitter-analyzer
|
|
314
|
-
uv sync --extra all --extra mcp
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## 📚 Documentation
|
|
318
|
-
|
|
319
|
-
- **[MCP Setup Guide for Users](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/MCP_SETUP_USERS.md)** - Simple setup for AI assistant users
|
|
320
|
-
- **[MCP Setup Guide for Developers](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/MCP_SETUP_DEVELOPERS.md)** - Local development configuration
|
|
321
|
-
- **[Project Root Configuration](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/PROJECT_ROOT_CONFIG.md)** - Complete configuration reference
|
|
322
|
-
- **[API Documentation](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/docs/api.md)** - Detailed API reference
|
|
323
|
-
- **[Contributing Guide](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/CONTRIBUTING.md)** - How to contribute
|
|
324
|
-
|
|
325
|
-
### 🔒 Project Root Configuration
|
|
326
|
-
|
|
327
|
-
Tree-sitter-analyzer automatically detects and secures your project boundaries:
|
|
328
|
-
|
|
329
|
-
- **Auto-detection**: Finds project root from `.git`, `pyproject.toml`, `package.json`, etc.
|
|
330
|
-
- **CLI**: Use `--project-root /path/to/project` for explicit control
|
|
331
|
-
- **MCP**: Set `TREE_SITTER_PROJECT_ROOT=${workspaceFolder}` for workspace integration
|
|
332
|
-
- **Security**: Only analyzes files within project boundaries
|
|
333
|
-
|
|
334
|
-
**Recommended MCP configuration:**
|
|
335
|
-
```json
|
|
336
|
-
{
|
|
337
|
-
"mcpServers": {
|
|
338
|
-
"tree-sitter-analyzer": {
|
|
339
|
-
"command": "uv",
|
|
340
|
-
"args": ["run", "--with", "tree-sitter-analyzer[mcp]", "python", "-m", "tree_sitter_analyzer.mcp.server"],
|
|
341
|
-
"env": {"TREE_SITTER_PROJECT_ROOT": "${workspaceFolder}"}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
## 🧪 Testing & Quality
|
|
348
|
-
|
|
349
|
-
This project maintains **enterprise-grade quality** with comprehensive testing:
|
|
350
|
-
|
|
351
|
-
### 📊 Quality Metrics
|
|
352
|
-
- **1358 tests** - 100% pass rate ✅
|
|
353
|
-
- **74.82% code coverage** - Industry standard quality
|
|
354
|
-
- **Zero test failures** - Complete CI/CD readiness
|
|
355
|
-
- **Cross-platform compatibility** - Windows, macOS, Linux
|
|
356
|
-
|
|
357
|
-
### 🏆 Recent Quality Achievements (v0.8.2)
|
|
358
|
-
- ✅ **Complete test suite stabilization** - Fixed all 31 failing tests
|
|
359
|
-
- ✅ **Formatters module breakthrough** - 0% → 42.30% coverage
|
|
360
|
-
- ✅ **Error handling improvements** - 61.64% → 82.76% coverage
|
|
361
|
-
- ✅ **104 new comprehensive tests** across critical modules
|
|
362
|
-
|
|
363
|
-
### 🔧 Running Tests
|
|
364
|
-
```bash
|
|
365
|
-
# Run all tests
|
|
366
|
-
pytest tests/ -v
|
|
367
|
-
|
|
368
|
-
# Run with coverage report
|
|
369
|
-
pytest tests/ --cov=tree_sitter_analyzer --cov-report=html
|
|
370
|
-
|
|
371
|
-
# Run specific test categories
|
|
372
|
-
pytest tests/test_formatters_comprehensive.py -v
|
|
373
|
-
pytest tests/test_core_engine_extended.py -v
|
|
374
|
-
pytest tests/test_mcp_server_initialization.py -v
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### 📈 Coverage Highlights
|
|
378
|
-
- **Formatters**: 42.30% (newly established)
|
|
379
|
-
- **Error Handler**: 82.76% (major improvement)
|
|
380
|
-
- **Language Detector**: 98.41% (excellent)
|
|
381
|
-
- **CLI Main**: 97.78% (excellent)
|
|
382
|
-
- **Security Framework**: 78%+ across all modules
|
|
383
|
-
|
|
384
|
-
## 📄 License
|
|
385
|
-
|
|
386
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
387
|
-
|
|
388
|
-
## 🤝 Contributing
|
|
389
|
-
|
|
390
|
-
We welcome contributions! Please see our [Contributing Guide](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/CONTRIBUTING.md) for details.
|
|
391
|
-
|
|
392
|
-
### 🤖 AI/LLM Collaboration
|
|
393
|
-
|
|
394
|
-
This project supports AI-assisted development with specialized quality controls:
|
|
395
|
-
|
|
396
|
-
```bash
|
|
397
|
-
# For AI systems - run before generating code
|
|
398
|
-
python check_quality.py --new-code-only
|
|
399
|
-
python llm_code_checker.py --check-all
|
|
400
|
-
|
|
401
|
-
# For AI-generated code review
|
|
402
|
-
python llm_code_checker.py path/to/new_file.py
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
📖 **See our [AI Collaboration Guide](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/AI_COLLABORATION_GUIDE.md) and [LLM Coding Guidelines](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/LLM_CODING_GUIDELINES.md) for detailed instructions on working with AI systems.**
|
|
406
|
-
|
|
407
|
-
---
|
|
408
|
-
|
|
409
|
-
**Made with ❤️ for developers who work with large codebases and AI assistants.**
|
|
File without changes
|
{tree_sitter_analyzer-0.9.4.dist-info → tree_sitter_analyzer-0.9.5.dist-info}/entry_points.txt
RENAMED
|
File without changes
|