Schema: ownership

{
  "$id": "https://australis.systems/schemas/htmx-ui-template-scaffold/ownership.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Target-side ownership manifest. Maps every path the tool has interacted with to an ownership class, never lets the tool overwrite route-owned or user-owned files, and preserves protected paths. Persisted by reconcile and by assets sync (the planner emits a version of this document under state_root/ownership.yaml).",
  "properties": {
    "plan_digest": {
      "description": "Optional SHA-256 hex digest of the plan that produced the current ownership state. Reconcile writes this; assets sync may omit it.",
      "pattern": "^[a-f0-9]{64}$",
      "type": "string"
    },
    "protected_paths": {
      "description": "Target-relative paths the tool never creates, updates, moves, or deletes.",
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "type": "array",
      "uniqueItems": true
    },
    "route_owned_assets": {
      "additionalProperties": {
        "pattern": "^[a-f0-9]{64}$",
        "type": "string"
      },
      "description": "Map from route-owned generated partial path to the content digest last published by the scaffold. Reconcile may update only an entry whose on-disk digest still matches this map.",
      "type": "object"
    },
    "route_owned_paths": {
      "description": "Target-relative paths that became route-owned through first scaffold. Reconcile never overwrites these.",
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "type": "array",
      "uniqueItems": true
    },
    "schema_version": {
      "description": "Major-version-locked envelope. Documents with any value other than 1.0.0 MUST fail validation, which enforces the major-version-1 contract.",
      "enum": [
        "1.0.0"
      ],
      "type": "string"
    },
    "tool_managed_assets": {
      "additionalProperties": {
        "minLength": 1,
        "type": "string"
      },
      "description": "Map from managed-asset target-relative path to its metadata. Values MUST be strings (e.g. 'TOOL_MANAGED' or a richer metadata inline object encoded as JSON string); the planner writes a marker here for CREATE or IDENTICAL operations.",
      "type": "object"
    },
    "user_owned_paths": {
      "description": "Target-relative paths manually adopted by the user. The tool never writes or deletes these.",
      "items": {
        "minLength": 1,
        "type": "string"
      },
      "type": "array",
      "uniqueItems": true
    }
  },
  "required": [
    "schema_version",
    "route_owned_paths",
    "user_owned_paths",
    "tool_managed_assets",
    "protected_paths"
  ],
  "title": "Ownership Manifest",
  "type": "object"
}