allagents 0.8.1 → 0.8.3

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.js +132 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22313,6 +22313,10 @@ var MarketplaceManifestSchema = exports_external.object({
22313
22313
  owner: ContactSchema.optional(),
22314
22314
  plugins: exports_external.array(MarketplacePluginEntrySchema)
22315
22315
  });
22316
+ var MarketplaceManifestLenientSchema = exports_external.object({
22317
+ name: exports_external.string().optional(),
22318
+ plugins: exports_external.array(exports_external.unknown())
22319
+ }).passthrough();
22316
22320
 
22317
22321
  // src/utils/marketplace-manifest-parser.ts
22318
22322
  var MANIFEST_PATH = ".claude-plugin/marketplace.json";
@@ -22342,17 +22346,79 @@ async function parseMarketplaceManifest(marketplacePath) {
22342
22346
  error: "Failed to parse marketplace.json as JSON: invalid syntax"
22343
22347
  };
22344
22348
  }
22345
- const result = MarketplaceManifestSchema.safeParse(json2);
22346
- if (!result.success) {
22347
- const issues = result.error.issues.map((i2) => ` ${i2.path.join(".")}: ${i2.message}`).join(`
22348
- `);
22349
+ const strictResult = MarketplaceManifestSchema.safeParse(json2);
22350
+ if (strictResult.success) {
22351
+ return { success: true, data: strictResult.data, warnings: [] };
22352
+ }
22353
+ return parseLeniently(json2);
22354
+ }
22355
+ function parseLeniently(json2) {
22356
+ const lenientResult = MarketplaceManifestLenientSchema.safeParse(json2);
22357
+ if (!lenientResult.success) {
22349
22358
  return {
22350
22359
  success: false,
22351
- error: `Marketplace manifest validation failed:
22352
- ${issues}`
22360
+ error: 'Marketplace manifest must contain a "plugins" array'
22353
22361
  };
22354
22362
  }
22355
- return { success: true, data: result.data };
22363
+ const raw = lenientResult.data;
22364
+ const warnings = [];
22365
+ const obj = json2;
22366
+ const validPlugins = [];
22367
+ for (let i2 = 0;i2 < raw.plugins.length; i2++) {
22368
+ const entry = raw.plugins[i2];
22369
+ const entryResult = MarketplacePluginEntrySchema.safeParse(entry);
22370
+ if (entryResult.success) {
22371
+ validPlugins.push(entryResult.data);
22372
+ continue;
22373
+ }
22374
+ const extracted = extractPluginEntry(entry, i2, warnings);
22375
+ if (extracted) {
22376
+ validPlugins.push(extracted);
22377
+ }
22378
+ }
22379
+ const data = {
22380
+ name: typeof raw.name === "string" ? raw.name : "unknown",
22381
+ description: typeof obj.description === "string" ? obj.description : "",
22382
+ plugins: validPlugins
22383
+ };
22384
+ return { success: true, data, warnings };
22385
+ }
22386
+ function extractPluginEntry(entry, index, warnings) {
22387
+ if (!entry || typeof entry !== "object") {
22388
+ warnings.push(`plugins[${index}]: not an object, skipped`);
22389
+ return null;
22390
+ }
22391
+ const obj = entry;
22392
+ const name = typeof obj.name === "string" && obj.name ? obj.name : undefined;
22393
+ if (!name) {
22394
+ warnings.push(`plugins[${index}]: missing "name" field, skipped`);
22395
+ return null;
22396
+ }
22397
+ let description = "";
22398
+ if (typeof obj.description === "string" && obj.description) {
22399
+ description = obj.description;
22400
+ } else if (obj.metadata && typeof obj.metadata === "object" && typeof obj.metadata.description === "string") {
22401
+ description = obj.metadata.description;
22402
+ warnings.push(`plugins[${index}] ("${name}"): "description" found in metadata instead of top level`);
22403
+ } else {
22404
+ warnings.push(`plugins[${index}] ("${name}"): missing "description" field`);
22405
+ }
22406
+ let source = "";
22407
+ if (typeof obj.source === "string") {
22408
+ source = obj.source;
22409
+ } else if (obj.source && typeof obj.source === "object" && obj.source.source === "url" && typeof obj.source.url === "string") {
22410
+ source = obj.source;
22411
+ } else {
22412
+ warnings.push(`plugins[${index}] ("${name}"): missing or invalid "source" field`);
22413
+ }
22414
+ return {
22415
+ name,
22416
+ description,
22417
+ source,
22418
+ ...typeof obj.version === "string" && { version: obj.version },
22419
+ ...typeof obj.category === "string" && { category: obj.category },
22420
+ ...typeof obj.homepage === "string" && { homepage: obj.homepage }
22421
+ };
22356
22422
  }
22357
22423
  function resolvePluginSourcePath(source, marketplacePath) {
22358
22424
  if (typeof source === "object") {
@@ -22599,9 +22665,9 @@ async function updateMarketplace(name) {
22599
22665
  async function getMarketplacePluginsFromManifest(marketplacePath) {
22600
22666
  const result = await parseMarketplaceManifest(marketplacePath);
22601
22667
  if (!result.success) {
22602
- return [];
22668
+ return { plugins: [], warnings: [] };
22603
22669
  }
22604
- return result.data.plugins.map((plugin) => {
22670
+ const plugins = result.data.plugins.map((plugin) => {
22605
22671
  const resolvedSource = resolvePluginSourcePath(plugin.source, marketplacePath);
22606
22672
  const info = {
22607
22673
  name: plugin.name,
@@ -22615,28 +22681,30 @@ async function getMarketplacePluginsFromManifest(marketplacePath) {
22615
22681
  info.homepage = plugin.homepage;
22616
22682
  return info;
22617
22683
  });
22684
+ return { plugins, warnings: result.warnings };
22618
22685
  }
22619
22686
  async function listMarketplacePlugins(name) {
22620
22687
  const marketplace = await getMarketplace(name);
22621
22688
  if (!marketplace) {
22622
- return [];
22689
+ return { plugins: [], warnings: [] };
22623
22690
  }
22624
- const manifestPlugins = await getMarketplacePluginsFromManifest(marketplace.path);
22625
- if (manifestPlugins.length > 0) {
22626
- return manifestPlugins;
22691
+ const manifestResult = await getMarketplacePluginsFromManifest(marketplace.path);
22692
+ if (manifestResult.plugins.length > 0) {
22693
+ return manifestResult;
22627
22694
  }
22628
22695
  const pluginsDir = join6(marketplace.path, "plugins");
22629
22696
  if (!existsSync5(pluginsDir)) {
22630
- return [];
22697
+ return { plugins: [], warnings: manifestResult.warnings };
22631
22698
  }
22632
22699
  try {
22633
22700
  const entries = await readdir3(pluginsDir, { withFileTypes: true });
22634
- return entries.filter((e) => e.isDirectory()).map((e) => ({
22701
+ const plugins = entries.filter((e) => e.isDirectory()).map((e) => ({
22635
22702
  name: e.name,
22636
22703
  path: join6(pluginsDir, e.name)
22637
22704
  })).sort((a, b) => a.name.localeCompare(b.name));
22705
+ return { plugins, warnings: manifestResult.warnings };
22638
22706
  } catch {
22639
- return [];
22707
+ return { plugins: [], warnings: manifestResult.warnings };
22640
22708
  }
22641
22709
  }
22642
22710
  function parsePluginSpec(spec) {
@@ -22675,26 +22743,42 @@ async function resolvePluginSpec(spec, options2 = {}) {
22675
22743
  return null;
22676
22744
  }
22677
22745
  const marketplaceName = options2.marketplaceNameOverride ?? parsed.marketplaceName;
22678
- const marketplace = await getMarketplace(marketplaceName);
22679
- if (!marketplace) {
22680
- return null;
22746
+ let marketplacePath = options2.marketplacePathOverride ?? null;
22747
+ if (!marketplacePath) {
22748
+ const marketplace = await getMarketplace(marketplaceName);
22749
+ if (!marketplace) {
22750
+ return null;
22751
+ }
22752
+ marketplacePath = marketplace.path;
22681
22753
  }
22682
- const manifestResult = await parseMarketplaceManifest(marketplace.path);
22754
+ const manifestResult = await parseMarketplaceManifest(marketplacePath);
22683
22755
  if (manifestResult.success) {
22684
22756
  const pluginEntry = manifestResult.data.plugins.find((p) => p.name === parsed.plugin);
22685
22757
  if (pluginEntry) {
22686
- const resolvedSource = typeof pluginEntry.source === "string" ? resolve4(marketplace.path, pluginEntry.source) : pluginEntry.source.url;
22687
- if (typeof resolvedSource === "string" && existsSync5(resolvedSource)) {
22688
- return {
22689
- path: resolvedSource,
22690
- marketplace: marketplaceName,
22691
- plugin: parsed.plugin
22692
- };
22758
+ if (typeof pluginEntry.source === "string") {
22759
+ const resolvedPath = resolve4(marketplacePath, pluginEntry.source);
22760
+ if (existsSync5(resolvedPath)) {
22761
+ return {
22762
+ path: resolvedPath,
22763
+ marketplace: marketplaceName,
22764
+ plugin: parsed.plugin
22765
+ };
22766
+ }
22767
+ } else {
22768
+ const fetchFn = options2.fetchFn ?? fetchPlugin;
22769
+ const fetchResult = await fetchFn(pluginEntry.source.url);
22770
+ if (fetchResult.success && fetchResult.cachePath) {
22771
+ return {
22772
+ path: fetchResult.cachePath,
22773
+ marketplace: marketplaceName,
22774
+ plugin: parsed.plugin
22775
+ };
22776
+ }
22693
22777
  }
22694
22778
  }
22695
22779
  }
22696
22780
  const subpath = options2.subpath ?? parsed.subpath ?? "plugins";
22697
- const pluginPath = join6(marketplace.path, subpath, parsed.plugin);
22781
+ const pluginPath = join6(marketplacePath, subpath, parsed.plugin);
22698
22782
  if (!existsSync5(pluginPath)) {
22699
22783
  return null;
22700
22784
  }
@@ -24765,28 +24849,42 @@ var pluginListCmd = import_cmd_ts2.command({
24765
24849
  }
24766
24850
  if (isJsonMode()) {
24767
24851
  const allPlugins = [];
24852
+ const allWarnings = [];
24768
24853
  for (const mp of toList) {
24769
- const plugins = await listMarketplacePlugins(mp.name);
24770
- for (const plugin of plugins) {
24854
+ const result = await listMarketplacePlugins(mp.name);
24855
+ for (const plugin of result.plugins) {
24771
24856
  allPlugins.push({ name: plugin.name, marketplace: mp.name });
24772
24857
  }
24858
+ for (const warning of result.warnings) {
24859
+ allWarnings.push(`${mp.name}: ${warning}`);
24860
+ }
24773
24861
  }
24774
24862
  jsonOutput({
24775
24863
  success: true,
24776
24864
  command: "plugin list",
24777
- data: { plugins: allPlugins, total: allPlugins.length }
24865
+ data: {
24866
+ plugins: allPlugins,
24867
+ total: allPlugins.length,
24868
+ ...allWarnings.length > 0 && { warnings: allWarnings }
24869
+ }
24778
24870
  });
24779
24871
  return;
24780
24872
  }
24781
24873
  let totalPlugins = 0;
24782
24874
  for (const mp of toList) {
24783
- const plugins = await listMarketplacePlugins(mp.name);
24784
- if (plugins.length === 0) {
24875
+ const result = await listMarketplacePlugins(mp.name);
24876
+ if (result.plugins.length === 0 && result.warnings.length === 0) {
24785
24877
  console.log(`${mp.name}: (no plugins found)`);
24786
24878
  continue;
24787
24879
  }
24788
24880
  console.log(`${mp.name}:`);
24789
- for (const plugin of plugins) {
24881
+ for (const warning of result.warnings) {
24882
+ console.log(` Warning: ${warning}`);
24883
+ }
24884
+ if (result.plugins.length === 0) {
24885
+ console.log(" (no plugins found)");
24886
+ }
24887
+ for (const plugin of result.plugins) {
24790
24888
  console.log(` - ${plugin.name}@${mp.name}`);
24791
24889
  totalPlugins++;
24792
24890
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allagents",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
5
5
  "type": "module",
6
6
  "bin": {