stricter checks
CI / verify (pull_request) Successful in 12s

This commit is contained in:
2026-10-10 15:16:53 +02:00
parent ced43fbb11
commit 513d51f702
30 changed files with 984 additions and 470 deletions
+13 -4
View File
@@ -3,6 +3,7 @@ import { mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { Host } from "@opencode/plugin/host";
import { z } from "zod";
import { build } from "../scripts/build.js";
import { install } from "../scripts/install.js";
@@ -23,13 +24,19 @@ test("packed package has independent native plugins and quota-only TUI discovery
});
expect(await unpack.exited).toBe(0);
const source = join(directory, "package");
const manifest = await Bun.file(join(source, "package.json")).json();
const manifest = z
.object({ exports: z.record(z.string(), z.object({ import: z.string() }).loose()) })
.loose()
.parse(await Bun.file(join(source, "package.json")).json());
const entrypoint = (name: string) =>
join(source, z.string().parse(manifest.exports[name]?.import));
expect(manifest.exports["."]).toBeUndefined();
expect(await Bun.file(join(source, "index.js")).exists()).toBe(false);
expect(await Bun.file(join(source, "dist", "index.js")).exists()).toBe(false);
for (const name of ["agents", "multi-work", "quota"]) {
const entrypoint = join(source, manifest.exports[`./${name}`].import);
const { default: plugin } = await import(entrypoint);
const { default: plugin } = z
.object({ default: z.object({ id: z.string() }).loose() })
.parse(await import(entrypoint(`./${name}`)));
expect(plugin.id).toBe(`stanp-opencode.${name}`);
}
const config = join(directory, "config");
@@ -42,7 +49,9 @@ test("packed package has independent native plugins and quota-only TUI discovery
expect(entries.server).toBeDefined();
expect(entries.tui !== undefined).toBe(name === "quota");
}
const { QuotaRpc } = await import(join(source, manifest.exports["./quota-rpc"].import));
const { QuotaRpc } = z
.object({ QuotaRpc: z.object({ id: z.string() }).loose() })
.parse(await import(entrypoint("./quota-rpc")));
expect(QuotaRpc.id).toBe("stanp-opencode.quota");
} finally {
await rm(directory, { recursive: true, force: true });