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
npm install -g forest-cli
You can verify the installation with:
The Forest CLI requires Node.js >= 18.0.0.
Getting started
Once installed, authenticate with your Forest account:
Then initialize your development environment from your project directory:
Commands
Authentication
| Command | Description |
|---|
forest 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 | Create a branch or list existing branches |
forest switch | Switch to a different branch |
forest set-origin | Set an environment as your branch’s origin |
Deployment
| Command | Description |
|---|
forest push | Push layout changes from your branch to its origin environment |
forest 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:
-
Create a branch to isolate your layout changes:
forest branch feature/my-feature --origin production
-
Work locally, make layout changes in your Forest UI connected to your development environment.
-
Push your changes to a staging or test environment for review:
-
Deploy to production once changes are validated:
Docker usage
You can also run the CLI via Docker without installing it locally:
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 |