dsh-plugin-guide 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ # {{pkgName}}
2
+
3
+ Um plugin do DeepSeek Harness (DSH) gerado com [`dsh-plugin-dev new`](https://github.com/PerryLink/dsh-plugin-guide).
4
+
5
+ ## Compatibility
6
+
7
+ | Superfície | Estado |
8
+ |---|---|
9
+ | Harness | DeepSeek Harness `0.1.1-rc.2` |
10
+ | Node | `^22.19.0 || >=24.0.0` |
11
+ | Plataformas | Todas (ESM puro; sem código nativo, sem rede) |
12
+
13
+ ## What it does
14
+
15
+ Registra a ferramenta `{{name}}_echo`. Ao chamá-la, responde `<greeting>: <text>`, em que `<greeting>` vem da configuração do plugin e `<text>` é o argumento.
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ pnpm pack
21
+ dsh plugin --profile <name> add ./{{pkgName}}-{{version}}.tgz
22
+ dsh --profile <name> --dump-config | grep '{{pkgName}}'
23
+ ```
24
+
25
+ ## Configuration
26
+
27
+ | Chave | Tipo | Padrão | Descrição |
28
+ |---|---|---|---|
29
+ | `greeting` | string | `Hello` | Prefixo da resposta echo |
30
+
31
+ A configuração é validada pelo schema Schemastery `Config` em `src/config.ts`; nenhum ajuste fica fixo no código.
32
+
33
+ ## Development
34
+
35
+ ```sh
36
+ pnpm install
37
+ pnpm run typecheck
38
+ pnpm test
39
+ pnpm run build
40
+ ```
41
+
42
+ ## License
43
+
44
+ [Apache License 2.0](LICENSE) © {{year}} {{pkgName}} contributors.
@@ -0,0 +1,44 @@
1
+ # {{pkgName}}
2
+
3
+ 由 [`dsh-plugin-dev new`](https://github.com/PerryLink/dsh-plugin-guide) 脚手架生成的 DeepSeek Harness(DSH)插件。
4
+
5
+ ## Compatibility
6
+
7
+ | 项目 | 状态 |
8
+ |---|---|
9
+ | Harness | DeepSeek Harness `0.1.1-rc.2` |
10
+ | Node | `^22.19.0 || >=24.0.0` |
11
+ | 平台 | 全部(纯 ESM;无原生代码、无网络) |
12
+
13
+ ## What it does
14
+
15
+ 注册 `{{name}}_echo` 工具。调用它时返回 `<greeting>: <text>`,其中 `<greeting>` 来自插件配置,`<text>` 是入参。
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ pnpm pack
21
+ dsh plugin --profile <name> add ./{{pkgName}}-{{version}}.tgz
22
+ dsh --profile <name> --dump-config | grep '{{pkgName}}'
23
+ ```
24
+
25
+ ## Configuration
26
+
27
+ | 键 | 类型 | 默认值 | 说明 |
28
+ |---|---|---|---|
29
+ | `greeting` | string | `Hello` | echo 回复的前缀 |
30
+
31
+ 配置由 `src/config.ts` 中的 Schemastery `Config` 模式校验;没有任何硬编码可调参数。
32
+
33
+ ## Development
34
+
35
+ ```sh
36
+ pnpm install
37
+ pnpm run typecheck
38
+ pnpm test
39
+ pnpm run build
40
+ ```
41
+
42
+ ## License
43
+
44
+ [Apache License 2.0](LICENSE) © {{year}} {{pkgName}} contributors.
@@ -0,0 +1,10 @@
1
+ # {{pkgName}} bundle layer: register the scaffolded plugin as a bundle row.
2
+ # This file is the `dsh.bundle.patch` layer (see package.json#dsh.bundle.patch).
3
+ # Layer semantics: a YAML array of row verbs; `insert` adds plugin rows to the
4
+ # composed config. A row's `id` must be unique within the layer stack; `name`
5
+ # resolves the plugin module through the installed package (package.json#main).
6
+ - insert:
7
+ # `id`: stable row identifier used by later layers to override this row.
8
+ - id: {{pkgName}}
9
+ # `name`: the module the loader imports; resolves to this package entry.
10
+ name: {{pkgName}}
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "{{pkgName}}",
3
+ "version": "{{version}}",
4
+ "description": "A DeepSeek Harness (DSH) plugin scaffolded by dsh-plugin-dev.",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/index.d.ts",
8
+ "files": [
9
+ "lib",
10
+ "cordis.patch.yml"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsdown",
14
+ "typecheck": "tsc --noEmit",
15
+ "test": "vitest run",
16
+ "prepare": "tsdown"
17
+ },
18
+ "dependencies": {
19
+ "tsdown": "^0.22.14",
20
+ "typescript": "^5.9.3"
21
+ },
22
+ "devDependencies": {
23
+ "@deepseek-ai/cordis": "^4.0.1",
24
+ "@deepseek-ai/dsh-tools": ">=0.1.0-rc.8 <0.2.0",
25
+ "@deepseek-ai/schemastery": "^3.18.0",
26
+ "@types/node": "^22.20.1",
27
+ "vitest": "^3.2.7"
28
+ },
29
+ "peerDependencies": {
30
+ "@deepseek-ai/cordis": "^4.0.1",
31
+ "@deepseek-ai/dsh-tools": ">=0.1.0-rc.8 <0.2.0",
32
+ "@deepseek-ai/schemastery": "^3.18.0"
33
+ },
34
+ "dsh": {
35
+ "bundle": {
36
+ "patch": "./cordis.patch.yml"
37
+ }
38
+ },
39
+ "engines": {
40
+ "node": "^22.19.0 || >=24.0.0"
41
+ },
42
+ "packageManager": "pnpm@11.7.0",
43
+ "license": "Apache-2.0"
44
+ }
@@ -0,0 +1,12 @@
1
+ import Schema from '@deepseek-ai/schemastery'
2
+
3
+ // Tunable configuration must be a Schemastery Schema, never a plain object:
4
+ // the harness validates it at load time and fails loud on invalid values, and
5
+ // every key can be changed from cordis.yml without editing code (guide §3.6).
6
+ export interface Config {
7
+ greeting: string
8
+ }
9
+
10
+ export const Config: Schema<Config> = Schema.object({
11
+ greeting: Schema.string().default('Hello').description('Greeting prefix for the echo tool.'),
12
+ })
@@ -0,0 +1,36 @@
1
+ import type { Context } from '@deepseek-ai/cordis'
2
+ import { defineTool } from '@deepseek-ai/dsh-tools'
3
+ import { Config } from './config'
4
+ import type { Config as ConfigShape } from './config'
5
+
6
+ export const name = '{{pkgName}}'
7
+ export const inject = ['tools']
8
+
9
+ // Re-export the schema so the loader can validate this plugin's config.
10
+ export { Config }
11
+
12
+ /** Pure greeting builder kept separate from the tool so tests stay keyless. */
13
+ export function buildGreeting(greeting: string, text: string): string {
14
+ return `${greeting}: ${text}`
15
+ }
16
+
17
+ // Every registration is an effect: `ctx.tools.register` returns the disposer that
18
+ // removes the tool on unload, so the plugin stays hot-reloadable (guide §3.3).
19
+ export function apply(ctx: Context, config: ConfigShape): void {
20
+ ctx.tools.register(
21
+ defineTool({
22
+ name: '{{name}}_echo',
23
+ description: 'Echo a greeting back to the caller.',
24
+ parameters: {
25
+ text: { type: 'string', required: true, description: 'Text to echo.' },
26
+ },
27
+ output: {
28
+ schema: { type: 'string' },
29
+ render: (_args, value) => [{ type: 'text', text: value }],
30
+ },
31
+ async execute(args) {
32
+ return buildGreeting(config.greeting, args.text)
33
+ },
34
+ }),
35
+ )
36
+ }
@@ -0,0 +1,12 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { buildGreeting } from '../src/index'
3
+
4
+ describe('{{pkgName}}', () => {
5
+ it('builds a greeting from the configured prefix', () => {
6
+ expect(buildGreeting('Hello', 'world')).toBe('Hello: world')
7
+ })
8
+
9
+ it('keeps the text verbatim after the prefix', () => {
10
+ expect(buildGreeting('Hi', 'a b:c')).toBe('Hi: a b:c')
11
+ })
12
+ })
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "lib": ["ES2022"],
7
+ "types": ["node"],
8
+ "strict": true,
9
+ "noImplicitAny": true,
10
+ "skipLibCheck": true,
11
+ "verbatimModuleSyntax": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true
15
+ },
16
+ "include": ["src", "tests"]
17
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from 'tsdown'
2
+
3
+ // tsdown bundles src/index.ts into lib/index.js (ESM) and emits lib/index.d.ts.
4
+ // It is also the self-contained `prepare` script for git installs: no project
5
+ // references, no type checking (see guide §7.1 "build-script catch").
6
+ export default defineConfig({
7
+ entry: { index: 'src/index.ts' },
8
+ format: ['esm'],
9
+ platform: 'node',
10
+ target: 'node22',
11
+ dts: true,
12
+ clean: true,
13
+ sourcemap: false,
14
+ outDir: 'lib',
15
+ })
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vitest/config'
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ include: ['tests/**/*.test.ts'],
6
+ environment: 'node',
7
+ },
8
+ })