Skip to main content

Module client_ts

Module client_ts 

Source
Expand description

fz client-ts (issue #155): a /__surface contract document in, the files of a typed @cratefield/client package out, written to --out.

The other harness-free commands work on what a venture has — a manifest (fz build), a migration directory, its environment (fz push). This one works on what a venture serves: --surface names the JSON the running venture publishes at /__surface, or - to read the body off stdin, so a client can be generated without checking the venture out at all:

curl -s https://venture.example/__surface | fz client-ts --surface - --out ./client

Generation itself is cratefield_client_ts::generate — pure, deterministic, no I/O — so this module is only the I/O around it: read the document, write the files, and say which of the two failed in the doctor’s coded shape (--json prints exactly one object on stdout, every refusal carrying a stable code from crate::codes).

Structs§

Generated
What a successful run did: the generated package’s identity and the files it wrote, in write order.
Refusal
A refused run: its stable code from the catalogue (crate::codes) plus the human message, which is exactly what the prose path prints after fz: .

Constants§

SCHEMA
The schema field of the fz client-ts --json object: consumers branch on it, so it only ever grows. The same wire contract fz doctor --json carries (crate::doctor::REPORT_SCHEMA).

Functions§

client_ts
The whole command minus the argv plumbing: read the document, generate the package, write it under out. Public so the acceptance tests can pin the messages and the JSON payloads the two disciplines print without driving argv.
from_document
Generates and writes from a document body — the seam client_ts reaches once it has read --surface. described is how a refusal should name the document (“the document on stdin”, or the path it was read from).
run
Runs fz client-ts in the prose discipline: the summary on stdout, a refusal as the message finish prints after fz: . source is the --surface value — a path, or - for stdin.
run_json
Runs fz client-ts --json: exactly one JSON object on stdout, nothing else on either stream, and the verdict as the exit code.