◉ Pulse
programmersd21 avatar
#24 today

programmersd21/oops

Rust Tool #backup #bash #cli #daemon

🛡️ Undo daemon for destructive shell commands

Created Jul 30, 2026
Stars
10
Today
+10
Forks
0
Quality
95/100
Momentum
20

README

Fetched from GitHub on Oct 30, 2026, 9:23 PM UTC · README.md

View original on GitHub

Third-party content — Open Source Pulse is not the owner of this repository.

This README belongs to programmersd21/oops and its contributors. We fetch it directly from the project’s public GitHub repository and display it for reference only. All text, code, images and trademarks remain the property of their respective authors. See the repository for its license terms. Copyright / takedown policy.

demo

Crate Downloads MSRV License Platform PRs

Undo daemon for destructive shell commands

Before rm, mv, sed -i, >, git reset --hard, and friends run, their target files get snapshotted — so you can undo the damage.


oops

→ undoes whatever you just broke.


Install

cargo build --release
install -Dm755 target/release/oops ~/.local/bin/oops
install -Dm644 systemd/oopsd.service ~/.config/systemd/user/oopsd.service
systemctl --user daemon-reload
systemctl --user enable --now oopsd
loginctl enable-linger "$USER"
eval "$(oops init bash)"   # or: zsh, fish

Commands

Command Description
oops Undo the most recent restorable snapshot
oops undo [id] Undo a specific snapshot (default: newest)
oops list Browse snapshot history (TUI, ↑↓/jk to navigate)
oops diff <id> Show files captured in a snapshot (TUI)
oops status Daemon status, storage usage, lingering state
oops gc Trigger garbage collection
oops pin <id> / oops unpin <id> Exempt / unexempt a snapshot from GC
oops init <bash|zsh|fish> Print shell hook script
oops daemon Run the background daemon (started via systemd)

Commands that talk to the daemon exit with code 2 and print setup instructions if it's not running.

How it works

A preexec hook (bash DEBUG trap, zsh/fish preexec) intercepts every command before execution and sends it to the daemon over a Unix socket. The daemon classifies the command — if it's destructive, it snapshots every at-risk path before acknowledging the hook. Only then does the shell run the command.

Files are copied (reflink on Btrfs/ZFS, plain copy elsewhere) to ~/.local/share/oops/blobs/<id>/. Metadata lives in SQLite. mtime is recorded for conflict detection during restore.

oops undo replays the snapshot: directories first (with original permissions), then files from blobs. The latest snapshot restores unconditionally. Older snapshots check mtime to avoid clobbering independently modified files. .git/ is never touched.

Configuration

Variable Default Description
OOPS_HOOK_TIMEOUT_MS 200 Max ms to wait for daemon ack before running the command unprotected
OOPS_ALLOW_PATHS $HOME Colon-separated additional directories to permit snapshotting

Data lives in $XDG_DATA_HOME/oops (~/.local/share/oops). Retention is 48 hours or 2 GB, whichever hits first. Pinned snapshots are exempt.

Limitations

Shell-hook capture cannot intercept destructive commands from cron, systemd services, GUI applications, scripts without the hook loaded, or non-interactive shells. fd redirects (1>&2, >&2) are correctly ignored; only truncating redirects (> file) trigger a snapshot. See oops status for the full degraded-warning message.

Project layout

  • oops-core/ — types, command classifier, redirect scanner, SQLite storage, IPC protocol
  • oops/ — single binary (CLI + daemon subcommand)
  • oops-tui/ — ratatui terminal UI for list and diff
  • oops/shell-hooks/ — bash, zsh, fish preexec hook scripts
  • systemd/ — systemd user service unit

License

MIT

Star History

RepoStars

Rendered by GitHub from the repository’s README. Scroll to read the full file.
First trending

Jul 30, 2026

first spotted on the list

Best rank

#24

highest position reached

Appearances

2

times on the trending list

Quality score

95

out of 100

Momentum

20

trend strength indicator

Star velocity

0.11

stars per day since creation

Activity — last 60 days

daily counts, collected every 6 hours
  • Stars
  • Forks
  • Merged PRs
  • Issues
  • Closed issues

Collecting activity data since launch — check back in a few days.

Star history

total stars per snapshot
4681012programmersd21/oops · Jul 30, 7 PM UTC: 5 starsprogrammersd21/oops · Jul 31, 8 AM UTC: 10 stars7 PM2 AM8 AM

Rank history

position on trending · lower is better
#1#24#26#28#30#32#34#36#38Jul 30, 7 PM UTC: rank #38Jul 31, 8 AM UTC: rank #247 PM2 AM8 AM

3D card for your website

Live HTML card with a glass surface and pointer tilt. Paste the iframe on any website.

<iframe src="https://www.notionpulse.cc/embed/programmersd21/oops" width="420" height="240" style="border:0;max-width:100%;background:transparent" loading="lazy" title="programmersd21/oops — trending on Open Source Pulse"></iframe>

Stars badge

Show current stars in your README or profile. Auto-updates every 6 hours.

programmersd21/oops stars badge
Markdown
[![programmersd21/oops](https://www.notionpulse.cc/api/badge/programmersd21/oops.svg)](https://www.notionpulse.cc/repo/programmersd21/oops)
HTML
<a href="https://www.notionpulse.cc/repo/programmersd21/oops"><img src="https://www.notionpulse.cc/api/badge/programmersd21/oops.svg" alt="programmersd21/oops stars badge" /></a>

Repository of the Day

#24 Repository of the Day

Repository of the Week

#24 Repository of the Week

Repository of the Month

#24 Repository of the Month