plugins 1.2.10-canary.4 → 1.3.0

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 +26 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -488,6 +488,9 @@ function error(title, details) {
488
488
  }
489
489
  }
490
490
  }
491
+ function warn(message) {
492
+ barLine(`${c.yellow(S.warning)} ${c.yellow(message)}`);
493
+ }
491
494
  async function multiSelect(title, options, maxVisible = 8) {
492
495
  if (!process.stdin.isTTY) {
493
496
  return options.map((o) => o.value);
@@ -753,11 +756,18 @@ async function installToPluginCache(plugins, scope, repoPath, source) {
753
756
  } catch {
754
757
  }
755
758
  }
759
+ const githubRepo = extractGitHubRepo(source);
760
+ const marketplacesDir = join3(pluginsDir, "marketplaces");
761
+ const marketplaceInstallLocation = join3(marketplacesDir, marketplaceName);
762
+ await mkdir(marketplacesDir, { recursive: true });
763
+ if (existsSync2(marketplaceInstallLocation)) {
764
+ await rm(marketplaceInstallLocation, { recursive: true });
765
+ }
766
+ await cp(repoPath, marketplaceInstallLocation, { recursive: true });
767
+ barDebug(c.dim(`Marketplace copied to ${marketplaceInstallLocation}`));
756
768
  if (knownMarketplaces[marketplaceName]) {
757
769
  stepDone(`Marketplace ${c.dim("'" + marketplaceName + "'")} already registered`);
758
770
  } else {
759
- const githubRepo = extractGitHubRepo(source);
760
- const marketplaceInstallLocation = join3(home, ".claude", "plugins", "marketplaces", marketplaceName);
761
771
  let marketplaceSource;
762
772
  if (githubRepo) {
763
773
  marketplaceSource = { source: "github", repo: githubRepo };
@@ -815,20 +825,27 @@ async function installToPluginCache(plugins, scope, repoPath, source) {
815
825
  barDebug(c.dim("Updated installed_plugins.json"));
816
826
  const settingsPath = join3(home, ".claude", "settings.json");
817
827
  let settings = {};
828
+ let settingsCorrupted = false;
818
829
  if (existsSync2(settingsPath)) {
819
830
  try {
820
831
  settings = JSON.parse(await readFile2(settingsPath, "utf-8"));
821
832
  } catch {
833
+ settingsCorrupted = true;
822
834
  }
823
835
  }
824
- const enabled = settings.enabledPlugins ?? {};
825
- for (const plugin of plugins) {
826
- const pluginKey = `${plugin.name}@${marketplaceName}`;
827
- enabled[pluginKey] = true;
836
+ if (settingsCorrupted) {
837
+ warn("Could not parse ~/.claude/settings.json \u2014 skipping enabledPlugins update to avoid overwriting existing settings.");
838
+ barLine(c.dim("You may need to manually enable the plugins in Claude Code settings."));
839
+ } else {
840
+ const enabled = settings.enabledPlugins ?? {};
841
+ for (const plugin of plugins) {
842
+ const pluginKey = `${plugin.name}@${marketplaceName}`;
843
+ enabled[pluginKey] = true;
844
+ }
845
+ settings.enabledPlugins = enabled;
846
+ await writeFile(settingsPath, JSON.stringify(settings, null, 2));
847
+ barDebug(c.dim("Updated settings.json enabledPlugins"));
828
848
  }
829
- settings.enabledPlugins = enabled;
830
- await writeFile(settingsPath, JSON.stringify(settings, null, 2));
831
- barDebug(c.dim("Updated settings.json enabledPlugins"));
832
849
  cachePopulated = true;
833
850
  }
834
851
  async function installToCursorExtensions(plugins, scope, repoPath, source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugins",
3
- "version": "1.2.10-canary.4",
3
+ "version": "1.3.0",
4
4
  "description": "Install open-plugin format plugins into agent tools",
5
5
  "type": "module",
6
6
  "bin": {