Three ways to run xnpm

Global install

recommended
# install once, use from any folder $ npm install -g @x12i/npm ✓ xnpm available everywhere ✓ xgit, x12i-npm, x12i-git included ✓ ask, undo, history, upstream included # keep it up to date $ xnpm upgrade ✓ updated to latest

CI / no install

pinned
# pinned version — fully reproducible $ npx @x12i/npm@latest --full-flow ✓ no install step in CI runner ✓ always runs the latest release ✓ structured exit codes for gating # pin a specific version $ npx @x12i/npm@2.30.1 --full-flow

Check setup

after install
# verify environment $ xnpm doctor ✓ npm 10.5.0 found ✓ git 2.44.0 found ✓ npm auth configured ✓ .npmrc readable # validate workspace + registry $ xnpm validate ✓ all local versions match registry

Flags reference

Flags compose.
Pick exactly what you need.

xnpm, xnpm i, and xnpm install are equivalent. Steps 1–3 (discover, graph, install) always run. Steps 4–7 only run when you pass the flag.

Every install runs a tarball inspection gate on new registry dependencies (Security). Publish checks live on Safety.

FlagWhat it does
Lifecycle
--buildRun npm run build after install, in dependency order
--testRun npm test after build — blocks publish if tests fail
--publishPack-check → version bump → publish via real npm binary
--publish-flowShortcut: fix deps, install, publish, push, report
--full-flowShortcut: fix deps, install, build, test, publish, push, report
xnpm releaseNamed release playbook — same steps as --full-flow with stack support
--pushgit add / commit / push after lifecycle — on non-fast-forward, prompts to pull --rebase then push (--yes auto-approves)
--yesNon-interactive: approve dependency fixes and git rebase recovery on push
--reportSuppress raw output; show high-level summary with counts and version changes
--dry-runShow planned steps and order without modifying any files
--no-version-bumpPublish the current version as-is, skip the minor bump
--clean-localRemove file: overrides for discovered packages from package.json
--clean-allRemove the entire overrides object from package.json
--inspect-onlyRun pre-install tarball inspection without npm install (CI pre-flight)
--skip-inspectSkip tarball inspection gate (debug only; logs a warning)
--forceRe-inspect tarballs; npm cache clean before install; after declined rebase, retry push with --force-with-lease
Selection
--package <name>Select a specific package by exact name (repeatable)
--filter <glob>Select packages by glob pattern, e.g. @x12i/* — multiple filters are OR-based
--monorepoFrom a package subfolder: discover the full git-root monorepo
--hereForce cwd-only discovery (default inside a named package folder)
--allDiscover all packages under cwd, including nested git repos (may prompt)
Undo & history
--txForce transaction journaling on a single command
--no-txDisable journaling for this run (e.g. in CI where you don't need it)
First publish & git setup (opt-in)
--new-publicFirst-publish as a public npm package — no version bump
--new-privateFirst-publish as a restricted npm package — scoped names only
--create-gitInitialize local git repo where missing, run initial commit
--repo-mode <mode>monorepo or multi-repo — required when creating git across multiple packages
--git-create-remoteCreate a new remote repo via provider API (GitHub, GitLab, Bitbucket)
--connect <url>alias: --git-link Attach local repo to an existing remote

Common commands

Copy-paste examples
for every situation.

Release playbook (named command)
xnpm release --report
Publish in dependency order (natural language)
xnpm ask "publish everything in the right order"
Scaffold tiered publish scripts
xnpm scripts init
Generate agent publish runbook + shell
xnpm scripts init runbook
Agent monorepo deploy guide
xnpm agent-deploy-guide
Git-first CLI — same package
xgit status xgit release --report
Install only
xnpm install
Install and build
xnpm install --build
Install, build, test
xnpm --build --test
Full flow — fix, install, build, test, publish, push
xnpm --full-flow
Publish flow — fix, install, publish, push (skip build/test)
xnpm --publish-flow
Pre-flight tarball inspection (no install)
xnpm install --inspect-only
Dry run — see the plan without touching anything
xnpm --full-flow --dry-run
Publish without bumping the version
xnpm --publish --no-version-bump
Target a scope only
xnpm --filter "@x12i/*" --build --publish
Target two scopes
xnpm --filter "@x12i/*" --filter "@exellix/*" --build --test
First publish as a private scoped package
xnpm --build --test --new-private --push --report
Connect to remote (monorepo)
xnpm --connect git@github.com:x12i/pkg.git --repo-mode monorepo --push
One-off via npx — no install needed
npx @x12i/npm@latest --build --test
Natural language — resolve intent to flags
xnpm ask "publish all @x12i packages and push"
Check recent runs and undo status
xnpm history
Preview what undo would restore
xnpm undo --dry-run
Undo the last run (local changes only)
xnpm undo --last
File upstream CR/FR (auth + file submit)
xnpm upstream auth login xnpm upstream submit --file fr.md --package @x12i/npm --repo x12i/npm
Scoped fix — in-house only by default
xnpm install --fix xnpm install --fix-public --dry-run xnpm why-upgrade vite
Dependency usage reports
xnpm deps unused --include-dev xnpm deps usage react
Validate workspace + build smoke
xnpm validate --build
Check environment and fix PATH issues
xnpm doctor

Monorepo publish scripts

Tiered scripts and runbooks.
Generate once, run by name.

xnpm scripts init writes scripts/publish-*.sh and wires root package.json publish:* entries. Scripts run from the git repo root with repo .npmrc — no wrapper exports for cache or npmrc.

xnpm uses an isolated npm cache at ~/.cache/xnpm/npm with automatic fallback to ~/.cache/xnpm/npm-clean when the primary cache is not writable (exit 3 if no cache works).

Preflight validate
xnpm scripts run preflight
Build, test, publish
xnpm scripts run core
Full release
xnpm scripts run all
Agent/human runbook + ordered shell
xnpm scripts init runbook
Runbook for a scope only
xnpm scripts init runbook --filter "@scope/*"
Tiered scripts + runbook
xnpm scripts init all

Typical monorepo flow

$ xnpm map $ xnpm scripts init $ xnpm --all install $ xnpm scripts run preflight $ xnpm scripts run all

Stack releases — 2.30.0

Release order from the
stack file, not guesswork.

Stack releases honor explicit dependsOn edges in .xnpm/stacks/<name>.json, even when package.json doesn't contain every operational edge. Publish order is a release contract, not just a runtime import graph.

$ xnpm list $ xnpm ask "release the jobs reliability stack" --plan --json $ xnpm release --stack jobs-reliability --dry-run --report --yes $ xnpm release --stack jobs-reliability --yes --report

Stacks can also opt into release-time internal dependency sync: local file: links stay for development, and xnpm rewrites them to registry ranges for the publish step only. See Safety.

.xnpm/stacks/jobs-reliability.json
{ "stack": "jobs-reliability", "syncInternalDepsOnPublish": true, "restoreFileDepsAfterRelease": true, "packages": [ { "path": "jobs-db", "name": "@exellix/jobs-db", "versionPolicy": "patch" }, { "path": "jobs", "name": "@exellix/jobs", "dependsOn": ["@exellix/jobs-db"], "versionPolicy": "patch" } ] }

xgit — git-first CLI

Same engine.
Natural git commands.

xgit ships in the same @x12i/npm package. Use xgit when git is primary; use xnpm when npm/monorepo lifecycle is primary. Both cross-solve: release, validate, ask, scripts, sibling checks, push rebase recovery.

xgit (git-first)
$ xgit status $ xgit pull --rebase origin main $ xgit push $ xgit ask "commit and push" $ xgit release --report
xnpm (monorepo-first)
$ xnpm install --all $ xnpm validate --fix $ xnpm release --push --yes $ xnpm ask "publish all packages and push" $ xnpm scripts init runbook

Exit codes

Structured exits for CI
and agents.

Since 2.29.1, publish verification is retry-aware: after npm publish succeeds, xnpm checks the registry for the new version and retries (5 attempts, 3s delay by default) while npm replication catches up — instead of treating a visibility lag as a failed publish and skipping the git push. If npm reports the version was already published, xnpm verifies it and continues. See Safety.

CodeMeaning
0Success
1Failed — package, registry, validation, or command error
2Partial success — e.g. publish OK but git push failed (or rebase declined)
3Environment / permissions — cache, global install dir, or node_modules not writable
4Approval required — a matched command needs confirmation but none was given in a non-interactive context (--agent, CI=true, non-TTY); the plan is printed, nothing executes

Passthrough

xnpm forwards npm and git
when automation isn't needed.

You don't need to switch binaries for everyday commands. xnpm detects native npm and git subcommands and forwards them directly.

implicit forwarding
$ xnpm run build → npm run build $ xnpm install lodash → npm install lodash $ xnpm status → git status $ xnpm push → git push $ xnpm pull → git pull
explicit passthrough
$ xnpm npm outdated $ xnpm npm list --depth 0 $ xnpm git log --oneline -5 $ xnpm git diff --stat # ask resolves to passthrough too $ xnpm ask "show git status" → git status

Disambiguation — same word, different destination

You typeRoutes toWhy
install
xnpm installxnpm automationbare install stays on xnpm
xnpm install --buildxnpm automationxnpm-only flag detected
xnpm install lodashnpm install lodashpackage name arg → native npm
xnpm install -D lodashnpm install -D lodashnpm flag (-D, --save-dev, …) → native npm
overloaded verbs
xnpm --pushxnpm lifecycle git pushxnpm flag — part of the automation run
xnpm pushgit pushbare subcommand → passthrough
xnpm --testxnpm lifecycle testxnpm flag — runs in correct order after build
xnpm testnpm testbare subcommand → passthrough
always xnpm — never passthrough
xnpm askxnpm askreserved
xnpm list / lsxnpm package discoveryreserved
xnpm historyxnpm transaction historyreserved
xnpm undoxnpm undoreserved
xnpm doctorxnpm doctorreserved
xnpm scriptsxnpm scripts subcommandinit, list, run, runbook
xgit (git-first — same package)
xgit statusgit statusnatural git passthrough
xgit pushgit pushplain git; lifecycle push uses --push
xgit releasexnpm release playbookmonorepo cross-solve
xgit npm run buildnpm run buildexplicit npm prefix

Open source.
MIT licensed.

xnpm is 100% free — personal and commercial use. No trial, no tiers, no account required.

MIT license Use anywhere No account required No trial period No paid tiers No feature gates

xnpm calls your installed npm and git binaries. It uses your existing .npmrc, lockfiles, auth tokens, and git config.
It does not replace the registry, does not reimplement dependency resolution, and does not intercept or store your credentials.