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

Function createVerboseProgress

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

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