Remove the map files from .gitignore so they are committed as project
navigation artifacts, and also unignore them in the sample fixture.
Regenerate all maps so the committed versions reflect the current source.
- project_map_reinit now regenerates only the target subtree + ancestors
by default, falling back to full reinit when subtree file count exceeds
reinitFullThresholdPercent (default 10%).
- Add reinitFullThresholdPercent config option.
- Expose fix=true on project_map_validate Pi tool for localized repair.
- Update docs and runtime guidance to prefer patch / validate --fix
before full reinit.
- Add integration tests for smart reinit and update typebox mock.
The before_agent_start handler now scans the active session context via
ctx.sessionManager.buildSessionContext() for an existing pi-project-map-hint
custom message and skips injection when one is already present in the
current branch. This prevents duplicate visible hints in advisory/pre-init
modes and duplicate hidden hints in strong/strict modes. The hint is
automatically re-injected after compaction or /tree navigation removes it
from the active path.
Also removes the unused hooks/on-prompt.ts prompt-text injector.
The before_agent_start handler now inspects the current session context
and skips injection if a pi-project-map-hint custom message is already
present in the active branch. This prevents duplicate hints on every
prompt while still re-injecting after compaction or tree navigation.
Also removes the unused hooks/on-prompt.ts prompt-text injector.
- Add renderProgressBar() helper in pi-extension.ts
- Pi init/reinit now show [████░░░░░░] 3/20 → filename.ts
- Replaces plain text percentage with visual bar
- All 52 tests passing
- Cache now lives at <project>/.cache/llm-cache.json (single hidden dir)
- Remove extra pi-project-map subdirectory level
- Use dirname() instead of string slicing for robustness
- Change cache location from .pi-project-map/cache/ to .cache/pi-project-map/
- Cache is now hidden by default (dot directory)
- Add .cache/ to .gitignore
- Remove committed .pi-project-map/cache/ from repo
- 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
- Use processFiles from llm-batch.ts in generateDirectoryMap
- Process files with 4 concurrent LLM calls + 100ms batch delays
- Reduces init time from O(n) sequential to O(n/4) parallel
- Prevents Pi tool timeout on projects with many files
- Call ctx.modelRegistry.getApiKeyAndHeaders(model) to resolve auth
- Pass resolved apiKey and headers to complete() options
- Provides clear error message if auth fails ( directs user to /login )
- Update test mock to include ok: true on auth response
- No external fetch() — Pi handles all transport and auth
- tree-sitter-go@0.23.4 peer depends on tree-sitter@^0.21.1
- Conflicts with tree-sitter@0.22.4 used by tree-sitter-python
- Go AST already falls back to generic export/deps extraction
- Add .npmrc with legacy-peer-deps=true as safety net
- npm install --omit=dev now works cleanly
- Upgrade tree-sitter to 0.22.4 with compatible grammar versions
- Add Python support via tree-sitter-python@0.23.6
- Add Go support via tree-sitter-go@0.23.4
- Extract class hierarchies with method signatures (params, returns)
- Extract call graphs including external library calls
- Extract exception raises (ValueError, Error, etc)
- Extract top-level functions with full signatures
- Encode rich AST data into compact markdown format:
class:Name, method:name(params)→return, call:..., raise:...
- Deduplicate nested call chains (db.query vs db.query().where())
- Filter out simple export names when rich func/class entries exist
- All 55 tests passing
- 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
- PiLLMClient now imports @mariozechner/pi-ai's complete() function
- Respects user's /model selection and /login auth
- No external fetch() — Pi handles transport internally
- Added src/types/pi-ai.d.ts for TypeScript declarations
- Extension reverted to real LLM calls (initProject, patchFile, reinitPath)
- Tests mock @mariozechner/pi-ai for verification
Inside Pi, the extension no longer attempts to call the LLM directly
(which Pi's ExtensionAPI doesn't support). Instead:
- project_map_init: generates maps using AST + heuristics (fast, free)
- project_map_patch: rewrites the file's directory with heuristics
- project_map_reinit: full heuristic regeneration
- project_map_validate: unchanged (no LLM needed)
The CLI still supports real LLM calls via --llm-provider=kimi|openai.
This separates concerns:
- Pi extension: deterministic structural analysis
- CLI: rich semantic analysis with configurable LLM
These grammars require tree-sitter@^0.25.0 but we use 0.21.1.
They already failed at runtime with try/catch graceful fallback.
Removing them fixes npm peer dependency conflict during pi install.
- Remove tree-sitter-go and tree-sitter-python from dependencies
- ast-extract.ts already handles missing grammars gracefully
- Heuristics + LLM layer cover Go/Python analysis anyway
- 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.
- format.ts: Full parsePackageMap implementation with round-trip support
- llm-extract.ts: Heuristic-based extraction without LLM API (regex exports,
imports, purpose inference from filename patterns)
- ast-extract.ts: Tree-sitter integration for TypeScript/TSX with fallback
for other languages
- init.ts: Refactored to expose generateDirectoryMap helper, reinitPath
delegates to initProject
- patch.ts: Small packages now use generateDirectoryMap for full rewrite
- discover.ts: Cleaned up require('fs') to use proper ES import
- Tests: 8 tests covering format round-trip and LLM heuristics
- All TypeScript compiles clean, all tests pass
- Design doc with full spec (dense markdown format, hybrid AST+LLM pipeline,
consumption model, stale data mitigation)
- Implementation plan with 6 milestones and rollout strategy
- TypeScript package structure with all source stubs
- CLI entry point, formatter, discover, init, patch, validate, extract, merge
- Pi SKILL.md with tool definitions and format documentation