@brainbase-labs/cli 0.16.0-rc.1 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +40 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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.16.
|
|
36011
|
+
version: "0.16.1",
|
|
36012
36012
|
description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
|
|
36013
36013
|
type: "module",
|
|
36014
36014
|
bin: {
|
|
@@ -40883,6 +40883,7 @@ var AuthSessionSchema = exports_external.object({
|
|
|
40883
40883
|
user_id: exports_external.string(),
|
|
40884
40884
|
email: exports_external.string().optional(),
|
|
40885
40885
|
server: exports_external.string().optional(),
|
|
40886
|
+
control_plane_url: exports_external.string().optional(),
|
|
40886
40887
|
supabase_url: exports_external.string().optional(),
|
|
40887
40888
|
supabase_anon_key: exports_external.string().optional(),
|
|
40888
40889
|
authedAt: exports_external.string()
|
|
@@ -47245,6 +47246,7 @@ var HARNESS_ALIASES = {
|
|
|
47245
47246
|
"claude-code-cloud": "claude-code",
|
|
47246
47247
|
codex_cloud: "codex",
|
|
47247
47248
|
"codex-cloud": "codex",
|
|
47249
|
+
qwen: "qwen-code",
|
|
47248
47250
|
qwen_acp: "qwen-code",
|
|
47249
47251
|
"qwen-acp": "qwen-code",
|
|
47250
47252
|
qwen_cloud: "qwen-code",
|
|
@@ -53363,19 +53365,27 @@ class ApiError extends Error {
|
|
|
53363
53365
|
this.name = "ApiError";
|
|
53364
53366
|
}
|
|
53365
53367
|
}
|
|
53366
|
-
function
|
|
53367
|
-
const
|
|
53368
|
+
function normalizeControlPlaneUrl(url) {
|
|
53369
|
+
const normalized = url?.trim().replace(/\/+$/, "");
|
|
53370
|
+
return normalized || DEFAULT_CONTROL_PLANE_BASE;
|
|
53371
|
+
}
|
|
53372
|
+
function controlPlaneBaseUrl(session) {
|
|
53373
|
+
const controlPlane = process.env.BRAINBASE_CONTROL_PLANE_URL?.trim();
|
|
53368
53374
|
if (controlPlane) {
|
|
53369
|
-
return
|
|
53375
|
+
return normalizeControlPlaneUrl(controlPlane);
|
|
53370
53376
|
}
|
|
53371
|
-
const legacyApi = process.env.BRAINBASE_API_URL;
|
|
53377
|
+
const legacyApi = process.env.BRAINBASE_API_URL?.trim();
|
|
53372
53378
|
if (legacyApi) {
|
|
53373
|
-
return
|
|
53379
|
+
return legacyApi.replace(/\/+$/, "");
|
|
53374
53380
|
}
|
|
53375
|
-
return
|
|
53381
|
+
return normalizeControlPlaneUrl(session?.control_plane_url);
|
|
53382
|
+
}
|
|
53383
|
+
function apiBase(session) {
|
|
53384
|
+
const suffix = usesLegacyControlPlane() ? "/api/cli" : "/v2/cli";
|
|
53385
|
+
return `${controlPlaneBaseUrl(session)}${suffix}`;
|
|
53376
53386
|
}
|
|
53377
53387
|
function usesLegacyControlPlane() {
|
|
53378
|
-
return !process.env.BRAINBASE_CONTROL_PLANE_URL && !!process.env.BRAINBASE_API_URL;
|
|
53388
|
+
return !process.env.BRAINBASE_CONTROL_PLANE_URL?.trim() && !!process.env.BRAINBASE_API_URL?.trim();
|
|
53379
53389
|
}
|
|
53380
53390
|
function legacyScheduleError() {
|
|
53381
53391
|
return new ApiError("Schedule-trigger writes require the MAS control plane. Set BRAINBASE_CONTROL_PLANE_URL or unset the legacy BRAINBASE_API_URL override.", 400);
|
|
@@ -53393,7 +53403,7 @@ function requireSession() {
|
|
|
53393
53403
|
function resolveCredential() {
|
|
53394
53404
|
const envToken = process.env.BRAINBASE_TOKEN;
|
|
53395
53405
|
if (envToken && envToken.trim()) {
|
|
53396
|
-
return { bearer: envToken.trim(), session:
|
|
53406
|
+
return { bearer: envToken.trim(), session: null };
|
|
53397
53407
|
}
|
|
53398
53408
|
const session = requireSession();
|
|
53399
53409
|
return { bearer: session.access_token, session };
|
|
@@ -60434,24 +60444,24 @@ function WelcomeCard(props) {
|
|
|
60434
60444
|
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
60435
60445
|
flexDirection: "column",
|
|
60436
60446
|
children: [
|
|
60437
|
-
props.
|
|
60447
|
+
props.controlPlaneUrl && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
60438
60448
|
children: [
|
|
60439
60449
|
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
60440
|
-
width:
|
|
60450
|
+
width: 15,
|
|
60441
60451
|
children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Text, {
|
|
60442
60452
|
dimColor: true,
|
|
60443
|
-
children: "
|
|
60453
|
+
children: "control plane"
|
|
60444
60454
|
}, undefined, false, undefined, this)
|
|
60445
60455
|
}, undefined, false, undefined, this),
|
|
60446
60456
|
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Text, {
|
|
60447
|
-
children: props.
|
|
60457
|
+
children: props.controlPlaneUrl
|
|
60448
60458
|
}, undefined, false, undefined, this)
|
|
60449
60459
|
]
|
|
60450
60460
|
}, undefined, true, undefined, this),
|
|
60451
60461
|
expiresText && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
60452
60462
|
children: [
|
|
60453
60463
|
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Box_default, {
|
|
60454
|
-
width:
|
|
60464
|
+
width: 15,
|
|
60455
60465
|
children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(Text, {
|
|
60456
60466
|
dimColor: true,
|
|
60457
60467
|
children: "expires"
|
|
@@ -60484,8 +60494,12 @@ async function showWelcomeCard(props) {
|
|
|
60484
60494
|
}
|
|
60485
60495
|
|
|
60486
60496
|
// src/cli/login.ts
|
|
60487
|
-
var DEFAULT_WEB_URL = "https://
|
|
60497
|
+
var DEFAULT_WEB_URL = "https://app.brainbaselabs.com";
|
|
60488
60498
|
var LOGIN_TIMEOUT_MS = 5 * 60 * 1000;
|
|
60499
|
+
function resolveLoginWebBase(web, envWeb = process.env.BRAINBASE_WEB_URL) {
|
|
60500
|
+
const override = web?.trim() || envWeb?.trim() || DEFAULT_WEB_URL;
|
|
60501
|
+
return override.replace(/\/+$/, "");
|
|
60502
|
+
}
|
|
60489
60503
|
function openInBrowser(url) {
|
|
60490
60504
|
const platform2 = process.platform;
|
|
60491
60505
|
const cmd = platform2 === "darwin" ? "open" : platform2 === "win32" ? "cmd" : "xdg-open";
|
|
@@ -60519,7 +60533,7 @@ async function readBody(req) {
|
|
|
60519
60533
|
}
|
|
60520
60534
|
async function runLogin(_cwd, args) {
|
|
60521
60535
|
banner("login — connect this device to brainbase");
|
|
60522
|
-
const webBase = (args.web
|
|
60536
|
+
const webBase = resolveLoginWebBase(args.web);
|
|
60523
60537
|
const expectedState = randomBytes(16).toString("hex");
|
|
60524
60538
|
const port = await getFreePort();
|
|
60525
60539
|
const callback = `http://127.0.0.1:${port}/cb`;
|
|
@@ -60568,6 +60582,7 @@ async function runLogin(_cwd, args) {
|
|
|
60568
60582
|
user_id: payload.user_id,
|
|
60569
60583
|
email: payload.email,
|
|
60570
60584
|
server: payload.server,
|
|
60585
|
+
control_plane_url: normalizeControlPlaneUrl(payload.control_plane_url),
|
|
60571
60586
|
supabase_url: payload.supabase_url,
|
|
60572
60587
|
supabase_anon_key: payload.supabase_anon_key,
|
|
60573
60588
|
authedAt: new Date().toISOString()
|
|
@@ -60609,7 +60624,7 @@ async function runLogin(_cwd, args) {
|
|
|
60609
60624
|
if (session) {
|
|
60610
60625
|
await showWelcomeCard({
|
|
60611
60626
|
email: session.email ?? session.user_id,
|
|
60612
|
-
|
|
60627
|
+
controlPlaneUrl: controlPlaneBaseUrl(session),
|
|
60613
60628
|
expiresAt: session.expires_at,
|
|
60614
60629
|
hint: "brainbase template pack — bundle your first agent"
|
|
60615
60630
|
});
|
|
@@ -60630,7 +60645,7 @@ function IdentityCard(props) {
|
|
|
60630
60645
|
tone: props.tone ?? "info",
|
|
60631
60646
|
children: [
|
|
60632
60647
|
props.email && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
60633
|
-
marginBottom: props.
|
|
60648
|
+
marginBottom: props.controlPlaneUrl || props.expiresAt ? 1 : 0,
|
|
60634
60649
|
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
60635
60650
|
bold: true,
|
|
60636
60651
|
children: props.email
|
|
@@ -60639,24 +60654,24 @@ function IdentityCard(props) {
|
|
|
60639
60654
|
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
60640
60655
|
flexDirection: "column",
|
|
60641
60656
|
children: [
|
|
60642
|
-
props.
|
|
60657
|
+
props.controlPlaneUrl && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
60643
60658
|
children: [
|
|
60644
60659
|
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
60645
|
-
width:
|
|
60660
|
+
width: 15,
|
|
60646
60661
|
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
60647
60662
|
dimColor: true,
|
|
60648
|
-
children: "
|
|
60663
|
+
children: "control plane"
|
|
60649
60664
|
}, undefined, false, undefined, this)
|
|
60650
60665
|
}, undefined, false, undefined, this),
|
|
60651
60666
|
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
60652
|
-
children: props.
|
|
60667
|
+
children: props.controlPlaneUrl
|
|
60653
60668
|
}, undefined, false, undefined, this)
|
|
60654
60669
|
]
|
|
60655
60670
|
}, undefined, true, undefined, this),
|
|
60656
60671
|
props.expiresAt && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
60657
60672
|
children: [
|
|
60658
60673
|
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Box_default, {
|
|
60659
|
-
width:
|
|
60674
|
+
width: 15,
|
|
60660
60675
|
children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
60661
60676
|
dimColor: true,
|
|
60662
60677
|
children: "expires"
|
|
@@ -60720,7 +60735,7 @@ async function runWhoami() {
|
|
|
60720
60735
|
title: "WHOAMI",
|
|
60721
60736
|
tone: "ok",
|
|
60722
60737
|
email: session.email ?? session.user_id,
|
|
60723
|
-
|
|
60738
|
+
controlPlaneUrl: controlPlaneBaseUrl(session),
|
|
60724
60739
|
expiresAt: session.expires_at
|
|
60725
60740
|
});
|
|
60726
60741
|
}
|
|
@@ -75873,7 +75888,7 @@ function help() {
|
|
|
75873
75888
|
out.push(` ${import_picocolors43.default.dim("--track")} for agent create: enable tracking non-interactively (off without a TTY)`);
|
|
75874
75889
|
out.push(` ${import_picocolors43.default.dim("--shell <sh|fish>")} for agent env: pick output format (auto-detected from $SHELL)`);
|
|
75875
75890
|
out.push(` ${import_picocolors43.default.dim("--all")} for template list: include installs from other folders`);
|
|
75876
|
-
out.push(` ${import_picocolors43.default.dim("--web <url>")} for login: web app URL (default https://
|
|
75891
|
+
out.push(` ${import_picocolors43.default.dim("--web <url>")} for login: web app URL (default https://app.brainbaselabs.com)`);
|
|
75877
75892
|
out.push("");
|
|
75878
75893
|
out.push(divider("ENV"));
|
|
75879
75894
|
out.push("");
|