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

Co-authored-by: Rodrigo Brechard <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-09-01 17:44:13 -07:00
1 parent 9a7b1e21e5
commit ea71a19d41
16 files changed
+1080 -82

No files matched your search

@@ -177,7 +177,7 @@ describe("searchSlashCommandItems", () => {
]);
});
it("hides skills from slash completion after the first message line", () => {
it("hides provider commands from slash completion after the first message line", () => {
const items = [
{
id: "slash:model",
@@ -186,6 +186,14 @@ describe("searchSlashCommandItems", () => {
label: "/model",
description: "Switch model",
},
{
id: "provider-slash-command:claudeAgent:compact",
type: "provider-slash-command",
provider: claudeDriver,
command: { name: "compact" },
label: "/compact",
description: "Compact the conversation",
},
{
id: "skill:claudeAgent:unslop",
type: "skill",
@@ -204,9 +212,11 @@ describe("searchSlashCommandItems", () => {
expect(slashCommandItemsForPromptPosition(items, false).map((item) => item.id)).toEqual([
"slash:model",
"skill:claudeAgent:unslop",
]);
expect(slashCommandItemsForPromptPosition(items, true).map((item) => item.id)).toEqual([
"slash:model",
"provider-slash-command:claudeAgent:compact",
"skill:claudeAgent:unslop",
]);
});
@@ -12,6 +12,12 @@ type SlashSearchItem = Extract<
{ type: "slash-command" | "provider-slash-command" | "skill" }
>;
/**
* A provider expands a slash command only when it opens the whole message;
* anywhere else it reaches the agent as literal text, so it is not offered
* there. Built-ins apply locally on selection and skills insert a `$` mention
* the server dispatches from any position, so both stay available.
*/
export function slashCommandItemsForPromptPosition(
items: ReadonlyArray<SlashSearchItem>,
isAtPromptStart: boolean,
@@ -19,7 +25,7 @@ export function slashCommandItemsForPromptPosition(
if (isAtPromptStart) {
return [...items];
}
return items.filter((item) => item.type !== "skill");
return items.filter((item) => item.type !== "provider-slash-command");
}
function scoreSlashCommandItem(item: SlashSearchItem, query: string): number | null {
+13
View File
@@ -48,6 +48,19 @@ describe("searchProviderSkills", () => {
expect(searchProviderSkills(skills, "gfc").map((skill) => skill.name)).toEqual(["gh-fix-ci"]);
});
it("keeps user-only skills and omits agent-only ones", () => {
const skills = [
makeSkill({ name: "re-release-version", userInvocationOnly: true }),
makeSkill({ name: "release-context", userInvocable: false }),
makeSkill({ name: "release-version" }),
];
expect(searchProviderSkills(skills, "release").map((skill) => skill.name)).toEqual([
"release-version",
"re-release-version",
]);
});
it("omits disabled skills from results", () => {
const skills = [
makeSkill({ name: "ui", displayName: "Ui", enabled: false }),
+2 -1
View File
@@ -2,6 +2,7 @@ import type { ServerProviderSkill } from "@t3tools/contracts";
import {
dedupeProviderSkillsByName,
formatProviderSkillDisplayName,
isProviderSkillUserInvocable,
} from "@t3tools/client-runtime/providerSkills";
import {
insertRankedSearchResult,
@@ -73,7 +74,7 @@ export function searchProviderSkills(
query: string,
limit = Number.POSITIVE_INFINITY,
): ServerProviderSkill[] {
const enabledSkills = dedupeProviderSkillsByName(skills.filter((skill) => skill.enabled));
const enabledSkills = dedupeProviderSkillsByName(skills.filter(isProviderSkillUserInvocable));
const normalizedQuery = normalizeSearchQuery(query, { trimLeadingPattern: /^\$+/ });
if (!normalizedQuery) {