# Get the CLI

After this guide, the `szenera` command line is built on your machine, and `szenera --help` shows all commands. First you learn which ways of getting it exist today, and which do not.

> **Type:** guide
> **For:** Developers who would rather trigger operations with a command than with a curl call
> **Prerequisite:** access to the platform’s source tree, Node 24 or later, and pnpm. Without the source tree, curl against the same routes is enough
> **Where:** command line

## The current state

The command line is the package `@szenera/cli` in the platform’s source tree. It carries version `0.1.0`, is not published on npm, and is not attached to any release as a download. The platform’s release flows produce container images and device software, but no CLI artifact. If you have the source tree, you build the CLI from it. If you do not, you work with curl against the same routes: every command is an API call, and the command pages name the route and the permission each command needs. This page says nothing about a future publication. It describes what applies today.

The package contains the commands for organizations. The commands for platform operations belong to a separate, internal tool and are not part of `szenera`.

## Steps

1. Install the source tree’s dependencies completely, never for a single sub-package only:

   ```bash
   pnpm install
   ```

2. Build the package. The build creates `dist/` including the executable file `dist/main.js`:

   ```bash
   pnpm --filter @szenera/cli build
   ```

3. Call the built file directly. Without a command and with `--help`, it shows the overview of all commands from the registry:

   ```bash
   node packages/cli/dist/main.js --help
   ```

4. Optionally link the file as `szenera` so the examples on the other pages apply literally. The package declares `szenera` as the program name for `dist/main.js`, and a symlink in a directory on your search path is enough:

   ```bash
   ln -s "$(pwd)/packages/cli/dist/main.js" ~/.local/bin/szenera
   szenera --help
   ```

## Options

**Two call forms at a glance:**

```bash
node packages/cli/dist/main.js <befehl>    # built
szenera <befehl>                            # linked
```

If you evaluate the exit codes in a script or in CI, call the file directly and never through `pnpm run`: `pnpm run` swallows exit codes and reports every failure as `1`.

## Check the result

- `szenera --help` (or `node packages/cli/dist/main.js --help`) lists 136 commands in groups such as `asset`, `scene`, `device`, `api` and ends with the block `Überall gültig` (“valid everywhere”: `--help`, `--profile=<name>`, `--json`, `--table`, `--raw`).
- `szenera <befehl> --help` shows the positional arguments, flags, and examples of a command. Both come from the registry, not from maintained text. `--help` never signs in and needs no profile.
- In the API’s session list, the CLI later identifies itself as `szenera-cli/0.1.0`. That is the version that also appears in error messages about the contract.

## If something goes wrong

| Symptom | Meaning | Solution |
|---|---|---|
| `node packages/cli/dist/main.js` reports that the file does not exist | The build is missing. `dist/` only exists after `pnpm --filter @szenera/cli build`. | Run step 2. |
| The call aborts with a syntax or module error before any command runs | The Node version is too old. The source tree requires Node 24 or later. | Use Node 24 or newer, then rebuild. |
| A script sees exit `1` for every error | The call runs through `pnpm run`, which swallows the codes. | Call the file directly through `node`. See [JSON output and exit codes](/cli/output-and-exit-codes). |
| `szenera health` ends with `Keine Konfiguration gefunden` (no configuration found) | The CLI runs but does not know which environment to talk to. | Create a profile or set `SZENERA_BASE_URL`. See [Profiles and credentials](/cli/profiles-and-credentials). |
| `szenera` does not know a command such as `tenant list` or `incident create` | That is a platform operations command, and it does not belong to `szenera`. | See [Commands for platform operations](/cli/commands-platform-operations). |

## Related

- [Profiles and credentials](/cli/profiles-and-credentials)
- [Your first call with curl](/getting-started/first-call)
- [Commands for your organization](/cli/commands-organization)
