@xbrowser/cli 1.24.3 → 1.25.1

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
@@ -48,7 +48,7 @@ import {
48
48
  splitCommand,
49
49
  waitForAIResponse,
50
50
  waitForPage
51
- } from "./chunk-LTLMDKWG.js";
51
+ } from "./chunk-RLWABNIE.js";
52
52
  import {
53
53
  SessionRecorder
54
54
  } from "./chunk-IR6C24P7.js";
@@ -63,7 +63,7 @@ import {
63
63
  getBrowser,
64
64
  resetForTesting,
65
65
  saveSessionDiskMeta
66
- } from "./chunk-PKXJST62.js";
66
+ } from "./chunk-PZJSCKTI.js";
67
67
  import "./chunk-JKVUFP3G.js";
68
68
  import {
69
69
  forwardCommandLog,
@@ -120,8 +120,8 @@ import {
120
120
  generateJSScript,
121
121
  generatePythonScript
122
122
  } from "./chunk-ETCO4SNK.js";
123
- import "./chunk-UR3R5LWF.js";
124
- import "./chunk-GYB5BOSP.js";
123
+ import "./chunk-DP6VI3UL.js";
124
+ import "./chunk-R3F4K2SB.js";
125
125
  import "./chunk-MYH6FIBZ.js";
126
126
  import {
127
127
  errMsg
@@ -2604,10 +2604,11 @@ async function handleBrowserCommand(command, args, options, sessionName, mode, c
2604
2604
  }
2605
2605
  case "mouse": {
2606
2606
  const flatArgs = args.flatMap((a) => a.split(/\s+/).filter(Boolean));
2607
- const action = options.action || flatArgs.find((a) => ["move", "click", "dblclick", "down", "up"].includes(a));
2608
- const actionIdx = action ? flatArgs.indexOf(action) : -1;
2609
- const x = options.x !== void 0 ? Number(options.x) : actionIdx >= 0 && flatArgs[actionIdx + 1] ? Number(flatArgs[actionIdx + 1]) : void 0;
2610
- const y = options.y !== void 0 ? Number(options.y) : actionIdx >= 0 && flatArgs[actionIdx + 2] ? Number(flatArgs[actionIdx + 2]) : void 0;
2607
+ const argActionIdx = flatArgs.findIndex((a) => ["move", "click", "dblclick", "down", "up"].includes(a));
2608
+ const action = options.action || (argActionIdx >= 0 ? flatArgs[argActionIdx] : void 0);
2609
+ const coordArgs = options.action !== void 0 ? flatArgs : argActionIdx >= 0 ? flatArgs.slice(argActionIdx + 1) : flatArgs;
2610
+ const x = options.x !== void 0 ? Number(options.x) : coordArgs[0] !== void 0 ? Number(coordArgs[0]) : void 0;
2611
+ const y = options.y !== void 0 ? Number(options.y) : coordArgs[1] !== void 0 ? Number(coordArgs[1]) : void 0;
2611
2612
  if (!action || x === void 0 || y === void 0 || isNaN(x) || isNaN(y)) {
2612
2613
  outputError("Usage: xbrowser mouse <move|click|dblclick> <x> <y>\n xbrowser mouse --action <action> --x <x> --y <y>");
2613
2614
  }
@@ -5562,7 +5563,13 @@ function extractSessionNameFromArgv(argv) {
5562
5563
  async function handleEvalMode(argv) {
5563
5564
  const evalCommands = parseEvalFlags(argv);
5564
5565
  if (evalCommands.length === 0) return;
5565
- const chain = evalCommands.map((script) => `eval --script-b64 ${Buffer.from(script, "utf8").toString("base64url")}`).join(" ; ");
5566
+ const knownCommands = new Set(getCommandNames());
5567
+ const chainParts = evalCommands.map((value) => {
5568
+ const firstWord = value.trim().split(/\s+/)[0] || "";
5569
+ if (knownCommands.has(firstWord)) return value;
5570
+ return `eval --script-b64 ${Buffer.from(value, "utf8").toString("base64url")}`;
5571
+ });
5572
+ const chain = chainParts.join(" ; ");
5566
5573
  const cdpEndpoint = extractCdpFromArgv(argv);
5567
5574
  const sessionArgIdx = argv.indexOf("--session");
5568
5575
  const sessionName = sessionArgIdx >= 0 && argv[sessionArgIdx + 1] ? argv[sessionArgIdx + 1] : process.env.XBROWSER_SESSION || "default";
@@ -5652,6 +5659,8 @@ async function handleChainInput(input, argv) {
5652
5659
  }
5653
5660
  async function routeCommand(argvIn, stdinCommands) {
5654
5661
  let argv = argvIn;
5662
+ let chainTokenStart = -1;
5663
+ let chainTokenEnd = -1;
5655
5664
  process.exitCode = 0;
5656
5665
  try {
5657
5666
  if (stdinCommands && stdinCommands.length > 0) {
@@ -5701,6 +5710,8 @@ async function routeCommand(argvIn, stdinCommands) {
5701
5710
  const remainder = chainArg.substring(spaceIdx + 1);
5702
5711
  let remainderParts = remainder.split(/\s+/).filter(Boolean);
5703
5712
  remainderParts = remainderParts.flatMap((part) => part.split(";").filter(Boolean));
5713
+ chainTokenStart = chainArgIdx;
5714
+ chainTokenEnd = chainArgIdx + remainderParts.length;
5704
5715
  argv = [...argv.slice(0, chainArgIdx), possibleCmd, ...remainderParts, ...argv.slice(chainArgIdx + 1)];
5705
5716
  }
5706
5717
  }
@@ -5926,6 +5937,10 @@ async function routeCommand(argvIn, stdinCommands) {
5926
5937
  const globalFlagSet = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--help", "-h", "--version", "--output", "-o"]);
5927
5938
  const cleanParts = [];
5928
5939
  for (let i = 0; i < argv.length; i++) {
5940
+ if (chainTokenStart >= 0 && i >= chainTokenStart && i <= chainTokenEnd) {
5941
+ cleanParts.push(argv[i]);
5942
+ continue;
5943
+ }
5929
5944
  if (globalFlagSet.has(argv[i])) continue;
5930
5945
  if (i > 0 && globalFlagSet.has(argv[i - 1]) && !argv[i].startsWith("-")) continue;
5931
5946
  if (argv[i].startsWith("--session=") || argv[i].startsWith("--cdp=")) continue;
@@ -6112,7 +6127,7 @@ Run "xbrowser ${command} ${subCommand} --help" to see available parameters.`
6112
6127
  const targetPage = pages[cmdTabIndex];
6113
6128
  await targetPage.bringToFront().catch(() => {
6114
6129
  });
6115
- const { setActivePage } = await import("./browser-DFM2SQDM.js");
6130
+ const { setActivePage } = await import("./browser-AGFVVYPN.js");
6116
6131
  setActivePage(session, targetPage);
6117
6132
  }
6118
6133
  }
@@ -6377,7 +6392,7 @@ async function handleRemote(args, options, mode) {
6377
6392
  }
6378
6393
  }
6379
6394
  async function startMcpServer() {
6380
- const { startMcpStdio } = await import("./server-Y5VVPRC6.js");
6395
+ const { startMcpStdio } = await import("./server-APHNNIXO.js");
6381
6396
  startMcpStdio();
6382
6397
  }
6383
6398
 
@@ -9292,7 +9307,7 @@ var DataCollector = class {
9292
9307
  return results;
9293
9308
  }
9294
9309
  async createBrowserContext() {
9295
- const { launch } = await import("./cdp-driver-57QV7C5O.js");
9310
+ const { launch } = await import("./cdp-driver-OQDGJ7FW.js");
9296
9311
  const { browser } = await launch({
9297
9312
  headless: true,
9298
9313
  args: ["--no-sandbox", "--disable-setuid-sandbox"]
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  executeChain,
3
3
  executeCommand
4
- } from "./chunk-LTLMDKWG.js";
5
- import "./chunk-PKXJST62.js";
4
+ } from "./chunk-RLWABNIE.js";
5
+ import "./chunk-PZJSCKTI.js";
6
6
  import "./chunk-JKVUFP3G.js";
7
7
  import "./chunk-3OD76SUE.js";
8
8
  import "./chunk-ZTHE5RBZ.js";
9
9
  import "./chunk-Q2DFJQGS.js";
10
- import "./chunk-UR3R5LWF.js";
11
- import "./chunk-GYB5BOSP.js";
10
+ import "./chunk-DP6VI3UL.js";
11
+ import "./chunk-R3F4K2SB.js";
12
12
  import "./chunk-MYH6FIBZ.js";
13
13
  import "./chunk-GDKLH7ZY.js";
14
14
  import "./chunk-WYETQ5C7.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  executeChain,
3
3
  executeCommand
4
- } from "./chunk-SUHS2EWV.js";
4
+ } from "./chunk-55TCNPMB.js";
5
5
  import "./chunk-JKVUFP3G.js";
6
6
  import "./chunk-3OD76SUE.js";
7
7
  import "./chunk-ZTHE5RBZ.js";
8
8
  import "./chunk-Q2DFJQGS.js";
9
- import "./chunk-X735U7G7.js";
10
- import "./chunk-GYB5BOSP.js";
9
+ import "./chunk-CRRR4KUO.js";
10
+ import "./chunk-R3F4K2SB.js";
11
11
  import "./chunk-MYH6FIBZ.js";
12
12
  import "./chunk-GDKLH7ZY.js";
13
13
  import "./chunk-KFQGP6VL.js";
@@ -61,7 +61,7 @@ var SessionReplayer = class {
61
61
  if (this.opts.page) {
62
62
  this.page = this.opts.page;
63
63
  } else if (this.opts.cdpUrl) {
64
- const { launch } = await import("./cdp-driver-BFGFAVAN.js");
64
+ const { launch } = await import("./cdp-driver-SPVN2G5X.js");
65
65
  const { browser } = await launch({ cdpEndpoint: this.opts.cdpUrl });
66
66
  let contexts = browser.contexts();
67
67
  for (let i = 0; i < 10 && contexts.length === 0; i++) {
@@ -11,7 +11,7 @@ import {
11
11
  sleep,
12
12
  typingDelay,
13
13
  wheelDelta
14
- } from "./chunk-GYB5BOSP.js";
14
+ } from "./chunk-R3F4K2SB.js";
15
15
  import "./chunk-KFQGP6VL.js";
16
16
  export {
17
17
  DEFAULT_STEALTH_CONFIG,
@@ -11,7 +11,7 @@ import {
11
11
  sleep,
12
12
  typingDelay,
13
13
  wheelDelta
14
- } from "./chunk-GYB5BOSP.js";
14
+ } from "./chunk-R3F4K2SB.js";
15
15
  import "./chunk-3RG5ZIWI.js";
16
16
  export {
17
17
  DEFAULT_STEALTH_CONFIG,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbrowser/cli",
3
- "version": "1.24.3",
3
+ "version": "1.25.1",
4
4
  "description": "Browser automation CLI for web scraping, headless browsing, SEO analysis, and AI agent workflows. A command-line alternative to Playwright, Puppeteer, and Selenium.",
5
5
  "type": "module",
6
6
  "bin": {