Salesforce CLI Plugins
Salesforce CLI consists of an npm (Node.js package manager) package called @salesforce/cli and multiple plugins—also npm packages—that contain commands. Node.js is a JavaScript (also Typescript) runtime environment that supports execution outside of a browser. Most of the core functionality that Salesforce CLI provides comes from plugins.
Some plugins are automatically installed when you install Salesforce CLI. These core plugins contain commands that support source-driven development, such as:
- Create and manage scratch orgs and sandboxes: The plugin-org plugin contains commands such as
org create scratch and org delete sandbox
- Deploy and retrieve metadata between the org and your local project: The plugin-deploy-retrieve plugin contains commands such as
project deploy start and project retrieve preview.
- Authorize orgs: The plugin-auth plugin contains commands such as
org login web and org logout.
- Work with test data: The plugin-data plugin contains commands such as
data export bulk, data query, and data import tree.
- Create and manage scratch org users: The plugin-user plugin contains commands such as
org create user and org generate password.
- Create, preview, and test agents: The plugin-agent plugin contains commands such as
agent create and agent test run.
Some plugins are installed just when you need them, rather than being included automatically in a Salesforce CLI installation. When you run a command in a “just-in-time” (JIT) plugin for the first time, Salesforce CLI installs the latest released version of the plugin and then runs the command. The plugin installation happens automatically, although we display a little message so you know what’s going on. From then on, run any of the commands contained in the plugin as usual. When you next update Salesforce CLI with sf update, if the JIT plugin has released a new version, then it’s also updated. These JIT plugins contain specialized commands that aren’t typically used by most CLI users, such as:
- Create and manage scratch org snapshots and shapes: The plugin-signups plugin contains commands such as
org create shape and org delete snapshot.
- Scan and evaluate Apex, LWC, Flow, and Visualforce code for potential issues: The code-analyzer plugin contains commands such as
code-analyzer rules and code-analyzer run.
- Run Flow tests in your org and view the results: The plugin-flow contains commands such as
flow run test and flow get test.
To determine whether a plugin is core or JIT, check the package.json file of the aggregator @salesforce/cli plugin:
- Core plugins are listed in the
oclif:plugins section.
- JIT plugins are listed in the
oclif:jitPlugins section.
See the Salesforce CLI Status page for the full list of core and JIT plugins, their GitHub repositories, and their status.
You can also install more plugins, such as CRM Analytics, to incorporate other Salesforce features into your development environment. You can also develop your own plugin to add your custom functionality to Salesforce CLI. See Salesforce CLI Plugin Developer Guide.
By default, the latest versions of the core plugins are installed when you both install Salesforce CLI for the first time and subsequently update. See What Happens When You Update Salesforce CLI? for details about how non-core plugins are updated.
To determine the versions of the plugins currently installed in your CLI, run:
The command displays information such as this sample output.
1@oclif/plugin-autocomplete 3.2.41 (core)
2@oclif/plugin-commands 4.1.40 (core)
3@oclif/plugin-help 6.2.38 (core)
4@oclif/plugin-not-found 3.2.75 (core)
5@oclif/plugin-plugins 5.4.58 (core)
6@oclif/plugin-search 1.2.39 (core)
7@oclif/plugin-update 4.7.23 (core)
8@oclif/plugin-version 2.2.38 (core)
9@oclif/plugin-warn-if-update-available 3.1.55 (core)
10@oclif/plugin-which 3.2.44 (core)
11agent 1.32.4 (core)
12apex 3.9.13 (core)
13api 1.3.11 (core)
14auth 4.3.1 (core)
15code-analyzer 5.11.0
16data 4.0.80 (core)
17deploy-retrieve 3.24.16 (core)
18info 3.4.111 (core)
19limits 3.3.80 (core)
20marketplace 1.3.10 (core)
21org 5.9.72 (core)
22packaging 2.25.10 (core)
23schema 3.3.98 (core)
24settings 2.4.60 (core)
25sobject 1.4.86 (core)
26telemetry 3.8.3 (core)
27templates 56.10.7 (core)
28trust 3.7.114 (core)
29user 3.7.1 (core)
30
31Uninstalled JIT Plugins:
32community 3.3.48
33custom-metadata 3.3.84
34dev 2.5.2
35devops-center 1.2.27
36flow 1.0.5
37lightning-dev 6.2.16
38signups 2.6.56
39@salesforce/sfdx-plugin-lwc-test 1.2.1
As shown in the sample output, if a plugin has (core) next to its name, it’s the version bundled with the CLI. If you install a specific version of the plugin, or it was automatically installed as a JIT plugin, its version number or tag is displayed instead. For example, the code-analyzer commands are contained in the JIT code-analyzer plugin and the sample output indicates that version 5.11.0 is installed.
The end of the plugins --core output also displays the available JIT plugins that haven’t yet been installed.
-
Install a CLI Plugin
You can extend the functionality of the core Salesforce CLI by installing a plugin, which is a set of CLI commands that are grouped in an npm package. The plugin can come from a variety of providers: Salesforce, a third party, or even one that you create yourself. Salesforce CLI plugin installs work similarly to npm installs.
-
Install Other Versions of Salesforce CLI Plugins
Sometimes you want to use a specific version of a plugin. For example, let’s say Salesforce fixed a bug in the apex run command. The fix has been released in the associated plugin, but Salesforce hasn’t yet included that plugin release in the current Salesforce CLI. But you want to test the bug fix in your local development environment. Follow these steps to install the version of the plugin that has the fix.
-
Install Trusted Unsigned Plugins Automatically
When you install a plugin with the sf plugins install command, Salesforce CLI first verifies its digital signature. If the plugin provides a valid signature, the CLI installs it. Otherwise, Salesforce CLI doesn’t install it until you answer a warning prompt and acknowledge that you understand the risks. This process works well when you install a plugin interactively at the command line, but can prevent a batch job from completing. To automatically install a plugin without prompting, even when unsigned, create an allowlist file on your local file system and add the plugins you trust.
-
Discover Salesforce Plugins
Check out these other plugins that work with specific Salesforce features. These plugins are created by Salesforce.
-
Quickly Uninstall All Non-Core Plugins
Sometimes you want to quickly uninstall all the non-core Salesforce CLI plugins that were installed after you first installed the CLI.
See Also