Thank you for your interest in contributing to Code Compass! This document provides guidelines and instructions for contributing.
- Bug Reports: Found a bug? Open an issue with details
- Feature Requests: Have an idea? Share it in the issues
- Code Contributions: Submit pull requests for bug fixes or new features
- Documentation: Improve README, add examples, fix typos
- Testing: Test on different projects and report results
# Fork the repository on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/Code-Compass-v0.1.0-MVP.git
cd Code-Compass-v0.1.0-MVP
# Add upstream remote
git remote add upstream https://github.com/Xiangyu-Li97/Code-Compass-v0.1.0-MVP.git# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in editable mode
pip install -e .
# Install development dependencies (optional)
pip install pytest black flake8# Create a feature branch
git checkout -b feature/your-feature-name
# Or a bugfix branch
git checkout -b fix/issue-number-descriptionWe have comprehensive test coverage. Please ensure all tests pass before submitting a PR.
# Run all tests
./run_all_tests.sh
# Or run specific test files
python3 tests/test_python_parser.py
python3 tests/test_cache.pyOur test suites include:
test_python_parser.py- AST parsingtest_cache.py- SQLite cachingtest_formatter.py- Output formattingtest_relative_imports.py- Import resolutiontest_type_annotations.py- Type annotation handlingtest_cache_performance.py- Performance benchmarkstest_real_project.py- Integration tests
We follow standard Python conventions:
# Format code with black (recommended)
black code_compass/ tests/
# Check with flake8
flake8 code_compass/ tests/ --max-line-length=100- Line length: Max 100 characters
- Imports: Group by standard library, third-party, local
- Docstrings: Use Google-style docstrings
- Type hints: Add type hints for function signatures
- Comments: Explain "why", not "what"
from typing import List, Optional
def parse_file(path: str, force: bool = False) -> Optional[FileInfo]:
"""Parse a Python file and extract symbols.
Args:
path: Absolute path to the Python file
force: If True, ignore cache and re-parse
Returns:
FileInfo object with extracted symbols, or None if parsing fails
"""
# Implementation
passWhen reporting bugs, please include:
-
Environment:
- Python version (
python --version) - Operating system
- Code Compass version
- Python version (
-
Steps to reproduce:
- Minimal code example
- Command you ran
- Expected vs actual behavior
-
Error messages:
- Full traceback
- Any relevant log output
**Environment:**
- Python: 3.11.0
- OS: Ubuntu 22.04
- Code Compass: v0.1.0
**Steps to Reproduce:**
1. Run `code-compass index /path/to/project`
2. ...
**Expected Behavior:**
Should index all files
**Actual Behavior:**
Crashes with SyntaxError
**Error Message:**We welcome feature requests! Please include:
- Use case: What problem does this solve?
- Proposed solution: How would you like it to work?
- Alternatives: Have you considered other approaches?
- Examples: Show what the API/CLI would look like
- ✅ Tests pass (
./run_all_tests.sh) - ✅ Code is formatted (
black code_compass/ tests/) - ✅ No linting errors (
flake8 code_compass/ tests/) - ✅ Documentation updated (if needed)
- ✅ Commit messages are clear
Follow Conventional Commits:
feat: add JavaScript parser
fix: handle empty files in cache
docs: update README with new examples
test: add tests for relative imports
refactor: simplify dependency graph builder
perf: optimize PageRank calculation
## Description
Brief description of what this PR does
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] All tests pass
- [ ] Added new tests for this change
- [ ] Tested on real projects
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or documented)- Submit your PR
- Maintainers will review within 1-3 days
- Address any feedback
- Once approved, we'll merge!
We're especially interested in contributions in these areas:
-
JavaScript/TypeScript Parser
- Use Tree-sitter or Babel AST
- Support ES6+ syntax
- Handle JSX/TSX
-
Performance Optimizations
- Parallel file parsing
- Incremental indexing
- Memory optimization for large projects
-
Additional Language Support
- Java
- Go
- Rust
- C/C++
-
Automatic File Watching
- Monitor file changes
- Auto-update index
- Debounce rapid changes
-
IDE Integration
- VSCode extension
- IntelliJ plugin
- Sublime Text package
-
Enhanced Output Formats
- Markdown with links
- HTML with syntax highlighting
- GraphML for visualization
code_compass/
├── models.py # Data structures (Symbol, FileInfo, RepoMap)
├── parsers/
│ ├── __init__.py
│ └── python_parser.py # Python AST parser
├── cache.py # SQLite cache manager
├── graph.py # Dependency graph & PageRank
├── map_generator.py # Core map generation logic
├── formatter.py # Output formatters (text/JSON)
└── cli.py # Command-line interface
-
Separation of Concerns
- Models are pure data (no logic)
- Formatters handle presentation
- Parsers handle language-specific logic
-
Performance First
- Cache everything possible
- Use SQLite for fast lookups
- Avoid re-parsing unchanged files
-
Fail Gracefully
- Syntax errors shouldn't crash
- Return partial results when possible
- Log warnings, don't throw exceptions
- Create
parsers/your_language_parser.py - Implement
YourLanguageParserclass withparse_file()method - Return
FileInfowith extracted symbols - Add tests in
tests/test_your_language_parser.py - Update CLI to detect file extensions
- Update README with language support
Example structure:
from code_compass.models import FileInfo, Symbol, SymbolType
class JavaScriptParser:
def parse_file(self, path: str) -> FileInfo:
"""Parse a JavaScript file and extract symbols."""
# Use Tree-sitter or Babel AST
# Extract functions, classes, exports
# Return FileInfo with symbols
pass- Be respectful and inclusive
- Provide constructive feedback
- Focus on the code, not the person
- Help others learn and grow
- Questions: Open a GitHub Discussion
- Bugs: Open an Issue
- Chat: (Coming soon - Discord/Slack)
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Code Compass! 🎉
Your contributions help make AI-powered coding more efficient for everyone.