MCPcopy
hub / github.com/CopilotKit/CopilotKit / normalizeCommandName

Function normalizeCommandName

packages/bot/src/commands.ts:78–84  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

76
77/** Normalize a command name for matching: drop a leading slash, lower-case, trim. */
78export function normalizeCommandName(name: string): string {
79 // Collapse "-"→"_" so a command routes the same whether invoked as
80 // /file-issue (Slack/Discord allow hyphens) or /file_issue (Telegram forbids
81 // them; its adapter converts on registration). This is the ROUTING key only —
82 // per-adapter display names are decided in each adapter / `toCommandSpec`.
83 return name.trim().replace(/^\//, "").toLowerCase().replace(/-/g, "_");
84}
85
86export function toCommandSpec(command: BotCommand): CommandSpec {
87 return {

Callers 3

createBotFunction · 0.85
onCommandFunction · 0.85
commands.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…