@wrongstack/cli 0.309.0 → 0.309.1

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.
@@ -3,8 +3,8 @@ import {
3
3
  loadCachedAcpRegistry,
4
4
  refreshAcpRegistry,
5
5
  setupProvider
6
- } from "./chunk-JQURRYU4.js";
7
- import "./chunk-SSSJQVUY.js";
6
+ } from "./chunk-UINEP3E7.js";
7
+ import "./chunk-XQ6FI2K6.js";
8
8
  import "./chunk-SZ42FYPT.js";
9
9
  import "./chunk-7OCVIDC7.js";
10
10
 
@@ -911,4 +911,4 @@ ${renderAcpBenchText(result)}
911
911
  export {
912
912
  acpCmd
913
913
  };
914
- //# sourceMappingURL=acp-5ZLGFHWP.js.map
914
+ //# sourceMappingURL=acp-7NWCC2GO.js.map
@@ -13,7 +13,7 @@ import {
13
13
  runOAuthLoginKind,
14
14
  runOAuthLoginMenu,
15
15
  validateFamily
16
- } from "./chunk-7JOMY3HO.js";
16
+ } from "./chunk-ZRZ54GVL.js";
17
17
  import {
18
18
  restoreFlags
19
19
  } from "./chunk-CSAPOCBP.js";
@@ -29,7 +29,7 @@ import "./chunk-VUVOMXWP.js";
29
29
  import {
30
30
  activeProfileConfigPath
31
31
  } from "./chunk-YMXXOOFN.js";
32
- import "./chunk-SSSJQVUY.js";
32
+ import "./chunk-XQ6FI2K6.js";
33
33
  import {
34
34
  loadConfigProviders,
35
35
  maskedKey,
@@ -596,4 +596,4 @@ async function runAuthRemove(deps, providerId) {
596
596
  export {
597
597
  authCmd
598
598
  };
599
- //# sourceMappingURL=auth-WOKC2RVG.js.map
599
+ //# sourceMappingURL=auth-GZ2FK5KR.js.map
@@ -31,18 +31,6 @@ export interface LoopbackCallback {
31
31
  /** The OAuth state parameter from the callback (validated against expected). */
32
32
  state: string;
33
33
  }
34
- /**
35
- * Open a URL in the user's default browser. Best-effort — never throws.
36
- *
37
- * - Windows: `cmd /c start "" <url>`
38
- * - macOS: `open <url>`
39
- * - Linux: `xdg-open <url>`
40
- *
41
- * Not `detached`: the CLI flows wait on the loopback callback in the
42
- * foreground, so the opener is a short-lived handoff. (The WebUI server's
43
- * `openBrowser` is deliberately different — it detaches and registers the pid
44
- * as protected because it launches a browser the session must outlive.)
45
- */
46
34
  export declare function openBrowser(url: string): void;
47
35
  /**
48
36
  * Start a loopback HTTP server for the OAuth authorization-code callback.
@@ -2,7 +2,7 @@ import {
2
2
  fallbackCodexProviderModels,
3
3
  filterCurrentCodexModelIds,
4
4
  isCodexCatalogModel
5
- } from "./chunk-SSSJQVUY.js";
5
+ } from "./chunk-XQ6FI2K6.js";
6
6
 
7
7
  // src/acp-registry-cache.ts
8
8
  import * as fs from "node:fs/promises";
@@ -214,4 +214,4 @@ export {
214
214
  setupProvider,
215
215
  createGracefulShutdown
216
216
  };
217
- //# sourceMappingURL=chunk-JQURRYU4.js.map
217
+ //# sourceMappingURL=chunk-UINEP3E7.js.map
@@ -4,20 +4,27 @@ import {
4
4
 
5
5
  // src/permission-prompt.ts
6
6
  import { alwaysAllowUnavailableReason } from "@wrongstack/core/security";
7
- import { color as color2, truncate, unifiedDiff, writeOut } from "@wrongstack/core/utils";
7
+ import {
8
+ color as color2,
9
+ sanitizeTerminalPreview,
10
+ sanitizeTerminalText as sanitizeTerminalText2,
11
+ truncate,
12
+ unifiedDiff,
13
+ writeOut
14
+ } from "@wrongstack/core/utils";
8
15
 
9
16
  // src/diff-renderer.ts
10
- import { color } from "@wrongstack/core/utils";
17
+ import { color, sanitizeTerminalText } from "@wrongstack/core/utils";
18
+ function diffLineStyle(line) {
19
+ if (line.startsWith("+++") || line.startsWith("---")) return color.bold(line);
20
+ if (line.startsWith("@@")) return color.cyan(line);
21
+ if (line.startsWith("+")) return color.green(line);
22
+ if (line.startsWith("-")) return color.red(line);
23
+ return color.dim(line);
24
+ }
11
25
  function renderDiff(diff) {
12
26
  if (!diff) return "";
13
- const lines = diff.split("\n");
14
- return lines.map((line) => {
15
- if (line.startsWith("+++") || line.startsWith("---")) return color.bold(line);
16
- if (line.startsWith("@@")) return color.cyan(line);
17
- if (line.startsWith("+")) return color.green(line);
18
- if (line.startsWith("-")) return color.red(line);
19
- return color.dim(line);
20
- }).join("\n");
27
+ return sanitizeTerminalText(diff).split("\n").map(diffLineStyle).join("\n");
21
28
  }
22
29
 
23
30
  // src/permission-prompt.ts
@@ -46,7 +53,7 @@ ${theme.warn("\u26A0 APPROVAL REQUIRED")} ${theme.primary("\u2502")} ${theme.bol
46
53
  ...noAlwaysReason ? [] : [{ key: "a", label: "always", value: "always" }],
47
54
  { key: "d", label: "deny", value: "deny" }
48
55
  ];
49
- const alwaysHint = noAlwaysReason ? "" : ` ${theme.bold("[a]")}lways allow (${suggestedPattern})`;
56
+ const alwaysHint = noAlwaysReason ? "" : ` ${theme.bold("[a]")}lways allow (${sanitizeTerminalText2(suggestedPattern)})`;
50
57
  const answer = await reader.readKey(
51
58
  `${theme.bold("[y]")}es ${theme.bold("[n]")}o${alwaysHint} ${theme.bold("[d]")}eny: `,
52
59
  options
@@ -64,17 +71,22 @@ function makeConfirmAwaiter(reader) {
64
71
  function stringifyInput(input) {
65
72
  if (!input || typeof input !== "object") return "";
66
73
  const obj = input;
67
- return Object.entries(obj).filter(([k]) => k !== "content" && k !== "new_string").map(([k, v]) => `${k}: ${truncate(JSON.stringify(v), 80)}`).join(" ");
74
+ return Object.entries(obj).filter(([k]) => k !== "content" && k !== "new_string").map(([k, v]) => `${k}: ${truncate(sanitizeTerminalText2(JSON.stringify(v)), 80)}`).join(" ");
68
75
  }
69
76
  var PREVIEW_MAX_LINES = 40;
70
- function clipPreview(body) {
71
- const lines = body.split("\n");
72
- if (lines.length <= PREVIEW_MAX_LINES) return body;
73
- const hidden = lines.length - PREVIEW_MAX_LINES;
74
- return `${lines.slice(0, PREVIEW_MAX_LINES).join("\n")}
75
- ${color2.dim(
76
- `\u2026 ${hidden} more line${hidden === 1 ? "" : "s"} not shown \u2014 review the file before approving`
77
- )}`;
77
+ var PREVIEW_MAX_CHARS = 8e3;
78
+ function clipPreview(body, decorate = (l) => l) {
79
+ const safe = sanitizeTerminalText2(body);
80
+ const { text, truncated } = sanitizeTerminalPreview(body, {
81
+ maxLines: PREVIEW_MAX_LINES,
82
+ maxChars: PREVIEW_MAX_CHARS
83
+ });
84
+ const rendered = text.split("\n").map(decorate).join("\n");
85
+ if (!truncated) return rendered;
86
+ const hiddenLines = safe.split("\n").length - text.split("\n").length;
87
+ const detail = hiddenLines > 0 ? `${hiddenLines} more line${hiddenLines === 1 ? "" : "s"} not shown` : `${safe.length - text.length} more characters not shown`;
88
+ return `${rendered}
89
+ ${color2.dim(`\u2026 ${detail} \u2014 review the file before approving`)}`;
78
90
  }
79
91
  function renderPayloadPreview(input) {
80
92
  if (!input || typeof input !== "object") return "";
@@ -87,17 +99,15 @@ function renderPayloadPreview(input) {
87
99
  toFile: "after",
88
100
  context: 2
89
101
  });
90
- return diff2 ? clipPreview(renderDiff(diff2)) : color2.dim("(replacement is identical)");
102
+ return diff2 ? clipPreview(diff2, diffLineStyle) : color2.dim("(replacement is identical)");
91
103
  }
92
104
  const content = obj["content"];
93
105
  if (typeof content === "string") {
94
106
  if (content === "") return color2.dim("(writes an empty file)");
95
- return clipPreview(
96
- content.split("\n").map((line) => color2.dim("\u2502 ") + line).join("\n")
97
- );
107
+ return clipPreview(content, (line) => color2.dim("\u2502 ") + line);
98
108
  }
99
109
  const diff = obj["diff"];
100
- return typeof diff === "string" && diff ? clipPreview(renderDiff(diff)) : "";
110
+ return typeof diff === "string" && diff ? clipPreview(diff, diffLineStyle) : "";
101
111
  }
102
112
 
103
113
  // src/boot/simpleui-full-auto.ts
@@ -473,4 +483,4 @@ export {
473
483
  detectProjectFacts,
474
484
  renderAgentsTemplate
475
485
  };
476
- //# sourceMappingURL=chunk-DOJLAULS.js.map
486
+ //# sourceMappingURL=chunk-WOTGMHAH.js.map
@@ -32,7 +32,20 @@ import {
32
32
  startLoopbackServer as startSharedLoopbackServer
33
33
  } from "@wrongstack/providers/oauth";
34
34
  import { callbackHtml } from "@wrongstack/providers/oauth";
35
+ var URL_METACHAR_REGEX = /[&|;<>(){}^"'`%\n\r\0]/;
36
+ function isSafeBrowserUrl(url) {
37
+ if (URL_METACHAR_REGEX.test(url)) return false;
38
+ try {
39
+ const parsed = new URL(url);
40
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
35
45
  function openBrowser(url) {
46
+ if (!isSafeBrowserUrl(url)) {
47
+ return;
48
+ }
36
49
  try {
37
50
  const platform = process.platform;
38
51
  const { command, args } = platform === "win32" ? { command: "cmd", args: ["/c", "start", "", url] } : platform === "darwin" ? { command: "open", args: [url] } : { command: "xdg-open", args: [url] };
@@ -246,4 +259,4 @@ export {
246
259
  filterCurrentCodexModelIds,
247
260
  isCodexCatalogModel
248
261
  };
249
- //# sourceMappingURL=chunk-SSSJQVUY.js.map
262
+ //# sourceMappingURL=chunk-XQ6FI2K6.js.map
@@ -6,7 +6,7 @@ import {
6
6
  openBrowser,
7
7
  runCodexOAuthLogin,
8
8
  startLoopbackServer
9
- } from "./chunk-SSSJQVUY.js";
9
+ } from "./chunk-XQ6FI2K6.js";
10
10
  import {
11
11
  activeLabel,
12
12
  loadConfigProviders,
@@ -1374,4 +1374,4 @@ export {
1374
1374
  addCustomProvider,
1375
1375
  addKeyForProvider
1376
1376
  };
1377
- //# sourceMappingURL=chunk-7JOMY3HO.js.map
1377
+ //# sourceMappingURL=chunk-ZRZ54GVL.js.map