Implement all stubs: parsePackageMap, LLM heuristics, tree-sitter AST, patch rewrite, reinit

- 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
This commit is contained in:
2026-06-09 18:04:57 +02:00
parent fd958671ca
commit d311c8fb3c
14 changed files with 1032 additions and 305 deletions
+23 -15
View File
@@ -1,23 +1,31 @@
export interface SkillConfig {
ignorePatterns: string[];
smallPackageThreshold: number;
llmModel: string;
contextBudget: number;
autoInjectPrompt: boolean;
ignorePatterns: string[];
smallPackageThreshold: number;
llmModel: string;
contextBudget: number;
autoInjectPrompt: boolean;
}
export const DEFAULT_CONFIG: SkillConfig = {
ignorePatterns: [
'node_modules', '.git', 'dist', 'build', 'coverage',
'.next', '.venv', '__pycache__', '.DS_Store', '*.log'
],
smallPackageThreshold: 10,
llmModel: 'gpt-4o-mini',
contextBudget: 4000,
autoInjectPrompt: true
ignorePatterns: [
"node_modules",
".git",
"dist",
"build",
"coverage",
".next",
".venv",
"__pycache__",
".DS_Store",
"*.log",
],
smallPackageThreshold: 10,
llmModel: "gpt-4o-mini",
contextBudget: 4000,
autoInjectPrompt: true,
};
export function loadConfig(): SkillConfig {
// TODO: load from .pi-project-map.json or similar
return DEFAULT_CONFIG;
// TODO: load from .pi-project-map.json or similar
return DEFAULT_CONFIG;
}