Files
zeekay 57c9521f14 The engine rides with hanzo; one gen pin; the lane's check stops depending on the day
hanzo.sh installs `dev` with `hanzo` and lists it nowhere, so `upgrade` names
hanzo and brings the engine (with_engine) and refuses `dev` as a name; the
install hints say "run the installer", not "-- dev". hanzo-gen is pinned once, in
[workspace.dependencies], at 41cb6d8 (0.1.3: a run's commit says Hanzo, not Hanzo
Dev); the identity crate had its own rev and linked a second copy.

generate.sh --check handed genspec the document api.hanzo.ai serves now, which
moves every few hours, so every push went red once cloud shipped (a8c4fe1,
adeb1c4). It rules on spec/cloud.json only while that document is the one
.spec-lock names; moved, it says a re-pin is due and still checks the generated
tree. 34d5ec2c made `chain up` need a network and left one parse test on it:
`chain status` there.

hanzoai/cli#64.

Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
2026-11-21 02:51:20 -08:00

34 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env sh
# Generate from the API document supplied by value in SPEC. SPEC_REF identifies
# the API release that supplied it. CI and make spec-check use the public
# /v1/openapi.json document; .spec-lock records its digest.
# --check refuses any projection change without rewriting files.
set -eu
cd "$(dirname "$0")/.."
# An apostrophe inside ${VAR:?word} opens a quote the parser never closes, and
# the whole script then fails to parse rather than this line failing to run.
[ -n "${SPEC:-}" ] || { echo "generate.sh: SPEC must name the cloud API document; the client lane in hanzoai/ci sets it" >&2; exit 1; }
export HANZO_REGISTRY="$SPEC" HANZO_SPEC_REF="${SPEC_REF:-unpinned}"
if [ "${1:-}" = "--check" ]; then
# genproduct reads the committed spec, so it answers on any day. genspec reads
# the document, so it answers only for the document .spec-lock names: the server
# moves every few hours, and a moved document is a re-pin due, not a defect in
# this tree. Two runs of one commit must agree.
cargo run --quiet --features maintainer --bin genproduct --locked -- --check
have=$(sed -n 's/^sha256=//p' .spec-lock)
got=$(sha256sum "$SPEC" | cut -d' ' -f1)
if [ "$got" = "$have" ]; then
cargo run --quiet --features maintainer --bin genspec --locked -- --check
else
echo "generate.sh: the document moved since .spec-lock ($have, now $got): a re-pin is due; spec/cloud.json is not checked against it"
fi
exit 0
fi
cargo run --quiet --features maintainer --bin genspec --locked
cargo run --quiet --features maintainer --bin genproduct --locked