|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +vcspull is a Python tool for managing and synchronizing multiple git, svn, and mercurial repositories via YAML or JSON configuration files. It allows users to pull/update multiple repositories in a single command, optionally filtering by repository name, path, or VCS URL. |
| 8 | + |
| 9 | +## Development Environment |
| 10 | + |
| 11 | +### Setup and Installation |
| 12 | + |
| 13 | +```bash |
| 14 | +# Install development dependencies with uv |
| 15 | +uv pip install -e . |
| 16 | +``` |
| 17 | + |
| 18 | +### Common Commands |
| 19 | + |
| 20 | +#### Testing |
| 21 | + |
| 22 | +```bash |
| 23 | +# Run all tests |
| 24 | +uv run pytest |
| 25 | + |
| 26 | +# Run specific test(s) |
| 27 | +uv run pytest tests/test_cli.py |
| 28 | +uv run pytest tests/test_cli.py::test_sync |
| 29 | + |
| 30 | +# Watch mode for tests (auto re-run on file changes) |
| 31 | +uv run ptw . |
| 32 | +# or |
| 33 | +make start |
| 34 | +``` |
| 35 | + |
| 36 | +#### Code Quality |
| 37 | + |
| 38 | +```bash |
| 39 | +# Format code with ruff |
| 40 | +uv run ruff format . |
| 41 | +# or |
| 42 | +make ruff_format |
| 43 | + |
| 44 | +# Run ruff linting |
| 45 | +uv run ruff check . |
| 46 | +# or |
| 47 | +make ruff |
| 48 | + |
| 49 | +# Run mypy type checking |
| 50 | +uv run mypy |
| 51 | +# or |
| 52 | +make mypy |
| 53 | + |
| 54 | +# Watch mode for linting (using entr) |
| 55 | +make watch_ruff |
| 56 | +make watch_mypy |
| 57 | +``` |
| 58 | + |
| 59 | +#### Documentation |
| 60 | + |
| 61 | +```bash |
| 62 | +# Build documentation |
| 63 | +make build_docs |
| 64 | + |
| 65 | +# Start documentation server (auto-reload) |
| 66 | +make start_docs |
| 67 | +``` |
| 68 | + |
| 69 | +## Code Architecture |
| 70 | + |
| 71 | +### Core Components |
| 72 | + |
| 73 | +1. **Configuration** |
| 74 | + - `config.py`: Handles loading and parsing of YAML/JSON configuration files |
| 75 | + - `_internal/config_reader.py`: Low-level config file reading |
| 76 | + |
| 77 | +2. **CLI** |
| 78 | + - `cli/__init__.py`: Main CLI entry point with argument parsing |
| 79 | + - `cli/sync.py`: Repository synchronization functionality |
| 80 | + - `cli/add.py`: Adding new repositories to configuration |
| 81 | + - `cli/add_from_fs.py`: Scanning filesystem for repositories |
| 82 | + |
| 83 | +3. **Repository Management** |
| 84 | + - Uses `libvcs` package for VCS operations (git, svn, hg) |
| 85 | + - Supports custom remotes and URL schemes |
| 86 | + |
| 87 | +### Configuration Format |
| 88 | + |
| 89 | +Configuration files are stored as YAML or JSON in either: |
| 90 | +- `~/.vcspull.yaml`/`.json` (home directory) |
| 91 | +- `~/.config/vcspull/` directory (XDG config) |
| 92 | + |
| 93 | +Example format: |
| 94 | +```yaml |
| 95 | +~/code/: |
| 96 | + flask: "git+https://github.com/mitsuhiko/flask.git" |
| 97 | +~/study/c: |
| 98 | + awesome: "git+git://git.naquadah.org/awesome.git" |
| 99 | +``` |
| 100 | +
|
| 101 | +### Testing |
| 102 | +
|
| 103 | +Tests use pytest and are organized by component functionality: |
| 104 | +- `tests/test_cli.py`: Tests for CLI functionality |
| 105 | +- `tests/test_config.py`: Tests for configuration parsing |
| 106 | +- `tests/test_sync.py`: Tests for repository synchronization |
| 107 | + |
| 108 | +## Best Practices |
| 109 | + |
| 110 | +1. **Types**: The codebase uses strict typing with mypy. All new code should include proper type annotations. |
| 111 | + |
| 112 | +2. **Docstrings**: The project follows NumPy docstring style for all functions and methods. |
| 113 | + |
| 114 | +3. **Error Handling**: Exceptions are defined in `exc.py`. Use appropriate exception types. |
| 115 | + |
| 116 | +4. **Testing Approach**: |
| 117 | + - Tests use fixtures extensively (see `conftest.py` and `tests/fixtures/`) |
| 118 | + - CLI tests use parameter fixtures with clear IDs for readability |
0 commit comments