|
7 | 7 | buildPublishedInstallScenarios, |
8 | 8 | collectInstalledBundledRuntimeSidecarPaths, |
9 | 9 | collectInstalledContextEngineRuntimeErrors, |
| 10 | + collectInstalledPluginSdkZodArtifactErrors, |
10 | 11 | collectInstalledRootDependencyManifestErrors, |
11 | 12 | collectInstalledPackageErrors, |
12 | 13 | normalizeInstalledBinaryVersion, |
@@ -146,6 +147,48 @@ describe("collectInstalledContextEngineRuntimeErrors", () => { |
146 | 147 | }); |
147 | 148 | }); |
148 | 149 |
|
| 150 | +describe("collectInstalledPluginSdkZodArtifactErrors", () => { |
| 151 | + function makeInstalledPackageRoot(): string { |
| 152 | + return mkdtempSync(join(tmpdir(), "openclaw-postpublish-zod-sdk-")); |
| 153 | + } |
| 154 | + |
| 155 | + it("rejects plugin-sdk zod artifacts with a bare zod export", () => { |
| 156 | + const packageRoot = makeInstalledPackageRoot(); |
| 157 | + |
| 158 | + try { |
| 159 | + mkdirSync(join(packageRoot, "dist", "plugin-sdk"), { recursive: true }); |
| 160 | + writeFileSync( |
| 161 | + join(packageRoot, "dist", "plugin-sdk", "zod.js"), |
| 162 | + 'import "../zod-D2c0iocA.js";\nexport * from "zod";\n', |
| 163 | + "utf8", |
| 164 | + ); |
| 165 | + |
| 166 | + expect(collectInstalledPluginSdkZodArtifactErrors(packageRoot)).toEqual([ |
| 167 | + "installed package plugin SDK artifact 'dist/plugin-sdk/zod.js' must be self-contained but imports zod.", |
| 168 | + ]); |
| 169 | + } finally { |
| 170 | + rmSync(packageRoot, { recursive: true, force: true }); |
| 171 | + } |
| 172 | + }); |
| 173 | + |
| 174 | + it("accepts plugin-sdk zod artifacts that only import package-local chunks", () => { |
| 175 | + const packageRoot = makeInstalledPackageRoot(); |
| 176 | + |
| 177 | + try { |
| 178 | + mkdirSync(join(packageRoot, "dist", "plugin-sdk"), { recursive: true }); |
| 179 | + writeFileSync( |
| 180 | + join(packageRoot, "dist", "plugin-sdk", "zod.js"), |
| 181 | + 'export { z } from "../zod-D2c0iocA.js";\n', |
| 182 | + "utf8", |
| 183 | + ); |
| 184 | + |
| 185 | + expect(collectInstalledPluginSdkZodArtifactErrors(packageRoot)).toEqual([]); |
| 186 | + } finally { |
| 187 | + rmSync(packageRoot, { recursive: true, force: true }); |
| 188 | + } |
| 189 | + }); |
| 190 | +}); |
| 191 | + |
149 | 192 | describe("normalizeInstalledBinaryVersion", () => { |
150 | 193 | it("accepts decorated CLI version output", () => { |
151 | 194 | expect(normalizeInstalledBinaryVersion("OpenClaw 2026.4.8 (9ece252)")).toBe("2026.4.8"); |
|
0 commit comments