Plugin directory / Knowledge / rulebase
rulebase
Unverified mycodesite
What it does
DeepSeek Harness (dsh) 插件:全局+项目两级 Markdown 规则注入(RuleBase)
Unverified — not yet verified
DeepSeek Harness (dsh) 插件:全局+项目两级 Markdown 规则注入(RuleBase) Not yet verified — install and test it yourself.
“Unverified” means our automated CI has not yet installed this plugin. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.
README
RuleBase
DeepSeek Harness (dsh) 插件:全局 + 项目两级 Markdown 规则注入
以「全局 + 项目」两级 Markdown 规则文件为源,在每次对话开始 / 每次系统提示词组装时把规则注入给 AI,并在 dsh 设置面板提供可视化规则管理界面。
规则仅以 .md 文件持久化,不注册 dsh settings 命名空间、不写入 settings.yaml。
功能
- 注入:启动时扫描全局规则;每个新对话按
agent.session.header.cwd扫描项目规则;全局 + 项目全量组装、全量替换,注入系统提示词。 - 项目路径识别:以「最近活跃 agent 的
session.header.cwd」作为当前项目路径(currentCwd),dsh 切换项目后自动跟随;无活跃 agent 或无有效 cwd 时视为「未选定项目」。 - 即变即用:文件监听 +
agent.inject();保存规则后下一次模型请求自动采用。 - 管理界面:设置面板「规则」区支持全局 / 项目 tab、新建(下拉选全局/项目)、编辑(单击行或设置菜单)、删除、刷新;设置菜单与新建下拉在点击其它区域自动关闭,配色随 dsh 亮/深外观自动切换(
--dsw-alias-*主题 token);项目 tab 在未选定项目时提示「请先开启一个项目对话」,保存项目规则时无项目会弹窗提示。
存储位置
| 级别 | 目录 |
|---|---|
| 全局 | ~/.dsh/rules/*.md |
| 项目 | <cwd>/.dsh/rules/*.md |
每个 .md 文件即一条规则;文件名(去扩展名)作为规则 id。
安装与运行
发布态(从 GitHub 安装)
# 最新版(git 源安装,安装时执行 prepare 现场构建)
dsh plugin add github:mycodesite/dsh-rules
# 指定版本
dsh plugin add github:mycodesite/dsh-rules#v0.1.0
注意:
dsh plugin是 pnpm 转发器。pnpm 10 的默认安全策略会拦截安装时构建,需按 pnpm 报错提示在 profile 的pnpm-workspace.yaml中放行本包的构建脚本后重跑。
也可以下载 GitHub Releases 中的最小化 tarball(仅含构建产物与 patch),本地安装:
dsh plugin add /path/to/rulebase-0.1.0.tgz
开发态(源码直接挂载)
npm install --legacy-peer-deps
node scripts/make-dev-patch.mjs # 生成 cordis.local.yml(git 忽略,不提交)
dsh web --patch ./cordis.local.yml # 或 dsh --profile tui --patch ./cordis.local.yml
cordis.local.yml 由脚本按仓库绝对路径生成,仓库内不写死本机路径,克隆后可移植。
脚本
| 命令 | 说明 |
|---|---|
npm run build |
构建 host 半(tsdown → lib/index.mjs)+ client 半(esbuild → lib/client.js) |
npm run typecheck |
类型检查(host + client 两个 project) |
npm test |
运行单测(tests/smoke.test.ts) |
npm pack |
产出最小发布 tarball(files 白名单) |
node scripts/release.mjs |
typecheck + test + build + pack 一键发布准备 |
node scripts/make-dev-patch.mjs |
生成开发态补丁 cordis.local.yml |
目录结构
src/
├─ host/
│ ├─ index.ts # 装配入口(apply):store / injector / service
│ ├─ paths.ts # 规则级别与目录解析
│ ├─ store.ts # RuleStore:md 文件读写
│ ├─ injector.ts # RuleInjector:注入与刷新(异步读盘 + 同步读缓存)
│ └─ service.ts # RulesService:Connection RPC 桥(UI↔host)
├─ client/
│ ├─ index.ts # 注册 settings.section
│ ├─ types.ts # 最小类型(Rule / RpcResult)
│ ├─ controller.ts # RuleController:列表状态机 + rpc 客户端
│ └─ RuleSection.tsx# 设置面板「规则」区 UI
scripts/
├─ build-client.mjs # client 半 esbuild 构建
├─ make-dev-patch.mjs # 生成开发态补丁
└─ release.mjs # 发布准备(typecheck+test+build+pack)
tests/
└─ smoke.test.ts # RuleStore 全量读写 / 路径解析
docs/
├─ API文档.md # 模块 API 总览
└─ api/ # 分模块文档
.github/workflows/ci.yml # CI:typecheck + test + build + pack(tag 自动发 Release)
文档
- 模块 API:见 docs/API文档.md 与 docs/api/。
- 变更记录:见 CHANGELOG.md。
环境要求
- Node.js
>= 22.5 - 依赖
@deepseek-ai/dsh-*(dsh 生态)与@deepseek-ai/cordis,均为peerDependencies(开发时以devDependencies提供)
许可
MIT © mycodesite
Install
Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:
dsh plugin add dshbase-catalog Then say "install rulebase for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.
This plugin is GitHub source (not published to npm) — install it straight from the repo:
Web profile:
dsh plugin --profile web add github:mycodesite/dsh-rules Headless (CLI) profile:
dsh plugin --profile headless add github:mycodesite/dsh-rules Test report
Not yet L3-verified — see failure note below if we already ran it.
2026-08-28 Note: L1(Release tgz 安装)+L2(dsh 加载)通过 on dsh 0.1.0-rc.8;L3 headless 问答因验证机 DeepSeek API 余额耗尽未执行,待补验。git 直装因作者 devDeps 与当前 dsh 依赖树 ERESOLVE 冲突暂不可用。 Browse all pending failures →