create-zhin-app 1.0.62 → 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
|
@@ -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',
|
|
@@ -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
|
```
|