# Repetitive workflows. Anything a release or a review runs twice belongs here,
# so a step cannot be forgotten by hand.
#
# Recipes only. Every decision the release makes lives in tools/cut.zig, which
# `zig build test` type-checks and covers; this file exists so nobody has to
# remember the invocation.

# every recipe, described
default:
    @just --list

# unit suite
test:
    zig build test

# unit + integration suite, which already runs the whole ordinary suite
itest:
    zig build test -Dintegration

# The committed npm scripts, never npx: npx can fetch an unpinned package.

# admin: typecheck, tests, lint, formatting
admin-check:
    cd admin && npm run typecheck && npm run test && npm run lint && npm run format:check

# admin/src/lib/contractSamples.gen.ts is a committed golden of live API bodies
# the admin tests assert against; this is the invocation AGENTS.md documents.

# regenerate the admin contract goldens from live responses
goldens:
    zig build test -Dintegration -Dcontract-samples-out="$PWD/admin/src/lib/contractSamples.gen.ts"

# the binary with the real admin UI embedded (a plain `zig build` embeds a placeholder page)
build:
    cd admin && npm run build
    zig build -Dadmin-dist=admin/dist

# Not the CI gate: this skips the admin `npm run build` and `assert-bundled`,
# the cross-target builds and verify-dist.

# the fast local checks
verify: itest admin-check
    zig fmt --check build.zig src tools

# kind is major, minor or patch: the version itself is derived from
# build.zig.zon, never typed, because a published tag cannot be corrected.
# Requires a clean tree, master, and a dated CHANGELOG.md section for the
# derived version. Preflight, bump, push, wait for CI, signed tag, watch the run.

# cut a release
release kind:
    zig build cut -- {{kind}}
