forked from sendaifun/solana-new
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·233 lines (204 loc) · 9.39 KB
/
Copy pathsetup
File metadata and controls
executable file
·233 lines (204 loc) · 9.39 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/usr/bin/env bash
# superstack setup — one-command installation
# Step 1: git clone https://github.com/sendaifun/solana-new-cli.git ~/.claude/skills/superstack && cd ~/.claude/skills/superstack && ./setup
# Step 2 (optional): superstack vendor OR ./setup --vendor (copies into your repo for team sharing)
set -euo pipefail
# --- Branding (single source of truth for bash) ---
PRODUCT_NAME="superstack"
GITHUB_REPO="sendaifun/solana-new-cli"
GITHUB_URL="https://github.com/${GITHUB_REPO}.git"
# --- Colors ---
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
DIM='\033[2m'
RESET='\033[0m'
log() { printf "\n ${GREEN}▸${RESET} %s\n" "$1"; }
warn() { printf " ${YELLOW}!${RESET} %s\n" "$1"; }
fail() { printf "\n ${RED}✗${RESET} %s\n\n" "$1" >&2; exit 1; }
ok() { printf " ${GREEN}✓${RESET} %s\n" "$1"; }
has_cmd() { command -v "$1" >/dev/null 2>&1; }
# --- Parse flags ---
VENDOR_MODE=false
for arg in "$@"; do
case "$arg" in
--vendor) VENDOR_MODE=true ;;
esac
done
# --- Vendor mode: copy into current project repo ---
if [ "$VENDOR_MODE" = true ]; then
# Find the superstack source — either the directory this script lives in,
# or the global install at ~/.claude/skills/
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VENDOR_DEST=".claude/skills/${PRODUCT_NAME}"
# Check if this script is inside the superstack repo (has skills/ dir)
if [ -d "$SCRIPT_DIR/skills" ]; then
SKILL_SRC="$SCRIPT_DIR"
elif [ -d "$HOME/.claude/skills/find-next-crypto-idea" ]; then
# Skills are installed individually — copy them all
SKILL_SRC="$HOME/.claude/skills"
else
fail "${PRODUCT_NAME} not installed yet. Run ./setup first (without --vendor)."
fi
printf "\n"
printf " ${BOLD}Step 2: Add to Your Repo${RESET}\n"
printf " ${DIM}Share ${PRODUCT_NAME} with your team — real files get committed to your repo.${RESET}\n"
printf " ${DIM}Teammates just run: cd .claude/skills/${PRODUCT_NAME} && ./setup${RESET}\n\n"
mkdir -p "$VENDOR_DEST"
if [ -d "$SCRIPT_DIR/skills" ]; then
# Copying from the repo itself — copy the whole thing
cp -Rf "$SCRIPT_DIR"/* "$VENDOR_DEST"/ 2>/dev/null || true
cp -f "$SCRIPT_DIR"/setup "$VENDOR_DEST"/setup 2>/dev/null || true
# Strip .git and node_modules (avoid nested repos and bloat)
rm -rf "$VENDOR_DEST/.git" "$VENDOR_DEST/node_modules" "$VENDOR_DEST/dist"
else
# Copying from installed skills
cp -Rf "$SKILL_SRC"/* "$VENDOR_DEST"/ 2>/dev/null || true
cp -f "$0" "$VENDOR_DEST/setup" 2>/dev/null || true
fi
chmod +x "$VENDOR_DEST/setup" 2>/dev/null || true
ok "Copied to ${VENDOR_DEST}/"
ok "Stripped .git, node_modules, dist (vendored as plain files)"
printf "\n"
printf " ${BOLD}Next:${RESET}\n"
printf " ${CYAN}git add .claude/skills/${PRODUCT_NAME}${RESET}\n"
printf " ${CYAN}git commit -m \"add ${PRODUCT_NAME} skills\"${RESET}\n"
printf "\n"
printf " ${DIM}Teammates clone your repo, then run:${RESET}\n"
printf " ${CYAN}cd .claude/skills/${PRODUCT_NAME} && ./setup${RESET}\n"
printf "\n"
exit 0
fi
# --- Banner ---
printf "\n"
printf " ${CYAN}${BOLD} ___ _ _ ___ ___ ___ ___ _____ _ ___ _ __${RESET}\n"
printf " ${CYAN}${BOLD}/ __| | | | _ \\ __| _ \\ __|_ _/_\\ / __| |/ /${RESET}\n"
printf " ${CYAN}${BOLD}\\__ \\ |_| | _/ _|| /__ \\ | |/ _ \\ (__| ' < ${RESET}\n"
printf " ${CYAN}${BOLD}|___/\\___/|_| |___|_|_\\___/ |_/_/ \\_\\___|_|\\_\\\\${RESET}\n"
printf " ${DIM}Ship on Solana — Idea to Launch${RESET}\n\n"
printf " ${BOLD}i'm your solana buddy by SendAI & Superteam.${RESET}\n\n"
printf " ${DIM}i'll help you end-to-end in your solana project development:${RESET}\n"
printf " ${DIM}from idea research & generation to building DeFi contracts${RESET}\n"
printf " ${DIM}or integrating payments to launching the product pitch!${RESET}\n\n"
# --- Prerequisites ---
log "Checking prerequisites..."
if ! has_cmd node; then
fail "Node.js is required (>= 20). Install from https://nodejs.org"
fi
NODE_MAJOR=$(node -e "console.log(process.versions.node.split('.')[0])")
if [ "$NODE_MAJOR" -lt 20 ]; then
fail "Node.js >= 20 required (found v$(node -v)). Update: https://nodejs.org"
fi
ok "Node.js $(node -v)"
if ! has_cmd npm; then
fail "npm is required. Install Node.js from https://nodejs.org"
fi
ok "npm $(npm -v)"
# --- Detect agent CLI ---
AGENT_CLI=""
if has_cmd claude; then
AGENT_CLI="claude"
ok "Claude Code found"
fi
if has_cmd codex; then
[ -n "$AGENT_CLI" ] && AGENT_CLI="${AGENT_CLI}+codex" || AGENT_CLI="codex"
ok "Codex found"
fi
if [ -z "$AGENT_CLI" ]; then
warn "No agent CLI found (claude or codex). Install one:"
printf " ${DIM}npm i -g @anthropic-ai/claude-code${RESET}\n"
printf " ${DIM}npm i -g @openai/codex${RESET}\n"
fi
# --- Install dependencies ---
log "Installing dependencies..."
if has_cmd pnpm && [ -f "pnpm-lock.yaml" ]; then
pnpm install --frozen-lockfile 2>/dev/null || pnpm install
elif has_cmd npm; then
npm install --prefer-offline --no-audit --no-fund 2>/dev/null || npm install
else
fail "npm or pnpm is required"
fi
# --- Build ---
log "Building..."
if has_cmd pnpm; then
pnpm build 2>/dev/null || warn "Build failed, trying with npx tsx directly..."
else
npm run build 2>/dev/null || warn "Build failed, trying with npx tsx directly..."
fi
# --- Install skills ---
log "Installing skills to ~/.claude/skills/ and ~/.codex/skills/..."
mkdir -p "$HOME/.claude/skills" "$HOME/.codex/skills"
if [ -f "dist/cli/index.js" ]; then
node dist/cli/index.js init --agent
else
npx tsx cli/index.ts init --agent
fi
# --- Telemetry opt-in ---
printf "\n"
printf " ${BOLD}Telemetry${RESET} ${DIM}(helps us improve ${PRODUCT_NAME})${RESET}\n"
printf " ${DIM}We track skill usage counts only — no code, no file paths, no PII.${RESET}\n"
printf " ${DIM}Options: anonymous (default), off, community${RESET}\n\n"
# Default to off, don't prompt in non-interactive
if [ -t 0 ]; then
printf " Enable telemetry? [off/anonymous/community]: "
read -r TELEMETRY_CHOICE </dev/tty || TELEMETRY_CHOICE="anonymous"
TELEMETRY_CHOICE="${TELEMETRY_CHOICE:-off}"
else
TELEMETRY_CHOICE="anonymous"
fi
# Save telemetry preference
CONFIG_DIR="$HOME/.${PRODUCT_NAME}"
mkdir -p "$CONFIG_DIR"
if [ -f "$CONFIG_DIR/config.json" ]; then
node -e "
const fs = require('fs');
const p = '$CONFIG_DIR/config.json';
const c = JSON.parse(fs.readFileSync(p, 'utf8'));
c.telemetryTier = '$TELEMETRY_CHOICE';
fs.writeFileSync(p, JSON.stringify(c, null, 2) + '\n');
" 2>/dev/null || true
else
echo "{\"telemetryTier\":\"$TELEMETRY_CHOICE\"}" > "$CONFIG_DIR/config.json"
fi
# Mark telemetry as prompted so skills don't ask again
touch "$CONFIG_DIR/.telemetry-prompted"
ok "Telemetry: $TELEMETRY_CHOICE"
# --- What gets installed ---
printf "\n"
printf " ${CYAN}┌─────────────────────────────────────────────────────────────────┐${RESET}\n"
printf " ${CYAN}│${RESET} ${BOLD}What gets installed:${RESET} Agent Skills in ~/.claude/skills/, ${CYAN}│${RESET}\n"
printf " ${CYAN}│${RESET} ~/.codex/skills/, and ~/.agents/skills/. ${CYAN}│${RESET}\n"
printf " ${CYAN}└─────────────────────────────────────────────────────────────────┘${RESET}\n"
# --- Done ---
printf "\n"
printf " ${GREEN}${BOLD}Setup complete!${RESET}\n\n"
printf " ${BOLD}Get started${RESET} ${DIM}— open Claude and ask:${RESET}\n\n"
printf " ${CYAN}claude \"What should I build in crypto?\"${RESET} ${DIM}→ Idea phase${RESET}\n"
printf " ${CYAN}claude \"Help me build the MVP\"${RESET} ${DIM}→ Build phase${RESET}\n"
printf " ${CYAN}claude \"Deploy to mainnet\"${RESET} ${DIM}→ Launch phase${RESET}\n"
printf "\n"
printf " ${DIM}Or invoke a skill directly:${RESET}\n\n"
printf " ${CYAN}claude \"/find-next-crypto-idea I want to build in DeFi\"${RESET}\n"
printf " ${CYAN}claude \"/scaffold-project Set up my Anchor workspace\"${RESET}\n"
printf " ${CYAN}claude \"/build-with-claude Help me build the MVP\"${RESET}\n"
printf " ${CYAN}claude \"/competitive-landscape Who are my competitors?\"${RESET}\n"
printf " ${CYAN}claude \"/defillama-research Show me DeFi opportunities\"${RESET}\n"
printf " ${CYAN}claude \"/roast-my-product Be brutal — what sucks?\"${RESET}\n"
printf " ${CYAN}claude \"/product-review Review my product's UX\"${RESET}\n"
printf " ${CYAN}claude \"/create-pitch-deck Help me pitch to investors\"${RESET}\n"
printf " ${CYAN}claude \"/marketing-video Create a promo video\"${RESET}\n"
printf "\n"
printf " ${DIM}Skills auto-activate based on your prompt. No CLI needed.${RESET}\n"
printf "\n"
printf " ${DIM}Or just tell your agent:${RESET}\n"
printf " ${GREEN}\"i wanna build something cool for solana hackathon, but idk what to build\"${RESET}\n"
printf "\n"
printf " ${BOLD}Add to Your Repo ${DIM}(Optional)${RESET}\n"
printf " ${DIM}Share ${PRODUCT_NAME} with your team — teammates just run setup once.${RESET}\n\n"
printf " ${CYAN}./setup --vendor${RESET}\n"
printf "\n"
printf " ${DIM}This copies skills into .claude/skills/${PRODUCT_NAME}/ in your project.${RESET}\n"
printf " ${DIM}Commit it, and teammates get everything when they clone your repo.${RESET}\n"
printf "\n"