# Install the snizu CLI

Source: https://snizu.dev/docs/cli/install

## Install it [#install-it]

The CLI is `@snizu/cli` on npm, and it needs Node.js 22 or newer. Install it globally and the `snizu` command is on your path:

```shellsession title="Terminal"
$ npm i -g @snizu/cli
$ snizu --version
2.0.0
```

To run it without installing, use the `snizu` package: `npx snizu theme check` runs the CLI at the same version as the `snizu` package you asked for, so `npx snizu@2.0.0` is always CLI 2.0.0.

The theme checker comes compiled to WebAssembly inside the package, so checking a theme needs nothing else. Building a function needs its language's own tools: Rust with the `wasm32-wasip1` target, or Javy for JavaScript.

## Sign in [#sign-in]

Make a Partner API token in the developer console under **Settings → API tokens**, then run [`snizu login`](/docs/cli/login). The token decides what the CLI can do for your organization: deploy apps, push themes, read logs, create development stores.

## In CI [#in-ci]

There's nothing to sign in to. Set the token in the environment and every command uses it:

<Fields>
<Field name="SNIZU_TOKEN" type="snz_pat_…">
A Partner API token. It wins over the token `snizu login` saved.
</Field>

<Field name="SNIZU_API_URL" type="url">
Another API to call. `https://api.snizu.com` by default.
</Field>

<Field name="CI" type="any value">
Never ask questions. Commands that would ask take flags instead, and say which when one is missing.
</Field>

<Field name="NO_COLOR" type="any value">
Print without colours. Output that isn't a terminal never has them.
</Field>
</Fields>

The CLI only asks questions when someone is at a terminal. In a pipe or with `CI` set, a command that needs an answer stops and names the flag to pass, such as `--theme` for `snizu theme push`.

## Every command [#every-command]

<Fields>
<Field name="snizu login" type="--token --api">
Sign in with a Partner API token. [More](/docs/cli/login)
</Field>

<Field name="snizu logout">
Forget the saved token. It keeps working until you revoke it in the console.
</Field>

<Field name="snizu whoami" type="--json">
The organization and what the token can do. [More](/docs/cli/whoami)
</Field>

<Field name="snizu app create" type="<dir>">
Write a small working app. [More](/docs/cli/app/create)
</Field>

<Field name="snizu app init" type="[dir]">
Link a folder to an app, or register one. [More](/docs/cli/app/init)
</Field>

<Field name="snizu app dev" type="--store">
Run the app's draft on a development store as you save. [More](/docs/cli/app/dev)
</Field>

<Field name="snizu app deploy" type="--submit">
Make a version a draft, or send it to review. [More](/docs/cli/app/deploy)
</Field>

<Field name="snizu app logs" type="--follow">
Your app's webhook deliveries. [More](/docs/cli/app/logs)
</Field>

<Field name="snizu theme init" type="--from">
Start a theme from one of snizu's own. [More](/docs/cli/theme/init)
</Field>

<Field name="snizu theme dev" type="--store">
Preview a theme on a development store as you save. [More](/docs/cli/theme/dev)
</Field>

<Field name="snizu theme check" type="--json">
The platform's checks, on this machine. [More](/docs/cli/theme/check)
</Field>

<Field name="snizu theme push" type="--submit">
Make a draft version of your theme. [More](/docs/cli/theme/push)
</Field>

<Field name="snizu function init" type="--target --lang">
Write a function that works. [More](/docs/cli/function/init)
</Field>

<Field name="snizu function build" type="[dir]">
Compile it, and check the size limit. [More](/docs/cli/function/build)
</Field>

<Field name="snizu function run" type="--input">
Run it here on a sample. [More](/docs/cli/function/run)
</Field>

<Field name="snizu function deploy" type="--store">
Put it on a development store. [More](/docs/cli/function/deploy)
</Field>

<Field name="snizu store create" type="<name>">
Open a development store. [More](/docs/cli/store/create)
</Field>
</Fields>

## Help and exit codes [#help-and-exit-codes]

`snizu help` lists every command with a line about it, and `snizu help theme push` (or `snizu theme push --help`) shows one command's usage. `-h` is `--help`, and `-v` or `-V` is `--version`.

A flag takes its value as `--store siwa-grove` or `--store=siwa-grove`, and `--` ends the flags.

<Fields>
<Field name="0">
It worked.
</Field>

<Field name="1">
It didn't: the API refused, the network failed, or a check found problems. The reason is on standard error.
</Field>

<Field name="2">
The command was typed wrong. It says what's missing and prints the command's usage.
</Field>
</Fields>

## What it keeps, and where [#what-it-keeps-and-where]

`snizu login` saves the token in `credentials.json`, readable only by you where the system allows it:

- `%APPDATA%\snizu` on Windows.
- `$XDG_CONFIG_HOME/snizu`, or `~/.config/snizu`, everywhere else.

Projects keep small files the CLI reads: `snizu.app.json` (which app a folder deploys), `snizu.theme.json` (which theme a folder pushes to) and `snizu.function.json` (a function's target and language). Commit the first and third. `snizu.theme.json` is yours to commit too; it never goes into the theme's package.

Every request names the CLI in its user agent, as `snizu-cli/2.0.0 node/22.12.0 (linux)`, so a problem can be traced to a version.