mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:20:22 +08:00
加入默认的破限制提示词,修改显示,支持桌面端
This commit is contained in:
1 parent
d488eaa30c
commit
5d2cb636f5
13 files changed
+2064
-838
No files matched your search
+14
-1
@@ -1,6 +1,7 @@
|
||||
// 规则集:多套 AGENTS.md / CLAUDE.md,切换即写入 ~/.dsh 原生全局指令通道
|
||||
// 规则集:多套 AGENTS.md / CLAUDE.md;激活时写入目标文件,并被 systemPrompt 段实时注入
|
||||
// 存储: $DSH_HOME/rules/<id>.md + <id>.json ;状态: rules/state.json
|
||||
|
||||
import fs from "node:fs";
|
||||
import { promises as fsp } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { findDshHome } from "./core.js";
|
||||
@@ -155,6 +156,18 @@ export async function setActive(dshHome, id) {
|
||||
await fsp.writeFile(stateFile(dshHome), JSON.stringify({ active: id }, null, 2), "utf8");
|
||||
}
|
||||
|
||||
/** Sync read for systemPrompt.section text(); empty string if none. */
|
||||
export function activeRuleText(dshHome) {
|
||||
try {
|
||||
const parsed = JSON.parse(fs.readFileSync(stateFile(dshHome), "utf8"));
|
||||
const id = parsed?.active;
|
||||
if (!validRuleId(id)) return "";
|
||||
return fs.readFileSync(rulePath(dshHome, id), "utf8").trim();
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
export async function activateRule(dshHome, id) {
|
||||
const content = await readRule(dshHome, id);
|
||||
if (content === null) throw new Error(`rule not found: ${id}`);
|
||||
|
||||
Reference in new issue
Block a user