refactor: dedupe lowercased readers

This commit is contained in:
Peter Steinberger
2026-04-07 08:15:36 +01:00
parent 763dc614c0
commit a5ff85f01c
12 changed files with 28 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
import { resolveLanguage } from "@pierre/diffs";
import type { FileContents, FileDiffMetadata, SupportedLanguages } from "@pierre/diffs";
import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
import type { DiffViewerPayload } from "./types.js";
const PASSTHROUGH_LANGUAGE_HINTS = new Set<SupportedLanguages>(["ansi", "text"]);
@@ -8,7 +9,7 @@ type DiffPayloadFile = FileContents | FileDiffMetadata;
export async function normalizeSupportedLanguageHint(
value?: string,
): Promise<SupportedLanguages | undefined> {
const normalized = value?.trim();
const normalized = normalizeOptionalString(value);
if (!normalized) {
return undefined;
}

View File

@@ -440,7 +440,7 @@ function buildArtifactContext(
}
function normalizeContextString(value: string | undefined): string | undefined {
const normalized = value?.trim();
const normalized = normalizeOptionalString(value);
return normalized ? normalized : undefined;
}