Skip to content

Conversation

@RMLaroche
Copy link
Owner

Summary

This PR adds a new --signature-mode feature that extracts class and method signatures from code files without requiring AI or API keys. This enables fast, offline static code analysis.

Key Features

  • Static Code Analysis: Extracts class definitions, method signatures, and function signatures
  • Multi-Language Support: Python (AST), Java, JavaScript, TypeScript (Tree-sitter when available)
  • Offline Operation: No API key required, works completely offline
  • Fast Processing: Much faster than AI summarization for signature extraction
  • Mode Compatibility: Works with both --update (default) and --scan-all modes

Technical Implementation

  • StaticAnalyzer: New module for signature extraction with fallback strategy
  • Python AST Fallback: Uses built-in ast module when Tree-sitter unavailable
  • Tree-sitter Integration: Multi-language parsing when tree-sitter-languages available
  • Graceful Degradation: Falls back to Python AST if Tree-sitter fails
  • Comprehensive Testing: 11 test cases covering all functionality

Usage Examples

# Extract signatures from current directory
codectx --signature-mode

# Extract signatures from all files (not just changed)
codectx --signature-mode --scan-all

# Extract signatures with custom output file
codectx --signature-mode --output-file signatures.md

Output Format

Generates structured markdown with:

  • Class definitions with inheritance information
  • Method signatures with type annotations and decorators
  • Function signatures with parameters and return types
  • Visibility modifiers (for Java)

Test Coverage

  • ✅ 11 comprehensive test cases
  • ✅ Python AST signature extraction
  • ✅ Error handling and fallback scenarios
  • ✅ Output formatting validation
  • ✅ Multi-language file detection
  • ✅ Integration with existing CLI framework

🤖 Generated with Claude Code

RMLaroche and others added 2 commits July 25, 2025 14:29
- Add --signature-mode CLI option for extracting class/method signatures
- Implement StaticAnalyzer with Python AST fallback and Tree-sitter support
- Support Python, Java, JavaScript, and TypeScript signature extraction
- Compatible with both update and scan-all modes
- Add comprehensive test suite with 11 test cases
- Update documentation and CLI help with signature mode examples
- Works offline without API key requirement
- Fast processing for all file sizes

Key features:
- Python AST analysis extracts classes, methods, functions with type annotations
- Tree-sitter integration for multi-language support (when available)
- Graceful fallback to Python AST when Tree-sitter unavailable
- Structured markdown output with signature analysis
- Preserves decorators, inheritance, and parameter information

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Unify output format between AI analysis and signature analysis modes
- Add comprehensive class heritage extraction for Python, Java, JavaScript
- Enhance signature mode output with structured sections and code blocks
- Support inheritance, interfaces, and class relationships parsing
- Add unified formatting for both individual and future hybrid modes
- Include heritage test file demonstrating class inheritance chains
- Improve decorator and metadata display in class signatures

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants