-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·78 lines (61 loc) · 2.02 KB
/
install.sh
File metadata and controls
executable file
·78 lines (61 loc) · 2.02 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
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
codex_home="${CODEX_HOME:-$HOME/.codex}"
skills_dest="${CODEX_SKILLS_DIR:-$codex_home/skills}"
agents_dest="${AGENTS_SKILLS_DIR:-$HOME/.agents/skills}"
timestamp="$(date +%Y%m%d%H%M%S)"
skills=(
"code-review"
"instruction-surface-audit"
"runtime-rollout-matrix"
)
backup_path() {
local path="$1"
if [[ -e "$path" || -L "$path" ]]; then
local backup="${path}.bak.${timestamp}"
mv "$path" "$backup"
printf 'Backed up %s -> %s\n' "$path" "$backup"
fi
}
install_skill() {
local skill_name="$1"
local src="$repo_root/skills/$skill_name"
local dest="$skills_dest/$skill_name"
local link="$agents_dest/$skill_name"
if [[ ! -d "$src" ]]; then
printf 'Missing source skill directory: %s\n' "$src" >&2
exit 1
fi
backup_path "$dest"
cp -R "$src" "$dest"
printf 'Installed %s -> %s\n' "$skill_name" "$dest"
backup_path "$link"
ln -s "$dest" "$link"
printf 'Linked %s -> %s\n' "$link" "$dest"
}
ensure_graph_dependency() {
printf 'Installing code-review-graph via pip...\n'
PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --user --upgrade code-review-graph
local user_base
user_base="$(python3 -c 'import site; print(site.USER_BASE)')"
local graph_bin="$user_base/bin/code-review-graph"
if [[ -x "$graph_bin" ]]; then
"$graph_bin" --version
printf 'Add %s to PATH to invoke code-review-graph directly.\n' "$(dirname "$graph_bin")"
return
fi
if command -v code-review-graph >/dev/null 2>&1; then
code-review-graph --version
return
fi
printf 'Warning: code-review-graph installed, but the executable was not found on PATH or in the Python user bin directory.\n' >&2
}
mkdir -p "$skills_dest" "$agents_dest"
for skill_name in "${skills[@]}"; do
install_skill "$skill_name"
done
ensure_graph_dependency
printf '\nInstalled skill pack into %s\n' "$skills_dest"
printf 'Compatibility links are in %s\n' "$agents_dest"
printf 'Restart Codex to pick up the new skills.\n'