cbrowser 20.1.3 → 20.2.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
@@ -35,7 +35,7 @@ import { getStatusInfo, formatStatus, getDataDir, getPaths } from "./config.js";
35
35
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
36
36
  import { resolveCookieDomain, hostFromUrl } from "./utils.js";
37
37
  import { dirname, join, resolve } from "node:path";
38
- import { guardConsole, guardTerminalOutput } from "./terminal-safe.js";
38
+ import { guardConsole, guardTerminalOutput, setTerminalHyperlinks } from "./terminal-safe.js";
39
39
  import { evaluateScript } from "./eval-script.js";
40
40
  import { VideoCaptureSession } from "./recording/engine.js";
41
41
  import { changeSignal, parseManifest } from "./recording/types.js";
@@ -2745,8 +2745,6 @@ function rewriteScroll(parsed) {
2745
2745
  }
2746
2746
  async function main() {
2747
2747
  const parsed = parseArgs(process.argv.slice(2));
2748
- for (const note of parsed.notes ?? [])
2749
- console.error(`Note: ${note}`);
2750
2748
  const { command, args, options } = rewriteScroll(parsed);
2751
2749
  // Initialize accessible output system (v18.54.0)
2752
2750
  const outputOpts = detectOutputOptions(options);
@@ -2758,6 +2756,16 @@ async function main() {
2758
2756
  guardTerminalOutput(process.stdout);
2759
2757
  guardTerminalOutput(process.stderr);
2760
2758
  guardConsole();
2759
+ // Every URL printed is a hyperlink to itself on a terminal (src/terminal-safe.ts):
2760
+ // never with --json, --json-output, --plain or TERM=dumb, and not when piped
2761
+ // unless CBROWSER_HYPERLINKS=1. CBROWSER_HYPERLINKS=0 turns them off. (2026-10-23)
2762
+ const linksEnv = process.env.CBROWSER_HYPERLINKS;
2763
+ const linksFor = (s) => linksEnv !== "0" && !outputOpts.plain && options.json !== true
2764
+ && process.env.TERM !== "dumb" && (linksEnv === "1" || s.isTTY === true);
2765
+ setTerminalHyperlinks({ stdout: linksFor(process.stdout), stderr: linksFor(process.stderr) });
2766
+ // After the guards, so a note quoting the user's own words is escaped too.
2767
+ for (const note of parsed.notes ?? [])
2768
+ console.error(`Note: ${note}`);
2761
2769
  // --json-output must never leave stdout empty. Only two commands in this file
2762
2770
  // call emitJson, so without this every other command printed nothing at all and
2763
2771
  // still exited 0 — a CI step piping to jq saw empty input beside a success code.