Files
wehub-resource-sync bcbd1bdb22
Integ / changes (push) Has been skipped
Pre-commit / pre-commit (push) Failing after 1s
CLI exit codes / changes (push) Has been skipped
Test (Install) / changes (push) Has been skipped
Test (Python) / changes (push) Has been skipped
Test (TypeScript) / changes (push) Has been skipped
CLI exit codes / cli-gate (push) Has been cancelled
Test (Install) / test-install-gate (push) Has been cancelled
Integ / integ-gate (push) Has been cancelled
Test (Python) / test-python-gate (push) Has been cancelled
Test (TypeScript) / test-typescript-gate (push) Has been cancelled
Test (Install) / python-minimal (3.12) (push) Has been cancelled
Test (Install) / python-minimal (3.11) (push) Has been cancelled
Test (Install) / python-extra (agno, mirage.agents.agno) (push) Has been cancelled
Test (Install) / python-extra (chroma, mirage.resource.chroma) (push) Has been cancelled
Test (Install) / python-extra (pdf, mirage.core.filetype.pdf) (push) Has been cancelled
Integ / integ (push) Has been cancelled
Integ / integ-database (push) Has been cancelled
Integ / integ-database-ts (push) Has been cancelled
Integ / integ-data (push) Has been cancelled
Integ / integ-ssh (push) Has been cancelled
Integ / integ-ssh-ts (push) Has been cancelled
Test (Python) / audit (push) Has been cancelled
Test (TypeScript) / test (push) Has been cancelled
Test (TypeScript) / python-fs-shim (push) Has been cancelled
CLI exit codes / Python CLI (push) Has been cancelled
CLI exit codes / TypeScript CLI (push) Has been cancelled
CLI exit codes / Cross-language snapshot interop (push) Has been cancelled
Test (Python) / test (push) Has been cancelled
Test (Python) / import-isolation (deepagents, openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Python) / import-isolation (deepagents, pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Integ / integ-ts (push) Has been cancelled
Integ / integ-fuse (push) Has been cancelled
Test (Install) / python-extra (databricks, mirage.resource.databricks_volume) (push) Has been cancelled
Test (Install) / python-extra (deepagents, mirage.agents.langchain) (push) Has been cancelled
Test (Install) / python-extra (email, mirage.resource.email) (push) Has been cancelled
Test (Install) / python-extra (fuse, mirage.fuse.mount) (push) Has been cancelled
Test (Install) / python-extra (hdf5, mirage.core.filetype.hdf5) (push) Has been cancelled
Test (Install) / python-extra (hf, mirage.resource.hf_buckets) (push) Has been cancelled
Test (Install) / python-extra (lancedb, mirage.resource.lancedb) (push) Has been cancelled
Test (Install) / python-extra (langfuse, mirage.resource.langfuse) (push) Has been cancelled
Test (Install) / python-extra (mongodb, mirage.resource.mongodb) (push) Has been cancelled
Test (Install) / python-extra (nextcloud, mirage.resource.nextcloud) (push) Has been cancelled
Test (Install) / python-extra (openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Install) / python-extra (openhands, mirage.agents.openhands, 3.12) (push) Has been cancelled
Test (Install) / python-extra (parquet, mirage.core.filetype.parquet) (push) Has been cancelled
Test (Install) / python-extra (postgres, mirage.resource.postgres) (push) Has been cancelled
Test (Install) / python-extra (pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Test (Install) / python-extra (qdrant, mirage.resource.qdrant) (push) Has been cancelled
Test (Install) / python-extra (redis, mirage.resource.redis) (push) Has been cancelled
Test (Install) / python-extra (s3, mirage.resource.s3) (push) Has been cancelled
Test (Install) / python-extra (ssh, mirage.resource.ssh) (push) Has been cancelled
Test (Install) / ts-minimal (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:30:44 +08:00

100 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Mirage installer (TypeScript CLI)
# Usage: curl -fsSL https://strukto.ai/mirage/install.sh | sh
PKG="@struktoai/mirage-cli"
MIN_NODE_MAJOR=20
RESET='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
info() { printf "${BOLD}info${RESET}: %s\n" "$1"; }
warn() { printf "${YELLOW}warn${RESET}: %s\n" "$1"; }
err() { printf "${RED}error${RESET}: %s\n" "$1" >&2; exit 1; }
ok() { printf "${GREEN}ok${RESET}: %s\n" "$1"; }
OS=$(uname -s)
case "$OS" in
Darwin|Linux) ;;
*) err "Unsupported OS: $OS. Mirage supports macOS and Linux." ;;
esac
ARCH=$(uname -m)
case "$ARCH" in
x86_64|amd64|arm64|aarch64) ;;
*) err "Unsupported architecture: $ARCH." ;;
esac
if ! command -v curl >/dev/null 2>&1; then
err "curl is required but not installed."
fi
node_major() {
node -e 'process.stdout.write(String(process.versions.node.split(".")[0]))' 2>/dev/null || echo 0
}
ensure_node() {
if command -v node >/dev/null 2>&1; then
local major
major=$(node_major)
if [ "$major" -ge "$MIN_NODE_MAJOR" ]; then
return 0
fi
warn "Node $(node --version) is older than required v${MIN_NODE_MAJOR}."
else
info "Node.js not found."
fi
info "Installing Node.js via fnm..."
if ! command -v fnm >/dev/null 2>&1; then
curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell
export PATH="$HOME/.local/share/fnm:$PATH"
eval "$(fnm env --shell bash 2>/dev/null || true)"
fi
if ! command -v fnm >/dev/null 2>&1; then
err "Failed to install fnm. Install Node.js >= ${MIN_NODE_MAJOR} manually: https://nodejs.org/"
fi
fnm install --lts
fnm use lts-latest
eval "$(fnm env --shell bash 2>/dev/null || true)"
if ! command -v node >/dev/null 2>&1; then
err "Node.js installation failed. Install manually: https://nodejs.org/"
fi
}
ensure_node
if ! command -v npm >/dev/null 2>&1; then
err "npm not found after Node install. Reinstall Node.js: https://nodejs.org/"
fi
info "Installing ${PKG} globally via npm..."
if ! npm install -g "${PKG}"; then
warn "Global install failed (likely a permissions issue on a system Node)."
warn "Retry with sudo, or use a Node version manager (fnm/nvm/volta)."
exit 1
fi
if ! command -v mirage >/dev/null 2>&1; then
NPM_BIN="$(npm bin -g 2>/dev/null || echo "")"
warn "'mirage' is not on your PATH yet."
if [ -n "$NPM_BIN" ]; then
warn "Add this to your shell profile (~/.zshrc, ~/.bashrc):"
warn " export PATH=\"${NPM_BIN}:\$PATH\""
fi
exit 0
fi
VERSION=$(mirage --version 2>/dev/null || echo "")
ok "Mirage installed${VERSION:+ ($VERSION)}"
printf "\nNext steps:\n"
printf " mirage --help\n"
printf "\nDocs: https://docs.mirage.strukto.ai\n"