Files
raea/tools/dupes.sh
shaneandshinyobjectz eaf5406f39 One raea skill, in raea-skills (skills/): raea pins it, and its release ships it from the pin (#58)
The raea skill moves from sdk/skills to the raea-skills submodule, in its framework (skills/skills/raea/SKILL.md
with raea-tested-against and raea-verbs, checked by its skillcheck), and raea-bevy is folded into it: its router
is the skill's 3d.md and its topic files are in 3d/. An agent loads one skill for everything raea does.

- `raea skill` and `raea skills install` find a checkout's skill in skills/skills (an install's share/raea/skills is
  unchanged) and skip raea-skills' _template. `raea skill raea-bevy` says where its text went, and install removes
  an older raea's raea-bevy copy.
- tools/skills.sh gen writes the references into skills/skills/raea/reference and copies the Bevy craft guides
  (sdk/guides/craft/bevy) in as the 3D topic files, which were links: a clone of raea-skills, or GitHub, reads them
  whole. check fails on a copy that differs from its guide, on one whose guide is gone, and on an uninitialised
  submodule.
- tools/release.sh gates on the pointer (skills in the gate inputs), adds raea-skills at the pin to the gate's tree,
  packs share/raea/skills from it, and lists raea-skills' own commits in the skills notes.
- The core-rules test reads the skill from the submodule, and the surface test checks it.
- The Claude Code plugin names the one skill folder; README, the guides and the SDK docs say raea's 3D guide.

Co-authored-by: shinyobjectz <[email protected]>
2026-11-08 14:36:53 -05:00

36 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Copied code, as a ratchet: exits 1 when cargo-dupes finds more exact or near-duplicate groups in raea's own Rust
# than tools/dupes.max allows. When it finds fewer, it says so: lower the numbers in the same commit, so they only
# go down. Vendored crates, the conformance runner (sdk/ui/conformance: a test tool in its own workspace, its
# one-line closures matching other crates') and tests are left out: #[cfg(test)] modules and files named tests.rs (a
# module's tests split into a file of their own, which cargo-dupes reads as code). So is engine/bevy-plugins/src/
# declared.rs, which tools/bevy-plugins.sh generates: one registration closure per catalog plugin, alike by design.
# tools/dupes.sh the check (L0, tools/agents/check)
# tools/dupes.sh report every group, to find what to fold together
# Needs cargo-dupes (cargo install cargo-dupes --locked).
set -u
ROOT=$(cd "$(dirname "$0")/.." && pwd)
cd "$ROOT" || exit 2
# tools/rask and skills (raea-skills) are their own repositories (submodules, empty in a fresh export), so they never count
X=(--exclude vendor --exclude target --exclude sdk/ui/conformance --exclude-tests --exclude tests.rs --exclude engine/bevy-plugins/src/declared.rs \
--exclude tools/rask --exclude skills)
command -v cargo-dupes >/dev/null || { echo "dupes: cargo-dupes isn't installed (cargo install cargo-dupes --locked)"; exit 1; }
[ "${1:-}" = report ] && exec cargo dupes report "${X[@]}"
read -r max_exact max_near < <(awk -F= '/^exact=/{e=$2} /^near=/{n=$2} END{print e, n}' tools/dupes.max)
[ -n "$max_exact" ] && [ -n "$max_near" ] || { echo "dupes: tools/dupes.max names no exact= and near= limits"; exit 1; }
out=$(cargo dupes stats "${X[@]}" 2>&1) || { echo "$out"; exit 1; }
exact=$(echo "$out" | awk '/^Exact duplicates:/{print $3}')
near=$(echo "$out" | awk '/^Near duplicates:/{print $3}')
[ -n "$exact" ] && [ -n "$near" ] || { echo "dupes: couldn't read cargo-dupes' stats:"; echo "$out"; exit 1; }
if [ "$exact" -gt "$max_exact" ] || [ "$near" -gt "$max_near" ]; then
echo "dupes: $exact exact and $near near-duplicate groups (allowed $max_exact and $max_near): fold the new copy into"
echo " what it copies (tools/dupes.sh report lists every group)"
exit 1
fi
if [ "$exact" -lt "$max_exact" ] || [ "$near" -lt "$max_near" ]; then
echo "dupes: ok, and down to $exact exact and $near near: set tools/dupes.max to exact=$exact near=$near"
else
echo "dupes: ok ($exact exact, $near near)"
fi