Is the source code for the sfdx tools available?

You can find GitHub Repo for Salesforce CLI source code here.

Salesforce open-sourced CLI, Check these blog posts here

Update: Salesforce completely open sourced CLI, Now you can contribute to the Salesforce CLI repo, check the below blog post.

Open Sourcing Salesforce CLI Update Feb. 2021

You can browse the Salesforce CLI GitHub organization here


The source code is published to npm in the salesforce-alm module. There's no public repo for the code yet.

If you want to review the source for sfdx force:mdapi:convert, you can download the module from npm (e.g. npm pack salesforce-alm) or look at the version installed by sfdx (in ~/.local/share/sfdx/client/node_modules/salesforce-alm on linux).

The force:mdapi:convert command is in dist/commands/mdapi/mdapi_convert.js, although the actual logic is in dist/lib/mdapiConvertApi.js.

You can use the node debugger with Chrome DevTools to step through the code. Add a debugger; statement to MdapiConvertCommand.execute, for example, and start the node debugger:

~/.local/share/sfdx/client/bin/node --inspect ~/.local/share/sfdx/client/bin/sfdx.js force:mdapi:convert --rootdir src/

(The current version has source maps, but the code isn't minified. You might need to delete all of the source maps to make the source readable, e.g. find ~/.local/share/sfdx/client/node_modules/salesforce-alm/dist -name \*.map | xargs rm)


The best answer for now is, "not yet".

The DX team have positioned themselves as pro open source and have discussed making some part of the CLI source code part of the OSS footprint of Salesforce in public presentations in the past. However, as of yet, there is not a public statement on a specific timeline for the roadmap for this or how much of it would be OSS (core engine, versus specific commands/modules, for instance).