{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://claude-context.dev/schemas/automation.schema.json",
  "title": "Claude Context Automation Configuration",
  "description": "Schema for automation/config.json",
  "type": "object",
  "required": ["version"],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON Schema reference"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Configuration version"
    },
    "generators": {
      "type": "object",
      "description": "Auto-generation settings",
      "properties": {
        "code_mapper": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean", "default": true },
            "output": { "type": "string" },
            "include_patterns": {
              "type": "array",
              "items": { "type": "string" }
            },
            "exclude_patterns": {
              "type": "array",
              "items": { "type": "string" }
            }
          }
        },
        "index_builder": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean", "default": true },
            "rebuild_on_change": { "type": "boolean", "default": true },
            "indexes": {
              "type": "array",
              "items": { "type": "string" }
            }
          }
        }
      }
    },
    "hooks": {
      "type": "object",
      "description": "Git hook settings",
      "properties": {
        "pre_commit": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean", "default": true },
            "check_drift": { "type": "boolean", "default": true },
            "block_on_stale": { "type": "boolean", "default": false }
          }
        },
        "post_commit": {
          "type": "object",
          "properties": {
            "enabled": { "type": "boolean", "default": true },
            "rebuild_code_map": { "type": "boolean", "default": true },
            "update_hashes": { "type": "boolean", "default": true }
          }
        }
      }
    },
    "sync": {
      "type": "object",
      "description": "Synchronization settings",
      "properties": {
        "semantic_anchors": { "type": "boolean", "default": true },
        "hash_algorithm": {
          "type": "string",
          "enum": ["md5", "sha1", "sha256"],
          "default": "md5"
        },
        "staleness_thresholds": {
          "type": "object",
          "properties": {
            "warning_days": { "type": "integer", "default": 30 },
            "stale_days": { "type": "integer", "default": 90 }
          }
        }
      }
    }
  },
  "additionalProperties": false
}
