bitfab-cli 0.2.381 → 0.2.382
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 +58 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9176,12 +9176,12 @@ var require_dist = __commonJS({
|
|
|
9176
9176
|
throw new Error(`Unknown format "${name}"`);
|
|
9177
9177
|
return f;
|
|
9178
9178
|
};
|
|
9179
|
-
function addFormats(ajv, list,
|
|
9179
|
+
function addFormats(ajv, list, fs18, exportName) {
|
|
9180
9180
|
var _a3;
|
|
9181
9181
|
var _b;
|
|
9182
9182
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
9183
9183
|
for (const f of list)
|
|
9184
|
-
ajv.addFormat(f,
|
|
9184
|
+
ajv.addFormat(f, fs18[f]);
|
|
9185
9185
|
}
|
|
9186
9186
|
module.exports = exports = formatsPlugin;
|
|
9187
9187
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -24896,7 +24896,7 @@ import path4 from "path";
|
|
|
24896
24896
|
var BITFAB_SKILLS = ["setup", "assistant", "update"];
|
|
24897
24897
|
|
|
24898
24898
|
// ../bitfab-plugin-lib/dist/hooks/skillDetection.js
|
|
24899
|
-
var SKILL_PATTERN = new RegExp(`^\\s
|
|
24899
|
+
var SKILL_PATTERN = new RegExp(`^\\s*[/$]?bitfab[:-](?<skill>${BITFAB_SKILLS.join("|")})(?=\\s|$)`, "i");
|
|
24900
24900
|
|
|
24901
24901
|
// ../bitfab-plugin-lib/dist/chatSessions/arming.js
|
|
24902
24902
|
import fs3 from "fs";
|
|
@@ -24906,6 +24906,9 @@ import path3 from "path";
|
|
|
24906
24906
|
// ../bitfab-plugin-lib/dist/chatSessions/transcriptReader.js
|
|
24907
24907
|
import fs4 from "fs";
|
|
24908
24908
|
|
|
24909
|
+
// ../bitfab-plugin-lib/dist/chatSessions/index.js
|
|
24910
|
+
var AMP_SESSION_RETENTION_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
24911
|
+
|
|
24909
24912
|
// ../bitfab-plugin-lib/dist/replayCapabilities.js
|
|
24910
24913
|
var semver = __toESM(require_semver2(), 1);
|
|
24911
24914
|
|
|
@@ -26195,7 +26198,7 @@ async function checkForUpdate(currentVersion, platform2, localBuildSha) {
|
|
|
26195
26198
|
current: currentVersion,
|
|
26196
26199
|
latest,
|
|
26197
26200
|
updateAvailable: versionNewer || staleSameVersion,
|
|
26198
|
-
autoUpdateEnabled: platform2.supportsAutoUpdate ? isAutoUpdateEnabled(platform2) : false,
|
|
26201
|
+
autoUpdateEnabled: platform2.supportsAutoUpdate && platform2.enableAutoUpdateHint !== void 0 ? isAutoUpdateEnabled(platform2) : false,
|
|
26199
26202
|
staleSameVersion
|
|
26200
26203
|
};
|
|
26201
26204
|
}
|
|
@@ -33610,14 +33613,17 @@ var setupV2Flow = Flow.parse({
|
|
|
33610
33613
|
}
|
|
33611
33614
|
});
|
|
33612
33615
|
|
|
33613
|
-
// ../bitfab-plugin-lib/dist/
|
|
33616
|
+
// ../bitfab-plugin-lib/dist/chatSessions/ampTranscript.js
|
|
33614
33617
|
import fs9 from "fs";
|
|
33615
33618
|
|
|
33616
|
-
// ../bitfab-plugin-lib/dist/hooks/
|
|
33619
|
+
// ../bitfab-plugin-lib/dist/hooks/captureHook.js
|
|
33617
33620
|
import fs10 from "fs";
|
|
33618
33621
|
|
|
33619
|
-
// ../bitfab-plugin-lib/dist/
|
|
33622
|
+
// ../bitfab-plugin-lib/dist/hooks/userPromptSubmit.js
|
|
33620
33623
|
import fs11 from "fs";
|
|
33624
|
+
|
|
33625
|
+
// ../bitfab-plugin-lib/dist/installScope.js
|
|
33626
|
+
import fs12 from "fs";
|
|
33621
33627
|
import os8 from "os";
|
|
33622
33628
|
import path9 from "path";
|
|
33623
33629
|
var INSTALL_SCOPES = ["user", "project", "local", "managed"];
|
|
@@ -33637,7 +33643,7 @@ function installScopeAppliesToProject(projectPath, projectDir) {
|
|
|
33637
33643
|
}
|
|
33638
33644
|
function canonicalPath(target) {
|
|
33639
33645
|
try {
|
|
33640
|
-
return
|
|
33646
|
+
return fs12.realpathSync(path9.resolve(target));
|
|
33641
33647
|
} catch {
|
|
33642
33648
|
return path9.resolve(target);
|
|
33643
33649
|
}
|
|
@@ -43235,7 +43241,7 @@ async function startMcpServer(platform2, getConfig2, pluginVersion) {
|
|
|
43235
43241
|
// src/amp.ts
|
|
43236
43242
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
43237
43243
|
import crypto3 from "crypto";
|
|
43238
|
-
import
|
|
43244
|
+
import fs13 from "fs";
|
|
43239
43245
|
import os9 from "os";
|
|
43240
43246
|
import path10 from "path";
|
|
43241
43247
|
import * as p3 from "@clack/prompts";
|
|
@@ -43416,13 +43422,13 @@ function ampPluginDir(env = process.env) {
|
|
|
43416
43422
|
return path10.join(configHome, "amp", "plugins", PLUGIN_DIR_NAME);
|
|
43417
43423
|
}
|
|
43418
43424
|
function pluginDirState(dir) {
|
|
43419
|
-
if (!
|
|
43425
|
+
if (!fs13.existsSync(dir)) {
|
|
43420
43426
|
return "missing";
|
|
43421
43427
|
}
|
|
43422
|
-
if (
|
|
43428
|
+
if (fs13.existsSync(path10.join(dir, ".git"))) {
|
|
43423
43429
|
return "checkout";
|
|
43424
43430
|
}
|
|
43425
|
-
return
|
|
43431
|
+
return fs13.readdirSync(dir).length === 0 ? "empty" : "occupied";
|
|
43426
43432
|
}
|
|
43427
43433
|
function skillInvocation(skill, args) {
|
|
43428
43434
|
const trimmed = args?.trim();
|
|
@@ -43445,7 +43451,7 @@ function installOrUpdatePlugin() {
|
|
|
43445
43451
|
`${dir} already exists but is not a git checkout of the Bitfab plugin. Move it aside (for example \`mv ${dir} ${dir}.bak\`) and rerun.`
|
|
43446
43452
|
);
|
|
43447
43453
|
}
|
|
43448
|
-
|
|
43454
|
+
fs13.mkdirSync(path10.dirname(dir), { recursive: true });
|
|
43449
43455
|
runCli("git", ["clone", "--depth", "1", "--quiet", PLUGIN_REPO_URL, dir]);
|
|
43450
43456
|
return "installed";
|
|
43451
43457
|
}
|
|
@@ -43504,15 +43510,20 @@ function runAmpSetup(skipPermissions, prompt) {
|
|
|
43504
43510
|
warnSkipPermissions(skipPermissions);
|
|
43505
43511
|
handOffToAmp(skillInvocation(SETUP_SKILL, prompt));
|
|
43506
43512
|
}
|
|
43507
|
-
function runAmpAnalyzeRepo(
|
|
43513
|
+
function runAmpAnalyzeRepo(captureOverride, limit, prompt) {
|
|
43508
43514
|
const message = skillInvocation(
|
|
43509
43515
|
`Use the ${SETUP_SKILL} skill in analyze-repo mode.`,
|
|
43510
43516
|
buildAnalyzeRepoArgs({ limit, prompt })
|
|
43511
43517
|
);
|
|
43518
|
+
const env = { ...process.env };
|
|
43519
|
+
env.BITFAB_AGENT_RUN_ID = crypto3.randomUUID();
|
|
43520
|
+
if (captureOverride !== void 0) {
|
|
43521
|
+
env.BITFAB_CAPTURE_SESSIONS = captureOverride ? "1" : "0";
|
|
43522
|
+
}
|
|
43512
43523
|
p3.log.step("Analyzing the repo with Amp (headless)");
|
|
43513
43524
|
const result = spawnSync2(CLI, ["-x", message], {
|
|
43514
43525
|
stdio: "inherit",
|
|
43515
|
-
env
|
|
43526
|
+
env,
|
|
43516
43527
|
...SHELL_OPTS
|
|
43517
43528
|
});
|
|
43518
43529
|
if (result.error) {
|
|
@@ -43550,7 +43561,7 @@ var ampAdapter = {
|
|
|
43550
43561
|
label: "Amp",
|
|
43551
43562
|
runsAgentIn: "editor",
|
|
43552
43563
|
supportsSkipPermissions: false,
|
|
43553
|
-
capturesSessionLogs:
|
|
43564
|
+
capturesSessionLogs: true,
|
|
43554
43565
|
install: runAmpInstall,
|
|
43555
43566
|
ensureLatest: ensureLatestAmpPlugin,
|
|
43556
43567
|
setup: runAmpSetup,
|
|
@@ -43562,7 +43573,7 @@ var ampAdapter = {
|
|
|
43562
43573
|
// src/claude.ts
|
|
43563
43574
|
import { spawn as spawn3 } from "child_process";
|
|
43564
43575
|
import crypto4 from "crypto";
|
|
43565
|
-
import
|
|
43576
|
+
import fs14 from "fs";
|
|
43566
43577
|
import os10 from "os";
|
|
43567
43578
|
import path11 from "path";
|
|
43568
43579
|
import * as p4 from "@clack/prompts";
|
|
@@ -43752,12 +43763,12 @@ function activeLocalClaudeBitfabPlugin() {
|
|
|
43752
43763
|
path11.join(os10.homedir(), ".claude", "settings.json")
|
|
43753
43764
|
];
|
|
43754
43765
|
for (const settingsPath of settingsPaths) {
|
|
43755
|
-
if (!
|
|
43766
|
+
if (!fs14.existsSync(settingsPath)) {
|
|
43756
43767
|
continue;
|
|
43757
43768
|
}
|
|
43758
43769
|
let contents;
|
|
43759
43770
|
try {
|
|
43760
|
-
contents =
|
|
43771
|
+
contents = fs14.readFileSync(settingsPath, "utf-8");
|
|
43761
43772
|
} catch {
|
|
43762
43773
|
continue;
|
|
43763
43774
|
}
|
|
@@ -43813,7 +43824,7 @@ async function runClaudeAnalyzeRepo(captureOverride, limit, prompt) {
|
|
|
43813
43824
|
limit,
|
|
43814
43825
|
prompt
|
|
43815
43826
|
});
|
|
43816
|
-
const out =
|
|
43827
|
+
const out = fs14.createWriteStream(logPath);
|
|
43817
43828
|
const spinner7 = p4.spinner();
|
|
43818
43829
|
spinner7.start("Analyzing workflows to instrument");
|
|
43819
43830
|
const stdoutChunks = [];
|
|
@@ -44481,7 +44492,7 @@ function eventMessageContent(event) {
|
|
|
44481
44492
|
}
|
|
44482
44493
|
function analyzeRepoLogPath() {
|
|
44483
44494
|
const dir = path11.join(process.cwd(), ".bitfab", "logs");
|
|
44484
|
-
|
|
44495
|
+
fs14.mkdirSync(dir, { recursive: true });
|
|
44485
44496
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
44486
44497
|
return path11.join(dir, `analyze-repo-${stamp}.jsonl`);
|
|
44487
44498
|
}
|
|
@@ -44531,10 +44542,10 @@ function claudeProjectKeys(projectPath) {
|
|
|
44531
44542
|
function enableBitfabMcpServer(configPath, projectPath) {
|
|
44532
44543
|
let staging;
|
|
44533
44544
|
try {
|
|
44534
|
-
if (!
|
|
44545
|
+
if (!fs14.existsSync(configPath)) {
|
|
44535
44546
|
return false;
|
|
44536
44547
|
}
|
|
44537
|
-
const raw =
|
|
44548
|
+
const raw = fs14.readFileSync(configPath, "utf-8");
|
|
44538
44549
|
if (raw.trim() === "") {
|
|
44539
44550
|
return false;
|
|
44540
44551
|
}
|
|
@@ -44551,20 +44562,20 @@ function enableBitfabMcpServer(configPath, projectPath) {
|
|
|
44551
44562
|
project.disabledMcpServers = disabled.filter(
|
|
44552
44563
|
(name) => name !== MCP_SERVER_NAME
|
|
44553
44564
|
);
|
|
44554
|
-
const target =
|
|
44555
|
-
const mode =
|
|
44565
|
+
const target = fs14.realpathSync(configPath);
|
|
44566
|
+
const mode = fs14.statSync(target).mode & 511;
|
|
44556
44567
|
const stagingPath = `${target}.bitfab-${process.pid}.tmp`;
|
|
44557
|
-
|
|
44568
|
+
fs14.writeFileSync(stagingPath, JSON.stringify(config4, null, 2), {
|
|
44558
44569
|
mode,
|
|
44559
44570
|
flag: "wx"
|
|
44560
44571
|
});
|
|
44561
44572
|
staging = stagingPath;
|
|
44562
|
-
|
|
44573
|
+
fs14.renameSync(staging, target);
|
|
44563
44574
|
return true;
|
|
44564
44575
|
} catch {
|
|
44565
44576
|
if (staging !== void 0) {
|
|
44566
44577
|
try {
|
|
44567
|
-
|
|
44578
|
+
fs14.rmSync(staging, { force: true });
|
|
44568
44579
|
} catch {
|
|
44569
44580
|
}
|
|
44570
44581
|
}
|
|
@@ -44573,8 +44584,8 @@ function enableBitfabMcpServer(configPath, projectPath) {
|
|
|
44573
44584
|
}
|
|
44574
44585
|
function enableAutoUpdate(settingsPath) {
|
|
44575
44586
|
let settings = {};
|
|
44576
|
-
if (
|
|
44577
|
-
const raw =
|
|
44587
|
+
if (fs14.existsSync(settingsPath)) {
|
|
44588
|
+
const raw = fs14.readFileSync(settingsPath, "utf-8");
|
|
44578
44589
|
settings = raw.trim() === "" ? {} : JSON.parse(raw);
|
|
44579
44590
|
}
|
|
44580
44591
|
const marketplaces = settings.extraKnownMarketplaces ?? {};
|
|
@@ -44588,8 +44599,8 @@ function enableAutoUpdate(settingsPath) {
|
|
|
44588
44599
|
autoUpdate: true
|
|
44589
44600
|
};
|
|
44590
44601
|
settings.extraKnownMarketplaces = marketplaces;
|
|
44591
|
-
|
|
44592
|
-
|
|
44602
|
+
fs14.mkdirSync(path11.dirname(settingsPath), { recursive: true });
|
|
44603
|
+
fs14.writeFileSync(settingsPath, `${JSON.stringify(settings, null, 2)}
|
|
44593
44604
|
`);
|
|
44594
44605
|
return true;
|
|
44595
44606
|
}
|
|
@@ -44618,7 +44629,7 @@ var claudeAdapter = {
|
|
|
44618
44629
|
// src/codex.ts
|
|
44619
44630
|
import { spawn as spawn4 } from "child_process";
|
|
44620
44631
|
import crypto5 from "crypto";
|
|
44621
|
-
import
|
|
44632
|
+
import fs15 from "fs";
|
|
44622
44633
|
import os11 from "os";
|
|
44623
44634
|
import path12 from "path";
|
|
44624
44635
|
import * as p5 from "@clack/prompts";
|
|
@@ -44692,7 +44703,7 @@ async function runCodexAnalyzeRepo(captureOverride, limit, prompt) {
|
|
|
44692
44703
|
limit,
|
|
44693
44704
|
prompt
|
|
44694
44705
|
});
|
|
44695
|
-
const out =
|
|
44706
|
+
const out = fs15.createWriteStream(logPath);
|
|
44696
44707
|
const spinner7 = p5.spinner();
|
|
44697
44708
|
spinner7.start("Analyzing workflows to instrument");
|
|
44698
44709
|
const stdoutChunks = [];
|
|
@@ -44848,14 +44859,14 @@ function eventItem(event) {
|
|
|
44848
44859
|
}
|
|
44849
44860
|
function analyzeRepoLogPath2() {
|
|
44850
44861
|
const dir = path12.join(process.cwd(), ".bitfab", "logs");
|
|
44851
|
-
|
|
44862
|
+
fs15.mkdirSync(dir, { recursive: true });
|
|
44852
44863
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
44853
44864
|
return path12.join(dir, `analyze-repo-${stamp}.jsonl`);
|
|
44854
44865
|
}
|
|
44855
44866
|
function enableCodexPlugin(configPath) {
|
|
44856
44867
|
let content = "";
|
|
44857
|
-
if (
|
|
44858
|
-
content =
|
|
44868
|
+
if (fs15.existsSync(configPath)) {
|
|
44869
|
+
content = fs15.readFileSync(configPath, "utf-8");
|
|
44859
44870
|
}
|
|
44860
44871
|
const header = `[plugins."${PLUGIN_KEY2}"]`;
|
|
44861
44872
|
const desiredSection = `${header}
|
|
@@ -44878,15 +44889,15 @@ enabled = true
|
|
|
44878
44889
|
|
|
44879
44890
|
${desiredSection}`;
|
|
44880
44891
|
}
|
|
44881
|
-
|
|
44882
|
-
|
|
44892
|
+
fs15.mkdirSync(path12.dirname(configPath), { recursive: true });
|
|
44893
|
+
fs15.writeFileSync(configPath, next);
|
|
44883
44894
|
return true;
|
|
44884
44895
|
}
|
|
44885
44896
|
function isCodexPluginEnabled(configPath, pluginKey) {
|
|
44886
|
-
if (!
|
|
44897
|
+
if (!fs15.existsSync(configPath)) {
|
|
44887
44898
|
return false;
|
|
44888
44899
|
}
|
|
44889
|
-
const content =
|
|
44900
|
+
const content = fs15.readFileSync(configPath, "utf-8");
|
|
44890
44901
|
const sectionRegex = new RegExp(
|
|
44891
44902
|
`\\[plugins\\."${escapeRegex2(pluginKey)}"\\][^\\[]*`,
|
|
44892
44903
|
"m"
|
|
@@ -44925,7 +44936,7 @@ var codexAdapter = {
|
|
|
44925
44936
|
// src/cursor.ts
|
|
44926
44937
|
import { spawn as spawn5, spawnSync as spawnSync3 } from "child_process";
|
|
44927
44938
|
import crypto6 from "crypto";
|
|
44928
|
-
import
|
|
44939
|
+
import fs16 from "fs";
|
|
44929
44940
|
import os12 from "os";
|
|
44930
44941
|
import path13 from "path";
|
|
44931
44942
|
import * as p6 from "@clack/prompts";
|
|
@@ -45013,7 +45024,7 @@ async function runCursorAnalyzeRepo(captureOverride, limit, prompt) {
|
|
|
45013
45024
|
limit,
|
|
45014
45025
|
prompt
|
|
45015
45026
|
});
|
|
45016
|
-
const out =
|
|
45027
|
+
const out = fs16.createWriteStream(logPath);
|
|
45017
45028
|
const spinner7 = p6.spinner();
|
|
45018
45029
|
spinner7.start("Analyzing workflows to instrument");
|
|
45019
45030
|
const stdoutChunks = [];
|
|
@@ -45169,7 +45180,7 @@ function resolveCursorPluginDir() {
|
|
|
45169
45180
|
path13.join(os12.homedir(), ".cursor", "plugins", "local", "bitfab")
|
|
45170
45181
|
];
|
|
45171
45182
|
for (const candidate of candidates) {
|
|
45172
|
-
if (
|
|
45183
|
+
if (fs16.existsSync(path13.join(candidate, ".cursor-plugin", "plugin.json")) && fs16.existsSync(path13.join(candidate, "mcp.json"))) {
|
|
45173
45184
|
return candidate;
|
|
45174
45185
|
}
|
|
45175
45186
|
}
|
|
@@ -45177,7 +45188,7 @@ function resolveCursorPluginDir() {
|
|
|
45177
45188
|
}
|
|
45178
45189
|
function analyzeRepoLogPath3() {
|
|
45179
45190
|
const dir = path13.join(process.cwd(), ".bitfab", "logs");
|
|
45180
|
-
|
|
45191
|
+
fs16.mkdirSync(dir, { recursive: true });
|
|
45181
45192
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
45182
45193
|
return path13.join(dir, `analyze-repo-${stamp}.jsonl`);
|
|
45183
45194
|
}
|
|
@@ -45258,11 +45269,11 @@ var platform = {
|
|
|
45258
45269
|
};
|
|
45259
45270
|
|
|
45260
45271
|
// src/version.ts
|
|
45261
|
-
import
|
|
45272
|
+
import fs17 from "fs";
|
|
45262
45273
|
import path14 from "path";
|
|
45263
45274
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
45264
45275
|
var CLI_VERSION = JSON.parse(
|
|
45265
|
-
|
|
45276
|
+
fs17.readFileSync(
|
|
45266
45277
|
path14.join(path14.dirname(fileURLToPath2(import.meta.url)), "../package.json"),
|
|
45267
45278
|
"utf-8"
|
|
45268
45279
|
)
|
package/package.json
CHANGED