refactor(skill): remove legacy skill compatibility

This commit is contained in:
morluto
2026-07-17 01:28:42 +00:00
parent 4c69e6120a
commit 8cf0dd2bf6
9 changed files with 17 additions and 153 deletions
-4
View File
@@ -152,10 +152,6 @@ describe("setup workflow", () => {
"configure_client",
"install_skill",
]);
expect(
result.plannedActions.find(({ kind }) => kind === "install_skill")
?.detail,
).toContain("back up its SKILL.md");
expect(host.hopperInstalls).toBe(0);
expect(host.configurations).toBe(0);
expect(result.remediation).toBe(
-4
View File
@@ -150,10 +150,8 @@ describe("agent lifecycle", () => {
home,
".agents/skills/reverse-engineer-anything/SKILL.md",
);
const legacySkill = join(home, ".agents/skills/rea-analysis/SKILL.md");
await mkdir(dirname(cursor), { recursive: true });
await mkdir(dirname(skill), { recursive: true });
await mkdir(dirname(legacySkill), { recursive: true });
await writeFile(
cursor,
JSON.stringify({
@@ -164,7 +162,6 @@ describe("agent lifecycle", () => {
}),
);
await writeFile(skill, "managed");
await writeFile(legacySkill, "legacy managed");
await mkdir(join(home, ".rea"), { recursive: true });
await import("node:fs/promises").then(({ symlink }) =>
symlink(home, join(home, ".rea/cache")),
@@ -175,7 +172,6 @@ describe("agent lifecycle", () => {
mcpServers: { other: { command: "other" } },
});
await expect(readFile(skill, "utf8")).rejects.toThrow();
await expect(readFile(legacySkill, "utf8")).rejects.toThrow();
expect(first.items).toContainEqual(
expect.objectContaining({
name: "cache",
+1 -53
View File
@@ -1,11 +1,4 @@
import {
mkdtemp,
mkdir,
readFile,
rm,
symlink,
writeFile,
} from "node:fs/promises";
import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
@@ -49,49 +42,4 @@ describe("canonical skill transaction", () => {
expect(await canonicalSkillNeedsInstall(home)).toBe(false);
expect(await installCanonicalSkill(home)).toBe("unchanged");
});
it("backs up and retires the legacy skill name", async () => {
const home = await mkdtemp(join(tmpdir(), "rea-skill-test-"));
roots.push(home);
const legacy = join(home, ".agents/skills/rea-analysis/SKILL.md");
const destination = join(
home,
".agents/skills/reverse-engineer-anything/SKILL.md",
);
await mkdir(dirname(legacy), { recursive: true });
await writeFile(legacy, "legacy managed skill\n");
expect(await canonicalSkillNeedsInstall(home)).toBe(true);
expect(await installCanonicalSkill(home)).toBe("installed");
expect(await readFile(destination, "utf8")).toContain(
"name: reverse-engineer-anything",
);
expect(await readFile(`${legacy}.rea.backup`, "utf8")).toBe(
"legacy managed skill\n",
);
await expect(readFile(legacy, "utf8")).rejects.toThrow();
expect(await canonicalSkillNeedsInstall(home)).toBe(false);
});
it("does not migrate a legacy skill through a directory symlink", async () => {
const home = await mkdtemp(join(tmpdir(), "rea-skill-test-"));
roots.push(home);
const skillsRoot = join(home, ".agents/skills");
const external = join(home, "external-skill");
const legacyRoot = join(skillsRoot, "rea-analysis");
const legacy = join(legacyRoot, "SKILL.md");
const destination = join(skillsRoot, "reverse-engineer-anything/SKILL.md");
await mkdir(skillsRoot, { recursive: true });
await mkdir(external, { recursive: true });
await writeFile(join(external, "SKILL.md"), "external skill\n");
await symlink(
external,
legacyRoot,
process.platform === "win32" ? "junction" : "dir",
);
expect(await installCanonicalSkill(home)).toBe("failed");
expect(await readFile(legacy, "utf8")).toBe("external skill\n");
await expect(readFile(destination, "utf8")).rejects.toThrow();
});
});