Related to this question How to handle the change to "Salesforce DX project format" and keep the revision history?, being able to see the source code for e.g.:

sfdx force:mdapi:convert --rootdir <retrieve dir name>

would make it a lot easier to write a git mv equivalent.

Given the Node underpinnings, I thought I might just be able to see the implementation in the installed sfdx software but I can't find it even if it is there.

So my question is, is the source code for the sfdx tools available to build on when writing your own sfdx plugin?


May 2020 Salesforce blog post: Open Sourcing Salesforce CLI.

3 Answers 3


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)

  • Sorry, xn. I felt obliged to make the (presumably recently published) repository link the accepted answer.
    – Keith C
    May 4, 2020 at 11:29
  • 1
    That's the best answer now.
    – xn.
    May 4, 2020 at 15:07

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).

  • Thanks for taking the time to clarify. Didn't want to be missing the opportunity of a better starting point just through not knowing.
    – Keith C
    Sep 22, 2017 at 12:10

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .