-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·61 lines (50 loc) · 2.03 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·61 lines (50 loc) · 2.03 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
56
57
58
59
60
61
#!/usr/bin/env bash
# Install the s command.
#
# curl -fsSL https://raw.githubusercontent.com/samelliottdlt/scripts/main/install.sh | bash
#
# Env vars:
# S_DIR — where to clone the repo (default: ~/.s)
set -euo pipefail
REPO="https://github.com/samelliottdlt/scripts.git"
S_DIR="${S_DIR:-$HOME/.s}"
# ── preflight ────────────────────────────────────────────────────────────────
if ! command -v node &>/dev/null; then
echo "Error: Node.js is required (>=18). Install it first:"
echo " https://nodejs.org or brew install node or nvm install --lts"
exit 1
fi
NODE_MAJOR=$(node -e "process.stdout.write(String(process.versions.node.split('.')[0]))")
if [ "$NODE_MAJOR" -lt 18 ]; then
echo "Error: Node.js >=18 required (found v$(node -v))"
exit 1
fi
if ! command -v npm &>/dev/null; then
echo "Error: npm is required but not found."
exit 1
fi
if ! command -v git &>/dev/null; then
echo "Error: git is required but not found."
exit 1
fi
# ── clone or update ──────────────────────────────────────────────────────────
if [ -d "$S_DIR/.git" ]; then
echo "Updating $S_DIR ..."
git -C "$S_DIR" pull --ff-only --quiet 2>/dev/null || echo " (pull skipped — using local copy)"
else
echo "Cloning into $S_DIR ..."
git clone --quiet "$REPO" "$S_DIR"
fi
# ── install deps + link ───────────────────────────────────────────────────────
cd "$S_DIR"
if [ -f package-lock.json ]; then
npm ci --silent
else
npm i --silent
fi
npm link --force --silent 2>/dev/null || npm link --force
node bin/s.mjs skills install >/dev/null
echo ""
echo "✓ Installed! Run: s"
echo " Scripts live in $S_DIR/scripts/"
echo " Agent skills installed to ~/.copilot/skills and ~/.claude/skills"