aboutsummaryrefslogtreecommitdiff
path: root/scripts/install-team.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install-team.sh')
-rwxr-xr-xscripts/install-team.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/install-team.sh b/scripts/install-team.sh
new file mode 100755
index 0000000..0e6e129
--- /dev/null
+++ b/scripts/install-team.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+# Install a team publishing overlay into a single target project.
+# Usage: install-team.sh <team> <project-path>
+#
+# 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 <team> <project-path>" >&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."