@xbrowser/cli 1.4.0 → 1.4.2

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
@@ -827,7 +827,7 @@ var waitForTimeoutCommand = registerCommand({
827
827
  description: "Wait for a specified number of milliseconds",
828
828
  scope: "project",
829
829
  parameters: z4.object({
830
- timeout: z4.number().describe("Milliseconds to wait").default(1e3)
830
+ timeout: z4.coerce.number().describe("Milliseconds to wait").default(1e3)
831
831
  }),
832
832
  result: z4.object({
833
833
  waited: z4.number()
@@ -10532,6 +10532,7 @@ function handleDaemon(args, options, mode) {
10532
10532
  }
10533
10533
 
10534
10534
  // src/cli/record-routes.ts
10535
+ import { existsSync as existsSync13 } from "fs";
10535
10536
  async function handleRecord(args, options, mode) {
10536
10537
  const sub = args[0];
10537
10538
  switch (sub) {
@@ -10561,6 +10562,27 @@ async function handleRecord(args, options, mode) {
10561
10562
  outputError(String(result.error || "Failed to stop recording"));
10562
10563
  return;
10563
10564
  }
10565
+ if (output && !existsSync13(output)) {
10566
+ const defaultRecording = SessionRecorder.getRecordingsDir(sessionName) + "/recording.json";
10567
+ if (existsSync13(defaultRecording)) {
10568
+ try {
10569
+ const { mkdirSync: mkdirSync10, copyFileSync: copyFileSync2 } = await import("fs");
10570
+ const { dirname: pathDirname } = await import("path");
10571
+ mkdirSync10(pathDirname(output), { recursive: true });
10572
+ if (output.endsWith(".yaml") || output.endsWith(".yml")) {
10573
+ const { default: yaml } = await import("yaml");
10574
+ const data = SessionRecorder.readData(sessionName);
10575
+ if (data) {
10576
+ const fs3 = await import("fs");
10577
+ fs3.writeFileSync(output, yaml.stringify(data), "utf-8");
10578
+ }
10579
+ } else {
10580
+ copyFileSync2(defaultRecording, output);
10581
+ }
10582
+ } catch {
10583
+ }
10584
+ }
10585
+ }
10564
10586
  outputResult({
10565
10587
  ok: true,
10566
10588
  message: "Recording stopped.",
@@ -12385,7 +12407,13 @@ async function routeCommand(argvIn, stdinCommands) {
12385
12407
  const spaceIdx = argv[0].indexOf(" ");
12386
12408
  const possibleCmd = argv[0].substring(0, spaceIdx);
12387
12409
  if (/^[a-zA-Z][\w-]*$/.test(possibleCmd)) {
12388
- argv = [possibleCmd, argv[0].substring(spaceIdx + 1), ...argv.slice(1)];
12410
+ const remainder = argv[0].substring(spaceIdx + 1);
12411
+ if (remainder.startsWith("--") || remainder.includes(" --") && !remainder.match(/^\w+:\/\//)) {
12412
+ const remainderParts = remainder.split(/\s+/).filter(Boolean);
12413
+ argv = [possibleCmd, ...remainderParts, ...argv.slice(1)];
12414
+ } else {
12415
+ argv = [possibleCmd, remainder, ...argv.slice(1)];
12416
+ }
12389
12417
  }
12390
12418
  }
12391
12419
  } catch (e) {
@@ -788,7 +788,7 @@ var waitForTimeoutCommand = registerCommand({
788
788
  description: "Wait for a specified number of milliseconds",
789
789
  scope: "project",
790
790
  parameters: z4.object({
791
- timeout: z4.number().describe("Milliseconds to wait").default(1e3)
791
+ timeout: z4.coerce.number().describe("Milliseconds to wait").default(1e3)
792
792
  }),
793
793
  result: z4.object({
794
794
  waited: z4.number()
package/dist/index.js CHANGED
@@ -867,7 +867,7 @@ var waitForTimeoutCommand = registerCommand({
867
867
  description: "Wait for a specified number of milliseconds",
868
868
  scope: "project",
869
869
  parameters: z4.object({
870
- timeout: z4.number().describe("Milliseconds to wait").default(1e3)
870
+ timeout: z4.coerce.number().describe("Milliseconds to wait").default(1e3)
871
871
  }),
872
872
  result: z4.object({
873
873
  waited: z4.number()
@@ -10872,6 +10872,7 @@ function handleDaemon(args, options, mode) {
10872
10872
  }
10873
10873
 
10874
10874
  // src/cli/record-routes.ts
10875
+ import { existsSync as existsSync13 } from "fs";
10875
10876
  async function handleRecord(args, options, mode) {
10876
10877
  const sub = args[0];
10877
10878
  switch (sub) {
@@ -10901,6 +10902,27 @@ async function handleRecord(args, options, mode) {
10901
10902
  outputError(String(result.error || "Failed to stop recording"));
10902
10903
  return;
10903
10904
  }
10905
+ if (output && !existsSync13(output)) {
10906
+ const defaultRecording = SessionRecorder.getRecordingsDir(sessionName) + "/recording.json";
10907
+ if (existsSync13(defaultRecording)) {
10908
+ try {
10909
+ const { mkdirSync: mkdirSync11, copyFileSync: copyFileSync2 } = await import("fs");
10910
+ const { dirname: pathDirname } = await import("path");
10911
+ mkdirSync11(pathDirname(output), { recursive: true });
10912
+ if (output.endsWith(".yaml") || output.endsWith(".yml")) {
10913
+ const { default: yaml3 } = await import("yaml");
10914
+ const data = SessionRecorder.readData(sessionName);
10915
+ if (data) {
10916
+ const fs6 = await import("fs");
10917
+ fs6.writeFileSync(output, yaml3.stringify(data), "utf-8");
10918
+ }
10919
+ } else {
10920
+ copyFileSync2(defaultRecording, output);
10921
+ }
10922
+ } catch {
10923
+ }
10924
+ }
10925
+ }
10904
10926
  outputResult({
10905
10927
  ok: true,
10906
10928
  message: "Recording stopped.",
@@ -12725,7 +12747,13 @@ async function routeCommand(argvIn, stdinCommands) {
12725
12747
  const spaceIdx = argv[0].indexOf(" ");
12726
12748
  const possibleCmd = argv[0].substring(0, spaceIdx);
12727
12749
  if (/^[a-zA-Z][\w-]*$/.test(possibleCmd)) {
12728
- argv = [possibleCmd, argv[0].substring(spaceIdx + 1), ...argv.slice(1)];
12750
+ const remainder = argv[0].substring(spaceIdx + 1);
12751
+ if (remainder.startsWith("--") || remainder.includes(" --") && !remainder.match(/^\w+:\/\//)) {
12752
+ const remainderParts = remainder.split(/\s+/).filter(Boolean);
12753
+ argv = [possibleCmd, ...remainderParts, ...argv.slice(1)];
12754
+ } else {
12755
+ argv = [possibleCmd, remainder, ...argv.slice(1)];
12756
+ }
12729
12757
  }
12730
12758
  }
12731
12759
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbrowser/cli",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
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": {