Pi skill integration, CLI polish, --fix flag, config file support

- SKILL.md: Proper Agent Skills frontmatter with name/description
- pi-extension.ts: Pi extension registering 4 custom tools
  (project_map_init/patch/validate/reinit) with prompt snippets/guidelines
- pi-extension.ts: Auto-detects .pi-map.md files on session start, warns
  about dirty markers, injects maintenance hints before agent start
- package.json: Added pi.extensions and pi.skills entries
- CLI: Added picocolors, clean help screen, progress indicators,
  summary output with timing, colored check/warning icons
- validate.ts: Added --fix flag that regenerates directories with
  discrepancies
- config.ts: Reads .pi-project-map.json from project root with merge
  over defaults
- init.ts: Added optional verbose parameter for programmatic use

All 16 tests pass. TypeScript compiles clean. Build succeeds.
This commit is contained in:
2026-06-09 20:54:59 +02:00
parent ab45859d65
commit 93c2ac60c5
9 changed files with 492 additions and 38 deletions
+23 -2
View File
@@ -1,3 +1,6 @@
import { existsSync, readFileSync } from "fs";
import { join } from "path";
export interface SkillConfig {
ignorePatterns: string[];
smallPackageThreshold: number;
@@ -18,6 +21,15 @@ export const DEFAULT_CONFIG: SkillConfig = {
"__pycache__",
".DS_Store",
"*.log",
".pi-map.md",
".cache",
"tmp",
"temp",
".tmp",
".turbo",
".parcel-cache",
".eslintcache",
".prettiercache",
],
smallPackageThreshold: 10,
llmModel: "gpt-4o-mini",
@@ -25,7 +37,16 @@ export const DEFAULT_CONFIG: SkillConfig = {
autoInjectPrompt: true,
};
export function loadConfig(): SkillConfig {
// TODO: load from .pi-project-map.json or similar
export function loadConfig(cwd: string = process.cwd()): SkillConfig {
const configPath = join(cwd, ".pi-project-map.json");
if (existsSync(configPath)) {
try {
const content = readFileSync(configPath, "utf8");
const userConfig = JSON.parse(content);
return { ...DEFAULT_CONFIG, ...userConfig };
} catch {
// Fall through to default
}
}
return DEFAULT_CONFIG;
}