A command bundle is a JSON file that distributes a set of saved commands for delphi-terminal. Bundles let users provide pre-configured commands to users. This would be useful for all members of a dev team sharing the same command list.
A bundle file is a JSON object with three fields:
{
"prefix": "cd.",
"description": "Continuous-Delphi PowerShell toolchain commands",
"commands": [
{
"name": "cd.clean",
"shell": "pwsh",
"command": "delphi-clean",
"workdir": "${ProjectDir}"
},
{
"name": "cd.build",
"shell": "pwsh",
"command": "Invoke-DelphiBuild -ProjectFile ${ProjectFile}",
"workdir": "${ProjectDir}"
},
{
"name": "cd.incver",
"shell": "pwsh",
"command": "Invoke-DelphiIncVer",
"workdir": "${ProjectDir}"
}
]
}prefix (required): A short string that uniquely identifies the bundle. Every command name in the bundle should start with this prefix. On import, all existing commands whose name starts with this prefix are deleted before the bundle's commands are added. This makes reimport safe -- updating a bundle replaces its commands without touching user-defined commands.
Convention: use a dot-separated namespace, e.g. cd. for
Continuous-Delphi, myteam. for internal team commands.
description (required): A human-readable description shown in the import confirmation dialog.
commands (required): An array of command objects. Each command has:
| Field | Required | Description |
|---|---|---|
| name | yes | Display name. Should start with the bundle prefix. |
| shell | yes | Target shell: active, cmd, pwsh, or powershell. |
| command | yes | The command text. May contain ${Variable} tokens. |
| workdir | no | Working directory. If set, the shell cd's here before running the command. May contain |
${Variable} tokens or be a static path. |
Note: You control the quoting requirements per shell.
- active -- runs in whichever tab is currently selected
- cmd -- runs in the CMD tab
- pwsh -- runs in the pwsh (PowerShell 7+) tab
- powershell -- runs in the legacy PowerShell tab
Both command and workdir fields support these variable tokens,
expanded at execution time:
| Token | Value |
|---|---|
${ProjectDir} |
Directory of the active project |
${ProjectFile} |
Full path of the active project (.dproj) |
${FileDir} |
Directory of the currently focused editor file |
${FilePath} |
Full path of the currently focused editor file |
${FileName} |
File name only of the currently focused editor file |
${PluginDir} |
Directory where the delphi-terminal plugin is installed |
${BuildConfig} |
Active build configuration (e.g. Debug, Release) |
${Platform} |
Active target platform (e.g. Win32, Win64) |
Variables are case-insensitive. If a variable cannot be resolved (e.g.
${ProjectDir} when no project is open), the command is aborted and an
error message is displayed in the terminal output.
Commands containing ${BuildConfig} or ${Platform} are automatically
hidden from the command palette when no project is open. Likewise,
commands containing ${FileDir}, ${FilePath}, or ${FileName} are
hidden when no editor file is open.
- Open Tools > Options > Third Party > delphi-terminal
- Click Saved Commands...
- Click Import...
- Select the
.jsonbundle file - Review the confirmation dialog (shows the prefix, description, and how many existing commands with that prefix will be replaced)
- Click Yes to import
To update a bundle, simply import the same file (or a newer version) again. All commands matching the prefix are replaced.
- Open Tools > Options > Third Party > delphi-terminal
- Click Saved Commands...
- Click Export...
- Enter the prefix that identifies the commands to export (e.g.
cd.) - Enter a human-readable description for the bundle
- Choose a file location and save
Only commands whose name starts with the given prefix are included in
the exported bundle. The resulting .json file is in the standard bundle
format and can be imported on other machines or shared with team members.
You can create a .delphi-terminal.json file next to any .dproj file
to define commands that only appear when that project is active.
The file uses the same bundle format:
{
"description": "Commands for MyApp",
"commands": [
{
"name": "deploy",
"shell": "pwsh",
"command": "Copy-Item ${ProjectDir}\\Win32\\Release\\MyApp.exe C:\\deploy\\",
"workdir": "${ProjectDir}"
},
{
"name": "run",
"shell": "cmd",
"command": "Win32\\Release\\MyApp.exe",
"workdir": "${ProjectDir}"
}
]
}When the command palette opens, project commands are automatically loaded
and prefixed with project:<dprojName>. (e.g. project:MyApp.deploy).
This prevents name collisions with global commands.
- The
prefixfield is optional in per-project files - Commands are only visible when that project is the active project
- No UI editor -- create and edit the JSON file manually, or use Export... to generate a starting point
- The file can be committed to source control for team-shared commands,
or added to
.gitignorefor per-developer commands
- Choose a prefix that identifies your tool or team (e.g.
mytools.) - Create a JSON file following the format above, or use Export... to generate one from existing commands
- Name every command starting with your prefix
- Test the commands manually in delphi-terminal first
- Distribute the
.jsonfile alongside your tools
{
"prefix": "demo.",
"description": "Demo commands for testing",
"commands": [
{
"name": "demo.hello",
"shell": "active",
"command": "echo Hello from delphi-terminal"
},
{
"name": "demo.projinfo",
"shell": "pwsh",
"command": "Write-Host 'Project: ${ProjectFile}'",
"workdir": "${ProjectDir}"
}
]
}