Skip to content

Commit 1eff5cd

Browse files
committed
fix(diffs): stop lightweight CLI registration from crashing
The diffs plugin has no cli-metadata.ts, so the lightweight CLI metadata loader fell back to plugin.ts and called register() with an empty runtime, crashing on api.runtime.state.openBlobStore for any non-bundled install (e.g. the published @openclaw/diffs npm package). Add a no-op cli-metadata.ts, matching every other bundled plugin's convention, so CLI metadata capture stops there instead of loading the full runtime. Fixes #128330
1 parent bd7fb1d commit 1eff5cd

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import path from "node:path";
2+
import { fileURLToPath } from "node:url";
3+
import { afterEach, describe, expect, it } from "vitest";
4+
import { loadOpenClawPluginCliRegistry } from "../../src/plugins/loader.js";
5+
import {
6+
resetPluginLoaderTestStateForTest,
7+
useNoBundledPlugins,
8+
} from "../../src/plugins/loader.test-fixtures.js";
9+
10+
const diffsRoot = path.dirname(fileURLToPath(import.meta.url));
11+
12+
afterEach(() => {
13+
resetPluginLoaderTestStateForTest();
14+
});
15+
16+
describe("diffs cli metadata entry", () => {
17+
it("loads without a runtime when discovered as an installed (non-bundled) plugin", async () => {
18+
useNoBundledPlugins();
19+
const registry = await loadOpenClawPluginCliRegistry({
20+
cache: false,
21+
config: {
22+
plugins: {
23+
load: { paths: [diffsRoot] },
24+
allow: ["diffs"],
25+
},
26+
},
27+
});
28+
29+
const diffs = registry.plugins.find((entry) => entry.id === "diffs");
30+
expect(diffs?.status).toBe("loaded");
31+
expect(diffs?.error).toBeUndefined();
32+
});
33+
});

‎extensions/diffs/cli-metadata.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Diffs plugin module implements lightweight cli metadata behavior.
2+
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3+
4+
export default definePluginEntry({
5+
id: "diffs",
6+
name: "Diffs",
7+
description: "OpenClaw read-only diff viewer plugin and file renderer for agents.",
8+
register() {
9+
// Diffs has no CLI commands. This entry only exists so lightweight CLI
10+
// metadata capture stops here instead of falling through to plugin.ts,
11+
// which requires a full runtime (api.runtime.state.openBlobStore).
12+
},
13+
});

0 commit comments

Comments
 (0)