@kwonye/mcpx 0.1.98 → 0.1.100

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 (35) hide show
  1. package/dist/{cli-remv48t3.js → cli-1ewrsfj4.js} +1 -1
  2. package/dist/{cli-zjepj3sj.js → cli-28g7x9rn.js} +10 -1
  3. package/dist/{cli-vy81xjm0.js → cli-b0xrqsjc.js} +1612 -488
  4. package/dist/cli-ct7asw78.js +598 -0
  5. package/dist/{cli-g4w6k655.js → cli-dy7x0zrg.js} +70 -5
  6. package/dist/{cli-gf70a85c.js → cli-etmrz2c4.js} +120 -28
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +137 -25
  9. package/dist/{config-2s2aqkqp.js → config-yx5m60fv.js} +2 -2
  10. package/dist/core/config.d.ts.map +1 -1
  11. package/dist/core/daemon.d.ts +1 -0
  12. package/dist/core/daemon.d.ts.map +1 -1
  13. package/dist/core/index.d.ts +3 -1
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.js +45 -21
  16. package/dist/core/marketplace-defaults.d.ts +4 -0
  17. package/dist/core/marketplace-defaults.d.ts.map +1 -0
  18. package/dist/core/marketplace-updater.d.ts +10 -0
  19. package/dist/core/marketplace-updater.d.ts.map +1 -0
  20. package/dist/core/marketplace.d.ts +67 -0
  21. package/dist/core/marketplace.d.ts.map +1 -0
  22. package/dist/core/paths.d.ts +3 -0
  23. package/dist/core/paths.d.ts.map +1 -1
  24. package/dist/core/plugin-cache.d.ts.map +1 -1
  25. package/dist/core/plugin-manager.d.ts +20 -7
  26. package/dist/core/plugin-manager.d.ts.map +1 -1
  27. package/dist/core/plugin-parse.d.ts.map +1 -1
  28. package/dist/marketplace-pwabb3ea.js +33 -0
  29. package/dist/{plugin-host-wr17xed6.js → plugin-host-9xcpnehq.js} +4 -5
  30. package/dist/{plugin-manager-7c9nk34n.js → plugin-manager-19q55n69.js} +4 -5
  31. package/dist/{registry-bnjb2345.js → registry-yvbxcaq6.js} +2 -2
  32. package/dist/types.d.ts +69 -0
  33. package/dist/types.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/cli-er8me5qr.js +0 -1052
@@ -3,7 +3,7 @@ import {
3
3
  getConfigPath,
4
4
  readJsonFile,
5
5
  writeJsonAtomic
6
- } from "./cli-zjepj3sj.js";
6
+ } from "./cli-28g7x9rn.js";
7
7
  import {
8
8
  normalizeServerSpecEnabled
9
9
  } from "./cli-s4gspqdf.js";
@@ -379,6 +379,43 @@ function repairConfig(config) {
379
379
  };
380
380
  }
381
381
 
382
+ // src/core/marketplace-defaults.ts
383
+ var BUILTIN_ADDED_AT = "1970-01-01T00:00:00.000Z";
384
+ var DEFAULT_MARKETPLACES = {
385
+ "claude-plugins-official": {
386
+ name: "claude-plugins-official",
387
+ displayName: "Claude official",
388
+ source: "anthropics/claude-plugins-official",
389
+ sourceType: "github",
390
+ manifestPath: ".claude-plugin/marketplace.json",
391
+ format: "claude",
392
+ builtIn: true,
393
+ autoUpdate: true,
394
+ addedAt: BUILTIN_ADDED_AT,
395
+ status: "unavailable"
396
+ },
397
+ "openai-curated": {
398
+ name: "openai-curated",
399
+ displayName: "Codex official",
400
+ source: "openai/plugins",
401
+ sourceType: "github",
402
+ manifestPath: ".agents/plugins/marketplace.json",
403
+ format: "codex",
404
+ builtIn: true,
405
+ autoUpdate: true,
406
+ addedAt: BUILTIN_ADDED_AT,
407
+ status: "unavailable"
408
+ }
409
+ };
410
+ function ensureDefaultMarketplaces(marketplaces) {
411
+ const result = { ...marketplaces ?? {} };
412
+ for (const [name, defaults] of Object.entries(DEFAULT_MARKETPLACES)) {
413
+ const existing = result[name];
414
+ result[name] = existing ? { ...defaults, ...existing, name, source: defaults.source, sourceType: defaults.sourceType, manifestPath: defaults.manifestPath, format: defaults.format, builtIn: true } : { ...defaults };
415
+ }
416
+ return result;
417
+ }
418
+
382
419
  // src/core/config.ts
383
420
  class ConfigLoadError extends Error {
384
421
  configPath;
@@ -426,10 +463,13 @@ var discoveredComponentSchema = z.object({
426
463
  });
427
464
  var discoveredMcpServerSchema = z.object({
428
465
  id: z.string(),
466
+ transport: z.enum(["stdio", "http"]).optional(),
429
467
  command: z.string(),
430
468
  args: z.array(z.string()).optional(),
431
469
  env: z.record(z.string(), z.string()).optional(),
432
- cwd: z.string().optional()
470
+ cwd: z.string().optional(),
471
+ url: z.string().optional(),
472
+ oauthResource: z.string().optional()
433
473
  });
434
474
  var discoveredComponentsSchema = z.object({
435
475
  skills: z.array(discoveredComponentSchema).default([]),
@@ -462,12 +502,34 @@ var managedPluginSchema = z.object({
462
502
  agents: z.boolean().optional(),
463
503
  commands: z.boolean().optional()
464
504
  }).optional(),
505
+ marketplace: z.object({
506
+ name: z.string(),
507
+ pluginName: z.string(),
508
+ sourceFingerprint: z.string()
509
+ }).optional(),
510
+ updateError: z.string().optional(),
465
511
  projectOverrides: z.record(z.string(), z.object({
466
512
  enabled: z.boolean().optional(),
467
513
  components: z.record(pluginComponentSchema, z.boolean()).optional(),
468
514
  config: z.record(z.string(), z.unknown()).optional()
469
515
  })).optional()
470
516
  });
517
+ var managedMarketplaceSchema = z.object({
518
+ name: z.string(),
519
+ displayName: z.string(),
520
+ source: z.string(),
521
+ sourceType: z.enum(["github", "git", "local", "hosted-json"]).default("github"),
522
+ manifestPath: z.string().optional(),
523
+ format: z.enum(["claude", "codex"]).optional(),
524
+ builtIn: z.boolean().default(false),
525
+ autoUpdate: z.boolean().default(false),
526
+ addedAt: z.string(),
527
+ lastCheckedAt: z.string().optional(),
528
+ lastUpdatedAt: z.string().optional(),
529
+ resolvedRevision: z.string().optional(),
530
+ status: z.enum(["ready", "stale", "error", "unavailable"]).default("unavailable"),
531
+ error: z.string().optional()
532
+ });
471
533
  var configSchema = z.object({
472
534
  schemaVersion: z.literal(1).default(1),
473
535
  gateway: z.object({
@@ -482,7 +544,8 @@ var configSchema = z.object({
482
544
  servers: z.record(z.string(), serverSchema).default({}),
483
545
  clients: z.record(z.string(), clientStateSchema).default({}),
484
546
  projects: z.record(z.string(), projectEntrySchema).default({}),
485
- plugins: z.record(z.string(), managedPluginSchema).default({})
547
+ plugins: z.record(z.string(), managedPluginSchema).default({}),
548
+ marketplaces: z.record(z.string(), managedMarketplaceSchema).default({})
486
549
  });
487
550
  var projectConfigSchema = z.object({
488
551
  name: z.string().min(1).optional(),
@@ -499,7 +562,8 @@ function defaultConfig() {
499
562
  servers: {},
500
563
  clients: {},
501
564
  projects: {},
502
- plugins: {}
565
+ plugins: {},
566
+ marketplaces: ensureDefaultMarketplaces(undefined)
503
567
  };
504
568
  }
505
569
  function loadConfig(configPath = getConfigPath()) {
@@ -541,7 +605,8 @@ function loadConfig(configPath = getConfigPath()) {
541
605
  servers,
542
606
  clients: clientEntries,
543
607
  projects: parsed.data.projects,
544
- plugins: parsed.data.plugins
608
+ plugins: parsed.data.plugins,
609
+ marketplaces: ensureDefaultMarketplaces(parsed.data.marketplaces)
545
610
  });
546
611
  }
547
612
  function saveConfig(config, configPath = getConfigPath()) {
@@ -1,29 +1,34 @@
1
+ import {
2
+ refreshAutoUpdateMarketplaces
3
+ } from "./cli-ct7asw78.js";
1
4
  import {
2
5
  APP_VERSION,
3
6
  getGatewayUrl,
4
7
  persistSyncState,
5
8
  syncAllClients
6
- } from "./cli-vy81xjm0.js";
9
+ } from "./cli-b0xrqsjc.js";
7
10
  import {
8
11
  loadConfig,
9
12
  loadMergedConfig,
10
13
  saveConfig
11
- } from "./cli-g4w6k655.js";
14
+ } from "./cli-dy7x0zrg.js";
12
15
  import {
13
16
  SecretsManager,
14
17
  UpstreamError,
15
18
  classifyUpstreamError,
16
19
  ensureGatewayToken
17
- } from "./cli-remv48t3.js";
20
+ } from "./cli-1ewrsfj4.js";
18
21
  import {
19
22
  ensureDir,
20
23
  ensureParentDir,
21
24
  getLogPath,
25
+ getMarketplaceUpdateLockPath,
26
+ getMarketplaceUpdateStatePath,
22
27
  getPidPath,
23
28
  getStagedVersionPath,
24
29
  getUpdateLockPath,
25
30
  getUpdatesDir
26
- } from "./cli-zjepj3sj.js";
31
+ } from "./cli-28g7x9rn.js";
27
32
  import {
28
33
  isServerEnabled
29
34
  } from "./cli-s4gspqdf.js";
@@ -1001,8 +1006,89 @@ function performRollback() {
1001
1006
  };
1002
1007
  }
1003
1008
 
1004
- // src/core/daemon.ts
1009
+ // src/core/marketplace-updater.ts
1005
1010
  import fs4 from "node:fs";
1011
+ var MARKETPLACE_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1000;
1012
+ var INITIAL_DELAY_MS = 30000;
1013
+ var LOCK_STALE_MS = 30 * 60 * 1000;
1014
+ function readState() {
1015
+ try {
1016
+ return JSON.parse(fs4.readFileSync(getMarketplaceUpdateStatePath(), "utf8"));
1017
+ } catch {
1018
+ return {};
1019
+ }
1020
+ }
1021
+ function writeState(state) {
1022
+ const target = getMarketplaceUpdateStatePath();
1023
+ ensureParentDir(target);
1024
+ fs4.writeFileSync(target, JSON.stringify(state, null, 2), { mode: 384 });
1025
+ }
1026
+ function due(now = Date.now()) {
1027
+ const last = readState().lastRunAt;
1028
+ return !last || !Number.isFinite(Date.parse(last)) || now - Date.parse(last) >= MARKETPLACE_UPDATE_INTERVAL_MS;
1029
+ }
1030
+ function acquireLock2() {
1031
+ const target = getMarketplaceUpdateLockPath();
1032
+ ensureParentDir(target);
1033
+ try {
1034
+ fs4.writeFileSync(target, `${process.pid}
1035
+ `, { flag: "wx", mode: 384 });
1036
+ return true;
1037
+ } catch {
1038
+ try {
1039
+ if (Date.now() - fs4.statSync(target).mtimeMs > LOCK_STALE_MS) {
1040
+ fs4.unlinkSync(target);
1041
+ return acquireLock2();
1042
+ }
1043
+ } catch {
1044
+ return acquireLock2();
1045
+ }
1046
+ return false;
1047
+ }
1048
+ }
1049
+ function releaseLock2() {
1050
+ try {
1051
+ fs4.unlinkSync(getMarketplaceUpdateLockPath());
1052
+ } catch {}
1053
+ }
1054
+ async function runMarketplaceAutoUpdate(options) {
1055
+ if (process.env.MCPX_NO_UPDATE === "1")
1056
+ return { checked: [], errors: [], skipped: true };
1057
+ if (!options?.force && !due())
1058
+ return { checked: [], errors: [], skipped: true };
1059
+ if (!acquireLock2())
1060
+ return { checked: [], errors: [], skipped: true };
1061
+ try {
1062
+ const result = await refreshAutoUpdateMarketplaces();
1063
+ writeState({ lastRunAt: new Date().toISOString() });
1064
+ return result;
1065
+ } finally {
1066
+ releaseLock2();
1067
+ }
1068
+ }
1069
+ function startMarketplaceAutoUpdater() {
1070
+ if (process.env.MCPX_NO_UPDATE === "1")
1071
+ return () => {};
1072
+ let stopped = false;
1073
+ const run = () => {
1074
+ if (!stopped)
1075
+ runMarketplaceAutoUpdate().catch(() => {
1076
+ return;
1077
+ });
1078
+ };
1079
+ const initial = setTimeout(run, INITIAL_DELAY_MS);
1080
+ initial.unref?.();
1081
+ const interval = setInterval(run, MARKETPLACE_UPDATE_INTERVAL_MS);
1082
+ interval.unref?.();
1083
+ return () => {
1084
+ stopped = true;
1085
+ clearTimeout(initial);
1086
+ clearInterval(interval);
1087
+ };
1088
+ }
1089
+
1090
+ // src/core/daemon.ts
1091
+ import fs5 from "node:fs";
1006
1092
  import net from "node:net";
1007
1093
  import { spawn as spawn2, execFileSync as execFileSync2 } from "node:child_process";
1008
1094
 
@@ -1995,11 +2081,18 @@ function createGatewayServer(options) {
1995
2081
  }
1996
2082
 
1997
2083
  // src/core/daemon.ts
2084
+ function buildDaemonChildEnv(baseEnv = process.env, electronRuntime = typeof process.versions.electron === "string") {
2085
+ return {
2086
+ ...baseEnv,
2087
+ MCPX_DAEMON_CHILD: "1",
2088
+ ...electronRuntime ? { ELECTRON_RUN_AS_NODE: "1" } : {}
2089
+ };
2090
+ }
1998
2091
  function readPidRecordFromFile(pidPath = getPidPath()) {
1999
- if (!fs4.existsSync(pidPath)) {
2092
+ if (!fs5.existsSync(pidPath)) {
2000
2093
  return null;
2001
2094
  }
2002
- const raw = fs4.readFileSync(pidPath, "utf8").trim();
2095
+ const raw = fs5.readFileSync(pidPath, "utf8").trim();
2003
2096
  if (!raw) {
2004
2097
  return null;
2005
2098
  }
@@ -2117,7 +2210,7 @@ async function startDaemon(config, cliPath, secrets) {
2117
2210
  };
2118
2211
  }
2119
2212
  try {
2120
- fs4.unlinkSync(getPidPath());
2213
+ fs5.unlinkSync(getPidPath());
2121
2214
  } catch {}
2122
2215
  }
2123
2216
  const { port, fellBackFrom } = await resolveGatewayPort(config, secrets);
@@ -2130,35 +2223,32 @@ async function startDaemon(config, cliPath, secrets) {
2130
2223
  const logPath = getLogPath();
2131
2224
  ensureParentDir(pidPath);
2132
2225
  ensureParentDir(logPath);
2133
- let logFd = fs4.openSync(logPath, "a", 384);
2134
- const logStat = fs4.fstatSync(logFd);
2226
+ let logFd = fs5.openSync(logPath, "a", 384);
2227
+ const logStat = fs5.fstatSync(logFd);
2135
2228
  if (logStat.size > 10 * 1024 * 1024) {
2136
- fs4.closeSync(logFd);
2229
+ fs5.closeSync(logFd);
2137
2230
  const log1 = `${logPath}.1`;
2138
2231
  const log2 = `${logPath}.2`;
2139
2232
  try {
2140
- if (fs4.existsSync(log2))
2141
- fs4.unlinkSync(log2);
2233
+ if (fs5.existsSync(log2))
2234
+ fs5.unlinkSync(log2);
2142
2235
  } catch {}
2143
2236
  try {
2144
- if (fs4.existsSync(log1))
2145
- fs4.renameSync(log1, log2);
2237
+ if (fs5.existsSync(log1))
2238
+ fs5.renameSync(log1, log2);
2146
2239
  } catch {}
2147
2240
  try {
2148
- fs4.renameSync(logPath, log1);
2241
+ fs5.renameSync(logPath, log1);
2149
2242
  } catch {}
2150
- logFd = fs4.openSync(logPath, "a", 384);
2243
+ logFd = fs5.openSync(logPath, "a", 384);
2151
2244
  }
2152
2245
  const child = spawn2(process.execPath, [cliPath, "daemon", "run", "--port", String(port)], {
2153
2246
  detached: true,
2154
2247
  stdio: ["ignore", logFd, logFd],
2155
- env: {
2156
- ...process.env,
2157
- MCPX_DAEMON_CHILD: "1"
2158
- }
2248
+ env: buildDaemonChildEnv()
2159
2249
  });
2160
2250
  child.unref();
2161
- fs4.writeFileSync(pidPath, `${child.pid}:${port}
2251
+ fs5.writeFileSync(pidPath, `${child.pid}:${port}
2162
2252
  `, { mode: 384 });
2163
2253
  startBackgroundUpdateCheck();
2164
2254
  await waitForGatewayReady(port, token);
@@ -2182,7 +2272,7 @@ function stopDaemon() {
2182
2272
  const cmd = execFileSync2("ps", ["-p", String(pid), "-o", "command="], { encoding: "utf8", timeout: 2000 }).trim();
2183
2273
  const looksLikeMcpxDaemon = cmd.includes("daemon run") && (cmd.includes("mcpx") || cmd.includes("cli.js"));
2184
2274
  if (!looksLikeMcpxDaemon) {
2185
- fs4.unlinkSync(pidPath);
2275
+ fs5.unlinkSync(pidPath);
2186
2276
  return {
2187
2277
  stopped: false,
2188
2278
  message: `PID ${pid} is not a mcpx daemon (command: ${cmd.slice(0, 80)}). Pidfile cleaned up.`
@@ -2190,7 +2280,7 @@ function stopDaemon() {
2190
2280
  }
2191
2281
  } catch {
2192
2282
  try {
2193
- fs4.unlinkSync(pidPath);
2283
+ fs5.unlinkSync(pidPath);
2194
2284
  } catch {}
2195
2285
  return {
2196
2286
  stopped: false,
@@ -2201,7 +2291,7 @@ function stopDaemon() {
2201
2291
  process.kill(pid, "SIGTERM");
2202
2292
  } catch {}
2203
2293
  try {
2204
- fs4.unlinkSync(pidPath);
2294
+ fs5.unlinkSync(pidPath);
2205
2295
  } catch {}
2206
2296
  return {
2207
2297
  stopped: true,
@@ -2214,10 +2304,10 @@ async function restartDaemon(config, cliPath, secrets) {
2214
2304
  }
2215
2305
  function readDaemonLogs(maxLines = 200) {
2216
2306
  const logPath = getLogPath();
2217
- if (!fs4.existsSync(logPath)) {
2307
+ if (!fs5.existsSync(logPath)) {
2218
2308
  return "";
2219
2309
  }
2220
- const lines = fs4.readFileSync(logPath, "utf8").split(`
2310
+ const lines = fs5.readFileSync(logPath, "utf8").split(`
2221
2311
  `);
2222
2312
  return lines.slice(Math.max(lines.length - maxLines, 0)).join(`
2223
2313
  `);
@@ -2230,7 +2320,9 @@ function runDaemonForeground(config, port, secrets) {
2230
2320
  expectedToken: token,
2231
2321
  secrets
2232
2322
  });
2323
+ const stopMarketplaceUpdater = startMarketplaceAutoUpdater();
2233
2324
  const cleanup = () => {
2325
+ stopMarketplaceUpdater();
2234
2326
  server.close(() => resolve());
2235
2327
  };
2236
2328
  process.on("SIGINT", cleanup);
@@ -2360,4 +2452,4 @@ async function buildStatusReport(config, managedIndex, daemon = getDaemonStatus(
2360
2452
  };
2361
2453
  }
2362
2454
 
2363
- export { probeHttpAuthRequirement, fetchRegistryServerDetail, selectBestPackage, extractRequiredInputs, mapRegistryToSpec, toSecretRef, secretRefName, defaultAuthSecretName, resolveAuthTarget, applyAuthReference, removeAuthReference, listAuthBindings, maybePrefixBearer, buildEnrichedPath, isOAuthReference, oauthReferenceServerName, runOAuthLogin, getOAuthAccessToken, compareVersions, checkForUpdates, getStagedUpdate, shouldUseStagedCli, clearStagedUpdate, getStagedCliPath, startBackgroundUpdateCheck, runBackgroundUpdate, performUpdate, performRollback, getDaemonStatus, startDaemon, stopDaemon, restartDaemon, readDaemonLogs, runDaemonForeground, STATUS_CLIENTS, buildStatusReport };
2455
+ export { probeHttpAuthRequirement, fetchRegistryServerDetail, selectBestPackage, extractRequiredInputs, mapRegistryToSpec, toSecretRef, secretRefName, defaultAuthSecretName, resolveAuthTarget, applyAuthReference, removeAuthReference, listAuthBindings, maybePrefixBearer, buildEnrichedPath, isOAuthReference, oauthReferenceServerName, runOAuthLogin, getOAuthAccessToken, compareVersions, checkForUpdates, getStagedUpdate, shouldUseStagedCli, clearStagedUpdate, getStagedCliPath, startBackgroundUpdateCheck, runBackgroundUpdate, performUpdate, performRollback, runMarketplaceAutoUpdate, startMarketplaceAutoUpdater, getDaemonStatus, startDaemon, stopDaemon, restartDaemon, readDaemonLogs, runDaemonForeground, STATUS_CLIENTS, buildStatusReport };
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAyhEA,wBAAsB,MAAM,CAAC,IAAI,WAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6E/D"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA+oEA,wBAAsB,MAAM,CAAC,IAAI,WAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6E/D"}
package/dist/cli.js CHANGED
@@ -29,7 +29,8 @@ import {
29
29
  startDaemon,
30
30
  stopDaemon,
31
31
  toSecretRef
32
- } from "./cli-gf70a85c.js";
32
+ } from "./cli-etmrz2c4.js";
33
+ import"./cli-ct7asw78.js";
33
34
  import {
34
35
  APP_VERSION,
35
36
  deleteSkill,
@@ -44,14 +45,14 @@ import {
44
45
  persistSyncState,
45
46
  saveSkill,
46
47
  syncAllClients
47
- } from "./cli-vy81xjm0.js";
48
+ } from "./cli-b0xrqsjc.js";
48
49
  import {
49
50
  ConfigLoadError,
50
51
  loadConfig,
51
52
  loadMergedConfig,
52
53
  loadProjectConfig,
53
54
  resolveActiveConfig
54
- } from "./cli-g4w6k655.js";
55
+ } from "./cli-dy7x0zrg.js";
55
56
  import {
56
57
  SecretsManager,
57
58
  addServer,
@@ -61,12 +62,12 @@ import {
61
62
  removeServer,
62
63
  rotateGatewayToken,
63
64
  setServerEnabled
64
- } from "./cli-remv48t3.js";
65
+ } from "./cli-1ewrsfj4.js";
65
66
  import {
66
67
  getConfigPath,
67
68
  getManagedIndexPath,
68
69
  getSecretsStorePath
69
- } from "./cli-zjepj3sj.js";
70
+ } from "./cli-28g7x9rn.js";
70
71
  import {
71
72
  __require,
72
73
  isServerEnabled
@@ -2590,11 +2591,11 @@ function registerProjectCommands(program, cliPath) {
2590
2591
  name: projectName,
2591
2592
  servers: {}
2592
2593
  };
2593
- const { saveProjectConfig } = await import("./config-2s2aqkqp.js");
2594
+ const { saveProjectConfig } = await import("./config-yx5m60fv.js");
2594
2595
  saveProjectConfig(localConfig, targetPath);
2595
2596
  process.stdout.write(`Initialized project configuration at: ${targetPath}
2596
2597
  `);
2597
- const { registerProject: registerProject2 } = await import("./registry-bnjb2345.js");
2598
+ const { registerProject: registerProject2 } = await import("./registry-yvbxcaq6.js");
2598
2599
  await mutateConfig((globalConfig) => {
2599
2600
  registerProject2(globalConfig, process.cwd(), projectName);
2600
2601
  });
@@ -2625,7 +2626,7 @@ function registerProjectCommands(program, cliPath) {
2625
2626
  process.exit(1);
2626
2627
  }
2627
2628
  const entry = globalConfig.projects[resolvedPath];
2628
- const { unregisterProject: unregisterProject2 } = await import("./registry-bnjb2345.js");
2629
+ const { unregisterProject: unregisterProject2 } = await import("./registry-yvbxcaq6.js");
2629
2630
  await mutateConfig((freshConfig) => {
2630
2631
  unregisterProject2(freshConfig, resolvedPath);
2631
2632
  });
@@ -2639,7 +2640,7 @@ function registerProjectCommands(program, cliPath) {
2639
2640
  function registerPluginCommands(program, _cliPath) {
2640
2641
  const plugin = program.command("plugin").description("Manage plugins");
2641
2642
  plugin.command("inspect <source>").description("Inspect plugin manifest and components").action(async (source) => {
2642
- const { inspectPlugin } = await import("./plugin-manager-7c9nk34n.js");
2643
+ const { inspectPlugin } = await import("./plugin-manager-19q55n69.js");
2643
2644
  try {
2644
2645
  const info = await inspectPlugin(source);
2645
2646
  process.stdout.write(JSON.stringify(info, null, 2) + `
@@ -2650,13 +2651,43 @@ function registerPluginCommands(program, _cliPath) {
2650
2651
  process.exit(1);
2651
2652
  }
2652
2653
  });
2653
- plugin.command("install <source>").option("--name <name>", "Plugin name").option("--no-enable", "Don't enable plugin after install").description("Install plugin").action(async (source, options) => {
2654
- const { installPlugin } = await import("./plugin-manager-7c9nk34n.js");
2654
+ plugin.command("install <source>").option("--name <name>", "Plugin name").option("--no-enable", "Don't enable plugin after install").option("-y, --yes", "Confirm marketplace plugin installation").description("Install plugin").action(async (source, options) => {
2655
2655
  try {
2656
- const p = await installPlugin(source, {
2657
- name: options.name,
2658
- enabled: !options.noEnable
2659
- });
2656
+ const config = loadConfig();
2657
+ const marketplaceName = source.includes("@") ? source.slice(source.lastIndexOf("@") + 1) : "";
2658
+ let p;
2659
+ if (config.marketplaces?.[marketplaceName]) {
2660
+ const { inspectMarketplacePlugin, installMarketplacePlugin } = await import("./marketplace-pwabb3ea.js");
2661
+ const detail = await inspectMarketplacePlugin(source);
2662
+ process.stdout.write(`${detail.displayName} (${source})
2663
+ `);
2664
+ process.stdout.write(`Will install: ${detail.supportedCapabilities.join(", ") || "nothing compatible"}
2665
+ `);
2666
+ if (detail.unsupportedCapabilities.length)
2667
+ process.stdout.write(`Unsupported: ${detail.unsupportedCapabilities.join(", ")}
2668
+ `);
2669
+ if (!detail.compatible)
2670
+ throw new Error(`Plugin ${source} has no mcpx-compatible capabilities`);
2671
+ if (!options.yes) {
2672
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
2673
+ throw new Error("Marketplace installation requires --yes in non-interactive mode");
2674
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
2675
+ try {
2676
+ const answer = await promptLine(rl, "Install this plugin? (y/N): ");
2677
+ if (answer.trim().toLowerCase() !== "y" && answer.trim().toLowerCase() !== "yes") {
2678
+ process.stdout.write(`Installation cancelled.
2679
+ `);
2680
+ return;
2681
+ }
2682
+ } finally {
2683
+ rl.close();
2684
+ }
2685
+ }
2686
+ p = await installMarketplacePlugin(source);
2687
+ } else {
2688
+ const { installPlugin } = await import("./plugin-manager-19q55n69.js");
2689
+ p = await installPlugin(source, { name: options.name, enabled: options.enable !== false });
2690
+ }
2660
2691
  process.stdout.write(`Plugin installed: ${p.id}
2661
2692
  `);
2662
2693
  } catch (e) {
@@ -2665,8 +2696,89 @@ function registerPluginCommands(program, _cliPath) {
2665
2696
  process.exit(1);
2666
2697
  }
2667
2698
  });
2699
+ const marketplace = plugin.command("marketplace").description("Manage plugin marketplaces");
2700
+ marketplace.command("list").description("List configured plugin marketplaces").action(async () => {
2701
+ const { listMarketplaces } = await import("./marketplace-pwabb3ea.js");
2702
+ process.stdout.write(JSON.stringify(await listMarketplaces(), null, 2) + `
2703
+ `);
2704
+ });
2705
+ marketplace.command("add <source>").option("--manifest <path>", "Marketplace manifest path inside the source").description("Add a Claude or Codex plugin marketplace").action(async (source, options) => {
2706
+ try {
2707
+ const { addMarketplace } = await import("./marketplace-pwabb3ea.js");
2708
+ const added = await addMarketplace(source, options.manifest);
2709
+ process.stdout.write(`Marketplace added: ${added.name}
2710
+ `);
2711
+ } catch (error) {
2712
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}
2713
+ `);
2714
+ process.exitCode = 1;
2715
+ }
2716
+ });
2717
+ marketplace.command("update [name]").description("Refresh one marketplace, or every configured marketplace").action(async (name) => {
2718
+ try {
2719
+ const { listMarketplaces, refreshMarketplaceWithPlugins } = await import("./marketplace-pwabb3ea.js");
2720
+ const names = name ? [name] : (await listMarketplaces()).map((entry) => entry.name);
2721
+ for (const marketplaceName of names) {
2722
+ const result = await refreshMarketplaceWithPlugins(marketplaceName);
2723
+ process.stdout.write(`Marketplace updated: ${marketplaceName} (${result.updated.length} plugin update(s))
2724
+ `);
2725
+ for (const error of result.errors)
2726
+ process.stderr.write(`Warning: ${error}
2727
+ `);
2728
+ }
2729
+ } catch (error) {
2730
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}
2731
+ `);
2732
+ process.exitCode = 1;
2733
+ }
2734
+ });
2735
+ marketplace.command("remove <name>").option("-y, --yes", "Confirm removal and uninstall marketplace plugins").description("Remove a custom marketplace and its installed plugins").action(async (name, options) => {
2736
+ try {
2737
+ if (!options.yes) {
2738
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
2739
+ throw new Error("Marketplace removal requires --yes in non-interactive mode");
2740
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
2741
+ try {
2742
+ const answer = await promptLine(rl, `Remove ${name} and uninstall its plugins? (y/N): `);
2743
+ if (!["y", "yes"].includes(answer.trim().toLowerCase()))
2744
+ return;
2745
+ } finally {
2746
+ rl.close();
2747
+ }
2748
+ }
2749
+ const { removeMarketplace } = await import("./marketplace-pwabb3ea.js");
2750
+ await removeMarketplace(name);
2751
+ process.stdout.write(`Marketplace removed: ${name}
2752
+ `);
2753
+ } catch (error) {
2754
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}
2755
+ `);
2756
+ process.exitCode = 1;
2757
+ }
2758
+ });
2759
+ plugin.command("discover [query]").option("--marketplace <name>", "Filter by marketplace").option("--category <category>", "Filter by category").description("Browse available marketplace plugins").action(async (query, options) => {
2760
+ const { listMarketplacePlugins } = await import("./marketplace-pwabb3ea.js");
2761
+ let listings = await listMarketplacePlugins(query);
2762
+ if (options.marketplace)
2763
+ listings = listings.filter((entry) => entry.marketplace === options.marketplace);
2764
+ if (options.category)
2765
+ listings = listings.filter((entry) => entry.category?.toLowerCase() === options.category.toLowerCase());
2766
+ process.stdout.write(JSON.stringify(listings, null, 2) + `
2767
+ `);
2768
+ });
2769
+ plugin.command("details <plugin>").description("Inspect a plugin@marketplace listing").action(async (qualified) => {
2770
+ try {
2771
+ const { inspectMarketplacePlugin } = await import("./marketplace-pwabb3ea.js");
2772
+ process.stdout.write(JSON.stringify(await inspectMarketplacePlugin(qualified), null, 2) + `
2773
+ `);
2774
+ } catch (error) {
2775
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}
2776
+ `);
2777
+ process.exitCode = 1;
2778
+ }
2779
+ });
2668
2780
  plugin.command("approve <name> <component>").description("Approve a plugin component (hooks, mcpServers)").action(async (name, component) => {
2669
- const { approvePluginComponent } = await import("./plugin-manager-7c9nk34n.js");
2781
+ const { approvePluginComponent } = await import("./plugin-manager-19q55n69.js");
2670
2782
  try {
2671
2783
  await approvePluginComponent(name, component);
2672
2784
  process.stdout.write(`Approved ${component} for plugin ${name}
@@ -2678,7 +2790,7 @@ function registerPluginCommands(program, _cliPath) {
2678
2790
  }
2679
2791
  });
2680
2792
  plugin.command("prepare <name>").description("Install plugin dependencies").action(async (name) => {
2681
- const { preparePlugin } = await import("./plugin-manager-7c9nk34n.js");
2793
+ const { preparePlugin } = await import("./plugin-manager-19q55n69.js");
2682
2794
  try {
2683
2795
  await preparePlugin(name);
2684
2796
  process.stdout.write(`Plugin ${name} prepared
@@ -2690,7 +2802,7 @@ function registerPluginCommands(program, _cliPath) {
2690
2802
  }
2691
2803
  });
2692
2804
  plugin.command("update <name>").description("Update plugin to latest version").action(async (name) => {
2693
- const { updatePlugin } = await import("./plugin-manager-7c9nk34n.js");
2805
+ const { updatePlugin } = await import("./plugin-manager-19q55n69.js");
2694
2806
  try {
2695
2807
  const p = await updatePlugin(name);
2696
2808
  process.stdout.write(`Plugin ${name} updated to ${p.version}
@@ -2702,7 +2814,7 @@ function registerPluginCommands(program, _cliPath) {
2702
2814
  }
2703
2815
  });
2704
2816
  plugin.command("uninstall <name>").option("--keep-data", "Keep plugin data after uninstall").description("Uninstall plugin").action(async (name, options) => {
2705
- const { uninstallPlugin } = await import("./plugin-manager-7c9nk34n.js");
2817
+ const { uninstallPlugin } = await import("./plugin-manager-19q55n69.js");
2706
2818
  try {
2707
2819
  await uninstallPlugin(name, options.keepData || false);
2708
2820
  process.stdout.write(`Plugin ${name} uninstalled
@@ -2716,13 +2828,13 @@ function registerPluginCommands(program, _cliPath) {
2716
2828
  plugin.command("enable <name>").option("--project <path>", "Scope this enable to a single registered project instead of globally").description("Enable plugin (globally, or for one project with --project)").action(async (name, options) => {
2717
2829
  try {
2718
2830
  if (options.project) {
2719
- const { setPluginProjectOverride } = await import("./plugin-manager-7c9nk34n.js");
2831
+ const { setPluginProjectOverride } = await import("./plugin-manager-19q55n69.js");
2720
2832
  const resolvedPath = path.resolve(options.project);
2721
2833
  await setPluginProjectOverride(name, resolvedPath, { enabled: true });
2722
2834
  process.stdout.write(`Plugin ${name} enabled for project: ${resolvedPath}
2723
2835
  `);
2724
2836
  } else {
2725
- const { enablePlugin } = await import("./plugin-manager-7c9nk34n.js");
2837
+ const { enablePlugin } = await import("./plugin-manager-19q55n69.js");
2726
2838
  await enablePlugin(name);
2727
2839
  process.stdout.write(`Plugin ${name} enabled
2728
2840
  `);
@@ -2736,13 +2848,13 @@ function registerPluginCommands(program, _cliPath) {
2736
2848
  plugin.command("disable <name>").option("--project <path>", "Scope this disable to a single registered project instead of globally").description("Disable plugin (globally, or for one project with --project)").action(async (name, options) => {
2737
2849
  try {
2738
2850
  if (options.project) {
2739
- const { setPluginProjectOverride } = await import("./plugin-manager-7c9nk34n.js");
2851
+ const { setPluginProjectOverride } = await import("./plugin-manager-19q55n69.js");
2740
2852
  const resolvedPath = path.resolve(options.project);
2741
2853
  await setPluginProjectOverride(name, resolvedPath, { enabled: false });
2742
2854
  process.stdout.write(`Plugin ${name} disabled for project: ${resolvedPath}
2743
2855
  `);
2744
2856
  } else {
2745
- const { disablePlugin } = await import("./plugin-manager-7c9nk34n.js");
2857
+ const { disablePlugin } = await import("./plugin-manager-19q55n69.js");
2746
2858
  await disablePlugin(name);
2747
2859
  process.stdout.write(`Plugin ${name} disabled
2748
2860
  `);
@@ -2754,7 +2866,7 @@ function registerPluginCommands(program, _cliPath) {
2754
2866
  }
2755
2867
  });
2756
2868
  plugin.command("status [name]").description("Show plugin status").action(async (name) => {
2757
- const { getPluginStatus, listPlugins } = await import("./plugin-manager-7c9nk34n.js");
2869
+ const { getPluginStatus, listPlugins } = await import("./plugin-manager-19q55n69.js");
2758
2870
  try {
2759
2871
  if (name) {
2760
2872
  const p = await getPluginStatus(name);
@@ -2779,7 +2891,7 @@ function registerPluginCommands(program, _cliPath) {
2779
2891
  }
2780
2892
  function registerPluginHostCommand(program) {
2781
2893
  program.command("plugin-host <plugin> <server>").description("Run a plugin MCP server under mcpx policy enforcement").action(async (plugin, server) => {
2782
- const { runPluginHost } = await import("./plugin-host-wr17xed6.js");
2894
+ const { runPluginHost } = await import("./plugin-host-9xcpnehq.js");
2783
2895
  runPluginHost(plugin, server);
2784
2896
  });
2785
2897
  }