allagents 0.8.3 → 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.
- package/README.md +8 -8
- package/dist/index.js +338 -327
- 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
|
|
71
|
-
allagents
|
|
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
|
@@ -23815,113 +23815,6 @@ async function getMarketplacePluginStatus(spec) {
|
|
|
23815
23815
|
};
|
|
23816
23816
|
}
|
|
23817
23817
|
|
|
23818
|
-
// src/core/workspace-modify.ts
|
|
23819
|
-
import { readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
|
|
23820
|
-
import { existsSync as existsSync10 } from "node:fs";
|
|
23821
|
-
import { join as join11 } from "node:path";
|
|
23822
|
-
async function addPlugin(plugin, workspacePath = process.cwd()) {
|
|
23823
|
-
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
23824
|
-
if (!existsSync10(configPath)) {
|
|
23825
|
-
return {
|
|
23826
|
-
success: false,
|
|
23827
|
-
error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
23828
|
-
Run 'allagents workspace init <path>' to create a new workspace`
|
|
23829
|
-
};
|
|
23830
|
-
}
|
|
23831
|
-
if (isPluginSpec(plugin)) {
|
|
23832
|
-
const resolved = await resolvePluginSpecWithAutoRegister(plugin);
|
|
23833
|
-
if (!resolved.success) {
|
|
23834
|
-
return {
|
|
23835
|
-
success: false,
|
|
23836
|
-
error: resolved.error || "Unknown error"
|
|
23837
|
-
};
|
|
23838
|
-
}
|
|
23839
|
-
return await addPluginToConfig(resolved.registeredAs ? plugin.replace(/@[^@]+$/, `@${resolved.registeredAs}`) : plugin, configPath, resolved.registeredAs);
|
|
23840
|
-
}
|
|
23841
|
-
if (isGitHubUrl(plugin)) {
|
|
23842
|
-
const validation = validatePluginSource(plugin);
|
|
23843
|
-
if (!validation.valid) {
|
|
23844
|
-
return {
|
|
23845
|
-
success: false,
|
|
23846
|
-
error: validation.error || "Invalid GitHub URL"
|
|
23847
|
-
};
|
|
23848
|
-
}
|
|
23849
|
-
const verifyResult = await verifyGitHubUrlExists(plugin);
|
|
23850
|
-
if (!verifyResult.exists) {
|
|
23851
|
-
return {
|
|
23852
|
-
success: false,
|
|
23853
|
-
error: verifyResult.error || `GitHub URL not found: ${plugin}`
|
|
23854
|
-
};
|
|
23855
|
-
}
|
|
23856
|
-
} else {
|
|
23857
|
-
const fullPath = join11(workspacePath, plugin);
|
|
23858
|
-
if (!existsSync10(fullPath) && !existsSync10(plugin)) {
|
|
23859
|
-
return {
|
|
23860
|
-
success: false,
|
|
23861
|
-
error: `Plugin not found at ${plugin}`
|
|
23862
|
-
};
|
|
23863
|
-
}
|
|
23864
|
-
}
|
|
23865
|
-
return await addPluginToConfig(plugin, configPath);
|
|
23866
|
-
}
|
|
23867
|
-
async function addPluginToConfig(plugin, configPath, autoRegistered) {
|
|
23868
|
-
try {
|
|
23869
|
-
const content = await readFile9(configPath, "utf-8");
|
|
23870
|
-
const config = load(content);
|
|
23871
|
-
if (config.plugins.includes(plugin)) {
|
|
23872
|
-
return {
|
|
23873
|
-
success: false,
|
|
23874
|
-
error: `Plugin already exists in .allagents/workspace.yaml: ${plugin}`
|
|
23875
|
-
};
|
|
23876
|
-
}
|
|
23877
|
-
config.plugins.push(plugin);
|
|
23878
|
-
const newContent = dump(config, { lineWidth: -1 });
|
|
23879
|
-
await writeFile5(configPath, newContent, "utf-8");
|
|
23880
|
-
return {
|
|
23881
|
-
success: true,
|
|
23882
|
-
...autoRegistered && { autoRegistered }
|
|
23883
|
-
};
|
|
23884
|
-
} catch (error) {
|
|
23885
|
-
return {
|
|
23886
|
-
success: false,
|
|
23887
|
-
error: error instanceof Error ? error.message : String(error)
|
|
23888
|
-
};
|
|
23889
|
-
}
|
|
23890
|
-
}
|
|
23891
|
-
async function removePlugin(plugin, workspacePath = process.cwd()) {
|
|
23892
|
-
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
23893
|
-
if (!existsSync10(configPath)) {
|
|
23894
|
-
return {
|
|
23895
|
-
success: false,
|
|
23896
|
-
error: `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
23897
|
-
Run 'allagents workspace init <path>' to create a new workspace`
|
|
23898
|
-
};
|
|
23899
|
-
}
|
|
23900
|
-
try {
|
|
23901
|
-
const content = await readFile9(configPath, "utf-8");
|
|
23902
|
-
const config = load(content);
|
|
23903
|
-
let index = config.plugins.indexOf(plugin);
|
|
23904
|
-
if (index === -1 && isPluginSpec(plugin) === false) {
|
|
23905
|
-
index = config.plugins.findIndex((p) => p.startsWith(`${plugin}@`) || p === plugin);
|
|
23906
|
-
}
|
|
23907
|
-
if (index === -1) {
|
|
23908
|
-
return {
|
|
23909
|
-
success: false,
|
|
23910
|
-
error: `Plugin not found in .allagents/workspace.yaml: ${plugin}`
|
|
23911
|
-
};
|
|
23912
|
-
}
|
|
23913
|
-
config.plugins.splice(index, 1);
|
|
23914
|
-
const newContent = dump(config, { lineWidth: -1 });
|
|
23915
|
-
await writeFile5(configPath, newContent, "utf-8");
|
|
23916
|
-
return { success: true };
|
|
23917
|
-
} catch (error) {
|
|
23918
|
-
return {
|
|
23919
|
-
success: false,
|
|
23920
|
-
error: error instanceof Error ? error.message : String(error)
|
|
23921
|
-
};
|
|
23922
|
-
}
|
|
23923
|
-
}
|
|
23924
|
-
|
|
23925
23818
|
// src/cli/json-output.ts
|
|
23926
23819
|
var jsonMode = false;
|
|
23927
23820
|
function isJsonMode() {
|
|
@@ -24024,54 +23917,6 @@ var statusMeta = {
|
|
|
24024
23917
|
clients: ["string"]
|
|
24025
23918
|
}
|
|
24026
23919
|
};
|
|
24027
|
-
var pluginInstallMeta = {
|
|
24028
|
-
command: "workspace plugin install",
|
|
24029
|
-
description: "Install plugin to .allagents/workspace.yaml (supports plugin@marketplace, GitHub URL, or local path)",
|
|
24030
|
-
whenToUse: "To add a new plugin to your workspace and immediately sync it",
|
|
24031
|
-
examples: [
|
|
24032
|
-
"allagents workspace plugin install my-plugin@official",
|
|
24033
|
-
"allagents workspace plugin install https://github.com/user/plugin",
|
|
24034
|
-
"allagents workspace plugin install ../local-plugin"
|
|
24035
|
-
],
|
|
24036
|
-
expectedOutput: "Confirms the plugin was added, then runs sync. Shows sync results. Exit 0 on success, exit 1 on failure.",
|
|
24037
|
-
positionals: [
|
|
24038
|
-
{ name: "plugin", type: "string", required: true, description: "Plugin identifier (plugin@marketplace, GitHub URL, or local path)" }
|
|
24039
|
-
],
|
|
24040
|
-
outputSchema: {
|
|
24041
|
-
plugin: "string",
|
|
24042
|
-
autoRegistered: "string | null",
|
|
24043
|
-
syncResult: {
|
|
24044
|
-
copied: "number",
|
|
24045
|
-
generated: "number",
|
|
24046
|
-
failed: "number",
|
|
24047
|
-
skipped: "number",
|
|
24048
|
-
plugins: [{ plugin: "string", success: "boolean", copied: "number", generated: "number", failed: "number" }]
|
|
24049
|
-
}
|
|
24050
|
-
}
|
|
24051
|
-
};
|
|
24052
|
-
var pluginUninstallMeta = {
|
|
24053
|
-
command: "workspace plugin uninstall",
|
|
24054
|
-
description: "Uninstall plugin from .allagents/workspace.yaml",
|
|
24055
|
-
whenToUse: "To remove a plugin from your workspace config and re-sync",
|
|
24056
|
-
examples: [
|
|
24057
|
-
"allagents workspace plugin uninstall my-plugin@official",
|
|
24058
|
-
"allagents workspace plugin uninstall https://github.com/user/plugin"
|
|
24059
|
-
],
|
|
24060
|
-
expectedOutput: "Confirms the plugin was removed, then runs sync to clean up. Exit 0 on success, exit 1 on failure.",
|
|
24061
|
-
positionals: [
|
|
24062
|
-
{ name: "plugin", type: "string", required: true, description: "Plugin identifier to uninstall" }
|
|
24063
|
-
],
|
|
24064
|
-
outputSchema: {
|
|
24065
|
-
plugin: "string",
|
|
24066
|
-
syncResult: {
|
|
24067
|
-
copied: "number",
|
|
24068
|
-
generated: "number",
|
|
24069
|
-
failed: "number",
|
|
24070
|
-
skipped: "number",
|
|
24071
|
-
plugins: [{ plugin: "string", success: "boolean", copied: "number", generated: "number", failed: "number" }]
|
|
24072
|
-
}
|
|
24073
|
-
}
|
|
24074
|
-
};
|
|
24075
23920
|
|
|
24076
23921
|
// src/cli/commands/workspace.ts
|
|
24077
23922
|
function buildSyncData(result) {
|
|
@@ -24092,56 +23937,6 @@ function buildSyncData(result) {
|
|
|
24092
23937
|
purgedPaths: result.purgedPaths ?? []
|
|
24093
23938
|
};
|
|
24094
23939
|
}
|
|
24095
|
-
async function runSyncAndPrint() {
|
|
24096
|
-
if (!isJsonMode()) {
|
|
24097
|
-
console.log(`
|
|
24098
|
-
Syncing workspace...
|
|
24099
|
-
`);
|
|
24100
|
-
}
|
|
24101
|
-
const result = await syncWorkspace();
|
|
24102
|
-
if (!result.success && result.error) {
|
|
24103
|
-
if (!isJsonMode()) {
|
|
24104
|
-
console.error(`Sync error: ${result.error}`);
|
|
24105
|
-
}
|
|
24106
|
-
return { ok: false, syncData: null };
|
|
24107
|
-
}
|
|
24108
|
-
const syncData = buildSyncData(result);
|
|
24109
|
-
if (!isJsonMode()) {
|
|
24110
|
-
for (const pluginResult of result.pluginResults) {
|
|
24111
|
-
const status = pluginResult.success ? "✓" : "✗";
|
|
24112
|
-
console.log(`${status} Plugin: ${pluginResult.plugin}`);
|
|
24113
|
-
if (pluginResult.error) {
|
|
24114
|
-
console.log(` Error: ${pluginResult.error}`);
|
|
24115
|
-
}
|
|
24116
|
-
const copied = pluginResult.copyResults.filter((r) => r.action === "copied").length;
|
|
24117
|
-
const generated = pluginResult.copyResults.filter((r) => r.action === "generated").length;
|
|
24118
|
-
const failed = pluginResult.copyResults.filter((r) => r.action === "failed").length;
|
|
24119
|
-
if (copied > 0)
|
|
24120
|
-
console.log(` Copied: ${copied} files`);
|
|
24121
|
-
if (generated > 0)
|
|
24122
|
-
console.log(` Generated: ${generated} files`);
|
|
24123
|
-
if (failed > 0) {
|
|
24124
|
-
console.log(` Failed: ${failed} files`);
|
|
24125
|
-
for (const failedResult of pluginResult.copyResults.filter((r) => r.action === "failed")) {
|
|
24126
|
-
console.log(` - ${failedResult.destination}: ${failedResult.error}`);
|
|
24127
|
-
}
|
|
24128
|
-
}
|
|
24129
|
-
}
|
|
24130
|
-
console.log(`
|
|
24131
|
-
Sync complete:`);
|
|
24132
|
-
console.log(` Total copied: ${result.totalCopied}`);
|
|
24133
|
-
if (result.totalGenerated > 0) {
|
|
24134
|
-
console.log(` Total generated: ${result.totalGenerated}`);
|
|
24135
|
-
}
|
|
24136
|
-
if (result.totalFailed > 0) {
|
|
24137
|
-
console.log(` Total failed: ${result.totalFailed}`);
|
|
24138
|
-
}
|
|
24139
|
-
if (result.totalSkipped > 0) {
|
|
24140
|
-
console.log(` Total skipped: ${result.totalSkipped}`);
|
|
24141
|
-
}
|
|
24142
|
-
}
|
|
24143
|
-
return { ok: result.success && result.totalFailed === 0, syncData };
|
|
24144
|
-
}
|
|
24145
23940
|
var initCmd = import_cmd_ts.command({
|
|
24146
23941
|
name: "init",
|
|
24147
23942
|
description: buildDescription(initMeta),
|
|
@@ -24363,134 +24158,125 @@ Clients (${result.clients.length}):`);
|
|
|
24363
24158
|
}
|
|
24364
24159
|
}
|
|
24365
24160
|
});
|
|
24366
|
-
var
|
|
24367
|
-
name: "
|
|
24368
|
-
description:
|
|
24369
|
-
|
|
24370
|
-
|
|
24371
|
-
|
|
24372
|
-
|
|
24373
|
-
try {
|
|
24374
|
-
const result = await addPlugin(plugin);
|
|
24375
|
-
if (!result.success) {
|
|
24376
|
-
if (isJsonMode()) {
|
|
24377
|
-
jsonOutput({ success: false, command: "workspace plugin install", error: result.error ?? "Unknown error" });
|
|
24378
|
-
process.exit(1);
|
|
24379
|
-
}
|
|
24380
|
-
console.error(`Error: ${result.error}`);
|
|
24381
|
-
process.exit(1);
|
|
24382
|
-
}
|
|
24383
|
-
if (isJsonMode()) {
|
|
24384
|
-
const { ok, syncData } = await runSyncAndPrint();
|
|
24385
|
-
jsonOutput({
|
|
24386
|
-
success: ok,
|
|
24387
|
-
command: "workspace plugin install",
|
|
24388
|
-
data: {
|
|
24389
|
-
plugin,
|
|
24390
|
-
autoRegistered: result.autoRegistered ?? null,
|
|
24391
|
-
syncResult: syncData
|
|
24392
|
-
},
|
|
24393
|
-
...!ok && { error: "Sync completed with failures" }
|
|
24394
|
-
});
|
|
24395
|
-
if (!ok) {
|
|
24396
|
-
process.exit(1);
|
|
24397
|
-
}
|
|
24398
|
-
return;
|
|
24399
|
-
}
|
|
24400
|
-
if (result.autoRegistered) {
|
|
24401
|
-
console.log(`✓ Auto-registered marketplace: ${result.autoRegistered}`);
|
|
24402
|
-
}
|
|
24403
|
-
console.log(`✓ Installed plugin: ${plugin}`);
|
|
24404
|
-
const { ok: syncOk } = await runSyncAndPrint();
|
|
24405
|
-
if (!syncOk) {
|
|
24406
|
-
process.exit(1);
|
|
24407
|
-
}
|
|
24408
|
-
} catch (error) {
|
|
24409
|
-
if (error instanceof Error) {
|
|
24410
|
-
if (isJsonMode()) {
|
|
24411
|
-
jsonOutput({ success: false, command: "workspace plugin install", error: error.message });
|
|
24412
|
-
process.exit(1);
|
|
24413
|
-
}
|
|
24414
|
-
console.error(`Error: ${error.message}`);
|
|
24415
|
-
process.exit(1);
|
|
24416
|
-
}
|
|
24417
|
-
throw error;
|
|
24418
|
-
}
|
|
24161
|
+
var workspaceCmd = import_cmd_ts.subcommands({
|
|
24162
|
+
name: "workspace",
|
|
24163
|
+
description: "Manage AI agent workspaces - initialize, sync, and configure plugins",
|
|
24164
|
+
cmds: {
|
|
24165
|
+
init: initCmd,
|
|
24166
|
+
sync: syncCmd,
|
|
24167
|
+
status: statusCmd
|
|
24419
24168
|
}
|
|
24420
24169
|
});
|
|
24421
|
-
|
|
24422
|
-
|
|
24423
|
-
|
|
24424
|
-
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
|
|
24436
|
-
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
plugin,
|
|
24446
|
-
syncResult: syncData
|
|
24447
|
-
},
|
|
24448
|
-
...!ok && { error: "Sync completed with failures" }
|
|
24449
|
-
});
|
|
24450
|
-
if (!ok) {
|
|
24451
|
-
process.exit(1);
|
|
24452
|
-
}
|
|
24453
|
-
return;
|
|
24454
|
-
}
|
|
24455
|
-
console.log(`✓ Uninstalled plugin: ${plugin}`);
|
|
24456
|
-
const { ok: syncOk } = await runSyncAndPrint();
|
|
24457
|
-
if (!syncOk) {
|
|
24458
|
-
process.exit(1);
|
|
24459
|
-
}
|
|
24460
|
-
} catch (error) {
|
|
24461
|
-
if (error instanceof Error) {
|
|
24462
|
-
if (isJsonMode()) {
|
|
24463
|
-
jsonOutput({ success: false, command: "workspace plugin uninstall", error: error.message });
|
|
24464
|
-
process.exit(1);
|
|
24465
|
-
}
|
|
24466
|
-
console.error(`Error: ${error.message}`);
|
|
24467
|
-
process.exit(1);
|
|
24468
|
-
}
|
|
24469
|
-
throw error;
|
|
24170
|
+
|
|
24171
|
+
// src/cli/commands/plugin.ts
|
|
24172
|
+
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
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
|
+
};
|
|
24470
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
|
+
};
|
|
24471
24245
|
}
|
|
24472
|
-
}
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24478
|
-
|
|
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
|
+
};
|
|
24479
24255
|
}
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
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
|
+
};
|
|
24489
24278
|
}
|
|
24490
|
-
}
|
|
24491
|
-
|
|
24492
|
-
// src/cli/commands/plugin.ts
|
|
24493
|
-
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
24279
|
+
}
|
|
24494
24280
|
|
|
24495
24281
|
// src/cli/metadata/plugin.ts
|
|
24496
24282
|
var marketplaceListMeta = {
|
|
@@ -24596,8 +24382,124 @@ var pluginValidateMeta = {
|
|
|
24596
24382
|
message: "string"
|
|
24597
24383
|
}
|
|
24598
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
|
+
};
|
|
24599
24433
|
|
|
24600
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
|
+
}
|
|
24601
24503
|
var marketplaceListCmd = import_cmd_ts2.command({
|
|
24602
24504
|
name: "list",
|
|
24603
24505
|
description: buildDescription(marketplaceListMeta),
|
|
@@ -24927,10 +24829,119 @@ var pluginValidateCmd = import_cmd_ts2.command({
|
|
|
24927
24829
|
console.log("(validation not yet implemented)");
|
|
24928
24830
|
}
|
|
24929
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
|
+
});
|
|
24930
24939
|
var pluginCmd = import_cmd_ts2.subcommands({
|
|
24931
24940
|
name: "plugin",
|
|
24932
24941
|
description: "Manage plugins and marketplaces",
|
|
24933
24942
|
cmds: {
|
|
24943
|
+
install: pluginInstallCmd,
|
|
24944
|
+
uninstall: pluginUninstallCmd,
|
|
24934
24945
|
marketplace: marketplaceCmd,
|
|
24935
24946
|
list: pluginListCmd,
|
|
24936
24947
|
validate: pluginValidateCmd
|