aboutsummaryrefslogtreecommitdiff
path: root/src/tools/tool.ts
blob: 8289aa332bedd354e3e03826a696c9b2dedb0587 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { config } from '@/config';
import type { Tool } from './tools.types';

type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;

export function defineTool(
  tool: WithOptional<Tool, 'isNew'>,
  { newTools }: { newTools: string[] } = { newTools: config.tools.newTools },
) {
  const isNew = newTools.includes(tool.name);

  return {
    isNew,
    ...tool,
  };
}