docs

  zegit · proves

zg CLI reference

The complete zg command surface — the developer and agent-facing CLI. Documented from the source, not the design prose.

Code is authoritative

Where product/architecture documents describe a richer design than what ships (for example a zg build command), this reference follows what the binary actually does today — zg --help at v0.0.173.

Top-level commands

CommandDescription
zg versionShow version, commit, build time.
zg updateSelf-update from the latest release on github.com/zegit-zoo/zg; verifies the checksums signature with the Control Plane's artifact key first. --check only reports.
zg initBootstrap a repo: .zegit/config.yaml, ZEGITFILE, .zegit/agents/, the pre-push hook, and the wired gateway remote. --solo for a one-person repo.
zg authLocal IAM / Control-Plane auth: init-ca, enroll, login, status, ssh-cert, logout, automation-*.
zg validateRun the pipeline, assemble an AoV, evaluate policy, sign into refs/zegit/aov/<sha>.
zg pushPush a ref with before/after verification of the remote; --wait-forward waits until the forges mirror it.
zg verify-forwardCheck that a ref reached every forge remote (forwarding is asynchronous).
zg evidenceEvidence record ops: evaluate, keygen, sign, verify, bundle, verify-bundle, verify-aov.
zg aovInspect the AoV of a commit (verdict under both clocks); mirror AoV refs into the Control Plane.
zg trTag Requests with quorum: create, list, get, approve, finalize, watch, withdraw, reject, invalidate.
zg policyRelease policy as a protected ref: show, scope, inspect, propose, approve, activate, withdraw, request-activation.
zg auditVerify shipped audit-log batches offline — from files, an export zip, or straight from the bucket.
zg git / zg git-shimOpt-in git mode: a git shim that routes gateway pushes and release tags through zegit; everything else is plain git.
zg sshThe core.sshCommand for wired clones — zegit's certificate and pinned host key for the gateway host only, plain ssh elsewhere.
zg install skillInstall the bundled agent skill into local tooling (--agent claude).
zg revertOwner-only break-glass revert to a safe tag.
zg breakglass / zg canaryOwner ceremonies: provision and drill the sealed break-glass owner, and plant canary automation identities that page on use.
zg ceremonyCA key ceremony — generate the ZeGit Root CA, the quorum-verdict key pair, or run the YubiHSM ceremony.

A global --json flag is available on commands for machine-readable output; the JSON contract is stable within a major version (fields are added, never renamed or removed). Any zg subcommand that is not a zg verb is handed to git unchanged.

zg validate

The core loop. Resolves HEAD's commit and tree, loads .zegit/config.yaml, runs each step with a streaming transcript, computes a policy digest over .zegit/config.yaml + ZEGITFILE, assembles the record, evaluates policy, and — unless blocked — signs a DSSE AoV to refs/zegit/aov/<commit>. It refuses up front when the committed .zegit/config.yaml is not the pipeline the ZEGITFILE pins, and warns when the zg binary was built from a dirty tree (the gateway rejects such release evidence).

terminalbash
zg validate                     # sign an AoV for HEAD
zg validate --risk review       # set the risk policy: allow | review | block
zg validate --no-sign --json    # evaluate only; print the decision
zg validate --key dev.key       # sign with an explicit key
zg validate --trust             # record this repo's pipeline as trusted on this machine
                                # (required when ZEGIT_VALIDATE_REQUIRE_TRUST=1)

Exit codes

CodeMeaning
0ALLOW
10REQUIRE_REVIEW
20BLOCK (a required step failed, or risk blocks)
1 / 2IO/exec error / usage error

zg auth

Two modes: local IAM (a single-machine simulation, no ZEGIT_CP_URL) and Control-Plane mode (when a CP URL is configured).

SubcommandDescription
auth init-caCreate a local CA root (ca/root.crt, ca/root.key).
auth enrollEnroll a passkey and record an identity + role.
auth loginWebAuthn ceremony → a short-lived leaf cert at cert/cert.pem; in CP mode also a gateway SSH cert and the pinned gateway host key. --validity narrows the window; --org scopes the leaf to one organization; ZEGIT_NO_BROWSER=1 prints the URL.
auth statusShow the current cert: identity, role, expiry.
auth ssh-certFetch a gateway SSH user certificate for the current session (ssh/id_zegit{,-cert.pub}).
auth logoutEnd the session on this machine (cert, key, CP cookie, SSH cert); --purge removes the enrolment too.
auth automation-keygenGenerate an ed25519 automation keypair.
auth automation-registerOwner registers an automation pubkey at the CP (--role developer|provisioner).
auth automation-loginPasswordless cert issuance for agents (challenge → sign → login).
terminalbash
zg auth login
zg auth status --json
zg auth enroll --identity jonas@acme --role maintainer
zg auth enroll --canary          # CP mode: a decoy invitation that pages when redeemed

The store is $ZEGIT_HOME, else $XDG_CONFIG_HOME/zegit, else ~/.config/zegit. An optional config.json there sets cp_url and identity; ZEGIT_CP_URL wins when both are set.

Login cert validity scales with role

Default login cert lifetimes are developer 8h, maintainer 1h, owner 5m — the more privilege, the more often you touch the passkey. The full model, including delegating a login cert to an agent, is on Identity & certificates.

zg evidence

The lower-level evidence pipeline — it mirrors the envelope state machine (unsigned → validated → signed).

SubcommandDescription
evidence evaluateEvaluate a record against the policy engine; --stamp writes a validated envelope.
evidence keygenGenerate an ed25519 keypair (PKCS#8 + PKIX PEM); prints a key_id.
evidence signSign an evaluated record into a DSSE envelope.
evidence verifyVerify a signed AoV DSSE envelope.
evidence bundleAssemble a CRA Evidence Bundle for a release tag (--tag, --prev, --sbom, --out); exits 20 with ZG_ERR_EVIDENCE_INCOMPLETE when a commit in the range lacks a valid AoV unless --allow-incomplete.
evidence verify-bundleVerify a bundle offline against a Root CA (fail-closed: no resolvable root is an error).
evidence verify-aovVerify the AoV at refs/zegit/aov/<commit> against a CA root — strictly at now, then on the accepted-evidence clock.
terminalbash
zg evidence keygen --out .zegit/keys/dev
zg evidence evaluate run.jsonl --stamp validated.jsonl --risk allow
zg evidence sign validated.jsonl --key .zegit/keys/dev.key --out aov.dsse
zg evidence verify aov.dsse --key .zegit/keys/dev.pub

See CRA & compliance for the bundle commands in context.

zg tr — Tag Requests

The human-in-the-loop release gate. TR refs live at refs/zegit/tr/<tag>; approvals at refs/zegit/tr/<tag>/approvals/<keyid>.

SubcommandDescription
tr create <tag>Open a TR at a commit (default HEAD); threshold/roles from ZEGITFILE. Refuses a commit that is not on master unless --allow-off-master.
tr listList open TRs and their quorum status (local refs only — tr get asks the Control Plane).
tr get <tag>Show a TR, its approvals, and the authoritative quorum verdict.
tr approve <tag>Approve with a fresh passkey touch (or approve in the Control Plane's Tag Requests page).
tr finalize <tag>Create the signed annotated tag once the Control Plane confirms quorum for that exact commit.
tr watch <tag>Poll finalize until quorum is met; --push <remote> then pushes the tag with ref-advance verification.
tr withdraw <tag>Retract your own open request (nothing is deleted).
tr reject / tr invalidate <tag> --reasonOwner/maintainer verdict that closes the request with the reason on record.

The creator can't self-approve

The creator's own approval never counts toward quorum unless the repo sets allow_aov_self_approval: true. zg tr finalize exits 30 (ZG_ERR_QUORUM_NOT_MET) if quorum isn't met; zg tr watch exits 31 when its window closes with quorum still unmet.

zg policy — release policy as a protected ref

Once a policy is activated at refs/zegit/policy it — not the tree's ZEGITFILE — decides how releases are gated, and replacing it always needs two distinct owner approvals (the very first activation needs one). The ZEGITFILE stays the proposal source. With ZEGIT_CP_URL set, proposals and approvals are mirrored to the Control Plane's Policy Center; the git ref stays authoritative.

SubcommandDescription
policy showPrint the active policy and its blob; --org <slug> shows an organization baseline.
policy scopePrint the validation: block that pins the current .zegit/config.yaml (digest + required step ids) — append it to ZEGITFILE, then propose.
policy proposeSign HEAD's ZEGITFILE as a proposal replacing the active policy; --org proposes an organization baseline.
policy inspect <blob>Decode a proposal: policy, proposer cert, verdict, approvals on file, and what activate would do (--diff).
policy approve <blob>Sign an owner approval (other roles are refused — they would never count).
policy activate <blob>Point refs/zegit/policy at the proposal once the owner quorum holds; --push <remote> pushes approvals and the ref together.
policy withdraw / policy request-activation <blob>Control-Plane-only: retract a proposal, or ask the hosting gateway to activate it once quorum holds.

zg aov

zg aov inspect [<commit>] shows everything an approver or auditor should see for one commit: the decoded record (subject, steps, decision, policy digest, actor, producer), the signer's certificate, the verdict under both clocks, and the tree cross-check. Exits 20 when the commit has no AoV — fetch them first with git fetch gateway 'refs/zegit/aov/*:refs/zegit/aov/*'. zg aov mirror backfills the Control Plane's Attestations page from local AoV refs; it is idempotent and the CP refuses envelopes that do not verify against its trust root.

zg push & zg verify-forward

zg push <remote> <refspec> pushes with the companion AoV ref in the same transaction, retries a transport that died after the pre-push gate, and verifies the remote ref actually advanced. zg verify-forward <ref> checks the ref reached every forge remote — forwarding from the gateway to GitHub and Gitea is asynchronous.

ExitMeaning
4A remote holds a non-ancestor sha (diverged).
5Missing, behind, or unreachable — retry class.
6Push reported success but the remote ref did not land on the expected sha.
7The tip has no AoV anywhere — run zg validate first.

zg init

Bootstraps a repo and installs a guarded pre-push hook. The hook pushes refs/zegit/aov/*, and for each refs/tags/v* being pushed it verifies a matching TR ref exists (else aborts) and pushes it first. Idempotent and composes with an existing hook. After a Control-Plane login it also writes the wired-clone setup into the clone's own .git/config: a gateway remote using the zegit-gateway: URL prefix and core.sshCommand = zg ssh.

terminalbash
zg init                 # current repo
zg init --repo . --force
zg init --solo          # allow_aov_self_approval: true for a one-person repo
zg init --slug org/repo # registry slug for the gateway remote (default: from origin)

zg git-shim — zg as your git

Opt-in drop-in: zg git-shim install writes a git shim (default ~/.local/bin/git; put that directory first on PATH). In a governed repo — one with a ZEGITFILE — git push gateway … then validates a commit without an attestation before pushing, and git tag vX.Y.Z (any name matching tag_request.release_tags) opens a Tag Request instead of a local tag. Every other git command is untouched; zg git … is always plain git; zg git-shim status / uninstall report and opt out. Commits are not wrapped — that ceremony stays in hooks.

zg update & zg audit

zg update installs the latest release from github.com/zegit-zoo/zg after verifying the checksums signature against the Control Plane's artifact key and the archive's sha256 against the checksums (cosign on PATH); --check only reports, --forge gitea --forge-url reads an internal mirror. zg audit verify checks shipped audit-log batches offline — DSSE signature on each batch's Merkle root, root recomputation, intra- and cross-batch chain linkage — from files, an export zip, or straight from an S3 bucket with a read-only key.

zg revert & zg ceremony

zg revert <tag> is an owner-only break-glass: it restores the tree to a safe tag, requires a passkey touch, signs an AoV, and resets HEAD. zg ceremony generate produces the ZeGit Root CA (root.crt + root.key, default validity three years) and prints the key-ceremony next steps; zg ceremony quorum-key generates the Control Plane's quorum-verdict key pair, which every gateway needs to verify tag verdicts; zg ceremony hsm runs the two-custodian YubiHSM ceremony.

terminalbash
zg revert v0.9.0 --message "roll back the bad release"
zg ceremony generate --cn "ZeGit Root CA" --out ./ceremony
zg ceremony quorum-key --out ./ceremony

Authoritative reference, generated from the component repos. Spot something stale? Tell us.