This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a GitOps tool for managing multiple applications across Kubernetes clusters. It consists of two main components:
- GitOps CLI (
gitops/) - Command-line tool for managing app deployments, built using theinvokeframework - GitOps Server (
gitops_server/) - FastAPI-based webhook server that handles deployment automation
# Install dependencies using uv
uv sync
# Install the CLI tool for development
uv tool install -e .# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/test_core.py
# Run with coverage
uv run pytest --cov=gitops --cov=gitops_server# Format code with ruff
uv run ruff format .
# Lint code
uv run ruff check .
# Fix auto-fixable linting issues
uv run ruff check --fix .
# Type checking with mypy
uv run mypy gitops/ gitops_server/# Run gitops commands during development
uv run python -m gitops.main --help
# Or if installed globally
gitops --help# Run the gitops server locally
uv run uvicorn gitops_server.main:app --reload- main.py: Entry point using invoke's Program framework
- core.py: Main CLI commands (bump, summary, etc.)
- shorthands.py: Shorthand command aliases
- settings.py: Configuration management
- utils/: Helper modules for apps, images, kubernetes operations, CLI formatting, etc.
- main.py: FastAPI application entry point with webhook endpoint
- app.py: FastAPI app configuration
- workers/: Background workers for deployment operations
- workers/deploy.py: Main deployment loop code
- workers/worker.py: Entry point for recieving webhook
- utils/: Git, GitHub, and Slack integration utilities
- Uses
invokeframework for CLI task definitions - Async operations with progress bars for CLI commands
- FastAPI with webhook validation for server component
- Kubernetes operations through the
kubernetes_asynciolibrary - Git operations for managing cluster repository state
- Environment Variables: Set
GITOPS_APPS_DIRECTORYto specify the apps directory location - Secrets: Server configuration goes in
secrets.env(seesecrets.example.env) - Ruff Config: Located in
ruff.tomlwith specific rules for this codebase - Dependencies: Managed through
pyproject.tomlwith separate server optional dependencies
- Tests are in the
tests/directory - Uses pytest with async support (
pytest-asyncio) - Sample data and webhook fixtures in
sample_data.pyandwebhook_sample_data.py - Conftest provides shared test configuration