📄 File detail

hooks/useMergedCommands.ts

🧩 .ts📏 16 lines💾 423 bytes📝 text
← Back to All Files

🎯 Use case

This file lives under “hooks/”, which covers reusable UI or integration hooks. On the API surface it exposes useMergedCommands — mainly functions, hooks, or classes. Dependencies touch lodash-es and React UI. It composes internal code from commands (relative imports).

Generated from folder role, exports, dependency roots, and inline comments — not hand-reviewed for every path.

🧠 Inline summary

import uniqBy from 'lodash-es/uniqBy.js' import { useMemo } from 'react' import type { Command } from '../commands.js' export function useMergedCommands(

📤 Exports (heuristic)

  • useMergedCommands

📚 External import roots

Package roots from from "…" (relative paths omitted).

  • lodash-es
  • react

🖥️ Source preview

import uniqBy from 'lodash-es/uniqBy.js'
import { useMemo } from 'react'
import type { Command } from '../commands.js'

export function useMergedCommands(
  initialCommands: Command[],
  mcpCommands: Command[],
): Command[] {
  return useMemo(() => {
    if (mcpCommands.length > 0) {
      return uniqBy([...initialCommands, ...mcpCommands], 'name')
    }
    return initialCommands
  }, [initialCommands, mcpCommands])
}