{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://project-templates-504498.gitlab.io/technical_design/APIs/provided/repo-config.schema.json",
  "title": ".repo.yaml",
  "description": "Configuration of a repository, owned by the developer and read by `repo update` (capability 001). Rules a JSON Schema cannot express - exactly one artifact for repoType single, unique artifact names, supported language/type combinations - are enforced by `repo update`.",
  "type": "object",
  "required": ["name", "description", "repository", "repoType", "ci", "artifacts"],
  "properties": {
    "name": { "type": "string", "minLength": 1, "description": "Human-readable name of the repository." },
    "description": { "type": "string", "minLength": 1, "description": "One sentence." },
    "repository": {
      "type": "string",
      "pattern": "^[a-z0-9.-]+\\.[a-z]+(/[A-Za-z0-9_.-]+){2,}$",
      "description": "Path of the repository at its host, without scheme or .git, e.g. gitlab.com/<group>/<project>. Go module path, Java package, and registry default derive from it."
    },
    "repoType": { "enum": ["single", "mono"], "description": "single: one artifact at the root. mono: one artifact per subdirectory, named after the artifact." },
    "ci": { "enum": ["gitlab", "github"] },
    "assistants": {
      "type": "array",
      "items": { "enum": ["claude", "copilot"] },
      "default": [],
      "description": "AI assistants to configure; none unless named."
    },
    "documentation": {
      "enum": ["lean", "extended"],
      "default": "lean",
      "description": "How much the repository documents beyond its specifications (capability 010). lean: ADRs in the lean template. extended: ADRs in the MADR template, and templates for use cases, business rules, and an arc42 architecture description in docs/."
    },
    "requirements": {
      "enum": ["repo", "external"],
      "default": "repo",
      "description": "Where the Capability Specifications are kept (capability 010). repo: files in specs/capabilities/. external: issues in the tracker that tracker names."
    },
    "tracker": {
      "type": "string",
      "pattern": "^https?://",
      "description": "URL of the issue list holding the Capability Specifications, for requirements: external (capability 010). Absent: the issues of repository labeled capability, on the forge of ci.",
      "examples": [
        "https://gitlab.com/my-group/my-project/-/issues/?label_name%5B%5D=capability",
        "https://github.com/my-org/my-project/issues?q=is%3Aissue+label%3Acapability",
        "https://example.atlassian.net/jira/software/projects/KEY/issues"
      ]
    },
    "artifacts": { "type": "array", "items": { "$ref": "#/$defs/artifact" } },
    "meta": {
      "type": "object",
      "properties": {
        "generatorVersion": { "type": "string", "description": "Written by `repo update` only." },
        "artifacts": {
          "type": "object",
          "additionalProperties": { "type": "array", "items": { "type": "string" } },
          "description": "Modules generated per artifact name. Written by `repo update` only."
        }
      }
    }
  },
  "$defs": {
    "artifact": {
      "type": "object",
      "required": ["name", "title", "description", "language", "type"],
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$",
          "description": "Slug: executable, archive, image, tag prefix, and, in a mono repository, directory."
        },
        "title": { "type": "string", "minLength": 1, "description": "Human-readable name." },
        "description": { "type": "string", "minLength": 1, "description": "One sentence." },
        "language": { "enum": ["cpp", "go", "java", "typescript", "kicad"] },
        "type": { "enum": ["library", "service", "tool", "frontend-react", "firmware-stm32", "electronics"] },
        "modules": { "type": "array", "items": { "type": "string" }, "description": "Modules to generate; absent: the profile's defaults." },
        "registry": { "type": ["string", "null"], "description": "Container registry; absent: derived from repository and ci." },
        "port": { "type": ["integer", "null"], "description": "Host port in the generated Compose files; absent: 8080 plus the artifact's position, counted from 0." }
      }
    }
  }
}
