{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://x07.io/spec/x07-tool-xtal-tests-gen-from-spec.report.schema.json",
  "title": "x07.tool.xtal.tests.gen-from-spec.report@0.1.0",
  "description": "Generic machine-readable report envelope for x07 CLI command wrappers.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "x07.tool.xtal.tests.gen-from-spec.report@0.1.0"
    },
    "command": {
      "type": "string",
      "const": "x07.xtal.tests.gen-from-spec"
    },
    "ok": {
      "type": "boolean"
    },
    "exit_code": {
      "type": "integer",
      "minimum": 0,
      "maximum": 255
    },
    "diagnostics": {
      "type": "array",
      "items": {
        "$ref": "https://x07.io/spec/x07diag.schema.json#/$defs/diagnostic"
      },
      "default": []
    },
    "meta": {
      "$ref": "#/$defs/meta"
    },
    "result": {
      "$ref": "#/$defs/result"
    }
  },
  "required": [
    "schema_version",
    "command",
    "ok",
    "exit_code",
    "diagnostics",
    "meta",
    "result"
  ],
  "$defs": {
    "meta": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "tool": {
          "$ref": "#/$defs/tool_meta"
        },
        "elapsed_ms": {
          "type": "integer",
          "minimum": 0
        },
        "cwd": {
          "type": "string"
        },
        "argv": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "inputs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/file_digest"
          },
          "default": []
        },
        "outputs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/file_digest"
          },
          "default": []
        },
        "nondeterminism": {
          "$ref": "#/$defs/nondeterminism"
        }
      },
      "required": [
        "tool",
        "elapsed_ms",
        "cwd",
        "argv",
        "inputs",
        "outputs",
        "nondeterminism"
      ]
    },
    "tool_meta": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "const": "x07"
        },
        "version": {
          "type": "string"
        },
        "git_sha": {
          "type": "string",
          "pattern": "^[0-9a-fA-F]{7,40}$"
        },
        "rustc": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "version"
      ]
    },
    "file_digest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "bytes_len": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "path",
        "sha256",
        "bytes_len"
      ]
    },
    "nondeterminism": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "uses_os_time": {
          "type": "boolean"
        },
        "uses_network": {
          "type": "boolean"
        },
        "uses_process": {
          "type": "boolean"
        }
      },
      "required": [
        "uses_os_time",
        "uses_network",
        "uses_process"
      ]
    },
    "result": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "stdout": {
          "$ref": "#/$defs/stream_payload"
        },
        "stderr": {
          "$ref": "#/$defs/stream_payload"
        },
        "stdout_json": {},
        "stderr_json": {}
      },
      "required": [
        "stdout",
        "stderr"
      ]
    },
    "stream_payload": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "bytes_len": {
          "type": "integer",
          "minimum": 0
        },
        "text": {
          "type": "string"
        },
        "base64": {
          "type": "string"
        }
      },
      "required": [
        "bytes_len"
      ]
    }
  }
}
