{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/kenryu42/claude-code-safety-net/main/assets/cc-safety-net.schema.json",
  "title": "Safety Net Configuration",
  "description": "Configuration file for cc-safety-net plugin custom rules",
  "type": "object",
  "properties": {
    "$schema": {
      "description": "JSON Schema reference for IDE support",
      "type": "string"
    },
    "version": {
      "type": "number",
      "const": 1,
      "description": "Schema version (must be 1)"
    },
    "rules": {
      "default": [],
      "description": "Custom blocking rules",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_-]{0,63}$",
            "description": "Unique identifier for the rule (case-insensitive for duplicate detection)"
          },
          "command": {
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$",
            "description": "Base command to match (e.g., 'git', 'npm', 'docker'). Paths are normalized to basename."
          },
          "subcommand": {
            "description": "Optional subcommand to match (e.g., 'add', 'install'). If omitted, matches any subcommand.",
            "type": "string",
            "pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$"
          },
          "block_args": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "description": "Arguments that trigger the block. Command is blocked if ANY of these are present."
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Message shown when the command is blocked"
          }
        },
        "required": [
          "name",
          "command",
          "block_args",
          "reason"
        ],
        "additionalProperties": false,
        "description": "A custom rule that blocks specific command patterns"
      }
    }
  },
  "required": [
    "version"
  ],
  "additionalProperties": false
}
