feat: add progress bar to init/reinit with per-file tracking

- processFiles() now accepts onProgress callback (completed, total, currentFile)
- InitOptions.onProgress receives structured ProgressInfo object
- initProject aggregates progress across all directories
- CLI renders ASCII progress bar: [████░░░░░░] 3/20 | filename.ts
- Pi extension sends structured updates with percentage + file details
- All 52 tests passing
This commit is contained in:
2026-06-10 18:43:42 +02:00
parent 78c60f9ca1
commit 9bdb862cca
5 changed files with 655 additions and 568 deletions
+14 -2
View File
@@ -82,7 +82,13 @@ export default function (pi: ExtensionAPI) {
verbose: false,
llmClient: client,
cacheDir: ctx.cwd,
onProgress: (msg) => _onUpdate?.({ content: [{ type: "text", text: msg }] }),
onProgress: (info) => {
const pct = info.total > 0 ? Math.round((info.completed / info.total) * 100) : 0;
_onUpdate?.({
content: [{ type: "text", text: `${info.message} (${pct}%)` }],
details: { progress: pct, file: info.currentFile, dir: info.dir },
});
},
});
return {
content: [
@@ -208,7 +214,13 @@ export default function (pi: ExtensionAPI) {
verbose: false,
llmClient: client,
cacheDir: ctx.cwd,
onProgress: (msg) => _onUpdate?.({ content: [{ type: "text", text: msg }] }),
onProgress: (info) => {
const pct = info.total > 0 ? Math.round((info.completed / info.total) * 100) : 0;
_onUpdate?.({
content: [{ type: "text", text: `${info.message} (${pct}%)` }],
details: { progress: pct, file: info.currentFile, dir: info.dir },
});
},
});
return {
content: [