cbrowser 18.73.0 → 18.73.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.
@@ -0,0 +1,33 @@
1
+ /**
2
+ * cli-args.ts — argv parsing for the CLI.
3
+ *
4
+ * Extracted from cli.ts so it can be unit-tested: cli.ts runs `main()` at the
5
+ * top level, so importing it from a test executes the CLI.
6
+ */
7
+ export interface ParsedArgs {
8
+ command: string;
9
+ args: string[];
10
+ options: Record<string, string | boolean>;
11
+ }
12
+ /**
13
+ * Parse argv into a command, positional args, and options.
14
+ *
15
+ * NEGATIVE FLAGS: `--no-x` sets options["no-x"] = true AND options.x = false.
16
+ *
17
+ * Setting both is deliberate. Before 2026-07-27 only options["no-x"] was set,
18
+ * so a reader written as `options.x !== false` never saw the flag. Measured
19
+ * across the four documented negative flags:
20
+ *
21
+ * --no-color reads options["no-color"] worked
22
+ * --no-vision reads options["no-vision"] worked
23
+ * --no-persistent reads options.persistent SILENTLY IGNORED
24
+ * --no-restore reads options.restore SILENTLY IGNORED
25
+ *
26
+ * The two that were broken are both opt-outs for persisted browser state, so
27
+ * state the user explicitly asked to discard was kept instead:
28
+ * `cbrowser cookie list --no-persistent` still returned cookies out of the
29
+ * persistent profile. Writing both keys fixes those two without disturbing the
30
+ * two that already worked.
31
+ */
32
+ export declare function parseArgs(args: string[]): ParsedArgs;
33
+ //# sourceMappingURL=cli-args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA4BpD"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * cli-args.ts — argv parsing for the CLI.
3
+ *
4
+ * Extracted from cli.ts so it can be unit-tested: cli.ts runs `main()` at the
5
+ * top level, so importing it from a test executes the CLI.
6
+ */
7
+ /**
8
+ * Parse argv into a command, positional args, and options.
9
+ *
10
+ * NEGATIVE FLAGS: `--no-x` sets options["no-x"] = true AND options.x = false.
11
+ *
12
+ * Setting both is deliberate. Before 2026-07-27 only options["no-x"] was set,
13
+ * so a reader written as `options.x !== false` never saw the flag. Measured
14
+ * across the four documented negative flags:
15
+ *
16
+ * --no-color reads options["no-color"] worked
17
+ * --no-vision reads options["no-vision"] worked
18
+ * --no-persistent reads options.persistent SILENTLY IGNORED
19
+ * --no-restore reads options.restore SILENTLY IGNORED
20
+ *
21
+ * The two that were broken are both opt-outs for persisted browser state, so
22
+ * state the user explicitly asked to discard was kept instead:
23
+ * `cbrowser cookie list --no-persistent` still returned cookies out of the
24
+ * persistent profile. Writing both keys fixes those two without disturbing the
25
+ * two that already worked.
26
+ */
27
+ export function parseArgs(args) {
28
+ const command = args[0] || "help";
29
+ const restArgs = [];
30
+ const options = {};
31
+ for (let i = 1; i < args.length; i++) {
32
+ if (args[i].startsWith("--")) {
33
+ const key = args[i].slice(2);
34
+ const next = args[i + 1];
35
+ if (next && !next.startsWith("--")) {
36
+ options[key] = next;
37
+ i++;
38
+ }
39
+ else {
40
+ options[key] = true;
41
+ }
42
+ // Only for the boolean form: `--no-cache foo` means the value "foo",
43
+ // and inverting that would be wrong.
44
+ if (key.startsWith("no-") && key.length > 3 && options[key] === true) {
45
+ options[key.slice(3)] = false;
46
+ }
47
+ }
48
+ else {
49
+ restArgs.push(args[i]);
50
+ }
51
+ }
52
+ return { command, args: restArgs, options };
53
+ }
54
+ //# sourceMappingURL=cli-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"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EAAE,OAAO,EAAE,CAAC;AAC9C,CAAC"}
package/dist/cli.js CHANGED
@@ -10,6 +10,7 @@
10
10
  * AI-powered browser automation from the command line.
11
11
  */
12
12
  import { CBrowser } from "./browser.js";
13
+ import { parseArgs } from "./cli-args.js";
13
14
  // Analysis module imports
14
15
  import { executeNaturalLanguage, executeNaturalLanguageScript, huntBugs, runChaosTest, comparePersonas, formatComparisonReport, findElementByIntent, runAgentReadyAudit, formatAgentReadyReport, generateAgentReadyHtmlReport, runCompetitiveBenchmark, formatCompetitiveBenchmarkReport, generateCompetitiveBenchmarkHtmlReport, runEmpathyAudit, formatEmpathyAuditReport, generateEmpathyAuditHtmlReport, runWebMCPReadyAudit, generateWebMCPReadyHtmlReport, runAIReadinessBenchmark } from "./analysis/index.js";
15
16
  // Testing module imports
@@ -934,28 +935,7 @@ function showCommandHelp(command) {
934
935
  }
935
936
  return true;
936
937
  }
937
- function parseArgs(args) {
938
- const command = args[0] || "help";
939
- const restArgs = [];
940
- const options = {};
941
- for (let i = 1; i < args.length; i++) {
942
- if (args[i].startsWith("--")) {
943
- const key = args[i].slice(2);
944
- const next = args[i + 1];
945
- if (next && !next.startsWith("--")) {
946
- options[key] = next;
947
- i++;
948
- }
949
- else {
950
- options[key] = true;
951
- }
952
- }
953
- else {
954
- restArgs.push(args[i]);
955
- }
956
- }
957
- return { command, args: restArgs, options };
958
- }
938
+ // parseArgs moved to ./cli-args.ts so it can be unit-tested (cli.ts self-executes).
959
939
  // =========================================================================
960
940
  // Flag validation — one gate, before dispatch
961
941
  // =========================================================================