promptgraph-mcp 2.8.9 → 2.9.1
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/commands/marketplace.js +16 -8
- package/package.json +1 -1
- package/tui.js +2 -1
package/commands/marketplace.js
CHANGED
|
@@ -39,9 +39,22 @@ export default async function handler(args, bin) {
|
|
|
39
39
|
|
|
40
40
|
if (skills?.error) { error(skills.error); process.exit(1); }
|
|
41
41
|
|
|
42
|
-
const { getCachedCount, refreshCountsInBackground } = await import('../bundle-counts.js');
|
|
42
|
+
const { getCachedCount, setCachedCount, refreshCountsInBackground } = await import('../bundle-counts.js');
|
|
43
|
+
const { SKILLS_STORE_DIR } = await import('../config.js');
|
|
44
|
+
const { globSync } = await import('glob');
|
|
45
|
+
const githubDir = path.join(SKILLS_STORE_DIR, 'github');
|
|
46
|
+
|
|
47
|
+
// For each bundle: if installed on disk — use real file count; otherwise use cache
|
|
43
48
|
const bundlesWithCounts = (Array.isArray(bundles) ? bundles : []).map(b => {
|
|
44
49
|
if (!b.repo_url) return b;
|
|
50
|
+
const owner = b.repo_url.split('/')[0];
|
|
51
|
+
const repo = b.repo_url.split('/')[1];
|
|
52
|
+
const clonedDir = path.join(githubDir, `${owner}-${repo}`);
|
|
53
|
+
if (fs.existsSync(clonedDir) && fs.readdirSync(clonedDir).length > 0) {
|
|
54
|
+
const realCount = globSync(`${clonedDir}/**/*.md`).length;
|
|
55
|
+
setCachedCount(b.repo_url, realCount);
|
|
56
|
+
return { ...b, skillCount: realCount };
|
|
57
|
+
}
|
|
45
58
|
const cached = getCachedCount(b.repo_url);
|
|
46
59
|
return cached !== null ? { ...b, skillCount: cached } : b;
|
|
47
60
|
});
|
|
@@ -51,18 +64,13 @@ export default async function handler(args, bin) {
|
|
|
51
64
|
try {
|
|
52
65
|
const cfg = _lcMkt();
|
|
53
66
|
const db = _getDbMkt();
|
|
54
|
-
const { SKILLS_STORE_DIR } = await import('../config.js');
|
|
55
|
-
const githubDir = path.join(SKILLS_STORE_DIR, 'github');
|
|
56
67
|
|
|
57
68
|
for (const b of (Array.isArray(bundles) ? bundles : [])) {
|
|
58
69
|
if (b.repo_url) {
|
|
59
70
|
const owner = b.repo_url.split('/')[0];
|
|
60
71
|
const repo = b.repo_url.split('/')[1];
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const dirExists = fs.existsSync(clonedDir) &&
|
|
64
|
-
fs.readdirSync(clonedDir).length > 0;
|
|
65
|
-
if (dirExists) installedSet.add(b.id);
|
|
72
|
+
const clonedDir = path.join(githubDir, `${owner}-${repo}`);
|
|
73
|
+
if (fs.existsSync(clonedDir) && fs.readdirSync(clonedDir).length > 0) installedSet.add(b.id);
|
|
66
74
|
} else if (Array.isArray(b.skills)) {
|
|
67
75
|
const allOnDisk = b.skills.every(sid => {
|
|
68
76
|
const row = db.prepare('SELECT path FROM skills WHERE id = ?').get(sid);
|
package/package.json
CHANGED
package/tui.js
CHANGED
|
@@ -154,9 +154,10 @@ function render(state, installedSet = new Set()) {
|
|
|
154
154
|
const nameStr = truncate(item.name, NAME_W);
|
|
155
155
|
const namePad = nameStr.padEnd(NAME_W);
|
|
156
156
|
const nameCol = selected ? white.bold(namePad) : white(namePad);
|
|
157
|
+
const installed = installedSet.has(item.id) || installedSet.has(item.code);
|
|
157
158
|
const extra = item.type === 'bundle'
|
|
158
159
|
? item.skillCount
|
|
159
|
-
? blue((item.skillCount + ' sk').padEnd(8))
|
|
160
|
+
? blue(((installed ? '' : '~') + item.skillCount + ' sk').padEnd(8))
|
|
160
161
|
: item.repo_url
|
|
161
162
|
? chalk.hex('#3B82F6')('↗ GitHub')
|
|
162
163
|
: dim(((item.skills?.length || 0) + ' sk').padEnd(8))
|