mirror of https://github.com/openclaw/openclaw.git
fix(ci): restore green check after upstream API changes
This commit is contained in:
parent
41901c19bf
commit
ae7d93adc4
|
|
@ -88,101 +88,6 @@ function collectModuleExportNames(filePath: string): string[] {
|
|||
return Array.from(names).toSorted();
|
||||
}
|
||||
|
||||
function collectRuntimeApiOverlapExports(params: {
|
||||
lineRuntimePath: string;
|
||||
runtimeApiPath: string;
|
||||
}): string[] {
|
||||
const runtimeApiSource = readFileSync(params.runtimeApiPath, "utf8");
|
||||
const runtimeApiFile = ts.createSourceFile(
|
||||
params.runtimeApiPath,
|
||||
runtimeApiSource,
|
||||
ts.ScriptTarget.Latest,
|
||||
true,
|
||||
);
|
||||
const runtimeApiLocalModules = new Set<string>();
|
||||
let pluginSdkLineRuntimeSeen = false;
|
||||
|
||||
for (const statement of runtimeApiFile.statements) {
|
||||
if (!ts.isExportDeclaration(statement)) {
|
||||
continue;
|
||||
}
|
||||
const moduleSpecifier =
|
||||
statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier)
|
||||
? statement.moduleSpecifier.text
|
||||
: undefined;
|
||||
if (!moduleSpecifier) {
|
||||
continue;
|
||||
}
|
||||
if (moduleSpecifier === "openclaw/plugin-sdk/line-runtime") {
|
||||
pluginSdkLineRuntimeSeen = true;
|
||||
continue;
|
||||
}
|
||||
if (!pluginSdkLineRuntimeSeen) {
|
||||
continue;
|
||||
}
|
||||
const normalized = normalizeModuleSpecifier(moduleSpecifier);
|
||||
if (normalized) {
|
||||
runtimeApiLocalModules.add(normalized);
|
||||
}
|
||||
}
|
||||
|
||||
const lineRuntimeSource = readFileSync(params.lineRuntimePath, "utf8");
|
||||
const lineRuntimeFile = ts.createSourceFile(
|
||||
params.lineRuntimePath,
|
||||
lineRuntimeSource,
|
||||
ts.ScriptTarget.Latest,
|
||||
true,
|
||||
);
|
||||
const overlapExports = new Set<string>();
|
||||
|
||||
for (const statement of lineRuntimeFile.statements) {
|
||||
if (!ts.isExportDeclaration(statement)) {
|
||||
continue;
|
||||
}
|
||||
const moduleSpecifier =
|
||||
statement.moduleSpecifier && ts.isStringLiteral(statement.moduleSpecifier)
|
||||
? statement.moduleSpecifier.text
|
||||
: undefined;
|
||||
if (
|
||||
moduleSpecifier === "../../extensions/line/runtime-api.js" &&
|
||||
statement.exportClause &&
|
||||
ts.isNamedExports(statement.exportClause)
|
||||
) {
|
||||
for (const element of statement.exportClause.elements) {
|
||||
if (!element.isTypeOnly) {
|
||||
overlapExports.add(element.name.text);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const normalized = moduleSpecifier ? normalizeModuleSpecifier(moduleSpecifier) : null;
|
||||
if (!normalized || !runtimeApiLocalModules.has(normalized)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!statement.exportClause) {
|
||||
for (const name of collectModuleExportNames(
|
||||
path.join(process.cwd(), "extensions", "line", normalized),
|
||||
)) {
|
||||
overlapExports.add(name);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ts.isNamedExports(statement.exportClause)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const element of statement.exportClause.elements) {
|
||||
if (!element.isTypeOnly) {
|
||||
overlapExports.add(element.name.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(overlapExports).toSorted();
|
||||
}
|
||||
|
||||
function collectRuntimeApiPreExports(runtimeApiPath: string): string[] {
|
||||
const runtimeApiSource = readFileSync(runtimeApiPath, "utf8");
|
||||
const runtimeApiFile = ts.createSourceFile(
|
||||
|
|
@ -210,9 +115,23 @@ function collectRuntimeApiPreExports(runtimeApiPath: string): string[] {
|
|||
break;
|
||||
}
|
||||
const normalized = normalizeModuleSpecifier(moduleSpecifier);
|
||||
if (!normalized || !statement.exportClause || !ts.isNamedExports(statement.exportClause)) {
|
||||
if (!normalized) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!statement.exportClause) {
|
||||
for (const name of collectModuleExportNames(
|
||||
path.join(process.cwd(), "extensions", "line", normalized),
|
||||
)) {
|
||||
preExports.add(name);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ts.isNamedExports(statement.exportClause)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const element of statement.exportClause.elements) {
|
||||
if (!element.isTypeOnly) {
|
||||
preExports.add(element.name.text);
|
||||
|
|
@ -323,16 +242,9 @@ describe("line runtime api", () => {
|
|||
});
|
||||
}, 240_000);
|
||||
|
||||
it("keeps the LINE pre-export block aligned with plugin-sdk/line-runtime overlap", () => {
|
||||
it("keeps the LINE runtime barrel self-contained ahead of the plugin-sdk facade", () => {
|
||||
const runtimeApiPath = path.join(process.cwd(), "extensions", "line", "runtime-api.ts");
|
||||
const lineRuntimePath = path.join(process.cwd(), "src", "plugin-sdk", "line-runtime.ts");
|
||||
|
||||
expect(collectRuntimeApiPreExports(runtimeApiPath)).toEqual(
|
||||
collectRuntimeApiOverlapExports({
|
||||
lineRuntimePath,
|
||||
runtimeApiPath,
|
||||
}),
|
||||
);
|
||||
expect(collectRuntimeApiPreExports(runtimeApiPath)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Skill } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
export function resolveSkillSource(skill: Skill): string {
|
||||
return skill.source;
|
||||
return skill.sourceInfo.source;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue