@brainbase-labs/cli 0.8.2 → 0.9.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 +373 -97
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28582,9 +28582,9 @@ var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
|
28582
28582
|
});
|
|
28583
28583
|
|
|
28584
28584
|
// src/index.ts
|
|
28585
|
-
var
|
|
28585
|
+
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
28586
28586
|
import process14 from "node:process";
|
|
28587
|
-
import
|
|
28587
|
+
import fs52 from "node:fs";
|
|
28588
28588
|
|
|
28589
28589
|
// src/cli/template.ts
|
|
28590
28590
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
@@ -29449,7 +29449,7 @@ function padStart(s, n) {
|
|
|
29449
29449
|
// package.json
|
|
29450
29450
|
var package_default = {
|
|
29451
29451
|
name: "@brainbase-labs/cli",
|
|
29452
|
-
version: "0.
|
|
29452
|
+
version: "0.9.0",
|
|
29453
29453
|
description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
|
|
29454
29454
|
type: "module",
|
|
29455
29455
|
bin: {
|
|
@@ -36201,6 +36201,31 @@ function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
|
|
|
36201
36201
|
|
|
36202
36202
|
// src/harnesses/codex/config-toml.ts
|
|
36203
36203
|
import path14 from "node:path";
|
|
36204
|
+
function normalizeCodexMcpEntry(entry) {
|
|
36205
|
+
const out = { ...entry };
|
|
36206
|
+
delete out.is_enabled;
|
|
36207
|
+
const hasUrl = typeof out.url === "string" && out.url.length > 0;
|
|
36208
|
+
if (hasUrl) {
|
|
36209
|
+
delete out.command;
|
|
36210
|
+
delete out.args;
|
|
36211
|
+
delete out.env;
|
|
36212
|
+
if (out.headers && typeof out.headers === "object" && !isEmptyObject(out.headers)) {
|
|
36213
|
+
out.http_headers = out.headers;
|
|
36214
|
+
}
|
|
36215
|
+
delete out.headers;
|
|
36216
|
+
} else {
|
|
36217
|
+
delete out.url;
|
|
36218
|
+
delete out.headers;
|
|
36219
|
+
if (Array.isArray(out.args) && out.args.length === 0)
|
|
36220
|
+
delete out.args;
|
|
36221
|
+
if (isEmptyObject(out.env))
|
|
36222
|
+
delete out.env;
|
|
36223
|
+
}
|
|
36224
|
+
return out;
|
|
36225
|
+
}
|
|
36226
|
+
function isEmptyObject(v2) {
|
|
36227
|
+
return !!v2 && typeof v2 === "object" && Object.keys(v2).length === 0;
|
|
36228
|
+
}
|
|
36204
36229
|
function readCodexConfig(file) {
|
|
36205
36230
|
if (!exists(file))
|
|
36206
36231
|
return {};
|
|
@@ -36594,7 +36619,7 @@ async function installMcp2(comp, opts, ctx) {
|
|
|
36594
36619
|
}
|
|
36595
36620
|
}
|
|
36596
36621
|
}
|
|
36597
|
-
setMcpServer2(config, comp.slug, resolveMcpEnvTemplates(payload));
|
|
36622
|
+
setMcpServer2(config, comp.slug, normalizeCodexMcpEntry(resolveMcpEnvTemplates(payload)));
|
|
36598
36623
|
return {
|
|
36599
36624
|
type: "mcp",
|
|
36600
36625
|
slug: comp.slug,
|
|
@@ -54570,7 +54595,7 @@ function printHelp() {
|
|
|
54570
54595
|
}
|
|
54571
54596
|
|
|
54572
54597
|
// src/cli/orchestration.ts
|
|
54573
|
-
var
|
|
54598
|
+
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
54574
54599
|
|
|
54575
54600
|
// src/cli/orchestration-pull.ts
|
|
54576
54601
|
import path54 from "node:path";
|
|
@@ -54600,11 +54625,24 @@ var EdgeSchema = exports_external.object({
|
|
|
54600
54625
|
description: exports_external.string().optional(),
|
|
54601
54626
|
payload_schema: exports_external.record(exports_external.unknown()).optional()
|
|
54602
54627
|
});
|
|
54628
|
+
var TriggerEdgeSchema = exports_external.object({
|
|
54629
|
+
agent: exports_external.string(),
|
|
54630
|
+
description: exports_external.string().optional(),
|
|
54631
|
+
payload_schema: exports_external.record(exports_external.unknown()).optional()
|
|
54632
|
+
});
|
|
54633
|
+
var TriggerSchema = exports_external.object({
|
|
54634
|
+
type: exports_external.string(),
|
|
54635
|
+
node_id: exports_external.string(),
|
|
54636
|
+
is_active: exports_external.boolean().optional(),
|
|
54637
|
+
config: exports_external.record(exports_external.unknown()).optional(),
|
|
54638
|
+
to: exports_external.array(TriggerEdgeSchema).default([])
|
|
54639
|
+
});
|
|
54603
54640
|
var OrchestrationManifestSchema = exports_external.object({
|
|
54604
54641
|
schema: exports_external.literal(1),
|
|
54605
54642
|
orchestration: OrchMetaSchema,
|
|
54606
54643
|
members: exports_external.array(MemberSchema).default([]),
|
|
54607
|
-
edges: exports_external.array(EdgeSchema).default([])
|
|
54644
|
+
edges: exports_external.array(EdgeSchema).default([]),
|
|
54645
|
+
triggers: exports_external.array(TriggerSchema).optional()
|
|
54608
54646
|
});
|
|
54609
54647
|
function orchManifestPath(cwd2) {
|
|
54610
54648
|
return path51.join(cwd2, ORCH_MANIFEST_FILE);
|
|
@@ -54634,7 +54672,7 @@ function writeOrchManifest(cwd2, manifest) {
|
|
|
54634
54672
|
doc.contents = manifest;
|
|
54635
54673
|
doc.commentBefore = ` brainbase-orchestration.yaml — declarative orchestration manifest.
|
|
54636
54674
|
` + ` Committed to source control. Edit by hand, then
|
|
54637
|
-
` + " `brainbase orchestration push`. Member agents live under ./agents/.";
|
|
54675
|
+
` + " `brainbase orchestration push`. Member agents live under ./agents/." + "\n A `triggers:` block (if present) is READ-ONLY — managed in the web app\n" + " and ignored by `orchestration push`.";
|
|
54638
54676
|
fs47.writeFileSync(orchManifestPath(cwd2), String(doc), "utf8");
|
|
54639
54677
|
}
|
|
54640
54678
|
function memberDir(cwd2, slug) {
|
|
@@ -54644,6 +54682,9 @@ var MEMBER_SLUG_MAX = 50;
|
|
|
54644
54682
|
function slugifyRaw(raw) {
|
|
54645
54683
|
return (raw || "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
54646
54684
|
}
|
|
54685
|
+
function slugifyMemberName(raw) {
|
|
54686
|
+
return slugifyRaw(raw) || "agent";
|
|
54687
|
+
}
|
|
54647
54688
|
function resolveMemberSlugs(members) {
|
|
54648
54689
|
const SAFE = /^[a-z0-9][a-z0-9-]*$/;
|
|
54649
54690
|
const used = new Set;
|
|
@@ -55067,7 +55108,20 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
55067
55108
|
to: slugFor(e2.to_agent_id),
|
|
55068
55109
|
...e2.description ? { description: e2.description } : {},
|
|
55069
55110
|
...e2.payload_schema && Object.keys(e2.payload_schema).length ? { payload_schema: e2.payload_schema } : {}
|
|
55070
|
-
}))
|
|
55111
|
+
})),
|
|
55112
|
+
...cloud.triggers && cloud.triggers.length ? {
|
|
55113
|
+
triggers: cloud.triggers.map((t) => ({
|
|
55114
|
+
type: t.trigger_type,
|
|
55115
|
+
node_id: t.node_id,
|
|
55116
|
+
is_active: t.is_active,
|
|
55117
|
+
...t.config && Object.keys(t.config).length ? { config: t.config } : {},
|
|
55118
|
+
to: t.edges.map((e2) => ({
|
|
55119
|
+
agent: slugFor(e2.to_agent_id),
|
|
55120
|
+
...e2.description ? { description: e2.description } : {},
|
|
55121
|
+
...e2.payload_schema && Object.keys(e2.payload_schema).length ? { payload_schema: e2.payload_schema } : {}
|
|
55122
|
+
}))
|
|
55123
|
+
}))
|
|
55124
|
+
} : {}
|
|
55071
55125
|
};
|
|
55072
55126
|
writeOrchManifest(cwd2, manifest);
|
|
55073
55127
|
writeOrchLink(cwd2, {
|
|
@@ -55453,6 +55507,192 @@ function handleApiError7(err) {
|
|
|
55453
55507
|
}
|
|
55454
55508
|
}
|
|
55455
55509
|
|
|
55510
|
+
// src/cli/orchestration-add-agent.ts
|
|
55511
|
+
import fs51 from "node:fs";
|
|
55512
|
+
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
55513
|
+
|
|
55514
|
+
// src/core/orchestration-add.ts
|
|
55515
|
+
function resolveOrgIdForGroup(groupId, orgsWithTeams) {
|
|
55516
|
+
for (const o2 of orgsWithTeams) {
|
|
55517
|
+
if (o2.teamIds.includes(groupId))
|
|
55518
|
+
return o2.orgId;
|
|
55519
|
+
}
|
|
55520
|
+
return null;
|
|
55521
|
+
}
|
|
55522
|
+
function parseEdgeSchema(raw) {
|
|
55523
|
+
if (!raw || !raw.trim())
|
|
55524
|
+
return;
|
|
55525
|
+
let parsed;
|
|
55526
|
+
try {
|
|
55527
|
+
parsed = JSON.parse(raw);
|
|
55528
|
+
} catch {
|
|
55529
|
+
throw new Error(`--schema is not valid JSON: ${raw}`);
|
|
55530
|
+
}
|
|
55531
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
55532
|
+
throw new Error(`--schema must be a JSON object, e.g. '{"field":"type"}'`);
|
|
55533
|
+
}
|
|
55534
|
+
return parsed;
|
|
55535
|
+
}
|
|
55536
|
+
function mergeMemberAndEdges(manifest, input) {
|
|
55537
|
+
const members = manifest.members.slice();
|
|
55538
|
+
if (!members.some((m3) => m3.slug === input.slug)) {
|
|
55539
|
+
members.push({
|
|
55540
|
+
slug: input.slug,
|
|
55541
|
+
...input.name && input.name !== input.slug ? { name: input.name } : {}
|
|
55542
|
+
});
|
|
55543
|
+
}
|
|
55544
|
+
const memberSlugs = new Set(members.map((m3) => m3.slug));
|
|
55545
|
+
const newEdges = [];
|
|
55546
|
+
const addEdge = (from, to2) => {
|
|
55547
|
+
if (from === to2)
|
|
55548
|
+
throw new Error(`Edge ${from} → ${to2}: self-loops are not allowed.`);
|
|
55549
|
+
for (const slug of [from, to2]) {
|
|
55550
|
+
if (!memberSlugs.has(slug)) {
|
|
55551
|
+
throw new Error(`Edge endpoint "${slug}" is not a member. Members: ${[...memberSlugs].join(", ")}.`);
|
|
55552
|
+
}
|
|
55553
|
+
}
|
|
55554
|
+
const duplicate = manifest.edges.some((e2) => e2.from === from && e2.to === to2) || newEdges.some((e2) => e2.from === from && e2.to === to2);
|
|
55555
|
+
if (duplicate)
|
|
55556
|
+
return;
|
|
55557
|
+
newEdges.push({
|
|
55558
|
+
from,
|
|
55559
|
+
to: to2,
|
|
55560
|
+
...input.description ? { description: input.description } : {},
|
|
55561
|
+
...input.payloadSchema ? { payload_schema: input.payloadSchema } : {}
|
|
55562
|
+
});
|
|
55563
|
+
};
|
|
55564
|
+
for (const f4 of input.from)
|
|
55565
|
+
addEdge(f4, input.slug);
|
|
55566
|
+
for (const t of input.to)
|
|
55567
|
+
addEdge(input.slug, t);
|
|
55568
|
+
return { ...manifest, members, edges: [...manifest.edges, ...newEdges] };
|
|
55569
|
+
}
|
|
55570
|
+
|
|
55571
|
+
// src/cli/orchestration-add-agent.ts
|
|
55572
|
+
async function runOrchestrationAddAgent(cwd2, args) {
|
|
55573
|
+
banner("orchestration add-agent — create a member agent and wire it into the graph");
|
|
55574
|
+
const link2 = readOrchLink(cwd2);
|
|
55575
|
+
if (!link2 || !hasOrchManifest(cwd2)) {
|
|
55576
|
+
f2.warn("This folder is not a linked orchestration.");
|
|
55577
|
+
f2.info(`Run ${import_picocolors37.default.cyan("brainbase orchestration pull <id>")} first.`);
|
|
55578
|
+
return;
|
|
55579
|
+
}
|
|
55580
|
+
let manifest;
|
|
55581
|
+
try {
|
|
55582
|
+
manifest = readOrchManifest(cwd2);
|
|
55583
|
+
} catch (err) {
|
|
55584
|
+
f2.error(err.message);
|
|
55585
|
+
return;
|
|
55586
|
+
}
|
|
55587
|
+
let name = args.name?.trim();
|
|
55588
|
+
if (!name) {
|
|
55589
|
+
name = (await text({
|
|
55590
|
+
message: "New agent name",
|
|
55591
|
+
placeholder: "e.g. Refund Bot",
|
|
55592
|
+
validate: (v3) => !v3?.trim() ? "Required" : undefined,
|
|
55593
|
+
flagHint: "Pass the name positionally or with --name."
|
|
55594
|
+
})).trim();
|
|
55595
|
+
}
|
|
55596
|
+
let slug = slugifyMemberName(name);
|
|
55597
|
+
if (manifest.members.some((m3) => m3.slug === slug) || fs51.existsSync(memberDir(cwd2, slug))) {
|
|
55598
|
+
let n = 2;
|
|
55599
|
+
let candidate = `${slug}-${n}`;
|
|
55600
|
+
while (manifest.members.some((m3) => m3.slug === candidate) || fs51.existsSync(memberDir(cwd2, candidate))) {
|
|
55601
|
+
candidate = `${slug}-${++n}`;
|
|
55602
|
+
}
|
|
55603
|
+
f2.info(`Slug ${import_picocolors37.default.bold(slug)} is taken — using ${import_picocolors37.default.bold(candidate)}.`);
|
|
55604
|
+
slug = candidate;
|
|
55605
|
+
}
|
|
55606
|
+
let payloadSchema;
|
|
55607
|
+
try {
|
|
55608
|
+
payloadSchema = parseEdgeSchema(args.schema);
|
|
55609
|
+
} catch (err) {
|
|
55610
|
+
f2.error(err.message);
|
|
55611
|
+
return;
|
|
55612
|
+
}
|
|
55613
|
+
let orgId = args.orgId;
|
|
55614
|
+
if (!orgId) {
|
|
55615
|
+
const sp = de();
|
|
55616
|
+
sp.start("Resolving org for this orchestration…");
|
|
55617
|
+
try {
|
|
55618
|
+
const orgs = await api.listOrgs();
|
|
55619
|
+
const orgsWithTeams = [];
|
|
55620
|
+
for (const o2 of orgs) {
|
|
55621
|
+
const teams = await api.listTeams(o2.id);
|
|
55622
|
+
orgsWithTeams.push({ orgId: o2.id, teamIds: teams.map((t) => t.id) });
|
|
55623
|
+
}
|
|
55624
|
+
const resolved = resolveOrgIdForGroup(link2.group_id, orgsWithTeams);
|
|
55625
|
+
if (!resolved) {
|
|
55626
|
+
sp.stop("Failed.");
|
|
55627
|
+
f2.error(`Could not find an org that owns group ${import_picocolors37.default.bold(link2.group_id)}. ` + `Pass ${import_picocolors37.default.cyan("--org <id>")} explicitly.`);
|
|
55628
|
+
return;
|
|
55629
|
+
}
|
|
55630
|
+
orgId = resolved;
|
|
55631
|
+
sp.stop("Resolved org.");
|
|
55632
|
+
} catch (err) {
|
|
55633
|
+
sp.stop("Failed.");
|
|
55634
|
+
f2.error(err.message);
|
|
55635
|
+
return;
|
|
55636
|
+
}
|
|
55637
|
+
}
|
|
55638
|
+
let from = args.from ?? [];
|
|
55639
|
+
let to2 = args.to ?? [];
|
|
55640
|
+
let description = args.description;
|
|
55641
|
+
if (from.length === 0 && to2.length === 0 && isInteractive() && manifest.members.length > 0) {
|
|
55642
|
+
const memberOptions = manifest.members.map((m3) => ({ value: m3.slug, label: m3.slug }));
|
|
55643
|
+
const pickedFrom = await ae({
|
|
55644
|
+
message: `Connect ${import_picocolors37.default.bold(slug)} FROM which member(s)? — edges INTO ${slug} (space to select, enter to skip)`,
|
|
55645
|
+
options: memberOptions,
|
|
55646
|
+
required: false
|
|
55647
|
+
});
|
|
55648
|
+
if (Array.isArray(pickedFrom))
|
|
55649
|
+
from = pickedFrom;
|
|
55650
|
+
const pickedTo = await ae({
|
|
55651
|
+
message: `Connect ${import_picocolors37.default.bold(slug)} TO which member(s)? — edges OUT of ${slug} (space to select, enter to skip)`,
|
|
55652
|
+
options: memberOptions,
|
|
55653
|
+
required: false
|
|
55654
|
+
});
|
|
55655
|
+
if (Array.isArray(pickedTo))
|
|
55656
|
+
to2 = pickedTo;
|
|
55657
|
+
if ((from.length > 0 || to2.length > 0) && description === undefined) {
|
|
55658
|
+
const d3 = await te({ message: "Edge description (optional)" });
|
|
55659
|
+
if (typeof d3 === "string" && d3.trim())
|
|
55660
|
+
description = d3.trim();
|
|
55661
|
+
}
|
|
55662
|
+
}
|
|
55663
|
+
let updated;
|
|
55664
|
+
try {
|
|
55665
|
+
updated = mergeMemberAndEdges(manifest, { slug, name, from, to: to2, description, payloadSchema });
|
|
55666
|
+
} catch (err) {
|
|
55667
|
+
f2.error(err.message);
|
|
55668
|
+
return;
|
|
55669
|
+
}
|
|
55670
|
+
const dest = memberDir(cwd2, slug);
|
|
55671
|
+
try {
|
|
55672
|
+
fs51.mkdirSync(dest, { recursive: true });
|
|
55673
|
+
await runAgentCreate(dest, {
|
|
55674
|
+
name,
|
|
55675
|
+
orgId,
|
|
55676
|
+
teamId: link2.group_id,
|
|
55677
|
+
harness: args.harness,
|
|
55678
|
+
yes: true,
|
|
55679
|
+
noTracking: true
|
|
55680
|
+
});
|
|
55681
|
+
} catch (err) {
|
|
55682
|
+
try {
|
|
55683
|
+
fs51.rmSync(dest, { recursive: true, force: true });
|
|
55684
|
+
} catch {}
|
|
55685
|
+
f2.error(`Failed to create ${slug}: ${err.message}`);
|
|
55686
|
+
return;
|
|
55687
|
+
}
|
|
55688
|
+
writeOrchManifest(cwd2, updated);
|
|
55689
|
+
if (args.noPush) {
|
|
55690
|
+
f2.info(`Manifest updated. Run ${import_picocolors37.default.cyan("brainbase orchestration push")} to apply.`);
|
|
55691
|
+
return;
|
|
55692
|
+
}
|
|
55693
|
+
await runOrchestrationPush(cwd2, { yes: true, graphOnly: true });
|
|
55694
|
+
}
|
|
55695
|
+
|
|
55456
55696
|
// src/cli/orchestration.ts
|
|
55457
55697
|
async function runOrchestration(cwd2, sub, args, opts) {
|
|
55458
55698
|
switch (sub) {
|
|
@@ -55476,6 +55716,20 @@ async function runOrchestration(cwd2, sub, args, opts) {
|
|
|
55476
55716
|
case "ls":
|
|
55477
55717
|
await runOrchestrationList({ orgId: opts.orgId, teamId: opts.teamId });
|
|
55478
55718
|
return;
|
|
55719
|
+
case "add-agent":
|
|
55720
|
+
case "add":
|
|
55721
|
+
await runOrchestrationAddAgent(cwd2, {
|
|
55722
|
+
name: args[0] ?? opts.name,
|
|
55723
|
+
from: opts.from,
|
|
55724
|
+
to: opts.to,
|
|
55725
|
+
description: opts.description,
|
|
55726
|
+
schema: opts.schema,
|
|
55727
|
+
harness: opts.harness,
|
|
55728
|
+
orgId: opts.orgId,
|
|
55729
|
+
noPush: opts.noPush,
|
|
55730
|
+
yes: opts.yes
|
|
55731
|
+
});
|
|
55732
|
+
return;
|
|
55479
55733
|
case undefined:
|
|
55480
55734
|
case "help":
|
|
55481
55735
|
case "-h":
|
|
@@ -55492,19 +55746,20 @@ async function runOrchestration(cwd2, sub, args, opts) {
|
|
|
55492
55746
|
function printHelp2() {
|
|
55493
55747
|
const out = [];
|
|
55494
55748
|
out.push("");
|
|
55495
|
-
out.push(` ${
|
|
55749
|
+
out.push(` ${import_picocolors38.default.bold("brainbase orchestration")} ${import_picocolors38.default.dim("<sub> [options]")}`);
|
|
55496
55750
|
out.push("");
|
|
55497
|
-
out.push(` ${
|
|
55498
|
-
out.push(` ${
|
|
55499
|
-
out.push(` ${
|
|
55500
|
-
out.push(` ${
|
|
55751
|
+
out.push(` ${import_picocolors38.default.cyan("pull")} ${import_picocolors38.default.dim("<id>")} ${import_picocolors38.default.dim("fetch orchestration + every member agent into this folder")}`);
|
|
55752
|
+
out.push(` ${import_picocolors38.default.cyan("push")} ${import_picocolors38.default.dim("push each member, then update the orchestration graph")}`);
|
|
55753
|
+
out.push(` ${import_picocolors38.default.cyan("add-agent")} ${import_picocolors38.default.dim("<name>")} ${import_picocolors38.default.dim("create a member agent, wire edges (--from/--to), and push")}`);
|
|
55754
|
+
out.push(` ${import_picocolors38.default.cyan("status")} ${import_picocolors38.default.dim("show what would push and what would pull")}`);
|
|
55755
|
+
out.push(` ${import_picocolors38.default.cyan("list")} ${import_picocolors38.default.dim("list orchestrations under a team")}`);
|
|
55501
55756
|
out.push("");
|
|
55502
|
-
out.push(` ${
|
|
55503
|
-
out.push(` ${
|
|
55504
|
-
out.push(` ${
|
|
55505
|
-
out.push(` ${
|
|
55506
|
-
out.push(` ${
|
|
55507
|
-
out.push(` ${
|
|
55757
|
+
out.push(` ${import_picocolors38.default.bold("Flags")}`);
|
|
55758
|
+
out.push(` ${import_picocolors38.default.dim("--yes, -y")} skip confirmations`);
|
|
55759
|
+
out.push(` ${import_picocolors38.default.dim("--harness <id>")} harness for newly-created member folders (default claude-code)`);
|
|
55760
|
+
out.push(` ${import_picocolors38.default.dim("--graph-only")} for push: only update members + edges, skip per-member push`);
|
|
55761
|
+
out.push(` ${import_picocolors38.default.dim("--org <id>")} for list: org id (CLI vocab — DB teams.id)`);
|
|
55762
|
+
out.push(` ${import_picocolors38.default.dim("--team <id>")} for list: team id (CLI vocab — DB groups.id)`);
|
|
55508
55763
|
out.push("");
|
|
55509
55764
|
console.log(out.join(`
|
|
55510
55765
|
`));
|
|
@@ -55549,16 +55804,16 @@ async function runRun(cwd2, args) {
|
|
|
55549
55804
|
}
|
|
55550
55805
|
|
|
55551
55806
|
// src/cli/publish.ts
|
|
55552
|
-
var
|
|
55807
|
+
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
55553
55808
|
async function runPublish(cwd2, _args) {
|
|
55554
55809
|
banner("publish — send your changes to the team");
|
|
55555
55810
|
const link2 = readLink(cwd2);
|
|
55556
55811
|
if (!link2) {
|
|
55557
55812
|
f2.warn("This folder is not linked to any agent.");
|
|
55558
|
-
f2.info(`Run ${
|
|
55813
|
+
f2.info(`Run ${import_picocolors39.default.cyan("brainbase link")} first.`);
|
|
55559
55814
|
return;
|
|
55560
55815
|
}
|
|
55561
|
-
f2.info(`${
|
|
55816
|
+
f2.info(`${import_picocolors39.default.bold("publish")} is coming soon — for now, edit the agent on the web app and run ${import_picocolors39.default.cyan("brainbase sync")} to bring changes here.`);
|
|
55562
55817
|
}
|
|
55563
55818
|
|
|
55564
55819
|
// src/ui/ink/StatusCard.tsx
|
|
@@ -55856,7 +56111,7 @@ async function runStatus(cwd2) {
|
|
|
55856
56111
|
}
|
|
55857
56112
|
|
|
55858
56113
|
// src/cli/token.ts
|
|
55859
|
-
var
|
|
56114
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
55860
56115
|
|
|
55861
56116
|
// src/ui/ink/TokenCards.tsx
|
|
55862
56117
|
var jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -56150,7 +56405,7 @@ async function runTokenRevoke(args) {
|
|
|
56150
56405
|
}
|
|
56151
56406
|
if (!autoProceed(args.yes)) {
|
|
56152
56407
|
const ok = await se({
|
|
56153
|
-
message: `Revoke token ${
|
|
56408
|
+
message: `Revoke token ${import_picocolors40.default.bold(args.id)}? CIs and machines using it will stop working.`,
|
|
56154
56409
|
initialValue: false
|
|
56155
56410
|
});
|
|
56156
56411
|
if (!ensureNotCancelled(ok))
|
|
@@ -56165,7 +56420,7 @@ async function runTokenRevoke(args) {
|
|
|
56165
56420
|
}
|
|
56166
56421
|
async function runTokenClear() {
|
|
56167
56422
|
if (!readToken()) {
|
|
56168
|
-
console.log(
|
|
56423
|
+
console.log(import_picocolors40.default.dim("No local token stored."));
|
|
56169
56424
|
return;
|
|
56170
56425
|
}
|
|
56171
56426
|
clearToken();
|
|
@@ -56216,17 +56471,17 @@ async function runToken(sub, rest2, args) {
|
|
|
56216
56471
|
function printTokenHelp() {
|
|
56217
56472
|
const out = [];
|
|
56218
56473
|
out.push("");
|
|
56219
|
-
out.push(` ${
|
|
56474
|
+
out.push(` ${import_picocolors40.default.bold("brainbase token")} ${import_picocolors40.default.dim("<command>")}`);
|
|
56220
56475
|
out.push("");
|
|
56221
|
-
out.push(` ${
|
|
56222
|
-
out.push(` ${
|
|
56223
|
-
out.push(` ${
|
|
56224
|
-
out.push(` ${
|
|
56476
|
+
out.push(` ${import_picocolors40.default.cyan("create")} ${import_picocolors40.default.dim("issue a new long-lived CLI key (PAT)")}`);
|
|
56477
|
+
out.push(` ${import_picocolors40.default.cyan("list")} ${import_picocolors40.default.dim("show your active tokens")}`);
|
|
56478
|
+
out.push(` ${import_picocolors40.default.cyan("revoke")} ${import_picocolors40.default.dim("<id>")} ${import_picocolors40.default.dim("revoke a token by id")}`);
|
|
56479
|
+
out.push(` ${import_picocolors40.default.cyan("clear")} ${import_picocolors40.default.dim("forget the local token (does not revoke)")}`);
|
|
56225
56480
|
out.push("");
|
|
56226
|
-
out.push(` ${
|
|
56227
|
-
out.push(` ${
|
|
56228
|
-
out.push(` ${
|
|
56229
|
-
out.push(` ${
|
|
56481
|
+
out.push(` ${import_picocolors40.default.bold("create flags")}`);
|
|
56482
|
+
out.push(` ${import_picocolors40.default.cyan("--name, -n")} ${import_picocolors40.default.dim("<label>")} ${import_picocolors40.default.dim("token label (prompted if omitted)")}`);
|
|
56483
|
+
out.push(` ${import_picocolors40.default.cyan("--scopes")} ${import_picocolors40.default.dim("<list>")} ${import_picocolors40.default.dim("comma-separated; allowed: read, publish, admin")}`);
|
|
56484
|
+
out.push(` ${import_picocolors40.default.dim("default: read,publish")}`);
|
|
56230
56485
|
out.push("");
|
|
56231
56486
|
console.log(out.join(`
|
|
56232
56487
|
`));
|
|
@@ -56246,92 +56501,92 @@ var PROTECTED = new Set([
|
|
|
56246
56501
|
function help() {
|
|
56247
56502
|
const out = [];
|
|
56248
56503
|
out.push("");
|
|
56249
|
-
out.push(` ${brandTint("◆")} ${
|
|
56250
|
-
out.push(` ${
|
|
56504
|
+
out.push(` ${brandTint("◆")} ${import_picocolors41.default.bold("brainbase")} ${import_picocolors41.default.dim(`v${VERSION}`)}`);
|
|
56505
|
+
out.push(` ${import_picocolors41.default.dim("connect your local agent to the brainbase platform")}`);
|
|
56251
56506
|
out.push("");
|
|
56252
56507
|
out.push(divider("USAGE"));
|
|
56253
56508
|
out.push("");
|
|
56254
|
-
out.push(` ${
|
|
56509
|
+
out.push(` ${import_picocolors41.default.bold("brainbase")} ${import_picocolors41.default.dim("<command> [options]")}`);
|
|
56255
56510
|
out.push("");
|
|
56256
56511
|
out.push(divider("AUTH"));
|
|
56257
56512
|
out.push("");
|
|
56258
|
-
out.push(` ${
|
|
56259
|
-
out.push(` ${
|
|
56260
|
-
out.push(` ${
|
|
56513
|
+
out.push(` ${import_picocolors41.default.cyan("login")} ${import_picocolors41.default.dim(" open the web app and connect this device")}`);
|
|
56514
|
+
out.push(` ${import_picocolors41.default.cyan("logout")} ${import_picocolors41.default.dim(" clear the local session")}`);
|
|
56515
|
+
out.push(` ${import_picocolors41.default.cyan("whoami")} ${import_picocolors41.default.dim(" show the current user")}`);
|
|
56261
56516
|
out.push("");
|
|
56262
56517
|
out.push(divider("LINKED AGENT"));
|
|
56263
56518
|
out.push("");
|
|
56264
|
-
out.push(` ${
|
|
56265
|
-
out.push(` ${
|
|
56266
|
-
out.push(` ${
|
|
56267
|
-
out.push(` ${
|
|
56268
|
-
out.push(` ${
|
|
56269
|
-
out.push(` ${
|
|
56270
|
-
out.push(` ${
|
|
56271
|
-
out.push(` ${
|
|
56272
|
-
out.push(` ${
|
|
56273
|
-
out.push(` ${
|
|
56519
|
+
out.push(` ${import_picocolors41.default.cyan("agent create")} ${import_picocolors41.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent")}`);
|
|
56520
|
+
out.push(` ${import_picocolors41.default.cyan("agent pull")} ${import_picocolors41.default.dim("[<id>]")} ${import_picocolors41.default.dim("bring cloud changes into this folder (--force to override)")}`);
|
|
56521
|
+
out.push(` ${import_picocolors41.default.cyan("agent push")} ${import_picocolors41.default.dim("send local changes to the cloud")}`);
|
|
56522
|
+
out.push(` ${import_picocolors41.default.cyan("agent unpack")} ${import_picocolors41.default.dim("install the claimed agent into a harness layout")}`);
|
|
56523
|
+
out.push(` ${import_picocolors41.default.cyan("link")} ${import_picocolors41.default.dim("attach this folder to an existing agent")}`);
|
|
56524
|
+
out.push(` ${import_picocolors41.default.cyan("agent status")} ${import_picocolors41.default.dim("show what would pull and what would push")}`);
|
|
56525
|
+
out.push(` ${import_picocolors41.default.cyan("agent env")} ${import_picocolors41.default.dim("print export lines for `eval $(brainbase agent env)`")}`);
|
|
56526
|
+
out.push(` ${import_picocolors41.default.cyan("run")} ${import_picocolors41.default.dim("<cmd> [args...]")} ${import_picocolors41.default.dim("run <cmd> with secrets.env loaded into env")}`);
|
|
56527
|
+
out.push(` ${import_picocolors41.default.cyan("status")} ${import_picocolors41.default.dim("show what this folder is linked to")}`);
|
|
56528
|
+
out.push(` ${import_picocolors41.default.cyan("unlink")} ${import_picocolors41.default.dim("disconnect this folder")}`);
|
|
56274
56529
|
out.push("");
|
|
56275
56530
|
out.push(divider("ORCHESTRATIONS"));
|
|
56276
56531
|
out.push("");
|
|
56277
|
-
out.push(` ${
|
|
56278
|
-
out.push(` ${
|
|
56279
|
-
out.push(` ${
|
|
56280
|
-
out.push(` ${
|
|
56532
|
+
out.push(` ${import_picocolors41.default.cyan("orchestration list")} ${import_picocolors41.default.dim("list orchestrations under a team")}`);
|
|
56533
|
+
out.push(` ${import_picocolors41.default.cyan("orchestration pull")} ${import_picocolors41.default.dim("<id>")} ${import_picocolors41.default.dim("recursively fetch an orchestration + every member agent")}`);
|
|
56534
|
+
out.push(` ${import_picocolors41.default.cyan("orchestration push")} ${import_picocolors41.default.dim("recursively push each member, then update the graph")}`);
|
|
56535
|
+
out.push(` ${import_picocolors41.default.cyan("orchestration status")} ${import_picocolors41.default.dim("show what would push and what would pull")}`);
|
|
56281
56536
|
out.push("");
|
|
56282
56537
|
out.push(divider("TEMPLATES"));
|
|
56283
56538
|
out.push("");
|
|
56284
|
-
out.push(` ${
|
|
56285
|
-
out.push(` ${
|
|
56286
|
-
out.push(` ${
|
|
56287
|
-
out.push(` ${
|
|
56288
|
-
out.push(` ${
|
|
56289
|
-
out.push(` ${
|
|
56290
|
-
out.push(` ${
|
|
56539
|
+
out.push(` ${import_picocolors41.default.cyan("template pack")} ${import_picocolors41.default.dim("bundle the current agent into a template")}`);
|
|
56540
|
+
out.push(` ${import_picocolors41.default.cyan("template publish")} ${import_picocolors41.default.dim("upload a template to the registry")}`);
|
|
56541
|
+
out.push(` ${import_picocolors41.default.cyan("template search")} ${import_picocolors41.default.dim("[query]")} ${import_picocolors41.default.dim("search the registry")}`);
|
|
56542
|
+
out.push(` ${import_picocolors41.default.cyan("template info")} ${import_picocolors41.default.dim("<creator/slug>")} ${import_picocolors41.default.dim("show registry details for a template")}`);
|
|
56543
|
+
out.push(` ${import_picocolors41.default.cyan("template onboard")} ${import_picocolors41.default.dim("<creator/slug>")} ${import_picocolors41.default.dim("install (or refresh) a template")}`);
|
|
56544
|
+
out.push(` ${import_picocolors41.default.cyan("template list")} ${import_picocolors41.default.dim("show installed templates")}`);
|
|
56545
|
+
out.push(` ${import_picocolors41.default.cyan("template remove")} ${import_picocolors41.default.dim("<creator/slug>")} ${import_picocolors41.default.dim("uninstall a template")}`);
|
|
56291
56546
|
out.push("");
|
|
56292
56547
|
out.push(divider("SKILLS"));
|
|
56293
56548
|
out.push("");
|
|
56294
|
-
out.push(` ${
|
|
56295
|
-
out.push(` ${
|
|
56296
|
-
out.push(` ${
|
|
56297
|
-
out.push(` ${
|
|
56298
|
-
out.push(` ${
|
|
56299
|
-
out.push(` ${
|
|
56300
|
-
out.push(` ${
|
|
56549
|
+
out.push(` ${import_picocolors41.default.cyan("skill add")} ${import_picocolors41.default.dim("<source>")} ${import_picocolors41.default.dim("install a skill (github / git / brainbase)")}`);
|
|
56550
|
+
out.push(` ${import_picocolors41.default.cyan("skill list")} ${import_picocolors41.default.dim("show locally installed skills + their source")}`);
|
|
56551
|
+
out.push(` ${import_picocolors41.default.cyan("skill update")} ${import_picocolors41.default.dim("<slug>")} ${import_picocolors41.default.dim("re-fetch a skill from its recorded source")}`);
|
|
56552
|
+
out.push(` ${import_picocolors41.default.cyan("skill remove")} ${import_picocolors41.default.dim("<slug>")} ${import_picocolors41.default.dim("uninstall a skill")}`);
|
|
56553
|
+
out.push(` ${import_picocolors41.default.cyan("skill search")} ${import_picocolors41.default.dim("[query]")} ${import_picocolors41.default.dim("search the brainbase skill registry")}`);
|
|
56554
|
+
out.push(` ${import_picocolors41.default.cyan("skill info")} ${import_picocolors41.default.dim("<creator/slug>")} ${import_picocolors41.default.dim("show registry details for a skill")}`);
|
|
56555
|
+
out.push(` ${import_picocolors41.default.cyan("skill publish")} ${import_picocolors41.default.dim("[dir]")} ${import_picocolors41.default.dim("publish a SKILL.md folder (defaults to .)")}`);
|
|
56301
56556
|
out.push("");
|
|
56302
56557
|
out.push(divider("CLI TOKENS"));
|
|
56303
56558
|
out.push("");
|
|
56304
|
-
out.push(` ${
|
|
56305
|
-
out.push(` ${
|
|
56306
|
-
out.push(` ${
|
|
56559
|
+
out.push(` ${import_picocolors41.default.cyan("token create")} ${import_picocolors41.default.dim("issue a long-lived CLI key for CI / scripts")}`);
|
|
56560
|
+
out.push(` ${import_picocolors41.default.cyan("token list")} ${import_picocolors41.default.dim("show your active tokens")}`);
|
|
56561
|
+
out.push(` ${import_picocolors41.default.cyan("token revoke")} ${import_picocolors41.default.dim("<id>")} ${import_picocolors41.default.dim("revoke a token")}`);
|
|
56307
56562
|
out.push("");
|
|
56308
56563
|
out.push(divider("FLAGS"));
|
|
56309
56564
|
out.push("");
|
|
56310
|
-
out.push(` ${
|
|
56311
|
-
out.push(` ${
|
|
56312
|
-
out.push(` ${
|
|
56313
|
-
out.push(` ${
|
|
56314
|
-
out.push(` ${
|
|
56315
|
-
out.push(` ${
|
|
56316
|
-
out.push(` ${
|
|
56317
|
-
out.push(` ${
|
|
56318
|
-
out.push(` ${
|
|
56565
|
+
out.push(` ${import_picocolors41.default.dim("--harness <id>")} force harness for onboard / sync (e.g. claude-code)`);
|
|
56566
|
+
out.push(` ${import_picocolors41.default.dim("--scope <s>")} force scope: global | project`);
|
|
56567
|
+
out.push(` ${import_picocolors41.default.dim("--yes, -y")} skip confirmations / auto-overwrite`);
|
|
56568
|
+
out.push(` ${import_picocolors41.default.dim("--agent <id>")} for link: attach this folder to an existing agent non-interactively`);
|
|
56569
|
+
out.push(` ${import_picocolors41.default.dim("--no-tracking")} for link: skip routing LLM traffic through brainbase`);
|
|
56570
|
+
out.push(` ${import_picocolors41.default.dim("--track")} for agent create: enable tracking non-interactively (off without a TTY)`);
|
|
56571
|
+
out.push(` ${import_picocolors41.default.dim("--shell <sh|fish>")} for agent env: pick output format (auto-detected from $SHELL)`);
|
|
56572
|
+
out.push(` ${import_picocolors41.default.dim("--all")} for template list: include installs from other folders`);
|
|
56573
|
+
out.push(` ${import_picocolors41.default.dim("--web <url>")} for login: web app URL (default https://new.usekafka.com)`);
|
|
56319
56574
|
out.push("");
|
|
56320
56575
|
out.push(divider("ENV"));
|
|
56321
56576
|
out.push("");
|
|
56322
|
-
out.push(` ${
|
|
56323
|
-
out.push(` ${
|
|
56324
|
-
out.push(` ${
|
|
56325
|
-
out.push(` ${
|
|
56326
|
-
out.push(` ${
|
|
56327
|
-
out.push(` ${
|
|
56328
|
-
out.push(` ${
|
|
56577
|
+
out.push(` ${import_picocolors41.default.dim("BRAINBASE_HOME")} override the local config dir (default ~/.brainbase)`);
|
|
56578
|
+
out.push(` ${import_picocolors41.default.dim("BRAINBASE_WEB_URL")} override the web app URL used by login`);
|
|
56579
|
+
out.push(` ${import_picocolors41.default.dim("BRAINBASE_API_URL")} override the API URL used by link / sync`);
|
|
56580
|
+
out.push(` ${import_picocolors41.default.dim("BRAINBASE_REGISTRY_URL")} override the registry API URL`);
|
|
56581
|
+
out.push(` ${import_picocolors41.default.dim("BRAINBASE_TOKEN")} long-lived CLI PAT (overrides token.json)`);
|
|
56582
|
+
out.push(` ${import_picocolors41.default.dim("BRAINBASE_SKIP_AUTH")} bypass the auth gate for development`);
|
|
56583
|
+
out.push(` ${import_picocolors41.default.dim("BRAINBASE_NON_INTERACTIVE")} force non-interactive mode — skip/auto-default prompts (CI & agents)`);
|
|
56329
56584
|
out.push("");
|
|
56330
56585
|
out.push(divider("HARNESSES"));
|
|
56331
56586
|
out.push("");
|
|
56332
|
-
out.push(` ${
|
|
56333
|
-
out.push(` ${
|
|
56334
|
-
out.push(` ${
|
|
56587
|
+
out.push(` ${import_picocolors41.default.dim("•")} ${import_picocolors41.default.bold("claude-code")} ${import_picocolors41.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
56588
|
+
out.push(` ${import_picocolors41.default.dim("•")} ${import_picocolors41.default.bold("codex")} ${import_picocolors41.default.dim("skills, mcps, commands, playbooks, instructions, files")}`);
|
|
56589
|
+
out.push(` ${import_picocolors41.default.dim("•")} ${import_picocolors41.default.bold("kafka")} ${import_picocolors41.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
56335
56590
|
out.push("");
|
|
56336
56591
|
console.log(out.join(`
|
|
56337
56592
|
`));
|
|
@@ -56347,6 +56602,16 @@ function getFlag(args, ...names) {
|
|
|
56347
56602
|
}
|
|
56348
56603
|
return;
|
|
56349
56604
|
}
|
|
56605
|
+
function getFlagAll(args, ...names) {
|
|
56606
|
+
const out = [];
|
|
56607
|
+
let v3 = getFlag(args, ...names);
|
|
56608
|
+
while (v3 !== undefined) {
|
|
56609
|
+
if (v3)
|
|
56610
|
+
out.push(v3);
|
|
56611
|
+
v3 = getFlag(args, ...names);
|
|
56612
|
+
}
|
|
56613
|
+
return out;
|
|
56614
|
+
}
|
|
56350
56615
|
function hasFlag2(args, ...names) {
|
|
56351
56616
|
for (const n of names) {
|
|
56352
56617
|
const i = args.indexOf(n);
|
|
@@ -56375,13 +56640,13 @@ async function requireAuth(cmd) {
|
|
|
56375
56640
|
if (status.ok)
|
|
56376
56641
|
return;
|
|
56377
56642
|
console.error("");
|
|
56378
|
-
console.error(` ${brandTint("◆")} ${
|
|
56643
|
+
console.error(` ${brandTint("◆")} ${import_picocolors41.default.bold("brainbase")}`);
|
|
56379
56644
|
console.error("");
|
|
56380
|
-
console.error(` ${
|
|
56645
|
+
console.error(` ${import_picocolors41.default.red("✗")} You need to sign in to use ${import_picocolors41.default.bold("brainbase " + cmd)}.`);
|
|
56381
56646
|
if (status.reason)
|
|
56382
|
-
console.error(` ${
|
|
56647
|
+
console.error(` ${import_picocolors41.default.dim(status.reason)}`);
|
|
56383
56648
|
console.error("");
|
|
56384
|
-
console.error(` Run ${
|
|
56649
|
+
console.error(` Run ${import_picocolors41.default.cyan("brainbase login")} to connect this device.`);
|
|
56385
56650
|
console.error("");
|
|
56386
56651
|
process14.exit(1);
|
|
56387
56652
|
}
|
|
@@ -56391,7 +56656,7 @@ async function main() {
|
|
|
56391
56656
|
const rawCwd = process14.cwd();
|
|
56392
56657
|
const cwd2 = (() => {
|
|
56393
56658
|
try {
|
|
56394
|
-
return
|
|
56659
|
+
return fs52.realpathSync(rawCwd);
|
|
56395
56660
|
} catch {
|
|
56396
56661
|
return rawCwd;
|
|
56397
56662
|
}
|
|
@@ -56426,6 +56691,11 @@ async function main() {
|
|
|
56426
56691
|
const taglineFlag = getFlag(argv, "--tagline");
|
|
56427
56692
|
const orgIdFlag = getFlag(argv, "--org");
|
|
56428
56693
|
const teamIdFlag = getFlag(argv, "--team");
|
|
56694
|
+
const fromFlags = getFlagAll(argv, "--from");
|
|
56695
|
+
const toFlags = getFlagAll(argv, "--to");
|
|
56696
|
+
const descriptionFlag = getFlag(argv, "--description");
|
|
56697
|
+
const schemaFlag = getFlag(argv, "--schema");
|
|
56698
|
+
const noPushFlag = hasFlag2(argv, "--no-push");
|
|
56429
56699
|
ensureSkillResolversRegistered();
|
|
56430
56700
|
await requireAuth(cmd);
|
|
56431
56701
|
try {
|
|
@@ -56518,7 +56788,13 @@ async function main() {
|
|
|
56518
56788
|
harness,
|
|
56519
56789
|
orgId: orgIdFlag,
|
|
56520
56790
|
teamId: teamIdFlag,
|
|
56521
|
-
graphOnly: graphOnlyFlag
|
|
56791
|
+
graphOnly: graphOnlyFlag,
|
|
56792
|
+
name: nameFlag,
|
|
56793
|
+
from: fromFlags,
|
|
56794
|
+
to: toFlags,
|
|
56795
|
+
description: descriptionFlag,
|
|
56796
|
+
schema: schemaFlag,
|
|
56797
|
+
noPush: noPushFlag
|
|
56522
56798
|
});
|
|
56523
56799
|
break;
|
|
56524
56800
|
}
|
|
@@ -56537,7 +56813,7 @@ async function main() {
|
|
|
56537
56813
|
process14.exit(1);
|
|
56538
56814
|
}
|
|
56539
56815
|
} catch (err) {
|
|
56540
|
-
console.error(
|
|
56816
|
+
console.error(import_picocolors41.default.red(`
|
|
56541
56817
|
${err.message}`));
|
|
56542
56818
|
if (process14.env.BRAINBASE_DEBUG)
|
|
56543
56819
|
console.error(err.stack);
|