Something went wrong. Try again.
A mental bridge between a hacker and their LLM(s) of choice.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132#!/usr/bin/env sh# Deletes the files named by its arguments (e.g. `scripts/rm.sh docs/x.md`),# which must be repo-relative paths, from the repo root. It checks every path# before deleting any, and refuses absolute paths, `..` segments, directories,# missing files and anything under .git/, .jj/ or node_modules/. Agents use it# instead of `rm`, which the agent shell aliases to `rm -i`.set -eu
cd "$(dirname "$0")/.."
refuse() { echo "scripts/rm.sh: refusing $1: $2" >&2 exit 1}
[ "$#" -gt 0 ] || refuse "nothing" "usage: scripts/rm.sh <repo-relative file>..."
for f in "$@"; do case "$f" in /*) refuse "$f" "absolute path; pass a repo-relative path" ;; .. | ../* | */.. | */../*) refuse "$f" "'..' segment" ;; esac case "${f#./}" in .git | .git/* | */.git/* | .jj | .jj/* | */.jj/* | node_modules | node_modules/* | */node_modules/*) refuse "$f" "it's under .git/, .jj/ or node_modules/" ;; esac [ ! -d "$f" ] || refuse "$f" "it's a directory" [ -e "$f" ] || [ -L "$f" ] || refuse "$f" "no such file"done
command rm -- "$@"