create-zhin-app 1.0.61 → 1.0.63
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/lib/workspace.js
CHANGED
|
@@ -572,7 +572,7 @@ HTTP_TOKEN=change-me
|
|
|
572
572
|
]
|
|
573
573
|
}, { spaces: 2 });
|
|
574
574
|
// plugin.ts(根插件入口)
|
|
575
|
-
await fs.writeFile(path.join(projectPath, 'plugin.ts'), `import { definePlugin } from 'zhin.js
|
|
575
|
+
await fs.writeFile(path.join(projectPath, 'plugin.ts'), `import { definePlugin } from 'zhin.js';
|
|
576
576
|
|
|
577
577
|
export default definePlugin({
|
|
578
578
|
name: '${projectName}',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-zhin-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"description": "Create a new zhin bot project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"fs-extra": "^11.4.0",
|
|
16
16
|
"inquirer": "^14.0.2",
|
|
17
17
|
"yaml": "^2.9.0",
|
|
18
|
-
"@zhin.js/scaffold-wizard": "0.2.
|
|
18
|
+
"@zhin.js/scaffold-wizard": "0.2.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -90,7 +90,7 @@ export default defineAgentTool({
|
|
|
90
90
|
**定时任务**(在 `plugin.ts` setup;完整骨架见仓库 skill `assets/cron-template.ts`):
|
|
91
91
|
|
|
92
92
|
```typescript
|
|
93
|
-
import { definePlugin, scheduleHostToken } from 'zhin.js
|
|
93
|
+
import { definePlugin, scheduleHostToken } from 'zhin.js';
|
|
94
94
|
|
|
95
95
|
export default definePlugin({
|
|
96
96
|
name: 'my-plugin',
|
|
@@ -20,7 +20,7 @@ tags:
|
|
|
20
20
|
|
|
21
21
|
引导创建一个符合 **Plugin Runtime** 的新插件。唯一启动路径是 `zhin runtime start`;插件即 package,`plugin.ts` 必须 default-export `definePlugin()`。
|
|
22
22
|
|
|
23
|
-
**禁止**再脚手架 `usePlugin()` / `MessageCommand` / `src/index.ts`
|
|
23
|
+
**禁止**再脚手架 `usePlugin()` / `MessageCommand` / `src/index.ts` 命令式注册——`zhin.js/node` 与 `bootstrapNode` 已删除,唯一入口是 Plugin Runtime。
|
|
24
24
|
|
|
25
25
|
## 适用场景
|
|
26
26
|
|
|
@@ -119,7 +119,7 @@ plugins/{name}/
|
|
|
119
119
|
**只做装配与生命周期,不堆业务:**
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
|
-
import { definePlugin } from 'zhin.js
|
|
122
|
+
import { definePlugin } from 'zhin.js';
|
|
123
123
|
|
|
124
124
|
export default definePlugin({
|
|
125
125
|
name: '{name}',
|
|
@@ -137,7 +137,7 @@ export default definePlugin({
|
|
|
137
137
|
- `plugin.ts` **必须** default-export `definePlugin()`,否则装配抛 `does not default-export a Plugin definition`
|
|
138
138
|
- 新代码**不要**调用 `usePlugin()` / `getPlugin()` / `MessageCommand`
|
|
139
139
|
- TS 文件间互导使用 `.js` 扩展名
|
|
140
|
-
- 本地导入 Feature
|
|
140
|
+
- 本地导入 Feature 包:主入口 `zhin.js`(`definePlugin`)与 `zhin.js/command` 等门面子路径
|
|
141
141
|
- 使用 AI / Agent 时从 `zhin.js/agent` 引入;须安装 `@zhin.js/agent`、`zod`、`ai` 与所选 `@ai-sdk/*`
|
|
142
142
|
|
|
143
143
|
### 第 5 步:生成首个命令
|
|
@@ -48,7 +48,7 @@ const plugin = usePlugin()
|
|
|
48
48
|
plugin.addCommand(new MessageCommand('hi').action(() => 'hi'))
|
|
49
49
|
|
|
50
50
|
// ✅ Runtime
|
|
51
|
-
import { definePlugin } from 'zhin.js
|
|
51
|
+
import { definePlugin } from 'zhin.js'
|
|
52
52
|
export default definePlugin({ name: 'my-plugin', setup() {} })
|
|
53
53
|
// + commands/hi.ts → defineCommand(...)
|
|
54
54
|
```
|