Skip to content

Commit 29732c1

Browse files
committed
test(plugins): lock xai boundary path drift
1 parent 1fdb013 commit 29732c1

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

scripts/lib/extension-package-boundary.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { existsSync, readFileSync, readdirSync } from "node:fs";
2-
import { join, resolve } from "node:path";
2+
import { join, posix, resolve } from "node:path";
33

44
export const EXTENSION_PACKAGE_BOUNDARY_BASE_CONFIG =
55
"extensions/tsconfig.package-boundary.base.json" as const;
@@ -66,6 +66,35 @@ export const EXTENSION_PACKAGE_BOUNDARY_BASE_PATHS = {
6666
"@openclaw/plugin-sdk/*": ["../packages/plugin-sdk/dist/src/plugin-sdk/*.d.ts"],
6767
} as const;
6868

69+
function prefixExtensionPackageBoundaryPaths(
70+
paths: Record<string, readonly string[]>,
71+
prefix: string,
72+
): Record<string, readonly string[]> {
73+
return Object.fromEntries(
74+
Object.entries(paths).map(([key, values]) => [
75+
key,
76+
values.map((value) => posix.join(prefix, value)),
77+
]),
78+
);
79+
}
80+
81+
export const EXTENSION_PACKAGE_BOUNDARY_XAI_PATHS = {
82+
...prefixExtensionPackageBoundaryPaths(EXTENSION_PACKAGE_BOUNDARY_BASE_PATHS, "../"),
83+
"openclaw/plugin-sdk/cli-runtime": [
84+
"../../packages/plugin-sdk/dist/src/plugin-sdk/cli-runtime.d.ts",
85+
],
86+
"openclaw/plugin-sdk/provider-env-vars": [
87+
"../../packages/plugin-sdk/dist/src/plugin-sdk/provider-env-vars.d.ts",
88+
],
89+
"@openclaw/*.js": ["../../packages/plugin-sdk/dist/extensions/*.d.ts", "../*"],
90+
"@openclaw/*": ["../*"],
91+
"@openclaw/plugin-sdk/*": ["../../packages/plugin-sdk/dist/src/plugin-sdk/*.d.ts"],
92+
"@openclaw/anthropic-vertex/api.js": ["./.boundary-stubs/anthropic-vertex-api.d.ts"],
93+
"@openclaw/ollama/api.js": ["./.boundary-stubs/ollama-api.d.ts"],
94+
"@openclaw/ollama/runtime-api.js": ["./.boundary-stubs/ollama-runtime-api.d.ts"],
95+
"@openclaw/speech-core/runtime-api.js": ["./.boundary-stubs/speech-core-runtime-api.d.ts"],
96+
} as const;
97+
6998
export type ExtensionPackageBoundaryTsConfigJson = {
7099
extends?: unknown;
71100
compilerOptions?: {

src/plugins/contracts/extension-package-project-boundaries.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
EXTENSION_PACKAGE_BOUNDARY_BASE_PATHS,
88
EXTENSION_PACKAGE_BOUNDARY_EXCLUDE,
99
EXTENSION_PACKAGE_BOUNDARY_INCLUDE,
10+
EXTENSION_PACKAGE_BOUNDARY_XAI_PATHS,
1011
isOptInExtensionPackageBoundaryTsconfig,
1112
readExtensionPackageBoundaryPackageJson,
1213
readExtensionPackageBoundaryTsconfig,
@@ -72,6 +73,11 @@ describe("opt-in extension package boundaries", () => {
7273
}
7374
});
7475

76+
it("keeps xai's boundary-specific path overrides derived from the shared package boundary map", () => {
77+
const tsconfig = readExtensionPackageBoundaryTsconfig("xai", REPO_ROOT);
78+
expect(tsconfig.compilerOptions?.paths).toEqual(EXTENSION_PACKAGE_BOUNDARY_XAI_PATHS);
79+
});
80+
7581
it("keeps plugin-sdk package types generated from the package build, not a hand-maintained types bridge", () => {
7682
const tsconfig = readJsonFile<TsConfigJson>("packages/plugin-sdk/tsconfig.json");
7783
expect(tsconfig.extends).toBe("../../tsconfig.json");

0 commit comments

Comments
 (0)