bmalph 1.0.0 → 2.2.1

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 (455) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +398 -217
  3. package/bmad/bmm/agents/analyst.agent.yaml +43 -36
  4. package/bmad/bmm/agents/architect.agent.yaml +29 -28
  5. package/bmad/bmm/agents/dev.agent.yaml +38 -38
  6. package/bmad/bmm/agents/pm.agent.yaml +44 -46
  7. package/bmad/bmm/agents/qa.agent.yaml +58 -0
  8. package/bmad/bmm/agents/quick-flow-solo-dev.agent.yaml +32 -32
  9. package/bmad/bmm/agents/sm.agent.yaml +37 -36
  10. package/bmad/bmm/agents/tech-writer/tech-writer-sidecar/documentation-standards.md +223 -223
  11. package/bmad/bmm/agents/tech-writer/tech-writer.agent.yaml +46 -45
  12. package/bmad/bmm/agents/ux-designer.agent.yaml +27 -26
  13. package/bmad/bmm/data/project-context-template.md +26 -26
  14. package/bmad/bmm/module-help.csv +31 -31
  15. package/bmad/bmm/module.yaml +50 -44
  16. package/bmad/bmm/teams/default-party.csv +20 -21
  17. package/bmad/bmm/teams/team-fullstack.yaml +12 -12
  18. package/bmad/bmm/workflows/1-analysis/create-product-brief/product-brief.template.md +10 -10
  19. package/bmad/bmm/workflows/1-analysis/create-product-brief/steps/step-01-init.md +177 -177
  20. package/bmad/bmm/workflows/1-analysis/create-product-brief/steps/step-01b-continue.md +161 -161
  21. package/bmad/bmm/workflows/1-analysis/create-product-brief/steps/step-02-vision.md +199 -199
  22. package/bmad/bmm/workflows/1-analysis/create-product-brief/steps/step-03-users.md +202 -202
  23. package/bmad/bmm/workflows/1-analysis/create-product-brief/steps/step-04-metrics.md +205 -205
  24. package/bmad/bmm/workflows/1-analysis/create-product-brief/steps/step-05-scope.md +219 -219
  25. package/bmad/bmm/workflows/1-analysis/create-product-brief/steps/step-06-complete.md +162 -162
  26. package/bmad/bmm/workflows/1-analysis/create-product-brief/workflow.md +57 -58
  27. package/bmad/bmm/workflows/1-analysis/research/domain-steps/step-01-init.md +137 -137
  28. package/bmad/bmm/workflows/1-analysis/research/domain-steps/step-02-domain-analysis.md +229 -229
  29. package/bmad/bmm/workflows/1-analysis/research/domain-steps/step-03-competitive-landscape.md +238 -238
  30. package/bmad/bmm/workflows/1-analysis/research/domain-steps/step-04-regulatory-focus.md +206 -206
  31. package/bmad/bmm/workflows/1-analysis/research/domain-steps/step-05-technical-trends.md +234 -234
  32. package/bmad/bmm/workflows/1-analysis/research/domain-steps/step-06-research-synthesis.md +443 -443
  33. package/bmad/bmm/workflows/1-analysis/research/market-steps/step-01-init.md +182 -182
  34. package/bmad/bmm/workflows/1-analysis/research/market-steps/step-02-customer-behavior.md +237 -237
  35. package/bmad/bmm/workflows/1-analysis/research/market-steps/step-03-customer-pain-points.md +249 -249
  36. package/bmad/bmm/workflows/1-analysis/research/market-steps/step-04-customer-decisions.md +259 -259
  37. package/bmad/bmm/workflows/1-analysis/research/market-steps/step-05-competitive-analysis.md +177 -177
  38. package/bmad/bmm/workflows/1-analysis/research/market-steps/step-06-research-completion.md +475 -475
  39. package/bmad/bmm/workflows/1-analysis/research/research.template.md +29 -29
  40. package/bmad/bmm/workflows/1-analysis/research/technical-steps/step-01-init.md +137 -137
  41. package/bmad/bmm/workflows/1-analysis/research/technical-steps/step-02-technical-overview.md +239 -239
  42. package/bmad/bmm/workflows/1-analysis/research/technical-steps/step-03-integration-patterns.md +248 -248
  43. package/bmad/bmm/workflows/1-analysis/research/technical-steps/step-04-architectural-patterns.md +202 -202
  44. package/bmad/bmm/workflows/1-analysis/research/technical-steps/step-05-implementation-research.md +233 -239
  45. package/bmad/bmm/workflows/1-analysis/research/technical-steps/step-06-research-synthesis.md +486 -486
  46. package/bmad/bmm/workflows/1-analysis/research/workflow-domain-research.md +54 -0
  47. package/bmad/bmm/workflows/1-analysis/research/workflow-market-research.md +54 -0
  48. package/bmad/bmm/workflows/1-analysis/research/workflow-technical-research.md +54 -0
  49. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/data/domain-complexity.csv +14 -12
  50. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/data/prd-purpose.md +197 -197
  51. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/data/project-types.csv +10 -10
  52. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-01-init.md +191 -191
  53. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-01b-continue.md +153 -153
  54. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-02-discovery.md +224 -224
  55. package/bmad/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-02b-vision.md +154 -0
  56. package/bmad/bmm/workflows/2-plan-workflows/create-prd/steps-c/step-02c-executive-summary.md +170 -0
  57. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-03-success.md +226 -226
  58. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-04-journeys.md +213 -213
  59. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-05-domain.md +207 -207
  60. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-06-innovation.md +226 -226
  61. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-07-project-type.md +237 -237
  62. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-08-scoping.md +228 -228
  63. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-09-functional.md +231 -231
  64. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-10-nonfunctional.md +242 -242
  65. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-11-polish.md +217 -217
  66. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-c/step-12-complete.md +124 -124
  67. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-e/step-e-01-discovery.md +247 -247
  68. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-e/step-e-01b-legacy-conversion.md +208 -208
  69. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-e/step-e-02-review.md +249 -249
  70. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-e/step-e-03-edit.md +253 -253
  71. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-e/step-e-04-complete.md +168 -168
  72. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-01-discovery.md +226 -218
  73. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-02-format-detection.md +191 -191
  74. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-02b-parity-check.md +209 -209
  75. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-03-density-validation.md +174 -174
  76. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-04-brief-coverage-validation.md +214 -214
  77. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-05-measurability-validation.md +228 -228
  78. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-06-traceability-validation.md +217 -217
  79. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-07-implementation-leakage-validation.md +205 -205
  80. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-08-domain-compliance-validation.md +243 -243
  81. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-09-project-type-validation.md +263 -263
  82. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-10-smart-validation.md +209 -209
  83. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-11-holistic-quality-validation.md +264 -264
  84. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-12-completeness-validation.md +242 -242
  85. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/steps-v/step-v-13-report-complete.md +231 -231
  86. package/bmad/bmm/workflows/2-plan-workflows/{prd → create-prd}/templates/prd-template.md +10 -10
  87. package/bmad/bmm/workflows/2-plan-workflows/create-prd/workflow-create-prd.md +63 -0
  88. package/bmad/bmm/workflows/2-plan-workflows/create-prd/workflow-edit-prd.md +65 -0
  89. package/bmad/bmm/workflows/2-plan-workflows/create-prd/workflow-validate-prd.md +63 -0
  90. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-01-init.md +135 -135
  91. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-01b-continue.md +127 -127
  92. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-02-discovery.md +190 -190
  93. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-03-core-experience.md +216 -216
  94. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-04-emotional-response.md +219 -219
  95. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-05-inspiration.md +234 -234
  96. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-06-design-system.md +252 -252
  97. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-07-defining-experience.md +254 -254
  98. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-08-visual-foundation.md +224 -224
  99. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-09-design-directions.md +224 -224
  100. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-10-user-journeys.md +241 -241
  101. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-11-component-strategy.md +248 -248
  102. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-12-ux-patterns.md +237 -237
  103. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-13-responsive-accessibility.md +264 -264
  104. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/steps/step-14-complete.md +171 -171
  105. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/ux-design-template.md +13 -13
  106. package/bmad/bmm/workflows/2-plan-workflows/create-ux-design/workflow.md +42 -43
  107. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-01-document-discovery.md +184 -190
  108. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-02-prd-analysis.md +172 -178
  109. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-03-epic-coverage-validation.md +173 -179
  110. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-04-ux-alignment.md +133 -139
  111. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-05-epic-quality-review.md +245 -252
  112. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/steps/step-06-final-assessment.md +129 -135
  113. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/templates/readiness-report-template.md +4 -4
  114. package/bmad/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md +54 -55
  115. package/bmad/bmm/workflows/3-solutioning/create-architecture/architecture-decision-template.md +12 -12
  116. package/bmad/bmm/workflows/3-solutioning/create-architecture/data/domain-complexity.csv +12 -10
  117. package/bmad/bmm/workflows/3-solutioning/create-architecture/data/project-types.csv +6 -6
  118. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-01-init.md +153 -153
  119. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-01b-continue.md +164 -164
  120. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-02-context.md +224 -224
  121. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-03-starter.md +331 -331
  122. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-04-decisions.md +318 -318
  123. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-05-patterns.md +359 -359
  124. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-06-structure.md +379 -379
  125. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-07-validation.md +359 -359
  126. package/bmad/bmm/workflows/3-solutioning/create-architecture/steps/step-08-complete.md +76 -76
  127. package/bmad/bmm/workflows/3-solutioning/create-architecture/workflow.md +49 -50
  128. package/bmad/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-01-validate-prerequisites.md +259 -259
  129. package/bmad/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-02-design-epics.md +233 -233
  130. package/bmad/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-03-create-stories.md +272 -272
  131. package/bmad/bmm/workflows/3-solutioning/create-epics-and-stories/steps/step-04-final-validation.md +149 -149
  132. package/bmad/bmm/workflows/3-solutioning/create-epics-and-stories/templates/epics-template.md +57 -57
  133. package/bmad/bmm/workflows/3-solutioning/create-epics-and-stories/workflow.md +58 -59
  134. package/bmad/bmm/workflows/4-implementation/code-review/checklist.md +23 -23
  135. package/bmad/bmm/workflows/4-implementation/code-review/instructions.xml +226 -226
  136. package/bmad/bmm/workflows/4-implementation/code-review/workflow.yaml +44 -51
  137. package/bmad/bmm/workflows/4-implementation/correct-course/checklist.md +288 -288
  138. package/bmad/bmm/workflows/4-implementation/correct-course/instructions.md +207 -206
  139. package/bmad/bmm/workflows/4-implementation/correct-course/workflow.yaml +54 -60
  140. package/bmad/bmm/workflows/4-implementation/create-story/checklist.md +358 -358
  141. package/bmad/bmm/workflows/4-implementation/create-story/instructions.xml +346 -345
  142. package/bmad/bmm/workflows/4-implementation/create-story/template.md +49 -49
  143. package/bmad/bmm/workflows/4-implementation/create-story/workflow.yaml +53 -61
  144. package/bmad/bmm/workflows/4-implementation/dev-story/checklist.md +80 -80
  145. package/bmad/bmm/workflows/4-implementation/dev-story/instructions.xml +410 -410
  146. package/bmad/bmm/workflows/4-implementation/dev-story/workflow.yaml +21 -27
  147. package/bmad/bmm/workflows/4-implementation/retrospective/instructions.md +1444 -1443
  148. package/bmad/bmm/workflows/4-implementation/retrospective/workflow.yaml +53 -58
  149. package/bmad/bmm/workflows/4-implementation/sprint-planning/checklist.md +33 -33
  150. package/bmad/bmm/workflows/4-implementation/sprint-planning/instructions.md +226 -225
  151. package/bmad/bmm/workflows/4-implementation/sprint-planning/sprint-status-template.yaml +55 -55
  152. package/bmad/bmm/workflows/4-implementation/sprint-planning/workflow.yaml +47 -54
  153. package/bmad/bmm/workflows/4-implementation/sprint-status/instructions.md +230 -229
  154. package/bmad/bmm/workflows/4-implementation/sprint-status/workflow.yaml +25 -36
  155. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-01-mode-detection.md +174 -156
  156. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-02-context-gathering.md +118 -120
  157. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-03-execute.md +111 -113
  158. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-04-self-check.md +111 -113
  159. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-05-adversarial-review.md +104 -106
  160. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/steps/step-06-resolve-findings.md +146 -140
  161. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md +50 -50
  162. package/bmad/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-01-understand.md +191 -189
  163. package/bmad/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-02-investigate.md +144 -144
  164. package/bmad/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-03-generate.md +127 -128
  165. package/bmad/bmm/workflows/bmad-quick-flow/quick-spec/steps/step-04-review.md +200 -191
  166. package/bmad/bmm/workflows/bmad-quick-flow/quick-spec/tech-spec-template.md +74 -74
  167. package/bmad/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md +79 -79
  168. package/bmad/bmm/workflows/document-project/checklist.md +245 -245
  169. package/bmad/bmm/workflows/document-project/documentation-requirements.csv +12 -12
  170. package/bmad/bmm/workflows/document-project/instructions.md +130 -221
  171. package/bmad/bmm/workflows/document-project/templates/deep-dive-template.md +345 -345
  172. package/bmad/bmm/workflows/document-project/templates/index-template.md +169 -169
  173. package/bmad/bmm/workflows/document-project/templates/project-overview-template.md +103 -103
  174. package/bmad/bmm/workflows/document-project/templates/project-scan-report-schema.json +160 -160
  175. package/bmad/bmm/workflows/document-project/templates/source-tree-template.md +135 -135
  176. package/bmad/bmm/workflows/document-project/workflow.yaml +22 -30
  177. package/bmad/bmm/workflows/document-project/workflows/deep-dive-instructions.md +298 -298
  178. package/bmad/bmm/workflows/document-project/workflows/deep-dive.yaml +31 -31
  179. package/bmad/bmm/workflows/document-project/workflows/full-scan-instructions.md +1106 -1106
  180. package/bmad/bmm/workflows/document-project/workflows/full-scan.yaml +31 -31
  181. package/bmad/bmm/workflows/generate-project-context/project-context-template.md +21 -0
  182. package/bmad/bmm/workflows/generate-project-context/steps/step-01-discover.md +184 -0
  183. package/bmad/bmm/workflows/generate-project-context/steps/step-02-generate.md +318 -0
  184. package/bmad/bmm/workflows/generate-project-context/steps/step-03-complete.md +278 -0
  185. package/bmad/bmm/workflows/generate-project-context/workflow.md +49 -0
  186. package/bmad/bmm/workflows/qa/automate/checklist.md +33 -0
  187. package/bmad/bmm/workflows/qa/automate/instructions.md +110 -0
  188. package/bmad/bmm/workflows/qa/automate/workflow.yaml +44 -0
  189. package/bmad/core/agents/bmad-master.agent.yaml +30 -30
  190. package/bmad/core/module-help.csv +9 -11
  191. package/bmad/core/module.yaml +25 -25
  192. package/bmad/core/tasks/editorial-review-prose.xml +102 -91
  193. package/bmad/core/tasks/editorial-review-structure.xml +209 -198
  194. package/bmad/core/tasks/help.md +85 -0
  195. package/bmad/core/tasks/index-docs.xml +64 -64
  196. package/bmad/core/tasks/review-adversarial-general.xml +48 -48
  197. package/bmad/core/tasks/shard-doc.xml +107 -108
  198. package/bmad/core/tasks/workflow.xml +234 -234
  199. package/bmad/core/workflows/advanced-elicitation/methods.csv +51 -51
  200. package/bmad/core/workflows/advanced-elicitation/workflow.xml +116 -116
  201. package/bmad/core/workflows/brainstorming/brain-methods.csv +61 -61
  202. package/bmad/core/workflows/brainstorming/steps/step-01-session-setup.md +197 -197
  203. package/bmad/core/workflows/brainstorming/steps/step-01b-continue.md +122 -122
  204. package/bmad/core/workflows/brainstorming/steps/step-02a-user-selected.md +225 -225
  205. package/bmad/core/workflows/brainstorming/steps/step-02b-ai-recommended.md +237 -237
  206. package/bmad/core/workflows/brainstorming/steps/step-02c-random-selection.md +209 -209
  207. package/bmad/core/workflows/brainstorming/steps/step-02d-progressive-flow.md +264 -264
  208. package/bmad/core/workflows/brainstorming/steps/step-03-technique-execution.md +399 -399
  209. package/bmad/core/workflows/brainstorming/steps/step-04-idea-organization.md +303 -303
  210. package/bmad/core/workflows/brainstorming/template.md +15 -15
  211. package/bmad/core/workflows/brainstorming/workflow.md +58 -58
  212. package/bmad/core/workflows/party-mode/steps/step-01-agent-loading.md +138 -138
  213. package/bmad/core/workflows/party-mode/steps/step-02-discussion-orchestration.md +187 -187
  214. package/bmad/core/workflows/party-mode/steps/step-03-graceful-exit.md +168 -157
  215. package/bmad/core/workflows/party-mode/workflow.md +194 -194
  216. package/bundled-versions.json +3 -0
  217. package/dist/cli.js +61 -6
  218. package/dist/commands/check-updates.d.ts +5 -0
  219. package/dist/commands/check-updates.js +63 -0
  220. package/dist/commands/doctor.d.ts +39 -1
  221. package/dist/commands/doctor.js +348 -79
  222. package/dist/commands/init.d.ts +2 -0
  223. package/dist/commands/init.js +41 -15
  224. package/dist/commands/status.d.ts +7 -1
  225. package/dist/commands/status.js +111 -42
  226. package/dist/commands/upgrade.d.ts +7 -1
  227. package/dist/commands/upgrade.js +43 -12
  228. package/dist/installer.d.ts +19 -2
  229. package/dist/installer.js +305 -66
  230. package/dist/transition/artifacts.d.ts +2 -0
  231. package/dist/transition/artifacts.js +46 -0
  232. package/dist/transition/context.d.ts +19 -0
  233. package/dist/transition/context.js +261 -0
  234. package/dist/transition/fix-plan.d.ts +15 -0
  235. package/dist/transition/fix-plan.js +94 -0
  236. package/dist/transition/index.d.ts +9 -0
  237. package/dist/transition/index.js +16 -0
  238. package/dist/transition/orchestration.d.ts +2 -0
  239. package/dist/transition/orchestration.js +243 -0
  240. package/dist/transition/specs-changelog.d.ts +3 -0
  241. package/dist/transition/specs-changelog.js +75 -0
  242. package/dist/transition/specs-index.d.ts +22 -0
  243. package/dist/transition/specs-index.js +157 -0
  244. package/dist/transition/story-parsing.d.ts +7 -0
  245. package/dist/transition/story-parsing.js +124 -0
  246. package/dist/transition/tech-stack.d.ts +3 -0
  247. package/dist/transition/tech-stack.js +79 -0
  248. package/dist/transition/types.d.ts +60 -0
  249. package/dist/transition/types.js +1 -0
  250. package/dist/utils/config.d.ts +4 -0
  251. package/dist/utils/config.js +14 -4
  252. package/dist/utils/constants.d.ts +70 -0
  253. package/dist/utils/constants.js +97 -0
  254. package/dist/utils/dryrun.d.ts +7 -0
  255. package/dist/utils/dryrun.js +48 -0
  256. package/dist/utils/errors.d.ts +63 -0
  257. package/dist/utils/errors.js +86 -0
  258. package/dist/utils/file-system.d.ts +24 -0
  259. package/dist/utils/file-system.js +99 -0
  260. package/dist/utils/github.d.ts +83 -0
  261. package/dist/utils/github.js +230 -0
  262. package/dist/utils/json.js +3 -3
  263. package/dist/utils/logger.d.ts +6 -0
  264. package/dist/utils/logger.js +27 -0
  265. package/dist/utils/state.d.ts +4 -7
  266. package/dist/utils/state.js +147 -26
  267. package/dist/utils/validate.d.ts +40 -0
  268. package/dist/utils/validate.js +175 -1
  269. package/package.json +75 -59
  270. package/ralph/RALPH-REFERENCE.md +412 -0
  271. package/ralph/lib/circuit_breaker.sh +463 -330
  272. package/ralph/lib/date_utils.sh +104 -53
  273. package/ralph/lib/enable_core.sh +815 -0
  274. package/ralph/lib/response_analyzer.sh +884 -768
  275. package/ralph/lib/task_sources.sh +577 -0
  276. package/ralph/lib/timeout_utils.sh +145 -145
  277. package/ralph/lib/wizard_utils.sh +547 -0
  278. package/ralph/ralph_import.sh +636 -0
  279. package/ralph/ralph_loop.sh +1793 -1391
  280. package/ralph/ralph_monitor.sh +125 -0
  281. package/ralph/templates/AGENT.md +158 -158
  282. package/ralph/templates/PROMPT.md +285 -292
  283. package/ralph/templates/fix_plan.md +27 -27
  284. package/ralph/templates/ralphrc.template +102 -0
  285. package/ralph/templates/specs/.gitkeep +1 -1
  286. package/slash-commands/advanced-elicitation.md +1 -1
  287. package/slash-commands/adversarial-review.md +1 -1
  288. package/slash-commands/analyst.md +1 -1
  289. package/slash-commands/architect.md +1 -1
  290. package/slash-commands/bmad-help.md +1 -1
  291. package/slash-commands/bmalph-implement.md +152 -152
  292. package/slash-commands/brainstorm-project.md +1 -1
  293. package/slash-commands/brainstorming.md +1 -1
  294. package/slash-commands/correct-course.md +1 -1
  295. package/slash-commands/create-architecture.md +1 -1
  296. package/slash-commands/create-brief.md +1 -1
  297. package/slash-commands/create-epics-stories.md +1 -1
  298. package/slash-commands/create-prd.md +1 -1
  299. package/slash-commands/create-story.md +1 -1
  300. package/slash-commands/create-ux.md +1 -1
  301. package/slash-commands/dev.md +1 -1
  302. package/slash-commands/document-project.md +1 -1
  303. package/slash-commands/domain-research.md +1 -1
  304. package/slash-commands/editorial-prose.md +1 -1
  305. package/slash-commands/editorial-structure.md +1 -1
  306. package/slash-commands/execute-workflow.md +1 -1
  307. package/slash-commands/generate-project-context.md +1 -0
  308. package/slash-commands/implementation-readiness.md +1 -1
  309. package/slash-commands/index-docs.md +1 -1
  310. package/slash-commands/market-research.md +1 -1
  311. package/slash-commands/party-mode.md +1 -1
  312. package/slash-commands/pm.md +1 -1
  313. package/slash-commands/qa-automate.md +1 -0
  314. package/slash-commands/qa.md +1 -0
  315. package/slash-commands/quick-dev.md +1 -1
  316. package/slash-commands/quick-flow-solo-dev.md +1 -1
  317. package/slash-commands/retrospective.md +1 -1
  318. package/slash-commands/shard-doc.md +1 -1
  319. package/slash-commands/sm.md +1 -1
  320. package/slash-commands/sprint-planning.md +1 -1
  321. package/slash-commands/sprint-status.md +1 -1
  322. package/slash-commands/tech-spec.md +1 -1
  323. package/slash-commands/tech-writer.md +1 -0
  324. package/slash-commands/technical-research.md +1 -1
  325. package/slash-commands/ux-designer.md +1 -1
  326. package/slash-commands/validate-architecture.md +1 -1
  327. package/slash-commands/validate-brief.md +1 -1
  328. package/slash-commands/validate-epics-stories.md +1 -1
  329. package/slash-commands/validate-prd.md +1 -1
  330. package/slash-commands/validate-story.md +1 -1
  331. package/slash-commands/validate-ux.md +1 -1
  332. package/bmad/bmm/agents/tea.agent.yaml +0 -63
  333. package/bmad/bmm/sub-modules/claude-code/config.yaml +0 -4
  334. package/bmad/bmm/sub-modules/claude-code/injections.yaml +0 -242
  335. package/bmad/bmm/sub-modules/claude-code/readme.md +0 -87
  336. package/bmad/bmm/testarch/knowledge/adr-quality-readiness-checklist.md +0 -350
  337. package/bmad/bmm/testarch/knowledge/api-request.md +0 -442
  338. package/bmad/bmm/testarch/knowledge/api-testing-patterns.md +0 -843
  339. package/bmad/bmm/testarch/knowledge/auth-session.md +0 -552
  340. package/bmad/bmm/testarch/knowledge/burn-in.md +0 -273
  341. package/bmad/bmm/testarch/knowledge/ci-burn-in.md +0 -675
  342. package/bmad/bmm/testarch/knowledge/component-tdd.md +0 -486
  343. package/bmad/bmm/testarch/knowledge/contract-testing.md +0 -957
  344. package/bmad/bmm/testarch/knowledge/data-factories.md +0 -500
  345. package/bmad/bmm/testarch/knowledge/email-auth.md +0 -721
  346. package/bmad/bmm/testarch/knowledge/error-handling.md +0 -725
  347. package/bmad/bmm/testarch/knowledge/feature-flags.md +0 -750
  348. package/bmad/bmm/testarch/knowledge/file-utils.md +0 -463
  349. package/bmad/bmm/testarch/knowledge/fixture-architecture.md +0 -401
  350. package/bmad/bmm/testarch/knowledge/fixtures-composition.md +0 -382
  351. package/bmad/bmm/testarch/knowledge/intercept-network-call.md +0 -430
  352. package/bmad/bmm/testarch/knowledge/log.md +0 -429
  353. package/bmad/bmm/testarch/knowledge/network-error-monitor.md +0 -405
  354. package/bmad/bmm/testarch/knowledge/network-first.md +0 -486
  355. package/bmad/bmm/testarch/knowledge/network-recorder.md +0 -527
  356. package/bmad/bmm/testarch/knowledge/nfr-criteria.md +0 -670
  357. package/bmad/bmm/testarch/knowledge/overview.md +0 -286
  358. package/bmad/bmm/testarch/knowledge/playwright-config.md +0 -730
  359. package/bmad/bmm/testarch/knowledge/probability-impact.md +0 -601
  360. package/bmad/bmm/testarch/knowledge/recurse.md +0 -421
  361. package/bmad/bmm/testarch/knowledge/risk-governance.md +0 -615
  362. package/bmad/bmm/testarch/knowledge/selective-testing.md +0 -732
  363. package/bmad/bmm/testarch/knowledge/selector-resilience.md +0 -527
  364. package/bmad/bmm/testarch/knowledge/test-healing-patterns.md +0 -644
  365. package/bmad/bmm/testarch/knowledge/test-levels-framework.md +0 -473
  366. package/bmad/bmm/testarch/knowledge/test-priorities-matrix.md +0 -373
  367. package/bmad/bmm/testarch/knowledge/test-quality.md +0 -664
  368. package/bmad/bmm/testarch/knowledge/timing-debugging.md +0 -372
  369. package/bmad/bmm/testarch/knowledge/visual-debugging.md +0 -524
  370. package/bmad/bmm/testarch/tea-index.csv +0 -35
  371. package/bmad/bmm/workflows/1-analysis/research/market-steps/step-02-customer-insights.md +0 -200
  372. package/bmad/bmm/workflows/1-analysis/research/workflow.md +0 -173
  373. package/bmad/bmm/workflows/2-plan-workflows/prd/validation-report-prd-workflow.md +0 -433
  374. package/bmad/bmm/workflows/2-plan-workflows/prd/workflow.md +0 -150
  375. package/bmad/bmm/workflows/bmad-quick-flow/quick-dev/data/project-levels.yaml +0 -59
  376. package/bmad/bmm/workflows/excalidraw-diagrams/_shared/excalidraw-library.json +0 -90
  377. package/bmad/bmm/workflows/excalidraw-diagrams/_shared/excalidraw-templates.yaml +0 -127
  378. package/bmad/bmm/workflows/excalidraw-diagrams/create-dataflow/checklist.md +0 -39
  379. package/bmad/bmm/workflows/excalidraw-diagrams/create-dataflow/instructions.md +0 -130
  380. package/bmad/bmm/workflows/excalidraw-diagrams/create-dataflow/workflow.yaml +0 -27
  381. package/bmad/bmm/workflows/excalidraw-diagrams/create-diagram/checklist.md +0 -43
  382. package/bmad/bmm/workflows/excalidraw-diagrams/create-diagram/instructions.md +0 -141
  383. package/bmad/bmm/workflows/excalidraw-diagrams/create-diagram/workflow.yaml +0 -27
  384. package/bmad/bmm/workflows/excalidraw-diagrams/create-flowchart/checklist.md +0 -49
  385. package/bmad/bmm/workflows/excalidraw-diagrams/create-flowchart/instructions.md +0 -241
  386. package/bmad/bmm/workflows/excalidraw-diagrams/create-flowchart/workflow.yaml +0 -27
  387. package/bmad/bmm/workflows/excalidraw-diagrams/create-wireframe/checklist.md +0 -38
  388. package/bmad/bmm/workflows/excalidraw-diagrams/create-wireframe/instructions.md +0 -133
  389. package/bmad/bmm/workflows/excalidraw-diagrams/create-wireframe/workflow.yaml +0 -27
  390. package/bmad/bmm/workflows/testarch/atdd/atdd-checklist-template.md +0 -363
  391. package/bmad/bmm/workflows/testarch/atdd/checklist.md +0 -374
  392. package/bmad/bmm/workflows/testarch/atdd/instructions.md +0 -806
  393. package/bmad/bmm/workflows/testarch/atdd/workflow.yaml +0 -47
  394. package/bmad/bmm/workflows/testarch/automate/checklist.md +0 -582
  395. package/bmad/bmm/workflows/testarch/automate/instructions.md +0 -1324
  396. package/bmad/bmm/workflows/testarch/automate/workflow.yaml +0 -54
  397. package/bmad/bmm/workflows/testarch/ci/checklist.md +0 -247
  398. package/bmad/bmm/workflows/testarch/ci/github-actions-template.yaml +0 -198
  399. package/bmad/bmm/workflows/testarch/ci/gitlab-ci-template.yaml +0 -149
  400. package/bmad/bmm/workflows/testarch/ci/instructions.md +0 -536
  401. package/bmad/bmm/workflows/testarch/ci/workflow.yaml +0 -47
  402. package/bmad/bmm/workflows/testarch/framework/checklist.md +0 -320
  403. package/bmad/bmm/workflows/testarch/framework/instructions.md +0 -481
  404. package/bmad/bmm/workflows/testarch/framework/workflow.yaml +0 -49
  405. package/bmad/bmm/workflows/testarch/nfr-assess/checklist.md +0 -407
  406. package/bmad/bmm/workflows/testarch/nfr-assess/instructions.md +0 -726
  407. package/bmad/bmm/workflows/testarch/nfr-assess/nfr-report-template.md +0 -461
  408. package/bmad/bmm/workflows/testarch/nfr-assess/workflow.yaml +0 -49
  409. package/bmad/bmm/workflows/testarch/test-design/checklist.md +0 -407
  410. package/bmad/bmm/workflows/testarch/test-design/instructions.md +0 -1158
  411. package/bmad/bmm/workflows/testarch/test-design/test-design-architecture-template.md +0 -213
  412. package/bmad/bmm/workflows/testarch/test-design/test-design-qa-template.md +0 -286
  413. package/bmad/bmm/workflows/testarch/test-design/test-design-template.md +0 -294
  414. package/bmad/bmm/workflows/testarch/test-design/workflow.yaml +0 -71
  415. package/bmad/bmm/workflows/testarch/test-review/checklist.md +0 -472
  416. package/bmad/bmm/workflows/testarch/test-review/instructions.md +0 -628
  417. package/bmad/bmm/workflows/testarch/test-review/test-review-template.md +0 -390
  418. package/bmad/bmm/workflows/testarch/test-review/workflow.yaml +0 -48
  419. package/bmad/bmm/workflows/testarch/trace/checklist.md +0 -642
  420. package/bmad/bmm/workflows/testarch/trace/instructions.md +0 -1030
  421. package/bmad/bmm/workflows/testarch/trace/trace-template.md +0 -675
  422. package/bmad/bmm/workflows/testarch/trace/workflow.yaml +0 -57
  423. package/bmad/core/resources/excalidraw/README.md +0 -160
  424. package/bmad/core/resources/excalidraw/excalidraw-helpers.md +0 -127
  425. package/bmad/core/resources/excalidraw/library-loader.md +0 -50
  426. package/bmad/core/resources/excalidraw/validate-json-instructions.md +0 -79
  427. package/bmad/core/tasks/bmad-help.md +0 -62
  428. package/dist/commands/guide.d.ts +0 -1
  429. package/dist/commands/guide.js +0 -19
  430. package/dist/commands/implement.d.ts +0 -1
  431. package/dist/commands/implement.js +0 -83
  432. package/dist/commands/plan.d.ts +0 -5
  433. package/dist/commands/plan.js +0 -44
  434. package/dist/commands/reset.d.ts +0 -5
  435. package/dist/commands/reset.js +0 -35
  436. package/dist/commands/resume.d.ts +0 -1
  437. package/dist/commands/resume.js +0 -44
  438. package/dist/commands/start.d.ts +0 -5
  439. package/dist/commands/start.js +0 -54
  440. package/dist/transition.d.ts +0 -52
  441. package/dist/transition.js +0 -656
  442. package/slash-commands/atdd.md +0 -1
  443. package/slash-commands/continuous-integration.md +0 -1
  444. package/slash-commands/create-dataflow.md +0 -1
  445. package/slash-commands/create-diagram.md +0 -1
  446. package/slash-commands/create-flowchart.md +0 -1
  447. package/slash-commands/create-wireframe.md +0 -1
  448. package/slash-commands/nfr-assess.md +0 -1
  449. package/slash-commands/tea.md +0 -1
  450. package/slash-commands/test-automate.md +0 -1
  451. package/slash-commands/test-design.md +0 -1
  452. package/slash-commands/test-framework.md +0 -1
  453. package/slash-commands/test-review.md +0 -1
  454. package/slash-commands/test-trace.md +0 -1
  455. package/slash-commands/validate-test-design.md +0 -1
@@ -1,500 +0,0 @@
1
- # Data Factories and API-First Setup
2
-
3
- ## Principle
4
-
5
- Prefer factory functions that accept overrides and return complete objects (`createUser(overrides)`). Seed test state through APIs, tasks, or direct DB helpers before visiting the UI—never via slow UI interactions. UI is for validation only, not setup.
6
-
7
- ## Rationale
8
-
9
- Static fixtures (JSON files, hardcoded objects) create brittle tests that:
10
-
11
- - Fail when schemas evolve (missing new required fields)
12
- - Cause collisions in parallel execution (same user IDs)
13
- - Hide test intent (what matters for _this_ test?)
14
-
15
- Dynamic factories with overrides provide:
16
-
17
- - **Parallel safety**: UUIDs and timestamps prevent collisions
18
- - **Schema evolution**: Defaults adapt to schema changes automatically
19
- - **Explicit intent**: Overrides show what matters for each test
20
- - **Speed**: API setup is 10-50x faster than UI
21
-
22
- ## Pattern Examples
23
-
24
- ### Example 1: Factory Function with Overrides
25
-
26
- **Context**: When creating test data, build factory functions with sensible defaults and explicit overrides. Use `faker` for dynamic values that prevent collisions.
27
-
28
- **Implementation**:
29
-
30
- ```typescript
31
- // test-utils/factories/user-factory.ts
32
- import { faker } from '@faker-js/faker';
33
-
34
- type User = {
35
- id: string;
36
- email: string;
37
- name: string;
38
- role: 'user' | 'admin' | 'moderator';
39
- createdAt: Date;
40
- isActive: boolean;
41
- };
42
-
43
- export const createUser = (overrides: Partial<User> = {}): User => ({
44
- id: faker.string.uuid(),
45
- email: faker.internet.email(),
46
- name: faker.person.fullName(),
47
- role: 'user',
48
- createdAt: new Date(),
49
- isActive: true,
50
- ...overrides,
51
- });
52
-
53
- // test-utils/factories/product-factory.ts
54
- type Product = {
55
- id: string;
56
- name: string;
57
- price: number;
58
- stock: number;
59
- category: string;
60
- };
61
-
62
- export const createProduct = (overrides: Partial<Product> = {}): Product => ({
63
- id: faker.string.uuid(),
64
- name: faker.commerce.productName(),
65
- price: parseFloat(faker.commerce.price()),
66
- stock: faker.number.int({ min: 0, max: 100 }),
67
- category: faker.commerce.department(),
68
- ...overrides,
69
- });
70
-
71
- // Usage in tests:
72
- test('admin can delete users', async ({ page, apiRequest }) => {
73
- // Default user
74
- const user = createUser();
75
-
76
- // Admin user (explicit override shows intent)
77
- const admin = createUser({ role: 'admin' });
78
-
79
- // Seed via API (fast!)
80
- await apiRequest({ method: 'POST', url: '/api/users', data: user });
81
- await apiRequest({ method: 'POST', url: '/api/users', data: admin });
82
-
83
- // Now test UI behavior
84
- await page.goto('/admin/users');
85
- await page.click(`[data-testid="delete-user-${user.id}"]`);
86
- await expect(page.getByText(`User ${user.name} deleted`)).toBeVisible();
87
- });
88
- ```
89
-
90
- **Key Points**:
91
-
92
- - `Partial<User>` allows overriding any field without breaking type safety
93
- - Faker generates unique values—no collisions in parallel tests
94
- - Override shows test intent: `createUser({ role: 'admin' })` is explicit
95
- - Factory lives in `test-utils/factories/` for easy reuse
96
-
97
- ### Example 2: Nested Factory Pattern
98
-
99
- **Context**: When testing relationships (orders with users and products), nest factories to create complete object graphs. Control relationship data explicitly.
100
-
101
- **Implementation**:
102
-
103
- ```typescript
104
- // test-utils/factories/order-factory.ts
105
- import { createUser } from './user-factory';
106
- import { createProduct } from './product-factory';
107
-
108
- type OrderItem = {
109
- product: Product;
110
- quantity: number;
111
- price: number;
112
- };
113
-
114
- type Order = {
115
- id: string;
116
- user: User;
117
- items: OrderItem[];
118
- total: number;
119
- status: 'pending' | 'paid' | 'shipped' | 'delivered';
120
- createdAt: Date;
121
- };
122
-
123
- export const createOrderItem = (overrides: Partial<OrderItem> = {}): OrderItem => {
124
- const product = overrides.product || createProduct();
125
- const quantity = overrides.quantity || faker.number.int({ min: 1, max: 5 });
126
-
127
- return {
128
- product,
129
- quantity,
130
- price: product.price * quantity,
131
- ...overrides,
132
- };
133
- };
134
-
135
- export const createOrder = (overrides: Partial<Order> = {}): Order => {
136
- const items = overrides.items || [createOrderItem(), createOrderItem()];
137
- const total = items.reduce((sum, item) => sum + item.price, 0);
138
-
139
- return {
140
- id: faker.string.uuid(),
141
- user: overrides.user || createUser(),
142
- items,
143
- total,
144
- status: 'pending',
145
- createdAt: new Date(),
146
- ...overrides,
147
- };
148
- };
149
-
150
- // Usage in tests:
151
- test('user can view order details', async ({ page, apiRequest }) => {
152
- const user = createUser({ email: 'test@example.com' });
153
- const product1 = createProduct({ name: 'Widget A', price: 10.0 });
154
- const product2 = createProduct({ name: 'Widget B', price: 15.0 });
155
-
156
- // Explicit relationships
157
- const order = createOrder({
158
- user,
159
- items: [
160
- createOrderItem({ product: product1, quantity: 2 }), // $20
161
- createOrderItem({ product: product2, quantity: 1 }), // $15
162
- ],
163
- });
164
-
165
- // Seed via API
166
- await apiRequest({ method: 'POST', url: '/api/users', data: user });
167
- await apiRequest({ method: 'POST', url: '/api/products', data: product1 });
168
- await apiRequest({ method: 'POST', url: '/api/products', data: product2 });
169
- await apiRequest({ method: 'POST', url: '/api/orders', data: order });
170
-
171
- // Test UI
172
- await page.goto(`/orders/${order.id}`);
173
- await expect(page.getByText('Widget A x 2')).toBeVisible();
174
- await expect(page.getByText('Widget B x 1')).toBeVisible();
175
- await expect(page.getByText('Total: $35.00')).toBeVisible();
176
- });
177
- ```
178
-
179
- **Key Points**:
180
-
181
- - Nested factories handle relationships (order → user, order → products)
182
- - Overrides cascade: provide custom user/products or use defaults
183
- - Calculated fields (total) derived automatically from nested data
184
- - Explicit relationships make test data clear and maintainable
185
-
186
- ### Example 3: Factory with API Seeding
187
-
188
- **Context**: When tests need data setup, always use API calls or database tasks—never UI navigation. Wrap factory usage with seeding utilities for clean test setup.
189
-
190
- **Implementation**:
191
-
192
- ```typescript
193
- // playwright/support/helpers/seed-helpers.ts
194
- import { APIRequestContext } from '@playwright/test';
195
- import { User, createUser } from '../../test-utils/factories/user-factory';
196
- import { Product, createProduct } from '../../test-utils/factories/product-factory';
197
-
198
- export async function seedUser(request: APIRequestContext, overrides: Partial<User> = {}): Promise<User> {
199
- const user = createUser(overrides);
200
-
201
- const response = await request.post('/api/users', {
202
- data: user,
203
- });
204
-
205
- if (!response.ok()) {
206
- throw new Error(`Failed to seed user: ${response.status()}`);
207
- }
208
-
209
- return user;
210
- }
211
-
212
- export async function seedProduct(request: APIRequestContext, overrides: Partial<Product> = {}): Promise<Product> {
213
- const product = createProduct(overrides);
214
-
215
- const response = await request.post('/api/products', {
216
- data: product,
217
- });
218
-
219
- if (!response.ok()) {
220
- throw new Error(`Failed to seed product: ${response.status()}`);
221
- }
222
-
223
- return product;
224
- }
225
-
226
- // Playwright globalSetup for shared data
227
- // playwright/support/global-setup.ts
228
- import { chromium, FullConfig } from '@playwright/test';
229
- import { seedUser } from './helpers/seed-helpers';
230
-
231
- async function globalSetup(config: FullConfig) {
232
- const browser = await chromium.launch();
233
- const page = await browser.newPage();
234
- const context = page.context();
235
-
236
- // Seed admin user for all tests
237
- const admin = await seedUser(context.request, {
238
- email: 'admin@example.com',
239
- role: 'admin',
240
- });
241
-
242
- // Save auth state for reuse
243
- await context.storageState({ path: 'playwright/.auth/admin.json' });
244
-
245
- await browser.close();
246
- }
247
-
248
- export default globalSetup;
249
-
250
- // Cypress equivalent with cy.task
251
- // cypress/support/tasks.ts
252
- export const seedDatabase = async (entity: string, data: unknown) => {
253
- // Direct database insert or API call
254
- if (entity === 'users') {
255
- await db.users.create(data);
256
- }
257
- return null;
258
- };
259
-
260
- // Usage in Cypress tests:
261
- beforeEach(() => {
262
- const user = createUser({ email: 'test@example.com' });
263
- cy.task('db:seed', { entity: 'users', data: user });
264
- });
265
- ```
266
-
267
- **Key Points**:
268
-
269
- - API seeding is 10-50x faster than UI-based setup
270
- - `globalSetup` seeds shared data once (e.g., admin user)
271
- - Per-test seeding uses `seedUser()` helpers for isolation
272
- - Cypress `cy.task` allows direct database access for speed
273
-
274
- ### Example 4: Anti-Pattern - Hardcoded Test Data
275
-
276
- **Problem**:
277
-
278
- ```typescript
279
- // ❌ BAD: Hardcoded test data
280
- test('user can login', async ({ page }) => {
281
- await page.goto('/login');
282
- await page.fill('[data-testid="email"]', 'test@test.com'); // Hardcoded
283
- await page.fill('[data-testid="password"]', 'password123'); // Hardcoded
284
- await page.click('[data-testid="submit"]');
285
-
286
- // What if this user already exists? Test fails in parallel runs.
287
- // What if schema adds required fields? Test breaks.
288
- });
289
-
290
- // ❌ BAD: Static JSON fixtures
291
- // fixtures/users.json
292
- {
293
- "users": [
294
- { "id": 1, "email": "user1@test.com", "name": "User 1" },
295
- { "id": 2, "email": "user2@test.com", "name": "User 2" }
296
- ]
297
- }
298
-
299
- test('admin can delete user', async ({ page }) => {
300
- const users = require('../fixtures/users.json');
301
- // Brittle: IDs collide in parallel, schema drift breaks tests
302
- });
303
- ```
304
-
305
- **Why It Fails**:
306
-
307
- - **Parallel collisions**: Hardcoded IDs (`id: 1`, `email: 'test@test.com'`) cause failures when tests run concurrently
308
- - **Schema drift**: Adding required fields (`phoneNumber`, `address`) breaks all tests using fixtures
309
- - **Hidden intent**: Does this test need `email: 'test@test.com'` specifically, or any email?
310
- - **Slow setup**: UI-based data creation is 10-50x slower than API
311
-
312
- **Better Approach**: Use factories
313
-
314
- ```typescript
315
- // ✅ GOOD: Factory-based data
316
- test('user can login', async ({ page, apiRequest }) => {
317
- const user = createUser({ email: 'unique@example.com', password: 'secure123' });
318
-
319
- // Seed via API (fast, parallel-safe)
320
- await apiRequest({ method: 'POST', url: '/api/users', data: user });
321
-
322
- // Test UI
323
- await page.goto('/login');
324
- await page.fill('[data-testid="email"]', user.email);
325
- await page.fill('[data-testid="password"]', user.password);
326
- await page.click('[data-testid="submit"]');
327
-
328
- await expect(page).toHaveURL('/dashboard');
329
- });
330
-
331
- // ✅ GOOD: Factories adapt to schema changes automatically
332
- // When `phoneNumber` becomes required, update factory once:
333
- export const createUser = (overrides: Partial<User> = {}): User => ({
334
- id: faker.string.uuid(),
335
- email: faker.internet.email(),
336
- name: faker.person.fullName(),
337
- phoneNumber: faker.phone.number(), // NEW field, all tests get it automatically
338
- role: 'user',
339
- ...overrides,
340
- });
341
- ```
342
-
343
- **Key Points**:
344
-
345
- - Factories generate unique, parallel-safe data
346
- - Schema evolution handled in one place (factory), not every test
347
- - Test intent explicit via overrides
348
- - API seeding is fast and reliable
349
-
350
- ### Example 5: Factory Composition
351
-
352
- **Context**: When building specialized factories, compose simpler factories instead of duplicating logic. Layer overrides for specific test scenarios.
353
-
354
- **Implementation**:
355
-
356
- ```typescript
357
- // test-utils/factories/user-factory.ts (base)
358
- export const createUser = (overrides: Partial<User> = {}): User => ({
359
- id: faker.string.uuid(),
360
- email: faker.internet.email(),
361
- name: faker.person.fullName(),
362
- role: 'user',
363
- createdAt: new Date(),
364
- isActive: true,
365
- ...overrides,
366
- });
367
-
368
- // Compose specialized factories
369
- export const createAdminUser = (overrides: Partial<User> = {}): User => createUser({ role: 'admin', ...overrides });
370
-
371
- export const createModeratorUser = (overrides: Partial<User> = {}): User => createUser({ role: 'moderator', ...overrides });
372
-
373
- export const createInactiveUser = (overrides: Partial<User> = {}): User => createUser({ isActive: false, ...overrides });
374
-
375
- // Account-level factories with feature flags
376
- type Account = {
377
- id: string;
378
- owner: User;
379
- plan: 'free' | 'pro' | 'enterprise';
380
- features: string[];
381
- maxUsers: number;
382
- };
383
-
384
- export const createAccount = (overrides: Partial<Account> = {}): Account => ({
385
- id: faker.string.uuid(),
386
- owner: overrides.owner || createUser(),
387
- plan: 'free',
388
- features: [],
389
- maxUsers: 1,
390
- ...overrides,
391
- });
392
-
393
- export const createProAccount = (overrides: Partial<Account> = {}): Account =>
394
- createAccount({
395
- plan: 'pro',
396
- features: ['advanced-analytics', 'priority-support'],
397
- maxUsers: 10,
398
- ...overrides,
399
- });
400
-
401
- export const createEnterpriseAccount = (overrides: Partial<Account> = {}): Account =>
402
- createAccount({
403
- plan: 'enterprise',
404
- features: ['advanced-analytics', 'priority-support', 'sso', 'audit-logs'],
405
- maxUsers: 100,
406
- ...overrides,
407
- });
408
-
409
- // Usage in tests:
410
- test('pro accounts can access analytics', async ({ page, apiRequest }) => {
411
- const admin = createAdminUser({ email: 'admin@company.com' });
412
- const account = createProAccount({ owner: admin });
413
-
414
- await apiRequest({ method: 'POST', url: '/api/users', data: admin });
415
- await apiRequest({ method: 'POST', url: '/api/accounts', data: account });
416
-
417
- await page.goto('/analytics');
418
- await expect(page.getByText('Advanced Analytics')).toBeVisible();
419
- });
420
-
421
- test('free accounts cannot access analytics', async ({ page, apiRequest }) => {
422
- const user = createUser({ email: 'user@company.com' });
423
- const account = createAccount({ owner: user }); // Defaults to free plan
424
-
425
- await apiRequest({ method: 'POST', url: '/api/users', data: user });
426
- await apiRequest({ method: 'POST', url: '/api/accounts', data: account });
427
-
428
- await page.goto('/analytics');
429
- await expect(page.getByText('Upgrade to Pro')).toBeVisible();
430
- });
431
- ```
432
-
433
- **Key Points**:
434
-
435
- - Compose specialized factories from base factories (`createAdminUser` → `createUser`)
436
- - Defaults cascade: `createProAccount` sets plan + features automatically
437
- - Still allow overrides: `createProAccount({ maxUsers: 50 })` works
438
- - Test intent clear: `createProAccount()` vs `createAccount({ plan: 'pro', features: [...] })`
439
-
440
- ## Integration Points
441
-
442
- - **Used in workflows**: `*atdd` (test generation), `*automate` (test expansion), `*framework` (factory setup)
443
- - **Related fragments**:
444
- - `fixture-architecture.md` - Pure functions and fixtures for factory integration
445
- - `network-first.md` - API-first setup patterns
446
- - `test-quality.md` - Parallel-safe, deterministic test design
447
-
448
- ## Cleanup Strategy
449
-
450
- Ensure factories work with cleanup patterns:
451
-
452
- ```typescript
453
- // Track created IDs for cleanup
454
- const createdUsers: string[] = [];
455
-
456
- afterEach(async ({ apiRequest }) => {
457
- // Clean up all users created during test
458
- for (const userId of createdUsers) {
459
- await apiRequest({ method: 'DELETE', url: `/api/users/${userId}` });
460
- }
461
- createdUsers.length = 0;
462
- });
463
-
464
- test('user registration flow', async ({ page, apiRequest }) => {
465
- const user = createUser();
466
- createdUsers.push(user.id);
467
-
468
- await apiRequest({ method: 'POST', url: '/api/users', data: user });
469
- // ... test logic
470
- });
471
- ```
472
-
473
- ## Feature Flag Integration
474
-
475
- When working with feature flags, layer them into factories:
476
-
477
- ```typescript
478
- export const createUserWithFlags = (
479
- overrides: Partial<User> = {},
480
- flags: Record<string, boolean> = {},
481
- ): User & { flags: Record<string, boolean> } => ({
482
- ...createUser(overrides),
483
- flags: {
484
- 'new-dashboard': false,
485
- 'beta-features': false,
486
- ...flags,
487
- },
488
- });
489
-
490
- // Usage:
491
- const user = createUserWithFlags(
492
- { email: 'test@example.com' },
493
- {
494
- 'new-dashboard': true,
495
- 'beta-features': true,
496
- },
497
- );
498
- ```
499
-
500
- _Source: Murat Testing Philosophy (lines 94-120), API-first testing patterns, faker.js documentation._