# nasfai — dev task surface. `just` lists recipes; `just <name>` runs one.

# Lint + tests with the coverage gate (mirrors CI). The default `just`.
default: lint test-cov

# The full pre-push gate — exactly what CI runs. Green here ⇒ green in CI.
ci: lint test-cov build

# Install all deps incl. extras + dev group into the uv-managed venv.
sync:
    uv sync --all-extras

# Update the lockfile.
lock:
    uv lock

# Run the test suite (pass extra args, e.g. `just test -k lineage`).
test *ARGS:
    uv run pytest {{ARGS}}

# Tests with coverage, failing under 80% on the package (as CI runs them).
test-cov:
    uv run pytest --cov=nasfai --cov-report=term-missing --cov-fail-under=80

# Coverage with a browsable HTML report at htmlcov/index.html.
cov-html:
    uv run pytest --cov=nasfai --cov-report=html
    @echo "open htmlcov/index.html"

# Static checks: lint, format-check, types.
lint:
    uv run ruff check .
    uv run ruff format --check .
    uv run mypy src

# Just the type-checker.
typecheck:
    uv run mypy src

# Auto-fix lint + format.
fix:
    uv run ruff check --fix .
    uv run ruff format .

# Build the wheel + sdist.
build:
    uv build

# Run the CLI: `just evolve --blueprint claude-sdk-coder --run examples/.../run.yaml`.
evolve *ARGS:
    uv run nasfai {{ARGS}}

# Run the flagship mock example end-to-end, then open the dashboard.
demo:
    uv run nasfai evolve --run examples/claude_sdk_coding_agent/run.mock.yaml
    uv run nasfai serve

# Launch the local dashboard to browse, trace, and compare runs.
serve *ARGS:
    uv run nasfai serve {{ARGS}}

# Opt-in live tests (need provider credentials).
live:
    uv run pytest -m live

# Remove caches and build/run artifacts.
clean:
    rm -rf dist .pytest_cache .mypy_cache .ruff_cache htmlcov .coverage
