{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/SetupLocalResult",
  "definitions": {
    "SetupLocalResult": {
      "type": "object",
      "properties": {
        "configured": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "profiles": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ProfileId"
          }
        },
        "localState": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string"
            },
            "files": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": ["path", "files"],
          "additionalProperties": false
        },
        "advisory": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "path": {
              "type": "string"
            },
            "files": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": ["enabled", "path", "files"],
          "additionalProperties": false
        },
        "openOrchestra": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "status": {
              "type": "string",
              "enum": ["available", "not-installed"]
            },
            "path": {
              "type": "string"
            },
            "files": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "command": {
              "type": "string"
            },
            "guidance": {
              "type": "string"
            }
          },
          "required": ["enabled", "status", "path", "files", "command", "guidance"],
          "additionalProperties": false
        },
        "cwd": {
          "type": "string"
        },
        "setupManifest": {
          "$ref": "#/definitions/SetupManifest"
        },
        "knowledge": {
          "type": "object",
          "properties": {
            "manifest": {
              "$ref": "#/definitions/KnowledgeManifest"
            },
            "changedPaths": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": ["manifest", "changedPaths"],
          "additionalProperties": false
        },
        "purgedArtifacts": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Paths removed because the previous artifact manifest referenced them but this generation no longer does (e.g. a renamed rule filename between plugin versions)."
        }
      },
      "required": ["configured", "profiles", "cwd"],
      "additionalProperties": false
    },
    "ProfileId": {
      "type": "string",
      "enum": [
        "developer",
        "architect",
        "sa",
        "pm",
        "mulesoft",
        "ux",
        "cgcloud",
        "qa",
        "crma",
        "commerce",
        "data360",
        "sfmc",
        "salescloud",
        "service",
        "cpq",
        "omnistudio",
        "fsl",
        "ai",
        "slack",
        "tableau",
        "experience-cloud",
        "release-manager",
        "fsc",
        "health",
        "manufacturing",
        "communications",
        "automotive",
        "education",
        "netzero",
        "nonprofit",
        "public-sector",
        "media",
        "energy",
        "revenue",
        "maps",
        "loyalty",
        "industries"
      ]
    },
    "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
    },
    "SetupCompleteness": {
      "type": "string",
      "enum": ["quick", "partial", "full"]
    },
    "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"]
    },
    "KnowledgeManifest": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number"
        },
        "pluginVersion": {
          "type": "string"
        },
        "setupLevel": {
          "$ref": "#/definitions/KnowledgeSetupLevel"
        },
        "scope": {
          "$ref": "#/definitions/KnowledgeScope"
        },
        "sourceRoots": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sourceDigest": {
          "type": "string"
        },
        "generatedAt": {
          "type": "string"
        },
        "artifactDigests": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "degradedReasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "schemaVersion",
        "pluginVersion",
        "setupLevel",
        "scope",
        "sourceRoots",
        "sourceDigest",
        "artifactDigests",
        "degradedReasons"
      ],
      "additionalProperties": false
    },
    "KnowledgeSetupLevel": {
      "type": "string",
      "enum": ["quick", "full"]
    },
    "KnowledgeScope": {
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/definitions/KnowledgeScopeKind"
        },
        "include": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "exclude": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["kind", "include", "exclude"],
      "additionalProperties": false
    },
    "KnowledgeScopeKind": {
      "type": "string",
      "enum": ["repository-full", "source-root-full", "filtered"]
    }
  }
}
