Added NEW command : CPDSL
π Description of the cpdsl Command (cptd >= v2.0.5)
Name: cpdsl
Role: Interpreter for declarative .dsl scripts enabling sequential execution of installed cptd commands
Platform Support: Cross-platform (Linux / Windows / macOS)
Format: Step-based YAML scenario files
π What Is cpdsl and Why Does It Matter?
cpdsl is the official scenario interpreter within the CPTD CLI platform. It reads YAML-based workflows line by line, step by step β transforming manual command sequences into structured, repeatable, and secure automation pipelines.
π§ Why Use cpdsl?
- Automate routine procedures using registered
cptdcommands - Replace unreliable shell scripts with validated YAML instructions
- Ensure portability β a single .dsl file can run anywhere
- Achieve full transparency, reproducibility, and structured logging
- Centralize complex operations such as backups, encryption, uploads, logging, and more
π Why Itβs Convenient
- A single .dsl file encapsulates an entire workflow
- Easily share automation logic as modules or assets
- Seamless GUI integration (e.g., a “Run Backup” button)
- Easy debugging and reusability of automation logic
π Advantages of the DSL Approach
| Feature | Advantage |
|---|---|
| π¦ Uniformity | All commands are launched through a consistent interface |
| β»οΈ Reusability | One DSL file can run on thousands of machines or via scheduled tasks |
| π Self-documenting | DSL reads like a technical spec or execution plan |
| π§± Extensibility | Future-ready: if, loop, include, when and more are possible |
| π Security | Immune to shell injection, eval, or accidental rm -rf disasters |
| π§ Cross-platform | Same .dsl works on Windows, Linux, and remote servers |
| π§° Integratable | Can be invoked from UI buttons, web dashboards, apps, or triggers |
π Example Command
cptd cpdsl run backup.dsl --log out.txt --strict --wait-all --summary
π Conclusion
cpdsl isnβt just syntax β itβs structure. Itβs automation strategy with clarity and control.
Forget chaotic bash chains and cryptic && sequences.
Write readable, testable, extensible workflows that evolve with your project.
cpdsl β Structure your CLI. Define your workflows. Automate with precision.
π YAML Scenario Guide for cpdsl
cpdsl is a YAML-based scenario interpreter for sequential and parallel command execution within the CPTD CLI system.
Scenarios let you combine complex processes (archiving, encryption, uploading, testing, etc.) into a single descriptive file.
π§± Basic File Structure (.dsl)
name: "Scenario Name"
description: "Short description of purpose"
steps:
- name: "Step Name"
command: "command_name"
args:
--flag1: value
--flag2: true
async: true
depends_on: "step_name"
π§© Field Descriptions
πΉ Top-Level Fields:
| Field | Type | Purpose |
|---|---|---|
name | string | Human-readable scenario name |
description | string | Short summary |
steps | list | Array of step definitions (see below) |
πΉ Inside steps[]:
| Field | Type | Required | Purpose |
|---|---|---|---|
name | string | No | Step name (for display and depends_on) |
command | string | β Yes | Name of the registered CPTD command |
args | dict --flag: val | No | Arguments for the command. true β flag only; false β ignored |
async | bool | No | If true, runs the step in the background |
depends_on | string / list | No | Dependencies. Runs only after specified step(s) complete |
πΉ Special Feature: Environment Variables
Instead of a fixed value, you can reference an environment variable:
args:
--password-env: SFTP_PASS
Inside cpdsl, this becomes:
--password-env <value of SFTP_PASS>
β Example of a Simple Scenario
name: "Backup"
description: "Mount, archive, and upload archive"
steps:
- name: "Mount"
command: "cpdisk"
args:
--mount: true
--file: "vault.hc"
- name: "Archive"
command: "compress"
args:
--input: "/vault/data"
--output: "/tmp/data.zip"
depends_on: "Mount"
- name: "Upload"
command: "uploader"
args:
--file: "/tmp/data.zip"
--target: "sftp://host/upload"
--password-env: SFTP_PASS
async: true
depends_on: "Archive"
π§ͺ Running a Scenario
cptd cpdsl run backup.dsl --log log.txt --strict --wait-all --summary
π Run Arguments:
| Argument | Purpose |
|---|---|
--log <file> | Save execution log |
--strict | Stop on first error |
--wait-all | Wait for all async: true steps to finish |
--summary | Print a summary table of step statuses at the end |
π Example of Summary Output (--summary)
Summary:
β Step 1 - Mount [OK]
β Step 2 - Archive [OK]
β Step 3 - Upload [ASYNC]
β οΈ Error Handling
| Scenario | Default Behavior | With --strict |
|---|---|---|
depends_on references unknown step | Error | Error |
| Step exits with non-zero code | Continues | Stops |
| Async step fails | Logs the error | Stops |
π Writing Tips
- Always assign a unique name: to each step
- Use depends_on to define logical order
- Use async: true for background tasks
- Store your .dsl files in scripts/ or scenarios/ for project structure