Automation CLI commands

Early access feature

The "Automations" feature is in early access and only available to select customers. If you are interested in getting access, please contact us.

The commands in this section allow you to manage the code automations in a Uniform project. Scout automations are managed in the dashboard instead.

Prerequisites

  • Minimum CLI version: 20.74.7
  • Managing automations requires an API key with Manage Automations permissions.

These commands should be added as a script command in your project, rather than run directly in the terminal. For example, in the package.json file of a next.js project:

"scripts": { "uniform:deploy-automations": "uniform automation deploy ./automations" },

An automation's public ID is derived from its filename, so on-entry-changed.automation.ts deploys as on-entry-changed.

uniform automation deploy <directory or file path...>

command
Bundle the specified automations and deploy them to the Uniform project. Deploying an automation that already exists replaces it.

  • If a file path is specified, that automation module is bundled and deployed. The filename does not have to follow the *.automation.ts convention.
  • If a directory path is specified, every *.automation.ts (also .js, .mjs, and .cjs) file directly inside the directory is deployed. Directories are not searched recursively.
  • You can pass several files and directories in a single command.
# Deploy a single automation uniform automation deploy ./on-entry-changed.automation.ts # Deploy several at once uniform automation deploy ./on-entry-changed.automation.ts ./nightly-cleanup.automation.ts # Deploy every automation in a directory uniform automation deploy ./automations

Any environment variable named UNIFORM_ENV_* that is available when the CLI runs is inlined into the deployed bundle. The CLI loads your .env file automatically, and CI variables work too. See secrets and environment variables.

Push-only deployment

Deployment is push-only. You cannot read the code you deployed back out, because it is encrypted to protect any sensitive data it may contain. Keep your automation source in version control.

CommandOutput details

-p, --project
string

Uniform project id. If not specified, the environment variable UNIFORM_CLI_PROJECT_ID is used.

-f, --format
string (optional, default value: YAML)

Uniform API key. If not specified, the environment variable UNIFORM_API_KEY is used.

--apiHost
string (optional, default value: https://uniform.app)

Uniform host. If not specified, the environment variable UNIFORM_CLI_BASE_URL is used. If the environment variable isn't set, the default value is used.

--proxy
string (optional)

Proxy server. If not specified, the following environment variables are used (with the first match being used): HTTPS_PROXY, https_proxy, ALL_PROXY, all_proxy. If no match is found, no proxy server is used.

--compatibilityDate
string (optional)
Code automations run on Cloudflare Workers. This date pins the Workers runtime so backwards-incompatible changes after that date do not apply to the deployed automation. Format: YYYY-MM-DD. Overrides compatibilityDate in the automation metadata. See Cloudflare compatibility dates.
uniform automation list

command
List the automations registered for the project. Also available as uniform automation ls.

CommandOutput details

-p, --project
string

Uniform project id. If not specified, the environment variable UNIFORM_CLI_PROJECT_ID is used.

-f, --format
string (optional, default value: YAML)

Uniform API key. If not specified, the environment variable UNIFORM_API_KEY is used.

--apiHost
string (optional, default value: https://uniform.app)

Uniform host. If not specified, the environment variable UNIFORM_CLI_BASE_URL is used. If the environment variable isn't set, the default value is used.

--proxy
string (optional)

Proxy server. If not specified, the following environment variables are used (with the first match being used): HTTPS_PROXY, https_proxy, ALL_PROXY, all_proxy. If no match is found, no proxy server is used.

uniform automation delete <public ID, directory, or file path...>

command
Delete the specified automations from the Uniform project.

  • If a public ID is specified, that automation is deleted.
  • If a file path is specified, the public ID is derived from the filename.
  • If a directory path is specified, every matching automation file in the directory is deleted, using the same convention as deploy.
  • A path that does not exist is treated as a public ID.
uniform automation delete on-entry-changed uniform automation delete ./on-entry-changed.automation.ts ./nightly-cleanup.automation.ts uniform automation delete ./automations
CommandOutput details

-p, --project
string

Uniform project id. If not specified, the environment variable UNIFORM_CLI_PROJECT_ID is used.

-f, --format
string (optional, default value: YAML)

Uniform API key. If not specified, the environment variable UNIFORM_API_KEY is used.

--apiHost
string (optional, default value: https://uniform.app)

Uniform host. If not specified, the environment variable UNIFORM_CLI_BASE_URL is used. If the environment variable isn't set, the default value is used.

--proxy
string (optional)

Proxy server. If not specified, the following environment variables are used (with the first match being used): HTTPS_PROXY, https_proxy, ALL_PROXY, all_proxy. If no match is found, no proxy server is used.