mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-14 10:41:23 +00:00
fix: unblock cli startup metadata
This commit is contained in:
@@ -103,6 +103,13 @@ export type PluginLoadOptions = {
|
||||
throwOnLoadError?: boolean;
|
||||
};
|
||||
|
||||
const CLI_METADATA_ENTRY_BASENAMES = [
|
||||
"cli-metadata.ts",
|
||||
"cli-metadata.js",
|
||||
"cli-metadata.mjs",
|
||||
"cli-metadata.cjs",
|
||||
] as const;
|
||||
|
||||
export class PluginLoadFailureError extends Error {
|
||||
readonly pluginIds: string[];
|
||||
readonly registry: PluginRegistry;
|
||||
@@ -1810,8 +1817,17 @@ export async function loadOpenClawPluginCliRegistry(
|
||||
}
|
||||
|
||||
const pluginRoot = safeRealpathOrResolve(candidate.rootDir);
|
||||
const cliMetadataSource = resolveCliMetadataEntrySource(candidate.rootDir);
|
||||
const sourceForCliMetadata =
|
||||
candidate.origin === "bundled" ? cliMetadataSource : (cliMetadataSource ?? candidate.source);
|
||||
if (!sourceForCliMetadata) {
|
||||
record.status = "loaded";
|
||||
registry.plugins.push(record);
|
||||
seenIds.set(pluginId, candidate.origin);
|
||||
continue;
|
||||
}
|
||||
const opened = openBoundaryFileSync({
|
||||
absolutePath: candidate.source,
|
||||
absolutePath: sourceForCliMetadata,
|
||||
rootPath: pluginRoot,
|
||||
boundaryLabel: "plugin root",
|
||||
rejectHardlinks: candidate.origin !== "bundled",
|
||||
@@ -1943,3 +1959,13 @@ function safeRealpathOrResolve(value: string): string {
|
||||
return path.resolve(value);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveCliMetadataEntrySource(rootDir: string): string | null {
|
||||
for (const basename of CLI_METADATA_ENTRY_BASENAMES) {
|
||||
const candidate = path.join(rootDir, basename);
|
||||
if (fs.existsSync(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user