opencode-agents 1.1.2 → 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 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 (space to select, enter to confirm):",
27148
+ message: "Select agents to install:",
27124
27149
  options: options2,
27125
27150
  required: true
27126
27151
  });
@@ -27157,25 +27182,25 @@ async function addCommand(source, options2) {
27157
27182
  if (isGlobal === void 0) {
27158
27183
  isGlobal = await promptInstallLocation();
27159
27184
  }
27160
- R2.step(import_picocolors3.default.cyan(`Source: ${import_picocolors3.default.dim(`https://github.com/${source}.git`)}`));
27185
+ R2.step(`Source: ${import_picocolors3.default.cyan(`https://github.com/${source}.git`)}`);
27161
27186
  const s = bt2();
27162
- s.start("Cloning repository...");
27187
+ s.start("Cloning repository");
27163
27188
  let tempDir;
27164
27189
  try {
27165
27190
  tempDir = await fetchSource2(source);
27166
- s.stop(import_picocolors3.default.green("\u2713 Repository cloned"));
27191
+ s.stop("Repository cloned");
27167
27192
  } catch (err) {
27168
- s.stop(import_picocolors3.default.red("\u2717 Failed to clone repository"));
27193
+ s.stop("Failed to clone repository");
27169
27194
  R2.error(`Failed to fetch source: ${err instanceof Error ? err.message : String(err)}`);
27170
27195
  process.exit(1);
27171
27196
  }
27172
- s.start("Discovering agents...");
27197
+ s.start("Discovering agents");
27173
27198
  let agents;
27174
27199
  try {
27175
27200
  agents = await discoverFromDirectory(tempDir);
27176
- s.stop(import_picocolors3.default.green(`\u2713 Found ${agents.length} agent(s)`));
27201
+ s.stop(`Found ${import_picocolors3.default.green(String(agents.length))} agent(s)`);
27177
27202
  } catch (err) {
27178
- s.stop(import_picocolors3.default.red("\u2717 Failed to discover agents"));
27203
+ s.stop("Failed to discover agents");
27179
27204
  R2.error(`Failed to discover agents: ${err instanceof Error ? err.message : String(err)}`);
27180
27205
  process.exit(1);
27181
27206
  }
@@ -27193,16 +27218,11 @@ async function addCommand(source, options2) {
27193
27218
  Ne("No agents selected, aborting");
27194
27219
  process.exit(0);
27195
27220
  }
27196
- console.log();
27197
- console.log(import_picocolors3.default.dim(` ${S_BRANCH} Selected agents:`));
27198
- selectedAgents.forEach((agent, index) => {
27199
- const isLast = index === selectedAgents.length - 1;
27200
- const prefix = isLast ? S_BRANCH_END : S_BRANCH;
27201
- const name = agent.agent.name || basename4(agent.path, ".md");
27202
- console.log(` ${S_BAR} ${prefix} ${S_BULLET} ${import_picocolors3.default.bold(name)}`);
27203
- });
27204
- console.log();
27205
- 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)`);
27206
27226
  try {
27207
27227
  let platforms;
27208
27228
  if (options2.agent && options2.agent.length > 0) {
@@ -27221,13 +27241,10 @@ async function addCommand(source, options2) {
27221
27241
  selectedAgents
27222
27242
  };
27223
27243
  await installAgent(installOptions);
27224
- s.stop(import_picocolors3.default.green(`\u2713 Successfully installed ${selectedAgents.length} agent(s)`));
27225
- console.log();
27226
- console.log(import_picocolors3.default.dim(" Next steps:"));
27227
- console.log(import_picocolors3.default.dim(` npx opencode-agents list View installed agents`));
27228
- 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.");
27229
27246
  } catch (err) {
27230
- s.stop(import_picocolors3.default.red("\u2717 Installation failed"));
27247
+ s.stop("Installation failed");
27231
27248
  R2.error(`Failed to install agent: ${err instanceof Error ? err.message : String(err)}`);
27232
27249
  process.exit(1);
27233
27250
  } finally {
@@ -27246,7 +27263,6 @@ async function listCommand(options2) {
27246
27263
  } else {
27247
27264
  platforms = ["opencode"];
27248
27265
  }
27249
- console.log();
27250
27266
  let hasAnyAgents = false;
27251
27267
  for (const platform of platforms) {
27252
27268
  const projectAgents = listInstalledAgents(platform, false);
@@ -27255,42 +27271,39 @@ async function listCommand(options2) {
27255
27271
  continue;
27256
27272
  }
27257
27273
  hasAnyAgents = true;
27258
- console.log(import_picocolors4.default.bold(import_picocolors4.default.cyan(`\u25C6 ${platform} agents`)));
27274
+ console.log();
27275
+ console.log(import_picocolors4.default.bold(import_picocolors4.default.cyan(`${platform} agents`)));
27259
27276
  console.log();
27260
27277
  if (projectAgents.length > 0) {
27261
- console.log(` ${globalAgents.length > 0 ? S_BRANCH : S_BRANCH_END} ${import_picocolors4.default.dim("Project")} ${import_picocolors4.default.dim("(./.opencode/agents/)")}`);
27262
- projectAgents.forEach((agent, index) => {
27263
- const isLast = index === projectAgents.length - 1;
27264
- const prefix = isLast ? S_BRANCH_END : S_BRANCH;
27278
+ console.log(import_picocolors4.default.dim("Project (./.opencode/agents/)"));
27279
+ for (const agent of projectAgents) {
27265
27280
  const name = agent.agent.name || agent.path.split(/[/\\]/).pop()?.replace(".md", "") || "unknown";
27266
27281
  const mode = agent.agent.mode || "subagent";
27267
- console.log(` ${globalAgents.length > 0 ? S_BAR : " "} ${prefix} ${S_BULLET} ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
27282
+ console.log(` ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
27268
27283
  if (agent.agent.description) {
27269
- console.log(` ${globalAgents.length > 0 ? S_BAR : " "} ${isLast ? " " : `${S_BAR} `} ${import_picocolors4.default.dim(agent.agent.description)}`);
27284
+ console.log(` ${import_picocolors4.default.dim(agent.agent.description)}`);
27270
27285
  }
27271
- });
27286
+ }
27272
27287
  console.log();
27273
27288
  }
27274
27289
  if (globalAgents.length > 0) {
27275
- console.log(` ${S_BRANCH_END} ${import_picocolors4.default.dim("Global")} ${import_picocolors4.default.dim("(~/.config/opencode/agents/)")}`);
27276
- globalAgents.forEach((agent, index) => {
27277
- const isLast = index === globalAgents.length - 1;
27278
- 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) {
27279
27292
  const name = agent.agent.name || agent.path.split(/[/\\]/).pop()?.replace(".md", "") || "unknown";
27280
27293
  const mode = agent.agent.mode || "subagent";
27281
- console.log(` ${prefix} ${S_BULLET} ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
27294
+ console.log(` ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
27282
27295
  if (agent.agent.description) {
27283
- console.log(` ${isLast ? " " : `${S_BAR} `} ${import_picocolors4.default.dim(agent.agent.description)}`);
27296
+ console.log(` ${import_picocolors4.default.dim(agent.agent.description)}`);
27284
27297
  }
27285
- });
27298
+ }
27286
27299
  console.log();
27287
27300
  }
27288
27301
  }
27289
27302
  if (!hasAnyAgents) {
27290
- R2.info(import_picocolors4.default.dim("No agents installed"));
27303
+ R2.info("No agents installed");
27291
27304
  console.log();
27292
- console.log(import_picocolors4.default.dim(" To install an agent:"));
27293
- console.log(import_picocolors4.default.dim(` npx opencode-agents add <repo>`));
27305
+ console.log(import_picocolors4.default.dim("To install an agent:"));
27306
+ console.log(import_picocolors4.default.dim(` npx opencode-agents add <repo>`));
27294
27307
  console.log();
27295
27308
  }
27296
27309
  }