> ## Documentation Index
> Fetch the complete documentation index at: https://forest-chore-open-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Forest CLI

> Command-line tool for managing your Forest projects, branches, environments, and deployments

# Forest CLI

The Forest CLI (`forest`) is a command-line tool that lets you manage your Forest layout changes throughout your development workflow, from local development to production deployment.

## Installation

```bash theme={null}
npm install -g forest-cli
```

You can verify the installation with:

```bash theme={null}
forest --version
```

<Info>
  The Forest CLI requires **Node.js >= 18.0.0**.
</Info>

## Getting started

Once installed, authenticate with your Forest account:

```bash theme={null}
forest login
```

Then initialize your development environment from your project directory:

```bash theme={null}
forest init
```

## Commands

### Authentication

| Command                                | Description                          |
| -------------------------------------- | ------------------------------------ |
| [`forest login`](/reference/cli/login) | Sign in to your Forest account       |
| `forest logout`                        | Sign out of your account             |
| `forest user`                          | Display the currently logged-in user |

### Branch management

| Command                                  | Description                                |
| ---------------------------------------- | ------------------------------------------ |
| [`forest branch`](/reference/cli/branch) | Create a branch or list existing branches  |
| [`forest switch`](/reference/cli/switch) | Switch to a different branch               |
| `forest set-origin`                      | Set an environment as your branch's origin |

### Deployment

| Command                                  | Description                                                     |
| ---------------------------------------- | --------------------------------------------------------------- |
| [`forest push`](/reference/cli/push)     | Push layout changes from your branch to its origin environment  |
| [`forest deploy`](/reference/cli/deploy) | Deploy layout changes to the production (reference) environment |

### Environment management

| Command                      | Description                                      |
| ---------------------------- | ------------------------------------------------ |
| `forest environments`        | List all environments                            |
| `forest environments:create` | Create a new environment                         |
| `forest environments:delete` | Delete an environment                            |
| `forest environments:update` | Update an environment                            |
| `forest environments:reset`  | Reset all layout changes on a remote environment |

### Project management

| Command               | Description                   |
| --------------------- | ----------------------------- |
| `forest projects`     | List all projects             |
| `forest projects:get` | Get a project's configuration |

### Schema

| Command                | Description                                       |
| ---------------------- | ------------------------------------------------- |
| `forest schema:apply`  | Apply your local schema to a specific environment |
| `forest schema:diff`   | Compare the schemas of two environments           |
| `forest schema:update` | Refresh your schema by generating missing files   |

## Development workflow

A typical development workflow with the Forest CLI looks like this:

1. **Create a branch** to isolate your layout changes:
   ```bash theme={null}
   forest branch feature/my-feature --origin production
   ```

2. **Work locally**, make layout changes in your Forest UI connected to your development environment.

3. **Push your changes** to a staging or test environment for review:
   ```bash theme={null}
   forest push
   ```

4. **Deploy to production** once changes are validated:
   ```bash theme={null}
   forest deploy
   ```

## Docker usage

You can also run the CLI via Docker without installing it locally:

```bash theme={null}
docker run --rm --init -it \
  -v `pwd`:/usr/src/app \
  -v ~/.forest.d:/usr/src/cli/.forest.d \
  -e TOKEN_PATH="/usr/src/cli" \
  forestadmin/toolbelt:latest [command]
```

## Global options

All commands support the following options:

| Option      | Description                               |
| ----------- | ----------------------------------------- |
| `--help`    | Display usage information for the command |
| `--version` | Show the CLI version                      |
