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:
+14
-2
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user