refactor: dedupe infra lowercase helpers

This commit is contained in:
Peter Steinberger
2026-04-07 12:45:04 +01:00
parent 8e4eaec394
commit 9716f970a3
15 changed files with 48 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
import JSON5 from "json5";
import { LEGACY_MANIFEST_KEYS, MANIFEST_KEY } from "../compat/legacy-names.js";
import { parseBooleanValue } from "../utils/boolean.js";
import { readStringValue } from "./string-coerce.js";
import { normalizeOptionalLowercaseString, readStringValue } from "./string-coerce.js";
import { normalizeCsvOrLooseStringList } from "./string-normalization.js";
export function normalizeStringList(input: unknown): string[] {
@@ -105,7 +105,7 @@ export function parseOpenClawManifestInstallBase(
const raw = input as Record<string, unknown>;
const kindRaw =
typeof raw.kind === "string" ? raw.kind : typeof raw.type === "string" ? raw.type : "";
const kind = kindRaw.trim().toLowerCase();
const kind = normalizeOptionalLowercaseString(kindRaw) ?? "";
if (!allowedKinds.includes(kind)) {
return undefined;
}