#!/usr/bin/env bash # install.sh — Install the Greyhaven Design System into a consuming project. # # Copies (does NOT symlink) files so the consuming project owns its copies. # Re-run this script to pull updated versions after design system changes. # # What it does: # 1. Copies SKILL.md into .claude/skills/ (for Claude Code) # 2. Copies AGENTS.md into the project root (standard convention) # 3. Copies Aspekta font files + font-face.css into public/fonts/ # 4. Prints CSS import + MCP setup instructions # # Usage: # ./skill/install.sh /path/to/your/project set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" SKILL_FILE="${SCRIPT_DIR}/SKILL.md" AGENTS_FILE="${SCRIPT_DIR}/AGENTS.md" FONTS_DIR="${REPO_ROOT}/public/fonts" if [ $# -ge 1 ]; then TARGET_PROJECT="$(cd "$1" && pwd)" else echo "Usage: $0 " echo "" echo "Example:" echo " $0 /path/to/my-app" echo " $0 ." exit 1 fi if [ ! -d "$TARGET_PROJECT" ]; then echo "Error: Directory not found: ${TARGET_PROJECT}" exit 1 fi # Helper: backup existing file/symlink and copy new one copy_with_backup() { local src="$1" local dst="$2" if [ -L "$dst" ]; then # Remove any existing symlink (leftover from old installs) rm "$dst" elif [ -f "$dst" ]; then mv "$dst" "${dst}.bak" echo " (backed up existing file to $(basename "${dst}.bak"))" fi cp "$src" "$dst" } echo "Installing Greyhaven Design System into ${TARGET_PROJECT}" echo "" # ── 1. SKILL.md ──────────────────────────────────────────────────────────── if [ -f "$SKILL_FILE" ]; then SKILLS_DIR="${TARGET_PROJECT}/.claude/skills" mkdir -p "$SKILLS_DIR" DST="${SKILLS_DIR}/greyhaven-design-system.md" copy_with_backup "$SKILL_FILE" "$DST" echo "[ok] SKILL.md: ${DST}" else echo "[skip] SKILL.md not found — run 'pnpm skill:build' first" fi # ── 2. AGENTS.md ─────────────────────────────────────────────────────────── if [ -f "$AGENTS_FILE" ]; then DST="${TARGET_PROJECT}/AGENTS.md" copy_with_backup "$AGENTS_FILE" "$DST" echo "[ok] AGENTS.md: ${DST}" else echo "[skip] AGENTS.md not found — run 'pnpm skill:build' first" fi # ── 3. Fonts ─────────────────────────────────────────────────────────────── if [ -d "$FONTS_DIR" ]; then TARGET_FONTS="${TARGET_PROJECT}/public/fonts" mkdir -p "$TARGET_FONTS" copied=0 for f in "$FONTS_DIR"/Aspekta-*.woff2; do [ -f "$f" ] || continue cp "$f" "$TARGET_FONTS/" copied=$((copied + 1)) done if [ -f "$FONTS_DIR/font-face.css" ]; then cp "$FONTS_DIR/font-face.css" "$TARGET_FONTS/" fi echo "[ok] Fonts: ${copied} Aspekta woff2 files copied to ${TARGET_FONTS}/" else echo "[skip] Fonts dir not found at ${FONTS_DIR}" fi # ── Next steps ───────────────────────────────────────────────────────────── cat <<'EOF' Done! ─── Next steps ──────────────────────────────────────────────────────────── 1. Add Aspekta @font-face to your global CSS: @font-face { font-family: 'Aspekta'; font-weight: 400; font-display: swap; src: url('/fonts/Aspekta-400.woff2') format('woff2'); } @font-face { font-family: 'Aspekta'; font-weight: 500; font-display: swap; src: url('/fonts/Aspekta-500.woff2') format('woff2'); } @font-face { font-family: 'Aspekta'; font-weight: 600; font-display: swap; src: url('/fonts/Aspekta-600.woff2') format('woff2'); } @font-face { font-family: 'Aspekta'; font-weight: 700; font-display: swap; src: url('/fonts/Aspekta-700.woff2') format('woff2'); } (Or import the full set: @import url('/fonts/font-face.css');) And set the font stack: --font-sans: 'Aspekta', ui-sans-serif, system-ui, sans-serif; 2. (Optional) Register the Greyhaven MCP server. Create .mcp.json in your project root: { "mcpServers": { "greyhaven": { "command": "npx", "args": ["tsx", "/mcp/server.ts"] } } } 3. Re-run this script after design system updates to refresh your copies. EOF