# CLI reference

The commands below use the CLI built in a [Lookalyke source checkout](https://lookalyke.dev/docs/quickstart/). Start the server in one terminal, then run commands from a second terminal in the same checkout.

## Inspect a running server

```sh
node packages/server/dist/cli.js status
node packages/server/dist/cli.js apps
node packages/server/dist/cli.js env stripe
node packages/server/dist/cli.js activity --limit 20 --app stripe
```

Use `--json` on commands that print data when a script needs to parse the result. For example, `keys --json` prints the current sandbox credentials. Keep keys out of shared logs and CI output.

## Trigger a scenario

```sh
node packages/server/dist/cli.js trigger stripe
node packages/server/dist/cli.js trigger stripe payment.succeeded
node packages/server/dist/cli.js break stripe slow 3s
node packages/server/dist/cli.js break stripe normal
```

`trigger stripe` lists available Stripe triggers. For a specific invoice, pass `--invoice` with its ID. Use [a seeded sandbox](https://lookalyke.dev/docs/quickstart/#start-the-demo) or make an open invoice before triggering a Stripe payment.

## Common flags

| Flag | Applies when | Behavior |
| --- | --- | --- |
| `--port 4101` | Starting a server | Listen on that port. Use `0` to choose a free port. |
| `--memory` | Starting a server | Keep data in memory for this run. |
| `--demo` | Starting a server | Load sample data and demo Activity. |
| `--apps stripe,resend` | Starting a server | Enable just those apps in the main sandbox. |
| `--url http://127.0.0.1:4101` | Talking to a running server | Target an instance other than the default at port 4100. |
| `--sandbox feature-x` | Talking to a running server | Use the named sandbox. |

For all options, run `node packages/server/dist/cli.js help` or see the [full running guide](https://github.com/jviars/lookalyke/blob/main/docs/running.md).
