MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / parseCommandInput

Function parseCommandInput

cli/src/commands/router-utils.ts:59–80  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

57 * parseCommandInput('init something') // => null
58 */
59export function parseCommandInput(input: string): ParsedCommandInput | null {
60 const trimmed = input.trim()
61 if (!trimmed) return null
62
63 if (trimmed.startsWith('/')) {
64 const command = parseCommand(trimmed)
65 if (!command) return null
66 const args = trimmed.slice(1 + command.length).trim()
67 return { command, args, implicitCommand: false }
68 }
69
70 if (/\s/.test(trimmed)) {
71 return null
72 }
73
74 const normalized = trimmed.toLowerCase()
75 if (!SLASHLESS_COMMAND_IDS.has(normalized)) {
76 return null
77 }
78
79 return { command: normalized, args: '', implicitCommand: true }
80}

Callers 2

routeUserPromptFunction · 0.90

Calls 1

parseCommandFunction · 0.85

Tested by

no test coverage detected