{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://trueref.dev/schema/trueref-config.json",
  "title": "TrueRef Repository Configuration",
  "description": "Configuration file for controlling how a repository is indexed and presented by TrueRef. Place as trueref.json (or context7.json for backward compatibility) at the root of your repository.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "projectTitle": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Override the display name for this library. When set, this replaces the repository name in search results and UI."
    },
    "description": {
      "type": "string",
      "minLength": 10,
      "maxLength": 500,
      "description": "A short description of the library used for search ranking and display. Should accurately describe the library's purpose."
    },
    "folders": {
      "type": "array",
      "maxItems": 50,
      "description": "Allowlist of folder path prefixes or regex strings to include in indexing. If empty or absent, all folders are included. Examples: [\"src/\", \"docs/\", \"^packages/core\"]",
      "items": {
        "type": "string",
        "maxLength": 200,
        "description": "A path prefix or regex string. Paths are matched against the full relative file path within the repository."
      }
    },
    "excludeFolders": {
      "type": "array",
      "maxItems": 50,
      "description": "Folders to exclude from indexing. Applied after the 'folders' allowlist. Examples: [\"test/\", \"fixtures/\", \"__mocks__\"]",
      "items": {
        "type": "string",
        "maxLength": 200,
        "description": "A path prefix or regex string for folders to exclude."
      }
    },
    "excludeFiles": {
      "type": "array",
      "maxItems": 100,
      "description": "Exact filenames to exclude (no path, no regex). Examples: [\"README.md\", \"CHANGELOG.md\", \"jest.config.ts\"]",
      "items": {
        "type": "string",
        "maxLength": 200,
        "description": "An exact filename (not a path). Must not contain path separators."
      }
    },
    "rules": {
      "type": "array",
      "maxItems": 20,
      "description": "Best practices and rules to inject at the top of every query-docs response. These are shown to AI coding assistants to guide correct library usage.",
      "items": {
        "type": "string",
        "minLength": 5,
        "maxLength": 500,
        "description": "A single best-practice rule or guideline for using this library."
      }
    },
    "previousVersions": {
      "type": "array",
      "maxItems": 50,
      "description": "Previously released versions to make available for versioned documentation queries.",
      "items": {
        "type": "object",
        "required": ["tag", "title"],
        "additionalProperties": false,
        "properties": {
          "tag": {
            "type": "string",
            "pattern": "^v?\\d+\\.\\d+(\\.\\d+)?(-.*)?$",
            "description": "Git tag name for this version (e.g. \"v1.2.3\", \"2.0.0-beta.1\")."
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "description": "Human-readable version label (e.g. \"Version 1.2.3\", \"v2 Legacy\")."
          }
        }
      }
    }
  }
}
