Add TUI release request contract
This commit is contained in:
parent
d71e9fc4e1
commit
ff1387f1eb
8 changed files with 292 additions and 3 deletions
|
|
@ -467,6 +467,14 @@ Recently cut:
|
|||
`scripts/run-evetui-capture-contract-smoke.ps1`. Plugin projection, terminal
|
||||
package release, and actual transcript/cell-grid capture artifacts remain
|
||||
pending.
|
||||
- EveTui release lifecycle now carries a structured pending release request
|
||||
contract. The runtime capability manifest reads version truth from
|
||||
`runtimes/incubating/eve-tui/package.json`, names the
|
||||
`gamecult.eve.runtime_release_request.v1` request schema, and proves the
|
||||
`evetui-v{version}` tag plus terminal runtime artifact path through
|
||||
`tools/evetui/evetui-release-contract.mjs` and
|
||||
`scripts/run-evetui-release-contract-smoke.ps1`. This proves the request
|
||||
shape without pretending the EveTui package has been published.
|
||||
- Aetheria interactive world surfaces now carry a structured provider-owned
|
||||
`worldInteraction` contract. The provider advertisement names projection
|
||||
kind, provider state schemas, daemon command boundary, receipt schema,
|
||||
|
|
|
|||
|
|
@ -64,15 +64,21 @@
|
|||
"ownerRepo": "EveTui",
|
||||
"packageName": "eve-tui",
|
||||
"packageRoot": "runtimes/incubating/eve-tui",
|
||||
"versionSource": "runtimes/incubating/eve-tui/eve-runtime-capability.json",
|
||||
"versionSource": "runtimes/incubating/eve-tui/package.json",
|
||||
"tagPattern": "evetui-v{version}",
|
||||
"artifactKind": "terminal-runtime",
|
||||
"requestSchema": "gamecult.eve.runtime_release_request.v1",
|
||||
"requestBuilder": "tools/evetui/evetui-release-contract.mjs",
|
||||
"artifactPattern": "artifacts/evetui-release/{version}/eve-tui-{version}.tgz",
|
||||
"publishProof": "Terminal runtime release is created from the EveTui repo and references the provider-agnostic TUI package root."
|
||||
},
|
||||
"evidencePaths": [
|
||||
"runtimes/incubating/eve-tui/package.json",
|
||||
"runtimes/incubating/eve-tui/src/eve-tui-shell.mjs",
|
||||
"runtimes/incubating/eve-tui/evetui-split-handoff.json",
|
||||
"tools/evetui/evetui-release-contract.mjs",
|
||||
"tools/evetui/evetui-release-contract.test.mjs",
|
||||
"scripts/run-evetui-release-contract-smoke.ps1",
|
||||
"scripts/run-evetui-split-handoff-smoke.ps1"
|
||||
],
|
||||
"pendingProofs": [
|
||||
|
|
|
|||
|
|
@ -103,11 +103,14 @@ foreach ($stage in @("release", "test", "capture")) {
|
|||
}
|
||||
|
||||
$releaseContract = $manifest.lifecycle.release.releaseContract
|
||||
foreach ($field in @("ownerRepo", "packageName", "packageRoot", "versionSource", "tagPattern", "artifactKind", "publishProof")) {
|
||||
foreach ($field in @("ownerRepo", "packageName", "packageRoot", "versionSource", "tagPattern", "artifactKind", "requestSchema", "requestBuilder", "artifactPattern", "publishProof")) {
|
||||
if (-not $releaseContract.$field) {
|
||||
throw "EveTui release contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
|
||||
throw "EveTui release contract has unexpected request schema: $($releaseContract.requestSchema)"
|
||||
}
|
||||
foreach ($pathProperty in @("packageRoot", "versionSource")) {
|
||||
$relativePath = $releaseContract.$pathProperty
|
||||
$absolutePath = Join-Path $projectRoot $relativePath
|
||||
|
|
@ -115,6 +118,13 @@ foreach ($pathProperty in @("packageRoot", "versionSource")) {
|
|||
throw "EveTui release contract $pathProperty does not exist: $relativePath"
|
||||
}
|
||||
}
|
||||
foreach ($pathProperty in @("requestBuilder")) {
|
||||
$relativePath = $releaseContract.$pathProperty
|
||||
$absolutePath = Join-Path $projectRoot $relativePath
|
||||
if (-not (Test-Path -LiteralPath $absolutePath)) {
|
||||
throw "EveTui release contract $pathProperty does not exist: $relativePath"
|
||||
}
|
||||
}
|
||||
|
||||
$testContract = $manifest.lifecycle.test.testContract
|
||||
foreach ($field in @("ownerRepo", "runnerKind", "runnerScript", "consumerProject", "packageName", "testAssembly", "testPlatform", "resultsArtifact", "logArtifact", "manifestMutation")) {
|
||||
|
|
@ -161,6 +171,7 @@ foreach ($pathProperty in @("requestBuilder", "advertisementPath")) {
|
|||
}
|
||||
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-split-handoff-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-release-contract-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-provider-shell-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-evetui-capture-contract-smoke.ps1")
|
||||
|
||||
|
|
|
|||
98
scripts/run-evetui-release-contract-smoke.ps1
Normal file
98
scripts/run-evetui-release-contract-smoke.ps1
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
param(
|
||||
[string] $CapabilityManifestPath = "runtimes\incubating\eve-tui\eve-runtime-capability.json",
|
||||
[string] $OutputPath = "artifacts\evetui-release-contract\latest\release-request.json"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$absoluteCapabilityPath = if ([System.IO.Path]::IsPathRooted($CapabilityManifestPath)) {
|
||||
$CapabilityManifestPath
|
||||
} else {
|
||||
Join-Path $projectRoot $CapabilityManifestPath
|
||||
}
|
||||
$absoluteOutputPath = if ([System.IO.Path]::IsPathRooted($OutputPath)) {
|
||||
$OutputPath
|
||||
} else {
|
||||
Join-Path $projectRoot $OutputPath
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $absoluteCapabilityPath)) {
|
||||
throw "EveTui release contract input not found: $absoluteCapabilityPath"
|
||||
}
|
||||
|
||||
$manifest = Get-Content -LiteralPath $absoluteCapabilityPath -Raw | ConvertFrom-Json
|
||||
$releaseContract = $manifest.lifecycle.release.releaseContract
|
||||
if ($null -eq $releaseContract) {
|
||||
throw "EveTui release contract missing lifecycle.release.releaseContract"
|
||||
}
|
||||
foreach ($field in @("ownerRepo", "packageName", "packageRoot", "versionSource", "tagPattern", "artifactKind", "requestSchema", "requestBuilder", "artifactPattern", "publishProof")) {
|
||||
if (-not $releaseContract.$field) {
|
||||
throw "EveTui release contract missing $field"
|
||||
}
|
||||
}
|
||||
if ($releaseContract.ownerRepo -ne "EveTui") {
|
||||
throw "Unexpected EveTui release owner: $($releaseContract.ownerRepo)"
|
||||
}
|
||||
if ($releaseContract.packageName -ne "eve-tui") {
|
||||
throw "Unexpected EveTui package name: $($releaseContract.packageName)"
|
||||
}
|
||||
if ($releaseContract.requestSchema -ne "gamecult.eve.runtime_release_request.v1") {
|
||||
throw "Unexpected EveTui release request schema: $($releaseContract.requestSchema)"
|
||||
}
|
||||
if ($releaseContract.artifactKind -ne "terminal-runtime") {
|
||||
throw "Unexpected EveTui release artifact kind: $($releaseContract.artifactKind)"
|
||||
}
|
||||
|
||||
$builderPath = Join-Path $projectRoot $releaseContract.requestBuilder
|
||||
$packagePath = Join-Path $projectRoot $releaseContract.versionSource
|
||||
$packageRoot = Join-Path $projectRoot $releaseContract.packageRoot
|
||||
foreach ($path in @($builderPath, $packagePath, $packageRoot)) {
|
||||
if (-not (Test-Path -LiteralPath $path)) {
|
||||
throw "EveTui release contract path not found: $path"
|
||||
}
|
||||
}
|
||||
|
||||
node --test (Join-Path $projectRoot "tools\evetui\evetui-release-contract.test.mjs")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveTui release contract tests failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
node $builderPath --capability $absoluteCapabilityPath --package $packagePath --output $absoluteOutputPath
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveTui release request builder failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $absoluteOutputPath)) {
|
||||
throw "EveTui release request was not written: $absoluteOutputPath"
|
||||
}
|
||||
|
||||
$request = Get-Content -LiteralPath $absoluteOutputPath -Raw | ConvertFrom-Json
|
||||
$packageManifest = Get-Content -LiteralPath $packagePath -Raw | ConvertFrom-Json
|
||||
foreach ($expectation in @(
|
||||
@{ field = "schema"; value = "gamecult.eve.runtime_release_request.v1" },
|
||||
@{ field = "ownerRepo"; value = "EveTui" },
|
||||
@{ field = "repository"; value = "GameCult/EveTui" },
|
||||
@{ field = "packageName"; value = "eve-tui" },
|
||||
@{ field = "version"; value = $packageManifest.version },
|
||||
@{ field = "packageRoot"; value = "runtimes/incubating/eve-tui" },
|
||||
@{ field = "versionSource"; value = "runtimes/incubating/eve-tui/package.json" },
|
||||
@{ field = "artifactKind"; value = "terminal-runtime" }
|
||||
)) {
|
||||
if ($request.($expectation.field) -ne $expectation.value) {
|
||||
throw "EveTui release request $($expectation.field) expected $($expectation.value) got $($request.($expectation.field))"
|
||||
}
|
||||
}
|
||||
|
||||
$expectedTagName = $releaseContract.tagPattern.Replace("{version}", $packageManifest.version)
|
||||
if ($request.tagName -ne $expectedTagName) {
|
||||
throw "Unexpected EveTui release tag: $($request.tagName)"
|
||||
}
|
||||
$expectedArtifactPath = $releaseContract.artifactPattern.Replace("{version}", $packageManifest.version)
|
||||
if ($request.artifactPath -ne $expectedArtifactPath) {
|
||||
throw "Unexpected EveTui release artifact path: $($request.artifactPath)"
|
||||
}
|
||||
if ($request.main -ne $packageManifest.main) {
|
||||
throw "EveTui release request lost package main entry"
|
||||
}
|
||||
|
||||
Write-Host "EveTui release contract smoke passed: $absoluteOutputPath"
|
||||
|
|
@ -191,6 +191,10 @@ node $consumerScript $consumerExport `
|
|||
--expect-runtime-lifecycle-pending "tui:test:TUI provider-advertisement smoke runs from EveTui with durable terminal transcript or cell-grid artifacts" `
|
||||
--expect-runtime-lifecycle-pending "tui:capture:TUI terminal transcript or cell-grid capture artifact" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.artifactKind:terminal-runtime" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.versionSource:runtimes/incubating/eve-tui/package.json" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.requestSchema:gamecult.eve.runtime_release_request.v1" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.requestBuilder:tools/evetui/evetui-release-contract.mjs" `
|
||||
--expect-runtime-lifecycle-field "tui:release:releaseContract.artifactPattern:artifacts/evetui-release/{version}/eve-tui-{version}.tgz" `
|
||||
--expect-runtime-lifecycle-field "tui:test:testContract.runnerKind:terminal-provider-shell-smoke" `
|
||||
--expect-runtime-lifecycle-field "tui:test:testContract.runnerScript:scripts/run-evetui-provider-shell-smoke.ps1" `
|
||||
--expect-runtime-lifecycle-field "tui:capture:captureContract.captureKind:terminal-transcript-or-cell-grid" `
|
||||
|
|
|
|||
114
tools/evetui/evetui-release-contract.mjs
Normal file
114
tools/evetui/evetui-release-contract.mjs
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
export function buildTuiReleaseRequest({
|
||||
capabilityManifest,
|
||||
packageManifest,
|
||||
capabilityManifestPath = "",
|
||||
packageManifestPath = "",
|
||||
repository = "GameCult/EveTui",
|
||||
} = {}) {
|
||||
if (!capabilityManifest || typeof capabilityManifest !== "object") {
|
||||
throw new Error("capabilityManifest is required");
|
||||
}
|
||||
if (!packageManifest || typeof packageManifest !== "object") {
|
||||
throw new Error("packageManifest is required");
|
||||
}
|
||||
|
||||
const releaseContract = capabilityManifest.lifecycle?.release?.releaseContract;
|
||||
if (!releaseContract) {
|
||||
throw new Error("capability manifest is missing lifecycle.release.releaseContract");
|
||||
}
|
||||
|
||||
if (packageManifest.name !== releaseContract.packageName) {
|
||||
throw new Error(`package name mismatch: expected ${releaseContract.packageName} got ${packageManifest.name || "missing"}`);
|
||||
}
|
||||
if (!packageManifest.version || !/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(packageManifest.version)) {
|
||||
throw new Error(`package version is not a SemVer-compatible release version: ${packageManifest.version || "missing"}`);
|
||||
}
|
||||
|
||||
const tagName = replaceVersion(releaseContract.tagPattern, packageManifest.version);
|
||||
const artifactPath = replaceVersion(
|
||||
releaseContract.artifactPattern || `artifacts/evetui-release/{version}/${releaseContract.packageName}-{version}.tgz`,
|
||||
packageManifest.version,
|
||||
);
|
||||
|
||||
return {
|
||||
schema: releaseContract.requestSchema || "gamecult.eve.runtime_release_request.v1",
|
||||
ownerRepo: releaseContract.ownerRepo,
|
||||
repository,
|
||||
packageName: releaseContract.packageName,
|
||||
version: packageManifest.version,
|
||||
packageRoot: releaseContract.packageRoot,
|
||||
versionSource: releaseContract.versionSource,
|
||||
tagName,
|
||||
artifactKind: releaseContract.artifactKind,
|
||||
artifactPath,
|
||||
publishProof: releaseContract.publishProof,
|
||||
sourceCapabilityManifestPath: capabilityManifestPath,
|
||||
sourcePackageManifestPath: packageManifestPath,
|
||||
main: packageManifest.main || "",
|
||||
scripts: packageManifest.scripts || {},
|
||||
dependencies: packageManifest.dependencies || {},
|
||||
devDependencies: packageManifest.devDependencies || {},
|
||||
};
|
||||
}
|
||||
|
||||
export function loadJsonFile(filePath) {
|
||||
return JSON.parse(readFileSync(filePath, "utf8"));
|
||||
}
|
||||
|
||||
export function writeReleaseRequest(request, outputPath) {
|
||||
mkdirSync(path.dirname(outputPath), { recursive: true });
|
||||
writeFileSync(outputPath, `${JSON.stringify(request, null, 2)}\n`, "utf8");
|
||||
}
|
||||
|
||||
function replaceVersion(pattern, version) {
|
||||
if (!pattern || !pattern.includes("{version}")) {
|
||||
throw new Error(`release pattern must include {version}: ${pattern || "missing"}`);
|
||||
}
|
||||
return pattern.replaceAll("{version}", version);
|
||||
}
|
||||
|
||||
function parseArgs(argv) {
|
||||
const args = {};
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const value = argv[index];
|
||||
if (!value.startsWith("--")) continue;
|
||||
const key = value.slice(2);
|
||||
const next = argv[index + 1];
|
||||
if (!next || next.startsWith("--")) {
|
||||
args[key] = true;
|
||||
} else {
|
||||
args[key] = next;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
function runCli() {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
for (const required of ["capability", "package", "output"]) {
|
||||
if (!args[required]) {
|
||||
throw new Error(`missing required --${required}`);
|
||||
}
|
||||
}
|
||||
|
||||
const request = buildTuiReleaseRequest({
|
||||
capabilityManifest: loadJsonFile(args.capability),
|
||||
packageManifest: loadJsonFile(args.package),
|
||||
capabilityManifestPath: args.capability,
|
||||
packageManifestPath: args.package,
|
||||
repository: args.repository || "GameCult/EveTui",
|
||||
});
|
||||
writeReleaseRequest(request, args.output);
|
||||
process.stdout.write(`${args.output}\n`);
|
||||
}
|
||||
|
||||
const invokedPath = process.argv[1] ? path.resolve(process.argv[1]) : "";
|
||||
const modulePath = fileURLToPath(import.meta.url);
|
||||
if (invokedPath === modulePath) {
|
||||
runCli();
|
||||
}
|
||||
37
tools/evetui/evetui-release-contract.test.mjs
Normal file
37
tools/evetui/evetui-release-contract.test.mjs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import { buildTuiReleaseRequest } from "./evetui-release-contract.mjs";
|
||||
|
||||
const capabilityManifest = JSON.parse(readFileSync(new URL("../../runtimes/incubating/eve-tui/eve-runtime-capability.json", import.meta.url), "utf8"));
|
||||
const packageManifest = JSON.parse(readFileSync(new URL("../../runtimes/incubating/eve-tui/package.json", import.meta.url), "utf8"));
|
||||
|
||||
test("builds EveTui release request from package manifest", () => {
|
||||
const request = buildTuiReleaseRequest({
|
||||
capabilityManifest,
|
||||
packageManifest,
|
||||
capabilityManifestPath: "runtimes/incubating/eve-tui/eve-runtime-capability.json",
|
||||
packageManifestPath: "runtimes/incubating/eve-tui/package.json",
|
||||
});
|
||||
|
||||
assert.equal(request.schema, "gamecult.eve.runtime_release_request.v1");
|
||||
assert.equal(request.ownerRepo, "EveTui");
|
||||
assert.equal(request.repository, "GameCult/EveTui");
|
||||
assert.equal(request.packageName, "eve-tui");
|
||||
assert.equal(request.version, "0.1.0");
|
||||
assert.equal(request.packageRoot, "runtimes/incubating/eve-tui");
|
||||
assert.equal(request.versionSource, "runtimes/incubating/eve-tui/package.json");
|
||||
assert.equal(request.tagName, "evetui-v0.1.0");
|
||||
assert.equal(request.artifactKind, "terminal-runtime");
|
||||
assert.equal(request.artifactPath, "artifacts/evetui-release/0.1.0/eve-tui-0.1.0.tgz");
|
||||
assert.equal(request.main, "src/eve-tui-shell.mjs");
|
||||
});
|
||||
|
||||
test("rejects package manifests that do not match the TUI release contract", () => {
|
||||
const wrongPackage = { ...packageManifest, name: "eve-wrong" };
|
||||
|
||||
assert.throws(
|
||||
() => buildTuiReleaseRequest({ capabilityManifest, packageManifest: wrongPackage }),
|
||||
/package name mismatch/,
|
||||
);
|
||||
});
|
||||
|
|
@ -853,8 +853,11 @@
|
|||
"scripts/run-evetui-lifecycle-smoke.ps1",
|
||||
"scripts/run-evetui-provider-shell-smoke.ps1",
|
||||
"scripts/run-evetui-capture-contract-smoke.ps1",
|
||||
"scripts/run-evetui-release-contract-smoke.ps1",
|
||||
"tools/evetui/evetui-capture-contract.mjs",
|
||||
"tools/evetui/evetui-capture-contract.test.mjs"
|
||||
"tools/evetui/evetui-capture-contract.test.mjs",
|
||||
"tools/evetui/evetui-release-contract.mjs",
|
||||
"tools/evetui/evetui-release-contract.test.mjs"
|
||||
],
|
||||
"expectedSourceSymbols": [
|
||||
{
|
||||
|
|
@ -872,6 +875,14 @@
|
|||
{
|
||||
"path": "tools/evetui/evetui-capture-contract.test.mjs",
|
||||
"contains": ["builds TUI capture request from provider advertisement", "rejects capture request when the surface does not advertise TUI", "artifacts/evetui-capture/smoke/tui-transcript.ansi"]
|
||||
},
|
||||
{
|
||||
"path": "tools/evetui/evetui-release-contract.mjs",
|
||||
"contains": ["buildTuiReleaseRequest", "gamecult.eve.runtime_release_request.v1", "evetui-release", "writeReleaseRequest"]
|
||||
},
|
||||
{
|
||||
"path": "tools/evetui/evetui-release-contract.test.mjs",
|
||||
"contains": ["builds EveTui release request from package manifest", "evetui-v0.1.0", "artifacts/evetui-release/0.1.0/eve-tui-0.1.0.tgz"]
|
||||
}
|
||||
],
|
||||
"capture": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue