fix: Improve CLI progress display and prevent tree-sitter WASM memory crashes
Replaces fixed-width padding with terminal escape sequences for proper progress line clearing across different terminal widths. Adds periodic parser reset every 5000 parses per language to prevent WASM heap fragmentation that causes "memory access out of bounds" crashes in large repositories. Includes filename truncation to fit available terminal width.
This commit is contained in:
@@ -160,12 +160,12 @@ async function initializeLocalProject(): Promise<void> {
|
||||
};
|
||||
const phaseName = phaseNames[progress.phase] || progress.phase;
|
||||
const percent = progress.total > 0 ? Math.round((progress.current / progress.total) * 100) : 0;
|
||||
process.stdout.write(`\r ${chalk.dim(phaseName)}... ${percent}% `);
|
||||
process.stdout.write(`\r ${chalk.dim(phaseName)}... ${percent}%\x1b[K`);
|
||||
},
|
||||
});
|
||||
|
||||
// Clear progress line
|
||||
process.stdout.write('\r' + ' '.repeat(50) + '\r');
|
||||
process.stdout.write('\r\x1b[K');
|
||||
|
||||
if (result.filesErrored > 0) {
|
||||
success(`Indexed ${formatNumber(result.filesIndexed)} files (${formatNumber(result.filesErrored)} files failed, ${formatNumber(result.nodesCreated)} symbols)`);
|
||||
|
||||
Reference in New Issue
Block a user