Skip to main content

Module bridge

Module bridge 

Source
Expand description

The workflow bridge: the command graph projected into recipes.

just is an ergonomic front door, not a place where commands are declared. Every recipe this writes is one line that runs the canonical program with the caller’s own arguments — never a second implementation, never a second description, and never a call back into just, which is what would make the bridge a cycle.

  CommandGraph ──► render ──► bridge.just ──► imported by the root justfile
                      └─────► bridge.json  (what was written, and from which graph)

§Where it lives, and why not in the tree

Under .ai/local/cache/, which no commit carries. A generated file in the tree would have to be regenerated by whoever changes a command, checked by a gate, and merged by hand on every branch that touches the command line — for a file that is a pure function of the tree it sits in. The materialisation is cheap and fingerprinted, so the cost of not tracking it is one hash comparison per entry into the repository.

§Argument forwarding

Interpolating a recipe’s arguments into the body — {{args}} — splices text into a shell command, so a path with a space arrives as two arguments and a quote arrives as a syntax error. The runner’s own answer is set positional-arguments, which passes a recipe’s arguments to the shell as $1, $2, …; the body then forwards "$@" and the shell’s own quoting carries spaces, quotes, $(…), newlines and leading dashes unaltered. Nothing here escapes anything, because nothing here interpolates anything.

Structs§

Manifest
What a materialisation wrote, and from what.
Outcome
What happened.

Constants§

BRIDGE
The file the root justfile imports.
DIRECTORY
The directory the bridge is materialised in, relative to the repository root.
MANIFEST
The record of what was written, and of the graph it was written from.
MANIFEST_SCHEMA
The schema of that record.
REQUIRED_SETTING
The setting the root justfile must carry for the forwarding in every recipe to be safe.

Functions§

bridged
The recipe names the last materialisation wrote; empty when there was none.
inputs
The files the bridge is derived from.
is_current
Is the materialised bridge derived from the declarations as they stand?
manifest
Read back what the last materialisation wrote, if anything.
materialise
Write the bridge and its manifest, atomically, and only when the graph changed.
recipe_names
The recipe names this graph projects.
render
Render the bridge.
stamp
A stamp over those files: size and modification time, in a fixed order.