-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·142 lines (128 loc) · 7.85 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·142 lines (128 loc) · 7.85 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env bash
#
# pi-power-stack installer
# ------------------------
# Deploys the full Pi power-user environment onto a fresh machine:
# • ~/.pi/agent/extensions/ — all extensions (editor, tools, mentions, router, conserve, usage, …)
# • ~/.pi/agent/agents/ — sub-agent + system prompts
# • ~/.pi/agent/themes/ — gruvbox (active) + nightowl
# • ~/.pi/agent/*.json — settings, models, permissions, keybindings, sub-bar/core
# • ~/.pi/agent/AGENTS.md — global operating doctrine
# • ~/.config/agents/skills/ — 17 skills (git, review, spawn, dig, write, …)
# • ~/pi-orchestration/ — Overstory + Codex swarm framework (advanced tier)
# • pi packages + local patches (best-effort)
#
# Safe & idempotent: backs up anything it would overwrite (timestamped).
# Run: ./install.sh full install (config + skills + orchestration)
# ./install.sh --core-only skip the orchestration/swarm tier
# ./install.sh --with-patches also apply the OPTIONAL, version-fragile package patches
#
set -uo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
STAMP=".bak-$(date +%Y%m%d-%H%M%S)"
PI="$HOME/.pi/agent"
CFG_SKILLS="$HOME/.config/agents/skills"
ORCH="$HOME/pi-orchestration"
CORE_ONLY=0
WITH_PATCHES=0
for a in "$@"; do
case "$a" in
--core-only) CORE_ONLY=1 ;;
--with-patches) WITH_PATCHES=1 ;;
esac
done
c() { printf "\033[1;36m→\033[0m %s\n" "$1"; }
ok() { printf "\033[1;32m✓\033[0m %s\n" "$1"; }
warn(){ printf "\033[1;33m!\033[0m %s\n" "$1"; }
err() { printf "\033[1;31m✗\033[0m %s\n" "$1"; }
bak() { [ -e "$1" ] && { cp -R "$1" "$1$STAMP" && warn "backed up $(basename "$1") → $(basename "$1")$STAMP"; }; return 0; }
echo ""
echo "╭──────────────────────────────────────────────╮"
echo "│ pi-power-stack — full Pi power setup │"
echo "╰──────────────────────────────────────────────╯"
echo ""
# ── 0. Prerequisites ────────────────────────────────────────────────
c "Checking prerequisites…"
MISSING=0
command -v pi >/dev/null 2>&1 || { err "pi not found → npm install -g @earendil-works/pi-coding-agent"; MISSING=1; }
command -v node >/dev/null 2>&1 || { err "node not found → install Node.js 20+"; MISSING=1; }
command -v git >/dev/null 2>&1 || { err "git not found"; MISSING=1; }
[ "$MISSING" = "1" ] && { echo ""; err "Install the missing prerequisites above, then re-run ./install.sh"; exit 1; }
ok "pi: $(pi --version 2>/dev/null || echo '?') node: $(node --version) git: ok"
mkdir -p "$PI" "$CFG_SKILLS"
# ── 1. Extensions ───────────────────────────────────────────────────
c "Installing extensions…"
bak "$PI/extensions"; rm -rf "$PI/extensions"
cp -R "$SCRIPT_DIR/pi/extensions" "$PI/extensions"
ok "extensions → $PI/extensions ($(ls "$PI/extensions" | wc -l | tr -d ' ') entries)"
if [ -f "$PI/extensions/tools/package.json" ]; then
c "Installing tools/ dependencies (npm install)…"
( cd "$PI/extensions/tools" && npm install --silent >/dev/null 2>&1 ) && ok "tools deps installed" \
|| warn "npm install in tools/ failed — run it manually: (cd $PI/extensions/tools && npm install)"
fi
# ── 2. Agent prompts, themes ────────────────────────────────────────
c "Installing agent prompts + themes…"
bak "$PI/agents"; rm -rf "$PI/agents"; cp -R "$SCRIPT_DIR/pi/agents" "$PI/agents"
bak "$PI/themes"; rm -rf "$PI/themes"; cp -R "$SCRIPT_DIR/pi/themes" "$PI/themes"
ok "agents + themes installed"
# ── 3. Config files ─────────────────────────────────────────────────
c "Installing config (settings, models, permissions, keybindings, AGENTS.md)…"
for f in settings.json models.json permissions.json keybindings.json \
pi-sub-bar-settings.json pi-sub-core-settings.json AGENTS.md; do
if [ -f "$SCRIPT_DIR/pi/$f" ]; then bak "$PI/$f"; cp "$SCRIPT_DIR/pi/$f" "$PI/$f"; fi
done
ok "config installed (defaultProvider=anthropic, model=claude-opus-4-8, theme=gruvbox)"
# ── 4. Skills ───────────────────────────────────────────────────────
c "Installing skills…"
bak "$CFG_SKILLS"; rm -rf "$CFG_SKILLS"; cp -R "$SCRIPT_DIR/config-skills" "$CFG_SKILLS"
find "$CFG_SKILLS" -type f \( -name "*.sh" -o -name "*.mjs" -o -name "spawn-amp" -o -name "cdp.mjs" \) -exec chmod +x {} \; 2>/dev/null
ok "skills → $CFG_SKILLS ($(ls "$CFG_SKILLS" | wc -l | tr -d ' ') skills)"
# ── 5. pi packages ──────────────────────────────────────────────────
# pi also auto-installs anything listed in settings.json on first launch; we prime them here.
c "Installing pi packages (also auto-installed on first launch)…"
PKGS=(
"npm:pi-web-access" "npm:pi-context" "npm:pi-token-burden"
"npm:@benvargas/pi-claude-code-use" "npm:@marckrenn/pi-sub-bar"
"https://github.com/davebcn87/pi-autoresearch" "npm:pi-tool-display"
"npm:@tomooshi/condensed-milk-pi" "https://github.com/edxeth/pi-gpt-config"
"https://github.com/eko24ive/pi-ask" "npm:pi-codex-goal"
)
for p in "${PKGS[@]}"; do
pi install "$p" >/dev/null 2>&1 && ok " $p" || warn " $p (pi will retry on launch)"
done
# ── 6. Local package patches (OPT-IN — version-fragile) ────────────
if [ "$WITH_PATCHES" = "1" ]; then
c "Applying OPTIONAL package patches (backs up every target)…"
bash "$SCRIPT_DIR/scripts/apply-patches.sh" || warn "some patches skipped — see output above"
else
c "Skipping optional package patches (run with --with-patches, or scripts/apply-patches.sh later)"
fi
# ── 7. Orchestration (advanced tier) ────────────────────────────────
if [ "$CORE_ONLY" = "0" ]; then
c "Installing orchestration framework → $ORCH …"
bak "$ORCH"; rm -rf "$ORCH"; cp -R "$SCRIPT_DIR/orchestration" "$ORCH"
chmod +x "$ORCH"/bin/*.sh 2>/dev/null
# symlink the two solo Codex helpers onto PATH (no .sh suffix)
mkdir -p "$HOME/.local/bin"
ln -sf "$ORCH/bin/codex-run.sh" "$HOME/.local/bin/codex-run"
ln -sf "$ORCH/bin/lucifer-codex.sh" "$HOME/.local/bin/lucifer-codex"
ln -sf "$ORCH/bin/watch.sh" "$HOME/.local/bin/lucifer-watch"
ok "orchestration installed; codex-run / lucifer-codex / lucifer-watch → ~/.local/bin"
case ":$PATH:" in *":$HOME/.local/bin:"*) : ;; *)
warn "add ~/.local/bin to PATH: echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc" ;;
esac
fi
echo ""
echo "╭──────────────────────────────────────────────╮"
echo "│ ✅ Stack installed │"
echo "╰──────────────────────────────────────────────╯"
echo ""
echo "NEXT — log in to your subscriptions (interactive, one-time):"
echo " pi # launch pi"
echo " /login anthropic # → Claude Max (OAuth in browser)"
echo " /login openai-codex # → Codex Max (OAuth in browser)"
echo " /model anthropic/claude-opus-4-8"
echo ""
echo "Then verify: ./doctor.sh"
echo "Read: README.md • ARCHITECTURE.md • orchestration/RUNBOOK.md"
echo ""