feat(skill): rename skill to reverse-engineer-anything
This commit is contained in:
@@ -146,9 +146,14 @@ describe("agent lifecycle", () => {
|
||||
const home = await mkdtemp(join(tmpdir(), "rea-uninstall-"));
|
||||
roots.push(home);
|
||||
const cursor = join(home, ".cursor/mcp.json");
|
||||
const skill = join(home, ".agents/skills/rea-analysis/SKILL.md");
|
||||
const skill = join(
|
||||
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({
|
||||
@@ -159,6 +164,7 @@ 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")),
|
||||
@@ -168,6 +174,8 @@ describe("agent lifecycle", () => {
|
||||
expect(JSON.parse(await readFile(cursor, "utf8"))).toEqual({
|
||||
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",
|
||||
@@ -300,7 +308,7 @@ describe("agent lifecycle", () => {
|
||||
it("reports a managed-path removal failure", async () => {
|
||||
const home = await mkdtemp(join(tmpdir(), "rea-uninstall-remove-"));
|
||||
roots.push(home);
|
||||
const skillRoot = join(home, ".agents/skills/rea-analysis");
|
||||
const skillRoot = join(home, ".agents/skills/reverse-engineer-anything");
|
||||
await mkdir(skillRoot, { recursive: true });
|
||||
const result = await runUninstall(
|
||||
false,
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import {
|
||||
mkdtemp,
|
||||
mkdir,
|
||||
readFile,
|
||||
rm,
|
||||
symlink,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
@@ -19,7 +26,10 @@ describe("canonical skill transaction", () => {
|
||||
it("backs up and upgrades a stale managed skill without touching siblings", async () => {
|
||||
const home = await mkdtemp(join(tmpdir(), "rea-skill-test-"));
|
||||
roots.push(home);
|
||||
const destination = join(home, ".agents/skills/rea-analysis/SKILL.md");
|
||||
const destination = join(
|
||||
home,
|
||||
".agents/skills/reverse-engineer-anything/SKILL.md",
|
||||
);
|
||||
const sibling = join(home, ".agents/skills/unrelated/SKILL.md");
|
||||
await mkdir(dirname(destination), { recursive: true });
|
||||
await mkdir(dirname(sibling), { recursive: true });
|
||||
@@ -31,7 +41,7 @@ describe("canonical skill transaction", () => {
|
||||
expect(await readFile(`${destination}.rea.backup`, "utf8")).toBe(
|
||||
"stale managed skill\n",
|
||||
);
|
||||
expect(await readFile(destination, "utf8")).toContain('version: "20"');
|
||||
expect(await readFile(destination, "utf8")).toContain('version: "21"');
|
||||
expect(await readFile(destination, "utf8")).toContain(
|
||||
`tool_count: ${String(TOOL_CONTRACTS.length)}`,
|
||||
);
|
||||
@@ -39,4 +49,49 @@ 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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user