dsh-publish-helper 0.22.0 → 0.23.1
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.
- package/README.md +9 -0
- package/docs/ecosystem.md +99 -0
- package/docs/plugin-vs-skill.md +79 -0
- package/index.js +9 -3
- package/lib/workflow.mjs +18 -0
- package/package.json +2 -1
- package/templates/release.yml +14 -9
- package/templates/skill-plugin/README.md +22 -0
- package/templates/skill-plugin/cordis.patch.yml +3 -0
- package/templates/skill-plugin/index.js +40 -0
- package/templates/skill-plugin/lib/skill.mjs +18 -0
- package/templates/skill-plugin/package.json +24 -0
package/README.md
CHANGED
|
@@ -6,6 +6,15 @@ DSH 插件上架 / 发布 / 撤回助手:发现、检查、生成 entry、开
|
|
|
6
6
|
|
|
7
7
|
插件在运行时注册 **`publish-release`** 技能(按需加载,不占常驻 token):preflight → 收录检查 → 建仓库 → npm 发布(staging 审核)→ entry/PR → 撤回。含 BOM、占名、stale fork、2FA 限制等坑。
|
|
8
8
|
|
|
9
|
+
## 模板与指南
|
|
10
|
+
|
|
11
|
+
- `templates/skill-plugin/`:**技能 + 插件**搭配模板,复制即用
|
|
12
|
+
- `templates/release.yml`:GitHub Actions 发版工作流
|
|
13
|
+
- `docs/plugin-vs-skill.md`:插件 vs 技能选型一页指南
|
|
14
|
+
- `docs/ecosystem.md`:**生态定位**——插件配技能一套、互操作约定、token 账、交付清单
|
|
15
|
+
|
|
16
|
+
`publish_workflow` 默认写 **trusted publishing** 工作流(GitHub OIDC,无需长期 token);需要 secret 时传 `mode: "token"`。
|
|
17
|
+
|
|
9
18
|
## 安装
|
|
10
19
|
|
|
11
20
|
```bash
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# DSH 生态定位:插件配技能,一套交付
|
|
2
|
+
|
|
3
|
+
> 一句话:**插件给动作,技能给流程;装一套,用一套;跨套可组合;常驻成本趋近于零。**
|
|
4
|
+
|
|
5
|
+
## 1. 三层模型
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
DSH(宿主)
|
|
9
|
+
├─ 插件(Plugin) → 能力层:工具、钩子、UI、HTTP 路由
|
|
10
|
+
├─ 技能(Skill) → 流程层:步骤、判断、坑(按需加载)
|
|
11
|
+
└─ 组合(Bundle) → 交付层:插件 + 技能 + 模板,一起装、一起发版
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| 层 | 谁消费 | 成本 |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| 插件 | 模型(工具 schema 每轮可见) | 常驻(约 300–900 token/套) |
|
|
17
|
+
| 技能 | 模型(命中才加载) | 0 常驻;命中约 500–800 token |
|
|
18
|
+
| 组合 | 用户(一条安装命令) | 安装一次 |
|
|
19
|
+
|
|
20
|
+
## 2. 定位原则
|
|
21
|
+
|
|
22
|
+
1. **一套交付**:每个 bundle 同时提供「能做」和「会做」——工具 + 技能,缺一不可。
|
|
23
|
+
2. **技能优先**:能写成技能解决的流程,不进工具描述;工具只暴露动作和参数。
|
|
24
|
+
3. **硬约束进代码**:安全默认、权限校验、重试策略写在插件里;技能只做建议。
|
|
25
|
+
4. **工具数克制**:一套 ≤5 个工具;低频动作拆套或改技能 + CLI。
|
|
26
|
+
5. **跨套组合**:技能可以调用其他插件的工具;工具名全局唯一、语义稳定。
|
|
27
|
+
|
|
28
|
+
## 3. 互操作约定
|
|
29
|
+
|
|
30
|
+
### 工具命名
|
|
31
|
+
|
|
32
|
+
- 前缀 = 插件域:`publish_*`、`bili_*`、`procedures_*`
|
|
33
|
+
- 动作 = 动词:`_preflight`、`_submit`、`_edit`、`_check`
|
|
34
|
+
- 全局唯一,发布后不改名(技能靠名字引用)
|
|
35
|
+
|
|
36
|
+
### 技能引用工具
|
|
37
|
+
|
|
38
|
+
技能正文里显式列出用到的工具:
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
## Tools used
|
|
42
|
+
- bili_check — login and binary status
|
|
43
|
+
- bili_upload — upload with metadata
|
|
44
|
+
- bili_edit — change title/partition/visibility
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
规则:
|
|
48
|
+
|
|
49
|
+
- 只写工具名和作用,**不复制**工具参数说明(避免两处维护)
|
|
50
|
+
- 工具缺失时降级:给出可执行的 shell 命令,不假装调用成功
|
|
51
|
+
- 跨套引用时标注插件名:`publish_workflow`(来自 dsh-publish-helper)
|
|
52
|
+
|
|
53
|
+
### 技能命名
|
|
54
|
+
|
|
55
|
+
- kebab-case,`<域>-<任务>`:`bilibili-upload`、`publish-release`
|
|
56
|
+
- 一个技能只做一件事;长流程拆多个技能
|
|
57
|
+
- 描述里写「什么时候用」,不要写实现细节
|
|
58
|
+
|
|
59
|
+
## 4. 组合示例
|
|
60
|
+
|
|
61
|
+
| 组合 | 插件 | 技能 | 组合场景 |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| 发布 | `dsh-publish-helper` | `publish-release` | 发版 → 收录 → 撤回 |
|
|
64
|
+
| 视频 | `dsh-bilibili-upload` | `bilibili-upload` | 上传 → 核对 → 改可见性 |
|
|
65
|
+
| 经验 | `dsh-procedures` | (钩子自动触发 + 卡库) | 报错命中 → 读卡 → 修 |
|
|
66
|
+
| 跨套 | publish-helper + bili-upload | `publish-release` 里引用 `bili_*` | 发布插件后录演示视频 |
|
|
67
|
+
|
|
68
|
+
## 5. Token 账
|
|
69
|
+
|
|
70
|
+
| 方案 | 常驻/轮 | 说明 |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| 纯插件(含全部流程) | 900–1500 | 流程塞进提示,每轮付费 |
|
|
73
|
+
| 纯技能 | 0 | 但无法执行动作 |
|
|
74
|
+
| **插件 + 技能(本定位)** | **300–900** | 工具最小化;流程按需加载 |
|
|
75
|
+
| 省下的部分 | 约 40–70% | 相对把流程写进常驻提示 |
|
|
76
|
+
|
|
77
|
+
关键动作:
|
|
78
|
+
|
|
79
|
+
- 工具 schema 只留必要参数(默认值写进参数描述)
|
|
80
|
+
- 一个插件不要注册 10 个低频工具
|
|
81
|
+
- 技能只在命中时加载;触发条件写准,避免误加载
|
|
82
|
+
|
|
83
|
+
## 6. 交付清单(每套必检)
|
|
84
|
+
|
|
85
|
+
- [ ] `dsh.bundle.patch` 可安装
|
|
86
|
+
- [ ] 工具名带前缀、≤5 个
|
|
87
|
+
- [ ] 至少一个运行时技能(`ctx.skills.register`)
|
|
88
|
+
- [ ] 技能声明 Tools used
|
|
89
|
+
- [ ] 安全默认在代码里(默认私密、校验、dry-run)
|
|
90
|
+
- [ ] README:安装命令 + 一句话 + 技能说明
|
|
91
|
+
- [ ] 测试覆盖参数构造与安全校验
|
|
92
|
+
- [ ] preflight PASS + npm 发布 + 市场投递
|
|
93
|
+
|
|
94
|
+
## 7. 路线
|
|
95
|
+
|
|
96
|
+
1. ✅ 固定模式:`templates/skill-plugin/`(已交付)
|
|
97
|
+
2. ✅ 两套参考实现:bili-upload、publish-helper(已交付)
|
|
98
|
+
3. 下一步:**能力索引**——一个技能列出已安装套件的工具/技能,帮助跨套发现
|
|
99
|
+
4. 再下一步:市场目录按「套」展示(插件 + 技能 + 组合场景)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# DSH 插件 vs 技能:怎么选
|
|
2
|
+
|
|
3
|
+
> 一页判断:**动作进插件,流程进技能;能只做技能就不做插件。**
|
|
4
|
+
|
|
5
|
+
## 1. 两者是什么
|
|
6
|
+
|
|
7
|
+
| | 插件(bundle) | 技能(SKILL.md / runtime skill) |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| 本质 | 代码:注册工具、钩子、UI、HTTP 路由 | 文档:触发条件 + 步骤 + 坑 |
|
|
10
|
+
| 能执行动作 | ✅ 直接调 API / spawn / 写文件 | ❌ 只能教模型自己拼 shell |
|
|
11
|
+
| 常驻成本 | 工具 schema + 提示,**每轮都付费** | **0**(不命中不加载) |
|
|
12
|
+
| 加载成本 | 低(已常驻) | 命中一次约 500–800 token |
|
|
13
|
+
| 跨 agent | 仅 DSH | 任何 agent 都能读 |
|
|
14
|
+
| 安装 | 需安装 bundle | 复制文件即可 |
|
|
15
|
+
| 安全边界 | 代码里做默认值/校验/确认 | 只能"建议",模型可能不听 |
|
|
16
|
+
|
|
17
|
+
## 2. 决策树
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
要做的事需要「执行动作」吗?
|
|
21
|
+
├─ 否 → 只做技能(0 常驻成本)
|
|
22
|
+
└─ 是 → 这个动作使用频率高吗?
|
|
23
|
+
├─ 高(每轮都可能用) → 插件
|
|
24
|
+
├─ 低(偶尔用一次) → 技能 + 轻量 CLI,或 技能 + 插件(插件可禁)
|
|
25
|
+
└─ 需要 UI/安全默认/复杂编排 → 插件
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 3. Token 账(关键)
|
|
29
|
+
|
|
30
|
+
| 方案 | 常驻/轮 | 用一次的成本 |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| 插件(3 个工具) | ~700–900 token | 工具调用输出 |
|
|
33
|
+
| 技能 | 0 | ~600 token(加载)+ 命令输出 |
|
|
34
|
+
| 技能 + 插件 | ~700–900 | ~600 + 调用 |
|
|
35
|
+
|
|
36
|
+
结论:
|
|
37
|
+
- **低频动作**(发视频、发版)→ 技能优先,插件按需启用
|
|
38
|
+
- **高频/必须自动触发**(报错钩子、记忆)→ 插件
|
|
39
|
+
- **不要把流程塞进插件描述**:描述只写"做什么/参数",流程写进技能
|
|
40
|
+
|
|
41
|
+
## 4. 推荐模式:一套双形态
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
your-plugin/
|
|
45
|
+
├── index.js # 工具:原子动作(硬约束、安全默认)
|
|
46
|
+
├── lib/skill.mjs # 技能:流程 + 坑(ctx.skills.register)
|
|
47
|
+
├── skills/ # 可选:给非 DSH agent 的 SKILL.md 副本
|
|
48
|
+
└── README.md
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- 装插件 = 动作 + 技能一起到位
|
|
52
|
+
- 只装技能(复制文件)= 没有硬约束,但跨 agent
|
|
53
|
+
- DSH 里用 `ctx.skills.register()` 注册,零常驻
|
|
54
|
+
|
|
55
|
+
## 5. 判断清单
|
|
56
|
+
|
|
57
|
+
写代码前问:
|
|
58
|
+
|
|
59
|
+
- [ ] 这个动作必须由代码保证吗?(安全默认、校验、重试、API 签名)
|
|
60
|
+
- [ ] 模型每轮都会用到它吗?(是 → 插件,否 → 技能)
|
|
61
|
+
- [ ] 流程里有没有"绝对不能做"的步骤?→ 放进代码,不要只写文档
|
|
62
|
+
- [ ] 技能超过 2k 字了吗?→ 拆成多个技能或引用按需加载的文件
|
|
63
|
+
- [ ] 另一个 agent(Claude Code 等)也要用吗?→ 保留一份 `skills/` 文本
|
|
64
|
+
|
|
65
|
+
## 6. 常见错误
|
|
66
|
+
|
|
67
|
+
| 错误 | 后果 | 修法 |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| 把长流程写进插件系统提示 | 每轮付费,改一次要发版 | 移到技能 |
|
|
70
|
+
| 只做技能却需要安全默认 | 模型可能误操作 | 关键约束放插件 |
|
|
71
|
+
| 插件塞很多低频工具 | schema 常驻浪费 | 拆包或改成技能 + CLI |
|
|
72
|
+
| 技能里写"硬规则" | 模型可能忽略 | 代码里强制 |
|
|
73
|
+
| 技能互相引用大段文档 | 加载成本失控 | 只放步骤,细节按需读 |
|
|
74
|
+
|
|
75
|
+
## 7. 参考实现
|
|
76
|
+
|
|
77
|
+
- `dsh-bilibili-upload`:工具 `bili_upload`/`bili_edit` + 技能 `bilibili-upload`
|
|
78
|
+
- `dsh-publish-helper`:发布工具集 + 技能 `publish-release`
|
|
79
|
+
- 模板:`templates/skill-plugin/`(复制即用)
|
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { readNpmrcToken } from './lib/credentials.mjs';
|
|
|
9
9
|
import { checkPlugin, repoFromUrl, resolveRepo, searchTopic } from './lib/discover.mjs';
|
|
10
10
|
import { AGENT_GUIDE, SECTION_NAME, SUBMISSION_SPEC } from './lib/guide.mjs';
|
|
11
11
|
import { SKILL_REGISTRATION } from './lib/skill.mjs';
|
|
12
|
+
import { WORKFLOW_MODES, workflowText } from './lib/workflow.mjs';
|
|
12
13
|
import { appendPublishLog } from './lib/log.mjs';
|
|
13
14
|
import { inboxDir, intakeZip, listInbox } from './lib/intake.mjs';
|
|
14
15
|
import { npmrcLine, publishArgs, recallArgs } from './lib/npm.mjs';
|
|
@@ -475,19 +476,24 @@ export function apply(ctx, rawConfig) {
|
|
|
475
476
|
|
|
476
477
|
ctx.tools.register({
|
|
477
478
|
name: 'publish_workflow',
|
|
478
|
-
description: 'Write the GitHub Actions
|
|
479
|
+
description: 'Write the GitHub Actions release workflow into a local package directory (.github/workflows/release.yml). Default mode trusted: npm publishes through GitHub OIDC with provenance and no long-lived token; mode token injects NODE_AUTH_TOKEN from the NPM_TOKEN secret.',
|
|
479
480
|
parameters: objectSchema({
|
|
480
481
|
dir: { type: 'string', description: 'Absolute package directory.' },
|
|
482
|
+
mode: { type: 'string', enum: WORKFLOW_MODES, description: 'trusted (default, needs npm Trusted Publisher) or token (needs the NPM_TOKEN secret).' },
|
|
481
483
|
}, ['dir']),
|
|
482
484
|
output: textOutput,
|
|
483
485
|
async execute(args) {
|
|
484
486
|
const directory = String(args.dir);
|
|
485
487
|
if (!existsSync(join(directory, 'package.json'))) throw new Error(`no package.json in ${directory}`);
|
|
486
|
-
const
|
|
488
|
+
const mode = args.mode ?? 'trusted';
|
|
489
|
+
const template = workflowText(mode);
|
|
487
490
|
const target = join(directory, '.github', 'workflows', 'release.yml');
|
|
488
491
|
mkdirSync(dirname(target), { recursive: true });
|
|
489
492
|
writeFileSync(target, template, 'utf8');
|
|
490
|
-
|
|
493
|
+
const hint = mode === 'trusted'
|
|
494
|
+
? 'configure npm -> package -> Settings -> Trusted publishing (GitHub Actions, this repo, release.yml), then push a v* tag'
|
|
495
|
+
: 'add the repository secret NPM_TOKEN, then push a v* tag';
|
|
496
|
+
return { text: `wrote ${target}\nmode: ${mode}\nnext: ${hint}` };
|
|
491
497
|
},
|
|
492
498
|
presentCall: present('Write release workflow'),
|
|
493
499
|
});
|
package/lib/workflow.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
export const WORKFLOW_MODES = ['trusted', 'token'];
|
|
4
|
+
|
|
5
|
+
const TEMPLATE = readFileSync(new URL('../templates/release.yml', import.meta.url), 'utf8');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Render the release workflow.
|
|
9
|
+
* trusted: no NODE_AUTH_TOKEN; npm uses GitHub OIDC (Trusted Publisher must be configured on npm).
|
|
10
|
+
* token: inject NODE_AUTH_TOKEN from the repository secret NPM_TOKEN.
|
|
11
|
+
*/
|
|
12
|
+
export function workflowText(mode = 'trusted') {
|
|
13
|
+
if (!WORKFLOW_MODES.includes(mode)) throw new Error(`unknown mode: ${mode} (use ${WORKFLOW_MODES.join(' or ')})`);
|
|
14
|
+
const env = mode === 'token'
|
|
15
|
+
? ' env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n'
|
|
16
|
+
: '';
|
|
17
|
+
return TEMPLATE.replace('__NODE_AUTH_ENV__\n', env);
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-publish-helper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"description": "DSH plugin publishing assistant: discover by topic, check listing readiness, generate the registry entry, open the pull request and show a settings page.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"cordis.patch.yml",
|
|
54
54
|
"README.md",
|
|
55
55
|
"templates",
|
|
56
|
+
"docs",
|
|
56
57
|
"LICENSE"
|
|
57
58
|
]
|
|
58
59
|
}
|
package/templates/release.yml
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# Copy to .github/workflows/release.yml in the package repository.
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
# add a repository secret NPM_TOKEN = granular npm token
|
|
5
|
-
# (Read and write, Bypass 2FA; never commit it) and push a tag.
|
|
3
|
+
# Two publishing modes (pick one):
|
|
6
4
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
5
|
+
# trusted (default, no long-lived token):
|
|
6
|
+
# 1. npm package page -> Settings -> Trusted publishing -> GitHub Actions,
|
|
7
|
+
# publisher = this repository, workflow = release.yml, environment = (empty)
|
|
8
|
+
# 2. push a v* tag; npm exchanges the GitHub OIDC token for a short-lived credential
|
|
9
|
+
#
|
|
10
|
+
# token (fallback):
|
|
11
|
+
# add a repository secret NPM_TOKEN = granular npm token
|
|
12
|
+
# (Read and write, Bypass 2FA; never commit it) and push a v* tag
|
|
13
|
+
#
|
|
14
|
+
# Granular tokens that bypass 2FA cannot unpublish and are being restricted for
|
|
15
|
+
# direct publishing, so prefer trusted publishing when the npm account has 2FA.
|
|
10
16
|
name: release
|
|
11
17
|
|
|
12
18
|
on:
|
|
@@ -17,7 +23,7 @@ on:
|
|
|
17
23
|
|
|
18
24
|
permissions:
|
|
19
25
|
contents: read
|
|
20
|
-
id-token: write # provenance
|
|
26
|
+
id-token: write # required for provenance and trusted publishing
|
|
21
27
|
|
|
22
28
|
jobs:
|
|
23
29
|
publish:
|
|
@@ -59,5 +65,4 @@ jobs:
|
|
|
59
65
|
|
|
60
66
|
- name: Publish with provenance
|
|
61
67
|
run: npm publish --provenance --access public --ignore-scripts
|
|
62
|
-
|
|
63
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
68
|
+
__NODE_AUTH_ENV__
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# skill-plugin template
|
|
2
|
+
|
|
3
|
+
A DSH bundle that pairs **one tool** with **one on-demand skill**.
|
|
4
|
+
|
|
5
|
+
- Tool: `example_do_task` — the atomic action, registered with `ctx.tools.register`.
|
|
6
|
+
- Skill: `example-task` — the workflow and pitfalls, registered with `ctx.skills.register`.
|
|
7
|
+
- The skill is only loaded when the model needs it, so it adds no resident prompt tokens.
|
|
8
|
+
|
|
9
|
+
## Use it
|
|
10
|
+
|
|
11
|
+
1. Copy this directory into your workspace.
|
|
12
|
+
2. Rename `dsh-example-skill-plugin` / `example-skill-plugin` / `example_do_task` / `example-task` everywhere (package.json, cordis.patch.yml, index.js, lib/skill.mjs).
|
|
13
|
+
3. Replace the tool logic and the skill content.
|
|
14
|
+
4. Add LICENSE and a real README.
|
|
15
|
+
5. Install: `plugin_manager` `install_bundle` with this directory, or publish with `dsh-publish-helper`.
|
|
16
|
+
|
|
17
|
+
## Rules of thumb
|
|
18
|
+
|
|
19
|
+
- Put **capabilities** in the tool, **process and pitfalls** in the skill.
|
|
20
|
+
- Keep safety defaults in code (the tool); never rely on the skill text for hard constraints.
|
|
21
|
+
- One skill per workflow; do not bundle unrelated workflows into one skill.
|
|
22
|
+
- Skill content should be shorter than ~2k words; move long references to separate files loaded on demand.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SKILL_REGISTRATION } from './lib/skill.mjs';
|
|
2
|
+
|
|
3
|
+
export const name = 'dsh-example-skill-plugin';
|
|
4
|
+
export const inject = ['tools'];
|
|
5
|
+
|
|
6
|
+
const textOutput = {
|
|
7
|
+
schema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
additionalProperties: false,
|
|
10
|
+
required: ['text'],
|
|
11
|
+
properties: { text: { type: 'string' } },
|
|
12
|
+
},
|
|
13
|
+
render: (_args, value) => [{ type: 'text', text: value.text }],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const present = (title) => (args) => ({ card: 'generic', title, kind: 'other', rawInput: args });
|
|
17
|
+
|
|
18
|
+
function objectSchema(properties, required = []) {
|
|
19
|
+
return { type: 'object', additionalProperties: false, properties, required };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function apply(ctx) {
|
|
23
|
+
// Tool: the atomic action. Keep it small; the how-to lives in the skill.
|
|
24
|
+
ctx.tools.register({
|
|
25
|
+
name: 'example_do_task',
|
|
26
|
+
description: 'Do one example task and return a short result.',
|
|
27
|
+
parameters: objectSchema({
|
|
28
|
+
input: { type: 'string', description: 'What to process.' },
|
|
29
|
+
}, ['input']),
|
|
30
|
+
output: textOutput,
|
|
31
|
+
async execute(args) {
|
|
32
|
+
return { text: `example result for: ${args.input}` };
|
|
33
|
+
},
|
|
34
|
+
presentCall: present('Run example task'),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Skill: loaded on demand (no resident prompt cost), only when the task matches.
|
|
38
|
+
const skills = ctx.get('skills');
|
|
39
|
+
if (skills) ctx.effect(() => skills.register(SKILL_REGISTRATION));
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const SKILL_NAME = 'example-task';
|
|
2
|
+
|
|
3
|
+
export const SKILL_CONTENT = `# Example task workflow
|
|
4
|
+
|
|
5
|
+
Use this skill when the user asks for the example task.
|
|
6
|
+
|
|
7
|
+
1. Check the preconditions with the example tool.
|
|
8
|
+
2. Do the work with the tool.
|
|
9
|
+
3. Verify the result and report the identifier.
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export const SKILL_REGISTRATION = {
|
|
13
|
+
name: SKILL_NAME,
|
|
14
|
+
description: 'Short, invocation-neutral description of when this workflow applies.',
|
|
15
|
+
whenToUse: 'when the user asks for the example task',
|
|
16
|
+
source: 'custom',
|
|
17
|
+
content: SKILL_CONTENT,
|
|
18
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-example-skill-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Example DSH bundle that pairs one on-demand skill with one tool: replace the names and descriptions, then publish.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "your-npm-name",
|
|
8
|
+
"homepage": "https://github.com/your-npm-name/dsh-example-skill-plugin#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/your-npm-name/dsh-example-skill-plugin.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": ["dsh", "dsh-plugin", "deepseek-harness"],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18",
|
|
16
|
+
"dsh": ">=0.2.1-rc.3"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": { "access": "public" },
|
|
19
|
+
"exports": { ".": "./index.js" },
|
|
20
|
+
"files": ["index.js", "lib/*.mjs", "cordis.patch.yml", "README.md", "LICENSE"],
|
|
21
|
+
"dsh": {
|
|
22
|
+
"bundle": { "patch": "./cordis.patch.yml" }
|
|
23
|
+
}
|
|
24
|
+
}
|