🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI

占位符编辑拦截 acus9345/dsh-block-placeholder-edits

DeepSeek Harness
acus93457 天前有提交已提供中文文档扫描:未发现敏感能力

模型有个习惯,会悄悄毁掉文件。它们不想重打代码,就写一句 // ... existing code ...…

31.5/100
综合分
2
GitHub 星标
—
npm 周下载
—/5
用户评分

数据截至 2026/10/25 · 周下载取自 npm 全网(含 CI / 镜像),非本站安装数;综合分由星标、活跃度与兼容性检查合成。

安装命令 · 需先装 dsh CLI 引擎
dsh plugin --profile web add acus9345/dsh-block-placeholder-edits
该包不可直接 npm 安装,改从 GitHub 源安装(明细见下方安装检查)

状态速览

判定依据:实装验证 · 静态安装检查 · 自动扫描 · 仓库维护状态
信任档位:需留意
是什么
dsh 原生插件 · security
装得上吗
实装验证未通过(unknown),装前请到仓库确认最近更新与 issue
L4 · 真实安装等级说明 →
安全吗
本站尚未对该插件做风险分级
暂未覆盖,不等同于无风险
还在维护吗
活跃:最近一次提交在 7 天前
档位由哪些信号合成

本站实装验证(真实安装 L4 覆盖全站;L5 为运行时冒烟或实机截图,覆盖范围小于 L4) · 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。 下方各区块是它的证据明细。

验证判据与等级说明 →
⚠︎ 实装验证未通过(unknown · 2026/10/30) ——可能是验证环境差异,装前建议到 GitHub 仓库确认最近更新与 issue。
社区实装还没有人打卡 · 装过的第一个就是你
安全扫描自动 · 静态分析源码
v2.7.0
🟢 扫描:未发现敏感能力尚无人工评估
展开查看扫描说明与证据 ↓

静态扫描未发现敏感能力:最多只发网络请求、读取自身元数据或只读文件,未发现执行命令、文件写入或敏感信息读取。

扫描于 2026/10/31(1 天前) · 范围 入口闭包 + 发布文件清单 · 来源 GitHub 仓库

静态扫描只反映源码中出现的调用,不构成安全背书;人工评估与自动扫描相互独立、互不覆盖。

依赖的 DSH / Cordis 模块
@deepseek-ai/cordis@deepseek-ai/dsh@deepseek-ai/dsh-agent@deepseek-ai/dsh-fs@deepseek-ai/dsh-llm@deepseek-ai/dsh-session@deepseek-ai/dsh-tools@deepseek-ai/schemastery
给这个插件打分还没有人投票↓
用户评分
还没有人投票,来当第一个

DeepSeek Harness 插件,拒绝那些用 // ... existing code ... 占位符删掉真实代码的编辑。

README

由 DeepSeek 最新模型翻译生成
dsh-block-placeholder-edits 模型有个习惯,会悄悄毁掉文件。它们不想重打代码,就写一句 // ... existing code ... 顶替,而编辑工具照单全收。于是文件里原本四十行真实代码的位置,现在只剩一条注释。你只有等构建挂了才发现,更糟的是构建没挂。 这个 DeepSeek Harness 插件会在每次 write 和 edit 落地前检查。如果新文本用占位注释顶替代码,或者整文件写入丢掉大文件的大部分内容,调用会被拒绝,文件保持原样。模型会收到明确提示,指出是哪一行出了问题: dsh-block-placeholder-edits blocked this edit to src/app.ts: the new text contains placeholder comments that stand in for code instead of the code itself. Writing them would delete whatever they replace. line 2: // ... rest of the function unchanged Fix: write out the full code in place of each placeholder, or use a smaller edit
展开完整文档(README 剩余 1 节)
dsh-block-placeholder-edits

模型有个习惯,会悄悄毁掉文件。它们不想重打代码,就写一句 // ... existing code ... 顶替,而编辑工具照单全收。于是文件里原本四十行真实代码的位置,现在只剩一条注释。你只有等构建挂了才发现,更糟的是构建没挂。

这个 DeepSeek Harness 插件会在每次 write 和 edit 落地前检查。如果新文本用占位注释顶替代码,或者整文件写入丢掉大文件的大部分内容,调用会被拒绝,文件保持原样。模型会收到明确提示,指出是哪一行出了问题:

dsh-block-placeholder-edits blocked this edit to src/app.ts: the new text contains
placeholder comments that stand in for code instead of the code itself. Writing them
would delete whatever they replace.
line 2: // ... rest of the function unchanged
Fix: write out the full code in place of each placeholder, or use a smaller edit
that replaces only the lines you are changing (old_string/new_string) so untouched
code stays as it is.

实际用下来,模型对这套反馈反应不错。它会改用范围更小的 edit,或者老老实实把代码写全。

安装

dsh plugin --profile web add dsh-block-placeholder-edits

这里用的是 web 配置档,也就是你用 dsh web 启动的浏览器界面。如果你用别的方式跑 DSH,就换成 headless(脚本和 CI)或 acp(编辑器集成)。每个配置档各管一份插件列表,所以用到的配置档都要加一遍。装完立即生效。卸载用 dsh plugin --profile web remove dsh-block-placeholder-edits。

从克隆安装

想试本地改动,就打包成 tarball 再装:

git clone https://github.com/acus9345/dsh-block-placeholder-edits
cd dsh-block-placeholder-edits
npm install
npm pack
dsh plugin --profile web add ./dsh-block-placeholder-edits-0.2.0.tgz

什么算占位符

指的是那些在谈论代码、而不是本身就是代码的注释,任何常见注释风格都算(//、#、/* /、、--、;、JSX 的 {/ /}):

// ... existing code ...
rest of the file unchanged
/ ... /
// keep the rest as is
// ... other methods
{/ ... /}

单独一行 ... 也算,但 Python、Markdown 这类 ... 有实际含义的文件除外。

普通注释可以通过,包括那些提到已有代码的注释。旧文本里本来就有的占位符也不算,所以文件里原本就带一个的话,插件不会去烦模型。

第二项检查针对整文件 write 调用。如果一个 40 行及以上的文件被替换成不到一半的行数,写入会被拒绝。这种模式几乎总是意味着模型凭记忆重写了文件,漏掉了一大块。定点编辑不受这项检查影响,新文件也不受影响。

模型确实想这么写的时候

有时候,删掉文件的大部分内容正是目的所在。模型会被告知:可以重复一次完全相同的调用以确认,第二次尝试就会放行。这样真正的重构不会卡住,但模型必须主动选择这么做。如果你更希望由人来决定,就设置 mode: ask。

配置

最简单的办法:打开 DSH 侧边栏里的 Plugins,点击 dsh-block-placeholder-edits,改好你想要的内容,然后按 Save。下一次工具调用就会生效,不用重启。

或者往 ~/.dsh/profiles/<profile>/cordis.patch.yml 里加一行,像下面这样;想对所有配置档生效,就加到 ~/.dsh/cordis.patch.yml。没写的键保持默认值。

- id: block-placeholder-edits
config:
mode: deny # or ask for an approval prompt
shrinkRatio: 0.5 # 0 turns the large-deletion check off
minLinesForShrink: 40 # files shorter than this are never shrink-checked
allowIdenticalRetry: true # false: a refusal is final
extraPatterns: [] # extra regexes for your own placeholder phrasing
ignore: ['docs/*'] # globs to skip entirely

开发

npm install
npm test # detector unit tests
npm run test:e2e # real dsh runs against a scripted local model, no API key needed

安装测试会运行 dsh plugin add,这需要 pnpm 在 PATH 里。

MIT 协议。作者 acus9345。欢迎在 issues 里反馈 bug 和想法。
预览分享卡片长什么样 ↓acus9345/dsh-block-placeholder-edits
分享 · DeepSeek Harness Hub
acus9345/dsh-block-placeholder-edits

模型有个习惯,会悄悄毁掉文件。它们不想重打代码,就写一句 // ... existing code ...…

回到顶部