Skip to content

Commit c5ba5da

Browse files
ctothclaude
andcommitted
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

code_extractor/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
MCP Server Code Extractor - Core Library
3+
4+
A powerful code extraction library using tree-sitter for precise syntax analysis.
5+
"""
6+
7+
from .models import CodeSymbol, Parameter, SymbolKind
8+
from .extractor import CodeExtractor, create_extractor
9+
10+
__version__ = "0.2.0"
11+
__all__ = ["CodeSymbol", "Parameter", "SymbolKind", "CodeExtractor", "create_extractor"]

0 commit comments

Comments
 (0)