Commit c5ba5da
feat: Add tree-sitter query-based core library with method/function distinction
- Create `code_extractor/` core library package with rich data models
- Implement tree-sitter query engine solving method vs function classification
- Add comprehensive pytest test suite with 100% pass rate
- Build new MCP server using core library with enhanced functionality
Key improvements:
- Methods now correctly classified as "method" not "function"
- Rich context extraction: parameters, return types, async detection, docstrings
- Hierarchical parent relationships (methods show parent class)
- Query-based extraction replacing manual tree traversal
- Proper symbol boundaries using definition nodes
- Enhanced testing infrastructure with fixtures
Technical details:
- CodeSymbol/Parameter dataclasses for structured representation
- Python tree-sitter queries handling async, decorated, and nested methods
- Two-pass capture processing for accurate symbol matching
- Language detection and parser management system
- Backward-compatible MCP interface with enhanced output
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 4a388f7 commit c5ba5da
23 files changed
Lines changed: 2335 additions & 1 deletion
File tree
- code_extractor
- queries
- tests
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments