allagents 1.0.1 → 1.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.js +190 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26146,6 +26146,7 @@ var init_marketplace_manifest_parser = __esm(() => {
26146
26146
  // src/core/user-workspace.ts
26147
26147
  var exports_user_workspace = {};
26148
26148
  __export(exports_user_workspace, {
26149
+ setUserPluginSkillsMode: () => setUserPluginSkillsMode,
26149
26150
  setUserClients: () => setUserClients,
26150
26151
  removeUserPluginsForMarketplace: () => removeUserPluginsForMarketplace,
26151
26152
  removeUserPlugin: () => removeUserPlugin,
@@ -26625,6 +26626,34 @@ async function removeUserEnabledSkill(skillKey) {
26625
26626
  };
26626
26627
  }
26627
26628
  }
26629
+ async function setUserPluginSkillsMode(pluginName, mode, skillNames) {
26630
+ await ensureUserWorkspace();
26631
+ const configPath = getUserWorkspaceConfigPath();
26632
+ try {
26633
+ const content = await readFile5(configPath, "utf-8");
26634
+ const config = load(content);
26635
+ const index = findPluginEntryByName(config, pluginName);
26636
+ if (index === -1) {
26637
+ return {
26638
+ success: false,
26639
+ error: `Plugin '${pluginName}' not found in user workspace config`
26640
+ };
26641
+ }
26642
+ const entry = ensureObjectPluginEntry(config, index);
26643
+ if (mode === "allowlist") {
26644
+ entry.skills = [...skillNames];
26645
+ } else {
26646
+ entry.skills = skillNames.length > 0 ? { exclude: [...skillNames] } : undefined;
26647
+ }
26648
+ await writeFile2(configPath, dump(config, { lineWidth: -1 }), "utf-8");
26649
+ return { success: true };
26650
+ } catch (error) {
26651
+ return {
26652
+ success: false,
26653
+ error: error instanceof Error ? error.message : String(error)
26654
+ };
26655
+ }
26656
+ }
26628
26657
  function pluginSourceToInfo(plugin, scope) {
26629
26658
  const parsed = parsePluginSpec(plugin);
26630
26659
  if (parsed) {
@@ -28010,6 +28039,39 @@ async function removeEnabledSkill(skillKey, workspacePath = process.cwd()) {
28010
28039
  };
28011
28040
  }
28012
28041
  }
28042
+ async function setPluginSkillsMode(pluginName, mode, skillNames, workspacePath = process.cwd()) {
28043
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28044
+ if (!existsSync8(configPath)) {
28045
+ return {
28046
+ success: false,
28047
+ error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}`
28048
+ };
28049
+ }
28050
+ try {
28051
+ const content = await readFile7(configPath, "utf-8");
28052
+ const config = load(content);
28053
+ const index = findPluginEntryByName(config, pluginName);
28054
+ if (index === -1) {
28055
+ return {
28056
+ success: false,
28057
+ error: `Plugin '${pluginName}' not found in workspace config`
28058
+ };
28059
+ }
28060
+ const entry = ensureObjectPluginEntry(config, index);
28061
+ if (mode === "allowlist") {
28062
+ entry.skills = [...skillNames];
28063
+ } else {
28064
+ entry.skills = skillNames.length > 0 ? { exclude: [...skillNames] } : undefined;
28065
+ }
28066
+ await writeFile4(configPath, dump(config, { lineWidth: -1 }), "utf-8");
28067
+ return { success: true };
28068
+ } catch (error) {
28069
+ return {
28070
+ success: false,
28071
+ error: error instanceof Error ? error.message : String(error)
28072
+ };
28073
+ }
28074
+ }
28013
28075
  function pruneEnabledSkillsForPlugin(config, pluginEntry) {
28014
28076
  if (!config.enabledSkills?.length)
28015
28077
  return;
@@ -33341,7 +33403,7 @@ var package_default;
33341
33403
  var init_package = __esm(() => {
33342
33404
  package_default = {
33343
33405
  name: "allagents",
33344
- version: "1.0.1",
33406
+ version: "1.0.2",
33345
33407
  description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
33346
33408
  type: "module",
33347
33409
  bin: {
@@ -33959,14 +34021,28 @@ async function runPlugins(context, cache2) {
33959
34021
  kt2(message, "Error");
33960
34022
  }
33961
34023
  }
34024
+ async function getPluginSkillsMode(pluginSource, scope, workspacePath) {
34025
+ const effectivePath = scope === "user" ? getHomeDir() : workspacePath;
34026
+ const allSkills = await getAllSkillsFromPlugins(effectivePath);
34027
+ const pluginSkills = allSkills.filter((s) => s.pluginSource === pluginSource);
34028
+ const first2 = pluginSkills[0];
34029
+ if (first2 && first2.pluginSkillsMode === "allowlist") {
34030
+ return "allowlist";
34031
+ }
34032
+ return "blocklist";
34033
+ }
33962
34034
  async function runPluginDetail(pluginKey, context, cache2) {
33963
34035
  const scope = pluginKey.startsWith("project:") ? "project" : "user";
33964
34036
  const pluginSource = pluginKey.replace(/^(project|user):/, "");
33965
34037
  while (true) {
34038
+ const workspacePath = context.workspacePath ?? process.cwd();
34039
+ const currentMode = await getPluginSkillsMode(pluginSource, scope, workspacePath);
34040
+ const autoEnableLabel = currentMode === "allowlist" ? "Auto-enable new skills: OFF" : "Auto-enable new skills: ON";
33966
34041
  const action = await select({
33967
34042
  message: `Plugin: ${pluginSource} [${scope}]`,
33968
34043
  options: [
33969
34044
  { label: "Browse skills", value: "browse" },
34045
+ { label: autoEnableLabel, value: "toggle_auto_enable" },
33970
34046
  { label: "Update", value: "update" },
33971
34047
  { label: "Remove", value: "remove" },
33972
34048
  { label: "Back", value: "back" }
@@ -33979,6 +34055,50 @@ async function runPluginDetail(pluginKey, context, cache2) {
33979
34055
  await runBrowsePluginSkills(pluginSource, scope, context, cache2);
33980
34056
  continue;
33981
34057
  }
34058
+ if (action === "toggle_auto_enable") {
34059
+ const effectivePath = scope === "user" ? getHomeDir() : workspacePath;
34060
+ const allSkills = await getAllSkillsFromPlugins(effectivePath);
34061
+ const pluginSkills = allSkills.filter((s2) => s2.pluginSource === pluginSource);
34062
+ const firstSkill = pluginSkills[0];
34063
+ if (!firstSkill) {
34064
+ kt2("No skills found in this plugin.", "Skills");
34065
+ continue;
34066
+ }
34067
+ const pluginName = firstSkill.pluginName;
34068
+ const s = Ie();
34069
+ if (currentMode === "allowlist") {
34070
+ const disabledNames = pluginSkills.filter((sk) => sk.disabled).map((sk) => sk.name);
34071
+ s.start("Switching to auto-enable...");
34072
+ const result = scope === "user" ? await setUserPluginSkillsMode(pluginName, "blocklist", disabledNames) : await setPluginSkillsMode(pluginName, "blocklist", disabledNames, workspacePath);
34073
+ if (!result.success) {
34074
+ s.stop("Failed");
34075
+ kt2(result.error ?? "Unknown error", "Error");
34076
+ continue;
34077
+ }
34078
+ } else {
34079
+ const enabledNames = pluginSkills.filter((sk) => !sk.disabled).map((sk) => sk.name);
34080
+ s.start("Switching to manual approval...");
34081
+ const result = scope === "user" ? await setUserPluginSkillsMode(pluginName, "allowlist", enabledNames) : await setPluginSkillsMode(pluginName, "allowlist", enabledNames, workspacePath);
34082
+ if (!result.success) {
34083
+ s.stop("Failed");
34084
+ kt2(result.error ?? "Unknown error", "Error");
34085
+ continue;
34086
+ }
34087
+ }
34088
+ s.stop("Mode updated");
34089
+ const syncS = Ie();
34090
+ syncS.start("Syncing...");
34091
+ if (scope === "project" && context.workspacePath) {
34092
+ await syncWorkspace(context.workspacePath);
34093
+ } else {
34094
+ await syncUserWorkspace();
34095
+ }
34096
+ syncS.stop("Sync complete");
34097
+ cache2?.invalidate();
34098
+ const newMode = currentMode === "allowlist" ? "ON" : "OFF";
34099
+ kt2(`Auto-enable new skills: ${newMode}`, "Updated");
34100
+ continue;
34101
+ }
33982
34102
  if (action === "update") {
33983
34103
  await runUpdatePlugin(pluginSource, scope, context, cache2);
33984
34104
  continue;
@@ -34057,18 +34177,34 @@ async function runBrowsePluginSkills(pluginSource, scope, context, cache2) {
34057
34177
  s.start("Updating skills...");
34058
34178
  for (const skill of toDisable) {
34059
34179
  const skillKey = `${skill.pluginName}:${skill.name}`;
34060
- if (scope === "user") {
34061
- await addUserDisabledSkill(skillKey);
34062
- } else if (context.workspacePath) {
34063
- await addDisabledSkill(skillKey, context.workspacePath);
34180
+ if (skill.pluginSkillsMode === "allowlist") {
34181
+ if (scope === "user") {
34182
+ await removeUserEnabledSkill(skillKey);
34183
+ } else if (context.workspacePath) {
34184
+ await removeEnabledSkill(skillKey, context.workspacePath);
34185
+ }
34186
+ } else {
34187
+ if (scope === "user") {
34188
+ await addUserDisabledSkill(skillKey);
34189
+ } else if (context.workspacePath) {
34190
+ await addDisabledSkill(skillKey, context.workspacePath);
34191
+ }
34064
34192
  }
34065
34193
  }
34066
34194
  for (const skill of toEnable) {
34067
34195
  const skillKey = `${skill.pluginName}:${skill.name}`;
34068
- if (scope === "user") {
34069
- await removeUserDisabledSkill(skillKey);
34070
- } else if (context.workspacePath) {
34071
- await removeDisabledSkill(skillKey, context.workspacePath);
34196
+ if (skill.pluginSkillsMode === "allowlist") {
34197
+ if (scope === "user") {
34198
+ await addUserEnabledSkill(skillKey);
34199
+ } else if (context.workspacePath) {
34200
+ await addEnabledSkill(skillKey, context.workspacePath);
34201
+ }
34202
+ } else {
34203
+ if (scope === "user") {
34204
+ await removeUserDisabledSkill(skillKey);
34205
+ } else if (context.workspacePath) {
34206
+ await removeDisabledSkill(skillKey, context.workspacePath);
34207
+ }
34072
34208
  }
34073
34209
  }
34074
34210
  s.stop("Skills updated");
@@ -34584,22 +34720,42 @@ async function runToggleSkills(skills, context, cache2) {
34584
34720
  let changedProject = false;
34585
34721
  let changedUser = false;
34586
34722
  for (const skill of toDisable) {
34587
- if (skill.scope === "user") {
34588
- await addUserDisabledSkill(skill.skillKey);
34723
+ if (skill.pluginSkillsMode === "allowlist") {
34724
+ if (skill.scope === "user") {
34725
+ await removeUserEnabledSkill(skill.skillKey);
34726
+ } else if (context.workspacePath) {
34727
+ await removeEnabledSkill(skill.skillKey, context.workspacePath);
34728
+ }
34729
+ } else {
34730
+ if (skill.scope === "user") {
34731
+ await addUserDisabledSkill(skill.skillKey);
34732
+ } else if (context.workspacePath) {
34733
+ await addDisabledSkill(skill.skillKey, context.workspacePath);
34734
+ }
34735
+ }
34736
+ if (skill.scope === "user")
34589
34737
  changedUser = true;
34590
- } else if (context.workspacePath) {
34591
- await addDisabledSkill(skill.skillKey, context.workspacePath);
34738
+ else
34592
34739
  changedProject = true;
34593
- }
34594
34740
  }
34595
34741
  for (const skill of toEnable) {
34596
- if (skill.scope === "user") {
34597
- await removeUserDisabledSkill(skill.skillKey);
34742
+ if (skill.pluginSkillsMode === "allowlist") {
34743
+ if (skill.scope === "user") {
34744
+ await addUserEnabledSkill(skill.skillKey);
34745
+ } else if (context.workspacePath) {
34746
+ await addEnabledSkill(skill.skillKey, context.workspacePath);
34747
+ }
34748
+ } else {
34749
+ if (skill.scope === "user") {
34750
+ await removeUserDisabledSkill(skill.skillKey);
34751
+ } else if (context.workspacePath) {
34752
+ await removeDisabledSkill(skill.skillKey, context.workspacePath);
34753
+ }
34754
+ }
34755
+ if (skill.scope === "user")
34598
34756
  changedUser = true;
34599
- } else if (context.workspacePath) {
34600
- await removeDisabledSkill(skill.skillKey, context.workspacePath);
34757
+ else
34601
34758
  changedProject = true;
34602
- }
34603
34759
  }
34604
34760
  s.stop("Skills updated");
34605
34761
  const syncS = Ie();
@@ -34659,13 +34815,26 @@ Use "Manage marketplaces" to add one first.`, "Skills");
34659
34815
  }
34660
34816
  options2.push({ label: "Back", value: "__back__" });
34661
34817
  const selected = await select4({
34662
- message: "Select a plugin to install",
34818
+ message: "Select a plugin",
34663
34819
  options: options2
34664
34820
  });
34665
34821
  if (Ct(selected) || selected === "__back__") {
34666
34822
  return;
34667
34823
  }
34668
- await installSelectedPlugin(selected, context, cache2);
34824
+ const workspacePath = context.workspacePath ?? process.cwd();
34825
+ const isInstalledProject = context.workspacePath ? await hasPlugin(selected, workspacePath) : false;
34826
+ const isInstalledUser = await hasUserPlugin(selected);
34827
+ if (isInstalledProject || isInstalledUser) {
34828
+ const scope = isInstalledUser ? "user" : "project";
34829
+ await runBrowsePluginSkills(selected, scope, context, cache2);
34830
+ return;
34831
+ }
34832
+ const installed = await installSelectedPlugin(selected, context, cache2);
34833
+ if (installed) {
34834
+ const nowInstalledUser = await hasUserPlugin(selected);
34835
+ const scope = nowInstalledUser ? "user" : "project";
34836
+ await runBrowsePluginSkills(selected, scope, context, cache2);
34837
+ }
34669
34838
  }
34670
34839
  var multiselect2, select4;
34671
34840
  var init_skills2 = __esm(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allagents",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
5
5
  "type": "module",
6
6
  "bin": {