MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / findArtifactSourceReference

Function findArtifactSourceReference

packages/runtime/src/index.ts:191–206  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

189}
190
191export function findArtifactSourceReference(source: string): string | null {
192 let cursor = 0;
193 const prefix = 'artifact source lives in';
194 while (cursor < source.length) {
195 const start = source.indexOf('<!--', cursor);
196 if (start < 0) return null;
197 const end = source.indexOf('-->', start + 4);
198 if (end < 0) return null;
199 const body = source.slice(start + 4, end).trim();
200 if (body.toLowerCase().startsWith(prefix)) {
201 return normalizeArtifactSourceReferencePath(body.slice(prefix.length).trim());
202 }
203 cursor = end + 3;
204 }
205 return null;
206}
207
208export function resolveArtifactSourceReferencePath(
209 currentPath: string,

Callers 5

index.test.tsFile · 0.90
looksRunnableArtifactFunction · 0.90
runPreviewFunction · 0.90
referencedSourcePathFunction · 0.90

Tested by

no test coverage detected