Day-to-day workflow¶
The commands you use every day, and the flags that matter.
Testing¶
rig test runs the :test alias of the target module. The exec-fn
recorded in the lockfile gives the command. Without -p, Rig runs every
module that declares a test exec-fn, in dependency order.
Pass extra arguments as EDN literals. Rig forwards them to the test runner as key/value opts:
Rig supports keywords, strings, numbers, booleans, vectors, and maps. Any
option your runner accepts works, exactly as it works with clj -X:test.
The exit code of the child process becomes Rig's exit code: a failing test
suite fails your shell.
A module participates when its :test alias declares an :exec-fn. Rig
skips modules without one.
Running code¶
rig run launches the :rig/main of the module on its locked classpath.
Program arguments are plain strings. To keep program flags from acting as
Rig flags, separate them with --:
rig run -p modules/orchestrator # no program args
rig run -p modules/orchestrator -- --env dev # flags for the program
--alias <name>runs on the classpath of a different alias, for example a:devalias with reloaded REPL tooling.- Rig applies the JVM options of the module and the alias.
- The working directory is the module directory.
The escape hatch: rig exec¶
When Rig has no verb for your task — a script, a linter, a database
client — rig exec runs any command with the locked classpath of the
project exported:
The command inherits:
CLASSPATH— the locked classpath of the module (alias included);JAVA_OPTS— the JVM options of the module and the alias, if any;- the module directory as working directory.
The exit code of your command becomes Rig's exit code.
Code hygiene¶
rig lint # clj-kondo (from PATH), project config
rig lint -p modules/app
rig fmt # cljfmt (the version pinned in the kernel)
rig fmt --check # CI: report without fixing
rig clean # remove target dirs of all target modules
rig clean -p modules/app
lint needs clj-kondo on your PATH. It works without a lockfile, because
it lints source. fmt uses the cljfmt pinned inside the kernel jar of Rig,
so everyone formats with the same version. It also works without a
lockfile.
What every hot command does first¶
test, run, repl, exec, and build apply the same lockfile
discipline before they launch anything:
- no lockfile →
no lock at /home/dev/app/deps.lock (run 'rig lock'), exit 3; - manifest changed → in development, Rig re-locks silently and prints
relocked (stale: <modules>); with--frozen, Rig fails with exit 3 instead; - Rig hash-checks every classpath artifact against the lockfile, securing
it from the cache or a checksum-checked
~/.m2. Rig downloads missing artifacts unless--offline.
So you can run rig test from a dirty checkout: you get either the locked
behavior or an explicit, visible re-lock — never a quiet re-resolution.
Module targeting¶
-p, --path <module> targets one module by its directory
(-p modules/orchestrator) or by a path to it. If you omit it (or pass
-p .), the command targets the root module; for multi-module commands,
it targets all modules in dependency order. Every command that takes a
module accepts -p.