{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/scaffold-manifest.schema.json",
  "version": "1.0.0",
  "title": "Multi-Agent Pipeline  -  scaffold manifest (.scaffold.json)",
  "description": "Written by a toolkit's scaffold skill at the root of the skeleton it creates, read by scaffold-gate.mjs. It names the stack adapter whose build, test and lint commands prove the skeleton, the values for that adapter's {slot}s, and the command that demonstrates the app between stories. It never names a remote: creating or linking the hosted repository is a separate, explicitly approved step outside the scaffold. Contract: multi-agent-refs/features/scaffold.md.",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "toolkit", "name", "stack"],
  "properties": {
    "version": { "const": "1.0.0" },
    "toolkit": {
      "type": "string",
      "minLength": 1,
      "description": "The plugin whose scaffold skill wrote this skeleton, e.g. ai-ios-toolkit."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "The project name the skeleton was created with."
    },
    "stack": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]*$",
      "description": "An applicable adapter id in schemas/stack-adapters.json (ios, android, web, backend-node, ...)."
    },
    "vars": {
      "type": "object",
      "additionalProperties": { "type": "string" },
      "description": "Values for the adapter's command slots: scheme and simulator for ios. scaffold-gate.mjs sets worktreePath to the skeleton directory and a fresh resultBundle per run."
    },
    "demo": {
      "type": "object",
      "additionalProperties": false,
      "required": ["command", "expect"],
      "description": "Required between stories. A command that terminates on its own, run from the skeleton root, and a JavaScript regular expression its combined output must match.",
      "properties": {
        "command": { "type": "string", "minLength": 1 },
        "expect": { "type": "string", "minLength": 1 }
      }
    }
  }
}
