How to use these is in Work on the terminal interface with worlds and journeys; what the command shows is in The terminal interface.
Crates
capdag-rs is one Cargo workspace of three crates.
| Crate | Directory | Holds |
|---|---|---|
capdag |
. |
The library: URNs, the fabric, planning, execution, cartridge hosting. No terminal code. |
capdag-tuikit |
tuikit/ |
The command’s terminal interface: every command, flag and surface (cli), the full-screen graph (tui), and the worlds and journeys (scenario), with the capdag-tuikit binary. |
capdag-cli |
cli/ |
EngineHost, the Host on the engine, and the capdag binary, which runs capdag-tuikit’s command line on it. |
capdag_tuikit::cli::run_command_line(argv, host) runs a command line on any
host and answers the process’s exit status; capdag_tuikit::cli::run(host)
runs the process’s own. The library’s test-fixtures feature gives a crate
built on it the builders the library’s own tests use.
Host
capdag_tuikit::cli::host::Host is what a command asks of the engine. The
command decides everything shown and says every word; a host answers with
capdag’s own types, and a failure is the engine’s own error.
| Method | Answers |
|---|---|
bind_fabric(flag) |
Points the process at the fabric --fabric names, else the environment’s, else the host’s own |
fabric_anchor() |
Where that fabric is read from |
open_fabric(offline, afresh) |
The fabric’s registry; afresh fetches the manifest and what it pins anew, offline fetches nothing |
clear_fabric_cache() |
Removes the local copy without opening it; the folder it was in |
cartridge_registry() |
The cartridge registry installed from, or None for a build bound to none |
has_bundle() |
Whether cartridges are bundled with the command |
bundled_cartridges() |
The bundled cartridges, each held to the build’s signed bundle manifest |
bundled_providers(cap) |
The bundled cartridges that declare cap |
bundled_adapter_groups(registry) |
The bundled cartridges with the adapter groups they inspect files by |
installed_cartridges() |
The cartridges in the per-user folder, and those discovery refused |
cartridge_store() |
The registry’s store: has(id), providers_of(cap), install(id) |
remove_cartridge(id) |
Every installed version removed, or that the cartridge is bundled |
find_dev_cap(alias) |
The dev cartridge whose cap has alias, and its directory |
dev_project_entry(project) |
A cartridge project’s built entry point |
dev_entry_manifest(entry) |
What a built entry point says it provides |
install_dev_cartridge(project, manifest) |
The project installed under the dev slot; its version directory |
probe_cap_groups(entry) |
What a staged cartridge advertises when started |
self_update(current) |
The command replaced by its channel’s latest release: from and to |
runtime(setup) |
A RunHost for one command’s runs |
RunHost hosts one command’s runs: spawn starts a strand, reporting every
signal to the run’s observer and obeying its RunControl; finish writes what
a strand produced (with capdag::orchestrator::cli_session::emit_strand when
nothing of it was written as it ran) and reports how it went;
stop_live_inputs closes live inputs; inspect asks a cartridge what a file
is. A HostError is NoHome, File { path, done, detail } or
Engine(message).
The capdag-tuikit binary
| Command | Does |
|---|---|
capdag-tuikit --world <W> [--speed N] -- <capdag args> |
Runs the capdag command line on world W in the working directory |
capdag-tuikit list |
The worlds and journeys |
capdag-tuikit check |
Everything wrong with the worlds and journeys; exits 1 when there is any |
capdag-tuikit journey <ID> [--mode M] [--step] |
Plays a journey on this terminal: its first mode, or M |
capdag-tuikit journey <ID> --check [--mode M] |
Plays it unwatched in every mode it declares, or M, and says what each came to |
capdag-tuikit world files <W> <DIR> |
Writes world W’s files into DIR |
capdag-tuikit world fabric --out <FILE> [--anchor <URL>] |
Snapshots the fabric at URL (default: the build’s) |
--scenarios <DIR> reads worlds, snapshots and journeys from DIR instead of
tuikit/scenarios/. --speed N plays runs N times as fast as their scripts’
waits (default 1). A world’s cartridges are said to be under
.capdag-world/ in the working directory; nothing is written there. A world
starts no cartridge binary and speaks no protocol, so a run given --dev-bin
or --trace is refused there, saying so, and so is asking a cartridge what a
file is.
Scenarios
tuikit/scenarios/
fabric/<name>.json fabric snapshots
worlds/<name>.json worlds
journeys/CJRN-nnn.json journeys
Fabric snapshot
| Field | Holds |
|---|---|
anchor |
The fabric it was taken of |
manifest_version |
The manifest it was taken at |
caps |
Every cap of the manifest, as the fabric publishes it |
media |
The media definitions the command reads: file types, live sources, the types caps’ inputs and outputs end on, and those caps’ arguments and outputs and aliases name |
aliases |
Every alias of the manifest |
World
| Field | Holds |
|---|---|
description |
What the world is for, in a sentence |
fabric |
Its snapshot: a file of fabric/ |
unreachable |
When given, the fabric cannot be reached, for this reason |
cartridge_registry |
The registry the command is bound to; absent for a build bound to none |
bundled, installed, store |
Cartridges: { "id", "version", "caps": [aliases], "dev": bool, "install_ms": n } — dev for a dev cartridge, install_ms how long installing one from the store takes |
refused |
Installed cartridges discovery refuses: { "id", "version", "reason" } |
files |
The working directory’s files, by path: their text |
refused_machines |
The machine files among files that are there to be refused |
runs |
A run script for each run, by its caps’ aliases in the order they run (a > b) |
update |
What capdag self update finds: { "latest": { "version" } } or { "fails": { "reason" } } |
dev_projects |
Cartridge projects, by the directory capdag dev install is given: { "built": { "name", "version", "caps": [aliases], "own_caps": [{ "urn", "title", "aliases" }] } } or { "unbuilt": "why" } |
unstartable |
Staged cartridges that do not start when asked for their caps: { "id", "version", "reason" } |
A staged cartridge that is not unstartable answers with the caps of the
world’s cartridge of its id and version.
Run script
| Field | Holds |
|---|---|
signals |
What the engine says while the strand runs, in order |
end |
How it ends |
on_stop |
{ "signals", "end" } played instead of the rest once the run is asked to stop |
machine |
The machine, in notation, when it is no machine file of the world and not one cap run on its own |
| Signal | The engine’s |
|---|---|
{ "wait": ms } |
Nothing said for ms milliseconds at speed 1; an abort ends the run during a wait |
{ "progress": { "value", "message" } } |
Run progress, 0 to 1 |
{ "step": { "step", "progress" } } |
A step’s progress; a map’s, under the map’s name |
{ "log": { "step", "level", "message" } } |
A log line, of a step or (without step) of the machine |
{ "items": { "map", "items": [texts] } } |
The next items a map’s body runs on, by the text each begins with |
{ "outcomes": { "map", "ended": [{ "item", "ok", "error" }] } } |
Every item of the map that has ended so far |
{ "report": { "step", "item", "outcome" } } |
What became of a step that did not run once and complete; item for a step in a map’s body |
An outcome is { "tolerated": { "failure", "earlier": [failures] } },
{ "retried": { "earlier": [failures] } } or { "skipped": { "absent": [names] } }.
A failure is { "class", "code", "message" }, its class one of input,
resource, environment, internal and user.
An end is { "completed": { "outputs": { media: value } } } — a text for one
value, a list of texts for a sequence, null for an output not produced — or
{ "failed": { "step", "failure" } }.
Steps are named by their cap’s alias, maps by their body’s aliases joined by
` → , and outputs by the media type each holds as capdag check` names it.
Journey
| Field | Holds |
|---|---|
title |
What a person does, in a sentence |
world |
The world it is done in |
args |
The capdag command line, after capdag |
modes |
For each mode it is run in: { "keys": [...], "expect": {...} } |
| Mode | stdin | stdout | stderr | Environment |
|---|---|---|---|---|
full_screen |
terminal | terminal | terminal | TERM=xterm-256color, no CI |
inline |
terminal | pipe | terminal | TERM=xterm-256color, no CI |
plain |
empty | pipe | pipe | CI=1 |
json |
empty | pipe | pipe | CI=1, --json before args |
In every mode the command runs in the journey’s directory, which is also its
TMPDIR: what it keeps in a temporary directory goes with the journey.
The terminal is 100 columns by 32 rows. Each key is { "wait": text } (until
the screen shows it, for up to 60 s), { "press": key } — a character,
Enter, Esc, Tab, Backspace, Up, Down, Left, Right, Home,
End, PageUp, PageDown, Space or Ctrl-<letter> — or
{ "type": text }.
expect |
Holds |
|---|---|
exit |
The exit status |
stdout |
Texts stdout holds |
shown |
Texts stderr holds on pipes, or the screen shows at the end on a terminal |
absent |
Texts neither holds |
screen |
On a terminal only: the screen at the end, whole — every line from the top row to the last row with text, as a person copies it (a line the terminal wrapped is one line, and spaces at a line’s end are not part of it); a blank row is an empty line. {dir} stands for the journey’s directory, and {*} for any text, such as how long a run took |
The journey tests play journeys at 20 times their scripts’ speed.
What the check holds
capdag-tuikit check, and the journey tests, refuse:
- a world whose cartridges or dev projects name a cap its snapshot lacks;
- a world file with an extension of no file type its snapshot holds;
- a machine file that does not plan against the snapshot, unless it is in
refused_machines, and one inrefused_machinesthat plans; - a script for a run no machine of the world, no
machineand no single cap makes; - a script naming a step, map or output its plan lacks, or one whose signals, played into the run view’s model of a run, are what no run can say: a report a step in its state cannot have, an item outcome for a run with no map, an end a run cannot come to — as it runs and as it runs when stopped;
- a journey in a world there is not, or in no mode.
TEST22284 to TEST22288 hold the snapshot’s aliases, every journey, the check
and its refusals; TEST22289 holds how a journey’s screen is met, and
TEST22290 that a closed stdout ends the command quietly.