bitfab-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 +90 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27178,6 +27178,8 @@ var REPO = "Project-White-Rabbit/bitfab-claude-plugin";
|
|
|
27178
27178
|
var MARKETPLACE = "bitfab";
|
|
27179
27179
|
var PLUGIN_KEY = "bitfab@bitfab";
|
|
27180
27180
|
var SETUP_COMMAND = "/bitfab:setup";
|
|
27181
|
+
var ASSISTANT_COMMAND = "/bitfab:assistant";
|
|
27182
|
+
var UPDATE_COMMAND = "/bitfab:update";
|
|
27181
27183
|
var SHELL_OPTS = process.platform === "win32" ? { shell: true } : {};
|
|
27182
27184
|
function runClaudeInstall() {
|
|
27183
27185
|
const s = p.spinner();
|
|
@@ -27217,6 +27219,24 @@ function runClaudeSetup() {
|
|
|
27217
27219
|
`);
|
|
27218
27220
|
spawnSync("claude", [SETUP_COMMAND], { stdio: "inherit", ...SHELL_OPTS });
|
|
27219
27221
|
}
|
|
27222
|
+
function runClaudeAssistant(args) {
|
|
27223
|
+
const cmd = [ASSISTANT_COMMAND, ...args].join(" ");
|
|
27224
|
+
p.log.info(`Launching ${cmd}...
|
|
27225
|
+
`);
|
|
27226
|
+
spawnSync("claude", [ASSISTANT_COMMAND, ...args], {
|
|
27227
|
+
stdio: "inherit",
|
|
27228
|
+
...SHELL_OPTS
|
|
27229
|
+
});
|
|
27230
|
+
}
|
|
27231
|
+
function runClaudeUpdate(args) {
|
|
27232
|
+
const cmd = [UPDATE_COMMAND, ...args].join(" ");
|
|
27233
|
+
p.log.info(`Launching ${cmd}...
|
|
27234
|
+
`);
|
|
27235
|
+
spawnSync("claude", [UPDATE_COMMAND, ...args], {
|
|
27236
|
+
stdio: "inherit",
|
|
27237
|
+
...SHELL_OPTS
|
|
27238
|
+
});
|
|
27239
|
+
}
|
|
27220
27240
|
function runClaude(args) {
|
|
27221
27241
|
const result = spawnSync("claude", [...args], {
|
|
27222
27242
|
stdio: "pipe",
|
|
@@ -27261,6 +27281,8 @@ import * as p2 from "@clack/prompts";
|
|
|
27261
27281
|
var REPO2 = "Project-White-Rabbit/bitfab-codex-plugin";
|
|
27262
27282
|
var PLUGIN_KEY2 = "bitfab@bitfab";
|
|
27263
27283
|
var SETUP_COMMAND2 = "$bitfab:setup";
|
|
27284
|
+
var ASSISTANT_COMMAND2 = "$bitfab:assistant";
|
|
27285
|
+
var UPDATE_COMMAND2 = "$bitfab:update";
|
|
27264
27286
|
var SHELL_OPTS2 = process.platform === "win32" ? { shell: true } : {};
|
|
27265
27287
|
function runCodexInstall() {
|
|
27266
27288
|
const s = p2.spinner();
|
|
@@ -27296,6 +27318,24 @@ function runCodexSetup() {
|
|
|
27296
27318
|
`);
|
|
27297
27319
|
spawnSync2("codex", [SETUP_COMMAND2], { stdio: "inherit", ...SHELL_OPTS2 });
|
|
27298
27320
|
}
|
|
27321
|
+
function runCodexAssistant(args) {
|
|
27322
|
+
const cmd = [ASSISTANT_COMMAND2, ...args].join(" ");
|
|
27323
|
+
p2.log.info(`Launching ${cmd}...
|
|
27324
|
+
`);
|
|
27325
|
+
spawnSync2("codex", [ASSISTANT_COMMAND2, ...args], {
|
|
27326
|
+
stdio: "inherit",
|
|
27327
|
+
...SHELL_OPTS2
|
|
27328
|
+
});
|
|
27329
|
+
}
|
|
27330
|
+
function runCodexUpdate(args) {
|
|
27331
|
+
const cmd = [UPDATE_COMMAND2, ...args].join(" ");
|
|
27332
|
+
p2.log.info(`Launching ${cmd}...
|
|
27333
|
+
`);
|
|
27334
|
+
spawnSync2("codex", [UPDATE_COMMAND2, ...args], {
|
|
27335
|
+
stdio: "inherit",
|
|
27336
|
+
...SHELL_OPTS2
|
|
27337
|
+
});
|
|
27338
|
+
}
|
|
27299
27339
|
function enableCodexPlugin(configPath) {
|
|
27300
27340
|
let content = "";
|
|
27301
27341
|
if (fs16.existsSync(configPath)) {
|
|
@@ -27337,6 +27377,8 @@ import * as p3 from "@clack/prompts";
|
|
|
27337
27377
|
var REPO3 = "Project-White-Rabbit/bitfab-cursor-plugin";
|
|
27338
27378
|
var ADD_PLUGIN_CMD = `/add-plugin ${REPO3}`;
|
|
27339
27379
|
var SETUP_COMMAND3 = "/bitfab-setup";
|
|
27380
|
+
var ASSISTANT_COMMAND3 = "/bitfab-assistant";
|
|
27381
|
+
var UPDATE_COMMAND3 = "/bitfab-update";
|
|
27340
27382
|
var SHELL_OPTS3 = process.platform === "win32" ? { shell: true } : {};
|
|
27341
27383
|
function runCursorInstall() {
|
|
27342
27384
|
const copied = copyToClipboard(ADD_PLUGIN_CMD);
|
|
@@ -27364,6 +27406,14 @@ function runCursorInstall() {
|
|
|
27364
27406
|
function runCursorSetup() {
|
|
27365
27407
|
p3.log.info(`To complete setup, run ${SETUP_COMMAND3} in Cursor.`);
|
|
27366
27408
|
}
|
|
27409
|
+
function runCursorAssistant(args) {
|
|
27410
|
+
const cmd = [ASSISTANT_COMMAND3, ...args].join(" ");
|
|
27411
|
+
p3.log.info(`To start the assistant, run ${cmd} in Cursor.`);
|
|
27412
|
+
}
|
|
27413
|
+
function runCursorUpdate(args) {
|
|
27414
|
+
const cmd = [UPDATE_COMMAND3, ...args].join(" ");
|
|
27415
|
+
p3.log.info(`To update, run ${cmd} in Cursor.`);
|
|
27416
|
+
}
|
|
27367
27417
|
function copyToClipboard(text) {
|
|
27368
27418
|
const cmd = clipboardCommand();
|
|
27369
27419
|
if (!cmd) {
|
|
@@ -27441,6 +27491,16 @@ var SETUP_FN = {
|
|
|
27441
27491
|
codex: runCodexSetup,
|
|
27442
27492
|
cursor: runCursorSetup
|
|
27443
27493
|
};
|
|
27494
|
+
var ASSISTANT_FN = {
|
|
27495
|
+
claude: runClaudeAssistant,
|
|
27496
|
+
codex: runCodexAssistant,
|
|
27497
|
+
cursor: runCursorAssistant
|
|
27498
|
+
};
|
|
27499
|
+
var UPDATE_FN = {
|
|
27500
|
+
claude: runClaudeUpdate,
|
|
27501
|
+
codex: runCodexUpdate,
|
|
27502
|
+
cursor: runCursorUpdate
|
|
27503
|
+
};
|
|
27444
27504
|
function detectInstalledEditors() {
|
|
27445
27505
|
return EDITORS.filter((e) => isOnPath(e));
|
|
27446
27506
|
}
|
|
@@ -27507,6 +27567,14 @@ async function runSetup(opts) {
|
|
|
27507
27567
|
const chosen = await resolveEditor(opts);
|
|
27508
27568
|
SETUP_FN[chosen]();
|
|
27509
27569
|
}
|
|
27570
|
+
async function runAssistant(opts, args) {
|
|
27571
|
+
const chosen = await resolveEditor(opts);
|
|
27572
|
+
ASSISTANT_FN[chosen](args);
|
|
27573
|
+
}
|
|
27574
|
+
async function runUpdate2(opts, args) {
|
|
27575
|
+
const chosen = await resolveEditor(opts);
|
|
27576
|
+
UPDATE_FN[chosen](args);
|
|
27577
|
+
}
|
|
27510
27578
|
async function runInit(opts) {
|
|
27511
27579
|
p4.intro("bitfab");
|
|
27512
27580
|
const chosen = await resolveEditor(opts);
|
|
@@ -27563,6 +27631,8 @@ Commands:
|
|
|
27563
27631
|
login Authenticate with Bitfab (opens browser)
|
|
27564
27632
|
logout Remove stored credentials
|
|
27565
27633
|
setup [--editor <name>] Launch /bitfab:setup in the editor
|
|
27634
|
+
assistant [--editor <name>] [args] Launch /bitfab:assistant in the editor
|
|
27635
|
+
update [--editor <name>] [args] Launch /bitfab:update in the editor
|
|
27566
27636
|
help Show this help
|
|
27567
27637
|
|
|
27568
27638
|
Editor names: claude, codex, cursor
|
|
@@ -27573,27 +27643,32 @@ Examples:
|
|
|
27573
27643
|
bitfab plugin-install Install plugin only
|
|
27574
27644
|
bitfab login Sign in to Bitfab
|
|
27575
27645
|
bitfab logout Sign out
|
|
27646
|
+
bitfab assistant investigate Investigate traces
|
|
27647
|
+
bitfab update plugin Update the Bitfab plugin
|
|
27576
27648
|
`;
|
|
27577
27649
|
function parseArgs(argv) {
|
|
27578
|
-
const [command, ...
|
|
27650
|
+
const [command, ...tail] = argv;
|
|
27579
27651
|
let editor;
|
|
27580
|
-
|
|
27581
|
-
|
|
27652
|
+
const rest = [];
|
|
27653
|
+
for (let i = 0; i < tail.length; i++) {
|
|
27654
|
+
const arg = tail[i];
|
|
27582
27655
|
if (arg === "--editor" || arg === "-e") {
|
|
27583
|
-
if (i + 1 <
|
|
27584
|
-
editor =
|
|
27656
|
+
if (i + 1 < tail.length) {
|
|
27657
|
+
editor = tail[i + 1];
|
|
27585
27658
|
i++;
|
|
27586
27659
|
} else {
|
|
27587
27660
|
throw new Error("--editor flag requires a value");
|
|
27588
27661
|
}
|
|
27589
27662
|
} else if (arg?.startsWith("--editor=")) {
|
|
27590
27663
|
editor = arg.slice("--editor=".length);
|
|
27664
|
+
} else if (arg !== void 0) {
|
|
27665
|
+
rest.push(arg);
|
|
27591
27666
|
}
|
|
27592
27667
|
}
|
|
27593
|
-
return { command, editor };
|
|
27668
|
+
return { command, editor, rest };
|
|
27594
27669
|
}
|
|
27595
27670
|
async function main() {
|
|
27596
|
-
const { command, editor } = parseArgs(process.argv.slice(2));
|
|
27671
|
+
const { command, editor, rest } = parseArgs(process.argv.slice(2));
|
|
27597
27672
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
27598
27673
|
process.stdout.write(HELP_TEXT);
|
|
27599
27674
|
return;
|
|
@@ -27618,6 +27693,14 @@ async function main() {
|
|
|
27618
27693
|
await runSetup({ editor });
|
|
27619
27694
|
return;
|
|
27620
27695
|
}
|
|
27696
|
+
if (command === "assistant") {
|
|
27697
|
+
await runAssistant({ editor }, rest);
|
|
27698
|
+
return;
|
|
27699
|
+
}
|
|
27700
|
+
if (command === "update") {
|
|
27701
|
+
await runUpdate2({ editor }, rest);
|
|
27702
|
+
return;
|
|
27703
|
+
}
|
|
27621
27704
|
process.stderr.write(`Unknown command: ${command}
|
|
27622
27705
|
|
|
27623
27706
|
${HELP_TEXT}`);
|