native macOS codings agent orchestrator
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #32 from onevcat/feature/filter-unsupported-ghostty-actions

feat: filter unsupported Ghostty actions from command palette

authored by

Wei Wang and committed by
GitHub
30793471 1b85d871

+64 -4
+14 -4
supacode/Features/CommandPalette/Reducer/CommandPaletteFeature.swift
··· 589 589 } 590 590 } 591 591 592 - /// Ghostty actions that Prowl handles natively and should not appear as 593 - /// duplicates from the Ghostty command palette entries. 594 - private let filteredGhosttyActions: Set<String> = [ 592 + /// Ghostty action keys that should be hidden from Prowl's command palette. 593 + /// 594 + /// Includes: 595 + /// - actions Prowl already exposes natively (`check_for_updates`) 596 + /// - Ghostty actions intentionally unsupported by Prowl's architecture/platform 597 + private let filteredGhosttyActionKeys: Set<String> = [ 595 598 "check_for_updates", 599 + "new_window", 600 + "close_all_windows", 601 + "goto_window", 602 + "toggle_tab_overview", 603 + "inspector", 604 + "show_gtk_inspector", 605 + "show_on_screen_keyboard", 596 606 ] 597 607 598 608 private func ghosttyCommandItems(_ commands: [GhosttyCommand]) -> [CommandPaletteItem] { 599 609 commands.compactMap { command in 600 - guard !filteredGhosttyActions.contains(command.action) else { return nil } 610 + guard !filteredGhosttyActionKeys.contains(command.actionKey) else { return nil } 601 611 let subtitle = command.description.trimmingCharacters(in: .whitespacesAndNewlines) 602 612 return CommandPaletteItem( 603 613 id: CommandPaletteItemID.ghosttyCommand(command),
+50
supacodeTests/CommandPaletteFeatureTests.swift
··· 88 88 #expect(ghosttyItem?.subtitle == "Focus the split to the right.") 89 89 } 90 90 91 + @Test func commandPaletteItems_filtersUnsupportedGhosttyCommands() { 92 + let rootPath = "/tmp/repo" 93 + let worktree = makeWorktree(id: rootPath, name: "repo", repoRoot: rootPath) 94 + let repository = makeRepository(rootPath: rootPath, name: "Repo", worktrees: [worktree]) 95 + var state = RepositoriesFeature.State(repositories: [repository]) 96 + state.selection = .worktree(worktree.id) 97 + 98 + let items = CommandPaletteFeature.commandPaletteItems( 99 + from: state, 100 + ghosttyCommands: [ 101 + GhosttyCommand( 102 + title: "New Window", 103 + description: "Create a new window", 104 + action: "new_window", 105 + actionKey: "new_window" 106 + ), 107 + GhosttyCommand( 108 + title: "Next Window", 109 + description: "Go to next window", 110 + action: "goto_window:next", 111 + actionKey: "goto_window" 112 + ), 113 + GhosttyCommand( 114 + title: "Inspector", 115 + description: "Open inspector", 116 + action: "inspector", 117 + actionKey: "inspector" 118 + ), 119 + GhosttyCommand( 120 + title: "Focus Split Right", 121 + description: "Focus the split to the right.", 122 + action: "goto_split:right", 123 + actionKey: "goto_split" 124 + ), 125 + ] 126 + ) 127 + 128 + let ghosttyActions = items.compactMap { item -> String? in 129 + if case .ghosttyCommand(let action) = item.kind { 130 + return action 131 + } 132 + return nil 133 + } 134 + 135 + #expect(ghosttyActions.contains("new_window") == false) 136 + #expect(ghosttyActions.contains("goto_window:next") == false) 137 + #expect(ghosttyActions.contains("inspector") == false) 138 + #expect(ghosttyActions.contains("goto_split:right")) 139 + } 140 + 91 141 @Test func commandPaletteItems_omitGhosttyCommandsWithoutSelectedWorktree() { 92 142 let items = CommandPaletteFeature.commandPaletteItems( 93 143 from: RepositoriesFeature.State(),