opencode-agents 1.1.3 → 1.1.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/dist/index.js +57 -46
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/commands/add.ts +19 -35
- package/src/commands/list.ts +15 -23
package/dist/index.js
CHANGED
|
@@ -26036,6 +26036,12 @@ var R2 = { message: (t = [], { symbol: r = import_picocolors.default.gray(d), se
|
|
|
26036
26036
|
var Ne = (t = "", r) => {
|
|
26037
26037
|
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray(x2)} ${import_picocolors.default.red(t)}
|
|
26038
26038
|
|
|
26039
|
+
`);
|
|
26040
|
+
};
|
|
26041
|
+
var Le = (t = "", r) => {
|
|
26042
|
+
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray(d)}
|
|
26043
|
+
${import_picocolors.default.gray(x2)} ${t}
|
|
26044
|
+
|
|
26039
26045
|
`);
|
|
26040
26046
|
};
|
|
26041
26047
|
var Z2 = (t, r) => t.split(`
|
|
@@ -26091,6 +26097,25 @@ ${import_picocolors.default.cyan(x2)}
|
|
|
26091
26097
|
}
|
|
26092
26098
|
} }).prompt();
|
|
26093
26099
|
};
|
|
26100
|
+
var Ge = (t) => import_picocolors.default.dim(t);
|
|
26101
|
+
var ke = (t, r, s) => {
|
|
26102
|
+
const i = { hard: true, trim: false }, a = J2(t, r, i).split(`
|
|
26103
|
+
`), o = a.reduce((n, c) => Math.max(M2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(M2(c), n), 0), l = r - (u - o);
|
|
26104
|
+
return J2(t, l, i);
|
|
26105
|
+
};
|
|
26106
|
+
var Ve = (t = "", r = "", s) => {
|
|
26107
|
+
const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = ["", ...ke(t, rt(i) - 6, o).split(`
|
|
26108
|
+
`).map(o), ""], l = M2(r), n = Math.max(u.reduce((p, E) => {
|
|
26109
|
+
const $ = M2(E);
|
|
26110
|
+
return $ > p ? $ : p;
|
|
26111
|
+
}, 0), l) + 2, c = u.map((p) => `${import_picocolors.default.gray(d)} ${p}${" ".repeat(n - M2(p))}${import_picocolors.default.gray(d)}`).join(`
|
|
26112
|
+
`), g = a ? `${import_picocolors.default.gray(d)}
|
|
26113
|
+
` : "", F = a ? Wt2 : gt2;
|
|
26114
|
+
i.write(`${g}${import_picocolors.default.green(V)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(rt2.repeat(Math.max(n - l - 1, 1)) + mt2)}
|
|
26115
|
+
${c}
|
|
26116
|
+
${import_picocolors.default.gray(F + rt2.repeat(n + 2) + pt2)}
|
|
26117
|
+
`);
|
|
26118
|
+
};
|
|
26094
26119
|
var Ke = import_picocolors.default.magenta;
|
|
26095
26120
|
var bt2 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: u = et2 ? 80 : 120, signal: l, ...n } = {}) => {
|
|
26096
26121
|
const c = ct2();
|
|
@@ -27117,10 +27142,10 @@ async function promptSelectAgents(agents) {
|
|
|
27117
27142
|
const options2 = agents.map((agent) => ({
|
|
27118
27143
|
value: agent,
|
|
27119
27144
|
label: agent.agent.name || basename4(agent.path, ".md"),
|
|
27120
|
-
hint: agent.agent.description?.slice(0, 50)
|
|
27145
|
+
hint: agent.agent.description?.slice(0, 50)
|
|
27121
27146
|
}));
|
|
27122
27147
|
const selected = await je({
|
|
27123
|
-
message: "Select agents to install
|
|
27148
|
+
message: "Select agents to install:",
|
|
27124
27149
|
options: options2,
|
|
27125
27150
|
required: true
|
|
27126
27151
|
});
|
|
@@ -27157,27 +27182,25 @@ async function addCommand(source, options2) {
|
|
|
27157
27182
|
if (isGlobal === void 0) {
|
|
27158
27183
|
isGlobal = await promptInstallLocation();
|
|
27159
27184
|
}
|
|
27160
|
-
|
|
27161
|
-
console.log(S_BAR);
|
|
27185
|
+
R2.step(`Source: ${import_picocolors3.default.cyan(`https://github.com/${source}.git`)}`);
|
|
27162
27186
|
const s = bt2();
|
|
27163
|
-
s.start("Cloning repository
|
|
27187
|
+
s.start("Cloning repository");
|
|
27164
27188
|
let tempDir;
|
|
27165
27189
|
try {
|
|
27166
27190
|
tempDir = await fetchSource2(source);
|
|
27167
|
-
s.stop(
|
|
27191
|
+
s.stop("Repository cloned");
|
|
27168
27192
|
} catch (err) {
|
|
27169
|
-
s.stop(
|
|
27193
|
+
s.stop("Failed to clone repository");
|
|
27170
27194
|
R2.error(`Failed to fetch source: ${err instanceof Error ? err.message : String(err)}`);
|
|
27171
27195
|
process.exit(1);
|
|
27172
27196
|
}
|
|
27173
|
-
|
|
27174
|
-
s.start("Discovering agents...");
|
|
27197
|
+
s.start("Discovering agents");
|
|
27175
27198
|
let agents;
|
|
27176
27199
|
try {
|
|
27177
27200
|
agents = await discoverFromDirectory(tempDir);
|
|
27178
|
-
s.stop(
|
|
27201
|
+
s.stop(`Found ${import_picocolors3.default.green(String(agents.length))} agent(s)`);
|
|
27179
27202
|
} catch (err) {
|
|
27180
|
-
s.stop(
|
|
27203
|
+
s.stop("Failed to discover agents");
|
|
27181
27204
|
R2.error(`Failed to discover agents: ${err instanceof Error ? err.message : String(err)}`);
|
|
27182
27205
|
process.exit(1);
|
|
27183
27206
|
}
|
|
@@ -27185,7 +27208,6 @@ async function addCommand(source, options2) {
|
|
|
27185
27208
|
R2.error("No agents found in the source");
|
|
27186
27209
|
process.exit(1);
|
|
27187
27210
|
}
|
|
27188
|
-
console.log(S_BAR);
|
|
27189
27211
|
let selectedAgents;
|
|
27190
27212
|
if (options2.yes) {
|
|
27191
27213
|
selectedAgents = agents;
|
|
@@ -27196,15 +27218,11 @@ async function addCommand(source, options2) {
|
|
|
27196
27218
|
Ne("No agents selected, aborting");
|
|
27197
27219
|
process.exit(0);
|
|
27198
27220
|
}
|
|
27199
|
-
|
|
27200
|
-
|
|
27201
|
-
|
|
27202
|
-
|
|
27203
|
-
|
|
27204
|
-
console.log(`${S_BAR} ${isLast ? " " : S_BAR} ${prefix} ${S_BULLET} ${import_picocolors3.default.bold(name)}`);
|
|
27205
|
-
});
|
|
27206
|
-
console.log(S_BAR);
|
|
27207
|
-
s.start("Installing agents...");
|
|
27221
|
+
const selectedList = selectedAgents.map(
|
|
27222
|
+
(agent) => ` ${import_picocolors3.default.bold(agent.agent.name || basename4(agent.path, ".md"))}`
|
|
27223
|
+
).join("\n");
|
|
27224
|
+
Ve(selectedList, "Selected agents");
|
|
27225
|
+
s.start(`Installing ${selectedAgents.length} agent(s)`);
|
|
27208
27226
|
try {
|
|
27209
27227
|
let platforms;
|
|
27210
27228
|
if (options2.agent && options2.agent.length > 0) {
|
|
@@ -27223,13 +27241,10 @@ async function addCommand(source, options2) {
|
|
|
27223
27241
|
selectedAgents
|
|
27224
27242
|
};
|
|
27225
27243
|
await installAgent(installOptions);
|
|
27226
|
-
s.stop(
|
|
27227
|
-
|
|
27228
|
-
console.log(import_picocolors3.default.dim(" Next steps:"));
|
|
27229
|
-
console.log(import_picocolors3.default.dim(` npx opencode-agents list View installed agents`));
|
|
27230
|
-
console.log();
|
|
27244
|
+
s.stop(import_picocolors3.default.green(`Successfully installed ${selectedAgents.length} agent(s)`));
|
|
27245
|
+
Le("Installation complete! Run `npx opencode-agents list` to see installed agents.");
|
|
27231
27246
|
} catch (err) {
|
|
27232
|
-
s.stop(
|
|
27247
|
+
s.stop("Installation failed");
|
|
27233
27248
|
R2.error(`Failed to install agent: ${err instanceof Error ? err.message : String(err)}`);
|
|
27234
27249
|
process.exit(1);
|
|
27235
27250
|
} finally {
|
|
@@ -27248,7 +27263,6 @@ async function listCommand(options2) {
|
|
|
27248
27263
|
} else {
|
|
27249
27264
|
platforms = ["opencode"];
|
|
27250
27265
|
}
|
|
27251
|
-
console.log();
|
|
27252
27266
|
let hasAnyAgents = false;
|
|
27253
27267
|
for (const platform of platforms) {
|
|
27254
27268
|
const projectAgents = listInstalledAgents(platform, false);
|
|
@@ -27257,42 +27271,39 @@ async function listCommand(options2) {
|
|
|
27257
27271
|
continue;
|
|
27258
27272
|
}
|
|
27259
27273
|
hasAnyAgents = true;
|
|
27260
|
-
console.log(
|
|
27274
|
+
console.log();
|
|
27275
|
+
console.log(import_picocolors4.default.bold(import_picocolors4.default.cyan(`${platform} agents`)));
|
|
27261
27276
|
console.log();
|
|
27262
27277
|
if (projectAgents.length > 0) {
|
|
27263
|
-
console.log(
|
|
27264
|
-
|
|
27265
|
-
const isLast = index === projectAgents.length - 1;
|
|
27266
|
-
const prefix = isLast ? S_BRANCH_END : S_BRANCH;
|
|
27278
|
+
console.log(import_picocolors4.default.dim("Project (./.opencode/agents/)"));
|
|
27279
|
+
for (const agent of projectAgents) {
|
|
27267
27280
|
const name = agent.agent.name || agent.path.split(/[/\\]/).pop()?.replace(".md", "") || "unknown";
|
|
27268
27281
|
const mode = agent.agent.mode || "subagent";
|
|
27269
|
-
console.log(` ${
|
|
27282
|
+
console.log(` ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
|
|
27270
27283
|
if (agent.agent.description) {
|
|
27271
|
-
console.log(`
|
|
27284
|
+
console.log(` ${import_picocolors4.default.dim(agent.agent.description)}`);
|
|
27272
27285
|
}
|
|
27273
|
-
}
|
|
27286
|
+
}
|
|
27274
27287
|
console.log();
|
|
27275
27288
|
}
|
|
27276
27289
|
if (globalAgents.length > 0) {
|
|
27277
|
-
console.log(
|
|
27278
|
-
|
|
27279
|
-
const isLast = index === globalAgents.length - 1;
|
|
27280
|
-
const prefix = isLast ? S_BRANCH_END : S_BRANCH;
|
|
27290
|
+
console.log(import_picocolors4.default.dim("Global (~/.config/opencode/agents/)"));
|
|
27291
|
+
for (const agent of globalAgents) {
|
|
27281
27292
|
const name = agent.agent.name || agent.path.split(/[/\\]/).pop()?.replace(".md", "") || "unknown";
|
|
27282
27293
|
const mode = agent.agent.mode || "subagent";
|
|
27283
|
-
console.log(`
|
|
27294
|
+
console.log(` ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
|
|
27284
27295
|
if (agent.agent.description) {
|
|
27285
|
-
console.log(` ${
|
|
27296
|
+
console.log(` ${import_picocolors4.default.dim(agent.agent.description)}`);
|
|
27286
27297
|
}
|
|
27287
|
-
}
|
|
27298
|
+
}
|
|
27288
27299
|
console.log();
|
|
27289
27300
|
}
|
|
27290
27301
|
}
|
|
27291
27302
|
if (!hasAnyAgents) {
|
|
27292
|
-
R2.info(
|
|
27303
|
+
R2.info("No agents installed");
|
|
27293
27304
|
console.log();
|
|
27294
|
-
console.log(import_picocolors4.default.dim("
|
|
27295
|
-
console.log(import_picocolors4.default.dim(`
|
|
27305
|
+
console.log(import_picocolors4.default.dim("To install an agent:"));
|
|
27306
|
+
console.log(import_picocolors4.default.dim(` npx opencode-agents add <repo>`));
|
|
27296
27307
|
console.log();
|
|
27297
27308
|
}
|
|
27298
27309
|
}
|