botapp-cli 0.2.3 → 0.2.4

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 CHANGED
@@ -1602,7 +1602,7 @@ Invalid ACP stdout: ${line}`;
1602
1602
  clientInfo: {
1603
1603
  name: "botapp-daemon",
1604
1604
  title: "botapp daemon",
1605
- version: "0.2.3"
1605
+ version: "0.2.4"
1606
1606
  }
1607
1607
  });
1608
1608
  const session = await request2("session/new", {
@@ -3274,6 +3274,7 @@ async function obtainPairingToken(opts) {
3274
3274
 
3275
3275
  // src/commands/update.ts
3276
3276
  import { spawn as spawn6 } from "child_process";
3277
+ import { realpathSync } from "fs";
3277
3278
  import { Command as Command19 } from "commander";
3278
3279
  import pc20 from "picocolors";
3279
3280
  var PACKAGE_NAME = "botapp-cli";
@@ -3328,16 +3329,22 @@ var updateCommand = new Command19("update").description("Update the `bot` CLI it
3328
3329
  console.log(pc20.green("botapp-cli updated. Run `bot --version` to confirm."));
3329
3330
  });
3330
3331
  function detectPackageManager() {
3331
- const bin = process.argv[1] ?? "";
3332
- if (matchAny(bin, ["/_npx/", "\\_npx\\"])) return "npx";
3333
- if (matchAny(bin, ["/pnpm/", "\\pnpm\\", "/.pnpm/"])) return "pnpm";
3334
- if (matchAny(bin, ["/.yarn/", "/yarn/global/"])) return "yarn";
3335
- if (matchAny(bin, ["/Cellar/", "/homebrew/", "\\Cellar\\"])) return "brew";
3336
- if (matchAny(bin, ["/lib/node_modules/", "\\node_modules\\"]) || bin.includes("npm")) return "npm";
3332
+ const argv = process.argv[1] ?? "";
3333
+ let real = "";
3334
+ try {
3335
+ real = argv ? realpathSync(argv) : "";
3336
+ } catch {
3337
+ }
3338
+ const candidates = [argv, real].filter(Boolean);
3339
+ if (matchAny(candidates, ["/_npx/", "\\_npx\\"])) return "npx";
3340
+ if (matchAny(candidates, ["/pnpm/", "\\pnpm\\", "/.pnpm/"])) return "pnpm";
3341
+ if (matchAny(candidates, ["/.yarn/", "/yarn/global/"])) return "yarn";
3342
+ if (matchAny(candidates, ["/Cellar/", "/homebrew/", "\\Cellar\\"])) return "brew";
3343
+ if (matchAny(candidates, ["/lib/node_modules/", "\\node_modules\\"]) || candidates.some((c) => c.includes("npm"))) return "npm";
3337
3344
  return null;
3338
3345
  }
3339
- function matchAny(haystack, needles) {
3340
- return needles.some((n) => haystack.includes(n));
3346
+ function matchAny(haystacks, needles) {
3347
+ return haystacks.some((h) => needles.some((n) => h.includes(n)));
3341
3348
  }
3342
3349
  function updateCommandFor(manager) {
3343
3350
  switch (manager) {
@@ -3354,7 +3361,7 @@ function updateCommandFor(manager) {
3354
3361
  }
3355
3362
 
3356
3363
  // src/index.ts
3357
- var version = "0.2.3";
3364
+ var version = "0.2.4";
3358
3365
  var program = new Command20().name("bot").description("botapp CLI \u2014 operate apps from the command line").version(version).enablePositionalOptions(true).option("--json", "Output as JSON").option("-s, --server <url>", "Server URL override").option("-t, --token <token>", "Auth token override").option("-v, --verbose", "Verbose output");
3359
3366
  program.addCommand(launchCommand);
3360
3367
  program.addCommand(runCommand);