tree-sitter-analyzer 1.8.3__py3-none-any.whl → 1.8.4__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 +66 -19
- {tree_sitter_analyzer-1.8.3.dist-info → tree_sitter_analyzer-1.8.4.dist-info}/METADATA +19 -5
- {tree_sitter_analyzer-1.8.3.dist-info → tree_sitter_analyzer-1.8.4.dist-info}/RECORD +6 -6
- {tree_sitter_analyzer-1.8.3.dist-info → tree_sitter_analyzer-1.8.4.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-1.8.3.dist-info → tree_sitter_analyzer-1.8.4.dist-info}/entry_points.txt +0 -0
tree_sitter_analyzer/__init__.py
CHANGED
tree_sitter_analyzer/utils.py
CHANGED
|
@@ -9,7 +9,9 @@ import atexit
|
|
|
9
9
|
import logging
|
|
10
10
|
import os
|
|
11
11
|
import sys
|
|
12
|
+
import tempfile
|
|
12
13
|
from functools import wraps
|
|
14
|
+
from pathlib import Path
|
|
13
15
|
from typing import Any
|
|
14
16
|
|
|
15
17
|
|
|
@@ -51,6 +53,10 @@ def setup_logger(
|
|
|
51
53
|
if name.startswith("test_"):
|
|
52
54
|
logger.handlers.clear()
|
|
53
55
|
|
|
56
|
+
# Initialize file logging variables at function scope
|
|
57
|
+
enable_file_log = os.environ.get("TREE_SITTER_ANALYZER_ENABLE_FILE_LOG", "").lower() == "true"
|
|
58
|
+
file_log_level = level # Default to main logger level
|
|
59
|
+
|
|
54
60
|
if not logger.handlers: # Avoid duplicate handlers
|
|
55
61
|
# Create a safe handler that writes to stderr to avoid breaking MCP stdio
|
|
56
62
|
handler = SafeStreamHandler()
|
|
@@ -60,27 +66,68 @@ def setup_logger(
|
|
|
60
66
|
handler.setFormatter(formatter)
|
|
61
67
|
logger.addHandler(handler)
|
|
62
68
|
|
|
63
|
-
#
|
|
69
|
+
# Optional file logging for debugging when launched by clients (e.g., Cursor)
|
|
64
70
|
# This helps diagnose cases where stdio is captured by the client and logs are hidden.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
# Only enabled when TREE_SITTER_ANALYZER_ENABLE_FILE_LOG is set to 'true'
|
|
72
|
+
if enable_file_log:
|
|
73
|
+
try:
|
|
74
|
+
# Determine log directory
|
|
75
|
+
log_dir = os.environ.get("TREE_SITTER_ANALYZER_LOG_DIR")
|
|
76
|
+
if log_dir:
|
|
77
|
+
# Use specified directory
|
|
78
|
+
log_path = Path(log_dir) / "tree_sitter_analyzer.log"
|
|
79
|
+
# Ensure directory exists
|
|
80
|
+
Path(log_dir).mkdir(parents=True, exist_ok=True)
|
|
81
|
+
else:
|
|
82
|
+
# Use system temporary directory
|
|
83
|
+
temp_dir = tempfile.gettempdir()
|
|
84
|
+
log_path = Path(temp_dir) / "tree_sitter_analyzer.log"
|
|
85
|
+
|
|
86
|
+
# Determine file log level
|
|
87
|
+
file_log_level_str = os.environ.get("TREE_SITTER_ANALYZER_FILE_LOG_LEVEL", "").upper()
|
|
88
|
+
if file_log_level_str and file_log_level_str in ["DEBUG", "INFO", "WARNING", "ERROR"]:
|
|
89
|
+
if file_log_level_str == "DEBUG":
|
|
90
|
+
file_log_level = logging.DEBUG
|
|
91
|
+
elif file_log_level_str == "INFO":
|
|
92
|
+
file_log_level = logging.INFO
|
|
93
|
+
elif file_log_level_str == "WARNING":
|
|
94
|
+
file_log_level = logging.WARNING
|
|
95
|
+
elif file_log_level_str == "ERROR":
|
|
96
|
+
file_log_level = logging.ERROR
|
|
97
|
+
else:
|
|
98
|
+
# Use same level as main logger
|
|
99
|
+
file_log_level = level
|
|
100
|
+
|
|
101
|
+
file_handler = logging.FileHandler(str(log_path), encoding="utf-8")
|
|
102
|
+
file_handler.setFormatter(formatter)
|
|
103
|
+
file_handler.setLevel(file_log_level)
|
|
104
|
+
logger.addHandler(file_handler)
|
|
105
|
+
|
|
106
|
+
# Log the file location for debugging purposes
|
|
107
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
108
|
+
try:
|
|
109
|
+
sys.stderr.write(f"[logging_setup] File logging enabled: {log_path}\n")
|
|
110
|
+
except Exception:
|
|
111
|
+
...
|
|
112
|
+
|
|
113
|
+
except Exception as e:
|
|
114
|
+
# Never let logging configuration break runtime behavior; log to stderr if possible
|
|
115
|
+
if hasattr(sys, "stderr") and hasattr(sys.stderr, "write"):
|
|
116
|
+
try:
|
|
117
|
+
sys.stderr.write(
|
|
118
|
+
f"[logging_setup] file handler init skipped: {e}\n"
|
|
119
|
+
)
|
|
120
|
+
except Exception:
|
|
121
|
+
...
|
|
80
122
|
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
|
|
123
|
+
# Set the logger level to the minimum of main level and file log level
|
|
124
|
+
# This ensures that all messages that should go to any handler are processed
|
|
125
|
+
final_level = level
|
|
126
|
+
if enable_file_log:
|
|
127
|
+
# Use the minimum level to ensure all messages reach their intended handlers
|
|
128
|
+
final_level = min(level, file_log_level)
|
|
129
|
+
|
|
130
|
+
logger.setLevel(final_level)
|
|
84
131
|
|
|
85
132
|
# For test loggers, ensure they don't inherit from parent and force level
|
|
86
133
|
if logger.name.startswith("test_"):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tree-sitter-analyzer
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.4
|
|
4
4
|
Summary: AI-era enterprise-grade code analysis tool with comprehensive HTML/CSS support, dynamic plugin architecture, and MCP integration
|
|
5
5
|
Project-URL: Homepage, https://github.com/aimasteracc/tree-sitter-analyzer
|
|
6
6
|
Project-URL: Documentation, https://github.com/aimasteracc/tree-sitter-analyzer#readme
|
|
@@ -198,11 +198,11 @@ Description-Content-Type: text/markdown
|
|
|
198
198
|
|
|
199
199
|
[](https://python.org)
|
|
200
200
|
[](LICENSE)
|
|
201
|
-
[](#quality-assurance)
|
|
202
202
|
[](https://codecov.io/gh/aimasteracc/tree-sitter-analyzer)
|
|
203
203
|
[](#quality-assurance)
|
|
204
204
|
[](https://pypi.org/project/tree-sitter-analyzer/)
|
|
205
|
-
[](https://github.com/aimasteracc/tree-sitter-analyzer/releases)
|
|
206
206
|
[](https://zread.ai/aimasteracc/tree-sitter-analyzer)
|
|
207
207
|
[](https://github.com/aimasteracc/tree-sitter-analyzer)
|
|
208
208
|
|
|
@@ -255,7 +255,7 @@ Tree-sitter Analyzer is an enterprise-grade code analysis tool designed for the
|
|
|
255
255
|
| **Go** | Basic Support | Basic syntax parsing |
|
|
256
256
|
|
|
257
257
|
### 🏆 Production Ready
|
|
258
|
-
- **3,
|
|
258
|
+
- **3,380 Tests** - 100% pass rate, enterprise-grade quality assurance
|
|
259
259
|
- **High Coverage** - Comprehensive test coverage
|
|
260
260
|
- **Cross-platform Support** - Compatible with Windows, macOS, Linux
|
|
261
261
|
- **Continuous Maintenance** - Active development and community support
|
|
@@ -373,6 +373,7 @@ rg --version
|
|
|
373
373
|
- **Roo Code**: Supports MCP protocol, use the same configuration format
|
|
374
374
|
- **Other MCP-compatible clients**: Use the same server configuration
|
|
375
375
|
|
|
376
|
+
|
|
376
377
|
---
|
|
377
378
|
|
|
378
379
|
### 3.2 💻 CLI Users (Command Line Tools)
|
|
@@ -640,6 +641,19 @@ Tree-sitter Analyzer provides a rich set of MCP tools designed for AI assistants
|
|
|
640
641
|
| **📁 Resource Access** | Code file resources | URI code file access | File content access via URI identification |
|
|
641
642
|
| | Project statistics resources | Project statistics data access | Project analysis data and statistical information |
|
|
642
643
|
|
|
644
|
+
### 🆕 v1.8.4 New Feature: Configurable File Logging
|
|
645
|
+
|
|
646
|
+
Revolutionary environment variable-controlled file logging system:
|
|
647
|
+
|
|
648
|
+
- **🔧 Environment Variable Control**: Flexible file logging behavior control through environment variables
|
|
649
|
+
- `TREE_SITTER_ANALYZER_ENABLE_FILE_LOG`: Enable/disable file logging
|
|
650
|
+
- `TREE_SITTER_ANALYZER_LOG_DIR`: Custom log directory path
|
|
651
|
+
- `TREE_SITTER_ANALYZER_FILE_LOG_LEVEL`: Control file log level
|
|
652
|
+
- **🛡️ Improved Default Behavior**: File logging disabled by default to prevent user project pollution
|
|
653
|
+
- **📁 Smart Directory Selection**: Uses system temp directory when enabled, keeping projects clean
|
|
654
|
+
- **🔄 Backward Compatibility**: Maintains all existing functionality unchanged
|
|
655
|
+
- **📚 Complete Documentation Support**: Includes debugging guides and troubleshooting documentation
|
|
656
|
+
|
|
643
657
|
### 🆕 v1.8.3 New Feature: MCP Tools Design Consistency Enhancement
|
|
644
658
|
|
|
645
659
|
Comprehensive MCP tools unification and design consistency improvements:
|
|
@@ -859,7 +873,7 @@ uv run python -m tree_sitter_analyzer --show-query-languages
|
|
|
859
873
|
## 8. 🏆 Quality Assurance
|
|
860
874
|
|
|
861
875
|
### 📊 Quality Metrics
|
|
862
|
-
- **3,
|
|
876
|
+
- **3,380 tests** - 100% pass rate ✅
|
|
863
877
|
- **High code coverage** - Comprehensive test suite
|
|
864
878
|
- **Zero test failures** - Production ready
|
|
865
879
|
- **Cross-platform support** - Windows, macOS, Linux
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
tree_sitter_analyzer/__init__.py,sha256=
|
|
1
|
+
tree_sitter_analyzer/__init__.py,sha256=Bg7okJtLa1BS4OaksNMVLvvdDXWbdWF0AKsoRp5aTig,3067
|
|
2
2
|
tree_sitter_analyzer/__main__.py,sha256=Zl79tpe4UaMu-7yeztc06tgP0CVMRnvGgas4ZQP5SCs,228
|
|
3
3
|
tree_sitter_analyzer/api.py,sha256=gqHatRpVm8k0jEfFm45iokHRPYJjEcud6MtrCSg1V0A,22169
|
|
4
4
|
tree_sitter_analyzer/cli_main.py,sha256=RAPn4VGHVOfC2vrU1Sef7PEPcypMwuI5GgWiwoYL1PE,11100
|
|
@@ -13,7 +13,7 @@ tree_sitter_analyzer/output_manager.py,sha256=hRAp6Aa9k05UVvZkOyRCEz2Lf7blx05fWn
|
|
|
13
13
|
tree_sitter_analyzer/project_detector.py,sha256=-zmtm12EvVD_6TDxS_6KpzuswP2Bpppnxq50kAEDyMA,9430
|
|
14
14
|
tree_sitter_analyzer/query_loader.py,sha256=rtUZ_ZBhacb2uvM8aPrf0XiigUDtxflfjbenfKcatEI,10407
|
|
15
15
|
tree_sitter_analyzer/table_formatter.py,sha256=tPKw77LLlQ7k5MMs9_Ez7qsSroNaSzZPoplyPtKHLhA,28577
|
|
16
|
-
tree_sitter_analyzer/utils.py,sha256=
|
|
16
|
+
tree_sitter_analyzer/utils.py,sha256=YN4n_XDJQAvcP2eKqYV7AzsZW1UMtks9O4BLR2youjs,16110
|
|
17
17
|
tree_sitter_analyzer/cli/__init__.py,sha256=O_3URpbdu5Ilb2-r48LjbZuWtOWQu_BhL3pa6C0G3Bk,871
|
|
18
18
|
tree_sitter_analyzer/cli/__main__.py,sha256=Xq8o8-0dPnMDU9WZqmqhzr98rx8rvoffTUHAkAwl-L8,218
|
|
19
19
|
tree_sitter_analyzer/cli/argument_validator.py,sha256=n336uNVWE9FFWc5s1ADKNQq53_BSnqdTtqEFk90UDBI,2574
|
|
@@ -103,7 +103,7 @@ tree_sitter_analyzer/security/regex_checker.py,sha256=jWK6H8PTPgzbwRPfK_RZ8bBTS6
|
|
|
103
103
|
tree_sitter_analyzer/security/validator.py,sha256=PJ2CxYANMi7Ot4rPq2sUgfEF0f7EXoS_3mWqEG4Y-8w,21966
|
|
104
104
|
tree_sitter_analyzer/utils/__init__.py,sha256=U2zLA7-80BE7NB9nV5coL2hdS-TPey22U4il9VkPfRA,3747
|
|
105
105
|
tree_sitter_analyzer/utils/tree_sitter_compat.py,sha256=9hvig3RQp_9H-YN1AWjW1Dl8fugYOPF-M8TRb41LMZU,10861
|
|
106
|
-
tree_sitter_analyzer-1.8.
|
|
107
|
-
tree_sitter_analyzer-1.8.
|
|
108
|
-
tree_sitter_analyzer-1.8.
|
|
109
|
-
tree_sitter_analyzer-1.8.
|
|
106
|
+
tree_sitter_analyzer-1.8.4.dist-info/METADATA,sha256=WWE_1AkppJ-PZ6PsD5aAa1jDwl7_vyPARYHEWSpduFA,49119
|
|
107
|
+
tree_sitter_analyzer-1.8.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
108
|
+
tree_sitter_analyzer-1.8.4.dist-info/entry_points.txt,sha256=TJmEXxAMz3og3VPphTHsuE8tNJxf7GuAPjNHwVhXRnc,972
|
|
109
|
+
tree_sitter_analyzer-1.8.4.dist-info/RECORD,,
|
|
File without changes
|
{tree_sitter_analyzer-1.8.3.dist-info → tree_sitter_analyzer-1.8.4.dist-info}/entry_points.txt
RENAMED
|
File without changes
|