# CLI reference

The nim commands for working with a wiki from a terminal or a script, covering local pages, the browser view, typed pages, static export, team wikis and updates.

You do not need `nim` to use the plugin, which runs its own copy. Install it to work with the wiki from a terminal or a script, to connect agents other than Claude Code and Codex, or to publish a static site.

```sh
npm install -g @nimbalyst/cli    # Node.js 22 or later
nim --version
nim --help                       # every command and flag
```

Commands run against the wiki of the project in the current folder.

## Local wiki

```sh
nim wiki init                         # start a private wiki that git ignores
nim wiki init --location docs/wiki    # or in a folder you check in
nim wiki list                         # the page tree (also: nim wiki ls)
nim wiki read "Strategy"              # a page by title, path or id
nim wiki search "pricing"             # page titles and text
nim wiki move "Pricing" --parent "Strategy"
echo "Notes body" | nim wiki write "Notes" --create
```

| Command | Notes |
| --- | --- |
| `nim wiki init [--location <path>]` | Creates the wiki and a Home page. The default folder is added to `.gitignore`; a `--location` folder is left for you to commit. |
| `nim wiki list [--json]` | The page tree with each page's id. |
| `nim wiki read <id\|path\|title> [--json]` | The page body as markdown. `--json` includes the body version for `write`. |
| `nim wiki write <id\|path\|title> [--file F] [--expected-version V] [--create [--parent P]]` | Replaces a page body from `--file` or stdin. With `--expected-version`, it refuses to overwrite a page that changed since you read it (exit code 7). `--create` makes a new page. |
| `nim wiki move <page> [--parent P \| --root \| --before P \| --after P] [--title T]` | Moves, reorders or renames a page. Links to it are rewritten. |
| `nim wiki search <words> [--limit N] [--json]` | Searches titles and text. |

`list`, `read`, `move` and `search` use the local wiki when the project has one, and the team wiki otherwise. Add `--local` or `--team` to choose.

## Browser view

```sh
nim wiki serve [--port N] [--no-open]
```

Opens the wiki in your browser to read and edit. It listens on this machine only, behind a token in the URL. `--no-open` prints the URL instead of opening it. See [Browser view](/docs/using/browser-view/).

## Typed pages

```sh
nim tracker list --type competitor
nim tracker create competitor "Acme" --field threat=high
nim tracker get <id>
nim tracker update <id> --field threat=low
nim wiki convert-type partner --to pages
```

`nim tracker` works on typed pages in the local wiki for types whose definition sets `storage`. `convert-type` turns a table type into one page per row, keeping ids and fields. See [Typed pages](/docs/writing/typed-pages/).

## Static export

Needs `nim` 0.12.0 or later; `--base` needs 0.12.2.

```sh
nim wiki export --static <dir> [--title T] [--base /path/] [--subtree <page>] [--exclude-type a,b] [--outside-refs text|console] [--keep-identity]
```

Writes the local wiki as a read-only website. See [Publish as a static site](/docs/sharing/publish-static-site/).

## Team wiki

These need `nim login`.

```sh
nim login                         # sign in in the browser
nim whoami
nim logout
nim wiki status                   # unbound, bound or ambiguous, with your teams
nim wiki team-create "Northwind"  # a new team; its first project is connected to this project
nim wiki move-to-team --dry-run   # preview moving the local wiki
nim wiki move-to-team             # move it; re-running resumes
nim wiki invite --org <id> a@example.com --project <id> --project-role editor
nim wiki invite-link --org <id> --project <id> --max-uses 10
```

| Command | Notes |
| --- | --- |
| `nim wiki status` | Whether this project is connected to a team wiki, and the teams and projects you can reach. |
| `nim wiki bind --org <id> --project <id>` | Team admins: connect this project to an existing team project. |
| `nim wiki create-project --org <id> --name <n> [--bind]` | Team admins: create a new project in a team. |
| `nim wiki pin --org <id> --project <id>` | Choose which project this checkout uses when several match. |
| `nim wiki move-to-team [--org <id> --project <id>] [--dry-run]` | Moves the whole local wiki. Local files are kept. |
| `nim wiki invite --org <id> <email>... [--role member\|admin] [--project <id> --project-role editor\|viewer]` | Team admins: invite by email. |
| `nim wiki invite-link --org <id> [--project <id>] [--role R] [--project-role R] [--expires-in SECONDS] [--max-uses N]` | Team admins: create an invite link. |

`nim wiki list`, `read`, `search` and `move` also work on the team wiki, along with `edit`, `create`, `rename`, `delete`, `items` and more. Run `nim --help` for the full list.

## Agents

```sh
nim mcp --workspace /path/to/project
```

Runs the local wiki as an MCP server on stdio, for agents that do not use plugins. See [Install](/docs/getting-started/install/#other-agents).

## Versions and updates

```sh
nim update             # update nim and the wiki plugins for Claude Code and Codex
nim update --check     # report only; exit code 1 if anything is out of date
nim update --dry-run   # print the commands without running them
nim update --only cli  # or claude, or codex
nim doctor             # installed versions and where they come from
```

See [Upgrade](/docs/reference/upgrade/).

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | OK |
| 1 | Not found, or `nim update --check` found something out of date |
| 2 | Usage error |
| 3 | Connection error |
| 7 | Conflict: the page changed since the version you passed |