MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / createFileReference

Function createFileReference

packages/web/src/features/chat/utils.ts:236–252  ·  view source on GitHub ↗
({ repo, path, startLine, endLine }: { repo: string, path: string, startLine?: string, endLine?: string })

Source from the content-addressed store, hash-verified

234}
235
236export const createFileReference = ({ repo, path, startLine, endLine }: { repo: string, path: string, startLine?: string, endLine?: string }): FileReference => {
237 const range = startLine && endLine ? {
238 startLine: parseInt(startLine),
239 endLine: parseInt(endLine),
240 } : startLine ? {
241 startLine: parseInt(startLine),
242 endLine: parseInt(startLine),
243 } : undefined;
244
245 return {
246 type: 'file',
247 id: getFileReferenceId({ repo, path, range }),
248 repo,
249 path,
250 range,
251 }
252}
253
254/**
255 * Converts LLM text that includes references (e.g., @file:...) into a portable

Callers 3

useExtractReferencesFunction · 0.90
remarkReferencesPluginFunction · 0.90

Calls 1

getFileReferenceIdFunction · 0.85

Tested by

no test coverage detected