|
1 | 1 | # Contributing to DevsContext |
2 | 2 |
|
3 | | -Thanks for your interest in contributing! |
4 | | - |
5 | 3 | ## Development Setup |
6 | 4 |
|
7 | 5 | ```bash |
8 | 6 | git clone https://github.com/anthropics/devscontext.git |
9 | 7 | cd devscontext |
| 8 | +python -m venv venv |
| 9 | +source venv/bin/activate |
10 | 10 | pip install -e ".[dev]" |
11 | 11 | ``` |
12 | 12 |
|
| 13 | +Configure for local testing: |
| 14 | +```bash |
| 15 | +cp .devscontext.yaml.example .devscontext.yaml |
| 16 | +# Edit .devscontext.yaml with your Jira URL |
| 17 | +export JIRA_EMAIL="you@company.com" |
| 18 | +export JIRA_API_TOKEN="your-token" |
| 19 | +``` |
| 20 | + |
13 | 21 | ## Running Tests |
14 | 22 |
|
| 23 | +Unit tests (no API keys needed): |
| 24 | +```bash |
| 25 | +pytest tests/ --ignore=tests/test_integration.py |
| 26 | +``` |
| 27 | + |
| 28 | +Integration tests (requires real API keys): |
15 | 29 | ```bash |
16 | | -pytest tests/ |
| 30 | +pytest tests/test_integration.py |
17 | 31 | ``` |
18 | 32 |
|
19 | | -## Code Style |
| 33 | +## Adding a New Adapter |
| 34 | + |
| 35 | +1. Create `src/devscontext/adapters/your_source.py`: |
| 36 | + - Extend the `Adapter` base class |
| 37 | + - Implement `fetch_context(task_id)` and `health_check()` |
| 38 | + - Add any source-specific methods (e.g., `search()`) |
| 39 | + |
| 40 | +2. Add config model to `src/devscontext/config.py` |
20 | 41 |
|
21 | | -We use ruff for linting and formatting: |
| 42 | +3. Wire into `src/devscontext/core.py`: |
| 43 | + - Add adapter initialization |
| 44 | + - Include in fetch/search flows |
22 | 45 |
|
| 46 | +4. Add tests in `tests/test_your_source.py` |
| 47 | + |
| 48 | +See `adapters/jira.py` as reference. |
| 49 | + |
| 50 | +## Code Quality |
| 51 | + |
| 52 | +Before submitting: |
23 | 53 | ```bash |
24 | 54 | ruff check . |
25 | 55 | ruff format . |
26 | 56 | mypy src/ |
| 57 | +pytest tests/ --ignore=tests/test_integration.py |
27 | 58 | ``` |
28 | 59 |
|
29 | | -## Pull Requests |
30 | | - |
31 | | -1. Fork the repo and create a branch from `main` |
32 | | -2. Add tests for any new functionality |
33 | | -3. Ensure tests pass and code is formatted |
34 | | -4. Submit a PR with a clear description |
| 60 | +Requirements: |
| 61 | +- Type hints on all functions |
| 62 | +- Pydantic models for data structures |
| 63 | +- Tests for new functionality |
35 | 64 |
|
36 | | -## Adding a New Adapter |
37 | | - |
38 | | -Adapters live in `src/devscontext/adapters/`. To add a new source: |
39 | | - |
40 | | -1. Create `adapters/your_source.py` extending `Adapter` base class |
41 | | -2. Implement `fetch_context()`, `health_check()`, and any source-specific methods |
42 | | -3. Add configuration model to `config.py` |
43 | | -4. Wire into `DevsContextCore` in `core.py` |
44 | | -5. Add tests in `tests/test_your_source.py` |
| 65 | +## Pull Requests |
45 | 66 |
|
46 | | -See `adapters/jira.py` as a reference implementation. |
| 67 | +1. Fork and create a branch from `main` |
| 68 | +2. Make your changes with tests |
| 69 | +3. Ensure all checks pass |
| 70 | +4. Open a PR describing what and why |
47 | 71 |
|
48 | 72 | ## Questions? |
49 | 73 |
|
50 | | -Open an issue or start a discussion. |
| 74 | +Open an issue. |
0 commit comments