Files
openclaw/src/config/patch-replace-paths.ts
Peter Steinberger d1684f48a3 refactor: delete dead infra and config exports (#106019)
* refactor: delete dead infra and config exports

* refactor: preserve live infra and config contracts

* refactor(config): remove obsolete file-store lifecycle APIs

* refactor(infra): finish current-main dead export cleanup
2026-07-13 12:00:47 -07:00

23 lines
683 B
TypeScript

// Normalizes config.patch replacePaths shared by Gateway and agent preflight checks.
function normalizeConfigPatchReplacePath(value: string): string {
const trimmed = value.trim();
if (trimmed.endsWith("[]")) {
return trimmed.slice(0, -2).replace(/\[\d+\](?=\.)/g, "[]");
}
return trimmed.replace(/\[\d+\](?=\.)/g, "[]");
}
export function normalizeConfigPatchReplacePaths(
values: readonly unknown[] | undefined,
): Set<string> {
if (!values) {
return new Set();
}
return new Set(
values
.filter((value): value is string => typeof value === "string")
.map(normalizeConfigPatchReplacePath)
.filter((value) => value.length > 0),
);
}