Try it. Undo it. Ship it.

Safe-by-default changes you can revert

xnpm records every file it touches before making changes. Undo restores each file to its exact prior state — no guessing, no diffs to apply manually.

Works for: package.json edits, .gitignore / .npmignore updates, override cleanup, lockfile changes from installs.
Does not undo: npm publish, git push, remote repo creation — logged as irreversible external effects.

"What changed?" is a first-class command

Every run gets a transaction ID and a readable manifest. You can answer "what did xnpm do?" in seconds — file-by-file diffs, command outputs, and a clear list of what can and cannot be reversed.

Hash-safe undo with an explicit override

If you edited a file after the run, xnpm refuses to overwrite it. You opt in with --force — an explicit choice, not a silent default. Use --dry-run first to see every file that would be restored.

Monorepo-aware transactions

One transaction captures changes across all package roots in a single run: one ID, per-package file snapshots, and consistent undo order that restores packages in the correct reverse-dependency sequence.

xnpm history
$ xnpm history txid time result pkgs undo ───────────────────────────────────────────── a3f9c1 2 mins ago success 6 yes b2e7a4 1 hour ago partial 4 yes c1d8b2 3 hours ago failed 2 yes $ xnpm show a3f9c1 packages/core package.json 1.2.3 → 1.3.0 packages/utils package.json 0.9.1 → 0.10.0 packages/core .npmignore created External effects (irreversible): npm publish @scope/core@1.3.0 git push origin main
xnpm undo
# preview first $ xnpm undo --dry-run packages/core package.json → 1.2.3 packages/utils package.json → 0.9.1 packages/core .npmignore → removed No files modified after run. Ready. $ xnpm undo --last ✓ packages/core package.json restored ✓ packages/utils package.json restored ✓ packages/core .npmignore removed External effects were not reversed. See: xnpm show a3f9c1
hash mismatch
$ xnpm undo --last ✕ Undo blocked packages/utils/package.json was modified after transaction a3f9c1. To override: xnpm undo --force To preview: xnpm undo --dry-run

Full CLI surface

All undo and history
commands.

History & inspection
xnpm historyList recent runs with outcome and undo status
xnpm history --jsonMachine-readable output for CI and scripts
xnpm history --limit NShow the last N runs
xnpm show <txid>File-by-file changes and external effects
xnpm show <txid> --diffFull diff view of every changed file
Undo & journaling
xnpm undoUndo the last run
xnpm undo --lastExplicit last-run undo
xnpm undo <txid>Undo a specific transaction by ID
xnpm undo --dry-runPreview what would be restored
xnpm undo --forceOverride hash mismatch check (explicit foot-gun)
xnpm install --txForce journaling on a single command
xnpm install --no-txDisable journaling (e.g. in CI)