Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·71 lines (66 loc) · 2.2 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·71 lines (66 loc) · 2.2 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
#!/usr/bin/env bash
# agent-skills installer — copies skill folders into per-harness skill dirs, then
# prints the AGENTS.md template blocks for manual pasting. Every action is copy/print
# only, with one explicit opt-in: --hooks also installs the ask-first gate into
# ~/.zcode/hooks/ and merges it into ZCode config.json (automatic backup, idempotent).
#
# Usage:
# ./install.sh --zcode [--claude] [--hooks]
# SKILLS="ask-first memory-hygiene" ./install.sh --zcode # subset
set -euo pipefail
cd "$(dirname "$0")"
SKILLS="${SKILLS:-memory-hygiene ask-first strategic-coding shell-hygiene}"
HOOKS=0
targets=()
if [ $# -eq 0 ]; then
echo "usage: ./install.sh [--zcode] [--claude] [--hooks] (SKILLS=\"a b\" to subset)"
exit 1
fi
for arg in "$@"; do
case "$arg" in
--zcode) targets+=("$HOME/.zcode/skills") ;;
--claude) targets+=("$HOME/.claude/skills") ;;
--hooks) HOOKS=1 ;;
*) echo "unknown flag: $arg" >&2; exit 1 ;;
esac
done
for t in "${targets[@]}"; do
mkdir -p "$t"
for s in $SKILLS; do
if [ ! -d "skills/$s" ]; then
echo "skip: skills/$s not found" >&2
continue
fi
cp -r "skills/$s" "$t/"
echo "installed: $s -> $t/$s"
done
done
if [ "$HOOKS" = "1" ]; then
cfg="$HOME/.zcode/cli/config.json"
hookdir="$HOME/.zcode/hooks"
if [ ! -f "$cfg" ]; then
echo "hooks: $cfg not found — skipping (is ZCode installed?)"
else
NODE_BIN="$(command -v node || true)"
if [ -z "$NODE_BIN" ]; then
echo "hooks: node not found on PATH — install Node.js first" >&2
exit 1
fi
NODE_BIN="$(cygpath -m "$NODE_BIN" 2>/dev/null || echo "$NODE_BIN")"
if [ -f "$NODE_BIN.exe" ]; then NODE_BIN="$NODE_BIN.exe"; fi
mkdir -p "$hookdir"
cp hooks/askfirst-gate.js "$hookdir/askfirst-gate.js"
echo "installed: hooks/askfirst-gate.js -> $hookdir/"
node hooks/install-merge.js "$cfg" "$NODE_BIN" "$hookdir/askfirst-gate.js"
echo "note: hooks take effect in NEW sessions; the running session keeps its old config."
fi
fi
echo
echo "AGENTS.md template blocks (paste what you need; tool skills need none):"
for s in $SKILLS; do
if [ -f "templates/$s.md" ]; then
echo
echo "=== templates/$s.md ==="
cat "templates/$s.md"
fi
done