MCPcopy Create free account
hub / github.com/promptfoo/promptfoo / parseScriptParts

Function parseScriptParts

src/providers/scriptCompletion.ts:23–39  ·  view source on GitHub ↗
(scriptPath: string)

Source from the content-addressed store, hash-verified

21}
22
23export function parseScriptParts(scriptPath: string): string[] {
24 const scriptPartsRegex = /[^\s"']+|"([^"]*)"|'([^']*)'/g;
25 let match;
26 const scriptParts = [];
27
28 while ((match = scriptPartsRegex.exec(scriptPath)) !== null) {
29 if (match[1]) {
30 scriptParts.push(match[1]);
31 } else if (match[2]) {
32 scriptParts.push(match[2]);
33 } else {
34 scriptParts.push(match[0]);
35 }
36 }
37
38 return scriptParts;
39}
40
41export function getFileHashes(scriptParts: string[]): string[] {
42 const fileHashes: string[] = [];

Callers 4

executablePromptFunctionFunction · 0.90
processExecutableFileFunction · 0.90
callApiMethod · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…