mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 20:01:39 +00:00
* refactor(plugins): trim activation and contract exports * test(plugins): restore fixture cleanup * refactor(plugins): trim install and loader exports * test(plugins): fully reset loader caches * refactor(plugins): trim metadata and catalog exports * test(plugins): preserve catalog trust coverage * refactor(plugins): trim provider and plugin exports * refactor(plugins): trim runtime and tool exports * test(plugins): update dead-export consumers * test(plugins): remove empty dead-export suites * refactor(plugins): align exports with split registry * refactor(plugins): trim drifted loader exports * style(plugins): format test fixtures * refactor(scripts): use supported plugin APIs * refactor(plugins): finish dead export cleanup * chore(deadcode): refresh export baseline * test(cli): mock production memory state * chore(deadcode): sync latest export baseline * fix(tests): keep plugin fixtures inside core * chore(deadcode): refresh rebased export baseline * chore(deadcode): sync current ratchets * fix(plugins): retain reserved slot invariant * fix(plugins): preserve dead-export invariants * test(plugins): use neutral catalog query fixture * test(plugins): satisfy catalog lint * test(plugins): preserve integrity drift coverage * fix(ci): register skill experience live proof
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
// Bundled Extension Manifest script supports OpenClaw repository automation.
|
|
import { checkMinHostVersion } from "../../src/plugins/min-host-version.ts";
|
|
import { isRecord } from "../../src/utils.js";
|
|
|
|
export type ExtensionPackageJson = {
|
|
name?: string;
|
|
version?: string;
|
|
dependencies?: Record<string, string>;
|
|
optionalDependencies?: Record<string, string>;
|
|
openclaw?: {
|
|
install?: unknown;
|
|
releaseChecks?: unknown;
|
|
};
|
|
};
|
|
|
|
export type BundledExtension = { id: string; packageJson: ExtensionPackageJson };
|
|
|
|
export function collectBundledExtensionManifestErrors(extensions: BundledExtension[]): string[] {
|
|
const errors: string[] = [];
|
|
|
|
for (const extension of extensions) {
|
|
const install = extension.packageJson.openclaw?.install;
|
|
if (install !== undefined && !isRecord(install)) {
|
|
errors.push(
|
|
`bundled extension '${extension.id}' manifest invalid | openclaw.install must be an object`,
|
|
);
|
|
continue;
|
|
}
|
|
const hasNpmSpec = isRecord(install) && "npmSpec" in install;
|
|
if (
|
|
hasNpmSpec &&
|
|
(!install.npmSpec || typeof install.npmSpec !== "string" || !install.npmSpec.trim())
|
|
) {
|
|
errors.push(
|
|
`bundled extension '${extension.id}' manifest invalid | openclaw.install.npmSpec must be a non-empty string`,
|
|
);
|
|
}
|
|
const minHostVersionCheck =
|
|
install?.minHostVersion === undefined
|
|
? null
|
|
: checkMinHostVersion({
|
|
currentVersion: "0.0.0",
|
|
minHostVersion: install.minHostVersion,
|
|
});
|
|
const minHostVersionError =
|
|
minHostVersionCheck && !minHostVersionCheck.ok && minHostVersionCheck.kind === "invalid"
|
|
? minHostVersionCheck.error
|
|
: null;
|
|
if (minHostVersionError) {
|
|
errors.push(`bundled extension '${extension.id}' manifest invalid | ${minHostVersionError}`);
|
|
}
|
|
}
|
|
|
|
return errors;
|
|
}
|