Skip to content

Commit 79b69f6

Browse files
committed
fix: robust setup script with uninstall, backup, version display
1 parent f79ed2e commit 79b69f6

2 files changed

Lines changed: 49 additions & 12 deletions

File tree

.upstream-sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
none
1+
3e3843c4a9c1cc01bcecab486818705ab7553e2b

setup

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,64 @@
11
#!/usr/bin/env bash
2-
# kstack setup — install skills to ~/.kiro/skills/
2+
# kstack setup — install/uninstall skills to ~/.kiro/skills/
3+
# Usage: ./setup (install)
4+
# ./setup remove (uninstall)
35
set -euo pipefail
46

57
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
68
SKILLS_DIR="$HOME/.kiro/skills"
79
SKILLS=(plan-product plan-eng code-review ship qa retro)
10+
VERSION=$(cat "$SCRIPT_DIR/VERSION" 2>/dev/null || echo "unknown")
811

12+
if [[ "${1:-}" == "remove" ]]; then
13+
echo "Uninstalling kstack v${VERSION}..."
14+
for skill in "${SKILLS[@]}"; do
15+
dest="$SKILLS_DIR/$skill"
16+
if [[ -L "$dest" ]]; then
17+
rm -f "$dest"
18+
echo " ✅ removed $skill"
19+
else
20+
echo " ⏭️ $skill not a symlink, skipping"
21+
fi
22+
done
23+
echo ""
24+
echo "kstack uninstalled. Repo at $SCRIPT_DIR left intact."
25+
echo "To fully remove: rm -rf $SCRIPT_DIR"
26+
exit 0
27+
fi
28+
29+
echo "Installing kstack v${VERSION}..."
930
mkdir -p "$SKILLS_DIR"
1031

32+
INSTALLED=0
1133
for skill in "${SKILLS[@]}"; do
1234
src="$SCRIPT_DIR/$skill"
1335
dest="$SKILLS_DIR/$skill"
14-
if [[ -d "$src" ]]; then
15-
if [[ -L "$dest" ]]; then
16-
rm -f "$dest"
17-
fi
18-
ln -sf "$src" "$dest"
19-
echo "$skill$dest"
20-
else
21-
echo " ⚠️ $skill not found in $SCRIPT_DIR"
36+
37+
if [[ ! -d "$src" ]]; then
38+
echo " ⚠️ $skill not found in repo"
39+
continue
40+
fi
41+
42+
# Handle existing target
43+
if [[ -e "$dest" && ! -L "$dest" ]]; then
44+
echo " ⚠️ $skill exists as directory (not symlink), backing up to ${dest}.bak"
45+
mv "$dest" "${dest}.bak"
46+
elif [[ -L "$dest" ]]; then
47+
rm -f "$dest"
2248
fi
49+
50+
ln -sf "$src" "$dest"
51+
echo "$skill"
52+
INSTALLED=$((INSTALLED + 1))
2353
done
2454

2555
echo ""
26-
echo "kstack installed. ${#SKILLS[@]} skills linked to $SKILLS_DIR"
27-
echo "Try: tell Kiro 'plan product', 'code review', 'ship', 'qa', or 'retro'"
56+
echo "kstack v${VERSION}: ${INSTALLED}/${#SKILLS[@]} skills installed to $SKILLS_DIR"
57+
echo ""
58+
echo "Usage — tell Kiro any of these:"
59+
echo " • plan product — rethink the problem, find the 10-star version"
60+
echo " • plan eng — architecture, diagrams, failure modes, test matrix"
61+
echo " • code review — paranoid review: what blows up in prod?"
62+
echo " • ship — sync main → test → push → PR"
63+
echo " • qa — diff-aware testing with health score"
64+
echo " • retro — data-driven retrospective"

0 commit comments

Comments
 (0)