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/tests | |
| 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/tests')
| -rw-r--r-- | scripts/tests/sync-language-bundle.bats | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/tests/sync-language-bundle.bats b/scripts/tests/sync-language-bundle.bats index 9fd1108..e641646 100644 --- a/scripts/tests/sync-language-bundle.bats +++ b/scripts/tests/sync-language-bundle.bats @@ -44,6 +44,14 @@ matches_canonical() { # project-relative-path canonical-abs-path diff -q "$PROJ/$1" "$2" >/dev/null 2>&1 } +# Mirror install-team.sh: copy only the team overlay's own rule files into a +# synthetic project (no generic rules, hooks, githooks, or settings). +install_team_overlay() { + local team="$1" proj="$2" + mkdir -p "$proj/.claude/rules" + cp "$REAL_REPO/teams/$team/claude/rules/"*.md "$proj/.claude/rules/" +} + # --- Normal: no bundle / clean --- @test "sync: project with no bundle is a quiet no-op (exit 0)" { @@ -151,3 +159,34 @@ matches_canonical() { # project-relative-path canonical-abs-path [ "$status" -eq 1 ] [[ "$output" == *"does not exist"* ]] } + +# --- Team overlays --- + +@test "sync: clean team overlay is a quiet no-op (exit 0)" { + install_team_overlay deepsat "$PROJ" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [ -z "$output" ] +} + +@test "sync: drifted team-overlay rule is auto-fixed and restored" { + install_team_overlay deepsat "$PROJ" + echo "junk drift" >> "$PROJ/.claude/rules/publishing.md" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + [[ "$output" == *"team bundle 'deepsat'"* ]] + [[ "$output" == *"publishing.md"* ]] + matches_canonical ".claude/rules/publishing.md" "$REAL_REPO/teams/deepsat/claude/rules/publishing.md" +} + +@test "sync: team overlay does NOT pull in generic claude-rules" { + install_team_overlay deepsat "$PROJ" # only publishing.md present, no commits.md + echo "junk drift" >> "$PROJ/.claude/rules/publishing.md" + run bash "$SCRIPT" "$PROJ" + [ "$status" -eq 0 ] + # A team overlay owns only its own rule; the sync must not copy generic + # rules (commits.md, testing.md, ...) into the project the way a language + # bundle does. + [ ! -f "$PROJ/.claude/rules/commits.md" ] + [ ! -f "$PROJ/.claude/rules/testing.md" ] +} |
