{
  "$id": "https://crewx.dev/schemas/hooks",
  "type": "array",
  "items": {
    "type": "object",
    "required": ["name"],
    "properties": {
      "name": { "type": "string" },
      "provider": {
        "oneOf": [
          { "enum": ["claude", "codex", "gemini", "copilot", "opencode"] },
          { "type": "array", "items": { "enum": ["claude", "codex", "gemini", "copilot", "opencode"] } }
        ]
      },
      "team": { "oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] },
      "role": { "oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] },
      "tag": { "oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] },
      "agents": { "type": "array", "items": { "type": "string" } },
      "event": { "enum": ["PreToolUse"] },
      "config": { "type": "object" },
      "deny": {
        "type": "object",
        "required": ["reason"],
        "properties": {
          "when": { "type": "array", "items": { "type": "string" } },
          "pattern": { "type": "string" },
          "regex": { "type": "string" },
          "pathPattern": { "type": "string" },
          "pathSizeMin": { "oneOf": [{ "type": "number" }, { "type": "string" }] },
          "pathSizeMax": { "oneOf": [{ "type": "number" }, { "type": "string" }] },
          "reason": { "type": "string" }
        },
        "additionalProperties": false
      },
      "guide": {
        "type": "object",
        "required": ["say"],
        "properties": {
          "when": { "type": "array", "items": { "type": "string" } },
          "pattern": { "type": "string" },
          "regex": { "type": "string" },
          "pathPattern": { "type": "string" },
          "pathSizeMin": { "oneOf": [{ "type": "number" }, { "type": "string" }] },
          "pathSizeMax": { "oneOf": [{ "type": "number" }, { "type": "string" }] },
          "whenInputRegex": { "type": "string" },
          "say": { "type": "string" },
          "once": { "type": "boolean" }
        },
        "additionalProperties": false
      },
      "plugin": { "type": "string" }
    },
    "oneOf": [
      { "required": ["deny"] },
      { "required": ["guide"] },
      { "required": ["plugin"] }
    ]
  }
}
