Skip to main content

JSON Envelope Format

In JSON mode, stdout carries exactly one JSON object. Every progress line goes to stderr.

Success envelope

boolean
true on success, false on error.
object
Verb-specific result data. Always present on success; present on an error only when the verb has something to report (for example, findings).
object
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

string
Stable error code (e.g., "validation", "forbidden", "auth_required"). Machine-readable; branch on this.
string
Human-readable error message.
string
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.
string
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.
In human mode, an error prints Error: <message> and Hint: <hint> to stderr, followed by Docs: <url> when the error has a docs entry.

Toolchain update notice

Every command except init, 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:
Status values:
  • "behind" — A newer version is available
  • "unsupported" — Your version is below the host’s declared minimum (makes publish fail with exit 9)
The field is absent when the CLI is current, when the check cannot resolve, or when disabled with 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 own error.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 --json envelope. From doctor with error.code doctor_failed it is not a bug: the package is not ready, and data says why
  • 2 — Fix the command (spelling, required arguments, --host)
  • 3 — Fix the definition or resolve the ambiguity the hint names
  • 4 — Run ekanos login and retry
  • 5 — Check ekanos sources for 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 version in package.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, 7
  • validate: 0, 1, 2, 3, 6, 9
  • dev: 0, 1, 2, 6, 7, 9, or Next’s exit code
  • test: 6 or 9 if the project can’t be loaded; otherwise the runner’s exit code
  • login: 0, 1, 2, 3, 4, 7, 8, 9
  • logout: 0, 1, 2, 9
  • whoami: 0, 1, 2, 4, 8, 9
  • sources: 0, 1, 2, 4, 8, 9
  • use: 0, 1, 2, 4, 5, 6, 8, 9
  • status: 0 whenever the report is assembled; host errors still map through the taxonomy. With --watch: 0 on gated/dev, 10 on rejected, 4 without a session, 9 without a project or source
  • publish: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
  • upgrade: 0, 1, 2, 3, 6, 8, 9, or the test script’s exit code
  • doctor: 0 when the report is ok; 1 with doctor_failed when it is not (the report is in data); 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:
  • publish when you lack a seat on the target source
  • use when the slug doesn’t name a source you hold a seat on
What to do: Run ekanos sources to see what you have access to. The hint always lists your actual seats.

precondition_failed (exit 9)

Returned by:
  • validate, publish when the project resolves a newer @ekanos/integration-schema than the CLI bundles
  • validate, dev, test, use, publish, and upgrade when package.json does not declare "type": "module", or when ekanos.json is not valid JSON or fails its schema
  • dev when a required package is missing, @ekanos/harness declares no version, or the CLI and harness shell contracts don’t match
  • publish when the host has declared this CLI version unsupported
  • status --watch when there is no project or no source
  • every verb that sends credentials when the host is a remote http:// URL
  • login when the host’s sign-in domain is not an Auth0 domain
What to do: Check the hint — it is specific about what’s missing or misconfigured. Common fixes:

validation (exit 3)

Returned by:
  • validate when error-severity findings are present
  • publish when 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 invalid
  • upgrade when run non-interactively without --yes, or when the confirm is declined
For 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 problem
  • hint — How to fix it
  • file, line — Where, when known
What to do: Read the hint and fix the integration. Run ekanos validate again.

gate_failed (exit 10)

Returned by:
  • publish when the local findings pass has error-severity findings (the same findings validate reports, plus escalated project.host-compiler-rules). Nothing is uploaded
  • status --watch when the host’s gate rejects the submitted version
Both carry the findings in 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.

Practical examples

Agent workflow

CI/CD pipeline