# @napi-rs/cli

> Cli tools for napi-rs

Latest version **3.10.6** (published 2026-10-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @napi-rs/cli
pnpm add @napi-rs/cli
yarn add @napi-rs/cli
bun add @napi-rs/cli
```

Provides the commands `napi`, `napi-raw`.

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.10.6 |
| Published | 2026-10-01 |
| First published | 2020-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^20.17.0 \|\| ^22.13.0 \|\| >= 23.5.0 |
| Dependencies | 12 |
| Unpacked size | 9.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 7957 |
| Author | LongYinan |
| Maintainers | broooooklyn, forehalo |
| Keywords | cli, rust, napi, n-api, node-api, node-addon, neon |

## Links

- npm: https://www.npmjs.com/package/@napi-rs/cli
- Repository: https://github.com/napi-rs/napi-rs
- Homepage: https://napi.rs/
- Issues: https://github.com/napi-rs/napi-rs/issues
- Funding: https://github.com/sponsors/Brooooooklyn
- npm.io page: https://npm.io/package/@napi-rs/cli

## Dependencies (12)

- [obug](https://npm.io/package/obug.md) ^3.0.0
- [semver](https://npm.io/package/semver.md) ^7.8.2
- [js-yaml](https://npm.io/package/js-yaml.md) ^5.0.0
- [typanion](https://npm.io/package/typanion.md) ^3.14.0
- [clipanion](https://npm.io/package/clipanion.md) ^4.0.0-rc.4
- [colorette](https://npm.io/package/colorette.md) ^2.0.20
- [es-toolkit](https://npm.io/package/es-toolkit.md) ^1.47.0
- [typescript](https://npm.io/package/typescript.md) ^6.0.3
- [@octokit/rest](https://npm.io/package/@octokit/rest.md) ^22.0.1
- [@inquirer/prompts](https://npm.io/package/@inquirer/prompts.md) ^8.5.2
- [@napi-rs/wasm-tools](https://npm.io/package/@napi-rs/wasm-tools.md) ^1.1.0
- [@napi-rs/cross-toolchain](https://npm.io/package/@napi-rs/cross-toolchain.md) ^1.0.3

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 3.10.6 (latest) — 2026-10-01
- 3.0.0-alpha.100 (canary) — 2025-07-17
- 3.0.0-alpha.4 (alpha) — 2023-05-27
- 2.0.0-beta.5 (beta) — 2021-12-10
- 3.10.5 — 2026-09-22
- 3.10.4 — 2026-09-17
- 3.10.3 — 2026-09-16
- 3.10.2 — 2026-09-16
- 3.10.1 — 2026-09-16
- 3.10.0 — 2026-09-15
- 3.9.1 — 2026-09-10
- 3.9.0 — 2026-09-02
- 3.8.6 — 2026-08-12
- 3.8.5 — 2026-08-10
- 3.8.4 — 2026-08-10
- … 246 more at https://npm.io/package/@napi-rs/cli/versions

## README

# `@napi-rs/cli`

[![Download](https://img.shields.io/npm/dm/@napi-rs/cli)](https://www.npmjs.com/package/@napi-rs/cli)
[![Install size](https://packagephobia.com/badge?p=@napi-rs/cli)](https://packagephobia.com/result?p=@napi-rs/cli)
<a href="https://discord.gg/SpWzYHsKHs">
<img src="https://img.shields.io/discord/874290842444111882.svg?logo=discord&style=flat-square"
    alt="chat" />
</a>

> Cli tools for napi-rs

```sh
# or npm, pnpm
yarn add @napi-rs/cli -D
yarn napi build
```

## Requirements

`@napi-rs/cli` supports Node.js `^20.17.0`, `^22.13.0`, and `>=23.5.0`.
Earlier Node.js releases are no longer supported by the CLI runtime.

## Commands

| Command         | desc                                                           | docs                                                |
| --------------- | -------------------------------------------------------------- | --------------------------------------------------- |
| new             | create new napi-rs project                                     | [./docs/new.md](./docs/new.md)                      |
| build           | build napi-rs project                                          | [./docs/build.md](./docs/build.md)                  |
| create-npm-dirs | Create npm package dirs for different platforms                | [./docs/create-npm-dirs](./docs/create-npm-dirs.md) |
| artifacts       | Copy artifacts from Github Actions into specified dir          | [./docs/artifacts.md](./docs/artifacts.md)          |
| rename          | Rename the napi-rs project                                     | [./docs/rename.md](./docs/rename.md)                |
| universalize    | Combile built binaries into one universal binary               | [./docs/universalize.md](./docs/universalize.md)    |
| version         | Update version in created npm packages by `create-npm-dirs`    | [./docs/version.md](./docs/version.md)              |
| pre-publish     | Update package.json and copy addons into per platform packages | [./docs/pre-publish.md](./docs/pre-publish.md)      |

## Disposing generated WASI bindings

Generated WASI bindings expose deterministic cleanup through a non-enumerable
symbol on the binding object:

```js
const binding = require('<package>')
const dispose = binding[Symbol.for('napi.rs.wasi.dispose')]

if (dispose) {
  await dispose()
}
```

The symbol is present only when the loaded binding is WASI. Browser WASI
loaders expose it on their default export. Disposal releases the instance: it
destroys the emnapi context and then terminates the workers owned by that
binding. Before that, the loader calls the binary's
`napi_prepare_wasm_env_cleanup` preparation hook, which shuts the addon's async
runtime down while the environment can still call into JavaScript. A registered
`AsyncRuntime` backend quiesces there and its cancelled tasks reject their
promises; the built-in Tokio runtime only _starts_ draining, so with it a
promise whose task is still running can still be left pending. Settle in-flight
work before disposing if that matters.

The same preparation runs on a direct `Context.destroy()`. `destroy()` disables
JavaScript calls before it runs its cleanup hooks, and the threadsafe function's
hook then drops whatever is still queued, so every generated loader shadows
`destroy` on the emnapi context it creates: an embedder, a test harness, or
emnapi's own `beforeExit` auto-destroy gets the barrier too, instead of silently
discarding the settlements. Prefer the dispose symbol when you can yield — only
`dispose()` waits for settlements queued from another thread. A `destroy()` that
re-enters from a promise hook while the barrier is still running is a no-op,
because the frame that started the barrier destroys the moment it returns; a
`dispose()` that re-enters the same way joins the disposal already running,
since its frame yields for the settlement drain before it destroys.

Concurrent calls share one promise, successful disposal is idempotent, and a
failed cleanup phase can be retried by calling the same function again. Do not
call addon exports after disposal completes.

See [WASI targets and loaders](./docs/wasi.md) for threaded, threadless,
browser, and workerd packaging behavior.

### Debug mode

```bash
DEBUG="napi:*" napi [command]
```

---
_Source: https://npm.io/package/@napi-rs/cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
