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

hardfork

v0.0.9

Published

A utility CLI that lets you hard-fork/nuke/revert/merge histories on a GitHub/GitLab repo with interactive promts.

Readme

hardfork

An open-source CLI utility tool for having a beautiful interactive command line ui for hard-forking or nuking a repo. It also has a revert helper that give you an interactive ui to revert to specifc commit hashes.

Requirement

  • git must be installed and credentials configued.

    it uses your own git cli and credentials under the hood.

Usage

One-off (no global install)

bunx hardfork@latest
#or
npx hardfork@latest

Global install:

bun i -g hardfork@latest
npm i -g hardfork@latest
# then invoke `hardfork` directly (no bunx prefix)
hardfork -help

Commands

hardfork (default)

Clone a source repo, optionally point origin at a new empty repo, and push.

+--------------------+
| Start: runHardfork |
+--------------------+
          |
          v
+------------------------------+
| Resolve source URL           |
| (--source / positional / UI) |
+------------------------------+
          |
          v
      +------------------+
      | Source valid +   |
      | readable remote? |
      +------------------+
        | yes       | no
        |           v
        |     +----------------------+
        |     | Prompt change source |
        |     | and retry loop       |
        |     +----------------------+
        |____________________^
          |
          v
+------------------------------+
| Choose clone mode            |
| normal / temp                |
+------------------------------+
          |
          v
+------------------------------+
| Preflight probe              |
| branches + default + size +  |
| commit count                 |
+------------------------------+
          |
          v
+------------------------------+
| Configure branch scope       |
| current / specific / all     |
+------------------------------+
          |
          v
+------------------------------+
| Configure history            |
| full / depth N / no-history  |
+------------------------------+
          |
          v
      +----------------------+
      | Expensive/risky      |
      | combination?         |
      +----------------------+
        | no        | yes
        |           v
        |     +----------------------+
        |     | Reconfigure loops:   |
        |     | history + branches   |
        |     +----------------------+
        |____________________^
          |
          v
+------------------------------+
| Transfer estimate screen     |
| continue / reconfigure loop  |
+------------------------------+
          |
          v
+------------------------------+
| Resolve destination remote   |
| validate != source           |
| check write access           |
+------------------------------+
          |
          v
+------------------------------+
| Resolve push intent          |
| temp => always push          |
+------------------------------+
          |
          v
+------------------------------+
| Resolve local path           |
| temp dir OR --dir/prompt     |
+------------------------------+
          |
          v
+------------------------------+
| Clone repo (with selected    |
| branch/history mode)         |
+------------------------------+
          |
          v
      +------------------+
      | Clone success?   |
      +------------------+
        | yes       | no
        |           v
        |     +----------------------+
        |     | Show error, cleanup  |
        |     | temp dir, exit       |
        |     +----------------------+
        |
        v
+------------------------------+
| Post-clone rewrite           |
| no-history: collapse commit  |
| depth: materialize shallow   |
+------------------------------+
          |
          v
      +------------------+
      | New remote set?  |
      +------------------+
        | yes       | no
        |           v
        |     +----------------------+
        |     | Warn: origin still   |
        |     | points to source     |
        |     +----------------------+
        v
+------------------------------+
| Update origin URL            |
| (special handling for        |
| multi-branch no-history)     |
+------------------------------+
          |
          v
      +----------------------+
      | shouldPush && remote?|
      +----------------------+
        | no        | yes
        |           v
        |     +----------------------+
        |     | Push flow            |
        |     +----------------------+
        |           |
        |           v
        |     +----------------------+
        |     | Multi-branch?        |
        |     +----------------------+
        |       | yes         | no
        |       v             v
        | +----------------+  +-------------------------+
        | | Keep/Nuke/Abort|  | Push single branch      |
        | | destination    |  | if non-FF => resolve:   |
        | | branches       |  | force / preserve /      |
        | | then push      |  | replay / nuke-all       |
        | +----------------+  +-------------------------+
        |___________  _________________________________/
                    \/
          +----------------------+
          | Finalize             |
          | temp: delete folder  |
          | normal: print cd     |
          +----------------------+
                    |
                    v
               +--------+
               | Done   |
               +--------+

The flow above mirrors the implementation in src/commands/hardfork.ts: preflight-driven branching, repeated reconfigure guards for risky combinations, destination safety checks, and separate push conflict strategies for multi-branch vs single-branch flows.

| Step | Interactive | Flags | | :------------- | :------------------------------------------------ | :-------------------------------------------------- | | Source URL | Prompt | --source <url> or first positional argument | | Clone location | Normal vs temp dir | --normal (default) / --temp | | History | Full clone vs single new root commit (no lineage) | --history / --no-history | | New remote | Optional URL | --remote <url> (--temp requires --remote) | | Push | Confirm | --push / --no-push; temp mode always pushes |

Global options: -y/--yes skip prompts (you must pass everything required), -h/--help, -v/--version.

Normal clone: --dir <path> sets the local folder (default under cwd from repo name); non-interactive -y defaults the dir name from the source slug.

Temporary clone: clones under the system temp dir, pushes, then deletes the clone.

If the destination remote rejects the first push (non-fast-forward / non-empty remote), interactive mode can:

  • Pick a branch when multiple remote branches exist, or nuke all branches (force-push one primary branch main/master, delete the rest).
  • Preserve remote history: either one new commit that replaces files with your fork’s tree, or replay the source’s commits on top (cleanup commit + linear replay with metadata).
  • Force overwrite: force-push and replace remote history on that branch.

With -y, a rejected push exits with a hint to rerun without -y so you can choose a resolution.


hardfork nuke [repo]

Make the repo empty (remove tracked files). Scope: one branch or all remote branches.

| Mode | Behavior | | :------------------- | :--------------------------------------------------------------------------- | | Preserve history | New commit(s) that delete all files (history stays). | | Wipe history | Fresh orphan-style history per branch: force-push empty trees (destructive). |

Options

| Flag | Purpose | | :----------------------- | :---------------------------------------------------------------- | | --preserve-history | Keep commits; empty tree in new commit(s). | | --wipe-history | Rewrite with fresh root / force-push (irreversible). | | --branch <name> | Branch to nuke (default main when scope is single-branch). | | --all-branches | Every branch on the remote. | | -m, --message <text> | Commit message for the nuke commit. | | -y, --yes | Skip prompts (repo URL and mode flags required where applicable). |


hardfork revert [repo] [commit]

Move a branch to a given commit (7–40 hex).

| Mode | Behavior | | :---------------------------------- | :---------------------------------------------------------------------------------- | | Keep history (--keep-history) | git revert each commit after the target (ancestor check); push (non-destructive). | | Destructive (--destructive) | git reset --hard to commit + force-push (rewrites remote branch). |

Options: --branch <name> (default: remote HEAD symref or main), -y/--yes.


Examples

With Bun (bunx runs the published CLI without installing globally):

# Interactive hard fork
bunx hardfork

# Scripted: clone, collapse history, push to new repo, delete temp clone
bunx hardfork --source https://github.com/org/old.git \
  --remote [email protected]:you/new.git --temp --no-history -y

# Keep full history, normal folder, push
bunx hardfork --source https://gitlab.com/group/repo.git \
  --remote [email protected]:you/fork.git --dir my-fork --history --push -y

# Empty one branch, keep history
bunx hardfork nuke https://github.com/you/repo.git --preserve-history --branch main -y

# Force-empty all branches (dangerous)
bunx hardfork nuke https://github.com/you/repo.git --wipe-history --all-branches -m "reset" -y

# Non-destructive revert (new commits)
bunx hardfork revert https://github.com/you/repo.git abc1234 --keep-history --branch main -y

# Rewind branch and force-push
bunx hardfork revert [email protected]:you/repo.git abc1234 --destructive -y

If you installed with npm install -g hardfork, drop the bunx prefix and run hardfork … instead.

Tech stack

Bun TypeScript @clack/prompts execa yargs

Socials

License

MIT License

Copyright (c) 2026 Ard Astroid [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.