promptgraph-mcp 2.8.8 → 2.8.9
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/bundle-counts.js +9 -0
- package/github-import.js +8 -8
- package/package.json +1 -1
package/bundle-counts.js
CHANGED
|
@@ -75,6 +75,15 @@ async function countSubdirMdFiles(ownerRepo) {
|
|
|
75
75
|
}).length;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
// Write a known real count (e.g. after install) — skips API, sets TTL to 24h
|
|
79
|
+
export function setCachedCount(repoUrl, count) {
|
|
80
|
+
try {
|
|
81
|
+
const cache = loadCache();
|
|
82
|
+
cache[repoUrl] = { count, ts: Date.now() };
|
|
83
|
+
saveCache(cache);
|
|
84
|
+
} catch {}
|
|
85
|
+
}
|
|
86
|
+
|
|
78
87
|
// Read cached count for a bundle (returns null if stale or missing)
|
|
79
88
|
export function getCachedCount(repoUrl) {
|
|
80
89
|
const cache = loadCache();
|
package/github-import.js
CHANGED
|
@@ -735,20 +735,20 @@ export async function importFromGitHubLight(repoUrl) {
|
|
|
735
735
|
process.stderr.write('\n');
|
|
736
736
|
|
|
737
737
|
const realCount = globSync(`${destBase}/**/*.md`).length;
|
|
738
|
-
const cacheKey = url.replace(/\.git$/, '');
|
|
739
|
-
const cachePath = path.join(PROMPTGRAPH_DIR, 'skill-counts.json');
|
|
740
|
-
try {
|
|
741
|
-
fs.mkdirSync(path.dirname(cachePath), { recursive: true });
|
|
742
|
-
const cache = JSON.parse(fs.readFileSync(cachePath, 'utf8') || '{}');
|
|
743
|
-
cache[cacheKey] = { count: realCount, ts: Date.now() };
|
|
744
|
-
fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2));
|
|
745
|
-
} catch {}
|
|
746
738
|
|
|
747
739
|
if (realCount < 1) {
|
|
748
740
|
fs.rmSync(destBase, { recursive: true, force: true });
|
|
749
741
|
throw new Error('No valid skills in repo — all files were filtered out');
|
|
750
742
|
}
|
|
751
743
|
|
|
744
|
+
// Update both caches with the real post-filter count
|
|
745
|
+
try {
|
|
746
|
+
const { setCachedCount } = await import('./bundle-counts.js');
|
|
747
|
+
const cacheKey = url.replace(/\.git$/, '').replace(/^https?:\/\/github\.com\//, '');
|
|
748
|
+
setCachedCount(cacheKey, realCount);
|
|
749
|
+
setCachedCount(url.replace(/\.git$/, ''), realCount);
|
|
750
|
+
} catch {}
|
|
751
|
+
|
|
752
752
|
const { dir: localDir, label: localLabel } = detectSkillsDirLocal(destBase);
|
|
753
753
|
const skillsDir = subdir ? path.join(destBase, subdir) : localDir;
|
|
754
754
|
const label = subdir || localLabel;
|