fix(gap-audit): check .js files and account for dynamically loaded prompts

The gap audit was falsely reporting prompts as orphaned because:
1. grepImports() only checked .ts files, but extension source is .js
2. Several prompts loaded dynamically (not via literal loadPrompt string)
   were not in the DYNAMICALLY_LOADED_PROMPTS set

Fixes:
- grepImports now checks both .ts and .js files
- Added heal-skill, product-audit, refine-slice, review-migration to
  DYNAMICALLY_LOADED_PROMPTS set

This eliminates the false-positive orphan-prompt self-feedback entries.
This commit is contained in:
Mikael Hugo 2026-05-07 01:52:41 +02:00
parent 693f6de0d1
commit e94a0d95e9

View file

@ -41,7 +41,7 @@ function grepImports(sourceDir, symbol) {
try {
const files = readdirSync(sourceDir, { recursive: true });
for (const file of files) {
if (!file.endsWith(".ts")) continue;
if (!file.endsWith(".ts") && !file.endsWith(".js")) continue;
const content = readFileSync(join(sourceDir, file), "utf-8");
if (content.includes(symbol)) return true;
}
@ -61,6 +61,10 @@ const DYNAMICALLY_LOADED_PROMPTS = new Set([
"execute-task",
"workflow-start",
"triage-self-feedback",
"heal-skill",
"product-audit",
"refine-slice",
"review-migration",
]);
function findOrphanPrompts() {
const findings = [];