{
  "type": "object",
  "properties": {},
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/zigai/pi-tweaks/master/packages/pi-typed-args/schemas/skill-arguments.schema.json",
  "title": "Pi Typed Args Skill Arguments",
  "description": "Schema for the top-level `arguments` field in SKILL.md frontmatter used by pi-typed-args.",
  "propertyNames": {
    "type": "string",
    "allOf": [
      {
        "pattern": "^[A-Za-z0-9_.-]+$"
      },
      {
        "not": {
          "pattern": "(^|\\.)(__proto__|constructor|prototype)(\\.|$)"
        }
      }
    ]
  },
  "additionalProperties": {
    "$ref": "#/$defs/argumentOrNamespace"
  },
  "$defs": {
    "argumentName": {
      "type": "string",
      "allOf": [
        {
          "pattern": "^[A-Za-z0-9_.-]+$"
        },
        {
          "not": {
            "pattern": "(^|\\.)(__proto__|constructor|prototype)(\\.|$)"
          }
        }
      ]
    },
    "argumentOrNamespace": {
      "anyOf": [
        {
          "$ref": "#/$defs/argument"
        },
        {
          "type": "object",
          "properties": {},
          "propertyNames": {
            "$ref": "#/$defs/argumentName"
          },
          "additionalProperties": {
            "$ref": "#/$defs/argumentOrNamespace"
          }
        }
      ]
    },
    "shared": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last", "append"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean"
        }
      },
      "allOf": [
        {
          "not": {
            "required": ["aliases"]
          }
        },
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "ui": {
      "type": "object",
      "properties": {
        "widget": {
          "enum": [
            "text",
            "textarea",
            "number",
            "toggle",
            "select",
            "radio",
            "multiselect",
            "path",
            "file",
            "directory",
            "command",
            "secret",
            "list",
            "key-value",
            "duration",
            "date",
            "time",
            "datetime",
            "url",
            "email",
            "json",
            "code",
            "stepper",
            "readonly",
            "computed",
            "confirm"
          ]
        },
        "rows": {
          "type": "integer",
          "minimum": 1
        },
        "title": {
          "type": "string"
        },
        "disabled": {
          "type": "boolean"
        },
        "visible_when": {
          "type": "boolean"
        },
        "enabled_when": {
          "type": "boolean"
        },
        "required_when": {
          "type": "boolean"
        },
        "section": {
          "type": "string"
        },
        "advanced": {
          "type": "boolean"
        },
        "copy_from": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "stringArgument": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "type": "string",
          "const": "string"
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean"
        },
        "ui": {
          "type": "object",
          "properties": {
            "widget": {
              "enum": [
                "text",
                "textarea",
                "number",
                "toggle",
                "select",
                "radio",
                "multiselect",
                "path",
                "file",
                "directory",
                "command",
                "secret",
                "list",
                "key-value",
                "duration",
                "date",
                "time",
                "datetime",
                "url",
                "email",
                "json",
                "code",
                "stepper",
                "readonly",
                "computed",
                "confirm"
              ]
            },
            "rows": {
              "type": "integer",
              "minimum": 1
            },
            "title": {
              "type": "string"
            },
            "disabled": {
              "type": "boolean"
            },
            "visible_when": {
              "type": "boolean"
            },
            "enabled_when": {
              "type": "boolean"
            },
            "required_when": {
              "type": "boolean"
            },
            "section": {
              "type": "string"
            },
            "advanced": {
              "type": "boolean"
            },
            "copy_from": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "default": {
          "type": "string"
        },
        "min_length": {
          "type": "integer",
          "minimum": 0
        },
        "max_length": {
          "type": "integer",
          "minimum": 0
        },
        "pattern": {
          "type": "string"
        },
        "format": {
          "enum": ["email", "url", "date", "time", "datetime", "duration", "json"]
        },
        "sensitive": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "numberArgument": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "type": "string",
          "const": "number"
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean",
          "const": false
        },
        "ui": {
          "type": "object",
          "properties": {
            "widget": {
              "enum": [
                "text",
                "textarea",
                "number",
                "toggle",
                "select",
                "radio",
                "multiselect",
                "path",
                "file",
                "directory",
                "command",
                "secret",
                "list",
                "key-value",
                "duration",
                "date",
                "time",
                "datetime",
                "url",
                "email",
                "json",
                "code",
                "stepper",
                "readonly",
                "computed",
                "confirm"
              ]
            },
            "rows": {
              "type": "integer",
              "minimum": 1
            },
            "title": {
              "type": "string"
            },
            "disabled": {
              "type": "boolean"
            },
            "visible_when": {
              "type": "boolean"
            },
            "enabled_when": {
              "type": "boolean"
            },
            "required_when": {
              "type": "boolean"
            },
            "section": {
              "type": "string"
            },
            "advanced": {
              "type": "boolean"
            },
            "copy_from": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "default": {
          "type": "number"
        },
        "integer": {
          "type": "boolean"
        },
        "min": {
          "type": "number"
        },
        "max": {
          "type": "number"
        },
        "step": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "unit": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "booleanArgument": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "type": "string",
          "const": "boolean"
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean",
          "const": false
        },
        "ui": {
          "type": "object",
          "properties": {
            "widget": {
              "enum": [
                "text",
                "textarea",
                "number",
                "toggle",
                "select",
                "radio",
                "multiselect",
                "path",
                "file",
                "directory",
                "command",
                "secret",
                "list",
                "key-value",
                "duration",
                "date",
                "time",
                "datetime",
                "url",
                "email",
                "json",
                "code",
                "stepper",
                "readonly",
                "computed",
                "confirm"
              ]
            },
            "rows": {
              "type": "integer",
              "minimum": 1
            },
            "title": {
              "type": "string"
            },
            "disabled": {
              "type": "boolean"
            },
            "visible_when": {
              "type": "boolean"
            },
            "enabled_when": {
              "type": "boolean"
            },
            "required_when": {
              "type": "boolean"
            },
            "section": {
              "type": "string"
            },
            "advanced": {
              "type": "boolean"
            },
            "copy_from": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "default": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "enumArgument": {
      "type": "object",
      "required": ["type", "values"],
      "properties": {
        "type": {
          "type": "string",
          "const": "enum"
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean",
          "const": false
        },
        "ui": {
          "type": "object",
          "properties": {
            "widget": {
              "enum": [
                "text",
                "textarea",
                "number",
                "toggle",
                "select",
                "radio",
                "multiselect",
                "path",
                "file",
                "directory",
                "command",
                "secret",
                "list",
                "key-value",
                "duration",
                "date",
                "time",
                "datetime",
                "url",
                "email",
                "json",
                "code",
                "stepper",
                "readonly",
                "computed",
                "confirm"
              ]
            },
            "rows": {
              "type": "integer",
              "minimum": 1
            },
            "title": {
              "type": "string"
            },
            "disabled": {
              "type": "boolean"
            },
            "visible_when": {
              "type": "boolean"
            },
            "enabled_when": {
              "type": "boolean"
            },
            "required_when": {
              "type": "boolean"
            },
            "section": {
              "type": "string"
            },
            "advanced": {
              "type": "boolean"
            },
            "copy_from": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "default": {
          "type": "string"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "option_descriptions": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "multiEnumArgument": {
      "type": "object",
      "required": ["type", "values"],
      "properties": {
        "type": {
          "enum": ["multi_enum", "multi-enum"]
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last", "append"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean"
        },
        "ui": {
          "type": "object",
          "properties": {
            "widget": {
              "enum": [
                "text",
                "textarea",
                "number",
                "toggle",
                "select",
                "radio",
                "multiselect",
                "path",
                "file",
                "directory",
                "command",
                "secret",
                "list",
                "key-value",
                "duration",
                "date",
                "time",
                "datetime",
                "url",
                "email",
                "json",
                "code",
                "stepper",
                "readonly",
                "computed",
                "confirm"
              ]
            },
            "rows": {
              "type": "integer",
              "minimum": 1
            },
            "title": {
              "type": "string"
            },
            "disabled": {
              "type": "boolean"
            },
            "visible_when": {
              "type": "boolean"
            },
            "enabled_when": {
              "type": "boolean"
            },
            "required_when": {
              "type": "boolean"
            },
            "section": {
              "type": "string"
            },
            "advanced": {
              "type": "boolean"
            },
            "copy_from": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "default": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "uniqueItems": true
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "min_items": {
          "type": "integer",
          "minimum": 0
        },
        "max_items": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "stringListArgument": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "enum": ["string_list", "string-list"]
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last", "append"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean"
        },
        "ui": {
          "type": "object",
          "properties": {
            "widget": {
              "enum": [
                "text",
                "textarea",
                "number",
                "toggle",
                "select",
                "radio",
                "multiselect",
                "path",
                "file",
                "directory",
                "command",
                "secret",
                "list",
                "key-value",
                "duration",
                "date",
                "time",
                "datetime",
                "url",
                "email",
                "json",
                "code",
                "stepper",
                "readonly",
                "computed",
                "confirm"
              ]
            },
            "rows": {
              "type": "integer",
              "minimum": 1
            },
            "title": {
              "type": "string"
            },
            "disabled": {
              "type": "boolean"
            },
            "visible_when": {
              "type": "boolean"
            },
            "enabled_when": {
              "type": "boolean"
            },
            "required_when": {
              "type": "boolean"
            },
            "section": {
              "type": "string"
            },
            "advanced": {
              "type": "boolean"
            },
            "copy_from": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "default": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "min_items": {
          "type": "integer",
          "minimum": 0
        },
        "max_items": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "keyValueArgument": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": {
          "enum": ["key_value", "key-value"]
        },
        "description": {
          "type": "string"
        },
        "examples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "title": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "placeholder": {
          "type": "string"
        },
        "occurrence": {
          "enum": ["error", "first", "last", "append"]
        },
        "position": {
          "type": "integer",
          "minimum": 0
        },
        "rest": {
          "type": "boolean",
          "const": false
        },
        "ui": {
          "type": "object",
          "properties": {
            "widget": {
              "enum": [
                "text",
                "textarea",
                "number",
                "toggle",
                "select",
                "radio",
                "multiselect",
                "path",
                "file",
                "directory",
                "command",
                "secret",
                "list",
                "key-value",
                "duration",
                "date",
                "time",
                "datetime",
                "url",
                "email",
                "json",
                "code",
                "stepper",
                "readonly",
                "computed",
                "confirm"
              ]
            },
            "rows": {
              "type": "integer",
              "minimum": 1
            },
            "title": {
              "type": "string"
            },
            "disabled": {
              "type": "boolean"
            },
            "visible_when": {
              "type": "boolean"
            },
            "enabled_when": {
              "type": "boolean"
            },
            "required_when": {
              "type": "boolean"
            },
            "section": {
              "type": "string"
            },
            "advanced": {
              "type": "boolean"
            },
            "copy_from": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "default": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "type": "string"
            }
          }
        },
        "min_items": {
          "type": "integer",
          "minimum": 0
        },
        "max_items": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "required": ["required", "default"],
            "properties": {
              "required": {
                "const": true
              }
            }
          }
        }
      ]
    },
    "argument": {
      "anyOf": [
        {
          "$ref": "#/$defs/stringArgument"
        },
        {
          "$ref": "#/$defs/numberArgument"
        },
        {
          "$ref": "#/$defs/booleanArgument"
        },
        {
          "$ref": "#/$defs/enumArgument"
        },
        {
          "$ref": "#/$defs/multiEnumArgument"
        },
        {
          "$ref": "#/$defs/stringListArgument"
        },
        {
          "$ref": "#/$defs/keyValueArgument"
        }
      ]
    }
  }
}
