#!/usr/bin/env bash # Install a team publishing overlay into a single target project. # Usage: install-team.sh # # Copies the team overlay's rule file(s) into the project's .claude/rules/. # A team overlay carries only its own rules — no generic rules, hooks, # githooks, or settings (those belong to the global install or a language # bundle). Re-runnable; the authoritative source overwrites. # # The overlay is NOT a global rule: it lands in one project's .claude/rules/ # and loads only there. The companion sync-language-bundle.sh keeps it fresh # at that project's startup. set -euo pipefail TEAM="${1:-}" PROJECT="${2:-}" if [ -z "$TEAM" ] || [ -z "$PROJECT" ]; then echo "Usage: $0 " >&2 exit 1 fi REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" SRC="$REPO_ROOT/teams/$TEAM" if [ ! -d "$SRC/claude/rules" ]; then echo "ERROR: no team overlay rules for '$TEAM' (expected $SRC/claude/rules/)" >&2 exit 1 fi if [ ! -d "$PROJECT" ]; then echo "ERROR: project path does not exist: $PROJECT" >&2 exit 1 fi PROJECT="$(cd "$PROJECT" && pwd)" echo "Installing team overlay '$TEAM' into $PROJECT" mkdir -p "$PROJECT/.claude/rules" count=0 for f in "$SRC/claude/rules"/*.md; do [ -f "$f" ] || continue cp "$f" "$PROJECT/.claude/rules/$(basename "$f")" count=$((count + 1)) done echo " [ok] .claude/rules/ — $count overlay rule(s) from teams/$TEAM/" echo "Loads only in this project. Startup keeps it synced via sync-language-bundle.sh."