xonecas.io
64875
Mc

mini-coder / commit 9759449

refactor: dedupe skill tool result rendering

xonecas2026-03-15 975944972fb72adf651dea1c6bbae9d2dd2205d6 parent 7ffaa7d

2 files changed

TODO.md+1−1
@@ -1,7 +1,7 @@
11 # TODO
22
33 - UI hangs for a short time before reasoning blocks. Reasoning blocks should use our colors library for italic styling.
4-- Assistant responses are no longer rendered with highlighted markdown syntax. It's just plain text with no coloring.
4+- Assistant responses are no longer rendered with highlighted markdown syntax. It's just plain text with no coloring. Let's condider markdown rendering libraries and their performance costs and completly rethink our approach. We want to keep our fast output above all, even if that means no markdown rendering.
55
66 ---
77
src/cli/tool-result-renderers.ts+24−18
@@ -114,6 +114,28 @@ function renderSubagentResult(result: unknown): boolean {
114114 return true;
115115 }
116116
117+function buildSkillDescriptionPart(description: string | undefined): string {
118+ const trimmed = description?.trim();
119+ if (!trimmed) return "";
120+ return ` ${c.dim("·")} ${c.dim(trimmed.length > 60 ? `${trimmed.slice(0, 57)}…` : trimmed)}`;
121+}
122+
123+function renderSkillSummaryLine(
124+ skill: {
125+ name?: string;
126+ description?: string;
127+ source?: "local" | "global";
128+ },
129+ label?: string,
130+): void {
131+ const name = skill.name ?? "(unknown)";
132+ const source = skill.source ?? "unknown";
133+ const labelPrefix = label ? `${c.dim(label)} ` : "";
134+ writeln(
135+ ` ${G.info} ${labelPrefix}${name} ${c.dim("·")} ${c.dim(source)}${buildSkillDescriptionPart(skill.description)}`,
136+ );
137+}
138+
117139 function renderListSkillsResult(result: unknown): boolean {
118140 const r = result as {
119141 skills?: Array<{
@@ -129,15 +151,7 @@ function renderListSkillsResult(result: unknown): boolean {
129151 }
130152
131153 for (const skill of r.skills.slice(0, 6)) {
132- const name = skill.name ?? "(unknown)";
133- const source = skill.source ?? "unknown";
134- const description = skill.description?.trim();
135- const descPart = description
136- ? ` ${c.dim("·")} ${c.dim(description.length > 60 ? `${description.slice(0, 57)}…` : description)}`
137- : "";
138- writeln(
139- ` ${G.info} ${name} ${c.dim("·")} ${c.dim(source)}${descPart}`,
140- );
154+ renderSkillSummaryLine(skill);
141155 }
142156
143157 if (r.skills.length > 6) {
@@ -159,15 +173,7 @@ function renderReadSkillResult(result: unknown): boolean {
159173 writeln(` ${G.info} ${c.dim("skill")} ${c.dim("(not found)")}`);
160174 return true;
161175 }
162- const name = r.skill.name ?? "(unknown)";
163- const source = r.skill.source ?? "unknown";
164- const description = r.skill.description?.trim();
165- const descPart = description
166- ? ` ${c.dim("·")} ${c.dim(description.length > 60 ? `${description.slice(0, 57)}…` : description)}`
167- : "";
168- writeln(
169- ` ${G.info} ${c.dim("skill")} ${name} ${c.dim("·")} ${c.dim(source)}${descPart}`,
170- );
176+ renderSkillSummaryLine(r.skill, "skill");
171177 return true;
172178 }