@cabane/cli 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/dist/cli.js +8 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -864,6 +864,7 @@ async function resolveToken(opts, config) {
864
864
  }
865
865
  function persistInstall(config, version) {
866
866
  if (!config.visionSecret) config.visionSecret = randomBytes(32).toString("hex");
867
+ if (!config.credentialKey) config.credentialKey = randomBytes(32).toString("base64");
867
868
  if (config.currentVersion && config.currentVersion !== version) {
868
869
  config.previousVersion = config.currentVersion;
869
870
  }
@@ -1004,6 +1005,7 @@ function composeServerEnv(opts) {
1004
1005
  WEB_DIST: "web",
1005
1006
  PUBLIC_BASE_URL: opts.publicBaseUrl?.replace(/\/$/, "") || `http://localhost:${opts.port}`,
1006
1007
  VISION_URL_SIGNING_SECRET: opts.visionSecret,
1008
+ ...opts.credentialKey ? { CABANE_CREDENTIAL_KEY: opts.credentialKey } : {},
1007
1009
  // Runtime file-read overrides → the artifact's own data/ tree.
1008
1010
  CABANE_API_ROOT: join6(dataDir, "api"),
1009
1011
  CABANE_SKILLS_DIR: join6(dataDir, "skills"),
@@ -1131,6 +1133,7 @@ async function healthy2(port) {
1131
1133
  }
1132
1134
 
1133
1135
  // src/commands/up.ts
1136
+ import { randomBytes as randomBytes2 } from "crypto";
1134
1137
  import { spawn as spawn3 } from "child_process";
1135
1138
  import { existsSync as existsSync8, mkdirSync as mkdirSync4, openSync as openSync2, readFileSync as readFileSync6, rmSync as rmSync4, writeFileSync as writeFileSync3 } from "fs";
1136
1139
  import { join as join8 } from "path";
@@ -1287,6 +1290,10 @@ async function up(opts) {
1287
1290
  if (!config.visionSecret) {
1288
1291
  throw new Error("config has no vision secret \u2014 reinstall to generate one.");
1289
1292
  }
1293
+ if (!config.credentialKey) {
1294
+ config.credentialKey = randomBytes2(32).toString("base64");
1295
+ saveConfig(config);
1296
+ }
1290
1297
  if (await portInUse(config.port)) {
1291
1298
  throw new Error(
1292
1299
  `port ${config.port} is already in use. If cabane is running, use \`cabane down\`; otherwise a stale process is holding it \u2014 free it and retry.`
@@ -1360,6 +1367,7 @@ var Supervisor = class {
1360
1367
  databaseUrl: this.pg.databaseUrl,
1361
1368
  storageRoot: this.paths.storageRoot,
1362
1369
  visionSecret: config.visionSecret,
1370
+ ...config.credentialKey ? { credentialKey: config.credentialKey } : {},
1363
1371
  ...config.publicUrl ? { publicBaseUrl: config.publicUrl } : {},
1364
1372
  // Persisted `cabane set-env` creds (generic server env) are layered beneath
1365
1373
  // the composed infra vars.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "description": "The cabane CLI — install, run, and update a self-hosted Cabane on your own machine (server + embedded Postgres; agents run on a companion you pair).",
6
6
  "license": "UNLICENSED",