Get from zero to running in 5 minutes.
CommandGraph is a single Python file with zero dependencies. Python 3.9+ required.
# Copy the engine
cp cgr.py /usr/local/bin/cgr
chmod +x /usr/local/bin/cgr
# Or just use it directly
alias cgr="python3 /path/to/cgr.py"Create hello.cgr:
--- Hello CommandGraph ---
target "local" local:
[say hello]:
run $ echo "Hello from CommandGraph!"
Run it:
cgr apply hello.cgrYou'll see ✓ ok say_hello — your first graph executed.
Create setup.cgr:
--- My first dependency ---
target "local" local:
[create directory]:
skip if $ test -d /tmp/myapp
run $ mkdir -p /tmp/myapp
[write config]:
first [create directory]
skip if $ test -f /tmp/myapp/config.txt
run $ echo "port=8080" > /tmp/myapp/config.txt
Key concepts:
first [create directory]means "run create directory before this step"skip ifmakes steps idempotent — if the check passes, the step is skipped
cgr plan setup.cgr # See the execution order
cgr apply setup.cgr # Run it
cgr apply setup.cgr # Run again — both steps skip (already done)--- Variables ---
set app_port = "3000"
set app_dir = "/tmp/myapp"
target "local" local:
[create app dir]:
skip if $ test -d ${app_dir}
run $ mkdir -p ${app_dir}
[write config]:
first [create app dir]
run $ echo "port=${app_port}" > ${app_dir}/config.txt
Override from the command line:
cgr apply setup.cgr --set app_port=9090cgr serve setup.cgrThis opens a browser with a three-panel IDE: editor, live DAG visualization, and execution log. Edit your graph, see the dependency tree update in real time, and click Apply to execute.
For remote/headless environments:
cgr serve setup.cgr --host 0.0.0.0 --no-open| Goal | Read |
|---|---|
| Guided walkthrough (9 lessons, ~1 hour) | TUTORIAL.md |
| Real-world recipes and patterns | COOKBOOK.md |
| Complete syntax reference | MANUAL.md |
| Formal language spec (for code generators) | COMMANDGRAPH_SPEC.md |