#!/usr/bin/env bash # One-shot: clone (optional) + build CST-Agent on Linux. set -euo pipefail REPO_URL="${CST_AGENT_REPO:-https://git.whcself.xyz/WHC/CST-agent.git}" DIR="${1:-}" if [[ -z "$DIR" ]]; then if [[ -f Makefile && -d src ]]; then DIR="$(pwd)" else DIR="CST-agent" fi fi if [[ ! -f "$DIR/Makefile" ]]; then echo "==> git clone $REPO_URL -> $DIR" git clone "$REPO_URL" "$DIR" fi cd "$DIR" echo "==> deps hint: gcc/clang make cmake libcurl ncursesw (zenity optional)" if command -v pacman >/dev/null 2>&1; then echo " Arch: sudo pacman -S --needed base-devel cmake curl ncurses" elif command -v apt-get >/dev/null 2>&1; then echo " Debian: sudo apt install build-essential cmake libcurl4-openssl-dev libncurses-dev" fi echo "==> make" make -j"$(nproc 2>/dev/null || echo 4)" make check || true echo echo "OK: ./cst-agent" echo "OpenAI-compatible env (see docs/env_openai.md):" echo " export OPENAI_API_KEY=sk-..." echo " export OPENAI_BASE_URL=https://api.openai.com/v1" echo " export OPENAI_MODEL=gpt-4.1-mini" echo " ./cst-agent --workspace ." echo "Or MiniMax default: export CST_API_KEY=... && ./cst-agent --workspace ."