diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-22 16:59:56 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-22 16:59:56 -0500 |
| commit | 3cb467e6aa4356f9912d661ef12d581d61b65cb6 (patch) | |
| tree | 6cc1e0634dedcdbbf68fcfc6d6696492fa96ad82 /scripts/install-team.sh | |
| parent | b37e4f8cb494ca14b9a00c967c7df8bd8d0a9ee1 (diff) | |
| download | rulesets-3cb467e6aa4356f9912d661ef12d581d61b65cb6.tar.gz rulesets-3cb467e6aa4356f9912d661ef12d581d61b65cb6.zip | |
feat: split team publishing rules into an installable overlay
The global commits.md carried DeepSat-specific publishing steps — Linear ticket-state moves, the Slack notification protocol with its channel ID and engineer names, the deepsat.ghe.com host, the team merge norm. Those are symlinked into every project on the machine, so they sat as dead weight in personal repos and risked misfiring where there's no Linear ticket to move or Slack mpdm to ping.
I split them out. commits.md keeps the universal skeleton (identity, attribution, commit format, the review-and-publish gate, verification) and replaces the team steps with seams: "run the project's publishing overlay here if it defines one," the same pattern startup.org uses for startup-extras. A project with no overlay runs the complete flow, just without ticket and chat integration.
The DeepSat specifics move to teams/deepsat/claude/rules/publishing.md. That file is not a global rule — install-team.sh copies it into one project's .claude/rules/ (make install-team TEAM=deepsat PROJECT=...), keyed on the PROJECT argument, so only the named project gets it. Location decides distribution: claude-rules/ is the global-symlink set, teams/ is targeted-copy, so the overlay reaches DeepSat and nowhere else.
The startup freshness check (sync-language-bundle.sh) now covers team overlays alongside language bundles: a process_bundle function handles both, with a team syncing only its own rule (no generic rules, hooks, or settings — those belong to a language bundle). A drifted overlay rule auto-fixes from canonical at the project's next startup, the same mechanism language bundles already ride.
Tested: 3 new bats cases (team overlay clean / drifted-and-fixed / does-not-pull-generic-rules) on top of the 11 existing; install-team + sync verified end-to-end against a temp project. make test green, shellcheck clean.
Diffstat (limited to 'scripts/install-team.sh')
| -rwxr-xr-x | scripts/install-team.sh | 49 |
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." |
