MCPcopy
hub / github.com/npmx-dev/npmx.dev / stripContextCommandAction

Function stripContextCommandAction

app/composables/useCommandPalette.ts:16–32  ·  view source on GitHub ↗
(
  command: CommandPaletteContextCommandInput,
  actionId: string,
)

Source from the content-addressed store, hash-verified

14const queryOverrideRegistry = new Map<string, (query: string) => CommandPaletteCommand[] | null>()
15
16function stripContextCommandAction(
17 command: CommandPaletteContextCommandInput,
18 actionId: string,
19): CommandPaletteContextCommand {
20 if ('action' in command) {
21 const { action: _action, ...commandWithoutAction } = command
22 return {
23 ...commandWithoutAction,
24 actionId,
25 }
26 }
27
28 return {
29 ...command,
30 actionId,
31 }
32}
33
34export function useCommandPalette() {
35 const isOpen = useState('command-palette:is-open', () => false)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected