{
  "$id": "https://agent-setup.oxidt.com/schema/setup.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Setup",
  "description": "What a `setup_*` tool returns.",
  "type": "object",
  "properties": {
    "compatible_with": {
      "description": "Existing SDKs that already accept these env vars, e.g. `sentry`. When\nthe repo has one, the agent configures it instead of adding a snippet.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "created": {
      "description": "`false` when an existing resource matched the input and was returned\nunchanged.",
      "type": "boolean"
    },
    "env": {
      "description": "Variables to write into the project's env file.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/EnvVar"
      }
    },
    "human_steps": {
      "description": "Steps only the user can do. Empty when setup is complete.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/HumanStep"
      }
    },
    "install": {
      "description": "Code to add to the codebase, one entry per target the app supports.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Snippet"
      }
    },
    "resource": {
      "$ref": "#/$defs/Resource"
    },
    "verify_with": {
      "description": "The tool to call to confirm the install, usually `verify_setup`.",
      "type": "string"
    }
  },
  "required": [
    "resource",
    "created",
    "env",
    "install",
    "human_steps",
    "verify_with"
  ],
  "$defs": {
    "EnvVar": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "secret": {
          "description": "`true`: the agent writes it to the env file but never echoes it to the\nuser or commits it. `false`: safe to commit, e.g. into deploy config.",
          "type": "boolean"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "value",
        "secret"
      ]
    },
    "HumanStep": {
      "description": "Something the agent must hand to the user instead of doing.",
      "type": "object",
      "properties": {
        "blocking": {
          "description": "`true` when verification cannot succeed until this step is done, e.g.\nan OAuth consent the app needs before it can receive data. The agent\nshows it before polling instead of in the final report.",
          "type": "boolean"
        },
        "url": {
          "type": "string"
        },
        "why": {
          "description": "Shown to the user, e.g. \"Connect Google Search Console\".",
          "type": "string"
        }
      },
      "required": [
        "why",
        "url",
        "blocking"
      ]
    },
    "Resource": {
      "description": "The app's core resource: a project, website, site, ...",
      "type": "object",
      "properties": {
        "dashboard_url": {
          "description": "Where the user sees it, for the agent's final report.",
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "kind": {
          "description": "`project`, `website`, `site`, ...",
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "id",
        "name",
        "dashboard_url"
      ]
    },
    "Snippet": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "file_hint": {
          "description": "Where it usually goes, e.g. `index.html <head>`. The agent decides.",
          "type": [
            "string",
            "null"
          ]
        },
        "packages": {
          "description": "Dependencies the code needs, in the target's package-manager syntax,\ne.g. `@sentry/nextjs` or `sentry`. The agent installs them before\nadding the code.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "target": {
          "description": "What it integrates with: `html`, `dioxus`, `axum`, `nextjs`, ...",
          "type": "string"
        }
      },
      "required": [
        "target",
        "code"
      ]
    }
  }
}
