{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/SynkraAI/aiox-core/schemas/squad-schema.json",
  "title": "AIOX Squad Manifest",
  "description": "Schema for squad.yaml manifest files (Task-First Architecture)",
  "type": "object",
  "required": ["name", "version"],
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$",
      "description": "Squad name in kebab-case (e.g., my-squad-name)",
      "minLength": 2,
      "maxLength": 50
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Semantic version (e.g., 1.0.0)"
    },
    "short-title": {
      "type": "string",
      "maxLength": 100,
      "description": "Short title for the squad"
    },
    "description": {
      "type": "string",
      "maxLength": 500,
      "description": "Brief description of the squad's purpose"
    },
    "author": {
      "type": "string",
      "description": "Author name or organization"
    },
    "license": {
      "type": "string",
      "enum": ["MIT", "Apache-2.0", "ISC", "GPL-3.0", "UNLICENSED"],
      "default": "MIT",
      "description": "License type"
    },
    "slashPrefix": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$",
      "description": "Prefix for slash commands (e.g., 'etl' for /etl-*)"
    },
    "aiox": {
      "type": "object",
      "properties": {
        "minVersion": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "Minimum AIOX version required"
        },
        "type": {
          "type": "string",
          "enum": ["squad"],
          "description": "Must be 'squad'"
        }
      }
    },
    "requires": {
      "type": "object",
      "description": "Runtime requirements",
      "properties": {
        "node": {
          "type": "string",
          "description": "Node.js version requirement (e.g., >=18.0.0)"
        },
        "aiox": {
          "type": "string",
          "description": "AIOX version requirement (e.g., >=2.0.0)"
        }
      }
    },
    "tags": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Keywords for discovery"
    },
    "components": {
      "type": "object",
      "description": "Task-first: tasks are primary entry point",
      "properties": {
        "tasks": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of task files (primary - task-first!)"
        },
        "agents": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of agent definition files"
        },
        "workflows": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of workflow files"
        },
        "checklists": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of checklist files"
        },
        "templates": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of template files"
        },
        "tools": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of tool scripts"
        },
        "scripts": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of automation scripts"
        }
      }
    },
    "scripts": {
      "type": "object",
      "description": "Script definitions organized by category",
      "additionalProperties": {
        "type": "array",
        "items": { "type": "string" }
      }
    },
    "config": {
      "type": "object",
      "description": "Configuration inheritance from aiox-core",
      "properties": {
        "extends": {
          "type": "string",
          "enum": ["extend", "override", "none"],
          "default": "extend",
          "description": "How to handle core config (extend adds rules, override replaces)"
        },
        "coding-standards": {
          "type": "string",
          "description": "Path to squad-specific coding standards (relative to squad root)"
        },
        "tech-stack": {
          "type": "string",
          "description": "Path to squad-specific tech stack doc"
        },
        "source-tree": {
          "type": "string",
          "description": "Path to squad-specific source tree doc"
        }
      }
    },
    "dependencies": {
      "type": "object",
      "properties": {
        "node": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Node.js package dependencies"
        },
        "python": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Python package dependencies"
        },
        "squads": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Other squads this depends on"
        }
      }
    },
    "mcps": {
      "type": "object",
      "description": "MCP server configurations",
      "additionalProperties": true
    },
    "integration": {
      "type": "object",
      "description": "Integration configurations",
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
