Expand description
The agent-safe workflow commands (harness #140): fz plan, fz deploy --plan <digest>, fz add, fz init and fz verify. They
work on the venture manifest — the desired composition — and two
on-disk records: the migration lockfile (.harness-lock.json) and
the deploy record (.harness-deploy.json) that fz deploy writes.
They never run wrangler, never touch a database and never prompt:
turning the recorded composition into a running Worker stays with
worker-build and wrangler deploy, and applying migrations stays
with fz migrations collect / wrangler d1 migrations apply — the
same needs-human boundary fz build draws.
Every command speaks the two disciplines fz doctor --json
established (harness #140). With --json it prints exactly one JSON
object on stdout — schema 1, ok, the failures each carrying a
stable code from crate::codes — and nothing else. Without it the
output is prose for the operator. --non-interactive is accepted on
every command: the workflow never prompts by construction, so the
flag’s one effect is suppressing the human next: steps from prose
output; anything that would need a human is a coded refusal, never a
blocked process.
PlanContent is the whole normalised plan; its sha256 (fz plan --json’s digest) is the approval token. fz deploy recomputes the
plan from the current inputs and refuses any other digest — a stale
approval cannot deploy — and records the plan it applied. fz verify diffs that record against the manifest and reports the drift
as coded failures in the doctor’s JSON shape.
Structs§
- AddOutcome
- The outcome of
fz add. - Baseline
- What the plan diffed against, and the slugs it saw there.
- Capability
- What one added module needs, as the catalog declares it.
- Consent
- The two consents
fz deploycan require, kept apart on purpose. - Deploy
Outcome - The outcome of
fz deploy. - Deploy
Record - A recorded deployment.
planis the fullPlanContentthat was applied, sofz verifycan name precisely which part of the manifest drifted, and a stalefz deploycan name what moved. - Migration
State - Migration status, read from the lockfile. The manifest world cannot
know whether a module ships migrations at all — only what has been
collected — so
not_collectedmeans “no locked migration exists”, phrased exactly that way in output. - Plan
Content - The full plan: the destination (
PlanState, flattened on the wire, the only part the digest hashes) plus the deltas against the current baseline — the deploy record when one exists, else the modules the migration lockfile knows. Every list is sorted and every map ordered, so output is a pure function of the inputs. - Plan
Outcome - The outcome of
fz plan: the normalised content and its digest. - Plan
State - The destination a plan describes: what the venture will become,
independent of what it is now. The sha256 over this struct’s JSON
is the plan digest — the approval token — because an approval is of
the destination, not of the journey: the baseline-dependent deltas
(
PlanContent’s added/removed lists) describe the journey and change the moment a deployment is recorded, so hashing them would make every deploy stale by its own success. - Selected
Module - One manifest module reference, normalised: the slug and its per-module config (empty for the bare-slug form).
- Verify
Outcome - The outcome of
fz verify: the doctor-shaped report plus the recomputed digest when the manifest resolved far enough to compute one.
Constants§
- RECORD_
FILE - The deploy record
fz deploywrites next to the manifest: the plan it applied, bound to the digest that approved it. - SCHEMA
- The
schemafield of every workflow JSON object — the same wire contractfz doctor --jsoncarries (crate::doctor::REPORT_SCHEMA).
Functions§
- add
fz add <module>: adds a module to the manifest’s desired composition and nothing else — it never deploys, never provisions and never touches a database. Adding a module the manifest already lists is a no-op that succeeds withchanged: false.- add_cli
- The
fz addCLI entry: both output disciplines. - deploy
fz deploy --plan <digest>: applies exactly the approved plan — by recording it, bound to its digest, in.harness-deploy.jsonbeside the manifest. It refuses:- deploy_
cli - The
fz deployCLI entry: both output disciplines. - init
fz init: writes a new venture manifest — name and host, no modules yet. Refuses to overwrite an existing manifest unless--force.- init_
cli - The
fz initCLI entry: both output disciplines. - plan
fz plan: describes what the manifest would change, and nothing else. Read-only by construction — nothing here touches the disk beyond reading its inputs.- plan_
cli - The
fz planCLI entry: both output disciplines. - verify
fz verify: diffs the recorded deployment against the manifest and reports every drift as a coded failure in the doctor’s shape — composition, config, environment, and (when nothing narrower explains it) the recorded digest no longer matching a recomputed plan.- verify_
cli - The
fz verifyCLI entry: both output disciplines. The JSON shape is the doctor’s, byte for byte.