@dsh-workbench/module-hello 1.2.6 → 1.2.8-beta.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.
- package/DEVELOPING.md +82 -0
- package/README.md +18 -59
- package/package.json +4 -3
package/DEVELOPING.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# @dsh-workbench/module-hello · 作者文档
|
|
2
|
+
|
|
3
|
+
终端用户看 [README.md](README.md);这份讲它演示了什么、文件怎么分层、开发与门禁。
|
|
4
|
+
|
|
5
|
+
工作台里**最小的可安装模块**:装上面板多一张卡片,卸掉就没了。它同时是模块包的样板 ——
|
|
6
|
+
两个面各注册一次、卡片只有一个标题、没有工具、没有数据源,别的一概不掺。
|
|
7
|
+
|
|
8
|
+
拿来试装试卸最省事;想知道一个模块**必须**有什么,看它的文件比看文档快。
|
|
9
|
+
|
|
10
|
+
## 装
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# 装进工作台的 profile(实例名按你自己的来,默认 workbench)
|
|
14
|
+
dsh plugin --profile workbench add @dsh-workbench/module-hello
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
也可以在 `:3081` 的「工作台模块市场」里找到它装。装完右栏多一张「示例模块」卡片,
|
|
18
|
+
标题下两行字,刷新按钮接好了但没有数据源 —— 按了只会重画。
|
|
19
|
+
|
|
20
|
+
卸掉:市场里卸,或 `dsh plugin --profile workbench remove @dsh-workbench/module-hello`。
|
|
21
|
+
|
|
22
|
+
## 它演示了什么
|
|
23
|
+
|
|
24
|
+
| 东西 | 在哪 | 说明 |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| 模块声明 | `package.json` 的 `dsh.workbench` | `apiVersion: 3`、单元 id `hello`、中英名字、一张卡(只有排序位)、零工具、不注入外壳服务、不声明写入域(`host.writes: []`,也就不用执行缝门面) |
|
|
27
|
+
| 宿主面 | `src/host.ts` | 把 `{ unit: 'hello', mount }` 注册进外壳的 `workbenchUnits`;`routes` 空、`registerTools` 空 |
|
|
28
|
+
| 浏览器面 | `src/client.tsx` | 把 `{ unit, messages, card }` 注册进外壳;卡片用 kit 的 `Card` |
|
|
29
|
+
| 文案 | `src/messages.ts` | zh / en 两份字典,键名以前缀分域 |
|
|
30
|
+
| 接线 | `cordis.patch.yml` | 把自己插进 profile 的组合图 |
|
|
31
|
+
| 测试 | `src/__tests__/plugin.test.ts` | 断言插件名、注入面、两个面各注册一次 |
|
|
32
|
+
|
|
33
|
+
两个面都只 `inject: ['workbenchUnits']` —— 外壳交出来的那个服务。宿主侧拿不到服务时打一条
|
|
34
|
+
warn 就退,不会把整个 entry 拖挂。
|
|
35
|
+
|
|
36
|
+
## 文件
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
src/
|
|
40
|
+
host.ts 宿主面:注册单元
|
|
41
|
+
client.tsx 浏览器面:注册卡片
|
|
42
|
+
messages.ts 文案(zh / en)
|
|
43
|
+
__tests__/plugin.test.ts 两个面的注册测试
|
|
44
|
+
scripts/smoke.mjs 构建后冒烟:产物能 require、导出齐全
|
|
45
|
+
cordis.patch.yml 把自己插进 profile 组合图
|
|
46
|
+
arch.config.mjs 一行:moduleArch()
|
|
47
|
+
eslint.config.mjs 两行:moduleLint()
|
|
48
|
+
client.js 构建产物(随仓提交,npm 包要带;dist/ 不进 git)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 开发与门禁
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pnpm install
|
|
55
|
+
pnpm build # dist/host.js + client.js
|
|
56
|
+
pnpm test # 单元测试
|
|
57
|
+
pnpm check # 十四条模块判据(契约 / 产物边界 / 源码边界 / 执行缝 / 卡片渲染 / arch / lint …)
|
|
58
|
+
pnpm selfcheck # build + 产物冒烟
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
改了想马上看效果:重新 `pnpm build` 后刷新页面;宿主侧热换,不用重装。
|
|
62
|
+
|
|
63
|
+
## 想造自己的模块
|
|
64
|
+
|
|
65
|
+
别从这份抄起,跑工具链:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm exec dsh-wb-module init my-unit --template diy
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`diy` 模板有真数据源、五态卡片和填好的设计底稿。完整流程见
|
|
72
|
+
[模块 DIY 指引](../core/skills/workbench-module-diy/SKILL.md),
|
|
73
|
+
判据与工具见 [module-tools](../module-tools/README.md)。
|
|
74
|
+
|
|
75
|
+
## 相关文档
|
|
76
|
+
|
|
77
|
+
| 想了解 | 读 |
|
|
78
|
+
|---|---|
|
|
79
|
+
| 模块怎么写、怎么装、怎么验收 | [DIY 指引](../core/skills/workbench-module-diy/SKILL.md) |
|
|
80
|
+
| 构建、接线、注册的细节 | [BUILD.md](../core/skills/workbench-module-diy/BUILD.md) · [WIRING.md](../core/skills/workbench-module-diy/WIRING.md) |
|
|
81
|
+
| 十四条判据、模板、设计底稿 | [module-tools](../module-tools/README.md) |
|
|
82
|
+
| 契约类型与共享组件 | [shared](../shared/README.md) |
|
package/README.md
CHANGED
|
@@ -1,80 +1,39 @@
|
|
|
1
1
|
# @dsh-workbench/module-hello
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
两个面各注册一次、卡片只有一个标题、没有工具、没有数据源,别的一概不掺。
|
|
3
|
+
工作台里最小的可安装模块:装上面板多一张「示例模块」卡片,卸掉就没了。
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## 你会看到什么
|
|
6
|
+
|
|
7
|
+
右栏多一张「示例模块」卡片,标题下面两行说明文字。卡头有刷新钮,但这个模块没有数据源,按了只会重画。
|
|
7
8
|
|
|
8
9
|
## 装
|
|
9
10
|
|
|
11
|
+
在市场「已安装」里找到「示例模块」直接装;也可以在终端装进工作台的 profile:
|
|
12
|
+
|
|
10
13
|
```bash
|
|
11
|
-
# 装进工作台的 profile(实例名按你自己的来,默认 workbench)
|
|
12
14
|
dsh plugin --profile workbench add @dsh-workbench/module-hello
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
标题下两行字,刷新按钮接好了但没有数据源 —— 按了只会重画。
|
|
17
|
-
|
|
18
|
-
卸掉:市场里卸,或 `dsh plugin --profile workbench remove @dsh-workbench/module-hello`。
|
|
19
|
-
|
|
20
|
-
## 它演示了什么
|
|
21
|
-
|
|
22
|
-
| 东西 | 在哪 | 说明 |
|
|
23
|
-
|---|---|---|
|
|
24
|
-
| 模块声明 | `package.json` 的 `dsh.workbench` | `apiVersion: 3`、单元 id `hello`、中英名字、一张卡(只有排序位)、零工具、不注入外壳服务、不声明写入域(`host.writes: []`,也就不用执行缝门面) |
|
|
25
|
-
| 宿主面 | `src/host.ts` | 把 `{ unit: 'hello', mount }` 注册进外壳的 `workbenchUnits`;`routes` 空、`registerTools` 空 |
|
|
26
|
-
| 浏览器面 | `src/client.tsx` | 把 `{ unit, messages, card }` 注册进外壳;卡片用 kit 的 `Card` |
|
|
27
|
-
| 文案 | `src/messages.ts` | zh / en 两份字典,键名以前缀分域 |
|
|
28
|
-
| 接线 | `cordis.patch.yml` | 把自己插进 profile 的组合图 |
|
|
29
|
-
| 测试 | `src/__tests__/plugin.test.ts` | 断言插件名、注入面、两个面各注册一次 |
|
|
30
|
-
|
|
31
|
-
两个面都只 `inject: ['workbenchUnits']` —— 外壳交出来的那个服务。宿主侧拿不到服务时打一条
|
|
32
|
-
warn 就退,不会把整个 entry 拖挂。
|
|
33
|
-
|
|
34
|
-
## 文件
|
|
35
|
-
|
|
36
|
-
```text
|
|
37
|
-
src/
|
|
38
|
-
host.ts 宿主面:注册单元
|
|
39
|
-
client.tsx 浏览器面:注册卡片
|
|
40
|
-
messages.ts 文案(zh / en)
|
|
41
|
-
__tests__/plugin.test.ts 两个面的注册测试
|
|
42
|
-
scripts/smoke.mjs 构建后冒烟:产物能 require、导出齐全
|
|
43
|
-
cordis.patch.yml 把自己插进 profile 组合图
|
|
44
|
-
arch.config.mjs 一行:moduleArch()
|
|
45
|
-
eslint.config.mjs 两行:moduleLint()
|
|
46
|
-
client.js 构建产物(随仓提交,npm 包要带;dist/ 不进 git)
|
|
47
|
-
```
|
|
17
|
+
装完在当前项目的面板里勾选它,卡片才会出现。
|
|
48
18
|
|
|
49
|
-
##
|
|
19
|
+
## agent 能做什么
|
|
50
20
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
pnpm test # 单元测试
|
|
55
|
-
pnpm check # 十四条模块判据(契约 / 产物边界 / 源码边界 / 执行缝 / 卡片渲染 / arch / lint …)
|
|
56
|
-
pnpm selfcheck # build + 产物冒烟
|
|
57
|
-
```
|
|
21
|
+
这个模块没有给 agent 开放工具,也没有写入通道;它只演示一张卡片怎么接进外壳。
|
|
22
|
+
|
|
23
|
+
## 数据从哪来
|
|
58
24
|
|
|
59
|
-
|
|
25
|
+
没有数据源:卡片上的字是模块自带的文案,不读接口、不需要登录。
|
|
60
26
|
|
|
61
|
-
##
|
|
27
|
+
## 卸
|
|
62
28
|
|
|
63
|
-
|
|
29
|
+
在市场里卸,或:
|
|
64
30
|
|
|
65
31
|
```bash
|
|
66
|
-
|
|
32
|
+
dsh plugin --profile workbench remove @dsh-workbench/module-hello
|
|
67
33
|
```
|
|
68
34
|
|
|
69
|
-
|
|
70
|
-
[模块 DIY 指引](../core/skills/workbench-module-diy/SKILL.md),
|
|
71
|
-
判据与工具见 [module-tools](../module-tools/README.md)。
|
|
35
|
+
卸掉后卡片消失,不影响其他模块。
|
|
72
36
|
|
|
73
|
-
##
|
|
37
|
+
## 出问题先看
|
|
74
38
|
|
|
75
|
-
|
|
76
|
-
|---|---|
|
|
77
|
-
| 模块怎么写、怎么装、怎么验收 | [DIY 指引](../core/skills/workbench-module-diy/SKILL.md) |
|
|
78
|
-
| 构建、接线、注册的细节 | [BUILD.md](../core/skills/workbench-module-diy/BUILD.md) · [WIRING.md](../core/skills/workbench-module-diy/WIRING.md) |
|
|
79
|
-
| 十四条判据、模板、设计底稿 | [module-tools](../module-tools/README.md) |
|
|
80
|
-
| 契约类型与共享组件 | [shared](../shared/README.md) |
|
|
39
|
+
卡片没出现时,先确认当前项目的面板里勾选了「示例模块」;还是没有就重新装一次。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-workbench/module-hello",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8-beta.0",
|
|
4
4
|
"description": "最小示例模块:装上后面板里多一张卡片,用来试装试卸。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"dist",
|
|
12
12
|
"client.js",
|
|
13
13
|
"cordis.patch.yml",
|
|
14
|
+
"DEVELOPING.md",
|
|
14
15
|
"CHANGELOG.md"
|
|
15
16
|
],
|
|
16
17
|
"dsh": {
|
|
@@ -63,8 +64,8 @@
|
|
|
63
64
|
"react": "^19.3.0",
|
|
64
65
|
"typescript": "5.9",
|
|
65
66
|
"vitest": "^5.0.2",
|
|
66
|
-
"@dsh-workbench/core": "1.2.
|
|
67
|
-
"@dsh-workbench/module-tools": "1.2.
|
|
67
|
+
"@dsh-workbench/core": "1.2.8-beta.0",
|
|
68
|
+
"@dsh-workbench/module-tools": "1.2.8-beta.0"
|
|
68
69
|
},
|
|
69
70
|
"publishConfig": {
|
|
70
71
|
"access": "public"
|