promptgraph-mcp 2.8.3 → 2.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/github-import.js +10 -2
- package/package.json +1 -1
package/github-import.js
CHANGED
|
@@ -643,15 +643,23 @@ function detectSubdirFromTree(repoRoot) {
|
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
+
// No known skill dir found — check if repo root has .md files itself
|
|
647
|
+
const rootMdCount = entries.filter(e => e.endsWith('.md')).length;
|
|
648
|
+
if (rootMdCount >= 2) return null; // root has skills — take everything
|
|
649
|
+
|
|
650
|
+
// Otherwise check subdirs: if most non-skip subdirs have .md files, take root (all dirs)
|
|
646
651
|
const skipSet = new Set([...SKIP_DIRS_API]);
|
|
647
652
|
const candidates = entries.filter(e => !skipSet.has(e.toLowerCase()) && !e.includes('.'));
|
|
653
|
+
let dirsWithMd = 0;
|
|
648
654
|
let best = null, bestCount = 0;
|
|
649
655
|
for (const dir of candidates) {
|
|
650
|
-
const sub = spawnSync('git', ['-C', repoRoot, 'ls-tree', '--name-only', `HEAD:${dir}`], { encoding: 'utf8', stdio: 'pipe' });
|
|
656
|
+
const sub = spawnSync('git', ['-C', repoRoot, 'ls-tree', '-r', '--name-only', `HEAD:${dir}`], { encoding: 'utf8', stdio: 'pipe' });
|
|
651
657
|
if (sub.status !== 0) continue;
|
|
652
658
|
const mdCount = sub.stdout.split('\n').filter(f => f.endsWith('.md')).length;
|
|
653
|
-
if (mdCount >= 1
|
|
659
|
+
if (mdCount >= 1) { dirsWithMd++; if (mdCount > bestCount) { best = dir; bestCount = mdCount; } }
|
|
654
660
|
}
|
|
661
|
+
// If multiple dirs have .md files — they're all skill categories, take root
|
|
662
|
+
if (dirsWithMd > 1) return null;
|
|
655
663
|
return best;
|
|
656
664
|
}
|
|
657
665
|
|