Skip to main content

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:
forest --version
The Forest CLI requires Node.js >= 18.0.0.

Getting started

Once installed, authenticate with your Forest account:
forest login
Then initialize your development environment from your project directory:
forest init

Commands

Authentication

CommandDescription
forest loginSign in to your Forest account
forest logoutSign out of your account
forest userDisplay the currently logged-in user

Branch management

CommandDescription
forest branchCreate a branch or list existing branches
forest switchSwitch to a different branch
forest set-originSet an environment as your branch’s origin

Deployment

CommandDescription
forest pushPush layout changes from your branch to its origin environment
forest deployDeploy layout changes to the production (reference) environment

Environment management

CommandDescription
forest environmentsList all environments
forest environments:createCreate a new environment
forest environments:deleteDelete an environment
forest environments:updateUpdate an environment
forest environments:resetReset all layout changes on a remote environment

Project management

CommandDescription
forest projectsList all projects
forest projects:getGet a project’s configuration

Schema

CommandDescription
forest schema:applyApply your local schema to a specific environment
forest schema:diffCompare the schemas of two environments
forest schema:updateRefresh 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:
    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:
    forest push
    
  4. Deploy to production once changes are validated:
    forest deploy
    

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:
OptionDescription
--helpDisplay usage information for the command
--versionShow the CLI version