Schema: copy-manifest

{
  "$defs": {
    "json_value": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "boolean"
        },
        {
          "type": "integer"
        },
        {
          "type": "number"
        },
        {
          "type": "null"
        },
        {
          "items": {
            "$ref": "#/$defs/json_value"
          },
          "type": "array"
        },
        {
          "additionalProperties": {
            "$ref": "#/$defs/json_value"
          },
          "type": "object"
        }
      ]
    }
  },
  "$id": "https://australis.systems/schemas/htmx-ui-template-scaffold/copy-manifest.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Immutable verbatim intake proof for one source copy operation. The schema mirrors the layout of intake/digital-legion/<source-revision>/manifest.json: schema_version + status envelope, target/site identity, source repo metadata plus the per-root file/dir/byte counts, the copy method and commands, the exhaustive verification report (sorted path set equality, file/dir counts, byte totals, sha256 list digest, per-file cmp), and optional environment and timestamp details.",
  "properties": {
    "copy": {
      "additionalProperties": false,
      "description": "Copy method, the array of root paths the copy was scoped to, and the verbatim commands used (in execution order).",
      "properties": {
        "commands": {
          "description": "Copy commands in execution order. Each entry is one shell statement.",
          "items": {
            "minLength": 1,
            "type": "string"
          },
          "minItems": 1,
          "type": "array"
        },
        "method": {
          "description": "Copy method discriminator. The current implementation uses bash with cp --no-clobber --preserve=all.",
          "minLength": 1,
          "type": "string"
        },
        "notes": {
          "description": "Optional human-readable copy notes.",
          "type": "string"
        },
        "roots_variable": {
          "description": "Optional ordered list of root paths passed to the copy script (kept verbatim so the audit can replay).",
          "items": {
            "minLength": 1,
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "method",
        "commands"
      ],
      "type": "object"
    },
    "environment": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Optional environment snapshot used at copy time.",
      "type": "object"
    },
    "file_formats": {
      "additionalProperties": {
        "type": "string"
      },
      "description": "Optional description of the NUL-delimited sidecar files (source-files.zlist, source-dirs.zlist, source.sha256z, destination.sha256z).",
      "type": "object"
    },
    "generated_at": {
      "description": "Optional RFC3339 timestamp the manifest was written.",
      "format": "date-time",
      "type": "string"
    },
    "pre_flight_checks": {
      "additionalProperties": {
        "$ref": "#/$defs/json_value"
      },
      "description": "Optional preflight checks recorded by the copy operation (escape-symlink pass, special-file pass, case-collision pass, etc.).",
      "type": "object"
    },
    "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"
    },
    "source": {
      "additionalProperties": false,
      "description": "Source provenance and the enumerated copy roots with their classification and counts.",
      "properties": {
        "deprecated_subtrees": {
          "description": "Optional list of deprecated subtrees captured as immutable evidence but excluded from deployable manifests.",
          "items": {
            "additionalProperties": false,
            "properties": {
              "classification": {
                "const": "deprecated",
                "type": "string"
              },
              "path": {
                "minLength": 1,
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "path",
              "classification",
              "reason"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "excluded_roots": {
          "description": "Optional list of source paths deliberately not copied.",
          "items": {
            "additionalProperties": false,
            "properties": {
              "path": {
                "minLength": 1,
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "path",
              "reason"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "repo": {
          "additionalProperties": false,
          "description": "Source repository provenance captured at copy time.",
          "properties": {
            "branch": {
              "minLength": 1,
              "type": "string"
            },
            "dirty": {
              "type": "boolean"
            },
            "dirty_note": {
              "type": "string"
            },
            "dirty_state": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "remote": {
              "format": "uri",
              "type": "string"
            },
            "revision": {
              "pattern": "^[a-f0-9]{40}$",
              "type": "string"
            },
            "short_revision": {
              "description": "Optional short revision (first 12+ hex chars).",
              "type": "string"
            }
          },
          "required": [
            "remote",
            "branch",
            "revision",
            "dirty"
          ],
          "type": "object"
        },
        "roots": {
          "description": "Per-root enumeration: classification, reason, file/dir/byte counts.",
          "items": {
            "additionalProperties": false,
            "properties": {
              "bytes": {
                "minimum": 0,
                "type": "integer"
              },
              "classification": {
                "enum": [
                  "deployable_master",
                  "reference_only",
                  "deprecated"
                ],
                "type": "string"
              },
              "dirs": {
                "minimum": 0,
                "type": "integer"
              },
              "files": {
                "minimum": 0,
                "type": "integer"
              },
              "path": {
                "description": "Source-repo-relative path of the copied root.",
                "minLength": 1,
                "type": "string"
              },
              "reason": {
                "description": "Human-readable reason for the classification.",
                "type": "string"
              }
            },
            "required": [
              "path",
              "classification",
              "files",
              "dirs",
              "bytes"
            ],
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "repo",
        "roots"
      ],
      "type": "object"
    },
    "status": {
      "const": "COPY_PROVEN",
      "description": "Copy-proven status. The schema forbids any other status from the immutable manifest.",
      "type": "string"
    },
    "target": {
      "additionalProperties": false,
      "description": "Target package, intake path on disk, payload prefix relative to the intake path, and the consumer repository provenance.",
      "properties": {
        "intake_path": {
          "description": "Target-relative path of the intake directory this manifest lives in.",
          "minLength": 1,
          "type": "string"
        },
        "package": {
          "description": "Target package name (e.g. 'htmx-ui-template-scaffold').",
          "minLength": 1,
          "type": "string"
        },
        "payload_prefix": {
          "description": "Path prefix inside the intake directory under which the copied payloads are stored (relative to intake path).",
          "minLength": 1,
          "type": "string"
        },
        "repo": {
          "additionalProperties": false,
          "description": "Consumer repository provenance captured at copy time.",
          "properties": {
            "branch": {
              "description": "Branch name checked out at copy time.",
              "minLength": 1,
              "type": "string"
            },
            "dirty": {
              "description": "Whether the consumer repo working tree had uncommitted changes at copy time.",
              "type": "boolean"
            },
            "dirty_note": {
              "description": "Optional human-readable note explaining the dirty state.",
              "type": "string"
            },
            "dirty_state": {
              "description": "Optional list of 'git status --porcelain' lines describing the dirty state.",
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "remote": {
              "description": "Repository remote URL.",
              "format": "uri",
              "type": "string"
            },
            "revision": {
              "description": "Full git revision (40-char SHA-1 hex) checked out at copy time.",
              "pattern": "^[a-f0-9]{40}$",
              "type": "string"
            }
          },
          "required": [
            "remote",
            "branch",
            "revision",
            "dirty"
          ],
          "type": "object"
        }
      },
      "required": [
        "package",
        "intake_path",
        "payload_prefix",
        "repo"
      ],
      "type": "object"
    },
    "timestamps": {
      "additionalProperties": {
        "format": "date-time",
        "type": "string"
      },
      "description": "Optional per-phase RFC3339 timestamps.",
      "type": "object"
    },
    "verification": {
      "additionalProperties": false,
      "description": "Verification report produced by sorted path set cmp, file/dir count equality, byte-total equality, mode equality, sha256 list equality, and per-file cmp.",
      "properties": {
        "byte_totals": {
          "additionalProperties": false,
          "properties": {
            "destination": {
              "minimum": 0,
              "type": "integer"
            },
            "equal": {
              "type": "boolean"
            },
            "source": {
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "source",
            "destination",
            "equal"
          ],
          "type": "object"
        },
        "cmp": {
          "additionalProperties": false,
          "properties": {
            "equal": {
              "type": "boolean"
            },
            "files_compared": {
              "minimum": 0,
              "type": "integer"
            },
            "mismatches": {
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "files_compared",
            "mismatches",
            "equal"
          ],
          "type": "object"
        },
        "commands": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "dir_counts": {
          "additionalProperties": false,
          "properties": {
            "destination": {
              "minimum": 0,
              "type": "integer"
            },
            "equal": {
              "type": "boolean"
            },
            "source": {
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "source",
            "destination",
            "equal"
          ],
          "type": "object"
        },
        "dir_modes": {
          "additionalProperties": false,
          "properties": {
            "distinct": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "equal": {
              "type": "boolean"
            }
          },
          "required": [
            "distinct",
            "equal"
          ],
          "type": "object"
        },
        "file_counts": {
          "additionalProperties": false,
          "properties": {
            "destination": {
              "minimum": 0,
              "type": "integer"
            },
            "equal": {
              "type": "boolean"
            },
            "source": {
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "source",
            "destination",
            "equal"
          ],
          "type": "object"
        },
        "file_modes": {
          "additionalProperties": false,
          "properties": {
            "distinct": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "equal": {
              "type": "boolean"
            }
          },
          "required": [
            "distinct",
            "equal"
          ],
          "type": "object"
        },
        "sha256_list_digest": {
          "description": "SHA-256 hex digest over the entire NUL-delimited sha256 list.",
          "pattern": "^[a-f0-9]{64}$",
          "type": "string"
        },
        "sha256_lists_equal": {
          "type": "boolean"
        },
        "sorted_dir_path_sets_equal": {
          "type": "boolean"
        },
        "sorted_file_path_sets_equal": {
          "type": "boolean"
        }
      },
      "required": [
        "commands",
        "sorted_file_path_sets_equal",
        "sorted_dir_path_sets_equal",
        "file_counts",
        "dir_counts",
        "byte_totals",
        "sha256_lists_equal",
        "sha256_list_digest",
        "cmp"
      ],
      "type": "object"
    }
  },
  "required": [
    "schema_version",
    "status",
    "target",
    "source",
    "copy",
    "verification"
  ],
  "title": "Copy Manifest",
  "type": "object"
}