@brainbase-labs/cli 0.2.2 → 0.2.3
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 +26 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6974,12 +6974,25 @@ function ensureGitignore(cwd) {
|
|
|
6974
6974
|
|
|
6975
6975
|
// src/core/route-adapters.ts
|
|
6976
6976
|
import path37 from "node:path";
|
|
6977
|
+
import os7 from "node:os";
|
|
6977
6978
|
import fs34 from "node:fs";
|
|
6978
6979
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
6979
6980
|
var CLAUDE_ENV_KEYS = ["ANTHROPIC_BASE_URL", "ANTHROPIC_AUTH_TOKEN"];
|
|
6980
6981
|
function claudeSettingsPath(cwd) {
|
|
6981
6982
|
return path37.join(cwd, ".claude", "settings.json");
|
|
6982
6983
|
}
|
|
6984
|
+
function claudeUserConfigPath() {
|
|
6985
|
+
return path37.join(os7.homedir(), ".claude.json");
|
|
6986
|
+
}
|
|
6987
|
+
function ensureClaudeOnboarded() {
|
|
6988
|
+
const file = claudeUserConfigPath();
|
|
6989
|
+
const cfg = readJsonOr(file, {});
|
|
6990
|
+
if (cfg.hasCompletedOnboarding === true)
|
|
6991
|
+
return false;
|
|
6992
|
+
cfg.hasCompletedOnboarding = true;
|
|
6993
|
+
writeJson(file, cfg);
|
|
6994
|
+
return true;
|
|
6995
|
+
}
|
|
6983
6996
|
var claudeRouteAdapter = {
|
|
6984
6997
|
id: "claude-code",
|
|
6985
6998
|
async enable(cwd, target) {
|
|
@@ -6995,7 +7008,11 @@ var claudeRouteAdapter = {
|
|
|
6995
7008
|
settings.env.ANTHROPIC_AUTH_TOKEN = target.apiKey;
|
|
6996
7009
|
ensureDir(path37.dirname(file));
|
|
6997
7010
|
writeJson(file, settings);
|
|
6998
|
-
|
|
7011
|
+
const notes = [];
|
|
7012
|
+
if (ensureClaudeOnboarded()) {
|
|
7013
|
+
notes.push("Marked claude as onboarded in ~/.claude.json so it picks up the proxy on first run.");
|
|
7014
|
+
}
|
|
7015
|
+
return { data: snap, notes };
|
|
6999
7016
|
},
|
|
7000
7017
|
async disable(cwd, snapshot) {
|
|
7001
7018
|
const file = claudeSettingsPath(cwd);
|
|
@@ -7252,6 +7269,8 @@ async function attachToExistingAgent(cwd, agentId, args, existing) {
|
|
|
7252
7269
|
cfg.start(`Configuring ${harness}…`);
|
|
7253
7270
|
const snap = await adapter.enable(cwd, { apiBase: apiBase2, apiKey: keyPlain });
|
|
7254
7271
|
cfg.stop(`${harness} pointed at brainbase.`);
|
|
7272
|
+
for (const note3 of snap.notes ?? [])
|
|
7273
|
+
p13.log.info(note3);
|
|
7255
7274
|
tracking = {
|
|
7256
7275
|
harness,
|
|
7257
7276
|
key_id: keyId,
|
|
@@ -7394,7 +7413,7 @@ async function runUnlink(cwd, args) {
|
|
|
7394
7413
|
// src/cli/sync.ts
|
|
7395
7414
|
import path38 from "node:path";
|
|
7396
7415
|
import fs35 from "node:fs";
|
|
7397
|
-
import
|
|
7416
|
+
import os8 from "node:os";
|
|
7398
7417
|
import crypto3 from "node:crypto";
|
|
7399
7418
|
import * as p15 from "@clack/prompts";
|
|
7400
7419
|
import pc22 from "picocolors";
|
|
@@ -7666,7 +7685,7 @@ function computeLocalHash(paths) {
|
|
|
7666
7685
|
return h.digest("hex");
|
|
7667
7686
|
}
|
|
7668
7687
|
function stageManifest(components) {
|
|
7669
|
-
const root = fs35.mkdtempSync(path38.join(
|
|
7688
|
+
const root = fs35.mkdtempSync(path38.join(os8.tmpdir(), "brainbase-sync-"));
|
|
7670
7689
|
for (const c of components) {
|
|
7671
7690
|
const compDir = path38.join(root, c.type, c.slug);
|
|
7672
7691
|
ensureDir(compDir);
|
|
@@ -7692,7 +7711,7 @@ import pc28 from "picocolors";
|
|
|
7692
7711
|
// src/cli/agent-pull.ts
|
|
7693
7712
|
import path42 from "node:path";
|
|
7694
7713
|
import fs39 from "node:fs";
|
|
7695
|
-
import
|
|
7714
|
+
import os9 from "node:os";
|
|
7696
7715
|
import * as p16 from "@clack/prompts";
|
|
7697
7716
|
import pc23 from "picocolors";
|
|
7698
7717
|
|
|
@@ -8309,7 +8328,7 @@ async function runAgentPull(cwd, args) {
|
|
|
8309
8328
|
}
|
|
8310
8329
|
}
|
|
8311
8330
|
function stageManifestComponents(components) {
|
|
8312
|
-
const root = fs39.mkdtempSync(path42.join(
|
|
8331
|
+
const root = fs39.mkdtempSync(path42.join(os9.tmpdir(), "brainbase-pull-"));
|
|
8313
8332
|
for (const c of components) {
|
|
8314
8333
|
const compDir = path42.join(root, c.type, c.slug);
|
|
8315
8334
|
ensureDir(compDir);
|
|
@@ -9157,6 +9176,8 @@ async function runAgentCreate(cwd, args) {
|
|
|
9157
9176
|
apiKey: created.key
|
|
9158
9177
|
});
|
|
9159
9178
|
cfgSpinner.stop(`${harness} pointed at brainbase.`);
|
|
9179
|
+
for (const note4 of snap.notes ?? [])
|
|
9180
|
+
p19.log.info(note4);
|
|
9160
9181
|
tracking = {
|
|
9161
9182
|
harness,
|
|
9162
9183
|
key_id: created.id,
|