source dump of claude code
1import uniqBy from 'lodash-es/uniqBy.js'
2import { useMemo } from 'react'
3import type { Command } from '../commands.js'
4
5export function useMergedCommands(
6 initialCommands: Command[],
7 mcpCommands: Command[],
8): Command[] {
9 return useMemo(() => {
10 if (mcpCommands.length > 0) {
11 return uniqBy([...initialCommands, ...mcpCommands], 'name')
12 }
13 return initialCommands
14 }, [initialCommands, mcpCommands])
15}