Skip to content

Commit 2bb8b20

Browse files
committed
fix(formatters): escape step titles in Seer output and remove dead string[] shim in writeOutput
1 parent ce17bba commit 2bb8b20

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/lib/formatters/output.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { writeJson } from "./json.js";
1212
type WriteOutputOptions<T> = {
1313
/** Output JSON format instead of human-readable */
1414
json: boolean;
15-
/** Function to format data as a rendered string or string array */
16-
formatHuman: (data: T) => string | string[];
15+
/** Function to format data as a rendered string */
16+
formatHuman: (data: T) => string;
1717
/** Optional source description if data was auto-detected */
1818
detectedFrom?: string;
1919
};
@@ -36,8 +36,7 @@ export function writeOutput<T>(
3636
return;
3737
}
3838

39-
const output = options.formatHuman(data);
40-
const text = Array.isArray(output) ? output.join("\n") : output;
39+
const text = options.formatHuman(data);
4140
stdout.write(`${text}\n`);
4241

4342
if (options.detectedFrom) {

src/lib/formatters/seer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function buildRootCauseMarkdown(cause: RootCause, index: number): string {
124124
lines.push("**Reproduction steps:**");
125125
lines.push("");
126126
for (const step of cause.root_cause_reproduction) {
127-
lines.push(`**${step.title}**`);
127+
lines.push(`**${escapeMarkdownInline(step.title)}**`);
128128
lines.push("");
129129
// code_snippet_and_analysis may itself contain markdown (code fences,
130130
// inline code, etc.) — pass it through as-is so marked renders it.
@@ -270,7 +270,7 @@ export function formatSolution(solution: SolutionArtifact): string {
270270
for (let i = 0; i < solution.data.steps.length; i++) {
271271
const step = solution.data.steps[i];
272272
if (step) {
273-
lines.push(`${i + 1}. **${step.title}**`);
273+
lines.push(`${i + 1}. **${escapeMarkdownInline(step.title)}**`);
274274
lines.push("");
275275
// step.description may contain markdown — pass it through as-is
276276
lines.push(` ${step.description.split("\n").join("\n ")}`);

0 commit comments

Comments
 (0)