cbrowser 7.9.0 → 7.10.0

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
@@ -1036,12 +1036,37 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
1036
1036
  case "fill":
1037
1037
  daemonArgs = { selector: args[0], value: args[1] };
1038
1038
  break;
1039
- case "screenshot":
1040
- daemonArgs = { path: args[0] };
1039
+ case "screenshot": {
1040
+ let ssUrl;
1041
+ let ssPath = typeof options.output === "string" ? options.output : undefined;
1042
+ if (args[0]) {
1043
+ if (args[0].startsWith("http://") || args[0].startsWith("https://") || args[0].startsWith("www.")) {
1044
+ ssUrl = args[0];
1045
+ if (args[1] && !args[1].startsWith("-"))
1046
+ ssPath = args[1];
1047
+ }
1048
+ else {
1049
+ ssPath = args[0];
1050
+ }
1051
+ }
1052
+ daemonArgs = { path: ssPath, url: ssUrl || options.url };
1041
1053
  break;
1042
- case "extract":
1043
- daemonArgs = { what: args[0] };
1054
+ }
1055
+ case "extract": {
1056
+ let extractUrl;
1057
+ let extractWhat = "text";
1058
+ if (args[0]) {
1059
+ if (args[0].startsWith("http://") || args[0].startsWith("https://") || args[0].startsWith("www.")) {
1060
+ extractUrl = args[0];
1061
+ extractWhat = args[1] || "text";
1062
+ }
1063
+ else {
1064
+ extractWhat = args[0];
1065
+ }
1066
+ }
1067
+ daemonArgs = { what: extractWhat, url: extractUrl || options.url };
1044
1068
  break;
1069
+ }
1045
1070
  case "run":
1046
1071
  daemonArgs = { command: args.join(" ") };
1047
1072
  break;
@@ -1178,9 +1203,19 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
1178
1203
  break;
1179
1204
  }
1180
1205
  case "extract": {
1181
- const what = args[0] || "text";
1182
- if (options.url) {
1183
- await browser.navigate(options.url);
1206
+ let url = typeof options.url === "string" ? options.url : undefined;
1207
+ let what = "text";
1208
+ if (args[0]) {
1209
+ if (args[0].startsWith("http://") || args[0].startsWith("https://") || args[0].startsWith("www.")) {
1210
+ url = args[0];
1211
+ what = args[1] || "text";
1212
+ }
1213
+ else {
1214
+ what = args[0];
1215
+ }
1216
+ }
1217
+ if (url) {
1218
+ await browser.navigate(url);
1184
1219
  }
1185
1220
  const result = await browser.extract(what);
1186
1221
  console.log(JSON.stringify(result.data, null, 2));
@@ -1377,6 +1412,7 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
1377
1412
  // =========================================================================
1378
1413
  // Tier 5: AI Test Generation (v5.0.0)
1379
1414
  // =========================================================================
1415
+ case "generate-tests":
1380
1416
  case "generate": {
1381
1417
  const url = args[0];
1382
1418
  if (!url) {
@@ -1460,11 +1496,23 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
1460
1496
  break;
1461
1497
  }
1462
1498
  case "screenshot": {
1463
- const path = args[0];
1464
- if (options.url) {
1465
- await browser.navigate(options.url);
1499
+ let screenshotUrl = typeof options.url === "string" ? options.url : undefined;
1500
+ let screenshotPath = typeof options.output === "string" ? options.output : undefined;
1501
+ if (args[0]) {
1502
+ if (args[0].startsWith("http://") || args[0].startsWith("https://") || args[0].startsWith("www.")) {
1503
+ screenshotUrl = args[0];
1504
+ if (args[1] && !args[1].startsWith("-")) {
1505
+ screenshotPath = args[1];
1506
+ }
1507
+ }
1508
+ else {
1509
+ screenshotPath = args[0];
1510
+ }
1511
+ }
1512
+ if (screenshotUrl) {
1513
+ await browser.navigate(screenshotUrl);
1466
1514
  }
1467
- const file = await browser.screenshot(path);
1515
+ const file = await browser.screenshot(screenshotPath);
1468
1516
  console.log(`✓ Screenshot saved: ${file}`);
1469
1517
  break;
1470
1518
  }
@@ -2973,6 +3021,7 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
2973
3021
  }
2974
3022
  break;
2975
3023
  }
3024
+ case "generate-tests":
2976
3025
  case "generate": {
2977
3026
  const name = args[1];
2978
3027
  if (!name) {
@@ -3366,6 +3415,7 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
3366
3415
  // =========================================================================
3367
3416
  // Bug Hunter (Tier 4)
3368
3417
  // =========================================================================
3418
+ case "hunt-bugs":
3369
3419
  case "hunt": {
3370
3420
  const url = args[0];
3371
3421
  if (!url) {
@@ -3441,6 +3491,7 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
3441
3491
  // =========================================================================
3442
3492
  // Chaos Engineering (Tier 4)
3443
3493
  // =========================================================================
3494
+ case "chaos-test":
3444
3495
  case "chaos": {
3445
3496
  const url = args[0];
3446
3497
  if (!url) {
@@ -3674,6 +3725,7 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
3674
3725
  // =========================================================================
3675
3726
  // AI Test Repair (Tier 6 - v6.2.0)
3676
3727
  // =========================================================================
3728
+ case "repair":
3677
3729
  case "repair-tests": {
3678
3730
  const filepath = args[0];
3679
3731
  if (!filepath) {
@@ -3738,6 +3790,7 @@ Documentation: https://github.com/alexandriashai/cbrowser/wiki
3738
3790
  // =========================================================================
3739
3791
  // Flaky Test Detection (Tier 6 - v6.3.0)
3740
3792
  // =========================================================================
3793
+ case "flaky":
3741
3794
  case "flaky-check": {
3742
3795
  const filepath = args[0];
3743
3796
  if (!filepath) {