npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

git-rewind

v0.2.0

Published

Agent-agnostic, git-native per-turn worktree snapshots. Capture every turn's file state into a hidden ref (no branches, no HEAD churn), restore any point. Wire into any AI coding agent's turn-end hook.

Readme

git-rewind

Agent-agnostic, git-native per-turn worktree snapshots.

git-rewind captures your repository's working-tree state into a hidden git ref (refs/rewind/store) at every agent turn — tracked and untracked files, ignored files excluded — without ever touching your index, HEAD, branches, or stash. When an AI agent (or a stray rm) clobbers your work, you restore any turn, whole or per-file.

It's a single bun CLI, so any coding agent that can run a shell command at turn end can use it — Claude Code, Codex, Gemini CLI, Cursor, or a plain shell.

Inspired by the Pi agent's pi-rewind-hook, which is Pi-only. This reimplements its storage model (single ref, tree-SHA dedup, ignored-file exclusion) as a portable CLI. See DESIGN.md for the full spec.

The one promise

A snapshot never mutates your real git state — not the index, not HEAD, not any branch, not the stash, not the worktree. It only writes objects and moves its own refs/rewind/* ref.

Install

bun install -g git-rewind        # (once published)
# or from source:
git clone … && cd git-rewind && bun link

Quick start

git-rewind install claude        # wire the Claude Code Stop hook
# …work with your agent as usual; every turn is snapshotted…

git-rewind list                  # see recent turn snapshots
git-rewind diff 1                # what changed since 1 turn ago
git-rewind restore 3 -- src/foo.ts   # undo just this file to 3 turns back
git-rewind undo                  # oops — revert that restore

How it works (30 seconds)

  • Each turn, the hook runs git-rewind snapshot. Using a throwaway index, it builds a tree of the exact worktree (git add -A honors .gitignore), and if that tree differs from the last snapshot, commits it onto refs/rewind/store with the previous snapshot as parent.
  • The result is a clean, dedup'd, turn-by-turn history you can log, diff, and restore — living entirely inside your repo, invisible to normal git.
  • Restore writes an undo point first, then materializes the target tree into the worktree (delete-then-restore for an exact match), still never staging.

Wiring into agents

Claude Code (~/.claude/settings.json):

{ "hooks": { "Stop": [ { "matcher": "", "hooks": [
  { "type": "command", "command": "git-rewind snapshot --async --agent claude" }
] } ] } }

Codex / others: point the agent's turn-end hook at git-rewind snapshot --async --agent <name>. git-rewind install <agent> writes the config for you.

Snapshots are --async (return instantly) and skip clean turns, so hooks stay cheap even on large repos.

Commands

snapshot · list · show · diff · restore · undo · prune · status · install · uninstall. Run git-rewind <cmd> --help. Full reference in DESIGN.md.

Status

🌿 Usable end-to-end. snapshot (sync + --async, --if-dirty, tree-SHA dedup, fixed identity, CAS ref update, session-from-stdin), list, show, status, restore (full + path-scoped, undo-point-first, delete-then-restore), undo (toggles redo), and install/uninstall (idempotent Claude Stop-hook wiring) are implemented and covered by a 27-case suite proving the invariants — the real index/HEAD/branch and ignored files are provably untouched, and full restore reproduces the target worktree tree exactly. diff and prune are the remaining pieces. The spec in DESIGN.md remains the source of truth.

Turn it on (Claude Code)

git-rewind install claude        # idempotently adds the Stop hook
# every dirty turn is now snapshotted, hands-free
git-rewind uninstall claude      # remove it

License

MIT © iamclaudia-ai