@brainbase-labs/cli 0.17.0 → 0.18.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/README.md +2 -0
- package/dist/index.js +567 -464
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35141,7 +35141,7 @@ var require_dist2 = __commonJS((exports, module) => {
|
|
|
35141
35141
|
});
|
|
35142
35142
|
|
|
35143
35143
|
// src/index.ts
|
|
35144
|
-
var
|
|
35144
|
+
var import_picocolors48 = __toESM(require_picocolors(), 1);
|
|
35145
35145
|
import process14 from "node:process";
|
|
35146
35146
|
import fs79 from "node:fs";
|
|
35147
35147
|
|
|
@@ -36008,7 +36008,7 @@ function padStart(s, n) {
|
|
|
36008
36008
|
// package.json
|
|
36009
36009
|
var package_default = {
|
|
36010
36010
|
name: "@brainbase-labs/cli",
|
|
36011
|
-
version: "0.
|
|
36011
|
+
version: "0.18.0",
|
|
36012
36012
|
description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
|
|
36013
36013
|
type: "module",
|
|
36014
36014
|
bin: {
|
|
@@ -54248,6 +54248,22 @@ var api = {
|
|
|
54248
54248
|
body: JSON.stringify({ name })
|
|
54249
54249
|
});
|
|
54250
54250
|
},
|
|
54251
|
+
async listAgents(orgId, teamId) {
|
|
54252
|
+
const path58 = `/orgs/${encodeURIComponent(orgId)}/teams/${encodeURIComponent(teamId)}/agents`;
|
|
54253
|
+
let body;
|
|
54254
|
+
try {
|
|
54255
|
+
body = await request(path58);
|
|
54256
|
+
} catch (err) {
|
|
54257
|
+
if (err instanceof ApiError && err.status === 404) {
|
|
54258
|
+
throw new ApiError("This control plane does not support listing agents yet. Update the server, or use the web app to find the agent id.", 404, err.body);
|
|
54259
|
+
}
|
|
54260
|
+
throw err;
|
|
54261
|
+
}
|
|
54262
|
+
if (!Array.isArray(body)) {
|
|
54263
|
+
throw new ApiError(`Unexpected response listing agents: expected an array from ${path58}.`, undefined, body);
|
|
54264
|
+
}
|
|
54265
|
+
return body;
|
|
54266
|
+
},
|
|
54251
54267
|
createAgent(input) {
|
|
54252
54268
|
if (usesLegacyControlPlane() && (input.machine_kind !== undefined || input.default_model !== undefined)) {
|
|
54253
54269
|
return Promise.reject(legacyAgentConfigError());
|
|
@@ -63027,7 +63043,7 @@ function runHarnessInstall(harnessId, components, opts, agentName) {
|
|
|
63027
63043
|
}
|
|
63028
63044
|
|
|
63029
63045
|
// src/cli/agent.ts
|
|
63030
|
-
var
|
|
63046
|
+
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
63031
63047
|
|
|
63032
63048
|
// src/cli/agent-pull.ts
|
|
63033
63049
|
import { spawn as spawn2 } from "node:child_process";
|
|
@@ -65336,7 +65352,7 @@ function formatExport(shell, key2, value) {
|
|
|
65336
65352
|
|
|
65337
65353
|
// src/cli/agent-create.ts
|
|
65338
65354
|
import path81 from "node:path";
|
|
65339
|
-
var
|
|
65355
|
+
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
65340
65356
|
|
|
65341
65357
|
// src/ui/box.ts
|
|
65342
65358
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
@@ -65362,110 +65378,189 @@ function tip(text2, indent = 2) {
|
|
|
65362
65378
|
return " ".repeat(indent) + import_picocolors30.default.dim("›") + " " + import_picocolors30.default.dim(text2);
|
|
65363
65379
|
}
|
|
65364
65380
|
|
|
65365
|
-
// src/
|
|
65366
|
-
|
|
65367
|
-
|
|
65368
|
-
|
|
65369
|
-
|
|
65370
|
-
|
|
65371
|
-
if (manifest.id) {
|
|
65372
|
-
f2.warn(`This folder already belongs to an agent — ${import_picocolors31.default.bold(manifest.agent.name)} (${import_picocolors31.default.dim(manifest.id)}).`);
|
|
65373
|
-
f2.info(`If you want to detach it, run ${import_picocolors31.default.cyan("brainbase unlink")} first; or move to a different directory.`);
|
|
65374
|
-
return;
|
|
65381
|
+
// src/core/org-team.ts
|
|
65382
|
+
var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
65383
|
+
class OrgTeamError extends Error {
|
|
65384
|
+
constructor(message) {
|
|
65385
|
+
super(message);
|
|
65386
|
+
this.name = "OrgTeamError";
|
|
65375
65387
|
}
|
|
65376
|
-
|
|
65377
|
-
|
|
65378
|
-
|
|
65388
|
+
}
|
|
65389
|
+
async function loading(announce, message, done, fetch2) {
|
|
65390
|
+
if (!announce)
|
|
65391
|
+
return await fetch2();
|
|
65392
|
+
const sp = de();
|
|
65393
|
+
sp.start(message);
|
|
65379
65394
|
try {
|
|
65380
|
-
|
|
65395
|
+
const value = await fetch2();
|
|
65396
|
+
sp.stop(done(value));
|
|
65397
|
+
return value;
|
|
65381
65398
|
} catch (err) {
|
|
65382
|
-
|
|
65383
|
-
|
|
65384
|
-
return;
|
|
65399
|
+
sp.stop("Failed.");
|
|
65400
|
+
throw err;
|
|
65385
65401
|
}
|
|
65386
|
-
|
|
65402
|
+
}
|
|
65403
|
+
async function chooseOne(opts) {
|
|
65404
|
+
if (!opts.allowPrompt) {
|
|
65405
|
+
throw new NonInteractiveError(`${opts.message} cannot be answered while emitting JSON. ${opts.flagHint}`);
|
|
65406
|
+
}
|
|
65407
|
+
return await select({
|
|
65408
|
+
message: opts.message,
|
|
65409
|
+
options: opts.options,
|
|
65410
|
+
flagHint: opts.flagHint
|
|
65411
|
+
});
|
|
65412
|
+
}
|
|
65413
|
+
async function resolveOrg(orgRef, opts = {}) {
|
|
65414
|
+
if (orgRef === "") {
|
|
65415
|
+
throw new OrgTeamError("--org needs a value: an organization id or slug.");
|
|
65416
|
+
}
|
|
65417
|
+
const orgs = await loading(opts.announce, "Loading your organizations…", (found) => `Found ${found.length} organization${found.length === 1 ? "" : "s"}.`, () => api.listOrgs());
|
|
65387
65418
|
if (orgs.length === 0) {
|
|
65388
|
-
|
|
65389
|
-
$e("Create one on the web app first, then come back.");
|
|
65390
|
-
return;
|
|
65419
|
+
throw new OrgTeamError("You are not a member of any organization. Create one in the web app first.");
|
|
65391
65420
|
}
|
|
65392
|
-
|
|
65393
|
-
|
|
65394
|
-
const found = orgs.find((o2) => o2.id === args.orgId || o2.slug === args.orgId);
|
|
65421
|
+
if (orgRef) {
|
|
65422
|
+
const found = orgs.find((o2) => o2.id === orgRef || o2.slug === orgRef);
|
|
65395
65423
|
if (!found) {
|
|
65396
|
-
|
|
65397
|
-
return;
|
|
65424
|
+
throw new OrgTeamError(`Org ${orgRef} not found, or you're not a member of it.`);
|
|
65398
65425
|
}
|
|
65399
|
-
|
|
65400
|
-
} else if (orgs.length === 1) {
|
|
65401
|
-
org = orgs[0];
|
|
65402
|
-
f2.info(`Using organization ${import_picocolors31.default.bold(org.name)}.`);
|
|
65403
|
-
} else {
|
|
65404
|
-
const orgId = await select({
|
|
65405
|
-
message: "Pick an organization",
|
|
65406
|
-
options: orgs.map((o2) => ({ value: o2.id, label: o2.name, hint: o2.role })),
|
|
65407
|
-
flagHint: "Pass --org <id-or-slug> to choose non-interactively."
|
|
65408
|
-
});
|
|
65409
|
-
org = orgs.find((o2) => o2.id === orgId);
|
|
65426
|
+
return found;
|
|
65410
65427
|
}
|
|
65411
|
-
|
|
65412
|
-
|
|
65413
|
-
|
|
65414
|
-
|
|
65415
|
-
|
|
65416
|
-
}
|
|
65417
|
-
|
|
65418
|
-
|
|
65419
|
-
|
|
65428
|
+
if (orgs.length === 1) {
|
|
65429
|
+
const org = orgs[0];
|
|
65430
|
+
if (opts.announce)
|
|
65431
|
+
f2.info(`Using organization ${import_picocolors31.default.bold(org.name)}.`);
|
|
65432
|
+
return org;
|
|
65433
|
+
}
|
|
65434
|
+
const orgId = await chooseOne({
|
|
65435
|
+
message: "Which organization?",
|
|
65436
|
+
options: orgs.map((o2) => ({ value: o2.id, label: o2.name, hint: o2.role })),
|
|
65437
|
+
flagHint: "Pass --org <id-or-slug>.",
|
|
65438
|
+
allowPrompt: opts.allowPrompt !== false
|
|
65439
|
+
});
|
|
65440
|
+
return orgs.find((o2) => o2.id === orgId);
|
|
65441
|
+
}
|
|
65442
|
+
function canOfferTeamCreation(opts) {
|
|
65443
|
+
return !!opts.offerCreateTeam && opts.allowPrompt !== false && opts.interactive;
|
|
65444
|
+
}
|
|
65445
|
+
function shouldAutoPickLoneTeam(opts) {
|
|
65446
|
+
return opts.teamCount === 1 && !opts.canCreate;
|
|
65447
|
+
}
|
|
65448
|
+
async function resolveOrgAndTeam(args) {
|
|
65449
|
+
if (args.orgId === "") {
|
|
65450
|
+
throw new OrgTeamError("--org needs a value: an organization id or slug.");
|
|
65420
65451
|
}
|
|
65421
|
-
|
|
65422
|
-
|
|
65452
|
+
if (args.teamId === "") {
|
|
65453
|
+
throw new OrgTeamError("--team needs a value: a team id.");
|
|
65454
|
+
}
|
|
65455
|
+
if (args.teamId && !args.orgId) {
|
|
65456
|
+
return await findTeamAcrossOrgs(args.teamId);
|
|
65457
|
+
}
|
|
65458
|
+
const org = await resolveOrg(args.orgId, {
|
|
65459
|
+
allowPrompt: args.allowPrompt,
|
|
65460
|
+
announce: args.announce
|
|
65461
|
+
});
|
|
65462
|
+
const teams = await loading(args.announce, `Loading teams in ${org.name}…`, (found) => `Found ${found.length} team${found.length === 1 ? "" : "s"}.`, () => api.listTeams(org.id));
|
|
65423
65463
|
if (args.teamId) {
|
|
65424
65464
|
const found = teams.find((t) => t.id === args.teamId);
|
|
65425
65465
|
if (!found) {
|
|
65426
|
-
|
|
65427
|
-
return;
|
|
65466
|
+
throw new OrgTeamError(`Team ${args.teamId} not found in ${org.name}.`);
|
|
65428
65467
|
}
|
|
65429
|
-
team
|
|
65430
|
-
}
|
|
65431
|
-
|
|
65432
|
-
|
|
65468
|
+
return { org, team: found };
|
|
65469
|
+
}
|
|
65470
|
+
const canCreate = canOfferTeamCreation({
|
|
65471
|
+
offerCreateTeam: args.offerCreateTeam,
|
|
65472
|
+
allowPrompt: args.allowPrompt,
|
|
65473
|
+
interactive: isInteractive()
|
|
65474
|
+
});
|
|
65475
|
+
if (teams.length === 0 && !canCreate) {
|
|
65476
|
+
throw new OrgTeamError(`${org.name} has no teams yet. Create one in the web app first.`);
|
|
65477
|
+
}
|
|
65478
|
+
if (shouldAutoPickLoneTeam({ teamCount: teams.length, canCreate })) {
|
|
65479
|
+
const team = teams[0];
|
|
65480
|
+
if (args.announce)
|
|
65433
65481
|
f2.info(`Using team ${import_picocolors31.default.bold(team.name)}.`);
|
|
65434
|
-
|
|
65435
|
-
|
|
65436
|
-
|
|
65437
|
-
|
|
65438
|
-
|
|
65439
|
-
|
|
65440
|
-
|
|
65441
|
-
|
|
65442
|
-
{ value: "__new__", label: "+ Create a new team" }
|
|
65443
|
-
];
|
|
65444
|
-
const teamChoice = await ie({
|
|
65445
|
-
message: "Pick a team (or create one)",
|
|
65446
|
-
options: teamOptions
|
|
65482
|
+
return { org, team };
|
|
65483
|
+
}
|
|
65484
|
+
if (!canCreate) {
|
|
65485
|
+
const teamId = await chooseOne({
|
|
65486
|
+
message: "Which team?",
|
|
65487
|
+
options: teams.map((t) => ({ value: t.id, label: t.name, hint: t.role })),
|
|
65488
|
+
flagHint: "Pass --team <id>.",
|
|
65489
|
+
allowPrompt: args.allowPrompt !== false
|
|
65447
65490
|
});
|
|
65448
|
-
|
|
65449
|
-
|
|
65450
|
-
|
|
65451
|
-
|
|
65452
|
-
|
|
65453
|
-
|
|
65454
|
-
|
|
65455
|
-
|
|
65456
|
-
|
|
65457
|
-
|
|
65458
|
-
|
|
65459
|
-
|
|
65460
|
-
|
|
65461
|
-
|
|
65462
|
-
|
|
65463
|
-
|
|
65464
|
-
|
|
65491
|
+
return { org, team: teams.find((t) => t.id === teamId) };
|
|
65492
|
+
}
|
|
65493
|
+
return { org, team: await pickOrCreateTeam(org, teams) };
|
|
65494
|
+
}
|
|
65495
|
+
var CREATE_TEAM = "__new__";
|
|
65496
|
+
async function pickOrCreateTeam(org, teams) {
|
|
65497
|
+
const picked = ensureNotCancelled(await ie({
|
|
65498
|
+
message: "Pick a team (or create one)",
|
|
65499
|
+
options: [
|
|
65500
|
+
...teams.map((t) => ({ value: t.id, label: t.name, hint: t.role })),
|
|
65501
|
+
{ value: CREATE_TEAM, label: "+ Create a new team" }
|
|
65502
|
+
]
|
|
65503
|
+
}));
|
|
65504
|
+
if (picked !== CREATE_TEAM)
|
|
65505
|
+
return teams.find((t) => t.id === picked);
|
|
65506
|
+
const name = ensureNotCancelled(await te({
|
|
65507
|
+
message: "New team name",
|
|
65508
|
+
validate: (v3) => !v3?.trim() ? "Required" : undefined
|
|
65509
|
+
}));
|
|
65510
|
+
return await loading(true, "Creating team…", (created) => `Created team ${import_picocolors31.default.bold(created.name)}.`, () => api.createTeam(org.id, name.trim()));
|
|
65511
|
+
}
|
|
65512
|
+
async function findTeamAcrossOrgs(teamId) {
|
|
65513
|
+
const orgs = await api.listOrgs();
|
|
65514
|
+
if (orgs.length === 0) {
|
|
65515
|
+
throw new OrgTeamError("You are not a member of any organization.");
|
|
65516
|
+
}
|
|
65517
|
+
const { resolved, failures } = await listTeamsPerOrg(orgs);
|
|
65518
|
+
for (const { org, teams } of resolved) {
|
|
65519
|
+
const team = teams.find((t) => t.id === teamId);
|
|
65520
|
+
if (team)
|
|
65521
|
+
return { org, team };
|
|
65522
|
+
}
|
|
65523
|
+
if (failures.length > 0)
|
|
65524
|
+
throw failures[0].error;
|
|
65525
|
+
throw new OrgTeamError(`Team ${teamId} not found in any of your organizations. Run \`brainbase team list\` to see the ids you can use.`);
|
|
65526
|
+
}
|
|
65527
|
+
async function listTeamsPerOrg(orgs) {
|
|
65528
|
+
const settled = await Promise.allSettled(orgs.map((org) => api.listTeams(org.id)));
|
|
65529
|
+
const entries = [];
|
|
65530
|
+
const resolved = [];
|
|
65531
|
+
const failures = [];
|
|
65532
|
+
settled.forEach((outcome, index) => {
|
|
65533
|
+
const org = orgs[index];
|
|
65534
|
+
if (outcome.status === "fulfilled") {
|
|
65535
|
+
const entry = { org, teams: outcome.value };
|
|
65536
|
+
entries.push(entry);
|
|
65537
|
+
resolved.push(entry);
|
|
65465
65538
|
} else {
|
|
65466
|
-
|
|
65539
|
+
const error = outcome.reason;
|
|
65540
|
+
entries.push({ org, teams: [], error: error.message });
|
|
65541
|
+
failures.push({ org, error });
|
|
65467
65542
|
}
|
|
65543
|
+
});
|
|
65544
|
+
return { entries, resolved, failures };
|
|
65545
|
+
}
|
|
65546
|
+
|
|
65547
|
+
// src/cli/agent-create.ts
|
|
65548
|
+
async function runAgentCreate(cwd2, args) {
|
|
65549
|
+
banner("agent create — claim a brainbase.agent.yaml and link this folder");
|
|
65550
|
+
let manifest = await loadOrScaffoldManifest(cwd2, args);
|
|
65551
|
+
if (!manifest)
|
|
65552
|
+
return;
|
|
65553
|
+
if (manifest.id) {
|
|
65554
|
+
f2.warn(`This folder already belongs to an agent — ${import_picocolors32.default.bold(manifest.agent.name)} (${import_picocolors32.default.dim(manifest.id)}).`);
|
|
65555
|
+
f2.info(`If you want to detach it, run ${import_picocolors32.default.cyan("brainbase unlink")} first; or move to a different directory.`);
|
|
65556
|
+
return;
|
|
65468
65557
|
}
|
|
65558
|
+
const { org, team } = await resolveOrgAndTeam({
|
|
65559
|
+
orgId: args.orgId,
|
|
65560
|
+
teamId: args.teamId,
|
|
65561
|
+
announce: true,
|
|
65562
|
+
offerCreateTeam: true
|
|
65563
|
+
});
|
|
65469
65564
|
const harness = normalizeHarnessId(args.harness ?? manifest.harness ?? await pickHarness2(cwd2));
|
|
65470
65565
|
let agentName = args.name?.trim() || manifest.agent.name.trim();
|
|
65471
65566
|
if (!agentName) {
|
|
@@ -65488,11 +65583,11 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65488
65583
|
}
|
|
65489
65584
|
if (!autoProceed(args.yes)) {
|
|
65490
65585
|
le([
|
|
65491
|
-
`${
|
|
65492
|
-
`${
|
|
65493
|
-
`${
|
|
65494
|
-
`${
|
|
65495
|
-
...tagline ? [`${
|
|
65586
|
+
`${import_picocolors32.default.dim("org")} ${import_picocolors32.default.bold(org.name)}`,
|
|
65587
|
+
`${import_picocolors32.default.dim("team")} ${import_picocolors32.default.bold(team.name)}`,
|
|
65588
|
+
`${import_picocolors32.default.dim("harness")} ${import_picocolors32.default.bold(harness)}`,
|
|
65589
|
+
`${import_picocolors32.default.dim("agent")} ${import_picocolors32.default.bold(agentName)}`,
|
|
65590
|
+
...tagline ? [`${import_picocolors32.default.dim("tagline")} ${tagline}`] : []
|
|
65496
65591
|
].join(`
|
|
65497
65592
|
`), "Will create");
|
|
65498
65593
|
const confirmed = await se({ message: "Create this agent?", initialValue: true });
|
|
@@ -65506,7 +65601,7 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65506
65601
|
const body = resolveEntrypoint(cwd2, manifest);
|
|
65507
65602
|
if (body === null) {
|
|
65508
65603
|
if (manifest.entrypoint.file) {
|
|
65509
|
-
f2.error(`Entrypoint file ${
|
|
65604
|
+
f2.error(`Entrypoint file ${import_picocolors32.default.bold(manifest.entrypoint.file)} not found.`);
|
|
65510
65605
|
} else {
|
|
65511
65606
|
f2.error("Entrypoint block is empty.");
|
|
65512
65607
|
}
|
|
@@ -65528,10 +65623,11 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65528
65623
|
...manifest.machine_kind !== undefined ? { machine_kind: manifest.machine_kind } : {},
|
|
65529
65624
|
...manifest.default_model !== undefined ? { default_model: manifest.default_model } : {}
|
|
65530
65625
|
});
|
|
65531
|
-
createSpinner.stop(`Created ${
|
|
65626
|
+
createSpinner.stop(`Created ${import_picocolors32.default.bold(agent.name)}.`);
|
|
65532
65627
|
} catch (err) {
|
|
65533
65628
|
createSpinner.stop("Failed.");
|
|
65534
65629
|
handleApiError4(err);
|
|
65630
|
+
process.exitCode = 1;
|
|
65535
65631
|
return;
|
|
65536
65632
|
}
|
|
65537
65633
|
const machineConfigMissing = manifest.machine_kind !== undefined && agent.machine_kind !== manifest.machine_kind;
|
|
@@ -65544,15 +65640,15 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65544
65640
|
...machineConfigMissing ? ["machine_kind"] : [],
|
|
65545
65641
|
...modelConfigMissing ? ["default_model"] : []
|
|
65546
65642
|
];
|
|
65547
|
-
f2.error(`Agent ${
|
|
65643
|
+
f2.error(`Agent ${import_picocolors32.default.bold(agent.id)} was created, but this control plane did not apply ${fields.join(" / ")}.`);
|
|
65548
65644
|
if (machineConfigMissing) {
|
|
65549
65645
|
if (agent.machine_kind) {
|
|
65550
|
-
f2.info(`machine_kind is immutable. Run ${
|
|
65646
|
+
f2.info(`machine_kind is immutable. Run ${import_picocolors32.default.cyan("brainbase agent pull --force")} to accept ${agent.machine_kind}, or delete this agent and recreate it after upgrading the control plane.`);
|
|
65551
65647
|
} else {
|
|
65552
65648
|
f2.info("machine_kind is immutable and this server did not report the provider it created. Upgrade the control plane, delete this agent, and recreate it.");
|
|
65553
65649
|
}
|
|
65554
65650
|
} else {
|
|
65555
|
-
f2.info(`Upgrade the control plane, then run ${
|
|
65651
|
+
f2.info(`Upgrade the control plane, then run ${import_picocolors32.default.cyan("brainbase agent push")} to apply default_model.`);
|
|
65556
65652
|
}
|
|
65557
65653
|
process.exitCode = 1;
|
|
65558
65654
|
return;
|
|
@@ -65566,12 +65662,12 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65566
65662
|
wantsTracking = true;
|
|
65567
65663
|
} else if (!isInteractive()) {
|
|
65568
65664
|
wantsTracking = false;
|
|
65569
|
-
f2.info(`Tracking left off (non-interactive). Re-run with ${
|
|
65665
|
+
f2.info(`Tracking left off (non-interactive). Re-run with ${import_picocolors32.default.cyan("--track")} to route ${harness} LLM traffic through brainbase.`);
|
|
65570
65666
|
} else if (args.yes) {
|
|
65571
65667
|
wantsTracking = true;
|
|
65572
65668
|
} else {
|
|
65573
65669
|
const ans = await se({
|
|
65574
|
-
message: `Track ${harness} conversations on the brainbase platform? ${
|
|
65670
|
+
message: `Track ${harness} conversations on the brainbase platform? ${import_picocolors32.default.dim("(routes LLM calls through brainbase so they appear under this agent)")}`,
|
|
65575
65671
|
initialValue: true
|
|
65576
65672
|
});
|
|
65577
65673
|
wantsTracking = ensureNotCancelled(ans);
|
|
@@ -65631,7 +65727,7 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65631
65727
|
if (hasContent) {
|
|
65632
65728
|
const outgoing = await buildOutgoingComponents(cwd2, manifest, null);
|
|
65633
65729
|
if (outgoing === null) {
|
|
65634
|
-
f2.warn(`Agent created, but local content wasn't uploaded. Fix the issue above and run ${
|
|
65730
|
+
f2.warn(`Agent created, but local content wasn't uploaded. Fix the issue above and run ${import_picocolors32.default.cyan("brainbase agent push")}.`);
|
|
65635
65731
|
} else if (outgoing.length > 0) {
|
|
65636
65732
|
const pushSpinner = de();
|
|
65637
65733
|
pushSpinner.start("Pushing local content…");
|
|
@@ -65645,9 +65741,9 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65645
65741
|
} catch (err) {
|
|
65646
65742
|
pushSpinner.stop("Failed.");
|
|
65647
65743
|
if (err instanceof ApiError) {
|
|
65648
|
-
f2.warn(`Content upload failed: ${err.message}. Run ${
|
|
65744
|
+
f2.warn(`Content upload failed: ${err.message}. Run ${import_picocolors32.default.cyan("brainbase agent push")} to retry.`);
|
|
65649
65745
|
} else {
|
|
65650
|
-
f2.warn(`Content upload failed: ${err.message}. Run ${
|
|
65746
|
+
f2.warn(`Content upload failed: ${err.message}. Run ${import_picocolors32.default.cyan("brainbase agent push")} to retry.`);
|
|
65651
65747
|
}
|
|
65652
65748
|
}
|
|
65653
65749
|
}
|
|
@@ -65685,7 +65781,7 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65685
65781
|
}
|
|
65686
65782
|
};
|
|
65687
65783
|
writeSyncState(cwd2, state);
|
|
65688
|
-
$e(`Created ${
|
|
65784
|
+
$e(`Created ${import_picocolors32.default.bold(agent.name)} and linked this folder.`);
|
|
65689
65785
|
await showResultCard({
|
|
65690
65786
|
title: "CREATED",
|
|
65691
65787
|
tone: "ok",
|
|
@@ -65698,9 +65794,9 @@ async function runAgentCreate(cwd2, args) {
|
|
|
65698
65794
|
});
|
|
65699
65795
|
console.log();
|
|
65700
65796
|
if (tracking && harness === "codex") {
|
|
65701
|
-
console.log(tip(`Run ${
|
|
65797
|
+
console.log(tip(`Run ${import_picocolors32.default.cyan("codex")} once in this folder and approve trust ${import_picocolors32.default.dim("— Codex only loads project-scope config in trusted projects.")}`));
|
|
65702
65798
|
}
|
|
65703
|
-
console.log(tip(`brainbase agent unpack ${
|
|
65799
|
+
console.log(tip(`brainbase agent unpack ${import_picocolors32.default.dim("— install harness files (skills/mcps) under .claude/, .codex/, …")}`));
|
|
65704
65800
|
console.log();
|
|
65705
65801
|
}
|
|
65706
65802
|
async function loadOrScaffoldManifest(cwd2, args) {
|
|
@@ -65712,13 +65808,13 @@ async function loadOrScaffoldManifest(cwd2, args) {
|
|
|
65712
65808
|
return null;
|
|
65713
65809
|
}
|
|
65714
65810
|
}
|
|
65715
|
-
f2.warn(`No ${
|
|
65811
|
+
f2.warn(`No ${import_picocolors32.default.bold(AGENT_MANIFEST_FILE)} here.`);
|
|
65716
65812
|
if (!args.yes) {
|
|
65717
65813
|
if (!isInteractive()) {
|
|
65718
65814
|
throw new NonInteractiveError(`No ${AGENT_MANIFEST_FILE} here. Create one first, or re-run with --yes to scaffold a minimal one.`);
|
|
65719
65815
|
}
|
|
65720
65816
|
const ans = await se({
|
|
65721
|
-
message: `Scaffold a minimal ${
|
|
65817
|
+
message: `Scaffold a minimal ${import_picocolors32.default.bold(AGENT_MANIFEST_FILE)} and continue?`,
|
|
65722
65818
|
initialValue: true
|
|
65723
65819
|
});
|
|
65724
65820
|
if (!ensureNotCancelled(ans)) {
|
|
@@ -65739,7 +65835,7 @@ async function loadOrScaffoldManifest(cwd2, args) {
|
|
|
65739
65835
|
};
|
|
65740
65836
|
try {
|
|
65741
65837
|
writeManifest(cwd2, scaffold);
|
|
65742
|
-
f2.info(`Wrote ${
|
|
65838
|
+
f2.info(`Wrote ${import_picocolors32.default.bold(AGENT_MANIFEST_FILE)}.`);
|
|
65743
65839
|
} catch (err) {
|
|
65744
65840
|
f2.error(`Failed to write manifest: ${err.message}`);
|
|
65745
65841
|
return null;
|
|
@@ -65750,7 +65846,7 @@ async function pickHarness2(cwd2) {
|
|
|
65750
65846
|
const detections = await detectHarnesses(cwd2);
|
|
65751
65847
|
const detected = detections.filter((d3) => d3.detection.detected);
|
|
65752
65848
|
if (detected.length === 1) {
|
|
65753
|
-
f2.info(`Detected harness: ${
|
|
65849
|
+
f2.info(`Detected harness: ${import_picocolors32.default.bold(detected[0].adapter.displayName)}.`);
|
|
65754
65850
|
return detected[0].adapter.id;
|
|
65755
65851
|
}
|
|
65756
65852
|
return await select({
|
|
@@ -65776,6 +65872,46 @@ function handleApiError4(err) {
|
|
|
65776
65872
|
$e("Aborted.");
|
|
65777
65873
|
}
|
|
65778
65874
|
|
|
65875
|
+
// src/cli/agent-list.ts
|
|
65876
|
+
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
65877
|
+
async function runAgentList(args) {
|
|
65878
|
+
if (!args.json)
|
|
65879
|
+
banner("agent list — agents in this team");
|
|
65880
|
+
const { org, team } = await resolveOrgAndTeam({
|
|
65881
|
+
orgId: args.orgId,
|
|
65882
|
+
teamId: args.teamId,
|
|
65883
|
+
allowPrompt: !args.json,
|
|
65884
|
+
announce: !args.json
|
|
65885
|
+
});
|
|
65886
|
+
const agents = await api.listAgents(org.id, team.id);
|
|
65887
|
+
if (args.json) {
|
|
65888
|
+
console.log(JSON.stringify(agents, null, 2));
|
|
65889
|
+
return;
|
|
65890
|
+
}
|
|
65891
|
+
console.log(formatAgentList(agents, { orgName: org.name, teamName: team.name }));
|
|
65892
|
+
}
|
|
65893
|
+
function formatAgentList(agents, labels) {
|
|
65894
|
+
const lines = [""];
|
|
65895
|
+
if (agents.length === 0) {
|
|
65896
|
+
lines.push(` ${import_picocolors33.default.dim(`No agents in ${labels.orgName} → ${labels.teamName} yet.`)}`, "", ` ${import_picocolors33.default.dim("create one with")} ${import_picocolors33.default.cyan("brainbase agent create")}`, "");
|
|
65897
|
+
return lines.join(`
|
|
65898
|
+
`);
|
|
65899
|
+
}
|
|
65900
|
+
for (const agent of agents) {
|
|
65901
|
+
lines.push(` ${import_picocolors33.default.bold(agent.name)} ${import_picocolors33.default.dim(agent.slug)}`);
|
|
65902
|
+
if (agent.tagline)
|
|
65903
|
+
lines.push(` ${import_picocolors33.default.dim(agent.tagline)}`);
|
|
65904
|
+
const meta = [agent.harness, agent.machine_kind, agent.default_model].filter((value) => !!value).join(" · ");
|
|
65905
|
+
if (meta)
|
|
65906
|
+
lines.push(` ${import_picocolors33.default.dim(meta)}`);
|
|
65907
|
+
lines.push(` ${import_picocolors33.default.dim(agent.id)}`);
|
|
65908
|
+
lines.push("");
|
|
65909
|
+
}
|
|
65910
|
+
lines.push(` ${import_picocolors33.default.dim("link this folder to one with")} ${import_picocolors33.default.cyan("brainbase link --agent <id>")}`, "");
|
|
65911
|
+
return lines.join(`
|
|
65912
|
+
`);
|
|
65913
|
+
}
|
|
65914
|
+
|
|
65779
65915
|
// src/cli/agent.ts
|
|
65780
65916
|
async function runAgent(cwd2, sub, args, opts) {
|
|
65781
65917
|
if (args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
@@ -65795,6 +65931,13 @@ async function runAgent(cwd2, sub, args, opts) {
|
|
|
65795
65931
|
track: opts.track
|
|
65796
65932
|
});
|
|
65797
65933
|
return;
|
|
65934
|
+
case "list":
|
|
65935
|
+
await runAgentList({
|
|
65936
|
+
orgId: opts.orgId,
|
|
65937
|
+
teamId: opts.teamId,
|
|
65938
|
+
json: opts.json
|
|
65939
|
+
});
|
|
65940
|
+
return;
|
|
65798
65941
|
case "pull":
|
|
65799
65942
|
await runAgentPull(cwd2, {
|
|
65800
65943
|
yes: opts.yes,
|
|
@@ -65838,26 +65981,111 @@ async function runAgent(cwd2, sub, args, opts) {
|
|
|
65838
65981
|
function printHelp() {
|
|
65839
65982
|
const out = [];
|
|
65840
65983
|
out.push("");
|
|
65841
|
-
out.push(` ${
|
|
65984
|
+
out.push(` ${import_picocolors34.default.bold("brainbase agent")} ${import_picocolors34.default.dim("<sub> [options]")}`);
|
|
65985
|
+
out.push("");
|
|
65986
|
+
out.push(` ${import_picocolors34.default.cyan("list")} ${import_picocolors34.default.dim("show the agents in a team, with the ids `brainbase link` takes (--json for scripts)")}`);
|
|
65987
|
+
out.push(` ${import_picocolors34.default.cyan("create")} ${import_picocolors34.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent")}`);
|
|
65988
|
+
out.push(` ${import_picocolors34.default.cyan("pull")} ${import_picocolors34.default.dim("[<id>]")} ${import_picocolors34.default.dim("apply cloud changes into this folder — pass <id> to switch (--force to override); --run-entrypoint to also execute the agent entrypoint")}`);
|
|
65989
|
+
out.push(` ${import_picocolors34.default.cyan("push")} ${import_picocolors34.default.dim("send local changes to the cloud — instructions, playbooks, skills, MCPs, entrypoint (--force to overwrite cloud-side conflicts with local)")}`);
|
|
65990
|
+
out.push(` ${import_picocolors34.default.cyan("unpack")} ${import_picocolors34.default.dim("install the claimed agent into a harness layout (--harness to override)")}`);
|
|
65991
|
+
out.push(` ${import_picocolors34.default.cyan("status")} ${import_picocolors34.default.dim("show what would push and what would pull")}`);
|
|
65992
|
+
out.push(` ${import_picocolors34.default.cyan("env")} ${import_picocolors34.default.dim('print export statements — use with `eval "$(brainbase agent env)"`')}`);
|
|
65993
|
+
out.push("");
|
|
65994
|
+
console.log(out.join(`
|
|
65995
|
+
`));
|
|
65996
|
+
}
|
|
65997
|
+
|
|
65998
|
+
// src/cli/team.ts
|
|
65999
|
+
var import_picocolors36 = __toESM(require_picocolors(), 1);
|
|
66000
|
+
|
|
66001
|
+
// src/cli/team-list.ts
|
|
66002
|
+
var import_picocolors35 = __toESM(require_picocolors(), 1);
|
|
66003
|
+
async function runTeamList(args) {
|
|
66004
|
+
if (!args.json)
|
|
66005
|
+
banner("team list — teams you can put agents in");
|
|
66006
|
+
const orgs = args.orgId !== undefined ? [await resolveOrg(args.orgId)] : await api.listOrgs();
|
|
66007
|
+
const { entries, resolved, failures } = await listTeamsPerOrg(orgs);
|
|
66008
|
+
if (resolved.length === 0 && failures.length > 0)
|
|
66009
|
+
throw failures[0].error;
|
|
66010
|
+
if (args.json) {
|
|
66011
|
+
for (const { org, error } of failures) {
|
|
66012
|
+
console.error(`Could not load teams in ${org.name}: ${error.message}`);
|
|
66013
|
+
}
|
|
66014
|
+
console.log(JSON.stringify(entries, null, 2));
|
|
66015
|
+
return;
|
|
66016
|
+
}
|
|
66017
|
+
console.log(formatTeamList(entries));
|
|
66018
|
+
}
|
|
66019
|
+
function formatTeamList(grouped) {
|
|
66020
|
+
const lines = [""];
|
|
66021
|
+
if (grouped.length === 0) {
|
|
66022
|
+
lines.push(` ${import_picocolors35.default.dim("You are not a member of any organization.")}`, "");
|
|
66023
|
+
return lines.join(`
|
|
66024
|
+
`);
|
|
66025
|
+
}
|
|
66026
|
+
const nameWidth = Math.max(...grouped.flatMap(({ teams }) => teams.map((t) => t.name.length)), 0);
|
|
66027
|
+
for (const { org, teams, error } of grouped) {
|
|
66028
|
+
const slug = org.slug ? ` ${import_picocolors35.default.dim(org.slug)}` : "";
|
|
66029
|
+
lines.push(` ${import_picocolors35.default.bold(org.name)}${slug}`);
|
|
66030
|
+
if (error) {
|
|
66031
|
+
lines.push(` ${import_picocolors35.default.red(`could not load teams: ${error}`)}`);
|
|
66032
|
+
} else if (teams.length === 0) {
|
|
66033
|
+
lines.push(` ${import_picocolors35.default.dim("no teams yet — create one in the web app")}`);
|
|
66034
|
+
}
|
|
66035
|
+
for (const team of teams) {
|
|
66036
|
+
lines.push(` ${team.name.padEnd(nameWidth)} ${import_picocolors35.default.dim(team.id)}`);
|
|
66037
|
+
}
|
|
66038
|
+
lines.push("");
|
|
66039
|
+
}
|
|
66040
|
+
lines.push(` ${import_picocolors35.default.dim("list a team’s agents with")} ${import_picocolors35.default.cyan("brainbase agent list --team <id>")}`, "");
|
|
66041
|
+
return lines.join(`
|
|
66042
|
+
`);
|
|
66043
|
+
}
|
|
66044
|
+
|
|
66045
|
+
// src/cli/team.ts
|
|
66046
|
+
async function runTeam(sub, args, opts) {
|
|
66047
|
+
if (args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
66048
|
+
printHelp2();
|
|
66049
|
+
return;
|
|
66050
|
+
}
|
|
66051
|
+
switch (sub) {
|
|
66052
|
+
case "list":
|
|
66053
|
+
await runTeamList({ orgId: opts.orgId, json: opts.json });
|
|
66054
|
+
return;
|
|
66055
|
+
case undefined:
|
|
66056
|
+
case "help":
|
|
66057
|
+
case "-h":
|
|
66058
|
+
case "--help":
|
|
66059
|
+
printHelp2();
|
|
66060
|
+
return;
|
|
66061
|
+
default:
|
|
66062
|
+
console.error(`Unknown team subcommand: ${sub}
|
|
66063
|
+
`);
|
|
66064
|
+
printHelp2();
|
|
66065
|
+
process.exit(1);
|
|
66066
|
+
}
|
|
66067
|
+
}
|
|
66068
|
+
function printHelp2() {
|
|
66069
|
+
const out = [];
|
|
66070
|
+
out.push("");
|
|
66071
|
+
out.push(` ${import_picocolors36.default.bold("brainbase team")} ${import_picocolors36.default.dim("<sub> [options]")}`);
|
|
65842
66072
|
out.push("");
|
|
65843
|
-
out.push(` ${
|
|
65844
|
-
out.push(
|
|
65845
|
-
out.push(` ${
|
|
65846
|
-
out.push(` ${
|
|
65847
|
-
out.push(` ${import_picocolors32.default.cyan("status")} ${import_picocolors32.default.dim("show what would push and what would pull")}`);
|
|
65848
|
-
out.push(` ${import_picocolors32.default.cyan("env")} ${import_picocolors32.default.dim('print export statements — use with `eval "$(brainbase agent env)"`')}`);
|
|
66073
|
+
out.push(` ${import_picocolors36.default.cyan("list")} ${import_picocolors36.default.dim("show the teams you can create agents in, grouped by organization")}`);
|
|
66074
|
+
out.push("");
|
|
66075
|
+
out.push(` ${import_picocolors36.default.dim("--org <id-or-slug>")} ${import_picocolors36.default.dim("limit to one organization")}`);
|
|
66076
|
+
out.push(` ${import_picocolors36.default.dim("--json")} ${import_picocolors36.default.dim("machine-readable output")}`);
|
|
65849
66077
|
out.push("");
|
|
65850
66078
|
console.log(out.join(`
|
|
65851
66079
|
`));
|
|
65852
66080
|
}
|
|
65853
66081
|
|
|
65854
66082
|
// src/cli/orchestration.ts
|
|
65855
|
-
var
|
|
66083
|
+
var import_picocolors43 = __toESM(require_picocolors(), 1);
|
|
65856
66084
|
|
|
65857
66085
|
// src/cli/orchestration-pull.ts
|
|
65858
66086
|
import path85 from "node:path";
|
|
65859
66087
|
import fs76 from "node:fs";
|
|
65860
|
-
var
|
|
66088
|
+
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
65861
66089
|
|
|
65862
66090
|
// src/core/orchestration-manifest.ts
|
|
65863
66091
|
import path82 from "node:path";
|
|
@@ -66360,8 +66588,8 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
66360
66588
|
orchId = args.orchestrationId;
|
|
66361
66589
|
} else {
|
|
66362
66590
|
f2.warn("This folder is not linked to any orchestration.");
|
|
66363
|
-
f2.info(`Run ${
|
|
66364
|
-
or ${
|
|
66591
|
+
f2.info(`Run ${import_picocolors37.default.cyan("brainbase orchestration pull <id>")} with an orchestration id,
|
|
66592
|
+
or ${import_picocolors37.default.cyan("brainbase orchestration list")} to find one.`);
|
|
66365
66593
|
return;
|
|
66366
66594
|
}
|
|
66367
66595
|
const sp = de();
|
|
@@ -66380,24 +66608,24 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
66380
66608
|
const slugFor = (agentId) => slugByAgent.get(agentId) ?? agentId;
|
|
66381
66609
|
const planLines = [];
|
|
66382
66610
|
planLines.push("");
|
|
66383
|
-
planLines.push(` ${
|
|
66611
|
+
planLines.push(` ${import_picocolors37.default.bold(cloud.name)} ${import_picocolors37.default.dim(`(${cloud.id})`)}`);
|
|
66384
66612
|
if (cloud.description)
|
|
66385
|
-
planLines.push(` ${
|
|
66613
|
+
planLines.push(` ${import_picocolors37.default.dim(cloud.description)}`);
|
|
66386
66614
|
planLines.push("");
|
|
66387
|
-
planLines.push(` ${
|
|
66615
|
+
planLines.push(` ${import_picocolors37.default.dim("members:")}`);
|
|
66388
66616
|
for (const m3 of cloud.members) {
|
|
66389
66617
|
const skipped = !m3.manifest;
|
|
66390
|
-
const tail2 = skipped ?
|
|
66391
|
-
planLines.push(` ${
|
|
66618
|
+
const tail2 = skipped ? import_picocolors37.default.red(" (manifest unavailable — skipped)") : "";
|
|
66619
|
+
planLines.push(` ${import_picocolors37.default.cyan("•")} ${import_picocolors37.default.bold(slugFor(m3.agent_id))} ${import_picocolors37.default.dim(`(${m3.name})`)}${tail2}`);
|
|
66392
66620
|
}
|
|
66393
66621
|
if (cloud.edges.length) {
|
|
66394
66622
|
planLines.push("");
|
|
66395
|
-
planLines.push(` ${
|
|
66623
|
+
planLines.push(` ${import_picocolors37.default.dim("edges:")}`);
|
|
66396
66624
|
for (const e2 of cloud.edges) {
|
|
66397
66625
|
const from = slugFor(e2.from_agent_id);
|
|
66398
66626
|
const to2 = slugFor(e2.to_agent_id);
|
|
66399
|
-
const desc = e2.description ? ` ${
|
|
66400
|
-
planLines.push(` ${
|
|
66627
|
+
const desc = e2.description ? ` ${import_picocolors37.default.dim("— " + e2.description)}` : "";
|
|
66628
|
+
planLines.push(` ${import_picocolors37.default.cyan(from)} ${import_picocolors37.default.dim("→")} ${import_picocolors37.default.cyan(to2)}${desc}`);
|
|
66401
66629
|
}
|
|
66402
66630
|
}
|
|
66403
66631
|
planLines.push("");
|
|
@@ -66406,7 +66634,7 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
66406
66634
|
const isRefresh = !!existingLink;
|
|
66407
66635
|
if (!autoProceed(args.yes) && !isRefresh) {
|
|
66408
66636
|
const ok = await se({
|
|
66409
|
-
message: `Pull into ${
|
|
66637
|
+
message: `Pull into ${import_picocolors37.default.bold(cwd2)}?`,
|
|
66410
66638
|
initialValue: true
|
|
66411
66639
|
});
|
|
66412
66640
|
if (!ensureNotCancelled(ok)) {
|
|
@@ -66450,7 +66678,7 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
66450
66678
|
scope: "project",
|
|
66451
66679
|
pullSecrets: true
|
|
66452
66680
|
});
|
|
66453
|
-
memberSp.stop(`Installed ${
|
|
66681
|
+
memberSp.stop(`Installed ${import_picocolors37.default.bold(slug)} ${import_picocolors37.default.dim(`(${m3.manifest.components.length} components)`)}.`);
|
|
66454
66682
|
installedMembers.push({
|
|
66455
66683
|
agent_id: m3.agent_id,
|
|
66456
66684
|
slug,
|
|
@@ -66511,7 +66739,7 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
66511
66739
|
payload_schema: e2.payload_schema ?? {}
|
|
66512
66740
|
}))
|
|
66513
66741
|
});
|
|
66514
|
-
$e(`Pulled ${cloud.name} at revision ${cloud.revision} into ${path85.basename(cwd2)}/ ${
|
|
66742
|
+
$e(`Pulled ${cloud.name} at revision ${cloud.revision} into ${path85.basename(cwd2)}/ ${import_picocolors37.default.dim(`(${installedMembers.length}/${cloud.members.length} members)`)}.`);
|
|
66515
66743
|
}
|
|
66516
66744
|
function handleApiError5(err) {
|
|
66517
66745
|
if (err instanceof ApiError) {
|
|
@@ -66528,7 +66756,7 @@ function handleApiError5(err) {
|
|
|
66528
66756
|
}
|
|
66529
66757
|
|
|
66530
66758
|
// src/cli/orchestration-push.ts
|
|
66531
|
-
var
|
|
66759
|
+
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
66532
66760
|
|
|
66533
66761
|
// src/core/orchestration-outgoing.ts
|
|
66534
66762
|
function buildOrchestrationGraphPayload(manifest, slugToAgentId) {
|
|
@@ -66598,12 +66826,12 @@ async function runOrchestrationPush(cwd2, args) {
|
|
|
66598
66826
|
const link2 = readOrchLink(cwd2);
|
|
66599
66827
|
if (!link2) {
|
|
66600
66828
|
f2.warn("This folder is not linked to any orchestration.");
|
|
66601
|
-
f2.info(`Run ${
|
|
66829
|
+
f2.info(`Run ${import_picocolors38.default.cyan("brainbase orchestration pull <id>")} first.`);
|
|
66602
66830
|
return;
|
|
66603
66831
|
}
|
|
66604
66832
|
if (!hasOrchManifest(cwd2)) {
|
|
66605
|
-
f2.warn(`No ${
|
|
66606
|
-
f2.info(`Run ${
|
|
66833
|
+
f2.warn(`No ${import_picocolors38.default.bold(ORCH_MANIFEST_FILE)} here.`);
|
|
66834
|
+
f2.info(`Run ${import_picocolors38.default.cyan("brainbase orchestration pull")} to materialise the manifest before pushing.`);
|
|
66607
66835
|
return;
|
|
66608
66836
|
}
|
|
66609
66837
|
let manifest;
|
|
@@ -66627,7 +66855,7 @@ async function runOrchestrationPush(cwd2, args) {
|
|
|
66627
66855
|
}
|
|
66628
66856
|
if (missing.length) {
|
|
66629
66857
|
f2.error(`Missing local checkouts for: ${missing.join(", ")}.`);
|
|
66630
|
-
f2.info(`Run ${
|
|
66858
|
+
f2.info(`Run ${import_picocolors38.default.cyan("brainbase orchestration pull")} to materialise the missing folders.`);
|
|
66631
66859
|
return;
|
|
66632
66860
|
}
|
|
66633
66861
|
let graph;
|
|
@@ -66639,13 +66867,13 @@ async function runOrchestrationPush(cwd2, args) {
|
|
|
66639
66867
|
return;
|
|
66640
66868
|
}
|
|
66641
66869
|
const plan = [""];
|
|
66642
|
-
plan.push(` ${
|
|
66643
|
-
plan.push(` ${
|
|
66870
|
+
plan.push(` ${import_picocolors38.default.bold(link2.name)} ${import_picocolors38.default.dim(`(${link2.orchestration_id})`)}`);
|
|
66871
|
+
plan.push(` ${import_picocolors38.default.dim(`${manifest.members.length} member${manifest.members.length === 1 ? "" : "s"}, ${manifest.edges.length} edge${manifest.edges.length === 1 ? "" : "s"}, ${graph.triggers.length} trigger${graph.triggers.length === 1 ? "" : "s"}`)}`);
|
|
66644
66872
|
plan.push("");
|
|
66645
66873
|
if (!args.graphOnly) {
|
|
66646
|
-
plan.push(` ${
|
|
66874
|
+
plan.push(` ${import_picocolors38.default.dim("per-member agent push:")}`);
|
|
66647
66875
|
for (const m3 of manifest.members) {
|
|
66648
|
-
plan.push(` ${
|
|
66876
|
+
plan.push(` ${import_picocolors38.default.cyan("•")} ${import_picocolors38.default.bold(m3.slug)}`);
|
|
66649
66877
|
}
|
|
66650
66878
|
plan.push("");
|
|
66651
66879
|
}
|
|
@@ -66665,7 +66893,7 @@ async function runOrchestrationPush(cwd2, args) {
|
|
|
66665
66893
|
for (const m3 of manifest.members) {
|
|
66666
66894
|
const dir = memberDir(cwd2, m3.slug);
|
|
66667
66895
|
console.log("");
|
|
66668
|
-
console.log(`${
|
|
66896
|
+
console.log(`${import_picocolors38.default.dim("───")} ${import_picocolors38.default.bold(m3.slug)} ${import_picocolors38.default.dim("───")}`);
|
|
66669
66897
|
try {
|
|
66670
66898
|
await runAgentPush(dir, { yes: true });
|
|
66671
66899
|
} catch (err) {
|
|
@@ -66723,7 +66951,7 @@ function handleApiError6(err) {
|
|
|
66723
66951
|
f2.error("You do not have access to this orchestration.");
|
|
66724
66952
|
} else if (err.status === 409) {
|
|
66725
66953
|
f2.error(err.message);
|
|
66726
|
-
f2.info(`Run ${
|
|
66954
|
+
f2.info(`Run ${import_picocolors38.default.cyan("brainbase orchestration pull")} to reconcile, then push again.`);
|
|
66727
66955
|
} else {
|
|
66728
66956
|
f2.error(err.message);
|
|
66729
66957
|
}
|
|
@@ -66733,13 +66961,13 @@ function handleApiError6(err) {
|
|
|
66733
66961
|
}
|
|
66734
66962
|
|
|
66735
66963
|
// src/cli/orchestration-status.ts
|
|
66736
|
-
var
|
|
66964
|
+
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
66737
66965
|
async function runOrchestrationStatus(cwd2) {
|
|
66738
66966
|
banner("orchestration status — what changed locally, remotely, both");
|
|
66739
66967
|
const link2 = readOrchLink(cwd2);
|
|
66740
66968
|
if (!link2) {
|
|
66741
66969
|
f2.warn("This folder is not linked to any orchestration.");
|
|
66742
|
-
f2.info(`Run ${
|
|
66970
|
+
f2.info(`Run ${import_picocolors39.default.cyan("brainbase orchestration pull <id>")} first.`);
|
|
66743
66971
|
return;
|
|
66744
66972
|
}
|
|
66745
66973
|
const localManifest = hasOrchManifest(cwd2) ? readOrchManifest(cwd2) : null;
|
|
@@ -66762,8 +66990,8 @@ async function runOrchestrationStatus(cwd2) {
|
|
|
66762
66990
|
}
|
|
66763
66991
|
const lines = [];
|
|
66764
66992
|
lines.push("");
|
|
66765
|
-
lines.push(` ${
|
|
66766
|
-
lines.push(` ${
|
|
66993
|
+
lines.push(` ${import_picocolors39.default.bold(link2.name)} ${import_picocolors39.default.dim(`(${link2.orchestration_id})`)}`);
|
|
66994
|
+
lines.push(` ${import_picocolors39.default.dim("revision")} cloud ${cloud.revision}${lock ? ` · lock ${lock.revision}` : " · never pulled"}`);
|
|
66767
66995
|
lines.push("");
|
|
66768
66996
|
const localSlugByAgentId = new Map;
|
|
66769
66997
|
for (const m3 of localManifest?.members ?? []) {
|
|
@@ -66777,12 +67005,12 @@ async function runOrchestrationStatus(cwd2) {
|
|
|
66777
67005
|
const membersAdded = [...localMemberSet].filter((s3) => !cloudMemberSet.has(s3));
|
|
66778
67006
|
const membersRemoved = [...cloudMemberSet].filter((s3) => !localMemberSet.has(s3));
|
|
66779
67007
|
if (membersAdded.length || membersRemoved.length) {
|
|
66780
|
-
lines.push(` ${
|
|
67008
|
+
lines.push(` ${import_picocolors39.default.bold("members")}`);
|
|
66781
67009
|
for (const slug of membersAdded) {
|
|
66782
|
-
lines.push(` ${
|
|
67010
|
+
lines.push(` ${import_picocolors39.default.yellow("→ push")} added in yaml: ${import_picocolors39.default.bold(slug)}`);
|
|
66783
67011
|
}
|
|
66784
67012
|
for (const slug of membersRemoved) {
|
|
66785
|
-
lines.push(` ${
|
|
67013
|
+
lines.push(` ${import_picocolors39.default.cyan("← pull")} added on cloud: ${import_picocolors39.default.bold(slug)}`);
|
|
66786
67014
|
}
|
|
66787
67015
|
lines.push("");
|
|
66788
67016
|
}
|
|
@@ -66797,11 +67025,11 @@ async function runOrchestrationStatus(cwd2) {
|
|
|
66797
67025
|
const edgesAdded = [...localEdges.keys()].filter((k3) => !cloudEdges.has(k3));
|
|
66798
67026
|
const edgesRemoved = [...cloudEdges.keys()].filter((k3) => !localEdges.has(k3));
|
|
66799
67027
|
if (edgesAdded.length || edgesRemoved.length) {
|
|
66800
|
-
lines.push(` ${
|
|
67028
|
+
lines.push(` ${import_picocolors39.default.bold("edges")}`);
|
|
66801
67029
|
for (const k3 of edgesAdded)
|
|
66802
|
-
lines.push(` ${
|
|
67030
|
+
lines.push(` ${import_picocolors39.default.yellow("→ push")} added in yaml: ${k3}`);
|
|
66803
67031
|
for (const k3 of edgesRemoved)
|
|
66804
|
-
lines.push(` ${
|
|
67032
|
+
lines.push(` ${import_picocolors39.default.cyan("← pull")} added on cloud: ${k3}`);
|
|
66805
67033
|
lines.push("");
|
|
66806
67034
|
}
|
|
66807
67035
|
const cloudTriggerKey = (t) => {
|
|
@@ -66839,11 +67067,11 @@ async function runOrchestrationStatus(cwd2) {
|
|
|
66839
67067
|
const triggersAdded = [...localTriggers.keys()].filter((k3) => !cloudTriggers.has(k3));
|
|
66840
67068
|
const triggersRemoved = [...cloudTriggers.keys()].filter((k3) => !localTriggers.has(k3));
|
|
66841
67069
|
if (triggersAdded.length || triggersRemoved.length) {
|
|
66842
|
-
lines.push(` ${
|
|
67070
|
+
lines.push(` ${import_picocolors39.default.bold("schedule triggers")}`);
|
|
66843
67071
|
for (const k3 of triggersAdded)
|
|
66844
|
-
lines.push(` ${
|
|
67072
|
+
lines.push(` ${import_picocolors39.default.yellow("→ push")} added/changed in yaml: ${localTriggers.get(k3) ?? k3}`);
|
|
66845
67073
|
for (const k3 of triggersRemoved)
|
|
66846
|
-
lines.push(` ${
|
|
67074
|
+
lines.push(` ${import_picocolors39.default.cyan("← pull")} added/changed on cloud: ${cloudTriggers.get(k3) ?? k3}`);
|
|
66847
67075
|
lines.push("");
|
|
66848
67076
|
}
|
|
66849
67077
|
const lockByAgentId = new Map((lock?.members ?? []).map((m3) => [m3.agent_id, m3]));
|
|
@@ -66866,27 +67094,27 @@ async function runOrchestrationStatus(cwd2) {
|
|
|
66866
67094
|
}
|
|
66867
67095
|
}
|
|
66868
67096
|
if (memberDrift.length) {
|
|
66869
|
-
lines.push(` ${
|
|
67097
|
+
lines.push(` ${import_picocolors39.default.bold("member content drift")}`);
|
|
66870
67098
|
for (const d3 of memberDrift) {
|
|
66871
|
-
lines.push(` ${
|
|
67099
|
+
lines.push(` ${import_picocolors39.default.cyan("?")} ${import_picocolors39.default.bold(d3.slug)} ${import_picocolors39.default.dim("— " + d3.reason)}`);
|
|
66872
67100
|
}
|
|
66873
|
-
lines.push(` ${
|
|
67101
|
+
lines.push(` ${import_picocolors39.default.dim("cd into each member folder and run")} ${import_picocolors39.default.cyan("brainbase agent status")}`);
|
|
66874
67102
|
lines.push("");
|
|
66875
67103
|
}
|
|
66876
67104
|
const revisionDrift = lock?.revision != null && cloud.revision !== lock.revision;
|
|
66877
67105
|
if (revisionDrift) {
|
|
66878
|
-
lines.push(` ${
|
|
66879
|
-
lines.push(` ${
|
|
67106
|
+
lines.push(` ${import_picocolors39.default.bold("cloud revision")}`);
|
|
67107
|
+
lines.push(` ${import_picocolors39.default.cyan("← pull")} cloud changed since last pull: ${import_picocolors39.default.dim(`lock ${lock.revision} → cloud ${cloud.revision}`)}`);
|
|
66880
67108
|
lines.push("");
|
|
66881
67109
|
}
|
|
66882
67110
|
if (!membersAdded.length && !membersRemoved.length && !edgesAdded.length && !edgesRemoved.length && !triggersAdded.length && !triggersRemoved.length && !memberDrift.length && !revisionDrift) {
|
|
66883
|
-
lines.push(` ${
|
|
67111
|
+
lines.push(` ${import_picocolors39.default.green("✓")} everything is in sync`);
|
|
66884
67112
|
lines.push("");
|
|
66885
67113
|
console.log(lines.join(`
|
|
66886
67114
|
`));
|
|
66887
67115
|
return;
|
|
66888
67116
|
}
|
|
66889
|
-
lines.push(` ${
|
|
67117
|
+
lines.push(` ${import_picocolors39.default.dim("run")} ${import_picocolors39.default.cyan("brainbase orchestration pull")} ${import_picocolors39.default.dim("to apply cloud changes,")} ${import_picocolors39.default.cyan("brainbase orchestration push")} ${import_picocolors39.default.dim("to send yours")}`);
|
|
66890
67118
|
lines.push("");
|
|
66891
67119
|
console.log(lines.join(`
|
|
66892
67120
|
`));
|
|
@@ -66901,108 +67129,45 @@ function stableJson(value) {
|
|
|
66901
67129
|
}
|
|
66902
67130
|
|
|
66903
67131
|
// src/cli/orchestration-list.ts
|
|
66904
|
-
var
|
|
67132
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
66905
67133
|
async function runOrchestrationList(args) {
|
|
66906
67134
|
banner("orchestration list — orchestrations under a team");
|
|
66907
|
-
|
|
66908
|
-
|
|
66909
|
-
|
|
66910
|
-
|
|
66911
|
-
|
|
66912
|
-
orgs = await api.listOrgs();
|
|
66913
|
-
} catch (err) {
|
|
66914
|
-
handleApiError7(err);
|
|
66915
|
-
return;
|
|
66916
|
-
}
|
|
66917
|
-
if (orgs.length === 0) {
|
|
66918
|
-
f2.warn("You are not a member of any organization.");
|
|
66919
|
-
return;
|
|
66920
|
-
}
|
|
66921
|
-
if (orgId) {
|
|
66922
|
-
const found = orgs.find((o2) => o2.id === orgId || o2.slug === orgId);
|
|
66923
|
-
if (!found) {
|
|
66924
|
-
f2.error(`Org ${orgId} not found or you're not a member.`);
|
|
66925
|
-
return;
|
|
66926
|
-
}
|
|
66927
|
-
orgId = found.id;
|
|
66928
|
-
} else if (orgs.length === 1) {
|
|
66929
|
-
orgId = orgs[0].id;
|
|
66930
|
-
} else {
|
|
66931
|
-
orgId = await select({
|
|
66932
|
-
message: "Which organization?",
|
|
66933
|
-
options: orgs.map((o2) => ({ value: o2.id, label: o2.name, hint: o2.role })),
|
|
66934
|
-
flagHint: "Pass --org <id-or-slug>."
|
|
66935
|
-
});
|
|
66936
|
-
}
|
|
66937
|
-
}
|
|
66938
|
-
if (!teamId) {
|
|
66939
|
-
let teams;
|
|
66940
|
-
try {
|
|
66941
|
-
teams = await api.listTeams(orgId);
|
|
66942
|
-
} catch (err) {
|
|
66943
|
-
handleApiError7(err);
|
|
66944
|
-
return;
|
|
66945
|
-
}
|
|
66946
|
-
if (teams.length === 0) {
|
|
66947
|
-
f2.warn("No teams under this organization. Create one in the web app first.");
|
|
66948
|
-
return;
|
|
66949
|
-
}
|
|
66950
|
-
if (teams.length === 1) {
|
|
66951
|
-
teamId = teams[0].id;
|
|
66952
|
-
} else {
|
|
66953
|
-
teamId = await select({
|
|
66954
|
-
message: "Which team?",
|
|
66955
|
-
options: teams.map((t) => ({ value: t.id, label: t.name })),
|
|
66956
|
-
flagHint: "Pass --team <id>."
|
|
66957
|
-
});
|
|
66958
|
-
}
|
|
66959
|
-
}
|
|
66960
|
-
let items;
|
|
67135
|
+
const { org, team } = await resolveOrgAndTeam({
|
|
67136
|
+
orgId: args.orgId,
|
|
67137
|
+
teamId: args.teamId,
|
|
67138
|
+
announce: true
|
|
67139
|
+
});
|
|
66961
67140
|
const sp = de();
|
|
66962
67141
|
sp.start("Fetching orchestrations…");
|
|
67142
|
+
let items;
|
|
66963
67143
|
try {
|
|
66964
|
-
items = await api.listOrchestrations(
|
|
66965
|
-
sp.stop(`${items.length} orchestration${items.length === 1 ? "" : "s"}.`);
|
|
67144
|
+
items = await api.listOrchestrations(org.id, team.id);
|
|
66966
67145
|
} catch (err) {
|
|
66967
67146
|
sp.stop("Failed.");
|
|
66968
|
-
|
|
66969
|
-
return;
|
|
67147
|
+
throw err;
|
|
66970
67148
|
}
|
|
67149
|
+
sp.stop(`${items.length} orchestration${items.length === 1 ? "" : "s"}.`);
|
|
66971
67150
|
if (items.length === 0) {
|
|
66972
67151
|
f2.info("This team has no orchestrations yet.");
|
|
66973
67152
|
return;
|
|
66974
67153
|
}
|
|
66975
67154
|
const lines = [""];
|
|
66976
67155
|
for (const o2 of items) {
|
|
66977
|
-
lines.push(` ${
|
|
67156
|
+
lines.push(` ${import_picocolors40.default.bold(o2.name)} ${import_picocolors40.default.dim(o2.id)}`);
|
|
66978
67157
|
if (o2.description)
|
|
66979
|
-
lines.push(` ${
|
|
66980
|
-
lines.push(` ${
|
|
67158
|
+
lines.push(` ${import_picocolors40.default.dim(o2.description)}`);
|
|
67159
|
+
lines.push(` ${import_picocolors40.default.dim(`${o2.member_count} member${o2.member_count === 1 ? "" : "s"} · ${o2.edge_count} edge${o2.edge_count === 1 ? "" : "s"}`)}`);
|
|
66981
67160
|
lines.push("");
|
|
66982
67161
|
}
|
|
66983
|
-
lines.push(` ${
|
|
67162
|
+
lines.push(` ${import_picocolors40.default.dim("pull one with")} ${import_picocolors40.default.cyan("brainbase orchestration pull <id>")}`);
|
|
66984
67163
|
lines.push("");
|
|
66985
67164
|
console.log(lines.join(`
|
|
66986
67165
|
`));
|
|
66987
67166
|
}
|
|
66988
|
-
function isUuid(value) {
|
|
66989
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-9a-f][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
66990
|
-
}
|
|
66991
|
-
function handleApiError7(err) {
|
|
66992
|
-
if (err instanceof ApiError) {
|
|
66993
|
-
if (err.status === 401) {
|
|
66994
|
-
f2.error("Your session is invalid. Run `brainbase login` and try again.");
|
|
66995
|
-
} else {
|
|
66996
|
-
f2.error(err.message);
|
|
66997
|
-
}
|
|
66998
|
-
} else {
|
|
66999
|
-
f2.error(err.message);
|
|
67000
|
-
}
|
|
67001
|
-
}
|
|
67002
67167
|
|
|
67003
67168
|
// src/cli/orchestration-add-agent.ts
|
|
67004
67169
|
import fs77 from "node:fs";
|
|
67005
|
-
var
|
|
67170
|
+
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
67006
67171
|
|
|
67007
67172
|
// src/core/orchestration-add.ts
|
|
67008
67173
|
function resolveOrgIdForGroup(groupId, orgsWithTeams) {
|
|
@@ -67067,7 +67232,7 @@ async function runOrchestrationAddAgent(cwd2, args) {
|
|
|
67067
67232
|
const link2 = readOrchLink(cwd2);
|
|
67068
67233
|
if (!link2 || !hasOrchManifest(cwd2)) {
|
|
67069
67234
|
f2.warn("This folder is not a linked orchestration.");
|
|
67070
|
-
f2.info(`Run ${
|
|
67235
|
+
f2.info(`Run ${import_picocolors41.default.cyan("brainbase orchestration pull <id>")} first.`);
|
|
67071
67236
|
return;
|
|
67072
67237
|
}
|
|
67073
67238
|
let manifest;
|
|
@@ -67093,7 +67258,7 @@ async function runOrchestrationAddAgent(cwd2, args) {
|
|
|
67093
67258
|
while (manifest.members.some((m3) => m3.slug === candidate) || fs77.existsSync(memberDir(cwd2, candidate))) {
|
|
67094
67259
|
candidate = `${slug}-${++n}`;
|
|
67095
67260
|
}
|
|
67096
|
-
f2.info(`Slug ${
|
|
67261
|
+
f2.info(`Slug ${import_picocolors41.default.bold(slug)} is taken — using ${import_picocolors41.default.bold(candidate)}.`);
|
|
67097
67262
|
slug = candidate;
|
|
67098
67263
|
}
|
|
67099
67264
|
let payloadSchema;
|
|
@@ -67117,7 +67282,7 @@ async function runOrchestrationAddAgent(cwd2, args) {
|
|
|
67117
67282
|
const resolved = resolveOrgIdForGroup(link2.group_id, orgsWithTeams);
|
|
67118
67283
|
if (!resolved) {
|
|
67119
67284
|
sp.stop("Failed.");
|
|
67120
|
-
f2.error(`Could not find an org that owns group ${
|
|
67285
|
+
f2.error(`Could not find an org that owns group ${import_picocolors41.default.bold(link2.group_id)}. ` + `Pass ${import_picocolors41.default.cyan("--org <id>")} explicitly.`);
|
|
67121
67286
|
return;
|
|
67122
67287
|
}
|
|
67123
67288
|
orgId = resolved;
|
|
@@ -67134,14 +67299,14 @@ async function runOrchestrationAddAgent(cwd2, args) {
|
|
|
67134
67299
|
if (from.length === 0 && to2.length === 0 && isInteractive() && manifest.members.length > 0) {
|
|
67135
67300
|
const memberOptions = manifest.members.map((m3) => ({ value: m3.slug, label: m3.slug }));
|
|
67136
67301
|
const pickedFrom = await ae({
|
|
67137
|
-
message: `Connect ${
|
|
67302
|
+
message: `Connect ${import_picocolors41.default.bold(slug)} FROM which member(s)? — edges INTO ${slug} (space to select, enter to skip)`,
|
|
67138
67303
|
options: memberOptions,
|
|
67139
67304
|
required: false
|
|
67140
67305
|
});
|
|
67141
67306
|
if (Array.isArray(pickedFrom))
|
|
67142
67307
|
from = pickedFrom;
|
|
67143
67308
|
const pickedTo = await ae({
|
|
67144
|
-
message: `Connect ${
|
|
67309
|
+
message: `Connect ${import_picocolors41.default.bold(slug)} TO which member(s)? — edges OUT of ${slug} (space to select, enter to skip)`,
|
|
67145
67310
|
options: memberOptions,
|
|
67146
67311
|
required: false
|
|
67147
67312
|
});
|
|
@@ -67180,23 +67345,23 @@ async function runOrchestrationAddAgent(cwd2, args) {
|
|
|
67180
67345
|
}
|
|
67181
67346
|
writeOrchManifest(cwd2, updated);
|
|
67182
67347
|
if (args.noPush) {
|
|
67183
|
-
f2.info(`Manifest updated. Run ${
|
|
67348
|
+
f2.info(`Manifest updated. Run ${import_picocolors41.default.cyan("brainbase orchestration push")} to apply.`);
|
|
67184
67349
|
return;
|
|
67185
67350
|
}
|
|
67186
67351
|
await runOrchestrationPush(cwd2, { yes: true, graphOnly: true });
|
|
67187
67352
|
}
|
|
67188
67353
|
|
|
67189
67354
|
// src/cli/orchestration-create.ts
|
|
67190
|
-
var
|
|
67355
|
+
var import_picocolors42 = __toESM(require_picocolors(), 1);
|
|
67191
67356
|
async function runOrchestrationCreate(cwd2, args) {
|
|
67192
67357
|
banner("orchestration create — claim a brainbase-orchestration.yaml");
|
|
67193
67358
|
if (readOrchLink(cwd2)) {
|
|
67194
67359
|
f2.warn("This folder is already linked to an orchestration.");
|
|
67195
|
-
f2.info(`Run ${
|
|
67360
|
+
f2.info(`Run ${import_picocolors42.default.cyan("brainbase orchestration push")} to update it.`);
|
|
67196
67361
|
return;
|
|
67197
67362
|
}
|
|
67198
67363
|
if (!hasOrchManifest(cwd2)) {
|
|
67199
|
-
f2.warn(`No ${
|
|
67364
|
+
f2.warn(`No ${import_picocolors42.default.bold(ORCH_MANIFEST_FILE)} here.`);
|
|
67200
67365
|
f2.info(`Create one, or pull an existing orchestration first.`);
|
|
67201
67366
|
return;
|
|
67202
67367
|
}
|
|
@@ -67222,15 +67387,17 @@ async function runOrchestrationCreate(cwd2, args) {
|
|
|
67222
67387
|
process.exitCode = 1;
|
|
67223
67388
|
return;
|
|
67224
67389
|
}
|
|
67225
|
-
const target = await resolveOrgAndTeam(
|
|
67226
|
-
|
|
67227
|
-
|
|
67390
|
+
const target = await resolveOrgAndTeam({
|
|
67391
|
+
orgId: args.orgId,
|
|
67392
|
+
teamId: args.teamId,
|
|
67393
|
+
announce: true
|
|
67394
|
+
});
|
|
67228
67395
|
const plan = [
|
|
67229
67396
|
"",
|
|
67230
|
-
` ${
|
|
67231
|
-
` ${
|
|
67232
|
-
` ${
|
|
67233
|
-
` ${
|
|
67397
|
+
` ${import_picocolors42.default.bold(manifest.orchestration.name)}`,
|
|
67398
|
+
` ${import_picocolors42.default.dim("org")} ${import_picocolors42.default.bold(target.org.name)}`,
|
|
67399
|
+
` ${import_picocolors42.default.dim("team")} ${import_picocolors42.default.bold(target.team.name)}`,
|
|
67400
|
+
` ${import_picocolors42.default.dim("graph")} ${manifest.members.length} member${manifest.members.length === 1 ? "" : "s"}, ${manifest.edges.length} edge${manifest.edges.length === 1 ? "" : "s"}, ${graph.triggers.length} trigger${graph.triggers.length === 1 ? "" : "s"}`,
|
|
67234
67401
|
""
|
|
67235
67402
|
];
|
|
67236
67403
|
console.log(plan.join(`
|
|
@@ -67260,7 +67427,7 @@ async function runOrchestrationCreate(cwd2, args) {
|
|
|
67260
67427
|
edges: graph.edges,
|
|
67261
67428
|
triggers: graph.triggers
|
|
67262
67429
|
});
|
|
67263
|
-
sp.stop(`Created ${
|
|
67430
|
+
sp.stop(`Created ${import_picocolors42.default.bold(created.name)}.`);
|
|
67264
67431
|
writeOrchLink(cwd2, {
|
|
67265
67432
|
schemaVersion: 1,
|
|
67266
67433
|
orchestration_id: created.id,
|
|
@@ -67291,92 +67458,11 @@ async function runOrchestrationCreate(cwd2, args) {
|
|
|
67291
67458
|
$e(`Created ${created.name} at revision ${created.revision}.`);
|
|
67292
67459
|
} catch (err) {
|
|
67293
67460
|
sp.stop("Failed.");
|
|
67294
|
-
|
|
67295
|
-
process.exitCode = 1;
|
|
67296
|
-
}
|
|
67297
|
-
}
|
|
67298
|
-
async function resolveOrgAndTeam(args) {
|
|
67299
|
-
const orgsSpinner = de();
|
|
67300
|
-
orgsSpinner.start("Loading your organizations…");
|
|
67301
|
-
let orgs;
|
|
67302
|
-
try {
|
|
67303
|
-
orgs = await api.listOrgs();
|
|
67304
|
-
} catch (err) {
|
|
67305
|
-
orgsSpinner.stop("Failed.");
|
|
67306
|
-
handleApiError8(err);
|
|
67307
|
-
process.exitCode = 1;
|
|
67308
|
-
return null;
|
|
67309
|
-
}
|
|
67310
|
-
orgsSpinner.stop(`Found ${orgs.length} organization${orgs.length === 1 ? "" : "s"}.`);
|
|
67311
|
-
if (orgs.length === 0) {
|
|
67312
|
-
f2.warn("You are not in any organizations yet.");
|
|
67313
|
-
process.exitCode = 1;
|
|
67314
|
-
return null;
|
|
67315
|
-
}
|
|
67316
|
-
let org;
|
|
67317
|
-
if (args.orgId) {
|
|
67318
|
-
const found = orgs.find((o2) => o2.id === args.orgId || o2.slug === args.orgId);
|
|
67319
|
-
if (!found) {
|
|
67320
|
-
f2.error(`Org ${args.orgId} not found or you're not a member.`);
|
|
67321
|
-
process.exitCode = 1;
|
|
67322
|
-
return null;
|
|
67323
|
-
}
|
|
67324
|
-
org = found;
|
|
67325
|
-
} else if (orgs.length === 1) {
|
|
67326
|
-
org = orgs[0];
|
|
67327
|
-
f2.info(`Using organization ${import_picocolors38.default.bold(org.name)}.`);
|
|
67328
|
-
} else if (!isInteractive()) {
|
|
67329
|
-
throw new NonInteractiveError("Multiple organizations. Pass --org <id-or-slug> to choose non-interactively.");
|
|
67330
|
-
} else {
|
|
67331
|
-
const orgId = await select({
|
|
67332
|
-
message: "Pick an organization",
|
|
67333
|
-
options: orgs.map((o2) => ({ value: o2.id, label: o2.name, hint: o2.role })),
|
|
67334
|
-
flagHint: "Pass --org <id-or-slug> to choose non-interactively."
|
|
67335
|
-
});
|
|
67336
|
-
org = orgs.find((o2) => o2.id === orgId);
|
|
67337
|
-
}
|
|
67338
|
-
const teamsSpinner = de();
|
|
67339
|
-
teamsSpinner.start(`Loading teams in ${org.name}…`);
|
|
67340
|
-
let teams;
|
|
67341
|
-
try {
|
|
67342
|
-
teams = await api.listTeams(org.id);
|
|
67343
|
-
} catch (err) {
|
|
67344
|
-
teamsSpinner.stop("Failed.");
|
|
67345
|
-
handleApiError8(err);
|
|
67346
|
-
process.exitCode = 1;
|
|
67347
|
-
return null;
|
|
67348
|
-
}
|
|
67349
|
-
teamsSpinner.stop(`Found ${teams.length} team${teams.length === 1 ? "" : "s"}.`);
|
|
67350
|
-
if (teams.length === 0) {
|
|
67351
|
-
f2.warn(`No teams in ${org.name} yet.`);
|
|
67461
|
+
handleApiError7(err);
|
|
67352
67462
|
process.exitCode = 1;
|
|
67353
|
-
return null;
|
|
67354
|
-
}
|
|
67355
|
-
let team;
|
|
67356
|
-
if (args.teamId) {
|
|
67357
|
-
const found = teams.find((t) => t.id === args.teamId);
|
|
67358
|
-
if (!found) {
|
|
67359
|
-
f2.error(`Team ${args.teamId} not found in this org.`);
|
|
67360
|
-
process.exitCode = 1;
|
|
67361
|
-
return null;
|
|
67362
|
-
}
|
|
67363
|
-
team = found;
|
|
67364
|
-
} else if (teams.length === 1) {
|
|
67365
|
-
team = teams[0];
|
|
67366
|
-
f2.info(`Using team ${import_picocolors38.default.bold(team.name)}.`);
|
|
67367
|
-
} else if (!isInteractive()) {
|
|
67368
|
-
throw new NonInteractiveError("Multiple teams. Pass --team <id> to choose non-interactively.");
|
|
67369
|
-
} else {
|
|
67370
|
-
const teamId = await select({
|
|
67371
|
-
message: "Pick a team",
|
|
67372
|
-
options: teams.map((t) => ({ value: t.id, label: t.name, hint: t.role })),
|
|
67373
|
-
flagHint: "Pass --team <id> to choose non-interactively."
|
|
67374
|
-
});
|
|
67375
|
-
team = teams.find((t) => t.id === teamId);
|
|
67376
67463
|
}
|
|
67377
|
-
return { org, team };
|
|
67378
67464
|
}
|
|
67379
|
-
function
|
|
67465
|
+
function handleApiError7(err) {
|
|
67380
67466
|
if (err instanceof ApiError) {
|
|
67381
67467
|
if (err.status === 401) {
|
|
67382
67468
|
f2.error("Your session is invalid. Run `brainbase login` and try again.");
|
|
@@ -67393,7 +67479,7 @@ function handleApiError8(err) {
|
|
|
67393
67479
|
// src/cli/orchestration.ts
|
|
67394
67480
|
async function runOrchestration(cwd2, sub, args, opts) {
|
|
67395
67481
|
if (args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
67396
|
-
|
|
67482
|
+
printHelp3();
|
|
67397
67483
|
return;
|
|
67398
67484
|
}
|
|
67399
67485
|
switch (sub) {
|
|
@@ -67442,33 +67528,33 @@ async function runOrchestration(cwd2, sub, args, opts) {
|
|
|
67442
67528
|
case "help":
|
|
67443
67529
|
case "-h":
|
|
67444
67530
|
case "--help":
|
|
67445
|
-
|
|
67531
|
+
printHelp3();
|
|
67446
67532
|
return;
|
|
67447
67533
|
default:
|
|
67448
67534
|
console.error(`Unknown orchestration subcommand: ${sub}
|
|
67449
67535
|
`);
|
|
67450
|
-
|
|
67536
|
+
printHelp3();
|
|
67451
67537
|
process.exit(1);
|
|
67452
67538
|
}
|
|
67453
67539
|
}
|
|
67454
|
-
function
|
|
67540
|
+
function printHelp3() {
|
|
67455
67541
|
const out = [];
|
|
67456
67542
|
out.push("");
|
|
67457
|
-
out.push(` ${
|
|
67543
|
+
out.push(` ${import_picocolors43.default.bold("brainbase orchestration")} ${import_picocolors43.default.dim("<sub> [options]")}`);
|
|
67458
67544
|
out.push("");
|
|
67459
|
-
out.push(` ${
|
|
67460
|
-
out.push(` ${
|
|
67461
|
-
out.push(` ${
|
|
67462
|
-
out.push(` ${
|
|
67463
|
-
out.push(` ${
|
|
67464
|
-
out.push(` ${
|
|
67545
|
+
out.push(` ${import_picocolors43.default.cyan("create")} ${import_picocolors43.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
|
|
67546
|
+
out.push(` ${import_picocolors43.default.cyan("pull")} ${import_picocolors43.default.dim("<id>")} ${import_picocolors43.default.dim("fetch orchestration + every member agent into this folder")}`);
|
|
67547
|
+
out.push(` ${import_picocolors43.default.cyan("push")} ${import_picocolors43.default.dim("push each member, then update the orchestration graph")}`);
|
|
67548
|
+
out.push(` ${import_picocolors43.default.cyan("add-agent")} ${import_picocolors43.default.dim("<name>")} ${import_picocolors43.default.dim("create a member agent, wire edges (--from/--to), and push")}`);
|
|
67549
|
+
out.push(` ${import_picocolors43.default.cyan("status")} ${import_picocolors43.default.dim("show what would push and what would pull")}`);
|
|
67550
|
+
out.push(` ${import_picocolors43.default.cyan("list")} ${import_picocolors43.default.dim("list orchestrations under a team")}`);
|
|
67465
67551
|
out.push("");
|
|
67466
|
-
out.push(` ${
|
|
67467
|
-
out.push(` ${
|
|
67468
|
-
out.push(` ${
|
|
67469
|
-
out.push(` ${
|
|
67470
|
-
out.push(` ${
|
|
67471
|
-
out.push(` ${
|
|
67552
|
+
out.push(` ${import_picocolors43.default.bold("Flags")}`);
|
|
67553
|
+
out.push(` ${import_picocolors43.default.dim("--yes, -y")} skip confirmations`);
|
|
67554
|
+
out.push(` ${import_picocolors43.default.dim("--harness <id>")} harness for newly-created member folders (default claude-code)`);
|
|
67555
|
+
out.push(` ${import_picocolors43.default.dim("--graph-only")} for push: only update members + edges, skip per-member push`);
|
|
67556
|
+
out.push(` ${import_picocolors43.default.dim("--org <id>")} for create/list: org id or slug (CLI vocab — DB teams.id)`);
|
|
67557
|
+
out.push(` ${import_picocolors43.default.dim("--team <id>")} for create/list: team id (CLI vocab — DB groups.id)`);
|
|
67472
67558
|
out.push("");
|
|
67473
67559
|
console.log(out.join(`
|
|
67474
67560
|
`));
|
|
@@ -67513,16 +67599,16 @@ async function runRun(cwd2, args) {
|
|
|
67513
67599
|
}
|
|
67514
67600
|
|
|
67515
67601
|
// src/cli/publish.ts
|
|
67516
|
-
var
|
|
67602
|
+
var import_picocolors44 = __toESM(require_picocolors(), 1);
|
|
67517
67603
|
async function runPublish(cwd2, _args) {
|
|
67518
67604
|
banner("publish — send your changes to the team");
|
|
67519
67605
|
const link2 = readLink(cwd2);
|
|
67520
67606
|
if (!link2) {
|
|
67521
67607
|
f2.warn("This folder is not linked to any agent.");
|
|
67522
|
-
f2.info(`Run ${
|
|
67608
|
+
f2.info(`Run ${import_picocolors44.default.cyan("brainbase link")} first.`);
|
|
67523
67609
|
return;
|
|
67524
67610
|
}
|
|
67525
|
-
f2.info(`${
|
|
67611
|
+
f2.info(`${import_picocolors44.default.bold("publish")} is coming soon — for now, edit the agent on the web app and run ${import_picocolors44.default.cyan("brainbase sync")} to bring changes here.`);
|
|
67526
67612
|
}
|
|
67527
67613
|
|
|
67528
67614
|
// src/ui/ink/StatusCard.tsx
|
|
@@ -67820,7 +67906,7 @@ async function runStatus(cwd2) {
|
|
|
67820
67906
|
}
|
|
67821
67907
|
|
|
67822
67908
|
// src/cli/token.ts
|
|
67823
|
-
var
|
|
67909
|
+
var import_picocolors45 = __toESM(require_picocolors(), 1);
|
|
67824
67910
|
|
|
67825
67911
|
// src/ui/ink/TokenCards.tsx
|
|
67826
67912
|
var jsx_dev_runtime17 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -68114,7 +68200,7 @@ async function runTokenRevoke(args) {
|
|
|
68114
68200
|
}
|
|
68115
68201
|
if (!autoProceed(args.yes)) {
|
|
68116
68202
|
const ok = await se({
|
|
68117
|
-
message: `Revoke token ${
|
|
68203
|
+
message: `Revoke token ${import_picocolors45.default.bold(args.id)}? CIs and machines using it will stop working.`,
|
|
68118
68204
|
initialValue: false
|
|
68119
68205
|
});
|
|
68120
68206
|
if (!ensureNotCancelled(ok))
|
|
@@ -68129,7 +68215,7 @@ async function runTokenRevoke(args) {
|
|
|
68129
68215
|
}
|
|
68130
68216
|
async function runTokenClear() {
|
|
68131
68217
|
if (!readToken()) {
|
|
68132
|
-
console.log(
|
|
68218
|
+
console.log(import_picocolors45.default.dim("No local token stored."));
|
|
68133
68219
|
return;
|
|
68134
68220
|
}
|
|
68135
68221
|
clearToken();
|
|
@@ -68180,24 +68266,24 @@ async function runToken(sub, rest2, args) {
|
|
|
68180
68266
|
function printTokenHelp() {
|
|
68181
68267
|
const out = [];
|
|
68182
68268
|
out.push("");
|
|
68183
|
-
out.push(` ${
|
|
68269
|
+
out.push(` ${import_picocolors45.default.bold("brainbase token")} ${import_picocolors45.default.dim("<command>")}`);
|
|
68184
68270
|
out.push("");
|
|
68185
|
-
out.push(` ${
|
|
68186
|
-
out.push(` ${
|
|
68187
|
-
out.push(` ${
|
|
68188
|
-
out.push(` ${
|
|
68271
|
+
out.push(` ${import_picocolors45.default.cyan("create")} ${import_picocolors45.default.dim("issue a new long-lived CLI key (PAT)")}`);
|
|
68272
|
+
out.push(` ${import_picocolors45.default.cyan("list")} ${import_picocolors45.default.dim("show your active tokens")}`);
|
|
68273
|
+
out.push(` ${import_picocolors45.default.cyan("revoke")} ${import_picocolors45.default.dim("<id>")} ${import_picocolors45.default.dim("revoke a token by id")}`);
|
|
68274
|
+
out.push(` ${import_picocolors45.default.cyan("clear")} ${import_picocolors45.default.dim("forget the local token (does not revoke)")}`);
|
|
68189
68275
|
out.push("");
|
|
68190
|
-
out.push(` ${
|
|
68191
|
-
out.push(` ${
|
|
68192
|
-
out.push(` ${
|
|
68193
|
-
out.push(` ${
|
|
68276
|
+
out.push(` ${import_picocolors45.default.bold("create flags")}`);
|
|
68277
|
+
out.push(` ${import_picocolors45.default.cyan("--name, -n")} ${import_picocolors45.default.dim("<label>")} ${import_picocolors45.default.dim("token label (prompted if omitted)")}`);
|
|
68278
|
+
out.push(` ${import_picocolors45.default.cyan("--scopes")} ${import_picocolors45.default.dim("<list>")} ${import_picocolors45.default.dim("comma-separated; allowed: read, publish, admin")}`);
|
|
68279
|
+
out.push(` ${import_picocolors45.default.dim("default: read,publish")}`);
|
|
68194
68280
|
out.push("");
|
|
68195
68281
|
console.log(out.join(`
|
|
68196
68282
|
`));
|
|
68197
68283
|
}
|
|
68198
68284
|
|
|
68199
68285
|
// src/cli/mcp.ts
|
|
68200
|
-
var
|
|
68286
|
+
var import_picocolors46 = __toESM(require_picocolors(), 1);
|
|
68201
68287
|
|
|
68202
68288
|
// src/core/mcp-check/collect-servers.ts
|
|
68203
68289
|
import path86 from "node:path";
|
|
@@ -76545,17 +76631,17 @@ async function runMcpCheck(cwd2, options) {
|
|
|
76545
76631
|
function renderHuman(report) {
|
|
76546
76632
|
const lines = [];
|
|
76547
76633
|
if (report.check_status === "skipped") {
|
|
76548
|
-
lines.push(
|
|
76634
|
+
lines.push(import_picocolors46.default.dim("No MCP servers configured — nothing to check."));
|
|
76549
76635
|
return lines.join(`
|
|
76550
76636
|
`) + `
|
|
76551
76637
|
`;
|
|
76552
76638
|
}
|
|
76553
76639
|
for (const s3 of report.servers) {
|
|
76554
|
-
const mark = s3.status === "ok" ?
|
|
76555
|
-
const detail = s3.status === "ok" ?
|
|
76640
|
+
const mark = s3.status === "ok" ? import_picocolors46.default.green("✓") : s3.status === "auth_failed" ? import_picocolors46.default.red("✗") : import_picocolors46.default.yellow("⚠");
|
|
76641
|
+
const detail = s3.status === "ok" ? import_picocolors46.default.dim(`${s3.tool_count} tool${s3.tool_count === 1 ? "" : "s"}`) : import_picocolors46.default.dim(s3.status + (s3.error ? ` — ${s3.error}` : ""));
|
|
76556
76642
|
lines.push(` ${mark} ${s3.name} ${detail}`);
|
|
76557
76643
|
}
|
|
76558
|
-
const summary = report.check_status === "ok" ?
|
|
76644
|
+
const summary = report.check_status === "ok" ? import_picocolors46.default.green("All MCP servers connected.") : import_picocolors46.default.yellow("Some MCP servers are unhealthy.");
|
|
76559
76645
|
lines.push("", summary);
|
|
76560
76646
|
return lines.join(`
|
|
76561
76647
|
`) + `
|
|
@@ -76578,7 +76664,7 @@ async function runMcp(cwd2, sub, _argv, options) {
|
|
|
76578
76664
|
}
|
|
76579
76665
|
|
|
76580
76666
|
// src/cli/task.ts
|
|
76581
|
-
var
|
|
76667
|
+
var import_picocolors47 = __toESM(require_picocolors(), 1);
|
|
76582
76668
|
|
|
76583
76669
|
// src/cli/task-create.ts
|
|
76584
76670
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -76742,7 +76828,7 @@ async function runTask(cwd2, sub, args) {
|
|
|
76742
76828
|
case "create": {
|
|
76743
76829
|
const parsed = parseCreateArgs(args);
|
|
76744
76830
|
if (parsed.help) {
|
|
76745
|
-
|
|
76831
|
+
printHelp4();
|
|
76746
76832
|
return;
|
|
76747
76833
|
}
|
|
76748
76834
|
await runTaskCreate(cwd2, parsed.options);
|
|
@@ -76752,30 +76838,30 @@ async function runTask(cwd2, sub, args) {
|
|
|
76752
76838
|
case "help":
|
|
76753
76839
|
case "-h":
|
|
76754
76840
|
case "--help":
|
|
76755
|
-
|
|
76841
|
+
printHelp4();
|
|
76756
76842
|
return;
|
|
76757
76843
|
default:
|
|
76758
76844
|
console.error(`Unknown task subcommand: ${sub}
|
|
76759
76845
|
`);
|
|
76760
|
-
|
|
76846
|
+
printHelp4();
|
|
76761
76847
|
process.exit(1);
|
|
76762
76848
|
}
|
|
76763
76849
|
}
|
|
76764
|
-
function
|
|
76850
|
+
function printHelp4() {
|
|
76765
76851
|
const out = [];
|
|
76766
76852
|
out.push("");
|
|
76767
|
-
out.push(` ${
|
|
76853
|
+
out.push(` ${import_picocolors47.default.bold("brainbase task")} ${import_picocolors47.default.dim("<sub> [options]")}`);
|
|
76768
76854
|
out.push("");
|
|
76769
|
-
out.push(` ${
|
|
76855
|
+
out.push(` ${import_picocolors47.default.cyan("create")} ${import_picocolors47.default.dim("--message <text>")} ${import_picocolors47.default.dim("create a task and start its first run")}`);
|
|
76770
76856
|
out.push("");
|
|
76771
|
-
out.push(` ${
|
|
76772
|
-
out.push(` ${
|
|
76773
|
-
out.push(` ${
|
|
76774
|
-
out.push(` ${
|
|
76775
|
-
out.push(` ${
|
|
76776
|
-
out.push(` ${
|
|
76857
|
+
out.push(` ${import_picocolors47.default.bold("create flags")}`);
|
|
76858
|
+
out.push(` ${import_picocolors47.default.dim("--message <text>")} required first user message`);
|
|
76859
|
+
out.push(` ${import_picocolors47.default.dim("--agent <id>")} override the claimed agent in brainbase.agent.yaml`);
|
|
76860
|
+
out.push(` ${import_picocolors47.default.dim("--title <text>")} optional task title`);
|
|
76861
|
+
out.push(` ${import_picocolors47.default.dim("--model <id>")} optional model override`);
|
|
76862
|
+
out.push(` ${import_picocolors47.default.dim("--json")} print task_id, agent_id, and status as JSON`);
|
|
76777
76863
|
out.push("");
|
|
76778
|
-
out.push(` ${
|
|
76864
|
+
out.push(` ${import_picocolors47.default.dim("Flag-like values:")} use ${import_picocolors47.default.cyan("--flag=value")} or ${import_picocolors47.default.cyan("--flag -- <value>")}`);
|
|
76779
76865
|
out.push("");
|
|
76780
76866
|
console.log(out.join(`
|
|
76781
76867
|
`));
|
|
@@ -76801,108 +76887,115 @@ var STORED_PAT_COMMANDS = new Set([
|
|
|
76801
76887
|
function help() {
|
|
76802
76888
|
const out = [];
|
|
76803
76889
|
out.push("");
|
|
76804
|
-
out.push(` ${brandTint("◆")} ${
|
|
76805
|
-
out.push(` ${
|
|
76890
|
+
out.push(` ${brandTint("◆")} ${import_picocolors48.default.bold("brainbase")} ${import_picocolors48.default.dim(`v${VERSION}`)}`);
|
|
76891
|
+
out.push(` ${import_picocolors48.default.dim("connect your local agent to the brainbase platform")}`);
|
|
76806
76892
|
out.push("");
|
|
76807
76893
|
out.push(divider("USAGE"));
|
|
76808
76894
|
out.push("");
|
|
76809
|
-
out.push(` ${
|
|
76895
|
+
out.push(` ${import_picocolors48.default.bold("brainbase")} ${import_picocolors48.default.dim("<command> [options]")}`);
|
|
76810
76896
|
out.push("");
|
|
76811
76897
|
out.push(divider("AUTH"));
|
|
76812
76898
|
out.push("");
|
|
76813
|
-
out.push(` ${
|
|
76814
|
-
out.push(` ${
|
|
76815
|
-
out.push(` ${
|
|
76899
|
+
out.push(` ${import_picocolors48.default.cyan("login")} ${import_picocolors48.default.dim(" open the web app and connect this device")}`);
|
|
76900
|
+
out.push(` ${import_picocolors48.default.cyan("logout")} ${import_picocolors48.default.dim(" clear the local session")}`);
|
|
76901
|
+
out.push(` ${import_picocolors48.default.cyan("whoami")} ${import_picocolors48.default.dim(" show the current user")}`);
|
|
76902
|
+
out.push("");
|
|
76903
|
+
out.push(divider("DISCOVERY"));
|
|
76904
|
+
out.push("");
|
|
76905
|
+
out.push(` ${import_picocolors48.default.cyan("team list")} ${import_picocolors48.default.dim("show the teams you can create agents in")}`);
|
|
76906
|
+
out.push(` ${import_picocolors48.default.cyan("agent list")} ${import_picocolors48.default.dim("show a team's agents and their ids")}`);
|
|
76816
76907
|
out.push("");
|
|
76817
76908
|
out.push(divider("LINKED AGENT"));
|
|
76818
76909
|
out.push("");
|
|
76819
|
-
out.push(` ${
|
|
76820
|
-
out.push(` ${
|
|
76821
|
-
out.push(` ${
|
|
76822
|
-
out.push(` ${
|
|
76823
|
-
out.push(` ${
|
|
76824
|
-
out.push(` ${
|
|
76825
|
-
out.push(` ${
|
|
76826
|
-
out.push(` ${
|
|
76827
|
-
out.push(` ${
|
|
76828
|
-
out.push(` ${
|
|
76910
|
+
out.push(` ${import_picocolors48.default.cyan("agent create")} ${import_picocolors48.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent")}`);
|
|
76911
|
+
out.push(` ${import_picocolors48.default.cyan("agent pull")} ${import_picocolors48.default.dim("[<id>]")} ${import_picocolors48.default.dim("bring cloud changes into this folder (--force to override; --run-entrypoint to also execute the agent entrypoint)")}`);
|
|
76912
|
+
out.push(` ${import_picocolors48.default.cyan("agent push")} ${import_picocolors48.default.dim("send local changes to the cloud (--force to overwrite cloud-side conflicts with local)")}`);
|
|
76913
|
+
out.push(` ${import_picocolors48.default.cyan("agent unpack")} ${import_picocolors48.default.dim("install the claimed agent into a harness layout")}`);
|
|
76914
|
+
out.push(` ${import_picocolors48.default.cyan("link")} ${import_picocolors48.default.dim("attach this folder to an existing agent")}`);
|
|
76915
|
+
out.push(` ${import_picocolors48.default.cyan("agent status")} ${import_picocolors48.default.dim("show what would pull and what would push")}`);
|
|
76916
|
+
out.push(` ${import_picocolors48.default.cyan("agent env")} ${import_picocolors48.default.dim("print export lines for `eval $(brainbase agent env)`")}`);
|
|
76917
|
+
out.push(` ${import_picocolors48.default.cyan("run")} ${import_picocolors48.default.dim("<cmd> [args...]")} ${import_picocolors48.default.dim("run <cmd> with secrets.env loaded into env")}`);
|
|
76918
|
+
out.push(` ${import_picocolors48.default.cyan("status")} ${import_picocolors48.default.dim("show what this folder is linked to")}`);
|
|
76919
|
+
out.push(` ${import_picocolors48.default.cyan("unlink")} ${import_picocolors48.default.dim("disconnect this folder")}`);
|
|
76829
76920
|
out.push("");
|
|
76830
76921
|
out.push(divider("TASKS"));
|
|
76831
76922
|
out.push("");
|
|
76832
|
-
out.push(` ${
|
|
76923
|
+
out.push(` ${import_picocolors48.default.cyan("task create")} ${import_picocolors48.default.dim("--message <text>")} ${import_picocolors48.default.dim("create a managed task and start its first run")}`);
|
|
76833
76924
|
out.push("");
|
|
76834
76925
|
out.push(divider("ORCHESTRATIONS"));
|
|
76835
76926
|
out.push("");
|
|
76836
|
-
out.push(` ${
|
|
76837
|
-
out.push(` ${
|
|
76838
|
-
out.push(` ${
|
|
76839
|
-
out.push(` ${
|
|
76840
|
-
out.push(` ${
|
|
76927
|
+
out.push(` ${import_picocolors48.default.cyan("orchestration create")} ${import_picocolors48.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
|
|
76928
|
+
out.push(` ${import_picocolors48.default.cyan("orchestration list")} ${import_picocolors48.default.dim("list orchestrations under a team")}`);
|
|
76929
|
+
out.push(` ${import_picocolors48.default.cyan("orchestration pull")} ${import_picocolors48.default.dim("<id>")} ${import_picocolors48.default.dim("recursively fetch an orchestration + every member agent")}`);
|
|
76930
|
+
out.push(` ${import_picocolors48.default.cyan("orchestration push")} ${import_picocolors48.default.dim("recursively push each member, then update the graph")}`);
|
|
76931
|
+
out.push(` ${import_picocolors48.default.cyan("orchestration status")} ${import_picocolors48.default.dim("show what would push and what would pull")}`);
|
|
76841
76932
|
out.push("");
|
|
76842
76933
|
out.push(divider("TEMPLATES"));
|
|
76843
76934
|
out.push("");
|
|
76844
|
-
out.push(` ${
|
|
76845
|
-
out.push(` ${
|
|
76846
|
-
out.push(` ${
|
|
76847
|
-
out.push(` ${
|
|
76848
|
-
out.push(` ${
|
|
76849
|
-
out.push(` ${
|
|
76850
|
-
out.push(` ${
|
|
76935
|
+
out.push(` ${import_picocolors48.default.cyan("template pack")} ${import_picocolors48.default.dim("bundle the current agent into a template")}`);
|
|
76936
|
+
out.push(` ${import_picocolors48.default.cyan("template publish")} ${import_picocolors48.default.dim("upload a template to the registry")}`);
|
|
76937
|
+
out.push(` ${import_picocolors48.default.cyan("template search")} ${import_picocolors48.default.dim("[query]")} ${import_picocolors48.default.dim("search the registry")}`);
|
|
76938
|
+
out.push(` ${import_picocolors48.default.cyan("template info")} ${import_picocolors48.default.dim("<creator/slug>")} ${import_picocolors48.default.dim("show registry details for a template")}`);
|
|
76939
|
+
out.push(` ${import_picocolors48.default.cyan("template onboard")} ${import_picocolors48.default.dim("<creator/slug>")} ${import_picocolors48.default.dim("install (or refresh) a template")}`);
|
|
76940
|
+
out.push(` ${import_picocolors48.default.cyan("template list")} ${import_picocolors48.default.dim("show installed templates")}`);
|
|
76941
|
+
out.push(` ${import_picocolors48.default.cyan("template remove")} ${import_picocolors48.default.dim("<creator/slug>")} ${import_picocolors48.default.dim("uninstall a template")}`);
|
|
76851
76942
|
out.push("");
|
|
76852
76943
|
out.push(divider("SKILLS"));
|
|
76853
76944
|
out.push("");
|
|
76854
|
-
out.push(` ${
|
|
76855
|
-
out.push(` ${
|
|
76856
|
-
out.push(` ${
|
|
76857
|
-
out.push(` ${
|
|
76858
|
-
out.push(` ${
|
|
76859
|
-
out.push(` ${
|
|
76860
|
-
out.push(` ${
|
|
76945
|
+
out.push(` ${import_picocolors48.default.cyan("skill add")} ${import_picocolors48.default.dim("<source>")} ${import_picocolors48.default.dim("install a skill (github / git / brainbase)")}`);
|
|
76946
|
+
out.push(` ${import_picocolors48.default.cyan("skill list")} ${import_picocolors48.default.dim("show locally installed skills + their source")}`);
|
|
76947
|
+
out.push(` ${import_picocolors48.default.cyan("skill update")} ${import_picocolors48.default.dim("<slug>")} ${import_picocolors48.default.dim("re-fetch a skill from its recorded source")}`);
|
|
76948
|
+
out.push(` ${import_picocolors48.default.cyan("skill remove")} ${import_picocolors48.default.dim("<slug>")} ${import_picocolors48.default.dim("uninstall a skill")}`);
|
|
76949
|
+
out.push(` ${import_picocolors48.default.cyan("skill search")} ${import_picocolors48.default.dim("[query]")} ${import_picocolors48.default.dim("search the brainbase skill registry")}`);
|
|
76950
|
+
out.push(` ${import_picocolors48.default.cyan("skill info")} ${import_picocolors48.default.dim("<creator/slug>")} ${import_picocolors48.default.dim("show registry details for a skill")}`);
|
|
76951
|
+
out.push(` ${import_picocolors48.default.cyan("skill publish")} ${import_picocolors48.default.dim("[dir]")} ${import_picocolors48.default.dim("publish a SKILL.md folder (defaults to .)")}`);
|
|
76861
76952
|
out.push("");
|
|
76862
76953
|
out.push(divider("CLI TOKENS"));
|
|
76863
76954
|
out.push("");
|
|
76864
|
-
out.push(` ${
|
|
76865
|
-
out.push(` ${
|
|
76866
|
-
out.push(` ${
|
|
76955
|
+
out.push(` ${import_picocolors48.default.cyan("token create")} ${import_picocolors48.default.dim("issue a long-lived CLI key for CI / scripts")}`);
|
|
76956
|
+
out.push(` ${import_picocolors48.default.cyan("token list")} ${import_picocolors48.default.dim("show your active tokens")}`);
|
|
76957
|
+
out.push(` ${import_picocolors48.default.cyan("token revoke")} ${import_picocolors48.default.dim("<id>")} ${import_picocolors48.default.dim("revoke a token")}`);
|
|
76867
76958
|
out.push("");
|
|
76868
76959
|
out.push(divider("MCP"));
|
|
76869
76960
|
out.push("");
|
|
76870
|
-
out.push(` ${
|
|
76961
|
+
out.push(` ${import_picocolors48.default.cyan("mcp check")} ${import_picocolors48.default.dim("[--json]")} ${import_picocolors48.default.dim("verify MCP server connectivity through the brainbase proxy (runs at sandbox bootstrap)")}`);
|
|
76871
76962
|
out.push("");
|
|
76872
76963
|
out.push(divider("FLAGS"));
|
|
76873
76964
|
out.push("");
|
|
76874
|
-
out.push(` ${
|
|
76875
|
-
out.push(` ${
|
|
76876
|
-
out.push(` ${
|
|
76877
|
-
out.push(` ${
|
|
76878
|
-
out.push(` ${
|
|
76879
|
-
out.push(` ${
|
|
76880
|
-
out.push(` ${
|
|
76881
|
-
out.push(` ${
|
|
76882
|
-
out.push(` ${
|
|
76883
|
-
out.push(` ${
|
|
76884
|
-
out.push(` ${
|
|
76885
|
-
out.push(` ${
|
|
76886
|
-
out.push(` ${
|
|
76965
|
+
out.push(` ${import_picocolors48.default.dim("--harness <id>")} force harness for onboard / sync (e.g. claude-code)`);
|
|
76966
|
+
out.push(` ${import_picocolors48.default.dim("--scope <s>")} force scope: global | project`);
|
|
76967
|
+
out.push(` ${import_picocolors48.default.dim("--yes, -y")} skip confirmations / auto-overwrite`);
|
|
76968
|
+
out.push(` ${import_picocolors48.default.dim("--agent <id>")} for link/task create: use this agent id explicitly`);
|
|
76969
|
+
out.push(` ${import_picocolors48.default.dim("--message <text>")} for task create: required first user message`);
|
|
76970
|
+
out.push(` ${import_picocolors48.default.dim("--title <text>")} for task create: optional task title`);
|
|
76971
|
+
out.push(` ${import_picocolors48.default.dim("--model <id>")} for task create: optional model override`);
|
|
76972
|
+
out.push(` ${import_picocolors48.default.dim("--org <id-or-slug>")} pick the organization (team/agent list, agent create, orchestration create/list)`);
|
|
76973
|
+
out.push(` ${import_picocolors48.default.dim("--team <id>")} pick the team, same commands (works without --org)`);
|
|
76974
|
+
out.push(` ${import_picocolors48.default.dim("--json")} for team/agent list, task create, mcp check: machine-readable output`);
|
|
76975
|
+
out.push(` ${import_picocolors48.default.dim("--no-tracking")} for link: skip routing LLM traffic through brainbase`);
|
|
76976
|
+
out.push(` ${import_picocolors48.default.dim("--track")} for agent create: enable tracking non-interactively (off without a TTY)`);
|
|
76977
|
+
out.push(` ${import_picocolors48.default.dim("--shell <sh|fish>")} for agent env: pick output format (auto-detected from $SHELL)`);
|
|
76978
|
+
out.push(` ${import_picocolors48.default.dim("--all")} for template list: include installs from other folders`);
|
|
76979
|
+
out.push(` ${import_picocolors48.default.dim("--web <url>")} for login: web app URL (default https://app.brainbaselabs.com)`);
|
|
76887
76980
|
out.push("");
|
|
76888
76981
|
out.push(divider("ENV"));
|
|
76889
76982
|
out.push("");
|
|
76890
|
-
out.push(` ${
|
|
76891
|
-
out.push(` ${
|
|
76892
|
-
out.push(` ${
|
|
76893
|
-
out.push(` ${
|
|
76894
|
-
out.push(` ${
|
|
76895
|
-
out.push(` ${
|
|
76896
|
-
out.push(` ${
|
|
76897
|
-
out.push(` ${
|
|
76898
|
-
out.push(` ${
|
|
76899
|
-
out.push(` ${
|
|
76983
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_HOME")} override the local config dir (default ~/.brainbase)`);
|
|
76984
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_WEB_URL")} override the web app URL used by login`);
|
|
76985
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_CONTROL_PLANE_URL")} override the MAS host (/v2/cli; task create uses /v2/tasks)`);
|
|
76986
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_API_URL")} legacy KLS host override (uses /api/cli; proxy/registry fallback)`);
|
|
76987
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_PROXY_URL")} override the model-proxy URL used by harness traffic (default https://api.v1.brainbaselabs.com)`);
|
|
76988
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_REGISTRY_URL")} override the registry API URL (default https://api.v1.brainbaselabs.com)`);
|
|
76989
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_TOKEN")} long-lived CLI PAT (overrides token.json)`);
|
|
76990
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_SKIP_AUTH")} bypass the auth gate for development`);
|
|
76991
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_NON_INTERACTIVE")} force non-interactive mode — skip/auto-default prompts (CI & agents)`);
|
|
76992
|
+
out.push(` ${import_picocolors48.default.dim("BRAINBASE_RUN_ENTRYPOINT")} =1 → agent pull executes the agent entrypoint (sandbox boots; or pass --run-entrypoint)`);
|
|
76900
76993
|
out.push("");
|
|
76901
76994
|
out.push(divider("HARNESSES"));
|
|
76902
76995
|
out.push("");
|
|
76903
|
-
out.push(` ${
|
|
76904
|
-
out.push(` ${
|
|
76905
|
-
out.push(` ${
|
|
76996
|
+
out.push(` ${import_picocolors48.default.dim("•")} ${import_picocolors48.default.bold("claude-code")} ${import_picocolors48.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
76997
|
+
out.push(` ${import_picocolors48.default.dim("•")} ${import_picocolors48.default.bold("codex")} ${import_picocolors48.default.dim("skills, mcps, commands, playbooks, instructions, files")}`);
|
|
76998
|
+
out.push(` ${import_picocolors48.default.dim("•")} ${import_picocolors48.default.bold("kafka")} ${import_picocolors48.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
76906
76999
|
out.push("");
|
|
76907
77000
|
console.log(out.join(`
|
|
76908
77001
|
`));
|
|
@@ -76966,13 +77059,13 @@ async function requireAuth(cmd) {
|
|
|
76966
77059
|
if (STORED_PAT_COMMANDS.has(cmd) && readToken())
|
|
76967
77060
|
return;
|
|
76968
77061
|
console.error("");
|
|
76969
|
-
console.error(` ${brandTint("◆")} ${
|
|
77062
|
+
console.error(` ${brandTint("◆")} ${import_picocolors48.default.bold("brainbase")}`);
|
|
76970
77063
|
console.error("");
|
|
76971
|
-
console.error(` ${
|
|
77064
|
+
console.error(` ${import_picocolors48.default.red("✗")} You need to sign in to use ${import_picocolors48.default.bold("brainbase " + cmd)}.`);
|
|
76972
77065
|
if (status.reason)
|
|
76973
|
-
console.error(` ${
|
|
77066
|
+
console.error(` ${import_picocolors48.default.dim(status.reason)}`);
|
|
76974
77067
|
console.error("");
|
|
76975
|
-
console.error(` Run ${
|
|
77068
|
+
console.error(` Run ${import_picocolors48.default.cyan("brainbase login")} to connect this device.`);
|
|
76976
77069
|
console.error("");
|
|
76977
77070
|
process14.exit(1);
|
|
76978
77071
|
}
|
|
@@ -77097,6 +77190,7 @@ async function main() {
|
|
|
77097
77190
|
const sub = argv.shift();
|
|
77098
77191
|
await runAgent(cwd2, sub, argv, {
|
|
77099
77192
|
yes,
|
|
77193
|
+
json: jsonFlag,
|
|
77100
77194
|
scope: scopeFlag,
|
|
77101
77195
|
shell: shellFlag,
|
|
77102
77196
|
harness,
|
|
@@ -77112,6 +77206,12 @@ async function main() {
|
|
|
77112
77206
|
});
|
|
77113
77207
|
break;
|
|
77114
77208
|
}
|
|
77209
|
+
case "team":
|
|
77210
|
+
case "teams": {
|
|
77211
|
+
const sub = argv.shift();
|
|
77212
|
+
await runTeam(sub, argv, { orgId: orgIdFlag, json: jsonFlag });
|
|
77213
|
+
break;
|
|
77214
|
+
}
|
|
77115
77215
|
case "task": {
|
|
77116
77216
|
const sub = argv.shift();
|
|
77117
77217
|
await runTask(cwd2, sub, argv);
|
|
@@ -77156,8 +77256,11 @@ async function main() {
|
|
|
77156
77256
|
process14.exit(1);
|
|
77157
77257
|
}
|
|
77158
77258
|
} catch (err) {
|
|
77159
|
-
console.error(
|
|
77259
|
+
console.error(import_picocolors48.default.red(`
|
|
77160
77260
|
${err.message}`));
|
|
77261
|
+
if (err instanceof ApiError && err.status === 401) {
|
|
77262
|
+
console.error(` Run ${import_picocolors48.default.cyan("brainbase login")} to connect this device.`);
|
|
77263
|
+
}
|
|
77161
77264
|
if (process14.env.BRAINBASE_DEBUG)
|
|
77162
77265
|
console.error(err.stack);
|
|
77163
77266
|
process14.exit(1);
|