@brainbase-labs/cli 0.8.3 → 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 +347 -96
- 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: {
|
|
@@ -54595,7 +54595,7 @@ function printHelp() {
|
|
|
54595
54595
|
}
|
|
54596
54596
|
|
|
54597
54597
|
// src/cli/orchestration.ts
|
|
54598
|
-
var
|
|
54598
|
+
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
54599
54599
|
|
|
54600
54600
|
// src/cli/orchestration-pull.ts
|
|
54601
54601
|
import path54 from "node:path";
|
|
@@ -54625,11 +54625,24 @@ var EdgeSchema = exports_external.object({
|
|
|
54625
54625
|
description: exports_external.string().optional(),
|
|
54626
54626
|
payload_schema: exports_external.record(exports_external.unknown()).optional()
|
|
54627
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
|
+
});
|
|
54628
54640
|
var OrchestrationManifestSchema = exports_external.object({
|
|
54629
54641
|
schema: exports_external.literal(1),
|
|
54630
54642
|
orchestration: OrchMetaSchema,
|
|
54631
54643
|
members: exports_external.array(MemberSchema).default([]),
|
|
54632
|
-
edges: exports_external.array(EdgeSchema).default([])
|
|
54644
|
+
edges: exports_external.array(EdgeSchema).default([]),
|
|
54645
|
+
triggers: exports_external.array(TriggerSchema).optional()
|
|
54633
54646
|
});
|
|
54634
54647
|
function orchManifestPath(cwd2) {
|
|
54635
54648
|
return path51.join(cwd2, ORCH_MANIFEST_FILE);
|
|
@@ -54659,7 +54672,7 @@ function writeOrchManifest(cwd2, manifest) {
|
|
|
54659
54672
|
doc.contents = manifest;
|
|
54660
54673
|
doc.commentBefore = ` brainbase-orchestration.yaml — declarative orchestration manifest.
|
|
54661
54674
|
` + ` Committed to source control. Edit by hand, then
|
|
54662
|
-
` + " `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`.";
|
|
54663
54676
|
fs47.writeFileSync(orchManifestPath(cwd2), String(doc), "utf8");
|
|
54664
54677
|
}
|
|
54665
54678
|
function memberDir(cwd2, slug) {
|
|
@@ -54669,6 +54682,9 @@ var MEMBER_SLUG_MAX = 50;
|
|
|
54669
54682
|
function slugifyRaw(raw) {
|
|
54670
54683
|
return (raw || "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
54671
54684
|
}
|
|
54685
|
+
function slugifyMemberName(raw) {
|
|
54686
|
+
return slugifyRaw(raw) || "agent";
|
|
54687
|
+
}
|
|
54672
54688
|
function resolveMemberSlugs(members) {
|
|
54673
54689
|
const SAFE = /^[a-z0-9][a-z0-9-]*$/;
|
|
54674
54690
|
const used = new Set;
|
|
@@ -55092,7 +55108,20 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
55092
55108
|
to: slugFor(e2.to_agent_id),
|
|
55093
55109
|
...e2.description ? { description: e2.description } : {},
|
|
55094
55110
|
...e2.payload_schema && Object.keys(e2.payload_schema).length ? { payload_schema: e2.payload_schema } : {}
|
|
55095
|
-
}))
|
|
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
|
+
} : {}
|
|
55096
55125
|
};
|
|
55097
55126
|
writeOrchManifest(cwd2, manifest);
|
|
55098
55127
|
writeOrchLink(cwd2, {
|
|
@@ -55478,6 +55507,192 @@ function handleApiError7(err) {
|
|
|
55478
55507
|
}
|
|
55479
55508
|
}
|
|
55480
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
|
+
|
|
55481
55696
|
// src/cli/orchestration.ts
|
|
55482
55697
|
async function runOrchestration(cwd2, sub, args, opts) {
|
|
55483
55698
|
switch (sub) {
|
|
@@ -55501,6 +55716,20 @@ async function runOrchestration(cwd2, sub, args, opts) {
|
|
|
55501
55716
|
case "ls":
|
|
55502
55717
|
await runOrchestrationList({ orgId: opts.orgId, teamId: opts.teamId });
|
|
55503
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;
|
|
55504
55733
|
case undefined:
|
|
55505
55734
|
case "help":
|
|
55506
55735
|
case "-h":
|
|
@@ -55517,19 +55746,20 @@ async function runOrchestration(cwd2, sub, args, opts) {
|
|
|
55517
55746
|
function printHelp2() {
|
|
55518
55747
|
const out = [];
|
|
55519
55748
|
out.push("");
|
|
55520
|
-
out.push(` ${
|
|
55749
|
+
out.push(` ${import_picocolors38.default.bold("brainbase orchestration")} ${import_picocolors38.default.dim("<sub> [options]")}`);
|
|
55521
55750
|
out.push("");
|
|
55522
|
-
out.push(` ${
|
|
55523
|
-
out.push(` ${
|
|
55524
|
-
out.push(` ${
|
|
55525
|
-
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")}`);
|
|
55526
55756
|
out.push("");
|
|
55527
|
-
out.push(` ${
|
|
55528
|
-
out.push(` ${
|
|
55529
|
-
out.push(` ${
|
|
55530
|
-
out.push(` ${
|
|
55531
|
-
out.push(` ${
|
|
55532
|
-
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)`);
|
|
55533
55763
|
out.push("");
|
|
55534
55764
|
console.log(out.join(`
|
|
55535
55765
|
`));
|
|
@@ -55574,16 +55804,16 @@ async function runRun(cwd2, args) {
|
|
|
55574
55804
|
}
|
|
55575
55805
|
|
|
55576
55806
|
// src/cli/publish.ts
|
|
55577
|
-
var
|
|
55807
|
+
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
55578
55808
|
async function runPublish(cwd2, _args) {
|
|
55579
55809
|
banner("publish — send your changes to the team");
|
|
55580
55810
|
const link2 = readLink(cwd2);
|
|
55581
55811
|
if (!link2) {
|
|
55582
55812
|
f2.warn("This folder is not linked to any agent.");
|
|
55583
|
-
f2.info(`Run ${
|
|
55813
|
+
f2.info(`Run ${import_picocolors39.default.cyan("brainbase link")} first.`);
|
|
55584
55814
|
return;
|
|
55585
55815
|
}
|
|
55586
|
-
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.`);
|
|
55587
55817
|
}
|
|
55588
55818
|
|
|
55589
55819
|
// src/ui/ink/StatusCard.tsx
|
|
@@ -55881,7 +56111,7 @@ async function runStatus(cwd2) {
|
|
|
55881
56111
|
}
|
|
55882
56112
|
|
|
55883
56113
|
// src/cli/token.ts
|
|
55884
|
-
var
|
|
56114
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
55885
56115
|
|
|
55886
56116
|
// src/ui/ink/TokenCards.tsx
|
|
55887
56117
|
var jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -56175,7 +56405,7 @@ async function runTokenRevoke(args) {
|
|
|
56175
56405
|
}
|
|
56176
56406
|
if (!autoProceed(args.yes)) {
|
|
56177
56407
|
const ok = await se({
|
|
56178
|
-
message: `Revoke token ${
|
|
56408
|
+
message: `Revoke token ${import_picocolors40.default.bold(args.id)}? CIs and machines using it will stop working.`,
|
|
56179
56409
|
initialValue: false
|
|
56180
56410
|
});
|
|
56181
56411
|
if (!ensureNotCancelled(ok))
|
|
@@ -56190,7 +56420,7 @@ async function runTokenRevoke(args) {
|
|
|
56190
56420
|
}
|
|
56191
56421
|
async function runTokenClear() {
|
|
56192
56422
|
if (!readToken()) {
|
|
56193
|
-
console.log(
|
|
56423
|
+
console.log(import_picocolors40.default.dim("No local token stored."));
|
|
56194
56424
|
return;
|
|
56195
56425
|
}
|
|
56196
56426
|
clearToken();
|
|
@@ -56241,17 +56471,17 @@ async function runToken(sub, rest2, args) {
|
|
|
56241
56471
|
function printTokenHelp() {
|
|
56242
56472
|
const out = [];
|
|
56243
56473
|
out.push("");
|
|
56244
|
-
out.push(` ${
|
|
56474
|
+
out.push(` ${import_picocolors40.default.bold("brainbase token")} ${import_picocolors40.default.dim("<command>")}`);
|
|
56245
56475
|
out.push("");
|
|
56246
|
-
out.push(` ${
|
|
56247
|
-
out.push(` ${
|
|
56248
|
-
out.push(` ${
|
|
56249
|
-
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)")}`);
|
|
56250
56480
|
out.push("");
|
|
56251
|
-
out.push(` ${
|
|
56252
|
-
out.push(` ${
|
|
56253
|
-
out.push(` ${
|
|
56254
|
-
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")}`);
|
|
56255
56485
|
out.push("");
|
|
56256
56486
|
console.log(out.join(`
|
|
56257
56487
|
`));
|
|
@@ -56271,92 +56501,92 @@ var PROTECTED = new Set([
|
|
|
56271
56501
|
function help() {
|
|
56272
56502
|
const out = [];
|
|
56273
56503
|
out.push("");
|
|
56274
|
-
out.push(` ${brandTint("◆")} ${
|
|
56275
|
-
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")}`);
|
|
56276
56506
|
out.push("");
|
|
56277
56507
|
out.push(divider("USAGE"));
|
|
56278
56508
|
out.push("");
|
|
56279
|
-
out.push(` ${
|
|
56509
|
+
out.push(` ${import_picocolors41.default.bold("brainbase")} ${import_picocolors41.default.dim("<command> [options]")}`);
|
|
56280
56510
|
out.push("");
|
|
56281
56511
|
out.push(divider("AUTH"));
|
|
56282
56512
|
out.push("");
|
|
56283
|
-
out.push(` ${
|
|
56284
|
-
out.push(` ${
|
|
56285
|
-
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")}`);
|
|
56286
56516
|
out.push("");
|
|
56287
56517
|
out.push(divider("LINKED AGENT"));
|
|
56288
56518
|
out.push("");
|
|
56289
|
-
out.push(` ${
|
|
56290
|
-
out.push(` ${
|
|
56291
|
-
out.push(` ${
|
|
56292
|
-
out.push(` ${
|
|
56293
|
-
out.push(` ${
|
|
56294
|
-
out.push(` ${
|
|
56295
|
-
out.push(` ${
|
|
56296
|
-
out.push(` ${
|
|
56297
|
-
out.push(` ${
|
|
56298
|
-
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")}`);
|
|
56299
56529
|
out.push("");
|
|
56300
56530
|
out.push(divider("ORCHESTRATIONS"));
|
|
56301
56531
|
out.push("");
|
|
56302
|
-
out.push(` ${
|
|
56303
|
-
out.push(` ${
|
|
56304
|
-
out.push(` ${
|
|
56305
|
-
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")}`);
|
|
56306
56536
|
out.push("");
|
|
56307
56537
|
out.push(divider("TEMPLATES"));
|
|
56308
56538
|
out.push("");
|
|
56309
|
-
out.push(` ${
|
|
56310
|
-
out.push(` ${
|
|
56311
|
-
out.push(` ${
|
|
56312
|
-
out.push(` ${
|
|
56313
|
-
out.push(` ${
|
|
56314
|
-
out.push(` ${
|
|
56315
|
-
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")}`);
|
|
56316
56546
|
out.push("");
|
|
56317
56547
|
out.push(divider("SKILLS"));
|
|
56318
56548
|
out.push("");
|
|
56319
|
-
out.push(` ${
|
|
56320
|
-
out.push(` ${
|
|
56321
|
-
out.push(` ${
|
|
56322
|
-
out.push(` ${
|
|
56323
|
-
out.push(` ${
|
|
56324
|
-
out.push(` ${
|
|
56325
|
-
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 .)")}`);
|
|
56326
56556
|
out.push("");
|
|
56327
56557
|
out.push(divider("CLI TOKENS"));
|
|
56328
56558
|
out.push("");
|
|
56329
|
-
out.push(` ${
|
|
56330
|
-
out.push(` ${
|
|
56331
|
-
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")}`);
|
|
56332
56562
|
out.push("");
|
|
56333
56563
|
out.push(divider("FLAGS"));
|
|
56334
56564
|
out.push("");
|
|
56335
|
-
out.push(` ${
|
|
56336
|
-
out.push(` ${
|
|
56337
|
-
out.push(` ${
|
|
56338
|
-
out.push(` ${
|
|
56339
|
-
out.push(` ${
|
|
56340
|
-
out.push(` ${
|
|
56341
|
-
out.push(` ${
|
|
56342
|
-
out.push(` ${
|
|
56343
|
-
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)`);
|
|
56344
56574
|
out.push("");
|
|
56345
56575
|
out.push(divider("ENV"));
|
|
56346
56576
|
out.push("");
|
|
56347
|
-
out.push(` ${
|
|
56348
|
-
out.push(` ${
|
|
56349
|
-
out.push(` ${
|
|
56350
|
-
out.push(` ${
|
|
56351
|
-
out.push(` ${
|
|
56352
|
-
out.push(` ${
|
|
56353
|
-
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)`);
|
|
56354
56584
|
out.push("");
|
|
56355
56585
|
out.push(divider("HARNESSES"));
|
|
56356
56586
|
out.push("");
|
|
56357
|
-
out.push(` ${
|
|
56358
|
-
out.push(` ${
|
|
56359
|
-
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")}`);
|
|
56360
56590
|
out.push("");
|
|
56361
56591
|
console.log(out.join(`
|
|
56362
56592
|
`));
|
|
@@ -56372,6 +56602,16 @@ function getFlag(args, ...names) {
|
|
|
56372
56602
|
}
|
|
56373
56603
|
return;
|
|
56374
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
|
+
}
|
|
56375
56615
|
function hasFlag2(args, ...names) {
|
|
56376
56616
|
for (const n of names) {
|
|
56377
56617
|
const i = args.indexOf(n);
|
|
@@ -56400,13 +56640,13 @@ async function requireAuth(cmd) {
|
|
|
56400
56640
|
if (status.ok)
|
|
56401
56641
|
return;
|
|
56402
56642
|
console.error("");
|
|
56403
|
-
console.error(` ${brandTint("◆")} ${
|
|
56643
|
+
console.error(` ${brandTint("◆")} ${import_picocolors41.default.bold("brainbase")}`);
|
|
56404
56644
|
console.error("");
|
|
56405
|
-
console.error(` ${
|
|
56645
|
+
console.error(` ${import_picocolors41.default.red("✗")} You need to sign in to use ${import_picocolors41.default.bold("brainbase " + cmd)}.`);
|
|
56406
56646
|
if (status.reason)
|
|
56407
|
-
console.error(` ${
|
|
56647
|
+
console.error(` ${import_picocolors41.default.dim(status.reason)}`);
|
|
56408
56648
|
console.error("");
|
|
56409
|
-
console.error(` Run ${
|
|
56649
|
+
console.error(` Run ${import_picocolors41.default.cyan("brainbase login")} to connect this device.`);
|
|
56410
56650
|
console.error("");
|
|
56411
56651
|
process14.exit(1);
|
|
56412
56652
|
}
|
|
@@ -56416,7 +56656,7 @@ async function main() {
|
|
|
56416
56656
|
const rawCwd = process14.cwd();
|
|
56417
56657
|
const cwd2 = (() => {
|
|
56418
56658
|
try {
|
|
56419
|
-
return
|
|
56659
|
+
return fs52.realpathSync(rawCwd);
|
|
56420
56660
|
} catch {
|
|
56421
56661
|
return rawCwd;
|
|
56422
56662
|
}
|
|
@@ -56451,6 +56691,11 @@ async function main() {
|
|
|
56451
56691
|
const taglineFlag = getFlag(argv, "--tagline");
|
|
56452
56692
|
const orgIdFlag = getFlag(argv, "--org");
|
|
56453
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");
|
|
56454
56699
|
ensureSkillResolversRegistered();
|
|
56455
56700
|
await requireAuth(cmd);
|
|
56456
56701
|
try {
|
|
@@ -56543,7 +56788,13 @@ async function main() {
|
|
|
56543
56788
|
harness,
|
|
56544
56789
|
orgId: orgIdFlag,
|
|
56545
56790
|
teamId: teamIdFlag,
|
|
56546
|
-
graphOnly: graphOnlyFlag
|
|
56791
|
+
graphOnly: graphOnlyFlag,
|
|
56792
|
+
name: nameFlag,
|
|
56793
|
+
from: fromFlags,
|
|
56794
|
+
to: toFlags,
|
|
56795
|
+
description: descriptionFlag,
|
|
56796
|
+
schema: schemaFlag,
|
|
56797
|
+
noPush: noPushFlag
|
|
56547
56798
|
});
|
|
56548
56799
|
break;
|
|
56549
56800
|
}
|
|
@@ -56562,7 +56813,7 @@ async function main() {
|
|
|
56562
56813
|
process14.exit(1);
|
|
56563
56814
|
}
|
|
56564
56815
|
} catch (err) {
|
|
56565
|
-
console.error(
|
|
56816
|
+
console.error(import_picocolors41.default.red(`
|
|
56566
56817
|
${err.message}`));
|
|
56567
56818
|
if (process14.env.BRAINBASE_DEBUG)
|
|
56568
56819
|
console.error(err.stack);
|