History

fix(claude): skills picked from the composer now run (#9128)

Theo Browne committed 2 months ago

Commit ea71a191 parent 9a7b1e216 files · +1080 −82Browse files

Showing the changes to packages/client-runtime/src (2 of 16 files). Show all

Unified · Split

2 files
  1. packages/client-runtime/src/providerSkills.test.ts +24 −0
  2. packages/client-runtime/src/providerSkills.ts +14 −1
packages/client-runtime/src/providerSkills.test.ts+24−0
@@ -108,6 +108,30 @@ describe("getProviderSkillsForSlashMenu", () => { · 107 unmodified lines
108108 });
109109 });
110110
111+describe("getProviderSkillsForSlashMenu", () => {
112+ it("drops a skill the provider reserves for the agent", () => {
113+ const skills = [
114+ {
115+ name: "legacy-system-context",
116+ path: "/Users/matt/.claude/skills/legacy-system-context/SKILL.md",
117+ enabled: true,
118+ userInvocable: false,
119+ },
120+ {
121+ name: "deploy",
122+ path: "/Users/matt/.claude/skills/deploy/SKILL.md",
123+ enabled: true,
124+ // Reserved for the user, not the agent: still a valid pick.
125+ userInvocationOnly: true,
126+ },
127+ ];
128+
129+ expect(getProviderSkillsForSlashMenu(skills, true).map((skill) => skill.name)).toEqual([
130+ "deploy",
131+ ]);
132+ });
133+});
134+
111135 describe("getProviderSlashCommandsForSlashMenu", () => {
112136 const commands = [
113137 { name: "ask-matt", description: "Ask which skill fits your situation." },
packages/client-runtime/src/providerSkills.ts+14−1
@@ -39,12 +39,25 @@ export function dedupeProviderSkillsByName( · 38 unmodified lines
3939 });
4040 }
4141
42+/**
43+ * Whether a composer pick can start this skill. A skill switched off in the
44+ * provider's settings will not run, and one the provider reserves for the
45+ * agent (Claude Code's `user-invocable: false`) rejects a user invocation.
46+ * Everything else, including skills the agent may not start on its own, is
47+ * fair game: the server dispatches the pick in the provider's native form.
48+ */
49+export function isProviderSkillUserInvocable(
50+ skill: Pick<ServerProviderSkill, "enabled" | "userInvocable">,
51+): boolean {
52+ return skill.enabled && skill.userInvocable !== false;
53+}
54+
4255 export function getProviderSkillsForSlashMenu(
4356 skills: ReadonlyArray<ServerProviderSkill>,
4457 showSkillsInSlashMenu: boolean,
4558 ): ServerProviderSkill[] {
4659 return showSkillsInSlashMenu
47− ? dedupeProviderSkillsByName(skills.filter((skill) => skill.enabled))
60+ ? dedupeProviderSkillsByName(skills.filter(isProviderSkillUserInvocable))
4861 : [];
4962 }
5063

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t