> ## Documentation Index
> Fetch the complete documentation index at: https://help.pixwel.com/llms.txt
> Use this file to discover all available pages before exploring further.

# The pixwel CLI

> A small Node CLI that wraps the Docker stack, tests, and API for local development — bring the platform up, run tests, tail logs, and query the API from one command.

`pixwel` is the developer command-line tool that lives in [`cli/`](https://github.com/Pixwel/platform/tree/main/cli). It's a thin [yargs](https://yargs.js.org/) wrapper around the commands you'd otherwise type by hand — `docker-compose`, the API test runners, the li3 console, and authenticated API calls — so that day-to-day local development is a handful of short verbs.

It's the same CLI that drives the [Local Development](/local-development) setup; this page is the full command reference.

## Install

The CLI is a workspace package, linked from your checkout:

```bash theme={null}
cd cli
pnpm i
npm link        # puts `pixwel` on your PATH
```

Then point it at your platform checkout. `pixwel path` defaults to the current directory:

```bash theme={null}
cd /path/to/platform
pixwel path
```

The path is stored in a [configstore](https://github.com/yeoman/configstore) file named `pxwl` (under `~/.config/configstore/pxwl.json`), so every other command works no matter which directory you run it from. If the path isn't set, the CLI refuses to run anything but `pixwel path`.

## Stack lifecycle

These wrap `docker-compose` against your checkout. They run from anywhere once the path is set.

| Command        | What it runs                                                                                          |
| -------------- | ----------------------------------------------------------------------------------------------------- |
| `pixwel up`    | `docker-compose up -d` — brings up the full stack (API at `http://localhost:8080`).                   |
| `pixwel stop`  | `docker-compose stop` — stops the containers, keeping them around.                                    |
| `pixwel down`  | `docker-compose down` — tears the stack down.                                                         |
| `pixwel debug` | Brings the stack up with the `docker-compose.debug.yml` override so [Xdebug](/api/xdebug) is enabled. |
| `pixwel bash`  | Opens a shell inside the `app` container (`docker-compose exec app bash`).                            |

## Install & environment

| Command             | What it does                                                                                                                                                                                                   |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pixwel install`    | One-shot setup: unlocks git-crypt with `gitcrypt.key`, copies the development env into place, installs the UI dependencies, and runs `composer install` for the API. Fails early if `gitcrypt.key` is missing. |
| `pixwel env [name]` | Copies `docker/<name>.env` into `.env`, `faye/.env`, and `slurpee2/.env`. Defaults to `development`.                                                                                                           |
| `pixwel migrate`    | Runs `utils/migrate.sh` (requires a local `mongo` client).                                                                                                                                                     |
| `pixwel fix`        | Runs `phpcbf` inside the `app` container to auto-fix PHP code style.                                                                                                                                           |

## Tests

| Command         | What it runs                                                                                                                                                                                                                                          |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pixwel kahlan` | Runs the API test suite ([Kahlan](/api/testing)) inside the `app` container. Add `--debug` to attach Xdebug, `--watch` to re-run on file changes. Any further arguments are forwarded to `./bin/kahlan` (e.g. `pixwel kahlan --spec=spec/cases/...`). |
| `pixwel karma`  | Runs the UI test suite ([Karma](/ui/testing)) via `npx karma start`.                                                                                                                                                                                  |

## Running & serving

| Command      | What it runs                                                                                                                             |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `pixwel ui`  | Serves the UI (`gulp serve`). Pass `--dev` to point it at your local API instead of a remote environment.                                |
| `pixwel li3` | Runs an API [li3 console](/api/overview) command inside the `app` container. Arguments are forwarded — e.g. `pixwel li3 search reindex`. |

## Logs

| Command        | What it tails                                              |
| -------------- | ---------------------------------------------------------- |
| `pixwel logs`  | The application logs under `api/resources/tmp/logs/*.log`. |
| `pixwel dlogs` | The container logs (`docker-compose logs -f`).             |

## API access

The CLI can authenticate against a deployed environment and make signed API calls.

<Steps>
  <Step title="Log in">
    `pixwel login` prompts for a host (development, staging, or production), email, and password. It exchanges them for a session token and saves the host, email, and token to the `pxwl` configstore.
  </Step>

  <Step title="Query the API">
    `pixwel api <path>` issues an authenticated `GET /api/<path>` and prints the JSON response. For example, `pixwel api projects`.
  </Step>

  <Step title="Get it as a table">
    `pixwel find <path>` does the same request but renders the result as an ASCII table instead of raw JSON.
  </Step>
</Steps>

`pixwel token` prints the saved authentication token — handy for pasting into other tools or `curl`.

<Note>
  Requests send an `X-Range: resources=0-19` header, so `api` and `find` return the first page of results. Use the path's own paging/query parameters to page through the rest.
</Note>

## Command summary

| Command                | Description                                                         |
| ---------------------- | ------------------------------------------------------------------- |
| `path [path]`          | Set the platform checkout path (defaults to the current directory). |
| `up` / `stop` / `down` | Start, stop, or tear down the full stack.                           |
| `debug`                | Start the stack with Xdebug enabled.                                |
| `bash`                 | Open a shell in the `app` container.                                |
| `install`              | Full local install (git-crypt, env, UI, API).                       |
| `env [name]`           | Copy an environment file into place.                                |
| `migrate`              | Run database migrations.                                            |
| `fix`                  | Auto-fix PHP code style.                                            |
| `kahlan`               | Run API tests (`--debug`, `--watch`).                               |
| `karma`                | Run UI tests.                                                       |
| `ui`                   | Serve the UI (`--dev` for the local API).                           |
| `li3`                  | Run an API li3 console command.                                     |
| `logs` / `dlogs`       | Tail application or container logs.                                 |
| `login`                | Authenticate and save a token.                                      |
| `api <path>`           | Authenticated API call, JSON output.                                |
| `find <path>`          | Authenticated API call, table output.                               |
| `token`                | Print the saved token.                                              |

***

[Back to docs index](/) | [Local Development >>](/local-development)
