Added NEW command : CPDSL

June 18, 2025

πŸ“œ 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 cptd commands
  • 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

FeatureAdvantage
πŸ“¦ UniformityAll commands are launched through a consistent interface
♻️ ReusabilityOne DSL file can run on thousands of machines or via scheduled tasks
πŸ“‹ Self-documentingDSL reads like a technical spec or execution plan
🧱 ExtensibilityFuture-ready: if, loop, include, when and more are possible
πŸ” SecurityImmune to shell injection, eval, or accidental rm -rf disasters
🧠 Cross-platformSame .dsl works on Windows, Linux, and remote servers
🧰 IntegratableCan 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:

FieldTypePurpose
namestringHuman-readable scenario name
descriptionstringShort summary
stepslistArray of step definitions (see below)

πŸ”Ή Inside steps[]:

FieldTypeRequiredPurpose
namestringNoStep name (for display and depends_on)
commandstringβœ… YesName of the registered CPTD command
argsdict --flag: valNoArguments for the command. true β†’ flag only; false β†’ ignored
asyncboolNoIf true, runs the step in the background
depends_onstring / listNoDependencies. 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:

ArgumentPurpose
--log <file>Save execution log
--strictStop on first error
--wait-allWait for all async: true steps to finish
--summaryPrint 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

ScenarioDefault BehaviorWith --strict
depends_on references unknown stepErrorError
Step exits with non-zero codeContinuesStops
Async step failsLogs the errorStops

πŸš€ 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

 

← Back to archive