Parcourir la source

fix(tui): hide project commands from mini palette (#38259)

Simon Klee il y a 3 semaines
Parent
commit
6e826f3e22

+ 0 - 32
packages/tui/src/mini/footer.command.tsx

@@ -92,18 +92,6 @@ function countLabel(count: number, total: number, query: string) {
   return `${count}/${total}`
 }
 
-function categoryRank(category: string) {
-  if (category === "Project Commands") {
-    return 0
-  }
-
-  if (category === "MCP Commands") {
-    return 1
-  }
-
-  return 2
-}
-
 function subagentStatusLabel(status: FooterSubagentTab["status"]) {
   if (status === "completed") {
     return "done"
@@ -374,7 +362,6 @@ export function RunCommandMenuBody(props: {
   const skills = createMemo(() => (props.commands() ?? []).filter((item) => item.source === "skill"))
   const activeSubagentCount = createMemo(() => props.subagents().filter((item) => item.status === "running").length)
   const entries = createMemo<CommandEntry[]>(() => {
-    const builtins = ["compact", "editor", "new", "settings"]
     const session: CommandEntry[] = [
       {
         action: "editor",
@@ -473,29 +460,10 @@ export function RunCommandMenuBody(props: {
         ]
         : []),
     ]
-    const commands = (props.commands() ?? [])
-      .filter((item) => item.source !== "skill" && !builtins.includes(item.name))
-      .map(
-        (item) =>
-          ({
-            action: "slash",
-            category: item.source === "mcp" ? "MCP Commands" : "Project Commands",
-            name: item.name,
-            display: item.name,
-            footer: `/${item.name}`,
-            keywords:
-              item.source === "mcp"
-                ? `/${item.name} ${item.name} mcp ${item.description ?? ""}`
-                : `/${item.name} ${item.name} ${item.description ?? ""}`,
-          }) satisfies CommandEntry,
-      )
-      .sort((a, b) => categoryRank(a.category) - categoryRank(b.category) || a.display.localeCompare(b.display))
-
     return [
       ...session,
       ...prompt,
       ...agent,
-      ...commands,
       {
         action: "settings",
         category: "System",

+ 11 - 1
packages/tui/test/mini/footer.view.test.tsx

@@ -365,7 +365,7 @@ test("run entry content updates when live commit text changes", async () => {
   }
 })
 
-test("direct command panel renders grouped command palette", async () => {
+test("direct command panel renders grouped actions without catalog commands", async () => {
   const [commands] = createSignal<RunCommand[] | undefined>([
     command({ name: "review", description: "Review code" }),
     command({ name: "deploy", description: "Deploy prompt", source: "mcp" }),
@@ -433,6 +433,16 @@ test("direct command panel renders grouped command palette", async () => {
     expect(frame).not.toContain("Review code")
     expect(frame).not.toContain("Commands 8")
 
+    await app.mockInput.typeText("review")
+    await app.renderOnce()
+    expect(app.captureCharFrame()).toContain("No results found")
+
+    app.mockInput.pressKey("u", { ctrl: true })
+    await app.mockInput.typeText("deploy")
+    await app.renderOnce()
+    expect(app.captureCharFrame()).toContain("No results found")
+
+    app.mockInput.pressKey("u", { ctrl: true })
     await app.mockInput.typeText("status")
     await app.renderOnce()
     expect(app.captureCharFrame()).toContain("Show status")