{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/SetupAgentsVerifyResult",
  "definitions": {
    "SetupAgentsVerifyResult": {
      "type": "object",
      "properties": {
        "tool": {
          "type": ["string", "null"]
        },
        "profiles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "probePrompt": {
          "type": ["string", "null"]
        },
        "hasRules": {
          "type": "boolean"
        },
        "cwd": {
          "type": "string"
        },
        "setupHealth": {
          "$ref": "#/definitions/SetupHealth"
        },
        "opencodeHealth": {
          "$ref": "#/definitions/OpenCodeHealth"
        },
        "referenceHealth": {
          "$ref": "#/definitions/ReferenceHealth"
        },
        "knowledgeReadiness": {
          "$ref": "#/definitions/KnowledgeReadiness"
        },
        "promptRegistryHealth": {
          "$ref": "#/definitions/PromptRegistryHealth"
        }
      },
      "required": ["tool", "profiles", "probePrompt", "hasRules", "cwd"],
      "additionalProperties": false
    },
    "SetupHealth": {
      "type": "object",
      "properties": {
        "healthy": {
          "type": "boolean"
        },
        "completeness": {
          "anyOf": [
            {
              "$ref": "#/definitions/SetupCompleteness"
            },
            {
              "type": "string",
              "const": "unmanaged"
            }
          ]
        },
        "manifest": {
          "anyOf": [
            {
              "$ref": "#/definitions/SetupManifest"
            },
            {
              "type": "null"
            }
          ]
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SetupArtifact"
          }
        },
        "repairCommand": {
          "type": "string"
        },
        "reasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "runtimeArtifacts": {
          "$ref": "#/definitions/RuntimeArtifactHealth"
        }
      },
      "required": ["healthy", "completeness", "manifest", "artifacts", "repairCommand", "reasons", "runtimeArtifacts"],
      "additionalProperties": false
    },
    "SetupCompleteness": {
      "type": "string",
      "enum": ["quick", "partial", "full"]
    },
    "SetupManifest": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number"
        },
        "completeness": {
          "$ref": "#/definitions/SetupCompleteness"
        },
        "requestedLevel": {
          "type": "string",
          "enum": ["quick", "full"]
        },
        "profiles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "tools": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SupportedTool"
          }
        },
        "generator": {
          "type": "string",
          "const": "setup-agents:local"
        },
        "pluginVersion": {
          "type": "string"
        },
        "sourceDigest": {
          "type": "string"
        },
        "expectedArtifacts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "owner": {
                "$ref": "#/definitions/SetupArtifactOwner"
              },
              "marker": {
                "type": ["string", "null"]
              },
              "expectedDigest": {
                "type": "string"
              }
            },
            "required": ["path", "owner", "marker", "expectedDigest"],
            "additionalProperties": false
          }
        },
        "producedArtifacts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SetupArtifact"
          }
        },
        "failedReasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "skippedReasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "knowledgeManifest": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "const": ".setup-agents/knowledge-manifest.json"
            },
            "status": {
              "type": "string",
              "enum": ["current", "missing"]
            }
          },
          "required": ["path", "status"],
          "additionalProperties": false
        },
        "generatedAt": {
          "type": "string"
        }
      },
      "required": [
        "schemaVersion",
        "completeness",
        "requestedLevel",
        "profiles",
        "tools",
        "generator",
        "pluginVersion",
        "sourceDigest",
        "expectedArtifacts",
        "producedArtifacts",
        "failedReasons",
        "skippedReasons",
        "knowledgeManifest"
      ],
      "additionalProperties": false
    },
    "SupportedTool": {
      "type": "string",
      "enum": ["cursor", "vscode", "codex", "claude", "agentforce", "windsurf", "jetbrains", "opencode"]
    },
    "SetupArtifactOwner": {
      "type": "string",
      "enum": ["setup-agents", "customer"]
    },
    "SetupArtifact": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "owner": {
          "$ref": "#/definitions/SetupArtifactOwner"
        },
        "marker": {
          "type": ["string", "null"]
        },
        "expectedDigest": {
          "type": "string"
        },
        "digest": {
          "type": ["string", "null"]
        },
        "status": {
          "$ref": "#/definitions/SetupArtifactStatus"
        },
        "reason": {
          "type": "string"
        }
      },
      "required": ["path", "owner", "marker", "expectedDigest", "digest", "status"],
      "additionalProperties": false
    },
    "SetupArtifactStatus": {
      "type": "string",
      "enum": ["current", "missing", "stale", "drifted", "foreign", "failed", "skipped"]
    },
    "RuntimeArtifactHealth": {
      "type": "object",
      "properties": {
        "healthy": {
          "type": "boolean"
        },
        "missingCanonical": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "missingAdapters": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["healthy", "missingCanonical", "missingAdapters"],
      "additionalProperties": false
    },
    "OpenCodeHealth": {
      "type": "object",
      "properties": {
        "status": {
          "$ref": "#/definitions/OpenCodeHealthStatus"
        },
        "issues": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/OpenCodeHealthIssue"
          }
        },
        "remediation": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["status", "issues", "remediation"],
      "additionalProperties": false
    },
    "OpenCodeHealthStatus": {
      "type": "string",
      "enum": ["healthy", "stale", "partial", "blocked"]
    },
    "OpenCodeHealthIssue": {
      "type": "object",
      "properties": {
        "surface": {
          "type": "string",
          "enum": ["config", "instructions", "rules", "agents", "commands", "models", "permissions", "mcp"]
        },
        "path": {
          "type": "string"
        },
        "reason": {
          "type": "string"
        },
        "remediation": {
          "type": "string"
        },
        "blocking": {
          "type": "boolean"
        }
      },
      "required": ["surface", "path", "reason", "remediation", "blocking"],
      "additionalProperties": false
    },
    "ReferenceHealth": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": ["healthy", "unhealthy", "not-configured"]
        },
        "complete": {
          "type": "boolean"
        },
        "configuredProfiles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "issues": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ReferenceHealthIssue"
          }
        },
        "manifestPath": {
          "type": "string"
        }
      },
      "required": ["status", "complete", "configuredProfiles", "issues", "manifestPath"],
      "additionalProperties": false
    },
    "ReferenceHealthIssue": {
      "type": "object",
      "properties": {
        "filename": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": ["missing", "stale", "contaminated", "foreign", "mis-scoped", "source-missing"]
        },
        "action": {
          "type": "string"
        }
      },
      "required": ["filename", "kind", "action"],
      "additionalProperties": false
    },
    "KnowledgeReadiness": {
      "type": "object",
      "properties": {
        "ready": {
          "type": "boolean"
        },
        "artifacts": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/KnowledgeArtifactReadiness"
          }
        },
        "repairCommand": {
          "type": "string"
        }
      },
      "required": ["ready", "artifacts", "repairCommand"],
      "additionalProperties": false
    },
    "KnowledgeArtifactReadiness": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": ["ready", "missing", "template", "stale", "degraded", "partial"]
        },
        "reason": {
          "type": "string"
        }
      },
      "required": ["path", "status", "reason"],
      "additionalProperties": false
    },
    "PromptRegistryHealth": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": ["not-applicable", "not-configured", "healthy", "issues"]
        },
        "scope": {
          "type": "string",
          "enum": ["non-salesforce", "quick", "setup-agents-generated-only"]
        },
        "registryPath": {
          "type": "string"
        },
        "records": {
          "type": "number"
        },
        "findings": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/PromptRegistryFinding"
          }
        }
      },
      "required": ["status", "scope", "registryPath", "records", "findings"],
      "additionalProperties": false
    },
    "PromptRegistryFinding": {
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/definitions/PromptRegistryFindingKind"
        },
        "path": {
          "type": "string"
        },
        "detail": {
          "type": "string"
        }
      },
      "required": ["kind", "path", "detail"],
      "additionalProperties": false
    },
    "PromptRegistryFindingKind": {
      "type": "string",
      "enum": ["empty", "template", "stale", "orphan", "missing", "duplicate", "invalid"]
    }
  }
}
