tree-sitter-analyzer 0.1.2__tar.gz → 0.2.0__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.
- tree_sitter_analyzer-0.2.0/CHANGELOG.md +97 -0
- tree_sitter_analyzer-0.2.0/CONTRIBUTING.md +98 -0
- tree_sitter_analyzer-0.2.0/MCP_SETUP_DEVELOPERS.md +181 -0
- tree_sitter_analyzer-0.2.0/MCP_SETUP_USERS.md +163 -0
- tree_sitter_analyzer-0.2.0/PKG-INFO +331 -0
- tree_sitter_analyzer-0.2.0/README.md +199 -0
- tree_sitter_analyzer-0.2.0/TOOL_RENAME_PLAN.md +64 -0
- tree_sitter_analyzer-0.2.0/docs/api.md +174 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/pyproject.toml +1 -1
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/__init__.py +1 -1
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/advanced_command.py +10 -10
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/base_command.py +11 -11
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/partial_read_command.py +12 -12
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/structure_command.py +13 -13
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/summary_command.py +8 -8
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli_main.py +6 -6
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/tools/read_partial_tool.py +5 -5
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/tools/table_format_tool.py +9 -9
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/table_formatter.py +26 -26
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/uv.lock +1 -1
- tree_sitter_analyzer-0.1.2/MCP_USAGE_GUIDE.md +0 -250
- tree_sitter_analyzer-0.1.2/PKG-INFO +0 -444
- tree_sitter_analyzer-0.1.2/README.md +0 -312
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/.gitignore +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/DEPLOYMENT_GUIDE.md +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/build_standalone.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/BigService.java +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/BigService.json +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/BigService.summary.json +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/JavaDocTest.java +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/MultiClass.java +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/Sample.java +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/calculate_token_comparison.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/examples/sample.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/pytest.ini +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/__main__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/api.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/__main__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/default_command.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/query_command.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/commands/table_command.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/cli/info_commands.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/core/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/core/analysis_engine.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/core/cache_service.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/core/engine.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/core/parser.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/core/query.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/encoding_utils.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/exceptions.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/file_handler.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/formatters/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/formatters/base_formatter.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/formatters/formatter_factory.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/formatters/java_formatter.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/formatters/python_formatter.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/interfaces/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/interfaces/cli.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/interfaces/cli_adapter.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/interfaces/mcp_adapter.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/interfaces/mcp_server.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/java_analyzer.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/language_detector.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/language_loader.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/languages/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/languages/java_plugin.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/languages/python_plugin.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/resources/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/resources/code_file_resource.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/resources/project_stats_resource.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/server.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/tools/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/tools/base_tool.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/utils/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/mcp/utils/error_handler.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/models.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/output_manager.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/base.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/java_plugin.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/javascript_plugin.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/manager.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/plugin_loader.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/python_plugin.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/plugins/registry.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/queries/__init__.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/queries/java.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/queries/javascript.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/queries/python.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/queries/typescript.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/query_loader.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/tree_sitter_analyzer/utils.py +0 -0
- {tree_sitter_analyzer-0.1.2 → tree_sitter_analyzer-0.2.0}/upload_to_pypi.py +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.0] - 2025-08-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **New `--quiet` option** for CLI to suppress INFO-level logging
|
|
12
|
+
- **Enhanced parameter validation** for partial read commands
|
|
13
|
+
- **Improved MCP tool names** for better clarity and AI assistant integration
|
|
14
|
+
- **Comprehensive test coverage** with 1283 passing tests
|
|
15
|
+
- **UV package manager support** for easier environment management
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **BREAKING**: Renamed MCP tool `format_table` to `analyze_code_structure` for better clarity
|
|
19
|
+
- **Improved**: All Japanese comments translated to English for international development
|
|
20
|
+
- **Enhanced**: Test stability with intelligent fallback mechanisms for complex Java parsing
|
|
21
|
+
- **Updated**: Documentation to reflect new tool names and features
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- **Resolved**: Previously skipped complex Java structure analysis test now passes
|
|
25
|
+
- **Fixed**: Robust error handling for environment-dependent parsing scenarios
|
|
26
|
+
- **Improved**: Parameter validation with better error messages
|
|
27
|
+
|
|
28
|
+
### Technical Improvements
|
|
29
|
+
- **Performance**: Optimized analysis engine with better caching
|
|
30
|
+
- **Reliability**: Enhanced error handling and logging throughout the codebase
|
|
31
|
+
- **Maintainability**: Comprehensive test suite with no skipped tests
|
|
32
|
+
- **Documentation**: Complete English localization of codebase
|
|
33
|
+
|
|
34
|
+
## [0.1.3] - Previous Release
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- Initial MCP server implementation
|
|
38
|
+
- Multi-language code analysis support
|
|
39
|
+
- Table formatting capabilities
|
|
40
|
+
- Partial file reading functionality
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
- Java, JavaScript, Python language support
|
|
44
|
+
- Tree-sitter based parsing
|
|
45
|
+
- CLI and MCP interfaces
|
|
46
|
+
- Extensible plugin architecture
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Migration Guide
|
|
51
|
+
|
|
52
|
+
### From 0.1.x to 0.2.0
|
|
53
|
+
|
|
54
|
+
#### MCP Tool Name Changes
|
|
55
|
+
If you're using the MCP server, update your tool calls:
|
|
56
|
+
|
|
57
|
+
**Before:**
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"tool": "format_table",
|
|
61
|
+
"arguments": { ... }
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**After:**
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"tool": "analyze_code_structure",
|
|
69
|
+
"arguments": { ... }
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### New CLI Options
|
|
74
|
+
Take advantage of the new `--quiet` option for cleaner output:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# New quiet mode
|
|
78
|
+
tree-sitter-analyzer file.java --structure --quiet
|
|
79
|
+
|
|
80
|
+
# Enhanced parameter validation
|
|
81
|
+
tree-sitter-analyzer file.java --partial-read --start-line 1 --end-line 10
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### UV Support
|
|
85
|
+
You can now use UV for package management:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Install with UV
|
|
89
|
+
uv add tree-sitter-analyzer
|
|
90
|
+
|
|
91
|
+
# Run with UV
|
|
92
|
+
uv run tree-sitter-analyzer file.java --structure
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
For more details, see the [README](README.md) and [documentation](docs/).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Contributing to Tree-sitter Analyzer
|
|
2
|
+
|
|
3
|
+
We welcome contributions! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start for Contributors
|
|
6
|
+
|
|
7
|
+
### Development Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Clone the repository
|
|
11
|
+
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
|
|
12
|
+
cd tree-sitter-analyzer
|
|
13
|
+
|
|
14
|
+
# Install development dependencies
|
|
15
|
+
uv sync --extra all --extra mcp
|
|
16
|
+
|
|
17
|
+
# Verify setup
|
|
18
|
+
uv run python -c "import tree_sitter_analyzer; print('Setup OK')"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Running Tests
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Run all tests (1283+ tests)
|
|
25
|
+
pytest tests/ -v
|
|
26
|
+
|
|
27
|
+
# Run with coverage
|
|
28
|
+
pytest tests/ --cov=tree_sitter_analyzer
|
|
29
|
+
|
|
30
|
+
# Run specific test file
|
|
31
|
+
pytest tests/test_mcp_tools.py -v
|
|
32
|
+
|
|
33
|
+
# Run tests for specific functionality
|
|
34
|
+
pytest tests/test_quiet_option.py -v
|
|
35
|
+
pytest tests/test_partial_read_command_validation.py -v
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 🛠️ Development Workflow
|
|
39
|
+
|
|
40
|
+
1. **Create a feature branch**
|
|
41
|
+
```bash
|
|
42
|
+
git checkout -b feature/your-feature-name
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
2. **Make your changes**
|
|
46
|
+
- Follow existing code style
|
|
47
|
+
- Add tests for new functionality
|
|
48
|
+
- Update documentation if needed
|
|
49
|
+
|
|
50
|
+
3. **Test your changes**
|
|
51
|
+
```bash
|
|
52
|
+
pytest tests/ -v
|
|
53
|
+
uv run python -m tree_sitter_analyzer examples/Sample.java --advanced
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
4. **Submit a pull request**
|
|
57
|
+
- Describe your changes clearly
|
|
58
|
+
- Include test results
|
|
59
|
+
- Reference any related issues
|
|
60
|
+
|
|
61
|
+
## 📝 Code Style
|
|
62
|
+
|
|
63
|
+
- Follow PEP 8 for Python code
|
|
64
|
+
- Use type hints where appropriate
|
|
65
|
+
- Write clear docstrings
|
|
66
|
+
- Keep functions focused and small
|
|
67
|
+
|
|
68
|
+
## 🐛 Reporting Issues
|
|
69
|
+
|
|
70
|
+
- Use GitHub Issues
|
|
71
|
+
- Include error messages and stack traces
|
|
72
|
+
- Provide sample code files when possible
|
|
73
|
+
- Specify your Python version and OS
|
|
74
|
+
|
|
75
|
+
## 💡 Feature Requests
|
|
76
|
+
|
|
77
|
+
- Open a GitHub Issue with the "enhancement" label
|
|
78
|
+
- Describe the use case clearly
|
|
79
|
+
- Explain how it would benefit users
|
|
80
|
+
|
|
81
|
+
## 🧪 Testing Guidelines
|
|
82
|
+
|
|
83
|
+
- Write tests for new features
|
|
84
|
+
- Ensure existing tests pass (1283+ tests should pass)
|
|
85
|
+
- Test with multiple programming languages
|
|
86
|
+
- Test both CLI and MCP functionality
|
|
87
|
+
- Test error handling and edge cases
|
|
88
|
+
- Include tests for new CLI options (like --quiet)
|
|
89
|
+
- Test MCP tool functionality and parameter validation
|
|
90
|
+
- Follow the existing test patterns in the codebase
|
|
91
|
+
|
|
92
|
+
## 📚 Documentation
|
|
93
|
+
|
|
94
|
+
- Update README.md for user-facing changes
|
|
95
|
+
- Add docstrings to new functions/classes
|
|
96
|
+
- Update MCP setup guides if needed
|
|
97
|
+
|
|
98
|
+
Thank you for contributing! 🎉
|
|
@@ -0,0 +1,181 @@
|
|
|
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
|
+
Add this configuration to your Claude Desktop config file:
|
|
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
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Important:** Replace `/absolute/path/to/tree-sitter-analyzer` with your actual project path.
|
|
51
|
+
|
|
52
|
+
### 3. Dual Configuration (Development + Stable)
|
|
53
|
+
|
|
54
|
+
For testing both versions, use this configuration:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"tree-sitter-analyzer-dev": {
|
|
60
|
+
"command": "uv",
|
|
61
|
+
"args": [
|
|
62
|
+
"run",
|
|
63
|
+
"--directory",
|
|
64
|
+
"/path/to/your/tree-sitter-analyzer",
|
|
65
|
+
"python",
|
|
66
|
+
"-m",
|
|
67
|
+
"tree_sitter_analyzer.mcp.server"
|
|
68
|
+
],
|
|
69
|
+
"disabled": false
|
|
70
|
+
},
|
|
71
|
+
"tree-sitter-analyzer-stable": {
|
|
72
|
+
"command": "uv",
|
|
73
|
+
"args": [
|
|
74
|
+
"run",
|
|
75
|
+
"--with",
|
|
76
|
+
"tree-sitter-analyzer[mcp]",
|
|
77
|
+
"python",
|
|
78
|
+
"-m",
|
|
79
|
+
"tree_sitter_analyzer.mcp.server"
|
|
80
|
+
],
|
|
81
|
+
"disabled": true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Switch between versions by changing the `disabled` flag.
|
|
88
|
+
|
|
89
|
+
## Development Workflow
|
|
90
|
+
|
|
91
|
+
### 1. Make Changes
|
|
92
|
+
```bash
|
|
93
|
+
# Edit code
|
|
94
|
+
vim tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py
|
|
95
|
+
|
|
96
|
+
# Run tests
|
|
97
|
+
pytest tests/ -v
|
|
98
|
+
|
|
99
|
+
# Test CLI
|
|
100
|
+
uv run python -m tree_sitter_analyzer examples/Sample.java --advanced
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 2. Test MCP Server
|
|
104
|
+
```bash
|
|
105
|
+
# Test server manually
|
|
106
|
+
uv run python -m tree_sitter_analyzer.mcp.server
|
|
107
|
+
|
|
108
|
+
# Should show server initialization logs
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Test with Claude Desktop
|
|
112
|
+
- Restart Claude Desktop
|
|
113
|
+
- Test your changes through the AI assistant
|
|
114
|
+
- Check logs for any issues
|
|
115
|
+
|
|
116
|
+
## Debugging
|
|
117
|
+
|
|
118
|
+
### Enable Debug Logging
|
|
119
|
+
```bash
|
|
120
|
+
export TREE_SITTER_ANALYZER_LOG_LEVEL=DEBUG
|
|
121
|
+
uv run python -m tree_sitter_analyzer.mcp.server
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Common Issues
|
|
125
|
+
|
|
126
|
+
**Import Errors:**
|
|
127
|
+
```bash
|
|
128
|
+
# Check dependencies
|
|
129
|
+
uv run python -c "import tree_sitter_analyzer.mcp.server"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Path Issues:**
|
|
133
|
+
- Use absolute paths in MCP configuration
|
|
134
|
+
- Verify project directory structure
|
|
135
|
+
|
|
136
|
+
**MCP Protocol Issues:**
|
|
137
|
+
- Check Claude Desktop logs
|
|
138
|
+
- Verify MCP package version: `uv run python -c "import mcp; print(mcp.__version__)"`
|
|
139
|
+
|
|
140
|
+
## Testing Changes
|
|
141
|
+
|
|
142
|
+
### Unit Tests
|
|
143
|
+
```bash
|
|
144
|
+
# Run all tests
|
|
145
|
+
pytest tests/ -v
|
|
146
|
+
|
|
147
|
+
# Run specific test
|
|
148
|
+
pytest tests/test_mcp_tools.py -v
|
|
149
|
+
|
|
150
|
+
# Run with coverage
|
|
151
|
+
pytest tests/ --cov=tree_sitter_analyzer
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Integration Tests
|
|
155
|
+
```bash
|
|
156
|
+
# Test MCP tools
|
|
157
|
+
uv run python -m pytest tests/test_mcp_integration.py -v
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Manual Testing
|
|
161
|
+
```bash
|
|
162
|
+
# Test CLI commands
|
|
163
|
+
uv run python -m tree_sitter_analyzer examples/Sample.java --table=full
|
|
164
|
+
|
|
165
|
+
# Test partial read
|
|
166
|
+
uv run python -m tree_sitter_analyzer examples/Sample.java --partial-read --start-line 84 --end-line 86
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Contributing
|
|
170
|
+
|
|
171
|
+
1. Create feature branch
|
|
172
|
+
2. Make changes
|
|
173
|
+
3. Run tests: `pytest tests/ -v`
|
|
174
|
+
4. Test MCP integration
|
|
175
|
+
5. Submit pull request
|
|
176
|
+
|
|
177
|
+
## Need Help?
|
|
178
|
+
|
|
179
|
+
- [GitHub Issues](https://github.com/aimasteracc/tree-sitter-analyzer/issues)
|
|
180
|
+
- [User Setup Guide](MCP_SETUP_USERS.md) - For end users
|
|
181
|
+
- [API Documentation](docs/api.md)
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# MCP Setup Guide for Users
|
|
2
|
+
|
|
3
|
+
**Simple setup for using Tree-sitter Analyzer with Claude Desktop**
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Claude Desktop installed
|
|
8
|
+
- Basic command line knowledge
|
|
9
|
+
|
|
10
|
+
## Step 1: Install uv (Package Manager)
|
|
11
|
+
|
|
12
|
+
uv is a fast Python package manager that handles everything automatically.
|
|
13
|
+
|
|
14
|
+
### Windows
|
|
15
|
+
```powershell
|
|
16
|
+
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### macOS/Linux
|
|
20
|
+
```bash
|
|
21
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Verify Installation
|
|
25
|
+
```bash
|
|
26
|
+
uv --version
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Step 2: Configure Claude Desktop
|
|
30
|
+
|
|
31
|
+
### Find Your Config File
|
|
32
|
+
|
|
33
|
+
**Windows:**
|
|
34
|
+
```
|
|
35
|
+
%APPDATA%\Claude\claude_desktop_config.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**macOS:**
|
|
39
|
+
```
|
|
40
|
+
~/Library/Application Support/Claude/claude_desktop_config.json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Linux:**
|
|
44
|
+
```
|
|
45
|
+
~/.config/claude/claude_desktop_config.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Add Configuration
|
|
49
|
+
|
|
50
|
+
Open the config file and add this configuration:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"tree-sitter-analyzer": {
|
|
56
|
+
"command": "uv",
|
|
57
|
+
"args": [
|
|
58
|
+
"run",
|
|
59
|
+
"--with",
|
|
60
|
+
"tree-sitter-analyzer[mcp]",
|
|
61
|
+
"python",
|
|
62
|
+
"-m",
|
|
63
|
+
"tree_sitter_analyzer.mcp.server"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Step 3: Restart Claude Desktop
|
|
71
|
+
|
|
72
|
+
Close and restart Claude Desktop completely.
|
|
73
|
+
|
|
74
|
+
## Step 4: Test the Setup
|
|
75
|
+
|
|
76
|
+
In Claude Desktop, try asking:
|
|
77
|
+
|
|
78
|
+
### Basic Usage Examples
|
|
79
|
+
|
|
80
|
+
**Check code scale:**
|
|
81
|
+
> "What's the overall complexity and size of examples/Sample.java?"
|
|
82
|
+
|
|
83
|
+
**Analyze code structure:**
|
|
84
|
+
> "Please analyze the structure of examples/Sample.java and show me a detailed table"
|
|
85
|
+
|
|
86
|
+
**Extract specific code:**
|
|
87
|
+
> "Show me lines 84-86 from examples/Sample.java"
|
|
88
|
+
|
|
89
|
+
**Universal analysis:**
|
|
90
|
+
> "Analyze this code file with automatic language detection"
|
|
91
|
+
|
|
92
|
+
You should see the tree-sitter-analyzer tools being used automatically.
|
|
93
|
+
|
|
94
|
+
## Available Tools
|
|
95
|
+
|
|
96
|
+
Once configured, you'll have access to these tools:
|
|
97
|
+
|
|
98
|
+
1. **analyze_code_scale** - Get code metrics and complexity
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"tool": "analyze_code_scale",
|
|
102
|
+
"arguments": {
|
|
103
|
+
"file_path": "examples/Sample.java",
|
|
104
|
+
"include_complexity": true,
|
|
105
|
+
"include_details": true
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
2. **analyze_code_structure** - Generate detailed structure tables
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"tool": "analyze_code_structure",
|
|
114
|
+
"arguments": {
|
|
115
|
+
"file_path": "examples/Sample.java",
|
|
116
|
+
"format_type": "full"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
3. **read_code_partial** - Extract specific line ranges
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"tool": "read_code_partial",
|
|
125
|
+
"arguments": {
|
|
126
|
+
"file_path": "examples/Sample.java",
|
|
127
|
+
"start_line": 84,
|
|
128
|
+
"end_line": 86
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
4. **analyze_code_universal** - Universal analysis with auto-detection
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"tool": "analyze_code_universal",
|
|
137
|
+
"arguments": {
|
|
138
|
+
"file_path": "examples/Sample.py",
|
|
139
|
+
"analysis_type": "comprehensive"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Troubleshooting
|
|
145
|
+
|
|
146
|
+
### Tool Not Available
|
|
147
|
+
- Restart Claude Desktop completely
|
|
148
|
+
- Check config file syntax with a JSON validator
|
|
149
|
+
- Verify uv is installed: `uv --version`
|
|
150
|
+
|
|
151
|
+
### Permission Issues
|
|
152
|
+
- On Windows: Run as administrator
|
|
153
|
+
- On macOS/Linux: Check file permissions
|
|
154
|
+
|
|
155
|
+
### Still Having Issues?
|
|
156
|
+
- Check Claude Desktop logs
|
|
157
|
+
- Test manual installation: `uv run --with "tree-sitter-analyzer[mcp]" python -c "import tree_sitter_analyzer; print('OK')"`
|
|
158
|
+
|
|
159
|
+
## Need Help?
|
|
160
|
+
|
|
161
|
+
- [GitHub Issues](https://github.com/aimasteracc/tree-sitter-analyzer/issues)
|
|
162
|
+
- [Developer Setup Guide](MCP_SETUP_DEVELOPERS.md) - For local development
|
|
163
|
+
|