#!/usr/bin/env bash # sd-design — multi-agent installer # Source: https://sd.michelvalles.com # # Usage: # curl -fsSL https://sd.michelvalles.com/install.sh | bash # Auto-detect: writes the universal AGENTS.md plus files for any # agent directories already present (.claude/, .cursor/, .windsurf/, .github/). # # curl -fsSL https://sd.michelvalles.com/install.sh | bash -s -- --all # Install for every supported agent (overwrites existing files). # # curl -fsSL https://sd.michelvalles.com/install.sh | bash -s -- --agents=claude,cursor,codex # Install only the listed agents. # # Supported agents: # claude → .claude/skills/sd-design/SKILL.md + CLAUDE.md # codex → AGENTS.md (OpenAI Codex CLI) # cursor → .cursor/rules/sd-design.mdc + .cursorrules (legacy) # windsurf → .windsurf/rules/sd-design.md + .windsurfrules (legacy) # copilot → .github/copilot-instructions.md (GitHub Copilot) # gemini → GEMINI.md (Gemini CLI) # aider → CONVENTIONS.md (Aider) # continue → .continuerules (Continue) # kiro → .kiro/steering/sd-design.md (Kiro) # universal → AGENTS.md only (the agents.md standard; fallback for everything else) set -euo pipefail HOST="https://sd.michelvalles.com" AGENTS_FLAG="" MODE="auto" for arg in "$@"; do case "$arg" in --all) MODE="all" ;; --agents=*) MODE="list" AGENTS_FLAG="${arg#--agents=}" ;; --help|-h) sed -n '2,30p' "$0" exit 0 ;; *) echo "unknown argument: $arg" >&2 echo "use --help for usage" >&2 exit 2 ;; esac done # Sanity check if [ ! -f "package.json" ] && [ ! -d ".git" ] && [ ! -d ".claude" ]; then echo "warning: current directory does not look like a project root" echo " (no package.json, no .git, no .claude)" if [ -t 0 ]; then printf "continue anyway? [y/N] " read -r answer case "$answer" in y|Y|yes|YES) ;; *) echo "aborted."; exit 1 ;; esac else echo "no tty for confirmation; aborting" >&2 exit 1 fi fi fetch() { local src="$1" local dst="$2" mkdir -p "$(dirname "$dst")" if curl -fsSL "$HOST/$src" -o "$dst"; then local size size=$(wc -c < "$dst" | tr -d ' ') echo " wrote $dst ($size bytes)" else echo " error: failed to fetch $src" >&2 return 1 fi } install_claude() { echo "[claude]" fetch "SKILL.md" ".claude/skills/sd-design/SKILL.md" fetch "AGENTS.md" "CLAUDE.md" } install_codex() { echo "[codex]" fetch "AGENTS.md" "AGENTS.md" } install_cursor() { echo "[cursor]" fetch "AGENTS.md" ".cursor/rules/sd-design.mdc" fetch "AGENTS.md" ".cursorrules" } install_windsurf() { echo "[windsurf]" fetch "AGENTS.md" ".windsurf/rules/sd-design.md" fetch "AGENTS.md" ".windsurfrules" } install_copilot() { echo "[copilot]" fetch "AGENTS.md" ".github/copilot-instructions.md" } install_gemini() { echo "[gemini]" fetch "AGENTS.md" "GEMINI.md" } install_aider() { echo "[aider]" fetch "AGENTS.md" "CONVENTIONS.md" } install_continue() { echo "[continue]" fetch "AGENTS.md" ".continuerules" } install_kiro() { echo "[kiro]" fetch "AGENTS.md" ".kiro/steering/sd-design.md" } install_universal() { echo "[universal]" fetch "AGENTS.md" "AGENTS.md" } run_agent() { case "$1" in claude) install_claude ;; codex) install_codex ;; cursor) install_cursor ;; windsurf) install_windsurf ;; copilot) install_copilot ;; gemini) install_gemini ;; aider) install_aider ;; continue) install_continue ;; kiro) install_kiro ;; universal) install_universal ;; *) echo "unknown agent: $1 (skipping)" >&2 ;; esac } case "$MODE" in all) echo "installing for ALL supported agents..." for a in claude codex cursor windsurf copilot gemini aider continue kiro; do run_agent "$a" done ;; list) echo "installing for: $AGENTS_FLAG" IFS=',' read -r -a agents <<< "$AGENTS_FLAG" for a in "${agents[@]}"; do run_agent "$(echo "$a" | tr -d ' ')" done ;; auto) echo "auto-detecting agents present in this project..." install_universal # always if [ -d ".claude" ]; then install_claude; fi if [ -d ".cursor" ] || [ -f ".cursorrules" ]; then install_cursor; fi if [ -d ".windsurf" ] || [ -f ".windsurfrules" ]; then install_windsurf; fi if [ -d ".github" ]; then install_copilot; fi if [ -d ".kiro" ]; then install_kiro; fi if [ -f ".continuerules" ]; then install_continue; fi ;; esac echo echo "done." echo echo "remember:" echo " - all assets live at $HOST and are fetched on demand by the agent" echo " - the agent will activate when you ask for an editorial slide deck," echo " or when it sees you editing components/deck/** or components/slides/**" echo echo "to install for more agents later:" echo " curl -fsSL $HOST/install.sh | bash -s -- --agents=cursor,gemini"