@xbrowser/cli 1.7.7 → 1.7.9

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/cli.js CHANGED
@@ -889,10 +889,10 @@ var mouseCommand = registerCommand({
889
889
  scope: "page",
890
890
  parameters: z6.object({
891
891
  action: z6.enum(["move", "down", "up", "click", "dblclick"]),
892
- x: z6.number(),
893
- y: z6.number(),
892
+ x: z6.coerce.number(),
893
+ y: z6.coerce.number(),
894
894
  button: z6.enum(["left", "right", "middle"]).optional(),
895
- steps: z6.number().optional()
895
+ steps: z6.coerce.number().optional()
896
896
  }),
897
897
  result: z6.object({
898
898
  action: z6.enum(["move", "down", "up", "click", "dblclick"]),
@@ -9949,9 +9949,9 @@ async function handleBrowserCommand(command, args, options, sessionName, mode, c
9949
9949
  };
9950
9950
  break;
9951
9951
  case "eval":
9952
- if (!args[0]) outputError("Usage: xbrowser eval <expression>");
9953
9952
  cmdName = "eval";
9954
- params = { expression: args.join(" ") };
9953
+ params = { expression: args.join(" ") || options.expression || "" };
9954
+ if (!params.expression) outputError("Usage: xbrowser eval <expression>");
9955
9955
  break;
9956
9956
  case "scroll": {
9957
9957
  let direction = "down";
@@ -12629,6 +12629,9 @@ async function routeCommand(argvIn, stdinCommands) {
12629
12629
  await handleChainInput(argv[1], argv);
12630
12630
  return;
12631
12631
  }
12632
+ if (argv[0] === "--json" || argv[0] === "--yaml") {
12633
+ argv = argv.slice(1);
12634
+ }
12632
12635
  const globalFlags = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--output", "--timeout", "--help", "-h", "--version"]);
12633
12636
  let chainArgIdx = -1;
12634
12637
  for (let i = 0; i < argv.length; i++) {
@@ -12656,8 +12659,11 @@ async function routeCommand(argvIn, stdinCommands) {
12656
12659
  }
12657
12660
  const hasJsonFlag = argv.some((a) => a === "--json" || a.startsWith("--json="));
12658
12661
  const hasYamlFlag = argv.some((a) => a === "--yaml" || a.startsWith("--yaml="));
12659
- const parsed = parseArgs(argv);
12662
+ const cleanArgv = argv.filter((a) => a !== "--json" && a !== "--yaml");
12663
+ const parsed = parseArgs(cleanArgv);
12660
12664
  const { positional, options } = parsed;
12665
+ if (hasJsonFlag) options.json = true;
12666
+ if (hasYamlFlag) options.yaml = true;
12661
12667
  const command = positional[0];
12662
12668
  const cmdArgs = positional.slice(1);
12663
12669
  const mode = options.json || hasJsonFlag ? "json" : options.yaml || hasYamlFlag ? "yaml" : "text";
@@ -856,10 +856,10 @@ var mouseCommand = registerCommand({
856
856
  scope: "page",
857
857
  parameters: z6.object({
858
858
  action: z6.enum(["move", "down", "up", "click", "dblclick"]),
859
- x: z6.number(),
860
- y: z6.number(),
859
+ x: z6.coerce.number(),
860
+ y: z6.coerce.number(),
861
861
  button: z6.enum(["left", "right", "middle"]).optional(),
862
- steps: z6.number().optional()
862
+ steps: z6.coerce.number().optional()
863
863
  }),
864
864
  result: z6.object({
865
865
  action: z6.enum(["move", "down", "up", "click", "dblclick"]),
package/dist/index.js CHANGED
@@ -929,10 +929,10 @@ var mouseCommand = registerCommand({
929
929
  scope: "page",
930
930
  parameters: z6.object({
931
931
  action: z6.enum(["move", "down", "up", "click", "dblclick"]),
932
- x: z6.number(),
933
- y: z6.number(),
932
+ x: z6.coerce.number(),
933
+ y: z6.coerce.number(),
934
934
  button: z6.enum(["left", "right", "middle"]).optional(),
935
- steps: z6.number().optional()
935
+ steps: z6.coerce.number().optional()
936
936
  }),
937
937
  result: z6.object({
938
938
  action: z6.enum(["move", "down", "up", "click", "dblclick"]),
@@ -10272,9 +10272,9 @@ async function handleBrowserCommand(command, args, options, sessionName, mode, c
10272
10272
  };
10273
10273
  break;
10274
10274
  case "eval":
10275
- if (!args[0]) outputError("Usage: xbrowser eval <expression>");
10276
10275
  cmdName = "eval";
10277
- params = { expression: args.join(" ") };
10276
+ params = { expression: args.join(" ") || options.expression || "" };
10277
+ if (!params.expression) outputError("Usage: xbrowser eval <expression>");
10278
10278
  break;
10279
10279
  case "scroll": {
10280
10280
  let direction = "down";
@@ -12952,6 +12952,9 @@ async function routeCommand(argvIn, stdinCommands) {
12952
12952
  await handleChainInput(argv[1], argv);
12953
12953
  return;
12954
12954
  }
12955
+ if (argv[0] === "--json" || argv[0] === "--yaml") {
12956
+ argv = argv.slice(1);
12957
+ }
12955
12958
  const globalFlags = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--output", "--timeout", "--help", "-h", "--version"]);
12956
12959
  let chainArgIdx = -1;
12957
12960
  for (let i = 0; i < argv.length; i++) {
@@ -12979,8 +12982,11 @@ async function routeCommand(argvIn, stdinCommands) {
12979
12982
  }
12980
12983
  const hasJsonFlag = argv.some((a) => a === "--json" || a.startsWith("--json="));
12981
12984
  const hasYamlFlag = argv.some((a) => a === "--yaml" || a.startsWith("--yaml="));
12982
- const parsed = parseArgs(argv);
12985
+ const cleanArgv = argv.filter((a) => a !== "--json" && a !== "--yaml");
12986
+ const parsed = parseArgs(cleanArgv);
12983
12987
  const { positional, options } = parsed;
12988
+ if (hasJsonFlag) options.json = true;
12989
+ if (hasYamlFlag) options.yaml = true;
12984
12990
  const command = positional[0];
12985
12991
  const cmdArgs = positional.slice(1);
12986
12992
  const mode = options.json || hasJsonFlag ? "json" : options.yaml || hasYamlFlag ? "yaml" : "text";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbrowser/cli",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
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": {