Automation CLI commands
Early access feature
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.
Automation commands#
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:
An automation's public ID is derived from its filename, so on-entry-changed.automation.ts deploys as on-entry-changed.
Deploy automations#
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.tsconvention. - 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.
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.
| Command | Output details |
|---|---|
-p, --project | Uniform project id. If not specified, the environment variable |
-f, --format | Uniform API key. If not specified, the environment variable |
--apiHost | Uniform host. If not specified, the environment variable |
--proxy | Proxy server. If not specified, the following environment variables are used (with the first match being 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. |
List automations#
command
List the automations registered for the project. Also available as uniform automation ls.
| Command | Output details |
|---|---|
-p, --project | Uniform project id. If not specified, the environment variable |
-f, --format | Uniform API key. If not specified, the environment variable |
--apiHost | Uniform host. If not specified, the environment variable |
--proxy | Proxy server. If not specified, the following environment variables are used (with the first match being used): |
Delete automations#
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.
| Command | Output details |
|---|---|
-p, --project | Uniform project id. If not specified, the environment variable |
-f, --format | Uniform API key. If not specified, the environment variable |
--apiHost | Uniform host. If not specified, the environment variable |
--proxy | Proxy server. If not specified, the following environment variables are used (with the first match being used): |