Skip to content

Commit 4bb438c

Browse files
committed
1 parent bfad1bf commit 4bb438c

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

‎src/cli/skills-cli.commands.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,19 @@ describe("skills cli commands", () => {
812812
expect(installSkillFromSourceMock).not.toHaveBeenCalled();
813813
});
814814

815+
it.each([
816+
{ spec: "git:owner/tools", flag: "--force-install" },
817+
{ spec: "./local-skill", flag: "--force-install" },
818+
{ spec: "git:owner/tools", flag: "--acknowledge-clawhub-risk" },
819+
{ spec: "./local-skill", flag: "--acknowledge-clawhub-risk" },
820+
])("rejects ClawHub-only $flag for source install $spec", async ({ spec, flag }) => {
821+
await expect(runCommand(["skills", "install", spec, flag])).rejects.toThrow("__exit__:1");
822+
823+
expect(runtimeErrors).toContain(`${flag} is only supported for ClawHub skill installs.`);
824+
expect(installSkillFromClawHubMock).not.toHaveBeenCalled();
825+
expect(installSkillFromSourceMock).not.toHaveBeenCalled();
826+
});
827+
815828
it("installs a skill into the cwd-inferred agent workspace", async () => {
816829
routeWorkspaceByAgent();
817830
resolveAgentIdByWorkspacePathMock.mockReturnValue("writer");

‎src/cli/skills-cli.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,16 @@ export function registerSkillsCli(program: Command) {
686686
return;
687687
}
688688
if (isSkillSourceInstallSpec(slug)) {
689-
if (opts.version) {
690-
defaultRuntime.error("--version is only supported for ClawHub skill installs.");
689+
const clawHubOnlyOption = [
690+
opts.version && "--version",
691+
opts.forceInstall && "--force-install",
692+
(opts.acknowledgeClawhubRisk === true || opts.acknowledgeClawHubRisk === true) &&
693+
"--acknowledge-clawhub-risk",
694+
].find(Boolean);
695+
if (clawHubOnlyOption) {
696+
defaultRuntime.error(
697+
`${clawHubOnlyOption} is only supported for ClawHub skill installs.`,
698+
);
691699
defaultRuntime.exit(1);
692700
return;
693701
}

0 commit comments

Comments
 (0)