# `just` lists the targets. Install: uv tool install rust-just. Every recipe is a plain command.

set shell := ["bash", "-uo", "pipefail", "-c"]

# load secrets/config from .env (gitignored)
set dotenv-load := true

# run the app with hot reload
dev:
    # `python`, not `uv run python`: the app must be watchfiles' direct child.
    # A nested `uv run` wrapper swallows watchfiles' kill and leaves an orphan.
    uv run watchfiles 'python -m app.main' app/ static/

# run the app once, no reload
serve:
    uv run python -m app.main

# format, fix lint, typecheck, test (with the Stario lint); runs every step, prints only problems.
# Without just: uvx stario-create@latest check
check:
    #!/usr/bin/env bash
    status=0
    uv run ruff format -q . || status=1
    uv run ruff check -q --fix . || status=1
    uv run pyrefly check 2>&1 | grep -v ' INFO '; [ "${PIPESTATUS[0]}" = 0 ] || status=1
    uv run pytest -q --no-header || status=1
    exit $status

# the same checks without changes, for CI
ci:
    uv run ruff format --check .
    uv run ruff check .
    uv run pyrefly check
    uv run pytest -q

# run the tests
test *args:
    uv run pytest -q --no-header {{args}}

# refresh AGENTS.md, the skills, and the Cloud Agent files from the latest stario-create
sync:
    uvx stario-create@latest sync
