arthai-marketplace

/revert-check

Detect accidental reverts of recently-merged PRs in the working tree before commit. Catches stale-buffer / bad-stash-pop scenarios that would silently undo landed bug fixes.

Synopsis

/revert-check [--strict|--advisory]

When to use it

Quickstart

/revert-check

What you’ll see: either ✓ No suspected reverts. Working tree changes look like genuine new work. or a table of flagged files showing the net line delta and the recently-merged PRs that touched each file, with verification commands.

Examples

/revert-check              # advisory (default) — warn but never block
/revert-check --advisory   # same as default
/revert-check --strict     # exit non-zero on any suspected revert — for pre-commit hooks / CI

Arguments & flags

Flag Values Default What it does
--advisory on Warn only; always exits 0
--strict off Exit 1 when any suspected revert is found — use as a blocking gate

What it does

  1. Identifies changed files — staged + unstaged tracked files, filtering out lockfiles and generated artifacts. Nothing changed → exits immediately.
  2. Detects the comparison baseline — the remote default branch (origin/main or equivalent), fetched fresh.
  3. Runs the per-file heuristic — a file is a suspected revert when all three signals fire: it was touched by a commit on the default branch in the last 30 days (recency), your working tree net-deletes lines against that baseline (direction), and the deletion is non-trivial (magnitude). Specifically, magnitude is detected as >20 net deleted lines AND deletions outnumber additions by 2:1 or more.
  4. Reports — flagged files are shown with their net delta and the recent PR numbers that touched them, plus the exact git diff / gh pr view / git restore commands to verify or discard. The human decides — the skill never modifies anything.
  5. Exits — 0 in advisory mode (even with warnings), 1 in strict mode if anything was flagged.

The check is entirely read-only: no files written, no watchers registered, no refs touched.

Output & artifacts

Troubleshooting

Problem Fix
A genuine refactor or test consolidation is flagged Expected false positive — review the diff, then proceed in advisory mode and document the intentional deletion in your commit message (e.g., “Refactor: removing dead code #123”)
skipped: no remote baseline No remote or default branch detectable (offline, no origin) — the check skips gracefully with exit 0
A subtle one-line revert wasn’t caught Below the heuristic’s threshold by design — /qa’s test execution is the second line of defense
Lockfile or generated artifact gets flagged These should be filtered automatically — if one slips through, it’s safe to ignore and proceed (advisory mode never blocks you)