feat: move LLM cache to project-local directory

- Cache now lives in <project>/.pi-project-map/cache/llm-cache.json
- Removed global ~/.cache/pi-project-map/ usage
- Cache travels with the project, no cross-project collisions
- Easy to invalidate: rm -rf .pi-project-map/cache/

Files changed:
- llm-cache.ts: accept cacheDir parameter, default to project-local
- llm-extract.ts: pass cacheDir through to cache functions
- init.ts: pass rootPath as cacheDir
- patch.ts: accept and pass cacheDir
- cli.ts: pass targetPath as cacheDir
- pi-extension.ts: pass ctx.cwd as cacheDir
- Tests updated to use temp dirs for cache isolation
This commit is contained in:
2026-06-10 15:13:10 +02:00
parent 5c6719817f
commit ed9f843d65
10 changed files with 88 additions and 49 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ describe("llm-extract with mock client", () => {
},
};
const result = await extractFileLLM(file, mockClient);
const result = await extractFileLLM(file, mockClient, tmpdir());
expect(result.purpose).toBe("Test file");
expect(result.deps).toEqual([]);
expect(result.concepts).toContain("testing");