# cetra-cli Every cetra-cli command and option: init, query and login. `cetra-cli` is the setup CLI of the `@cetra-ai/cli` package. Run it with `npx @cetra-ai/cli `, or install it and run `cetra-cli `. It needs Node.js 22.12 or later. It has three commands: `init` sets an app up, `query` runs one SQL statement on the project, and `login` saves a new token. Human text goes to stderr. With `--json`, the result goes to stdout, and it never contains a key or a token. Run `cetra-cli --help` for the options. ### `cetra-cli init` Signs in, picks a project, writes the env file, the project link and the skill, and prints the prompt for your coding agent. With no server at `--url` on this machine, it starts a local one first. See [Set up with your coding agent](https://cetra.sh/docs/get-started/coding-agent/) for the steps. ```bash npx @cetra-ai/cli@latest init [--url ] [--project ] [--dir ] ``` | Option | What it does | |---|---| | `--url ` | The server. Defaults to `CETRA_URL`, then the project link, then the cloud (`https://app.cetra.sh`). Use `http://localhost:` for a self-hosted server on this machine. With no `--url`, `init` signs you in at `app.cetra.sh`, and the sign-in continues on your organization's region. | | `--project ` | Preselects the project on the approval page. Ignored when `init` starts a local server, which has one project. | | `--dir ` | The project directory. Defaults to the current directory. It must exist. | | `--env-file ` | The env file, relative to `--dir`. Defaults to `.env`. | | `--agents ` | Where the skill goes: `claude`, `agents`, or both as a comma list. Defaults to both. An unknown name is a usage error. | | `--no-skill` | Does not install the skill. Cannot be combined with `--agents`. | | `--no-browser` | Prints the sign-in URL and does not open a browser. | | `--yes` | Starts a local server without asking, uses the default admin email `admin@cetra.local` on its first start, and replaces an existing `CETRA_API_KEY` without asking. | | `--json` | Prints one JSON object on stdout. | | `-h`, `--help` | Shows the options. | With `--json`, the object has these fields: `server`, `project` (`org/project`), `env_file`, `link_file`, `skills` (the installed directories), `prompt` and `traces_url`. If `.env` already has a `CETRA_API_KEY`, `init` asks before it replaces the key. Without a terminal and without `--yes`, it keeps the key and says so. On a first start of a local server, `init` prints the admin email and the generated password, and the UI address. The password is printed only when stderr is a terminal. Otherwise it is in no file, and you reset it with `cetra admin reset-password `. ### `cetra-cli query` Runs one SQL statement on the linked project and prints the rows. ```bash npx @cetra-ai/cli query "" [--since 1h] [--limit 100] ``` The statement is one positional argument, in quotes. The server comes from `--url`, then `CETRA_URL`, then the project link. The project comes from `--project`, then `CETRA_PROJECT`, then the project link. A server named by `--url` or `CETRA_URL` uses `CETRA_TOKEN` when it is set. Otherwise the saved token for that server is used. | Option | What it does | |---|---| | `--since ` | The window ending now: `30m`, `24h` or `7d`. Units are `s`, `m`, `h` and `d`. Defaults to `24h`. | | `--from