set shell := ["bash", "-euo", "pipefail", "-c"]
set positional-arguments
export UV_CACHE_DIR := justfile_directory() + "/.cache/uv"
export UV_PYTHON_INSTALL_DIR := justfile_directory() + "/.cache/uv-python"
default:
    @just --list
version:
    @cat VERSION
join:
    bash scripts/join.sh
status:
    docker compose -f compose.yaml -f compose.peer.yaml ps
    curl --fail --silent --show-error http://127.0.0.1:18080/health
wallet *args:
    docker compose run --rm toolbox scripts/wallet.mjs "$@"
node-proof *args:
    docker compose run --rm toolbox scripts/node-proof.mjs "$@"
light-up:
    uv run --no-project --no-config --no-cache python scripts/light-init.py
light-wallet *args:
    docker compose -f compose.wallet.yaml run --rm wallet scripts/wallet.mjs "$@"
http-wallet *args:
    uv run --no-project --no-config --no-cache python scripts/http-wallet.py "$@"
site-build:
    uv run --no-project --no-config --no-cache python scripts/site_build.py
site-preview:
    uv run --no-project --no-config --no-cache python scripts/site_build.py --output dist/site --base-url http://localhost:49944
    docker compose -f compose.preview.yaml up -d
web-plan:
    uv run --no-project --no-config --no-cache python scripts/web_deploy.py plan
web-check:
    uv run --no-project --no-config --no-cache python scripts/web_deploy.py check
web-dns *args:
    uv run --no-project --no-config --no-cache python scripts/web_dns.py "$@"
web-deploy:
    uv run --no-project --no-config --no-cache python scripts/web_deploy.py deploy
cloudflare-install:
    npm ci --prefix web --cache .cache/npm --ignore-scripts --no-audit --no-fund
cloudflare-plan:
    uv run --no-project --no-config --no-cache python scripts/cloudflare.py plan
cloudflare-infrastructure:
    uv run --no-project --no-config --no-cache python scripts/cloudflare.py infrastructure
cloudflare-publish:
    uv run --no-project --no-config --no-cache python scripts/cloudflare.py publish
cloudflare-status:
    uv run --no-project --no-config --no-cache python scripts/cloudflare.py status
backup:
    docker compose run --rm toolbox scripts/backup.mjs create
    docker compose run --rm toolbox scripts/backup.mjs verify
test:
    uv run --no-project --no-config --no-cache python scripts/test.py
