From 87980fce00bcfbf1a20fb32c7895879a559fcf5f Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Fri, 30 Oct 2026 04:17:29 +0000 Subject: [PATCH] chore: recover verified orb setup Amp-Thread-ID: https://ampcode.com/threads/T-01a18715-4e00-708e-a87d-6bd109748d66 --- .agents/setup | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 53 insertions(+) create mode 100755 .agents/setup diff --git a/.agents/setup b/.agents/setup new file mode 100755 index 0000000000..68571288bd --- /dev/null +++ b/.agents/setup @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Prepares a fresh Amp orb: Rust stable, Python 3.12 and the locked uv environment with the +# native extension built. Idempotent; a warm run on a restored snapshot only re-verifies. +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_root" + +step() { + local name="$1" + shift + local start=$SECONDS + echo "==> ${name}" + "$@" + echo "<== ${name} ($((SECONDS - start))s)" +} + +# One persistent Cargo target directory per worktree, outside the repository (see AGENTS.md). +target_dir="$HOME/.cache/cargo-target/$(basename "$repo_root")" +export CARGO_TARGET_DIR="$target_dir" +export PATH="$HOME/.cargo/bin:$PATH" + +install_rust() { + if ! command -v rustup >/dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ + | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable \ + --component clippy --component rustfmt + else + # CI lints with the latest stable toolchain. + rustup update stable --no-self-update + rustup component add clippy rustfmt --toolchain stable + fi +} + +persist_env() { + local marker="# sqlbuild orb environment (${repo_root})" + if ! grep -Fqx "$marker" "$HOME/.bash_profile" 2>/dev/null; then + cat >>"$HOME/.bash_profile" <