Files
dsh-purge/lib/phase1-keep.js
叫我小杨同学andCursor a5dcbb02d8 release: 1.1.70
Hub/残装不再空等 pluginPackages;清洗页合并升级链展示,Apply 仍全打。合并 #97/#98/#99。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-11 18:01:05 +08:00

22 lines
904 B
JavaScript

export const PHASE1_KEEP_EXPR =
'PERSONA_SECTION_NAMES.has(section?.name) || String(section?.name || "").startsWith("dsh-purge") || String(section?.name || "").startsWith("dshpg-")';
/**
* 把官方 phase-1 白名单放宽到 dsh-purge* + dshpg-*。
* 已放行 dsh-purge 的旧补丁会升到带 dshpg。
*/
export function widenPhase1KeepFilter(text) {
const raw = String(text || "");
const crlf = raw.includes("\r\n");
let next = raw.replace(/\r\n/g, "\n");
next = next.replace(
/PERSONA_SECTION_NAMES\.has\(section\?\.name\) \|\| String\(section\?\.name \|\| ""\)\.startsWith\("dsh-purge"\)(?! \|\| String\(section\?\.name \|\| ""\)\.startsWith\("dshpg-"\))/g,
PHASE1_KEEP_EXPR,
);
next = next.replace(
/section => PERSONA_SECTION_NAMES\.has\(section\?\.name\)(?! \|\|)/g,
`section => ${PHASE1_KEEP_EXPR}`,
);
return crlf ? next.replace(/\n/g, "\r\n") : next;
}