mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:37:41 +00:00
feat: add OpenProse plugin skills
This commit is contained in:
@@ -39,4 +39,82 @@ describe("loadWorkspaceSkillEntries", () => {
|
||||
|
||||
expect(entries).toEqual([]);
|
||||
});
|
||||
|
||||
it("includes plugin-shipped skills when the plugin is enabled", async () => {
|
||||
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-"));
|
||||
const managedDir = path.join(workspaceDir, ".managed");
|
||||
const bundledDir = path.join(workspaceDir, ".bundled");
|
||||
const pluginRoot = path.join(workspaceDir, ".clawdbot", "extensions", "open-prose");
|
||||
|
||||
await fs.mkdir(path.join(pluginRoot, "skills", "prose"), { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(pluginRoot, "clawdbot.plugin.json"),
|
||||
JSON.stringify(
|
||||
{
|
||||
id: "open-prose",
|
||||
skills: ["./skills"],
|
||||
configSchema: { type: "object", additionalProperties: false, properties: {} },
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
"utf-8",
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(pluginRoot, "skills", "prose", "SKILL.md"),
|
||||
`---\nname: prose\ndescription: test\n---\n`,
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
const entries = loadWorkspaceSkillEntries(workspaceDir, {
|
||||
config: {
|
||||
plugins: {
|
||||
entries: { "open-prose": { enabled: true } },
|
||||
},
|
||||
},
|
||||
managedSkillsDir: managedDir,
|
||||
bundledSkillsDir: bundledDir,
|
||||
});
|
||||
|
||||
expect(entries.map((entry) => entry.skill.name)).toContain("prose");
|
||||
});
|
||||
|
||||
it("excludes plugin-shipped skills when the plugin is not allowed", async () => {
|
||||
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-"));
|
||||
const managedDir = path.join(workspaceDir, ".managed");
|
||||
const bundledDir = path.join(workspaceDir, ".bundled");
|
||||
const pluginRoot = path.join(workspaceDir, ".clawdbot", "extensions", "open-prose");
|
||||
|
||||
await fs.mkdir(path.join(pluginRoot, "skills", "prose"), { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(pluginRoot, "clawdbot.plugin.json"),
|
||||
JSON.stringify(
|
||||
{
|
||||
id: "open-prose",
|
||||
skills: ["./skills"],
|
||||
configSchema: { type: "object", additionalProperties: false, properties: {} },
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
"utf-8",
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(pluginRoot, "skills", "prose", "SKILL.md"),
|
||||
`---\nname: prose\ndescription: test\n---\n`,
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
const entries = loadWorkspaceSkillEntries(workspaceDir, {
|
||||
config: {
|
||||
plugins: {
|
||||
allow: ["something-else"],
|
||||
},
|
||||
},
|
||||
managedSkillsDir: managedDir,
|
||||
bundledSkillsDir: bundledDir,
|
||||
});
|
||||
|
||||
expect(entries.map((entry) => entry.skill.name)).not.toContain("prose");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user