DatoCMS CLI
DatoCMS CLI tool for managing DatoCMS projects, environments and schemas.
Usage
$ npm install -g @datocms/cli
$ datocms COMMAND
running command...
$ datocms (--version)
@datocms/cli/0.1.6 darwin-x64 node-v16.20.0
$ datocms --help [COMMAND]
USAGE
$ datocms COMMAND
...
Commands
datocms autocomplete [SHELL]
Display autocomplete installation instructions.
USAGE
$ datocms autocomplete [SHELL] [-r]
ARGUMENTS
SHELL (zsh|bash|powershell) Shell type
FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
DESCRIPTION
Display autocomplete installation instructions.
EXAMPLES
$ datocms autocomplete
$ datocms autocomplete bash
$ datocms autocomplete zsh
$ datocms autocomplete powershell
$ datocms autocomplete --refresh-cache
See code: @oclif/plugin-autocomplete
datocms environments:destroy ENVIRONMENT_ID
Destroys a sandbox environment
USAGE
$ datocms environments:destroy ENVIRONMENT_ID [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to destroy
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Destroys a sandbox environment
See code: src/commands/environments/destroy.ts
datocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_ID
Creates a new sandbox environment by forking an existing one
USAGE
$ datocms environments:fork SOURCE_ENVIRONMENT_ID NEW_ENVIRONMENT_ID [--json] [--config-file <value>] [--profile
<value>] [--api-token <value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
[--force --fast]
ARGUMENTS
SOURCE_ENVIRONMENT_ID The environment to copy
NEW_ENVIRONMENT_ID The name of the new sandbox environment to generate
FLAGS
--fast Run a fast fork. A fast fork reduces processing time, but it also prevents writing to the source environment
during the process
--force Forces the start of a fast fork, even there are users currently editing records in the environment to copy
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Creates a new sandbox environment by forking an existing one
See code: src/commands/environments/fork.ts
datocms environments:index
Lists primary/sandbox environments of a project
USAGE
$ datocms environments:index [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Lists primary/sandbox environments of a project
ALIASES
$ datocms environments:index
$ datocms environments:list
datocms environments:list
Lists primary/sandbox environments of a project
USAGE
$ datocms environments:list [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Lists primary/sandbox environments of a project
ALIASES
$ datocms environments:index
$ datocms environments:list
See code: src/commands/environments/list.ts
datocms environments:primary
Returns the name the primary environment of a project
USAGE
$ datocms environments:primary [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Returns the name the primary environment of a project
See code: src/commands/environments/primary.ts
datocms environments:promote ENVIRONMENT_ID
Promotes a sandbox environment to primary
USAGE
$ datocms environments:promote ENVIRONMENT_ID [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to promote
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Promotes a sandbox environment to primary
See code: src/commands/environments/promote.ts
datocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_ID
Renames an environment
USAGE
$ datocms environments:rename ENVIRONMENT_ID NEW_ENVIRONMENT_ID [--json] [--config-file <value>] [--profile <value>]
[--api-token <value>] [--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
ARGUMENTS
ENVIRONMENT_ID The environment to rename
NEW_ENVIRONMENT_ID The new environment ID
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Renames an environment
See code: src/commands/environments/rename.ts
datocms help [COMMAND]
Display help for datocms.
USAGE
$ datocms help [COMMAND...] [-n]
ARGUMENTS
COMMAND... Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for datocms.
See code: @oclif/plugin-help
datocms maintenance:off
Take a project out of maintenance mode
USAGE
$ datocms maintenance:off [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory]
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Take a project out of maintenance mode
See code: src/commands/maintenance/off.ts
datocms maintenance:on
Put a project in maintenance mode
USAGE
$ datocms maintenance:on [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--force]
FLAGS
--force Forces the activation of maintenance mode even there are users currently editing records
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Put a project in maintenance mode
See code: src/commands/maintenance/on.ts
datocms migrations:new NAME
Create a new migration script
USAGE
$ datocms migrations:new NAME [--json] [--config-file <value>] [--profile <value>] [--api-token <value>]
[--log-level NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--ts | --js] [--template <value>
| --autogenerate <value>]
ARGUMENTS
NAME The name to give to the script
FLAGS
--autogenerate=<value>
Auto-generates script by diffing the schema of two environments
Examples:
* --autogenerate=foo finds changes made to sandbox environment 'foo' and applies them to primary environment
* --autogenerate=foo:bar finds changes made to environment 'foo' and applies them to environment 'bar'
--js
Forces the creation of a JavaScript migration file
--template=<value>
Start the migration script from a custom template
--ts
Forces the creation of a TypeScript migration file
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Create a new migration script
See code: src/commands/migrations/new.ts
datocms migrations:run
Run migration scripts that have not run yet
USAGE
$ datocms migrations:run [--json] [--config-file <value>] [--profile <value>] [--api-token <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--log-mode stdout|file|directory] [--source <value>] [--dry-run] [--force
[--fast-fork [--destination <value> | --in-place]]] [--migrations-dir <value>] [--migrations-model <value>]
[--migrations-tsconfig <value>]
FLAGS
--destination=<value> Specify the name of the new forked environment
--dry-run Simulate the execution of the migrations, without making any actual change
--fast-fork Run a fast fork. A fast fork reduces processing time, but it also prevents writing to
the source environment during the process
--force Forces the start of a fast fork, even there are users currently editing records in the
environment to copy
--in-place Run the migrations in the --source environment, without forking
--migrations-dir=<value> Directory where script migrations are stored
--migrations-model=<value> API key of the DatoCMS model used to store migration data
--migrations-tsconfig=<value> Path of the tsconfig.json to use to run TS migrations scripts
--source=<value> Specify the environment to fork
GLOBAL FLAGS
--api-token=<value> Specify a custom API key to access a DatoCMS project
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
--log-level=<option> Level of logging for performed API calls
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--log-mode=<option> Where logged output should be written to
<options: stdout|file|directory>
--profile=<value> Use settings of profile in datocms.config.js
DESCRIPTION
Run migration scripts that have not run yet
See code: src/commands/migrations/run.ts
datocms plugins
List installed plugins.
USAGE
$ datocms plugins [--json] [--core]
FLAGS
--core Show core plugins.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List installed plugins.
EXAMPLES
$ datocms plugins
See code: @oclif/plugin-plugins
datocms plugins:add PLUGIN
Installs a plugin into datocms.
USAGE
$ datocms plugins:add PLUGIN... [--json] [-f] [-h] [-s | -v]
ARGUMENTS
PLUGIN... Plugin to install.
FLAGS
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
-h, --help Show CLI help.
-s, --silent Silences npm output.
-v, --verbose Show verbose npm output.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Installs a plugin into datocms.
Uses npm to install plugins.
Installation of a user-installed plugin will override a core plugin.
Use the DATOCMS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
Use the DATOCMS_NPM_REGISTRY environment variable to set the npm registry.
ALIASES
$ datocms plugins:add
EXAMPLES
Install a plugin from npm registry.
$ datocms plugins:add myplugin
Install a plugin from a github url.
$ datocms plugins:add https://github.com/someuser/someplugin
Install a plugin from a github slug.
$ datocms plugins:add someuser/someplugin
datocms plugins:available
Lists official DatoCMS CLI plugins
USAGE
$ datocms plugins:available [--json]
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Lists official DatoCMS CLI plugins
See code: src/commands/plugins/available.ts
datocms plugins:inspect PLUGIN...
Displays installation properties of a plugin.
USAGE
$ datocms plugins:inspect PLUGIN...
ARGUMENTS
PLUGIN... [default: .] Plugin to inspect.
FLAGS
-h, --help Show CLI help.
-v, --verbose
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Displays installation properties of a plugin.
EXAMPLES
$ datocms plugins:inspect myplugin
See code: @oclif/plugin-plugins
datocms plugins:install PLUGIN
Installs a plugin into datocms.
USAGE
$ datocms plugins:install PLUGIN... [--json] [-f] [-h] [-s | -v]
ARGUMENTS
PLUGIN... Plugin to install.
FLAGS
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
-h, --help Show CLI help.
-s, --silent Silences npm output.
-v, --verbose Show verbose npm output.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Installs a plugin into datocms.
Uses npm to install plugins.
Installation of a user-installed plugin will override a core plugin.
Use the DATOCMS_NPM_LOG_LEVEL environment variable to set the npm loglevel.
Use the DATOCMS_NPM_REGISTRY environment variable to set the npm registry.
ALIASES
$ datocms plugins:add
EXAMPLES
Install a plugin from npm registry.
$ datocms plugins:install myplugin
Install a plugin from a github url.
$ datocms plugins:install https://github.com/someuser/someplugin
Install a plugin from a github slug.
$ datocms plugins:install someuser/someplugin
See code: @oclif/plugin-plugins
datocms plugins:link PATH
Links a plugin into the CLI for development.
USAGE
$ datocms plugins:link PATH [-h] [--install] [-v]
ARGUMENTS
PATH [default: .] path to plugin
FLAGS
-h, --help Show CLI help.
-v, --verbose
--[no-]install Install dependencies after linking the plugin.
DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
command will override the user-installed or core plugin implementation. This is useful for development work.
EXAMPLES
$ datocms plugins:link myplugin
See code: @oclif/plugin-plugins
datocms plugins:remove [PLUGIN]
Removes a plugin from the CLI.
USAGE
$ datocms plugins:remove [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
EXAMPLES
$ datocms plugins:remove myplugin
datocms plugins:reset
Remove all user-installed and linked plugins.
USAGE
$ datocms plugins:reset [--hard] [--reinstall]
FLAGS
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
--reinstall Reinstall all plugins after uninstalling.
See code: @oclif/plugin-plugins
datocms plugins:uninstall [PLUGIN]
Removes a plugin from the CLI.
USAGE
$ datocms plugins:uninstall [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
EXAMPLES
$ datocms plugins:uninstall myplugin
See code: @oclif/plugin-plugins
datocms plugins:unlink [PLUGIN]
Removes a plugin from the CLI.
USAGE
$ datocms plugins:unlink [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ datocms plugins:unlink
$ datocms plugins:remove
EXAMPLES
$ datocms plugins:unlink myplugin
datocms plugins:update
Update installed plugins.
USAGE
$ datocms plugins:update [-h] [-v]
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Update installed plugins.
See code: @oclif/plugin-plugins
datocms profile:remove PROFILE_ID
Remove a profile from DatoCMS config file
USAGE
$ datocms profile:remove PROFILE_ID [--json] [--config-file <value>]
ARGUMENTS
PROFILE_ID The name of the profile
GLOBAL FLAGS
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
DESCRIPTION
Remove a profile from DatoCMS config file
See code: src/commands/profile/remove.ts
datocms profile:set PROFILE_ID
Add/update profile configuration in DatoCMS config file
USAGE
$ datocms profile:set PROFILE_ID [--json] [--config-file <value>] [--log-level
NONE|BASIC|BODY|BODY_AND_HEADERS] [--migrations-dir <value>] [--migrations-model <value>] [--migrations-template
<value>] [--migrations-tsconfig <value>]
ARGUMENTS
PROFILE_ID [default: default] Name of the profile to create/update
FLAGS
--log-level=<option> Level of logging to use for the profile
<options: NONE|BASIC|BODY|BODY_AND_HEADERS>
--migrations-dir=<value> Directory where script migrations will be stored
--migrations-model=<value> API key of the DatoCMS model used to store migration data
--migrations-template=<value> Path of the file to use as migration script template
--migrations-tsconfig=<value> Path of the tsconfig.json to use to run TS migration scripts
GLOBAL FLAGS
--config-file=<value> [default: ./datocms.config.json] Specify a custom config file path
--json Format output as json.
DESCRIPTION
Add/update profile configuration in DatoCMS config file
See code: src/commands/profile/set.ts