{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "deploy --json: success",
  "description": "The one object `deploy --json` prints on stdout when the deployment is ready, and the object the MCP tool deploy returns once the deployment is ready (before that it returns state=building and next_tool). More keys may be added; none of these is removed or renamed.",
  "type": "object",
  "required": ["deployment_id", "project", "url", "state", "elapsed_s"],
  "properties": {
    "deployment_id": { "type": "string", "minLength": 1, "description": "Pass it to inspect, logs, promote, rollback." },
    "project": { "type": "string", "minLength": 1, "description": "Project name." },
    "url": { "type": "string", "pattern": "^https?://", "description": "The live (or preview) address." },
    "state": { "const": "ready", "description": "Always ready: a deploy that does not become ready is the error object, exit code 1." },
    "image_digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$", "description": "The registry digest of the image the deployment runs, as the platform recorded it (for a build, the one it pushed). Absent for static sites and when the registry could not be asked; a rollback or promote of this deployment runs the same digest." },
    "elapsed_s": { "type": "number", "minimum": 0, "description": "Measured seconds from the start of the command until ready." },
    "status": { "type": "string", "description": "Same as state." },
    "project_id": { "type": "string" },
    "tier": { "type": "string" },
    "environment": { "enum": ["production", "preview"] },
    "image": { "type": "string" },
    "preview_url": { "type": "string" },
    "next": { "type": "string", "description": "What to tell the person next." },
    "warnings": { "type": "array" },
    "project_created": { "type": "boolean", "description": "Present and true when this deploy created the project because no project of that name existed (deploy --yes creates on first deploy). Absent when the project already existed. A mistyped --project shows up here; the stderr line names a similar existing project when there is one, and `project delete <name> --yes` undoes the creation." },
    "addons": { "type": "array", "description": "Present when the directory's nesly.toml declares [[addon]] tables or the deploy detected addons the app needs (a database or cache driver in the dependency manifests): what the deploy did for each before building. source is \"nesly.toml\" or \"detected:<signal>\". action is created, updated (an existing bucket's mount or model's default model changed), exists, unmanaged (the project has it, the file does not name it; left as it is, never deleted), or not_created (the app names several databases, so none was created: run the command in the row for the one you choose; or the plan refuses an addon the deploy only detected: message says why, next is the upgrade address or the command to run afterwards). An addon nesly.toml declares and the plan refuses is not in a success object: the deploy stops with exit 5 and the error object's refusal; --no-addons skips the detection.", "items": { "type": "object", "required": ["kind", "action"], "properties": { "kind": { "type": "string" }, "source": { "type": "string" }, "command": { "type": "string" }, "next": { "type": "string" }, "action": { "enum": ["created", "updated", "exists", "unmanaged", "not_created"] }, "env_keys": { "type": "array", "items": { "type": "string" } }, "mount": { "type": "string" }, "model": { "type": "string" } } } },
    "model": { "type": "object", "description": "The resolved plan of this deploy: the object `app show --json` prints for the directory (processes, port, health, release, variable names by source, memory, services needed). `deploy` resolves it locally and prints it as one block before the build; the platform freezes the same object at the rollout, so `app plan --detailed-exit-code` of the same tree reports no change. Names and numbers only, never a value. Present for a deploy of a directory; absent for an image, a repository, a prebuilt site and a preview. The MCP tool deploy returns the model the platform froze.", "required": ["environment", "processes", "env"], "properties": { "project": { "type": ["string", "null"] }, "environment": { "type": "string" }, "processes": { "type": "object" }, "env": { "type": "object" }, "resources": { "type": "object" }, "services": { "type": "object" }, "build": { "type": "object" } } },
    "rescued": { "type": "string" },
    "say": { "type": "string", "description": "The one thing to tell the person: the URL on the first line, and only once the platform's own check opened it and it answered; while a build runs, that it is building (on the hosted MCP server, the page to watch it on first, then that you will tell them when it is up)." },
    "did": { "type": "array", "description": "MCP tools deploy and wait_deployment: what the platform did for the person on its own, in order, one plain sentence each (a database it created and why, the secret values it generated, a repair of its own build copy, the first screen it opened). step is one of reading, database, building, starting, checking. Never a log line or an id.", "items": { "type": "object", "required": ["step", "text"], "properties": { "step": { "enum": ["reading", "database", "building", "starting", "checking"] }, "text": { "type": "string" } } } },
    "protected": { "type": "boolean", "description": "MCP tools deploy, wait_deployment and get_project: true when the project asks every visitor to sign in (Auth Protect), read from the project record when the answer is made. The platform's own check of the site does not pass that gate, so verified does not say it: the say does." },
    "because": { "type": "string", "description": "MCP tool deploy: why this deploys a site that is already live, in the agent's words, when it passed one." },
    "watch_url": { "type": "string", "description": "MCP tool deploy on the hosted server only: the console page that shows this deployment's build log live. Give it to the person at once. Absent when the console address is not configured." },
    "verified": { "type": "boolean", "description": "True exactly when the platform itself opened the deployment's address and got the app's own page (first_screen.class is ok). False when its look found a problem (first_screen names the class and say names the problem), when it could not read a page (first_screen.class is not-read), and when it did not open the address at all (a static site: first_screen is absent); say states which. A warning that is only advice, such as an addon hint in warnings, does not change it. False: open the URL yourself before telling the person it works." },
    "ready_note": { "type": "object", "description": "Set when the deployment is ready but the platform's own check got a 4xx at the probed path (below 500 counts as ready). Advice, not failure: a health path makes the check strict.", "properties": { "path": { "type": "string" }, "status": { "type": "integer", "minimum": 400, "maximum": 499 } } },
    "first_screen": { "type": "object", "description": "What the platform saw at the app's root address right after its health check: the first screen a visitor gets. class is \"ok\" (the app's working first screen), or the red it showed: db (a database setup form or error), env, crash (a stack trace or debug page), 5xx, blank, no-answer, unexpected; \"not-read\" when the platform could not fetch the page. A red does NOT fail the deployment: it is ready, and the app is up but not usable; run diagnose. Absent for a static site.", "required": ["class"], "properties": { "class": { "enum": ["ok", "db", "env", "crash", "5xx", "blank", "no-answer", "unexpected", "not-read"] }, "title": { "type": "string" } } },
    "already_live": { "type": "object", "description": "The project was live before this deploy: it ships a new revision, not a first publish.", "properties": { "url": { "type": "string" }, "deployment_id": { "type": "string" } } },
    "rescue": { "type": "object", "description": "What the platform repaired by itself.", "properties": { "applied": { "type": "boolean" }, "summary": { "type": "string" }, "repo_unchanged": { "type": "boolean", "description": "Always true: the platform repairs its own build copy, never the person's repository." } } },
    "failure_reason": { "type": "string", "description": "Why an earlier attempt of this deployment failed, when the platform recorded one." },
    "pull_request": { "type": "integer", "minimum": 1, "description": "The pull request a preview deployment was built from." },
    "build": {
      "type": "object",
      "description": "What the platform resolved and ran for this build; absent for a deployment of a given image.",
      "properties": {
        "framework": { "type": "string" },
        "root": { "type": "string" },
        "install": { "type": "string" },
        "command": { "type": "string" },
        "output": { "type": "string" },
        "start": { "type": "string" },
        "origins": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Where each resolved value came from (detected, the config file, project settings)." },
        "redirects": { "type": "array", "items": { "type": "object", "properties": { "from": { "type": "string" }, "to": { "type": "string" }, "status": { "type": "integer" } } } },
        "headers": { "type": "array", "items": { "type": "object", "properties": { "for": { "type": "string" }, "values": { "type": "object", "additionalProperties": { "type": "string" } } } } }
      }
    }
  }
}
