mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 11:10:22 +08:00
fix: 极简等模式不用再点保存也能挂上提示词
组装时若内存里还没挂正文,就从磁盘提示词或当前规则集补上。空的已保存标记不再挡住磁盘文件。提示词段同时挂到全局层,切换官方预设也能看见。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
813fbe4d54
commit
e26d3251f0
3 files changed
+74
-8
No files matched your search
+14
-1
@@ -1451,6 +1451,13 @@ export function isDshHomeDir(dir) {
|
||||
return base === ".dsh" || base === "dsh-home";
|
||||
}
|
||||
|
||||
function homeHasHarnessData(dir) {
|
||||
if (!dir || !isDir(dir)) return false;
|
||||
return isFile(path.join(dir, "prompt-inject.md"))
|
||||
|| isDir(path.join(dir, "profiles"))
|
||||
|| isFile(path.join(dir, "cordis.patch.yml"));
|
||||
}
|
||||
|
||||
function desktopHomeCandidates() {
|
||||
const out = [];
|
||||
const push = (dir) => {
|
||||
@@ -1517,9 +1524,15 @@ export function findDshHome(options = {}) {
|
||||
if (fromEnv && String(fromEnv).trim()) return path.normalize(fromEnv.trim());
|
||||
const desktopHost = adapterFor(detectSurface(options)) === "desktop";
|
||||
if (desktopHost) {
|
||||
const found = [];
|
||||
for (const cand of desktopHomeCandidates()) {
|
||||
if (isDshHomeDir(cand)) return path.normalize(cand);
|
||||
if (isDshHomeDir(cand)) found.push(path.normalize(cand));
|
||||
}
|
||||
const unix = path.normalize(path.join(os.homedir(), ".dsh"));
|
||||
const usable = found.find((cand) => homeHasHarnessData(cand));
|
||||
if (usable) return usable;
|
||||
if (isDir(unix) && homeHasHarnessData(unix)) return unix;
|
||||
if (found.length) return found[0];
|
||||
}
|
||||
const shimDir = options.shimDir !== undefined ? options.shimDir : findShimDir();
|
||||
const prefix = options.prefix !== undefined ? options.prefix : findNpmPrefix();
|
||||
|
||||
Reference in new issue
Block a user