@xbrowser/cli 1.5.4 → 1.5.5

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
@@ -12557,6 +12557,11 @@ async function routeCommand(argvIn, stdinCommands) {
12557
12557
  await handleChainInput(argv[0], argv);
12558
12558
  return;
12559
12559
  }
12560
+ const jsonBeforeChain = (argv[0] === "--json" || argv[0] === "--yaml") && argv[1] && isChainInput(argv[1]);
12561
+ if (jsonBeforeChain) {
12562
+ await handleChainInput(argv[1], argv);
12563
+ return;
12564
+ }
12560
12565
  const globalFlags = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--output", "--timeout", "--help", "-h", "--version"]);
12561
12566
  let chainArgIdx = -1;
12562
12567
  for (let i = 0; i < argv.length; i++) {
@@ -12581,11 +12586,13 @@ async function routeCommand(argvIn, stdinCommands) {
12581
12586
  outputError(e instanceof Error ? e.message : String(e));
12582
12587
  return;
12583
12588
  }
12589
+ const hasJsonFlag = argv.some((a) => a === "--json" || a.startsWith("--json="));
12590
+ const hasYamlFlag = argv.some((a) => a === "--yaml" || a.startsWith("--yaml="));
12584
12591
  const parsed = parseArgs(argv);
12585
12592
  const { positional, options } = parsed;
12586
12593
  const command = positional[0];
12587
12594
  const cmdArgs = positional.slice(1);
12588
- const mode = options.json ? "json" : options.yaml ? "yaml" : "text";
12595
+ const mode = options.json || hasJsonFlag ? "json" : options.yaml || hasYamlFlag ? "yaml" : "text";
12589
12596
  const sessionName = options.session || process.env.XBROWSER_SESSION || "default";
12590
12597
  const cdpEndpoint = options.cdp || process.env.XBROWSER_CDP;
12591
12598
  if (options.version || options.v && positional.length === 0) {
@@ -12593,8 +12600,13 @@ async function routeCommand(argvIn, stdinCommands) {
12593
12600
  return;
12594
12601
  }
12595
12602
  if (positional.length === 0) {
12596
- showMainHelp();
12597
- return;
12603
+ const chainHints = [options.json, options.yaml, options.session, options.cdp].filter(Boolean).find((v) => typeof v === "string" && v.includes(" "));
12604
+ if (chainHints) {
12605
+ positional.push(chainHints);
12606
+ } else {
12607
+ showMainHelp();
12608
+ return;
12609
+ }
12598
12610
  }
12599
12611
  if ((options.help || options.h) && positional.length > 0) {
12600
12612
  const loader = await getPluginLoader();
package/dist/index.js CHANGED
@@ -12880,6 +12880,11 @@ async function routeCommand(argvIn, stdinCommands) {
12880
12880
  await handleChainInput(argv[0], argv);
12881
12881
  return;
12882
12882
  }
12883
+ const jsonBeforeChain = (argv[0] === "--json" || argv[0] === "--yaml") && argv[1] && isChainInput(argv[1]);
12884
+ if (jsonBeforeChain) {
12885
+ await handleChainInput(argv[1], argv);
12886
+ return;
12887
+ }
12883
12888
  const globalFlags = /* @__PURE__ */ new Set(["--session", "--cdp", "--json", "--yaml", "--output", "--timeout", "--help", "-h", "--version"]);
12884
12889
  let chainArgIdx = -1;
12885
12890
  for (let i = 0; i < argv.length; i++) {
@@ -12904,11 +12909,13 @@ async function routeCommand(argvIn, stdinCommands) {
12904
12909
  outputError(e instanceof Error ? e.message : String(e));
12905
12910
  return;
12906
12911
  }
12912
+ const hasJsonFlag = argv.some((a) => a === "--json" || a.startsWith("--json="));
12913
+ const hasYamlFlag = argv.some((a) => a === "--yaml" || a.startsWith("--yaml="));
12907
12914
  const parsed = parseArgs(argv);
12908
12915
  const { positional, options } = parsed;
12909
12916
  const command = positional[0];
12910
12917
  const cmdArgs = positional.slice(1);
12911
- const mode = options.json ? "json" : options.yaml ? "yaml" : "text";
12918
+ const mode = options.json || hasJsonFlag ? "json" : options.yaml || hasYamlFlag ? "yaml" : "text";
12912
12919
  const sessionName = options.session || process.env.XBROWSER_SESSION || "default";
12913
12920
  const cdpEndpoint = options.cdp || process.env.XBROWSER_CDP;
12914
12921
  if (options.version || options.v && positional.length === 0) {
@@ -12916,8 +12923,13 @@ async function routeCommand(argvIn, stdinCommands) {
12916
12923
  return;
12917
12924
  }
12918
12925
  if (positional.length === 0) {
12919
- showMainHelp();
12920
- return;
12926
+ const chainHints = [options.json, options.yaml, options.session, options.cdp].filter(Boolean).find((v) => typeof v === "string" && v.includes(" "));
12927
+ if (chainHints) {
12928
+ positional.push(chainHints);
12929
+ } else {
12930
+ showMainHelp();
12931
+ return;
12932
+ }
12921
12933
  }
12922
12934
  if ((options.help || options.h) && positional.length > 0) {
12923
12935
  const loader = await getPluginLoader();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbrowser/cli",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
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": {