feat(restore): support skills add passthrough flags

This commit is contained in:
xixu-me committed 2026-03-25 13:48:16 +08:00
1 parent 17c27cdc84
commit 0359706be3
4 files changed
+181 -18

No files matched your search

+100
View File
@@ -40,6 +40,31 @@ test("prints per-source install commands during restore dry-run", async () => {
expect(result.stdout).not.toContain("github/awesome-copilot");
});
test("prints passthrough skills add options during restore dry-run", async () => {
const result = await runRestore(
[
"--dry-run",
"--only-source",
"anthropics/skills",
"--agent",
"codex",
"--agent",
"claude-code",
"--copy",
"--all",
],
{
readManifest: () => sampleManifest,
},
);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain(
"[dry-run] bunx skills add anthropics/skills -g -y --agent codex --agent claude-code --copy --all",
);
expect(result.stdout).not.toContain("--skill");
});
test("restores only missing skills during live execution", async () => {
const commands: string[][] = [];
@@ -63,6 +88,81 @@ test("restores only missing skills during live execution", async () => {
]);
});
test("passes agent and copy options through during live restore", async () => {
const commands: string[][] = [];
const result = await runRestore(
[
"--manifest",
"ignored.yaml",
"--agent",
"codex",
"--agent",
"claude-code",
"--copy",
],
{
readManifest: () => sampleManifest,
getInstalledSkillNames: async () => new Set(["alpha"]),
runBunx: async (args) => {
commands.push(args);
return { exitCode: 0, stdout: "", stderr: "" };
},
},
);
expect(result.exitCode).toBe(0);
expect(commands).toEqual([
[
"skills",
"add",
"anthropics/skills",
"-g",
"-y",
"--agent",
"codex",
"--agent",
"claude-code",
"--copy",
"--skill",
"beta",
],
[
"skills",
"add",
"github/awesome-copilot",
"-g",
"-y",
"--agent",
"codex",
"--agent",
"claude-code",
"--copy",
"--skill",
"gamma",
],
]);
});
test("installs all source skills when --all is enabled", async () => {
const commands: string[][] = [];
const result = await runRestore(["--manifest", "ignored.yaml", "--all"], {
readManifest: () => sampleManifest,
getInstalledSkillNames: async () => new Set(["alpha", "beta", "gamma"]),
runBunx: async (args) => {
commands.push(args);
return { exitCode: 0, stdout: "", stderr: "" };
},
});
expect(result.exitCode).toBe(0);
expect(commands).toEqual([
["skills", "add", "anthropics/skills", "-g", "-y", "--all"],
["skills", "add", "github/awesome-copilot", "-g", "-y", "--all"],
]);
});
test("continues and returns success when continue-on-error is enabled", async () => {
const result = await runRestore(
["--manifest", "ignored.yaml", "--continue-on-error"],