Announcing Salesforce CLI Unification | Salesforce Developers Blog

Towards one CLI to rule them all

It’s hard to believe that it’s been over four years since we first announced Salesforce DX, and with it, the Salesforce CLI. As some say: time flies when you’re shipping features! We know that many of you started on your DX journey at that time, and you have helped us continue to evolve those tools to better fit your needs. But as our tooling grew over the years, we noticed an evolution in your own projects: you’re taking on more ambitious development work, building across multiple Salesforce clouds, and, of course, using a number of different tools. However, an overabundance of tools can make development feel disconnected and inconsistent, especially as you build across different products. Well, guess what — it’s all coming together!

We know how important a robust, scriptable CLI is to developers, architects, and admins, and while many of you are sfdx power users, we also recognize that you need a different CLI for MuleSoft, Commerce Cloud, Heroku, and so on. Today, we’re excited to share a major enhancement to the Salesforce CLI that will streamline and simplify how you build across Salesforce: CLI Unification! We’re introducing a new, global CLI executable called sf that provides you with a single command line taxonomy for cross-Salesforce development.

Introducing a new executable for cross-cloud development

CLI Unification is a natural evolution of our Salesforce CLI strategy, and therefore we’re building a new executable instead of a net new CLI. The new executable, sf, will come bundled with the Salesforce CLI and you’ll be able to keep using all of the sfdx commands you know and love, but also incorporate new commands that are designed from day 1 for cross-cloud app development and deployment. The executables are interoperable, so you’ll be able to add these new sf commands to your current scripts and projects without reworking them.

With this approach, we’re evolving the taxonomy of our Salesforce CLI to bring together existing capabilities from other CLIs, such as the Heroku CLI and MuleSoft CLI, to deliver net-new, cross-cloud commands under the new executable, sf. Our ultimate goal is to provide you with one set of tools for writing and deploying all of your Salesforce apps.

Rethinking our command taxonomy for a growing Salesforce

As we mentioned before, Salesforce looked a lot different when we first introduced the Salesforce CLI. So while CLI Unification is an effort designed to eliminate tool and context switching, it’s also an opportunity to reimagine the CLI’s command structure for where Salesforce is today, and where it’s going. To this end, we’re designing CLI commands that focus on the actions that you take or the job you perform when running a command, instead of focusing on product or brand names.

For example, sf project deploy by default deploys the entire project that is defined in your local directory. If your project includes Functions and a Force app, then both are deployed to their respective environments.

Let’s say that you later include a Heroku app, some MuleSoft APIs, and a resource from Marketing Cloud in your project. In this case, sf project deploy will deploy all of these resources to all of the respective environments.

Now, what if you want a more granular way of deploying changes or use a product-specific deployment feature? In that case, you’d use the product-specific project deploy commands that have flag options for granular deployment. As an example, sf project deploy org will support all the current options for force:source:deploy and force:source:push.

Stepping back to focus on usability and productivity

The approach to CLI Unification seen above provides a gradual path to adoption that enables you to employ new, cross-cloud commands, but also default to existing CLI functionality when more product-specific controls are desired. You may also notice in the example above that the project deploy command is interactive. When designing CLI Unification we wanted to improve the usability of the CLI on top of adding cross cloud commands, but the improvements don’t stop there.

The journey to CLI Unification has provided us with a chance to step back and examine the entire structure of our CLI, and think critically about the fundamental changes you’d need to be more productive and more satisfied with your CLI experience. To that end, we’ve introduced a number of additional improvements that will make your CLI experience better than ever. These improvements include spaces instead of colons, global table flags, improved help, interactive prompting on all commands if required flags are not specified, and output consistency standards for things like tables and JSON that improve the long-term experience of using the CLI. By focusing on usability and discoverability when designing sf, we’ve done our best to ensure that you’ll have a productive toolchain you can rely on for the long haul as the Platform continues to grow and evolve.

Introducing new commands without breaking your current scripts

Ok, this may sound exciting to some of you who were growing a bit frustrated with CLI juggling. But I know that more than a few of you are also sweating at the prospect of broken scripts and tooling migrations. When we set out on the path towards unifying our CLIs through a new executable, our foremost objective was to deliver a seamless experience that wouldn’t break you.

sf is an evolution of sfdx as the platform gets more complex. One of those complexities is authentication and managing your identity and accounts for Salesforce. We have always known that this is a large headache for developers, (especially based on the number of times you all run sfdx force:org:list!), so we have spent a lot of time thinking about how this will work in a unified world. From day one, you will be able to see the scope of Salesforce orgs that you are authenticated to in sf, and soon you will be able to authenticate to other types of accounts like Heroku and compute environments for Functions. sf will be fully aware of sfdx and vice versa, so you can start using sf commands right away with environments you authenticated to via sfdx.

Furthermore, we are actively working on updating the source commands to use the new deploy and retrieve libraries that have already increased the speed of deploys and retrieves in VS Code. We are working hard on a new test suite for every command to limit regressions from release to release. As we grow sf, all of these improvements to sfdx will come over, but we want to bring them to sfdx now because that is where Salesforce development happens today.

And since sf is an evolution of sfdx , they come in the same installer, so you can immediately start using them side by side!

What about existing plug-ins? Because both sfdx and sf are based on oclif, any existing oclif or sfdx plugins will work in sf. When installed in sf, your plug-ins will get many of the usability improvements out of the box, and in the coming months, we will detail how and when to modify your plug-ins to get the rest of the improvements.

Get started today with our Demo CLI

As we mentioned earlier this year, we’re evolving the Salesforce CLI in the open, with the community’s input, and this effort towards unifying our CLI functionality will be no different. The first iteration of the Salesforce CLI that features the new sf executable is targeted for July 31st, but we’re doing something a little unique so that you don’t have to wait until then to begin familiarizing yourself with this new command structure.

Available today is a first of its kind Demo CLI that will enable you to explore some basic commands within sf and even practice running them. This will provide you with an opportunity to explore new commands like sf env list or sf project deploy and get a feel for what using them will be like next month. It also means that you can tell us what you enjoy from this new command taxonomy, what changes you’d like to see, and what commands you want next.

No different from how the Salesforce CLI works today, CLI Unification will happen in waves, with community input influencing every step of the way. We’re building on oclif, in the open, so you can deliver new, better-than-ever plug-ins and customizations that will enable every team to have a simpler, more productive experience building across Salesforce. We can’t wait to see what you deploy!

To learn more, visit our readme and stay tuned to our Salesforce CLI repo on GitHub for updates. You can also see what CLI Unification looks like today at TrailheaDX, both as part of the opening keynote, and in the “Build Scalable Experiences: Functions & CLI” episode.

To install the Demo CLI with npm, run the following from your terminal:

npm install --global @salesforce/sf-demo
sf --help

About the author

Claire Bianchi is Director of Product Management for Developer Tooling at Salesforce.

Stay up to date with the latest news from the Salesforce Developers Blog

Subscribe