-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·54 lines (44 loc) · 1.36 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·54 lines (44 loc) · 1.36 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
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODE="${1:---both}"
SKILL_NAME="github-security-agent"
SOURCE_DIR="$ROOT"
usage() {
cat <<'USAGE'
Install the github-security-agent skill for Codex and/or Claude Code.
Usage:
./install.sh [--codex|--claude|--both]
Default: --both
USAGE
}
case "$MODE" in
--both|--codex|--claude) ;;
-h|--help) usage; exit 0 ;;
*) echo "Unknown option: $MODE" >&2; usage >&2; exit 2 ;;
esac
install_one() {
local home_dir="$1" label="$2"
local target="$home_dir/skills/$SKILL_NAME"
local stamp
mkdir -p "$home_dir/skills"
if [ -L "$target" ] && [ "$(readlink "$target")" = "$SOURCE_DIR" ]; then
echo "OK $label: $target"
return
fi
if [ -e "$target" ] || [ -L "$target" ]; then
stamp="$(date +%Y%m%d%H%M%S)"
mv "$target" "$target.backup.$stamp"
echo "BACKUP $label: $target.backup.$stamp"
fi
ln -s "$SOURCE_DIR" "$target"
echo "LINK $label: $target -> $SOURCE_DIR"
}
[ -f "$SOURCE_DIR/SKILL.md" ] || { echo "Missing $SOURCE_DIR/SKILL.md" >&2; exit 1; }
if [ "$MODE" = "--both" ] || [ "$MODE" = "--codex" ]; then
install_one "${CODEX_HOME:-$HOME/.codex}" "Codex"
fi
if [ "$MODE" = "--both" ] || [ "$MODE" = "--claude" ]; then
install_one "${CLAUDE_HOME:-$HOME/.claude}" "Claude"
fi
echo "Installed $SKILL_NAME. Start a new Codex or Claude Code session."