{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://evalship.com/schema/audit-v1.json",
  "title": "evalship audit v1",
  "description": "A repo audit written by a coding agent following the evalship setup prompt.",
  "type": "object",
  "required": ["schema", "repository", "headline", "suites", "findings"],
  "additionalProperties": false,
  "properties": {
    "schema": { "const": "evalship/audit-v1" },
    "repository": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$" },
    "agent": { "type": "string", "maxLength": 60 },
    "prompt_version": { "type": "string", "maxLength": 20 },
    "headline": { "type": "string", "minLength": 1, "maxLength": 400 },
    "suites": {
      "type": "array", "maxItems": 50,
      "items": {
        "type": "object", "required": ["name", "framework", "path"], "additionalProperties": false,
        "properties": {
          "name": { "type": "string", "maxLength": 100 },
          "framework": { "type": "string", "maxLength": 40 },
          "path": { "type": "string", "maxLength": 300 },
          "cases": { "type": ["integer", "null"], "minimum": 0 },
          "deterministic_assertions": { "type": ["integer", "null"], "minimum": 0 },
          "judge_assertions": { "type": ["integer", "null"], "minimum": 0 },
          "exercises": { "type": "array", "maxItems": 50, "items": { "type": "string", "maxLength": 300 } },
          "models": { "type": "array", "maxItems": 20, "items": { "type": "string", "maxLength": 80 } },
          "command": { "type": ["string", "null"], "maxLength": 300 },
          "ci_triggers": { "type": "array", "items": { "enum": ["pull_request", "push", "schedule", "manual"] } },
          "results_format": { "type": ["string", "null"], "maxLength": 40 },
          "est_cost_per_run_usd": { "type": ["number", "null"], "minimum": 0 }
        }
      }
    },
    "prompts": {
      "type": "array", "maxItems": 100,
      "items": {
        "type": "object", "required": ["path"], "additionalProperties": false,
        "properties": {
          "path": { "type": "string", "maxLength": 300 },
          "line": { "type": ["integer", "null"], "minimum": 1 },
          "symbol": { "type": ["string", "null"], "maxLength": 120 },
          "tested_by": { "type": "array", "maxItems": 20, "items": { "type": "string", "maxLength": 100 } }
        }
      }
    },
    "findings": {
      "type": "array", "maxItems": 8,
      "items": {
        "type": "object", "required": ["kind", "severity", "title", "evidence", "why_it_matters", "action"], "additionalProperties": false,
        "properties": {
          "kind": { "enum": ["not_in_ci", "untested_prompt", "untested_instruction", "judge_only", "too_easy", "thin_dataset", "cost", "duplicated_setup", "nondeterminism"] },
          "severity": { "enum": ["info", "notice", "important"] },
          "title": { "type": "string", "minLength": 1, "maxLength": 160 },
          "evidence": {
            "type": "array", "minItems": 1, "maxItems": 10,
            "items": {
              "type": "object", "required": ["file"], "additionalProperties": false,
              "properties": {
                "file": { "type": "string", "maxLength": 300 },
                "line": { "type": ["integer", "null"], "minimum": 1 },
                "quote": { "type": ["string", "null"], "maxLength": 300 },
                "note": { "type": ["string", "null"], "maxLength": 300 }
              }
            }
          },
          "why_it_matters": { "type": "string", "maxLength": 600 },
          "action": { "type": "string", "maxLength": 600 }
        }
      }
    },
    "plan": {
      "type": "array", "maxItems": 6,
      "items": {
        "type": "object", "required": ["title", "status"], "additionalProperties": false,
        "properties": {
          "title": { "type": "string", "maxLength": 160 },
          "detail": { "type": ["string", "null"], "maxLength": 600 },
          "status": { "enum": ["applied", "proposed", "skipped"] }
        }
      }
    },
    "ci": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "workflow": { "type": ["string", "null"], "maxLength": 300 },
        "uploads_results": { "type": "boolean" },
        "artifact_name": { "type": ["string", "null"], "maxLength": 100 },
        "setup_pr_url": { "type": ["string", "null"], "maxLength": 300 },
        "secrets_needed": { "type": "array", "maxItems": 20, "items": { "type": "string", "maxLength": 100 } }
      }
    },
    "badge_added": { "type": "boolean" }
  }
}
