tree-sitter-analyzer 0.8.0__tar.gz → 0.8.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tree-sitter-analyzer might be problematic. Click here for more details.

Files changed (111) hide show
  1. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/CHANGELOG.md +75 -0
  2. tree_sitter_analyzer-0.8.2/MCP_SETUP_DEVELOPERS.md +325 -0
  3. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/MCP_SETUP_USERS.md +48 -5
  4. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/PKG-INFO +57 -7
  5. tree_sitter_analyzer-0.8.2/PROJECT_ROOT_CONFIG.md +203 -0
  6. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/README.md +56 -6
  7. tree_sitter_analyzer-0.8.2/RELEASE_CHECKLIST_v0.8.2.md +182 -0
  8. tree_sitter_analyzer-0.8.2/RELEASE_NOTES_v0.8.2.md +181 -0
  9. tree_sitter_analyzer-0.8.2/examples/project_root_demo.py +247 -0
  10. tree_sitter_analyzer-0.8.2/examples/security_integration_demo.py +216 -0
  11. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/pyproject.toml +1 -1
  12. tree_sitter_analyzer-0.8.2/start_mcp_server.py +116 -0
  13. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/__init__.py +1 -1
  14. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/base_command.py +27 -9
  15. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/default_command.py +1 -1
  16. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/partial_read_command.py +7 -7
  17. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/query_command.py +11 -4
  18. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/table_command.py +1 -1
  19. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/info_commands.py +2 -2
  20. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli_main.py +13 -7
  21. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/core/analysis_engine.py +38 -13
  22. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/server.py +93 -13
  23. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +22 -3
  24. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/tools/read_partial_tool.py +10 -2
  25. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/tools/table_format_tool.py +20 -3
  26. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +18 -2
  27. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/utils/error_handler.py +18 -0
  28. tree_sitter_analyzer-0.8.2/tree_sitter_analyzer/project_detector.py +317 -0
  29. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/security/validator.py +24 -7
  30. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/uv.lock +1 -1
  31. tree_sitter_analyzer-0.8.0/MCP_SETUP_DEVELOPERS.md +0 -181
  32. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/.gitignore +0 -0
  33. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/.pre-commit-config.yaml +0 -0
  34. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/AI_COLLABORATION_GUIDE.md +0 -0
  35. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/CODE_STYLE_GUIDE.md +0 -0
  36. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/CONTRIBUTING.md +0 -0
  37. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/DEPLOYMENT_GUIDE.md +0 -0
  38. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/LLM_CODING_GUIDELINES.md +0 -0
  39. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/README_ja.md +0 -0
  40. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/README_zh.md +0 -0
  41. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/build_standalone.py +0 -0
  42. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/check_quality.py +0 -0
  43. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/docs/api.md +0 -0
  44. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/BigService.java +0 -0
  45. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/BigService.json +0 -0
  46. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/BigService.summary.json +0 -0
  47. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/JavaDocTest.java +0 -0
  48. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/MultiClass.java +0 -0
  49. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/Sample.java +0 -0
  50. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/calculate_token_comparison.py +0 -0
  51. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/sample.py +0 -0
  52. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/examples/security_demo.py +0 -0
  53. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/llm_code_checker.py +0 -0
  54. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/pytest.ini +0 -0
  55. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/__main__.py +0 -0
  56. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/api.py +0 -0
  57. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/__init__.py +0 -0
  58. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/__main__.py +0 -0
  59. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/__init__.py +0 -0
  60. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/advanced_command.py +0 -0
  61. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/structure_command.py +0 -0
  62. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/cli/commands/summary_command.py +0 -0
  63. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/core/__init__.py +0 -0
  64. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/core/cache_service.py +0 -0
  65. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/core/engine.py +0 -0
  66. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/core/parser.py +0 -0
  67. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/core/query.py +0 -0
  68. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/encoding_utils.py +0 -0
  69. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/exceptions.py +0 -0
  70. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/file_handler.py +0 -0
  71. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/formatters/__init__.py +0 -0
  72. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/formatters/base_formatter.py +0 -0
  73. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/formatters/formatter_factory.py +0 -0
  74. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/formatters/java_formatter.py +0 -0
  75. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/formatters/python_formatter.py +0 -0
  76. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/interfaces/__init__.py +0 -0
  77. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/interfaces/cli.py +0 -0
  78. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/interfaces/cli_adapter.py +0 -0
  79. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/interfaces/mcp_adapter.py +0 -0
  80. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/interfaces/mcp_server.py +0 -0
  81. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/language_detector.py +0 -0
  82. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/language_loader.py +0 -0
  83. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/languages/__init__.py +0 -0
  84. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/languages/java_plugin.py +0 -0
  85. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/languages/javascript_plugin.py +0 -0
  86. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/languages/python_plugin.py +0 -0
  87. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/__init__.py +0 -0
  88. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/resources/__init__.py +0 -0
  89. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/resources/code_file_resource.py +0 -0
  90. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/resources/project_stats_resource.py +0 -0
  91. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/tools/__init__.py +0 -0
  92. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +0 -0
  93. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/tools/base_tool.py +0 -0
  94. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/mcp/utils/__init__.py +0 -0
  95. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/models.py +0 -0
  96. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/output_manager.py +0 -0
  97. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/plugins/__init__.py +0 -0
  98. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/plugins/base.py +0 -0
  99. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/plugins/manager.py +0 -0
  100. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/queries/__init__.py +0 -0
  101. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/queries/java.py +0 -0
  102. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/queries/javascript.py +0 -0
  103. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/queries/python.py +0 -0
  104. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/queries/typescript.py +0 -0
  105. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/query_loader.py +0 -0
  106. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/security/__init__.py +0 -0
  107. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/security/boundary_manager.py +0 -0
  108. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/security/regex_checker.py +0 -0
  109. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/table_formatter.py +0 -0
  110. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/tree_sitter_analyzer/utils.py +0 -0
  111. {tree_sitter_analyzer-0.8.0 → tree_sitter_analyzer-0.8.2}/upload_to_pypi.py +0 -0
@@ -5,6 +5,81 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.2] - 2025-08-05
9
+
10
+ ### 🎯 Major Quality Improvements
11
+
12
+ #### 🏆 Complete Test Suite Stabilization
13
+ - **Fixed**: All 31 failing tests now pass - achieved **100% test success rate** (1358/1358 tests)
14
+ - **Fixed**: Windows file permission issues in temporary file handling
15
+ - **Fixed**: API signature mismatches in QueryExecutor test calls
16
+ - **Fixed**: Return format inconsistencies in ReadPartialTool tests
17
+ - **Fixed**: Exception type mismatches between error handler and test expectations
18
+ - **Fixed**: SecurityValidator method name discrepancies in component tests
19
+ - **Fixed**: Mock dependency path issues in engine configuration tests
20
+
21
+ #### 📊 Test Coverage Enhancements
22
+ - **Enhanced**: Formatters module coverage from **0%** to **42.30%** - complete breakthrough
23
+ - **Enhanced**: Error handler coverage from **61.64%** to **82.76%** (+21.12%)
24
+ - **Enhanced**: Overall project coverage from **71.97%** to **74.82%** (+2.85%)
25
+ - **Added**: 104 new comprehensive test cases across critical modules
26
+ - **Added**: Edge case testing for binary files, Unicode content, and large files
27
+ - **Added**: Performance and concurrency testing for core components
28
+
29
+ #### 🔧 Test Infrastructure Improvements
30
+ - **Improved**: Cross-platform compatibility with proper Windows file handling
31
+ - **Improved**: Systematic error classification and batch fixing methodology
32
+ - **Improved**: Test reliability with proper exception type imports
33
+ - **Improved**: Mock object configuration and dependency injection testing
34
+ - **Improved**: Temporary file lifecycle management across all test scenarios
35
+
36
+ #### 🧪 New Test Modules
37
+ - **Added**: `test_formatters_comprehensive.py` - Complete formatters testing (30 tests)
38
+ - **Added**: `test_core_engine_extended.py` - Extended engine edge case testing (14 tests)
39
+ - **Added**: `test_core_query_extended.py` - Query executor performance testing (13 tests)
40
+ - **Added**: `test_universal_analyze_tool_extended.py` - Tool robustness testing (17 tests)
41
+ - **Added**: `test_read_partial_tool_extended.py` - Partial reading comprehensive testing (19 tests)
42
+ - **Added**: `test_mcp_server_initialization.py` - Server startup validation (15 tests)
43
+ - **Added**: `test_error_handling_improvements.py` - Error handling verification (20 tests)
44
+
45
+ ### 🚀 Technical Achievements
46
+ - **Achievement**: Zero test failures - complete CI/CD readiness
47
+ - **Achievement**: Comprehensive formatters module testing foundation established
48
+ - **Achievement**: Cross-platform test compatibility ensured
49
+ - **Achievement**: Robust error handling validation implemented
50
+ - **Achievement**: Performance and stress testing coverage added
51
+
52
+ ### 📈 Quality Metrics
53
+ - **Metric**: 1358 total tests (100% pass rate)
54
+ - **Metric**: 74.82% code coverage (industry-standard quality)
55
+ - **Metric**: 6 error categories systematically resolved
56
+ - **Metric**: 5 test files comprehensively updated
57
+ - **Metric**: Zero breaking changes to existing functionality
58
+
59
+ ---
60
+
61
+ ## [0.8.1] - 2025-08-05
62
+
63
+ ### 🔧 Fixed
64
+ - **Fixed**: Eliminated duplicate "ERROR:" prefixes in error messages across all CLI commands
65
+ - **Fixed**: Updated all CLI tests to match unified error message format
66
+ - **Fixed**: Resolved missing `--project-root` parameters in comprehensive CLI tests
67
+ - **Fixed**: Corrected module import issues in language detection tests
68
+ - **Fixed**: Updated test expectations to match security validation behavior
69
+
70
+ ### 🧪 Testing Improvements
71
+ - **Enhanced**: Fixed 6 failing tests in `test_partial_read_command_validation.py`
72
+ - **Enhanced**: Fixed 6 failing tests in `test_cli_comprehensive.py` and Java structure analyzer tests
73
+ - **Enhanced**: Improved test stability and reliability across all CLI functionality
74
+ - **Enhanced**: Unified error message testing with consistent format expectations
75
+
76
+ ### 📦 Code Quality
77
+ - **Improved**: Centralized error message formatting in `output_manager.py`
78
+ - **Improved**: Consistent error handling architecture across all CLI commands
79
+ - **Improved**: Better separation of concerns between error content and formatting
80
+
81
+ ---
82
+
8
83
  ## [0.8.0] - 2025-08-04
9
84
 
10
85
  ### 🚀 Added
@@ -0,0 +1,325 @@
1
+ # MCP Setup Guide for Developers
2
+
3
+ **Local development setup for Tree-sitter Analyzer MCP server**
4
+
5
+ ## Prerequisites
6
+
7
+ - Python 3.10+
8
+ - uv package manager
9
+ - Git
10
+ - Claude Desktop (for testing)
11
+
12
+ ## Development Setup
13
+
14
+ ### 1. Clone and Setup Project
15
+
16
+ ```bash
17
+ # Clone the repository
18
+ git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
19
+ cd tree-sitter-analyzer
20
+
21
+ # Install development dependencies
22
+ uv sync --extra all --extra mcp
23
+
24
+ # Verify installation
25
+ uv run python -c "import tree_sitter_analyzer; print('Development setup OK')"
26
+ ```
27
+
28
+ ### 2. Configure Claude Desktop for Local Development
29
+
30
+ #### Recommended Development Configuration
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "tree-sitter-analyzer-dev": {
36
+ "command": "uv",
37
+ "args": [
38
+ "run",
39
+ "--directory",
40
+ "/absolute/path/to/tree-sitter-analyzer",
41
+ "python",
42
+ "-m",
43
+ "tree_sitter_analyzer.mcp.server"
44
+ ],
45
+ "env": {
46
+ "TREE_SITTER_PROJECT_ROOT": "${workspaceFolder}"
47
+ }
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ **Important:** Replace `/absolute/path/to/tree-sitter-analyzer` with your actual project path.
54
+
55
+ ## Project Root Configuration Options
56
+
57
+ The MCP server supports multiple ways to configure the project root directory for security and functionality:
58
+
59
+ ### Configuration Priority (Highest to Lowest)
60
+
61
+ 1. **Command Line Argument** (Highest Priority)
62
+ 2. **Environment Variable** (Medium Priority)
63
+ 3. **Auto-Detection** (Lowest Priority)
64
+
65
+ ### Option 1: Environment Variable (Recommended)
66
+
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "tree-sitter-analyzer-dev": {
71
+ "command": "uv",
72
+ "args": ["run", "--directory", "/path/to/tree-sitter-analyzer", "python", "-m", "tree_sitter_analyzer.mcp.server"],
73
+ "env": {
74
+ "TREE_SITTER_PROJECT_ROOT": "${workspaceFolder}"
75
+ }
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ **Benefits:**
82
+ - ✅ Automatically adapts to current workspace
83
+ - ✅ Works with any IDE supporting workspace variables
84
+ - ✅ Flexible and dynamic configuration
85
+
86
+ ### Option 2: Command Line Argument
87
+
88
+ ```json
89
+ {
90
+ "mcpServers": {
91
+ "tree-sitter-analyzer-dev": {
92
+ "command": "uv",
93
+ "args": [
94
+ "run", "--directory", "/path/to/tree-sitter-analyzer",
95
+ "python", "-m", "tree_sitter_analyzer.mcp.server",
96
+ "--project-root", "/specific/project/path"
97
+ ]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ **Use cases:**
104
+ - 🎯 Fixed project path requirements
105
+ - 🎯 Override environment variable settings
106
+ - 🎯 Multi-project environments
107
+
108
+ ### Option 3: Auto-Detection (Zero Configuration)
109
+
110
+ ```json
111
+ {
112
+ "mcpServers": {
113
+ "tree-sitter-analyzer-dev": {
114
+ "command": "uv",
115
+ "args": ["run", "--directory", "/path/to/tree-sitter-analyzer", "python", "-m", "tree_sitter_analyzer.mcp.server"]
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ **How it works:**
122
+ - 🔍 Searches for project markers (.git, pyproject.toml, package.json, etc.)
123
+ - 🔍 Traverses up directory tree from server working directory
124
+ - 🔍 Falls back to current working directory if no markers found
125
+
126
+ **Supported project markers:**
127
+ - Version control: `.git`, `.hg`, `.svn`
128
+ - Python: `pyproject.toml`, `setup.py`, `requirements.txt`
129
+ - JavaScript: `package.json`, `yarn.lock`, `node_modules`
130
+ - Java: `pom.xml`, `build.gradle`, `gradlew`
131
+ - And many more...
132
+
133
+ ## Testing Project Root Configuration
134
+
135
+ ### Test Auto-Detection
136
+
137
+ ```bash
138
+ # Test from project directory
139
+ cd /your/project/directory
140
+ uv run python -m tree_sitter_analyzer.mcp.server --help
141
+
142
+ # Should show detected project root in logs
143
+ ```
144
+
145
+ ### Test Command Line Override
146
+
147
+ ```bash
148
+ # Test explicit project root
149
+ uv run python -m tree_sitter_analyzer.mcp.server --project-root /specific/path --help
150
+ ```
151
+
152
+ ### Test Environment Variable
153
+
154
+ ```bash
155
+ # Test environment variable
156
+ export TREE_SITTER_PROJECT_ROOT=/your/project
157
+ uv run python -m tree_sitter_analyzer.mcp.server --help
158
+ ```
159
+
160
+ ### Test Priority Handling
161
+
162
+ ```bash
163
+ # Test priority (command line should win)
164
+ export TREE_SITTER_PROJECT_ROOT=/env/path
165
+ uv run python -m tree_sitter_analyzer.mcp.server --project-root /cmd/path --help
166
+ # Should use /cmd/path
167
+ ```
168
+
169
+ ## Debugging Project Root Issues
170
+
171
+ ### Check Current Configuration
172
+
173
+ ```bash
174
+ # Run with verbose logging
175
+ uv run python -c "
176
+ from tree_sitter_analyzer.project_detector import detect_project_root
177
+ import logging
178
+ logging.basicConfig(level=logging.INFO)
179
+ result = detect_project_root()
180
+ print(f'Detected project root: {result}')
181
+ "
182
+ ```
183
+
184
+ ### Verify Security Boundaries
185
+
186
+ ```bash
187
+ # Test file access validation
188
+ uv run python -c "
189
+ from tree_sitter_analyzer.security import SecurityValidator
190
+ validator = SecurityValidator('/your/project/root')
191
+ is_valid, msg = validator.validate_file_path('/your/project/root/src/file.py')
192
+ print(f'Valid: {is_valid}, Message: {msg}')
193
+ "
194
+ ```
195
+
196
+ ### 3. Dual Configuration (Development + Stable)
197
+
198
+ For testing both versions, use this configuration:
199
+
200
+ ```json
201
+ {
202
+ "mcpServers": {
203
+ "tree-sitter-analyzer-dev": {
204
+ "command": "uv",
205
+ "args": [
206
+ "run",
207
+ "--directory",
208
+ "/path/to/your/tree-sitter-analyzer",
209
+ "python",
210
+ "-m",
211
+ "tree_sitter_analyzer.mcp.server"
212
+ ],
213
+ "disabled": false
214
+ },
215
+ "tree-sitter-analyzer-stable": {
216
+ "command": "uv",
217
+ "args": [
218
+ "run",
219
+ "--with",
220
+ "tree-sitter-analyzer[mcp]",
221
+ "python",
222
+ "-m",
223
+ "tree_sitter_analyzer.mcp.server"
224
+ ],
225
+ "disabled": true
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
231
+ Switch between versions by changing the `disabled` flag.
232
+
233
+ ## Development Workflow
234
+
235
+ ### 1. Make Changes
236
+ ```bash
237
+ # Edit code
238
+ vim tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py
239
+
240
+ # Run tests
241
+ pytest tests/ -v
242
+
243
+ # Test CLI
244
+ uv run python -m tree_sitter_analyzer examples/Sample.java --advanced --output-format=text
245
+ ```
246
+
247
+ ### 2. Test MCP Server
248
+ ```bash
249
+ # Test server manually
250
+ uv run python -m tree_sitter_analyzer.mcp.server
251
+
252
+ # Should show server initialization logs
253
+ ```
254
+
255
+ ### 3. Test with Claude Desktop
256
+ - Restart Claude Desktop
257
+ - Test your changes through the AI assistant
258
+ - Check logs for any issues
259
+
260
+ ## Debugging
261
+
262
+ ### Enable Debug Logging
263
+ ```bash
264
+ export TREE_SITTER_ANALYZER_LOG_LEVEL=DEBUG
265
+ uv run python -m tree_sitter_analyzer.mcp.server
266
+ ```
267
+
268
+ ### Common Issues
269
+
270
+ **Import Errors:**
271
+ ```bash
272
+ # Check dependencies
273
+ uv run python -c "import tree_sitter_analyzer.mcp.server"
274
+ ```
275
+
276
+ **Path Issues:**
277
+ - Use absolute paths in MCP configuration
278
+ - Verify project directory structure
279
+
280
+ **MCP Protocol Issues:**
281
+ - Check Claude Desktop logs
282
+ - Verify MCP package version: `uv run python -c "import mcp; print(mcp.__version__)"`
283
+
284
+ ## Testing Changes
285
+
286
+ ### Unit Tests
287
+ ```bash
288
+ # Run all tests
289
+ pytest tests/ -v
290
+
291
+ # Run specific test
292
+ pytest tests/test_mcp_tools.py -v
293
+
294
+ # Run with coverage
295
+ pytest tests/ --cov=tree_sitter_analyzer
296
+ ```
297
+
298
+ ### Integration Tests
299
+ ```bash
300
+ # Test MCP tools
301
+ uv run python -m pytest tests/test_mcp_integration.py -v
302
+ ```
303
+
304
+ ### Manual Testing
305
+ ```bash
306
+ # Test CLI commands
307
+ uv run python -m tree_sitter_analyzer examples/Sample.java --table=full
308
+
309
+ # Test partial read
310
+ uv run python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
311
+ ```
312
+
313
+ ## Contributing
314
+
315
+ 1. Create feature branch
316
+ 2. Make changes
317
+ 3. Run tests: `pytest tests/ -v`
318
+ 4. Test MCP integration
319
+ 5. Submit pull request
320
+
321
+ ## Need Help?
322
+
323
+ - [GitHub Issues](https://github.com/aimasteracc/tree-sitter-analyzer/issues)
324
+ - [User Setup Guide](MCP_SETUP_USERS.md) - For end users
325
+ - [API Documentation](docs/api.md)
@@ -47,7 +47,7 @@ uv --version
47
47
 
48
48
  ### Add Configuration
49
49
 
50
- Open the config file and add this configuration:
50
+ Open the config file and add this **recommended configuration**:
51
51
 
52
52
  ```json
53
53
  {
@@ -55,18 +55,61 @@ Open the config file and add this configuration:
55
55
  "tree-sitter-analyzer": {
56
56
  "command": "uv",
57
57
  "args": [
58
- "run",
59
- "--with",
58
+ "run",
59
+ "--with",
60
60
  "tree-sitter-analyzer[mcp]",
61
- "python",
62
- "-m",
61
+ "python",
62
+ "-m",
63
63
  "tree_sitter_analyzer.mcp.server"
64
+ ],
65
+ "env": {
66
+ "TREE_SITTER_PROJECT_ROOT": "${workspaceFolder}"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ > **💡 Why this configuration?**
74
+ > - `${workspaceFolder}` automatically uses your current project directory
75
+ > - Provides secure file access boundaries
76
+ > - Works with any project without manual path changes
77
+ > - Enables intelligent project root detection
78
+
79
+ ## Project Root Configuration
80
+
81
+ The tree-sitter-analyzer automatically detects your project boundaries for security and functionality. Here's how it works:
82
+
83
+ ### ✅ Recommended: Use the configuration above
84
+ The `${workspaceFolder}` setting automatically adapts to your current project directory. This works for:
85
+ - VS Code workspaces
86
+ - Any IDE that supports workspace variables
87
+ - Most development environments
88
+
89
+ ### 🔧 Alternative: Fixed project path (for specific use cases)
90
+ If you need to analyze files from a specific directory only:
91
+
92
+ ```json
93
+ {
94
+ "mcpServers": {
95
+ "tree-sitter-analyzer": {
96
+ "command": "uv",
97
+ "args": [
98
+ "run", "--with", "tree-sitter-analyzer[mcp]",
99
+ "python", "-m", "tree_sitter_analyzer.mcp.server",
100
+ "--project-root", "/absolute/path/to/your/project"
64
101
  ]
65
102
  }
66
103
  }
67
104
  }
68
105
  ```
69
106
 
107
+ ### 🎯 What happens with project root?
108
+ - **Security**: Only files within the project directory can be analyzed
109
+ - **Smart detection**: Automatically finds project markers (.git, package.json, pyproject.toml, etc.)
110
+ - **Path resolution**: Resolves relative paths correctly
111
+ - **Performance**: Optimizes analysis for your project structure
112
+
70
113
  ## Step 3: Restart Claude Desktop
71
114
 
72
115
  Close and restart Claude Desktop completely.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tree-sitter-analyzer
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: Extensible multi-language code analyzer framework using Tree-sitter with dynamic plugin architecture
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
@@ -137,7 +137,9 @@ Description-Content-Type: text/markdown
137
137
 
138
138
  [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
139
139
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
140
- [![Tests](https://img.shields.io/badge/tests-1126%20passed-brightgreen.svg)](#testing)
140
+ [![Tests](https://img.shields.io/badge/tests-1358%20passed-brightgreen.svg)](#testing)
141
+ [![Coverage](https://img.shields.io/badge/coverage-74.82%25-green.svg)](#testing)
142
+ [![Quality](https://img.shields.io/badge/quality-enterprise%20grade-blue.svg)](#quality)
141
143
 
142
144
  **Solve the LLM token limit problem for large code files.**
143
145
 
@@ -306,21 +308,69 @@ uv sync --extra all --extra mcp
306
308
 
307
309
  - **[MCP Setup Guide for Users](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/MCP_SETUP_USERS.md)** - Simple setup for AI assistant users
308
310
  - **[MCP Setup Guide for Developers](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/MCP_SETUP_DEVELOPERS.md)** - Local development configuration
311
+ - **[Project Root Configuration](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/PROJECT_ROOT_CONFIG.md)** - Complete configuration reference
309
312
  - **[API Documentation](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/docs/api.md)** - Detailed API reference
310
313
  - **[Contributing Guide](https://github.com/aimasteracc/tree-sitter-analyzer/blob/main/CONTRIBUTING.md)** - How to contribute
311
314
 
312
- ## 🧪 Testing
315
+ ### 🔒 Project Root Configuration
313
316
 
314
- This project maintains high code quality with **1126 passing tests**.
317
+ Tree-sitter-analyzer automatically detects and secures your project boundaries:
315
318
 
319
+ - **Auto-detection**: Finds project root from `.git`, `pyproject.toml`, `package.json`, etc.
320
+ - **CLI**: Use `--project-root /path/to/project` for explicit control
321
+ - **MCP**: Set `TREE_SITTER_PROJECT_ROOT=${workspaceFolder}` for workspace integration
322
+ - **Security**: Only analyzes files within project boundaries
323
+
324
+ **Recommended MCP configuration:**
325
+ ```json
326
+ {
327
+ "mcpServers": {
328
+ "tree-sitter-analyzer": {
329
+ "command": "uv",
330
+ "args": ["run", "--with", "tree-sitter-analyzer[mcp]", "python", "-m", "tree_sitter_analyzer.mcp.server"],
331
+ "env": {"TREE_SITTER_PROJECT_ROOT": "${workspaceFolder}"}
332
+ }
333
+ }
334
+ }
335
+ ```
336
+
337
+ ## 🧪 Testing & Quality
338
+
339
+ This project maintains **enterprise-grade quality** with comprehensive testing:
340
+
341
+ ### 📊 Quality Metrics
342
+ - **1358 tests** - 100% pass rate ✅
343
+ - **74.82% code coverage** - Industry standard quality
344
+ - **Zero test failures** - Complete CI/CD readiness
345
+ - **Cross-platform compatibility** - Windows, macOS, Linux
346
+
347
+ ### 🏆 Recent Quality Achievements (v0.8.2)
348
+ - ✅ **Complete test suite stabilization** - Fixed all 31 failing tests
349
+ - ✅ **Formatters module breakthrough** - 0% → 42.30% coverage
350
+ - ✅ **Error handling improvements** - 61.64% → 82.76% coverage
351
+ - ✅ **104 new comprehensive tests** across critical modules
352
+
353
+ ### 🔧 Running Tests
316
354
  ```bash
317
- # Run tests
355
+ # Run all tests
318
356
  pytest tests/ -v
319
357
 
320
- # Run with coverage
321
- pytest tests/ --cov=tree_sitter_analyzer
358
+ # Run with coverage report
359
+ pytest tests/ --cov=tree_sitter_analyzer --cov-report=html
360
+
361
+ # Run specific test categories
362
+ pytest tests/test_formatters_comprehensive.py -v
363
+ pytest tests/test_core_engine_extended.py -v
364
+ pytest tests/test_mcp_server_initialization.py -v
322
365
  ```
323
366
 
367
+ ### 📈 Coverage Highlights
368
+ - **Formatters**: 42.30% (newly established)
369
+ - **Error Handler**: 82.76% (major improvement)
370
+ - **Language Detector**: 98.41% (excellent)
371
+ - **CLI Main**: 97.78% (excellent)
372
+ - **Security Framework**: 78%+ across all modules
373
+
324
374
  ## 📄 License
325
375
 
326
376
  MIT License - see [LICENSE](LICENSE) file for details.