{
  "additionalProperties": false,
  "properties": {
    "backend_form": {
      "description": "How the backend travels: source, prebuilt or none.",
      "enum": [
        "none",
        "source",
        "prebuilt"
      ],
      "type": "string"
    },
    "checks": {
      "additionalProperties": false,
      "description": "Summary of the check report bundled with the package.",
      "properties": {
        "errors": {
          "description": "Rules that could not run.",
          "type": "integer"
        },
        "failed": {
          "description": "Findings that failed during the pack gate.",
          "type": "integer"
        },
        "passed": {
          "description": "Findings that passed during the pack gate.",
          "type": "integer"
        }
      },
      "required": [
        "passed",
        "failed"
      ],
      "type": "object"
    },
    "created_with": {
      "description": "Version of app-anything that packed this package.",
      "type": "string"
    },
    "digest": {
      "description": "Digest over the sorted file digests.",
      "examples": [
        "sha256:0123abcd"
      ],
      "pattern": "^sha256:[0-9a-f]{64}$",
      "type": "string"
    },
    "files": {
      "additionalProperties": {
        "description": "expected a digest like 'sha256:<64 hex digits>'",
        "examples": [
          "sha256:0123abcd"
        ],
        "pattern": "^sha256:[0-9a-f]{64}$",
        "type": "string"
      },
      "description": "Digest of every file in the package, keyed by package-relative path.",
      "type": "object"
    },
    "manifest": {
      "additionalProperties": false,
      "description": "The resolved manifest: every inherited value made explicit.",
      "properties": {
        "backend": {
          "anyOf": [
            {
              "additionalProperties": false,
              "properties": {
                "entry": {
                  "description": "Command that starts the backend, like `python -m server`.",
                  "oneOf": [
                    {
                      "description": "a shell command",
                      "type": "string"
                    },
                    {
                      "description": "an argv array",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  ]
                },
                "health": {
                  "description": "Path returning 2xx once the backend is ready.",
                  "examples": [
                    "/healthz"
                  ],
                  "pattern": "^/[^\\s?#]*$",
                  "type": "string"
                },
                "lock": {
                  "anyOf": [
                    {
                      "description": "expected a relative posix path without '..' parts",
                      "examples": [
                        "webapp"
                      ],
                      "pattern": "^[^*\\s:\\\\]+$",
                      "type": "string"
                    },
                    {}
                  ],
                  "description": "Lock file that pins backend dependencies, like `uv.lock` or `package-lock.json`."
                },
                "prebuilt": {
                  "additionalProperties": {
                    "description": "expected a relative posix path without '..' parts",
                    "examples": [
                      "webapp"
                    ],
                    "pattern": "^[^*\\s:\\\\]+$",
                    "type": "string"
                  },
                  "description": "Escape hatch: per-triple prebuilt binaries, like `{'aarch64-apple-darwin': 'bin/reach-macos'}`.",
                  "type": "object"
                },
                "runtime": {
                  "description": "Runtime the backend needs, like `python>=3.11` or `node>=20`.",
                  "oneOf": [
                    {
                      "examples": [
                        "python>=3.11",
                        "node>=20"
                      ],
                      "pattern": "^[a-z][a-z0-9-]*(==|>=|<=|~=|>|<)?[^\\s]*$",
                      "type": "string"
                    },
                    {
                      "additionalProperties": false,
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "specifier": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name"
                      ],
                      "type": "object"
                    }
                  ]
                },
                "sources": {
                  "description": "Globs copied into the package relative to the project root, like `('src/**', 'server.py')`.",
                  "items": {
                    "description": "expected a glob pattern relative to the project root",
                    "examples": [
                      "src/**"
                    ],
                    "pattern": "^[^:\\s\\\\]+$",
                    "type": "string"
                  },
                  "type": "array"
                },
                "start_timeout": {
                  "description": "Seconds to wait for the health path before failing.",
                  "type": "number"
                },
                "stop_timeout": {
                  "description": "Seconds to wait after stdin closes or SIGTERM before the process tree is killed.",
                  "type": "number"
                }
              },
              "required": [
                "runtime",
                "entry",
                "sources"
              ],
              "type": "object"
            },
            {}
          ],
          "description": "Backend process contract; absent for static or wasm-only apps."
        },
        "capabilities_version": {
          "description": "Capability set the `requires` list refers to.",
          "type": "integer"
        },
        "config": {
          "additionalProperties": {
            "additionalProperties": false,
            "properties": {
              "access": {
                "description": "`read` for files, `read-write` for directories the app may change.",
                "enum": [
                  "read",
                  "read-write"
                ],
                "type": "string"
              },
              "env": {
                "anyOf": [
                  {
                    "description": "expected an environment variable name like 'APP_DATA_DIR'",
                    "examples": [
                      "APP_DATA_DIR"
                    ],
                    "pattern": "^[A-Z][A-Z0-9_]*$",
                    "type": "string"
                  },
                  {}
                ],
                "description": "Environment variable the backend reads the value from; defaults to `APP_CONFIG_<NAME>`."
              },
              "required": {
                "description": "Whether the app can run without this value.",
                "type": "boolean"
              },
              "title": {
                "description": "Human-readable question shown by the app when the value is missing.",
                "type": "string"
              },
              "type": {
                "description": "Kind of value: directory, file, string or boolean.",
                "enum": [
                  "directory",
                  "file",
                  "string",
                  "boolean"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "title"
            ],
            "type": "object"
          },
          "description": "Values the app asks the user for, like a notes folder.",
          "type": "object"
        },
        "extensions": {
          "additionalProperties": {
            "additionalProperties": {},
            "type": "object"
          },
          "description": "Opaque `x-<creator>` blocks; the core only checks the key prefix.",
          "type": "object"
        },
        "format": {
          "description": "Format version this manifest was written for.",
          "examples": [
            "0.1"
          ],
          "pattern": "^\\d+\\.\\d+$",
          "type": "string"
        },
        "frontend": {
          "additionalProperties": false,
          "description": "Where the frontend lives and how it is built.",
          "properties": {
            "build": {
              "anyOf": [
                {
                  "oneOf": [
                    {
                      "description": "a shell command",
                      "type": "string"
                    },
                    {
                      "description": "an argv array",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  ]
                },
                {}
              ],
              "description": "Command that produces `dist`; run by `pack` when present."
            },
            "dist": {
              "description": "Folder containing index.html, relative to the project root.",
              "examples": [
                "webapp"
              ],
              "pattern": "^[^*\\s:\\\\]+$",
              "type": "string"
            },
            "served_by": {
              "description": "`host` serves the files itself; `backend` means the backend serves them at `/`.",
              "enum": [
                "host",
                "backend"
              ],
              "type": "string"
            }
          },
          "required": [
            "dist"
          ],
          "type": "object"
        },
        "id": {
          "description": "Reverse-dns app id, like `com.example.app`.",
          "examples": [
            "com.example.app"
          ],
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*(\\.[a-z0-9]+(-[a-z0-9]+)*)+$",
          "type": "string"
        },
        "integration": {
          "additionalProperties": false,
          "description": "OS integration the app registers for.",
          "properties": {
            "file_types": {
              "description": "File types the app registers as able to open.",
              "items": {
                "additionalProperties": false,
                "properties": {
                  "description": {
                    "description": "Shown by the OS in open-with dialogs.",
                    "type": "string"
                  },
                  "extensions": {
                    "description": "Extensions the app opens, like `('.md',)`.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "extensions"
                ],
                "type": "object"
              },
              "type": "array"
            },
            "url_schemes": {
              "description": "URL schemes the app registers, like `('reach',)`.",
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "type": "object"
        },
        "name": {
          "description": "Human-readable app name.",
          "type": "string"
        },
        "requires": {
          "description": "Capabilities the app needs, like `('ui.static', 'fs.app-data')`.",
          "items": {
            "description": "expected a capability id like 'ui.static' or a vendor id like 'x-acme.bluetooth'",
            "examples": [
              "ui.static"
            ],
            "pattern": "^(x-[a-z0-9]+(-[a-z0-9]+)*|[a-z][a-z0-9-]*)(\\.[a-z][a-z0-9-]*)+$",
            "type": "string"
          },
          "type": "array"
        },
        "update": {
          "anyOf": [
            {
              "additionalProperties": false,
              "properties": {
                "channel": {
                  "description": "Update channel to track.",
                  "type": "string"
                },
                "public_key": {
                  "description": "Public key the feed is signed with.",
                  "type": "string"
                },
                "url": {
                  "description": "URL of the signed update feed.",
                  "type": "string"
                }
              },
              "required": [
                "url",
                "public_key"
              ],
              "type": "object"
            },
            {}
          ],
          "description": "Author-run update feed; distribution stays the author's concern."
        },
        "version": {
          "description": "App version, semantic.",
          "examples": [
            "1.2.3"
          ],
          "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$",
          "type": "string"
        },
        "window": {
          "additionalProperties": false,
          "description": "Initial window geometry.",
          "properties": {
            "height": {
              "description": "Initial window height in pixels.",
              "type": "integer"
            },
            "min_height": {
              "description": "Minimum window height in pixels.",
              "type": "integer"
            },
            "min_width": {
              "description": "Minimum window width in pixels.",
              "type": "integer"
            },
            "resizable": {
              "description": "Whether the window can be resized.",
              "type": "boolean"
            },
            "title": {
              "anyOf": [
                {
                  "type": "string"
                },
                {}
              ],
              "description": "Window title; defaults to the app name."
            },
            "width": {
              "description": "Initial window width in pixels.",
              "type": "integer"
            }
          },
          "type": "object"
        }
      },
      "required": [
        "id",
        "name",
        "version",
        "frontend"
      ],
      "type": "object"
    },
    "package_format": {
      "description": "Package layout version, independent of the manifest format.",
      "type": "integer"
    }
  },
  "required": [
    "manifest",
    "backend_form",
    "digest",
    "created_with",
    "checks"
  ],
  "title": "PackageManifest",
  "type": "object"
}
