-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·103 lines (94 loc) · 4.37 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·103 lines (94 loc) · 4.37 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
#!/bin/sh
# CodeCouncil one-command installer.
#
# curl -fsSL https://raw.githubusercontent.com/adigo-pro/CodeCouncil/main/install.sh | sh
#
# What it does (and nothing else):
# 1. checks python3 >= 3.10 and git
# 2. clones (or updates) the repo into ~/.codecouncil/app
# 3. writes a `codecouncil` launcher into ~/.local/bin
# 4. installs pi (the model runtime) via npm if it's missing and npm exists
# 5. scaffolds ~/.codecouncil/env for your model key (never inside a repo)
#
# Re-run any time to update. Uninstall: rm -rf ~/.codecouncil/app ~/.local/bin/codecouncil
set -eu
REPO_URL="${CODECOUNCIL_REPO_URL:-https://github.com/adigo-pro/CodeCouncil}"
APP_DIR="${CODECOUNCIL_HOME:-$HOME/.codecouncil/app}"
BIN_DIR="$HOME/.local/bin"
ENV_FILE="$HOME/.codecouncil/env"
say() { printf '\033[36mcodecouncil\033[0m %s\n' "$1"; }
fail() { printf '\033[31mcodecouncil\033[0m %s\n' "$1" >&2; exit 1; }
# --- 1. prerequisites -------------------------------------------------------
command -v git >/dev/null 2>&1 || fail "git is required — install it first."
command -v python3 >/dev/null 2>&1 || fail "python3 is required — install Python 3.10+ first."
python3 - <<'PY' || fail "Python 3.10+ required (found $(python3 -V 2>&1))."
import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)
PY
# --- 2. clone or update -----------------------------------------------------
if [ -d "$APP_DIR/.git" ]; then
say "updating existing install in $APP_DIR"
git -C "$APP_DIR" pull --ff-only || fail "update failed — local changes in $APP_DIR? Resolve or remove it and re-run."
else
say "installing into $APP_DIR"
mkdir -p "$(dirname "$APP_DIR")"
git clone --depth 1 "$REPO_URL" "$APP_DIR"
fi
# --- 3. launcher on PATH ----------------------------------------------------
mkdir -p "$BIN_DIR"
cat > "$BIN_DIR/codecouncil" <<SH
#!/bin/sh
# CodeCouncil launcher (generated by install.sh — re-running the installer updates the app)
export PYTHONPATH="$APP_DIR\${PYTHONPATH:+:\$PYTHONPATH}"
exec python3 -m codecouncil "\$@"
SH
chmod +x "$BIN_DIR/codecouncil"
say "launcher: $BIN_DIR/codecouncil"
case ":$PATH:" in
*":$BIN_DIR:"*) ;;
*) say "NOTE: $BIN_DIR is not on your PATH — add this to your shell profile:"
say " export PATH=\"\$HOME/.local/bin:\$PATH\"" ;;
esac
# --- 4. pi (the model runtime) ----------------------------------------------
if command -v pi >/dev/null 2>&1; then
say "pi found: $(command -v pi)"
elif command -v npm >/dev/null 2>&1; then
say "installing pi (the model runtime, pi.dev) via npm…"
npm install -g --ignore-scripts @earendil-works/pi-coding-agent \
|| say "WARN: pi install failed — install manually: npm install -g @earendil-works/pi-coding-agent"
else
say "WARN: pi not found and npm unavailable. Install Node, then:"
say " npm install -g @earendil-works/pi-coding-agent"
fi
# --- 5. model key scaffold --------------------------------------------------
# The default app clone happens to create $HOME/.codecouncil, but never rely
# on that: a CODECOUNCIL_HOME override clones elsewhere and this write is
# then the first touch of the directory.
if [ ! -f "$ENV_FILE" ]; then
umask 077
mkdir -p "$(dirname "$ENV_FILE")"
# the app clone (or an older installer) may have created the directory
# with default 755 — the credentials dir must not be listable by others
chmod 700 "$(dirname "$ENV_FILE")"
cat > "$ENV_FILE" <<'ENV'
# CodeCouncil model credentials — this file lives OUTSIDE every git repo on
# purpose, so a key here can never be committed. One line per key, KEY=value.
# Free option (Nemotron via NVIDIA hosted inference, no login):
# NVIDIA_API_KEY=nvapi-... <- get one at build.nvidia.com
# Or any provider pi supports (see README "Model providers"):
# OPENROUTER_API_KEY=sk-or-...
# OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...
# GEMINI_API_KEY=...
# GROQ_API_KEY=gsk_...
ENV
say "created $ENV_FILE — type /keys in the running council to fill it (guided, hidden input)"
else
say "keeping existing $ENV_FILE"
fi
# --- done -------------------------------------------------------------------
say ""
say "installed. next steps:"
say " 1. codecouncil /path/to/repo-you-code-in"
say " 2. type /keys in the running council — guided key setup, hidden input"
say " (free: NVIDIA_API_KEY from build.nvidia.com; a model is picked automatically)"
say "docs: https://github.com/adigo-pro/CodeCouncil#sixty-second-start"