-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·149 lines (130 loc) · 4.17 KB
/
Copy pathsetup
File metadata and controls
executable file
·149 lines (130 loc) · 4.17 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
#!/usr/bin/env bash
set -euo pipefail
# Apex Protocol — setup script
# Detects platform and creates appropriate symlinks/manifests
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VERSION=$(cat "$SCRIPT_DIR/VERSION" 2>/dev/null || echo "0.1.0")
echo "apex-forge v$VERSION — setup"
echo "================================"
# Detect platforms
PLATFORMS_FOUND=()
# Claude Code (global)
if [ -d "$HOME/.claude/skills" ]; then
PLATFORMS_FOUND+=("claude-global")
fi
# Claude Code (local)
if [ -d ".claude/skills" ] && [ "$SCRIPT_DIR" != "$(cd .claude/skills/apex-forge 2>/dev/null && pwd)" ]; then
PLATFORMS_FOUND+=("claude-local")
fi
# Cursor
if [ -d ".cursor-plugin" ]; then
PLATFORMS_FOUND+=("cursor")
fi
# Codex / Factory
if [ -d ".agents/skills" ]; then
PLATFORMS_FOUND+=("codex")
fi
# Antigravity
if [ -d ".agent/skills" ]; then
PLATFORMS_FOUND+=("antigravity")
fi
echo ""
echo "Detected platforms: ${PLATFORMS_FOUND[*]:-none}"
echo ""
# Create skill manifests
create_claude_manifest() {
local target_dir="$1"
if [ ! -L "$target_dir/apex-forge" ] && [ ! -d "$target_dir/apex-forge" ]; then
ln -sf "$SCRIPT_DIR" "$target_dir/apex-forge"
echo " Linked: $target_dir/apex-forge -> $SCRIPT_DIR"
else
echo " Already exists: $target_dir/apex-forge"
fi
}
# Setup for each platform
for platform in "${PLATFORMS_FOUND[@]}"; do
case "$platform" in
claude-global)
echo "Setting up Claude Code (global)..."
create_claude_manifest "$HOME/.claude/skills"
;;
claude-local)
echo "Setting up Claude Code (local)..."
create_claude_manifest ".claude/skills"
;;
cursor)
echo "Setting up Cursor..."
if [ ! -L ".cursor-plugin/apex-forge" ]; then
ln -sf "$SCRIPT_DIR" ".cursor-plugin/apex-forge"
echo " Linked: .cursor-plugin/apex-forge"
fi
;;
codex)
echo "Setting up Codex/Factory..."
if [ ! -L ".agents/skills/apex-forge" ]; then
ln -sf "$SCRIPT_DIR" ".agents/skills/apex-forge"
echo " Linked: .agents/skills/apex-forge"
fi
;;
antigravity)
echo "Setting up Antigravity..."
if command -v "$SCRIPT_DIR/dist/apex-forge" >/dev/null 2>&1 || [ -x "$SCRIPT_DIR/dist/apex-forge" ]; then
"$SCRIPT_DIR/dist/apex-forge" convert --platform antigravity --output ".agent/skills" 2>/dev/null
echo " Converted skills to .agent/skills/"
else
ln -sf "$SCRIPT_DIR" ".agent/skills/apex-forge"
echo " Linked: .agent/skills/apex-forge (run build first for full conversion)"
fi
;;
esac
done
# Create default config if needed
if [ ! -f ".apex/config.yaml" ]; then
mkdir -p .apex
cat > .apex/config.yaml << 'YAML'
# Apex Protocol configuration
# See README.md for all options
default_tier: auto
proactive: true
compound_on_resolve: true
max_concurrent_agents: 3
autonomy: balanced
YAML
echo ""
echo "Created .apex/config.yaml with defaults"
fi
# Build TypeScript binaries if Bun is available
if command -v bun >/dev/null 2>&1; then
echo ""
echo "Building TypeScript runtime..."
cd "$SCRIPT_DIR"
bun install --frozen-lockfile 2>/dev/null || bun install
bun run build:all 2>&1 | tail -3
if [ -x "$SCRIPT_DIR/dist/apex-forge" ]; then
echo " apex CLI: $SCRIPT_DIR/dist/apex-forge"
fi
if [ -x "$SCRIPT_DIR/dist/apex-forge-browse" ]; then
echo " apex-browse: $SCRIPT_DIR/dist/apex-forge-browse"
fi
if [ -x "$SCRIPT_DIR/dist/apex-forge-mcp" ]; then
echo " apex-mcp: $SCRIPT_DIR/dist/apex-forge-mcp"
fi
# Install Playwright browsers if needed
if [ -x "$SCRIPT_DIR/dist/apex-forge-browse" ] && ! bunx playwright install --dry-run chromium >/dev/null 2>&1; then
echo ""
echo "Installing Chromium for browser testing..."
bunx playwright install chromium
fi
else
echo ""
echo "Note: Bun not found. TypeScript binaries not built."
echo " Install Bun: curl -fsSL https://bun.sh/install | bash"
echo " Then run: cd $SCRIPT_DIR && bun run build:all"
fi
# Create docs directories
mkdir -p docs/brainstorms docs/plans docs/solutions docs/ideation
echo ""
echo "Setup complete."
echo ""
echo "The protocol layer auto-activates on every session."
echo "Run '/apex brainstorm' to start a workflow."