commands-workflows
commands-workflows provides cmdw, a command workflow manager for developers
who want to turn recurring terminal routines into reliable, reusable workflows.
Use it to standardize project setup, testing, releases, deployments, API calls, maintenance tasks, and other command sequences that need structure without requiring a full automation platform. Workflows can include multiple commands, reusable placeholders, default values, global variables, file references, and list expansion.
Installation
pip install commands-workflows
After installation, run:
cmdw --help
Quick Start
Create a workflow:
cmdw create deploy \
"git checkout {{branch=main}}" \
"git pull" \
"npm run build" \
"npm run deploy -- --target {{target}}" \
--desc "Build and deploy a project"
Run it with a required value:
cmdw run deploy production
Override a value by name:
cmdw run deploy --set target=staging --set branch=release
Show the saved workflow and the placeholders it expects:
cmdw show deploy
Core Concepts
Workflows
A workflow is a named list of shell commands. Commands run in the order they were saved.
cmdw create test "python -m unittest" --desc "Run the test suite"
cmdw run test
Useful commands:
cmdw list
cmdw show test
cmdw edit test --desc "Run all unit tests"
cmdw delete test
You can also use the long command names:
cmdw list-workflow
cmdw show-workflow test
cmdw run-workflow test
Placeholders
Use placeholders inside commands with {{name}}.
cmdw create greet "echo Hello {{name}}"
cmdw run greet Steven
Placeholders can have default values:
cmdw create branch "git checkout {{branch=main}}"
cmdw run branch
cmdw run branch develop
When a workflow has multiple placeholders, positional values are assigned in the order the placeholders appear:
cmdw create release "git tag v{{version}}" "git push origin v{{version}}"
cmdw run release 1.2.0
Use an explicit index when you want to control the positional order:
cmdw create api-call \
"curl https://api.example.com/{{resource:1}}/{{id:2}}"
cmdw run api-call users 42
Named values passed with --set name=value override positional values:
cmdw run api-call --set resource=users --set id=42
Global Variables
Global variables let you keep shared values outside a single workflow. They are stored locally and can be reused by any workflow.
cmdw add-var account_id 123456
cmdw add-var env.production_url https://example.com
cmdw list-var
Reference them in commands:
cmdw create open-prod "curl {{global.env.production_url}}/health"
cmdw run open-prod
Nested variables are supported with dot notation:
cmdw edit-var env.production_url https://api.example.com
cmdw delete-var env.production_url
If your globals.json contains a key with dots, quote that segment inside the
reference:
cmdw create dns "curl zones/global.cloudflare.zones.'{{domain}}'/dns_records"
cmdw run dns example.com
You can also wrap global references in percent signs when that makes a command easier to read:
cmdw create dns "curl zones/%global.cloudflare.zones.'{{domain}}'%/dns_records"
File and Script References
cmdw can resolve local file and helper script references at run time.
Use sys. to read a file:
cmdw create print-config "cat {{sys./path/to/config.json}}"
Use sys.ssh. to read from ~/.ssh:
cmdw create show-key "cat {{sys.ssh.id_rsa.pub}}"
Use scripts. to reference a file in ~/.cmdw/scripts:
cmdw create fetch "python {{scripts.fetch_data.py}}"
Use %...% syntax when a direct token is easier to place inside a command:
cmdw create fetch "python %scripts.fetch_data.py%"
List Expansion
A placeholder ending in [] expands a command once per value.
cmdw create ping-all "ping -c 1 {{host[]}}"
cmdw run ping-all --set "host[]=api.example.com,db.example.com"
List values can also come from global variables when the list reference is used as a default value:
cmdw add-var hosts "['api.example.com', 'db.example.com']"
cmdw create ping-hosts "ping -c 1 {{host[]=global.hosts}}"
cmdw run ping-hosts
Error Handling
By default, a workflow stops when a command fails.
Continue after failed commands:
cmdw run deploy production --continue-on-error
Reduce output:
cmdw run deploy production --mute
Command Reference
| Command | Description |
|---|---|
cmdw create NAME [COMMANDS]... --desc TEXT |
Create a workflow. |
cmdw list |
List saved workflows. |
cmdw show NAME |
Show workflow commands and placeholders. |
cmdw run NAME [ARGS]... |
Run a workflow. |
cmdw run NAME --set key=value |
Run with named placeholder values. |
cmdw edit NAME --new-name NAME |
Rename a workflow. |
cmdw edit NAME --desc TEXT |
Update a workflow description. |
cmdw edit NAME --command TEXT |
Replace workflow commands. Repeat for multiple commands. |
cmdw delete NAME |
Delete a workflow. |
cmdw add-var NAME VALUE |
Add a global variable. |
cmdw edit-var NAME VALUE |
Update a global variable. |
cmdw delete-var NAME |
Delete a global variable. |
cmdw list-var |
List global variables. |
Local Storage
cmdw stores data in your home directory:
~/.cmdw/workflows.json
~/.cmdw/globals.json
~/.cmdw/scripts/
The files are local JSON files. You can back them up, inspect them, or sync them with your own tooling.
Practical Examples
Run a Project Setup Sequence
cmdw create setup \
"python -m venv .venv" \
"pip install -r requirements.txt" \
"python -m unittest" \
--desc "Create a virtual environment and run tests"
cmdw run setup
Reuse a Deployment Target
cmdw add-var deploy.target production
cmdw create deploy \
"npm run build" \
"npm run deploy -- --target {{global.deploy.target}}"
cmdw run deploy
Run the Same Command for Several Items
cmdw create check-domains "curl -I https://{{domain[]}}"
cmdw run check-domains --set "domain[]=example.com,example.org"
Notes
- Commands are executed by your system shell.
- Review workflows before running them, especially if they include destructive shell commands.
- Secrets saved as global variables are stored as plain text in
~/.cmdw/globals.json.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commands_workflows-0.1.1.tar.gz.
File metadata
- Download URL: commands_workflows-0.1.1.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d8d3c75c4b4c2a8f4016ea68de2be7909f72ede3a4ad57507fe4d5c1075dc77
|
|
| MD5 |
28a9fadaf804bdf13de35436245aa9ae
|
|
| BLAKE2b-256 |
43f2cdecb806119f7e1ac93fcb9e6d3e25ea36377e572dfbef26a9f27715ed57
|
File details
Details for the file commands_workflows-0.1.1-py3-none-any.whl.
File metadata
- Download URL: commands_workflows-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c35b259095b5c7ec26c16cecf7bc441d58b772df4c4d35ec4a33f64c69eb386
|
|
| MD5 |
94e48e08456ebcd256bf681c72d0d560
|
|
| BLAKE2b-256 |
55ba7adc309bd1e1cc29a5c09029227d9648106ebc3dfe416e2ee9e47bc4cb64
|