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

Function createVerboseProgress

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

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