ni
Use ni command family instead of direct npm, yarn, pnpm, or bun
commands.
Quick Rules
- Use
nifor install/add operations. - Use
nrfor npm scripts defined inpackage.json. - Use
nlxfor temporary package execution (npx/dlxstyle). - Use
nupfor upgrade operations. - Use
nunfor uninstall/remove operations. - Use
ncifor clean install. - Use
ndfor dedupe. - Use
naonly when the above commands cannot express the requested action.
Command Selection
- Install/add dependency:
ni <pkg> - Run package.json script:
nr <script> - Run direct command in repository:
na exec <command> - Temporary binary execution:
nlx <command> - Upgrade dependencies:
nup - Remove dependency:
nun <pkg> - Clean install:
nci - Dedupe:
nd
Priority Order
- Match to one of:
ni,nr,nlx,nup,nun,nci,nd. - If direct command execution in a repository is requested, prefer
na exec <command>. - If npm script execution is requested, prefer
nr <script>. - If none of the above can satisfy the request, fallback to
na ....
Examples
# install deps
ni
# add dependency
ni vitest -D
# run npm script
nr test
# direct command execution in repository (pnpm vitest-like intent)
na exec vitest
# temporary package execution
nlx vitest
# upgrade
nup
# uninstall
nun vitest
# clean install
nci
# dedupe
nd
Fallback Policy
Fallback to na when:
- requested behavior is not representable by
ni,nr,nlx,nup,nun,nci, ornd - required subcommand/flag is unavailable in those commands
- command mapping is unclear and
nais needed to preserve exact behavior
When falling back:
- prefer
na exec <command>for repository-local direct command execution - keep arguments unchanged to preserve user intent