xonecas.io
64875
Mc

mini-coder / commit d484091

refactor(cli): split tool rendering and compact shell logs

xonecas2026-03-14 d484091bce7096bd7f266a743a3f7dbe7f9313a6 parent fe08402

4 files changed

src/cli/tool-render-call.test.ts+33−0
@@ -0,0 +1,33 @@
1+import { describe, expect, test } from "bun:test";
2+import { buildToolCallLine } from "./tool-render-call.ts";
3+
4+describe("buildToolCallLine", () => {
5+ test("formats shell calls with truncated command previews", () => {
6+ const line = buildToolCallLine("shell", {
7+ command: "echo x".repeat(30),
8+ });
9+ expect(line).toContain("$");
10+ expect(line).toContain("echo x");
11+ expect(line).toContain("…");
12+ });
13+
14+ test("formats read calls with line and count range", () => {
15+ const line = buildToolCallLine("read", {
16+ path: "src/index.ts",
17+ line: 12,
18+ count: 25,
19+ });
20+ expect(line).toContain("read");
21+ expect(line).toContain("src/index.ts");
22+ expect(line).toContain(":12+25");
23+ });
24+
25+ test("formats subagent calls with agent label", () => {
26+ const line = buildToolCallLine("subagent", {
27+ agentName: "reviewer",
28+ prompt: "Review this diff",
29+ });
30+ expect(line).toContain("[@reviewer]");
31+ expect(line).toContain("Review this diff");
32+ });
33+});
src/cli/tool-render-call.ts+63−0
@@ -0,0 +1,63 @@
1+import * as c from "yoctocolors";
2+import { G } from "./output.ts";
3+
4+function toolGlyph(name: string): string {
5+ if (name === "read") return G.read;
6+ if (name === "create" || name === "replace" || name === "insert")
7+ return G.write;
8+ if (name === "shell") return G.run;
9+ if (name === "subagent") return G.agent;
10+ if (name.startsWith("mcp_")) return G.mcp;
11+ return G.info;
12+}
13+
14+export function buildToolCallLine(name: string, args: unknown): string {
15+ const a =
16+ args && typeof args === "object" ? (args as Record<string, unknown>) : {};
17+
18+ if (name === "subagent") {
19+ const prompt = typeof a.prompt === "string" ? a.prompt : "";
20+ const short = prompt.length > 60 ? `${prompt.slice(0, 57)}…` : prompt;
21+ const agentName =
22+ typeof a.agentName === "string" && a.agentName ? a.agentName : "";
23+ const label = agentName ? ` ${c.dim(c.cyan(`[@${agentName}]`))}` : "";
24+ return `${G.agent}${label} ${c.dim("—")} ${short}`;
25+ }
26+
27+ if (name === "read") {
28+ const line = Number.isFinite(a.line as number) ? Number(a.line) : null;
29+ const count = Number.isFinite(a.count as number) ? Number(a.count) : null;
30+ const range =
31+ line || count ? c.dim(`:${line ?? 1}${count ? `+${count}` : ""}`) : "";
32+ return `${G.read} ${c.dim("read")} ${String(a.path ?? "")}${range}`;
33+ }
34+
35+ if (name === "create") {
36+ return `${G.write} ${c.dim("create")} ${c.bold(String(a.path ?? ""))}`;
37+ }
38+
39+ if (name === "replace") {
40+ const range = a.endAnchor
41+ ? c.dim(` ${a.startAnchor}–${a.endAnchor}`)
42+ : c.dim(` ${a.startAnchor}`);
43+ const verb =
44+ a.newContent === undefined || a.newContent === "" ? "delete" : "replace";
45+ return `${G.write} ${c.dim(verb)} ${c.bold(String(a.path ?? ""))}${range}`;
46+ }
47+
48+ if (name === "insert") {
49+ return `${G.write} ${c.dim(`insert ${a.position ?? ""}`)} ${c.bold(String(a.path ?? ""))}${c.dim(` @ ${a.anchor}`)}`;
50+ }
51+
52+ if (name === "shell") {
53+ const cmd = String(a.command ?? "");
54+ const shortCmd = cmd.length > 72 ? `${cmd.slice(0, 69)}…` : cmd;
55+ return `${G.run} ${shortCmd}`;
56+ }
57+
58+ if (name.startsWith("mcp_")) {
59+ return `${G.mcp} ${c.dim(name)}`;
60+ }
61+
62+ return `${toolGlyph(name)} ${c.dim(name)}`;
63+}
src/cli/tool-render-result.ts+252−0
@@ -0,0 +1,252 @@
1+import * as c from "yoctocolors";
2+import { G, writeln } from "./output.ts";
3+
4+function renderDiff(diff: string): void {
5+ if (!diff || diff === "(no changes)") return;
6+ for (const line of diff.split("\n")) {
7+ if (line.startsWith("+++") || line.startsWith("---")) {
8+ writeln(` ${c.dim(line)}`);
9+ } else if (line.startsWith("+")) {
10+ writeln(` ${c.green(line)}`);
11+ } else if (line.startsWith("-")) {
12+ writeln(` ${c.red(line)}`);
13+ } else if (line.startsWith("@@")) {
14+ writeln(` ${c.cyan(line)}`);
15+ } else {
16+ writeln(` ${c.dim(line)}`);
17+ }
18+ }
19+}
20+
21+function formatErrorBadge(result: unknown): string {
22+ const msg =
23+ typeof result === "string"
24+ ? result
25+ : result instanceof Error
26+ ? result.message
27+ : JSON.stringify(result);
28+ const oneLiner = msg.split("\n")[0] ?? msg;
29+ return `${G.err} ${c.red(oneLiner)}`;
30+}
31+
32+function writeShellPreviewLines(
33+ label: string,
34+ value: string,
35+ lineColor: (input: string) => string,
36+ maxLines: number,
37+): void {
38+ if (!value.trim()) return;
39+ const lines = value.split("\n");
40+ writeln(` ${c.dim(label)} ${c.dim(`(${lines.length} lines)`)}`);
41+ for (const line of lines.slice(0, maxLines)) {
42+ writeln(` ${lineColor("│")} ${line}`);
43+ }
44+ if (lines.length > maxLines) {
45+ writeln(
46+ ` ${lineColor("│")} ${c.dim(`… +${lines.length - maxLines} lines`)}`,
47+ );
48+ }
49+}
50+
51+function renderShellResult(result: {
52+ stdout: string;
53+ stderr: string;
54+ exitCode: number;
55+ success: boolean;
56+ timedOut: boolean;
57+}): void {
58+ const badge = result.timedOut
59+ ? c.yellow("timeout")
60+ : result.success
61+ ? c.green("success")
62+ : c.red("error");
63+
64+ const stdoutLines = result.stdout.trim()
65+ ? result.stdout.split("\n").length
66+ : 0;
67+ const stderrLines = result.stderr.trim()
68+ ? result.stderr.split("\n").length
69+ : 0;
70+
71+ writeln(
72+ ` ${badge} ${c.dim(`exit ${result.exitCode} · stdout ${stdoutLines}L · stderr ${stderrLines}L`)}`,
73+ );
74+ writeShellPreviewLines("stdout", result.stdout, c.dim, 6);
75+ writeShellPreviewLines("stderr", result.stderr, c.red, 4);
76+}
77+
78+export function renderToolResult(
79+ toolName: string,
80+ result: unknown,
81+ isError: boolean,
82+): void {
83+ if (isError) {
84+ writeln(` ${formatErrorBadge(result)}`);
85+ return;
86+ }
87+
88+ if (toolName === "read") {
89+ const r = result as {
90+ path: string;
91+ line: number;
92+ totalLines: number;
93+ truncated: boolean;
94+ content?: string;
95+ };
96+ const linesReturned = r.content ? r.content.split("\n").length : 0;
97+ const endLine = linesReturned > 0 ? r.line + linesReturned - 1 : r.line;
98+ const range =
99+ r.line === 1 && endLine === r.totalLines
100+ ? `${r.totalLines} lines`
101+ : `lines ${r.line}–${endLine} of ${r.totalLines}`;
102+ writeln(
103+ ` ${G.info} ${c.dim(`${r.path} ${range}${r.truncated ? " (truncated)" : ""}`)}`,
104+ );
105+ return;
106+ }
107+
108+ if (toolName === "create") {
109+ const r = result as { path: string; diff: string; created: boolean };
110+ const verb = r.created ? c.green("created") : c.dim("overwritten");
111+ writeln(` ${G.ok} ${verb} ${r.path}`);
112+ renderDiff(r.diff);
113+ return;
114+ }
115+
116+ if (toolName === "replace" || toolName === "insert") {
117+ const r = result as { path: string; diff: string; deleted?: boolean };
118+ const verb =
119+ toolName === "insert" ? "inserted" : r.deleted ? "deleted" : "replaced";
120+ writeln(` ${G.ok} ${c.dim(verb)} ${r.path}`);
121+ renderDiff(r.diff);
122+ return;
123+ }
124+
125+ if (toolName === "shell") {
126+ renderShellResult(
127+ result as {
128+ stdout: string;
129+ stderr: string;
130+ exitCode: number;
131+ success: boolean;
132+ timedOut: boolean;
133+ },
134+ );
135+ return;
136+ }
137+
138+ if (toolName === "subagent") {
139+ const r = result as {
140+ inputTokens?: number;
141+ outputTokens?: number;
142+ agentName?: string;
143+ };
144+ const label = r.agentName ? ` ${c.dim(c.cyan(`[@${r.agentName}]`))}` : "";
145+ writeln(
146+ ` ${G.agent}${label} ${c.dim(`subagent done (${r.inputTokens ?? 0}in / ${r.outputTokens ?? 0}out tokens)`)}`,
147+ );
148+ return;
149+ }
150+
151+ if (toolName === "readSkill") {
152+ const r = result as {
153+ skill?: {
154+ name?: string;
155+ description?: string;
156+ source?: "local" | "global";
157+ };
158+ };
159+ if (!r.skill) {
160+ writeln(` ${G.info} ${c.dim("skill")} ${c.dim("(not found)")}`);
161+ return;
162+ }
163+ const name = r.skill.name ?? "(unknown)";
164+ const source = r.skill.source ?? "unknown";
165+ const description = r.skill.description?.trim();
166+ const descPart = description
167+ ? ` ${c.dim("·")} ${c.dim(description.length > 60 ? `${description.slice(0, 57)}…` : description)}`
168+ : "";
169+ writeln(
170+ ` ${G.info} ${c.dim("skill")} ${name} ${c.dim("·")} ${c.dim(source)}${descPart}`,
171+ );
172+ return;
173+ }
174+
175+ if (toolName === "webSearch") {
176+ const r = result as {
177+ results?: Array<{ title?: string; url?: string; score?: number }>;
178+ };
179+ if (Array.isArray(r?.results)) {
180+ if (r.results.length === 0) {
181+ writeln(` ${G.info} ${c.dim("no results")}`);
182+ return;
183+ }
184+
185+ for (const item of r.results.slice(0, 5)) {
186+ const title = (item.title?.trim() || item.url || "(untitled)").replace(
187+ /\s+/g,
188+ " ",
189+ );
190+ const score =
191+ typeof item.score === "number"
192+ ? c.dim(` (${item.score.toFixed(2)})`)
193+ : "";
194+ writeln(` ${c.dim("•")} ${title}${score}`);
195+ if (item.url) writeln(` ${c.dim(item.url)}`);
196+ }
197+
198+ if (r.results.length > 5) {
199+ writeln(` ${c.dim(` +${r.results.length - 5} more`)}`);
200+ }
201+ return;
202+ }
203+ }
204+
205+ if (toolName === "webContent") {
206+ const r = result as {
207+ results?: Array<{ url?: string; title?: string; text?: string }>;
208+ };
209+ if (Array.isArray(r?.results)) {
210+ if (r.results.length === 0) {
211+ writeln(` ${G.info} ${c.dim("no pages")}`);
212+ return;
213+ }
214+
215+ for (const item of r.results.slice(0, 3)) {
216+ const title = (item.title?.trim() || item.url || "(untitled)").replace(
217+ /\s+/g,
218+ " ",
219+ );
220+ writeln(` ${c.dim("•")} ${title}`);
221+ if (item.url) writeln(` ${c.dim(item.url)}`);
222+ const preview = (item.text ?? "").replace(/\s+/g, " ").trim();
223+ if (preview) {
224+ const trimmed =
225+ preview.length > 220 ? `${preview.slice(0, 217)}…` : preview;
226+ writeln(` ${c.dim(trimmed)}`);
227+ }
228+ }
229+
230+ if (r.results.length > 3) {
231+ writeln(` ${c.dim(` +${r.results.length - 3} more`)}`);
232+ }
233+ return;
234+ }
235+ }
236+
237+ if (toolName.startsWith("mcp_")) {
238+ const content = Array.isArray(result) ? result : [result];
239+ for (const block of (
240+ content as Array<{ type?: string; text?: string }>
241+ ).slice(0, 5)) {
242+ if (block?.type === "text" && block.text) {
243+ const lines = block.text.split("\n").slice(0, 6);
244+ for (const line of lines) writeln(` ${c.dim("│")} ${line}`);
245+ }
246+ }
247+ return;
248+ }
249+
250+ const text = JSON.stringify(result);
251+ writeln(` ${c.dim(text.length > 120 ? `${text.slice(0, 117)}…` : text)}`);
252+}
src/cli/tool-render.ts+9−291
@@ -1,120 +1,28 @@
11 import { homedir } from "node:os";
22 import * as c from "yoctocolors";
33 import { G, writeln } from "./output.ts";
4+import { buildToolCallLine } from "./tool-render-call.ts";
5+import { renderToolResult as renderResultImpl } from "./tool-render-result.ts";
46
57 const HOME = homedir();
68
7-function toolGlyph(name: string): string {
8- if (name === "read") return G.read;
9- if (name === "create" || name === "replace" || name === "insert")
10- return G.write;
11- if (name === "shell") return G.run;
12- if (name === "subagent") return G.agent;
13- if (name.startsWith("mcp_")) return G.mcp;
14- return G.info;
15-}
16-
17-function toolCallLine(name: string, args: unknown): string {
18- const a =
19- args && typeof args === "object" ? (args as Record<string, unknown>) : {};
20-
21- if (name === "subagent") {
22- const prompt = typeof a.prompt === "string" ? a.prompt : "";
23- const short = prompt.length > 60 ? `${prompt.slice(0, 57)}…` : prompt;
24- const agentName =
25- typeof a.agentName === "string" && a.agentName ? a.agentName : "";
26- const label = agentName ? ` ${c.dim(c.cyan(`[@${agentName}]`))}` : "";
27- return `${G.agent}${label} ${c.dim("—")} ${short}`;
28- }
29- if (name === "read") {
30- const line = Number.isFinite(a.line as number) ? Number(a.line) : null;
31- const count = Number.isFinite(a.count as number) ? Number(a.count) : null;
32- const range =
33- line || count ? c.dim(`:${line ?? 1}${count ? `+${count}` : ""}`) : "";
34- return `${G.read} ${c.dim("read")} ${String(a.path ?? "")}${range}`;
35- }
36- if (name === "create") {
37- return `${G.write} ${c.dim("create")} ${c.bold(String(a.path ?? ""))}`;
38- }
39- if (name === "replace") {
40- const range = a.endAnchor
41- ? c.dim(` ${a.startAnchor}–${a.endAnchor}`)
42- : c.dim(` ${a.startAnchor}`);
43- const verb =
44- a.newContent === undefined || a.newContent === "" ? "delete" : "replace";
45- return `${G.write} ${c.dim(verb)} ${c.bold(String(a.path ?? ""))}${range}`;
46- }
47- if (name === "insert") {
48- return `${G.write} ${c.dim(`insert ${a.position ?? ""}`)} ${c.bold(String(a.path ?? ""))}${c.dim(` @ ${a.anchor}`)}`;
49- }
50- if (name === "shell") {
51- const cmd = String(a.command ?? "");
52- const shortCmd = cmd.length > 72 ? `${cmd.slice(0, 69)}…` : cmd;
53- return `${G.run} ${shortCmd}`;
54- }
55- if (name.startsWith("mcp_")) {
56- return `${G.mcp} ${c.dim(name)}`;
57- }
58- return `${toolGlyph(name)} ${c.dim(name)}`;
59-}
60-
619 export function renderToolCall(toolName: string, args: unknown): void {
62- writeln(` ${toolCallLine(toolName, args)}`);
10+ writeln(` ${buildToolCallLine(toolName, args)}`);
6311 }
12+
6413 export function renderHook(
6514 toolName: string,
6615 scriptPath: string,
6716 success: boolean,
6817 ): void {
6918 const short = scriptPath.replace(HOME, "~");
70-
7119 if (success) {
7220 writeln(` ${G.ok} ${c.dim(`hook post-${toolName}`)}`);
73- } else {
74- writeln(
75- ` ${G.err} ${c.red(`hook post-${toolName} failed`)} ${c.dim(short)}`,
76- );
77- }
78-}
79-
80-function renderDiff(diff: string): void {
81- if (!diff || diff === "(no changes)") return;
82- for (const line of diff.split("\n")) {
83- if (line.startsWith("+++") || line.startsWith("---")) {
84- writeln(` ${c.dim(line)}`);
85- } else if (line.startsWith("+")) {
86- writeln(` ${c.green(line)}`);
87- } else if (line.startsWith("-")) {
88- writeln(` ${c.red(line)}`);
89- } else if (line.startsWith("@@")) {
90- writeln(` ${c.cyan(line)}`);
91- } else {
92- writeln(` ${c.dim(line)}`);
93- }
21+ return;
9422 }
95-}
96-
97-function formatErrorBadge(result: unknown): string {
98- const msg =
99- typeof result === "string"
100- ? result
101- : result instanceof Error
102- ? result.message
103- : JSON.stringify(result);
104- const oneLiner = msg.split("\n")[0] ?? msg;
105- return `${G.err} ${c.red(oneLiner)}`;
106-}
107-
108-function formatShellBadge(r: {
109- timedOut: boolean;
110- success: boolean;
111- exitCode: number;
112-}): string {
113- return r.timedOut
114- ? c.yellow("timeout")
115- : r.success
116- ? c.green(`✔ ${r.exitCode}`)
117- : c.red(`✖ ${r.exitCode}`);
23+ writeln(
24+ ` ${G.err} ${c.red(`hook post-${toolName} failed`)} ${c.dim(short)}`,
25+ );
11826 }
11927
12028 export function renderToolResult(
@@ -122,195 +30,5 @@ export function renderToolResult(
12230 result: unknown,
12331 isError: boolean,
12432 ): void {
125- if (isError) {
126- writeln(` ${formatErrorBadge(result)}`);
127- return;
128- }
129-
130- if (toolName === "read") {
131- const r = result as {
132- path: string;
133- line: number;
134- totalLines: number;
135- truncated: boolean;
136- content?: string;
137- };
138- const linesReturned = r.content ? r.content.split("\n").length : 0;
139- const endLine = linesReturned > 0 ? r.line + linesReturned - 1 : r.line;
140- const range =
141- r.line === 1 && endLine === r.totalLines
142- ? `${r.totalLines} lines`
143- : `lines ${r.line}–${endLine} of ${r.totalLines}`;
144- writeln(
145- ` ${G.info} ${c.dim(`${r.path} ${range}${r.truncated ? " (truncated)" : ""}`)}`,
146- );
147- return;
148- }
149-
150- if (toolName === "create") {
151- const r = result as { path: string; diff: string; created: boolean };
152- const verb = r.created ? c.green("created") : c.dim("overwritten");
153- writeln(` ${G.ok} ${verb} ${r.path}`);
154- renderDiff(r.diff);
155- return;
156- }
157-
158- if (toolName === "replace" || toolName === "insert") {
159- const r = result as { path: string; diff: string; deleted?: boolean };
160- const verb =
161- toolName === "insert" ? "inserted" : r.deleted ? "deleted" : "replaced";
162- writeln(` ${G.ok} ${c.dim(verb)} ${r.path}`);
163- renderDiff(r.diff);
164- return;
165- }
166-
167- if (toolName === "shell") {
168- const r = result as {
169- stdout: string;
170- stderr: string;
171- exitCode: number;
172- success: boolean;
173- timedOut: boolean;
174- };
175-
176- const badge = formatShellBadge(r);
177-
178- writeln(` ${badge}`);
179-
180- const outLines = r.stdout ? r.stdout.split("\n") : [];
181- const errLines = r.stderr ? r.stderr.split("\n") : [];
182-
183- // Show stdout (up to 20 lines)
184- for (const line of outLines.slice(0, 20)) {
185- writeln(` ${c.dim("│")} ${line}`);
186- }
187- if (outLines.length > 20)
188- writeln(` ${c.dim(`│ … +${outLines.length - 20} lines`)}`);
189-
190- // Show stderr (up to 8 lines), only if non-empty
191- for (const line of errLines.slice(0, 8)) {
192- if (line.trim()) writeln(` ${c.red("│")} ${c.dim(line)}`);
193- }
194- if (errLines.length > 8)
195- writeln(` ${c.red(`│ … +${errLines.length - 8} lines`)}`);
196- return;
197- }
198-
199- if (toolName === "subagent") {
200- const r = result as {
201- inputTokens?: number;
202- outputTokens?: number;
203- agentName?: string;
204- };
205- const label = r.agentName ? ` ${c.dim(c.cyan(`[@${r.agentName}]`))}` : "";
206- writeln(
207- ` ${G.agent}${label} ${c.dim(`subagent done (${r.inputTokens ?? 0}in / ${r.outputTokens ?? 0}out tokens)`)}`,
208- );
209-
210- return;
211- }
212-
213- if (toolName === "readSkill") {
214- const r = result as {
215- skill?: {
216- name?: string;
217- description?: string;
218- source?: "local" | "global";
219- };
220- };
221- if (!r.skill) {
222- writeln(` ${G.info} ${c.dim("skill")} ${c.dim("(not found)")}`);
223- return;
224- }
225- const name = r.skill.name ?? "(unknown)";
226- const source = r.skill.source ?? "unknown";
227- const description = r.skill.description?.trim();
228- const descPart = description
229- ? ` ${c.dim("·")} ${c.dim(description.length > 60 ? `${description.slice(0, 57)}…` : description)}`
230- : "";
231- writeln(
232- ` ${G.info} ${c.dim("skill")} ${name} ${c.dim("·")} ${c.dim(source)}${descPart}`,
233- );
234- return;
235- }
236-
237- if (toolName === "webSearch") {
238- const r = result as {
239- results?: Array<{ title?: string; url?: string; score?: number }>;
240- };
241- if (Array.isArray(r?.results)) {
242- if (r.results.length === 0) {
243- writeln(` ${G.info} ${c.dim("no results")}`);
244- return;
245- }
246-
247- for (const item of r.results.slice(0, 5)) {
248- const title = (item.title?.trim() || item.url || "(untitled)").replace(
249- /\s+/g,
250- " ",
251- );
252- const score =
253- typeof item.score === "number"
254- ? c.dim(` (${item.score.toFixed(2)})`)
255- : "";
256- writeln(` ${c.dim("•")} ${title}${score}`);
257- if (item.url) writeln(` ${c.dim(item.url)}`);
258- }
259-
260- if (r.results.length > 5) {
261- writeln(` ${c.dim(` +${r.results.length - 5} more`)}`);
262- }
263- return;
264- }
265- }
266-
267- if (toolName === "webContent") {
268- const r = result as {
269- results?: Array<{ url?: string; title?: string; text?: string }>;
270- };
271- if (Array.isArray(r?.results)) {
272- if (r.results.length === 0) {
273- writeln(` ${G.info} ${c.dim("no pages")}`);
274- return;
275- }
276-
277- for (const item of r.results.slice(0, 3)) {
278- const title = (item.title?.trim() || item.url || "(untitled)").replace(
279- /\s+/g,
280- " ",
281- );
282- writeln(` ${c.dim("•")} ${title}`);
283- if (item.url) writeln(` ${c.dim(item.url)}`);
284- const preview = (item.text ?? "").replace(/\s+/g, " ").trim();
285- if (preview) {
286- const trimmed =
287- preview.length > 220 ? `${preview.slice(0, 217)}…` : preview;
288- writeln(` ${c.dim(trimmed)}`);
289- }
290- }
291-
292- if (r.results.length > 3) {
293- writeln(` ${c.dim(` +${r.results.length - 3} more`)}`);
294- }
295- return;
296- }
297- }
298-
299- // MCP tools — show content blocks
300- if (toolName.startsWith("mcp_")) {
301- const content = Array.isArray(result) ? result : [result];
302- for (const block of (
303- content as Array<{ type?: string; text?: string }>
304- ).slice(0, 5)) {
305- if (block?.type === "text" && block.text) {
306- const lines = block.text.split("\n").slice(0, 6);
307- for (const l of lines) writeln(` ${c.dim("│")} ${l}`);
308- }
309- }
310- return;
311- }
312-
313- // Generic fallback — one-line JSON summary
314- const text = JSON.stringify(result);
315- writeln(` ${c.dim(text.length > 120 ? `${text.slice(0, 117)}…` : text)}`);
33+ renderResultImpl(toolName, result, isError);
31634 }