zj-git-bypass-safe-delete

Installation
SKILL.md

Bypass WorkBuddy Safe-Delete for Git

WorkBuddy's safe-delete shim (genie-safe-delete.cjs, injected via NODE_OPTIONS=--require=...) intercepts fs.unlinkSync / fs.rmSync / fs.rmdirSync and routes deletes to the OS trash. On Windows Git Bash, uname -s returns MINGW64_NT-10.0 — which the shim's case MINGW* does not match, so it falls through to trash_linux whose EXDEV fallback actually runs REAL_RM -rf "$p". Net effect: rm -rf is destructive on this host, and git's internal Node helpers silently lose .git/refs/* / index.lock / FETCH_HEAD.

This skill makes both the symptom (broken git) and the root cause (rm -rf is destructive) safe to handle.

Quick start

  1. Diagnose: bash scripts/diagnose.sh <repo-path> — reports which files are missing, whether reflog is intact, and whether the shim is in scope.
  2. Recover: bash scripts/recover-refs.sh <repo-path> <branch> [<commit>] — recreates missing refs/heads/... from reflog using direct file IO (not git update-ref, which itself is unsafe under the shim).
  3. Stop using rm -rf for cleanup — use mv <target> <backup>/ instead (shim does not wrap mv).

Workflow

1. Diagnose

Run:

Installs
1
GitHub Stars
7
First Seen
Sep 4, 2026