{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://harness-forge.dev/schemas/runtime/repo-map.schema.json",
  "title": "Repo map",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "workspaceId",
    "workspaceType",
    "dominantLanguages",
    "frameworks",
    "services",
    "criticalPaths",
    "highRiskPaths",
    "existingInstructionSurfaces",
    "qualityGaps",
    "supportingEvidence"
  ],
  "properties": {
    "workspaceId": { "type": "string" },
    "workspaceType": { "type": "string" },
    "dominantLanguages": { "$ref": "#/$defs/repoFacts" },
    "frameworks": { "$ref": "#/$defs/repoFacts" },
    "services": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "path", "classification"],
        "properties": {
          "id": { "type": "string" },
          "path": { "type": "string" },
          "classification": { "type": "string" }
        }
      }
    },
    "criticalPaths": { "$ref": "#/$defs/stringArray" },
    "highRiskPaths": { "$ref": "#/$defs/stringArray" },
    "existingInstructionSurfaces": { "$ref": "#/$defs/stringArray" },
    "qualityGaps": { "$ref": "#/$defs/repoFacts" },
    "supportingEvidence": { "$ref": "#/$defs/stringArray" }
  },
  "$defs": {
    "stringArray": {
      "type": "array",
      "items": { "type": "string" }
    },
    "repoFacts": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "confidence", "evidence"],
        "properties": {
          "id": { "type": "string" },
          "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
          "evidence": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      }
    }
  }
}
