MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / formatRetrievalBlock

Function formatRetrievalBlock

src/context/retrieval.ts:378–389  ·  view source on GitHub ↗
(files: RankedFile[])

Source from the content-addressed store, hash-verified

376
377/** Render the ranked files as a system-prompt context block (empty string if none). */
378export function formatRetrievalBlock(files: RankedFile[]): string {
379 if (files.length === 0) return '';
380 const lines: string[] = [];
381 lines.push('# Likely-relevant files (auto-retrieved by semantic similarity + import-graph)');
382 lines.push('Ranked by meaning, then widened along import edges so dependencies (state/db/types) of the top matches are included. Files marked "import-neighbor" are related via imports, not direct matches. Read the top ones with read_file before searching blindly.');
383 lines.push('');
384 for (const f of files) {
385 const tag = f.bestLines === 'import-neighbor' ? 'import-neighbor' : `lines ${f.bestLines}, similarity ${f.score.toFixed(3)}`;
386 lines.push(`- ${f.file} (${tag})`);
387 }
388 return lines.join('\n');
389}
390
391async function ollamaReachable(baseUrl: string, signal?: AbortSignal): Promise<boolean> {
392 try {

Callers 3

retrieval.test.tsFile · 0.85
hybridSearchToolFunction · 0.85
buildInitialMessagesMethod · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected