mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:11:23 +00:00
fix: load plugin packages from config dirs
This commit is contained in:
@@ -131,4 +131,32 @@ describe("discoverClawdbotPlugins", () => {
|
||||
const ids = candidates.map((c) => c.idHint);
|
||||
expect(ids).toContain("voice-call");
|
||||
});
|
||||
|
||||
it("treats configured directory paths as plugin packages", async () => {
|
||||
const stateDir = makeTempDir();
|
||||
const packDir = path.join(stateDir, "packs", "demo-plugin-dir");
|
||||
fs.mkdirSync(packDir, { recursive: true });
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(packDir, "package.json"),
|
||||
JSON.stringify({
|
||||
name: "@clawdbot/demo-plugin-dir",
|
||||
clawdbot: { extensions: ["./index.js"] },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
fs.writeFileSync(
|
||||
path.join(packDir, "index.js"),
|
||||
"module.exports = {}",
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
const { candidates } = await withStateDir(stateDir, async () => {
|
||||
const { discoverClawdbotPlugins } = await import("./discovery.js");
|
||||
return discoverClawdbotPlugins({ extraPaths: [packDir] });
|
||||
});
|
||||
|
||||
const ids = candidates.map((c) => c.idHint);
|
||||
expect(ids).toContain("demo-plugin-dir");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user