Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·155 lines (138 loc) · 4.07 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·155 lines (138 loc) · 4.07 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/usr/bin/env bash
# Install AXguard skills + commands into coding-agent harnesses.
set -euo pipefail
AGENT="${AXGUARD_AGENT:-claude}"
SCOPE="global"
usage() {
cat <<'EOF'
Usage: ./install.sh [--agent claude|cursor|opencode|codex|agents|all] [--global|--project]
Defaults:
./install.sh Install for Claude Code globally (~/.claude)
Examples:
./install.sh --agent cursor
./install.sh --agent all
./install.sh --agent claude --project
EOF
}
while [ "$#" -gt 0 ]; do
case "$1" in
--agent) shift; AGENT="${1:?--agent requires a value}" ;;
--agent=*) AGENT="${1#*=}" ;;
--global) SCOPE="global" ;;
--project) SCOPE="project" ;;
-h|--help) usage; exit 0 ;;
*) echo "Unknown option: $1" >&2; usage >&2; exit 2 ;;
esac
shift
done
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
install_skills() {
local dest_dir="$1"
mkdir -p "$dest_dir"
local skill_md skill_dir name
while IFS= read -r skill_md; do
skill_dir="$(dirname "$skill_md")"
name="$(basename "$skill_dir")"
rm -rf "$dest_dir/$name"
mkdir -p "$dest_dir/$name"
cp -R "$skill_dir"/. "$dest_dir/$name/"
echo "installed skill: $name → $dest_dir/$name"
done < <(find . -mindepth 2 -maxdepth 2 -type f -name SKILL.md 2>/dev/null | sort)
}
copy_files() {
local src_glob="$1"
local dest_dir="$2"
local label="$3"
mkdir -p "$dest_dir"
local item name
for item in $src_glob; do
[ -f "$item" ] || continue
name="$(basename "$item")"
cp "$item" "$dest_dir/$name"
echo "installed $label: $name → $dest_dir/$name"
done
}
install_claude() {
local root
if [ "$SCOPE" = "project" ]; then root=".claude"; else root="$HOME/.claude"; fi
echo "AXguard → Claude Code ($SCOPE)"
install_skills "$root/skills"
copy_files "commands/*.md" "$root/commands" "command"
}
install_cursor() {
local root
if [ "$SCOPE" = "project" ]; then root=".cursor"; else root="$HOME/.cursor"; fi
echo "AXguard → Cursor ($SCOPE)"
install_skills "$root/skills"
# Cursor also picks up project rules; commands map to skills for slash-style prompts
mkdir -p "$root/commands"
copy_files "commands/*.md" "$root/commands" "command"
}
install_opencode() {
local root
if [ "$SCOPE" = "project" ]; then
root=".opencode"
else
root="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}"
fi
echo "AXguard → OpenCode ($SCOPE)"
install_skills "$root/skills"
copy_files "commands/*.md" "$root/commands" "command"
}
install_codex() {
local root
if [ "$SCOPE" = "project" ]; then root=".codex"; else root="${CODEX_HOME:-$HOME/.codex}"; fi
echo "AXguard → Codex ($SCOPE)"
install_skills "$root/skills"
copy_files "commands/*.md" "$root/commands" "command"
}
install_agents() {
local root
if [ "$SCOPE" = "project" ]; then root=".agents"; else root="$HOME/.agents"; fi
echo "AXguard → shared Agent Skills ($SCOPE)"
install_skills "$root/skills"
}
echo ""
cat <<'BANNER'
▄▀█ ▀▄▀ █▀▀ █░█ ▄▀█ █▀█ █▀▄
█▀█ █░█ █▄█ █▄█ █▀█ █▀▄ █▄▀
install · skills + commands
BANNER
echo ""
case "$AGENT" in
claude) install_claude ;;
cursor) install_cursor ;;
opencode) install_opencode ;;
codex) install_codex ;;
agents) install_agents ;;
all)
install_claude
install_cursor
install_opencode
install_codex
install_agents
;;
*)
echo "Unknown agent: $AGENT" >&2
usage >&2
exit 2
;;
esac
echo ""
echo "CLI (optional but recommended):"
echo " python3 -m venv .venv && source .venv/bin/activate"
echo " pip install -e ."
echo " axguard help"
echo " axguard audit ."
echo ""
echo "Start with the workflow you need (not the full catalog):"
echo " /axguard-audit full A→Z + HTML/MD reports"
echo " /axguard-scan fast check while coding"
echo " /axguard-threat-model first look / CSO framing"
echo " /axguard-triage kill false positives"
echo " /axguard-fix patch confirmed bugs"
echo " /axguard-ci PR fail-on-high gate"
echo ""
echo "Cheat sheet: COMMANDS-QUICK-REF.md"
echo ""