bitfab-cli 0.2.26 → 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.
- package/dist/index.js +50 -47
- 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(
|
|
3226
|
-
let input =
|
|
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 [
|
|
3426
|
-
wsComponent.path =
|
|
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,
|
|
6975
|
-
if (!isValidStudioRoute(
|
|
6976
|
-
throw new Error(`Studio route not allowed: ${
|
|
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:
|
|
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,
|
|
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 =
|
|
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,
|
|
7073
|
+
async function navigateStudioAndAwaitAck(client, path15, opts = {}) {
|
|
7074
7074
|
const ackTimeoutMs = opts.ackTimeoutMs ?? STUDIO_NAVIGATE_ACK_TIMEOUT_MS;
|
|
7075
|
-
if (!isValidStudioRoute(
|
|
7075
|
+
if (!isValidStudioRoute(path15)) {
|
|
7076
7076
|
return { acked: false, reason: "invalid-route" };
|
|
7077
7077
|
}
|
|
7078
7078
|
try {
|
|
7079
|
-
await navigateStudio(client,
|
|
7079
|
+
await navigateStudio(client, path15);
|
|
7080
7080
|
} catch {
|
|
7081
7081
|
return { acked: false, reason: "push-failed" };
|
|
7082
7082
|
}
|
|
7083
|
-
const result = await awaitNavigateAck(client,
|
|
7083
|
+
const result = await awaitNavigateAck(client, path15, ackTimeoutMs);
|
|
7084
7084
|
if (result.acked || result.reason !== "timeout") {
|
|
7085
7085
|
return result;
|
|
7086
7086
|
}
|
|
@@ -7915,14 +7915,14 @@ var StudioNavigationError = class extends Error {
|
|
|
7915
7915
|
this.name = "StudioNavigationError";
|
|
7916
7916
|
}
|
|
7917
7917
|
};
|
|
7918
|
-
async function openStudioTo(
|
|
7918
|
+
async function openStudioTo(path15, opts) {
|
|
7919
7919
|
const sessionId = opts.sessionId ?? crypto4.randomUUID();
|
|
7920
7920
|
const noop = () => {
|
|
7921
7921
|
};
|
|
7922
7922
|
const restoreFocus = recordFocus();
|
|
7923
7923
|
if (!opts.apiKey) {
|
|
7924
|
-
const separator =
|
|
7925
|
-
const redirectPath = `${
|
|
7924
|
+
const separator = path15.includes("?") ? "&" : "?";
|
|
7925
|
+
const redirectPath = `${path15}${separator}session=${encodeURIComponent(sessionId)}&pluginLogin=true`;
|
|
7926
7926
|
const signInPath = `/studio/sign-in?redirect_url=${encodeURIComponent(redirectPath)}`;
|
|
7927
7927
|
const signInUrl = `${opts.serviceUrl}${signInPath}&session=${encodeURIComponent(sessionId)}`;
|
|
7928
7928
|
openChromelessWindow(signInUrl);
|
|
@@ -7981,7 +7981,7 @@ async function openStudioTo(path14, opts) {
|
|
|
7981
7981
|
apiKey: opts.apiKey,
|
|
7982
7982
|
sessionId: existing.sessionId
|
|
7983
7983
|
};
|
|
7984
|
-
const ack = await navigateStudioAndAwaitAck(client,
|
|
7984
|
+
const ack = await navigateStudioAndAwaitAck(client, path15);
|
|
7985
7985
|
if (ack.acked) {
|
|
7986
7986
|
if (existing.endedAt != null || existing.closedAt != null) {
|
|
7987
7987
|
reactivateActiveStudioSession(existing.sessionId);
|
|
@@ -8005,7 +8005,7 @@ async function openStudioTo(path14, opts) {
|
|
|
8005
8005
|
serviceUrl: opts.serviceUrl,
|
|
8006
8006
|
apiKey: opts.apiKey,
|
|
8007
8007
|
sessionId,
|
|
8008
|
-
initialPath:
|
|
8008
|
+
initialPath: path15,
|
|
8009
8009
|
clientHeaders: opts.clientHeaders
|
|
8010
8010
|
});
|
|
8011
8011
|
const poller = opts.onEvent ? startEventPoller(session.serviceUrl, opts.apiKey, session.sessionId, opts.onEvent, restoreFocus) : { abort: noop, done: Promise.resolve() };
|
|
@@ -8920,10 +8920,10 @@ function mergeDefs(...defs) {
|
|
|
8920
8920
|
function cloneDef(schema) {
|
|
8921
8921
|
return mergeDefs(schema._zod.def);
|
|
8922
8922
|
}
|
|
8923
|
-
function getElementAtPath(obj,
|
|
8924
|
-
if (!
|
|
8923
|
+
function getElementAtPath(obj, path15) {
|
|
8924
|
+
if (!path15)
|
|
8925
8925
|
return obj;
|
|
8926
|
-
return
|
|
8926
|
+
return path15.reduce((acc, key) => acc?.[key], obj);
|
|
8927
8927
|
}
|
|
8928
8928
|
function promiseAllObject(promisesObj) {
|
|
8929
8929
|
const keys = Object.keys(promisesObj);
|
|
@@ -9306,11 +9306,11 @@ function aborted(x, startIndex = 0) {
|
|
|
9306
9306
|
}
|
|
9307
9307
|
return false;
|
|
9308
9308
|
}
|
|
9309
|
-
function prefixIssues(
|
|
9309
|
+
function prefixIssues(path15, issues) {
|
|
9310
9310
|
return issues.map((iss) => {
|
|
9311
9311
|
var _a2;
|
|
9312
9312
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
9313
|
-
iss.path.unshift(
|
|
9313
|
+
iss.path.unshift(path15);
|
|
9314
9314
|
return iss;
|
|
9315
9315
|
});
|
|
9316
9316
|
}
|
|
@@ -9493,7 +9493,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
9493
9493
|
}
|
|
9494
9494
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
9495
9495
|
const result = { errors: [] };
|
|
9496
|
-
const processError = (error49,
|
|
9496
|
+
const processError = (error49, path15 = []) => {
|
|
9497
9497
|
var _a2, _b;
|
|
9498
9498
|
for (const issue2 of error49.issues) {
|
|
9499
9499
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -9503,7 +9503,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
9503
9503
|
} else if (issue2.code === "invalid_element") {
|
|
9504
9504
|
processError({ issues: issue2.issues }, issue2.path);
|
|
9505
9505
|
} else {
|
|
9506
|
-
const fullpath = [...
|
|
9506
|
+
const fullpath = [...path15, ...issue2.path];
|
|
9507
9507
|
if (fullpath.length === 0) {
|
|
9508
9508
|
result.errors.push(mapper(issue2));
|
|
9509
9509
|
continue;
|
|
@@ -9535,8 +9535,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
9535
9535
|
}
|
|
9536
9536
|
function toDotPath(_path) {
|
|
9537
9537
|
const segs = [];
|
|
9538
|
-
const
|
|
9539
|
-
for (const seg of
|
|
9538
|
+
const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
9539
|
+
for (const seg of path15) {
|
|
9540
9540
|
if (typeof seg === "number")
|
|
9541
9541
|
segs.push(`[${seg}]`);
|
|
9542
9542
|
else if (typeof seg === "symbol")
|
|
@@ -21513,13 +21513,13 @@ function resolveRef(ref, ctx) {
|
|
|
21513
21513
|
if (!ref.startsWith("#")) {
|
|
21514
21514
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
21515
21515
|
}
|
|
21516
|
-
const
|
|
21517
|
-
if (
|
|
21516
|
+
const path15 = ref.slice(1).split("/").filter(Boolean);
|
|
21517
|
+
if (path15.length === 0) {
|
|
21518
21518
|
return ctx.rootSchema;
|
|
21519
21519
|
}
|
|
21520
21520
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
21521
|
-
if (
|
|
21522
|
-
const key =
|
|
21521
|
+
if (path15[0] === defsKey) {
|
|
21522
|
+
const key = path15[1];
|
|
21523
21523
|
if (!key || !ctx.defs[key]) {
|
|
21524
21524
|
throw new Error(`Reference not found: ${ref}`);
|
|
21525
21525
|
}
|
|
@@ -21953,6 +21953,9 @@ import os9 from "os";
|
|
|
21953
21953
|
import path6 from "path";
|
|
21954
21954
|
var FILE_PATH = path6.join(os9.homedir(), ".config", "bitfab", "active-preview-session.json");
|
|
21955
21955
|
|
|
21956
|
+
// ../bitfab-plugin-lib/dist/commands/status.js
|
|
21957
|
+
import path8 from "path";
|
|
21958
|
+
|
|
21956
21959
|
// ../bitfab-plugin-lib/dist/updates.js
|
|
21957
21960
|
import fs9 from "fs";
|
|
21958
21961
|
import os10 from "os";
|
|
@@ -21963,11 +21966,11 @@ import { execSync as execSync2 } from "child_process";
|
|
|
21963
21966
|
|
|
21964
21967
|
// ../bitfab-plugin-lib/dist/installedSdk.js
|
|
21965
21968
|
import fs11 from "fs";
|
|
21966
|
-
import
|
|
21969
|
+
import path10 from "path";
|
|
21967
21970
|
|
|
21968
21971
|
// ../bitfab-plugin-lib/dist/workspaces.js
|
|
21969
21972
|
import fs10 from "fs";
|
|
21970
|
-
import
|
|
21973
|
+
import path9 from "path";
|
|
21971
21974
|
|
|
21972
21975
|
// ../bitfab-plugin-lib/dist/commands/waitForTrace.js
|
|
21973
21976
|
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
@@ -21981,7 +21984,7 @@ import fs13 from "fs";
|
|
|
21981
21984
|
// ../bitfab-plugin-lib/dist/installScope.js
|
|
21982
21985
|
import fs14 from "fs";
|
|
21983
21986
|
import os11 from "os";
|
|
21984
|
-
import
|
|
21987
|
+
import path11 from "path";
|
|
21985
21988
|
|
|
21986
21989
|
// ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.js
|
|
21987
21990
|
var util;
|
|
@@ -22342,8 +22345,8 @@ function getErrorMap2() {
|
|
|
22342
22345
|
|
|
22343
22346
|
// ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/parseUtil.js
|
|
22344
22347
|
var makeIssue = (params) => {
|
|
22345
|
-
const { data, path:
|
|
22346
|
-
const fullPath = [...
|
|
22348
|
+
const { data, path: path15, errorMaps, issueData } = params;
|
|
22349
|
+
const fullPath = [...path15, ...issueData.path || []];
|
|
22347
22350
|
const fullIssue = {
|
|
22348
22351
|
...issueData,
|
|
22349
22352
|
path: fullPath
|
|
@@ -22458,11 +22461,11 @@ var errorUtil;
|
|
|
22458
22461
|
|
|
22459
22462
|
// ../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/types.js
|
|
22460
22463
|
var ParseInputLazyPath = class {
|
|
22461
|
-
constructor(parent, value,
|
|
22464
|
+
constructor(parent, value, path15, key) {
|
|
22462
22465
|
this._cachedPath = [];
|
|
22463
22466
|
this.parent = parent;
|
|
22464
22467
|
this.data = value;
|
|
22465
|
-
this._path =
|
|
22468
|
+
this._path = path15;
|
|
22466
22469
|
this._key = key;
|
|
22467
22470
|
}
|
|
22468
22471
|
get path() {
|
|
@@ -27360,7 +27363,7 @@ import process3 from "process";
|
|
|
27360
27363
|
import { spawnSync } from "child_process";
|
|
27361
27364
|
import fs15 from "fs";
|
|
27362
27365
|
import os12 from "os";
|
|
27363
|
-
import
|
|
27366
|
+
import path12 from "path";
|
|
27364
27367
|
import * as p from "@clack/prompts";
|
|
27365
27368
|
var REPO = "Project-White-Rabbit/bitfab-claude-plugin";
|
|
27366
27369
|
var MARKETPLACE = "bitfab";
|
|
@@ -27380,7 +27383,7 @@ function runClaudeInstall() {
|
|
|
27380
27383
|
}
|
|
27381
27384
|
s.start("Enabling auto-updates");
|
|
27382
27385
|
const changed = enableAutoUpdate(
|
|
27383
|
-
|
|
27386
|
+
path12.join(os12.homedir(), ".claude", "settings.json")
|
|
27384
27387
|
);
|
|
27385
27388
|
if (changed) {
|
|
27386
27389
|
s.stop("Auto-updates enabled");
|
|
@@ -27486,7 +27489,7 @@ function enableAutoUpdate(settingsPath) {
|
|
|
27486
27489
|
autoUpdate: true
|
|
27487
27490
|
};
|
|
27488
27491
|
settings.extraKnownMarketplaces = marketplaces;
|
|
27489
|
-
fs15.mkdirSync(
|
|
27492
|
+
fs15.mkdirSync(path12.dirname(settingsPath), { recursive: true });
|
|
27490
27493
|
fs15.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
|
|
27491
27494
|
`);
|
|
27492
27495
|
return true;
|
|
@@ -27496,7 +27499,7 @@ function enableAutoUpdate(settingsPath) {
|
|
|
27496
27499
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
27497
27500
|
import fs16 from "fs";
|
|
27498
27501
|
import os13 from "os";
|
|
27499
|
-
import
|
|
27502
|
+
import path13 from "path";
|
|
27500
27503
|
import * as p2 from "@clack/prompts";
|
|
27501
27504
|
var REPO2 = "Project-White-Rabbit/bitfab-codex-plugin";
|
|
27502
27505
|
var PLUGIN_KEY2 = "bitfab@bitfab";
|
|
@@ -27524,7 +27527,7 @@ function runCodexInstall() {
|
|
|
27524
27527
|
}
|
|
27525
27528
|
s.start("Enabling bitfab plugin in config");
|
|
27526
27529
|
const changed = enableCodexPlugin(
|
|
27527
|
-
|
|
27530
|
+
path13.join(os13.homedir(), ".codex", "config.toml")
|
|
27528
27531
|
);
|
|
27529
27532
|
if (changed) {
|
|
27530
27533
|
s.stop("Plugin enabled");
|
|
@@ -27611,7 +27614,7 @@ enabled = true
|
|
|
27611
27614
|
|
|
27612
27615
|
${desiredSection}`;
|
|
27613
27616
|
}
|
|
27614
|
-
fs16.mkdirSync(
|
|
27617
|
+
fs16.mkdirSync(path13.dirname(configPath), { recursive: true });
|
|
27615
27618
|
fs16.writeFileSync(configPath, next);
|
|
27616
27619
|
return true;
|
|
27617
27620
|
}
|
|
@@ -27724,11 +27727,11 @@ var platform = {
|
|
|
27724
27727
|
|
|
27725
27728
|
// src/version.ts
|
|
27726
27729
|
import fs17 from "fs";
|
|
27727
|
-
import
|
|
27730
|
+
import path14 from "path";
|
|
27728
27731
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
27729
27732
|
var CLI_VERSION = JSON.parse(
|
|
27730
27733
|
fs17.readFileSync(
|
|
27731
|
-
|
|
27734
|
+
path14.join(path14.dirname(fileURLToPath2(import.meta.url)), "../package.json"),
|
|
27732
27735
|
"utf-8"
|
|
27733
27736
|
)
|
|
27734
27737
|
).version;
|