DevCycle CLI for interacting with DevCycle features from the command line.
The CLI can be customized in several ways using command-line args or by creating a configuration file.
Install the CLI
$ npm install -g @devcycle/cli
Or alternatively, using homebrew
$ brew tap devcyclehq/cli
$ brew install devcycle
Many of the CLI commands require DevCycle API authorization. There are several ways to provide these credentials.
Using Access Tokens (preferred)
By using the
login sso command, the CLI will retrieve and store an access token, which is valid for 24 hours.
login again command can be used to retrieve a new access token using the saved project and organization without prompting for them.
This process will open browser windows to interact with the DevCycle universal login page. It will first obtain a personal access token, then prompt you to choose an organization. A second browser window is used to authenticate the CLI with your chosen organization.
To switch organizations once logged in, the
organizations select command can be used.
Repo Init Command
Using Client Credentials
Client Credentials in Auth File
dvc status command to find the configuration file location for your platform. The credentials can be stored in the file pointed to by the Auth config path. Create the file if it does not exist, with the following contents.
client_id: <your client id>
client_secret: <your client secret>
This file should not be checked in to version control.
The default location is based on the oclif configDir
If you intend to run the CLI using options that override config file locations, the
dvc status command command can be run with those options to confirm that the file locations are as expected.
You also need to specify the default project ID for the CLI to use.
Otherwise, this is chosen during login or set using the project select command
Set the following environment variables:
$ export DEVCYCLE_CLIENT_ID=<your client id>
$ export DEVCYCLE_CLIENT_SECRET=<your client secret>
$ export DEVCYCLE_PROJECT_KEY=<your project key>
The CLI can be run with the following arguments:
$ dvc --client-id=<your client id> --client-secret=<your client secret> --project=<your project key>
The Devcycle Github actions are configured with auth information through the
client-secret configuration parameters. This is passed to the CLI via command line arguments.
$ npm install -g @devcycle/cli
$ dvc COMMAND
$ dvc (--version)
@devcycle/cli/5.12.1 linux-x64 node-v18.16.0
$ dvc --help [COMMAND]
$ dvc COMMAND
dvc alias- Manage repository variable aliases.
dvc autocomplete- display autocomplete installation instructions
dvc diff- Print a diff of DevCycle variable usage between two versions of your code.
dvc environments- Create a new Environment for an existing Feature.
dvc features- Create, view, or modify Features with the Management API.
dvc generate- Generate Devcycle related files.
dvc help- Display help for dvc.
dvc identity- View or manage your DevCycle Identity.
dvc keys- Retrieve SDK keys from the Management API.
dvc login- Log in to DevCycle.
dvc logout- Discards any auth configuration that has been stored in the auth configuration file.
dvc organizations- List or switch organizations.
dvc overrides- Create, view, or modify Overrides for a Project with the Management API.
dvc projects- Create, or view Projects with the Management API.
dvc repo- Manage repository configuration.
dvc status- Check CLI status.
dvc targeting- Create, view, or modify Targeting Rules for a Feature with the Management API.
dvc usages- Print all DevCycle variable usages in the current version of your code.
dvc variables- Create, view, or modify Variables with the Management API.
dvc variations- Create a new Variation for an existing Feature.
The following commands can only be run from the root of a configured repository
Many of the options available as command-line args can also be specified using a repo configuration file. The default
location for this file is
This location can be overridden using the
The configuration file format is documented below:
### the project and organization to use when connecting to the DevCycle Rest API for this repo
display_name: "Human Readable Org Name"
### block for configuring "code insights" features like diff and variable usage scanning
### use this section to improve the detection of DevCycle usage within your code
### add additional names to check for when looking for instances of DVCClient from an SDK
### map the values used in your code to the corresponding variable key in DevCycle
### additional regex patterns used to match variables for a specific file extension
### file extension to override for, containing a list of patterns to use
### an array of file glob patterns to include in usage scan
### an array of file glob patterns to exclude from usage scan
When identifying variable usages in the code, the CLI will identify DevCycle SDK methods by default. To capture other usages you may define match patterns. Match patterns are defined by file extension, and each pattern should contain exactly one capture group which matches the key of the variable. Make sure the captured value contains the entire key parameter (including quotes, if applicable).
Match patterns can be defined in the configuration file, for example:
Match patterns can also be passed directly to relevant commands using the
dvc usages --match-pattern ts="customVariableGetter\(\s*[\"']([^\"']*)[\"']" js="customVariableGetter\(\s*[\"']([^\"']*)[\"']"
When testing your regex the
--show-regex flag can be helpful. This will print all patterns used to find matches in your codebase.
dvc usages --show-regex