CLI

Smartmate comes with a command line interface (CLI), that allows you to create, validate, and publish applications on your smartmate workspace.

Pre-requisites

Installation

npm install -g smartmate-cli or yarn global add smartmate-cli

Usage

Almost all of the commands are interactive in order to provide a richer dev experience.

The command sm --help lists the available commands and sm <command> --help shows more details for an individual command.

Authentication

Command

Shortcut

Description

sm login

sm lg

Authenticate the CLI to a Smartmate workspace.

You can use sm login $workspace $username $password to login as a user to the desired workspace.

You can be logged in to multiple workspaces. This is useful for example if you have a sandbox workspace that you use for testing before publishing to your production workspace.

sm logout

sm lgo

Sign out of the Smartmate CLI on the current workspace.

sm list

sm li

List all the workspaces the Smartmate CLI is currently logged on.

sm use

sm u

Choose the current workspace.

Note

The login flow requests an offline_token as specified by OpenID Connect specs. For this reason, if you are using the CLI from a CI system, you should log out after performing the required operations.

Create a new workspace

Command

Shortcut

Description

sm init

sm u

Set up a new empty workspace. It creates the smartmate.yml file

Add things

Command

Shortcut

Description

sm add

sm a

Adds a new application, table, process, etc. into the current workspace

For this command to work you should be inside a workspace folder or any of its sub-folders. The workspace root is determined by the smartmate.yml file.

If the command is run from within an app, the system will automatically create the element in the app, otherwise it will ask the app that the element should be added into.

Shortcuts

  • sm add app: Add a new app into the current workspace.

  • sm add table: Add a new table into the current app.

  • sm add process: Add a new process into the current app.

  • sm add template: Add a new template into the current app.

Validate and Publish

Command

Shortcut

Description

sm validate

sm v

Validate the current workspace files.

sm publish

sm p

Publish all the apps of the current workspace on Smartmate.

Use the -f or --force option to bypass the “Are you sure?” message.