Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .agents/resume
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Fast orb resume: ensure Rust is on PATH. Do not install packages here.
set -euo pipefail

if [[ -f "${HOME}/.cargo/env" ]]; then
# shellcheck disable=SC1091
source "${HOME}/.cargo/env"
fi

if ! command -v rustc >/dev/null 2>&1 || ! command -v cargo >/dev/null 2>&1; then
echo "[resume] rustc/cargo missing; run .agents/setup" >&2
exit 1
fi
60 changes: 60 additions & 0 deletions .agents/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
# Idempotent orb setup for inauguration: Rust toolchain + in-cli lockfile fetch.
set -euo pipefail

step() {
local label="$1"
shift
echo "[setup] ${label}"
local start
start="$(date +%s)"
"$@"
echo "[setup] ${label} ($(( $(date +%s) - start ))s)"
}

need_pkg() {
dpkg -s "$1" >/dev/null 2>&1
}

missing=()
for pkg in build-essential pkg-config curl ca-certificates; do
need_pkg "$pkg" || missing+=("$pkg")
done
if ((${#missing[@]})); then
step "apt-get update" sudo apt-get update -qq
step "apt-get install" sudo apt-get install -y -qq "${missing[@]}"
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 default --component rustfmt,clippy,rust-src'
fi

# shellcheck disable=SC1091
source "${CARGO_HOME}/env"

step "rustup default stable" rustup default stable
step "rustup components" rustup component add rustfmt clippy rust-src

profile_marker="# inauguration rustup"
if ! grep -Fqx "$profile_marker" "$HOME/.bash_profile" 2>/dev/null; then
cat >> "$HOME/.bash_profile" <<EOF

$profile_marker
if [[ -f "\$HOME/.cargo/env" ]]; then
# shellcheck disable=SC1091
source "\$HOME/.cargo/env"
fi
EOF
fi

if [[ -f in-cli/Cargo.lock ]]; then
step "cargo fetch in-cli" cargo fetch --locked --manifest-path in-cli/Cargo.toml
fi

echo "[setup] rustc=$(rustc --version)"
echo "[setup] cargo=$(cargo --version)"
echo "[setup] done"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ docs-site/.wrangler/

# moonshine docs-site deps
docs-site/node_modules/

# Amp orb portals (local)
.amp/portals/
Loading