oh-my-codex-cli 0.1.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 (292) hide show
  1. package/.agent/skills/agent-kb/HOW_TO_USE.md +428 -0
  2. package/.agent/skills/agent-kb/README.md +46 -0
  3. package/.agent/skills/agent-kb/SKILL.md +128 -0
  4. package/.agent/skills/agent-kb/references/intelligent-analysis-explained.md +333 -0
  5. package/.agent/skills/agent-kb/references/query-optimization.md +225 -0
  6. package/.agent/skills/aireview/SKILL.md +704 -0
  7. package/.agent/skills/analyze/SKILL.md +81 -0
  8. package/.agent/skills/architect-planner/HOW_TO_USE.md +238 -0
  9. package/.agent/skills/architect-planner/README.md +41 -0
  10. package/.agent/skills/architect-planner/SKILL.md +539 -0
  11. package/.agent/skills/auto-mbti/SKILL.md +291 -0
  12. package/.agent/skills/autopilot/SKILL.md +222 -0
  13. package/.agent/skills/backend-patterns/SKILL.md +602 -0
  14. package/.agent/skills/bdd-generator/README.md +78 -0
  15. package/.agent/skills/bdd-generator/SKILL.md +436 -0
  16. package/.agent/skills/brainstorming/HOW_TO_USE.md +289 -0
  17. package/.agent/skills/brainstorming/README.md +41 -0
  18. package/.agent/skills/brainstorming/SKILL.md +165 -0
  19. package/.agent/skills/build-fix/SKILL.md +190 -0
  20. package/.agent/skills/cancel/SKILL.md +658 -0
  21. package/.agent/skills/checkpoint/SKILL.md +94 -0
  22. package/.agent/skills/code-review/SKILL.md +273 -0
  23. package/.agent/skills/coding-standards/SKILL.md +535 -0
  24. package/.agent/skills/conductor/SKILL.md +128 -0
  25. package/.agent/skills/conductor/commands/conductor/implement.toml +358 -0
  26. package/.agent/skills/conductor/commands/conductor/newTrack.toml +142 -0
  27. package/.agent/skills/conductor/commands/conductor/revert.toml +123 -0
  28. package/.agent/skills/conductor/commands/conductor/setup.toml +429 -0
  29. package/.agent/skills/conductor/commands/conductor/status.toml +57 -0
  30. package/.agent/skills/conductor/scripts/install.sh +89 -0
  31. package/.agent/skills/conductor/templates/code_styleguides/csharp.md +115 -0
  32. package/.agent/skills/conductor/templates/code_styleguides/dart.md +238 -0
  33. package/.agent/skills/conductor/templates/code_styleguides/general.md +23 -0
  34. package/.agent/skills/conductor/templates/code_styleguides/go.md +48 -0
  35. package/.agent/skills/conductor/templates/code_styleguides/html-css.md +49 -0
  36. package/.agent/skills/conductor/templates/code_styleguides/javascript.md +51 -0
  37. package/.agent/skills/conductor/templates/code_styleguides/python.md +37 -0
  38. package/.agent/skills/conductor/templates/code_styleguides/typescript.md +43 -0
  39. package/.agent/skills/conductor/templates/rules/README.md +23 -0
  40. package/.agent/skills/conductor/templates/rules/agents.md +49 -0
  41. package/.agent/skills/conductor/templates/rules/coding-style.md +70 -0
  42. package/.agent/skills/conductor/templates/rules/dev.md +20 -0
  43. package/.agent/skills/conductor/templates/rules/git-workflow.md +45 -0
  44. package/.agent/skills/conductor/templates/rules/hooks.md +6 -0
  45. package/.agent/skills/conductor/templates/rules/patterns.md +55 -0
  46. package/.agent/skills/conductor/templates/rules/performance.md +47 -0
  47. package/.agent/skills/conductor/templates/rules/research.md +26 -0
  48. package/.agent/skills/conductor/templates/rules/review.md +22 -0
  49. package/.agent/skills/conductor/templates/rules/security.md +36 -0
  50. package/.agent/skills/conductor/templates/rules/testing.md +30 -0
  51. package/.agent/skills/conductor/templates/workflow.md +333 -0
  52. package/.agent/skills/consensus/HOW_TO_USE.md +191 -0
  53. package/.agent/skills/consensus/README.md +41 -0
  54. package/.agent/skills/consensus/SKILL.md +317 -0
  55. package/.agent/skills/content-research-writer/SKILL.md +537 -0
  56. package/.agent/skills/debug-analysis/SKILL.md +331 -0
  57. package/.agent/skills/deepinit/SKILL.md +347 -0
  58. package/.agent/skills/deepsearch/SKILL.md +56 -0
  59. package/.agent/skills/doctor/SKILL.md +158 -0
  60. package/.agent/skills/drawio/EXAMPLES.md +382 -0
  61. package/.agent/skills/drawio/QUICK_START.md +237 -0
  62. package/.agent/skills/drawio/README.md +315 -0
  63. package/.agent/skills/drawio/SETUP_GUIDE.md +254 -0
  64. package/.agent/skills/drawio/SKILL.md +1176 -0
  65. package/.agent/skills/e2e/SKILL.md +396 -0
  66. package/.agent/skills/ecomode/SKILL.md +160 -0
  67. package/.agent/skills/electron-driver/SKILL.md +144 -0
  68. package/.agent/skills/electron-driver/scripts/driver-template.js +71 -0
  69. package/.agent/skills/eval/SKILL.md +140 -0
  70. package/.agent/skills/eval-harness/SKILL.md +242 -0
  71. package/.agent/skills/evolve/SKILL.md +213 -0
  72. package/.agent/skills/frontend-design/SKILL.md +42 -0
  73. package/.agent/skills/frontend-patterns/SKILL.md +646 -0
  74. package/.agent/skills/frontend-ui-ux/SKILL.md +70 -0
  75. package/.agent/skills/git-master/SKILL.md +75 -0
  76. package/.agent/skills/help/SKILL.md +89 -0
  77. package/.agent/skills/iterative-retrieval/SKILL.md +217 -0
  78. package/.agent/skills/local-skills-setup/SKILL.md +483 -0
  79. package/.agent/skills/log-analyzer/SKILL.md +187 -0
  80. package/.agent/skills/mcp-setup/SKILL.md +226 -0
  81. package/.agent/skills/multi-model-research/HOW_TO_USE.md +614 -0
  82. package/.agent/skills/multi-model-research/README.md +233 -0
  83. package/.agent/skills/multi-model-research/SKILL.md +541 -0
  84. package/.agent/skills/multi-model-research/references/troubleshooting.md +415 -0
  85. package/.agent/skills/note/SKILL.md +80 -0
  86. package/.agent/skills/omc-setup/SKILL.md +219 -0
  87. package/.agent/skills/orchestrate/SKILL.md +620 -0
  88. package/.agent/skills/patent-workflow/IMPLEMENTATION_SUMMARY.md +500 -0
  89. package/.agent/skills/patent-workflow/README.md +455 -0
  90. package/.agent/skills/patent-workflow/SKILL.md +1036 -0
  91. package/.agent/skills/patent-workflow/tools/irr_checker.py +260 -0
  92. package/.agent/skills/patent-workflow/tools/sample_terminology.json +49 -0
  93. package/.agent/skills/patent-workflow/tools/term_checker.py +355 -0
  94. package/.agent/skills/pattern-recognition/SKILL.md +792 -0
  95. package/.agent/skills/pipeline/SKILL.md +448 -0
  96. package/.agent/skills/plan/SKILL.md +309 -0
  97. package/.agent/skills/planning-methodology/SKILL.md +370 -0
  98. package/.agent/skills/planning-with-files/SKILL.md +210 -0
  99. package/.agent/skills/planning-with-files/examples.md +202 -0
  100. package/.agent/skills/planning-with-files/reference.md +218 -0
  101. package/.agent/skills/planning-with-files/scripts/check-complete.ps1 +42 -0
  102. package/.agent/skills/planning-with-files/scripts/check-complete.sh +44 -0
  103. package/.agent/skills/planning-with-files/scripts/init-session.ps1 +120 -0
  104. package/.agent/skills/planning-with-files/scripts/init-session.sh +120 -0
  105. package/.agent/skills/planning-with-files/scripts/session-catchup.py +208 -0
  106. package/.agent/skills/planning-with-files/templates/findings.md +95 -0
  107. package/.agent/skills/planning-with-files/templates/progress.md +114 -0
  108. package/.agent/skills/planning-with-files/templates/task_plan.md +132 -0
  109. package/.agent/skills/project-analyze/CLAUDE.md +18 -0
  110. package/.agent/skills/project-analyze/HOW_TO_USE.md +145 -0
  111. package/.agent/skills/project-analyze/README.md +42 -0
  112. package/.agent/skills/project-analyze/SKILL.md +289 -0
  113. package/.agent/skills/project-analyze/SKILL.md.backup +287 -0
  114. package/.agent/skills/project-analyze/SKILL.md.backup_20260105_093646 +287 -0
  115. package/.agent/skills/project-analyze/assets/analysis-report-template.md +433 -0
  116. package/.agent/skills/project-analyze/references/analysis-patterns.md +422 -0
  117. package/.agent/skills/project-analyze/references/projectmind-explained.md +535 -0
  118. package/.agent/skills/project-session-manager/SKILL.md +428 -0
  119. package/.agent/skills/project-session-manager/lib/config.sh +86 -0
  120. package/.agent/skills/project-session-manager/lib/parse.sh +121 -0
  121. package/.agent/skills/project-session-manager/lib/session.sh +132 -0
  122. package/.agent/skills/project-session-manager/lib/tmux.sh +103 -0
  123. package/.agent/skills/project-session-manager/lib/worktree.sh +171 -0
  124. package/.agent/skills/project-session-manager/psm.sh +629 -0
  125. package/.agent/skills/project-session-manager/templates/feature.md +56 -0
  126. package/.agent/skills/project-session-manager/templates/issue-fix.md +57 -0
  127. package/.agent/skills/project-session-manager/templates/pr-review.md +65 -0
  128. package/.agent/skills/project-session-manager/templates/projects.json +19 -0
  129. package/.agent/skills/quality-check/HOW_TO_USE.md +171 -0
  130. package/.agent/skills/quality-check/README.md +50 -0
  131. package/.agent/skills/quality-check/SKILL.md +240 -0
  132. package/.agent/skills/quality-check/SKILL.md.backup +238 -0
  133. package/.agent/skills/quality-check/SKILL.md.backup_20260105_093646 +238 -0
  134. package/.agent/skills/quality-check/assets/quality-report-template.md +437 -0
  135. package/.agent/skills/quality-check/references/refactoring-patterns.md +550 -0
  136. package/.agent/skills/quality-check/references/scoring-criteria.md +454 -0
  137. package/.agent/skills/quality-validation/SKILL.md +519 -0
  138. package/.agent/skills/quality-validation/SKILL.md.backup +573 -0
  139. package/.agent/skills/quality-validation/SKILL.md.backup_20260105_093646 +573 -0
  140. package/.agent/skills/ralph/SKILL.md +236 -0
  141. package/.agent/skills/ralph-init/SKILL.md +78 -0
  142. package/.agent/skills/ralplan/SKILL.md +58 -0
  143. package/.agent/skills/refactor-clean/SKILL.md +49 -0
  144. package/.agent/skills/release/SKILL.md +84 -0
  145. package/.agent/skills/research/SKILL.md +526 -0
  146. package/.agent/skills/research-methodology/SKILL.md +268 -0
  147. package/.agent/skills/review/SKILL.md +53 -0
  148. package/.agent/skills/security-review/SKILL.md +509 -0
  149. package/.agent/skills/security-review/cloud-infrastructure-security.md +361 -0
  150. package/.agent/skills/setup-pm/SKILL.md +102 -0
  151. package/.agent/skills/skill/SKILL.md +424 -0
  152. package/.agent/skills/skill-create/SKILL.md +209 -0
  153. package/.agent/skills/skill-debugger/HOW_TO_USE.md +244 -0
  154. package/.agent/skills/skill-debugger/README.md +44 -0
  155. package/.agent/skills/skill-debugger/SKILL.md +326 -0
  156. package/.agent/skills/skill-debugger/diagnostic_checklist.md +115 -0
  157. package/.agent/skills/skill-development/SKILL.md +661 -0
  158. package/.agent/skills/skill-development/references/skill-creator-original.md +209 -0
  159. package/.agent/skills/skill-doc-generator/README.md +37 -0
  160. package/.agent/skills/skill-doc-generator/SKILL.md +331 -0
  161. package/.agent/skills/skill-quality-analyzer/HOW_TO_USE.md +243 -0
  162. package/.agent/skills/skill-quality-analyzer/README.md +61 -0
  163. package/.agent/skills/skill-quality-analyzer/SKILL.md +247 -0
  164. package/.agent/skills/skill-quality-analyzer/analyzer.py +209 -0
  165. package/.agent/skills/skill-quality-analyzer/expected_output.json +81 -0
  166. package/.agent/skills/skill-quality-analyzer/sample_input.json +9 -0
  167. package/.agent/skills/skill-tester/README.md +46 -0
  168. package/.agent/skills/skill-tester/SKILL.md +345 -0
  169. package/.agent/skills/start-dev/SKILL.md +701 -0
  170. package/.agent/skills/swarm/SKILL.md +691 -0
  171. package/.agent/skills/task-kb-lookup/SKILL.md +211 -0
  172. package/.agent/skills/task-kb-record/SKILL.md +417 -0
  173. package/.agent/skills/tdd/SKILL.md +446 -0
  174. package/.agent/skills/tdd-generator/DEMO.md +516 -0
  175. package/.agent/skills/tdd-generator/README.md +89 -0
  176. package/.agent/skills/tdd-generator/SKILL.md +278 -0
  177. package/.agent/skills/tdd-workflow/SKILL.md +424 -0
  178. package/.agent/skills/test-coverage/SKILL.md +48 -0
  179. package/.agent/skills/thinkdeep/HOW_TO_USE.md +183 -0
  180. package/.agent/skills/thinkdeep/README.md +41 -0
  181. package/.agent/skills/thinkdeep/SKILL.md +343 -0
  182. package/.agent/skills/ui-ux-pro-max/SKILL.md +228 -0
  183. package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
  184. package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
  185. package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
  186. package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
  187. package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  188. package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  189. package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  190. package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  191. package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  192. package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  193. package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  194. package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  195. package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  196. package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
  197. package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
  198. package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  199. package/.agent/skills/ui-ux-pro-max/scripts/core.py +236 -0
  200. package/.agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
  201. package/.agent/skills/ultrapilot/SKILL.md +647 -0
  202. package/.agent/skills/ultraqa/SKILL.md +152 -0
  203. package/.agent/skills/ultrawork/SKILL.md +123 -0
  204. package/.agent/skills/update-codemaps/SKILL.md +38 -0
  205. package/.agent/skills/update-docs/SKILL.md +52 -0
  206. package/.agent/skills/verification-loop/SKILL.md +140 -0
  207. package/.agent/skills/verify/SKILL.md +80 -0
  208. package/.agent/skills/writer-memory/SKILL.md +459 -0
  209. package/.agent/skills/writer-memory/lib/character-tracker.ts +338 -0
  210. package/.agent/skills/writer-memory/lib/memory-manager.ts +804 -0
  211. package/.agent/skills/writer-memory/lib/relationship-graph.ts +400 -0
  212. package/.agent/skills/writer-memory/lib/scene-organizer.ts +544 -0
  213. package/.agent/skills/writer-memory/lib/synopsis-builder.ts +339 -0
  214. package/.agent/skills/writer-memory/templates/synopsis-template.md +46 -0
  215. package/.governance/skill-lint.allowlist +4 -0
  216. package/.governance/skill-llm.allowlist +4 -0
  217. package/AGENTS.md +59 -0
  218. package/LICENSE +21 -0
  219. package/README.md +169 -0
  220. package/README.zh.md +145 -0
  221. package/bin/omcodex.js +8 -0
  222. package/commands/conductor/implement.toml +358 -0
  223. package/commands/conductor/newTrack.toml +142 -0
  224. package/commands/conductor/revert.toml +123 -0
  225. package/commands/conductor/setup.toml +429 -0
  226. package/commands/conductor/status.toml +57 -0
  227. package/docs/ALIGNMENT.md +40 -0
  228. package/docs/CODEX.md +133 -0
  229. package/docs/NOTIFY.md +81 -0
  230. package/docs/SKILL_GOVERNANCE.md +72 -0
  231. package/docs/SKILL_GOVERNANCE_FRAMEWORK.md +182 -0
  232. package/docs/SKILL_GOVERNANCE_FRAMEWORK.zh.md +170 -0
  233. package/package.json +50 -0
  234. package/prompts/architect.md +105 -0
  235. package/prompts/executor.md +134 -0
  236. package/prompts/planner.md +113 -0
  237. package/scripts/check-skill-governance.sh +84 -0
  238. package/scripts/check-skill-llm-governance.js +302 -0
  239. package/scripts/eval-skills.js +217 -0
  240. package/scripts/generate-catalog-docs.js +95 -0
  241. package/scripts/generate-codex-mcp-config.sh +22 -0
  242. package/scripts/install-codex-force.sh +5 -0
  243. package/scripts/install-codex-incremental.sh +5 -0
  244. package/scripts/install-codex.sh +79 -0
  245. package/scripts/notify-dispatch.js +15 -0
  246. package/scripts/setup-package-manager.js +137 -0
  247. package/src/catalog/generated/public-catalog.json +547 -0
  248. package/src/catalog/manifest.json +542 -0
  249. package/src/catalog/reader.js +43 -0
  250. package/src/catalog/schema.js +79 -0
  251. package/src/cli/doctor.js +62 -0
  252. package/src/cli/index.js +85 -0
  253. package/src/cli/notify.js +127 -0
  254. package/src/cli/route.js +43 -0
  255. package/src/cli/setup.js +155 -0
  256. package/src/cli/team.js +125 -0
  257. package/src/config/generator.js +119 -0
  258. package/src/mcp/memory-server.js +241 -0
  259. package/src/mcp/state-server.js +112 -0
  260. package/src/mcp/trace-server.js +168 -0
  261. package/src/notify/dispatch.js +74 -0
  262. package/src/notify/extensibility/dispatcher.js +113 -0
  263. package/src/notify/extensibility/events.js +15 -0
  264. package/src/notify/extensibility/loader.js +54 -0
  265. package/src/router/skill-router.js +90 -0
  266. package/src/team/auto-advance.js +72 -0
  267. package/src/team/orchestrator.js +82 -0
  268. package/src/team/state-store.js +33 -0
  269. package/src/utils/paths.js +33 -0
  270. package/templates/AGENTS.md +15 -0
  271. package/templates/catalog-manifest.json +542 -0
  272. package/templates/code_styleguides/csharp.md +115 -0
  273. package/templates/code_styleguides/dart.md +238 -0
  274. package/templates/code_styleguides/general.md +23 -0
  275. package/templates/code_styleguides/go.md +48 -0
  276. package/templates/code_styleguides/html-css.md +49 -0
  277. package/templates/code_styleguides/javascript.md +51 -0
  278. package/templates/code_styleguides/python.md +37 -0
  279. package/templates/code_styleguides/typescript.md +43 -0
  280. package/templates/rules/README.md +23 -0
  281. package/templates/rules/agents.md +49 -0
  282. package/templates/rules/coding-style.md +70 -0
  283. package/templates/rules/dev.md +20 -0
  284. package/templates/rules/git-workflow.md +45 -0
  285. package/templates/rules/notify.md +6 -0
  286. package/templates/rules/patterns.md +55 -0
  287. package/templates/rules/performance.md +47 -0
  288. package/templates/rules/research.md +26 -0
  289. package/templates/rules/review.md +22 -0
  290. package/templates/rules/security.md +36 -0
  291. package/templates/rules/testing.md +30 -0
  292. package/templates/workflow.md +333 -0
@@ -0,0 +1,516 @@
1
+ # TDD Test Generator - Practical Demonstrations
2
+
3
+ This file contains three detailed demonstrations showing how to use the TDD Test Generator skill.
4
+
5
+ ## Demo 1: Unit Test Generation (30 seconds)
6
+
7
+ ### Original Function
8
+ ```typescript
9
+ // src/utils/formatMessage.ts
10
+ export function formatMessage(text: string, maxLength: number = 100): string {
11
+ if (!text) return '';
12
+ if (text.length <= maxLength) return text;
13
+ return text.slice(0, maxLength) + '...';
14
+ }
15
+ ```
16
+
17
+ ### User Action
18
+ Simply say: **"生成测试"** or **"Generate test for formatMessage"**
19
+
20
+ ### Generated Test (Instant)
21
+ ```typescript
22
+ // src/utils/__tests__/formatMessage.test.ts
23
+ import { describe, it, expect } from 'vitest';
24
+ import { formatMessage } from '../formatMessage';
25
+
26
+ describe('formatMessage', () => {
27
+ it('should return empty string for empty input', () => {
28
+ expect(formatMessage('')).toBe('');
29
+ });
30
+
31
+ it('should return original text if within maxLength', () => {
32
+ const text = 'Hello World';
33
+ expect(formatMessage(text, 100)).toBe('Hello World');
34
+ });
35
+
36
+ it('should truncate and add ellipsis if exceeds maxLength', () => {
37
+ const text = 'A'.repeat(150);
38
+ const result = formatMessage(text, 100);
39
+ expect(result).toBe('A'.repeat(100) + '...');
40
+ expect(result.length).toBe(103);
41
+ });
42
+
43
+ it('should use default maxLength of 100', () => {
44
+ const text = 'B'.repeat(120);
45
+ const result = formatMessage(text);
46
+ expect(result).toBe('B'.repeat(100) + '...');
47
+ });
48
+
49
+ it('should handle text exactly at maxLength', () => {
50
+ const text = 'C'.repeat(100);
51
+ expect(formatMessage(text, 100)).toBe(text);
52
+ });
53
+ });
54
+ ```
55
+
56
+ ### TDD Workflow
57
+ 1. 🔴 **Red**: Run test (fails - function doesn't exist yet)
58
+ 2. 🟢 **Green**: Implement formatMessage function
59
+ 3. 🔵 **Refactor**: Optimize if needed
60
+ 4. ✅ **Result**: 5 passing tests, 100% coverage
61
+
62
+ ---
63
+
64
+ ## Demo 2: Component Test Generation (1 minute)
65
+
66
+ ### Original Component
67
+ ```typescript
68
+ // src/components/ChatInput.tsx
69
+ import React, { useState } from 'react';
70
+
71
+ interface ChatInputProps {
72
+ onSend: (message: string) => void;
73
+ placeholder?: string;
74
+ disabled?: boolean;
75
+ }
76
+
77
+ export const ChatInput: React.FC<ChatInputProps> = ({
78
+ onSend,
79
+ placeholder = '输入消息...',
80
+ disabled = false
81
+ }) => {
82
+ const [value, setValue] = useState('');
83
+
84
+ const handleSubmit = (e: React.FormEvent) => {
85
+ e.preventDefault();
86
+ if (value.trim()) {
87
+ onSend(value);
88
+ setValue('');
89
+ }
90
+ };
91
+
92
+ return (
93
+ <form onSubmit={handleSubmit}>
94
+ <input
95
+ type="text"
96
+ value={value}
97
+ onChange={(e) => setValue(e.target.value)}
98
+ placeholder={placeholder}
99
+ disabled={disabled}
100
+ />
101
+ <button type="submit" disabled={disabled || !value.trim()}>
102
+ 发送
103
+ </button>
104
+ </form>
105
+ );
106
+ };
107
+ ```
108
+
109
+ ### User Action
110
+ Say: **"如何测试ChatInput组件"** or **"Generate component test"**
111
+
112
+
113
+ ### Generated Test Suite
114
+ ```typescript
115
+ // src/components/__tests__/ChatInput.test.tsx
116
+ import { describe, it, expect, vi } from 'vitest';
117
+ import { render, screen } from '@testing-library/react';
118
+ import userEvent from '@testing-library/user-event';
119
+ import { ChatInput } from '../ChatInput';
120
+
121
+ describe('ChatInput', () => {
122
+ it('renders with default placeholder', () => {
123
+ const mockOnSend = vi.fn();
124
+ render(<ChatInput onSend={mockOnSend} />);
125
+
126
+ expect(screen.getByPlaceholderText('输入消息...')).toBeInTheDocument();
127
+ });
128
+
129
+ it('renders with custom placeholder', () => {
130
+ const mockOnSend = vi.fn();
131
+ render(<ChatInput onSend={mockOnSend} placeholder="Custom placeholder" />);
132
+
133
+ expect(screen.getByPlaceholderText('Custom placeholder')).toBeInTheDocument();
134
+ });
135
+
136
+ it('calls onSend with message when form submitted', async () => {
137
+ const user = userEvent.setup();
138
+ const mockOnSend = vi.fn();
139
+ render(<ChatInput onSend={mockOnSend} />);
140
+
141
+ const input = screen.getByRole('textbox');
142
+ const button = screen.getByRole('button', { name: '发送' });
143
+
144
+ await user.type(input, 'Hello World');
145
+ await user.click(button);
146
+
147
+ expect(mockOnSend).toHaveBeenCalledWith('Hello World');
148
+ expect(mockOnSend).toHaveBeenCalledTimes(1);
149
+ });
150
+
151
+ it('clears input after sending message', async () => {
152
+ const user = userEvent.setup();
153
+ const mockOnSend = vi.fn();
154
+ render(<ChatInput onSend={mockOnSend} />);
155
+
156
+ const input = screen.getByRole('textbox') as HTMLInputElement;
157
+
158
+ await user.type(input, 'Test message');
159
+ await user.click(screen.getByRole('button'));
160
+
161
+ expect(input.value).toBe('');
162
+ });
163
+
164
+ it('does not call onSend for empty message', async () => {
165
+ const user = userEvent.setup();
166
+ const mockOnSend = vi.fn();
167
+ render(<ChatInput onSend={mockOnSend} />);
168
+
169
+ await user.click(screen.getByRole('button'));
170
+
171
+ expect(mockOnSend).not.toHaveBeenCalled();
172
+ });
173
+
174
+ it('trims whitespace before sending', async () => {
175
+ const user = userEvent.setup();
176
+ const mockOnSend = vi.fn();
177
+ render(<ChatInput onSend={mockOnSend} />);
178
+
179
+ const input = screen.getByRole('textbox');
180
+ await user.type(input, ' spaces ');
181
+ await user.click(screen.getByRole('button'));
182
+
183
+ expect(mockOnSend).toHaveBeenCalledWith(' spaces ');
184
+ });
185
+
186
+ it('disables input and button when disabled prop is true', () => {
187
+ const mockOnSend = vi.fn();
188
+ render(<ChatInput onSend={mockOnSend} disabled />);
189
+
190
+ expect(screen.getByRole('textbox')).toBeDisabled();
191
+ expect(screen.getByRole('button')).toBeDisabled();
192
+ });
193
+
194
+ it('disables button when input is empty', () => {
195
+ const mockOnSend = vi.fn();
196
+ render(<ChatInput onSend={mockOnSend} />);
197
+
198
+ expect(screen.getByRole('button')).toBeDisabled();
199
+ });
200
+
201
+ it('enables button when input has content', async () => {
202
+ const user = userEvent.setup();
203
+ const mockOnSend = vi.fn();
204
+ render(<ChatInput onSend={mockOnSend} />);
205
+
206
+ const button = screen.getByRole('button');
207
+ expect(button).toBeDisabled();
208
+
209
+ await user.type(screen.getByRole('textbox'), 'A');
210
+ expect(button).not.toBeDisabled();
211
+ });
212
+ });
213
+ ```
214
+
215
+ ### Test Results
216
+ ```bash
217
+ ✓ src/components/__tests__/ChatInput.test.tsx (9)
218
+ ✓ ChatInput (9)
219
+ ✓ renders with default placeholder
220
+ ✓ renders with custom placeholder
221
+ ✓ calls onSend with message when form submitted
222
+ ✓ clears input after sending message
223
+ ✓ does not call onSend for empty message
224
+ ✓ trims whitespace before sending
225
+ ✓ disables input and button when disabled prop is true
226
+ ✓ disables button when input is empty
227
+ ✓ enables button when input has content
228
+
229
+ Test Files 1 passed (1)
230
+ Tests 9 passed (9)
231
+ Start at 14:23:45
232
+ Duration 234ms
233
+ ```
234
+
235
+
236
+ ---
237
+
238
+ ## Demo 3: Complete Playwright Test Agents Workflow (5 minutes)
239
+
240
+ ### Scenario
241
+ Testing a chat application with login, message sending, and history features.
242
+
243
+ ### Step 1: Initialize Playwright Test Agents (30 seconds)
244
+
245
+ ```bash
246
+ # In your project root
247
+ npx playwright test --init-agents
248
+ ```
249
+
250
+ **What happens:**
251
+ - Creates `.github/workflows/agents.yml` with agent definitions
252
+ - Sets up `specs/` directory for test plans
253
+ - Sets up `tests/` directory for generated tests
254
+ - Creates initial `seed.spec.ts`
255
+
256
+ ### Step 2: Planner Agent - Autonomous Exploration (2 minutes)
257
+
258
+ ```bash
259
+ npx playwright test --agent=planner
260
+ ```
261
+
262
+ **Planner Agent Actions:**
263
+ 1. Opens your application
264
+ 2. Explores UI autonomously (clicks buttons, fills forms, navigates)
265
+ 3. Discovers features and user workflows
266
+ 4. Generates test plans in Markdown
267
+
268
+ **Generated Test Plan** (`specs/chat-feature.md`):
269
+ ```markdown
270
+ # Chat Feature Test Plan
271
+
272
+ ## Test: User Login
273
+ 1. Navigate to login page
274
+ 2. Enter valid credentials (username: testuser, password: test123)
275
+ 3. Click login button
276
+ 4. Verify redirect to chat page
277
+ 5. Verify user avatar appears in header
278
+
279
+ ## Test: Send Message
280
+ 1. Ensure user is logged in
281
+ 2. Locate message input field
282
+ 3. Type "Hello, this is a test message"
283
+ 4. Click send button
284
+ 5. Verify message appears in chat history
285
+ 6. Verify message timestamp is shown
286
+ 7. Verify input field is cleared
287
+
288
+ ## Test: Load Message History
289
+ 1. Navigate to chat page
290
+ 2. Verify previous messages load automatically
291
+ 3. Scroll to top of chat
292
+ 4. Verify lazy loading of older messages
293
+ 5. Verify messages are ordered by timestamp
294
+ ```
295
+
296
+ ### Step 3: Generator Agent - Code Generation (1 minute)
297
+
298
+ ```bash
299
+ npx playwright test --agent=generator
300
+ ```
301
+
302
+ **Generator Agent Actions:**
303
+ 1. Reads all test plans from `specs/`
304
+ 2. Generates executable Playwright tests
305
+ 3. Saves to `tests/` directory
306
+
307
+ **Generated Test** (`tests/chat-feature.spec.ts`):
308
+ ```typescript
309
+ import { test, expect } from '@playwright/test';
310
+
311
+ test.describe('Chat Feature', () => {
312
+ test('User Login', async ({ page }) => {
313
+ // Navigate to login page
314
+ await page.goto('http://localhost:3000/login');
315
+
316
+ // Enter valid credentials
317
+ await page.getByLabel('用户名').fill('testuser');
318
+ await page.getByLabel('密码').fill('test123');
319
+
320
+ // Click login button
321
+ await page.getByRole('button', { name: '登录' }).click();
322
+
323
+ // Verify redirect to chat page
324
+ await expect(page).toHaveURL(/.*\/chat/);
325
+
326
+ // Verify user avatar appears
327
+ await expect(page.getByAltText('用户头像')).toBeVisible();
328
+ });
329
+
330
+ test('Send Message', async ({ page }) => {
331
+ // Setup: Login first
332
+ await page.goto('http://localhost:3000/login');
333
+ await page.getByLabel('用户名').fill('testuser');
334
+ await page.getByLabel('密码').fill('test123');
335
+ await page.getByRole('button', { name: '登录' }).click();
336
+ await page.waitForURL(/.*\/chat/);
337
+
338
+ // Locate message input
339
+ const input = page.getByRole('textbox', { name: '输入消息' });
340
+
341
+ // Type message
342
+ await input.fill('Hello, this is a test message');
343
+
344
+ // Send message
345
+ await page.getByRole('button', { name: '发送' }).click();
346
+
347
+ // Verify message appears
348
+ await expect(page.getByText('Hello, this is a test message')).toBeVisible();
349
+
350
+ // Verify timestamp shown
351
+ await expect(page.locator('.message-timestamp').first()).toBeVisible();
352
+
353
+ // Verify input cleared
354
+ await expect(input).toHaveValue('');
355
+ });
356
+
357
+ test('Load Message History', async ({ page }) => {
358
+ // Navigate to chat
359
+ await page.goto('http://localhost:3000/login');
360
+ await page.getByLabel('用户名').fill('testuser');
361
+ await page.getByLabel('密码').fill('test123');
362
+ await page.getByRole('button', { name: '登录' }).click();
363
+
364
+ // Verify messages load
365
+ await expect(page.locator('.message-item')).toHaveCount(10, { timeout: 3000 });
366
+
367
+ // Scroll to top
368
+ await page.locator('.chat-container').evaluate(el => el.scrollTop = 0);
369
+
370
+ // Verify lazy loading
371
+ await expect(page.locator('.message-item')).toHaveCount(20, { timeout: 2000 });
372
+
373
+ // Verify order by timestamp
374
+ const timestamps = await page.locator('.message-timestamp').allTextContents();
375
+ const sorted = [...timestamps].sort();
376
+ expect(timestamps).toEqual(sorted);
377
+ });
378
+ });
379
+ ```
380
+
381
+
382
+ ### Step 4: Healer Agent - Automatic Test Maintenance (Ongoing)
383
+
384
+ ```bash
385
+ npx playwright test --agent=healer --repeat
386
+ ```
387
+
388
+ **Healer Agent Actions:**
389
+ 1. Monitors test execution continuously
390
+ 2. Detects test failures
391
+ 3. Analyzes failure causes (UI changes, selector updates needed)
392
+ 4. Automatically updates test code
393
+ 5. Re-runs tests until passing
394
+ 6. Commits fixes to git
395
+
396
+ **Example Healing Scenario:**
397
+
398
+ **Before UI Change:**
399
+ ```typescript
400
+ await page.getByRole('button', { name: '发送' }).click();
401
+ ```
402
+
403
+ **UI Changes:** Button text changed from "发送" to "发送消息"
404
+
405
+ **Test Fails:**
406
+ ```
407
+ Error: locator.click: Timeout 30000ms exceeded.
408
+ =========================== logs ===========================
409
+ waiting for getByRole('button', { name: '发送' })
410
+ ============================================================
411
+ ```
412
+
413
+ **Healer Agent Fixes Automatically:**
414
+ ```typescript
415
+ // Healer detects the button now says "发送消息"
416
+ await page.getByRole('button', { name: '发送消息' }).click();
417
+ ```
418
+
419
+ **Test Passes Again:**
420
+ ```
421
+ ✓ Send Message (2.3s)
422
+ Healed: Updated button selector from '发送' to '发送消息'
423
+ ```
424
+
425
+ ---
426
+
427
+ ## Practical Application Strategy
428
+
429
+ ### For Your Helo Editor Project
430
+
431
+ **Week 1: Start with Unit Tests (70%)**
432
+ ```bash
433
+ # Test utility functions
434
+ - formatMessage
435
+ - validateInput
436
+ - parseMarkdown
437
+ - calculateWordCount
438
+ ```
439
+
440
+ **Week 2: Add Component Tests (20%)**
441
+ ```bash
442
+ # Test React components
443
+ - ChatInput
444
+ - MessageList
445
+ - Toolbar
446
+ - EditorPanel
447
+ ```
448
+
449
+ **Week 3: Set up Playwright Test Agents (10%)**
450
+ ```bash
451
+ # E2E critical workflows
452
+ - User login and authentication
453
+ - Create and save document
454
+ - AI chat interaction
455
+ - Document collaboration
456
+ ```
457
+
458
+ ### Expected ROI Timeline
459
+ - **Week 1**: -30% speed (learning curve)
460
+ - **Week 2**: -10% speed (getting comfortable)
461
+ - **Week 3**: +10% speed (catching bugs early)
462
+ - **Week 4+**: +20-40% speed (confidence + refactoring safely)
463
+
464
+ ### Maintenance Strategy
465
+ - **Healer Agent**: Handles 80% of selector updates automatically
466
+ - **Generator Agent**: Regenerates tests when specs change
467
+ - **Manual Updates**: Only needed for complex business logic changes
468
+
469
+ ---
470
+
471
+ ## Quick Reference Commands
472
+
473
+ ```bash
474
+ # Generate unit test
475
+ "生成测试 for [function name]"
476
+
477
+ # Generate component test
478
+ "如何测试 [component name]"
479
+
480
+ # Initialize Playwright Test Agents
481
+ npx playwright test --init-agents
482
+
483
+ # Run agent loop (all three agents)
484
+ npx playwright test --agent=planner
485
+ npx playwright test --agent=generator
486
+ npx playwright test --agent=healer --repeat
487
+
488
+ # Run tests
489
+ npm run test # Unit + component tests
490
+ npm run test:e2e # E2E tests
491
+ ```
492
+
493
+ ---
494
+
495
+ ## Success Metrics
496
+
497
+ After implementing this TDD approach, you should see:
498
+
499
+ ✅ **Code Quality**
500
+ - Bug detection rate: +60%
501
+ - Production bugs: -40%
502
+ - Code coverage: >80%
503
+
504
+ ✅ **Development Speed**
505
+ - Refactoring confidence: +90%
506
+ - Debugging time: -50%
507
+ - Feature delivery: +30% (after week 3)
508
+
509
+ ✅ **Maintenance**
510
+ - Test maintenance time: -80% (thanks to Healer Agent)
511
+ - Breaking changes detected: +95%
512
+ - Regression bugs: -70%
513
+
514
+ ---
515
+
516
+ **Ready to start?** Just say: **"生成测试"** 🚀
@@ -0,0 +1,89 @@
1
+ # TDD Test Generator - Quick Start Guide
2
+
3
+ ## Quick Start
4
+
5
+ Just say any trigger word:
6
+ - "生成测试" / "Generate test"
7
+ - "如何测试" / "How to test"
8
+ - "TDD"
9
+ - "Playwright Test Agents"
10
+
11
+ Claude will automatically load this skill!
12
+
13
+ ## Three Usage Scenarios
14
+
15
+ ### Scenario 1: Unit Test Generation (Easiest)
16
+ Input: Paste your function code
17
+ Output: Complete Vitest test suite
18
+ Time: < 30 seconds
19
+
20
+ ### Scenario 2: Component Test Generation
21
+ Input: Paste React component
22
+ Output: React Testing Library tests with user interactions
23
+ Time: < 1 minute
24
+
25
+ ### Scenario 3: E2E Tests + Playwright Test Agents (Most Powerful)
26
+
27
+ Three AI Agents working for you:
28
+ 1. Planner Agent - Explores app, generates test plans
29
+ 2. Generator Agent - Creates Playwright tests from plans
30
+ 3. Healer Agent - Auto-fixes broken tests
31
+
32
+ Setup commands:
33
+ ```bash
34
+ npx playwright test --init-agents
35
+ npx playwright test --agent=planner
36
+ npx playwright test --agent=generator
37
+ npx playwright test --agent=healer --repeat
38
+ ```
39
+
40
+ ## Example: Quick Unit Test
41
+
42
+ **You say**: "Generate test for this function"
43
+
44
+ **Claude generates**:
45
+ ```typescript
46
+ import { describe, it, expect } from 'vitest';
47
+
48
+ describe('formatMessage', () => {
49
+ it('should trim whitespace', () => {
50
+ expect(formatMessage(' hello ')).toBe('hello');
51
+ });
52
+
53
+ it('should replace multiple spaces', () => {
54
+ expect(formatMessage('hello world')).toBe('hello world');
55
+ });
56
+ });
57
+ ```
58
+
59
+ Run: `pnpm test formatMessage.test.ts`
60
+
61
+ ## TDD Workflow Support
62
+
63
+ ### Red-Green-Refactor Cycle
64
+
65
+ 🔴 **Red**: Write failing test (Claude generates)
66
+ 🟢 **Green**: Implement minimal code to pass
67
+ 🔵 **Refactor**: Optimize safely with test protection
68
+
69
+ ## Key Features
70
+
71
+ - ✅ Smart test generation from code analysis
72
+ - ✅ TDD workflow guidance
73
+ - ✅ Playwright Test Agents integration
74
+ - ✅ Auto-healing broken tests
75
+ - ✅ Best practices enforcement
76
+
77
+ ## Ready to Start?
78
+
79
+ Just say:
80
+ ```
81
+ "Generate test for my formatMessage function"
82
+ ```
83
+
84
+ Or:
85
+ ```
86
+ "Use Playwright Test Agents for E2E testing"
87
+ ```
88
+
89
+ Claude will do the rest! 🚀