MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / createVerboseProgress

Function createVerboseProgress

src/bin/codegraph.ts:326–354  ·  view source on GitHub ↗

* Create a plain-text progress callback for --verbose mode. * No animations, no ANSI tricks — just timestamped lines to stdout.

()

Source from the content-addressed store, hash-verified

324 * No animations, no ANSI tricks — just timestamped lines to stdout.
325 */
326function createVerboseProgress(): (progress: { phase: string; current: number; total: number; currentFile?: string }) => void {
327 let lastPhase = '';
328 let lastPct = -1;
329 const startTime = Date.now();
330
331 return (progress) => {
332 const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
333
334 if (progress.phase !== lastPhase) {
335 lastPhase = progress.phase;
336 lastPct = -1;
337 console.log(`[${elapsed}s] Phase: ${progress.phase}`);
338 }
339
340 if (progress.total > 0) {
341 const pct = Math.floor((progress.current / progress.total) * 100);
342 // Log every 5% to keep output manageable
343 if (pct >= lastPct + 5 || progress.current === progress.total) {
344 lastPct = pct;
345 console.log(`[${elapsed}s] ${progress.current}/${progress.total} (${pct}%)${progress.currentFile ? ` ${getGlyphs().dash} ${progress.currentFile}` : ''}`);
346 }
347 } else if (progress.current > 0) {
348 // Scanning phase (no total yet) — log periodically
349 if (progress.current % 1000 === 0 || progress.current === 1) {
350 console.log(`[${elapsed}s] ${formatNumber(progress.current)} files found`);
351 }
352 }
353 };
354}
355
356/**
357 * Print success message

Callers 2

runIndexFunction · 0.85
renderIndexFunction · 0.85

Calls 2

getGlyphsFunction · 0.90
formatNumberFunction · 0.70

Tested by

no test coverage detected