repo-janitor

Use BEFORE committing and whenever tidying the repo — removes regenerable build/scan artifacts (dist/, coverage.out, sbom.cdx.json, junit.xml, binaries) and prevents them from being committed. Pairs w

SKILL.md

GitHub

Repo Janitor

Goal: keep regenerable artifacts out of the repo. Two layers:

  • Deterministic, pre-commit — mise run clean:check (scripts/clean-artifacts.sh --check) runs FIRST in the git pre-commit hook: it removes known untracked artifacts from the worktree, then BLOCKS the commit if any staged file is a build/scan artifact.
  • AI review (this skill) — before you (Claude) git commit, the PreToolUse hook injects this checklist so you double-check that nothing regenerable or stray is being committed.

What counts as a removable / never-commit artifact

  • Build output: dist/, the unpixel binary, *.exe, *.test
  • Test/scan output: coverage.out / coverage.*, junit.xml, sbom.cdx.json, *.out
  • Editor/OS junk: .DS_Store, swap files
  • Local-only config that slipped in: mise.local.toml, .env*

All of these are gitignored and regenerated by mise run …; they must never be tracked.

How to act

  1. Before committing, run mise run clean (full clean) or let the pre-commit gate auto-tidy.
  2. If the gate blocks a staged artifact: git restore --staged <file>, confirm it is in .gitignore, and re-commit.
  3. If a NEW kind of generated file appears, add it to .gitignore AND to the artifacts/ glob_artifacts lists in scripts/clean-artifacts.sh so the janitor knows about it.
  4. Never delete tracked source — the script only removes untracked paths.

Notes

  • The janitor only deletes paths git does not track, so it is safe.
  • Tasks: mise run clean (full), mise run clean:check (gate behavior).