MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / main

Function main

graph-ui/tools/eval-llm.mjs:222–757  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

220const round = (value) => Math.round(value * 1000) / 1000;
221
222async function main() {
223 const args = parseArgs(process.argv.slice(2));
224 const startedAt = Date.now();
225 let serverChild = null;
226 let home = null;
227 let runtimeDir = null;
228 let serverPort = 0;
229 let failure = null;
230 const serverLog = [];
231 const models = [];
232 const extras = { compile: {}, iterations: ITERATIONS, leftovers: [] };
233
234 try {
235 if (!existsSync(BINARY)) {
236 throw new Error(`Binary fehlt: ${BINARY} (erst 'make -f Makefile.cbm cbm-with-ui' im cbm-Clone bauen)`);
237 }
238 if (!existsSync(FIXTURE)) {
239 throw new Error(`Fixture fehlt: ${FIXTURE}`);
240 }
241
242 const questions = JSON.parse(await readFile(QUESTIONS, 'utf8'));
243 const selected = args.only.length === 0
244 ? questions
245 : questions.filter((entry) => entry.id.startsWith(args.only));
246 log(`${selected.length} von ${questions.length} Fragen`);
247
248 // ------------------------------------------------- HOME und Index --
249 home = await mkdtemp(join(tmpdir(), 'codeatlasweb-w5b-eval-home-'));
250 runtimeDir = await mkdtemp('/private/tmp/codeatlasweb-w5b-eval-run-');
251 process.env.CBM_RUNTIME_DIR = runtimeDir;
252 const indexed = await indexRepository(BINARY, { home, repoPath: FIXTURE, project: PROJECT });
253 extras.indexed = { nodes: indexed.nodes, edges: indexed.edges };
254 log(`indiziert: ${PROJECT} (${indexed.nodes} Knoten, ${indexed.edges} Kanten)`);
255
256 serverPort = await findFreePort(SERVER_PORT_FLOOR);
257 const started = await startServer(BINARY, { home, port: serverPort, log: serverLog });
258 serverChild = started.child;
259 log(`C-Server auf ${serverPort}`);
260
261 // ------------------------------------------- der Context-Compiler --
262 const { module: compiler, inputs } = await loadCompiler();
263 extras.compilerModules = inputs;
264 const provider = compiler.makeProvider(`http://127.0.0.1:${serverPort}`, 1);
265 const root = compiler.ATLAS_WORKSPACE_ROOT;
266 const opts = { projectName: PROJECT, generation: 1 };
267
268 // Der Fokus jeder Frage, einmal aufgeloest. `focusQn` ist
269 // projektrelativ notiert, damit die Datei nicht den Projektnamen dieses
270 // Laufs traegt; das Praefix kommt hier davor.
271 const focusOf = new Map();
272 for (const entry of selected) {
273 const resolved = await compiler.resolveSubject(
274 provider, root, `${PROJECT}.${entry.focusQn}`, opts,
275 );
276 if (resolved === undefined) {
277 throw new Error(`focusQn nicht aufloesbar: ${entry.focusQn} (${entry.id})`);
278 }
279 focusOf.set(entry.id, resolved.symbol);

Callers 1

eval-llm.mjsFile · 0.70

Calls 15

indexRepositoryFunction · 0.90
findFreePortFunction · 0.90
startServerFunction · 0.90
loadCompilerFunction · 0.90
startLlamaFunction · 0.90
llamaPropsFunction · 0.90
stopLlamaFunction · 0.90
sleepFunction · 0.90
stopServerFunction · 0.90
countListenersFunction · 0.90
boundViolationsFunction · 0.90
winnerOfFunction · 0.85

Tested by

no test coverage detected