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

# dsh-plugin-devkit

Developer toolkit for building DeepSeek Harness (dsh) plugins. Generates compliant scaffolds, lints your tool schema against the 3 hard rules, and prepares a registry entry for publishing.

## Install

```bash
# Option 1 (recommended): from npm (package name is dsh-plugin-devkit)
dsh plugin --profile web add dsh-plugin-devkit

# Option 2: from GitHub
dsh plugin --profile web add github:d-ouyang/dsh-plugin-devkit

# local dev:
dsh plugin --profile web add ./dsh-plugin-devkit
```

Restart the web service (`:3080`) after installing.

## Tools

### `scaffold_plugin` — generate a compliant scaffold
Say in chat: *"Generate a dsh plugin named my-tool, category tools, author d-ouyang"*
→ Creates `~/dsh-plugin-my-tool/` with the entry files (**TypeScript by default**: `index.ts` + `<name>-core.ts` + `tsconfig.json`), `package.json`, `cordis.patch.yml`, `README.md`, `test.ts`, `examples/`.
→ Pass `language: "js"` for plain JavaScript (`index.js` + `<name>-core.js` + `test.mjs`).
→ TypeScript plugins are transpiled on the fly by dsh's tsx at runtime (zero build) and get type-checking for the cordis ctx and tool schema.

### `lint_plugin` — catch the 3 hard schema rules
Say: *"Check if ~/dsh-plugin-my-tool's schema is valid"*
→ Compiles your tools with the real harness `defineTool` compiler and translates cryptic errors into "you broke rule N — fix it like this".

### `explain_rules` — the 3 hard rules explained
Say: *"What are the 3 hard rules for dsh tool schema?"*

### `open_landscape` — plugin market landscape dashboard
Say: *"Show me the dsh plugin market"* / *"Open the plugin landscape"*
→ Generates and opens a visual dashboard: per-category plugin counts / avg stars / max stars, Top 25 by stars, and a competition-gap scan. Every direction has a "create this kind of plugin" button that copies a market-aware prompt — paste it into chat and the agent uses `scaffold_plugin` to build that direction for you.
- Open directly in browser: `file://~/.dsh/devkit/landscape.html`
- If dsh web has loaded this plugin (port may vary): `http://localhost:3080/devkit/landscape`

## The 3 hard rules

1. `required` is either omitted or `true` — never `false`.
2. `type` is a single string — no arrays (use `type: 'json'` for nullable).
3. Every `object` (incl. nested `items`) must set `additionalProperties: true|false`.

Full workflows: [USAGE.md (EN)](./docs/USAGE.en.md) · [USAGE.md (中文)](./docs/USAGE.md)
