feat: add live progress streaming to init/reinit tools

- InitOptions.onProgress callback for directory-level progress
- generateDirectoryMap reports per-file progress (→ filename)
- initProject reports [N/M] Analyzing <path> (X files)...
- pi-extension wires _onUpdate to onProgress for live Pi UI updates
- User sees real-time feedback instead of silent long waits
This commit is contained in:
2026-06-10 16:32:08 +02:00
parent bd5ba74aa2
commit d948d88d0a
2 changed files with 21 additions and 4 deletions
+12 -2
View File
@@ -78,7 +78,12 @@ export default function (pi: ExtensionAPI) {
try {
const targetPath = params.path || ctx.cwd;
const client = getPiLLMClient(ctx);
await initProject(targetPath, { verbose: false, llmClient: client, cacheDir: ctx.cwd });
await initProject(targetPath, {
verbose: false,
llmClient: client,
cacheDir: ctx.cwd,
onProgress: (msg) => _onUpdate?.({ content: [{ type: "text", text: msg }] }),
});
return {
content: [
{
@@ -199,7 +204,12 @@ export default function (pi: ExtensionAPI) {
try {
const targetPath = params.path || ctx.cwd;
const client = getPiLLMClient(ctx);
await reinitPath(targetPath, { verbose: false, llmClient: client, cacheDir: ctx.cwd });
await reinitPath(targetPath, {
verbose: false,
llmClient: client,
cacheDir: ctx.cwd,
onProgress: (msg) => _onUpdate?.({ content: [{ type: "text", text: msg }] }),
});
return {
content: [
{