After each write or edit of a .js, .mjs, .cjs, .py or .json file, runs the real parser (node --check, Python compile, JSON.parse) and injects the parse error into the next step so the model fixes it immediately. Observes only: never blocks a tool call and never changes the tool result.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-syntax-gate
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:xinming-chenniang/dsh-syntax-gate
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
DSH 宿主插件(无界面)。
write/edit落盘后,按扩展名用真解析器检查一遍; 失败就在模型下一步注入「文件 + 错误」,当步即可修。只观察,不拦截,不改工具结果。
它补的是哪一段
AI 写代码最容易坏的时机不是提交,而是落盘那一刻:写坏一个 .mjs,要等下一次运行才炸,
而 pre-commit 管不到没有 git 的目录、也管不到还没提交的改动。这个插件把检查放到落盘后的一步之内。
行为
| 事件 | 动作 |
|---|---|
tools/result(write / edit) |
按扩展名校验:.js/.mjs/.cjs → node --check;.py → Python compile()(不写 __pycache__);.json → JSON.parse |
| 校验失败 | 进队列(同路径只留最新,最多 5 条,10 分钟过期),不抛错、不改工具结果 |
agent/pre-step |
队列非空时把最多 3 条拼成一条用户消息注入,随后清空 |
| 其它工具 / 其它扩展名 | 连读都不读(.gd/.lua/.ps1 没有 50ms 级语法器,故意不查) |
边界(别指望它做超过这些)
- 只查语法,不跑 lint / 类型 / 测试——那些慢,且各项目有自己的入口(
npm run check)。 - 不拦:不
reject、不改入参、不碰tools/pre-execute;拦提交是 pre-commit 的事。 - 只在同回合内回灌:错误 TTL 10 分钟,超时就丢;旧错误不会追着人跑。
- 队列不按会话隔离(宿主
agent/pre-step不带可靠的会话/agent 身份):一条错误消息可能出现在 同进程的另一回合——但它是共享文件系统上的客观事实,误投危害小。
安装
市场:DSH 桌面端 → 设置 → 插件 → 搜
syntax-gate。CLI(源码安装):
dsh plugin --profile <profile> add github:xinming-chenniang/dsh-syntax-gate本地开发:在 profile 的
package.json里加"dsh-syntax-gate": "link:<仓库路径>",并把dsh-syntax-gate追加进dsh.profile.bundles, 然后pnpm install;装载状态看dsh plugin --profile <profile> why dsh-syntax-gate。 改bundles后需重启应用才生效。
配置
在 profile 的 cordis.patch.yml 里按 id 覆盖(也可直接改本包的 cordis.patch.yml):
- id: dsh-syntax-gate
name: dsh-syntax-gate
config:
enabled: true
timeoutMs: 20000 # 单次校验上限
maxBytes: 8388608 # 超过这个体积不查
maxQueued: 5
ttlMs: 600000
skipDirs: [node_modules, .git, dist, build, coverage, __pycache__, .venv, venv, _trash]
关掉:给该条目加 disabled: true。
自检
node --test # 期望 10 个用例全绿
端到端:让 AI 写一个含语法错误的 .mjs,下一步上下文里应出现 [语法闸门] … 解析失败 开头的用户消息;
把文件改对再写一次,不再出现。
与 dsh-verify-gate 的区别
名字像,做的事不同:Raysnows/dsh-verify-gate 是完成闸门——一个回合改过代码却没跑验证时,
提醒模型「去跑测试或申报豁免」;本插件直接执行语法校验,把解析错误回灌给模型。
两者插件 id 不同,可以同时装。
实测经验
- 兜底 catch 会吃掉 JSON 校验失败:
JSON.parse的异常若落进runSyntaxCheck最外层 「任何意外都不弄坏工具调用」的 catch,就会被判成 ok=true——单测第一版就是这么挂的。 JSON 分支必须自己 catch 并返回ok:false。 python -m py_compile会往__pycache__写.pyc,把工作区弄脏;改用compile(source, path, 'exec')。
License
MIT
Links
More in this category
yjh051108/dsh-routing-suite★ 7028
One repository, three parts: a runtime injector for DSH plugin packages (inject, hot-reload, unload, promote a dev staging tool to the front, route self-heal, plus a settings-page plugin manager that lists, unloads and drags folders in to internalize), a task-aware reasoning-mode router agent preset (router-standard / router-spec / router-react), and a graded two-level task protocol whose six tools (commit_star, lock_stage, revise_do, edit_plan, mark_task, redteam_verdict) pin task state to disk. The injector implementation ships in-tree, so the install carries its own behaviour rather than a dependency list.
strukto-ai/mirage#dsh★ 3954
Swaps the filesystem and bash providers for a mirage virtual workspace: file tools and shell commands run over mounted resources (RAM, S3, Redis, Slack, Gmail, Notion, Postgres) instead of the host disk, with per-mount read/write/exec modes, per-command sandbox routing (monty, pyodide, quickjs in process; docker, e2b, daytona remote), and installed CLIs (git, gh, slack, linear, ntn, gws, or one you register) as head words in the virtual terminal.
first-fluke/oh-my-agent#dsh★ 1496
Runs project OMA checks before and after tool execution and when a turn tries to finish. Installs its OMA CLI dependency and initializes unconfigured projects on first use. Requires Node.js 22+; initial setup needs network access and project write access.
MichengAI/dsh-skills-manager★ 641
Manages local DeepSeek Harness skills in Settings and shows shared Agent skills as read-only.
hust-open-atom-club/oh-dsh★ 326
Community distribution: TUI, desktop, and Web UI as one bundle with layered installation.
Fishquito7/dsh-skill-mcp-panel★ 292
Manages DSH skills and MCP servers from the web settings: skill cards with hot enable/disable, workspace scopes, groups, batch migration and drag-and-drop import, plus stdio/HTTP MCP CRUD with connection tests, secret redaction and the unified dsh-panel CLI.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.