bitfab-cli 0.2.83 → 0.2.84

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 +82 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9538,6 +9538,72 @@ function printBlockingNotice(until) {
9538
9538
  console.error(blockingNote(until));
9539
9539
  }
9540
9540
 
9541
+ // ../bitfab-plugin-lib/dist/parseArgs.js
9542
+ function formatPositionalLabel(spec) {
9543
+ const tag = spec.format && spec.format !== "string" ? `:${spec.format}` : "";
9544
+ if (spec.variadic) {
9545
+ return spec.required !== false ? `<${spec.name}${tag}> [<${spec.name}${tag}>...]` : `[<${spec.name}${tag}>...]`;
9546
+ }
9547
+ return spec.required !== false ? `<${spec.name}${tag}>` : `[${spec.name}${tag}]`;
9548
+ }
9549
+ function formatFlagLabel(spec) {
9550
+ if (spec.boolean) {
9551
+ return `[--${spec.name}]`;
9552
+ }
9553
+ const tag = spec.format && spec.format !== "string" ? `:${spec.format}` : "";
9554
+ const valueHint = spec.format === "number" ? " N" : ` <${spec.name}${tag}>`;
9555
+ const defaultHint = spec.default !== void 0 ? ` (default: ${spec.default})` : "";
9556
+ return `[--${spec.name}${valueHint}${defaultHint}]`;
9557
+ }
9558
+ function buildUsage(command, positional, flags) {
9559
+ const parts = [
9560
+ `Usage: ${command}`,
9561
+ ...positional.map(formatPositionalLabel),
9562
+ ...(flags ?? []).map(formatFlagLabel)
9563
+ ];
9564
+ return parts.join(" ");
9565
+ }
9566
+ function buildHelp(command, positional, flags, description) {
9567
+ const lines = [buildUsage(command, positional, flags)];
9568
+ if (description) {
9569
+ lines.push("", description);
9570
+ }
9571
+ const describedArgs = positional.filter((s) => s.description);
9572
+ const flagSpecs = flags ?? [];
9573
+ const labelWidth = Math.max(0, ...describedArgs.map((s) => s.name.length), ...flagSpecs.map((s) => s.name.length + 2));
9574
+ if (describedArgs.length > 0) {
9575
+ lines.push("", "Arguments:");
9576
+ for (const spec of describedArgs) {
9577
+ lines.push(` ${spec.name.padEnd(labelWidth)} ${spec.description}`);
9578
+ }
9579
+ }
9580
+ if (flagSpecs.length > 0) {
9581
+ lines.push("", "Flags:");
9582
+ for (const spec of flagSpecs) {
9583
+ const detail = [
9584
+ spec.description,
9585
+ spec.default !== void 0 ? `(default: ${spec.default})` : void 0
9586
+ ].filter(Boolean).join(" ");
9587
+ lines.push(` ${`--${spec.name}`.padEnd(labelWidth)} ${detail}`.trimEnd());
9588
+ }
9589
+ }
9590
+ return lines.join("\n");
9591
+ }
9592
+ function helpRequested(raw) {
9593
+ return raw.includes("-h") || raw.includes("--help");
9594
+ }
9595
+ function printHelpIfRequested(opts) {
9596
+ const argv = opts.argv ?? process.argv;
9597
+ if (!helpRequested(argv.slice(2))) {
9598
+ return;
9599
+ }
9600
+ console.log(buildHelp(extractCommandName(argv), opts.positional ?? [], opts.flags, opts.description));
9601
+ process.exit(0);
9602
+ }
9603
+ function extractCommandName(argv) {
9604
+ return argv[1]?.replace(/.*\//, "").replace(/\.[jt]s$/, "") ?? "command";
9605
+ }
9606
+
9541
9607
  // ../bitfab-plugin-lib/dist/studioTeardown.js
9542
9608
  var WINDOW_CLOSE_GRACE_PERIOD_MS = 1e4;
9543
9609
  function createWindowCloseArbiter(handlers, graceMs = WINDOW_CLOSE_GRACE_PERIOD_MS) {
@@ -10507,6 +10573,11 @@ async function runLogin(platform2, pluginVersion, options) {
10507
10573
  }
10508
10574
  return;
10509
10575
  }
10576
+ if (exitOnComplete) {
10577
+ printHelpIfRequested({
10578
+ description: "Sign in to Bitfab. Opens Studio in the browser for authentication and saves the API key locally. Takes no arguments."
10579
+ });
10580
+ }
10510
10581
  const force = options?.force ?? process.argv.includes("--force");
10511
10582
  const config2 = getConfig();
10512
10583
  if (!force && hasCredentials() && config2.apiKey) {
@@ -10568,8 +10639,11 @@ ${err.message}`);
10568
10639
 
10569
10640
  // ../bitfab-plugin-lib/dist/commands/logout.js
10570
10641
  function runLogout() {
10642
+ printHelpIfRequested({
10643
+ description: "Log out of Bitfab by removing the stored credentials from this machine. Takes no arguments."
10644
+ });
10571
10645
  if (!hasCredentials()) {
10572
- console.log("Not logged in \u2014 no credentials to remove.");
10646
+ console.log("Not logged in: no credentials to remove.");
10573
10647
  return;
10574
10648
  }
10575
10649
  deleteCredentials();
@@ -30405,6 +30479,10 @@ Examples:
30405
30479
  bitfab setup --skip-permissions Setup without permission prompts
30406
30480
  bitfab assistant --skip-permissions Run assistant autonomously
30407
30481
  `;
30482
+ function wantsHelp(argv) {
30483
+ const command = argv[0];
30484
+ return !command || command === "help" || argv.includes("-h") || argv.includes("--help");
30485
+ }
30408
30486
  function parseArgs2(argv) {
30409
30487
  const [command, ...tail] = argv;
30410
30488
  let editor;
@@ -30451,7 +30529,7 @@ async function main() {
30451
30529
  process.argv.slice(2)
30452
30530
  );
30453
30531
  const abortUpdateCheck = startUpdateCheck();
30454
- if (!command || command === "help" || command === "--help" || command === "-h") {
30532
+ if (wantsHelp(process.argv.slice(2))) {
30455
30533
  process.stdout.write(HELP_TEXT);
30456
30534
  abortUpdateCheck();
30457
30535
  return;
@@ -30504,5 +30582,6 @@ main().catch((err) => {
30504
30582
  });
30505
30583
  export {
30506
30584
  handleDrainArg,
30507
- parseArgs2 as parseArgs
30585
+ parseArgs2 as parseArgs,
30586
+ wantsHelp
30508
30587
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitfab-cli",
3
- "version": "0.2.83",
3
+ "version": "0.2.84",
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",