mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 07:37:30 +01:00
Problem: the org rules were restated by hand in CLAUDE.md essays (aoz-begleitung 1,850 lines), AGENTS.md intros and three differently worded starter templates; the starter said accounts are the app's own above a rule saying accountkit owns them. Nothing checked any of it, and 18 agent files import a personal ~/.claude file. Change: templates/agent-rules.md is the only place the rules are written. sync-agent-rules.mjs opens one pull request per code repo putting it between fleet:rules markers (and a CLAUDE.md pointer where there is no CLAUDE.md; an existing CLAUDE.md is never rewritten). agent-files-audit.mjs fails on a finding not in agent-files.baseline; a baselined finding that has been fixed, or a block that is merely out of date, never fails it (the org-drift ratchet went red twice on 26 Oct because a file in another repo improved). All three templates carry the block and a test pins that. Own workflow, so a finding in another repo cannot hold this repo's merges. Validation: 27 + 4 + 3 self-tests pass; the audit read 46 repositories and found 77 findings, all baselined; docs-truth-audit reports the same result on solon, petvity, aoz-begleitung and skif with and without the block.
79 lines
2.4 KiB
YAML
79 lines
2.4 KiB
YAML
# One org-rules block in every repo's AGENTS.md, generated from this repo.
|
|
#
|
|
# templates/agent-rules.md is the only place the rules are written. This opens
|
|
# (or updates) one pull request per code repo that does not carry the current
|
|
# block yet; the repo's own CI checks it and the auto-merge sweep merges it.
|
|
# The audit then fails on a repo that has no block and no baseline line, so a
|
|
# new repo cannot start without the shape. It is its own workflow, not a job
|
|
# of ci.yml: a finding in another repo must never hold this repo's merges.
|
|
name: Agent rules
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- templates/agent-rules.md
|
|
- scripts/ci/agent-rules.mjs
|
|
- scripts/ci/agent-files-audit.mjs
|
|
- scripts/ci/agent-files.baseline
|
|
- scripts/packages/sync-agent-rules.mjs
|
|
pull_request:
|
|
paths:
|
|
- templates/agent-rules.md
|
|
- templates/**/AGENTS.md
|
|
- templates/**/CLAUDE.md
|
|
- scripts/ci/agent-rules.mjs
|
|
- scripts/ci/agent-files-audit.mjs
|
|
- scripts/ci/agent-files.baseline
|
|
- scripts/packages/sync-agent-rules.mjs
|
|
schedule:
|
|
- cron: "41 5 * * *"
|
|
workflow_dispatch: {}
|
|
|
|
concurrency:
|
|
group: agent-rules
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
audit:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: "24"
|
|
- name: The rules and their audit still behave
|
|
run: |
|
|
node scripts/ci/test-agent-rules.mjs
|
|
node scripts/ci/test-agent-files-audit.mjs
|
|
node scripts/packages/test-sync-agent-rules.mjs
|
|
- name: Does any repo's agent-file set drift from the one shape?
|
|
env:
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
|
|
run: node scripts/ci/agent-files-audit.mjs --check
|
|
|
|
sync:
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: "24"
|
|
- name: Offer every repo the current block
|
|
env:
|
|
GH_TOKEN: ${{ secrets.FLEET_PAT }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -z "${GH_TOKEN}" ]; then
|
|
echo "::error::FLEET_PAT is not set; no pull request can be opened."
|
|
exit 1
|
|
fi
|
|
gh auth setup-git
|
|
node scripts/packages/sync-agent-rules.mjs
|