fix(patches): silence false warnings for already-applied patches

- patch-ap-allow-private-address: detect allowPrivateAddress in source
- patch-endpoint-posts-ai-cleanup: detect any AI field key variant

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sven
2026-03-16 20:32:24 +01:00
parent 733c00b1b3
commit e3765948e5
2 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -74,12 +74,12 @@ for (const filePath of candidates) {
checked += 1; checked += 1;
const source = await readFile(filePath, "utf8"); const source = await readFile(filePath, "utf8");
if (source.includes(MARKER)) { if (source.includes(MARKER) || source.includes("allowPrivateAddress")) {
continue; continue;
} }
if (!source.includes(OLD_SNIPPET)) { if (!source.includes(OLD_SNIPPET)) {
console.log(`[postinstall] patch-ap-allow-private-address: snippet not found in ${filePath}`); console.log(`[postinstall] patch-ap-allow-private-address: snippet not found in ${filePath} — skipping`);
continue; continue;
} }
+6 -2
View File
@@ -90,8 +90,12 @@ for (const filePath of candidates) {
} }
if (!source.includes(oldSnippet)) { if (!source.includes(oldSnippet)) {
// Beta.41+ has native AI field cleanup — skip silently // Already has AI field cleanup in some form — skip silently
if (source.includes('"ai-text-level"') && source.includes('"ai-code-level"')) { if (
source.includes('"ai-text-level"') ||
source.includes('"aiTextLevel"') ||
!source.includes("jf2ToMf2")
) {
continue; continue;
} }
console.warn( console.warn(