allagents 0.20.2 → 0.21.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 +252 -88
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28289,6 +28289,72 @@ var init_status2 = __esm(() => {
28289
28289
  init_user_workspace();
28290
28290
  });
28291
28291
 
28292
+ // src/core/skills.ts
28293
+ import { existsSync as existsSync17 } from "node:fs";
28294
+ import { readFile as readFile13, readdir as readdir4 } from "node:fs/promises";
28295
+ import { join as join19, resolve as resolve12 } from "node:path";
28296
+ async function resolvePluginPath(pluginSource, workspacePath) {
28297
+ if (isPluginSpec(pluginSource)) {
28298
+ const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource);
28299
+ return resolved2.success ? resolved2.path ?? null : null;
28300
+ }
28301
+ if (isGitHubUrl(pluginSource)) {
28302
+ const parsed = parseGitHubUrl(pluginSource);
28303
+ const result = await fetchPlugin(pluginSource, {
28304
+ offline: true,
28305
+ ...parsed?.branch && { branch: parsed.branch }
28306
+ });
28307
+ if (!result.success)
28308
+ return null;
28309
+ return parsed?.subpath ? join19(result.cachePath, parsed.subpath) : result.cachePath;
28310
+ }
28311
+ const resolved = resolve12(workspacePath, pluginSource);
28312
+ return existsSync17(resolved) ? resolved : null;
28313
+ }
28314
+ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
28315
+ const configPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28316
+ if (!existsSync17(configPath)) {
28317
+ return [];
28318
+ }
28319
+ const content = await readFile13(configPath, "utf-8");
28320
+ const config = load(content);
28321
+ const disabledSkills = new Set(config.disabledSkills ?? []);
28322
+ const skills = [];
28323
+ for (const pluginSource of config.plugins) {
28324
+ const pluginPath = await resolvePluginPath(pluginSource, workspacePath);
28325
+ if (!pluginPath)
28326
+ continue;
28327
+ const pluginName = await getPluginName(pluginPath);
28328
+ const skillsDir = join19(pluginPath, "skills");
28329
+ if (!existsSync17(skillsDir))
28330
+ continue;
28331
+ const entries = await readdir4(skillsDir, { withFileTypes: true });
28332
+ const skillDirs = entries.filter((e) => e.isDirectory());
28333
+ for (const entry of skillDirs) {
28334
+ const skillKey = `${pluginName}:${entry.name}`;
28335
+ skills.push({
28336
+ name: entry.name,
28337
+ pluginName,
28338
+ pluginSource,
28339
+ path: join19(skillsDir, entry.name),
28340
+ disabled: disabledSkills.has(skillKey)
28341
+ });
28342
+ }
28343
+ }
28344
+ return skills;
28345
+ }
28346
+ async function findSkillByName(skillName, workspacePath = process.cwd()) {
28347
+ const allSkills = await getAllSkillsFromPlugins(workspacePath);
28348
+ return allSkills.filter((s) => s.name === skillName);
28349
+ }
28350
+ var init_skills = __esm(() => {
28351
+ init_js_yaml();
28352
+ init_constants();
28353
+ init_plugin();
28354
+ init_plugin_path();
28355
+ init_marketplace();
28356
+ });
28357
+
28292
28358
  // node_modules/isexe/windows.js
28293
28359
  var require_windows = __commonJS((exports, module) => {
28294
28360
  module.exports = isexe;
@@ -30306,7 +30372,7 @@ var package_default;
30306
30372
  var init_package = __esm(() => {
30307
30373
  package_default = {
30308
30374
  name: "allagents",
30309
- version: "0.20.2",
30375
+ version: "0.21.0",
30310
30376
  description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
30311
30377
  type: "module",
30312
30378
  bin: {
@@ -30376,10 +30442,10 @@ var init_package = __esm(() => {
30376
30442
 
30377
30443
  // src/cli/update-check.ts
30378
30444
  import { readFile as readFile14 } from "node:fs/promises";
30379
- import { join as join20 } from "node:path";
30445
+ import { join as join21 } from "node:path";
30380
30446
  import { spawn as spawn2 } from "node:child_process";
30381
30447
  async function getCachedUpdateInfo(path3) {
30382
- const filePath = path3 ?? join20(getHomeDir(), CONFIG_DIR, CACHE_FILE);
30448
+ const filePath = path3 ?? join21(getHomeDir(), CONFIG_DIR, CACHE_FILE);
30383
30449
  try {
30384
30450
  const raw = await readFile14(filePath, "utf-8");
30385
30451
  const data = JSON.parse(raw);
@@ -30417,8 +30483,8 @@ function buildNotice(currentVersion, latestVersion) {
30417
30483
  Run \`allagents self update\` to upgrade.`;
30418
30484
  }
30419
30485
  function backgroundUpdateCheck() {
30420
- const dir = join20(getHomeDir(), CONFIG_DIR);
30421
- const filePath = join20(dir, CACHE_FILE);
30486
+ const dir = join21(getHomeDir(), CONFIG_DIR);
30487
+ const filePath = join21(dir, CACHE_FILE);
30422
30488
  const script = `
30423
30489
  const https = require('https');
30424
30490
  const fs = require('fs');
@@ -32254,15 +32320,15 @@ class TuiCache {
32254
32320
  }
32255
32321
 
32256
32322
  // src/cli/tui/context.ts
32257
- import { existsSync as existsSync18 } from "node:fs";
32258
- import { join as join21 } from "node:path";
32323
+ import { existsSync as existsSync19 } from "node:fs";
32324
+ import { join as join22 } from "node:path";
32259
32325
  async function getTuiContext(cwd = process.cwd(), cache2) {
32260
32326
  const cachedContext = cache2?.getContext();
32261
32327
  if (cachedContext) {
32262
32328
  return cachedContext;
32263
32329
  }
32264
- const configPath = join21(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
32265
- const hasWorkspace = existsSync18(configPath) && !isUserConfigPath(cwd);
32330
+ const configPath = join22(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
32331
+ const hasWorkspace = existsSync19(configPath) && !isUserConfigPath(cwd);
32266
32332
  let projectPluginCount = 0;
32267
32333
  if (hasWorkspace) {
32268
32334
  try {
@@ -32861,6 +32927,123 @@ var init_clients = __esm(() => {
32861
32927
  ({ multiselect: multiselect3 } = exports_dist);
32862
32928
  });
32863
32929
 
32930
+ // src/cli/tui/actions/skills.ts
32931
+ async function loadAllSkills(context) {
32932
+ const skills = [];
32933
+ const userSkills = await getAllSkillsFromPlugins(getHomeDir());
32934
+ const userKeys = new Set;
32935
+ for (const s of userSkills) {
32936
+ const skillKey = `${s.pluginName}:${s.name}`;
32937
+ userKeys.add(skillKey);
32938
+ skills.push({
32939
+ ...s,
32940
+ scope: "user",
32941
+ key: `user:${skillKey}`,
32942
+ skillKey
32943
+ });
32944
+ }
32945
+ if (context.workspacePath && !isUserConfigPath(context.workspacePath)) {
32946
+ const projectSkills = await getAllSkillsFromPlugins(context.workspacePath);
32947
+ for (const s of projectSkills) {
32948
+ const skillKey = `${s.pluginName}:${s.name}`;
32949
+ if (userKeys.has(skillKey))
32950
+ continue;
32951
+ skills.push({
32952
+ ...s,
32953
+ scope: "project",
32954
+ key: `project:${skillKey}`,
32955
+ skillKey
32956
+ });
32957
+ }
32958
+ }
32959
+ return skills;
32960
+ }
32961
+ async function runManageSkills(context, cache2) {
32962
+ try {
32963
+ const skills = await loadAllSkills(context);
32964
+ if (skills.length === 0) {
32965
+ kt2("No skills found. Install a plugin with skills first.", "Skills");
32966
+ return;
32967
+ }
32968
+ const options2 = skills.map((s2) => ({
32969
+ label: `${s2.name} (${s2.pluginName}) [${s2.scope}]`,
32970
+ value: s2.key
32971
+ }));
32972
+ const initialValues = skills.filter((s2) => !s2.disabled).map((s2) => s2.key);
32973
+ const selected = await multiselect4({
32974
+ message: "Toggle skills (selected = enabled)",
32975
+ options: options2,
32976
+ initialValues,
32977
+ required: false
32978
+ });
32979
+ if (Ct(selected)) {
32980
+ return;
32981
+ }
32982
+ const selectedSet = new Set(selected);
32983
+ const toDisable = skills.filter((s2) => !s2.disabled && !selectedSet.has(s2.key));
32984
+ const toEnable = skills.filter((s2) => s2.disabled && selectedSet.has(s2.key));
32985
+ if (toDisable.length === 0 && toEnable.length === 0) {
32986
+ kt2("No changes made.", "Skills");
32987
+ return;
32988
+ }
32989
+ const s = Ie();
32990
+ s.start("Updating skills...");
32991
+ let changedProject = false;
32992
+ let changedUser = false;
32993
+ for (const skill of toDisable) {
32994
+ if (skill.scope === "user") {
32995
+ await addUserDisabledSkill(skill.skillKey);
32996
+ changedUser = true;
32997
+ } else if (context.workspacePath) {
32998
+ await addDisabledSkill(skill.skillKey, context.workspacePath);
32999
+ changedProject = true;
33000
+ }
33001
+ }
33002
+ for (const skill of toEnable) {
33003
+ if (skill.scope === "user") {
33004
+ await removeUserDisabledSkill(skill.skillKey);
33005
+ changedUser = true;
33006
+ } else if (context.workspacePath) {
33007
+ await removeDisabledSkill(skill.skillKey, context.workspacePath);
33008
+ changedProject = true;
33009
+ }
33010
+ }
33011
+ s.stop("Skills updated");
33012
+ const syncS = Ie();
33013
+ syncS.start("Syncing...");
33014
+ if (changedProject && context.workspacePath) {
33015
+ await syncWorkspace(context.workspacePath);
33016
+ }
33017
+ if (changedUser) {
33018
+ await syncUserWorkspace();
33019
+ }
33020
+ syncS.stop("Sync complete");
33021
+ cache2?.invalidate();
33022
+ const changes = [];
33023
+ for (const skill of toEnable) {
33024
+ changes.push(`✓ Enabled: ${skill.name} (${skill.pluginName}) [${skill.scope}]`);
33025
+ }
33026
+ for (const skill of toDisable) {
33027
+ changes.push(`✗ Disabled: ${skill.name} (${skill.pluginName}) [${skill.scope}]`);
33028
+ }
33029
+ kt2(changes.join(`
33030
+ `), "Updated");
33031
+ } catch (error) {
33032
+ const message = error instanceof Error ? error.message : String(error);
33033
+ kt2(message, "Error");
33034
+ }
33035
+ }
33036
+ var multiselect4;
33037
+ var init_skills2 = __esm(() => {
33038
+ init_dist2();
33039
+ init_skills();
33040
+ init_workspace_modify();
33041
+ init_user_workspace();
33042
+ init_sync();
33043
+ init_constants();
33044
+ ({ multiselect: multiselect4 } = exports_dist);
33045
+ });
33046
+
32864
33047
  // src/cli/tui/actions/update.ts
32865
33048
  async function runUpdate() {
32866
33049
  try {
@@ -32916,12 +33099,14 @@ function buildMenuOptions(context) {
32916
33099
  options2.push({ label: "Install plugin", value: "install" });
32917
33100
  options2.push({ label: "Manage plugins", value: "manage" });
32918
33101
  options2.push({ label: "Manage clients", value: "manage-clients" });
33102
+ options2.push({ label: "Manage skills", value: "manage-skills" });
32919
33103
  options2.push({ label: "Manage marketplaces", value: "marketplace" });
32920
33104
  } else {
32921
33105
  options2.push({ label: "View status", value: "status" });
32922
33106
  options2.push({ label: "Install plugin", value: "install" });
32923
33107
  options2.push({ label: "Manage plugins", value: "manage" });
32924
33108
  options2.push({ label: "Manage clients", value: "manage-clients" });
33109
+ options2.push({ label: "Manage skills", value: "manage-skills" });
32925
33110
  options2.push({ label: "Manage marketplaces", value: "marketplace" });
32926
33111
  options2.push({ label: "Check for updates", value: "update" });
32927
33112
  }
@@ -32986,6 +33171,9 @@ async function runWizard() {
32986
33171
  case "manage-clients":
32987
33172
  await runManageClients(context, cache2);
32988
33173
  break;
33174
+ case "manage-skills":
33175
+ await runManageSkills(context, cache2);
33176
+ break;
32989
33177
  case "marketplace":
32990
33178
  await runBrowseMarketplaces(context, cache2);
32991
33179
  break;
@@ -33012,6 +33200,7 @@ var init_wizard = __esm(() => {
33012
33200
  init_status3();
33013
33201
  init_plugins();
33014
33202
  init_clients();
33203
+ init_skills2();
33015
33204
  init_update();
33016
33205
  init_update_check();
33017
33206
  ({ select: select2 } = exports_dist);
@@ -33960,74 +34149,14 @@ var pluginUninstallMeta = {
33960
34149
  };
33961
34150
 
33962
34151
  // src/cli/commands/plugin-skills.ts
34152
+ init_source();
33963
34153
  init_sync();
33964
34154
  init_workspace_modify();
33965
34155
  init_user_workspace();
34156
+ init_skills();
33966
34157
  var import_cmd_ts3 = __toESM(require_cjs(), 1);
33967
-
33968
- // src/core/skills.ts
33969
- init_js_yaml();
33970
- init_constants();
33971
- init_plugin();
33972
- init_plugin_path();
33973
- init_marketplace();
33974
- import { existsSync as existsSync17 } from "node:fs";
33975
- import { readFile as readFile13, readdir as readdir4 } from "node:fs/promises";
33976
- import { join as join19, resolve as resolve12 } from "node:path";
33977
- async function resolvePluginPath(pluginSource, workspacePath) {
33978
- if (isPluginSpec(pluginSource)) {
33979
- const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource);
33980
- return resolved2.success ? resolved2.path ?? null : null;
33981
- }
33982
- if (isGitHubUrl(pluginSource)) {
33983
- const parsed = parseGitHubUrl(pluginSource);
33984
- const result = await fetchPlugin(pluginSource, {
33985
- offline: true,
33986
- ...parsed?.branch && { branch: parsed.branch }
33987
- });
33988
- if (!result.success)
33989
- return null;
33990
- return parsed?.subpath ? join19(result.cachePath, parsed.subpath) : result.cachePath;
33991
- }
33992
- const resolved = resolve12(workspacePath, pluginSource);
33993
- return existsSync17(resolved) ? resolved : null;
33994
- }
33995
- async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
33996
- const configPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
33997
- if (!existsSync17(configPath)) {
33998
- return [];
33999
- }
34000
- const content = await readFile13(configPath, "utf-8");
34001
- const config = load(content);
34002
- const disabledSkills = new Set(config.disabledSkills ?? []);
34003
- const skills = [];
34004
- for (const pluginSource of config.plugins) {
34005
- const pluginPath = await resolvePluginPath(pluginSource, workspacePath);
34006
- if (!pluginPath)
34007
- continue;
34008
- const pluginName = await getPluginName(pluginPath);
34009
- const skillsDir = join19(pluginPath, "skills");
34010
- if (!existsSync17(skillsDir))
34011
- continue;
34012
- const entries = await readdir4(skillsDir, { withFileTypes: true });
34013
- const skillDirs = entries.filter((e) => e.isDirectory());
34014
- for (const entry of skillDirs) {
34015
- const skillKey = `${pluginName}:${entry.name}`;
34016
- skills.push({
34017
- name: entry.name,
34018
- pluginName,
34019
- pluginSource,
34020
- path: join19(skillsDir, entry.name),
34021
- disabled: disabledSkills.has(skillKey)
34022
- });
34023
- }
34024
- }
34025
- return skills;
34026
- }
34027
- async function findSkillByName(skillName, workspacePath = process.cwd()) {
34028
- const allSkills = await getAllSkillsFromPlugins(workspacePath);
34029
- return allSkills.filter((s) => s.name === skillName);
34030
- }
34158
+ import { existsSync as existsSync18 } from "node:fs";
34159
+ import { join as join20 } from "node:path";
34031
34160
 
34032
34161
  // src/cli/metadata/plugin-skills.ts
34033
34162
  var skillsListMeta = {
@@ -34094,6 +34223,16 @@ var skillsAddMeta = {
34094
34223
 
34095
34224
  // src/cli/commands/plugin-skills.ts
34096
34225
  init_constants();
34226
+ function hasProjectConfig(dir) {
34227
+ return existsSync18(join20(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
34228
+ }
34229
+ function resolveScope(cwd) {
34230
+ if (isUserConfigPath(cwd))
34231
+ return "user";
34232
+ if (hasProjectConfig(cwd))
34233
+ return "project";
34234
+ return "user";
34235
+ }
34097
34236
  function groupSkillsByPlugin(skills) {
34098
34237
  const grouped = new Map;
34099
34238
  for (const skill of skills) {
@@ -34122,16 +34261,23 @@ var listCmd = import_cmd_ts3.command({
34122
34261
  },
34123
34262
  handler: async ({ scope }) => {
34124
34263
  try {
34125
- const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
34126
- const workspacePath = isUser ? getHomeDir() : process.cwd();
34127
- const skills = await getAllSkillsFromPlugins(workspacePath);
34264
+ const cwd = process.cwd();
34265
+ const inProjectDir = !isUserConfigPath(cwd) && hasProjectConfig(cwd);
34266
+ const showUser = scope !== "project";
34267
+ const showProject = scope === "project" || !scope && inProjectDir;
34268
+ const userSkills = showUser ? await getAllSkillsFromPlugins(getHomeDir()) : [];
34269
+ const projectSkills = showProject ? await getAllSkillsFromPlugins(cwd) : [];
34270
+ const userKeys = new Set(userSkills.map((s) => `${s.pluginName}:${s.name}`));
34271
+ const dedupedProjectSkills = projectSkills.filter((s) => !userKeys.has(`${s.pluginName}:${s.name}`));
34128
34272
  if (isJsonMode()) {
34273
+ const effectiveScope = scope === "user" ? "user" : scope === "project" ? "project" : "all";
34274
+ const allSkills = [...userSkills, ...dedupedProjectSkills];
34129
34275
  jsonOutput({
34130
34276
  success: true,
34131
34277
  command: "plugin skills list",
34132
34278
  data: {
34133
- scope: isUser ? "user" : "project",
34134
- skills: skills.map((s) => ({
34279
+ scope: effectiveScope,
34280
+ skills: allSkills.map((s) => ({
34135
34281
  name: s.name,
34136
34282
  plugin: s.pluginName,
34137
34283
  disabled: s.disabled
@@ -34140,19 +34286,37 @@ var listCmd = import_cmd_ts3.command({
34140
34286
  });
34141
34287
  return;
34142
34288
  }
34143
- if (skills.length === 0) {
34289
+ if (userSkills.length === 0 && dedupedProjectSkills.length === 0) {
34144
34290
  console.log("No skills found. Install a plugin first with:");
34145
34291
  console.log(" allagents plugin install <plugin>");
34146
34292
  return;
34147
34293
  }
34148
- const grouped = groupSkillsByPlugin(skills);
34149
- for (const [pluginName, data] of grouped) {
34294
+ if (userSkills.length > 0 && scope !== "project") {
34295
+ console.log(`
34296
+ ${source_default.whiteBright("User Skills:")}`);
34297
+ const grouped = groupSkillsByPlugin(userSkills);
34298
+ for (const [pluginName, data] of grouped) {
34299
+ console.log(`
34300
+ ${source_default.hex("#89b4fa")(pluginName)} (${data.source}):`);
34301
+ for (const skill of data.skills) {
34302
+ const icon = skill.disabled ? "✗" : "✓";
34303
+ const status = skill.disabled ? " (disabled)" : "";
34304
+ console.log(` ${icon} ${skill.name}${status}`);
34305
+ }
34306
+ }
34307
+ }
34308
+ if (dedupedProjectSkills.length > 0) {
34150
34309
  console.log(`
34151
- ${pluginName} (${data.source}):`);
34152
- for (const skill of data.skills) {
34153
- const icon = skill.disabled ? "✗" : "✓";
34154
- const status = skill.disabled ? " (disabled)" : "";
34155
- console.log(` ${icon} ${skill.name}${status}`);
34310
+ ${source_default.whiteBright("Project Skills:")}`);
34311
+ const grouped = groupSkillsByPlugin(dedupedProjectSkills);
34312
+ for (const [pluginName, data] of grouped) {
34313
+ console.log(`
34314
+ ${source_default.hex("#89b4fa")(pluginName)} (${data.source}):`);
34315
+ for (const skill of data.skills) {
34316
+ const icon = skill.disabled ? "✗" : "✓";
34317
+ const status = skill.disabled ? " (disabled)" : "";
34318
+ console.log(` ${icon} ${skill.name}${status}`);
34319
+ }
34156
34320
  }
34157
34321
  }
34158
34322
  console.log();
@@ -34189,7 +34353,7 @@ var removeCmd = import_cmd_ts3.command({
34189
34353
  },
34190
34354
  handler: async ({ skill, scope, plugin }) => {
34191
34355
  try {
34192
- const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
34356
+ const isUser = scope === "user" || !scope && resolveScope(process.cwd()) === "user";
34193
34357
  const workspacePath = isUser ? getHomeDir() : process.cwd();
34194
34358
  const matches = await findSkillByName(skill, workspacePath);
34195
34359
  if (matches.length === 0) {
@@ -34313,7 +34477,7 @@ var addCmd = import_cmd_ts3.command({
34313
34477
  },
34314
34478
  handler: async ({ skill, scope, plugin }) => {
34315
34479
  try {
34316
- const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
34480
+ const isUser = scope === "user" || !scope && resolveScope(process.cwd()) === "user";
34317
34481
  const workspacePath = isUser ? getHomeDir() : process.cwd();
34318
34482
  const matches = await findSkillByName(skill, workspacePath);
34319
34483
  if (matches.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allagents",
3
- "version": "0.20.2",
3
+ "version": "0.21.0",
4
4
  "description": "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
5
5
  "type": "module",
6
6
  "bin": {