# AgentChaos developer command shortcuts.
# Run `just` (no args) to list all available commands.

default:
    @just --list

# === Setup ===

# Install dev dependencies into local venv
install:
    uv pip install -e ".[dev]"

# Install all extras (langgraph, openai, anthropic, docs)
install-all:
    uv pip install -e ".[dev,all]"

# Install pre-commit hooks
hooks:
    pre-commit install

# === Quality ===

# Run linter
lint:
    ruff check .

# Auto-format code
fmt:
    ruff format .

# Type check
typecheck:
    mypy agent_chaos tests examples

# Run all unit tests
test:
    pytest -v

# Run tests with coverage report
test-cov:
    pytest --cov=agent_chaos --cov-report=term-missing --cov-report=html

# Run only fast tests (skip slow / integration)
test-fast:
    pytest -v -m "not slow and not integration"

# All quality checks (lint + typecheck + test)
check: lint typecheck test

# === Docs ===

# Serve docs locally at http://localhost:8000
docs-serve:
    mkdocs serve

# Build static docs site
docs-build:
    mkdocs build

# === Release ===

# Build distribution artifacts
build:
    rm -rf dist/
    uv build

# Publish to PyPI (requires UV_PUBLISH_TOKEN env var)
publish: build
    uv publish

# === Cleanup ===

clean:
    rm -rf dist build site
    rm -rf .pytest_cache .mypy_cache .ruff_cache .coverage htmlcov
    find . -type d -name __pycache__ -exec rm -rf {} +
    find . -type f -name "*.pyc" -delete

# === Examples ===

# Run the no-API-key pytest demo and write a JSON report
example-basic:
    pytest examples/basic --chaos --chaos-report chaos_reports/basic.json -q

# Run tau-bench example (requires API keys)
example-tau-bench:
    python examples/tau_bench/run.py
