fix(install): try offline cargo build first, fall back to online

Offline build is attempted first so a fresh clone with a warm registry
cache can install without network. On failure, fall back to a regular
cargo build --release which will fetch from crates.io.
This commit is contained in:
Parfii-bot 2026-04-21 03:46:32 +08:00
parent 33192a06e0
commit 5fa4bb9777

View file

@ -234,8 +234,13 @@ if [[ -d "$KIT_DIR/skills" ]]; then
fi
# --- build assembler -------------------------------------------------------
say "building Rust assembler (cargo build --release)"
( cd "$AGENTS_DIR/_assembler" && cargo build --release )
# Prefer offline build (fresh-clone on a no-network machine should still work
# if the registry cache is warm). Fall back to online fetch on failure.
say "building Rust assembler (cargo build --release, offline first)"
if ! ( cd "$AGENTS_DIR/_assembler" && cargo build --release --offline ) 2>/tmp/keiseikit-cargo-offline.log; then
say "offline build failed — fetching deps from crates.io"
( cd "$AGENTS_DIR/_assembler" && cargo build --release )
fi
if [[ ! -x "$AGENTS_DIR/_assembler/target/release/assemble" ]]; then
err "build succeeded but binary not found at $AGENTS_DIR/_assembler/target/release/assemble"
exit 2