Skip to main content

CLI Reference

tenant-emit has exactly one verb: build-certificate.

build-certificate

Reconstructs a signed governance-certificate.json from a finished run directory.

tenant-emit build-certificate <run-dir> [FLAGS]

Arguments

ArgumentDescription
<run-dir>Path to the factory run directory (e.g., .factory/runs/<run_id>).

Flags

FlagTypeDefaultDescription
--tenant-modeFlagfalseRequires a signer. The binary halts before emission if no signer is provided.
--require-operator-keyFlagfalseRefuses the ephemeral dev-only key fallback. Exits with code 2 if the key resolves to ephemeral.
--signer-subjectStringNonePrincipal identifier (e.g., a JWT subject). Required if --tenant-mode is set.
--signer-identity-providerStringNoneThe system that attested the subject. Required if --signer-subject is set.
--signer-session-idStringNoneOptional run-scoped session ID.
--corpus-attestationPathNoneBinds a precomputed corpus attestation by hash. Read, never recompute. Falls back to OAP_CORPUS_ATTESTATION_PATH. Applied only on the signer path.
--require-corpus-bindingFlagfalseRefuses to emit (exit 2) unless a corpus binding is actually applied (a corpus attestation resolved and a signer is present). Mirrors --require-operator-key.
--sbom-dirPathNoneProduced-app root whose .factory/sbom.cdx.json and .factory/audit.json are bound into the certificate by content hash. Read, never recompute. Falls back to OAP_SBOM_DIR. Applied only on the signer path.
--require-sbom-bindingFlagfalseRefuses to emit (exit 2) unless an SBOM artifact binding is actually applied. Mirrors --require-corpus-binding.
--stage-idsStringNoneComma-separated stage IDs, or auto for filesystem discovery. Empty entries are ignored. Defaults to OAP's s0..s5 if omitted.
--adapterString"unknown"Adapter name recorded in the pipeline state.
--business-docsPaths...NoneOptional requirement documents. A domain-separated SHA-256 over them (each document length-prefixed) is recorded as the requirements hash. An unreadable document is a hard error (exit 2), never a partial hash.
--requirements-hashStringNoneDirect requirements hash. Ignored if --business-docs is given.
--outPath<run-dir>/governance-certificate.jsonFull output file path (including the file name) for the emitted certificate. Parent directories are created as needed.
--repo-rootPath.Kept for upstream parity; a no-op on the tenant path since tenant certs carry no spec_id.

Environment Variables

VariableDescription
OAP_SIGNING_KEYBase64-encoded 32-byte Ed25519 seed used to sign the certificate.
OAP_SIGNING_KEY_PATHPath to a file containing the base64-encoded Ed25519 seed. Checked if OAP_SIGNING_KEY is unset. The path itself is never written into the certificate: the signing attestation records only the source (source=OAP_SIGNING_KEY_PATH), not the file location.
OAP_CORPUS_ATTESTATION_PATHPath to a spec-spine CorpusAttestation JSON to bind into the certificate. Fallback for --corpus-attestation.
OAP_SBOM_DIRProduced-app root for the SBOM artifact binding. Fallback for --sbom-dir.

Exit Codes

CodeMeaning
0Success. Certificate written.
1Runtime I/O failure after the certificate was built (e.g., the certificate could not be persisted).
2Configuration or input error, detected before anything is written: the run directory does not exist; --tenant-mode had no signer; an operator-supplied signing key is malformed; --require-operator-key resolved to an ephemeral key; a required binding (--require-corpus-binding / --require-sbom-binding) could not be applied; or a --business-docs file is unreadable.

Examples

Basic tenant emission with auto-discovered stages:

tenant-emit build-certificate .factory/runs/run-123 \
--tenant-mode \
--signer-subject "bot@ci" \
--signer-identity-provider "github-actions" \
--stage-ids auto

Production emission enforcing operator key and binding a corpus:

tenant-emit build-certificate .factory/runs/run-123 \
--tenant-mode \
--signer-subject "alice@example.com" \
--signer-identity-provider "okta" \
--corpus-attestation ./attestation.json \
--require-operator-key \
--stage-ids auto

Custom output path and specific stages:

tenant-emit build-certificate .factory/runs/run-123 \
--stage-ids "s0-preflight,tenant-build" \
--out ./dist/cert.json