MCPcopy
hub / github.com/Dimillian/CodexMonitor / tokenizeCommand

Function tokenizeCommand

src/utils/threadItems.explore.ts:100–113  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

98}
99
100function tokenizeCommand(command: string) {
101 const tokens: string[] = [];
102 const regex = /"([^"]*)"|'([^']*)'|`([^`]*)`|(\S+)/g;
103 let match: RegExpExecArray | null = regex.exec(command);
104 while (match) {
105 const [, doubleQuoted, singleQuoted, backticked, bare] = match;
106 const value = doubleQuoted ?? singleQuoted ?? backticked ?? bare ?? "";
107 if (value) {
108 tokens.push(value);
109 }
110 match = regex.exec(command);
111 }
112 return tokens;
113}
114
115function splitCommandSegments(command: string) {
116 return command

Callers 1

parseCommandSegmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected