cbrowser 18.54.0 → 18.55.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.
Files changed (39) hide show
  1. package/README.md +54 -1
  2. package/dist/cli.js +162 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/mcp-server-remote.d.ts.map +1 -1
  5. package/dist/mcp-server-remote.js +145 -13
  6. package/dist/mcp-server-remote.js.map +1 -1
  7. package/dist/mcp-tools/base/audit-tools.d.ts.map +1 -1
  8. package/dist/mcp-tools/base/audit-tools.js +25 -3
  9. package/dist/mcp-tools/base/audit-tools.js.map +1 -1
  10. package/dist/mcp-tools/base/cognitive-tools.d.ts +2 -0
  11. package/dist/mcp-tools/base/cognitive-tools.d.ts.map +1 -1
  12. package/dist/mcp-tools/base/cognitive-tools.js +116 -5
  13. package/dist/mcp-tools/base/cognitive-tools.js.map +1 -1
  14. package/dist/mcp-tools/base/persona-comparison-tools.d.ts.map +1 -1
  15. package/dist/mcp-tools/base/persona-comparison-tools.js +25 -3
  16. package/dist/mcp-tools/base/persona-comparison-tools.js.map +1 -1
  17. package/dist/mcp-tools/base/visual-testing-tools.d.ts.map +1 -1
  18. package/dist/mcp-tools/base/visual-testing-tools.js +27 -3
  19. package/dist/mcp-tools/base/visual-testing-tools.js.map +1 -1
  20. package/dist/output.d.ts +75 -0
  21. package/dist/output.d.ts.map +1 -0
  22. package/dist/output.js +125 -0
  23. package/dist/output.js.map +1 -0
  24. package/dist/types.d.ts +11 -0
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/types.js +126 -0
  27. package/dist/types.js.map +1 -1
  28. package/dist/values/persona-values.d.ts.map +1 -1
  29. package/dist/values/persona-values.js +98 -8
  30. package/dist/values/persona-values.js.map +1 -1
  31. package/dist/visual/attention-transport.d.ts +1 -1
  32. package/dist/visual/attention-transport.d.ts.map +1 -1
  33. package/dist/visual/attention-transport.js +99 -52
  34. package/dist/visual/attention-transport.js.map +1 -1
  35. package/dist/visual/cognitive-transport-chain.d.ts +6 -4
  36. package/dist/visual/cognitive-transport-chain.d.ts.map +1 -1
  37. package/dist/visual/cognitive-transport-chain.js +83 -7
  38. package/dist/visual/cognitive-transport-chain.js.map +1 -1
  39. package/package.json +6 -2
package/README.md CHANGED
@@ -16,6 +16,59 @@ npx cbrowser cognitive-effort --url "https://your-site.com" --persona first-time
16
16
 
17
17
  ---
18
18
 
19
+ ## 5-Minute Quickstart
20
+
21
+ Get from zero to your first cognitive insight in 3 commands:
22
+
23
+ ```bash
24
+ # 1. Install CBrowser
25
+ npm install cbrowser
26
+
27
+ # 2. Install the browser engine (~150MB)
28
+ npx playwright install chromium
29
+
30
+ # 3. Run your first cognitive audit
31
+ npx cbrowser cognitive-effort --url "https://your-site.com" --persona first-timer
32
+ ```
33
+
34
+ **What you get:** A cognitive transport score (0-1), abandonment risk percentage, and the UX bottleneck — in under 30 seconds.
35
+
36
+ **No API key needed** for basic commands (navigate, screenshot, click, extract, explore). Cognitive journeys require an Anthropic API key:
37
+
38
+ ```bash
39
+ npx cbrowser config set-api-key <your-anthropic-key>
40
+ ```
41
+
42
+ **Check your environment:** Run `npx cbrowser doctor` to verify everything is set up correctly.
43
+
44
+ **Accessibility:** CBrowser supports `--no-color` (or `NO_COLOR` env var), `--plain` (no emoji/decorations), and `--json-output` (structured JSON) for screen readers, CI pipelines, and scripting.
45
+
46
+ ---
47
+
48
+ ## Table of Contents
49
+
50
+ - [5-Minute Quickstart](#5-minute-quickstart)
51
+ - [Cognitive Transport Chain](#cognitive-transport-chain)
52
+ - [Visual Overlays & Attention Analysis](#visual-overlays--attention-analysis)
53
+ - [AI Friendliness Suite](#ai-friendliness-suite)
54
+ - [Cognitive User Simulation](#cognitive-user-simulation)
55
+ - [Accessibility Empathy Testing](#accessibility-empathy-testing)
56
+ - [Constitutional AI Safety](#constitutional-ai-safety)
57
+ - [Site Knowledge System](#site-knowledge-system)
58
+ - [Natural Language Testing](#natural-language-testing)
59
+ - [Visual Testing](#visual-testing)
60
+ - [Competitive UX Benchmark](#competitive-ux-benchmark)
61
+ - [Geo Proxy](#geo-proxy)
62
+ - [MCP Server Integration](#mcp-server-integration)
63
+ - [CI/CD Integration](#cicd-integration)
64
+ - [API Reference](#api-reference)
65
+ - [Configuration](#configuration)
66
+ - [Enterprise Edition](#enterprise-edition)
67
+ - [Contributing](#contributing)
68
+ - [License](#license)
69
+
70
+ ---
71
+
19
72
  ## Cognitive Transport Chain
20
73
 
21
74
  The 6-layer Sequential Transport Chain computes exactly how hard your page is for any persona — and predicts whether they'll abandon:
@@ -263,7 +316,7 @@ CBrowser runs as an MCP server for Claude Desktop and claude.ai.
263
316
  ### Remote MCP (claude.ai)
264
317
 
265
318
  **Public Demo Server** (rate-limited):
266
- ```
319
+ ```text
267
320
  https://demo.cbrowser.ai/mcp
268
321
  ```
269
322
 
package/dist/cli.js CHANGED
@@ -30,6 +30,8 @@ import { runCognitiveJourney, getAnthropicApiKey, setAnthropicApiKey, removeAnth
30
30
  import { getLightpandaStatus, LIGHTPANDA_SETUP_GUIDE, LIGHTPANDA_SECURITY_WARNING, isLightpandaConfigured, } from "./lightpanda.js";
31
31
  // Version from package.json - single source of truth
32
32
  import { VERSION } from "./version.js";
33
+ // Accessible output system (v18.54.0)
34
+ import { detectOutputOptions, setOutputOptions, getOutputOptions, installOutputWrappers, emitJson, } from "./output.js";
33
35
  // Node readline for interactive input
34
36
  import * as readline from "readline";
35
37
  /**
@@ -654,6 +656,12 @@ DIAGNOSTICS
654
656
  version, -v, --version Show version number
655
657
  status Show environment status and diagnostics
656
658
  Displays data directories, browsers, config, heal cache
659
+ doctor Check environment health (Node, Playwright, API key)
660
+
661
+ ACCESSIBILITY
662
+ --no-color Disable all color output (also respects NO_COLOR env var)
663
+ --plain Disable emoji, box-drawing, and unicode decorations
664
+ --json-output Output structured JSON (for scripts and screen readers)
657
665
 
658
666
  STORAGE & CLEANUP
659
667
  storage Show storage usage statistics
@@ -1030,6 +1038,121 @@ function generateTestSuiteHtmlReport(result) {
1030
1038
  </body>
1031
1039
  </html>`;
1032
1040
  }
1041
+ /**
1042
+ * Doctor command — validates environment health with pass/fail checks.
1043
+ * Checks: Node version, Playwright chromium, API key, data directory.
1044
+ */
1045
+ async function runDoctor(outputOpts) {
1046
+ const fs = await import("fs");
1047
+ const { execSync } = await import("child_process");
1048
+ const checks = [];
1049
+ // Check 1: Node.js version
1050
+ const nodeVersion = process.versions.node;
1051
+ const nodeMajor = parseInt(nodeVersion.split(".")[0], 10);
1052
+ if (nodeMajor >= 18) {
1053
+ checks.push({ name: "Node.js", status: "pass", message: `v${nodeVersion} (>= 18 required)` });
1054
+ }
1055
+ else {
1056
+ checks.push({
1057
+ name: "Node.js",
1058
+ status: "fail",
1059
+ message: `v${nodeVersion} (>= 18 required)`,
1060
+ fix: "Install Node.js 18+ from https://nodejs.org",
1061
+ });
1062
+ }
1063
+ // Check 2: Playwright chromium — verify binary exists without launching a full browser
1064
+ try {
1065
+ execSync("npx playwright install --dry-run chromium 2>&1", {
1066
+ encoding: "utf8",
1067
+ timeout: 15000,
1068
+ });
1069
+ checks.push({ name: "Playwright Chromium", status: "pass", message: "Installed" });
1070
+ }
1071
+ catch {
1072
+ checks.push({
1073
+ name: "Playwright Chromium",
1074
+ status: "fail",
1075
+ message: "Not installed or not launchable",
1076
+ fix: "Run: npx playwright install chromium",
1077
+ });
1078
+ }
1079
+ // Check 3: API key
1080
+ const hasApiKey = isApiKeyConfigured();
1081
+ if (hasApiKey) {
1082
+ checks.push({ name: "Anthropic API Key", status: "pass", message: "Configured" });
1083
+ }
1084
+ else {
1085
+ checks.push({
1086
+ name: "Anthropic API Key",
1087
+ status: "warn",
1088
+ message: "Not configured (cognitive features require it, basic commands work without it)",
1089
+ fix: "Run: cbrowser config set-api-key <your-key>",
1090
+ });
1091
+ }
1092
+ // Check 4: Data directory
1093
+ const dataDir = getDataDir();
1094
+ try {
1095
+ await fs.promises.access(dataDir, fs.constants.W_OK);
1096
+ checks.push({ name: "Data Directory", status: "pass", message: dataDir });
1097
+ }
1098
+ catch {
1099
+ checks.push({
1100
+ name: "Data Directory",
1101
+ status: "fail",
1102
+ message: `${dataDir} (not writable)`,
1103
+ fix: process.platform === "win32"
1104
+ ? "Check directory permissions in Properties"
1105
+ : `Run: sudo chown -R $USER:$USER ${dataDir}`,
1106
+ });
1107
+ }
1108
+ // Output results
1109
+ if (outputOpts.json) {
1110
+ const jsonResult = {
1111
+ success: checks.every(c => c.status !== "fail"),
1112
+ command: "doctor",
1113
+ data: { checks },
1114
+ meta: { version: VERSION },
1115
+ };
1116
+ emitJson(jsonResult);
1117
+ return;
1118
+ }
1119
+ const passSymbol = outputOpts.plain ? "[PASS]" : "✅";
1120
+ const failSymbol = outputOpts.plain ? "[FAIL]" : "❌";
1121
+ const warnSymbol = outputOpts.plain ? "[WARN]" : "⚠️";
1122
+ console.log("");
1123
+ console.log(outputOpts.plain
1124
+ ? `CBrowser Doctor v${VERSION}`
1125
+ : `🩺 CBrowser Doctor v${VERSION}`);
1126
+ console.log(outputOpts.plain ? "---" : "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
1127
+ for (const check of checks) {
1128
+ const symbol = check.status === "pass" ? passSymbol
1129
+ : check.status === "fail" ? failSymbol
1130
+ : warnSymbol;
1131
+ console.log(`${symbol} ${check.name}: ${check.message}`);
1132
+ if (check.fix) {
1133
+ console.log(` Fix: ${check.fix}`);
1134
+ }
1135
+ }
1136
+ console.log("");
1137
+ const failCount = checks.filter(c => c.status === "fail").length;
1138
+ const warnCount = checks.filter(c => c.status === "warn").length;
1139
+ if (failCount === 0 && warnCount === 0) {
1140
+ console.log(outputOpts.plain
1141
+ ? "All checks passed. CBrowser is ready."
1142
+ : "🎉 All checks passed. CBrowser is ready!");
1143
+ }
1144
+ else if (failCount === 0) {
1145
+ console.log(outputOpts.plain
1146
+ ? `All critical checks passed. ${warnCount} warning(s).`
1147
+ : `✅ All critical checks passed. ${warnCount} warning(s).`);
1148
+ }
1149
+ else {
1150
+ console.log(outputOpts.plain
1151
+ ? `${failCount} check(s) failed. Fix the issues above to use CBrowser.`
1152
+ : `❌ ${failCount} check(s) failed. Fix the issues above to use CBrowser.`);
1153
+ }
1154
+ console.log("");
1155
+ }
1033
1156
  function parseGeoLocation(location) {
1034
1157
  // Check if it's a preset
1035
1158
  if (LOCATION_PRESETS[location]) {
@@ -1048,10 +1171,19 @@ function parseGeoLocation(location) {
1048
1171
  }
1049
1172
  async function main() {
1050
1173
  const { command, args, options } = parseArgs(process.argv.slice(2));
1174
+ // Initialize accessible output system (v18.54.0)
1175
+ const outputOpts = detectOutputOptions(options);
1176
+ setOutputOptions(outputOpts);
1177
+ installOutputWrappers();
1051
1178
  if (command === "help" || options.help) {
1052
1179
  showHelp();
1053
1180
  process.exit(0);
1054
1181
  }
1182
+ // Doctor command - environment health check (v18.54.0)
1183
+ if (command === "doctor") {
1184
+ await runDoctor(outputOpts);
1185
+ process.exit(0);
1186
+ }
1055
1187
  // MCP Server mode - runs before browser instantiation
1056
1188
  if (command === "mcp-server") {
1057
1189
  console.error("🔌 Starting CBrowser MCP Server...");
@@ -5253,7 +5385,36 @@ Examples:
5253
5385
  process.exit(0);
5254
5386
  }
5255
5387
  main().catch((error) => {
5256
- console.error("Error:", error.message);
5388
+ const opts = getOutputOptions();
5389
+ if (opts.json) {
5390
+ const jsonError = {
5391
+ success: false,
5392
+ command: process.argv[2] || "unknown",
5393
+ error: {
5394
+ code: error.code || "E999",
5395
+ message: error.message,
5396
+ howToFix: error.howToFix,
5397
+ docUrl: error.docUrl,
5398
+ },
5399
+ meta: { version: VERSION },
5400
+ };
5401
+ emitJson(jsonError);
5402
+ process.exit(1);
5403
+ }
5404
+ // Enriched error output with remediation guidance
5405
+ if (error.howToFix) {
5406
+ console.error("");
5407
+ console.error(opts.plain ? `Error [${error.code}]: ${error.message}` : `❌ Error [${error.code}]: ${error.message}`);
5408
+ console.error("");
5409
+ console.error(opts.plain ? `How to fix: ${error.howToFix}` : `💡 How to fix: ${error.howToFix}`);
5410
+ if (error.docUrl) {
5411
+ console.error(opts.plain ? `Docs: ${error.docUrl}` : `📚 Docs: ${error.docUrl}`);
5412
+ }
5413
+ console.error("");
5414
+ }
5415
+ else {
5416
+ console.error("Error:", error.message);
5417
+ }
5257
5418
  process.exit(1);
5258
5419
  });
5259
5420
  //# sourceMappingURL=cli.js.map