fix: 发布 1.1.35,技能路径跟随安装目录

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-09-28 21:45:47 +08:00
1 parent 7fc64e4b45
commit 065d00633b
28 files changed
+363 -168

No files matched your search

+1 -7
View File
@@ -415,13 +415,7 @@ const newApply = ` function apply(ctx) {
name: "shell.overlay",
id: "dsh-purge-dock",
order: 50,
}, () => h(react.Fragment, null, h(PurgeDock), h(HeroNewSessionMount), h(EnvAdaptSendGate))));
ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
name: "conversation.session.header.utilities",
id: "dsh-purge-header",
order: 90,
label: () => t("dock.inSession"),
}, () => h(SessionHeaderPurge)));
}, () => h(react.Fragment, null, h(PurgeDock), h(HeroNewSessionMount), h(TabRowPurgeMount), h(EnvAdaptSendGate))));
try {
if (typeof ctx.inject === "function") {
ctx.inject(["sessions", "uiWorkspace", "workspaces", "conversation"], (host) => installRewindUi(host));
+44
View File
@@ -0,0 +1,44 @@
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { checkSkill, expandSkillPath } from "../lib/redteam/skill-availability.js";
const env = { DSH_HOME: "D:\\DeepSeek Harness\\.dsh", PATH: "" };
const expanded = expandSkillPath("~/.dsh/redteam/toolkit/fscan/fscan", env);
assert.equal(expanded.replace(/\//g, "\\"), "D:\\DeepSeek Harness\\.dsh\\redteam\\toolkit\\fscan\\fscan");
assert.ok(!expanded.includes(os.homedir()), "tilde .dsh must follow DSH_HOME, not the OS home");
const missingTool = checkSkill({
name: "fscan-intranet",
content: "run $DSH_HOME/redteam/toolkit/fscan/fscan\n",
}, { env });
assert.equal(missingTool.status, "available");
assert.equal(missingTool.problems.length, 0);
assert.ok(missingTool.checked.missing_paths.length > 0);
const fofa = checkSkill({
name: "fofa-recon",
content: 'KEY = os.environ["FOFA_KEY"]\n',
}, { env });
assert.equal(fofa.status, "broken");
assert.match(fofa.problems.join("\n"), /FOFA_KEY/);
const vps = checkSkill({
name: "vps",
content: "host <你的VPS_IP>\nkey $DSH_HOME/redteam/toolkit/vps/id_rsa\n",
}, { env });
assert.equal(vps.status, "available");
assert.equal(vps.problems.some((p) => p.includes("路径不存在")), false);
const skillDir = path.resolve("skills/redteam");
const broken = [];
for (const file of fs.readdirSync(skillDir).filter((f) => f.endsWith(".md"))) {
const content = fs.readFileSync(path.join(skillDir, file), "utf8");
const name = file.replace(/\.md$/, "");
const verdict = checkSkill({ name, content, path: path.join(skillDir, file) }, { env });
if (verdict.status !== "available") broken.push(name + " " + verdict.problems.join(" | "));
}
assert.deepEqual(broken.filter((line) => !line.startsWith("fofa-recon")), []);
console.log("ok: skill paths follow DSH_HOME");
console.log(broken.join("\n") || "(no broken skills)");
+27 -5
View File
@@ -13,6 +13,14 @@ fs.writeFileSync(
path.join(templates, "http", "cve.yml"),
"id: x\ninfo:\n name: CVE-2024-1 demo\n severity: high\n tags: cve\n",
);
fs.writeFileSync(
path.join(templates, "http", "rce.yml"),
"id: r\ninfo:\n name: Demo RCE\n severity: critical\n tags: cve,rce\n",
);
fs.writeFileSync(
path.join(templates, "http", "sqli.yml"),
"id: s\ninfo:\n name: Demo SQLi\n severity: high\n tags: sqli\n",
);
const prev = process.env.NUCLEI_TEMPLATES_DIR;
process.env.NUCLEI_TEMPLATES_DIR = templates;
@@ -20,19 +28,33 @@ let store;
try {
store = new RedteamStore(path.join(root, "rt"));
const page = store.searchTemplates("", 40, 0);
assert.equal(page.total, 2);
assert.equal(page.matched, 1);
assert.equal(page.items.length, 1);
assert.equal(page.total, 4);
assert.equal(page.matched, 3);
assert.equal(page.items.length, 3);
assert.equal(page.items[0].name, "CVE-2024-1 demo");
assert.equal(page.items[0].severity, "high");
assert.equal(page.items[0].category, "other");
const byCode = new Map(page.byCategory.map((c) => [c.code, c.n]));
assert.equal(byCode.get("rce"), 1);
assert.equal(byCode.get("sqli"), 1);
assert.ok(byCode.get("rce") > 0, "rce chip is not zero");
const onlyRce = store.searchTemplates("", 40, 0, "rce");
assert.equal(onlyRce.matched, 1);
assert.equal(onlyRce.items[0].name, "Demo RCE");
assert.equal(onlyRce.items[0].category, "rce");
assert.equal(onlyRce.byCategory.find((c) => c.code === "sqli").n, 1);
const found = store.searchTemplates("CVE-2024-1");
assert.equal(found.items.length, 1);
const hidden = store.searchTemplates("nope");
assert.equal(hidden.items[0].path.replace(/\\/g, "/"), ".github/auto.yml");
const listed = dispatch(store, { op: "pocSearch", templateLimit: 40, templateOffset: 0 });
assert.equal(listed.ok, true);
assert.equal(listed.templates.items.length, 1);
assert.equal(listed.templates.total, 2);
assert.equal(listed.templates.items.length, 3);
assert.equal(listed.templates.total, 4);
assert.equal(listed.templates.byCategory.find((c) => c.code === "rce").n, 1);
const filtered = dispatch(store, { op: "pocSearch", category: "sqli", templateLimit: 40, templateOffset: 0 });
assert.equal(filtered.templates.matched, 1);
assert.equal(filtered.templates.items[0].category, "sqli");
console.log("ok: template page");
} finally {
try { store?.close(); } catch { /* ignore */ }