@brainbase-labs/cli 0.50.0 → 0.51.0
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 +62 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36091,7 +36091,7 @@ function padStart(s, n) {
|
|
|
36091
36091
|
// package.json
|
|
36092
36092
|
var package_default = {
|
|
36093
36093
|
name: "@brainbase-labs/cli",
|
|
36094
|
-
version: "0.
|
|
36094
|
+
version: "0.51.0",
|
|
36095
36095
|
description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
|
|
36096
36096
|
type: "module",
|
|
36097
36097
|
bin: {
|
|
@@ -68334,6 +68334,9 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
|
68334
68334
|
function sanitizeLabel(s3) {
|
|
68335
68335
|
return s3.replace(/\u001b\][\s\S]*?(?:\u0007|\u001b\\|$)/g, "").replace(/\u001b\[[\u0030-\u003f]*[\u0020-\u002f]*[\u0040-\u007e]?/g, "").replace(/\u001b[\s\S]?/g, "").replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, "");
|
|
68336
68336
|
}
|
|
68337
|
+
function sanitizeLines(s3) {
|
|
68338
|
+
return s3.split(/\r\n|[\n\r\u2028\u2029]/).map(sanitizeLabel);
|
|
68339
|
+
}
|
|
68337
68340
|
|
|
68338
68341
|
// src/cli/agent-status.ts
|
|
68339
68342
|
function capabilityDrifted(field) {
|
|
@@ -86450,7 +86453,8 @@ async function agentNames(ids) {
|
|
|
86450
86453
|
}
|
|
86451
86454
|
function agentLabel(id, names) {
|
|
86452
86455
|
const name = names.get(id.toLowerCase());
|
|
86453
|
-
|
|
86456
|
+
const safeId = sanitizeLabel(id);
|
|
86457
|
+
return name ? `${name} (${safeId})` : safeId;
|
|
86454
86458
|
}
|
|
86455
86459
|
|
|
86456
86460
|
// src/cli/task-list.ts
|
|
@@ -86508,8 +86512,8 @@ function formatTaskList(tasks, names, agentId, interfaceId, labelFiltered = fals
|
|
|
86508
86512
|
for (const task of tasks) {
|
|
86509
86513
|
const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors65.default.dim("(untitled)");
|
|
86510
86514
|
lines.push(` ${statusLabel(task.status)} ${import_picocolors65.default.bold(title)}`);
|
|
86511
|
-
lines.push(` ${import_picocolors65.default.dim(task.id)}`);
|
|
86512
|
-
lines.push(` ${import_picocolors65.default.dim(`agent ${agentLabel(task.agent_id, names)} · created ${task.created_at}`)}`);
|
|
86515
|
+
lines.push(` ${import_picocolors65.default.dim(sanitizeLabel(task.id))}`);
|
|
86516
|
+
lines.push(` ${import_picocolors65.default.dim(`agent ${agentLabel(task.agent_id, names)} · created ${sanitizeLabel(task.created_at)}`)}`);
|
|
86513
86517
|
lines.push("");
|
|
86514
86518
|
}
|
|
86515
86519
|
lines.push(` ${import_picocolors65.default.dim("inspect one with")} ${import_picocolors65.default.cyan("brainbase task get <id>")}`, "");
|
|
@@ -86517,7 +86521,7 @@ function formatTaskList(tasks, names, agentId, interfaceId, labelFiltered = fals
|
|
|
86517
86521
|
`);
|
|
86518
86522
|
}
|
|
86519
86523
|
function statusLabel(status) {
|
|
86520
|
-
const padded = status.padEnd(14);
|
|
86524
|
+
const padded = sanitizeLabel(status).padEnd(14);
|
|
86521
86525
|
switch (status) {
|
|
86522
86526
|
case "success":
|
|
86523
86527
|
return import_picocolors65.default.green(padded);
|
|
@@ -86563,49 +86567,60 @@ async function readEvalRuns(task) {
|
|
|
86563
86567
|
}
|
|
86564
86568
|
function format2(task, evals, names) {
|
|
86565
86569
|
const lines = [""];
|
|
86566
|
-
const title = task.title
|
|
86570
|
+
const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors66.default.dim("(untitled)");
|
|
86571
|
+
const id = sanitizeLabel(task.id);
|
|
86567
86572
|
lines.push(` ${statusLabel(task.status)} ${import_picocolors66.default.bold(title)}`);
|
|
86568
86573
|
lines.push("");
|
|
86569
|
-
lines.push(` ${import_picocolors66.default.dim("task")} ${
|
|
86574
|
+
lines.push(` ${import_picocolors66.default.dim("task")} ${id}`);
|
|
86570
86575
|
lines.push(` ${import_picocolors66.default.dim("agent")} ${agentLabel(task.agent_id, names)}`);
|
|
86571
|
-
|
|
86576
|
+
if (task.model !== undefined) {
|
|
86577
|
+
const model = task.model?.trim() ? sanitizeLabel(task.model) : import_picocolors66.default.dim("agent default");
|
|
86578
|
+
lines.push(` ${import_picocolors66.default.dim("model")} ${model}`);
|
|
86579
|
+
}
|
|
86580
|
+
lines.push(` ${import_picocolors66.default.dim("created")} ${sanitizeLabel(task.created_at)}`);
|
|
86572
86581
|
if (task.parent_task_id) {
|
|
86573
|
-
lines.push(` ${import_picocolors66.default.dim("parent")} ${task.parent_task_id}`);
|
|
86582
|
+
lines.push(` ${import_picocolors66.default.dim("parent")} ${sanitizeLabel(task.parent_task_id)}`);
|
|
86574
86583
|
}
|
|
86575
86584
|
if (task.machine_id) {
|
|
86576
|
-
|
|
86585
|
+
const size2 = task.machine_size ? ` (size ${sanitizeLabel(task.machine_size)})` : "";
|
|
86586
|
+
lines.push(` ${import_picocolors66.default.dim("machine")} ${sanitizeLabel(task.machine_id)}${size2}`);
|
|
86577
86587
|
}
|
|
86578
86588
|
if (task.sandbox_id)
|
|
86579
|
-
lines.push(` ${import_picocolors66.default.dim("sandbox")} ${task.sandbox_id}`);
|
|
86580
|
-
const failure = failureSummary(task);
|
|
86589
|
+
lines.push(` ${import_picocolors66.default.dim("sandbox")} ${sanitizeLabel(task.sandbox_id)}`);
|
|
86590
|
+
const [failure, ...failureRest] = sanitizeLines(failureSummary(task) ?? "").filter((line2) => line2.trim());
|
|
86581
86591
|
if (failure) {
|
|
86592
|
+
const label3 = " failure ";
|
|
86582
86593
|
lines.push("");
|
|
86583
86594
|
lines.push(` ${import_picocolors66.default.red("failure")} ${failure}`);
|
|
86595
|
+
for (const line2 of failureRest)
|
|
86596
|
+
lines.push(`${" ".repeat(label3.length)}${line2}`);
|
|
86584
86597
|
}
|
|
86585
86598
|
const metadata = Object.entries(task.metadata ?? {});
|
|
86586
86599
|
if (metadata.length > 0) {
|
|
86587
86600
|
lines.push("");
|
|
86588
86601
|
lines.push(` ${import_picocolors66.default.bold(import_picocolors66.default.dim("METADATA"))}`);
|
|
86589
86602
|
for (const [key2, value2] of metadata) {
|
|
86590
|
-
lines.push(` ${import_picocolors66.default.dim(key2)} ${value2}`);
|
|
86603
|
+
lines.push(` ${import_picocolors66.default.dim(sanitizeLabel(key2))} ${sanitizeLabel(String(value2))}`);
|
|
86591
86604
|
}
|
|
86592
86605
|
}
|
|
86593
86606
|
lines.push("");
|
|
86594
86607
|
lines.push(` ${import_picocolors66.default.bold(import_picocolors66.default.dim("EVAL VERDICTS"))}`);
|
|
86595
86608
|
if (evals.unavailable) {
|
|
86596
|
-
lines.push(` ${import_picocolors66.default.dim(evals.unavailable)}`);
|
|
86609
|
+
lines.push(` ${import_picocolors66.default.dim(sanitizeLabel(evals.unavailable))}`);
|
|
86597
86610
|
} else if (evals.runs.length === 0) {
|
|
86598
86611
|
lines.push(` ${import_picocolors66.default.dim("none")}`);
|
|
86599
86612
|
} else {
|
|
86600
86613
|
for (const run of evals.runs) {
|
|
86601
|
-
const verdict = run.passed === true ? import_picocolors66.default.green("pass") : run.passed === false ? import_picocolors66.default.red("fail") : import_picocolors66.default.dim(run.status);
|
|
86602
|
-
lines.push(` ${verdict} ${run.eval_slug ?? run.eval_id}`);
|
|
86603
|
-
|
|
86604
|
-
|
|
86614
|
+
const verdict = run.passed === true ? import_picocolors66.default.green("pass") : run.passed === false ? import_picocolors66.default.red("fail") : import_picocolors66.default.dim(sanitizeLabel(run.status));
|
|
86615
|
+
lines.push(` ${verdict} ${sanitizeLabel(run.eval_slug ?? run.eval_id)}`);
|
|
86616
|
+
for (const line2 of sanitizeLines(run.reasoning ?? "")) {
|
|
86617
|
+
if (line2.trim())
|
|
86618
|
+
lines.push(` ${import_picocolors66.default.dim(line2)}`);
|
|
86619
|
+
}
|
|
86605
86620
|
}
|
|
86606
86621
|
}
|
|
86607
86622
|
lines.push("");
|
|
86608
|
-
lines.push(` ${import_picocolors66.default.dim("read its transcript with")} ${import_picocolors66.default.cyan(`brainbase task logs ${
|
|
86623
|
+
lines.push(` ${import_picocolors66.default.dim("read its transcript with")} ${import_picocolors66.default.cyan(`brainbase task logs ${id}`)}`, "");
|
|
86609
86624
|
return lines.join(`
|
|
86610
86625
|
`);
|
|
86611
86626
|
}
|
|
@@ -97097,7 +97112,32 @@ async function runBenchmark(sub, args, write3 = (value2) => process.stdout.write
|
|
|
97097
97112
|
}
|
|
97098
97113
|
}
|
|
97099
97114
|
|
|
97115
|
+
// src/ui/console-streams.ts
|
|
97116
|
+
import { format as format3 } from "node:util";
|
|
97117
|
+
function routeConsoleThroughStreams() {
|
|
97118
|
+
if (typeof globalThis.Bun === "undefined")
|
|
97119
|
+
return;
|
|
97120
|
+
const writer = (stream) => (...args) => {
|
|
97121
|
+
if (!stream.writable)
|
|
97122
|
+
return;
|
|
97123
|
+
stream.write(`${format3(...args)}
|
|
97124
|
+
`);
|
|
97125
|
+
};
|
|
97126
|
+
console.log = writer(process.stdout);
|
|
97127
|
+
console.info = writer(process.stdout);
|
|
97128
|
+
console.debug = writer(process.stdout);
|
|
97129
|
+
console.warn = writer(process.stderr);
|
|
97130
|
+
console.error = writer(process.stderr);
|
|
97131
|
+
const ignoreClosedReader = (error2) => {
|
|
97132
|
+
if (error2.code !== "EPIPE")
|
|
97133
|
+
throw error2;
|
|
97134
|
+
};
|
|
97135
|
+
process.stdout.on("error", ignoreClosedReader);
|
|
97136
|
+
process.stderr.on("error", ignoreClosedReader);
|
|
97137
|
+
}
|
|
97138
|
+
|
|
97100
97139
|
// src/index.ts
|
|
97140
|
+
routeConsoleThroughStreams();
|
|
97101
97141
|
var PROTECTED = new Set([
|
|
97102
97142
|
"template",
|
|
97103
97143
|
"skill",
|
|
@@ -97782,8 +97822,10 @@ ${didYouMean(cmd, COMMANDS3, "brainbase")}`);
|
|
|
97782
97822
|
process14.exit(1);
|
|
97783
97823
|
}
|
|
97784
97824
|
} catch (err) {
|
|
97825
|
+
const message2 = sanitizeLines(err.message).join(`
|
|
97826
|
+
`);
|
|
97785
97827
|
console.error(import_picocolors80.default.red(`
|
|
97786
|
-
${
|
|
97828
|
+
${message2}`));
|
|
97787
97829
|
if (err instanceof ApiError && err.status === 401 && !err.message.includes("brainbase login")) {
|
|
97788
97830
|
console.error(` Run ${import_picocolors80.default.cyan("brainbase login")} to connect this device.`);
|
|
97789
97831
|
}
|