@doubao-apps/ai 0.0.33 → 0.0.34

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.
Files changed (69) hide show
  1. package/README.md +1 -32
  2. package/dist/733.js +7 -15
  3. package/dist/cli.js +1 -1
  4. package/dist/manifest.json +3 -11
  5. package/dist/skills/doubao-apps-dev/SKILL.md +103 -227
  6. package/dist/skills/doubao-apps-dev/references/examples/common-patterns.md +80 -66
  7. package/dist/skills/doubao-apps-dev/references/examples/component-basics.md +24 -3
  8. package/dist/skills/doubao-apps-dev/references/examples/component-recipes.md +71 -0
  9. package/dist/skills/doubao-apps-dev/references/examples/open-api-recipes.md +203 -0
  10. package/dist/skills/doubao-apps-dev/references/guides/component-development.md +66 -42
  11. package/dist/skills/doubao-apps-dev/references/guides/expired-widget.md +113 -0
  12. package/dist/skills/doubao-apps-dev/references/guides/mcp-ui.md +275 -0
  13. package/dist/skills/doubao-apps-dev/references/guides/performance-optimization.md +24 -7
  14. package/dist/skills/doubao-apps-dev/references/reference/components-quick-ref.md +18 -7
  15. package/dist/skills/doubao-apps-dev/references/reference/framework-api-quick-ref.md +125 -107
  16. package/dist/skills/doubao-apps-dev/references/reference/open-api/01-/345/237/272/347/241/200.md +136 -0
  17. package/dist/skills/doubao-apps-dev/references/reference/open-api/02-/347/263/273/347/273/237.md +257 -0
  18. package/dist/skills/doubao-apps-dev/references/reference/open-api/03-/345/256/232/344/275/215.md +326 -0
  19. package/dist/skills/doubao-apps-dev/references/reference/open-api/04-/345/255/230/345/202/250.md +284 -0
  20. package/dist/skills/doubao-apps-dev/references/reference/open-api/05-/350/267/257/347/224/261.md +162 -0
  21. package/dist/skills/doubao-apps-dev/references/reference/open-api/06-/344/272/244/344/272/222.md +290 -0
  22. package/dist/skills/doubao-apps-dev/references/reference/open-api/07-/350/276/223/345/205/245.md +63 -0
  23. package/dist/skills/doubao-apps-dev/references/reference/open-api/08-/347/275/221/347/273/234.md +124 -0
  24. package/dist/skills/doubao-apps-dev/references/reference/open-api/09-/345/252/222/344/275/223.md +192 -0
  25. package/dist/skills/doubao-apps-dev/references/reference/open-api/10-/344/270/232/345/212/241/350/203/275/345/212/233.md +431 -0
  26. package/dist/skills/doubao-apps-dev/references/reference/open-api/11-/347/231/273/345/275/225.md +110 -0
  27. package/dist/skills/doubao-apps-dev/references/reference/open-api/12-/346/224/257/344/273/230.md +224 -0
  28. package/dist/skills/doubao-apps-dev/references/reference/open-api/13-/346/225/260/346/215/256/345/210/206/346/236/220.md +43 -0
  29. package/dist/skills/doubao-apps-dev/references/reference/open-api/14-/350/223/235/347/211/231.md +598 -0
  30. package/dist/skills/doubao-apps-dev/references/reference/open-api/15-wi-fi.md +210 -0
  31. package/dist/skills/doubao-apps-dev/references/reference/open-api/16-/345/212/240/351/200/237/345/272/246/350/256/241.md +87 -0
  32. package/dist/skills/doubao-apps-dev/references/reference/open-api/17-ibeacon.md +97 -0
  33. package/dist/skills/doubao-apps-dev/references/reference/open-api/18-/347/275/227/347/233/230.md +78 -0
  34. package/dist/skills/doubao-apps-dev/references/reference/open-api/19-/350/256/276/345/244/207/346/226/271/345/220/221.md +86 -0
  35. package/dist/skills/doubao-apps-dev/references/reference/open-api/20-/351/231/200/350/236/272/344/273/252.md +87 -0
  36. package/dist/skills/doubao-apps-dev/references/reference/open-api/21-/350/256/276/345/244/207-/347/275/221/347/273/234.md +102 -0
  37. package/dist/skills/doubao-apps-dev/references/reference/open-api/22-/347/237/255/344/277/241.md +40 -0
  38. package/dist/skills/doubao-apps-dev/references/reference/open-api/23-/346/227/240/351/232/234/347/242/215.md +40 -0
  39. package/dist/skills/doubao-apps-dev/references/reference/open-api/24-/345/237/272/347/241/200/344/277/241/346/201/257.md +86 -0
  40. package/dist/skills/doubao-apps-dev/references/reference/open-api/25-/347/224/265/346/261/240.md +63 -0
  41. package/dist/skills/doubao-apps-dev/references/reference/open-api/26-/346/227/245/345/216/206.md +95 -0
  42. package/dist/skills/doubao-apps-dev/references/reference/open-api/27-/345/211/252/350/264/264/346/235/277.md +64 -0
  43. package/dist/skills/doubao-apps-dev/references/reference/open-api/28-/350/201/224/347/263/273/344/272/272.md +101 -0
  44. package/dist/skills/doubao-apps-dev/references/reference/open-api/29-/345/212/240/345/257/206.md +43 -0
  45. package/dist/skills/doubao-apps-dev/references/reference/open-api/30-/347/224/265/350/257/235.md +36 -0
  46. package/dist/skills/doubao-apps-dev/references/reference/open-api/31-/346/211/253/347/240/201.md +58 -0
  47. package/dist/skills/doubao-apps-dev/references/reference/open-api/32-/345/261/217/345/271/225.md +136 -0
  48. package/dist/skills/doubao-apps-dev/references/reference/open-api/33-/351/234/207/345/212/250.md +62 -0
  49. package/dist/skills/doubao-apps-dev/references/reference/open-api/34-/346/226/207/344/273/266/347/263/273/347/273/237.md +73 -0
  50. package/dist/skills/doubao-apps-dev/references/reference/open-api/README.md +34 -0
  51. package/dist/skills/doubao-apps-dev/references/reference/open-api.md +384 -2
  52. package/dist/skills/doubao-apps-dev/references/rules/dos-and-donts.md +44 -27
  53. package/dist/skills/h5-to-doubao/SKILL.md +8 -4
  54. package/dist/skills/weixin-to-doubao/SKILL.md +8 -4
  55. package/dist/skills/weixin-to-doubao/assets/migration-checklist-template.md +1 -1
  56. package/package.json +2 -3
  57. package/dist/contexts/doubao-apps-dev/AGENTS.md +0 -300
  58. package/dist/contexts/doubao-apps-dev/CLAUDE.md +0 -31
  59. package/dist/contexts/doubao-apps-dev/references/examples/common-patterns.md +0 -589
  60. package/dist/contexts/doubao-apps-dev/references/examples/component-basics.md +0 -526
  61. package/dist/contexts/doubao-apps-dev/references/guides/best-practices.md +0 -571
  62. package/dist/contexts/doubao-apps-dev/references/guides/component-development.md +0 -891
  63. package/dist/contexts/doubao-apps-dev/references/guides/performance-optimization.md +0 -402
  64. package/dist/contexts/doubao-apps-dev/references/guides/troubleshooting.md +0 -287
  65. package/dist/contexts/doubao-apps-dev/references/reference/components-quick-ref.md +0 -103
  66. package/dist/contexts/doubao-apps-dev/references/reference/framework-api-quick-ref.md +0 -550
  67. package/dist/contexts/doubao-apps-dev/references/reference/open-api/README.md +0 -8
  68. package/dist/contexts/doubao-apps-dev/references/reference/open-api.md +0 -11
  69. package/dist/contexts/doubao-apps-dev/references/rules/dos-and-donts.md +0 -467
@@ -1,300 +0,0 @@
1
- # Doubao Apps SDK AI 开发指南
2
-
3
- 本文件专供 AI coding agents(如 Claude、Copilot、Cursor)和开发者使用,提供 Doubao Apps SDK 框架的快速入门、开发规则和文档导航。
4
-
5
- ---
6
-
7
- ## 快速开始
8
-
9
- ### 1. 项目介绍
10
-
11
- Doubao Apps SDK 是豆包应用开发框架,基于 React Lynx 框架提供完整的小程序开发、构建和部署能力。
12
-
13
- **核心特性**:
14
- - **React 风格开发**:使用 TSX/JSX 语法和 React Hooks
15
- - **Lynx 渲染引擎**:跨平台高性能渲染
16
- - **Bridge API**:150+ 系统能力接口
17
- - **完整工具链**:CLI、调试工具、部署系统
18
-
19
- ### 2. 环境准备
20
-
21
- **必需环境**:
22
- - Node.js 20+
23
- - pnpm(推荐):`npm install -g pnpm`
24
- - bnpm 源:`npm config set registry https://bnpm.byted.org`
25
-
26
- ### 3. 创建项目
27
-
28
- ```bash
29
- # 安装依赖
30
- pnpm install
31
-
32
- # 启动开发
33
- pnpm dev
34
- ```
35
-
36
- **开发服务器命令**:
37
- - `d` - 选择场景/页面/卡片运行
38
- - `<scene-name>` - 运行指定场景
39
- - `<page-id>` - 运行指定页面
40
- - `<widget-id>` - 运行指定卡片
41
-
42
- ### 4. 项目结构
43
-
44
- ```
45
- my-doubao-app/
46
- ├── doubao.config.ts # 项目配置
47
- ├── package.json # 依赖管理
48
- ├── pnpm-lock.yaml # 依赖锁定
49
- └── src/
50
- ├── app.ts # 应用入口
51
- ├── pages/ # 页面目录(全屏UI)
52
- │ └── home/
53
- │ ├── index.tsx
54
- │ └── index.scss
55
- └── widgets/ # 卡片目录(聊天UI)
56
- └── hello-world/
57
- ├── index.tsx
58
- └── index.scss
59
- ```
60
-
61
- ---
62
-
63
- ## 核心规则(必读)
64
-
65
- ### 推荐做法
66
-
67
- - **优先使用 pnpm** 作为包管理器
68
- - **分离样式文件**:每个组件使用独立的 `.scss` 文件
69
- - **在 `src/app.config.ts` 中配置 metadata**:为 App、Page 和 Widget 统一配置元数据
70
- - **使用生命周期钩子**:合理使用 `onShow`、`onMounted` 等
71
- - **TypeScript 类型**:使用 `getViewData<T>()`、为 props 和 state 提供类型定义
72
- - **错误处理**:处理边界情况和错误状态
73
-
74
- ### 禁止做法
75
-
76
- - **不写内联样式**:避免在 TSX 中直接写 style
77
- - **不在 render 中请求**:异步操作应在生命周期钩子中进行
78
- - **不过度嵌套**:保持组件层级扁平化
79
- - **不忽略类型**:避免使用 `any` 类型
80
-
81
- ### ⚠️ 文件命名约束
82
-
83
- 页面/卡片目录下的入口文件必须命名为 **`index.tsx`**,样式文件为 **`index.scss`**。
84
-
85
- **详细规则** → [references/rules/dos-and-donts.md](references/rules/dos-and-donts.md)
86
-
87
- ---
88
-
89
- ## 组件开发
90
-
91
- ### Page(页面)
92
-
93
- Page 是全屏 UI 组件,支持九宫格、浮窗等变体。
94
-
95
- **metadata 配置**:
96
- ```ts
97
- import { defineAppConfig } from '@doubao-apps/kit';
98
-
99
- export default defineAppConfig({
100
- pages: {
101
- 'pages/home': {
102
- id: 'my-page',
103
- title: '我的页面',
104
- description: '页面功能描述'
105
- }
106
- }
107
- });
108
- ```
109
-
110
- **页面实现**:
111
- ```tsx
112
- import { definePage, getViewData } from '@doubao-apps/framework';
113
- import './index.scss';
114
-
115
- interface HomePageData {
116
- title: string;
117
- }
118
-
119
- export default definePage({
120
- onShow() {
121
- // 页面显示时触发
122
- },
123
- render() {
124
- const input = getViewData<HomePageData>();
125
- return <view>{input.title}</view>;
126
- }
127
- });
128
- ```
129
-
130
- **开发指南** → [references/guides/component-development.md](references/guides/component-development.md)
131
-
132
- ### Widget(卡片)
133
-
134
- Widget 是聊天流中的卡片组件,在对话中展示。
135
-
136
- **metadata 配置**:
137
- ```ts
138
- import { defineAppConfig } from '@doubao-apps/kit';
139
-
140
- export default defineAppConfig({
141
- widgets: {
142
- 'widgets/my-widget': {
143
- id: 'my-widget',
144
- name: '我的卡片',
145
- description: '卡片功能描述',
146
- boxType: 'inbox',
147
- border: true
148
- }
149
- }
150
- });
151
- ```
152
-
153
- **卡片实现**:
154
- ```tsx
155
- import { defineWidget, getViewData } from '@doubao-apps/framework';
156
- import './index.scss';
157
-
158
- interface MyWidgetData {
159
- title: string;
160
- }
161
-
162
- export default defineWidget({
163
- onMounted() {
164
- // 卡片挂载后触发
165
- },
166
- render() {
167
- const input = getViewData<MyWidgetData>();
168
- return <view>{input.title}</view>;
169
- }
170
- });
171
- ```
172
-
173
- **开发指南** → [references/guides/component-development.md](references/guides/component-development.md)
174
-
175
- **基础示例对比** → [references/examples/component-basics.md](references/examples/component-basics.md)
176
-
177
- ---
178
-
179
- ## 开发资源
180
-
181
- ### 开发任务模板
182
-
183
- 根据不同的开发任务,使用不同的知识文档:
184
-
185
- | 任务类型 | 文档 | 适用场景 |
186
- |---------|-----------|---------|
187
- | 组件开发 | [component-development.md](references/guides/component-development.md) | Page 和 Widget 完整开发指南 |
188
- | 最佳实践 | [best-practices.md](references/guides/best-practices.md) | 代码规范、架构设计 |
189
- | 性能优化 | [performance-optimization.md](references/guides/performance-optimization.md) | 渲染优化、内存管理 |
190
- | 问题排查 | [troubleshooting.md](references/guides/troubleshooting.md) | 调试技巧、常见问题 |
191
-
192
- ---
193
-
194
- ## API 参考
195
-
196
- 完整的 Framework API(框架核心)和 Bridge API(系统能力)列表:
197
-
198
- - **[Framework API 快速参考](references/reference/framework-api-quick-ref.md)** - 核心 Framework API 速查
199
- - **[Open API 目录](references/reference/open-api/README.md)** - 公开可用的端能力(系统能力)目录与详细文档
200
- - **[组件库快速参考](references/reference/components-quick-ref.md)** - SDK 内置组件(Button、Switch、Swiper 等)
201
-
202
- 包含:
203
- - **Framework API**:组件定义(definePage、defineWidget)、生命周期、状态管理
204
- - **Components**:SDK 内置 UI 组件(Button、Switch、Slider、Swiper、Dialog 等)
205
- - **Bridge API**:系统能力接口(网络、存储、设备、UI 交互等)
206
-
207
- ### Playground 测试页范式
208
-
209
- 当任务涉及 `examples/playground`、Open API 测试页、JSB 验证页或组件 Demo 时,必须按当前 Playground 结构编写:
210
-
211
- - **API 测试页**:放在 `examples/playground/src/pages/api/<group>/<api-name>/index.tsx`,并同步 `src/case-metadata.ts` 与 `src/pages/api/registry.ts`;`apiCaseMetas.name` 使用 `<group>/<api-name>`,允许带 `/`。
212
- - **组件测试页**:放在 `examples/playground/src/pages/component/<component-name>/index.tsx`,并同步 `src/case-metadata.ts` 与 `src/pages/component/registry.ts`。
213
- - **页面结构**:直接写 `definePage`、`PlaygroundPage`、纵向排列的多个 `TestCase`、`ActionButton` 和真实 API/组件调用,禁止任何页面工厂函数。
214
- - **覆盖方式**:API 页尽可能覆盖参数组合、边界值、失败路径和事件回调;组件页覆盖默认态、边界态和交互态。不要只写 2~3 个 happy path。
215
- - **日志隔离**:多个 `TestCase` 不共用同一个日志 state;日志 payload 可带 `case` / `caseName`,避免不同日志面板串扰。
216
- - **路由编码**:入口页跳转含 `/` 的 case name 时必须 `encodeURIComponent`;开发模式 `delegate-page` 的 query 需要 encode/decode。
217
- - **响应式主题**:Playground 外壳和示例辅助 UI 使用 `--pg-*` 变量;不要在 Playground 任务中顺手修组件库自身主题。
218
-
219
- ### API e2e 测试范式
220
-
221
- 当任务新增或正式暴露 `@doubao-apps/framework/api` / Open API / JSB API 时,必须同步补充 `e2e/api` 自动化测试:
222
-
223
- - **测试目录**:Vitest case 放在 `e2e/api/__tests__/`,优先补到已有 domain 文件,如 `basic.test.ts`、`network.test.ts`、`storage.test.ts`、`device.test.ts`、`ui.test.ts`;没有合适分组时新建 `<domain>.test.ts`。
224
- - **测试小程序**:`examples/e2e-api-runner` 只负责建立 WebSocket 链接、接收 API 调用指令、执行 `@byted-doubao-apps/framework/api` 并回传结果;不要把具体 e2e case 写在小程序或 playground 内。
225
- - **协议层**:WebSocket server、协议类型和 runner client 由 `@byted-doubao-apps/e2e-runner` 提供;不要在测试用例里重复实现通信协议。
226
- - **调用方式**:在测试中使用 `const session = await getApiSession()`,再通过 `await session.callApi<TResult>('<apiName>', [params], { timeoutMs })` 调用并在 Vitest 侧断言。
227
- - **稳定性原则**:只自动化稳定、低副作用、可断言的 API;强交互、权限弹窗、支付、路由退出、账号业务态或设备状态不稳定的 API 应 `it.skip` / `describe.skip` 并写明原因。
228
- - **本地依赖**:网络类 API 优先使用 `session.httpFixtureServer`,避免依赖公网。
229
- - **验证命令**:至少运行 `pnpm --filter @byted-doubao-apps/e2e-api typecheck`;有目标设备时再运行 `pnpm --filter @byted-doubao-apps/e2e-api test:api`。
230
-
231
- ### Lynx 组件
232
-
233
- Lynx 组件库完整参考文档请访问官方文档:
234
-
235
- 👉 **[Lynx 官方文档](https://lynx.bytedance.net/next/llms.txt)**
236
-
237
- ---
238
-
239
- ## 代码示例
240
-
241
- ### 常用场景
242
-
243
- | 场景 | 示例文档 | 说明 |
244
- |-----|---------|------|
245
- | 组件基础 | [component-basics.md](references/examples/component-basics.md) | Page 和 Widget 基础示例对比 |
246
- | 常用模式 | [common-patterns.md](references/examples/common-patterns.md) | API 集成、状态管理、页面导航 |
247
-
248
- ---
249
-
250
- ## 外部资源
251
-
252
- ### 快速参考
253
-
254
- API 参考文档
255
-
256
- - **[Framework API](references/reference/framework-api-quick-ref.md)** - 核心 Framework API 速查
257
- - **[组件库](references/reference/components-quick-ref.md)** - SDK 内置组件速查
258
- - **[Open API](references/reference/open-api/README.md)** - 系统能力 API 目录与详细文档
259
-
260
- ### 依赖包
261
-
262
- - **Framework**:`@doubao-apps/framework` - 核心框架
263
- - **端能力 API**:`@doubao-apps/framework/api` - 系统能力接口
264
- - **Kit**:`@doubao-apps/kit` - 开发工具包
265
-
266
- ---
267
-
268
- ## 获取帮助
269
-
270
- ### 常见问题
271
-
272
- 遇到问题?先查看故障排查指南:
273
-
274
- 👉 **[故障排查指南](references/guides/troubleshooting.md)**
275
-
276
- ### 最佳实践
277
-
278
- 想要提升代码质量?查看最佳实践:
279
-
280
- 👉 **[最佳实践指南](references/guides/best-practices.md)**
281
-
282
- ### 性能优化
283
-
284
- 应用性能不佳?查看性能优化指南:
285
-
286
- 👉 **[性能优化指南](references/guides/performance-optimization.md)**
287
-
288
- ---
289
-
290
- ## 知识库文档组织
291
-
292
- ```
293
- 项目根目录/
294
- ├── AGENTS.md # 主入口文档(AI Agent 必读)
295
- └── references/ # 详细文档目录
296
- ├── guides/ # 开发指南
297
- ├── rules/ # 开发规则
298
- ├── examples/ # 代码示例
299
- └── reference/ # API 参考
300
- ```
@@ -1,31 +0,0 @@
1
- # CLAUDE.md - Doubao Apps SDK 开发助手
2
-
3
- > 本文件为 Claude AI 助手优化的入口文件,由 `doubao-cli add context --agent claude` 安装。
4
-
5
- ## 主入口
6
-
7
- 完整开发指南请参考:**[AGENTS.md](./AGENTS.md)**
8
-
9
- ## 快速导航
10
-
11
- | 开发任务 | 参考文档 |
12
- |---------|---------|
13
- | 创建 Page(页面组件) | [references/guides/component-development.md](references/guides/component-development.md) |
14
- | 创建 Widget(卡片组件) | [references/guides/component-development.md](references/guides/component-development.md) |
15
- | 最佳实践 | [references/guides/best-practices.md](references/guides/best-practices.md) |
16
- | 性能优化 | [references/guides/performance-optimization.md](references/guides/performance-optimization.md) |
17
- | 问题排查 | [references/guides/troubleshooting.md](references/guides/troubleshooting.md) |
18
- | Framework API | [references/reference/framework-api-quick-ref.md](references/reference/framework-api-quick-ref.md) |
19
- | Bridge API / 系统能力 | [references/reference/open-api/README.md](references/reference/open-api/README.md) |
20
- | Playground / API / JSB 验证页 | [AGENTS.md#playground-测试页范式](./AGENTS.md#playground-测试页范式) |
21
- | API e2e 自动化测试 | [AGENTS.md#api-e2e-测试范式](./AGENTS.md#api-e2e-测试范式) |
22
-
23
- ## 知识库结构
24
-
25
- ```
26
- references/
27
- ├── guides/ # 开发指南(组件开发、最佳实践、性能优化、故障排除)
28
- ├── rules/ # 框架规则(dos-and-donts)
29
- ├── examples/ # 代码示例(组件基础、常用模式)
30
- └── reference/ # API 参考(Framework API、系统能力)
31
- ```