{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/lintel/lintel-catalog-toml/latest.json",
  "title": "Lintel Catalog Builder",
  "description": "Configuration file for the Lintel catalog builder.\n\nDefines how to build a JSON Schema catalog from local schema definitions and\nexternal sources. The catalog builder reads this file, fetches schemas,\norganizes them into groups, and writes the output to one or more targets.\n\nPlace this file at the root of your catalog repository.",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/lintel-rs/catalog/master/schemas/lintel/lintel-catalog-toml.json",
    "sourceSha256": "be4b349faf7030ca79e20bcfd050ff6c43098e0814cde59a2886bd7909cdd194",
    "fileMatch": [
      "lintel-catalog.toml",
      "**/lintel-catalog.toml"
    ],
    "parsers": [
      "toml"
    ],
    "catalogDescription": "Configuration for the Lintel catalog builder."
  },
  "type": "object",
  "properties": {
    "catalog": {
      "description": "Catalog metadata such as the catalog title. Corresponds to the\n`[catalog]` TOML section.",
      "$ref": "#/$defs/CatalogMeta"
    },
    "target": {
      "description": "Named build targets that control where output files are written.\n\nEach key is a target name (e.g. `local`, `pages`) and the value\nspecifies the target type and its options. Multiple targets can be built\nin a single run.\n\nCorresponds to `[target.<name>]` sections in TOML.",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/TargetConfig"
      }
    },
    "groups": {
      "description": "Named schema groups.\n\nEach key is a group identifier (used as the output directory name) and\nthe value defines the group's display name, description, and schema\ndefinitions.\n\nCorresponds to `[groups.<name>]` sections in TOML.",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/GroupConfig"
      }
    },
    "sources": {
      "description": "Named external catalog sources to import schemas from.\n\nEach key is a source identifier and the value specifies the catalog URL\nand optional organization rules that route imported schemas into groups.\n\nCorresponds to `[sources.<name>]` sections in TOML.",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/SourceConfig"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "catalog"
  ],
  "$defs": {
    "CatalogMeta": {
      "title": "Catalog Metadata",
      "description": "Metadata for the catalog, specified in the `[catalog]` section.\n\nThis section is required even if empty.",
      "type": "object",
      "properties": {
        "title": {
          "description": "Human-readable title for the catalog, included in the generated\n`catalog.json` output.",
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "Lintel Schema Catalog"
          ],
          "default": null
        },
        "source-base-url": {
          "description": "Base URL for local schema source files.\n\nWhen set, local schemas (those without a `url`) get their `x-lintel`\n`source` field constructed as `{source-base-url}/schemas/{group}/{key}.json`.\nThis is typically a raw GitHub URL pointing to the catalog repository.\n\nWhen omitted, local schemas use a relative path like\n`schemas/{group}/{key}.json`.",
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "https://raw.githubusercontent.com/lintel-rs/catalog/master"
          ],
          "default": null
        }
      },
      "additionalProperties": false
    },
    "TargetConfig": {
      "title": "Build Target",
      "description": "Output target configuration.\n\nEach target specifies where the built catalog and schema files are written.\nWhen `site.github` is present, GitHub Pages files (`.nojekyll`, `CNAME`) are\nwritten automatically.",
      "type": "object",
      "properties": {
        "dir": {
          "description": "Output directory path (relative to the catalog repository root).",
          "type": "string",
          "examples": [
            "../catalog-generated"
          ]
        },
        "base-url": {
          "description": "Base URL where the catalog will be hosted. Schema URLs in\n`catalog.json` are constructed relative to this URL.",
          "type": "string",
          "examples": [
            "https://raw.githubusercontent.com/org/catalog/master/"
          ]
        },
        "site": {
          "description": "Site-level configuration for description and hosting options.",
          "anyOf": [
            {
              "$ref": "#/$defs/SiteConfig"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "dir",
        "base-url"
      ],
      "additionalProperties": false
    },
    "SiteConfig": {
      "title": "Site Config",
      "description": "Site-level configuration for a build target.\n\nControls metadata and hosting options that apply to the generated static\nsite.",
      "type": "object",
      "properties": {
        "description": {
          "description": "Human-readable description for the site, used in the HTML meta\ndescription tag and JSON-LD structured data.",
          "type": [
            "string",
            "null"
          ],
          "default": null
        },
        "ga-tracking-id": {
          "description": "Google Analytics tracking ID (measurement ID).\n\nWhen set, the generated site includes the Google Analytics Global Site\nTag (`gtag.js`) snippet in every page's `<head>`. The snippet loads\nthe gtag.js library and configures it with the provided measurement ID.\n\nThe injected markup looks like:\n\n```html\n<!-- Google tag (gtag.js) -->\n<script async src=\"<https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID>\"></script>\n<script>\n  window.dataLayer = window.dataLayer || [];\n  function gtag(){dataLayer.push(arguments);}\n  gtag('js', new Date());\n\n  gtag('config', 'GA_TRACKING_ID');\n</script>\n```\n\nwhere `GA_TRACKING_ID` is replaced with the value of this field\n(e.g. `G-XXXXXXXXXX`).\n\nLeave unset (or omit) to disable Google Analytics entirely.",
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "G-XXXXXXXXXX"
          ],
          "default": null
        },
        "github": {
          "description": "GitHub Pages hosting options.",
          "anyOf": [
            {
              "$ref": "#/$defs/GitHubPagesConfig"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "GitHubPagesConfig": {
      "title": "GitHub Pages Options",
      "description": "Options for GitHub Pages hosting.\n\nWhen present on a `dir` target, a `.nojekyll` file is created and an\noptional `CNAME` file is written.",
      "type": "object",
      "properties": {
        "cname": {
          "description": "Custom domain for GitHub Pages. When set, a `CNAME` file is written to\nthe output directory with this value.",
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "catalog.example.com"
          ],
          "default": null
        }
      },
      "additionalProperties": false
    },
    "GroupConfig": {
      "title": "Schema Group",
      "description": "A named collection of related schema definitions.\n\nGroups organize schemas into directories in the built catalog. Each group\nhas a display name and description that appear in the catalog index, and\ncontains one or more schema definitions.\n\nCorresponds to a `[groups.<id>]` section in TOML.",
      "type": "object",
      "properties": {
        "name": {
          "description": "Human-readable display name for this group.",
          "type": "string",
          "examples": [
            "GitHub",
            "Claude Code"
          ]
        },
        "description": {
          "description": "Short description of the schemas in this group, shown in the catalog\nindex.",
          "type": "string"
        },
        "schemas": {
          "description": "Schema definitions within this group.\n\nEach key is a schema identifier (used as the filename, e.g. `agent` ->\n`agent.json`) and the value describes the schema source, display name,\nand file-match patterns.\n\nCorresponds to `[groups.<group>.schemas.<id>]` sections in TOML.",
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/SchemaDefinition"
          }
        }
      },
      "required": [
        "name",
        "description"
      ],
      "additionalProperties": false
    },
    "SchemaDefinition": {
      "title": "Schema Definition",
      "description": "An individual schema entry within a group.\n\nDefines where to obtain the schema, its display metadata, and which files it\nshould match in the catalog.\n\nThe `name` and `description` fields are optional overrides. When omitted,\nthey are auto-populated from the underlying JSON Schema's `title` and\n`description` properties. If the schema has no title, the entry key is used\nas a fallback name.",
      "type": "object",
      "properties": {
        "url": {
          "description": "URL to download the schema from.\n\nIf omitted, the schema is expected to already exist locally at\n`schemas/<group>/<key>.json`.",
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "description": "Human-readable display name for this schema.\n\nWhen omitted, defaults to the `title` property from the JSON Schema.",
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "GitHub Workflow",
            "devenv.yaml"
          ],
          "default": null
        },
        "description": {
          "description": "Short description of what this schema validates.\n\nWhen omitted, defaults to the `description` property from the JSON Schema.",
          "type": [
            "string",
            "null"
          ],
          "default": null
        },
        "file-match": {
          "title": "File Match",
          "description": "Glob patterns for files this schema should be auto-associated with.\n\nEditors and tools use these patterns to automatically apply the schema\nwhen a matching file is opened.",
          "type": "array",
          "items": {
            "type": "string"
          },
          "examples": [
            [
              "**/.github/workflows/*.yml"
            ],
            [
              "devenv.yaml"
            ]
          ],
          "default": []
        },
        "versions": {
          "description": "Alternate versions of this schema, keyed by version identifier.\nValues are URLs to the versioned schema.",
          "type": "object",
          "default": {},
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "SourceConfig": {
      "title": "External Catalog Source",
      "description": "An external schema catalog to import schemas from.\n\nThe catalog builder fetches the JSON catalog from the given URL, then uses\nthe `organize` rules to route matching schemas into local groups.\n\nCorresponds to a `[sources.<id>]` section in TOML.",
      "type": "object",
      "properties": {
        "url": {
          "description": "URL to the external catalog JSON file (in `SchemaStore` format:\n`{\"schemas\": [...]}`).",
          "type": "string",
          "examples": [
            "https://www.schemastore.org/api/json/catalog.json"
          ]
        },
        "exclude-matches": {
          "description": "Filenames to exclude from this source.\n\nIf any of a schema's `fileMatch` entries match one of these patterns\n(using the same glob logic as `organize`), the schema is skipped\nentirely. Use this to suppress source schemas that duplicate\nexplicitly configured group entries.",
          "type": "array",
          "items": {
            "type": "string"
          },
          "examples": [
            [
              "biome.jsonc"
            ]
          ],
          "default": []
        },
        "organize": {
          "description": "Rules for routing schemas from this source into local groups.\n\nEach key is a group identifier (matching a key in `[groups]`) and the\nvalue contains glob patterns. Schemas whose names or URLs match any\npattern are placed into that group.\n\nCorresponds to `[sources.<source>.organize.<group>]` sections in TOML.",
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/OrganizeEntry"
          }
        }
      },
      "required": [
        "url"
      ],
      "additionalProperties": false
    },
    "OrganizeEntry": {
      "title": "Organize Entry",
      "description": "Routing rule that assigns schemas from an external source to a local group.\n\nContains glob patterns to match against schema names or URLs. Group metadata\n(display name, description) is defined in the corresponding `[groups]`\nentry.",
      "type": "object",
      "properties": {
        "match": {
          "description": "Glob patterns matched against schema names or URLs from the external\ncatalog.\n\nSchemas matching any pattern are imported into the corresponding group\ndirectory.",
          "type": "array",
          "items": {
            "type": "string"
          },
          "examples": [
            [
              "**.github**"
            ],
            [
              "*docker*"
            ]
          ]
        }
      },
      "required": [
        "match"
      ],
      "additionalProperties": false
    }
  }
}
