Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·214 lines (197 loc) · 6.81 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·214 lines (197 loc) · 6.81 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/usr/bin/env bash
# agent-dev-kit — Reproducible AI Agent DevSecOps & MCP Bootstrap Installer
# Usage:
# bash scripts/install.sh [--dry-run] [--skip-cli] [--skip-skills] [--skip-mcp] [--skip-agents-md]
# Supports macOS and Linux (requires Node.js 20+, git, python3).
set -uo pipefail
DRY_RUN=0
SKIP_CLI=0
SKIP_SKILLS=0
SKIP_MCP=0
SKIP_AGENTS_MD=0
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=1 ;;
--skip-cli) SKIP_CLI=1 ;;
--skip-skills) SKIP_SKILLS=1 ;;
--skip-mcp) SKIP_MCP=1 ;;
--skip-agents-md) SKIP_AGENTS_MD=1 ;;
-h|--help)
sed -n '2,6p' "$0"
exit 0
;;
*)
echo "Unknown option: $arg" >&2
exit 2
;;
esac
done
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
CODEX_DIR="$REPO_ROOT/codex"
TIMESTAMP="$(date '+%Y%m%d-%H%M%S')"
LOG="${AGENT_DEV_KIT_LOG:-$HOME/agent-dev-kit-report-${TIMESTAMP}.md}"
PASS_COUNT=0
FAIL_COUNT=0
SKIP_COUNT=0
if [ "$DRY_RUN" -eq 0 ]; then
: > "$LOG"
fi
log_line() {
if [ "$DRY_RUN" -eq 1 ]; then
echo "$1"
else
echo "$1" | tee -a "$LOG"
fi
}
ok() { PASS_COUNT=$((PASS_COUNT + 1)); log_line "- ✅ $1"; }
ng() { FAIL_COUNT=$((FAIL_COUNT + 1)); log_line "- ❌ $1"; }
skip() { SKIP_COUNT=$((SKIP_COUNT + 1)); log_line "- ⏭️ $1"; }
run_step() {
local name="$1"
shift
if [ "$DRY_RUN" -eq 1 ]; then
skip "[dry-run] $name -> $*"
return 0
fi
if "$@" >/dev/null 2>&1; then
ok "$name"
else
ng "$name (command: $*)"
fi
}
check_prereqs() {
log_line "## 0. Prerequisites"
for bin in git node npm python3; do
if command -v "$bin" >/dev/null 2>&1; then
ok "$bin ($(command -v "$bin"))"
else
ng "Missing required dependency: $bin"
fi
done
}
log_line "# agent-dev-kit Bootstrap Report ($(date '+%F %T %Z'))"
[ "$DRY_RUN" -eq 1 ] && log_line "> Running in **dry-run** mode — no files or packages will be modified."
check_prereqs
# 1. CLI & Security Tooling
log_line ""
log_line "## 1. CLI & DevSecOps Tooling"
if [ "$SKIP_CLI" -eq 1 ]; then
skip "CLI installation skipped (--skip-cli)"
else
if ! command -v codex >/dev/null 2>&1; then
run_step "Install @openai/codex" npm i -g @openai/codex
else
ok "codex already installed ($(codex --version 2>/dev/null || echo present))"
fi
run_step "eas-cli" npm i -g eas-cli
run_step "supabase CLI" npx -y supabase --version
run_step "semgrep" bash -c 'command -v semgrep || pipx install semgrep || pip install --user semgrep'
run_step "gitleaks" bash -c 'command -v gitleaks || brew install gitleaks || go install github.com/zricethezav/gitleaks/v8@latest'
run_step "trivy" bash -c 'command -v trivy || brew install trivy || curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b "$HOME/.local/bin"'
run_step "osv-scanner" bash -c 'command -v osv-scanner || brew install osv-scanner || go install github.com/google/osv-scanner/v2/cmd/osv-scanner@latest'
run_step "maestro" bash -c 'command -v maestro || curl -fsSL "https://get.maestro.mobile.dev" | bash'
run_step "k6" bash -c 'command -v k6 || brew install k6'
run_step "fastlane" bash -c 'command -v fastlane || brew install fastlane || gem install fastlane'
run_step "act" bash -c 'command -v act || brew install act'
fi
# 2. Agent Skills
log_line ""
log_line "## 2. Agent Skills (~/.agents/skills)"
if [ "$SKIP_SKILLS" -eq 1 ]; then
skip "Skills installation skipped (--skip-skills)"
else
[ "$DRY_RUN" -eq 0 ] && mkdir -p "$HOME/.agents/skills"
add_skill() {
local repo="$1"
local skill_name="${2:-}"
if [ -n "$skill_name" ]; then
run_step "skills: $repo ($skill_name)" npx -y skills@latest add "$repo" -g -a codex -y --skill "$skill_name"
else
run_step "skills: $repo" npx -y skills@latest add "$repo" -g -a codex -y
fi
}
add_skill anthropics/skills "frontend-design webapp-testing mcp-builder skill-creator"
add_skill obra/superpowers "*"
add_skill addyosmani/agent-skills "*"
add_skill expo/skills "*"
add_skill callstackincubator/agent-skills "*"
add_skill supabase/agent-skills "*"
add_skill vercel-labs/agent-skills "web-design-guidelines"
add_skill nextlevelbuilder/ui-ux-pro-max-skill "*"
add_skill phuryn/pm-skills "*"
add_skill trailofbits/skills "*"
add_skill paid-tw/skills "*"
add_skill appeeky/aso-skills "*"
add_skill new-silvermoon/awesome-android-agent-skills "*"
fi
# 3. MCP Servers (~/.codex/config.toml)
log_line ""
log_line "## 3. MCP Servers (~/.codex/config.toml)"
if [ "$SKIP_MCP" -eq 1 ]; then
skip "MCP config merge skipped (--skip-mcp)"
elif [ "$DRY_RUN" -eq 1 ]; then
skip "[dry-run] Merge non-duplicate blocks from $CODEX_DIR/config.toml into ~/.codex/config.toml"
else
mkdir -p "$HOME/.codex"
DST_TOML="$HOME/.codex/config.toml"
[ -f "$DST_TOML" ] && cp "$DST_TOML" "${DST_TOML}.bak.${TIMESTAMP}"
if python3 - "$CODEX_DIR/config.toml" "$DST_TOML" <<'PY'
import os, re, sys
src_p, dst_p = sys.argv[1], sys.argv[2]
src = open(src_p, encoding="utf-8").read()
dst = open(dst_p, encoding="utf-8").read() if os.path.exists(dst_p) else ""
blocks = re.split(r'(?m)^(?=\[)', src)
added = []
for b in blocks:
m = re.match(r'\[([^\]]+)\]', b)
if m and ('[' + m.group(1) + ']') not in dst:
added.append(b.strip())
if added:
with open(dst_p, 'a', encoding='utf-8') as f:
if dst and not dst.endswith('\n'):
f.write('\n')
f.write('\n' + '\n\n'.join(added) + '\n')
PY
then
ok "Merged MCP server blocks into $DST_TOML (backup created if existing)"
else
ng "Failed to merge $CODEX_DIR/config.toml into $DST_TOML"
fi
log_line "> Note: OAuth MCP servers require manual sign-in: \`codex mcp login supabase|expo|figma|sentry|stripe\`"
fi
# 4. Global AGENTS.md
log_line ""
log_line "## 4. Global AGENTS.md (~/.codex/AGENTS.md)"
if [ "$SKIP_AGENTS_MD" -eq 1 ]; then
skip "AGENTS.md install skipped (--skip-agents-md)"
elif [ "$DRY_RUN" -eq 1 ]; then
skip "[dry-run] Copy $CODEX_DIR/AGENTS.md -> ~/.codex/AGENTS.md (backing up existing)"
else
mkdir -p "$HOME/.codex"
if [ -f "$HOME/.codex/AGENTS.md" ]; then
cp "$HOME/.codex/AGENTS.md" "$HOME/.codex/AGENTS.md.bak.${TIMESTAMP}"
fi
if cp "$CODEX_DIR/AGENTS.md" "$HOME/.codex/AGENTS.md"; then
ok "Installed ~/.codex/AGENTS.md"
else
ng "Failed to copy AGENTS.md"
fi
fi
# 5. Environment Variable Verification
log_line ""
log_line "## 5. Environment Checks"
for k in GITHUB_PAT_TOKEN CONTEXT7_API_KEY; do
if [ -n "${!k:-}" ]; then
ok "Env var $k is set"
else
skip "Env var $k not set (optional — see codex/environment.example)"
fi
done
log_line ""
log_line "---"
log_line "**Summary:** ✅ $PASS_COUNT passed · ⏭️ $SKIP_COUNT skipped · ❌ $FAIL_COUNT failed"
if [ "$DRY_RUN" -eq 0 ]; then
echo "Report saved to: $LOG"
fi
[ "$FAIL_COUNT" -eq 0 ]