{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ProjectLock",
  "description": "Top-level `ocx.lock` document.\n\nTools are sorted by `(group, name)` at write time for byte-stable output.\nOnly `lock_version` `3` and `4` are accepted, every tool's `repository` must\nbe bare and every platform key canonical.",
  "type": "object",
  "properties": {
    "metadata": {
      "description": "Lock metadata header (version, declaration hash, generator, etc.).",
      "$ref": "#/$defs/LockMetadata"
    },
    "tool": {
      "description": "All locked tools in the project. Sorted by (group, name) at write\ntime for byte-stable output. On disk this is the `[[tool]]` array.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/LockedTool"
      },
      "default": []
    }
  },
  "additionalProperties": false,
  "required": [
    "metadata"
  ],
  "$defs": {
    "LockMetadata": {
      "description": "Lock metadata header.",
      "type": "object",
      "properties": {
        "lock_version": {
          "description": "On-disk schema version.",
          "$ref": "#/$defs/LockVersion"
        },
        "declaration_hash_version": {
          "description": "Canonicalization contract version for `declaration_hash`. Currently\nalways `1`.",
          "type": "integer",
          "format": "uint8",
          "minimum": 0,
          "maximum": 255
        },
        "declaration_hash": {
          "description": "`sha256:<hex>` of the RFC 8785 JCS-canonicalized declaration.",
          "type": "string"
        },
        "generated_by": {
          "description": "Tooling version string that wrote the lock, e.g. `\"ocx 0.3.0\"`.",
          "type": "string"
        },
        "generated_at": {
          "description": "ISO-8601 UTC timestamp. Preserved verbatim when the resolved\ncontent (registry, repository, digest) of every tool is unchanged\nbetween two `ocx lock` runs; updated otherwise.",
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "lock_version",
        "declaration_hash_version",
        "declaration_hash",
        "generated_by",
        "generated_at"
      ]
    },
    "LockVersion": {
      "description": "OCX lock format version. Version 4 adds the per-entry `declared` field; version 3 locks are still read.",
      "type": "integer",
      "enum": [
        3,
        4
      ]
    },
    "LockedTool": {
      "description": "One locked tool entry, identified by the local binding `(group, name)`.\n\n`name` is the key in the developer's `ocx.toml`; `group` is `\"default\"` for\nthe top-level `[tools]` table, else the `[group.<name>]` key. `repository`\nis the bare registry/repo coordinate (no tag, no digest) shared by every\nplatform leaf. `platforms` records one leaf digest per shipped platform,\nkeyed by the canonical platform string; a platform the publisher does not\nship has no key.",
      "type": "object",
      "properties": {
        "name": {
          "description": "Local binding name (TOML key from `ocx.toml`, e.g. `cmake`).",
          "type": "string"
        },
        "group": {
          "description": "Owning group. `\"default\"` for entries from the top-level\n`[tools]` table; otherwise the named `[group.*]` key.",
          "type": "string"
        },
        "repository": {
          "description": "Bare registry/repo coordinates shared by every platform leaf.",
          "$ref": "#/$defs/PackageRef"
        },
        "declared": {
          "description": "The `ocx.toml` spelling this entry was resolved from (e.g.\n`ocx.sh/kitware/cmake:3.29`). Present on every `V4` entry, absent on `V3`.",
          "type": [
            "string",
            "null"
          ]
        },
        "platforms": {
          "description": "Available-only per-platform leaf digests, keyed by the canonical\nplatform string (`os/arch[/variant][+feature,...]` or `any`).",
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/Digest"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "name",
        "group",
        "repository",
        "platforms"
      ]
    },
    "PackageRef": {
      "description": "OCI identifier in the format 'registry/repository[:tag][@digest]'.",
      "type": "string"
    },
    "Digest": {
      "description": "OCI content-addressed digest (e.g. 'sha256:abcdef...').",
      "type": "string",
      "pattern": "^sha(256|384|512):[0-9a-f]+$"
    }
  },
  "$id": "https://ocx.sh/schemas/project-lock/v4.json",
  "$comment": "machine-generated; format may evolve across OCX versions — do not hand-edit"
}
