Skip to content

Latest commit

 

History

History
68 lines (49 loc) · 4.34 KB

ARCHITECTURE.md

File metadata and controls

68 lines (49 loc) · 4.34 KB

Salesforce CLI Architecture

Plugin Architecture

The Salesforce CLI is built using oclif, which is an open source CLI framework owned and maintained by Salesforce. The primary benefit of using oclif is that it allows us to develop CLI plugins for specific feature areas. Some plugins are bundled with every CLI installation, while others can be installed if and when a user chooses.

This architecture allows us to empower internal teams and external contributors (aka plugin providers) to own and maintain their CLI commands, without having to create an entirely new CLI. It also allows plugin providers to keep their changes isolated from other plugins and it allows customers to preview features and fixes by manually installing a plugin before it's shipped in the CLI.

We write most of our business logic inside of NPM libraries that plugins can consume. This allows the commands in a plugin to be a light wrapper around the library and also enables other consumers to use the exact same functionality - for example, both @salesforce/plugin-deploy-retrieve and the Salesforce Extension pack for VsCode use the source-deploy-retrieve library to interact with Salesforce metadata.

sf plugins and dependencies

Typical Salesforce Plugin

Plugins are npm packages written in Typescript and are hosted in the public npm registry. These are the dependencies that are typical amongst all Salesforce plugins:

Salesforce plugins

oclif plugins

dependencies

dev dependencies

sf typical plugin

Command Execution

Below is a diagram that outlines at a high level the process that occurs every time a user executes a CLI command.

command execution flow