2026-03-13 22:49:42 -05:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
import {
|
|
|
|
|
listClaudeSkills,
|
|
|
|
|
syncClaudeSkills,
|
|
|
|
|
} from "@paperclipai/adapter-claude-local/server";
|
|
|
|
|
|
|
|
|
|
describe("claude local skill sync", () => {
|
2026-03-16 18:27:20 -05:00
|
|
|
const paperclipKey = "paperclipai/paperclip/paperclip";
|
|
|
|
|
const createAgentKey = "paperclipai/paperclip/paperclip-create-agent";
|
|
|
|
|
|
2026-03-13 22:49:42 -05:00
|
|
|
it("defaults to mounting all built-in Paperclip skills when no explicit selection exists", async () => {
|
|
|
|
|
const snapshot = await listClaudeSkills({
|
|
|
|
|
agentId: "agent-1",
|
|
|
|
|
companyId: "company-1",
|
|
|
|
|
adapterType: "claude_local",
|
|
|
|
|
config: {},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(snapshot.mode).toBe("ephemeral");
|
|
|
|
|
expect(snapshot.supported).toBe(true);
|
2026-03-16 18:27:20 -05:00
|
|
|
expect(snapshot.desiredSkills).toContain(paperclipKey);
|
|
|
|
|
expect(snapshot.entries.find((entry) => entry.key === paperclipKey)?.required).toBe(true);
|
|
|
|
|
expect(snapshot.entries.find((entry) => entry.key === paperclipKey)?.state).toBe("configured");
|
2026-03-13 22:49:42 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("respects an explicit desired skill list without mutating a persistent home", async () => {
|
|
|
|
|
const snapshot = await syncClaudeSkills({
|
|
|
|
|
agentId: "agent-2",
|
|
|
|
|
companyId: "company-1",
|
|
|
|
|
adapterType: "claude_local",
|
|
|
|
|
config: {
|
|
|
|
|
paperclipSkillSync: {
|
2026-03-16 18:27:20 -05:00
|
|
|
desiredSkills: [paperclipKey],
|
2026-03-13 22:49:42 -05:00
|
|
|
},
|
|
|
|
|
},
|
2026-03-16 18:27:20 -05:00
|
|
|
}, [paperclipKey]);
|
2026-03-13 22:49:42 -05:00
|
|
|
|
2026-03-16 18:27:20 -05:00
|
|
|
expect(snapshot.desiredSkills).toContain(paperclipKey);
|
|
|
|
|
expect(snapshot.entries.find((entry) => entry.key === paperclipKey)?.state).toBe("configured");
|
|
|
|
|
expect(snapshot.entries.find((entry) => entry.key === createAgentKey)?.state).toBe("configured");
|
2026-03-13 22:49:42 -05:00
|
|
|
});
|
2026-03-16 19:13:00 -05:00
|
|
|
|
|
|
|
|
it("normalizes legacy flat Paperclip skill refs to canonical keys", async () => {
|
|
|
|
|
const snapshot = await listClaudeSkills({
|
|
|
|
|
agentId: "agent-3",
|
|
|
|
|
companyId: "company-1",
|
|
|
|
|
adapterType: "claude_local",
|
|
|
|
|
config: {
|
|
|
|
|
paperclipSkillSync: {
|
|
|
|
|
desiredSkills: ["paperclip"],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(snapshot.warnings).toEqual([]);
|
|
|
|
|
expect(snapshot.desiredSkills).toContain(paperclipKey);
|
|
|
|
|
expect(snapshot.desiredSkills).not.toContain("paperclip");
|
|
|
|
|
expect(snapshot.entries.find((entry) => entry.key === paperclipKey)?.state).toBe("configured");
|
|
|
|
|
expect(snapshot.entries.find((entry) => entry.key === "paperclip")).toBeUndefined();
|
|
|
|
|
});
|
2026-03-13 22:49:42 -05:00
|
|
|
});
|