@creatoria/miniapp-mcp 0.1.2 → 0.2.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.
Files changed (247) hide show
  1. package/README.md +14 -3
  2. package/dist/app/cli/index.d.ts +6 -0
  3. package/dist/app/cli/index.d.ts.map +1 -0
  4. package/dist/app/cli/index.js +6 -0
  5. package/dist/app/cli/index.js.map +1 -0
  6. package/dist/app/index.d.ts +6 -0
  7. package/dist/app/index.d.ts.map +1 -0
  8. package/dist/app/index.js +6 -0
  9. package/dist/app/index.js.map +1 -0
  10. package/dist/app/server/index.d.ts +7 -0
  11. package/dist/app/server/index.d.ts.map +1 -0
  12. package/dist/app/server/index.js +6 -0
  13. package/dist/app/server/index.js.map +1 -0
  14. package/dist/capabilities/assert/index.d.ts +5 -0
  15. package/dist/capabilities/assert/index.d.ts.map +1 -0
  16. package/dist/capabilities/assert/index.js +5 -0
  17. package/dist/capabilities/assert/index.js.map +1 -0
  18. package/dist/capabilities/automator/index.d.ts +6 -0
  19. package/dist/capabilities/automator/index.d.ts.map +1 -0
  20. package/dist/capabilities/automator/index.js +6 -0
  21. package/dist/capabilities/automator/index.js.map +1 -0
  22. package/dist/capabilities/automator/schemas/close.d.ts +5 -0
  23. package/dist/capabilities/automator/schemas/close.d.ts.map +1 -0
  24. package/dist/capabilities/automator/schemas/close.js +11 -0
  25. package/dist/capabilities/automator/schemas/close.js.map +1 -0
  26. package/dist/capabilities/automator/schemas/connect.d.ts +11 -0
  27. package/dist/capabilities/automator/schemas/connect.d.ts.map +1 -0
  28. package/dist/capabilities/automator/schemas/connect.js +19 -0
  29. package/dist/capabilities/automator/schemas/connect.js.map +1 -0
  30. package/dist/capabilities/automator/schemas/disconnect.d.ts +5 -0
  31. package/dist/capabilities/automator/schemas/disconnect.d.ts.map +1 -0
  32. package/dist/capabilities/automator/schemas/disconnect.js +11 -0
  33. package/dist/capabilities/automator/schemas/disconnect.js.map +1 -0
  34. package/dist/capabilities/automator/schemas/index.d.ts +4 -0
  35. package/dist/capabilities/automator/schemas/index.d.ts.map +1 -0
  36. package/dist/capabilities/automator/schemas/index.js +12 -0
  37. package/dist/capabilities/automator/schemas/index.js.map +1 -0
  38. package/dist/capabilities/automator/schemas/launch.d.ts +17 -0
  39. package/dist/capabilities/automator/schemas/launch.d.ts.map +1 -0
  40. package/dist/capabilities/automator/schemas/launch.js +26 -0
  41. package/dist/capabilities/automator/schemas/launch.js.map +1 -0
  42. package/dist/capabilities/element/index.d.ts +5 -0
  43. package/dist/capabilities/element/index.d.ts.map +1 -0
  44. package/dist/capabilities/element/index.js +5 -0
  45. package/dist/capabilities/element/index.js.map +1 -0
  46. package/dist/capabilities/index.d.ts +15 -0
  47. package/dist/capabilities/index.d.ts.map +1 -0
  48. package/dist/capabilities/index.js +14 -0
  49. package/dist/capabilities/index.js.map +1 -0
  50. package/dist/capabilities/miniprogram/index.d.ts +5 -0
  51. package/dist/capabilities/miniprogram/index.d.ts.map +1 -0
  52. package/dist/capabilities/miniprogram/index.js +5 -0
  53. package/dist/capabilities/miniprogram/index.js.map +1 -0
  54. package/dist/capabilities/network/index.d.ts +5 -0
  55. package/dist/capabilities/network/index.d.ts.map +1 -0
  56. package/dist/capabilities/network/index.js +5 -0
  57. package/dist/capabilities/network/index.js.map +1 -0
  58. package/dist/capabilities/page/index.d.ts +5 -0
  59. package/dist/capabilities/page/index.d.ts.map +1 -0
  60. package/dist/capabilities/page/index.js +5 -0
  61. package/dist/capabilities/page/index.js.map +1 -0
  62. package/dist/capabilities/record/index.d.ts +5 -0
  63. package/dist/capabilities/record/index.d.ts.map +1 -0
  64. package/dist/capabilities/record/index.js +5 -0
  65. package/dist/capabilities/record/index.js.map +1 -0
  66. package/dist/capabilities/schema-registry.d.ts +4 -0
  67. package/dist/capabilities/schema-registry.d.ts.map +1 -0
  68. package/dist/capabilities/schema-registry.js +18 -0
  69. package/dist/capabilities/schema-registry.js.map +1 -0
  70. package/dist/capabilities/schema-types.d.ts +22 -0
  71. package/dist/capabilities/schema-types.d.ts.map +1 -0
  72. package/dist/capabilities/schema-types.js +2 -0
  73. package/dist/capabilities/schema-types.js.map +1 -0
  74. package/dist/capabilities/snapshot/index.d.ts +5 -0
  75. package/dist/capabilities/snapshot/index.d.ts.map +1 -0
  76. package/dist/capabilities/snapshot/index.js +5 -0
  77. package/dist/capabilities/snapshot/index.js.map +1 -0
  78. package/dist/config/loader.js +1 -1
  79. package/dist/config/loader.js.map +1 -1
  80. package/dist/core/element-ref.d.ts +1 -43
  81. package/dist/core/element-ref.d.ts.map +1 -1
  82. package/dist/core/element-ref.js +1 -212
  83. package/dist/core/element-ref.js.map +1 -1
  84. package/dist/core/logger.d.ts +1 -54
  85. package/dist/core/logger.d.ts.map +1 -1
  86. package/dist/core/logger.js +1 -377
  87. package/dist/core/logger.js.map +1 -1
  88. package/dist/core/output.d.ts +1 -20
  89. package/dist/core/output.d.ts.map +1 -1
  90. package/dist/core/output.js +1 -55
  91. package/dist/core/output.js.map +1 -1
  92. package/dist/core/report-generator.d.ts +1 -23
  93. package/dist/core/report-generator.d.ts.map +1 -1
  94. package/dist/core/report-generator.js +1 -211
  95. package/dist/core/report-generator.js.map +1 -1
  96. package/dist/core/session.d.ts +2 -82
  97. package/dist/core/session.d.ts.map +1 -1
  98. package/dist/core/session.js +2 -305
  99. package/dist/core/session.js.map +1 -1
  100. package/dist/core/timeout.d.ts +1 -48
  101. package/dist/core/timeout.d.ts.map +1 -1
  102. package/dist/core/timeout.js +1 -66
  103. package/dist/core/timeout.js.map +1 -1
  104. package/dist/core/tool-logger.d.ts +1 -82
  105. package/dist/core/tool-logger.d.ts.map +1 -1
  106. package/dist/core/tool-logger.js +1 -452
  107. package/dist/core/tool-logger.js.map +1 -1
  108. package/dist/core/validation.d.ts +1 -38
  109. package/dist/core/validation.d.ts.map +1 -1
  110. package/dist/core/validation.js +1 -92
  111. package/dist/core/validation.js.map +1 -1
  112. package/dist/runtime/element/element-ref.d.ts +44 -0
  113. package/dist/runtime/element/element-ref.d.ts.map +1 -0
  114. package/dist/runtime/element/element-ref.js +214 -0
  115. package/dist/runtime/element/element-ref.js.map +1 -0
  116. package/dist/runtime/element/index.d.ts +2 -0
  117. package/dist/runtime/element/index.d.ts.map +1 -0
  118. package/dist/runtime/element/index.js +2 -0
  119. package/dist/runtime/element/index.js.map +1 -0
  120. package/dist/runtime/index.d.ts +10 -0
  121. package/dist/runtime/index.d.ts.map +1 -0
  122. package/dist/runtime/index.js +10 -0
  123. package/dist/runtime/index.js.map +1 -0
  124. package/dist/runtime/logging/index.d.ts +3 -0
  125. package/dist/runtime/logging/index.d.ts.map +1 -0
  126. package/dist/runtime/logging/index.js +3 -0
  127. package/dist/runtime/logging/index.js.map +1 -0
  128. package/dist/runtime/logging/logger.d.ts +55 -0
  129. package/dist/runtime/logging/logger.d.ts.map +1 -0
  130. package/dist/runtime/logging/logger.js +379 -0
  131. package/dist/runtime/logging/logger.js.map +1 -0
  132. package/dist/runtime/logging/tool-logger.d.ts +83 -0
  133. package/dist/runtime/logging/tool-logger.d.ts.map +1 -0
  134. package/dist/runtime/logging/tool-logger.js +454 -0
  135. package/dist/runtime/logging/tool-logger.js.map +1 -0
  136. package/dist/runtime/outputs/index.d.ts +3 -0
  137. package/dist/runtime/outputs/index.d.ts.map +1 -0
  138. package/dist/runtime/outputs/index.js +3 -0
  139. package/dist/runtime/outputs/index.js.map +1 -0
  140. package/dist/runtime/outputs/output-manager.d.ts +12 -0
  141. package/dist/runtime/outputs/output-manager.d.ts.map +1 -0
  142. package/dist/runtime/outputs/output-manager.js +39 -0
  143. package/dist/runtime/outputs/output-manager.js.map +1 -0
  144. package/dist/runtime/outputs/report-generator.d.ts +5 -0
  145. package/dist/runtime/outputs/report-generator.d.ts.map +1 -0
  146. package/dist/runtime/outputs/report-generator.js +175 -0
  147. package/dist/runtime/outputs/report-generator.js.map +1 -0
  148. package/dist/runtime/session/index.d.ts +3 -0
  149. package/dist/runtime/session/index.d.ts.map +1 -0
  150. package/dist/runtime/session/index.js +3 -0
  151. package/dist/runtime/session/index.js.map +1 -0
  152. package/dist/runtime/session/store.d.ts +28 -0
  153. package/dist/runtime/session/store.d.ts.map +1 -0
  154. package/dist/runtime/session/store.js +154 -0
  155. package/dist/runtime/session/store.js.map +1 -0
  156. package/dist/runtime/session/utils/cleanup.d.ts +3 -0
  157. package/dist/runtime/session/utils/cleanup.d.ts.map +1 -0
  158. package/dist/runtime/session/utils/cleanup.js +78 -0
  159. package/dist/runtime/session/utils/cleanup.js.map +1 -0
  160. package/dist/runtime/timeout/index.d.ts +2 -0
  161. package/dist/runtime/timeout/index.d.ts.map +1 -0
  162. package/dist/runtime/timeout/index.js +2 -0
  163. package/dist/runtime/timeout/index.js.map +1 -0
  164. package/dist/runtime/timeout/timeout.d.ts +49 -0
  165. package/dist/runtime/timeout/timeout.d.ts.map +1 -0
  166. package/dist/runtime/timeout/timeout.js +67 -0
  167. package/dist/runtime/timeout/timeout.js.map +1 -0
  168. package/dist/runtime/validation/index.d.ts +2 -0
  169. package/dist/runtime/validation/index.d.ts.map +1 -0
  170. package/dist/runtime/validation/index.js +2 -0
  171. package/dist/runtime/validation/index.js.map +1 -0
  172. package/dist/runtime/validation/validation.d.ts +39 -0
  173. package/dist/runtime/validation/validation.d.ts.map +1 -0
  174. package/dist/runtime/validation/validation.js +93 -0
  175. package/dist/runtime/validation/validation.js.map +1 -0
  176. package/dist/schemas/automator/miniprogram_close.json +12 -0
  177. package/dist/schemas/automator/miniprogram_connect.json +19 -0
  178. package/dist/schemas/automator/miniprogram_disconnect.json +12 -0
  179. package/dist/schemas/automator/miniprogram_launch.json +30 -0
  180. package/dist/server.js +1 -1
  181. package/dist/server.js.map +1 -1
  182. package/dist/tools/index.d.ts.map +1 -1
  183. package/dist/tools/index.js +3 -3
  184. package/dist/tools/index.js.map +1 -1
  185. package/dist/tools/miniprogram.d.ts +2 -1
  186. package/dist/tools/miniprogram.d.ts.map +1 -1
  187. package/dist/tools/miniprogram.js +19 -24
  188. package/dist/tools/miniprogram.js.map +1 -1
  189. package/dist/tools/page.js +2 -2
  190. package/dist/tools/page.js.map +1 -1
  191. package/docs/directory-structure-and-code-style-best-practices.md +91 -0
  192. package/docs/migration/README.md +34 -0
  193. package/docs/migration/TC-ALIGN-01-notes.md +35 -0
  194. package/docs/migration/runtime-skeleton.md +50 -0
  195. package/docs/migration/tool-schema-strategy.md +75 -0
  196. package/docs//345/256/214/346/225/264/345/256/236/347/216/260/346/226/271/346/241/210.md +14 -14
  197. package/docs//347/254/254/344/270/200/347/211/210/346/234/254/346/226/271/346/241/210.md +7 -7
  198. package/package.json +4 -2
  199. package/docs/SIMPLE_USAGE.md +0 -210
  200. package/docs/architecture.E-Docs.md +0 -1359
  201. package/docs/architecture.F1.md +0 -720
  202. package/docs/architecture.F2.md +0 -871
  203. package/docs/architecture.F3.md +0 -905
  204. package/docs/architecture.md +0 -90
  205. package/docs/charter.A1.align.yaml +0 -170
  206. package/docs/charter.A2.align.yaml +0 -199
  207. package/docs/charter.A3.align.yaml +0 -242
  208. package/docs/charter.A4.align.yaml +0 -227
  209. package/docs/charter.B1.align.yaml +0 -179
  210. package/docs/charter.B2.align.yaml +0 -200
  211. package/docs/charter.B3.align.yaml +0 -200
  212. package/docs/charter.B4.align.yaml +0 -188
  213. package/docs/charter.C1.align.yaml +0 -190
  214. package/docs/charter.C2.align.yaml +0 -202
  215. package/docs/charter.C3.align.yaml +0 -211
  216. package/docs/charter.C4.align.yaml +0 -263
  217. package/docs/charter.C5.align.yaml +0 -220
  218. package/docs/charter.D1.align.yaml +0 -190
  219. package/docs/charter.D2.align.yaml +0 -234
  220. package/docs/charter.D3.align.yaml +0 -206
  221. package/docs/charter.E-Docs.align.yaml +0 -294
  222. package/docs/charter.F1.align.yaml +0 -193
  223. package/docs/charter.F2.align.yaml +0 -248
  224. package/docs/charter.F3.align.yaml +0 -287
  225. package/docs/charter.G.align.yaml +0 -174
  226. package/docs/charter.align.yaml +0 -111
  227. package/docs/maintenance.md +0 -682
  228. package/docs/playwright-mcp/350/260/203/347/240/224.md +0 -53
  229. package/docs/setup-guide.md +0 -775
  230. package/docs/tasks.A1.atomize.md +0 -296
  231. package/docs/tasks.A2.atomize.md +0 -408
  232. package/docs/tasks.A3.atomize.md +0 -564
  233. package/docs/tasks.A4.atomize.md +0 -496
  234. package/docs/tasks.B1.atomize.md +0 -352
  235. package/docs/tasks.B2.atomize.md +0 -561
  236. package/docs/tasks.B3.atomize.md +0 -508
  237. package/docs/tasks.B4.atomize.md +0 -504
  238. package/docs/tasks.C1.atomize.md +0 -540
  239. package/docs/tasks.C2.atomize.md +0 -665
  240. package/docs/tasks.C3.atomize.md +0 -745
  241. package/docs/tasks.C4.atomize.md +0 -908
  242. package/docs/tasks.C5.atomize.md +0 -755
  243. package/docs/tasks.D1.atomize.md +0 -547
  244. package/docs/tasks.D2.atomize.md +0 -619
  245. package/docs/tasks.D3.atomize.md +0 -790
  246. package/docs/tasks.E-Docs.atomize.md +0 -1204
  247. package/docs/tasks.atomize.md +0 -189
@@ -1,1204 +0,0 @@
1
- # Task Card: [E1] Documentation Enhancement
2
-
3
- **Task ID**: E1
4
- **Task Name**: Documentation Enhancement
5
- **Charter**: `docs/charter.E1.align.yaml`
6
- **Architecture**: `docs/architecture.E1.md`
7
- **Stage**: E (Documentation & Examples)
8
- **Status**: IN PROGRESS (Atomize phase)
9
- **Estimated**: 7-9 hours
10
- **Actual**: TBD
11
- **Started**: 2025-10-02
12
-
13
- ---
14
-
15
- ## Goal (目标)
16
-
17
- Create comprehensive, navigable, and maintainable documentation that enables developers to quickly understand, configure, and use the MCP server for WeChat Mini Program automation.
18
-
19
- **Deliverables**:
20
- - Enhanced README.md with quickstart and inline examples
21
- - Complete API reference for all 59 tools across 7 categories
22
- - 5+ realistic usage examples covering major scenarios
23
- - Enhanced troubleshooting guide with FAQ and error reference
24
- - Detailed setup guide and architecture documentation
25
- - Enhanced CONTRIBUTING.md with 6A workflow
26
-
27
- **Success Criteria**:
28
- - New users can run first command in <5 minutes following README
29
- - Developers can find tool documentation in <2 minutes
30
- - All 59 tools documented with consistent format
31
- - Documentation is cross-referenced and searchable
32
-
33
- ---
34
-
35
- ## Prerequisites (前置条件)
36
-
37
- - ✅ Stage D completion (all 59 tools implemented and tested)
38
- - ✅ Access to tool schemas and type definitions (src/tools/)
39
- - ✅ Understanding of ElementRef protocol (src/core/element-ref.ts)
40
- - ✅ Knowledge of SessionStore lifecycle (src/core/session-store.ts)
41
- - ✅ Test files as source of usage examples (tests/unit/)
42
- - ✅ Charter E1 approved
43
- - ✅ Architecture E1 completed
44
-
45
- ---
46
-
47
- ## Implementation Tasks (19 Tasks)
48
-
49
- ### Phase 1: Core Documentation (2 hours)
50
-
51
- #### Task E1.1: README.md Enhancement ⏳
52
- **Estimated**: 30 minutes
53
-
54
- **Goal**: Transform README into a compelling entry point with quickstart path, hero section, core features overview, and inline examples.
55
-
56
- **Steps**:
57
- 1. Add badges section (Tests, License, Version, MCP Protocol)
58
- 2. Write hero section with value proposition (2-3 sentences)
59
- 3. Create "Features" section highlighting 6 key capabilities:
60
- - 59 Automation Tools
61
- - ElementRef Protocol
62
- - Session Management
63
- - Snapshot & Replay
64
- - Built-in Assertions
65
- - MCP Native
66
- 4. Enhance "Quick Start" with:
67
- - Prerequisites checklist
68
- - 3-step installation (clone, build, configure)
69
- - First automation code example
70
- 5. Add 3 inline code examples:
71
- - Navigate and Interact
72
- - Run Assertions
73
- - Capture Snapshots
74
- 6. Add "Tool Categories" overview table (7 categories × 59 tools)
75
- 7. Add "Documentation" navigation section with links
76
- 8. Add "Project Structure" visual tree
77
- 9. Update "Contributing" and "Links" sections
78
- 10. Verify all internal links work
79
-
80
- **DoD**:
81
- - [x] README.md contains hero section with value proposition
82
- - [x] Quick Start enables first command in <5 minutes
83
- - [x] 3 inline code examples are clear and runnable
84
- - [x] All 7 tool categories summarized
85
- - [x] Navigation links to all major docs sections
86
- - [x] Badges display correctly (Tests, License, etc.)
87
- - [x] File length <500 lines (readable)
88
-
89
- **References**:
90
- - `docs/architecture.E1.md` Section 3.1 (README structure)
91
- - Current `README.md` (existing content)
92
- - `src/tools/index.ts` (tool registration for count verification)
93
-
94
- ---
95
-
96
- #### Task E1.2: Setup Guide Enhancement ⏳
97
- **Estimated**: 30 minutes
98
-
99
- **Goal**: Expand existing setup-guide.md with detailed environment requirements, DevTools configuration, MCP client setup, verification steps, and common setup issues.
100
-
101
- **Steps**:
102
- 1. Read existing `docs/setup-guide.md`
103
- 2. Add "Environment Requirements" section:
104
- - Node.js 18+ (specific version recommendations)
105
- - WeChat DevTools installation paths (macOS/Windows/Linux)
106
- - OS compatibility matrix
107
- 3. Enhance "WeChat DevTools Setup" with:
108
- - Automation port configuration (Settings → Security)
109
- - CLI path verification commands
110
- - Enable service port (default 9420)
111
- - Security settings checklist
112
- 4. Add "MCP Client Configuration" section:
113
- - Claude Desktop configuration example
114
- - Cline configuration example
115
- - Custom client setup (using @modelcontextprotocol/sdk)
116
- 5. Add "Verification Steps" section:
117
- - Test CLI path: `cli --help`
118
- - Test MCP connection
119
- - Test first automation command
120
- - Expected output examples
121
- 6. Add "Configuration Options" section:
122
- - Document all .mcp.json options (capabilities, outputDir, sessionTimeout, etc.)
123
- - Provide .mcp.json.example with comments
124
- 7. Add "Common Setup Issues" section:
125
- - Permission errors (macOS/Linux)
126
- - Port conflicts (9420 already in use)
127
- - Path issues (CLI not found)
128
- - Solutions for each issue
129
- 8. Cross-reference with troubleshooting.md
130
-
131
- **DoD**:
132
- - [x] Environment requirements clearly listed
133
- - [x] WeChat DevTools configuration step-by-step
134
- - [x] MCP client examples for Claude Desktop and Cline
135
- - [x] Verification steps with expected output
136
- - [x] All .mcp.json options documented
137
- - [x] Common setup issues covered with solutions
138
- - [x] File length <1500 lines
139
-
140
- **References**:
141
- - `docs/setup-guide.md` (existing)
142
- - `src/config/index.ts` (config options)
143
- - `docs/architecture.E1.md` Section 3.5
144
-
145
- ---
146
-
147
- #### Task E1.3: Architecture Document ⏳
148
- **Estimated**: 45 minutes
149
-
150
- **Goal**: Create comprehensive architecture.md documenting system overview, component relationships, design decisions, and extension points.
151
-
152
- **Steps**:
153
- 1. Create new file `docs/architecture.md`
154
- 2. Add "Overview" section:
155
- - Project purpose and value proposition
156
- - High-level architecture diagram (MCP → Server → Automator → DevTools)
157
- - Key design principles (6 principles from architecture.E1.md)
158
- 3. Add "System Components" section:
159
- - MCP Server (server.ts, CLI)
160
- - Core modules (SessionStore, ElementRef, OutputManager)
161
- - Tools hierarchy (Automator → MiniProgram → Page → Element)
162
- - Configuration system (config/)
163
- 4. Add "Design Decisions" section (ADR-style):
164
- - ADR-1: ElementRef Protocol (why, alternatives considered, tradeoffs)
165
- - ADR-2: Session Management (isolated state, lifecycle)
166
- - ADR-3: Capabilities System (modular tool registration)
167
- - ADR-4: Stdio Transport (vs HTTP/WebSocket)
168
- - ADR-5: Zod Schemas (validation and docs)
169
- 5. Add "Data Flows" section with sequence diagrams:
170
- - Flow 1: Launch → Connect → Navigate (basic workflow)
171
- - Flow 2: Element Resolution (refId vs selector vs xpath)
172
- - Flow 3: Snapshot Capture/Restore (state management)
173
- 6. Add "Extension Points" section:
174
- - How to add new tools (step-by-step)
175
- - How to add new capabilities
176
- - How to customize SessionStore
177
- 7. Add "Project Structure" section (annotated directory tree)
178
- 8. Add "Technology Stack" section (Node, TypeScript, MCP SDK, miniprogram-automator)
179
- 9. Cross-reference with API docs and examples
180
-
181
- **DoD**:
182
- - [x] System overview with architecture diagram
183
- - [x] All major components documented
184
- - [x] 5 key design decisions explained (ADR format)
185
- - [x] 3 data flow diagrams (using Mermaid)
186
- - [x] Extension points clearly documented
187
- - [x] Cross-references to related docs
188
- - [x] File length <2000 lines
189
-
190
- **References**:
191
- - `docs/architecture.E1.md` (design inspiration)
192
- - `docs/完整实现方案.md` (original architecture)
193
- - `src/` directory structure
194
- - `docs/charter.E1.align.yaml` (design principles)
195
-
196
- ---
197
-
198
- ### Phase 2: API Documentation (3 hours)
199
-
200
- #### Task E1.4: API Documentation Framework ⏳
201
- **Estimated**: 15 minutes
202
-
203
- **Goal**: Create docs/api/README.md as comprehensive tool catalog with navigation, basic workflows, and ElementRef protocol documentation.
204
-
205
- **Steps**:
206
- 1. Create `docs/api/README.md`
207
- 2. Add "Overview" section (59 tools, 7 categories)
208
- 3. Create "Tool Categories" section with tables:
209
- - 7 category subsections (Automator, MiniProgram, Page, Element, Assert, Snapshot, Record)
210
- - Each table: Tool Name → Description → Link to detailed docs
211
- - Total count per category
212
- 4. Add "Common Workflows" section with 4 code examples:
213
- - Basic Navigation Flow
214
- - Testing Flow
215
- - Debugging Flow
216
- - Record/Replay Flow
217
- 5. Add "ElementRef Protocol" section:
218
- - Protocol description
219
- - TypeScript interface
220
- - Resolution priority explanation
221
- - Cache invalidation rules
222
- - 4 usage examples (selector, save handle, index, xpath)
223
- 6. Add "See Also" section with links to setup, examples, troubleshooting
224
- 7. Verify all internal links work
225
-
226
- **DoD**:
227
- - [x] All 59 tools listed in category tables
228
- - [x] 4 common workflows documented with code
229
- - [x] ElementRef protocol fully explained
230
- - [x] Navigation links to all 7 category docs
231
- - [x] Cross-references to setup/examples/troubleshooting
232
- - [x] File length <1000 lines
233
-
234
- **References**:
235
- - `docs/architecture.E1.md` Section 3.2.1
236
- - `src/tools/index.ts` (tool registration)
237
- - `src/core/element-ref.ts` (ElementRef protocol)
238
-
239
- ---
240
-
241
- #### Task E1.5: Automator Tools Documentation ⏳
242
- **Estimated**: 20 minutes
243
-
244
- **Goal**: Document 4 Automator-level tools (launch, connect, disconnect, close) with complete API reference.
245
-
246
- **Steps**:
247
- 1. Create `docs/api/automator.md`
248
- 2. Add file header and category introduction
249
- 3. Document each tool using template:
250
- - `automator_launch`: Launch DevTools with project
251
- - `automator_connect`: Connect to running instance
252
- - `automator_disconnect`: Disconnect from instance
253
- - `automator_close`: Close DevTools instance
254
- 4. For each tool, include:
255
- - Description (1-2 sentences)
256
- - Parameters table (name, type, required, default, description)
257
- - Return value TypeScript interface
258
- - 2 code examples (basic usage, error handling)
259
- - Usage notes (performance, behavior, dependencies)
260
- - Common errors table (code, cause, solution)
261
- - See Also links
262
- 5. Extract parameter details from Zod schemas in `src/tools/automator.ts`
263
- 6. Extract examples from `tests/unit/automator.test.ts`
264
- 7. Cross-reference between related tools
265
-
266
- **DoD**:
267
- - [x] All 4 Automator tools documented
268
- - [x] Each tool has parameters table, return value, 2 examples, usage notes, errors
269
- - [x] Examples extracted from test files (verified)
270
- - [x] Common errors documented with solutions
271
- - [x] Cross-references between tools
272
- - [x] File length <800 lines
273
-
274
- **References**:
275
- - `src/tools/automator.ts` (implementation and schemas)
276
- - `tests/unit/automator.test.ts` (usage examples)
277
- - `docs/微信小程序自动化完整操作手册.md` (official API reference)
278
- - `docs/architecture.E1.md` Section 3.2.2 (template)
279
-
280
- ---
281
-
282
- #### Task E1.6: MiniProgram Tools Documentation ⏳
283
- **Estimated**: 30 minutes
284
-
285
- **Goal**: Document 6 MiniProgram-level tools (navigate, callWx, evaluate, screenshot, getPageStack, getSystemInfo).
286
-
287
- **Steps**:
288
- 1. Create `docs/api/miniprogram.md`
289
- 2. Add file header and category introduction
290
- 3. Document each tool using template:
291
- - `miniprogram_navigateTo`: Navigate to new page
292
- - `miniprogram_navigateBack`: Go back to previous page
293
- - `miniprogram_redirectTo`: Redirect to page (replace current)
294
- - `miniprogram_evaluate`: Execute JavaScript in app context
295
- - `miniprogram_screenshot`: Capture app screenshot
296
- - `miniprogram_currentPage`: Get current page information
297
- 4. For each tool, include full API reference (description, parameters, return, examples, notes, errors)
298
- 5. Extract from `src/tools/miniprogram.ts` and `tests/unit/miniprogram.test.ts`
299
- 6. Add special notes for:
300
- - Navigation: page path format, app.json registration
301
- - Evaluate: context scope, async execution
302
- - Screenshot: path resolution, image formats
303
- 7. Cross-reference with Page tools (navigate → query workflow)
304
-
305
- **DoD**:
306
- - [x] All 6 MiniProgram tools documented
307
- - [x] Each tool has complete API reference
308
- - [x] Special notes for navigation and evaluate
309
- - [x] Examples from test files
310
- - [x] Common errors with solutions
311
- - [x] Cross-references to Page tools
312
- - [x] File length <1200 lines
313
-
314
- **References**:
315
- - `src/tools/miniprogram.ts`
316
- - `tests/unit/miniprogram.test.ts`
317
- - `docs/微信小程序自动化完整操作手册.md`
318
- - `docs/architecture.E1.md` Section 3.2.2
319
-
320
- ---
321
-
322
- #### Task E1.7: Page Tools Documentation ⏳
323
- **Estimated**: 40 minutes
324
-
325
- **Goal**: Document 8 Page-level tools (query, queryAll, waitFor, getData, setData, callMethod, getSize, getScrollTop).
326
-
327
- **Steps**:
328
- 1. Create `docs/api/page.md`
329
- 2. Add file header and category introduction
330
- 3. Document each tool using template:
331
- - `page_querySelector`: Query single element by selector
332
- - `page_querySelectorAll`: Query multiple elements by selector
333
- - `page_data`: Get or set page data
334
- - `page_setData`: Update page data
335
- - `page_waitFor`: Wait for condition (selector, timeout, custom)
336
- - `page_scrollTo`: Scroll to position
337
- - `page_callMethod`: Call page instance method
338
- - `page_size`: Get page dimensions
339
- 4. For each tool, include full API reference
340
- 5. Add special notes for:
341
- - Query: Selector syntax (WXML vs CSS), multi-element handling
342
- - Data: Path notation (dot syntax), nested data access
343
- - WaitFor: Condition types (element, idle, timeout, custom)
344
- 6. Extract from `src/tools/page.ts` and `tests/unit/page.test.ts`
345
- 7. Cross-reference with Element tools (query → interact workflow)
346
- 8. Add workflow examples (query → wait → interact)
347
-
348
- **DoD**:
349
- - [x] All 8 Page tools documented
350
- - [x] Each tool has complete API reference
351
- - [x] Special notes for query selectors and data paths
352
- - [x] Workflow examples included
353
- - [x] Examples from test files
354
- - [x] Common errors with solutions
355
- - [x] Cross-references to Element tools
356
- - [x] File length <1500 lines
357
-
358
- **References**:
359
- - `src/tools/page.ts`
360
- - `tests/unit/page.test.ts`
361
- - `docs/微信小程序自动化完整操作手册.md`
362
- - `docs/architecture.E1.md` Section 3.2.2
363
-
364
- ---
365
-
366
- #### Task E1.8: Element Tools Documentation ⏳
367
- **Estimated**: 60 minutes
368
-
369
- **Goal**: Document 23 Element-level tools across 5 subcategories (Attributes, Interactions, Input, Component-Specific, Query/State).
370
-
371
- **Steps**:
372
- 1. Create `docs/api/element.md`
373
- 2. Add file header and category introduction
374
- 3. Organize tools into subcategories with subheadings:
375
- - **General Attributes (8 tools)**:
376
- - element_attribute, element_boundingClientRect
377
- - element_text, element_value
378
- - element_property, element_style
379
- - element_wxml, element_outerWxml
380
- - **Interactions (3 tools)**:
381
- - element_tap, element_longpress
382
- - element_touchstart_touchend
383
- - **Input (1 tool)**:
384
- - element_input
385
- - **Component-Specific Methods (11 tools)**:
386
- - Swiper: element_swipeTo
387
- - Scroll View: element_scrollIntoView, element_scrollTo_element
388
- - Movable View: element_moveTo
389
- - Picker: element_callMethod, element_setPickerValue
390
- - Video: element_play, element_pause, element_seek
391
- - Textarea/Input: element_trigger, element_callMethod
392
- 4. For each tool, include full API reference
393
- 5. Add special notes for:
394
- - ElementRef usage across all tools (refId vs selector)
395
- - Component-specific tools: which WXML components they apply to
396
- - Touch events: coordinates, event types
397
- 6. Extract from `src/tools/element.ts` and `tests/unit/element.test.ts`
398
- 7. Add ElementRef best practices section
399
- 8. Cross-reference with Page query tools
400
-
401
- **DoD**:
402
- - [x] All 23 Element tools documented
403
- - [x] Tools organized into 5 logical subcategories
404
- - [x] Each tool has complete API reference
405
- - [x] Component-specific tools clearly labeled
406
- - [x] ElementRef best practices documented
407
- - [x] Examples from test files
408
- - [x] Common errors with solutions
409
- - [x] Cross-references to Page tools
410
- - [x] File length <3000 lines
411
-
412
- **References**:
413
- - `src/tools/element.ts`
414
- - `tests/unit/element.test.ts`
415
- - `docs/微信小程序自动化完整操作手册.md`
416
- - `docs/architecture.E1.md` Section 3.2.2
417
-
418
- ---
419
-
420
- #### Task E1.9: Assert Tools Documentation ⏳
421
- **Estimated**: 30 minutes
422
-
423
- **Goal**: Document 9 Assert tools for testing and validation workflows.
424
-
425
- **Steps**:
426
- 1. Create `docs/api/assert.md`
427
- 2. Add file header and category introduction
428
- 3. Document each tool using template:
429
- - `assert_elementExists`: Assert element exists in DOM
430
- - `assert_elementNotExists`: Assert element does not exist
431
- - `assert_elementText`: Assert element text content
432
- - `assert_elementAttribute`: Assert element attribute value
433
- - `assert_elementData`: Assert page data value
434
- - `assert_elementVisible`: Assert element is visible
435
- - `assert_elementEnabled`: Assert element is enabled
436
- - `assert_pageUrl`: Assert current page URL
437
- - `assert_screenshot`: Visual regression testing
438
- 4. For each tool, include full API reference
439
- 5. Add "Testing Workflows" section with 3 examples:
440
- - Basic assertion test (exists + text)
441
- - Form validation test (multiple asserts)
442
- - Visual regression test (screenshot)
443
- 6. Extract from `src/tools/assert.ts` and `tests/unit/assert.test.ts`
444
- 7. Cross-reference with Examples (03-assertion-testing.md)
445
- 8. Add assertion best practices section
446
-
447
- **DoD**:
448
- - [x] All 9 Assert tools documented
449
- - [x] Each tool has complete API reference
450
- - [x] 3 testing workflow examples included
451
- - [x] Assertion best practices documented
452
- - [x] Examples from test files
453
- - [x] Common errors with solutions
454
- - [x] Cross-references to testing example
455
- - [x] File length <1500 lines
456
-
457
- **References**:
458
- - `src/tools/assert.ts`
459
- - `tests/unit/assert.test.ts`
460
- - `docs/architecture.E1.md` Section 3.2.2
461
-
462
- ---
463
-
464
- #### Task E1.10: Snapshot Tools Documentation ⏳
465
- **Estimated**: 15 minutes
466
-
467
- **Goal**: Document 3 Snapshot tools for state management and debugging.
468
-
469
- **Steps**:
470
- 1. Create `docs/api/snapshot.md`
471
- 2. Add file header and category introduction
472
- 3. Document each tool using template:
473
- - `snapshot_capture`: Capture current page state
474
- - `snapshot_restore`: Restore previously captured state
475
- - `snapshot_compare`: Compare two snapshots
476
- 4. For each tool, include full API reference
477
- 5. Add "Debugging Workflows" section with 2 examples:
478
- - Capture → Action → Compare (state change debugging)
479
- - Capture → Test → Restore (test isolation)
480
- 6. Extract from `src/tools/snapshot.ts` and `tests/unit/snapshot.test.ts`
481
- 7. Cross-reference with Examples (04-snapshot-debugging.md)
482
- 8. Add snapshot best practices section (when to capture, cleanup)
483
-
484
- **DoD**:
485
- - [x] All 3 Snapshot tools documented
486
- - [x] Each tool has complete API reference
487
- - [x] 2 debugging workflow examples included
488
- - [x] Snapshot best practices documented
489
- - [x] Examples from test files
490
- - [x] Common errors with solutions
491
- - [x] Cross-references to debugging example
492
- - [x] File length <600 lines
493
-
494
- **References**:
495
- - `src/tools/snapshot.ts`
496
- - `tests/unit/snapshot.test.ts`
497
- - `docs/architecture.E1.md` Section 3.2.2
498
-
499
- ---
500
-
501
- #### Task E1.11: Record Tools Documentation ⏳
502
- **Estimated**: 30 minutes
503
-
504
- **Goal**: Document 6 Record tools for recording and replaying user flows.
505
-
506
- **Steps**:
507
- 1. Create `docs/api/record.md`
508
- 2. Add file header and category introduction
509
- 3. Document each tool using template:
510
- - `record_start`: Start recording user actions
511
- - `record_stop`: Stop current recording
512
- - `record_save`: Save recording to file
513
- - `record_replay`: Replay saved recording
514
- - `record_list`: List all saved recordings
515
- - `record_delete`: Delete saved recording
516
- 4. For each tool, include full API reference
517
- 5. Add "Recording Workflows" section with 3 examples:
518
- - Record → Save → Replay (basic flow)
519
- - Record → Edit → Save (manual editing)
520
- - List → Replay → Delete (management)
521
- 6. Extract from `src/tools/record.ts` and `tests/unit/record.test.ts`
522
- 7. Add recording file format documentation (JSON structure)
523
- 8. Cross-reference with Examples (05-record-replay.md)
524
- 9. Add recording best practices section
525
-
526
- **DoD**:
527
- - [x] All 6 Record tools documented
528
- - [x] Each tool has complete API reference
529
- - [x] 3 recording workflow examples included
530
- - [x] Recording file format documented
531
- - [x] Recording best practices documented
532
- - [x] Examples from test files
533
- - [x] Common errors with solutions
534
- - [x] Cross-references to recording example
535
- - [x] File length <1200 lines
536
-
537
- **References**:
538
- - `src/tools/record.ts`
539
- - `tests/unit/record.test.ts`
540
- - `docs/architecture.E1.md` Section 3.2.2
541
-
542
- ---
543
-
544
- ### Phase 3: Usage Examples (2 hours)
545
-
546
- #### Task E1.12: Review Existing Example ⏳
547
- **Estimated**: 15 minutes
548
-
549
- **Goal**: Review and enhance existing examples/01-basic-navigation.md for consistency with new documentation standards.
550
-
551
- **Steps**:
552
- 1. Read existing `examples/01-basic-navigation.md`
553
- 2. Apply example template structure:
554
- - Add difficulty badge (🟢 Basic)
555
- - Add "Tools Used" table
556
- - Verify "Prerequisites" section completeness
557
- - Ensure "Step-by-Step Walkthrough" is clear
558
- - Add "Expected Output" section
559
- - Add "Troubleshooting" section
560
- - Add "Variations" section
561
- - Add "See Also" cross-references
562
- 3. Verify code examples match current API
563
- 4. Update parameter names/formats if changed
564
- 5. Add inline comments to code examples
565
- 6. Cross-reference with API docs (automator.md, miniprogram.md, page.md)
566
-
567
- **DoD**:
568
- - [x] Example follows template structure
569
- - [x] Difficulty badge added (🟢 Basic)
570
- - [x] Code examples verified and updated
571
- - [x] Troubleshooting section added
572
- - [x] Cross-references to API docs added
573
- - [x] File length <1000 lines
574
-
575
- **References**:
576
- - `examples/01-basic-navigation.md` (existing)
577
- - `docs/architecture.E1.md` Section 3.3 (template)
578
- - `docs/api/automator.md`, `miniprogram.md`, `page.md`
579
-
580
- ---
581
-
582
- #### Task E1.13: Element Interaction Example ⏳
583
- **Estimated**: 30 minutes
584
-
585
- **Goal**: Create examples/02-element-interaction.md demonstrating element interactions (tap, input, swiper, scroll, picker).
586
-
587
- **Steps**:
588
- 1. Create `examples/02-element-interaction.md`
589
- 2. Apply example template structure
590
- 3. Set difficulty: 🟢 Basic
591
- 4. Write scenario description: "Interact with common WeChat Mini Program components including buttons, inputs, swipers, scroll views, and pickers"
592
- 5. List prerequisites (DevTools, MCP client, demo project)
593
- 6. Create "Tools Used" table (element_tap, element_input, element_swipeTo, element_scrollIntoView, element_setPickerValue)
594
- 7. Write complete code example covering:
595
- - Tap button
596
- - Input text into field
597
- - Swipe to next item in swiper
598
- - Scroll element into view
599
- - Select picker option
600
- 8. Add step-by-step walkthrough with explanations
601
- 9. Add expected output for each step
602
- 10. Add troubleshooting section:
603
- - Element not found
604
- - Element not interactable
605
- - Swiper/picker index out of range
606
- 11. Add variations:
607
- - Use refId for repeated interactions
608
- - Combine with assertions
609
- 12. Cross-reference with element.md
610
-
611
- **DoD**:
612
- - [x] Example follows template structure
613
- - [x] Covers 5+ interaction types
614
- - [x] Complete code with step-by-step walkthrough
615
- - [x] Troubleshooting section with 3+ issues
616
- - [x] Cross-references to API docs
617
- - [x] File length <1200 lines
618
-
619
- **References**:
620
- - `docs/architecture.E1.md` Section 3.3 (template)
621
- - `docs/api/element.md`
622
- - `tests/unit/element.test.ts` (example patterns)
623
-
624
- ---
625
-
626
- #### Task E1.14: Assertion Testing Example ⏳
627
- **Estimated**: 30 minutes
628
-
629
- **Goal**: Create examples/03-assertion-testing.md demonstrating automated testing workflow with assertions.
630
-
631
- **Steps**:
632
- 1. Create `examples/03-assertion-testing.md`
633
- 2. Apply example template structure
634
- 3. Set difficulty: 🟡 Intermediate
635
- 4. Write scenario description: "Build an automated test suite for a Mini Program page using assertions to validate UI state, data, and behavior"
636
- 5. List prerequisites
637
- 6. Create "Tools Used" table (assert_elementExists, assert_elementText, assert_elementAttribute, assert_elementData, assert_pageUrl)
638
- 7. Write complete code example covering:
639
- - Launch and navigate to test page
640
- - Assert page URL is correct
641
- - Assert key elements exist
642
- - Assert element text content
643
- - Assert element attributes (class, disabled, etc.)
644
- - Assert page data values
645
- - Perform action (tap button)
646
- - Assert state changes (new elements, updated data)
647
- - Cleanup
648
- 8. Add step-by-step walkthrough
649
- 9. Add expected output showing assertion results
650
- 10. Add troubleshooting section:
651
- - Assertion failures
652
- - Timing issues (data not updated yet)
653
- - Selector mismatches
654
- 11. Add variations:
655
- - Negative testing (assert_elementNotExists)
656
- - Data-driven testing (multiple scenarios)
657
- 12. Cross-reference with assert.md
658
-
659
- **DoD**:
660
- - [x] Example follows template structure
661
- - [x] Demonstrates complete test workflow
662
- - [x] Uses 5+ assertion tools
663
- - [x] Shows before/after state validation
664
- - [x] Troubleshooting section with 3+ issues
665
- - [x] Cross-references to API docs
666
- - [x] File length <1500 lines
667
-
668
- **References**:
669
- - `docs/architecture.E1.md` Section 3.3
670
- - `docs/api/assert.md`
671
- - `tests/unit/assert.test.ts`
672
-
673
- ---
674
-
675
- #### Task E1.15: Snapshot Debugging Example ⏳
676
- **Estimated**: 20 minutes
677
-
678
- **Goal**: Create examples/04-snapshot-debugging.md demonstrating state capture, restore, and comparison for debugging.
679
-
680
- **Steps**:
681
- 1. Create `examples/04-snapshot-debugging.md`
682
- 2. Apply example template structure
683
- 3. Set difficulty: 🟡 Intermediate
684
- 4. Write scenario description: "Use snapshots to capture and compare application state during debugging, enabling quick identification of state changes and rollback to known-good states"
685
- 5. List prerequisites
686
- 6. Create "Tools Used" table (snapshot_capture, snapshot_restore, snapshot_compare)
687
- 7. Write complete code example covering:
688
- - Capture initial state ("clean-state")
689
- - Perform action (form submission)
690
- - Capture new state ("after-submit")
691
- - Compare states to see changes
692
- - Restore initial state
693
- - Re-run test with different inputs
694
- 8. Add step-by-step walkthrough
695
- 9. Add expected output showing snapshot comparison results
696
- 10. Add troubleshooting section:
697
- - Snapshot not found
698
- - State not restored correctly
699
- - Too many snapshots (cleanup)
700
- 11. Add variations:
701
- - Use snapshots for test isolation
702
- - Capture snapshots at multiple points
703
- 12. Cross-reference with snapshot.md
704
-
705
- **DoD**:
706
- - [x] Example follows template structure
707
- - [x] Demonstrates capture → compare → restore workflow
708
- - [x] Shows practical debugging use case
709
- - [x] Expected output shows state diff
710
- - [x] Troubleshooting section with 3+ issues
711
- - [x] Cross-references to API docs
712
- - [x] File length <1000 lines
713
-
714
- **References**:
715
- - `docs/architecture.E1.md` Section 3.3
716
- - `docs/api/snapshot.md`
717
- - `tests/unit/snapshot.test.ts`
718
-
719
- ---
720
-
721
- #### Task E1.16: Record and Replay Example ⏳
722
- **Estimated**: 25 minutes
723
-
724
- **Goal**: Create examples/05-record-replay.md demonstrating recording user flows and replaying for regression testing.
725
-
726
- **Steps**:
727
- 1. Create `examples/05-record-replay.md`
728
- 2. Apply example template structure
729
- 3. Set difficulty: 🔴 Advanced
730
- 4. Write scenario description: "Record complex user flows as JSON files and replay them for automated regression testing, reducing manual test maintenance"
731
- 5. List prerequisites
732
- 6. Create "Tools Used" table (record_start, record_stop, record_save, record_replay, record_list, record_delete)
733
- 7. Write complete code example covering:
734
- - Start recording ("checkout-flow")
735
- - Perform multi-step user flow (browse → select → add to cart → checkout)
736
- - Stop recording
737
- - Save recording to file
738
- - List all recordings
739
- - Replay recording
740
- - Verify results with assertions
741
- - Delete recording
742
- 8. Add step-by-step walkthrough
743
- 9. Add section on recording file format (JSON structure)
744
- 10. Add expected output showing recording metadata
745
- 11. Add troubleshooting section:
746
- - Recording file corrupt
747
- - Replay fails (element not found)
748
- - Timing issues during replay
749
- 12. Add variations:
750
- - Edit recording JSON manually
751
- - Combine with assertions for validation
752
- - Replay with different data inputs
753
- 13. Cross-reference with record.md
754
-
755
- **DoD**:
756
- - [x] Example follows template structure
757
- - [x] Demonstrates complete record → save → replay workflow
758
- - [x] Recording file format documented
759
- - [x] Shows practical regression testing use case
760
- - [x] Troubleshooting section with 3+ issues
761
- - [x] Cross-references to API docs
762
- - [x] File length <1500 lines
763
-
764
- **References**:
765
- - `docs/architecture.E1.md` Section 3.3
766
- - `docs/api/record.md`
767
- - `tests/unit/record.test.ts`
768
-
769
- ---
770
-
771
- ### Phase 4: Final Documentation (1.5 hours)
772
-
773
- #### Task E1.17: Troubleshooting Guide Enhancement ⏳
774
- **Estimated**: 60 minutes
775
-
776
- **Goal**: Transform docs/troubleshooting.md into comprehensive error resolution guide with FAQ, error reference, debugging workflows, and best practices.
777
-
778
- **Steps**:
779
- 1. Read existing `docs/troubleshooting.md`
780
- 2. Add "Table of Contents" with navigation links
781
- 3. Create "FAQ" section with 10-15 common questions:
782
- - How to enable automation in DevTools?
783
- - Why does automator_launch fail?
784
- - What's difference between refId/selector/xpath?
785
- - Can I use with clients other than Claude Desktop?
786
- - How to debug "Element not found"?
787
- - (5-10 more based on test scenarios)
788
- 4. Create "Error Reference" section organized by category:
789
- - **Automator Errors**: ERR_LAUNCH_FAILED, ERR_CONNECT_TIMEOUT, ERR_NOT_LAUNCHED
790
- - **MiniProgram Errors**: ERR_NAVIGATION_FAILED, ERR_EVALUATE_FAILED
791
- - **Page Errors**: ERR_ELEMENT_NOT_FOUND, ERR_SELECTOR_INVALID, ERR_TIMEOUT
792
- - **Element Errors**: ERR_ELEMENT_INVALID, ERR_INTERACTION_FAILED, ERR_NOT_INTERACTABLE
793
- - **Configuration Errors**: ERR_CONFIG_INVALID, ERR_PATH_NOT_FOUND
794
- - For each error: Cause, Common Reasons (3-5), Solutions (step-by-step), Example Error JSON
795
- 5. Create "Debugging Workflows" section with 3-5 step-by-step procedures:
796
- - Workflow 1: Element Not Found (5-step diagnosis)
797
- - Workflow 2: Session State Issues
798
- - Workflow 3: Performance Degradation
799
- - Workflow 4: Network/Connection Issues
800
- - Workflow 5: Configuration Problems
801
- 6. Create "Best Practices" section:
802
- - Performance Optimization (3+ tips)
803
- - Reliability Best Practices (3+ tips)
804
- - Maintainability Best Practices (3+ tips)
805
- 7. Create "Common Pitfalls" section with 5+ scenarios:
806
- - Stale element references after navigation
807
- - Incorrect selector syntax (WXML vs CSS)
808
- - Timing issues (element not ready)
809
- - Using wrong ElementRef resolution strategy
810
- - Not cleaning up sessions
811
- 8. Add "Getting Help" section with links to GitHub issues
812
- 9. Cross-reference with setup-guide.md, API docs, examples
813
-
814
- **DoD**:
815
- - [x] FAQ section with 10+ questions
816
- - [x] Error reference with 20+ error codes across 5 categories
817
- - [x] 3-5 debugging workflows with step-by-step instructions
818
- - [x] Best practices organized by category (performance, reliability, maintainability)
819
- - [x] 5+ common pitfalls documented
820
- - [x] Cross-references to other docs
821
- - [x] File length <3000 lines
822
-
823
- **References**:
824
- - `docs/troubleshooting.md` (existing)
825
- - `docs/architecture.E1.md` Section 3.4
826
- - `src/tools/*.ts` (error messages)
827
- - `tests/unit/*.test.ts` (common scenarios)
828
-
829
- ---
830
-
831
- #### Task E1.18: CONTRIBUTING Enhancement ⏳
832
- **Estimated**: 30 minutes
833
-
834
- **Goal**: Enhance CONTRIBUTING.md with 6A workflow documentation, development environment setup, tool development guide, and PR process.
835
-
836
- **Steps**:
837
- 1. Read existing `CONTRIBUTING.md`
838
- 2. Add "Table of Contents"
839
- 3. Add "6A Workflow" section with detailed explanation:
840
- - Overview of 6A stages (Align → Architect → Atomize → Approve → Automate → Assess)
841
- - When to use each stage
842
- - Expected outputs per stage
843
- - Example: How E1 followed 6A (charter → architecture → atomize → this doc)
844
- 4. Add "Development Environment" section:
845
- - Prerequisites (Node 18+, pnpm, WeChat DevTools)
846
- - Clone and setup commands
847
- - Build and test commands
848
- - Development workflow (watch mode, linting, formatting)
849
- 5. Add "Code Standards" section:
850
- - TypeScript conventions
851
- - Testing requirements (unit + integration)
852
- - Documentation synchronization rules
853
- - Commit message format
854
- 6. Add "Tool Development Guide" section (step-by-step):
855
- - Step 1: Define tool in src/tools/{category}.ts
856
- - Step 2: Create Zod schema for inputs
857
- - Step 3: Implement tool handler
858
- - Step 4: Register tool in tools/index.ts
859
- - Step 5: Write unit tests (tests/unit/)
860
- - Step 6: Document in docs/api/{category}.md
861
- - Step 7: Update .llm/state.json
862
- - Example: Adding a new element interaction tool
863
- 7. Add "Pull Request Process" section:
864
- - Branch naming conventions
865
- - PR description template
866
- - Review checklist (tests passing, docs updated, .llm/state.json updated)
867
- - CI requirements
868
- 8. Add "Documentation Update Protocol" section:
869
- - When to update docs (code change, API change, new tool)
870
- - Which docs to update (API reference, examples, troubleshooting)
871
- - Verification checklist
872
- 9. Cross-reference with architecture.md, setup-guide.md
873
-
874
- **DoD**:
875
- - [x] 6A workflow fully explained with examples
876
- - [x] Development environment setup documented
877
- - [x] Tool development guide with 7-step process
878
- - [x] PR process and checklist documented
879
- - [x] Documentation update protocol defined
880
- - [x] Cross-references to other docs
881
- - [x] File length <2000 lines
882
-
883
- **References**:
884
- - `CONTRIBUTING.md` (existing)
885
- - `CLAUDE.md` (6A workflow reference)
886
- - `docs/architecture.E1.md` Section 3.7
887
- - `.llm/prompts/` (6A workflow definitions)
888
-
889
- ---
890
-
891
- #### Task E1.19: Cross-Referencing and Review ⏳
892
- **Estimated**: 60 minutes
893
-
894
- **Goal**: Verify all internal links work, ensure consistency across all documentation, and validate completeness.
895
-
896
- **Steps**:
897
- 1. Create documentation checklist spreadsheet:
898
- - List all 18+ documentation files
899
- - Columns: File, Status, Word Count, Links Verified, Consistency Checked, Completeness Verified
900
- 2. **Link Verification** (15 min):
901
- - Review all internal links in README.md
902
- - Review all internal links in docs/api/README.md
903
- - Review all cross-references in docs/api/{category}.md files (7 files)
904
- - Review all "See Also" links in examples/ (5 files)
905
- - Verify troubleshooting.md cross-references
906
- - Fix broken links
907
- 3. **Consistency Check** (20 min):
908
- - Verify terminology consistency:
909
- - "ElementRef" vs "element reference" (standardize)
910
- - "MiniProgram" vs "Mini Program" (standardize)
911
- - "DevTools" vs "WeChat DevTools" (standardize)
912
- - Verify code example formatting consistency:
913
- - All JavaScript code blocks use ```javascript
914
- - Consistent indentation (2 spaces)
915
- - Consistent comment style
916
- - Verify heading hierarchy consistency:
917
- - H1 only for file title
918
- - H2 for main sections
919
- - H3 for subsections
920
- - No skipped levels
921
- - Verify table formatting consistency
922
- 4. **Completeness Verification** (15 min):
923
- - Verify all 59 tools documented (cross-check with src/tools/index.ts)
924
- - Verify all examples follow template structure
925
- - Verify all API docs have: description, parameters, return, examples, notes, errors
926
- - Verify all examples have: scenario, prerequisites, tools used, code, walkthrough, output, troubleshooting, variations, see also
927
- 5. **Quality Review** (10 min):
928
- - Check for typos/grammar (automated spell check)
929
- - Check for clarity (no ambiguous statements)
930
- - Check for completeness (no "TBD" or "TODO" remaining)
931
- - Check for accuracy (code examples match current API)
932
- 6. **Final Validation** (5 min):
933
- - Build project: `pnpm build`
934
- - Verify no broken imports
935
- - Render all Markdown files in GitHub preview
936
- - Check Table of Contents auto-generation works
937
- 7. Create `docs/documentation-index.md` listing all docs with descriptions
938
- 8. Update README.md "Documentation" section if needed
939
-
940
- **DoD**:
941
- - [x] All internal links verified and working
942
- - [x] Terminology consistent across all docs
943
- - [x] Code formatting consistent
944
- - [x] Heading hierarchy consistent
945
- - [x] All 59 tools documented (verified)
946
- - [x] All examples complete (verified)
947
- - [x] No typos or grammar errors
948
- - [x] No "TBD" or "TODO" remaining
949
- - [x] Documentation index created
950
- - [x] Checklist completed with evidence
951
-
952
- **References**:
953
- - All documentation files (18+ files)
954
- - `src/tools/index.ts` (tool count verification)
955
-
956
- ---
957
-
958
- ## Definition of Done (完成标准)
959
-
960
- ### Documentation Deliverables
961
-
962
- **Core Documentation**:
963
- - [x] README.md enhanced with quickstart and inline examples
964
- - [x] docs/architecture.md created with system overview
965
- - [x] docs/setup-guide.md enhanced with detailed configuration
966
-
967
- **API Documentation** (7 files):
968
- - [x] docs/api/README.md (tool catalog and workflows)
969
- - [x] docs/api/automator.md (4 tools)
970
- - [x] docs/api/miniprogram.md (6 tools)
971
- - [x] docs/api/page.md (8 tools)
972
- - [x] docs/api/element.md (23 tools)
973
- - [x] docs/api/assert.md (9 tools)
974
- - [x] docs/api/snapshot.md (3 tools)
975
- - [x] docs/api/record.md (6 tools)
976
-
977
- **Usage Examples** (6 files):
978
- - [x] examples/README.md (example index)
979
- - [x] examples/01-basic-navigation.md (enhanced)
980
- - [x] examples/02-element-interaction.md (new)
981
- - [x] examples/03-assertion-testing.md (new)
982
- - [x] examples/04-snapshot-debugging.md (new)
983
- - [x] examples/05-record-replay.md (new)
984
-
985
- **Support Documentation**:
986
- - [x] docs/troubleshooting.md enhanced (FAQ, errors, workflows, best practices)
987
- - [x] CONTRIBUTING.md enhanced (6A workflow, tool development)
988
- - [x] docs/documentation-index.md (new)
989
-
990
- **Total**: 18 documentation files (3 enhanced, 15 new)
991
-
992
- ### Quality Criteria
993
-
994
- **Completeness**:
995
- - [x] All 59 tools documented with complete API reference
996
- - [x] Each tool has: description, parameters, return value, 2+ examples, usage notes, common errors
997
- - [x] 5+ usage examples covering major scenarios
998
- - [x] FAQ has 10+ questions
999
- - [x] Error reference has 20+ error codes
1000
- - [x] 3+ debugging workflows documented
1001
- - [x] Cross-references working between all docs
1002
-
1003
- **Accessibility**:
1004
- - [x] README quickstart enables first command in <5 minutes
1005
- - [x] Developers can find any tool documentation in <2 minutes
1006
- - [x] Setup guide enables environment setup in <15 minutes
1007
- - [x] Troubleshooting guide enables error resolution in <5 minutes
1008
-
1009
- **Consistency**:
1010
- - [x] All API docs follow template structure
1011
- - [x] All examples follow template structure
1012
- - [x] Terminology unified across all docs
1013
- - [x] Code formatting consistent
1014
- - [x] Heading hierarchy consistent
1015
-
1016
- **Usability**:
1017
- - [x] Table of contents in long documents
1018
- - [x] Internal navigation links working
1019
- - [x] Code examples are clear and commented
1020
- - [x] Troubleshooting sections in examples
1021
- - [x] "See Also" cross-references provided
1022
-
1023
- ### Git & State Management
1024
-
1025
- **Git**:
1026
- - [x] All new/updated files committed
1027
- - [x] Commit message follows conventions
1028
- - [x] References E1 task in commit message
1029
-
1030
- **State Management**:
1031
- - [x] .llm/state.json updated with:
1032
- - stage: "E"
1033
- - task_id: "E1"
1034
- - status: "COMPLETED"
1035
- - artifacts: All 18 documentation files listed
1036
- - timestamp: ISO8601 format
1037
- - [x] Session log created in .llm/session_log/ (if multi-session)
1038
- - [x] .llm/qa/E1-acceptance.md created with evidence
1039
-
1040
- ---
1041
-
1042
- ## Task Dependencies
1043
-
1044
- ### Sequential Dependencies (Must Complete in Order)
1045
-
1046
- **Phase 1 → Phase 2**:
1047
- - E1.3 (Architecture) must complete before E1.4 (API Framework)
1048
- - E1.4 (API Framework) must complete before E1.5-E1.11 (API docs)
1049
-
1050
- **Phase 2 → Phase 3**:
1051
- - E1.5-E1.11 (API docs) must complete before E1.12-E1.16 (Examples)
1052
- - Examples reference API docs for "See Also" links
1053
-
1054
- **Phase 3 → Phase 4**:
1055
- - E1.17 (Troubleshooting) references examples and API docs
1056
- - E1.19 (Review) requires all other tasks complete
1057
-
1058
- ### Parallel Work Opportunities
1059
-
1060
- **Phase 1** (can parallelize):
1061
- - E1.1 (README) + E1.2 (Setup Guide) can be done in parallel
1062
- - E1.3 (Architecture) depends on understanding from E1.1/E1.2
1063
-
1064
- **Phase 2** (can parallelize within subcategories):
1065
- - E1.5-E1.7 (Automator/MiniProgram/Page) can be done in parallel
1066
- - E1.8-E1.11 (Element/Assert/Snapshot/Record) can be done in parallel
1067
- - But E1.4 (API Framework) must complete first
1068
-
1069
- **Phase 3** (can parallelize):
1070
- - E1.13-E1.16 (new examples) can be done in parallel after E1.12
1071
- - E1.12 (review existing) should be done first as template reference
1072
-
1073
- **Phase 4** (sequential):
1074
- - E1.17 (Troubleshooting) can be done in parallel with E1.18 (CONTRIBUTING)
1075
- - E1.19 (Review) must be done last
1076
-
1077
- ---
1078
-
1079
- ## Risks & Mitigation
1080
-
1081
- ### Identified Risks
1082
-
1083
- | Risk | Impact | Probability | Mitigation |
1084
- |------|--------|-------------|------------|
1085
- | **Work underestimated** (7-9 hours may not be enough) | High | Medium | Focus on core content first, avoid over-polishing, defer optional 6th example if needed |
1086
- | **Documentation becomes outdated quickly** | High | Medium | Establish update protocol in CONTRIBUTING.md, add to PR checklist |
1087
- | **Examples don't match actual user scenarios** | Medium | Low | Base on test files, keep examples realistic, collect feedback |
1088
- | **API docs too technical for beginners** | Medium | Low | Add beginner-friendly intro sections, use progressive disclosure |
1089
- | **Broken internal links after refactoring** | Low | Medium | E1.19 verifies all links, use relative paths consistently |
1090
- | **Inconsistent formatting across docs** | Low | Medium | Use templates strictly, E1.19 consistency check |
1091
-
1092
- ### Open Questions
1093
-
1094
- 1. **Auto-generation from Zod schemas**: Should we invest in auto-generating API docs?
1095
- - **Decision**: Manual for E1 (faster delivery), revisit automation in Stage G
1096
- - **Rationale**: 59 tools × 3-4 min/tool = manageable manual work, automation has setup cost
1097
-
1098
- 2. **Documentation site**: Should we use VitePress/Docusaurus for better UX?
1099
- - **Decision**: Markdown files only for E1 (simplicity), revisit in Stage G
1100
- - **Rationale**: GitHub Markdown rendering is sufficient, avoid tooling complexity
1101
-
1102
- 3. **Example verification**: Do we need tests that validate example code?
1103
- - **Decision**: Defer to Stage G
1104
- - **Rationale**: Examples are conceptual, not copy-pastable; manual review sufficient for E1
1105
-
1106
- 4. **Bilingual strategy**: Separate EN/CN files or mixed?
1107
- - **Decision**: Mixed bilingual (headers in both languages) for critical docs
1108
- - **Rationale**: Easier maintenance, audience understands both languages
1109
-
1110
- ---
1111
-
1112
- ## References (参考资料)
1113
-
1114
- ### Planning Documents
1115
-
1116
- - `docs/charter.E1.align.yaml` - Task alignment and scope
1117
- - `docs/architecture.E1.md` - Documentation architecture design
1118
- - `.llm/prompts/task.cards.md` - Original E1 task definition
1119
-
1120
- ### Source Code
1121
-
1122
- - `src/tools/index.ts` - Tool registration (59 tools)
1123
- - `src/tools/automator.ts` - Automator tools (4)
1124
- - `src/tools/miniprogram.ts` - MiniProgram tools (6)
1125
- - `src/tools/page.ts` - Page tools (8)
1126
- - `src/tools/element.ts` - Element tools (23)
1127
- - `src/tools/assert.ts` - Assert tools (9)
1128
- - `src/tools/snapshot.ts` - Snapshot tools (3)
1129
- - `src/tools/record.ts` - Record tools (6)
1130
- - `src/core/element-ref.ts` - ElementRef protocol
1131
- - `src/core/session-store.ts` - Session management
1132
- - `src/config/index.ts` - Configuration options
1133
-
1134
- ### Tests (Usage Examples)
1135
-
1136
- - `tests/unit/automator.test.ts`
1137
- - `tests/unit/miniprogram.test.ts`
1138
- - `tests/unit/page.test.ts`
1139
- - `tests/unit/element.test.ts`
1140
- - `tests/unit/assert.test.ts`
1141
- - `tests/unit/snapshot.test.ts`
1142
- - `tests/unit/record.test.ts`
1143
- - `tests/unit/tool-registration.test.ts`
1144
-
1145
- ### Existing Documentation
1146
-
1147
- - `README.md` (current state)
1148
- - `docs/setup-guide.md` (current state)
1149
- - `docs/troubleshooting.md` (current state)
1150
- - `CONTRIBUTING.md` (current state)
1151
- - `examples/01-basic-navigation.md` (existing example)
1152
- - `docs/完整实现方案.md` (original architecture)
1153
- - `docs/微信小程序自动化完整操作手册.md` (official API reference, 50+ pages)
1154
-
1155
- ### External References
1156
-
1157
- - [MCP Protocol Documentation](https://modelcontextprotocol.io/)
1158
- - [WeChat Mini Program Docs](https://developers.weixin.qq.com/miniprogram/dev/framework/)
1159
- - [Markdown Style Guide](https://www.markdownguide.org/)
1160
- - [GitHub Flavored Markdown](https://github.github.com/gfm/)
1161
-
1162
- ---
1163
-
1164
- ## Next Steps After E1
1165
-
1166
- ### Immediate Next Steps
1167
-
1168
- 1. **Approval Gate**: Wait for explicit approval before beginning Automate phase
1169
- 2. **Update State**: Update `.llm/state.json` with E1 ATOMIZED status
1170
- 3. **Begin Implementation**: Start with Phase 1 (E1.1-E1.3)
1171
-
1172
- ### Dependent Tasks (After E1 Complete)
1173
-
1174
- - **E2**: Enhanced Examples & Tutorials (if approved)
1175
- - Additional examples (e2e-shopping, form validation, error handling)
1176
- - Interactive tutorials
1177
- - Video walkthroughs (if needed)
1178
-
1179
- - **Stage G**: Quality Assurance
1180
- - Documentation review with external reviewers
1181
- - Documentation accuracy validation
1182
- - Link validation automation
1183
- - Spell check automation
1184
-
1185
- - **Stage H**: Release Preparation
1186
- - Generate API docs website (VitePress/Docusaurus)
1187
- - Publish to npm
1188
- - Update README with installation instructions
1189
- - Create release notes
1190
-
1191
- ### Improvements Suggested for Future
1192
-
1193
- 1. **Auto-generation**: Explore generating API docs from Zod schemas
1194
- 2. **Interactive Examples**: Create runnable examples in documentation site
1195
- 3. **Video Tutorials**: Record screencasts for complex workflows
1196
- 4. **Translation**: Full Chinese translation for CN audience
1197
- 5. **Documentation Tests**: Automated validation of example code
1198
- 6. **Search**: Add search functionality to documentation site
1199
-
1200
- ---
1201
-
1202
- **Task Status**: ⏳ IN PROGRESS (Atomize phase complete, awaiting approval to proceed to Automate)
1203
- **Documentation Status**: ⏳ PLANNED (ready to begin implementation)
1204
- **Approval Required**: YES (before beginning E1.1)