{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/inquilabee/maina/main/docs/maina-manifest.schema.json",
  "title": "maina tool manifest",
  "description": "Shape of a maina YAML manifest. Cross-field and backend-specific rules are still enforced by the loader at Tool() time.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "abstract": {
      "type": "boolean"
    },
    "args": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/$defs/arg"
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "cli": {
      "type": "string",
      "minLength": 1
    },
    "env": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "extends": {
      "type": "string"
    },
    "install": {
      "anyOf": [
        {
          "$ref": "#/$defs/install"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "output": {
      "anyOf": [
        {
          "$ref": "#/$defs/output"
        },
        {
          "type": "null"
        }
      ]
    },
    "parser": {
      "type": "string",
      "minLength": 1
    },
    "platforms": {
      "type": "array",
      "items": {
        "enum": [
          "linux",
          "macos",
          "windows"
        ]
      }
    },
    "requires": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "schema": {
      "const": 1
    },
    "separator": {
      "type": "string",
      "minLength": 1
    },
    "subcommand": {
      "type": "string"
    },
    "timeout": {
      "type": "number",
      "exclusiveMinimum": 0
    },
    "version": {
      "type": "string"
    }
  },
  "$defs": {
    "arg": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "choices": {
          "type": "array",
          "items": {
            "type": [
              "string",
              "integer"
            ]
          },
          "minItems": 1
        },
        "default": {},
        "description": {
          "type": "string"
        },
        "false_flag": {
          "type": "string",
          "minLength": 1
        },
        "flag": {
          "type": "string",
          "minLength": 1
        },
        "help": {
          "type": "string"
        },
        "join": {
          "type": "string",
          "minLength": 1,
          "examples": [
            ",",
            ";",
            ":"
          ]
        },
        "joiner": {
          "type": "string"
        },
        "order": {
          "type": "integer"
        },
        "positional": {
          "type": "boolean"
        },
        "repeat": {
          "type": "boolean"
        },
        "required": {
          "type": "boolean"
        },
        "type": {
          "enum": [
            "flag",
            "pairs",
            "path",
            "string"
          ]
        }
      }
    },
    "install": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "allow_any_executable": {
          "type": "boolean"
        },
        "allow_scripts": {
          "type": "boolean"
        },
        "allow_sdist": {
          "type": "boolean"
        },
        "arch_map": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "asset_template": {
          "type": "string",
          "minLength": 1
        },
        "assets": {
          "type": "object",
          "propertyNames": {
            "type": "string",
            "pattern": "^(linux|macos|windows)-([a-z0-9_]+)$",
            "examples": [
              "linux-arm64",
              "linux-x86_64",
              "macos-arm64",
              "macos-x86_64",
              "windows-arm64",
              "windows-x86_64"
            ]
          },
          "additionalProperties": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "backend": {
          "type": "string",
          "minLength": 1,
          "examples": [
            "github",
            "npm",
            "path",
            "pip",
            "script"
          ]
        },
        "binary": {
          "type": "string",
          "minLength": 1
        },
        "entry": {
          "type": "string",
          "minLength": 1
        },
        "os_map": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "package": {
          "type": "string",
          "minLength": 1
        },
        "repo": {
          "type": "string",
          "minLength": 1
        },
        "sha256": {
          "type": "object",
          "propertyNames": {
            "type": "string",
            "pattern": "^(linux|macos|windows)-([a-z0-9_]+)$",
            "examples": [
              "linux-arm64",
              "linux-x86_64",
              "macos-arm64",
              "macos-x86_64",
              "windows-arm64",
              "windows-x86_64"
            ]
          },
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9a-fA-F]{64}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "tag": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "output": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "allow_stale_report": {
          "type": "boolean"
        },
        "format": {
          "type": "string"
        },
        "from_file": {
          "type": "string",
          "minLength": 1
        },
        "success_codes": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        }
      }
    }
  }
}
