CLI

Every lesson in this course builds one system: a stablecoin reserve attestation registry that discovers issuers, reads the PDFs they publish, and refuses to publish a field it could not read. What it is and where this lesson sits.

Tier
1 Noob
Build position
4
Throughlines
D Execution surface · E Tool surface and trust boundary · B Instruction packaging
Verdict
existing practice
Commit
fdb36ab
Demo
scripts/terms/demo-06.ts
Runs in
the course repository

The CLI is the registry's front door: one executable that every later term calls, by hand at first and later with nobody watching. Line D is execution surface, and this is its attended end, the rung terms 17 and 18 take supervision away from. The reason it gets a slot of its own is that it is the first surface in the repo something other than a human will call, and that changes what it owes its caller.

The mechanism

One rule shapes src/cli.ts: every command that could spend declares a budget first, and the budget is refused before the request is built rather than reported after it returns.

--budget has no default. This is the load-bearing decision in the file. A default budget is a budget nobody chose, and the first run where that matters is the run that overspends. The error says so rather than quietly substituting a number:

$ reserve-registry plan --offline
  --budget is required and has no default.
  A default budget is a budget nobody chose, and the first time it matters is
  the run that overspends.
  -> exit 1

Exit codes are a contract, because a tool that will be called from a Makefile now and from CI at term 28 needs one. Zero is success, one is refused or failed, two is misuse. Distinguishing the last two matters: a caller that cannot tell "you asked for something impossible" from "you typed the flag wrong" will retry the second one forever.

Build it

Three commands. discover prints the universe with its provenance. plan prices the classification work without sending any of it. scan runs the credential scanner over tracked files and exits non-zero on a finding, which is what makes it usable from a hook at term 15.

discover reports consumed: 0 with an explanation attached, rather than a reassuring zero on its own. A zero with no reason is indistinguishable from a counter that was never wired up.

The receipt

artifacts/06-cli.json is a real captured session over all five paths, with actual stderr and actual exit codes. The demo fails if any exit code drifts, so the contract is tested rather than documented.

The interesting line is in the success case:

$ reserve-registry plan --budget 20000 --offline
  charged 17782 (estimate x1.15), reference says 12322

That is term 3's finding showing up where it costs something. The CLI charges 17782 against a true cost of 12322, so a 15000-token budget would refuse a job that fits comfortably. The fix belongs to term 3, scaling the estimator by 0.798 and dropping headroom to 1.01, and it is deliberately not applied in this commit so the two stay separable and this unit can show the before.

Where it overlaps

Line D is execution surface: this is where the work stops being something you type and starts being something that can be invoked. Line E is the trust boundary, and the CLI is where the credential from term 5 is read or refused. Line B is instruction packaging, escalated: a flag is an instruction with a contract attached, and unlike a sentence in a prompt it either parses or it does not.

A personal teaching project, in development. The registry it builds is a teaching artifact and is not an assurance opinion about any issuer. Not affiliated with or endorsed by any employer, or by any vendor whose tools it describes. Where a unit depends on a specific flag or path, it names the version it was verified against. All units.