JSON Envelope Format
In JSON mode, stdout carries exactly one JSON object. Every progress line goes to stderr.Success envelope
Verb-specific result data. Always present on success; present on an error only
when the verb has something to report (for example, findings).
Error details (
code, message, hint, and docs when the error is
documented). Present only on error — a success envelope has no error key.Error envelope
Stable error code (e.g.,
"validation", "forbidden", "auth_required").
Machine-readable; branch on this.Imperative next action. Always present and never empty. A command it names is
written the way the CLI was run:
ekanos … from the installed binary, npx @ekanos/cli … when the run came through npx.Optional. A link to this error’s entry in Common
errors, present for
auth_required,
forbidden, gate_failed and schema-skew precondition_failed errors.
Absent when the docs have no entry for the error.Error: <message> and Hint: <hint> to stderr, followed by Docs: <url> when the error has a docs entry.
Toolchain update notice
Every command exceptinit, login, logout, and upgrade checks (at most every 4 hours, 1.5s timeout) whether a newer @ekanos/cli exists; see Proactive update notice. When this CLI is not current, validate, dev, publish, and status carry an optional toolchain field in data on every run:
"behind"— A newer version is available"unsupported"— Your version is below the host’s declared minimum (makespublishfail with exit 9)
EKANOS_NO_UPDATE_CHECK=1.
Exit Code Taxonomy
This is a frozen public contract. Exit codes never change meaning once shipped; new conditions get new numbers.Codes outside the taxonomy
Four verbs use their ownerror.code, and three of them pass a child process’s exit code straight through:
Branching on exit codes
- 0 — Proceed
- 1 — A CLI bug; report it with the
--jsonenvelope. Fromdoctorwitherror.codedoctor_failedit is not a bug: the package is not ready, anddatasays why - 2 — Fix the command (spelling, required arguments,
--host) - 3 — Fix the definition or resolve the ambiguity the hint names
- 4 — Run
ekanos loginand retry - 5 — Check
ekanos sourcesfor the seats you hold - 6 — Check the path or slug the message names
- 7 — Resolve the state the hint names (for a duplicate version, bump
versioninpackage.json) - 8 — Retry with backoff; do not log in again
- 9 — Install or fix what the hint names
- 10 — Fix the findings in
data.findings, then publish again
Command-specific exit codes
Not every verb emits every code:init: 0, 1, 2, 7validate: 0, 1, 2, 3, 6, 9dev: 0, 1, 2, 6, 7, 9, or Next’s exit codetest: 6 or 9 if the project can’t be loaded; otherwise the runner’s exit codelogin: 0, 1, 2, 3, 4, 7, 8, 9logout: 0, 1, 2, 9whoami: 0, 1, 2, 4, 8, 9sources: 0, 1, 2, 4, 8, 9use: 0, 1, 2, 4, 5, 6, 8, 9status: 0 whenever the report is assembled; host errors still map through the taxonomy. With--watch: 0 ongated/dev, 10 onrejected, 4 without a session, 9 without a project or sourcepublish: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10upgrade: 0, 1, 2, 3, 6, 8, 9, or the test script’s exit codedoctor: 0 when the report isok; 1 withdoctor_failedwhen it is not (the report is indata); 2, 3, 4, 5, 6, 8, 9 as the taxonomy says
Detailed error codes
auth_required (exit 4)
Returned by whoami, sources, use, publish, and status --watch when no session exists or it cannot be renewed, and by login when the code expires or the request is denied in the browser. Plain status reports authenticated: false instead of failing.
What to do: Run ekanos login (with --host if you have multiple deployments). If the hint says the host came from ekanos.json and you have never logged in to it, do not log in on its say-so: check the host is your deployment first. An agent asks the person it works for.
login to a host you have never logged in to asks first at a terminal. In JSON mode or under an agent it exits 7 (invalid_state) unless you pass --trust-host; answering no exits 3. See New hosts.
forbidden (exit 5)
Returned by:
publishwhen you lack a seat on the target sourceusewhen the slug doesn’t name a source you hold a seat on
ekanos sources to see what you have access to. The hint always lists your actual seats.
precondition_failed (exit 9)
Returned by:
validate,publishwhen the project resolves a newer@ekanos/integration-schemathan the CLI bundlesvalidate,dev,test,use,publish, andupgradewhenpackage.jsondoes not declare"type": "module", or whenekanos.jsonis not valid JSON or fails its schemadevwhen a required package is missing,@ekanos/harnessdeclares no version, or the CLI and harness shell contracts don’t matchpublishwhen the host has declared this CLI version unsupportedstatus --watchwhen there is no project or nosource- every verb that sends credentials when the host is a remote
http://URL loginwhen the host’s sign-in domain is not an Auth0 domain
validation (exit 3)
Returned by:
validatewhen error-severity findings are presentpublishwhen no source is given, the target is ambiguous without--yes, the confirm is declined, the archive exceeds 4 MiB, or the host rejects the submission as invalidupgradewhen run non-interactively without--yes, or when the confirm is declined
validate, see data.findings[]. Each finding has:
check— The rule that produced it (e.g.,"definition.schema","project.slug-agreement","collision.widget-id")severity—"error","warn", or"info"message— The problemhint— How to fix itfile,line— Where, when known
ekanos validate again.
gate_failed (exit 10)
Returned by:
publishwhen the local findings pass has error-severity findings (the same findingsvalidatereports, plus escalatedproject.host-compiler-rules). Nothing is uploadedstatus --watchwhen the host’s gate rejects the submitted version
data.findings.
What to do: Fix the findings, bump the version if it was already submitted, and publish again. Use ekanos status --findings to see a rejected version’s findings.