{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://maw.soulbrews.studio/schema/registry.json",
  "title": "maw plugin registry manifest",
  "description": "Source-of-truth manifest listing all curated maw plugins.",
  "type": "object",
  "required": ["schemaVersion", "updated", "plugins"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string"
    },
    "schemaVersion": {
      "const": 1,
      "description": "Manifest schema version. Bump on breaking changes."
    },
    "updated": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 timestamp of last registry update."
    },
    "plugins": {
      "type": "object",
      "description": "Map of plugin-name → registry entry.",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9-]*$",
        "minLength": 2,
        "maxLength": 64
      },
      "additionalProperties": {
        "$ref": "#/$defs/entry"
      }
    },
    "packages": {
      "type": "object",
      "description": "Curated bundles of plugins. `maw plugin install <package>` resolves and installs all referenced plugins. Each `plugins` entry must be a key in the top-level `plugins` map (cross-validated by tooling, not schema).",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9-]*$",
        "minLength": 2,
        "maxLength": 32
      },
      "additionalProperties": {
        "$ref": "#/$defs/package"
      }
    }
  },
  "$defs": {
    "entry": {
      "type": "object",
      "required": ["version", "source", "summary", "author", "license", "addedAt"],
      "additionalProperties": false,
      "properties": {
        "version": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$",
          "description": "Semver of the published plugin."
        },
        "source": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]*/[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*(@[a-zA-Z0-9._-]+)?$",
          "description": "Source locator in owner/repo[/subpath][@ref] form (Vercel-style; consumed by maw-js#939 github: resolver). Owner/repo lowercase."
        },
        "sha256": {
          "oneOf": [
            {"type": "null"},
            {"type": "string", "pattern": "^[a-f0-9]{64}$"}
          ],
          "description": "SHA-256 of the resolved source tarball. Null until CI populates on first release tag."
        },
        "summary": {
          "type": "string",
          "minLength": 4,
          "maxLength": 200
        },
        "author": {
          "type": "string",
          "minLength": 1
        },
        "license": {
          "type": "string",
          "description": "SPDX identifier (e.g. MIT, BUSL-1.1)."
        },
        "homepage": {
          "type": "string",
          "format": "uri"
        },
        "addedAt": {
          "type": "string",
          "format": "date-time"
        },
        "tier": {
          "type": "string",
          "description": "Optional classification tag — e.g. 'extra', 'standard', 'federation', 'dev'."
        }
      }
    },
    "package": {
      "type": "object",
      "required": ["summary", "plugins"],
      "additionalProperties": false,
      "properties": {
        "summary": {
          "type": "string",
          "minLength": 4,
          "maxLength": 200,
          "description": "One-line description of what this bundle is for."
        },
        "plugins": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$"
          },
          "minItems": 1,
          "uniqueItems": true,
          "description": "Plugin names to install when this package is requested."
        }
      }
    }
  }
}
