Workbench CLI commands

Manage collection module development, testing, publishing, and diagnostics with the Workbench CLI.

Workbench CLI commands

Use the Workbench CLI to clone, edit, test, publish, and inspect collection modules from your local machine.

Run rp --help or rp <command> --help for the full flag list — this page may lag the CLI.

Quick reference

CommandPurpose
rp clone -cmInitial download of a collection module
rp pullRe-sync local files from Root
rp pushUpload local changes as a new draft
rp publishPromote the draft to a new live version
rp logsTail collection module execution logs
rp testRun unit tests
rp diffShow local vs. remote differences

rp invoke and rp generate are product-module-only and aren't documented on this page.

Before you start

Run rp clone once for a collection module. It writes a .root-auth file with your API key and a .root-config.json file with the module identity. Subsequent rp pull, rp push, rp publish, and operational commands read these files automatically, so they do not need the API key or collection module key as arguments.

After cloning, run cd <collection-module-directory> before using the other commands.

Authoring lifecycle

rp clone -cm

rp clone -cm <api-key> <collection-module-key> [--live] [--host <host>]

Clones a collection module from Root to your local machine for local editing. By default, clones the current draft.

The -cm flag tells the CLI you're cloning a collection module rather than a product module — the clone command is shared between both.

FlagPurpose
-l, --liveClone the most recent live version instead of the draft
-h, --host <host>Use a specific Root host

rp pull

rp pull [--live] [--force] [--no-sort]

Pulls files and configuration from Root and overwrites the local files. By default, pulls the current draft.

FlagPurpose
-l, --livePull the most recent live version instead of the draft
-f, --forceForce the pull even when local changes may be overwritten
-ns, --no-sortPreserve file ordering instead of sorting generated output

rp push

rp push [--force] [--no-sort]

Pushes local files to Root, creating a new draft version of the collection module. Draft versions are usable from the sandbox dashboard and API for testing.

FlagPurpose
-f, --forceForce the push when the CLI detects a conflict or unsafe change
-ns, --no-sortPreserve file ordering instead of sorting generated output

rp publish

rp publish [--force]

Promotes the current draft to a new live version of the collection module. Publishing bumps the sandbox version automatically and prompts you for confirmation unless --force is passed.

Live versions are immutable. Existing policies stay bound to the version they were issued against.

Requires rp ≥ 1.4.26.

FlagPurpose
--forcePublish without an interactive confirmation prompt

Operational commands

rp logs

rp logs [options]

Tails execution logs for the collection module. Calls to console.log/warn/error/debug/info from your hooks are captured and stored in DynamoDB for about 30 days.

FlagPurpose
-w, --watchStream logs in real time
-t, --time <duration>Set the lookback window, for example 30m, 1h, or 2d
-l, --level <level>Filter by info, warn, error, or debug
-p, --policy-id <id>Filter to a single policy
-f, --function-name <name>Filter to one lifecycle hook
-s, --status <status>Filter by COMPLETE, FAILED, or RUNNING
-c, --count <n>Limit the maximum number of log lines

Example:

rp logs -w -l error -t 1h

rp test

rp test [options]

Runs unit tests under code/unit-tests/.

FlagPurpose
-u, --unitRun only unit tests
-w, --watchRe-run on file change

rp diff

rp diff [options]

Shows what has changed locally compared with the remote draft. Use this before rp push to review the files that will be uploaded.

FlagPurpose
-c, --codeShow code changes only
-w, --workflowsShow workflow JSON changes only
-ut, --unit-testsShow unit test changes only
-rm, --read-meShow README changes only
-d, --documentsShow document changes only
-ad, --api-docsShow API documentation changes only

Related guides