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:
Colby McHenry
2026-04-04 10:28:07 -05:00
parent e4908e1270
commit 3a44d5c4d1
5 changed files with 64 additions and 10 deletions
+2 -2
View File
@@ -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)`);