{"id":315,"date":"2025-06-18T21:26:42","date_gmt":"2025-06-18T21:26:42","guid":{"rendered":"https:\/\/cptdcli.com\/?p=315"},"modified":"2025-06-19T22:38:26","modified_gmt":"2025-06-19T22:38:26","slug":"add-new-command-cpdsl","status":"publish","type":"post","link":"https:\/\/www.cptdcli.org\/?p=315","title":{"rendered":"Added NEW command : CPDSL"},"content":{"rendered":"\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:5.92%\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h2 class=\"wp-block-heading\">\ud83d\udcdc Description of the cpdsl Command (cptd &gt;= v2.0.5)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Name:<\/strong> <strong>cpdsl<\/strong><br><strong>Role:<\/strong> Interpreter for declarative <strong>.dsl<\/strong> scripts enabling sequential execution of installed <code>cptd<\/code> commands<br><strong>Platform Support:<\/strong> Cross-platform (Linux \/ Windows \/ macOS)<br><strong>Format:<\/strong> Step-based YAML scenario files<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\ude80 What Is <code>cpdsl<\/code> and Why Does It Matter?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>cpdsl <\/strong>is the official scenario interpreter within the <strong>CPTD CLI<\/strong> platform. It reads YAML-based workflows line by line, step by step \u2014 transforming manual command sequences into structured, repeatable, and secure automation pipelines.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83e\udde0 Why Use cpdsl?<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Automate routine procedures using registered <code>cptd<\/code> commands<\/li>\n\n\n\n<li>Replace unreliable shell scripts with validated YAML instructions<\/li>\n\n\n\n<li>Ensure portability \u2014 a single .dsl file can run anywhere<\/li>\n\n\n\n<li>Achieve full transparency, reproducibility, and structured logging<\/li>\n\n\n\n<li>Centralize complex operations such as backups, encryption, uploads, logging, and more<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccc Why It\u2019s Convenient<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A single .<strong>dsl <\/strong>file encapsulates an entire workflow<\/li>\n\n\n\n<li>Easily share automation logic as modules or assets<\/li>\n\n\n\n<li>Seamless GUI integration (e.g., a &#8220;Run Backup&#8221; button)<\/li>\n\n\n\n<li>Easy debugging and reusability of automation logic<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcca Advantages of the DSL Approach<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Feature<\/th><th>Advantage<\/th><\/tr><\/thead><tbody><tr><td>\ud83d\udce6 Uniformity<\/td><td>All commands are launched through a consistent interface<\/td><\/tr><tr><td>\u267b\ufe0f Reusability<\/td><td>One DSL file can run on thousands of machines or via scheduled tasks<\/td><\/tr><tr><td>\ud83d\udccb Self-documenting<\/td><td>DSL reads like a technical spec or execution plan<\/td><\/tr><tr><td>\ud83e\uddf1 Extensibility<\/td><td>Future-ready: <code>if<\/code>, <code>loop<\/code>, <code>include<\/code>, <code>when<\/code> and more are possible<\/td><\/tr><tr><td>\ud83d\udd10 Security<\/td><td>Immune to shell injection, <code>eval<\/code>, or accidental <code>rm -rf<\/code> disasters<\/td><\/tr><tr><td>\ud83e\udde0 Cross-platform<\/td><td>Same <code>.dsl<\/code> works on Windows, Linux, and remote servers<\/td><\/tr><tr><td>\ud83e\uddf0 Integratable<\/td><td>Can be invoked from UI buttons, web dashboards, apps, or triggers<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcc2 Example Command<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>cptd cpdsl run backup.dsl --log out.txt --strict --wait-all --summary\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83c\udfc1 Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">cpdsl isn\u2019t just syntax \u2014 it\u2019s structure. It\u2019s automation strategy with clarity and control.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Forget chaotic bash chains and cryptic <code>&amp;&amp;<\/code> sequences.<br>Write readable, testable, extensible workflows that evolve with your project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>cpdsl \u2014 Structure your CLI. Define your workflows. Automate with precision.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udcd8 YAML Scenario Guide for <code>cpdsl<\/code><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">cpdsl is a YAML-based scenario interpreter for sequential and parallel command execution within the <strong>CPTD CLI<\/strong> system.<br>Scenarios let you combine complex processes (archiving, encryption, uploading, testing, etc.) into a single descriptive file.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddf1 Basic File Structure (.dsl)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>name: \"Scenario Name\"\ndescription: \"Short description of purpose\"\n\nsteps:\n  - name: \"Step Name\"\n    command: \"command_name\"\n    args:\n      --flag1: value\n      --flag2: true\n    async: true\n    depends_on: \"step_name\"\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\udde9 Field Descriptions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd39 Top-Level Fields:<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Field<\/th><th>Type<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>name<\/code><\/td><td>string<\/td><td>Human-readable scenario name<\/td><\/tr><tr><td><code>description<\/code><\/td><td>string<\/td><td>Short summary<\/td><\/tr><tr><td><code>steps<\/code><\/td><td>list<\/td><td>Array of step definitions (see below)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd39 Inside <code>steps[]<\/code>:<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Field<\/th><th>Type<\/th><th>Required<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>name<\/code><\/td><td>string<\/td><td>No<\/td><td>Step name (for display and <code>depends_on<\/code>)<\/td><\/tr><tr><td><code>command<\/code><\/td><td>string<\/td><td>\u2705 Yes<\/td><td>Name of the registered CPTD command<\/td><\/tr><tr><td><code>args<\/code><\/td><td>dict <code>--flag: val<\/code><\/td><td>No<\/td><td>Arguments for the command. <code>true<\/code> \u2192 flag only; <code>false<\/code> \u2192 ignored<\/td><\/tr><tr><td><code>async<\/code><\/td><td>bool<\/td><td>No<\/td><td>If <code>true<\/code>, runs the step in the background<\/td><\/tr><tr><td><code>depends_on<\/code><\/td><td>string \/ list<\/td><td>No<\/td><td>Dependencies. Runs only after specified step(s) complete<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd39 Special Feature: Environment Variables<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of a fixed value, you can reference an environment variable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>args:\n  --password-env: SFTP_PASS\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside cpdsl, this becomes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>--password-env &lt;value of SFTP_PASS&gt;\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 Example of a Simple Scenario<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>name: \"Backup\"\ndescription: \"Mount, archive, and upload archive\"\n\nsteps:\n  - name: \"Mount\"\n    command: \"cpdisk\"\n    args:\n      --mount: true\n      --file: \"vault.hc\"\n\n  - name: \"Archive\"\n    command: \"compress\"\n    args:\n      --input: \"\/vault\/data\"\n      --output: \"\/tmp\/data.zip\"\n    depends_on: \"Mount\"\n\n  - name: \"Upload\"\n    command: \"uploader\"\n    args:\n      --file: \"\/tmp\/data.zip\"\n      --target: \"sftp:\/\/host\/upload\"\n      --password-env: SFTP_PASS\n    async: true\n    depends_on: \"Archive\"\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddea Running a Scenario<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>cptd cpdsl run backup.dsl --log log.txt --strict --wait-all --summary\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83c\udf9b Run Arguments:<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Argument<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>--log &lt;file&gt;<\/code><\/td><td>Save execution log<\/td><\/tr><tr><td><code>--strict<\/code><\/td><td>Stop on first error<\/td><\/tr><tr><td><code>--wait-all<\/code><\/td><td>Wait for all <code>async: true<\/code> steps to finish<\/td><\/tr><tr><td><code>--summary<\/code><\/td><td>Print a summary table of step statuses at the end<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udccb Example of Summary Output (<code>--summary<\/code>)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Summary:\n\u2714 Step 1 - Mount                &#91;OK]\n\u2714 Step 2 - Archive              &#91;OK]\n\u2714 Step 3 - Upload               &#91;ASYNC]\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u26a0\ufe0f Error Handling<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Scenario<\/th><th>Default Behavior<\/th><th>With <code>--strict<\/code><\/th><\/tr><\/thead><tbody><tr><td><code>depends_on<\/code> references unknown step<\/td><td>Error<\/td><td>Error<\/td><\/tr><tr><td>Step exits with non-zero code<\/td><td>Continues<\/td><td>Stops<\/td><\/tr><tr><td>Async step fails<\/td><td>Logs the error<\/td><td>Stops<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\ude80 Writing Tips<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always assign a unique name: to each step<\/li>\n\n\n\n<li>Use depends_on to define logical order<\/li>\n\n\n\n<li>Use async: true for background tasks<\/li>\n\n\n\n<li>Store your .dsl files in scripts\/ or scenarios\/ for project structure<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:5%\"><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udcdc Description of the cpdsl Command (cptd &gt;= v2.0.5) Name: cpdslRole: Interpreter for declarative .dsl scripts enabling sequential execution of installed cptd commandsPlatform Support: Cross-platform (Linux \/ Windows \/ macOS)Format: Step-based YAML scenario files \ud83d\ude80 What Is cpdsl and Why Does It Matter? cpdsl is the official scenario interpreter within the CPTD CLI platform. It [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":310,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-315","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-new-commands"],"_links":{"self":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=315"}],"version-history":[{"count":8,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":328,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions\/328"}],"wp:attachment":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}