The Three Commands

The loop judges your project by running three recipes in your repository: run, certify and demo. The verdict is the exit code.

On this page

The loop judges your project by running recipes from the justfile in your repository. The verdict is the recipe’s exit code. Zero passes, and anything else fails.

That is the whole contract between the loop and your code. A project in any language can meet it.

The recipes#

RecipeWhen the loop runs itWhat it should do
just run <dir>After a test is written, and after a coder’s turnRun the tests
just certify <dir>Before reviewRun every check a change must pass: tests, lint, static analysis
just demo <dir>At a journey’s demo stepWalk the journey in a browser and keep the screenshots

<dir> is a folder the loop makes for that one run. Write your reports there.

Recipes for the working copy#

Each work runs in its own git worktree. Two more recipes prepare it and clean it up.

  • just copy-setup makes a fresh worktree runnable: install dependencies, create its test database.
  • just copy-teardown removes what copy-setup made, before the worktree is deleted.

Optional recipes#

  • just ci runs when the loop needs a CI verdict and no outside CI reports one.
  • just retry runs when CI fails, to tell a flaky test from a broken one.

The loop checks which recipes exist with just --show <name>. It skips an optional one you have not written.

What a recipe is given#

Every recipe gets these in its environment:

  • CODEMYSPEC_PLUGIN: the absolute path of the plugin folder in use, so a recipe can call the plugin’s own scripts.
  • EVIDENCE_CONTEXT: run/<work id> or certify/<work id>.
  • EVIDENCE_CORRELATION: one id for this run.

Evidence#

A recipe can leave evidence for the reviewer and for the control plane.

  • Write findings as SARIF files to .code_my_spec/evidence/*.sarif.
  • Write screenshots and other files into a new folder under .code_my_spec/evidence/.

After run and certify, the loop uploads what is new and deletes its local copy. With no server connected it logs one line and carries on.

An example#

run dir:
    mix test

certify dir:
    mix format --check-formatted
    mix credo --strict
    mix test

copy-setup:
    mix deps.get
    mix ecto.setup

copy-teardown:
    mix ecto.drop

Next#

Stuck, or is this page wrong? Write to contact@codemyspec.com and a person answers.