MCPcopy
hub / github.com/coder/mux / parseCommandHeaderBody

Function parseCommandHeaderBody

src/browser/utils/slashCommands/registry.ts:65–76  ·  view source on GitHub ↗
(rawInput: string)

Source from the content-addressed store, hash-verified

63}
64
65function parseCommandHeaderBody(rawInput: string): CommandHeaderBody {
66 const newlineIndex = rawInput.indexOf("\n");
67 const header = newlineIndex === -1 ? rawInput : rawInput.slice(0, newlineIndex);
68 const rawBody = newlineIndex === -1 ? "" : rawInput.slice(newlineIndex + 1);
69 const body = trimOuterBlankLines(rawBody);
70
71 return {
72 headerTokens: tokenizeCommandLine(header),
73 body: body.trim().length > 0 ? body : undefined,
74 bodyHadLeadingBlankLine: /^\s*\r?\n/.test(rawBody),
75 };
76}
77
78// Re-export MODEL_ABBREVIATIONS from constants for backwards compatibility
79export { MODEL_ABBREVIATIONS };

Callers 1

registry.tsFile · 0.85

Calls 3

trimOuterBlankLinesFunction · 0.85
tokenizeCommandLineFunction · 0.85
testMethod · 0.80

Tested by

no test coverage detected