Development Guide¶
Welcome to the Echomine development documentation! This section contains detailed guides for contributors working on the project.
Quick Navigation¶
Getting Started¶
- Setup Guide: Environment setup and installation
- Workflows: Common development workflows
Development Standards¶
- Testing Guide: Writing and running tests (TDD)
- Type Checking: mypy --strict usage and patterns
- Documentation: Writing docs and docstrings
Overview¶
Echomine follows strict development practices to ensure quality, type safety, and maintainability. All contributors must follow these standards.
Core Principles¶
- Test-Driven Development (TDD)
- Write tests FIRST (RED phase)
- Implement minimal code to pass (GREEN phase)
-
Refactor while keeping tests green (REFACTOR phase)
-
Type Safety
- mypy --strict must pass with zero errors
- All functions must have type hints
-
No
Anytypes in public API -
Library-First Architecture
- Core functionality in
src/echomine/(importable library) - CLI wraps library, never the reverse
-
All features available programmatically
-
Memory Efficiency
- O(1) memory usage via streaming
- ijson for parsing large files
- Generator patterns for all iterations
For complete development guidelines, see CONTRIBUTING.md.
Development Workflow Overview¶
graph TD
A[Create Feature Branch] --> B[Write Failing Test RED]
B --> C[Run Test - Verify Failure]
C --> D[Implement Code GREEN]
D --> E[Run Test - Verify Pass]
E --> F[Refactor]
F --> G{More Tests?}
G -->|Yes| B
G -->|No| H[Run Quality Checks]
H --> I[mypy --strict]
H --> J[ruff check/format]
H --> K[pytest --cov]
I --> L{All Pass?}
J --> L
K --> L
L -->|No| M[Fix Issues]
M --> H
L -->|Yes| N[Commit & Push]
N --> O[Create PR]
Quick Reference Commands¶
Testing¶
# All tests with coverage
pytest --cov=echomine --cov-report=term-missing
# Unit tests only (fast)
pytest tests/unit/ -v
# Watch mode (requires pytest-watch)
ptw -- tests/unit/
Type Checking¶
# Strict type checking
mypy --strict src/echomine/
# Check with tests too
mypy --strict src/echomine/ tests/
Linting and Formatting¶
# Auto-fix linting issues
ruff check --fix src/ tests/
# Format code
ruff format src/ tests/
# Check without making changes
ruff check src/ tests/
ruff format --check src/ tests/
Pre-Commit¶
Documentation¶
# Build docs locally
mkdocs build
# Serve docs with live reload
mkdocs serve
# Deploy to GitHub Pages
mkdocs gh-deploy
Project Structure¶
echomine/
├── src/echomine/ # Library (importable, reusable)
│ ├── models/ # Pydantic data models
│ ├── protocols/ # Protocol definitions
│ ├── adapters/ # Provider implementations
│ ├── search/ # Search and ranking
│ ├── utils/ # Utilities (logging, exceptions)
│ └── cli/ # CLI commands (wraps library)
├── tests/
│ ├── unit/ # Fast, isolated tests (70%)
│ ├── integration/ # Component interaction (20%)
│ ├── contract/ # Protocol compliance (5%)
│ ├── performance/ # Benchmarks (5%)
│ └── fixtures/ # Test data
├── docs/ # Documentation (mkdocs)
├── specs/ # Feature specifications
└── .claude/ # AI agent coordination
Development Standards¶
Code Quality Gates¶
All code must pass these checks before merging:
- ✅ Tests:
pytestpasses with >80% coverage - ✅ Type Checking:
mypy --strictpasses with zero errors - ✅ Linting:
ruff checkpasses - ✅ Formatting:
ruff format --checkpasses - ✅ Documentation: All public APIs have docstrings
- ✅ Conventional Commits: Commit messages follow format
Constitution Principles¶
The project follows 8 constitution principles (non-negotiable):
- Library-First Architecture
- CLI Interface Contract (stdout/stderr separation)
- Test-Driven Development (TDD mandatory)
- Observability & Debuggability (JSON logs)
- Simplicity & YAGNI
- Strict Typing Mandatory (mypy --strict)
- Multi-Provider Adapter Pattern
- Memory Efficiency & Streaming
For details, see Architecture or specs/001-ai-chat-parser/constitution.md.
Getting Help¶
- General Development: Read CONTRIBUTING.md
- Setup Issues: See Setup Guide
- Testing Questions: See Testing Guide
- Type Errors: See Type Checking Guide
- Other Questions: Open an issue or start a discussion
Next Steps¶
- New to the project? Start with Setup Guide
- Ready to code? Review Workflows
- Writing tests? See Testing Guide
- Type errors? Check Type Checking Guide
- Updating docs? Read Documentation Guide
Last Updated: 2025-11-28