From 1ce335c7fdd2f330828db605dda38868d595b48e Mon Sep 17 00:00:00 2001 From: Amp Date: Tue, 15 Sep 2026 18:03:30 +0000 Subject: [PATCH] chore: add Amp orb setup/resume and ignore generated artifacts Bootstrap rustup, rustfmt, clippy, and a C toolchain for Amp orbs. Keep .agents and .amp out of published crates, ignore example build output, and drop the checked-in preprocessor dump. Amp-Thread-ID: https://ampcode.com/threads/T-01a0a631-cbad-764e-a59c-662f4c6e0902 Co-authored-by: Max Carter --- .agents/resume | 22 +++++++++++ .agents/setup | 72 ++++++++++++++++++++++++++++++++++ .gitignore | 2 + Cargo.toml | 2 +- examples/demo-app/build/math.c | 20 ---------- 5 files changed, 97 insertions(+), 21 deletions(-) create mode 100755 .agents/resume create mode 100755 .agents/setup delete mode 100644 examples/demo-app/build/math.c diff --git a/.agents/resume b/.agents/resume new file mode 100755 index 0000000..003c126 --- /dev/null +++ b/.agents/resume @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Fast reconnect/repair after orb pause. Do not install packages here. +set -euo pipefail + +export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}" +export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" +export PATH="${CARGO_HOME}/bin:${PATH}" + +if [ -f "${CARGO_HOME}/env" ]; then + # shellcheck disable=SC1091 + source "${CARGO_HOME}/env" +fi + +if ! command -v rustc >/dev/null 2>&1; then + echo "[resume] rustc missing from PATH; run .agents/setup" >&2 + exit 1 +fi + +if ! command -v cc >/dev/null 2>&1 && ! command -v gcc >/dev/null 2>&1; then + echo "[resume] C compiler missing; run .agents/setup" >&2 + exit 1 +fi diff --git a/.agents/setup b/.agents/setup new file mode 100755 index 0000000..d5c147e --- /dev/null +++ b/.agents/setup @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# Fresh-orb bootstrap for equilibrium-ffi (Rust library + optional eq CLI). +set -euo pipefail + +log() { printf '[setup] %s\n' "$*"; } +step() { + local label="$1" + shift + local start + start="$(date +%s)" + log "start: ${label}" + "$@" + log "done: ${label} ($(( $(date +%s) - start ))s)" +} + +need_apt() { + local pkg + for pkg in "$@"; do + if ! dpkg -s "$pkg" >/dev/null 2>&1; then + return 0 + fi + done + return 1 +} + +if need_apt build-essential ca-certificates curl pkg-config; then + step "apt-get update" sudo apt-get update -qq + step "apt install build tools" sudo apt-get install -y --no-install-recommends \ + build-essential ca-certificates curl pkg-config +else + log "apt packages already present" +fi + +export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}" +export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" +export PATH="${CARGO_HOME}/bin:${PATH}" + +if ! command -v rustup >/dev/null 2>&1; then + step "install rustup" bash -c 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal' +else + log "rustup already installed" +fi +# shellcheck disable=SC1091 +source "${CARGO_HOME}/env" + +step "ensure stable toolchain" rustup toolchain install stable --profile minimal --no-self-update +step "ensure rustfmt+clippy" rustup component add rustfmt clippy --toolchain stable + +# Persist PATH for later non-interactive login shells (Amp / services). +profile_marker="# equilibrium-ffi rustup PATH" +if ! grep -Fqx "$profile_marker" "$HOME/.bash_profile" 2>/dev/null; then + cat >> "$HOME/.bash_profile" <" 1 -# 1 "" 3 -# 406 "" 3 -# 1 "" 1 -# 1 "" 2 -# 1 "/home/undivisible/equilibrium/demo-app/foreign-code/math.c" 2 - -int c_add(int a, int b) { - return a + b; -} - -int c_factorial(int n) { - if (n <= 1) return 1; - int result = 1; - for (int i = 2; i <= n; i++) { - result *= i; - } - return result; -}