downstream-sync
Refresh every downstream repo (beet_atproto, beet_egress, beet_esp, beet_eval, beetmash) with beet's AGENTS.md marker block, its MIT/Apache licenses and shared config files. Use after changing AGENTS.md, the licenses or rustfmt.toml.
- License 许可
- Apache-2.0
- 所属仓库
- mrchantey/beet
- 最近更新
- 2026-10-23
- Stars
- ★ 134
- Forks
- 8
01 前言 Front Matter
- name
- downstream-sync
- description
- Refresh every downstream repo (beet_atproto, beet_egress, beet_esp, beet_eval, beetmash) with beet's AGENTS.md marker block, its MIT/Apache licenses and shared config files. Use after changing AGENTS.md, the licenses or rustfmt.toml.
03 SKILL.md 正文
Downstream Sync
Beet has downstream repos (separate git repos building on beet via a path dependency). Each inherits beet's conventions rather than fracturing into its own: a verbatim copy of beet's AGENTS.md lives inside a marker block at the bottom of the downstream AGENTS.md, and beet's licenses and shared config files are copied as-is. This skill refreshes all of that; downstream-create scaffolds a new repo and registers it here.
Downstream repos
/home/pete/me/beet_atproto/home/pete/me/beet_egress/home/pete/me/beet_esp/home/pete/me/beet_eval/home/pete/me/beetmash, the business built on beet, which is not open source and so takes no license files (theUNLICENSEDarray below)
downstream-create adds a new repo to this list and to the DOWNSTREAM array below.
What is synced
rustfmt.toml,LICENSE-MIT.txt,LICENSE-APACHE.txt: verbatim copies of beet's, so every downstream formats like beet and is dual licensedMIT OR Apache-2.0like beet. AnUNLICENSEDrepo takesrustfmt.tomlalone.AGENTS.mdinherited block: everything between the markers is replaced with beet's currentAGENTS.md(the working tree version, so in-flight edits propagate):
<!-- beet:sync:begin, beet's AGENTS.md refreshed by the downstream-sync skill, do not hand-edit -->
<!-- beet:sync:end -->
CLAUDE.md -> AGENTS.mdsymlink.
Skills are not synced
No skill is copied into a downstream. A skill an agent working on a crate built on beet would invoke lives in the shared user-level ~/.agents/skills (stowed from /home/pete/me/arch-config/stow/agents/.agents/skills), so every repo already sees it: the generic ones under their own names (docs-diataxis, release, phased-plan, ..), the beet-specific ones prefixed beet- (beet-rendering, beet-create-cli, beet-audit-free-fns).
Beet-repo procedures stay in $BEET/.agents/skills, since they name beet's justfile recipes, worktrees, example set, site and deploy; they are reachable at that path like every other beet-relative path in the block. A downstream's own equivalents (its test command, its deploy entry) belong in its AGENTS.md header, and its .agents/skills holds only its own skills (beet_egress keeps download-takeout there), never named like a shared one.
The contract
- A downstream
AGENTS.mdis its repo-specific header followed by the synced block. Where the header conflicts with the block, the header wins; downstream deltas (target quirks, path-dep notes, test attribute spellings) belong in the header, never as edits inside the block. - Never hand-edit inside the markers; the next sync clobbers it.
- Leave all changes unstaged in every repo, including this one. Never commit.
- A downstream
AGENTS.mdmissing the markers is malformed, and a missingAGENTS.mdis the same case: the script warns and skips it. Write the header by hand with the markers at the end (downstream-create's template is the shape), never append a second copy of anything, then rerun.
Run it
BEET=/home/pete/me/beet
DOWNSTREAM=(/home/pete/me/beet_atproto /home/pete/me/beet_egress /home/pete/me/beet_esp /home/pete/me/beet_eval /home/pete/me/beetmash)
# not open source: beet's conventions, never its licenses
UNLICENSED=(/home/pete/me/beetmash)
for repo in "${DOWNSTREAM[@]}"; do
files=(rustfmt.toml)
[[ " ${UNLICENSED[*]} " == *" $repo "* ]] || files+=(LICENSE-MIT.txt LICENSE-APACHE.txt)
for file in "${files[@]}"; do
cp "$BEET/$file" "$repo/$file"
done
if grep -q '<!-- beet:sync:begin' "$repo/AGENTS.md" 2>/dev/null; then
awk -v src="$BEET/AGENTS.md" '
/<!-- beet:sync:begin/ { print; while ((getline line < src) > 0) print line; close(src); skip=1; next }
/<!-- beet:sync:end/ { skip=0 }
!skip { print }
' "$repo/AGENTS.md" > "$repo/AGENTS.md.tmp" && mv "$repo/AGENTS.md.tmp" "$repo/AGENTS.md"
ln -sf AGENTS.md "$repo/CLAUDE.md"
else
echo "$repo/AGENTS.md: missing or no sync markers, write the header by hand" >&2
fi
done
Afterwards spot-check one downstream repo: AGENTS.md header intact, exactly one block with beet's current text inside it, and both license files present, or absent in an UNLICENSED repo.
Candidates deliberately not synced
justfile,.cargo/config.toml,.gitignore: repo-shaped, they drift for real reasons;downstream-createwrites their initial shape.Cargo.toml: repo-shaped; itslicense = "MIT OR Apache-2.0"(on the package, or[workspace.package]in a workspace) is set once, anddownstream-create's template carries it..github/workflows/test.yml: revisit when a downstream gains CI.
04 同仓库更多 Skills
worktree-sync-upstream
Sync a detached-HEAD worktree with its upstream branch in the main repo in both directions, rebasing only owned commits and fast-forwarding upstream, with recovery steps for tangled history and helpers for prose and secrets.toml conflicts. Use from inside a worktree.
worktree-sync-all
Sync the main branch with every worktree in both directions, applying the worktree-sync-upstream skill to each in turn, then levelling them. Use when asked to sync all worktrees.
test-the-works
Maximal project health pass. Run core tests, all tests, the example smoke set, the rsx_site verification and every downstream repo in sequence, fixing every failure and warning surfaced along the way. Use when asked to run 'the works' or fully verify the project.
test-run
Run the core test suite (just test-core) to a clean, warning-free pass, with recipes for hanging tests and mold linker flakes. Use when asked to run or fix the test suite.
test-examples
Run the workspace example smoke set to catch regressions unit tests miss, covering every feature gate combination with self-terminating examples and curl-probed servers. Use when asked to run or verify the examples.
test-dependency-audit
Audit every crate's Cargo.toml for unused, duplicate or misplaced dependencies, moving shared deps to the workspace and feature-gating where sensible. Use when asked to audit or slim dependencies.