bitfab-cli 0.2.25 → 0.2.27

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/index.js +60 -62
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3222,8 +3222,8 @@ var require_utils = __commonJS({
3222
3222
  }
3223
3223
  return ind;
3224
3224
  }
3225
- function removeDotSegments(path14) {
3226
- let input = path14;
3225
+ function removeDotSegments(path15) {
3226
+ let input = path15;
3227
3227
  const output = [];
3228
3228
  let nextSlash = -1;
3229
3229
  let len = 0;
@@ -3422,8 +3422,8 @@ var require_schemes = __commonJS({
3422
3422
  wsComponent.secure = void 0;
3423
3423
  }
3424
3424
  if (wsComponent.resourceName) {
3425
- const [path14, query] = wsComponent.resourceName.split("?");
3426
- wsComponent.path = path14 && path14 !== "/" ? path14 : void 0;
3425
+ const [path15, query] = wsComponent.resourceName.split("?");
3426
+ wsComponent.path = path15 && path15 !== "/" ? path15 : void 0;
3427
3427
  wsComponent.query = query;
3428
3428
  wsComponent.resourceName = void 0;
3429
3429
  }
@@ -6971,18 +6971,18 @@ async function pollLoginEvents(opts) {
6971
6971
  }
6972
6972
  throw new Error("Login polling aborted");
6973
6973
  }
6974
- async function navigateStudio(client, path14) {
6975
- if (!isValidStudioRoute(path14)) {
6976
- throw new Error(`Studio route not allowed: ${path14}`);
6974
+ async function navigateStudio(client, path15) {
6975
+ if (!isValidStudioRoute(path15)) {
6976
+ throw new Error(`Studio route not allowed: ${path15}`);
6977
6977
  }
6978
6978
  return pushAgentSessionEvent(client, {
6979
6979
  type: "agent:navigate",
6980
- data: { path: path14 }
6980
+ data: { path: path15 }
6981
6981
  });
6982
6982
  }
6983
6983
  var STUDIO_NAVIGATE_ACK_TIMEOUT_MS = 12e3;
6984
6984
  var PING_PONG_TIMEOUT_MS = 5e3;
6985
- function awaitNavigateAck(client, path14, ackTimeoutMs) {
6985
+ function awaitNavigateAck(client, path15, ackTimeoutMs) {
6986
6986
  const abortController = new AbortController();
6987
6987
  let timer = null;
6988
6988
  const result = new Promise((resolve) => {
@@ -6990,7 +6990,7 @@ function awaitNavigateAck(client, path14, ackTimeoutMs) {
6990
6990
  resolve({ acked: false, reason: "timeout" });
6991
6991
  abortController.abort();
6992
6992
  }, ackTimeoutMs);
6993
- const pathOnly = path14.split("?")[0];
6993
+ const pathOnly = path15.split("?")[0];
6994
6994
  pollAgentSessionEvents({
6995
6995
  serviceUrl: client.serviceUrl,
6996
6996
  apiKey: client.apiKey,
@@ -7070,17 +7070,17 @@ function awaitPong(client, pingTs) {
7070
7070
  });
7071
7071
  });
7072
7072
  }
7073
- async function navigateStudioAndAwaitAck(client, path14, opts = {}) {
7073
+ async function navigateStudioAndAwaitAck(client, path15, opts = {}) {
7074
7074
  const ackTimeoutMs = opts.ackTimeoutMs ?? STUDIO_NAVIGATE_ACK_TIMEOUT_MS;
7075
- if (!isValidStudioRoute(path14)) {
7075
+ if (!isValidStudioRoute(path15)) {
7076
7076
  return { acked: false, reason: "invalid-route" };
7077
7077
  }
7078
7078
  try {
7079
- await navigateStudio(client, path14);
7079
+ await navigateStudio(client, path15);
7080
7080
  } catch {
7081
7081
  return { acked: false, reason: "push-failed" };
7082
7082
  }
7083
- const result = await awaitNavigateAck(client, path14, ackTimeoutMs);
7083
+ const result = await awaitNavigateAck(client, path15, ackTimeoutMs);
7084
7084
  if (result.acked || result.reason !== "timeout") {
7085
7085
  return result;
7086
7086
  }
@@ -7868,8 +7868,7 @@ function recordFocus() {
7868
7868
  return () => focusApp(frontmost);
7869
7869
  }
7870
7870
 
7871
- // ../bitfab-plugin-lib/dist/commands/loginForSession.js
7872
- var LOGIN_TIMEOUT_MS = 10 * 60 * 1e3;
7871
+ // ../bitfab-plugin-lib/dist/commands/sessionReady.js
7873
7872
  var SESSION_READY_TIMEOUT_MS = 3e4;
7874
7873
  var SESSION_READY_POLL_MS = 500;
7875
7874
  async function waitForSessionReady(opts) {
@@ -7903,7 +7902,7 @@ async function waitForSessionReady(opts) {
7903
7902
 
7904
7903
  // ../bitfab-plugin-lib/dist/commands/openStudioTo.js
7905
7904
  var SESSION_CLOSE_GRACE_PERIOD_MS = 1e4;
7906
- var LOGIN_TIMEOUT_MS2 = 10 * 60 * 1e3;
7905
+ var LOGIN_TIMEOUT_MS = 10 * 60 * 1e3;
7907
7906
  var StudioNavigationError = class extends Error {
7908
7907
  reason;
7909
7908
  blockedReason;
@@ -7916,18 +7915,20 @@ var StudioNavigationError = class extends Error {
7916
7915
  this.name = "StudioNavigationError";
7917
7916
  }
7918
7917
  };
7919
- async function openStudioTo(path14, opts) {
7918
+ async function openStudioTo(path15, opts) {
7920
7919
  const sessionId = opts.sessionId ?? crypto4.randomUUID();
7921
7920
  const noop = () => {
7922
7921
  };
7923
7922
  const restoreFocus = recordFocus();
7924
7923
  if (!opts.apiKey) {
7925
- const targetWithSession = `${path14}${path14.includes("?") ? "&" : "?"}session=${encodeURIComponent(sessionId)}`;
7926
- const signInUrl = `${opts.serviceUrl}/studio/sign-in?redirect_url=${encodeURIComponent(targetWithSession)}`;
7924
+ const separator = path15.includes("?") ? "&" : "?";
7925
+ const redirectPath = `${path15}${separator}session=${encodeURIComponent(sessionId)}&pluginLogin=true`;
7926
+ const signInPath = `/studio/sign-in?redirect_url=${encodeURIComponent(redirectPath)}`;
7927
+ const signInUrl = `${opts.serviceUrl}${signInPath}&session=${encodeURIComponent(sessionId)}`;
7927
7928
  openChromelessWindow(signInUrl);
7928
7929
  opts.onLoginRequired?.(sessionId, signInUrl);
7929
7930
  const abortController = new AbortController();
7930
- const timer = setTimeout(() => abortController.abort(), LOGIN_TIMEOUT_MS2);
7931
+ const timer = setTimeout(() => abortController.abort(), LOGIN_TIMEOUT_MS);
7931
7932
  const keepalive = setInterval(() => process.stderr.write(""), 3e4);
7932
7933
  let apiKey;
7933
7934
  try {
@@ -7956,6 +7957,7 @@ async function openStudioTo(path14, opts) {
7956
7957
  return {
7957
7958
  sessionId,
7958
7959
  serviceUrl: opts.serviceUrl,
7960
+ apiKey,
7959
7961
  opened: true,
7960
7962
  ...poller2
7961
7963
  };
@@ -7964,6 +7966,7 @@ async function openStudioTo(path14, opts) {
7964
7966
  return {
7965
7967
  sessionId,
7966
7968
  serviceUrl: opts.serviceUrl,
7969
+ apiKey,
7967
7970
  opened: true,
7968
7971
  abort: noop,
7969
7972
  done: Promise.resolve()
@@ -7978,7 +7981,7 @@ async function openStudioTo(path14, opts) {
7978
7981
  apiKey: opts.apiKey,
7979
7982
  sessionId: existing.sessionId
7980
7983
  };
7981
- const ack = await navigateStudioAndAwaitAck(client, path14);
7984
+ const ack = await navigateStudioAndAwaitAck(client, path15);
7982
7985
  if (ack.acked) {
7983
7986
  if (existing.endedAt != null || existing.closedAt != null) {
7984
7987
  reactivateActiveStudioSession(existing.sessionId);
@@ -7987,6 +7990,7 @@ async function openStudioTo(path14, opts) {
7987
7990
  return {
7988
7991
  sessionId: existing.sessionId,
7989
7992
  serviceUrl: existing.serviceUrl,
7993
+ apiKey: opts.apiKey,
7990
7994
  opened: false,
7991
7995
  ...poller2
7992
7996
  };
@@ -8001,13 +8005,14 @@ async function openStudioTo(path14, opts) {
8001
8005
  serviceUrl: opts.serviceUrl,
8002
8006
  apiKey: opts.apiKey,
8003
8007
  sessionId,
8004
- initialPath: path14,
8008
+ initialPath: path15,
8005
8009
  clientHeaders: opts.clientHeaders
8006
8010
  });
8007
8011
  const poller = opts.onEvent ? startEventPoller(session.serviceUrl, opts.apiKey, session.sessionId, opts.onEvent, restoreFocus) : { abort: noop, done: Promise.resolve() };
8008
8012
  return {
8009
8013
  sessionId: session.sessionId,
8010
8014
  serviceUrl: session.serviceUrl,
8015
+ apiKey: opts.apiKey,
8011
8016
  opened: true,
8012
8017
  ...poller
8013
8018
  };
@@ -8093,7 +8098,7 @@ async function runLogin(platform2, pluginVersion, options) {
8093
8098
  const exitOnComplete = options?.exitOnComplete ?? true;
8094
8099
  const config2 = getConfig();
8095
8100
  console.log("\nOpening Studio to sign in...");
8096
- const closePath = `/studio/close?pluginLogin=true&autoClose=true&message=${encodeURIComponent("Login complete")}`;
8101
+ const closePath = `/studio/close?autoClose=true&message=${encodeURIComponent("Login complete")}`;
8097
8102
  try {
8098
8103
  const result = await openStudioTo(closePath, {
8099
8104
  serviceUrl: config2.serviceUrl,
@@ -8142,11 +8147,7 @@ function runLogout() {
8142
8147
  console.log("Logged out of Bitfab.");
8143
8148
  }
8144
8149
 
8145
- // ../bitfab-plugin-lib/dist/commands/openExperiments.js
8146
- import crypto5 from "crypto";
8147
-
8148
8150
  // ../bitfab-plugin-lib/dist/commands/openTracePlan.js
8149
- import crypto6 from "crypto";
8150
8151
  var OPEN_TRACE_PLAN_TIMEOUT_MS = 30 * 60 * 1e3;
8151
8152
 
8152
8153
  // ../bitfab-plugin-lib/dist/commands/persistReplayLabels.js
@@ -8919,10 +8920,10 @@ function mergeDefs(...defs) {
8919
8920
  function cloneDef(schema) {
8920
8921
  return mergeDefs(schema._zod.def);
8921
8922
  }
8922
- function getElementAtPath(obj, path14) {
8923
- if (!path14)
8923
+ function getElementAtPath(obj, path15) {
8924
+ if (!path15)
8924
8925
  return obj;
8925
- return path14.reduce((acc, key) => acc?.[key], obj);
8926
+ return path15.reduce((acc, key) => acc?.[key], obj);
8926
8927
  }
8927
8928
  function promiseAllObject(promisesObj) {
8928
8929
  const keys = Object.keys(promisesObj);
@@ -9305,11 +9306,11 @@ function aborted(x, startIndex = 0) {
9305
9306
  }
9306
9307
  return false;
9307
9308
  }
9308
- function prefixIssues(path14, issues) {
9309
+ function prefixIssues(path15, issues) {
9309
9310
  return issues.map((iss) => {
9310
9311
  var _a2;
9311
9312
  (_a2 = iss).path ?? (_a2.path = []);
9312
- iss.path.unshift(path14);
9313
+ iss.path.unshift(path15);
9313
9314
  return iss;
9314
9315
  });
9315
9316
  }
@@ -9492,7 +9493,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
9492
9493
  }
9493
9494
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
9494
9495
  const result = { errors: [] };
9495
- const processError = (error49, path14 = []) => {
9496
+ const processError = (error49, path15 = []) => {
9496
9497
  var _a2, _b;
9497
9498
  for (const issue2 of error49.issues) {
9498
9499
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -9502,7 +9503,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
9502
9503
  } else if (issue2.code === "invalid_element") {
9503
9504
  processError({ issues: issue2.issues }, issue2.path);
9504
9505
  } else {
9505
- const fullpath = [...path14, ...issue2.path];
9506
+ const fullpath = [...path15, ...issue2.path];
9506
9507
  if (fullpath.length === 0) {
9507
9508
  result.errors.push(mapper(issue2));
9508
9509
  continue;
@@ -9534,8 +9535,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
9534
9535
  }
9535
9536
  function toDotPath(_path) {
9536
9537
  const segs = [];
9537
- const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
9538
- for (const seg of path14) {
9538
+ const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
9539
+ for (const seg of path15) {
9539
9540
  if (typeof seg === "number")
9540
9541
  segs.push(`[${seg}]`);
9541
9542
  else if (typeof seg === "symbol")
@@ -21512,13 +21513,13 @@ function resolveRef(ref, ctx) {
21512
21513
  if (!ref.startsWith("#")) {
21513
21514
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
21514
21515
  }
21515
- const path14 = ref.slice(1).split("/").filter(Boolean);
21516
- if (path14.length === 0) {
21516
+ const path15 = ref.slice(1).split("/").filter(Boolean);
21517
+ if (path15.length === 0) {
21517
21518
  return ctx.rootSchema;
21518
21519
  }
21519
21520
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
21520
- if (path14[0] === defsKey) {
21521
- const key = path14[1];
21521
+ if (path15[0] === defsKey) {
21522
+ const key = path15[1];
21522
21523
  if (!key || !ctx.defs[key]) {
21523
21524
  throw new Error(`Reference not found: ${ref}`);
21524
21525
  }
@@ -21946,18 +21947,15 @@ var inputFileSchema = external_exports.object({
21946
21947
  verdicts: external_exports.array(external_exports.unknown()).min(1)
21947
21948
  });
21948
21949
 
21949
- // ../bitfab-plugin-lib/dist/commands/startDataset.js
21950
- import crypto7 from "crypto";
21951
-
21952
- // ../bitfab-plugin-lib/dist/commands/startTemplatePreview.js
21953
- import crypto8 from "crypto";
21954
-
21955
21950
  // ../bitfab-plugin-lib/dist/activePreviewSession.js
21956
21951
  import fs8 from "fs";
21957
21952
  import os9 from "os";
21958
21953
  import path6 from "path";
21959
21954
  var FILE_PATH = path6.join(os9.homedir(), ".config", "bitfab", "active-preview-session.json");
21960
21955
 
21956
+ // ../bitfab-plugin-lib/dist/commands/status.js
21957
+ import path8 from "path";
21958
+
21961
21959
  // ../bitfab-plugin-lib/dist/updates.js
21962
21960
  import fs9 from "fs";
21963
21961
  import os10 from "os";
@@ -21968,11 +21966,11 @@ import { execSync as execSync2 } from "child_process";
21968
21966
 
21969
21967
  // ../bitfab-plugin-lib/dist/installedSdk.js
21970
21968
  import fs11 from "fs";
21971
- import path9 from "path";
21969
+ import path10 from "path";
21972
21970
 
21973
21971
  // ../bitfab-plugin-lib/dist/workspaces.js
21974
21972
  import fs10 from "fs";
21975
- import path8 from "path";
21973
+ import path9 from "path";
21976
21974
 
21977
21975
  // ../bitfab-plugin-lib/dist/commands/waitForTrace.js
21978
21976
  var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
@@ -21986,7 +21984,7 @@ import fs13 from "fs";
21986
21984
  // ../bitfab-plugin-lib/dist/installScope.js
21987
21985
  import fs14 from "fs";
21988
21986
  import os11 from "os";
21989
- import path10 from "path";
21987
+ import path11 from "path";
21990
21988
 
21991
21989
  // ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.js
21992
21990
  var util;
@@ -22347,8 +22345,8 @@ function getErrorMap2() {
22347
22345
 
22348
22346
  // ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.js
22349
22347
  var makeIssue = (params) => {
22350
- const { data, path: path14, errorMaps, issueData } = params;
22351
- const fullPath = [...path14, ...issueData.path || []];
22348
+ const { data, path: path15, errorMaps, issueData } = params;
22349
+ const fullPath = [...path15, ...issueData.path || []];
22352
22350
  const fullIssue = {
22353
22351
  ...issueData,
22354
22352
  path: fullPath
@@ -22463,11 +22461,11 @@ var errorUtil;
22463
22461
 
22464
22462
  // ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/types.js
22465
22463
  var ParseInputLazyPath = class {
22466
- constructor(parent, value, path14, key) {
22464
+ constructor(parent, value, path15, key) {
22467
22465
  this._cachedPath = [];
22468
22466
  this.parent = parent;
22469
22467
  this.data = value;
22470
- this._path = path14;
22468
+ this._path = path15;
22471
22469
  this._key = key;
22472
22470
  }
22473
22471
  get path() {
@@ -27365,7 +27363,7 @@ import process3 from "process";
27365
27363
  import { spawnSync } from "child_process";
27366
27364
  import fs15 from "fs";
27367
27365
  import os12 from "os";
27368
- import path11 from "path";
27366
+ import path12 from "path";
27369
27367
  import * as p from "@clack/prompts";
27370
27368
  var REPO = "Project-White-Rabbit/bitfab-claude-plugin";
27371
27369
  var MARKETPLACE = "bitfab";
@@ -27385,7 +27383,7 @@ function runClaudeInstall() {
27385
27383
  }
27386
27384
  s.start("Enabling auto-updates");
27387
27385
  const changed = enableAutoUpdate(
27388
- path11.join(os12.homedir(), ".claude", "settings.json")
27386
+ path12.join(os12.homedir(), ".claude", "settings.json")
27389
27387
  );
27390
27388
  if (changed) {
27391
27389
  s.stop("Auto-updates enabled");
@@ -27491,7 +27489,7 @@ function enableAutoUpdate(settingsPath) {
27491
27489
  autoUpdate: true
27492
27490
  };
27493
27491
  settings.extraKnownMarketplaces = marketplaces;
27494
- fs15.mkdirSync(path11.dirname(settingsPath), { recursive: true });
27492
+ fs15.mkdirSync(path12.dirname(settingsPath), { recursive: true });
27495
27493
  fs15.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
27496
27494
  `);
27497
27495
  return true;
@@ -27501,7 +27499,7 @@ function enableAutoUpdate(settingsPath) {
27501
27499
  import { spawnSync as spawnSync2 } from "child_process";
27502
27500
  import fs16 from "fs";
27503
27501
  import os13 from "os";
27504
- import path12 from "path";
27502
+ import path13 from "path";
27505
27503
  import * as p2 from "@clack/prompts";
27506
27504
  var REPO2 = "Project-White-Rabbit/bitfab-codex-plugin";
27507
27505
  var PLUGIN_KEY2 = "bitfab@bitfab";
@@ -27529,7 +27527,7 @@ function runCodexInstall() {
27529
27527
  }
27530
27528
  s.start("Enabling bitfab plugin in config");
27531
27529
  const changed = enableCodexPlugin(
27532
- path12.join(os13.homedir(), ".codex", "config.toml")
27530
+ path13.join(os13.homedir(), ".codex", "config.toml")
27533
27531
  );
27534
27532
  if (changed) {
27535
27533
  s.stop("Plugin enabled");
@@ -27616,7 +27614,7 @@ enabled = true
27616
27614
 
27617
27615
  ${desiredSection}`;
27618
27616
  }
27619
- fs16.mkdirSync(path12.dirname(configPath), { recursive: true });
27617
+ fs16.mkdirSync(path13.dirname(configPath), { recursive: true });
27620
27618
  fs16.writeFileSync(configPath, next);
27621
27619
  return true;
27622
27620
  }
@@ -27729,11 +27727,11 @@ var platform = {
27729
27727
 
27730
27728
  // src/version.ts
27731
27729
  import fs17 from "fs";
27732
- import path13 from "path";
27730
+ import path14 from "path";
27733
27731
  import { fileURLToPath as fileURLToPath2 } from "url";
27734
27732
  var CLI_VERSION = JSON.parse(
27735
27733
  fs17.readFileSync(
27736
- path13.join(path13.dirname(fileURLToPath2(import.meta.url)), "../package.json"),
27734
+ path14.join(path14.dirname(fileURLToPath2(import.meta.url)), "../package.json"),
27737
27735
  "utf-8"
27738
27736
  )
27739
27737
  ).version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitfab-cli",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "description": "Install and configure the Bitfab plugin in Claude Code, Codex, or Cursor.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",