opencode-agents 1.1.1 → 1.1.3
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 +61 -76
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/commands/add.ts +30 -27
- package/src/commands/list.ts +9 -9
- package/src/core/installer.ts +0 -3
package/dist/index.js
CHANGED
|
@@ -9676,10 +9676,10 @@ var require_index_688c5d50 = __commonJS({
|
|
|
9676
9676
|
throw new Error("unknown meta: " + entry.type);
|
|
9677
9677
|
}
|
|
9678
9678
|
}
|
|
9679
|
-
abort(
|
|
9679
|
+
abort(error) {
|
|
9680
9680
|
this[ABORTED] = true;
|
|
9681
|
-
this.emit("abort",
|
|
9682
|
-
this.warn("TAR_ABORT",
|
|
9681
|
+
this.emit("abort", error);
|
|
9682
|
+
this.warn("TAR_ABORT", error, { recoverable: false });
|
|
9683
9683
|
}
|
|
9684
9684
|
write(chunk) {
|
|
9685
9685
|
if (this[ABORTED])
|
|
@@ -14907,10 +14907,10 @@ var require_index_688c5d50 = __commonJS({
|
|
|
14907
14907
|
var abs = this._makeAbs(f);
|
|
14908
14908
|
this.cache[abs] = "FILE";
|
|
14909
14909
|
if (abs === this.cwdAbs) {
|
|
14910
|
-
var
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
throw
|
|
14910
|
+
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
14911
|
+
error.path = this.cwd;
|
|
14912
|
+
error.code = er.code;
|
|
14913
|
+
throw error;
|
|
14914
14914
|
}
|
|
14915
14915
|
break;
|
|
14916
14916
|
case "ENOENT":
|
|
@@ -15514,10 +15514,10 @@ var require_index_688c5d50 = __commonJS({
|
|
|
15514
15514
|
var abs = this._makeAbs(f);
|
|
15515
15515
|
this.cache[abs] = "FILE";
|
|
15516
15516
|
if (abs === this.cwdAbs) {
|
|
15517
|
-
var
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
this.emit("error",
|
|
15517
|
+
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
15518
|
+
error.path = this.cwd;
|
|
15519
|
+
error.code = er.code;
|
|
15520
|
+
this.emit("error", error);
|
|
15521
15521
|
this.abort();
|
|
15522
15522
|
}
|
|
15523
15523
|
break;
|
|
@@ -16393,14 +16393,14 @@ var require_index_688c5d50 = __commonJS({
|
|
|
16393
16393
|
} else {
|
|
16394
16394
|
exports3.storage.removeItem("debug");
|
|
16395
16395
|
}
|
|
16396
|
-
} catch (
|
|
16396
|
+
} catch (error) {
|
|
16397
16397
|
}
|
|
16398
16398
|
}
|
|
16399
16399
|
function load() {
|
|
16400
16400
|
let r;
|
|
16401
16401
|
try {
|
|
16402
16402
|
r = exports3.storage.getItem("debug");
|
|
16403
|
-
} catch (
|
|
16403
|
+
} catch (error) {
|
|
16404
16404
|
}
|
|
16405
16405
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
16406
16406
|
r = process.env.DEBUG;
|
|
@@ -16410,7 +16410,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
16410
16410
|
function localstorage() {
|
|
16411
16411
|
try {
|
|
16412
16412
|
return localStorage;
|
|
16413
|
-
} catch (
|
|
16413
|
+
} catch (error) {
|
|
16414
16414
|
}
|
|
16415
16415
|
}
|
|
16416
16416
|
module3.exports = common(exports3);
|
|
@@ -16418,8 +16418,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
16418
16418
|
formatters.j = function(v) {
|
|
16419
16419
|
try {
|
|
16420
16420
|
return JSON.stringify(v);
|
|
16421
|
-
} catch (
|
|
16422
|
-
return "[UnexpectedJSONParseError]: " +
|
|
16421
|
+
} catch (error) {
|
|
16422
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
16423
16423
|
}
|
|
16424
16424
|
};
|
|
16425
16425
|
});
|
|
@@ -16518,7 +16518,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
16518
16518
|
221
|
|
16519
16519
|
];
|
|
16520
16520
|
}
|
|
16521
|
-
} catch (
|
|
16521
|
+
} catch (error) {
|
|
16522
16522
|
}
|
|
16523
16523
|
exports3.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
16524
16524
|
return /^debug_/i.test(key);
|
|
@@ -17429,11 +17429,11 @@ var require_index_688c5d50 = __commonJS({
|
|
|
17429
17429
|
hash
|
|
17430
17430
|
};
|
|
17431
17431
|
});
|
|
17432
|
-
} catch (
|
|
17432
|
+
} catch (error) {
|
|
17433
17433
|
throw new DegitError(`could not fetch remote ${repo.url}`, {
|
|
17434
17434
|
code: "COULD_NOT_FETCH",
|
|
17435
17435
|
url: repo.url,
|
|
17436
|
-
original:
|
|
17436
|
+
original: error
|
|
17437
17437
|
});
|
|
17438
17438
|
}
|
|
17439
17439
|
}
|
|
@@ -23421,9 +23421,9 @@ var require_async_iterator = __commonJS({
|
|
|
23421
23421
|
},
|
|
23422
23422
|
next: function next() {
|
|
23423
23423
|
var _this = this;
|
|
23424
|
-
var
|
|
23425
|
-
if (
|
|
23426
|
-
return Promise.reject(
|
|
23424
|
+
var error = this[kError];
|
|
23425
|
+
if (error !== null) {
|
|
23426
|
+
return Promise.reject(error);
|
|
23427
23427
|
}
|
|
23428
23428
|
if (this[kEnded]) {
|
|
23429
23429
|
return Promise.resolve(createIterResult(void 0, true));
|
|
@@ -23536,8 +23536,8 @@ var require_from = __commonJS({
|
|
|
23536
23536
|
try {
|
|
23537
23537
|
var info = gen[key](arg);
|
|
23538
23538
|
var value = info.value;
|
|
23539
|
-
} catch (
|
|
23540
|
-
reject(
|
|
23539
|
+
} catch (error) {
|
|
23540
|
+
reject(error);
|
|
23541
23541
|
return;
|
|
23542
23542
|
}
|
|
23543
23543
|
if (info.done) {
|
|
@@ -24567,16 +24567,16 @@ var require_pipeline = __commonJS({
|
|
|
24567
24567
|
if (streams.length < 2) {
|
|
24568
24568
|
throw new ERR_MISSING_ARGS("streams");
|
|
24569
24569
|
}
|
|
24570
|
-
var
|
|
24570
|
+
var error;
|
|
24571
24571
|
var destroys = streams.map(function(stream, i) {
|
|
24572
24572
|
var reading = i < streams.length - 1;
|
|
24573
24573
|
var writing = i > 0;
|
|
24574
24574
|
return destroyer(stream, reading, writing, function(err) {
|
|
24575
|
-
if (!
|
|
24575
|
+
if (!error) error = err;
|
|
24576
24576
|
if (err) destroys.forEach(call);
|
|
24577
24577
|
if (reading) return;
|
|
24578
24578
|
destroys.forEach(call);
|
|
24579
|
-
callback(
|
|
24579
|
+
callback(error);
|
|
24580
24580
|
});
|
|
24581
24581
|
});
|
|
24582
24582
|
return streams.reduce(pipe);
|
|
@@ -26912,7 +26912,6 @@ var logger = {
|
|
|
26912
26912
|
// src/core/installer.ts
|
|
26913
26913
|
async function installAgent(options2) {
|
|
26914
26914
|
const { source, sourcePath, global: global2, platforms, agentName, copy, selectedAgents } = options2;
|
|
26915
|
-
logger.info(`Installing agent from: ${source}`);
|
|
26916
26915
|
let tempDir;
|
|
26917
26916
|
let agents;
|
|
26918
26917
|
if (selectedAgents) {
|
|
@@ -26946,7 +26945,6 @@ async function installAgent(options2) {
|
|
|
26946
26945
|
} else {
|
|
26947
26946
|
copyFileSync2(sourcePath2, finalPath);
|
|
26948
26947
|
}
|
|
26949
|
-
logger.success(`Copied agent "${name}" to ${finalPath}`);
|
|
26950
26948
|
}
|
|
26951
26949
|
}
|
|
26952
26950
|
}
|
|
@@ -27099,20 +27097,6 @@ function showBanner() {
|
|
|
27099
27097
|
console.log(` ${import_picocolors2.default.dim("$")} ${import_picocolors2.default.cyan("npx opencode-agents find")} ${import_picocolors2.default.dim("Search for agents")}`);
|
|
27100
27098
|
console.log();
|
|
27101
27099
|
}
|
|
27102
|
-
function renderSkillCard(name, description, index) {
|
|
27103
|
-
console.log();
|
|
27104
|
-
console.log(` ${S_BAR}`);
|
|
27105
|
-
console.log(` ${S_BRANCH} ${import_picocolors2.default.cyan("Agent:")} ${import_picocolors2.default.bold(name)}`);
|
|
27106
|
-
console.log(` ${S_BAR}`);
|
|
27107
|
-
console.log(` ${S_BRANCH_END} ${import_picocolors2.default.dim(description)}`);
|
|
27108
|
-
console.log();
|
|
27109
|
-
}
|
|
27110
|
-
function success(message) {
|
|
27111
|
-
console.log(` ${import_picocolors2.default.green("\u2713")} ${message}`);
|
|
27112
|
-
}
|
|
27113
|
-
function error(message) {
|
|
27114
|
-
console.log(` ${import_picocolors2.default.red("\u2717")} ${message}`);
|
|
27115
|
-
}
|
|
27116
27100
|
|
|
27117
27101
|
// src/commands/add.ts
|
|
27118
27102
|
async function promptInstallLocation() {
|
|
@@ -27173,32 +27157,35 @@ async function addCommand(source, options2) {
|
|
|
27173
27157
|
if (isGlobal === void 0) {
|
|
27174
27158
|
isGlobal = await promptInstallLocation();
|
|
27175
27159
|
}
|
|
27176
|
-
|
|
27160
|
+
console.log(`${S_STEP_ACTIVE} ${import_picocolors3.default.cyan("Source:")} ${import_picocolors3.default.dim(`https://github.com/${source}.git`)}`);
|
|
27161
|
+
console.log(S_BAR);
|
|
27177
27162
|
const s = bt2();
|
|
27178
27163
|
s.start("Cloning repository...");
|
|
27179
27164
|
let tempDir;
|
|
27180
27165
|
try {
|
|
27181
27166
|
tempDir = await fetchSource2(source);
|
|
27182
|
-
s.stop("Repository cloned
|
|
27167
|
+
s.stop(`${import_picocolors3.default.green("\u2713")} Repository cloned`);
|
|
27183
27168
|
} catch (err) {
|
|
27184
|
-
s.stop("Failed to clone repository
|
|
27185
|
-
error(`Failed to fetch source: ${err instanceof Error ? err.message : String(err)}`);
|
|
27169
|
+
s.stop(`${import_picocolors3.default.red("\u2717")} Failed to clone repository`);
|
|
27170
|
+
R2.error(`Failed to fetch source: ${err instanceof Error ? err.message : String(err)}`);
|
|
27186
27171
|
process.exit(1);
|
|
27187
27172
|
}
|
|
27173
|
+
console.log(S_BAR);
|
|
27188
27174
|
s.start("Discovering agents...");
|
|
27189
27175
|
let agents;
|
|
27190
27176
|
try {
|
|
27191
27177
|
agents = await discoverFromDirectory(tempDir);
|
|
27192
|
-
s.stop(
|
|
27178
|
+
s.stop(`${import_picocolors3.default.green("\u2713")} Found ${agents.length} agent(s)`);
|
|
27193
27179
|
} catch (err) {
|
|
27194
|
-
s.stop("Failed to discover agents
|
|
27195
|
-
error(`Failed to discover agents: ${err instanceof Error ? err.message : String(err)}`);
|
|
27180
|
+
s.stop(`${import_picocolors3.default.red("\u2717")} Failed to discover agents`);
|
|
27181
|
+
R2.error(`Failed to discover agents: ${err instanceof Error ? err.message : String(err)}`);
|
|
27196
27182
|
process.exit(1);
|
|
27197
27183
|
}
|
|
27198
27184
|
if (agents.length === 0) {
|
|
27199
|
-
error("No agents found in the source");
|
|
27185
|
+
R2.error("No agents found in the source");
|
|
27200
27186
|
process.exit(1);
|
|
27201
27187
|
}
|
|
27188
|
+
console.log(S_BAR);
|
|
27202
27189
|
let selectedAgents;
|
|
27203
27190
|
if (options2.yes) {
|
|
27204
27191
|
selectedAgents = agents;
|
|
@@ -27209,15 +27196,15 @@ async function addCommand(source, options2) {
|
|
|
27209
27196
|
Ne("No agents selected, aborting");
|
|
27210
27197
|
process.exit(0);
|
|
27211
27198
|
}
|
|
27212
|
-
console.log();
|
|
27213
|
-
|
|
27214
|
-
|
|
27215
|
-
|
|
27216
|
-
|
|
27217
|
-
|
|
27218
|
-
|
|
27219
|
-
|
|
27220
|
-
s.start(
|
|
27199
|
+
console.log(`${S_BAR} ${S_BRANCH} ${import_picocolors3.default.dim("Selected:")}`);
|
|
27200
|
+
selectedAgents.forEach((agent, index) => {
|
|
27201
|
+
const isLast = index === selectedAgents.length - 1;
|
|
27202
|
+
const prefix = isLast ? S_BRANCH_END : S_BRANCH;
|
|
27203
|
+
const name = agent.agent.name || basename4(agent.path, ".md");
|
|
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
27208
|
try {
|
|
27222
27209
|
let platforms;
|
|
27223
27210
|
if (options2.agent && options2.agent.length > 0) {
|
|
@@ -27236,16 +27223,14 @@ async function addCommand(source, options2) {
|
|
|
27236
27223
|
selectedAgents
|
|
27237
27224
|
};
|
|
27238
27225
|
await installAgent(installOptions);
|
|
27239
|
-
s.stop(import_picocolors3.default.green(
|
|
27240
|
-
console.log();
|
|
27241
|
-
success("Installation complete!");
|
|
27226
|
+
s.stop(`${import_picocolors3.default.green("\u2713")} Successfully installed ${selectedAgents.length} agent(s)`);
|
|
27242
27227
|
console.log();
|
|
27243
|
-
console.log(import_picocolors3.default.dim("
|
|
27244
|
-
console.log(import_picocolors3.default.dim(` npx opencode-agents list`));
|
|
27228
|
+
console.log(import_picocolors3.default.dim(" Next steps:"));
|
|
27229
|
+
console.log(import_picocolors3.default.dim(` npx opencode-agents list View installed agents`));
|
|
27245
27230
|
console.log();
|
|
27246
27231
|
} catch (err) {
|
|
27247
|
-
s.stop("Installation failed
|
|
27248
|
-
error(`Failed to install agent: ${err instanceof Error ? err.message : String(err)}`);
|
|
27232
|
+
s.stop(`${import_picocolors3.default.red("\u2717")} Installation failed`);
|
|
27233
|
+
R2.error(`Failed to install agent: ${err instanceof Error ? err.message : String(err)}`);
|
|
27249
27234
|
process.exit(1);
|
|
27250
27235
|
} finally {
|
|
27251
27236
|
if (existsSync4(tempDir) && tempDir.startsWith(tmpdir2())) {
|
|
@@ -27272,32 +27257,32 @@ async function listCommand(options2) {
|
|
|
27272
27257
|
continue;
|
|
27273
27258
|
}
|
|
27274
27259
|
hasAnyAgents = true;
|
|
27275
|
-
console.log(import_picocolors4.default.bold(import_picocolors4.default.cyan(
|
|
27260
|
+
console.log(import_picocolors4.default.bold(import_picocolors4.default.cyan(`\u25C6 ${platform} agents`)));
|
|
27276
27261
|
console.log();
|
|
27277
27262
|
if (projectAgents.length > 0) {
|
|
27278
|
-
console.log(` ${S_BRANCH} ${import_picocolors4.default.dim("Project")} ${import_picocolors4.default.dim("(./.opencode/agents/)")}`);
|
|
27263
|
+
console.log(` ${globalAgents.length > 0 ? S_BRANCH : S_BRANCH_END} ${import_picocolors4.default.dim("Project")} ${import_picocolors4.default.dim("(./.opencode/agents/)")}`);
|
|
27279
27264
|
projectAgents.forEach((agent, index) => {
|
|
27280
|
-
const isLast = index === projectAgents.length - 1
|
|
27265
|
+
const isLast = index === projectAgents.length - 1;
|
|
27281
27266
|
const prefix = isLast ? S_BRANCH_END : S_BRANCH;
|
|
27282
27267
|
const name = agent.agent.name || agent.path.split(/[/\\]/).pop()?.replace(".md", "") || "unknown";
|
|
27283
27268
|
const mode = agent.agent.mode || "subagent";
|
|
27284
|
-
console.log(` ${S_BAR} ${prefix} ${S_BULLET} ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
|
|
27269
|
+
console.log(` ${globalAgents.length > 0 ? S_BAR : " "} ${prefix} ${S_BULLET} ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
|
|
27285
27270
|
if (agent.agent.description) {
|
|
27286
|
-
console.log(` ${S_BAR} ${isLast ? " " : `${S_BAR} `} ${import_picocolors4.default.dim(agent.agent.description)}`);
|
|
27271
|
+
console.log(` ${globalAgents.length > 0 ? S_BAR : " "} ${isLast ? " " : `${S_BAR} `} ${import_picocolors4.default.dim(agent.agent.description)}`);
|
|
27287
27272
|
}
|
|
27288
27273
|
});
|
|
27289
27274
|
console.log();
|
|
27290
27275
|
}
|
|
27291
27276
|
if (globalAgents.length > 0) {
|
|
27292
|
-
console.log(` ${
|
|
27277
|
+
console.log(` ${S_BRANCH_END} ${import_picocolors4.default.dim("Global")} ${import_picocolors4.default.dim("(~/.config/opencode/agents/)")}`);
|
|
27293
27278
|
globalAgents.forEach((agent, index) => {
|
|
27294
27279
|
const isLast = index === globalAgents.length - 1;
|
|
27295
27280
|
const prefix = isLast ? S_BRANCH_END : S_BRANCH;
|
|
27296
27281
|
const name = agent.agent.name || agent.path.split(/[/\\]/).pop()?.replace(".md", "") || "unknown";
|
|
27297
27282
|
const mode = agent.agent.mode || "subagent";
|
|
27298
|
-
console.log(`
|
|
27283
|
+
console.log(` ${prefix} ${S_BULLET} ${import_picocolors4.default.bold(name)} ${import_picocolors4.default.dim(`[${mode}]`)}`);
|
|
27299
27284
|
if (agent.agent.description) {
|
|
27300
|
-
console.log(`
|
|
27285
|
+
console.log(` ${isLast ? " " : `${S_BAR} `} ${import_picocolors4.default.dim(agent.agent.description)}`);
|
|
27301
27286
|
}
|
|
27302
27287
|
});
|
|
27303
27288
|
console.log();
|
|
@@ -27306,7 +27291,7 @@ async function listCommand(options2) {
|
|
|
27306
27291
|
if (!hasAnyAgents) {
|
|
27307
27292
|
R2.info(import_picocolors4.default.dim("No agents installed"));
|
|
27308
27293
|
console.log();
|
|
27309
|
-
console.log(import_picocolors4.default.dim("
|
|
27294
|
+
console.log(import_picocolors4.default.dim(" To install an agent:"));
|
|
27310
27295
|
console.log(import_picocolors4.default.dim(` npx opencode-agents add <repo>`));
|
|
27311
27296
|
console.log();
|
|
27312
27297
|
}
|