{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/pipeline-designer/pipeline-designer.github.io/main/schemas/package-manifest.schema.json",
  "title": "Agent Pipeline Designer Package Manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "id",
    "name",
    "version",
    "description",
    "author",
    "license",
    "repository",
    "categories",
    "files"
  ],
  "properties": {
    "$schema": { "type": "string" },
    "schemaVersion": { "const": 1 },
    "id": {
      "type": "string",
      "maxLength": 128,
      "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)+$"
    },
    "name": { "type": "string", "minLength": 2, "maxLength": 80 },
    "version": {
      "type": "string",
      "maxLength": 100,
      "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
    },
    "description": { "type": "string", "minLength": 10, "maxLength": 300 },
    "author": { "type": "string", "minLength": 2, "maxLength": 100 },
    "license": { "type": "string", "minLength": 2, "maxLength": 80 },
    "repository": {
      "type": "string",
      "minLength": 10,
      "maxLength": 500,
      "format": "uri",
      "pattern": "^https://(?:github\\.com|raw\\.githubusercontent\\.com)/"
    },
    "categories": {
      "type": "array",
      "maxItems": 12,
      "uniqueItems": true,
      "items": { "type": "string", "minLength": 2, "maxLength": 40 }
    },
    "files": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": { "$ref": "#/$defs/file" }
    }
  },
  "$defs": {
    "file": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "source", "sha256", "size"],
      "properties": {
        "path": {
          "type": "string",
          "pattern": "^(?:\\.github/agents/[a-z0-9][a-z0-9-]{0,63}\\.agent\\.md|\\.github/instructions/[a-z0-9][a-z0-9-]{0,63}\\.instructions\\.md|\\.github/prompts/[a-z0-9][a-z0-9-]{0,63}\\.prompt\\.md|\\.github/copilot-instructions\\.md)$"
        },
        "source": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*(?:/[A-Za-z0-9][A-Za-z0-9._-]*)*$"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "size": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100000
        }
      }
    }
  }
}
