fix: 命令撞名只丢那一条;主插件 insert 自愈(#162 #159)

This commit is contained in:
叫我小杨同学 committed 2026-10-26 11:15:56 +08:00
1 parent 2a3c7cef6a
commit add692e491
7 files changed
+179 -53

No files matched your search

+11
View File
@@ -12,6 +12,7 @@ import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { readPresetDefinition } from './preset-composition.js'
import { scheduleClearOwnedSelectedDefault } from '../preset-default.js'
import { ensureAllProfileBodyInserts } from '../profile-insert.js'
/** Cordis 插件名。 */
export const name = 'dsh-purge-redteam'
@@ -460,6 +461,16 @@ export function installPreset(options = {}) {
* @param ctx - 插件上下文。
*/
export function apply(ctx) {
try {
const home = process.env.DSH_HOME || join(homedir(), '.dsh')
const healed = ensureAllProfileBodyInserts(home)
for (const item of healed) {
if (item.wrote) {
ctx.logger?.info?.('redteam-mode: 已补本体 insert %s(下次启动加载主插件)', item.path)
}
}
} catch { /* 自愈失败不挡预设落地 */ }
const paths = packagePaths()
let result
try {