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
+27 -12
View File
@@ -13,12 +13,24 @@ function printUsage() {
console.log(`${pc.bold("project-map")} — hierarchical project analysis for Pi agents
`);
console.log(`${pc.bold("Usage:")}`);
console.log(` project-map ${pc.cyan("init")} [path] Generate .pi-map.md files for all directories`);
console.log(` project-map ${pc.cyan("patch")} <file> Update analysis for a changed file's directory`);
console.log(` project-map ${pc.cyan("validate")} [--fix] [path] Check for stale/missing/orphaned entries`);
console.log(` project-map ${pc.cyan("reinit")} [path] Force full regeneration`);
console.log(` project-map ${pc.cyan("--help")} Show this help message`);
console.log(` project-map ${pc.cyan("--version")} Show version\n`);
console.log(
` project-map ${pc.cyan("init")} [path] Generate .pi-map.md files for all directories`,
);
console.log(
` project-map ${pc.cyan("patch")} <file> Update analysis for a changed file's directory`,
);
console.log(
` project-map ${pc.cyan("validate")} [--fix] [path] Check for stale/missing/orphaned entries`,
);
console.log(
` project-map ${pc.cyan("reinit")} [path] Force full regeneration`,
);
console.log(
` project-map ${pc.cyan("--help")} Show this help message`,
);
console.log(
` project-map ${pc.cyan("--version")} Show version\n`,
);
console.log(`${pc.bold("Examples:")}`);
console.log(` project-map init`);
console.log(` project-map patch src/components/Button.tsx`);
@@ -32,10 +44,9 @@ function printVersion() {
}
function formatCount(count: number, label: string): string {
const plural =
label.endsWith("y")
? `${label.slice(0, -1)}ies`
: `${label}${count === 1 ? "" : "s"}`;
const plural = label.endsWith("y")
? `${label.slice(0, -1)}ies`
: `${label}${count === 1 ? "" : "s"}`;
return `${pc.bold(String(count))} ${count === 1 ? label : plural}`;
}
@@ -78,7 +89,9 @@ async function main() {
}
case "patch": {
if (!args[1]) {
console.error(`${pc.red("Error:")} Missing file path. Usage: project-map patch <file>`);
console.error(
`${pc.red("Error:")} Missing file path. Usage: project-map patch <file>`,
);
process.exit(1);
}
await patchFile(args[1]);
@@ -113,7 +126,9 @@ async function main() {
const targetPath = args[1] || ".";
const start = Date.now();
const entries = discoverProject(targetPath);
console.log(`Regenerating ${formatCount(entries.length, ".pi-map.md file")}...`);
console.log(
`Regenerating ${formatCount(entries.length, ".pi-map.md file")}...`,
);
await reinitPath(targetPath, { verbose: false });
const elapsed = ((Date.now() - start) / 1000).toFixed(1);
console.log(`${pc.green("✓")} Regenerated in ${elapsed}s`);