Thank you for your interest in contributing to code-memory! This document provides guidelines and instructions for contributing.
- Python >= 3.13
- uv package manager
# Clone the repository
git clone https://github.com/kapillamba4/code-memory.git
cd code-memory
# Install dependencies (including dev dependencies)
uv sync --all-extras# Run the MCP server
uv run mcp run code_memory/server.py
# Run with MCP Inspector for debugging
uv run mcp dev code_memory/server.py# Run all tests
uv run pytest tests/ -v
# Run with coverage
uv run pytest tests/ -v --cov --cov-report=term-missing# Run ruff linter
uv run ruff check .
# Run ruff formatter
uv run ruff format .
# Run type checking
uv run mypy .# Build the package
uv build- Follow PEP 8 conventions
- Maximum line length is 100 characters
- Use type hints for function parameters and return types
- Write docstrings for public functions and classes
code-memory/
├── code_memory/ # Package source
│ ├── server.py # MCP server entry point
│ ├── db.py # SQLite database layer
│ ├── parser.py # Tree-sitter code parser
│ ├── doc_parser.py # Markdown documentation parser
│ ├── queries.py # Hybrid retrieval query layer
│ ├── git_search.py # Git history search module
│ ├── errors.py # Custom exception hierarchy
│ ├── validation.py # Input validation functions
│ ├── logging_config.py # Structured logging configuration
│ └── api_types.py # MCP response TypedDicts
├── tests/ # Test suite
├── prompts/ # Milestone prompt files
└── pyproject.toml # Project configuration
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and linting (
uv run pytest && uv run ruff check .) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Include a clear description of the changes
- Reference any related issues
- Ensure all tests pass
- Add tests for new functionality
- Update documentation if needed
- Add the tool function in
code_memory/server.pywith the@mcp.tool()decorator - Add input validation using functions from
validation.py - Wrap the implementation in error handling
- Add logging using
ToolLogger - Write tests in
tests/test_tools.py
- Add the tree-sitter language package to
pyproject.toml - Update the language registry in
parser.py - Add node-type mappings for the new language
- Write tests for the new language
| Variable | Description | Default |
|---|---|---|
CODE_MEMORY_LOG_LEVEL |
Logging verbosity (DEBUG, INFO, WARNING, ERROR) | INFO |
By contributing to code-memory, you agree that your contributions will be licensed under the MIT License.