DX CLI is your developer experience companion. A command-line tool that helps automate and standardize recurring setup and configuration tasks across your organization.
This guide explains:
- How to use the built-in DX CLI commands.
- How to create your own custom CLI and make it available to your peers.
Display all available commands in the CLI.
Show the current version of DX CLI.
Use AI to answer your configuration-related questions and automatically set up your local environment.
Update the DX CLI core component along with all organization-managed features.
When new engineers join your team, they often face a maze of setup steps: reading documentation, configuring tools, and adjusting their environment. A custom CLI automates these repetitive tasks, making onboarding fast and seamless.
For example, you can script:
- Maven setup with custom proxies and mirrors
- Certificate management within a Java truststore
- And more!
All these can be distributed to all your peers within your organization through DX CLI packages.
Before creating your own CLI, make sure you:
- Have write access to your organization’s DX CLI packages repository.
- Follow your organization's contribution guidelines.
We’ll create a simple command that prints:
C:\Users\startdevx>helloworld
Hello world Kevin!In the root directory of your DX CLI packages repository, create a new folder named helloworld with the following structure:
helloworld/
├── config.json
└── start.ps1In the config.json file, the version and description fields are used for displaying information when using dx -h. Copy/paste the following content in the config.json file:
{
"version": "0.0.1",
"description": "Display 'Hello world <username>!' message on your command prompt"
}In the start.ps1, add your script logic. Copy/paste the following content in start.ps1 file:
Write-Host "Hello world $Env:USERNAME!"If it doesn't exist, create a .bin/ root folder and create a new .bat file named after your target CLI - in this example, helloworld.bat and copy/paste the following content in the helloworld.bat file:
@echo OFF
set current_location=%~dp0
set cli_folder=%~n0
set command=%*
powershell -NoProfile -ExecutionPolicy bypass -File "%current_location%..\%cli_folder%\start.ps1" %command%You can rename start.ps1 to any filename. Just remember to update its reference inside the .bat file.
Once your CLI works locally:
- Commit and merge your changes to the
mainbranch. - Users can run
dx updateto fetch the latest packages. - Your new
helloworldcommand will be ready to use!
Want to use another scripting language like Python? Just modify the .bat launcher to call the appropriate file:
@echo OFF
set current_location=%~dp0
set cli_folder=%~n0
set command=%*
python "%current_location%..\%cli_folder%\start.py" %command%DX CLI is an open-source solution available on GitHub, crafted by Start DevX organization.