Workbench CLI tool commands

Use the Workbench CLI tool to make product module changes and push them to Root

This guide covers the full feature suite of the Workbench CLI tool. To set up the Workbench CLI tool, follow the Workbench setup tutorial first. To learn more about the configurability of product modules and workflows on Root, refer to the Product modules & workflows guide section.

Commands

rp clone [api key] [product module key]

This command creates a new directory and clones the latest draft version of your product module from Root to your local machine for local editing. This command is only used once for the initial setup of your product module on your local machine.

Use cd to navigate into the new directory in order to use the other commands.

Example

Below is an example of cloning a product module and navigating into the new directory. After this step is completed, all the other rp commands can be used.

$ rp clone sandbox_NDIwZGYxg5LTgMTE4YzWkhhKZV5xdVLZENTNt dinosure
Product module 'dinosure' successfully cloned into './dinosure' directory.
$ cd dinosure

rp pull

This command pulls all files and configurations of your product module from Root and overrides the local files. By default, this command pulls the latest draft version, not the live version.

Optional: -f or --force flag

Use the -f or --force flag to ignore the diff check and force the pull.

Warning: this overrides all local files to match the version on Root exactly.

Optional: -l or --live flag

This optional flag will pull the live version from Root.

Optional: -c or --config flag

This optional flag will only pull the .root-config.json file. Use this to upgrade the version of the config without overriding other changes due to be pushed. See Versioning for more details.

Example

$ rp pull
No changes to pull, local version is in sync with Root

rp push

This command pushes all the local files and configurations to Root which create a new draft version of the product module on the platform.

You can issue policies from a draft version over the API or on the dashboard in Sandbox. To deploy the draft version to live, please contact the Root team (they will review your changes and action the deploy).

Optional: -f or --force flag

Use the -f or --force flag to ignore the diff check and force the push.

Example

$ rp push
No changes to push, local version is in sync with Root

rp render

This command renders the document templates locally in the ./sandbox/output directory. It compiles a PDF file for each valid HTML document in the ./documents directory.

πŸ‘

Productivity tip

For best use during active document development, use all three the -m, -p <policy-id> and -w flags simultaneously in order to generate new documents every time changes are saved. Open the document using Preview on Mac and it will automatically refresh. This results in a real-time view of the end-result.

Optional: -m or --merge flag

Use the -m or --merge flags to execute the handlebars and merge in the merge variables located in /sandbox/merge-vars.json.

Optional: -p <policy id> or --policy-id <policy id> flag

Supply an ID for an existing sandbox policy ID with the -p or --policy-id option to fetch the corresponding merge variables. This will be ignored if the merge flag is set to false.

Optional: -w or --watch flag

Use the watch flag to enable live-reload that will re-render all the documents every time any of the template or merge-var files are saved.

Example

$ rp render -m -w
Documents successfully generated in the './sandbox' directory with merge-vars injected.
Watching for template or merge-var changes to re-render documents.

rp test

This command will run any tests located in the specified test suite. Use this command to run product module code locally. You can find the test suite in code > unit-tests. Multiple test files can be created.

The test suite relies on Mocha & Chai for tests.

πŸ‘

Productivity tip

For best use during active code development, use the -w flag to rerun the test suite every time changes are saved. This allows rapid feedback and encourages righting more tests.

Optional: -w or --watch flag

Use the watch flag to enable live-reload of the test suite when changes to either the code or test files are saved.

Example

$ rp test -w rp test -w
Started test suite.


  getQuote
    βœ“ should return an integer suggested premium
    βœ“ should return a suggested premium of R115.17 (in cents)


  2 passing (8ms)

Completed test suite.
Watching for code or test file changes.

rp lint

This command will run eslint on the product module code.

Optional: -f or --fix flag

Use the -f or --fix flag to automatically apply the eslint fixes to the product module code.


What’s Next