@avelor/drop
v0.1.1
Published
Safe directory removal. Validates git state before deleting.
Maintainers
Readme
@avelor/drop
Safe directory removal. Validates git state before deleting.

✖ drop: uncommitted changes in ./my-project
commit or stash before deleting
✖ drop: unpushed commits in ./my-project
push before deleting, or use --force
✓ ./empty-cache deleteddrop is rm -rf with a guard. Before deleting, it checks that the directory is either empty, not a git repository, or a git repository with everything committed and pushed. If any check fails, it blocks and tells you why.
Install
npm install -g @avelor/dropRequires Node.js 18+.
Usage
drop ./old-project # validate, then delete
drop ./repo --dry-run # show what would happen without deleting
drop ./broken --force # skip all validationExit code is 0 on success, 1 on any block or error.
Validation order
- Path exists — errors immediately if not
- Is a directory — files are not supported (
rmhandles those) - Empty directory — deletes without checks
- Git repository — blocks if not; use
--forceto override - No uncommitted changes — blocks if
git statusshows anything - Remote configured — blocks if there are commits but no remote
- All commits pushed — blocks if any local branch has unpushed commits
Each blocked state has its own message explaining what to do next.
Options
--force, -f skip all validations and delete
--dry-run show what would happen without deleting
-v, --version
-h, --helpSudo
drop refuses to run via sudo. If you genuinely need elevated permissions, switch to the root user directly. This prevents accidental destruction of system directories via privilege escalation.
drop: do not run with sudo
if you need elevated permissions, run as root directlyLicense
MIT
