@criogaid/pi-hashline-edit 0.13.0 → 0.15.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 (152) hide show
  1. package/README.md +18 -12
  2. package/README.zh-CN.md +18 -12
  3. package/package.json +8 -1
  4. package/src/core/AGENTS.md +3 -1
  5. package/src/core/apply.ts +110 -117
  6. package/src/core/character-set.ts +2 -3
  7. package/src/core/copy-span.ts +15 -0
  8. package/src/core/errors.ts +24 -9
  9. package/src/core/lines.ts +71 -17
  10. package/src/core/ranges.ts +5 -4
  11. package/src/core/replace-schema.ts +3 -1
  12. package/src/core/replace.ts +50 -29
  13. package/src/core/search-analysis.ts +21 -22
  14. package/src/core/search.ts +15 -32
  15. package/src/core/types.ts +3 -0
  16. package/src/index.ts +47 -39
  17. package/src/pi/AGENTS.md +30 -19
  18. package/src/pi/action-fusion.ts +284 -211
  19. package/src/pi/argument-diagnostics.ts +50 -37
  20. package/src/pi/argument-error.ts +2 -2
  21. package/src/pi/argument-validation.ts +163 -66
  22. package/src/pi/budgets.ts +12 -0
  23. package/src/pi/diagnostic-buffer.ts +12 -11
  24. package/src/pi/edit-tool.ts +138 -115
  25. package/src/pi/error-text.ts +10 -2
  26. package/src/pi/failure-context.ts +24 -37
  27. package/src/pi/file-commit.ts +131 -164
  28. package/src/pi/file-read.ts +122 -31
  29. package/src/pi/fusion-arguments.ts +214 -0
  30. package/src/pi/fusion-card.ts +102 -60
  31. package/src/pi/grep-candidates.ts +35 -22
  32. package/src/pi/grep-output.ts +197 -190
  33. package/src/pi/grep-render.ts +22 -13
  34. package/src/pi/grep-reread.ts +7 -6
  35. package/src/pi/grep-scope.ts +31 -16
  36. package/src/pi/grep-search.ts +56 -47
  37. package/src/pi/grep-tool.ts +35 -33
  38. package/src/pi/grep-worker.ts +3 -4
  39. package/src/pi/mutation-diff.ts +238 -0
  40. package/src/pi/mutation-result.ts +102 -79
  41. package/src/pi/mutation-runner.ts +107 -84
  42. package/src/pi/native-bash.ts +41 -0
  43. package/src/pi/path.ts +59 -6
  44. package/src/pi/read-tool.ts +173 -138
  45. package/src/pi/regex-worker.ts +14 -8
  46. package/src/pi/render.ts +101 -54
  47. package/src/pi/replace-regex.ts +1 -1
  48. package/src/pi/replace-tool.ts +14 -7
  49. package/src/pi/report-cause.ts +34 -17
  50. package/src/pi/report-schema.ts +184 -85
  51. package/src/pi/report.ts +133 -64
  52. package/src/pi/rg-process.ts +68 -48
  53. package/src/pi/schema.ts +4 -0
  54. package/src/pi/text-stream.ts +81 -87
  55. package/src/pi/workspace-cwd.js +2 -0
  56. package/src/pi/workspace.ts +46 -0
  57. package/src/pi/write-tool.ts +19 -13
  58. package/src/core/apply.test.ts +0 -644
  59. package/src/core/case-fold.test.ts +0 -35
  60. package/src/core/character-set.test.ts +0 -97
  61. package/src/core/errors.test.ts +0 -39
  62. package/src/core/hash.test.ts +0 -64
  63. package/src/core/lines.test.ts +0 -63
  64. package/src/core/ranges.test.ts +0 -123
  65. package/src/core/replace.test.ts +0 -187
  66. package/src/core/search-analysis.test.ts +0 -210
  67. package/src/core/search-matrix.test.ts +0 -64
  68. package/src/core/search-matrix.testing.ts +0 -171
  69. package/src/core/search.test.ts +0 -132
  70. package/src/core/text.test.ts +0 -52
  71. package/src/integration/config-registration.test.ts +0 -291
  72. package/src/integration/fusion-dispatch.test.ts +0 -320
  73. package/src/integration/grep-errors.test.ts +0 -81
  74. package/src/integration/grep-flags.test.ts +0 -76
  75. package/src/integration/grep-js-completeness.test.ts +0 -278
  76. package/src/integration/grep-line-candidates.test.ts +0 -201
  77. package/src/integration/grep-matrix.test.ts +0 -118
  78. package/src/integration/grep-order.test.ts +0 -78
  79. package/src/integration/grep-path-matrix.test.ts +0 -128
  80. package/src/integration/grep-prefilter-coverage.test.ts +0 -204
  81. package/src/integration/grep-process-limits.test.ts +0 -122
  82. package/src/integration/grep-regex.test.ts +0 -412
  83. package/src/integration/grep-rg.test.ts +0 -1659
  84. package/src/integration/grep-scan-budget.test.ts +0 -111
  85. package/src/integration/grep-translation.test.ts +0 -199
  86. package/src/integration/large-text.test.ts +0 -70
  87. package/src/integration/model-budget-lifecycle.test.ts +0 -186
  88. package/src/integration/mutation-file-types.test.ts +0 -30
  89. package/src/integration/mutation-file-types.testing.ts +0 -33
  90. package/src/integration/npm-package.test.ts +0 -19
  91. package/src/integration/npm-package.testing.ts +0 -243
  92. package/src/integration/publication-read-changes.test.ts +0 -454
  93. package/src/integration/read-changes.test.ts +0 -98
  94. package/src/integration/replace-package.test.ts +0 -22
  95. package/src/integration/replace-package.testing.ts +0 -36
  96. package/src/integration/replace-worker-boundary.test.ts +0 -127
  97. package/src/integration/report-replay.test.ts +0 -91
  98. package/src/integration/utf8-errors.test.ts +0 -46
  99. package/src/pi/action-fusion.test.ts +0 -659
  100. package/src/pi/action-fusion.testing.ts +0 -38
  101. package/src/pi/anchor-format.test.ts +0 -124
  102. package/src/pi/argument-error.testing.ts +0 -46
  103. package/src/pi/argument-format.test.ts +0 -196
  104. package/src/pi/argument-validation.test.ts +0 -1007
  105. package/src/pi/codemode.test.ts +0 -101
  106. package/src/pi/config.test.ts +0 -204
  107. package/src/pi/diagnostic-buffer.test.ts +0 -115
  108. package/src/pi/directory-sync.test.ts +0 -57
  109. package/src/pi/execute.test.ts +0 -1257
  110. package/src/pi/extension-loading.test.ts +0 -14
  111. package/src/pi/extension-loading.testing.ts +0 -3
  112. package/src/pi/failure-context.test.ts +0 -370
  113. package/src/pi/failure-path.test.ts +0 -289
  114. package/src/pi/file-commit.test.ts +0 -628
  115. package/src/pi/file-read.test.ts +0 -29
  116. package/src/pi/file-snapshot.test.ts +0 -22
  117. package/src/pi/fusion-card-interaction.test.ts +0 -143
  118. package/src/pi/fusion-card.test.ts +0 -353
  119. package/src/pi/grep-candidates.test.ts +0 -26
  120. package/src/pi/grep-matrix.test.ts +0 -68
  121. package/src/pi/grep-order.test.ts +0 -447
  122. package/src/pi/grep-output.testing.ts +0 -24
  123. package/src/pi/grep-rg.testing.ts +0 -73
  124. package/src/pi/grep.test.ts +0 -1670
  125. package/src/pi/model-budgets.test.ts +0 -96
  126. package/src/pi/mutation-outcome.testing.ts +0 -20
  127. package/src/pi/mutation-result.test.ts +0 -96
  128. package/src/pi/output-budgets.test.ts +0 -221
  129. package/src/pi/pi.test.ts +0 -158
  130. package/src/pi/read-delegation.test.ts +0 -119
  131. package/src/pi/read.test.ts +0 -735
  132. package/src/pi/regex-worker.test.ts +0 -42
  133. package/src/pi/registration.test.ts +0 -549
  134. package/src/pi/render.test.ts +0 -841
  135. package/src/pi/replace.test.ts +0 -634
  136. package/src/pi/report-failure.testing.ts +0 -27
  137. package/src/pi/report.test.ts +0 -533
  138. package/src/pi/result-safety.test.ts +0 -597
  139. package/src/pi/rg-process.test.ts +0 -133
  140. package/src/pi/rg-regex.test.ts +0 -40
  141. package/src/pi/text-stream.test.ts +0 -281
  142. package/src/pi/tool-call.testing.ts +0 -61
  143. package/src/pi/tool-factories.testing.ts +0 -59
  144. package/src/pi/write.test.ts +0 -256
  145. package/src/testing/extension-loader.testing.ts +0 -24
  146. package/src/testing/installation.testing.ts +0 -77
  147. package/src/testing/process.testing.ts +0 -33
  148. package/src/testing/regex-host.testing.ts +0 -20
  149. package/src/testing/regex-translation-corpus.ts +0 -267
  150. package/src/testing/rg-line-listing.fixture.mjs +0 -7
  151. package/src/testing/run-tests.ts +0 -47
  152. package/src/testing/session.testing.ts +0 -127
@@ -4,13 +4,8 @@
4
4
  *
5
5
  * @module pi-hashline-edit/pi
6
6
  */
7
- import { createReadStream } from "node:fs";
8
7
  import { createUtf8Decoder, Utf8DecodingError, type Utf8Decoding } from "../core/text.ts";
9
- import { throwIfCancelled } from "./error-text.ts";
10
- import { withFileRead } from "./file-read.ts";
11
- import { createRevisionHasher } from "./file-revision.ts";
12
-
13
- const TEXT_READ_CHUNK_BYTES = 64 * 1024;
8
+ import { readFileRevision } from "./file-read.ts";
14
9
 
15
10
  /**
16
11
  * Scan whole-file bytes; lossy decoding reports validity without rejecting malformed UTF-8.
@@ -20,116 +15,115 @@ export async function scanTextFile(
20
15
  path: string,
21
16
  options: {
22
17
  readonly onChunk?: (text: string, bytesRead: number) => void | Promise<void>;
23
- readonly signal?: AbortSignal;
18
+ readonly signal: AbortSignal;
24
19
  readonly decoding?: Utf8Decoding;
25
- } = {},
20
+ },
26
21
  ) {
27
22
  const { onChunk, signal, decoding = "strict" } = options;
28
- return withFileRead(path, signal, async (handle) => {
29
- const decode = createUtf8Decoder();
30
- // Strict decoding always decides validity; lossy text is decoded only for a chunk consumer.
31
- const lossy = decoding === "lossy" && onChunk ? createUtf8Decoder("lossy") : undefined;
32
- const revision = createRevisionHasher();
33
- let byteLength = 0;
34
- let lineFeeds = 0;
35
- let lastByte = -1;
36
- let hasNul = false;
37
- let decodingError: unknown;
38
- /** Strict text of a chunk, or of the final flush without bytes; undefined once malformed. */
39
- const decodeStrict = (bytes?: Buffer): string | undefined => {
40
- if (decodingError) return undefined;
41
- try {
42
- return decode(bytes, bytes !== undefined);
43
- } catch (error) {
44
- if (!(error instanceof Utf8DecodingError)) throw error;
45
- decodingError = error;
46
- return undefined;
47
- }
48
- };
49
- const stream = createReadStream(path, {
50
- fd: handle,
51
- autoClose: false,
52
- highWaterMark: TEXT_READ_CHUNK_BYTES,
53
- signal,
54
- });
23
+ const decode = createUtf8Decoder();
24
+ // Strict decoding always decides validity; lossy text is decoded only for a chunk consumer.
25
+ const lossy =
26
+ decoding === "lossy" && onChunk ? { decode: createUtf8Decoder("lossy"), onChunk } : undefined;
27
+ let byteLength = 0;
28
+ let lineFeeds = 0;
29
+ let lastByte = -1;
30
+ let hasNul = false;
31
+ let decodingError: Utf8DecodingError | undefined;
32
+ /** Strict text of a chunk, or of the final flush without bytes; undefined once malformed. */
33
+ const decodeStrict = (bytes?: Buffer): string | undefined => {
34
+ if (decodingError) return undefined;
55
35
  try {
56
- for await (const chunk of stream) {
57
- const bytes = chunk as Buffer;
58
- revision.update(bytes);
59
- byteLength += bytes.length;
60
- hasNul ||= bytes.includes(0);
61
- lastByte = bytes[bytes.length - 1];
62
- let offset = 0;
63
- while ((offset = bytes.indexOf(10, offset)) !== -1) {
64
- lineFeeds++;
65
- offset++;
66
- }
67
- // NUL takes precedence even when an earlier chunk contained malformed UTF-8.
68
- if (hasNul) continue;
69
- let text = decodeStrict(bytes);
70
- if (lossy) text = lossy(bytes, true);
71
- if (text !== undefined) await onChunk?.(text, byteLength);
72
- }
36
+ return decode(bytes, bytes !== undefined);
73
37
  } catch (error) {
74
- // Node's stream abort raises its own AbortError; report the shared cancellation text.
75
- throwIfCancelled(signal);
76
- throw error;
38
+ if (!(error instanceof Utf8DecodingError)) throw error;
39
+ decodingError = error;
40
+ return undefined;
77
41
  }
78
- throwIfCancelled(signal);
79
- if (!hasNul) {
42
+ };
43
+ const revision = await readFileRevision(path, signal, {
44
+ extent: "eof",
45
+ onChunk(bytes) {
46
+ byteLength += bytes.length;
47
+ hasNul ||= bytes.includes(0);
48
+ lastByte = bytes[bytes.length - 1];
49
+ let offset = 0;
50
+ while ((offset = bytes.indexOf(10, offset)) !== -1) {
51
+ lineFeeds++;
52
+ offset++;
53
+ }
54
+ // NUL takes precedence even when an earlier chunk contained malformed UTF-8.
55
+ if (hasNul) return;
56
+ const text = decodeStrict(bytes);
57
+ if (lossy) {
58
+ const { decode, onChunk } = lossy;
59
+ return onChunk(decode(bytes, true), byteLength);
60
+ }
61
+ if (text !== undefined) return onChunk?.(text, byteLength);
62
+ },
63
+ onEnd() {
64
+ if (hasNul) return;
80
65
  let tail = decodeStrict();
81
- if (lossy) tail = lossy();
82
- else if (decodingError && decoding === "strict") throw decodingError;
83
- if (tail) await onChunk?.(tail, byteLength);
84
- }
85
- return {
86
- revision: revision.digest(),
87
- totalLines: lineFeeds + (lastByte !== -1 && lastByte !== 10 ? 1 : 0),
88
- finalNewline: lastByte === -1 || lastByte === 10,
89
- hasNul,
90
- validUtf8: !decodingError,
91
- };
66
+ if (lossy) tail = lossy.decode();
67
+ if (tail) return onChunk?.(tail, byteLength);
68
+ },
92
69
  });
70
+ // A changed observation or a NUL anywhere takes precedence over an encoding error.
71
+ if (decoding === "strict" && !hasNul && decodingError) throw decodingError;
72
+ return {
73
+ revision,
74
+ totalLines: lineFeeds + (lastByte !== -1 && lastByte !== 10 ? 1 : 0),
75
+ finalNewline: lastByte === -1 || lastByte === 10,
76
+ hasNul,
77
+ validUtf8: !decodingError,
78
+ };
93
79
  }
94
80
 
95
81
  interface ScannedLine {
96
82
  readonly number: number;
97
83
  readonly byteLength: number;
98
84
  readonly carriageReturns: number;
99
- /** Absent when the selected line exceeds maxLineBytes. */
100
- readonly text: string | undefined;
85
+ readonly text: string;
86
+ }
87
+
88
+ /** A bound on the bytes retained per line, and what receives a selected line beyond it. */
89
+ interface LineBound {
90
+ readonly maxBytes: number;
91
+ /** Called for a selected line longer than maxBytes, in place of onLine. */
92
+ readonly onExceeded: () => void;
101
93
  }
102
94
 
103
- /** Visit selected logical lines, retaining at most maxLineBytes of content per line. */
95
+ /** Visit selected logical lines; with a bound, a longer line goes to its onExceeded. */
104
96
  export async function scanTextLines(
105
97
  path: string,
106
98
  select: (number: number) => boolean,
107
99
  onLine: (line: ScannedLine) => void,
108
100
  options: {
109
- readonly signal?: AbortSignal;
110
- readonly maxLineBytes?: number;
101
+ readonly signal: AbortSignal;
111
102
  readonly decoding?: Utf8Decoding;
103
+ readonly bound?: LineBound;
112
104
  },
113
105
  ) {
114
- const { signal, decoding, maxLineBytes: maxBytes = Infinity } = options;
106
+ const { signal, decoding, bound } = options;
107
+ const maxBytes = bound ? bound.maxBytes : Infinity;
115
108
  let number = 1;
116
109
  let byteLength = 0;
117
110
  let carriageReturns = 0;
118
111
  let parts: string[] = [];
119
112
  let selected = select(number);
120
113
  let lastChar = "";
121
- const finish = (terminated: boolean) => {
114
+ const finish = (terminatorCrBytes: 0 | 1) => {
122
115
  if (selected) {
123
- const stripCr = terminated && lastChar === "\r";
124
- const logicalBytes = byteLength - (stripCr ? 1 : 0);
125
- let text = logicalBytes <= maxBytes ? parts.join("") : undefined;
126
- if (stripCr && text !== undefined) text = text.slice(0, -1);
127
- onLine({
128
- number,
129
- byteLength: logicalBytes,
130
- carriageReturns: carriageReturns - (stripCr ? 1 : 0),
131
- text,
132
- });
116
+ const logicalBytes = byteLength - terminatorCrBytes;
117
+ if (bound && logicalBytes > bound.maxBytes) bound.onExceeded();
118
+ else {
119
+ const text = parts.join("");
120
+ onLine({
121
+ number,
122
+ byteLength: logicalBytes,
123
+ carriageReturns: carriageReturns - terminatorCrBytes,
124
+ text: terminatorCrBytes === 0 ? text : text.slice(0, -terminatorCrBytes),
125
+ });
126
+ }
133
127
  carriageReturns = 0;
134
128
  byteLength = 0;
135
129
  parts = [];
@@ -160,11 +154,11 @@ export async function scanTextLines(
160
154
  else parts = [];
161
155
  }
162
156
  if (lf === -1) break;
163
- finish(true);
157
+ finish(lastChar === "\r" ? 1 : 0);
164
158
  start = lf + 1;
165
159
  }
166
160
  },
167
161
  });
168
- if (!stats.hasNul && byteLength > 0) finish(false);
162
+ if (!stats.hasNul && byteLength > 0) finish(0);
169
163
  return stats;
170
164
  }
@@ -0,0 +1,2 @@
1
+ // Emit ASCII so the host can decode Unicode paths without relying on a Windows code page.
2
+ WScript.StdOut.Write(encodeURIComponent(WScript.CreateObject("WScript.Shell").CurrentDirectory));
@@ -0,0 +1,46 @@
1
+ import { isAbsolute, join } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import type { ExecResult, ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
+
5
+ function workspaceFrom(result: ExecResult, cwd: string): string | undefined {
6
+ if (result.code === 0 && !result.killed && !result.truncated && isAbsolute(cwd)) return cwd;
7
+ }
8
+
9
+ /** Ask the OS in the loader's cwd without starting Node with the host's preloads. */
10
+ export async function resolveWorkspace(pi: Pick<ExtensionAPI, "exec">): Promise<string> {
11
+ let result: ExecResult;
12
+ let stdout: string;
13
+ if (process.platform === "win32") {
14
+ const system32 = join(process.env.SystemRoot ?? "C:\\Windows", "System32");
15
+ const script = fileURLToPath(new URL("./workspace-cwd.js", import.meta.url));
16
+ const probe = await pi.exec(join(system32, "cscript.exe"), [
17
+ "//B",
18
+ "//NoLogo",
19
+ "//E:JScript",
20
+ script,
21
+ ]);
22
+ try {
23
+ const cwd = workspaceFrom(probe, decodeURIComponent(probe.stdout));
24
+ if (cwd !== undefined) return cwd;
25
+ } catch (error) {
26
+ // If the script host emits a diagnostic on stdout, the payload may not be URI-encoded.
27
+ if (!(error instanceof URIError)) throw error;
28
+ }
29
+ result = await pi.exec(join(system32, "WindowsPowerShell/v1.0/powershell.exe"), [
30
+ "-NoProfile",
31
+ "-NonInteractive",
32
+ "-Command",
33
+ "[Console]::OutputEncoding = [Text.UTF8Encoding]::new($false); [Console]::Write([Environment]::CurrentDirectory)",
34
+ ]);
35
+ stdout = result.stdout;
36
+ } else {
37
+ result = await pi.exec("/bin/pwd", ["-P"]);
38
+ stdout = result.stdout.replace(/\n$/, "");
39
+ }
40
+
41
+ const cwd = workspaceFrom(result, stdout);
42
+ if (cwd !== undefined) return cwd;
43
+ throw new Error(`Unable to resolve the Pi workspace (exit ${result.code})`, {
44
+ cause: result.stderr || undefined,
45
+ });
46
+ }
@@ -6,14 +6,20 @@ import {
6
6
  type Theme,
7
7
  type ToolRenderResultOptions,
8
8
  } from "@earendil-works/pi-coding-agent";
9
- import { commitFile } from "./file-commit.ts";
10
9
  import { mutationToolBase, type MutationToolEnvironment } from "./mutation-runner.ts";
11
10
  import { throwIfCancelled } from "./error-text.ts";
12
11
  import { unwritableTextError } from "../core/text.ts";
13
- import { MUTATION_CARD_SHOWN, reportLines, renderToolError, splitReport } from "./render.ts";
12
+ import {
13
+ MUTATION_CARD_SHOWN,
14
+ NO_NET_CHANGE,
15
+ reportLines,
16
+ renderToolError,
17
+ splitReport,
18
+ } from "./render.ts";
14
19
  import type { MutationOutcome } from "./mutation-result.ts";
15
20
  import type { ReportDetails } from "./report.ts";
16
21
  import { filePathField } from "./schema.ts";
22
+ import { noArgumentProduct } from "./argument-validation.ts";
17
23
 
18
24
  const writeSchema = Type.Object(
19
25
  {
@@ -32,8 +38,6 @@ const writeSchema = Type.Object(
32
38
  type WriteParams = Static<typeof writeSchema>;
33
39
  /** write shows the built-in card; its report states every fact. */
34
40
  type WriteMutationDetails = object;
35
- /** The write card's call line shows the content. */
36
- const WRITE_CARD_SHOWN = new Set([...MUTATION_CARD_SHOWN, "publication"]);
37
41
  type WriteRenderContext = Parameters<
38
42
  NonNullable<ReturnType<typeof createWriteToolDefinition>["renderCall"]>
39
43
  >[2];
@@ -52,20 +56,18 @@ export function makeWriteOverride(env: MutationToolEnvironment) {
52
56
  const content = (args as { content?: unknown } | null)?.content;
53
57
  const unwritable = typeof content === "string" ? unwritableTextError(content) : undefined;
54
58
  if (unwritable) report("content", unwritable.message);
59
+ return noArgumentProduct;
55
60
  },
56
61
  async run(
57
62
  params,
58
- { absolutePath, signal },
63
+ { publish, signal },
59
64
  ): Promise<MutationOutcome<WriteMutationDetails, "write">> {
60
65
  throwIfCancelled(signal);
61
- const commit = await commitFile(absolutePath, params.content, {
62
- mode: params.mode,
63
- signal,
64
- });
66
+ const commit = await publish(params.content, { mode: params.mode });
65
67
  return {
66
68
  commit,
67
69
  details: {},
68
- facts: {},
70
+ facts: { tool: "write" },
69
71
  };
70
72
  },
71
73
  }),
@@ -78,10 +80,14 @@ export function makeWriteOverride(env: MutationToolEnvironment) {
78
80
  theme: Theme,
79
81
  context: WriteRenderContext,
80
82
  ) {
81
- if (context.isError) return renderToolError(result, "write", theme, options.expanded);
83
+ if (context.isError)
84
+ return renderToolError(result, "write", theme, options.expanded, context);
82
85
  const { report } = splitReport(result, "write");
83
- const facts = report ? reportLines(report, theme, WRITE_CARD_SHOWN) : [];
84
- if (facts.length) return new Text(facts.join("\n"), 0, 0);
86
+ const lines = [
87
+ ...(report?.publication === "NOT_PUBLISHED" ? [theme.fg("success", NO_NET_CHANGE)] : []),
88
+ ...(report ? reportLines(report, theme, MUTATION_CARD_SHOWN) : []),
89
+ ];
90
+ if (lines.length) return new Text(lines.join("\n"), 0, 0);
85
91
  return builtin.renderResult!({ ...result, details: undefined }, options, theme, context);
86
92
  },
87
93
  };