Repositories/EigenverftModule/eigenverft-module-package-definition-1.1.schema.json

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://eigenverft.local/schemas/eigenverft-module-package-definition-1.1.schema.json",
  "title": "Eigenverft module package definition (schemaVersion 1.1 wire)",
  "$comment": "Mandatory baseline wire model. schemaVersion is fixed to \"1.1\" (see properties.schemaVersion.const); successor to the retired 1.0 definition line.",
  "description": "Package definition (schemaVersion 1.1): package-scoped root with one shared lifecycle block (install/remove/discovery/validation). Supersedes earlier on-disk shapes including schemaVersion 1.0.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "id",
    "display",
    "upstreamSources",
    "providedTools",
    "shared",
    "releases"
  ],
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Optional JSON Schema association for editors and linters."
    },
    "schemaVersion": {
      "description": "Mandatory baseline wire version. Must be \"1.1\" (successor to the retired 1.0 definition line).",
      "type": "string",
      "const": "1.1"
    },
    "id": {
      "description": "Stable package definition id (normally filename stem).",
      "type": "string",
      "minLength": 1
    },
    "display": {
      "description": "Default display labels (localizations intentionally omitted).",
      "allOf": [
        {
          "$ref": "#/$defs/displayDefaultOnly"
        }
      ]
    },
    "upstreamSources": {
      "description": "Named upstream sources used by release acquisition candidates.",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/upstreamSource"
      }
    },
    "dependencies": {
      "description": "Optional package dependencies to resolve before lifecycle operations. May be a single dependencyRef object or an array of dependencyRef (both deserialize the same in PowerShell).",
      "oneOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/dependencyRef"
          }
        },
        {
          "$ref": "#/$defs/dependencyRef"
        }
      ]
    },
    "providedTools": {
      "description": "Package-owned commands/apps. Single source of truth (no duplicate shim list in shared).",
      "allOf": [
        {
          "$ref": "#/$defs/providedTools"
        }
      ]
    },
    "shared": {
      "description": "Lifecycle rules shared by all releases: discovery, policy, install/remove pair, and validation expectations.",
      "$ref": "#/$defs/sharedLifecycle"
    },
    "releases": {
      "description": "Only per-release facts: identity, constraints, artifact, and acquisition sequence.",
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/releaseNarrow"
      }
    }
  },
  "$defs": {
    "displayDefaultOnly": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "default"
      ],
      "properties": {
        "default": {
          "$ref": "#/$defs/displayEntry"
        }
      }
    },
    "displayEntry": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "publisher",
        "corporation",
        "summary"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "publisher": {
          "type": "string"
        },
        "corporation": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        }
      }
    },
    "dependencyRef": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "repositoryId",
        "definitionId"
      ],
      "properties": {
        "repositoryId": {
          "type": "string"
        },
        "definitionId": {
          "type": "string"
        }
      }
    },
    "upstreamSource": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "baseUri"
          ],
          "properties": {
            "kind": {
              "const": "download"
            },
            "baseUri": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "repositoryOwner",
            "repositoryName"
          ],
          "properties": {
            "kind": {
              "const": "githubRelease"
            },
            "repositoryOwner": {
              "type": "string"
            },
            "repositoryName": {
              "type": "string"
            }
          }
        }
      ]
    },
    "providedTools": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "commands",
        "apps"
      ],
      "properties": {
        "commands": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/namedRelativePath"
          }
        },
        "apps": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/namedRelativePath"
          }
        }
      }
    },
    "namedRelativePath": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "relativePath"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "relativePath": {
          "type": "string"
        }
      }
    },
    "sharedLifecycle": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "compatibility",
        "discovery",
        "ownershipPolicy",
        "install",
        "remove",
        "validation"
      ],
      "properties": {
        "compatibility": {
          "$ref": "#/$defs/compatibility"
        },
        "discovery": {
          "$ref": "#/$defs/existingInstallDiscovery"
        },
        "ownershipPolicy": {
          "$ref": "#/$defs/existingInstallPolicy"
        },
        "install": {
          "$ref": "#/$defs/install"
        },
        "remove": {
          "$ref": "#/$defs/removePolicy"
        },
        "validation": {
          "$ref": "#/$defs/validation"
        }
      }
    },
    "removePolicy": {
      "description": "Remove-side controls paired with install metadata. No separate remove command graph.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "keepInstallDirectory",
        "keepInventoryRecord",
        "keepShims",
        "requireProcessExit"
      ],
      "properties": {
        "keepInstallDirectory": {
          "type": "boolean"
        },
        "keepInventoryRecord": {
          "type": "boolean"
        },
        "keepShims": {
          "type": "boolean"
        },
        "requireProcessExit": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "verifyAbsentUsingValidation": {
          "type": "boolean",
          "description": "When true, runtime may reuse validation probes in inverted mode for post-remove verification."
        }
      }
    },
    "compatibility": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "checks"
      ],
      "properties": {
        "checks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/compatibilityCheck"
          }
        }
      }
    },
    "compatibilityCheck": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "operator",
            "value"
          ],
          "properties": {
            "kind": {
              "const": "osVersion"
            },
            "operator": {
              "type": "string"
            },
            "value": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "operator",
            "value"
          ],
          "properties": {
            "kind": {
              "const": "physicalOrVideoMemoryGiB"
            },
            "operator": {
              "type": "string"
            },
            "value": {
              "type": "number"
            },
            "onFail": {
              "type": "string"
            }
          }
        }
      ]
    },
    "pathRegistration": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "mode"
          ],
          "properties": {
            "mode": {
              "const": "none"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "mode",
            "source"
          ],
          "properties": {
            "mode": {
              "const": "user"
            },
            "source": {
              "$ref": "#/$defs/pathRegistrationSource"
            }
          }
        }
      ]
    },
    "pathRegistrationSource": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "value"
          ],
          "properties": {
            "kind": {
              "const": "shim"
            },
            "value": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "values"
          ],
          "properties": {
            "kind": {
              "const": "shim"
            },
            "values": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1
            }
          }
        }
      ]
    },
    "install": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "installDirectory",
            "pathRegistration",
            "expandedRoot",
            "createDirectories"
          ],
          "properties": {
            "kind": {
              "const": "expandArchive"
            },
            "installDirectory": {
              "type": "string"
            },
            "pathRegistration": {
              "$ref": "#/$defs/pathRegistration"
            },
            "expandedRoot": {
              "type": "string"
            },
            "createDirectories": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "installerCommand",
            "packageSpec",
            "installDirectory",
            "pathRegistration"
          ],
          "properties": {
            "kind": {
              "const": "npmGlobalPackage"
            },
            "installerCommand": {
              "type": "string"
            },
            "packageSpec": {
              "type": "string"
            },
            "installDirectory": {
              "type": "string"
            },
            "pathRegistration": {
              "$ref": "#/$defs/pathRegistration"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "installDirectory",
            "targetRelativePath",
            "pathRegistration"
          ],
          "properties": {
            "kind": {
              "const": "placePackageFile"
            },
            "installDirectory": {
              "type": "string"
            },
            "targetRelativePath": {
              "type": "string"
            },
            "pathRegistration": {
              "$ref": "#/$defs/pathRegistration"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "installDirectory",
            "installerKind",
            "uiMode",
            "elevation",
            "timeoutSec",
            "commandArguments",
            "targetDirectoryArgument",
            "successExitCodes",
            "restartExitCodes",
            "pathRegistration"
          ],
          "properties": {
            "kind": {
              "const": "nsisInstaller"
            },
            "installDirectory": {
              "type": "string"
            },
            "installerKind": {
              "type": "string"
            },
            "uiMode": {
              "type": "string"
            },
            "elevation": {
              "type": "string"
            },
            "timeoutSec": {
              "type": "number"
            },
            "commandArguments": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "targetDirectoryArgument": {
              "type": "object",
              "additionalProperties": true
            },
            "successExitCodes": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "restartExitCodes": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "pathRegistration": {
              "$ref": "#/$defs/pathRegistration"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "targetKind",
            "installerKind",
            "uiMode",
            "elevation",
            "timeoutSec",
            "logRelativePath",
            "commandArguments",
            "successExitCodes",
            "restartExitCodes",
            "pathRegistration"
          ],
          "properties": {
            "kind": {
              "const": "runInstaller"
            },
            "targetKind": {
              "type": "string"
            },
            "installerKind": {
              "type": "string"
            },
            "uiMode": {
              "type": "string"
            },
            "elevation": {
              "type": "string"
            },
            "timeoutSec": {
              "type": "number"
            },
            "logRelativePath": {
              "type": "string"
            },
            "commandArguments": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "successExitCodes": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "restartExitCodes": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "pathRegistration": {
              "$ref": "#/$defs/pathRegistration"
            }
          }
        }
      ]
    },
    "validation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "files",
        "directories",
        "commandChecks",
        "signatures",
        "fileDetails"
      ],
      "properties": {
        "files": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "directories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "commandChecks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/commandCheck"
          }
        },
        "metadataFiles": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "signatures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/signatureCheck"
          }
        },
        "fileDetails": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/fileDetail"
          }
        },
        "registryChecks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/registryCheck"
          }
        }
      }
    },
    "commandCheck": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "entryPoint",
        "arguments",
        "outputPattern"
      ],
      "properties": {
        "entryPoint": {
          "type": "string"
        },
        "arguments": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outputPattern": {
          "type": "string"
        },
        "expectedValue": {
          "type": "string"
        }
      }
    },
    "signatureCheck": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "relativePath",
        "requireValid",
        "subjectContains"
      ],
      "properties": {
        "relativePath": {
          "type": "string"
        },
        "requireValid": {
          "type": "boolean"
        },
        "subjectContains": {
          "type": "string"
        }
      }
    },
    "fileDetail": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "relativePath"
      ],
      "properties": {
        "relativePath": {
          "type": "string"
        },
        "productName": {
          "type": "string"
        },
        "fileDescription": {
          "type": "string"
        },
        "fileVersion": {
          "type": "string"
        },
        "productVersion": {
          "type": "string"
        }
      }
    },
    "registryCheck": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "paths"
      ],
      "properties": {
        "paths": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "valueName": {
          "type": "string"
        },
        "expectedValue": {},
        "operator": {
          "type": "string"
        }
      }
    },
    "existingInstallDiscovery": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "enableDetection",
        "searchLocations",
        "installRootRules"
      ],
      "properties": {
        "enableDetection": {
          "type": "boolean"
        },
        "searchLocations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/searchLocation"
          }
        },
        "installRootRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/installRootRule"
          }
        }
      }
    },
    "searchLocation": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "name"
          ],
          "properties": {
            "kind": {
              "const": "command"
            },
            "name": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "path"
          ],
          "properties": {
            "kind": {
              "const": "path"
            },
            "path": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "searchOrder",
            "paths",
            "installDirectorySource"
          ],
          "properties": {
            "kind": {
              "const": "windowsUninstallRegistryKey"
            },
            "searchOrder": {
              "type": "number"
            },
            "paths": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "minItems": 1
            },
            "installDirectorySource": {
              "type": "string"
            }
          }
        }
      ]
    },
    "installRootRule": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "match",
        "installRootRelativePath"
      ],
      "properties": {
        "match": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "value"
          ],
          "properties": {
            "kind": {
              "const": "fileName"
            },
            "value": {
              "type": "string"
            }
          }
        },
        "installRootRelativePath": {
          "type": "string"
        }
      }
    },
    "existingInstallPolicy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "allowAdoptExternal",
        "upgradeAdoptedInstall",
        "requirePackageOwnership"
      ],
      "properties": {
        "allowAdoptExternal": {
          "type": "boolean"
        },
        "upgradeAdoptedInstall": {
          "type": "boolean"
        },
        "requirePackageOwnership": {
          "type": "boolean"
        }
      }
    },
    "constraints": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "os",
        "cpu"
      ],
      "properties": {
        "os": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "cpu": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        }
      }
    },
    "contentHash": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "algorithm",
        "value"
      ],
      "properties": {
        "algorithm": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "publisherSignature": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "requireValid",
        "subjectContains"
      ],
      "properties": {
        "kind": {
          "const": "authenticode"
        },
        "requireValid": {
          "type": "boolean"
        },
        "subjectContains": {
          "type": "string"
        }
      }
    },
    "acquisitionCandidate": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "searchOrder",
            "verification"
          ],
          "properties": {
            "kind": {
              "const": "packageDepot"
            },
            "searchOrder": {
              "type": "number"
            },
            "verification": {
              "$ref": "#/$defs/verification"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "kind",
            "sourceId",
            "searchOrder",
            "verification"
          ],
          "properties": {
            "kind": {
              "const": "download"
            },
            "sourceId": {
              "type": "string"
            },
            "sourcePath": {
              "type": "string"
            },
            "searchOrder": {
              "type": "number"
            },
            "verification": {
              "$ref": "#/$defs/verification"
            }
          }
        }
      ]
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "required",
            "optional"
          ]
        }
      }
    },
    "releaseNarrow": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "version",
        "releaseTrack",
        "flavor",
        "constraints"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "releaseTag": {
          "type": "string"
        },
        "releaseTrack": {
          "type": "string"
        },
        "flavor": {
          "type": "string"
        },
        "constraints": {
          "$ref": "#/$defs/constraints"
        },
        "packageFile": {
          "$ref": "#/$defs/packageFileNarrow"
        },
        "acquisitionCandidates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/acquisitionCandidate"
          }
        }
      }
    },
    "packageFileNarrow": {
      "description": "Per-release acquisition artifact only.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "fileName"
      ],
      "properties": {
        "fileName": {
          "type": "string"
        },
        "contentHash": {
          "$ref": "#/$defs/contentHash"
        },
        "publisherSignature": {
          "$ref": "#/$defs/publisherSignature"
        }
      }
    }
  }
}