Quickstart
This guide assumes cx (Conditional eXecution) is already installed somewhere
on your PATH.
Check:
cx --help
just --versionRun The Bundled Example
From this repository:
cd examples/linewise
just clean
just build
just buildExpected behavior:
- The first build creates
build/message.upperanddist/message.txt. - The second build still runs the
justrecipe chain. - Each
cxline reports that its declared output is fresh:
up-to-date: build/message.upper
up-to-date: dist/message.txtInspect the result:
cat dist/message.txtExpected output:
Result: HELLO FROM CXRecreate The Example From Scratch
You do not need this repository to try the mental model. Create a new directory:
mkdir cx-demo
cd cx-demo
mkdir -p data
printf 'hello from cx\n' > data/message.txtCreate a Justfile:
set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
default: build
prepare:
mkdir -p build dist
build: prepare
cx --in data/message.txt --out build/message.upper -- bash -c 'tr "[:lower:]" "[:upper:]" < data/message.txt > build/message.upper'
cx --in build/message.upper --out dist/message.txt -- bash -c 'printf "Result: " > dist/message.txt; cat build/message.upper >> dist/message.txt'
clean:
rm -rf build dist .cxRun it:
just build
just buildThe first run executes both commands. The second run prints:
up-to-date: build/message.upper
up-to-date: dist/message.txtNow change the input:
printf 'changed input\n' > data/message.txt
just build
cat dist/message.txtExpected output:
Result: CHANGED INPUTOnly the cx lines decide whether to rerun. The prepare recipe remains a
plain just recipe and still runs normally.
Inspect The Static View
From a directory with a Justfile, run:
cx graphcx graph uses just --dump --dump-format json and reports the linewise cx
calls it can see. Plain recipe lines are left alone.
Run:
cx lintThe MVP lint pass checks basic cx line shape, such as requiring at least one
--out.
What To Look For
After running a cx line, a .cx/ directory appears:
.cx/
state.jsonThat file records the declared output set, command identity, input stamps, and output hashes. It is runtime state and should not be committed.