> 🇨🇳 简体中文 | 🇬🇧 [English](./README.md)

# dsh-plugin-devkit

用于开发 DeepSeek Harness（dsh）插件的开发者工具包。一键生成合规脚手架、按三条硬规则校验 schema、生成发布到社区注册表的条目。

## 安装

```bash
# 方式一（推荐）：从 npm 安装（包名即 dsh-plugin-devkit）
dsh plugin --profile web add dsh-plugin-devkit

# 方式二：从 GitHub 安装
dsh plugin --profile web add github:d-ouyang/dsh-plugin-devkit

# 本地开发：dsh plugin --profile web add ./dsh-plugin-devkit
```

装完重启 web 服务（:3080）。

## 工具

### `scaffold_plugin` —— 生成合规脚手架
对话里说：「帮我生成一个 dsh 插件，名字 my-tool，品类 tools，作者 d-ouyang」
→ 在 `~/dsh-plugin-my-tool/` 生成入口文件（**默认 TypeScript**：`index.ts` + `<name>-core.ts` + `tsconfig.json`）、`package.json`、`cordis.patch.yml`、`README.md`、`test.ts`、`examples/`。
→ 想生成纯 JavaScript，传 `language: "js"`，则为 `index.js` + `<name>-core.js` + `test.mjs`。
→ TypeScript 插件运行时由 dsh 的 tsx 即时转译（零构建），且能在编辑器/tsc 阶段对 cordis ctx 与 tool schema 做类型检查。

### `lint_plugin` —— 校验三条硬规则
对话里说：「检查 ~/dsh-plugin-my-tool 的 schema 是否合规」
→ 用 harness 真实的 `defineTool` 编译器编译你的工具，把天书错误翻译成「你违反了第几条规则 + 怎么改」。

### `explain_rules` —— 三条规则讲解
对话里说：「dsh 工具 schema 有哪三条硬规则？」

### `publish_plugin` —— 产出注册表条目 + 步骤
对话里说：「把 ~/dsh-plugin-my-tool 发布到社区注册表」
→ 生成 `awesome-dsh-plugin` 注册表条目 JSON 与提交步骤。**不会**自动推送。

### `open_landscape` —— 插件生态画像仪表盘
对话里说：「看看 dsh 插件市场情况」「打开插件画像」
→ 生成并打开一个可视化仪表盘：各品类插件数量/平均星/最高星、高星 Top25、竞争空白扫描。每个方向都有「创建此方向插件」按钮，点一下复制一段带市场参考的提示词，直接粘到聊天框即可让智能体用 `scaffold_plugin` 帮你生成该方向的插件。
- 浏览器直接打开：`file://~/.dsh/devkit/landscape.html`
- 若 dsh web 已加载本插件（端口以实际为准）：`http://localhost:3080/devkit/landscape`

## 三条硬规则

1. `required` 要么省略，要么为 `true`——绝不写 `false`。
2. `type` 只能是单一字符串——不接受数组（可空用 `type: 'json'`）。
3. 每个 `object`（含数组 `items` 内嵌套 object）必须写 `additionalProperties: true|false`。

完整工作流：[USAGE.md（中文）](./docs/USAGE.md) · [USAGE.md (EN)](./docs/USAGE.en.md)
