fix: enforce canonical workshop skill names

This commit is contained in:
Shakker
2026-05-30 04:33:46 +01:00
committed by Shakker
parent ab0613c9d3
commit 199cdc1052
2 changed files with 6 additions and 5 deletions
+4 -3
View File
@@ -59,6 +59,7 @@ describe("skill workshop proposals", () => {
expect(proposal.record.status).toBe("pending");
expect(proposal.record.scan.state).toBe("clean");
expect(proposal.content).toContain('name: "weather-helper"');
expect(proposal.record.supportFiles?.map((file) => file.path)).toEqual([
"references/weather-api.md",
"scripts/check-weather.js",
@@ -85,7 +86,7 @@ describe("skill workshop proposals", () => {
});
expect(applied.targetSkillFile).toBe(proposal.record.target.skillFile);
await expect(fs.readFile(applied.targetSkillFile, "utf8")).resolves.toBe(
'---\nname: "Weather Helper"\ndescription: "Check weather before planning outdoor tasks"\n---\n\n# Weather Helper\n\nUse the weather provider before answering.\n',
'---\nname: "weather-helper"\ndescription: "Check weather before planning outdoor tasks"\n---\n\n# Weather Helper\n\nUse the weather provider before answering.\n',
);
await expect(
fs.readFile(
@@ -101,8 +102,8 @@ describe("skill workshop proposals", () => {
).resolves.toContain("parseWeather");
const status = buildWorkspaceSkillStatus(workspaceDir);
expect(status.skills.find((skill) => skill.name === "Weather Helper")).toMatchObject({
name: "Weather Helper",
expect(status.skills.find((skill) => skill.name === "weather-helper")).toMatchObject({
name: "weather-helper",
source: "openclaw-workspace",
filePath: applied.targetSkillFile,
});
+2 -2
View File
@@ -135,7 +135,7 @@ export async function proposeCreateSkill(
const supportFiles = prepareSkillProposalSupportFiles(input.supportFiles);
const proposalContent = renderProposalMarkdown({
name,
name: target.skillKey,
description,
content: input.content,
});
@@ -192,7 +192,7 @@ export async function proposeUpdateSkill(
const supportFiles = prepareSkillProposalSupportFiles(input.supportFiles);
const proposalContent = renderProposalMarkdown({
name: targetSkill.name,
name: targetSkill.skillKey,
description: targetSkill.description,
content: input.content,
});