{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://decantr.ai/schemas/scaffold-pack.v1.json",
  "title": "Decantr Scaffold Execution Pack",
  "type": "object",
  "required": ["$schema", "packVersion", "packType", "objective", "target", "preset", "scope", "requiredSetup", "allowedVocabulary", "examples", "antiPatterns", "successChecks", "tokenBudget", "data", "renderedMarkdown"],
  "properties": {
    "$schema": {
      "const": "https://decantr.ai/schemas/scaffold-pack.v1.json"
    },
    "packVersion": {
      "const": "1.0.0"
    },
    "packType": {
      "const": "scaffold"
    },
    "objective": {
      "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/nonEmptyString"
    },
    "target": {
      "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/executionPackTarget"
    },
    "preset": {
      "type": ["string", "null"]
    },
    "scope": {
      "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/executionPackScope"
    },
    "requiredSetup": {
      "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/stringArray"
    },
    "allowedVocabulary": {
      "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/stringArray"
    },
    "examples": {
      "type": "array",
      "items": {
        "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/executionPackExample"
      }
    },
    "antiPatterns": {
      "type": "array",
      "items": {
        "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/executionPackAntiPattern"
      }
    },
    "successChecks": {
      "type": "array",
      "items": {
        "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/executionPackSuccessCheck"
      }
    },
    "tokenBudget": {
      "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/executionPackTokenBudget"
    },
    "data": {
      "type": "object",
      "required": ["shell", "theme", "routing", "features", "routes"],
      "properties": {
        "shell": {
          "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/nonEmptyString"
        },
        "theme": {
          "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/themeRef"
        },
        "routing": {
          "type": "string",
          "enum": ["hash", "history", "pathname"]
        },
        "features": {
          "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/stringArray"
        },
        "navigation": {
          "type": "object",
          "description": "Project-level navigation and command-palette obligations.",
          "required": ["commandPalette", "hotkeys"],
          "properties": {
            "commandPalette": {
              "oneOf": [
                { "type": "boolean" },
                {
                  "type": "object",
                  "properties": {
                    "trigger": { "type": "string" },
                    "placeholder": { "type": "string" },
                    "width": { "type": "string" },
                    "styling": {
                      "type": "string",
                      "enum": ["modal", "sheet", "inline", "fullscreen"]
                    },
                    "commands": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["id", "label"],
                        "properties": {
                          "id": { "type": "string", "minLength": 1 },
                          "label": { "type": "string", "minLength": 1 },
                          "section": { "type": "string" },
                          "hotkey": { "type": "string" },
                          "action": { "type": "string" },
                          "route": { "type": "string" }
                        },
                        "additionalProperties": false
                      }
                    }
                  },
                  "additionalProperties": false
                }
              ]
            },
            "hotkeys": {
              "type": "array",
              "items": {
                "type": "object",
                "required": ["key"],
                "properties": {
                  "key": { "type": "string", "minLength": 1 },
                  "route": { "type": "string" },
                  "label": { "type": "string" },
                  "semantics": {
                    "type": "object",
                    "properties": {
                      "chord_window_ms": { "type": "number" },
                      "input_guard": { "type": "boolean" },
                      "modifier_suppression": { "type": "boolean" },
                      "match_case": { "type": "boolean" }
                    },
                    "additionalProperties": false
                  }
                },
                "additionalProperties": false
              }
            },
            "hotkeySemantics": {
              "type": "object",
              "properties": {
                "chord_window_ms": { "type": "number" },
                "input_guard": { "type": "boolean" },
                "modifier_suppression": { "type": "boolean" },
                "match_case": { "type": "boolean" }
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        },
        "routes": {
          "type": "array",
          "items": {
            "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/routeSummary"
          }
        },
        "themeDecorators": {
          "type": "array",
          "description": "Canonical theme decorator contract — class + intent + slot hint. Lives ONCE in scaffold-pack and is referenced (not duplicated) by section packs as of 1.7.22.",
          "items": {
            "type": "object",
            "required": ["class", "intent", "applyTo"],
            "additionalProperties": false,
            "properties": {
              "class": { "type": "string", "minLength": 1 },
              "intent": { "type": "string" },
              "applyTo": { "type": "string" }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "renderedMarkdown": {
      "$ref": "https://decantr.ai/schemas/execution-pack.common.v1.json#/$defs/nonEmptyString"
    }
  },
  "additionalProperties": false
}
