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

Function createVerboseProgress

src/bin/codegraph.ts:325–353  ·  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

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