azu/ni.zsh

Alternative `ni` written in zsh: npm/yarn/pnpm/bun/deno with the same command

Shell

197

92 commits

updated Sep 3, 2026

See the code

README

Alternative ni written in zsh

ni - use the right package manager

You can run npm/yarn/pnpm/bun/deno/vite-plus/aube with same command!

Installation

Using Zinit

zinit load azu/ni.zsh

Using Antigen

antigen bundle azu/ni.zsh@main

Using sheldon

[plugins.ni]
github = "azu/ni.zsh"

Manually

curl https://raw.githubusercontent.com/azu/ni.zsh/main/ni.zsh > ni.zsh
source ni.zsh

:warning: Troubleshooting: command not found: compdef

ni.zsh requires compdef command. If you got command not found: compdef error, you need to enable compinit in your .zshrc.

# .zshrc
# load compdef
autoload -Uz compinit && compinit
# load ni.zsh
source /path/to/ni.zsh

Supported Package Manager

Vite+ is detected when package.json has vite-plus in devDependencies or dependencies. This detection runs before the packageManager field, so Vite+ projects that delegate to pnpm/npm/Yarn/Bun still use vp.

aube is detected when package.json has "packageManager": "aube@<version>" or aube-lock.yaml exists. aube can also read and write other lockfiles (pnpm-lock.yaml, package-lock.json, etc.) in place, but those projects are detected as the original package manager.

Requirements

  • zsh
    • require to enable autoload -Uz compinit && compinit
  • jq
  • npm-check if you want to use npm + ni upgrade-interactive

Usage

ni                      -- install current package.json
ni ci                   -- install with frozen lockfile (equivalent to npm ci)
ni add <pkg>            -- add package
ni remove <pkg>         -- remove package
ni run <script>         -- run scripts
ni test                 -- run test script
ni upgrade [<pkg>]      -- upgrade packages
ni upgrade-interactive  -- upgrade package interactively
ni exec <command>       -- execute command
ni dlx <pkg>            -- download package and execute command

Command Table

ninpmyarnyarn-berrypnpmbundenovite-plusaube
ninpm installyarn installyarn installpnpm installbun installdeno installvp installaube install
ni cinpm ciyarn install --frozen-lockfileyarn install --immutablepnpm install --frozen-lockfilebun install --frozen-lockfiledeno install --frozenvp install --frozen-lockfileaube ci
ni add <pkg>npm installyarn addyarn addpnpm addbun adddeno add --npmvp addaube add
ni remove <pkg>npm uninstallyarn removeyarn removepnpm removebun removedeno uninstallvp removeaube remove
ni run <script>npm runyarn runyarn runpnpm runbun rundeno runvp runaube run
ni testnpm run testyarn run testyarn run testpnpm run testbun run testdeno run testvp run testaube run test
ni upgradenpm upgradeyarn upgradeyarn uppnpm updatebun updatedeno outdated --updatevp updateaube update
ni upgrade-interactivenpm-check^1yarn up --interactive "*"yarn upgrade-interactivepnpm update -ideno outdated --update --interactivevp update --interactive
ni exec <command>npm exec --noyarn <command>yarn execpnpm execbunxvp execaube exec
ni dlx <pkg>npxnpxyarn dlxpnpm dlxbunxdeno xvp dlxaube dlx

Notes

  • Installing devDependencies: ni add --dev <pkg>
  • Additional arguments for ni run: ni run dev --port 8080
  • Update specific package: ni upgrade <pkg>

Auto Complete

ni <TAB>

Experimental

Supply chain risk detections

You can integrate Socket Firewall to detect supply chain attacks.

https://github.com/user-attachments/assets/b3b6fc24-ec80-4bd3-a699-7562d503f7b1

Socket Firewall provides proactive protection against malicious packages by scanning all package installations and executions in real-time.

Setup:

  1. Install Socket Firewall globally:

    npm i -g sfw
    
  2. Enable Socket Firewall in ni.zsh:

    export NI_USE_SOCKET_FIREWALL=1
    
  3. (Optional) Specify custom sfw binary path:

    export NI_SOCKET_FIREWALL_BIN=/path/to/sfw
    

    If not set, uses sfw command from PATH.

Protected commands:

When Socket Firewall is enabled, the following commands are automatically protected:

  • ni add / ni - Package installation
  • ni exec / ni dlx - Package execution (npx, bunx)

License

MIT © azu

bun
node
npm
pnpm
security
shell-script
yarn

Contributors

azu

76 commits

yuki-yano

2 commits

h3y6e

2 commits

mono0x

2 commits

azu/ni.zsh

Alternative `ni` written in zsh: npm/yarn/pnpm/bun/deno with the same command

Shell

197

92 commits

updated Sep 3, 2026

See the code

README

Alternative ni written in zsh

ni - use the right package manager

You can run npm/yarn/pnpm/bun/deno/vite-plus/aube with same command!

Installation

Using Zinit

zinit load azu/ni.zsh

Using Antigen

antigen bundle azu/ni.zsh@main

Using sheldon

[plugins.ni]
github = "azu/ni.zsh"

Manually

curl https://raw.githubusercontent.com/azu/ni.zsh/main/ni.zsh > ni.zsh
source ni.zsh

:warning: Troubleshooting: command not found: compdef

ni.zsh requires compdef command. If you got command not found: compdef error, you need to enable compinit in your .zshrc.

# .zshrc
# load compdef
autoload -Uz compinit && compinit
# load ni.zsh
source /path/to/ni.zsh

Supported Package Manager

Vite+ is detected when package.json has vite-plus in devDependencies or dependencies. This detection runs before the packageManager field, so Vite+ projects that delegate to pnpm/npm/Yarn/Bun still use vp.

aube is detected when package.json has "packageManager": "aube@<version>" or aube-lock.yaml exists. aube can also read and write other lockfiles (pnpm-lock.yaml, package-lock.json, etc.) in place, but those projects are detected as the original package manager.

Requirements

  • zsh
    • require to enable autoload -Uz compinit && compinit
  • jq
  • npm-check if you want to use npm + ni upgrade-interactive

Usage

ni                      -- install current package.json
ni ci                   -- install with frozen lockfile (equivalent to npm ci)
ni add <pkg>            -- add package
ni remove <pkg>         -- remove package
ni run <script>         -- run scripts
ni test                 -- run test script
ni upgrade [<pkg>]      -- upgrade packages
ni upgrade-interactive  -- upgrade package interactively
ni exec <command>       -- execute command
ni dlx <pkg>            -- download package and execute command

Command Table

ninpmyarnyarn-berrypnpmbundenovite-plusaube
ninpm installyarn installyarn installpnpm installbun installdeno installvp installaube install
ni cinpm ciyarn install --frozen-lockfileyarn install --immutablepnpm install --frozen-lockfilebun install --frozen-lockfiledeno install --frozenvp install --frozen-lockfileaube ci
ni add <pkg>npm installyarn addyarn addpnpm addbun adddeno add --npmvp addaube add
ni remove <pkg>npm uninstallyarn removeyarn removepnpm removebun removedeno uninstallvp removeaube remove
ni run <script>npm runyarn runyarn runpnpm runbun rundeno runvp runaube run
ni testnpm run testyarn run testyarn run testpnpm run testbun run testdeno run testvp run testaube run test
ni upgradenpm upgradeyarn upgradeyarn uppnpm updatebun updatedeno outdated --updatevp updateaube update
ni upgrade-interactivenpm-check^1yarn up --interactive "*"yarn upgrade-interactivepnpm update -ideno outdated --update --interactivevp update --interactive
ni exec <command>npm exec --noyarn <command>yarn execpnpm execbunxvp execaube exec
ni dlx <pkg>npxnpxyarn dlxpnpm dlxbunxdeno xvp dlxaube dlx

Notes

  • Installing devDependencies: ni add --dev <pkg>
  • Additional arguments for ni run: ni run dev --port 8080
  • Update specific package: ni upgrade <pkg>

Auto Complete

ni <TAB>

Experimental

Supply chain risk detections

You can integrate Socket Firewall to detect supply chain attacks.

https://github.com/user-attachments/assets/b3b6fc24-ec80-4bd3-a699-7562d503f7b1

Socket Firewall provides proactive protection against malicious packages by scanning all package installations and executions in real-time.

Setup:

  1. Install Socket Firewall globally:

    npm i -g sfw
    
  2. Enable Socket Firewall in ni.zsh:

    export NI_USE_SOCKET_FIREWALL=1
    
  3. (Optional) Specify custom sfw binary path:

    export NI_SOCKET_FIREWALL_BIN=/path/to/sfw
    

    If not set, uses sfw command from PATH.

Protected commands:

When Socket Firewall is enabled, the following commands are automatically protected:

  • ni add / ni - Package installation
  • ni exec / ni dlx - Package execution (npx, bunx)

License

MIT © azu

bun
node
npm
pnpm
security
shell-script
yarn

Contributors

azu

76 commits

yuki-yano

2 commits

h3y6e

2 commits

mono0x

2 commits

Languages

Shell

98.7%

TypeScript

1.3%