{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "number",
      "const": 1
    },
    "contextDir": {
      "type": "string",
      "minLength": 1,
      "pattern": "^(?!\\/)(?!.*(?:^|\\/)\\.\\.(?:\\/|$))[A-Za-z0-9._\\-/]+$"
    },
    "targets": {
      "default": [],
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "baseline": {
      "type": "string",
      "enum": [
        "ecc"
      ]
    },
    "posture": {
      "type": "string",
      "enum": [
        "vibe",
        "enterprise"
      ]
    },
    "kiroHookRuntime": {
      "type": "string",
      "enum": [
        "ide1-cli3",
        "cli2"
      ]
    },
    "managedMcpProjection": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "state": {
          "type": "string",
          "enum": [
            "active",
            "revoked"
          ]
        },
        "expected": {
          "type": "object",
          "properties": {
            "allowManagedMcpServersOnly": {
              "type": "boolean",
              "const": true
            },
            "allowedMcpServers": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "serverCommand": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "serverCommand"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "allowManagedMcpServersOnly",
            "allowedMcpServers"
          ],
          "additionalProperties": false
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "schemaVersion",
        "state",
        "expected",
        "sha256"
      ],
      "additionalProperties": false
    },
    "kiroMcpProjection": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "state": {
          "type": "string",
          "enum": [
            "active",
            "revoked"
          ]
        },
        "expected": {
          "type": "object",
          "properties": {
            "mcpServers": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]{0,119}$"
              },
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "stdio"
                  },
                  "command": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "args": {
                    "maxItems": 128,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 2048
                    }
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  },
                  "classification": {
                    "type": "string",
                    "enum": [
                      "local",
                      "third-party-hosted"
                    ]
                  },
                  "egress": {
                    "type": "string",
                    "enum": [
                      "none",
                      "local-only",
                      "vendor-incumbent",
                      "third-party"
                    ]
                  },
                  "credentials": {
                    "type": "string",
                    "enum": [
                      "none",
                      "oauth",
                      "token"
                    ]
                  },
                  "supplyChain": {
                    "type": "string",
                    "enum": [
                      "pinned",
                      "hosted-remote",
                      "unpinned"
                    ]
                  },
                  "env": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 4096
                    }
                  },
                  "skillsProvider": {
                    "type": "object",
                    "properties": {
                      "provider": {
                        "type": "string",
                        "enum": [
                          "SkillProvider",
                          "SkillsProvider",
                          "SkillsDirectoryProvider",
                          "ClaudeSkillsProvider",
                          "skills"
                        ]
                      },
                      "serverVersion": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "manifestSha256": {
                        "type": "string",
                        "pattern": "^[a-f0-9]{64}$"
                      },
                      "hotReload": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "provider",
                      "hotReload"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "command",
                  "args",
                  "description",
                  "classification",
                  "egress",
                  "credentials",
                  "supplyChain"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "mcpServers"
          ],
          "additionalProperties": false
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "required": [
        "schemaVersion",
        "state",
        "expected",
        "sha256"
      ],
      "additionalProperties": false
    },
    "adopt": {
      "type": "object",
      "properties": {
        "acknowledged": {
          "default": [],
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "binding": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "framework": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "enum": [
                "ecc",
                "superpowers"
              ]
            },
            "mode": {
              "type": "string",
              "enum": [
                "lean",
                "full"
              ]
            },
            "host": {
              "type": "string",
              "enum": [
                "claude"
              ]
            },
            "features": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "minLength": 1
              },
              "additionalProperties": {
                "type": "boolean"
              }
            }
          },
          "required": [
            "id",
            "host"
          ],
          "additionalProperties": false
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "git"
                },
                "repository": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2048
                },
                "commitSha": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{40}$"
                },
                "treeDigest": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                }
              },
              "required": [
                "kind",
                "repository",
                "commitSha",
                "treeDigest"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "npm"
                },
                "package": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 214,
                  "pattern": "^(?:@[a-z0-9][a-z0-9._-]*\\/)?[a-z0-9][a-z0-9._-]*$"
                },
                "exactVersion": {
                  "type": "string",
                  "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z][0-9A-Za-z.-]*)?(?:\\+[0-9A-Za-z][0-9A-Za-z.-]*)?$"
                },
                "integrity": {
                  "type": "string",
                  "pattern": "^sha512-[A-Za-z0-9+/]{86}==$"
                }
              },
              "required": [
                "kind",
                "package",
                "exactVersion",
                "integrity"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "schemaVersion",
        "framework",
        "source"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "contextDir"
  ],
  "title": ".aih-config.json"
}
