mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 05:10:22 +08:00
feat: 发布 1.1.11-beta.1,Skill 导入官方目录并加正式/测试通道
设置页可导入压缩包或文件夹到官方 skills;导入约束路径与符号链接,保存保留官方 frontmatter。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d30f3a76e9
commit
cff7ebcbb5
8 files changed
+1628
-86
No files matched your search
+43
-4
@@ -1318,7 +1318,37 @@ export function normPath(p) {
|
||||
|
||||
export function isDshHomeDir(dir) {
|
||||
if (!dir || !isDir(dir)) return false;
|
||||
return path.basename(path.normalize(dir)) === ".dsh";
|
||||
const base = path.basename(path.normalize(dir)).toLowerCase();
|
||||
return base === ".dsh" || base === "dsh-home";
|
||||
}
|
||||
|
||||
function desktopHomeCandidates() {
|
||||
const out = [];
|
||||
const push = (dir) => {
|
||||
if (!dir) return;
|
||||
const root = path.normalize(dir);
|
||||
out.push(root);
|
||||
out.push(path.join(root, ".dsh"));
|
||||
out.push(path.join(root, "dsh-home"));
|
||||
};
|
||||
try {
|
||||
const exe = desktop.findDesktopAppExecutable();
|
||||
if (exe) push(path.dirname(exe));
|
||||
} catch { /* ignore */ }
|
||||
try {
|
||||
if (process.resourcesPath) push(path.dirname(path.normalize(process.resourcesPath)));
|
||||
} catch { /* ignore */ }
|
||||
try {
|
||||
for (const root of desktop.listDesktopInstallRoots()) push(root);
|
||||
} catch { /* ignore */ }
|
||||
for (const guess of desktopDshHomeGuesses()) out.push(guess);
|
||||
const seen = new Set();
|
||||
return out.filter((item) => {
|
||||
const key = path.normalize(item).replace(/\\/g, "/").toLowerCase();
|
||||
if (seen.has(key)) return false;
|
||||
seen.add(key);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
export function portableHomeFromLauncher(shimDir, prefix) {
|
||||
@@ -1350,15 +1380,24 @@ function desktopDshHomeGuesses() {
|
||||
];
|
||||
}
|
||||
|
||||
// DSH_HOME → 启动器旁 .dsh → ~/.dsh
|
||||
// DSH_HOME → 桌面进程旁 .dsh/dsh-home → 启动器旁 .dsh → ~/.dsh
|
||||
// 不写死盘符;桌面端不借用 Web 启动器旁的主目录。
|
||||
export function findDshHome(options = {}) {
|
||||
const env = options.env ?? process.env;
|
||||
const fromEnv = env.DSH_HOME;
|
||||
if (fromEnv && String(fromEnv).trim()) return path.normalize(fromEnv.trim());
|
||||
const desktopHost = adapterFor(detectSurface(options)) === "desktop";
|
||||
if (desktopHost) {
|
||||
for (const cand of desktopHomeCandidates()) {
|
||||
if (isDshHomeDir(cand)) return path.normalize(cand);
|
||||
}
|
||||
}
|
||||
const shimDir = options.shimDir !== undefined ? options.shimDir : findShimDir();
|
||||
const prefix = options.prefix !== undefined ? options.prefix : findNpmPrefix();
|
||||
const portable = portableHomeFromLauncher(shimDir, prefix);
|
||||
if (portable) return portable;
|
||||
if (!desktopHost) {
|
||||
const portable = portableHomeFromLauncher(shimDir, prefix);
|
||||
if (portable) return portable;
|
||||
}
|
||||
const unix = path.join(os.homedir(), ".dsh");
|
||||
if (isDir(unix)) return unix;
|
||||
const wslWin = findWslWindowsDshHome(env);
|
||||
|
||||
Reference in new issue
Block a user