bitfab-cli 0.2.183 → 0.2.184

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 +175 -46
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -30875,6 +30875,17 @@ function ensureLatestPlugin(pull) {
30875
30875
  }
30876
30876
 
30877
30877
  // src/cliEditor.ts
30878
+ function buildAnalyzeRepoCommand(base, opts = {}) {
30879
+ const parts = [base];
30880
+ if (opts.limit !== void 0) {
30881
+ parts.push(`limit=${opts.limit}`);
30882
+ }
30883
+ const prompt = opts.prompt?.trim();
30884
+ if (prompt) {
30885
+ parts.push(`guidance: ${prompt}`);
30886
+ }
30887
+ return parts.join(" ");
30888
+ }
30878
30889
  function makeCliAuthCheck({
30879
30890
  cli,
30880
30891
  args,
@@ -31042,7 +31053,7 @@ function pullLatestClaudePlugin() {
31042
31053
  function ensureLatestClaudePlugin() {
31043
31054
  ensureLatestPlugin(pullLatestClaudePlugin);
31044
31055
  }
31045
- async function runClaudeAnalyzeRepo(captureOverride, limit) {
31056
+ async function runClaudeAnalyzeRepo(captureOverride, limit, prompt) {
31046
31057
  const auth = checkClaudeAuth();
31047
31058
  if (!auth.ok) {
31048
31059
  throw new Error(auth.message);
@@ -31054,7 +31065,10 @@ async function runClaudeAnalyzeRepo(captureOverride, limit) {
31054
31065
  if (captureOverride !== void 0) {
31055
31066
  env.BITFAB_CAPTURE_SESSIONS = captureOverride ? "1" : "0";
31056
31067
  }
31057
- const command = limit === void 0 ? ANALYZE_REPO_COMMAND : `${ANALYZE_REPO_COMMAND} limit=${limit}`;
31068
+ const command = buildAnalyzeRepoCommand(ANALYZE_REPO_COMMAND, {
31069
+ limit,
31070
+ prompt
31071
+ });
31058
31072
  const out = fs20.createWriteStream(logPath);
31059
31073
  const spinner6 = p3.spinner();
31060
31074
  spinner6.start("Analyzing repo and drafting trace plans");
@@ -31359,7 +31373,7 @@ function runCodexInstall() {
31359
31373
  }
31360
31374
  p4.log.success("Bitfab plugin ready in Codex");
31361
31375
  }
31362
- async function runCodexAnalyzeRepo(captureOverride, limit) {
31376
+ async function runCodexAnalyzeRepo(captureOverride, limit, prompt) {
31363
31377
  const auth = checkCodexAuth();
31364
31378
  if (!auth.ok) {
31365
31379
  throw new Error(auth.message);
@@ -31371,7 +31385,10 @@ async function runCodexAnalyzeRepo(captureOverride, limit) {
31371
31385
  if (captureOverride !== void 0) {
31372
31386
  env.BITFAB_CAPTURE_SESSIONS = captureOverride ? "1" : "0";
31373
31387
  }
31374
- const command = limit === void 0 ? ANALYZE_REPO_COMMAND2 : `${ANALYZE_REPO_COMMAND2} limit=${limit}`;
31388
+ const command = buildAnalyzeRepoCommand(ANALYZE_REPO_COMMAND2, {
31389
+ limit,
31390
+ prompt
31391
+ });
31375
31392
  const out = fs21.createWriteStream(logPath);
31376
31393
  const spinner6 = p4.spinner();
31377
31394
  spinner6.start("Analyzing repo and drafting trace plans");
@@ -31718,7 +31735,7 @@ function runCursorSetup(skipPermissions) {
31718
31735
  }
31719
31736
  p5.log.info(`To complete setup, run ${SETUP_COMMAND3} in Cursor.`);
31720
31737
  }
31721
- async function runCursorAnalyzeRepo(captureOverride, limit) {
31738
+ async function runCursorAnalyzeRepo(captureOverride, limit, prompt) {
31722
31739
  ensureCursorAuthenticated();
31723
31740
  const pluginDir = resolveCursorPluginDir();
31724
31741
  if (!pluginDir) {
@@ -31736,7 +31753,10 @@ async function runCursorAnalyzeRepo(captureOverride, limit) {
31736
31753
  if (captureOverride !== void 0) {
31737
31754
  env.BITFAB_CAPTURE_SESSIONS = captureOverride ? "1" : "0";
31738
31755
  }
31739
- const command = limit === void 0 ? ANALYZE_REPO_COMMAND3 : `${ANALYZE_REPO_COMMAND3} limit=${limit}`;
31756
+ const command = buildAnalyzeRepoCommand(ANALYZE_REPO_COMMAND3, {
31757
+ limit,
31758
+ prompt
31759
+ });
31740
31760
  const out = fs22.createWriteStream(logPath);
31741
31761
  const spinner6 = p5.spinner();
31742
31762
  spinner6.start("Analyzing repo and drafting trace plans");
@@ -32206,7 +32226,7 @@ async function runAnalyzeRepo(opts) {
32206
32226
  }
32207
32227
  await ensureAnalyzeRepoAuth();
32208
32228
  const captureOverride = await resolveCaptureOverride(opts.uploadLogs);
32209
- await ADAPTERS[chosen].analyzeRepo(captureOverride, opts.limit);
32229
+ await ADAPTERS[chosen].analyzeRepo(captureOverride, opts.limit, opts.prompt);
32210
32230
  p6.outro("Done!");
32211
32231
  }
32212
32232
  async function ensureAnalyzeRepoAuth(canPrompt = Boolean(process.stdin.isTTY)) {
@@ -32366,7 +32386,7 @@ Commands:
32366
32386
  logout Remove stored credentials
32367
32387
  session-logs [status|enable|disable] Read or update session log collection
32368
32388
  setup [--editor <name>] Launch /bitfab:setup in the editor
32369
- analyze-repo [--editor <name>] Headless scan: draft + upload trace plans (no prompts, no code edits)
32389
+ analyze-repo [--editor <name>] [prompt] Headless scan: draft + upload trace plans (no prompts, no code edits)
32370
32390
  assistant [--editor <name>] [args] Launch /bitfab:assistant in the editor
32371
32391
  update [--editor <name>] [mode] Update plugin, then launch SDK update (mode: all|plugin|sdk)
32372
32392
  help Show this help
@@ -32378,12 +32398,14 @@ Options:
32378
32398
  --upload-logs analyze-repo: upload the run's session logs to Bitfab (skips the prompt)
32379
32399
  --no-upload-logs analyze-repo: keep session logs local (skips the prompt)
32380
32400
  --limit <n> analyze-repo: cap how many draft trace plans to upload (default 5)
32401
+ --prompt, -p <text> analyze-repo: free-text guidance steering what to focus on
32381
32402
 
32382
32403
  Examples:
32383
32404
  bitfab init Full setup (detect editor, install, login, setup)
32384
32405
  bitfab init --editor claude Full setup for Claude Code
32385
32406
  bitfab analyze-repo Scan the repo and upload draft trace plans (headless)
32386
32407
  bitfab analyze-repo --limit 3 Scan the repo and upload at most 3 draft trace plans
32408
+ bitfab analyze-repo "focus on billing" Scan with free-text guidance on what to prioritize
32387
32409
  bitfab session-logs enable Enable session log collection
32388
32410
  bitfab session-logs disable Disable session log collection
32389
32411
  bitfab assistant investigate Investigate traces
@@ -32466,24 +32488,29 @@ Examples:
32466
32488
  bitfab setup --editor codex
32467
32489
  bitfab setup --skip-permissions
32468
32490
  `,
32469
- "analyze-repo": `Usage: bitfab analyze-repo [--editor <name>] [--limit <n>] [--upload-logs | --no-upload-logs]
32491
+ "analyze-repo": `Usage: bitfab analyze-repo [--editor <name>] [--limit <n>] [--prompt <text>] [--upload-logs | --no-upload-logs] [prompt]
32470
32492
 
32471
32493
  Headlessly scan the repository for AI workflows and upload draft trace plans for the top candidates, with no prompts and no code edits.
32472
32494
 
32495
+ Pass free-text guidance to steer what the scan prioritizes, either with --prompt or as a trailing quoted argument.
32496
+
32473
32497
  Options:
32474
32498
  --editor, -e <name> Target editor: claude, codex, cursor
32475
32499
  --limit <n> Cap how many draft trace plans to upload (default 5)
32500
+ --prompt, -p <text> Free-text guidance steering what the scan focuses on
32476
32501
  --upload-logs Upload this run's session logs to Bitfab
32477
32502
  --no-upload-logs Keep this run's session logs local
32478
32503
 
32479
32504
  Examples:
32480
32505
  bitfab analyze-repo
32481
32506
  bitfab analyze-repo --limit 3
32507
+ bitfab analyze-repo --prompt "focus on the billing and checkout flows"
32508
+ bitfab analyze-repo "only the agent orchestration code"
32482
32509
  bitfab analyze-repo --no-upload-logs
32483
32510
  `,
32484
32511
  assistant: `Usage: bitfab assistant [--editor <name>] [--skip-permissions | --no-skip-permissions] [args...]
32485
32512
 
32486
- Launch the Bitfab assistant in the selected editor. Extra arguments are passed through to the editor command.
32513
+ Launch the Bitfab assistant in the selected editor. Extra arguments are passed through to the editor command. To pass an argument that looks like a bitfab flag, put it after \`--\`: everything after \`--\` is forwarded verbatim.
32487
32514
 
32488
32515
  Options:
32489
32516
  --editor, -e <name> Target editor: claude, codex, cursor
@@ -32494,10 +32521,11 @@ Examples:
32494
32521
  bitfab assistant
32495
32522
  bitfab assistant investigate
32496
32523
  bitfab assistant --editor claude --skip-permissions
32524
+ bitfab assistant -- --editor-flag value
32497
32525
  `,
32498
32526
  update: `Usage: bitfab update [--editor <name>] [--skip-permissions | --no-skip-permissions] [all|plugin|sdk]
32499
32527
 
32500
- Update the Bitfab plugin, then launch the SDK update flow in the selected editor.
32528
+ Update the Bitfab plugin, then launch the SDK update flow in the selected editor. Extra arguments are passed through to the editor command; use \`--\` to forward arguments that look like bitfab flags.
32501
32529
 
32502
32530
  Arguments:
32503
32531
  all Update plugin and SDKs (default)
@@ -32534,6 +32562,15 @@ function parseLimit(raw) {
32534
32562
  }
32535
32563
  return n;
32536
32564
  }
32565
+ function resolveAnalyzeRepoPrompt(prompt, rest) {
32566
+ if (prompt !== void 0) {
32567
+ return prompt;
32568
+ }
32569
+ if (rest.length > 0) {
32570
+ return rest.join(" ");
32571
+ }
32572
+ return void 0;
32573
+ }
32537
32574
  function isHelpCommand(command) {
32538
32575
  return command !== void 0 && Object.hasOwn(COMMAND_HELP_TEXT, command);
32539
32576
  }
@@ -32568,46 +32605,131 @@ function getHelpText(topic) {
32568
32605
  function wantsHelp(argv) {
32569
32606
  return getHelpTopic(argv) !== null;
32570
32607
  }
32608
+ var COMMAND_SPECS = {
32609
+ init: { flags: ["editor", "skipPermissions"], unknownOption: "error" },
32610
+ "plugin-install": { flags: ["editor"], unknownOption: "error" },
32611
+ login: { flags: [], unknownOption: "error" },
32612
+ logout: { flags: [], unknownOption: "error" },
32613
+ "session-logs": { flags: [], unknownOption: "error" },
32614
+ setup: { flags: ["editor", "skipPermissions"], unknownOption: "error" },
32615
+ "analyze-repo": {
32616
+ flags: ["editor", "uploadLogs", "limit", "prompt"],
32617
+ unknownOption: "error"
32618
+ },
32619
+ assistant: { flags: ["editor", "skipPermissions"], unknownOption: "forward" },
32620
+ update: { flags: ["editor", "skipPermissions"], unknownOption: "forward" },
32621
+ help: { flags: [], unknownOption: "forward" }
32622
+ };
32623
+ var FALLBACK_SPEC = { flags: [], unknownOption: "forward" };
32624
+ function applyFlag(key, token, next, values) {
32625
+ switch (key) {
32626
+ case "editor":
32627
+ if (token === "--editor" || token === "-e") {
32628
+ if (next === void 0) {
32629
+ throw new Error("--editor flag requires a value");
32630
+ }
32631
+ values.editor = next;
32632
+ return 2;
32633
+ }
32634
+ if (token.startsWith("--editor=")) {
32635
+ values.editor = token.slice("--editor=".length);
32636
+ return 1;
32637
+ }
32638
+ return null;
32639
+ case "skipPermissions":
32640
+ if (token === "--skip-permissions") {
32641
+ values.skipPermissions = true;
32642
+ return 1;
32643
+ }
32644
+ if (token === "--no-skip-permissions") {
32645
+ values.skipPermissions = false;
32646
+ return 1;
32647
+ }
32648
+ return null;
32649
+ case "uploadLogs":
32650
+ if (token === "--upload-logs") {
32651
+ values.uploadLogs = true;
32652
+ return 1;
32653
+ }
32654
+ if (token === "--no-upload-logs") {
32655
+ values.uploadLogs = false;
32656
+ return 1;
32657
+ }
32658
+ return null;
32659
+ case "limit":
32660
+ if (token === "--limit") {
32661
+ if (next === void 0) {
32662
+ throw new Error("--limit flag requires a value");
32663
+ }
32664
+ values.limit = parseLimit(next);
32665
+ return 2;
32666
+ }
32667
+ if (token.startsWith("--limit=")) {
32668
+ values.limit = parseLimit(token.slice("--limit=".length));
32669
+ return 1;
32670
+ }
32671
+ return null;
32672
+ case "prompt":
32673
+ if (token === "--prompt" || token === "-p") {
32674
+ if (next === void 0) {
32675
+ throw new Error("--prompt flag requires a value");
32676
+ }
32677
+ values.prompt = next;
32678
+ return 2;
32679
+ }
32680
+ if (token.startsWith("--prompt=")) {
32681
+ values.prompt = token.slice("--prompt=".length);
32682
+ return 1;
32683
+ }
32684
+ return null;
32685
+ }
32686
+ }
32571
32687
  function parseArgs2(argv) {
32572
32688
  const [command, ...tail] = argv;
32573
- let editor;
32574
- let skipPermissions;
32575
- let uploadLogs;
32576
- let limit;
32689
+ const spec = command !== void 0 ? COMMAND_SPECS[command] ?? FALLBACK_SPEC : FALLBACK_SPEC;
32690
+ const values = {};
32577
32691
  const rest = [];
32578
32692
  for (let i = 0; i < tail.length; i++) {
32579
- const arg = tail[i];
32580
- if (arg === "--editor" || arg === "-e") {
32581
- if (i + 1 < tail.length) {
32582
- editor = tail[i + 1];
32583
- i++;
32584
- } else {
32585
- throw new Error("--editor flag requires a value");
32586
- }
32587
- } else if (arg?.startsWith("--editor=")) {
32588
- editor = arg.slice("--editor=".length);
32589
- } else if (arg === "--skip-permissions") {
32590
- skipPermissions = true;
32591
- } else if (arg === "--no-skip-permissions") {
32592
- skipPermissions = false;
32593
- } else if (arg === "--upload-logs") {
32594
- uploadLogs = true;
32595
- } else if (arg === "--no-upload-logs") {
32596
- uploadLogs = false;
32597
- } else if (arg === "--limit") {
32598
- if (i + 1 < tail.length) {
32599
- limit = parseLimit(tail[i + 1]);
32600
- i++;
32601
- } else {
32602
- throw new Error("--limit flag requires a value");
32693
+ const token = tail[i];
32694
+ if (token === void 0) {
32695
+ continue;
32696
+ }
32697
+ if (token === "--") {
32698
+ for (let j = i + 1; j < tail.length; j++) {
32699
+ rest.push(tail[j]);
32700
+ }
32701
+ break;
32702
+ }
32703
+ let claimed = false;
32704
+ for (const key of spec.flags) {
32705
+ const consumed = applyFlag(key, token, tail[i + 1], values);
32706
+ if (consumed !== null) {
32707
+ if (consumed === 2) {
32708
+ i++;
32709
+ }
32710
+ claimed = true;
32711
+ break;
32603
32712
  }
32604
- } else if (arg?.startsWith("--limit=")) {
32605
- limit = parseLimit(arg.slice("--limit=".length));
32606
- } else if (arg !== void 0) {
32607
- rest.push(arg);
32608
32713
  }
32714
+ if (claimed) {
32715
+ continue;
32716
+ }
32717
+ const isOption = token.startsWith("-") && token !== "-";
32718
+ const isHelp = token === "-h" || token === "--help";
32719
+ if (isOption && !isHelp && spec.unknownOption === "error") {
32720
+ throw new Error(`unknown option '${token}' for command '${command}'`);
32721
+ }
32722
+ rest.push(token);
32609
32723
  }
32610
- return { command, editor, skipPermissions, uploadLogs, limit, rest };
32724
+ return {
32725
+ command,
32726
+ editor: values.editor,
32727
+ skipPermissions: values.skipPermissions,
32728
+ uploadLogs: values.uploadLogs,
32729
+ limit: values.limit,
32730
+ prompt: values.prompt,
32731
+ rest
32732
+ };
32611
32733
  }
32612
32734
  async function main() {
32613
32735
  const argv = process.argv.slice(2);
@@ -32625,7 +32747,7 @@ ${GLOBAL_HELP_TEXT}`
32625
32747
  process.stdout.write(helpText);
32626
32748
  return;
32627
32749
  }
32628
- const { command, editor, skipPermissions, uploadLogs, limit, rest } = parseArgs2(argv);
32750
+ const { command, editor, skipPermissions, uploadLogs, limit, prompt, rest } = parseArgs2(argv);
32629
32751
  const abortUpdateCheck = startUpdateCheck();
32630
32752
  if (command === "init") {
32631
32753
  await runInit({ editor, skipPermissions });
@@ -32658,7 +32780,13 @@ ${GLOBAL_HELP_TEXT}`
32658
32780
  return;
32659
32781
  }
32660
32782
  if (command === "analyze-repo") {
32661
- await runAnalyzeRepo({ editor, skipPermissions, uploadLogs, limit });
32783
+ await runAnalyzeRepo({
32784
+ editor,
32785
+ skipPermissions,
32786
+ uploadLogs,
32787
+ limit,
32788
+ prompt: resolveAnalyzeRepoPrompt(prompt, rest)
32789
+ });
32662
32790
  abortUpdateCheck();
32663
32791
  return;
32664
32792
  }
@@ -32700,5 +32828,6 @@ export {
32700
32828
  getHelpTopic,
32701
32829
  isEntrypoint,
32702
32830
  parseArgs2 as parseArgs,
32831
+ resolveAnalyzeRepoPrompt,
32703
32832
  wantsHelp
32704
32833
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitfab-cli",
3
- "version": "0.2.183",
3
+ "version": "0.2.184",
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",