MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / rewriteModuleRefsForUiRun

Function rewriteModuleRefsForUiRun

yaml-flow-editor/vite.config.ts:127–143  ·  view source on GitHub ↗
(
    yamlText: string,
    currentFileDir: string,
    moduleTargetByOriginalPath: Map<string, string>,
  )

Source from the content-addressed store, hash-verified

125 }
126
127 function rewriteModuleRefsForUiRun(
128 yamlText: string,
129 currentFileDir: string,
130 moduleTargetByOriginalPath: Map<string, string>,
131 ): string {
132 return yamlText.replace(
133 /^(\s*module\s*:\s*)(?:(["'])([^"'\n]+)\2|([^#\n][^\n#]*?))(\s*(?:#.*)?)$/gm,
134 (full, prefix: string, quoted: string | undefined, quotedPath: string | undefined, barePath: string | undefined, suffix: string | undefined) => {
135 const originalPath = (quotedPath ?? barePath ?? '').trim()
136 const targetPath = moduleTargetByOriginalPath.get(originalPath)
137 if (!targetPath) return full
138 const nextPath = toPosixRelative(currentFileDir, targetPath)
139 if (quoted) return `${prefix}${quoted}${nextPath}${quoted}${suffix ?? ''}`
140 return `${prefix}${nextPath}${suffix ?? ''}`
141 }
142 )
143 }
144
145 function eventLogPathForRun(projectRoot: string, run: RunInfo): string | null {
146 try {

Callers 1

configureServerFunction · 0.85

Calls 2

toPosixRelativeFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected