@curdx/flow 5.0.0 → 5.0.2

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/dist/index.mjs +56 -0
  2. package/package.json +4 -2
package/dist/index.mjs CHANGED
@@ -369,6 +369,61 @@ async function shouldSkipRefresh(name) {
369
369
  return false;
370
370
  }
371
371
  }
372
+ async function fetchUpstreamMarketplaceJson(entry) {
373
+ if (entry.source === "github" && entry.repo) {
374
+ const url = `https://raw.githubusercontent.com/${entry.repo}/HEAD/.claude-plugin/marketplace.json`;
375
+ try {
376
+ const r = await fetch(url, { signal: AbortSignal.timeout(1e4) });
377
+ if (!r.ok) return null;
378
+ return await r.text();
379
+ } catch {
380
+ return null;
381
+ }
382
+ }
383
+ if (entry.source === "directory" && entry.path) {
384
+ try {
385
+ return await fs.readFile(
386
+ path.join(entry.path, ".claude-plugin", "marketplace.json"),
387
+ "utf8"
388
+ );
389
+ } catch {
390
+ return null;
391
+ }
392
+ }
393
+ return null;
394
+ }
395
+ function normalizeJsonForCompare(text2) {
396
+ try {
397
+ return JSON.stringify(JSON.parse(text2));
398
+ } catch {
399
+ return text2;
400
+ }
401
+ }
402
+ async function reconcileMarketplaceCache(name) {
403
+ const entries = await listMarketplaces();
404
+ const entry = entries.find((m) => m.name === name);
405
+ if (!entry) return false;
406
+ const upstream = await fetchUpstreamMarketplaceJson(entry);
407
+ if (!upstream) return false;
408
+ const localFile = path.join(marketplaceDir(name), ".claude-plugin", "marketplace.json");
409
+ let localContent = null;
410
+ try {
411
+ localContent = await fs.readFile(localFile, "utf8");
412
+ } catch {
413
+ localContent = null;
414
+ }
415
+ if (localContent !== null && normalizeJsonForCompare(localContent) === normalizeJsonForCompare(upstream)) {
416
+ return false;
417
+ }
418
+ try {
419
+ await fs.mkdir(path.dirname(localFile), { recursive: true });
420
+ await fs.writeFile(localFile, upstream, "utf8");
421
+ marketplaceJsonCache.delete(name);
422
+ return true;
423
+ } catch {
424
+ return false;
425
+ }
426
+ }
372
427
  async function refreshMarketplaces(names) {
373
428
  const unique = [...new Set(names)];
374
429
  const toRefresh = [];
@@ -380,6 +435,7 @@ async function refreshMarketplaces(names) {
380
435
  toRefresh.map((name) => run("claude", ["plugin", "marketplace", "update", name]))
381
436
  );
382
437
  for (const name of toRefresh) marketplaceJsonCache.delete(name);
438
+ await Promise.all(toRefresh.map((name) => reconcileMarketplaceCache(name)));
383
439
  return toRefresh;
384
440
  }
385
441
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curdx/flow",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "Interactive installer for Claude Code plugins and MCP servers",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.mjs",
@@ -15,7 +15,9 @@
15
15
  "build": "tsup",
16
16
  "dev": "tsup --watch",
17
17
  "start": "node ./dist/index.mjs",
18
- "typecheck": "tsc --noEmit"
18
+ "typecheck": "tsc --noEmit",
19
+ "check-versions": "node scripts/check-versions.mjs",
20
+ "prepublishOnly": "node scripts/check-versions.mjs && npm run typecheck && npm run build"
19
21
  },
20
22
  "keywords": [
21
23
  "claude",