{
  "description": "Metadata stored inside .libragen files describing the library contents",
  "type": "object",
  "properties": {
    "name": {
      "description": "Unique name for the library (e.g., \"react-docs\", \"rust-std\")",
      "type": "string"
    },
    "version": {
      "description": "Library version in semver format (e.g., \"1.0.0\")",
      "type": "string"
    },
    "schemaVersion": {
      "description": "Schema version for database compatibility",
      "type": "number"
    },
    "contentVersion": {
      "description": "Version of the source content (e.g., \"1.74.0\" for Rust docs)",
      "type": "string"
    },
    "contentVersionType": {
      "description": "Type of content versioning used",
      "enum": [
        "commit",
        "custom",
        "date",
        "revision",
        "semver"
      ],
      "type": "string"
    },
    "displayName": {
      "description": "Human-readable display name",
      "type": "string"
    },
    "description": {
      "description": "Short description of what this library contains",
      "type": "string"
    },
    "agentDescription": {
      "description": "Detailed guidance for AI agents on when to use this library. Should describe the\ntypes of questions/tasks this library can help with. Example: \"Use this library when\nthe user asks about React hooks, component lifecycle, or JSX syntax. Contains\nofficial React documentation and examples.\"",
      "type": "string"
    },
    "exampleQueries": {
      "description": "Example queries that this library is good at answering. Helps agents understand the\nlibrary's scope through concrete examples.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "keywords": {
      "description": "Searchable keywords/tags",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "programmingLanguages": {
      "description": "Primary programming language(s) covered (e.g., \"typescript\", \"python\")",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "textLanguages": {
      "description": "Human/natural language(s) of the content, as ISO 639-1 codes (e.g., \"en\", \"es\",\n\"zh\")",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "frameworks": {
      "description": "Frameworks or tools covered (e.g., \"react\", \"express\", \"pytest\")",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "license": {
      "type": "string"
    },
    "author": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "repository": {
      "type": "string"
    },
    "createdAt": {
      "type": "string"
    },
    "embedding": {
      "type": "object",
      "properties": {
        "model": {
          "type": "string"
        },
        "dimensions": {
          "type": "number"
        },
        "quantization": {
          "type": "string"
        }
      },
      "required": [
        "dimensions",
        "model"
      ]
    },
    "chunking": {
      "type": "object",
      "properties": {
        "strategy": {
          "type": "string"
        },
        "chunkSize": {
          "type": "number"
        },
        "chunkOverlap": {
          "type": "number"
        }
      },
      "required": [
        "chunkOverlap",
        "chunkSize",
        "strategy"
      ]
    },
    "stats": {
      "type": "object",
      "properties": {
        "chunkCount": {
          "type": "number"
        },
        "sourceCount": {
          "type": "number"
        },
        "fileSize": {
          "type": "number"
        }
      },
      "required": [
        "chunkCount",
        "fileSize",
        "sourceCount"
      ]
    },
    "contentHash": {
      "type": "string"
    },
    "source": {
      "description": "Source provenance information",
      "$ref": "#/definitions/SourceProvenance"
    }
  },
  "required": [
    "chunking",
    "contentHash",
    "createdAt",
    "embedding",
    "name",
    "schemaVersion",
    "stats",
    "version"
  ],
  "definitions": {
    "SourceProvenance": {
      "description": "Information about the source of a library's content.\nTracks where the content came from for provenance and reproducibility.",
      "type": "object",
      "properties": {
        "type": {
          "description": "Source type: 'local' for filesystem, 'git' for git repositories",
          "enum": [
            "git",
            "local"
          ],
          "type": "string"
        },
        "path": {
          "description": "For local sources: the absolute path to the source directory or file",
          "type": "string"
        },
        "url": {
          "description": "For git sources: the repository URL (e.g., \"https://github.com/owner/repo\")",
          "type": "string"
        },
        "ref": {
          "description": "For git sources: the branch, tag, or ref that was checked out",
          "type": "string"
        },
        "commitHash": {
          "description": "For git sources: the full commit SHA",
          "type": "string"
        },
        "licenses": {
          "description": "SPDX license identifiers or custom license strings for the source content",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "type"
      ]
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://libragen.dev/schemas/v1/library-metadata.schema.json",
  "title": "Libragen Library Metadata"
}
