allagents 0.8.2 → 0.8.4

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 (3) hide show
  1. package/README.md +8 -8
  2. package/dist/index.js +361 -334
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -67,8 +67,8 @@ allagents workspace init my-workspace --from owner/repo/path/to/template
67
67
  allagents plugin marketplace add anthropics/claude-plugins-official
68
68
 
69
69
  # Install plugins to workspace
70
- allagents workspace plugin install code-review@claude-plugins-official
71
- allagents workspace plugin install my-plugin@someuser/their-repo
70
+ allagents plugin install code-review@claude-plugins-official
71
+ allagents plugin install my-plugin@someuser/their-repo
72
72
 
73
73
  # Sync plugins to workspace
74
74
  allagents workspace sync
@@ -112,12 +112,6 @@ allagents workspace sync [options]
112
112
 
113
113
  # Show status of workspace and plugins
114
114
  allagents workspace status
115
-
116
- # Install a plugin to .allagents/workspace.yaml (auto-registers marketplace if needed)
117
- allagents workspace plugin install <plugin@marketplace>
118
-
119
- # Remove a plugin from .allagents/workspace.yaml
120
- allagents workspace plugin remove <plugin>
121
115
  ```
122
116
 
123
117
  ### Plugin Marketplace Commands
@@ -142,6 +136,12 @@ allagents plugin marketplace update [name]
142
136
  ### Plugin Commands
143
137
 
144
138
  ```bash
139
+ # Install a plugin to .allagents/workspace.yaml (auto-registers marketplace if needed)
140
+ allagents plugin install <plugin@marketplace>
141
+
142
+ # Remove a plugin from .allagents/workspace.yaml
143
+ allagents plugin uninstall <plugin>
144
+
145
145
  # List available plugins from marketplaces
146
146
  allagents plugin list [marketplace]
147
147
 
package/dist/index.js CHANGED
@@ -22743,26 +22743,42 @@ async function resolvePluginSpec(spec, options2 = {}) {
22743
22743
  return null;
22744
22744
  }
22745
22745
  const marketplaceName = options2.marketplaceNameOverride ?? parsed.marketplaceName;
22746
- const marketplace = await getMarketplace(marketplaceName);
22747
- if (!marketplace) {
22748
- 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;
22749
22753
  }
22750
- const manifestResult = await parseMarketplaceManifest(marketplace.path);
22754
+ const manifestResult = await parseMarketplaceManifest(marketplacePath);
22751
22755
  if (manifestResult.success) {
22752
22756
  const pluginEntry = manifestResult.data.plugins.find((p) => p.name === parsed.plugin);
22753
22757
  if (pluginEntry) {
22754
- const resolvedSource = typeof pluginEntry.source === "string" ? resolve4(marketplace.path, pluginEntry.source) : pluginEntry.source.url;
22755
- if (typeof resolvedSource === "string" && existsSync5(resolvedSource)) {
22756
- return {
22757
- path: resolvedSource,
22758
- marketplace: marketplaceName,
22759
- plugin: parsed.plugin
22760
- };
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
+ }
22761
22777
  }
22762
22778
  }
22763
22779
  }
22764
22780
  const subpath = options2.subpath ?? parsed.subpath ?? "plugins";
22765
- const pluginPath = join6(marketplace.path, subpath, parsed.plugin);
22781
+ const pluginPath = join6(marketplacePath, subpath, parsed.plugin);
22766
22782
  if (!existsSync5(pluginPath)) {
22767
22783
  return null;
22768
22784
  }
@@ -23799,113 +23815,6 @@ async function getMarketplacePluginStatus(spec) {
23799
23815
  };
23800
23816
  }
23801
23817
 
23802
- // src/core/workspace-modify.ts
23803
- import { readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
23804
- import { existsSync as existsSync10 } from "node:fs";
23805
- import { join as join11 } from "node:path";
23806
- async function addPlugin(plugin, workspacePath = process.cwd()) {
23807
- const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
23808
- if (!existsSync10(configPath)) {
23809
- return {
23810
- success: false,
23811
- error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
23812
- Run 'allagents workspace init <path>' to create a new workspace`
23813
- };
23814
- }
23815
- if (isPluginSpec(plugin)) {
23816
- const resolved = await resolvePluginSpecWithAutoRegister(plugin);
23817
- if (!resolved.success) {
23818
- return {
23819
- success: false,
23820
- error: resolved.error || "Unknown error"
23821
- };
23822
- }
23823
- return await addPluginToConfig(resolved.registeredAs ? plugin.replace(/@[^@]+$/, `@${resolved.registeredAs}`) : plugin, configPath, resolved.registeredAs);
23824
- }
23825
- if (isGitHubUrl(plugin)) {
23826
- const validation = validatePluginSource(plugin);
23827
- if (!validation.valid) {
23828
- return {
23829
- success: false,
23830
- error: validation.error || "Invalid GitHub URL"
23831
- };
23832
- }
23833
- const verifyResult = await verifyGitHubUrlExists(plugin);
23834
- if (!verifyResult.exists) {
23835
- return {
23836
- success: false,
23837
- error: verifyResult.error || `GitHub URL not found: ${plugin}`
23838
- };
23839
- }
23840
- } else {
23841
- const fullPath = join11(workspacePath, plugin);
23842
- if (!existsSync10(fullPath) && !existsSync10(plugin)) {
23843
- return {
23844
- success: false,
23845
- error: `Plugin not found at ${plugin}`
23846
- };
23847
- }
23848
- }
23849
- return await addPluginToConfig(plugin, configPath);
23850
- }
23851
- async function addPluginToConfig(plugin, configPath, autoRegistered) {
23852
- try {
23853
- const content = await readFile9(configPath, "utf-8");
23854
- const config = load(content);
23855
- if (config.plugins.includes(plugin)) {
23856
- return {
23857
- success: false,
23858
- error: `Plugin already exists in .allagents/workspace.yaml: ${plugin}`
23859
- };
23860
- }
23861
- config.plugins.push(plugin);
23862
- const newContent = dump(config, { lineWidth: -1 });
23863
- await writeFile5(configPath, newContent, "utf-8");
23864
- return {
23865
- success: true,
23866
- ...autoRegistered && { autoRegistered }
23867
- };
23868
- } catch (error) {
23869
- return {
23870
- success: false,
23871
- error: error instanceof Error ? error.message : String(error)
23872
- };
23873
- }
23874
- }
23875
- async function removePlugin(plugin, workspacePath = process.cwd()) {
23876
- const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
23877
- if (!existsSync10(configPath)) {
23878
- return {
23879
- success: false,
23880
- error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
23881
- Run 'allagents workspace init <path>' to create a new workspace`
23882
- };
23883
- }
23884
- try {
23885
- const content = await readFile9(configPath, "utf-8");
23886
- const config = load(content);
23887
- let index = config.plugins.indexOf(plugin);
23888
- if (index === -1 && isPluginSpec(plugin) === false) {
23889
- index = config.plugins.findIndex((p) => p.startsWith(`${plugin}@`) || p === plugin);
23890
- }
23891
- if (index === -1) {
23892
- return {
23893
- success: false,
23894
- error: `Plugin not found in .allagents/workspace.yaml: ${plugin}`
23895
- };
23896
- }
23897
- config.plugins.splice(index, 1);
23898
- const newContent = dump(config, { lineWidth: -1 });
23899
- await writeFile5(configPath, newContent, "utf-8");
23900
- return { success: true };
23901
- } catch (error) {
23902
- return {
23903
- success: false,
23904
- error: error instanceof Error ? error.message : String(error)
23905
- };
23906
- }
23907
- }
23908
-
23909
23818
  // src/cli/json-output.ts
23910
23819
  var jsonMode = false;
23911
23820
  function isJsonMode() {
@@ -24008,54 +23917,6 @@ var statusMeta = {
24008
23917
  clients: ["string"]
24009
23918
  }
24010
23919
  };
24011
- var pluginInstallMeta = {
24012
- command: "workspace plugin install",
24013
- description: "Install plugin to .allagents/workspace.yaml (supports plugin@marketplace, GitHub URL, or local path)",
24014
- whenToUse: "To add a new plugin to your workspace and immediately sync it",
24015
- examples: [
24016
- "allagents workspace plugin install my-plugin@official",
24017
- "allagents workspace plugin install https://github.com/user/plugin",
24018
- "allagents workspace plugin install ../local-plugin"
24019
- ],
24020
- expectedOutput: "Confirms the plugin was added, then runs sync. Shows sync results. Exit 0 on success, exit 1 on failure.",
24021
- positionals: [
24022
- { name: "plugin", type: "string", required: true, description: "Plugin identifier (plugin@marketplace, GitHub URL, or local path)" }
24023
- ],
24024
- outputSchema: {
24025
- plugin: "string",
24026
- autoRegistered: "string | null",
24027
- syncResult: {
24028
- copied: "number",
24029
- generated: "number",
24030
- failed: "number",
24031
- skipped: "number",
24032
- plugins: [{ plugin: "string", success: "boolean", copied: "number", generated: "number", failed: "number" }]
24033
- }
24034
- }
24035
- };
24036
- var pluginUninstallMeta = {
24037
- command: "workspace plugin uninstall",
24038
- description: "Uninstall plugin from .allagents/workspace.yaml",
24039
- whenToUse: "To remove a plugin from your workspace config and re-sync",
24040
- examples: [
24041
- "allagents workspace plugin uninstall my-plugin@official",
24042
- "allagents workspace plugin uninstall https://github.com/user/plugin"
24043
- ],
24044
- expectedOutput: "Confirms the plugin was removed, then runs sync to clean up. Exit 0 on success, exit 1 on failure.",
24045
- positionals: [
24046
- { name: "plugin", type: "string", required: true, description: "Plugin identifier to uninstall" }
24047
- ],
24048
- outputSchema: {
24049
- plugin: "string",
24050
- syncResult: {
24051
- copied: "number",
24052
- generated: "number",
24053
- failed: "number",
24054
- skipped: "number",
24055
- plugins: [{ plugin: "string", success: "boolean", copied: "number", generated: "number", failed: "number" }]
24056
- }
24057
- }
24058
- };
24059
23920
 
24060
23921
  // src/cli/commands/workspace.ts
24061
23922
  function buildSyncData(result) {
@@ -24076,56 +23937,6 @@ function buildSyncData(result) {
24076
23937
  purgedPaths: result.purgedPaths ?? []
24077
23938
  };
24078
23939
  }
24079
- async function runSyncAndPrint() {
24080
- if (!isJsonMode()) {
24081
- console.log(`
24082
- Syncing workspace...
24083
- `);
24084
- }
24085
- const result = await syncWorkspace();
24086
- if (!result.success && result.error) {
24087
- if (!isJsonMode()) {
24088
- console.error(`Sync error: ${result.error}`);
24089
- }
24090
- return { ok: false, syncData: null };
24091
- }
24092
- const syncData = buildSyncData(result);
24093
- if (!isJsonMode()) {
24094
- for (const pluginResult of result.pluginResults) {
24095
- const status = pluginResult.success ? "✓" : "✗";
24096
- console.log(`${status} Plugin: ${pluginResult.plugin}`);
24097
- if (pluginResult.error) {
24098
- console.log(` Error: ${pluginResult.error}`);
24099
- }
24100
- const copied = pluginResult.copyResults.filter((r) => r.action === "copied").length;
24101
- const generated = pluginResult.copyResults.filter((r) => r.action === "generated").length;
24102
- const failed = pluginResult.copyResults.filter((r) => r.action === "failed").length;
24103
- if (copied > 0)
24104
- console.log(` Copied: ${copied} files`);
24105
- if (generated > 0)
24106
- console.log(` Generated: ${generated} files`);
24107
- if (failed > 0) {
24108
- console.log(` Failed: ${failed} files`);
24109
- for (const failedResult of pluginResult.copyResults.filter((r) => r.action === "failed")) {
24110
- console.log(` - ${failedResult.destination}: ${failedResult.error}`);
24111
- }
24112
- }
24113
- }
24114
- console.log(`
24115
- Sync complete:`);
24116
- console.log(` Total copied: ${result.totalCopied}`);
24117
- if (result.totalGenerated > 0) {
24118
- console.log(` Total generated: ${result.totalGenerated}`);
24119
- }
24120
- if (result.totalFailed > 0) {
24121
- console.log(` Total failed: ${result.totalFailed}`);
24122
- }
24123
- if (result.totalSkipped > 0) {
24124
- console.log(` Total skipped: ${result.totalSkipped}`);
24125
- }
24126
- }
24127
- return { ok: result.success && result.totalFailed === 0, syncData };
24128
- }
24129
23940
  var initCmd = import_cmd_ts.command({
24130
23941
  name: "init",
24131
23942
  description: buildDescription(initMeta),
@@ -24347,135 +24158,126 @@ Clients (${result.clients.length}):`);
24347
24158
  }
24348
24159
  }
24349
24160
  });
24350
- var pluginInstallCmd = import_cmd_ts.command({
24351
- name: "install",
24352
- description: buildDescription(pluginInstallMeta),
24353
- args: {
24354
- plugin: import_cmd_ts.positional({ type: import_cmd_ts.string, displayName: "plugin" })
24355
- },
24356
- handler: async ({ plugin }) => {
24357
- try {
24358
- const result = await addPlugin(plugin);
24359
- if (!result.success) {
24360
- if (isJsonMode()) {
24361
- jsonOutput({ success: false, command: "workspace plugin install", error: result.error ?? "Unknown error" });
24362
- process.exit(1);
24363
- }
24364
- console.error(`Error: ${result.error}`);
24365
- process.exit(1);
24366
- }
24367
- if (isJsonMode()) {
24368
- const { ok, syncData } = await runSyncAndPrint();
24369
- jsonOutput({
24370
- success: ok,
24371
- command: "workspace plugin install",
24372
- data: {
24373
- plugin,
24374
- autoRegistered: result.autoRegistered ?? null,
24375
- syncResult: syncData
24376
- },
24377
- ...!ok && { error: "Sync completed with failures" }
24378
- });
24379
- if (!ok) {
24380
- process.exit(1);
24381
- }
24382
- return;
24383
- }
24384
- if (result.autoRegistered) {
24385
- console.log(`✓ Auto-registered marketplace: ${result.autoRegistered}`);
24386
- }
24387
- console.log(`✓ Installed plugin: ${plugin}`);
24388
- const { ok: syncOk } = await runSyncAndPrint();
24389
- if (!syncOk) {
24390
- process.exit(1);
24391
- }
24392
- } catch (error) {
24393
- if (error instanceof Error) {
24394
- if (isJsonMode()) {
24395
- jsonOutput({ success: false, command: "workspace plugin install", error: error.message });
24396
- process.exit(1);
24397
- }
24398
- console.error(`Error: ${error.message}`);
24399
- process.exit(1);
24400
- }
24401
- throw error;
24402
- }
24403
- }
24404
- });
24405
- var pluginUninstallCmd = import_cmd_ts.command({
24406
- name: "uninstall",
24407
- description: buildDescription(pluginUninstallMeta),
24408
- aliases: ["remove"],
24409
- args: {
24410
- plugin: import_cmd_ts.positional({ type: import_cmd_ts.string, displayName: "plugin" })
24411
- },
24412
- handler: async ({ plugin }) => {
24413
- try {
24414
- const result = await removePlugin(plugin);
24415
- if (!result.success) {
24416
- if (isJsonMode()) {
24417
- jsonOutput({ success: false, command: "workspace plugin uninstall", error: result.error ?? "Unknown error" });
24418
- process.exit(1);
24419
- }
24420
- console.error(`Error: ${result.error}`);
24421
- process.exit(1);
24422
- }
24423
- if (isJsonMode()) {
24424
- const { ok, syncData } = await runSyncAndPrint();
24425
- jsonOutput({
24426
- success: ok,
24427
- command: "workspace plugin uninstall",
24428
- data: {
24429
- plugin,
24430
- syncResult: syncData
24431
- },
24432
- ...!ok && { error: "Sync completed with failures" }
24433
- });
24434
- if (!ok) {
24435
- process.exit(1);
24436
- }
24437
- return;
24438
- }
24439
- console.log(`✓ Uninstalled plugin: ${plugin}`);
24440
- const { ok: syncOk } = await runSyncAndPrint();
24441
- if (!syncOk) {
24442
- process.exit(1);
24443
- }
24444
- } catch (error) {
24445
- if (error instanceof Error) {
24446
- if (isJsonMode()) {
24447
- jsonOutput({ success: false, command: "workspace plugin uninstall", error: error.message });
24448
- process.exit(1);
24449
- }
24450
- console.error(`Error: ${error.message}`);
24451
- process.exit(1);
24452
- }
24453
- throw error;
24454
- }
24455
- }
24456
- });
24457
- var workspacePluginCmd = import_cmd_ts.subcommands({
24458
- name: "plugin",
24459
- description: "Manage plugins in .allagents/workspace.yaml",
24460
- cmds: {
24461
- install: pluginInstallCmd,
24462
- uninstall: pluginUninstallCmd
24463
- }
24464
- });
24465
24161
  var workspaceCmd = import_cmd_ts.subcommands({
24466
24162
  name: "workspace",
24467
24163
  description: "Manage AI agent workspaces - initialize, sync, and configure plugins",
24468
24164
  cmds: {
24469
24165
  init: initCmd,
24470
24166
  sync: syncCmd,
24471
- status: statusCmd,
24472
- plugin: workspacePluginCmd
24167
+ status: statusCmd
24473
24168
  }
24474
24169
  });
24475
24170
 
24476
24171
  // src/cli/commands/plugin.ts
24477
24172
  var import_cmd_ts2 = __toESM(require_cjs(), 1);
24478
24173
 
24174
+ // src/core/workspace-modify.ts
24175
+ import { readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
24176
+ import { existsSync as existsSync10 } from "node:fs";
24177
+ import { join as join11 } from "node:path";
24178
+ async function addPlugin(plugin, workspacePath = process.cwd()) {
24179
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
24180
+ if (!existsSync10(configPath)) {
24181
+ return {
24182
+ success: false,
24183
+ error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
24184
+ Run 'allagents workspace init <path>' to create a new workspace`
24185
+ };
24186
+ }
24187
+ if (isPluginSpec(plugin)) {
24188
+ const resolved = await resolvePluginSpecWithAutoRegister(plugin);
24189
+ if (!resolved.success) {
24190
+ return {
24191
+ success: false,
24192
+ error: resolved.error || "Unknown error"
24193
+ };
24194
+ }
24195
+ return await addPluginToConfig(resolved.registeredAs ? plugin.replace(/@[^@]+$/, `@${resolved.registeredAs}`) : plugin, configPath, resolved.registeredAs);
24196
+ }
24197
+ if (isGitHubUrl(plugin)) {
24198
+ const validation = validatePluginSource(plugin);
24199
+ if (!validation.valid) {
24200
+ return {
24201
+ success: false,
24202
+ error: validation.error || "Invalid GitHub URL"
24203
+ };
24204
+ }
24205
+ const verifyResult = await verifyGitHubUrlExists(plugin);
24206
+ if (!verifyResult.exists) {
24207
+ return {
24208
+ success: false,
24209
+ error: verifyResult.error || `GitHub URL not found: ${plugin}`
24210
+ };
24211
+ }
24212
+ } else {
24213
+ const fullPath = join11(workspacePath, plugin);
24214
+ if (!existsSync10(fullPath) && !existsSync10(plugin)) {
24215
+ return {
24216
+ success: false,
24217
+ error: `Plugin not found at ${plugin}`
24218
+ };
24219
+ }
24220
+ }
24221
+ return await addPluginToConfig(plugin, configPath);
24222
+ }
24223
+ async function addPluginToConfig(plugin, configPath, autoRegistered) {
24224
+ try {
24225
+ const content = await readFile9(configPath, "utf-8");
24226
+ const config = load(content);
24227
+ if (config.plugins.includes(plugin)) {
24228
+ return {
24229
+ success: false,
24230
+ error: `Plugin already exists in .allagents/workspace.yaml: ${plugin}`
24231
+ };
24232
+ }
24233
+ config.plugins.push(plugin);
24234
+ const newContent = dump(config, { lineWidth: -1 });
24235
+ await writeFile5(configPath, newContent, "utf-8");
24236
+ return {
24237
+ success: true,
24238
+ ...autoRegistered && { autoRegistered }
24239
+ };
24240
+ } catch (error) {
24241
+ return {
24242
+ success: false,
24243
+ error: error instanceof Error ? error.message : String(error)
24244
+ };
24245
+ }
24246
+ }
24247
+ async function removePlugin(plugin, workspacePath = process.cwd()) {
24248
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
24249
+ if (!existsSync10(configPath)) {
24250
+ return {
24251
+ success: false,
24252
+ error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
24253
+ Run 'allagents workspace init <path>' to create a new workspace`
24254
+ };
24255
+ }
24256
+ try {
24257
+ const content = await readFile9(configPath, "utf-8");
24258
+ const config = load(content);
24259
+ let index = config.plugins.indexOf(plugin);
24260
+ if (index === -1 && isPluginSpec(plugin) === false) {
24261
+ index = config.plugins.findIndex((p) => p.startsWith(`${plugin}@`) || p === plugin);
24262
+ }
24263
+ if (index === -1) {
24264
+ return {
24265
+ success: false,
24266
+ error: `Plugin not found in .allagents/workspace.yaml: ${plugin}`
24267
+ };
24268
+ }
24269
+ config.plugins.splice(index, 1);
24270
+ const newContent = dump(config, { lineWidth: -1 });
24271
+ await writeFile5(configPath, newContent, "utf-8");
24272
+ return { success: true };
24273
+ } catch (error) {
24274
+ return {
24275
+ success: false,
24276
+ error: error instanceof Error ? error.message : String(error)
24277
+ };
24278
+ }
24279
+ }
24280
+
24479
24281
  // src/cli/metadata/plugin.ts
24480
24282
  var marketplaceListMeta = {
24481
24283
  command: "plugin marketplace list",
@@ -24580,8 +24382,124 @@ var pluginValidateMeta = {
24580
24382
  message: "string"
24581
24383
  }
24582
24384
  };
24385
+ var pluginInstallMeta = {
24386
+ command: "plugin install",
24387
+ description: "Install plugin to .allagents/workspace.yaml (supports plugin@marketplace, GitHub URL, or local path)",
24388
+ whenToUse: "To add a new plugin to your workspace and immediately sync it",
24389
+ examples: [
24390
+ "allagents plugin install my-plugin@official",
24391
+ "allagents plugin install https://github.com/user/plugin",
24392
+ "allagents plugin install ../local-plugin"
24393
+ ],
24394
+ expectedOutput: "Confirms the plugin was added, then runs sync. Shows sync results. Exit 0 on success, exit 1 on failure.",
24395
+ positionals: [
24396
+ { name: "plugin", type: "string", required: true, description: "Plugin identifier (plugin@marketplace, GitHub URL, or local path)" }
24397
+ ],
24398
+ outputSchema: {
24399
+ plugin: "string",
24400
+ autoRegistered: "string | null",
24401
+ syncResult: {
24402
+ copied: "number",
24403
+ generated: "number",
24404
+ failed: "number",
24405
+ skipped: "number",
24406
+ plugins: [{ plugin: "string", success: "boolean", copied: "number", generated: "number", failed: "number" }]
24407
+ }
24408
+ }
24409
+ };
24410
+ var pluginUninstallMeta = {
24411
+ command: "plugin uninstall",
24412
+ description: "Uninstall plugin from .allagents/workspace.yaml",
24413
+ whenToUse: "To remove a plugin from your workspace config and re-sync",
24414
+ examples: [
24415
+ "allagents plugin uninstall my-plugin@official",
24416
+ "allagents plugin uninstall https://github.com/user/plugin"
24417
+ ],
24418
+ expectedOutput: "Confirms the plugin was removed, then runs sync to clean up. Exit 0 on success, exit 1 on failure.",
24419
+ positionals: [
24420
+ { name: "plugin", type: "string", required: true, description: "Plugin identifier to uninstall" }
24421
+ ],
24422
+ outputSchema: {
24423
+ plugin: "string",
24424
+ syncResult: {
24425
+ copied: "number",
24426
+ generated: "number",
24427
+ failed: "number",
24428
+ skipped: "number",
24429
+ plugins: [{ plugin: "string", success: "boolean", copied: "number", generated: "number", failed: "number" }]
24430
+ }
24431
+ }
24432
+ };
24583
24433
 
24584
24434
  // src/cli/commands/plugin.ts
24435
+ function buildSyncData2(result) {
24436
+ return {
24437
+ copied: result.totalCopied,
24438
+ generated: result.totalGenerated,
24439
+ failed: result.totalFailed,
24440
+ skipped: result.totalSkipped,
24441
+ plugins: result.pluginResults.map((pr) => ({
24442
+ plugin: pr.plugin,
24443
+ success: pr.success,
24444
+ error: pr.error,
24445
+ copied: pr.copyResults.filter((r) => r.action === "copied").length,
24446
+ generated: pr.copyResults.filter((r) => r.action === "generated").length,
24447
+ failed: pr.copyResults.filter((r) => r.action === "failed").length,
24448
+ copyResults: pr.copyResults
24449
+ })),
24450
+ purgedPaths: result.purgedPaths ?? []
24451
+ };
24452
+ }
24453
+ async function runSyncAndPrint() {
24454
+ if (!isJsonMode()) {
24455
+ console.log(`
24456
+ Syncing workspace...
24457
+ `);
24458
+ }
24459
+ const result = await syncWorkspace();
24460
+ if (!result.success && result.error) {
24461
+ if (!isJsonMode()) {
24462
+ console.error(`Sync error: ${result.error}`);
24463
+ }
24464
+ return { ok: false, syncData: null };
24465
+ }
24466
+ const syncData = buildSyncData2(result);
24467
+ if (!isJsonMode()) {
24468
+ for (const pluginResult of result.pluginResults) {
24469
+ const status = pluginResult.success ? "✓" : "✗";
24470
+ console.log(`${status} Plugin: ${pluginResult.plugin}`);
24471
+ if (pluginResult.error) {
24472
+ console.log(` Error: ${pluginResult.error}`);
24473
+ }
24474
+ const copied = pluginResult.copyResults.filter((r) => r.action === "copied").length;
24475
+ const generated = pluginResult.copyResults.filter((r) => r.action === "generated").length;
24476
+ const failed = pluginResult.copyResults.filter((r) => r.action === "failed").length;
24477
+ if (copied > 0)
24478
+ console.log(` Copied: ${copied} files`);
24479
+ if (generated > 0)
24480
+ console.log(` Generated: ${generated} files`);
24481
+ if (failed > 0) {
24482
+ console.log(` Failed: ${failed} files`);
24483
+ for (const failedResult of pluginResult.copyResults.filter((r) => r.action === "failed")) {
24484
+ console.log(` - ${failedResult.destination}: ${failedResult.error}`);
24485
+ }
24486
+ }
24487
+ }
24488
+ console.log(`
24489
+ Sync complete:`);
24490
+ console.log(` Total copied: ${result.totalCopied}`);
24491
+ if (result.totalGenerated > 0) {
24492
+ console.log(` Total generated: ${result.totalGenerated}`);
24493
+ }
24494
+ if (result.totalFailed > 0) {
24495
+ console.log(` Total failed: ${result.totalFailed}`);
24496
+ }
24497
+ if (result.totalSkipped > 0) {
24498
+ console.log(` Total skipped: ${result.totalSkipped}`);
24499
+ }
24500
+ }
24501
+ return { ok: result.success && result.totalFailed === 0, syncData };
24502
+ }
24585
24503
  var marketplaceListCmd = import_cmd_ts2.command({
24586
24504
  name: "list",
24587
24505
  description: buildDescription(marketplaceListMeta),
@@ -24911,10 +24829,119 @@ var pluginValidateCmd = import_cmd_ts2.command({
24911
24829
  console.log("(validation not yet implemented)");
24912
24830
  }
24913
24831
  });
24832
+ var pluginInstallCmd = import_cmd_ts2.command({
24833
+ name: "install",
24834
+ description: buildDescription(pluginInstallMeta),
24835
+ args: {
24836
+ plugin: import_cmd_ts2.positional({ type: import_cmd_ts2.string, displayName: "plugin" })
24837
+ },
24838
+ handler: async ({ plugin }) => {
24839
+ try {
24840
+ const result = await addPlugin(plugin);
24841
+ if (!result.success) {
24842
+ if (isJsonMode()) {
24843
+ jsonOutput({ success: false, command: "plugin install", error: result.error ?? "Unknown error" });
24844
+ process.exit(1);
24845
+ }
24846
+ console.error(`Error: ${result.error}`);
24847
+ process.exit(1);
24848
+ }
24849
+ if (isJsonMode()) {
24850
+ const { ok, syncData } = await runSyncAndPrint();
24851
+ jsonOutput({
24852
+ success: ok,
24853
+ command: "plugin install",
24854
+ data: {
24855
+ plugin,
24856
+ autoRegistered: result.autoRegistered ?? null,
24857
+ syncResult: syncData
24858
+ },
24859
+ ...!ok && { error: "Sync completed with failures" }
24860
+ });
24861
+ if (!ok) {
24862
+ process.exit(1);
24863
+ }
24864
+ return;
24865
+ }
24866
+ if (result.autoRegistered) {
24867
+ console.log(`✓ Auto-registered marketplace: ${result.autoRegistered}`);
24868
+ }
24869
+ console.log(`✓ Installed plugin: ${plugin}`);
24870
+ const { ok: syncOk } = await runSyncAndPrint();
24871
+ if (!syncOk) {
24872
+ process.exit(1);
24873
+ }
24874
+ } catch (error) {
24875
+ if (error instanceof Error) {
24876
+ if (isJsonMode()) {
24877
+ jsonOutput({ success: false, command: "plugin install", error: error.message });
24878
+ process.exit(1);
24879
+ }
24880
+ console.error(`Error: ${error.message}`);
24881
+ process.exit(1);
24882
+ }
24883
+ throw error;
24884
+ }
24885
+ }
24886
+ });
24887
+ var pluginUninstallCmd = import_cmd_ts2.command({
24888
+ name: "uninstall",
24889
+ description: buildDescription(pluginUninstallMeta),
24890
+ aliases: ["remove"],
24891
+ args: {
24892
+ plugin: import_cmd_ts2.positional({ type: import_cmd_ts2.string, displayName: "plugin" })
24893
+ },
24894
+ handler: async ({ plugin }) => {
24895
+ try {
24896
+ const result = await removePlugin(plugin);
24897
+ if (!result.success) {
24898
+ if (isJsonMode()) {
24899
+ jsonOutput({ success: false, command: "plugin uninstall", error: result.error ?? "Unknown error" });
24900
+ process.exit(1);
24901
+ }
24902
+ console.error(`Error: ${result.error}`);
24903
+ process.exit(1);
24904
+ }
24905
+ if (isJsonMode()) {
24906
+ const { ok, syncData } = await runSyncAndPrint();
24907
+ jsonOutput({
24908
+ success: ok,
24909
+ command: "plugin uninstall",
24910
+ data: {
24911
+ plugin,
24912
+ syncResult: syncData
24913
+ },
24914
+ ...!ok && { error: "Sync completed with failures" }
24915
+ });
24916
+ if (!ok) {
24917
+ process.exit(1);
24918
+ }
24919
+ return;
24920
+ }
24921
+ console.log(`✓ Uninstalled plugin: ${plugin}`);
24922
+ const { ok: syncOk } = await runSyncAndPrint();
24923
+ if (!syncOk) {
24924
+ process.exit(1);
24925
+ }
24926
+ } catch (error) {
24927
+ if (error instanceof Error) {
24928
+ if (isJsonMode()) {
24929
+ jsonOutput({ success: false, command: "plugin uninstall", error: error.message });
24930
+ process.exit(1);
24931
+ }
24932
+ console.error(`Error: ${error.message}`);
24933
+ process.exit(1);
24934
+ }
24935
+ throw error;
24936
+ }
24937
+ }
24938
+ });
24914
24939
  var pluginCmd = import_cmd_ts2.subcommands({
24915
24940
  name: "plugin",
24916
24941
  description: "Manage plugins and marketplaces",
24917
24942
  cmds: {
24943
+ install: pluginInstallCmd,
24944
+ uninstall: pluginUninstallCmd,
24918
24945
  marketplace: marketplaceCmd,
24919
24946
  list: pluginListCmd,
24920
24947
  validate: pluginValidateCmd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allagents",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
5
5
  "type": "module",
6
6
  "bin": {