Update design doc and implementation plan for proper LLM integration

- design-doc.md: Rewrote Section 3 (Pipeline Architecture) to describe the
  real LLM integration: dual-provider LLM client (Pi native + external),
  SHA-256 disk cache in ~/.cache/pi-project-map/, parallelization with
  4-8 concurrent requests, retries with exponential backoff, hard-error
  policy, context limit protection. Added new Section 4 with concrete
  file-level and package-level prompts.
- implementation-plan.md: Replaced old milestone schedule with current
  status and detailed M7 tasks for LLM integration: LLM client abstraction,
  external API client, Pi LLM client, disk cache, parallel batching with
  retries, rewriting llm-extract.ts, context limits, CLI/extension wiring,
  and tests.
- Minor formatting cleanup in pi-extension.ts and src/cli.ts

All 16 tests pass. TypeScript compiles clean.
This commit is contained in:
2026-06-09 21:45:44 +02:00
parent 93c2ac60c5
commit 7b67205d43
4 changed files with 326 additions and 210 deletions
+16 -4
View File
@@ -59,7 +59,11 @@ export default function (pi: ExtensionAPI) {
}),
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
const targetPath = params.path || ctx.cwd;
const result = runCommand("init", targetPath === ctx.cwd ? [] : [targetPath], ctx.cwd);
const result = runCommand(
"init",
targetPath === ctx.cwd ? [] : [targetPath],
ctx.cwd,
);
return {
content: [{ type: "text", text: result.stdout || result.stderr }],
details: { success: result.success, cwd: ctx.cwd },
@@ -70,7 +74,8 @@ export default function (pi: ExtensionAPI) {
pi.registerTool({
name: "project_map_patch",
label: "Project Map Patch",
description: "Update .pi-map.md for the directory containing a changed file",
description:
"Update .pi-map.md for the directory containing a changed file",
promptSnippet: "Update project analysis after editing a source file",
promptGuidelines: [
"Use project_map_patch immediately after editing any source file",
@@ -108,10 +113,17 @@ export default function (pi: ExtensionAPI) {
}),
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
const targetPath = params.path || ctx.cwd;
const result = runCommand("validate", targetPath === ctx.cwd ? [] : [targetPath], ctx.cwd);
const result = runCommand(
"validate",
targetPath === ctx.cwd ? [] : [targetPath],
ctx.cwd,
);
return {
content: [{ type: "text", text: result.stdout || result.stderr }],
details: { success: result.success, clean: result.stdout.includes("clean") },
details: {
success: result.success,
clean: result.stdout.includes("clean"),
},
};
},
});