|
| 1 | +# Claude Code Configuration |
| 2 | + |
| 3 | +This directory contains configuration for using this project with Claude Code, particularly in the online environment. |
| 4 | + |
| 5 | +## SessionStart Hook |
| 6 | + |
| 7 | +The `hooks/SessionStart` script automatically runs when a new Claude Code session begins. It: |
| 8 | + |
| 9 | +1. **Installs pixi** (if not already installed) - The package and environment manager |
| 10 | +2. **Installs project dependencies** - All Python packages and tools defined in `pyproject.toml` |
| 11 | +3. **Sets up pre-commit hooks** - For automatic code quality checks |
| 12 | +4. **Configures git** - Sets up merge drivers for lockfiles |
| 13 | + |
| 14 | +## Usage with Claude Code Online |
| 15 | + |
| 16 | +When you start a Claude Code online session, the SessionStart hook will automatically run and set up your environment. You'll see output indicating the setup progress. |
| 17 | + |
| 18 | +### Available Commands |
| 19 | + |
| 20 | +Once setup is complete, Claude can use these pixi tasks: |
| 21 | + |
| 22 | +#### Testing & Quality |
| 23 | +- `pixi run test` - Run pytest tests |
| 24 | +- `pixi run coverage` - Run tests with coverage report |
| 25 | +- `pixi run lint` - Run ruff and pylint linters |
| 26 | +- `pixi run format` - Format code with ruff |
| 27 | + |
| 28 | +#### CI Tasks |
| 29 | +- `pixi run ci` - Run full CI pipeline (format, lint, test, coverage) |
| 30 | +- `pixi run fix` - Auto-fix common issues (update lock, format, lint) |
| 31 | + |
| 32 | +#### Pre-commit |
| 33 | +- `pixi run pre-commit` - Run all pre-commit hooks |
| 34 | +- `pixi run pre-commit-update` - Update pre-commit hook versions |
| 35 | + |
| 36 | +### How It Works |
| 37 | + |
| 38 | +1. **First session**: The hook installs pixi and all dependencies (may take a few minutes) |
| 39 | +2. **Subsequent sessions**: The hook verifies the environment is ready (much faster) |
| 40 | +3. **Environment activated**: All pixi commands are available to Claude |
| 41 | + |
| 42 | +### Troubleshooting |
| 43 | + |
| 44 | +If you encounter issues: |
| 45 | + |
| 46 | +1. **Dependencies not found**: Run `pixi install` manually |
| 47 | +2. **Lockfile conflicts**: Run `pixi run update-lock` |
| 48 | +3. **Pre-commit issues**: Run `pixi run pre-commit-update` |
| 49 | +4. **Full reset**: Delete `.pixi` directory and restart session |
| 50 | + |
| 51 | +### Customization |
| 52 | + |
| 53 | +You can modify `hooks/SessionStart` to: |
| 54 | +- Install additional tools |
| 55 | +- Run custom setup scripts |
| 56 | +- Configure environment variables |
| 57 | +- Set up external services |
| 58 | + |
| 59 | +## Learn More |
| 60 | + |
| 61 | +- [Claude Code Documentation](https://docs.claude.com/claude-code) |
| 62 | +- [Pixi Documentation](https://pixi.sh) |
| 63 | +- [Project README](../README.md) |
0 commit comments