{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/test-gen-inventory.schema.json",
  "title": "Multi-Agent Pipeline  -  test-gen inventory",
  "description": "What the app has that a test could cover, written by the inventory stage of /multi-agent:test-gen as $RUN/inventory.json (multi-agent-refs/test-gen/stages.md). Items are joined to tests by their stable id (route, screen id, Figma node id, endpoint path), never by title. `priority` is added after the inventory, from the user's pick or, in autopilot, the top three. test-gen-gate.mjs check --stage inventory checks this shape without a dependency.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "platform", "source", "items"],
  "properties": {
    "schemaVersion": { "const": "1.0.0" },
    "platform": { "enum": ["ios", "android", "web", "api"] },
    "repo": { "type": "string", "minLength": 1 },
    "source": {
      "enum": ["design_scenario_inventory", "web_map", "ui_tree", "openapi", "agent"],
      "description": "Where the items came from. `agent` is the stage's own reading of the code, used when no tool answered."
    },
    "generatedAt": { "type": "string", "format": "date-time" },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "kind", "title"],
        "properties": {
          "id": { "type": "string", "minLength": 1, "description": "Stable identifier." },
          "kind": { "enum": ["screen", "flow", "endpoint", "component"] },
          "title": { "type": "string", "minLength": 1 },
          "path": {
            "type": "string",
            "minLength": 1,
            "description": "Code path that implements it, file or directory."
          },
          "handles": {
            "type": "array",
            "items": { "type": "string", "minLength": 1 },
            "description": "Automation handles already on it (accessibilityIdentifier, testTag, data-testid)."
          }
        }
      }
    },
    "priority": {
      "type": "object",
      "additionalProperties": false,
      "required": ["mode", "selected"],
      "properties": {
        "mode": {
          "enum": ["user", "autopilot-top3"],
          "description": "user: picked by the person; autopilot-top3: the three the run proceeded with unattended."
        },
        "selected": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        }
      }
    }
  }
}
