-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·80 lines (69 loc) · 2.48 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·80 lines (69 loc) · 2.48 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
#!/usr/bin/env bash
# install.sh — idempotent installer for sumd (provides both sumd + sumr CLIs).
#
# Part of koru's docs/llm-tools/sumd/ pattern. Installs into --user scope by
# default; override with SUMD_PIP_SCOPE=venv to use ./venv.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
cd "$REPO_ROOT"
echo "→ Instaluję sumd (CLIs: sumd, sumr)…"
# Allow choosing install target: user (default), venv, or current interpreter.
scope="${SUMD_PIP_SCOPE:-user}"
case "$scope" in
user) pip_args=(--user) ;;
venv)
[ -x venv/bin/pip ] || python3 -m venv venv
pip_args=()
PIP=venv/bin/pip
;;
current) pip_args=() ;;
*) echo " ✗ SUMD_PIP_SCOPE must be: user|venv|current" >&2; exit 2 ;;
esac
PIP="${PIP:-pip}"
if ! command -v sumd >/dev/null 2>&1 && [ ! -x venv/bin/sumd ]; then
"$PIP" install "${pip_args[@]}" --upgrade sumd
else
echo " ✓ sumd już zainstalowany (upgrade: pip install -U sumd)"
fi
# Which binary to smoke-test
if [ -x venv/bin/sumd ]; then
SUMD=venv/bin/sumd
SUMR=venv/bin/sumr
else
SUMD="$(command -v sumd || true)"
SUMR="$(command -v sumr || true)"
fi
if [ -z "$SUMD" ] || [ -z "$SUMR" ]; then
echo " ✗ sumd/sumr nie w PATH po instalacji — sprawdź pip warnings" >&2
exit 3
fi
# Smoke test — `sumd --version` powinno zwrócić numer wersji
if "$SUMD" --version 2>&1 | grep -qE '^sumd'; then
version="$($SUMD --version | head -1)"
echo " ✓ $version"
else
echo " ⚠ sumd --version nie zwrócił oczekiwanego output"
fi
# Smoke test — `sumr --help` powinno wspomnieć refactor profile
if "$SUMR" --help 2>&1 | grep -qi 'refactor'; then
echo " ✓ sumr --help działa (refactor profile dostępny)"
else
echo " ⚠ sumr --help nie wspomina refactor profile — niestandardowa wersja?"
fi
# Sprawdź czy repo ma już skonfigurowany debounce wrapper
if [ -x scripts/sumr-refresh.sh ]; then
echo " ✓ scripts/sumr-refresh.sh obecny (debounced wrapper gotowy)"
else
echo " ℹ Nie ma scripts/sumr-refresh.sh — zainstaluj template:"
echo " cp templates/sumr-refresh.sh.template scripts/sumr-refresh.sh"
echo " chmod +x scripts/sumr-refresh.sh"
fi
# Sprawdź czy istnieje SUMR.md (pierwszy refresh potrzebny?)
if [ -f SUMR.md ]; then
size=$(stat -c '%s' SUMR.md 2>/dev/null || wc -c < SUMR.md)
echo " ✓ SUMR.md istnieje (${size} bytes)"
else
echo " ℹ Brak SUMR.md — pierwszy refresh:"
echo " $SUMR ."
fi
echo "✓ sumd/sumr gotowy. Pełny workflow: workflows/sumr-refresh-loop.md"