-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·55 lines (46 loc) · 2.28 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·55 lines (46 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env sh
# miii installer / updater
#
# curl -fsSL https://raw.githubusercontent.com/maruakshay/miii-cli/main/install.sh | sh
#
# Re-run any time to update to the latest release.
set -eu
PKG="miii-agent"
GREEN="$(printf '\033[32m')"; YELLOW="$(printf '\033[33m')"; RED="$(printf '\033[31m')"; DIM="$(printf '\033[2m')"; RESET="$(printf '\033[0m')"
info() { printf '%s\n' "${GREEN}==>${RESET} $*"; }
warn() { printf '%s\n' "${YELLOW}!!${RESET} $*" >&2; }
die() { printf '%s\n' "${RED}xx${RESET} $*" >&2; exit 1; }
# --- Node ---
command -v node >/dev/null 2>&1 || die "Node.js not found. Install Node >= 18 from https://nodejs.org"
NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0)"
[ "$NODE_MAJOR" -ge 18 ] || die "Node >= 18 required (found $(node -v)). Upgrade from https://nodejs.org"
# --- npm ---
command -v npm >/dev/null 2>&1 || die "npm not found. It ships with Node.js — reinstall from https://nodejs.org"
# Detect install vs update for nicer messaging.
if npm ls -g "$PKG" >/dev/null 2>&1; then
info "Updating ${PKG} to the latest release…"
else
info "Installing ${PKG}…"
fi
# Global installs may need sudo when the npm prefix isn't user-writable.
if npm i -g "${PKG}@latest" 2>/dev/null; then
:
elif command -v sudo >/dev/null 2>&1; then
warn "Global install needs elevated permissions — retrying with sudo."
sudo npm i -g "${PKG}@latest"
else
warn "Global install failed and sudo is unavailable — likely your npm prefix isn't writable."
printf '%s\n' "${DIM} Point npm at a user-owned prefix, then re-run this installer:${RESET}" >&2
printf '%s\n' "${DIM} npm config set prefix \"\$HOME/.npm-global\"${RESET}" >&2
printf '%s\n' "${DIM} export PATH=\"\$HOME/.npm-global/bin:\$PATH\" # add to ~/.bashrc or ~/.zshrc${RESET}" >&2
die "Install failed."
fi
VERSION="$(miii --version 2>/dev/null || npm view "$PKG" version 2>/dev/null || echo '')"
info "Done.${VERSION:+ ${DIM}($PKG $VERSION)${RESET}}"
# --- Ollama hint ---
if ! command -v ollama >/dev/null 2>&1; then
warn "Ollama not detected. miii needs a local model server."
printf '%s\n' "${DIM} Install: https://ollama.com/download${RESET}"
printf '%s\n' "${DIM} Then: ollama pull qwen2.5-coder:14b${RESET}"
fi
printf '\n%s\n' "Run ${GREEN}miii${RESET} to start."