promptgraph-mcp 2.2.6 → 2.2.7

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.
Files changed (2) hide show
  1. package/index.js +21 -18
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -208,35 +208,38 @@ if (args[0] === 'marketplace') {
208
208
 
209
209
  if (skills?.error) { error(skills.error); process.exit(1); }
210
210
 
211
- // Build installed set: bundle IDs from config sources + skill IDs from DB
211
+ // Build installed set source of truth is the FILESYSTEM, not DB/config
212
212
  const installedSet = new Set();
213
213
  try {
214
214
  const cfg = _lcMkt();
215
215
  const db = _getDbMkt();
216
-
217
- // Collect installed skill IDs from DB
218
- const dbSkillIds = new Set(db.prepare('SELECT id FROM skills').all().map(r => r.id));
219
-
220
- // Build set of cloned repo names from config sources (exact: github:owner-repo)
221
- const githubSources = new Set(
222
- cfg.sources.filter(s => s.source.startsWith('github:')).map(s => s.source.replace('github:', '').toLowerCase())
223
- );
216
+ const { SKILLS_STORE_DIR } = await import('./config.js');
217
+ const githubDir = path.join(SKILLS_STORE_DIR, 'github');
224
218
 
225
219
  for (const b of (Array.isArray(bundles) ? bundles : [])) {
226
220
  if (b.repo_url) {
227
- // repo_url = "owner/repo" → cloned as "owner-repo" in github: source
228
- const clonedName = b.repo_url.replace('/', '-').toLowerCase();
229
- if (githubSources.has(clonedName)) installedSet.add(b.id);
221
+ // Check actual cloned directory exists and has files
222
+ const owner = b.repo_url.split('/')[0];
223
+ const repo = b.repo_url.split('/')[1];
224
+ const clonedName = `${owner}-${repo}`;
225
+ const clonedDir = path.join(githubDir, clonedName);
226
+ const dirExists = fs.existsSync(clonedDir) &&
227
+ fs.readdirSync(clonedDir).length > 0; // not empty
228
+ if (dirExists) installedSet.add(b.id);
230
229
  } else if (Array.isArray(b.skills)) {
231
- // skill-list bundle: installed if ALL skills are in DB
232
- if (b.skills.length > 0 && b.skills.every(sid => dbSkillIds.has(sid))) {
233
- installedSet.add(b.id);
234
- }
230
+ // skill-list bundle: check files exist on disk via DB path column
231
+ const allOnDisk = b.skills.every(sid => {
232
+ const row = db.prepare('SELECT path FROM skills WHERE id = ?').get(sid);
233
+ return row && fs.existsSync(row.path);
234
+ });
235
+ if (b.skills.length > 0 && allOnDisk) installedSet.add(b.id);
235
236
  }
236
237
  }
237
238
 
238
- // Individual skills
239
- for (const id of dbSkillIds) installedSet.add(id);
239
+ // Individual marketplace skills — check file exists on disk
240
+ for (const row of db.prepare('SELECT id, path FROM skills WHERE source = ?').all('marketplace')) {
241
+ if (fs.existsSync(row.path)) installedSet.add(row.id);
242
+ }
240
243
  } catch {}
241
244
 
242
245
  const { runTUI } = await import('./tui.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {