SPB Git

spb/khaelor Public

KHAELOR — a terminal-native autonomous engineering agent powered by Anthropic.

TypeScript 82.9% HTML 14.9% CSS 1.1% JavaScript 0.7%
4.5 KB · 113 lines shellscript
Raw Blame History
1#!/bin/sh2# KHAELOR3# File: website/public/install.sh4# Description: Hosted installer for the KHAELOR CLI — checks Node >= 22 and npm, installs the tarball globally, verifies.5#6# Author: Simon-Pierre Boucher7# Contact: contact@spboucher.ai8#9# Usage:  curl -fsSL https://www.khaelor.sh/install.sh | sh10#11# This script never runs sudo on its own. If a global npm install needs12# elevated permissions, it prints exactly what to do instead.1314set -eu1516TARBALL_URL="https://www.khaelor.sh/khaelor.tgz"17MIN_NODE_MAJOR=221819say()  { printf '%s\n' "$*"; }20fail() { printf 'khaelor install: error: %s\n' "$*" >&2; exit 1; }2122say ""23say "  KHAELOR installer"24say "  https://www.khaelor.sh"25say ""2627# ── 1. node ─────────────────────────────────────────────────────────────28if ! command -v node >/dev/null 2>&1; then29  fail "Node.js was not found on your PATH.3031KHAELOR requires Node.js ${MIN_NODE_MAJOR} or newer. Install it with one of:32  - https://nodejs.org (official installers)33  - brew install node          (Homebrew, macOS)34  - nvm install ${MIN_NODE_MAJOR}               (nvm)35then re-run:  curl -fsSL https://www.khaelor.sh/install.sh | sh"36fi3738NODE_VERSION="$(node --version 2>/dev/null || true)"39# node --version prints e.g. v22.11.0 — extract the major.40NODE_MAJOR="$(printf '%s' "$NODE_VERSION" | sed -e 's/^v//' -e 's/\..*$//')"41case "$NODE_MAJOR" in42  ''|*[!0-9]*) fail "could not parse Node.js version from 'node --version' (got: ${NODE_VERSION:-nothing})." ;;43esac44if [ "$NODE_MAJOR" -lt "$MIN_NODE_MAJOR" ]; then45  fail "Node.js ${NODE_VERSION} is too old.4647KHAELOR requires Node.js ${MIN_NODE_MAJOR} or newer. Upgrade with one of:48  - https://nodejs.org49  - brew upgrade node          (Homebrew, macOS)50  - nvm install ${MIN_NODE_MAJOR}               (nvm)"51fi52say "  node ${NODE_VERSION} ... ok"5354# ── 2. npm ──────────────────────────────────────────────────────────────55if ! command -v npm >/dev/null 2>&1; then56  fail "npm was not found on your PATH.5758npm normally ships with Node.js. If you installed Node another way, install59npm too, then re-run this script."60fi61say "  npm $(npm --version 2>/dev/null || say '?') ... ok"6263# ── 3. install ──────────────────────────────────────────────────────────64say ""65say "  Installing KHAELOR from ${TARBALL_URL} ..."66say ""6768if ! npm install -g "$TARBALL_URL"; then69  say "" >&270  say "khaelor install: 'npm install -g' failed." >&271  say "" >&272  say "If the error above mentions EACCES (permission denied), your global npm" >&273  say "prefix is owned by root. The clean fix is a user-owned prefix — this" >&274  say "script will NOT run sudo for you:" >&275  say "" >&276  say "    mkdir -p ~/.npm-global" >&277  say "    npm config set prefix ~/.npm-global" >&278  say "    export PATH=\"\$HOME/.npm-global/bin:\$PATH\"   # add to your shell profile" >&279  say "    npm install -g ${TARBALL_URL}" >&280  say "" >&281  say "For any other error, the npm output above has the details." >&282  exit 183fi8485# ── 4. verify ───────────────────────────────────────────────────────────86if ! command -v khaelor >/dev/null 2>&1; then87  fail "install completed but 'khaelor' is not on your PATH.8889Your npm global bin directory is probably not on PATH. Find it with:90    npm prefix -g91then add '<that prefix>/bin' to PATH in your shell profile and open a new shell."92fi9394KHAELOR_VERSION="$(khaelor --version 2>/dev/null || true)"95if [ -z "$KHAELOR_VERSION" ]; then96  fail "'khaelor --version' did not run cleanly. Try running it directly to see the error."97fi9899# ── 5. next steps ───────────────────────────────────────────────────────100say ""101say "  KHAELOR ${KHAELOR_VERSION} installed."102say ""103say "  Next steps:"104say ""105say "    1. Set your Anthropic API key (add to your shell profile to persist):"106say "         export ANTHROPIC_API_KEY=sk-ant-..."107say ""108say "    2. Start it inside a project:"109say "         cd your-project && khaelor"110say ""111say "  Docs: https://www.khaelor.sh/docs/getting-started.html"112say ""113