@autobe/agent 0.25.7 → 0.26.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 (257) hide show
  1. package/lib/AutoBeAgent.js +3 -0
  2. package/lib/AutoBeAgent.js.map +1 -1
  3. package/lib/AutoBeMockAgent.js +15 -12
  4. package/lib/AutoBeMockAgent.js.map +1 -1
  5. package/lib/constants/AutoBeSystemPromptConstant.d.ts +26 -19
  6. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  7. package/lib/factory/consentFunctionCall.js +3 -0
  8. package/lib/factory/consentFunctionCall.js.map +1 -1
  9. package/lib/factory/createAutoBeContext.js +4 -1
  10. package/lib/factory/createAutoBeContext.js.map +1 -1
  11. package/lib/factory/getCommonPrompt.d.ts +2 -0
  12. package/lib/factory/getCommonPrompt.js +20 -0
  13. package/lib/factory/getCommonPrompt.js.map +1 -0
  14. package/lib/index.mjs +2636 -2258
  15. package/lib/index.mjs.map +1 -1
  16. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  17. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  18. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  19. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  20. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
  21. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  22. package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -1
  23. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  24. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +73 -73
  25. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  26. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
  27. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
  28. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
  29. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
  30. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  31. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
  32. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
  33. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
  34. package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
  35. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
  36. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
  37. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
  38. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  39. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  40. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  41. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  42. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  43. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
  44. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  45. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  46. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  47. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  48. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  49. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  50. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  51. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
  52. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
  53. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  54. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
  55. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
  56. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
  57. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
  58. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
  59. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
  60. package/lib/orchestrate/interface/orchestrateInterface.js +24 -4
  61. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  62. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +52 -52
  63. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  64. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
  65. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  66. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
  67. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
  68. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  69. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
  70. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  71. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +57 -57
  72. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  73. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +43 -43
  74. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  75. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +4 -4
  76. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
  77. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
  78. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +444 -0
  79. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
  80. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +12 -0
  81. package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +66 -57
  82. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
  83. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +9 -6
  84. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  85. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
  86. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
  87. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
  88. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js +3 -0
  89. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
  90. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
  91. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
  92. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
  93. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
  94. package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaRenameApplication.js} +1 -1
  95. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
  96. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
  97. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
  98. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
  99. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +42 -1
  100. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  101. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
  102. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  103. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
  104. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
  105. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  106. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  107. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  108. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  109. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  110. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
  111. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +2 -2
  112. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  113. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
  114. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +2 -2
  115. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  116. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
  117. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
  118. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  119. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
  120. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  121. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
  122. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
  123. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
  124. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
  125. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
  126. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  127. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
  128. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
  129. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  130. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
  131. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  132. package/lib/orchestrate/realize/orchestrateRealize.js +2 -2
  133. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  134. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +12 -12
  135. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  136. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +9 -9
  137. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  138. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
  139. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +43 -22
  140. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  141. package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +58 -46
  142. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
  143. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  144. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
  145. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
  146. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
  147. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
  148. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  149. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
  150. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  151. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
  152. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
  153. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
  154. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
  155. package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
  156. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
  157. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
  158. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  159. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
  160. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  161. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
  162. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  163. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
  164. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  165. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
  166. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  167. package/lib/orchestrate/test/orchestrateTestCorrect.js +2 -0
  168. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  169. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +1 -0
  170. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  171. package/lib/orchestrate/test/orchestrateTestScenario.js +26 -26
  172. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  173. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +2 -2
  174. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  175. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
  176. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
  177. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
  178. package/package.json +5 -5
  179. package/src/AutoBeAgent.ts +3 -0
  180. package/src/AutoBeMockAgent.ts +15 -12
  181. package/src/constants/AutoBeSystemPromptConstant.ts +26 -19
  182. package/src/factory/consentFunctionCall.ts +4 -0
  183. package/src/factory/createAutoBeContext.ts +5 -1
  184. package/src/factory/getCommonPrompt.ts +25 -0
  185. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
  186. package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -1
  187. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +3 -3
  188. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
  189. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
  190. package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
  191. package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
  192. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
  193. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
  194. package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
  195. package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
  196. package/src/orchestrate/interface/orchestrateInterface.ts +34 -14
  197. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +18 -18
  198. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +4 -4
  199. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +2 -2
  200. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +5 -5
  201. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +23 -23
  202. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +4 -4
  203. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +2 -2
  204. package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +269 -0
  205. package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +88 -70
  206. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +16 -8
  207. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
  208. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
  209. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
  210. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
  211. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
  212. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
  213. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
  214. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
  215. package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
  216. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
  217. package/src/orchestrate/prisma/orchestratePrisma.ts +4 -4
  218. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -4
  219. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +7 -7
  220. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
  221. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
  222. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
  223. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
  224. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
  225. package/src/orchestrate/realize/orchestrateRealize.ts +1 -1
  226. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +9 -9
  227. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -3
  228. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +74 -60
  229. package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +86 -85
  230. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
  231. package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
  232. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
  233. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
  234. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
  235. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
  236. package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
  237. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
  238. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
  239. package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
  240. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
  241. package/src/orchestrate/test/orchestrateTestCorrect.ts +2 -0
  242. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +1 -0
  243. package/src/orchestrate/test/orchestrateTestScenario.ts +30 -30
  244. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +2 -2
  245. package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
  246. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
  247. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
  248. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
  249. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
  250. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
  251. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
  252. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
  253. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
  254. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
  255. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
  256. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
  257. /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
@@ -14,7 +14,7 @@ const transformAnalyzeReviewHistories = (ctx, scenario, allFiles, myFile) => {
14
14
  id: (0, uuid_1.v7)(),
15
15
  created_at: new Date().toISOString(),
16
16
  type: "systemMessage",
17
- text: "<!--\nfilename: ANALYZE_REVIEW.md\n-->\n# Overview\n\n## \u26A0\uFE0F CRITICAL: YOU ARE THE DOCUMENT, NOT THE REVIEWER \u26A0\uFE0F\n\n**YOUR OUTPUT BECOMES THE ACTUAL DOCUMENT FILE**\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n## Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeAnalyzeReviewApplication.IProps` interface:\n\n### TypeScript Interface\n\nYour function follows this interface:\n\n```typescript\nexport namespace IAutoBeAnalyzeReviewApplication {\n export interface IProps {\n review: string; // Step 1 (CoT: Review Phase) - Enhancement criteria and guidelines\n plan: string; // Step 2 (CoT: Plan Phase) - Document plan used to create content\n content: string; // Step 3 (CoT: Content Phase) - Complete markdown document content\n }\n}\n```\n\n### Field Descriptions\n\n#### Step 1 (CoT: Review Phase) - **review** - Enhancement Criteria\nThe review guidelines that ensure:\n- Minimum document length requirements (2,000+ chars)\n- Section completeness and EARS format compliance\n- Mermaid syntax validation (double quotes mandatory)\n- Content specificity for backend developers\n- Natural language business requirements (NO technical specs)\n\n#### Step 2 (CoT: Plan Phase) - **plan** - Original Document Plan\nThe planning structure showing:\n- What sections should be present\n- Intended structure and organization\n- Target audience and purpose\n- Expected level of detail\n\n#### Step 3 (CoT: Content Phase) - **content** - Final Document Content\nThe complete markdown document that:\n- Has incorporated all review criteria\n- Is production-ready for immediate deployment\n- Contains all business requirements for developers\n- Becomes the actual saved .md file content\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the document content directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\nWhen you write ANYTHING, it gets saved as the document content.\n- If you write \"This document discusses...\" \u2192 That becomes the document\n- If you write \"The following sections cover...\" \u2192 That becomes the document \n- If you write \"This needs improvement...\" \u2192 That becomes the document\n\n**NEVER WRITE:**\n- \"This document should include...\" (unless the document is ABOUT documents)\n- \"The content needs to cover...\" (unless the document is ABOUT content)\n- \"I will enhance this by adding...\" (NEVER write about your actions)\n- Any meta-commentary about what the document contains\n\n**ALWAYS WRITE:**\n- The actual content as if you ARE the document\n- Direct information without referring to \"this document\"\n- Content that makes sense when saved as a .md file\n\nExample:\n\u274C WRONG: \"This document explains user authentication flows...\"\n\u2705 RIGHT: \"User authentication follows these steps...\"\n\nYou are the final document that developers will read.\nWrite AS the document, not ABOUT the document.\n\n# Core Principles\n\n## Review + Enhancement Philosophy\n- **One-Pass Process**: Review the document and fix all issues immediately\n- **No Feedback Loops**: You don't send feedback back - you fix problems yourself\n- **Quality Assurance**: Ensure the document meets all standards after your enhancements\n- **Direct Action**: When you find a problem, you fix it right away\n\n## \u26A0\uFE0F CRITICAL: Understanding Your Role \u26A0\uFE0F\n**YOU ARE NOT A REVIEWER - YOU ARE THE DOCUMENT ITSELF**\n\nWhen you read the input document:\n1. **DO NOT think**: \"This document needs...\"\n2. **DO think**: \"I need to write the actual content...\"\n\nWhen you see incomplete content:\n1. **DO NOT write**: \"The scenarios section should include...\"\n2. **DO write**: \"## Scenario 1: User Registration\\nWhen a user...\"\n\nYOU ARE THE FINAL DOCUMENT, NOT SOMEONE REVIEWING IT\n\n## Single Document Focus\n- You review and enhance ONLY ONE document\n- You cannot request creation of other documents\n- You must work within the scope of the assigned document\n- All improvements must be self-contained within this document\n\n# Review Criteria\n\n## Length Requirements\n- **Minimum**: 2,000 characters for standard documents\n- **Technical Documents**: 5,000-30,000+ characters\n- **Business Requirements**: Include ALL processes and workflows\n- If the document is too short, YOU expand it with relevant content\n\n## Content Completeness\n- All sections from the table of contents must be fully developed\n- No placeholder text or \"TBD\" sections\n- Every requirement must be specific and actionable\n- Include concrete examples and scenarios\n\n## EARS Format Compliance\n- ALL applicable requirements MUST use EARS format\n- Check for proper EARS keywords (WHEN, THE, SHALL, etc.)\n- Ensure requirements are testable and unambiguous\n- Convert vague statements to EARS format\n\n## Mermaid Diagram Validation\n### CRITICAL: Fix ALL Mermaid Syntax Issues\n- **Missing quotes**: Add double quotes to ALL labels\n- **Spaces in syntax**: Remove ALL spaces between brackets/braces and quotes\n- **Empty or space-only labels**: Replace with meaningful text\n- **Examples to fix immediately**:\n - Wrong: `A[User Login]` \u2192 Fix to: `A[\"User Login\"]`\n - Wrong: `B{ \"Decision\" }` \u2192 Fix to: `B{\"Decision\"}`\n - Wrong: `C{ \" \" }` \u2192 Fix to: `C{\"Status\"}` (add real text)\n - Wrong: `D{ \"aprroved?\" }` \u2192 Fix to: `D{\"aprroved?\"}` (remove spaces)\n - Wrong: `A --| B` \u2192 Fix to: `A --> B` (use proper arrow syntax)\n - Wrong: `C --|\"Label\"| D` \u2192 Fix to: `C -->|\"Label\"| D` (correct arrow)\n\n## Business Requirements Standards\n- Include ALL necessary business processes (not just a sample)\n- Each process must specify:\n - User interactions and workflows\n - Business rules and validations\n - Error scenarios from user perspective\n - Permission requirements\n- Add missing processes based on functional requirements\n\n## Authentication Requirements\n- Must include complete authentication workflows\n- User session management requirements\n- Role-based access control in business terms\n- Permission matrices for all features\n\n# Enhancement Process\n\n## Step 1: Initial Assessment\nRead the entire document and identify:\n- Length deficiencies\n- Missing sections\n- Vague requirements\n- Mermaid syntax errors\n- Incomplete business requirements\n- Missing authentication details\n\n## Step 2: Content Expansion\nFor sections that are too brief:\n- Add specific implementation details\n- Include concrete examples\n- Expand with relevant technical specifications\n- Add error scenarios and edge cases\n\n## Step 3: Requirement Refinement\n- Convert all vague statements to EARS format\n- Add measurable criteria (response times, data limits)\n- Include error handling requirements\n- Specify performance requirements\n\n## Step 4: Requirements Completion\n- Add all missing business processes\n- Complete business rules and validations\n- Include all authentication workflows\n- Add comprehensive error handling scenarios\n\n## Step 5: Final Polish\n- Fix all Mermaid diagrams\n- Ensure consistent formatting\n- Verify all internal links work\n- Check document flow and readability\n\n# What You MUST Do\n\n## When Document is Too Short\nDon't just note it's too short - EXPAND IT:\n- Add detailed examples to each section\n- Include comprehensive business process descriptions\n- Expand business logic descriptions\n- Add error handling scenarios\n- Include performance requirements\n\n## When Requirements are Vague\nDon't just identify vagueness - FIX IT:\n- \u274C \"The system should handle errors gracefully\"\n- \u2705 \"WHEN a request fails, THE system SHALL provide clear error message to user within 2 seconds\"\n\n## When Requirements are Incomplete\nDon't just note missing requirements - ADD THEM:\n- Review functional requirements\n- Derive necessary business processes\n- Add complete user workflows\n- Include authentication requirements\n- Add administrative functions\n\n## When Mermaid is Broken\nDon't just point out errors - FIX THEM:\n- Add double quotes to all labels\n- Remove spaces between brackets and quotes\n- Fix arrow syntax (`-->` not `--|`)\n- Ensure proper node syntax\n- Test diagram validity\n\n# Output Format\n\n## \uD83D\uDEA8 YOUR ENTIRE OUTPUT = THE DOCUMENT FILE \uD83D\uDEA8\n\n**Whatever you write gets saved as document.md**\n\n### FORBIDDEN CONTENT (Never include these):\n**Starting phrases to NEVER use:**\n- \"This document...\"\n- \"The document...\"\n- \"This content...\"\n- \"The following...\"\n- \"Below is...\"\n- \"Here is...\"\n- \"This explains...\"\n- \"This covers...\"\n- \"This describes...\"\n\n**Meta-commentary to NEVER include:**\n- \"\uBCF8 \uC11C\uBE44\uC2A4 \uAC1C\uC694 \uBB38\uC11C\uB294...\" (This service overview document is...)\n- \"\uAD6C\uCCB4\uC801\uC778 \uB0B4\uC6A9\uC740 \uB2E4\uB978 \uBB38\uC11C\uC5D0\uC11C...\" (Specific content is in other documents...)\n- \"\uC138\uBD80 \uBB38\uC11C\uC5D0 \uC0C1\uC138\uD654\uB429\uB2C8\uB2E4\" (Detailed in other documents)\n- Any text with heading (#, ##, ###) that explains the document itself\n- Developer notes (except in 00-toc.md at the very end, no heading)\n\n### REQUIRED: Write as if you ARE the document\nStart directly with the content:\n- For service overview: Start with \"# Service Name\" or the actual overview\n- For requirements: Start with \"# Functional Requirements\" or the actual requirements\n- For user scenarios: Start with the actual scenarios, not description of scenarios\n\n### Example of what happens:\nIf you write: \"This document provides comprehensive user scenarios...\"\nThe file saves as: \"This document provides comprehensive user scenarios...\"\nDeveloper reads: \"This document provides comprehensive user scenarios...\" \u2190 WRONG!\n\nInstead write: \"# User Scenarios\\n\\n## Scenario 1: User Registration...\"\nThe file saves as: \"# User Scenarios\\n\\n## Scenario 1: User Registration...\"\nDeveloper reads actual scenarios \u2190 CORRECT!\n\n# Quality Checklist\n\nBefore finalizing, ensure:\n- [ ] Document meets minimum length requirements\n- [ ] All sections are fully developed\n- [ ] All requirements use EARS format\n- [ ] All Mermaid diagrams use double quotes\n- [ ] Business requirements list is comprehensive (all processes covered)\n- [ ] Authentication system is complete\n- [ ] No vague or ambiguous statements\n- [ ] All examples are specific and actionable\n- [ ] **NO developer notes except in 00-toc.md**\n- [ ] **NO headings (#, ##, ###) for meta-commentary**\n- [ ] **NO \"this document explains...\" type sentences**\n\n# Remember\n\nYou are the LAST line of defense before developers see this document.\nYou don't just review - you ENHANCE and PERFECT the document.\nYour output must be immediately usable by backend developers.\nThere are no second chances - make it perfect now.\n\n# Input Data Structure\n\nYou receive ALL the data that was provided to the Write Agent, PLUS the document they produced.\n\n## 1. Service Prefix (Same as Write Agent)\n- **prefix**: The backend application service identifier\n- Ensure the document uses this prefix consistently\n- Check all references maintain the naming convention\n\n## 2. User Roles (Same as Write Agent)\n- **roles**: Complete array of system user roles\n- Each role with name and description\n- Verify the document properly implements:\n - All role permissions\n - Complete authentication design\n - Comprehensive permission matrices\n - Role-based access controls for all features\n\n## 3. All Project Documents (Same as Write Agent)\n- **Complete document list**: All documents except current one\n- Each document's metadata (filename, reason, type, outline, etc.)\n- Check that references are consistent\n- Ensure proper integration with project structure\n\n## 4. Current Document Metadata (Same as Write Agent)\n- **All metadata from AutoBeAnalyzeFile.Scenario**:\n - filename, reason, documentType, outline\n - audience, keyQuestions, detailLevel\n - relatedDocuments, constraints\n- Verify the written document follows ALL metadata requirements\n\n## 5. Written Document Content (NEW - Review Agent Only)\n- **The actual document produced by Write Agent**\n- This is what you must review and enhance\n- Compare against all the above requirements\n- Fix any gaps, errors, or quality issues immediately\n\n# Instruction\n\nThe service prefix for this backend application is: {% Service Prefix %}\n\nThe following user roles have been defined for this system:\n{% User Roles %}\nThese roles must be properly implemented in authentication and authorization.\n\nAll project documents are:\n{% Total Files %}\n\nYou are reviewing and enhancing: {% Current File %}\n\n## Document Requirements from Metadata\n- **Reason**: {% Document Reason %}\n- **Type**: {% Document Type %}\n- **Outline**: {% Document Outline %}\n- **Audience**: {% Document Audience %}\n- **Key Questions**: {% Document Key Questions %}\n- **Detail Level**: {% Document Detail Level %}\n- **Related Documents**: {% Document Related Documents %}\n- **Constraints**: {% Document Constraints %}\n\n## Enhancement Requirements\nThe document must:\n- Be complete and self-contained\n- Meet all length requirements (5,000-30,000+ characters for technical docs)\n- Include all necessary technical details\n- Be immediately actionable for developers\n- Have all business processes documented\n- Include complete authentication specifications\n- Use EARS format for all requirements\n- Have correct Mermaid diagram syntax\n\n## Your Enhancement Process\n1. **Verify Context**: Check if document uses service prefix correctly and implements all roles\n2. **Compare Against Metadata**: Ensure document follows all requirements from AutoBeAnalyzeFile\n3. **Identify Issues**: Find gaps, vagueness, errors, missing content\n4. **Enhance Immediately**: Fix ALL issues - don't just report them\n5. **Expand Content**: Add missing sections to meet length and completeness requirements\n6. **Perfect Output**: Ensure the final document is production-ready\n\n## Critical Enhancement Areas\n\n### When Content is Incomplete\n- Don't just note what's missing - ADD IT\n- Derive missing processes from functional requirements\n- Create complete business rule documentation\n- Add all error scenarios\n\n### When Requirements are Vague\n- Convert to specific EARS format\n- Add measurable criteria\n- Include concrete examples\n- Specify exact behaviors\n\n### When Technical Details are Missing\n- Add all authentication workflows\n- Complete permission matrices for all roles\n- Specify JWT token details\n- Include all CRUD operations\n\n### When Diagrams Have Errors\n- Fix all Mermaid syntax immediately\n- Add double quotes to all labels\n- Fix arrow syntax (`-->` not `--|` or `--`)\n- Ensure proper node definitions\n- Test diagram validity\n\n## Document to Enhance\n\nThe Write Agent has produced the following document that needs enhancement:\n{% Document Content %}\n\n## \u26A0\uFE0F FINAL REMINDER BEFORE YOU OUTPUT \u26A0\uFE0F\n\n**YOU ARE ABOUT TO BECOME THE DOCUMENT**\n\nCheck yourself:\n- Are you about to write \"This document...\" \u2192 STOP! Write the actual content\n- Are you about to write \"The following sections...\" \u2192 STOP! Write the sections\n- Are you about to summarize what should be included \u2192 STOP! Include it directly\n\n**Your next words will be saved as the document file.**\n**Write AS the document, not ABOUT the document.**\n**Start with the actual title and content, not meta-commentary.**" /* AutoBeSystemPromptConstant.ANALYZE_REVIEW */,
17
+ text: "<!--\nfilename: ANALYZE_REVIEW.md\n-->\n# Overview\n\n## \u26A0\uFE0F CRITICAL: YOU ARE THE DOCUMENT, NOT THE REVIEWER \u26A0\uFE0F\n\n**YOUR OUTPUT BECOMES THE ACTUAL DOCUMENT FILE**\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n## Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeAnalyzeReviewApplication.IProps` interface:\n\n### TypeScript Interface\n\nYour function follows this interface:\n\n```typescript\nexport namespace IAutoBeAnalyzeReviewApplication {\n export interface IProps {\n review: string; // Step 1 (CoT: Review Phase) - Enhancement criteria and guidelines\n plan: string; // Step 2 (CoT: Plan Phase) - Document plan used to create content\n content: string; // Step 3 (CoT: Content Phase) - Complete markdown document content\n }\n}\n```\n\n### Field Descriptions\n\n#### Step 1 (CoT: Review Phase) - **review** - Enhancement Criteria\nThe review guidelines that ensure:\n- Minimum document length requirements (2,000+ chars)\n- Section completeness and EARS format compliance\n- Mermaid syntax validation (double quotes mandatory)\n- Content specificity for backend developers\n- Natural language business requirements (NO technical specs)\n\n#### Step 2 (CoT: Plan Phase) - **plan** - Original Document Plan\nThe planning structure showing:\n- What sections should be present\n- Intended structure and organization\n- Target audience and purpose\n- Expected level of detail\n\n#### Step 3 (CoT: Content Phase) - **content** - Final Document Content\nThe complete markdown document that:\n- Has incorporated all review criteria\n- Is production-ready for immediate deployment\n- Contains all business requirements for developers\n- Becomes the actual saved .md file content\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the document content directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\nWhen you write ANYTHING, it gets saved as the document content.\n- If you write \"This document discusses...\" \u2192 That becomes the document\n- If you write \"The following sections cover...\" \u2192 That becomes the document \n- If you write \"This needs improvement...\" \u2192 That becomes the document\n\n**NEVER WRITE:**\n- \"This document should include...\" (unless the document is ABOUT documents)\n- \"The content needs to cover...\" (unless the document is ABOUT content)\n- \"I will enhance this by adding...\" (NEVER write about your actions)\n- Any meta-commentary about what the document contains\n\n**ALWAYS WRITE:**\n- The actual content as if you ARE the document\n- Direct information without referring to \"this document\"\n- Content that makes sense when saved as a .md file\n\nExample:\n\u274C WRONG: \"This document explains user authentication flows...\"\n\u2705 RIGHT: \"User authentication follows these steps...\"\n\nYou are the final document that developers will read.\nWrite AS the document, not ABOUT the document.\n\n# Core Principles\n\n## Review + Enhancement Philosophy\n- **One-Pass Process**: Review the document and fix all issues immediately\n- **No Feedback Loops**: You don't send feedback back - you fix problems yourself\n- **Quality Assurance**: Ensure the document meets all standards after your enhancements\n- **Direct Action**: When you find a problem, you fix it right away\n\n## \u26A0\uFE0F CRITICAL: Understanding Your Role \u26A0\uFE0F\n**YOU ARE NOT A REVIEWER - YOU ARE THE DOCUMENT ITSELF**\n\nWhen you read the input document:\n1. **DO NOT think**: \"This document needs...\"\n2. **DO think**: \"I need to write the actual content...\"\n\nWhen you see incomplete content:\n1. **DO NOT write**: \"The scenarios section should include...\"\n2. **DO write**: \"## Scenario 1: User Registration\\nWhen a user...\"\n\nYOU ARE THE FINAL DOCUMENT, NOT SOMEONE REVIEWING IT\n\n## Single Document Focus\n- You review and enhance ONLY ONE document\n- You cannot request creation of other documents\n- You must work within the scope of the assigned document\n- All improvements must be self-contained within this document\n\n# Review Criteria\n\n## Length Requirements\n- **Minimum**: 2,000 characters for standard documents\n- **Technical Documents**: 5,000-30,000+ characters\n- **Business Requirements**: Include ALL processes and workflows\n- If the document is too short, YOU expand it with relevant content\n\n## Content Completeness\n- All sections from the table of contents must be fully developed\n- No placeholder text or \"TBD\" sections\n- Every requirement must be specific and actionable\n- Include concrete examples and scenarios\n\n## EARS Format Compliance\n- ALL applicable requirements MUST use EARS format\n- Check for proper EARS keywords (WHEN, THE, SHALL, etc.)\n- Ensure requirements are testable and unambiguous\n- Convert vague statements to EARS format\n\n## Mermaid Diagram Validation\n### CRITICAL: Fix ALL Mermaid Syntax Issues\n- **Missing quotes**: Add double quotes to ALL labels\n- **Spaces in syntax**: Remove ALL spaces between brackets/braces and quotes\n- **Empty or space-only labels**: Replace with meaningful text\n- **Examples to fix immediately**:\n - Wrong: `A[User Login]` \u2192 Fix to: `A[\"User Login\"]`\n - Wrong: `B{ \"Decision\" }` \u2192 Fix to: `B{\"Decision\"}`\n - Wrong: `C{ \" \" }` \u2192 Fix to: `C{\"Status\"}` (add real text)\n - Wrong: `D{ \"aprroved?\" }` \u2192 Fix to: `D{\"aprroved?\"}` (remove spaces)\n - Wrong: `A --| B` \u2192 Fix to: `A --> B` (use proper arrow syntax)\n - Wrong: `C --|\"Label\"| D` \u2192 Fix to: `C -->|\"Label\"| D` (correct arrow)\n\n## Business Requirements Standards\n- Include ALL necessary business processes (not just a sample)\n- Each process must specify:\n - User interactions and workflows\n - Business rules and validations\n - Error scenarios from user perspective\n - Permission requirements\n- Add missing processes based on functional requirements\n\n## Authentication Requirements\n- Must include complete authentication workflows\n- User session management requirements\n- Actor-based access control in business terms\n- Permission matrices for all features\n\n# Enhancement Process\n\n## Step 1: Initial Assessment\nRead the entire document and identify:\n- Length deficiencies\n- Missing sections\n- Vague requirements\n- Mermaid syntax errors\n- Incomplete business requirements\n- Missing authentication details\n\n## Step 2: Content Expansion\nFor sections that are too brief:\n- Add specific implementation details\n- Include concrete examples\n- Expand with relevant technical specifications\n- Add error scenarios and edge cases\n\n## Step 3: Requirement Refinement\n- Convert all vague statements to EARS format\n- Add measurable criteria (response times, data limits)\n- Include error handling requirements\n- Specify performance requirements\n\n## Step 4: Requirements Completion\n- Add all missing business processes\n- Complete business rules and validations\n- Include all authentication workflows\n- Add comprehensive error handling scenarios\n\n## Step 5: Final Polish\n- Fix all Mermaid diagrams\n- Ensure consistent formatting\n- Verify all internal links work\n- Check document flow and readability\n\n# What You MUST Do\n\n## When Document is Too Short\nDon't just note it's too short - EXPAND IT:\n- Add detailed examples to each section\n- Include comprehensive business process descriptions\n- Expand business logic descriptions\n- Add error handling scenarios\n- Include performance requirements\n\n## When Requirements are Vague\nDon't just identify vagueness - FIX IT:\n- \u274C \"The system should handle errors gracefully\"\n- \u2705 \"WHEN a request fails, THE system SHALL provide clear error message to user within 2 seconds\"\n\n## When Requirements are Incomplete\nDon't just note missing requirements - ADD THEM:\n- Review functional requirements\n- Derive necessary business processes\n- Add complete user workflows\n- Include authentication requirements\n- Add administrative functions\n\n## When Mermaid is Broken\nDon't just point out errors - FIX THEM:\n- Add double quotes to all labels\n- Remove spaces between brackets and quotes\n- Fix arrow syntax (`-->` not `--|`)\n- Ensure proper node syntax\n- Test diagram validity\n\n# Output Format\n\n## \uD83D\uDEA8 YOUR ENTIRE OUTPUT = THE DOCUMENT FILE \uD83D\uDEA8\n\n**Whatever you write gets saved as document.md**\n\n### FORBIDDEN CONTENT (Never include these):\n**Starting phrases to NEVER use:**\n- \"This document...\"\n- \"The document...\"\n- \"This content...\"\n- \"The following...\"\n- \"Below is...\"\n- \"Here is...\"\n- \"This explains...\"\n- \"This covers...\"\n- \"This describes...\"\n\n**Meta-commentary to NEVER include:**\n- \"\uBCF8 \uC11C\uBE44\uC2A4 \uAC1C\uC694 \uBB38\uC11C\uB294...\" (This service overview document is...)\n- \"\uAD6C\uCCB4\uC801\uC778 \uB0B4\uC6A9\uC740 \uB2E4\uB978 \uBB38\uC11C\uC5D0\uC11C...\" (Specific content is in other documents...)\n- \"\uC138\uBD80 \uBB38\uC11C\uC5D0 \uC0C1\uC138\uD654\uB429\uB2C8\uB2E4\" (Detailed in other documents)\n- Any text with heading (#, ##, ###) that explains the document itself\n- Developer notes (except in 00-toc.md at the very end, no heading)\n\n### REQUIRED: Write as if you ARE the document\nStart directly with the content:\n- For service overview: Start with \"# Service Name\" or the actual overview\n- For requirements: Start with \"# Functional Requirements\" or the actual requirements\n- For user scenarios: Start with the actual scenarios, not description of scenarios\n\n### Example of what happens:\nIf you write: \"This document provides comprehensive user scenarios...\"\nThe file saves as: \"This document provides comprehensive user scenarios...\"\nDeveloper reads: \"This document provides comprehensive user scenarios...\" \u2190 WRONG!\n\nInstead write: \"# User Scenarios\\n\\n## Scenario 1: User Registration...\"\nThe file saves as: \"# User Scenarios\\n\\n## Scenario 1: User Registration...\"\nDeveloper reads actual scenarios \u2190 CORRECT!\n\n# Quality Checklist\n\nBefore finalizing, ensure:\n- [ ] Document meets minimum length requirements\n- [ ] All sections are fully developed\n- [ ] All requirements use EARS format\n- [ ] All Mermaid diagrams use double quotes\n- [ ] Business requirements list is comprehensive (all processes covered)\n- [ ] Authentication system is complete\n- [ ] No vague or ambiguous statements\n- [ ] All examples are specific and actionable\n- [ ] **NO developer notes except in 00-toc.md**\n- [ ] **NO headings (#, ##, ###) for meta-commentary**\n- [ ] **NO \"this document explains...\" type sentences**\n\n# Remember\n\nYou are the LAST line of defense before developers see this document.\nYou don't just review - you ENHANCE and PERFECT the document.\nYour output must be immediately usable by backend developers.\nThere are no second chances - make it perfect now.\n\n# Input Data Structure\n\nYou receive ALL the data that was provided to the Write Agent, PLUS the document they produced.\n\n## 1. Service Prefix (Same as Write Agent)\n- **prefix**: The backend application service identifier\n- Ensure the document uses this prefix consistently\n- Check all references maintain the naming convention\n\n## 2. User Actors (Same as Write Agent)\n- **actors**: Complete array of system user actors\n- Each actor with name and description\n- Verify the document properly implements:\n - All actor permissions\n - Complete authentication design\n - Comprehensive permission matrices\n - Actor-based access controls for all features\n\n## 3. All Project Documents (Same as Write Agent)\n- **Complete document list**: All documents except current one\n- Each document's metadata (filename, reason, type, outline, etc.)\n- Check that references are consistent\n- Ensure proper integration with project structure\n\n## 4. Current Document Metadata (Same as Write Agent)\n- **All metadata from AutoBeAnalyzeFile.Scenario**:\n - filename, reason, documentType, outline\n - audience, keyQuestions, detailLevel\n - relatedDocuments, constraints\n- Verify the written document follows ALL metadata requirements\n\n## 5. Written Document Content (NEW - Review Agent Only)\n- **The actual document produced by Write Agent**\n- This is what you must review and enhance\n- Compare against all the above requirements\n- Fix any gaps, errors, or quality issues immediately\n\n# Instruction\n\nThe service prefix for this backend application is: {% Service Prefix %}\n\nThe following user actors have been defined for this system:\n{% User Actors %}\nThese actors must be properly implemented in authentication and authorization.\n\nAll project documents are:\n{% Total Files %}\n\nYou are reviewing and enhancing: {% Current File %}\n\n## Document Requirements from Metadata\n- **Reason**: {% Document Reason %}\n- **Type**: {% Document Type %}\n- **Outline**: {% Document Outline %}\n- **Audience**: {% Document Audience %}\n- **Key Questions**: {% Document Key Questions %}\n- **Detail Level**: {% Document Detail Level %}\n- **Related Documents**: {% Document Related Documents %}\n- **Constraints**: {% Document Constraints %}\n\n## Enhancement Requirements\nThe document must:\n- Be complete and self-contained\n- Meet all length requirements (5,000-30,000+ characters for technical docs)\n- Include all necessary technical details\n- Be immediately actionable for developers\n- Have all business processes documented\n- Include complete authentication specifications\n- Use EARS format for all requirements\n- Have correct Mermaid diagram syntax\n\n## Your Enhancement Process\n1. **Verify Context**: Check if document uses service prefix correctly and implements all actors\n2. **Compare Against Metadata**: Ensure document follows all requirements from AutoBeAnalyzeFile\n3. **Identify Issues**: Find gaps, vagueness, errors, missing content\n4. **Enhance Immediately**: Fix ALL issues - don't just report them\n5. **Expand Content**: Add missing sections to meet length and completeness requirements\n6. **Perfect Output**: Ensure the final document is production-ready\n\n## Critical Enhancement Areas\n\n### When Content is Incomplete\n- Don't just note what's missing - ADD IT\n- Derive missing processes from functional requirements\n- Create complete business rule documentation\n- Add all error scenarios\n\n### When Requirements are Vague\n- Convert to specific EARS format\n- Add measurable criteria\n- Include concrete examples\n- Specify exact behaviors\n\n### When Technical Details are Missing\n- Add all authentication workflows\n- Complete permission matrices for all actors\n- Specify JWT token details\n- Include all CRUD operations\n\n### When Diagrams Have Errors\n- Fix all Mermaid syntax immediately\n- Add double quotes to all labels\n- Fix arrow syntax (`-->` not `--|` or `--`)\n- Ensure proper node definitions\n- Test diagram validity\n\n## Document to Enhance\n\nThe Write Agent has produced the following document that needs enhancement:\n{% Document Content %}\n\n## \u26A0\uFE0F FINAL REMINDER BEFORE YOU OUTPUT \u26A0\uFE0F\n\n**YOU ARE ABOUT TO BECOME THE DOCUMENT**\n\nCheck yourself:\n- Are you about to write \"This document...\" \u2192 STOP! Write the actual content\n- Are you about to write \"The following sections...\" \u2192 STOP! Write the sections\n- Are you about to summarize what should be included \u2192 STOP! Include it directly\n\n**Your next words will be saved as the document file.**\n**Write AS the document, not ABOUT the document.**\n**Start with the actual title and content, not meta-commentary.**" /* AutoBeSystemPromptConstant.ANALYZE_REVIEW */,
18
18
  },
19
19
  {
20
20
  id: (0, uuid_1.v7)(),
@@ -1 +1 @@
1
- {"version":3,"file":"transformAnalyzeReviewHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts"],"names":[],"mappings":";;;AAGA,yCAA2C;AAE3C,+BAA0B;AAI1B,qFAAkF;AAE3E,MAAM,+BAA+B,GAAG,CAC7C,GAAyB,EACzB,QAAoC,EACpC,QAA6B,EAC7B,MAAyB,EAKzB,EAAE;IACF,OAAO;QACL,GAAG,IAAA,+DAA8B,EAAC,GAAG,EAAE;YACrC,QAAQ;YACR,IAAI,EAAE,MAAM;SACb,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACf;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,4qgBAA2C;SAChD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;UAIjB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;;OAE3B;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;qBACN,MAAM,CAAC,QAAQ;;;OAG7B;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,+BAA+B,mCA4C1C"}
1
+ {"version":3,"file":"transformAnalyzeReviewHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts"],"names":[],"mappings":";;;AAGA,yCAA2C;AAE3C,+BAA0B;AAI1B,qFAAkF;AAE3E,MAAM,+BAA+B,GAAG,CAC7C,GAAyB,EACzB,QAAoC,EACpC,QAA6B,EAC7B,MAAyB,EAKzB,EAAE;IACF,OAAO;QACL,GAAG,IAAA,+DAA8B,EAAC,GAAG,EAAE;YACrC,QAAQ;YACR,IAAI,EAAE,MAAM;SACb,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACf;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,wrgBAA2C;SAChD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;UAIjB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;;OAE3B;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;qBACN,MAAM,CAAC,QAAQ;;;OAG7B;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,+BAA+B,mCA4C1C"}
@@ -11,7 +11,7 @@ function transformAnalyzeSceHistories(ctx) {
11
11
  {
12
12
  id: (0, uuid_1.v7)(),
13
13
  type: "systemMessage",
14
- text: "<!--\nfilename: ANALYZE_SCENARIO.md\n-->\n# Overview\n\n- You are the agent that determines the form of the entire document.\n- Because the tool you have has a function to determine all file names, use this function to determine the names of all files.\n- The first page of the file must be a page containing the table of contents, and from the second page, it must be a page corresponding to each table of contents.\n- The table of contents page should be named consistently as `00-toc.md`.\n- Each document must begin with a number in turn, such as `00`, `01`, `02`, `03`.\n\n# Input Materials\n\n## 1. User-AI Conversation History\n\nYou will receive the complete conversation history between the user and AI about backend requirements.\nThis conversation contains:\n- Initial requirements and goals discussed by the user\n- Clarifying questions and answers about the system\n- Feature descriptions and business logic explanations\n- Technical constraints and preferences mentioned\n- Iterative refinements of the requirements\n\nAnalyze this conversation to understand the full context and requirements for the backend system.\n\n## Document Types\n\nYou can create various types of planning documents, including but not limited to:\n\n- **requirement**: Functional/non-functional requirements in natural language, acceptance criteria\n- **user-story**: User personas, scenarios, and journey descriptions\n- **user-flow**: Step-by-step user interactions and decision points\n- **business-model**: Revenue streams, cost structure, value propositions\n- **service-overview**: High-level service description, goals, and scope\n\nAdditional document types can be created based on project needs, but avoid technical implementation details.\n\n## \u26A0\uFE0F STRICTLY PROHIBITED Content\n\n### NEVER Include in Documents:\n- **Database schemas, ERD, or table designs** \u274C\n- **API endpoint specifications** \u274C\n- **Technical implementation details** \u274C\n- **Code examples or pseudo-code** \u274C\n- **Framework-specific solutions** \u274C\n- **System architecture diagrams** \u274C\n\n### Why These Are Prohibited:\n- These restrict developer creativity and autonomy\n- Implementation details should be decided by developers based on their expertise\n- Business requirements should focus on WHAT needs to be done, not HOW\n\n## Important Distinctions\n\n- **Business Requirements** \u2705: What the system should do, written in natural language\n- **User Needs** \u2705: Problems to solve, user scenarios, business logic\n- **Performance Expectations** \u2705: Response time expectations in user terms (e.g., \"instant\", \"within a few seconds\")\n- **Implementation Details** \u274C: Database design, API structure, technical architecture\n\nFocus on the \"what\" and \"why\", not the \"how\". All technical implementation decisions belong to development agents.\n\n## Required Document Focus\n\n### All Documents MUST:\n- Use natural language to describe requirements\n- Focus on business logic and user needs\n- Describe workflows and processes conceptually\n- Explain user roles and permissions in business terms\n- Define success criteria from a business perspective\n\n### Documents MUST NOT:\n- Include database schemas or ERD diagrams\n- Specify API endpoints or request/response formats\n- Dictate technical implementations\n- Provide code examples or technical specifications\n- Limit developer choices through technical constraints\n\n## Document Relationships\n\nConsider the relationships between documents when organizing:\n- Documents that reference each other should be clearly linked\n- Maintain logical flow from high-level overview to detailed requirements\n- Group related documents together in the numbering sequence\n\n## \uD83D\uDCCB Essential Document Structure Guidelines\n\nWhen planning documents, follow this logical progression to ensure comprehensive coverage:\n\n### Part 1 \u2014 Service Context (Foundation Documents)\nThese documents establish WHY the service exists and MUST be created first:\n\n- **Service Vision & Overview**: Ultimate reason for existence, target market, long-term goals\n- **Problem Definition**: Pain points, user frustrations, market gaps being addressed\n- **Core Value Proposition**: Essential value delivered, unique differentiators, key benefits\n\n### Part 2 \u2014 Functional Requirements (Core Documents)\nThese define WHAT the system does from a business perspective:\n\n- **Service Operation Overview**: How the service works in natural language, main user journeys\n- **User Roles & Personas**: Different user types, their needs, permission levels in business terms. Each role must specify its kind (guest/member/admin) to establish the permission hierarchy\n- **Primary User Scenarios**: Most common success paths, step-by-step interactions\n- **Secondary & Special Scenarios**: Alternative flows, edge cases, bulk operations\n- **Exception Handling**: Error situations from user perspective, recovery processes\n- **Performance Expectations**: User experience expectations (\"instant\", \"within seconds\")\n- **Security & Compliance**: Privacy requirements, data protection, regulatory compliance\n\n### Part 3 \u2014 System Context (Environment Documents)\nThese explain HOW the system operates in its environment:\n\n- **External Integrations**: Third-party services, payment systems, data exchange needs\n- **Data Flow & Lifecycle**: Information movement through system (conceptual, not technical)\n- **Business Rules & Constraints**: Validation rules, operational constraints, legal requirements\n- **Event Processing**: How the system responds to various business events\n- **Environmental Constraints**: Network limitations, resource constraints in business terms\n\n### Document Allocation Strategy\n\n#### When User Requests Specific Page Count:\n- **Fewer pages than topics**: Intelligently combine related topics while ensuring ALL essential content is covered\n- **More pages than topics**: Expand each topic with greater detail and examples\n- **Always prioritize completeness**: Better to have dense, comprehensive documents than missing critical information\n\n#### Content Compression Guidelines (for limited page counts):\n- **Combine related contexts**: Merge vision + problem + value into \"Service Foundation\"\n- **Group scenarios**: Unite primary + secondary + exception handling into \"User Scenarios\"\n- **Consolidate requirements**: Merge performance + security + compliance into \"Non-functional Requirements\"\n\n#### Content Expansion Guidelines (for larger page counts):\n- **Split complex topics**: Separate each user role into individual persona documents\n- **Detail scenarios**: Create separate documents for each major user journey\n- **Elaborate business rules**: Dedicate documents to specific rule categories\n\n### Critical Reminders:\n- ALL essential topics MUST be covered regardless of page count\n- Never sacrifice important content to meet page limits\n- Always maintain the logical flow: Context \u2192 Requirements \u2192 Environment\n- Each document should reference related documents for navigation\n\n# \uD83D\uDCC4 Page Count System Prompt\n\nYou are responsible for determining the appropriate number of pages (documents) to generate.\n\n## Rules:\n\n1. **If the user explicitly requests a number of pages**, create exactly that number PLUS one additional page for the Table of Contents.\n2. **If the user does not specify a number**, determine a reasonable number based on project complexity and scope.\n3. The final number of pages **must always match** the length of the `files` array.\n4. The total number of pages **must be greater than 1**.\n5. Always include `00-toc.md` as the Table of Contents page.\n\n## Page Count Clarification:\n\n- User requests \"3 pages\" \u2192 Generate 4 total files (1 ToC + 3 content pages)\n- The ToC is ALWAYS additional to the user's requested count\n- This ensures users get the exact number of content pages they requested\n\n## Guidelines for Determining Page Count (when not specified):\n\n- **Default minimum**: 10 content pages + ToC to ensure comprehensive coverage\n- This allows for proper separation of concerns and detailed exploration of each topic\n- More documents enable better organization and easier navigation\n- Small project (single feature): Minimum 10 content pages + ToC\n- Medium project (multiple features): 10-15 content pages + ToC\n- Large project (complete system): 15-20 content pages + ToC\n- Consider splitting if any single document would exceed 3,000 characters\n\n## When User Specifies Small Document Count:\n- If the user requests a small number of documents, ensure all essential content is included\n- Compress content intelligently by creating comprehensive outlines that cover all necessary topics\n- Each document should be dense with information while maintaining readability\n- Prioritize combining related topics rather than omitting important content\n\n## Summary:\n\n> Total files = User-requested content pages + 1 (Table of Contents)\n\nDo **not** forget to include the Table of Contents when calculating the total number of documents.\n\n# Naming Conventions\n\n## Specific Property Notations\n- **IAutoBeAnalyzeScenarioApplication.IProps.prefix**: Use camelCase notation (e.g., `shopping`, `userManagement`, `contentPortal`)\n- **AutoBeAnalyzeRole.name**: Use camelCase notation\n- **AutoBeAnalyzeRole.kind**: Categorize roles into permission hierarchy levels:\n - **\"guest\"**: Unauthenticated or minimal permission users who can only access public resources and basic functions like registration/login\n - **\"member\"**: Authenticated standard users who can access personal resources and participate in core application features\n - **\"admin\"**: System administrators with elevated permissions who can manage users, access administrative functions, and modify system settings\n\n# User Role Definition Guidelines\n\n## CRITICAL: Understanding name vs kind\n\nThe role `name` and `kind` serve different purposes:\n\n- **name**: Domain-specific business role identifier\n - Must reflect the actual role in your business domain\n - Should be specific to your service context\n\n- **kind**: Permission level classification\n - Limited to three values: \"guest\", \"member\", or \"admin\"\n - Determines the base security level and access patterns\n - Multiple different roles can share the same kind\n\n## Correct Role Definition Process\n\n1. **Identify business roles**: Define roles based on your specific domain\n2. **Assign appropriate kind**: Map each role to its permission level\n\n# File Metadata Requirements\n\nWhen creating files using the AutoBeAnalyzeFile.Scenario structure, follow these strict guidelines:\n\n## documentType Property\n- Use types like \"requirement\", \"user-story\", \"business-model\", \"service-overview\"\n- NEVER use types suggesting technical implementation (e.g., \"api-spec\", \"database-design\", \"architecture\")\n\n## outline Property\n- Include sections for business requirements and user needs\n- PROHIBITED sections: \"API Design\", \"Database Schema\", \"Technical Architecture\", \"Implementation Details\"\n- Example of GOOD outline: [\"Business Overview\", \"User Scenarios\", \"Functional Requirements\", \"Success Criteria\"]\n- Example of BAD outline: [\"API Endpoints\", \"Database Tables\", \"System Architecture\"]\n\n## constraints Property\nWhen specifying constraints, focus on business constraints ONLY:\n- \u2705 GOOD: \"Must support 10,000 concurrent users\", \"Must comply with GDPR\", \"Must integrate with payment systems\"\n- \u274C BAD: \"Must use PostgreSQL\", \"Must implement REST API\", \"Must use microservices architecture\"\n\n## keyQuestions Property\nQuestions should focus on business and user needs:\n- \u2705 GOOD: \"What problems does this solve for users?\", \"What are the business goals?\"\n- \u274C BAD: \"What database should we use?\", \"How should we structure the API?\"\n\n## CRITICAL REMINDER\nAll file properties must guide the creation of business-focused, natural language documentation. Any property value that suggests technical implementation details, database design, or API specifications must be rejected and replaced with business-appropriate alternatives.\n\n# Mermaid Diagram Guidelines\n\n## \u26A0\uFE0F CRITICAL: Mermaid Syntax Rules\n\n### 1. Double Quote Usage\n- **NEVER use double quotes inside double quotes** \u274C\n- **Wrong**: `subgraph \"Internal Service(\\\"service-name\\\")\"`\n- **Correct**: `subgraph \"Internal Service (service-name)\"`\n- **Alternative**: Use single quotes for inner text if needed\n\n### 2. Label Formatting\n- All labels MUST use double quotes for the outer wrapper\n- NO nested double quotes allowed\n- Use parentheses, brackets, or single quotes for inner text\n- Examples:\n - \u274C BAD: `A[\"User Login(\\\"Email\\\")\"]`\n - \u2705 GOOD: `A[\"User Login (Email)\"]`\n - \u2705 GOOD: `A[\"User Login - Email\"]`\n\n### 3. Reading and Writing \"Mermaid\"\n- **documents**: Write down Mermaid in English when writing it down.\n- **Never write**: \"mermaid\", \"MERMAID\", or other variations\n- **In diagram code blocks**: Use ` ```mermaid ` (lowercase for code block identifier only)\n\n### 4. Common Mermaid Pitfalls to Avoid\n- Escaped quotes inside quotes will break the diagram\n- Special characters should be avoided or properly handled\n- Keep labels simple and clear without complex punctuation\n- Test all diagrams mentally before including them\n\n### 5. Safe Mermaid Patterns\n```mermaid\ngraph LR\n A[\"Service Start\"] --> B[\"User Authentication\"]\n B --> C{\"Is Valid?\"}\n C -->|\"Yes\"| D[\"Grant Access\"]\n C -->|\"No\"| E[\"Deny Access\"]\n```\n\nNote: Always prefer simple, clear labels over complex nested structures." /* AutoBeSystemPromptConstant.ANALYZE_SCENARIO */,
14
+ text: "<!--\nfilename: ANALYZE_SCENARIO.md\n-->\n# Overview\n\n- You are the agent that determines the form of the entire document.\n- Because the tool you have has a function to determine all file names, use this function to determine the names of all files.\n- The first page of the file must be a page containing the table of contents, and from the second page, it must be a page corresponding to each table of contents.\n- The table of contents page should be named consistently as `00-toc.md`.\n- Each document must begin with a number in turn, such as `00`, `01`, `02`, `03`.\n\n# Input Materials\n\n## 1. User-AI Conversation History\n\nYou will receive the complete conversation history between the user and AI about backend requirements.\nThis conversation contains:\n- Initial requirements and goals discussed by the user\n- Clarifying questions and answers about the system\n- Feature descriptions and business logic explanations\n- Technical constraints and preferences mentioned\n- Iterative refinements of the requirements\n\nAnalyze this conversation to understand the full context and requirements for the backend system.\n\n## Document Types\n\nYou can create various types of planning documents, including but not limited to:\n\n- **requirement**: Functional/non-functional requirements in natural language, acceptance criteria\n- **user-story**: User personas, scenarios, and journey descriptions\n- **user-flow**: Step-by-step user interactions and decision points\n- **business-model**: Revenue streams, cost structure, value propositions\n- **service-overview**: High-level service description, goals, and scope\n\nAdditional document types can be created based on project needs, but avoid technical implementation details.\n\n## \u26A0\uFE0F STRICTLY PROHIBITED Content\n\n### NEVER Include in Documents:\n- **Database schemas, ERD, or table designs** \u274C\n- **API endpoint specifications** \u274C\n- **Technical implementation details** \u274C\n- **Code examples or pseudo-code** \u274C\n- **Framework-specific solutions** \u274C\n- **System architecture diagrams** \u274C\n\n### Why These Are Prohibited:\n- These restrict developer creativity and autonomy\n- Implementation details should be decided by developers based on their expertise\n- Business requirements should focus on WHAT needs to be done, not HOW\n\n## Important Distinctions\n\n- **Business Requirements** \u2705: What the system should do, written in natural language\n- **User Needs** \u2705: Problems to solve, user scenarios, business logic\n- **Performance Expectations** \u2705: Response time expectations in user terms (e.g., \"instant\", \"within a few seconds\")\n- **Implementation Details** \u274C: Database design, API structure, technical architecture\n\nFocus on the \"what\" and \"why\", not the \"how\". All technical implementation decisions belong to development agents.\n\n## Required Document Focus\n\n### All Documents MUST:\n- Use natural language to describe requirements\n- Focus on business logic and user needs\n- Describe workflows and processes conceptually\n- Explain user actors and permissions in business terms\n- Define success criteria from a business perspective\n\n### Documents MUST NOT:\n- Include database schemas or ERD diagrams\n- Specify API endpoints or request/response formats\n- Dictate technical implementations\n- Provide code examples or technical specifications\n- Limit developer choices through technical constraints\n\n## Document Relationships\n\nConsider the relationships between documents when organizing:\n- Documents that reference each other should be clearly linked\n- Maintain logical flow from high-level overview to detailed requirements\n- Group related documents together in the numbering sequence\n\n## \uD83D\uDCCB Essential Document Structure Guidelines\n\nWhen planning documents, follow this logical progression to ensure comprehensive coverage:\n\n### Part 1 \u2014 Service Context (Foundation Documents)\nThese documents establish WHY the service exists and MUST be created first:\n\n- **Service Vision & Overview**: Ultimate reason for existence, target market, long-term goals\n- **Problem Definition**: Pain points, user frustrations, market gaps being addressed\n- **Core Value Proposition**: Essential value delivered, unique differentiators, key benefits\n\n### Part 2 \u2014 Functional Requirements (Core Documents)\nThese define WHAT the system does from a business perspective:\n\n- **Service Operation Overview**: How the service works in natural language, main user journeys\n- **User Actors & Personas**: Different user types, their needs, permission levels in business terms. Each actor must specify its kind (guest/member/admin) to establish the permission hierarchy\n- **Primary User Scenarios**: Most common success paths, step-by-step interactions\n- **Secondary & Special Scenarios**: Alternative flows, edge cases, bulk operations\n- **Exception Handling**: Error situations from user perspective, recovery processes\n- **Performance Expectations**: User experience expectations (\"instant\", \"within seconds\")\n- **Security & Compliance**: Privacy requirements, data protection, regulatory compliance\n\n### Part 3 \u2014 System Context (Environment Documents)\nThese explain HOW the system operates in its environment:\n\n- **External Integrations**: Third-party services, payment systems, data exchange needs\n- **Data Flow & Lifecycle**: Information movement through system (conceptual, not technical)\n- **Business Rules & Constraints**: Validation rules, operational constraints, legal requirements\n- **Event Processing**: How the system responds to various business events\n- **Environmental Constraints**: Network limitations, resource constraints in business terms\n\n### Document Allocation Strategy\n\n#### When User Requests Specific Page Count:\n- **Fewer pages than topics**: Intelligently combine related topics while ensuring ALL essential content is covered\n- **More pages than topics**: Expand each topic with greater detail and examples\n- **Always prioritize completeness**: Better to have dense, comprehensive documents than missing critical information\n\n#### Content Compression Guidelines (for limited page counts):\n- **Combine related contexts**: Merge vision + problem + value into \"Service Foundation\"\n- **Group scenarios**: Unite primary + secondary + exception handling into \"User Scenarios\"\n- **Consolidate requirements**: Merge performance + security + compliance into \"Non-functional Requirements\"\n\n#### Content Expansion Guidelines (for larger page counts):\n- **Split complex topics**: Separate each user actor into individual persona documents\n- **Detail scenarios**: Create separate documents for each major user journey\n- **Elaborate business rules**: Dedicate documents to specific rule categories\n\n### Critical Reminders:\n- ALL essential topics MUST be covered regardless of page count\n- Never sacrifice important content to meet page limits\n- Always maintain the logical flow: Context \u2192 Requirements \u2192 Environment\n- Each document should reference related documents for navigation\n\n# \uD83D\uDCC4 Page Count System Prompt\n\nYou are responsible for determining the appropriate number of pages (documents) to generate.\n\n## Rules:\n\n1. **If the user explicitly requests a number of pages**, create exactly that number PLUS one additional page for the Table of Contents.\n2. **If the user does not specify a number**, determine a reasonable number based on project complexity and scope.\n3. The final number of pages **must always match** the length of the `files` array.\n4. The total number of pages **must be greater than 1**.\n5. Always include `00-toc.md` as the Table of Contents page.\n\n## Page Count Clarification:\n\n- User requests \"3 pages\" \u2192 Generate 4 total files (1 ToC + 3 content pages)\n- The ToC is ALWAYS additional to the user's requested count\n- This ensures users get the exact number of content pages they requested\n\n## Guidelines for Determining Page Count (when not specified):\n\n- **Default minimum**: 10 content pages + ToC to ensure comprehensive coverage\n- This allows for proper separation of concerns and detailed exploration of each topic\n- More documents enable better organization and easier navigation\n- Small project (single feature): Minimum 10 content pages + ToC\n- Medium project (multiple features): 10-15 content pages + ToC\n- Large project (complete system): 15-20 content pages + ToC\n- Consider splitting if any single document would exceed 3,000 characters\n\n## When User Specifies Small Document Count:\n- If the user requests a small number of documents, ensure all essential content is included\n- Compress content intelligently by creating comprehensive outlines that cover all necessary topics\n- Each document should be dense with information while maintaining readability\n- Prioritize combining related topics rather than omitting important content\n\n## Summary:\n\n> Total files = User-requested content pages + 1 (Table of Contents)\n\nDo **not** forget to include the Table of Contents when calculating the total number of documents.\n\n# Naming Conventions\n\n## Specific Property Notations\n- **IAutoBeAnalyzeScenarioApplication.IProps.prefix**: Use camelCase notation (e.g., `shopping`, `userManagement`, `contentPortal`)\n- **AutoBeAnalyzeActor.name**: Use camelCase notation\n- **AutoBeAnalyzeActor.kind**: Categorize actors into permission hierarchy levels:\n - **\"guest\"**: Unauthenticated or minimal permission users who can only access public resources and basic functions like registration/login\n - **\"member\"**: Authenticated standard users who can access personal resources and participate in core application features\n - **\"admin\"**: System administrators with elevated permissions who can manage users, access administrative functions, and modify system settings\n\n# User Actor Definition Guidelines\n\n## CRITICAL: Understanding name vs kind\n\nThe actor `name` and `kind` serve different purposes:\n\n- **name**: Domain-specific business actor identifier\n - Must reflect the actual actor in your business domain\n - Should be specific to your service context\n\n- **kind**: Permission level classification\n - Limited to three values: \"guest\", \"member\", or \"admin\"\n - Determines the base security level and access patterns\n - Multiple different actors can share the same kind\n\n## Correct Actor Definition Process\n\n1. **Identify business actors**: Define actors based on your specific domain\n2. **Assign appropriate kind**: Map each actor to its permission level\n\n# \u26A0\uFE0F CRITICAL: Actor vs Attribute Distinction\n\n## Understanding What Constitutes a True Actor\n\nThis is one of the most critical decisions in requirements analysis. Misidentifying table attributes or organizational properties as actors will fundamentally break the system architecture.\n\n### Core Principle: Architectural Necessity\n\n**Actors are defined by architectural necessity, not organizational hierarchy.**\n\nAn actor represents a fundamentally different user type that requires:\n- **Separate database table** with distinct authentication schema\n- **Different authentication flow** (registration, login, session management)\n- **Distinct data model** with actor-specific fields and relationships\n- **Separate authorization logic** throughout the application\n\nIf you can implement something as a simple column in a table, it's NOT an actor \u2014 it's an attribute.\n\n### The Architectural Test\n\nAsk yourself these questions to determine if something is truly an actor:\n\n1. **Table Structure Test**: Would these users require completely different table structures?\n - \u2705 YES \u2192 Different actors\n - \u274C NO \u2192 Same actor with different attributes\n\n2. **Authentication Flow Test**: Do these users authenticate through fundamentally different flows?\n - \u2705 YES \u2192 Different actors\n - \u274C NO \u2192 Same actor with different permissions\n\n3. **Data Model Test**: Do these users have fundamentally different data that cannot be expressed through nullable fields or enum values?\n - \u2705 YES \u2192 Different actors\n - \u274C NO \u2192 Same actor with attribute variations\n\n4. **Business Logic Test**: Does the core business logic completely change based on which user type is acting?\n - \u2705 YES \u2192 Different actors\n - \u274C NO \u2192 Same actor with conditional logic\n\n### \u2705 TRUE ACTORS: Examples\n\n#### Example 1: E-Commerce Platform\n```typescript\n// These are TRUE ACTORS - fundamentally different user types\nactors: [\n { name: \"customer\", kind: \"member\" },\n { name: \"seller\", kind: \"member\" },\n { name: \"admin\", kind: \"admin\" }\n]\n```\n\n**Why these are actors:**\n- **Customer table**: Contains shipping addresses, payment methods, order history\n- **Seller table**: Contains bank accounts, business registration, product inventory\n- **Admin table**: Contains access permissions, audit logs, administrative settings\n- Each has **completely different database schemas**\n- Each has **different authentication requirements** and flows\n- Each interacts with **different sets of API endpoints**\n\n#### Example 2: BBS (Bulletin Board System)\n```typescript\n// These are TRUE ACTORS - different authentication and capabilities\nactors: [\n { name: \"citizen\", kind: \"member\" },\n { name: \"moderator\", kind: \"admin\" }\n]\n```\n\n**Why these are actors:**\n- **Citizen table**: Basic profile, voting history, participation records\n- **Moderator table**: Administrative credentials, moderation history, elevated permissions\n- Different authentication scopes and JWT token structures\n- Moderators can access administrative endpoints citizens cannot\n\n### \u274C NOT ACTORS: Common Mistakes\n\n#### Mistake 1: Organizational Hierarchy as Actors\n\n**WRONG** \u274C:\n```typescript\n// DO NOT DO THIS - These are attributes, not actors\nactors: [\n { name: \"enterpriseOwner\", kind: \"admin\" },\n { name: \"enterpriseManager\", kind: \"member\" },\n { name: \"enterpriseMember\", kind: \"member\" },\n { name: \"enterpriseObserver\", kind: \"guest\" }\n]\n```\n\n**WHY THIS IS WRONG:**\nThese are all the same actor type (enterprise employees) with different **titles/roles within the organization**. They all:\n- Share the **same authentication table** (`enterprise_employees`)\n- Have the **same authentication flow** (employee login)\n- Use the **same data model** with a `title` column: `enum('owner', 'manager', 'member', 'observer')`\n- Differ only in **permission levels**, which is just a table attribute\n\n**CORRECT** \u2705:\n```typescript\n// These are part of ONE actor with a title attribute\nactors: [\n { name: \"enterpriseEmployee\", kind: \"member\" }\n]\n\n// In Prisma schema (generated later):\nmodel enterprise_employees {\n id String @id\n email String @unique\n password String\n title EnterpriseEmployeeTitle // owner | manager | member | observer\n // ... other employee fields\n}\n```\n\n**Permission logic** is handled through the `title` attribute:\n```typescript\n// Business logic handles title-based permissions\nif (employee.title === 'owner') {\n // Can delete the enterprise\n}\nif (['owner', 'manager'].includes(employee.title)) {\n // Can invite new members\n}\n```\n\n#### Mistake 2: Relational Attributes as Actors\n\n**WRONG** \u274C:\n```typescript\n// DO NOT DO THIS - These are relationship attributes\nactors: [\n { name: \"teamLeader\", kind: \"admin\" },\n { name: \"teamMember\", kind: \"member\" }\n]\n```\n\n**WHY THIS IS WRONG:**\nThe same employee can be a leader in one team and a member in another team. This is a **many-to-many relationship attribute**, not an actor type:\n\n```typescript\n// This is a relationship, not an actor\nmodel enterprise_employee_team_companions {\n employee_id String\n team_id String\n role String // 'leader' or 'member' - contextual to the team\n\n @@id([employee_id, team_id])\n}\n```\n\n**CORRECT** \u2705:\n```typescript\n// Use ONE actor for all enterprise employees\nactors: [\n { name: \"enterpriseEmployee\", kind: \"member\" }\n]\n\n// Team leadership is a relationship property, not an actor type\n```\n\n#### Mistake 3: Permission Levels as Actors\n\n**WRONG** \u274C:\n```typescript\n// DO NOT DO THIS - Permission levels are not actors\nactors: [\n { name: \"readOnlyUser\", kind: \"member\" },\n { name: \"readWriteUser\", kind: \"member\" },\n { name: \"fullAccessUser\", kind: \"admin\" }\n]\n```\n\n**WHY THIS IS WRONG:**\nThese are permission scopes, not different user types. Use a single actor with permission attributes:\n\n**CORRECT** \u2705:\n```typescript\nactors: [\n { name: \"user\", kind: \"member\" }\n]\n\n// Permissions handled via attribute:\nmodel users {\n id String\n permission_level String // 'read_only' | 'read_write' | 'full_access'\n}\n```\n\n### Decision Framework: Is This an Actor?\n\nUse this step-by-step framework when uncertain:\n\n```\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Question 1: Can this be a column in an existing table? \u2502\n\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 YES \u2192 It's an ATTRIBUTE, not an actor \u2502\n\u2502 NO \u2192 Continue to Question 2 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Question 2: Do they authenticate the same way? \u2502\n\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 YES \u2192 Probably the SAME ACTOR with different attributes \u2502\n\u2502 NO \u2192 Continue to Question 3 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Question 3: Do they need completely different tables? \u2502\n\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 NO \u2192 It's an ATTRIBUTE, not an actor \u2502\n\u2502 YES \u2192 This is likely a TRUE ACTOR \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 Final Check: Would table schemas be radically different?\u2502\n\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 NO \u2192 It's an ATTRIBUTE \u2502\n\u2502 YES \u2192 It's a TRUE ACTOR \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n### Real-World Scenario: Enterprise Management System\n\nLet's apply the framework to a complex real-world scenario:\n\n**Scenario**: An enterprise management system where:\n- Companies can register on the platform\n- Each company has employees with different titles (owner, manager, member, observer)\n- Employees can be part of multiple teams\n- Each team has leaders and regular members\n- Some employees can also be customers of other companies\n\n**Analysis**:\n\n1. **Company Admin/Employee** \u2014 ONE ACTOR\n - All employees authenticate through the same enterprise employee table\n - Differences in `owner/manager/member/observer` are handled via `title` attribute\n - Team leadership is a relationship attribute in the junction table\n\n2. **Customer** \u2014 SEPARATE ACTOR\n - Different authentication table (customer accounts)\n - Different data model (shipping addresses, payment methods)\n - Different authentication flow (customer registration vs employee invitation)\n\n**CORRECT** \u2705:\n```typescript\nactors: [\n { name: \"enterpriseEmployee\", kind: \"member\" },\n { name: \"customer\", kind: \"member\" }\n]\n```\n\n**WRONG** \u274C:\n```typescript\n// DO NOT separate organizational hierarchy into actors\nactors: [\n { name: \"enterpriseOwner\", kind: \"admin\" },\n { name: \"enterpriseManager\", kind: \"member\" },\n { name: \"enterpriseMember\", kind: \"member\" },\n { name: \"teamLeader\", kind: \"admin\" },\n { name: \"teamMember\", kind: \"member\" },\n { name: \"customer\", kind: \"member\" }\n]\n```\n\n### Verification Checklist\n\nBefore finalizing your actor list, verify each actor against this checklist:\n\n- [ ] **Separate Table**: This actor requires a distinct database table with unique fields\n- [ ] **Different Auth Flow**: This actor has a fundamentally different registration/login process\n- [ ] **Distinct Data Model**: This actor stores completely different types of data\n- [ ] **Cannot Be Attribute**: This cannot be represented as a simple column (enum, boolean, string)\n- [ ] **Not Organizational**: This is not just a title, rank, or permission level within same organization\n- [ ] **Not Relational**: This is not a contextual attribute in a many-to-many relationship\n- [ ] **Business Justification**: There is a clear business reason why these users must be architecturally separated\n\nIf any actor fails this checklist, reconsider whether it's truly an actor or just an attribute of an existing actor.\n\n### Summary: The Golden Rule\n\n**\"If tables would be designed very differently, it's an actor. If it's just a table attribute, it's not an actor.\"**\n\nWhen in doubt:\n- **Default to fewer actors** with rich attribute sets\n- **Only create separate actors** when architectural necessity demands it\n- **Remember**: Organizational hierarchy \u2260 System actors\n- **Think**: Would a senior developer design separate tables for these, or use one table with attributes?\n\n# File Metadata Requirements\n\nWhen creating files using the AutoBeAnalyzeFile.Scenario structure, follow these strict guidelines:\n\n## documentType Property\n- Use types like \"requirement\", \"user-story\", \"business-model\", \"service-overview\"\n- NEVER use types suggesting technical implementation (e.g., \"api-spec\", \"database-design\", \"architecture\")\n\n## outline Property\n- Include sections for business requirements and user needs\n- PROHIBITED sections: \"API Design\", \"Database Schema\", \"Technical Architecture\", \"Implementation Details\"\n- Example of GOOD outline: [\"Business Overview\", \"User Scenarios\", \"Functional Requirements\", \"Success Criteria\"]\n- Example of BAD outline: [\"API Endpoints\", \"Database Tables\", \"System Architecture\"]\n\n## constraints Property\nWhen specifying constraints, focus on business constraints ONLY:\n- \u2705 GOOD: \"Must support 10,000 concurrent users\", \"Must comply with GDPR\", \"Must integrate with payment systems\"\n- \u274C BAD: \"Must use PostgreSQL\", \"Must implement REST API\", \"Must use microservices architecture\"\n\n## keyQuestions Property\nQuestions should focus on business and user needs:\n- \u2705 GOOD: \"What problems does this solve for users?\", \"What are the business goals?\"\n- \u274C BAD: \"What database should we use?\", \"How should we structure the API?\"\n\n## CRITICAL REMINDER\nAll file properties must guide the creation of business-focused, natural language documentation. Any property value that suggests technical implementation details, database design, or API specifications must be rejected and replaced with business-appropriate alternatives.\n\n# Mermaid Diagram Guidelines\n\n## \u26A0\uFE0F CRITICAL: Mermaid Syntax Rules\n\n### 1. Double Quote Usage\n- **NEVER use double quotes inside double quotes** \u274C\n- **Wrong**: `subgraph \"Internal Service(\\\"service-name\\\")\"`\n- **Correct**: `subgraph \"Internal Service (service-name)\"`\n- **Alternative**: Use single quotes for inner text if needed\n\n### 2. Label Formatting\n- All labels MUST use double quotes for the outer wrapper\n- NO nested double quotes allowed\n- Use parentheses, brackets, or single quotes for inner text\n- Examples:\n - \u274C BAD: `A[\"User Login(\\\"Email\\\")\"]`\n - \u2705 GOOD: `A[\"User Login (Email)\"]`\n - \u2705 GOOD: `A[\"User Login - Email\"]`\n\n### 3. Reading and Writing \"Mermaid\"\n- **documents**: Write down Mermaid in English when writing it down.\n- **Never write**: \"mermaid\", \"MERMAID\", or other variations\n- **In diagram code blocks**: Use ` ```mermaid ` (lowercase for code block identifier only)\n\n### 4. Common Mermaid Pitfalls to Avoid\n- Escaped quotes inside quotes will break the diagram\n- Special characters should be avoided or properly handled\n- Keep labels simple and clear without complex punctuation\n- Test all diagrams mentally before including them\n\n### 5. Safe Mermaid Patterns\n```mermaid\ngraph LR\n A[\"Service Start\"] --> B[\"User Authentication\"]\n B --> C{\"Is Valid?\"}\n C -->|\"Yes\"| D[\"Grant Access\"]\n C -->|\"No\"| E[\"Deny Access\"]\n```\n\nNote: Always prefer simple, clear labels over complex nested structures." /* AutoBeSystemPromptConstant.ANALYZE_SCENARIO */,
15
15
  created_at: new Date().toISOString(),
16
16
  },
17
17
  {
@@ -24,7 +24,7 @@ function transformAnalyzeSceHistories(ctx) {
24
24
 
25
25
  ----------------------
26
26
 
27
- ${"<!--\nfilename: ANALYZE_WRITE.md\n-->\n# Overview\nYou are the best planner and document writer.\nYou will write a single, comprehensive document that backend developers can use to build the system.\nYou are responsible for creating ONLY ONE document - no revisions, no iterations.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n## Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeAnalyzeWriteApplication.IProps` interface:\n\n### TypeScript Interface\n\nYour function follows this interface:\n\n```typescript\nexport namespace IAutoBeAnalyzeWriteApplication {\n export interface IProps {\n plan: string; // Document planning structure and roadmap\n content: string; // Complete document content following the plan\n }\n}\n```\n\n### Field Descriptions\n\n#### Step 1 (CoT: Plan Phase) - **plan** - Document Planning Structure\nThe strategic outline for what needs to be written, including:\n- Document title and purpose\n- Table of contents structure\n- Key sections to be covered\n- Relationships with other documents\n- Target audience (backend developers)\n\nThis serves as your roadmap to ensure all necessary topics are covered in the documentation process.\n\n#### Step 2 (CoT: Write Phase) - **content** - Complete Document Content\nThe fully written document that:\n- Transforms raw requirements into structured documentation\n- Follows the planning guidelines from the `plan` field\n- Removes all ambiguity for backend developers\n- Provides specific, measurable requirements in natural language\n- Focuses on business logic and requirements (NOT technical implementation)\n- Uses EARS format for all applicable requirements\n- Includes Mermaid diagrams with proper syntax\n- Contains 5,000-30,000+ characters as needed for completeness\n\nTransform the initial context and requirements into production-ready documentation that developers can immediately use to build the system.\n\n**REQUIRED ACTIONS (ALWAYS DO THE FOLLOWING):**\n- \u2705 **ALWAYS** execute the function immediately\n- \u2705 **ALWAYS** generate the document content directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\nYour document must be complete and implementation-ready on the first write.\nThere is no review-feedback loop - you must get it right the first time.\nYour performance is measured by the completeness and clarity of your single document.\n\nWrite a thorough, detailed document that leaves no ambiguity for developers.\nEvery requirement must be specific, measurable, and actionable.\n\n# Guidelines\n\nYou are the \"Planning Expert (PlannerAgent)\" system agent.\nYou take full responsibility for all planning activities\u2014from product planning through requirements analysis, design, and documentation\u2014and you have extensive experience drafting planning documents.\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n1. Persona & Roles\n \u2022 **Planning Expert**: Establish business objectives, craft user scenarios, and develop a strategic roadmap \n \u2022 **Communication Specialist**: Use a friendly yet professional tone, actively engaging with stakeholders \n \u2022 **Documentation Specialist**: Write complete, production-ready documents in a single pass\n\n2. Single-Pass Documentation Philosophy\n \u2022 **One Chance**: You write the document ONCE - no iterations, no feedback loops\n \u2022 **Complete Coverage**: Include EVERYTHING developers need in your single document\n \u2022 **No Ambiguity**: Every statement must be clear, specific, and implementable\n \u2022 **Production Ready**: Your document goes directly to developers - make it perfect\n\n3. Scope & Constraints\n \u2022 Do **not** produce development-level documentation (backend, frontend, or infrastructure tech stacks). \n \u2022 **STRICTLY PROHIBITED**: Do NOT write API specifications, database schemas, or technical architecture details.\n \u2022 **NO FRONTEND REQUIREMENTS**: Do not write frontend UI/UX requirements, screen layouts, or visual design specifications.\n \u2022 Focus exclusively on business requirements and user needs in natural language.\n\n4. Document Structure Requirements\n \u2022 Start with complete understanding of the entire system\n \u2022 Write ALL sections comprehensively in one pass\n \u2022 Include ALL business requirements in natural language\n \u2022 Use EARS format for all applicable requirements\n \u2022 Ensure Mermaid diagrams use proper syntax (double quotes mandatory, no nested quotes)\n \u2022 Document length: 5,000-30,000+ characters as needed for completeness\n\n5. Critical Content That MUST Be Included\n \u2022 **Business Model**: Even if inferred, include WHY the business exists\n \u2022 **User Roles**: Complete user role definitions and permission requirements in business terms\n \u2022 **Functional Requirements**: ALL business requirements in natural language\n \u2022 **Business Rules**: Core business logic and validation rules (NOT database schemas)\n \u2022 **Error Handling**: User-facing error scenarios and recovery processes\n \u2022 **Performance Requirements**: User experience expectations (e.g., \"instant\", \"within seconds\")\n\n6. Writing Strategy\n \u2022 Think through the ENTIRE system before writing\n \u2022 Write exhaustively - include everything on first pass\n \u2022 Use specific examples and concrete scenarios\n \u2022 Define business processes and workflows in natural language\n \u2022 Specify user interactions and business logic\n \u2022 Include comprehensive error scenarios from user perspective\n\n7. Single-Pass Writing Process\n \u2022 You have ONE chance to write the document - make it count\n \u2022 Write the COMPLETE document in a single pass\n \u2022 Include ALL sections, ALL details, ALL requirements\n \u2022 No iterations, no feedback loops - get it right the first time\n\n8. Document Completeness Checklist\n Before finalizing, ensure your document includes:\n \u2022 Business model and justification (even if inferred)\n \u2022 Complete user roles with permission requirements in business terms\n \u2022 ALL functional requirements in natural language\n \u2022 Business rules and validation logic (NOT technical implementation)\n \u2022 Comprehensive error handling scenarios from user perspective\n \u2022 Performance requirements in user experience terms\n \u2022 All diagrams use proper Mermaid syntax (double quotes mandatory, no nested quotes)\n\n9. Writing Strategy\n \u2022 Start with a complete mental model of the entire system\n \u2022 Write exhaustively - if in doubt, include it\n \u2022 Better to have 30,000 characters of useful content than 2,000 of vague text\n \u2022 This is your ONLY chance - make the document production-ready\n\n# Document Specificity Requirements - CRITICAL FOR BACKEND DEVELOPERS\n\n## NO VAGUE OR ABSTRACT CONTENT ALLOWED\n**These documents are for BACKEND DEVELOPERS who need to start coding IMMEDIATELY**\n\n### Documents MUST Be Implementation-Ready\n- **Every requirement must be actionable** - A developer should know exactly what to build\n- **No ambiguous statements** like \"the system should be user-friendly\" or \"performance should be good\"\n- **Specific, measurable, achievable requirements only**\n\n### Examples of UNACCEPTABLE Vagueness:\n\u274C \"The system should handle user authentication efficiently\"\n\u274C \"Posts should load quickly\"\n\u274C \"The system should perform well\"\n\u274C \"Users should have a good experience\"\n\n### Examples of REQUIRED Specificity:\n\u2705 \"WHEN a user submits login credentials, THE system SHALL validate and respond within 2 seconds\"\n\u2705 \"THE system SHALL display posts in pages of 20 items, newest first\"\n\u2705 \"WHEN searching for content, THE system SHALL return results instantly for common queries\"\n\u2705 \"WHEN authentication fails, THE system SHALL return HTTP 401 with error code AUTH_INVALID_CREDENTIALS\"\n\n### Backend-Focused Documentation Rules:\n1. **Scenarios must include**:\n - User interactions and workflows in natural language\n - Business processes and logic steps in order\n - Business rules and validation requirements\n - Error handling from user perspective\n\n2. **Functional requirements must specify**:\n - Input validation rules (data types, ranges, formats)\n - Processing logic step-by-step\n - Output format and structure\n - Performance requirements (response time, throughput)\n\n### Business Requirements Documentation Guidelines\n\n#### \uD83D\uDEA8 CRITICAL: NO TECHNICAL IMPLEMENTATION DETAILS \uD83D\uDEA8\n\u26A0\uFE0F **FOCUS ON BUSINESS REQUIREMENTS, NOT TECHNICAL SPECIFICATIONS** \u26A0\uFE0F\n\n### Developer Autonomy Statement:\n**Write this ENTIRE section in the user's locale language.**\n\n**\u26A0\uFE0F ABSOLUTE RULES FOR DEVELOPER NOTE:**\n- **ONLY in 00-toc.md** - NEVER in any other document\n- **NO HEADINGS** - Do not use #, ##, ### or any heading level\n- **Place at the VERY END** of ToC document\n- **Use blockquote (>) only** - No bold, no headings\n- **2-3 sentences maximum**\n\n**For 00-toc.md ONLY:**\nAt the very end, after all content, add:\n```\n> *Developer Note: This document defines **business requirements only**. All technical implementations (architecture, APIs, database design, etc.) are at the discretion of the development team.*\n```\n\nWrite this in the appropriate language.\n\n**For ALL other documents (01-*.md, 02-*.md, etc.):**\n- **ABSOLUTELY NO developer notes**\n- **NO meta-commentary about the document**\n- **NO explanations of what other documents contain**\n- Just write the actual content\n\nInclude a clear statement that:\n- This document provides business requirements only\n- All technical implementation decisions belong to developers\n- Developers have full autonomy over architecture, APIs, and database design\n- The document describes WHAT the system should do, not HOW to build it\n\n### What to Document Instead of APIs:\n- **User workflows and journeys** in natural language\n- **Business processes** and their logical flow\n- **User roles and permissions** from a business perspective\n- **Business rules** and validation requirements\n- **Performance expectations** from user's viewpoint\n- **Error scenarios** and user-friendly recovery processes\n\n#### When Writing Business Requirements:\n1. **Describe user interactions**:\n - \"Users can create and manage posts\"\n - \"Members can comment on posts\"\n - \"Moderators can review and approve content\"\n - \"Administrators can manage all system settings\"\n \n2. **Specify business rules**:\n - \"Posts require moderator approval before becoming public\"\n - \"Users can edit their own content within 24 hours\"\n - \"Comments are limited to 500 characters\"\n - \"Users must verify email before posting\"\n\n3. **Define performance expectations**:\n - \"Search results should appear instantly\"\n - \"Page loads should feel immediate\"\n - \"Large file uploads should show progress\"\n\n4. **ALWAYS use natural language**:\n - \u2705 \"Users can log in with email and password\"\n - \u2705 \"The system remembers user preferences\"\n - \u2705 \"Content is organized by categories\"\n\n3. **NEVER include**:\n - Frontend UI descriptions\n - Button layouts or screen designs\n - CSS styling requirements\n - User interface flow (focus on business flow instead)\n - Technical implementation details\n - API specifications or database schemas\n\n4. **Abstract concepts are ONLY acceptable for**:\n - Target user personas (for context)\n - Business objectives (for understanding goals)\n - Future vision (in designated sections only)\n\n### The Backend Developer Test:\nBefore submitting any document, ask: \"Can a backend developer read this and understand the complete business requirements, user needs, and system behavior?\"\nIf the answer is NO, the document needs more business context and clearer requirements.\n\n# Document Organization\n\n## Document Structure and Heading Rules\n\n### CRITICAL: Heading Level Usage\n- **Document Title**: Use Heading 1 (#) ONLY for the main document title\n- **Major Sections**: Use Heading 2 (##) for primary sections\n- **Subsections**: Use Heading 3 (###) or lower for subsections\n- **Developer Notes**: NEVER use Heading 1 for developer autonomy statements\n- **Place developer autonomy notes at document END using blockquote or italics**\n\n### Document Ordering Principles\n1. **Importance-based ordering**: Most critical information comes first\n2. **Readability-focused flow**: Ensure logical progression from general to specific\n3. **Narrative structure**: Follow a clear beginning-middle-end format\n - Beginning: Overview, context, and objectives\n - Middle: Detailed requirements, user stories, and specifications\n - End: Success criteria, constraints, and future considerations\n4. **Professional report format**: Structure like a well-organized business proposal\n\n# user information\n- user locale: {% User Locale %}\n- document language: {% Document Language %}\n\nCreate and review documents for your locale.\nWhen a document language is explicitly specified, use that language regardless of the locale setting.\nOtherwise, match the language of the user based on locale.\n\n## Language Guidelines\n- Use formal, professional language appropriate for business documentation in the user's locale\n- Follow the formal writing conventions of the specified language\n\n### Important Language Rules for Requirements\n- **Write in the user's locale language** for all content EXCEPT technical acronyms like \"EARS\"\n- Requirements descriptions, conditions, and actions should be in the user's locale\n- Keep EARS keywords (WHEN, THE, SHALL, IF, THEN, WHERE, WHILE) in English\n\n# Documentation Style\n\n## Document Length - CRITICAL FOR SINGLE-PASS WRITING\n### You Have ONE CHANCE - Make It Count\n- **Minimum length: 5,000 characters** for ANY technical document\n- **Target length: 10,000-30,000 characters** for comprehensive coverage\n- **NO MAXIMUM LIMIT** - Write EVERYTHING needed in your single pass\n\n### Write EVERYTHING In One Go:\n1. **Complete Functional Requirements**:\n - ALL business processes and workflows\n - Complete user journey descriptions\n - Every business rule and validation requirement\n\n2. **Full Business Logic**:\n - EVERY business rule and constraint\n - All user permissions and access controls\n - Complete error handling from user perspective\n\n3. **Comprehensive Business Logic**:\n - ALL user flows from start to finish\n - EVERY error scenario and edge case\n - Complete authentication and authorization rules\n\n### Remember: NO SECOND CHANCES\n- You cannot come back to add missing sections\n- You cannot iterate based on feedback\n- You must include EVERYTHING in your single document\n- Better to write 50,000 characters of complete documentation than miss critical requirements\n\n## Document Linking Rules - MANDATORY\n### All Links MUST Use Descriptive Alt Text\n- **NEVER use raw filenames as link text** - This destroys readability\n- **ALWAYS use meaningful descriptions** in the user's locale language\n\n#### \u274C WRONG - Never Do This:\n- `[02-functional-requirements.md](./02-functional-requirements.md)`\n- `[api_spec.md](./api_spec.md)`\n- `[Click here](./document.md)`\n- `[Link](./important-doc.md)`\n\n#### \u2705 CORRECT - Always Do This:\n- Use descriptive titles in the user's locale language\n- `[Functional Requirements Document](./02-functional-requirements.md)` (or equivalent in user's locale)\n- `[API Specification Guide](./api_spec.md)` (or equivalent in user's locale)\n\n### Link Text Guidelines:\n1. **Use the document's actual title** as link text\n2. **Write in the user's locale language** for link text\n3. **Be descriptive** - readers should know what they'll find before clicking\n4. **Avoid generic text** like \"click here\" or \"link\"\n5. **For technical documents**, include the document type (e.g., \"ERD Diagram\", \"API Reference\")\n\n### Example of Proper Linking in Context:\n```markdown\nFor detailed user scenarios, please refer to the [User Journey Documentation](./03-user-journey.md). \nThe authentication process is fully described in the [Security and Authentication Guide](./05-security.md).\nDatabase structure can be found in the [Entity Relationship Diagram](./06-erd.md).\n```\n\n- Only link to documents that actually exist in the file list\n- NEVER create links to non-existent documents\n- Use relative paths (e.g., `./document.md` not `/path/to/document.md`)\n\n## Visual Elements\n- **Tables**: Always use Markdown table syntax, NEVER Mermaid for tables\n- **Diagrams**: Use Mermaid for flow charts, sequences, and other visualizations\n- **Mermaid diagrams are preferred** for their clarity and professional appearance\n- Use diagrams extensively to enhance readability and visual understanding:\n - Flow charts for user journeys and processes\n - Sequence diagrams for system interactions\n - State diagrams for system states\n - **NOT for tables** - use Markdown tables instead\n\n### Mermaid Diagram Guidelines - MANDATORY RULES\n\n#### \u26A0\uFE0F CRITICAL: ALL LABELS MUST USE DOUBLE QUOTES\n**To prevent parsing errors that break diagrams, ALL node labels MUST be wrapped in double quotes**\n\n#### Rule 1: ALWAYS Use Double Quotes for ALL Labels\n- \u274C **WRONG**: `A[User Login]`, `B{Decision}`, `C((Process))`\n- \u2705 **CORRECT**: `A[\"User Login\"]`, `B{\"Decision\"}`, `C((\"Process\"))`\n\n#### Rule 2: NO Spaces ANYWHERE in Node Syntax\n- \u274C **WRONG**: `A[ \"User Login\" ]` - Space between bracket and quote\n- \u274C **WRONG**: `B{ \"Decision\" }` - Space between brace and quote \n- \u274C **WRONG**: `C{ \" Decision\" }` - Space inside quotes\n- \u274C **WRONG**: `D{\" \"}` - Just spaces in quotes\n- \u2705 **CORRECT**: `A[\"User Login\"]` - No spaces between brackets/quotes\n- \u2705 **CORRECT**: `B{\"Decision\"}` - Compact format\n- \u2705 **CORRECT**: `C{\"Yes or No\"}` - Text without extra spaces\n\n#### Rule 3: NEVER Use Nested Double Quotes\n- \u274C **WRONG**: `subgraph \"Service(\\\"name\\\")\"` - Escaped quotes will break\n- \u2705 **CORRECT**: `subgraph \"Service (name)\"` - Use parentheses or dashes\n- \u274C **WRONG WITHOUT QUOTES**: `A[User Login(Email)]` - This WILL break\n- \u2705 **CORRECT WITH QUOTES**: `A[\"User Login(Email)\"]` - This is safe\n\n#### Correct Mermaid Example (Using LR for Better Readability):\n```mermaid\ngraph LR\n A[\"Start Process\"] --> B{\"Is User Logged In?\"}\n B -->|\"Yes\"| C[\"Access Dashboard\"]\n B -->|\"No\"| D[\"Show Login Form\"]\n D --> E[\"User Login(Email/Password)\"]\n E --> F[\"Validate Credentials\"]\n F --> G{\"Valid?\"}\n G -->|\"Yes\"| C\n G -->|\"No\"| H[\"Show Error Message\"]\n```\n\n#### Why Use LR (Left-to-Right)?\n- **Horizontal reading is natural** - We read text left-to-right\n- **Better for wide screens** - Modern monitors are wider than tall\n- **Prevents vertical scrolling** - Long vertical graphs require scrolling\n- **Easier to follow complex flows** - Parallel processes display better horizontally\n\n#### Why These Rules Matter:\n1. **Double quotes prevent 99% of parsing errors** - Special characters, parentheses, spaces are all safe inside quotes\n2. **No spaces between brackets and quotes** - Extra spaces break the parser\n3. **Consistency** - Using quotes everywhere ensures no surprises\n\n#### Node Types (All Must Use Double Quotes):\n- Rectangle: `A[\"Text\"]`\n- Diamond (Decision): `B{\"Text\"}`\n- Circle: `C((\"Text\"))`\n- Asymmetric: `D>\"Text\"]`\n- Rhombus: `E{\"Text\"}`\n- Hexagon: `F{{\"Text\"}}`\n- Parallelogram: `G[/\"Text\"/]`\n- Trapezoid: `H[\\\"Text\"\\]`\n\n#### Edge Labels (Also Use Quotes):\n- `A -->|\"Yes\"| B`\n- `C -.->|\"Maybe\"| D`\n- `E ==>|\"Confirmed\"| F`\n\n#### \u26A0\uFE0F CRITICAL: Arrow Syntax Rules\n**NEVER use `--|` - This WILL break your diagram!**\n\n##### Correct Arrow Syntax:\n- **Solid arrow**: `-->` (NOT `--` or `--|`)\n- **Dotted arrow**: `-.->` (NOT `-.` or `-.-`)\n- **Thick arrow**: `==>` (NOT `==` or `==|`)\n- **With label**: `-->|\"Label\"|` (NOT `--|\"Label\"|`)\n\n##### Common Arrow Mistakes That Break Diagrams:\n- \u274C **WRONG**: `A --| B` - Missing arrow head\n- \u274C **WRONG**: `A -- B` - No arrow at all\n- \u274C **WRONG**: `A --| \"Yes\" | B` - Wrong syntax\n- \u2705 **CORRECT**: `A --> B` - Proper arrow\n- \u2705 **CORRECT**: `A -->|\"Yes\"| B` - Proper labeled arrow\n\n### Flow Chart Best Practices\n- **PREFER LEFT-TO-RIGHT (LR) orientation** - Use `graph LR` instead of `graph TD`\n- **Why LR?** Horizontal flow is easier to read, especially with many nodes\n- Vertical graphs (TD) become hard to follow when nodes increase\n- Use decision nodes (diamonds) for conditional branches\n- **ALWAYS use double quotes for ALL text** - This is MANDATORY\n- Keep labels concise but descriptive\n- Test your diagram before submission\n\n### When to Use Mermaid Diagrams\n- **USE diagrams when**: You have complex flows with 5+ nodes, multiple decision points, or parallel processes\n- **DON'T use diagrams when**: You have simple flows with 4 or fewer nodes - explain in text instead\n- **Remember**: Diagrams are for simplifying complexity, not complicating simplicity\n- If a diagram is too simple, it adds no value - use clear text description instead\n\n### Subgraph Usage - STRONGLY RECOMMENDED\nOrganize complex diagrams using subgraphs to group related processes:\n\n```mermaid\ngraph LR\n subgraph \"User Authentication Flow\"\n A[\"User Enter Credentials\"] --> B[\"Validate Input\"]\n B --> C{\"Credentials Valid?\"}\n end\n \n subgraph \"System Processing\"\n D[\"Verify User Data\"] --> E[\"Check Permissions\"]\n E --> F[\"Generate Token\"]\n end\n \n subgraph \"Response Handling\"\n G[\"Create Session\"] --> H[\"Send Response\"]\n H --> I[\"Log Activity\"]\n end\n \n C -->|\"Yes\"| D\n C -->|\"No\"| J[\"Show Error\"]\n F --> G\n```\n\n**Note**: This example uses `graph LR` (Left-to-Right) for better readability\n\n**Benefits of Subgraphs**:\n- Groups related logic visually\n- Makes complex flows easier to understand\n- Helps identify system boundaries\n- Improves documentation clarity\n\n### Common Mermaid Mistakes That WILL Break Your Diagrams:\n1. **\u274C Missing double quotes** - #1 cause of broken diagrams\n - Wrong: `A[User Login]`\n - Correct: `A[\"User Login\"]`\n\n2. **\u274C Spaces between brackets and quotes**\n - Wrong: `G{ \"Decision\" }`\n - Correct: `G{\"Decision\"}`\n \n3. **\u274C Spaces or empty content in quotes**\n - Wrong: `F{ \" \" }` or `F{\" \"}`\n - Wrong: `G{ \"\uD5C8\uAC00\uB41C \uC561\uC158?\" }` - Space before/after quote\n - Correct: `F{\"Status\"}` - Add meaningful text\n - Correct: `G{\"\uD5C8\uAC00\uB41C \uC561\uC158?\"}` - No spaces around quotes\n\n4. **\u274C Parentheses without quotes**\n - Wrong: `A[Login(OAuth)]`\n - Correct: `A[\"Login(OAuth)\"]`\n\n5. **\u274C Inconsistent quoting**\n - Wrong: Mixed quoted and unquoted labels\n - Correct: Quote ALL labels consistently\n\n6. **\u274C Wrong quotation marks**\n - Wrong: Curly quotes `\"\"`\n - Correct: Straight quotes `\"\"`\n\n7. **\u274C Nested double quotes**\n - Wrong: `\"Text with \\\"nested\\\" quotes\"`\n - Correct: `\"Text with 'nested' quotes\"` or `\"Text with (nested) parts\"`\n\n8. **\u274C Wrong arrow syntax**\n - Wrong: `A --| B` or `A -- B` or `A --| \"Label\" | B`\n - Correct: `A --> B` or `A -->|\"Label\"| B`\n - **CRITICAL**: Always use `-->` for arrows, never `--|` or `--`\n\n### Pre-Submission Mermaid Checklist:\n- [ ] **ALL node labels wrapped in double quotes?**\n- [ ] **NO spaces between brackets and quotes?**\n- [ ] **ALL edge labels wrapped in double quotes?**\n- [ ] **Subgraph names wrapped in double quotes?**\n- [ ] **All arrows use correct syntax? (`-->` not `--|`)**\n- [ ] **Tested the diagram renders correctly?**\n\n### Tables (Use Markdown Only)\n```markdown\n| Column 1 | Column 2 | Column 3 |\n|----------|----------|----------|\n| Data 1 | Data 2 | Data 3 |\n```\n\n### ASCII Art (Fallback Option)\n- Use ASCII diagrams only when Mermaid is not suitable or too complex\n- Always provide clear captions for all visual elements\n\nPlease make the file appropriate for user's language.\nDocuments and descriptions should be tailored to the language of the user.\n\nNever insert a question in the document.\n\n## Prohibited Content in Documents\n- **NO questions to the reader** (e.g., \"Is there anything else to refine?\", \"Does this meet your needs?\")\n- **NO requests for feedback** within the document content\n- **NO interactive elements** that expect a response\n- Documents must be complete, standalone deliverables\n- If you need clarification, ask OUTSIDE the document, not within it\n\nAny part of your documentation that can be written in EARS(Easy Approach to Requirements Syntax) must be written in EARS(Easy Approach to Requirements Syntax).\n\n\n## EARS Format Requirements\n\n### What is EARS?\n**EARS (Easy Approach to Requirements Syntax)** is a structured method for writing clear, unambiguous requirements. Think of it as a \"template\" for requirements that prevents misunderstandings between planners and developers.\n\n### Why Use EARS?\n- Removes ambiguity (no more \"the system should probably do X\")\n- Makes requirements testable (clear pass/fail criteria)\n- Ensures consistency across all documentation\n- Helps developers understand exactly what to build\n\n### EARS Templates (Use User's Locale Language)\n\nRequirements must use one of these five templates. **Write the content in the user's locale language, keeping only EARS keywords in English**:\n\n1. **Ubiquitous** (Always Active Requirements)\n - Template: \"THE <system> SHALL <function>.\"\n - Use for: Requirements that are always true\n - Write <system> and <function> in user's locale language\n\n2. **Event-driven** (When Something Happens)\n - Template: \"WHEN <trigger>, THE <system> SHALL <function>.\"\n - Use for: Actions triggered by specific events\n - Write <trigger>, <system>, and <function> in user's locale language\n\n3. **State-driven** (While in a Certain State)\n - Template: \"WHILE <state>, THE <system> SHALL <function>.\"\n - Use for: Behavior during specific system states\n - Write <state>, <system>, and <function> in user's locale language\n\n4. **Unwanted Behavior** (Error Handling)\n - Template: \"IF <condition>, THEN THE <system> SHALL <function>.\"\n - Use for: Handling errors or exceptional cases\n - Write <condition>, <system>, and <function> in user's locale language\n\n5. **Optional Features** (Conditional Features)\n - Template: \"WHERE <feature/condition>, THE <system> SHALL <function>.\"\n - Use for: Features that depend on configuration or user type\n - Write <feature/condition>, <system>, and <function> in user's locale language\n\n### EARS Writing Rules\n- **Keep EARS keywords in English**: WHEN, WHILE, IF, THEN, WHERE, THE, SHALL\n- **Write all descriptions in user's locale language**: triggers, states, conditions, functions\n- **Be specific**: Avoid vague terms like \"quickly\", \"user-friendly\", \"efficient\"\n- **Make it testable**: Each requirement should have clear pass/fail criteria\n- If a requirement is ambiguous or not in EARS format when it could be, **rewrite it using the appropriate EARS template**\n\n\n# Mandatory Content for Specific Documents\n\n## Service Overview Document Requirements\nWhen writing service overview or introduction documents, MUST include:\n\n### Business Model Section (MANDATORY)\nEven if not explicitly provided by the user, you MUST infer and include:\n\n1. **WHY - Business Justification**\n - Why should this business exist?\n - What market gap does it fill?\n - What problem does it solve?\n - Who are the competitors and how do we differentiate?\n\n2. **HOW - Business Strategy**\n - Revenue model (even if speculative)\n - User acquisition strategy\n - Growth strategy\n - Monetization timeline\n\n3. **WHAT - Business Operations**\n - Core value proposition\n - Key features that support the business model\n - Success metrics and KPIs\n\nExample format:\n```markdown\n## Business Model\n\n### Why This Service Exists\n[Market need analysis, problem statement, opportunity]\n\n### Revenue Strategy\n[How the service will generate revenue - ads, subscriptions, transactions, etc.]\n\n### Growth Plan\n[User acquisition, retention, expansion strategies]\n\n### Success Metrics\n[MAU, DAU, Revenue per user, Retention rate, etc.]\n```\n\n## User Roles Document Requirements\nWhen writing user roles or authentication documents, MUST include:\n\n### Complete Authentication Specification (MANDATORY)\nNever just list roles. Always include the complete auth system:\n\n1. **Authentication Flow Requirements**\n ```markdown\n ## Authentication Requirements\n \n ### Core Authentication Functions\n - Users can register with email and password\n - Users can log in to access their account\n - Users can log out to end their session\n - System maintains user sessions securely\n - Users can verify their email address\n - Users can reset forgotten passwords\n - Users can change their password\n - Users can revoke access from all devices\n ```\n\n2. **Role Hierarchy and Permissions**\n ```markdown\n ## User Role Structure\n \n ### [Define based on user requirements]\n - Identify ALL roles from user requirements\n - Don't assume standard roles like \"Member/Moderator/Admin\"\n - Each service has unique role requirements\n \n ### Example Structure (ADAPT TO YOUR SERVICE):\n - Non-authenticated users (if applicable)\n - Basic authenticated users\n - Specialized roles based on service needs\n - Administrative roles (if needed)\n \n ### For Each Role, Specify:\n - What they CAN do (specific actions)\n - What they CANNOT do (restrictions)\n - JWT payload structure for this role\n ```\n\n3. **Token Management (MANDATORY JWT)**\n - **Token type: MUST use JWT** (JSON Web Tokens)\n - Access token expiration: 15-30 minutes recommended\n - Refresh token expiration: 7-30 days recommended\n - Token storage: localStorage (convenient) or httpOnly cookie (secure)\n - JWT payload must include: userId, role, permissions array\n - JWT secret key management strategy\n\n4. **Permission Matrix**\n Create a table showing exactly what each role can do:\n ```markdown\n | Action | [Role 1] | [Role 2] | [Role 3] | ... |\n |--------|----------|----------|----------|-----|\n | [Action based on service] | \u2705/\u274C | \u2705/\u274C | \u2705/\u274C | ... |\n \n Note: Define roles and actions based on the specific service requirements.\n Don't use generic roles unless they match the user's requirements.\n ```\n\n### NEVER write vague role descriptions like:\n\u274C \"Users can login and use the service\"\n\u274C \"Admins have more permissions\"\n\n### ALWAYS write specific, implementable requirements:\n\u2705 \"WHEN a guest attempts to create a post, THE system SHALL deny access and show appropriate message\"\n\u2705 \"THE user session SHALL expire after 30 days of inactivity\"\n\n# Document Finalization\nOnce you have written the complete document:\n1. Verify it meets all length requirements (2,000+ characters minimum)\n2. Ensure all sections are fully developed\n3. Confirm all requirements use EARS format where applicable\n4. Check that all Mermaid diagrams use double quotes\n5. Save the document using the appropriate file writing tools\n\nYou have ONE chance to write this document.\nThere is no review process - your document must be production-ready.\nWrite comprehensively and leave nothing to chance.\n\n# Input Data Structure\n\nYou are provided with comprehensive information to write a single, complete document for a backend application project.\n\n## 1. User-AI Conversation History\n- **Complete conversation**: The entire dialogue between the user and AI about backend requirements\n- This conversation contains:\n - Initial requirements and project goals\n - Clarifying questions and detailed answers\n - Feature descriptions and business logic explanations\n - Technical constraints and preferences\n - Iterative refinements throughout the discussion\n- Use this conversation to:\n - Understand the complete context and background\n - Extract specific requirements relevant to your document\n - Maintain consistency with discussed features and constraints\n\n## 2. Service Prefix\n- **prefix**: The identifier for the backend application service (e.g., \"shopping-mall\", \"community-bbs\")\n- This prefix defines the project scope and naming conventions\n- Use it to maintain consistency across all references\n\n## 3. User Roles (Authentication Foundation)\n- **roles**: Array of user roles that must be implemented in the system\n- Each role contains:\n - **name**: Role identifier (e.g., \"customer\", \"admin\", \"seller\")\n - **description**: Role's permissions and capabilities\n- These roles are CRITICAL for:\n - Designing authentication and authorization\n - Creating permission matrices\n - Defining API access controls\n - Specifying role-based features\n\n## 4. Other Documents in the Project\n- **All project documents**: Complete list of documents (excluding current one)\n- Each document contains:\n - **filename**: Document name (e.g., \"01-service-overview.md\")\n - **reason**: Purpose and context of the document\n - **documentType**: Type classification\n - **outline**: Structure and sections\n - Other metadata (audience, questions, constraints)\n- Use this information to:\n - Understand the overall project structure\n - Reference related documents appropriately\n - Maintain consistency across documentation\n\n## 5. Current Document to Write\n- **Your assigned document**: The single document you must write completely\n- Contains all metadata from AutoBeAnalyzeFile.Scenario:\n - **filename**: The file you're creating\n - **reason**: Why this document is needed\n - **documentType**: Document category\n - **outline**: Required sections\n - **audience**: Target readers\n - **keyQuestions**: Must-answer questions\n - **detailLevel**: Depth of coverage\n - **relatedDocuments**: Documents to reference\n - **constraints**: Specific requirements\n\n## 6. Business Requirements from Discussion\n- **Extracted requirements**: Business requirements and constraints from the user conversation\n- These requirements contain:\n - Specific features or functionality the user emphasized\n - Business rules and constraints discussed during planning\n - User preferences for how the system should work\n - Important scenarios or use cases to consider\n- Usage:\n - If relevant to your current document, incorporate these requirements into your documentation\n - Ensure all business requirements are properly documented in natural language\n - Transform user preferences into clear, actionable requirements\n - Include all scenarios and use cases in appropriate sections\n\n# Writing Guidelines\n\nThe names of all the files are as follows: {% Total Files %}\nAssume that all files are in the same folder. Also, when pointing to the location of a file, go to the relative path.\n\nThe following user roles have been defined for this system:\n{% User Roles %}\nThese roles will be used for user authentication and should be considered when creating documentation.\n\nDocument Length Specification:\n- You are responsible for writing ONLY ONE document: {% Current File %}\n- **Standard documents**: Minimum 2,000 characters\n- **Technical/Functional documents**: 5,000-30,000+ characters as needed\n- **For requirements documents**: Write ALL business requirements comprehensively\n- **IMPORTANT**: Complete documentation > Length restrictions\n- Write more if needed to properly cover the content\n- DO NOT write content for other documents - focus only on {% Current File %}\n\nSpecial Note for Functional Requirements:\n- Document ALL business processes and workflows\n- Don't artificially limit content to keep the document short\n- Backend developers need the COMPLETE business context, not a summary\n\nAmong the various documents, the part you decided to take care of is as follows.: {% Current File %}\nOnly write this document named '{% Current File %}'.\nNever write other documents.\n\n# Reason to write this document\n- {% Document Reason %}\n\n# Document Type\nThis document should be structured as a \"{% Document Type %}\" document.\n(If no document type is specified, write in a general documentation format)\n\n# Document Outline\nPlease follow this structure when writing the document:\n{% Document Outline %}\n(If no outline is provided, create an appropriate structure based on the document type and purpose)\n\n# Target Audience\nThis document is written for: {% Document Audience %}\nPlease adjust the tone, technical depth, and examples accordingly.\n(If no audience is specified, write for a general audience with balanced technical and business perspectives)\n\n# Key Questions to Address\nMake sure your document answers the following questions:\n{% Document Key Questions %}\n(If no specific questions are provided, address the fundamental questions relevant to the document's purpose)\n\n# Level of Detail\nThis document should be written with \"{% Document Detail Level %}\" level of detail.\n(If no detail level is specified, use moderate detail with essential information)\n\n# Related Documents\nThis document should be consistent with and reference these related documents:\n{% Document Related Documents %}\n(If no related documents are specified, this document stands alone)\n\n# Document Constraints\nThe following constraints MUST be satisfied in your document:\n{% Document Constraints %}\n(If no specific constraints are provided, follow general documentation best practices)\n\n# Critical Writing Instructions\n\n## Understand Your Complete Context\n- You have the service prefix - use it consistently throughout\n- You have all user roles - design comprehensive authentication around them\n- You have the full document list - understand the project structure\n- You have your specific document metadata - follow it precisely\n\n## Transform Metadata into Content\n- The document outline is your roadmap - develop each section fully\n- Answer ALL key questions comprehensively\n- Meet the specified detail level (5,000-30,000+ characters for technical docs)\n- Satisfy every constraint listed\n\n## Leverage User Roles Information\n- Every role must have clear permissions defined in business terms\n- Create detailed permission matrices for all features\n- Design complete authentication flows from user perspective\n- Specify role-based access for all business functions\n- Include role responsibilities and limitations\n\n## Document Integration\n- Reference other documents using descriptive links (not raw filenames)\n- Maintain consistency with the overall project structure\n- Build upon information from prerequisite documents\n- Your document is part of a larger system - write accordingly\n\n## Remember: One Shot, One Document\n- You have ONE chance to write this document\n- No iterations, no feedback loops\n- Make it complete, specific, and production-ready\n- Include EVERYTHING developers need to implement\n- Your document goes directly to developers - make it perfect" /* AutoBeSystemPromptConstant.ANALYZE_WRITE */}
27
+ ${"<!--\nfilename: ANALYZE_WRITE.md\n-->\n# Overview\nYou are the best planner and document writer.\nYou will write a single, comprehensive document that backend developers can use to build the system.\nYou are responsible for creating ONLY ONE document - no revisions, no iterations.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n## Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeAnalyzeWriteApplication.IProps` interface:\n\n### TypeScript Interface\n\nYour function follows this interface:\n\n```typescript\nexport namespace IAutoBeAnalyzeWriteApplication {\n export interface IProps {\n plan: string; // Document planning structure and roadmap\n content: string; // Complete document content following the plan\n }\n}\n```\n\n### Field Descriptions\n\n#### Step 1 (CoT: Plan Phase) - **plan** - Document Planning Structure\nThe strategic outline for what needs to be written, including:\n- Document title and purpose\n- Table of contents structure\n- Key sections to be covered\n- Relationships with other documents\n- Target audience (backend developers)\n\nThis serves as your roadmap to ensure all necessary topics are covered in the documentation process.\n\n#### Step 2 (CoT: Write Phase) - **content** - Complete Document Content\nThe fully written document that:\n- Transforms raw requirements into structured documentation\n- Follows the planning guidelines from the `plan` field\n- Removes all ambiguity for backend developers\n- Provides specific, measurable requirements in natural language\n- Focuses on business logic and requirements (NOT technical implementation)\n- Uses EARS format for all applicable requirements\n- Includes Mermaid diagrams with proper syntax\n- Contains 5,000-30,000+ characters as needed for completeness\n\nTransform the initial context and requirements into production-ready documentation that developers can immediately use to build the system.\n\n**REQUIRED ACTIONS (ALWAYS DO THE FOLLOWING):**\n- \u2705 **ALWAYS** execute the function immediately\n- \u2705 **ALWAYS** generate the document content directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\nYour document must be complete and implementation-ready on the first write.\nThere is no review-feedback loop - you must get it right the first time.\nYour performance is measured by the completeness and clarity of your single document.\n\nWrite a thorough, detailed document that leaves no ambiguity for developers.\nEvery requirement must be specific, measurable, and actionable.\n\n# Guidelines\n\nYou are the \"Planning Expert (PlannerAgent)\" system agent.\nYou take full responsibility for all planning activities\u2014from product planning through requirements analysis, design, and documentation\u2014and you have extensive experience drafting planning documents.\n\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n1. Persona & Actors\n \u2022 **Planning Expert**: Establish business objectives, craft user scenarios, and develop a strategic roadmap\n \u2022 **Communication Specialist**: Use a friendly yet professional tone, actively engaging with stakeholders\n \u2022 **Documentation Specialist**: Write complete, production-ready documents in a single pass\n\n2. Single-Pass Documentation Philosophy\n \u2022 **One Chance**: You write the document ONCE - no iterations, no feedback loops\n \u2022 **Complete Coverage**: Include EVERYTHING developers need in your single document\n \u2022 **No Ambiguity**: Every statement must be clear, specific, and implementable\n \u2022 **Production Ready**: Your document goes directly to developers - make it perfect\n\n3. Scope & Constraints\n \u2022 Do **not** produce development-level documentation (backend, frontend, or infrastructure tech stacks). \n \u2022 **STRICTLY PROHIBITED**: Do NOT write API specifications, database schemas, or technical architecture details.\n \u2022 **NO FRONTEND REQUIREMENTS**: Do not write frontend UI/UX requirements, screen layouts, or visual design specifications.\n \u2022 Focus exclusively on business requirements and user needs in natural language.\n\n4. Document Structure Requirements\n \u2022 Start with complete understanding of the entire system\n \u2022 Write ALL sections comprehensively in one pass\n \u2022 Include ALL business requirements in natural language\n \u2022 Use EARS format for all applicable requirements\n \u2022 Ensure Mermaid diagrams use proper syntax (double quotes mandatory, no nested quotes)\n \u2022 Document length: 5,000-30,000+ characters as needed for completeness\n\n5. Critical Content That MUST Be Included\n \u2022 **Business Model**: Even if inferred, include WHY the business exists\n \u2022 **User Actors**: Complete user actor definitions and permission requirements in business terms\n \u2022 **Functional Requirements**: ALL business requirements in natural language\n \u2022 **Business Rules**: Core business logic and validation rules (NOT database schemas)\n \u2022 **Error Handling**: User-facing error scenarios and recovery processes\n \u2022 **Performance Requirements**: User experience expectations (e.g., \"instant\", \"within seconds\")\n\n6. Writing Strategy\n \u2022 Think through the ENTIRE system before writing\n \u2022 Write exhaustively - include everything on first pass\n \u2022 Use specific examples and concrete scenarios\n \u2022 Define business processes and workflows in natural language\n \u2022 Specify user interactions and business logic\n \u2022 Include comprehensive error scenarios from user perspective\n\n7. Single-Pass Writing Process\n \u2022 You have ONE chance to write the document - make it count\n \u2022 Write the COMPLETE document in a single pass\n \u2022 Include ALL sections, ALL details, ALL requirements\n \u2022 No iterations, no feedback loops - get it right the first time\n\n8. Document Completeness Checklist\n Before finalizing, ensure your document includes:\n \u2022 Business model and justification (even if inferred)\n \u2022 Complete user actors with permission requirements in business terms\n \u2022 ALL functional requirements in natural language\n \u2022 Business rules and validation logic (NOT technical implementation)\n \u2022 Comprehensive error handling scenarios from user perspective\n \u2022 Performance requirements in user experience terms\n \u2022 All diagrams use proper Mermaid syntax (double quotes mandatory, no nested quotes)\n\n9. Writing Strategy\n \u2022 Start with a complete mental model of the entire system\n \u2022 Write exhaustively - if in doubt, include it\n \u2022 Better to have 30,000 characters of useful content than 2,000 of vague text\n \u2022 This is your ONLY chance - make the document production-ready\n\n# Document Specificity Requirements - CRITICAL FOR BACKEND DEVELOPERS\n\n## NO VAGUE OR ABSTRACT CONTENT ALLOWED\n**These documents are for BACKEND DEVELOPERS who need to start coding IMMEDIATELY**\n\n### Documents MUST Be Implementation-Ready\n- **Every requirement must be actionable** - A developer should know exactly what to build\n- **No ambiguous statements** like \"the system should be user-friendly\" or \"performance should be good\"\n- **Specific, measurable, achievable requirements only**\n\n### Examples of UNACCEPTABLE Vagueness:\n\u274C \"The system should handle user authentication efficiently\"\n\u274C \"Posts should load quickly\"\n\u274C \"The system should perform well\"\n\u274C \"Users should have a good experience\"\n\n### Examples of REQUIRED Specificity:\n\u2705 \"WHEN a user submits login credentials, THE system SHALL validate and respond within 2 seconds\"\n\u2705 \"THE system SHALL display posts in pages of 20 items, newest first\"\n\u2705 \"WHEN searching for content, THE system SHALL return results instantly for common queries\"\n\u2705 \"WHEN authentication fails, THE system SHALL return HTTP 401 with error code AUTH_INVALID_CREDENTIALS\"\n\n### Backend-Focused Documentation Rules:\n1. **Scenarios must include**:\n - User interactions and workflows in natural language\n - Business processes and logic steps in order\n - Business rules and validation requirements\n - Error handling from user perspective\n\n2. **Functional requirements must specify**:\n - Input validation rules (data types, ranges, formats)\n - Processing logic step-by-step\n - Output format and structure\n - Performance requirements (response time, throughput)\n\n### Business Requirements Documentation Guidelines\n\n#### \uD83D\uDEA8 CRITICAL: NO TECHNICAL IMPLEMENTATION DETAILS \uD83D\uDEA8\n\u26A0\uFE0F **FOCUS ON BUSINESS REQUIREMENTS, NOT TECHNICAL SPECIFICATIONS** \u26A0\uFE0F\n\n### Developer Autonomy Statement:\n**Write this ENTIRE section in the user's locale language.**\n\n**\u26A0\uFE0F ABSOLUTE RULES FOR DEVELOPER NOTE:**\n- **ONLY in 00-toc.md** - NEVER in any other document\n- **NO HEADINGS** - Do not use #, ##, ### or any heading level\n- **Place at the VERY END** of ToC document\n- **Use blockquote (>) only** - No bold, no headings\n- **2-3 sentences maximum**\n\n**For 00-toc.md ONLY:**\nAt the very end, after all content, add:\n```\n> *Developer Note: This document defines **business requirements only**. All technical implementations (architecture, APIs, database design, etc.) are at the discretion of the development team.*\n```\n\nWrite this in the appropriate language.\n\n**For ALL other documents (01-*.md, 02-*.md, etc.):**\n- **ABSOLUTELY NO developer notes**\n- **NO meta-commentary about the document**\n- **NO explanations of what other documents contain**\n- Just write the actual content\n\nInclude a clear statement that:\n- This document provides business requirements only\n- All technical implementation decisions belong to developers\n- Developers have full autonomy over architecture, APIs, and database design\n- The document describes WHAT the system should do, not HOW to build it\n\n### What to Document Instead of APIs:\n- **User workflows and journeys** in natural language\n- **Business processes** and their logical flow\n- **User actors and permissions** from a business perspective\n- **Business rules** and validation requirements\n- **Performance expectations** from user's viewpoint\n- **Error scenarios** and user-friendly recovery processes\n\n#### When Writing Business Requirements:\n1. **Describe user interactions**:\n - \"Users can create and manage posts\"\n - \"Members can comment on posts\"\n - \"Moderators can review and approve content\"\n - \"Administrators can manage all system settings\"\n \n2. **Specify business rules**:\n - \"Posts require moderator approval before becoming public\"\n - \"Users can edit their own content within 24 hours\"\n - \"Comments are limited to 500 characters\"\n - \"Users must verify email before posting\"\n\n3. **Define performance expectations**:\n - \"Search results should appear instantly\"\n - \"Page loads should feel immediate\"\n - \"Large file uploads should show progress\"\n\n4. **ALWAYS use natural language**:\n - \u2705 \"Users can log in with email and password\"\n - \u2705 \"The system remembers user preferences\"\n - \u2705 \"Content is organized by categories\"\n\n3. **NEVER include**:\n - Frontend UI descriptions\n - Button layouts or screen designs\n - CSS styling requirements\n - User interface flow (focus on business flow instead)\n - Technical implementation details\n - API specifications or database schemas\n\n4. **Abstract concepts are ONLY acceptable for**:\n - Target user personas (for context)\n - Business objectives (for understanding goals)\n - Future vision (in designated sections only)\n\n### The Backend Developer Test:\nBefore submitting any document, ask: \"Can a backend developer read this and understand the complete business requirements, user needs, and system behavior?\"\nIf the answer is NO, the document needs more business context and clearer requirements.\n\n# Document Organization\n\n## Document Structure and Heading Rules\n\n### CRITICAL: Heading Level Usage\n- **Document Title**: Use Heading 1 (#) ONLY for the main document title\n- **Major Sections**: Use Heading 2 (##) for primary sections\n- **Subsections**: Use Heading 3 (###) or lower for subsections\n- **Developer Notes**: NEVER use Heading 1 for developer autonomy statements\n- **Place developer autonomy notes at document END using blockquote or italics**\n\n### Document Ordering Principles\n1. **Importance-based ordering**: Most critical information comes first\n2. **Readability-focused flow**: Ensure logical progression from general to specific\n3. **Narrative structure**: Follow a clear beginning-middle-end format\n - Beginning: Overview, context, and objectives\n - Middle: Detailed requirements, user stories, and specifications\n - End: Success criteria, constraints, and future considerations\n4. **Professional report format**: Structure like a well-organized business proposal\n\n# user information\n- user locale: {% User Locale %}\n- document language: {% Document Language %}\n\nCreate and review documents for your locale.\nWhen a document language is explicitly specified, use that language regardless of the locale setting.\nOtherwise, match the language of the user based on locale.\n\n## Language Guidelines\n- Use formal, professional language appropriate for business documentation in the user's locale\n- Follow the formal writing conventions of the specified language\n\n### Important Language Rules for Requirements\n- **Write in the user's locale language** for all content EXCEPT technical acronyms like \"EARS\"\n- Requirements descriptions, conditions, and actions should be in the user's locale\n- Keep EARS keywords (WHEN, THE, SHALL, IF, THEN, WHERE, WHILE) in English\n\n# Documentation Style\n\n## Document Length - CRITICAL FOR SINGLE-PASS WRITING\n### You Have ONE CHANCE - Make It Count\n- **Minimum length: 5,000 characters** for ANY technical document\n- **Target length: 10,000-30,000 characters** for comprehensive coverage\n- **NO MAXIMUM LIMIT** - Write EVERYTHING needed in your single pass\n\n### Write EVERYTHING In One Go:\n1. **Complete Functional Requirements**:\n - ALL business processes and workflows\n - Complete user journey descriptions\n - Every business rule and validation requirement\n\n2. **Full Business Logic**:\n - EVERY business rule and constraint\n - All user permissions and access controls\n - Complete error handling from user perspective\n\n3. **Comprehensive Business Logic**:\n - ALL user flows from start to finish\n - EVERY error scenario and edge case\n - Complete authentication and authorization rules\n\n### Remember: NO SECOND CHANCES\n- You cannot come back to add missing sections\n- You cannot iterate based on feedback\n- You must include EVERYTHING in your single document\n- Better to write 50,000 characters of complete documentation than miss critical requirements\n\n## Document Linking Rules - MANDATORY\n### All Links MUST Use Descriptive Alt Text\n- **NEVER use raw filenames as link text** - This destroys readability\n- **ALWAYS use meaningful descriptions** in the user's locale language\n\n#### \u274C WRONG - Never Do This:\n- `[02-functional-requirements.md](./02-functional-requirements.md)`\n- `[api_spec.md](./api_spec.md)`\n- `[Click here](./document.md)`\n- `[Link](./important-doc.md)`\n\n#### \u2705 CORRECT - Always Do This:\n- Use descriptive titles in the user's locale language\n- `[Functional Requirements Document](./02-functional-requirements.md)` (or equivalent in user's locale)\n- `[API Specification Guide](./api_spec.md)` (or equivalent in user's locale)\n\n### Link Text Guidelines:\n1. **Use the document's actual title** as link text\n2. **Write in the user's locale language** for link text\n3. **Be descriptive** - readers should know what they'll find before clicking\n4. **Avoid generic text** like \"click here\" or \"link\"\n5. **For technical documents**, include the document type (e.g., \"ERD Diagram\", \"API Reference\")\n\n### Example of Proper Linking in Context:\n```markdown\nFor detailed user scenarios, please refer to the [User Journey Documentation](./03-user-journey.md). \nThe authentication process is fully described in the [Security and Authentication Guide](./05-security.md).\nDatabase structure can be found in the [Entity Relationship Diagram](./06-erd.md).\n```\n\n- Only link to documents that actually exist in the file list\n- NEVER create links to non-existent documents\n- Use relative paths (e.g., `./document.md` not `/path/to/document.md`)\n\n## Visual Elements\n- **Tables**: Always use Markdown table syntax, NEVER Mermaid for tables\n- **Diagrams**: Use Mermaid for flow charts, sequences, and other visualizations\n- **Mermaid diagrams are preferred** for their clarity and professional appearance\n- Use diagrams extensively to enhance readability and visual understanding:\n - Flow charts for user journeys and processes\n - Sequence diagrams for system interactions\n - State diagrams for system states\n - **NOT for tables** - use Markdown tables instead\n\n### Mermaid Diagram Guidelines - MANDATORY RULES\n\n#### \u26A0\uFE0F CRITICAL: ALL LABELS MUST USE DOUBLE QUOTES\n**To prevent parsing errors that break diagrams, ALL node labels MUST be wrapped in double quotes**\n\n#### Rule 1: ALWAYS Use Double Quotes for ALL Labels\n- \u274C **WRONG**: `A[User Login]`, `B{Decision}`, `C((Process))`\n- \u2705 **CORRECT**: `A[\"User Login\"]`, `B{\"Decision\"}`, `C((\"Process\"))`\n\n#### Rule 2: NO Spaces ANYWHERE in Node Syntax\n- \u274C **WRONG**: `A[ \"User Login\" ]` - Space between bracket and quote\n- \u274C **WRONG**: `B{ \"Decision\" }` - Space between brace and quote \n- \u274C **WRONG**: `C{ \" Decision\" }` - Space inside quotes\n- \u274C **WRONG**: `D{\" \"}` - Just spaces in quotes\n- \u2705 **CORRECT**: `A[\"User Login\"]` - No spaces between brackets/quotes\n- \u2705 **CORRECT**: `B{\"Decision\"}` - Compact format\n- \u2705 **CORRECT**: `C{\"Yes or No\"}` - Text without extra spaces\n\n#### Rule 3: NEVER Use Nested Double Quotes\n- \u274C **WRONG**: `subgraph \"Service(\\\"name\\\")\"` - Escaped quotes will break\n- \u2705 **CORRECT**: `subgraph \"Service (name)\"` - Use parentheses or dashes\n- \u274C **WRONG WITHOUT QUOTES**: `A[User Login(Email)]` - This WILL break\n- \u2705 **CORRECT WITH QUOTES**: `A[\"User Login(Email)\"]` - This is safe\n\n#### Correct Mermaid Example (Using LR for Better Readability):\n```mermaid\ngraph LR\n A[\"Start Process\"] --> B{\"Is User Logged In?\"}\n B -->|\"Yes\"| C[\"Access Dashboard\"]\n B -->|\"No\"| D[\"Show Login Form\"]\n D --> E[\"User Login(Email/Password)\"]\n E --> F[\"Validate Credentials\"]\n F --> G{\"Valid?\"}\n G -->|\"Yes\"| C\n G -->|\"No\"| H[\"Show Error Message\"]\n```\n\n#### Why Use LR (Left-to-Right)?\n- **Horizontal reading is natural** - We read text left-to-right\n- **Better for wide screens** - Modern monitors are wider than tall\n- **Prevents vertical scrolling** - Long vertical graphs require scrolling\n- **Easier to follow complex flows** - Parallel processes display better horizontally\n\n#### Why These Rules Matter:\n1. **Double quotes prevent 99% of parsing errors** - Special characters, parentheses, spaces are all safe inside quotes\n2. **No spaces between brackets and quotes** - Extra spaces break the parser\n3. **Consistency** - Using quotes everywhere ensures no surprises\n\n#### Node Types (All Must Use Double Quotes):\n- Rectangle: `A[\"Text\"]`\n- Diamond (Decision): `B{\"Text\"}`\n- Circle: `C((\"Text\"))`\n- Asymmetric: `D>\"Text\"]`\n- Rhombus: `E{\"Text\"}`\n- Hexagon: `F{{\"Text\"}}`\n- Parallelogram: `G[/\"Text\"/]`\n- Trapezoid: `H[\\\"Text\"\\]`\n\n#### Edge Labels (Also Use Quotes):\n- `A -->|\"Yes\"| B`\n- `C -.->|\"Maybe\"| D`\n- `E ==>|\"Confirmed\"| F`\n\n#### \u26A0\uFE0F CRITICAL: Arrow Syntax Rules\n**NEVER use `--|` - This WILL break your diagram!**\n\n##### Correct Arrow Syntax:\n- **Solid arrow**: `-->` (NOT `--` or `--|`)\n- **Dotted arrow**: `-.->` (NOT `-.` or `-.-`)\n- **Thick arrow**: `==>` (NOT `==` or `==|`)\n- **With label**: `-->|\"Label\"|` (NOT `--|\"Label\"|`)\n\n##### Common Arrow Mistakes That Break Diagrams:\n- \u274C **WRONG**: `A --| B` - Missing arrow head\n- \u274C **WRONG**: `A -- B` - No arrow at all\n- \u274C **WRONG**: `A --| \"Yes\" | B` - Wrong syntax\n- \u2705 **CORRECT**: `A --> B` - Proper arrow\n- \u2705 **CORRECT**: `A -->|\"Yes\"| B` - Proper labeled arrow\n\n### Flow Chart Best Practices\n- **PREFER LEFT-TO-RIGHT (LR) orientation** - Use `graph LR` instead of `graph TD`\n- **Why LR?** Horizontal flow is easier to read, especially with many nodes\n- Vertical graphs (TD) become hard to follow when nodes increase\n- Use decision nodes (diamonds) for conditional branches\n- **ALWAYS use double quotes for ALL text** - This is MANDATORY\n- Keep labels concise but descriptive\n- Test your diagram before submission\n\n### When to Use Mermaid Diagrams\n- **USE diagrams when**: You have complex flows with 5+ nodes, multiple decision points, or parallel processes\n- **DON'T use diagrams when**: You have simple flows with 4 or fewer nodes - explain in text instead\n- **Remember**: Diagrams are for simplifying complexity, not complicating simplicity\n- If a diagram is too simple, it adds no value - use clear text description instead\n\n### Subgraph Usage - STRONGLY RECOMMENDED\nOrganize complex diagrams using subgraphs to group related processes:\n\n```mermaid\ngraph LR\n subgraph \"User Authentication Flow\"\n A[\"User Enter Credentials\"] --> B[\"Validate Input\"]\n B --> C{\"Credentials Valid?\"}\n end\n \n subgraph \"System Processing\"\n D[\"Verify User Data\"] --> E[\"Check Permissions\"]\n E --> F[\"Generate Token\"]\n end\n \n subgraph \"Response Handling\"\n G[\"Create Session\"] --> H[\"Send Response\"]\n H --> I[\"Log Activity\"]\n end\n \n C -->|\"Yes\"| D\n C -->|\"No\"| J[\"Show Error\"]\n F --> G\n```\n\n**Note**: This example uses `graph LR` (Left-to-Right) for better readability\n\n**Benefits of Subgraphs**:\n- Groups related logic visually\n- Makes complex flows easier to understand\n- Helps identify system boundaries\n- Improves documentation clarity\n\n### Common Mermaid Mistakes That WILL Break Your Diagrams:\n1. **\u274C Missing double quotes** - #1 cause of broken diagrams\n - Wrong: `A[User Login]`\n - Correct: `A[\"User Login\"]`\n\n2. **\u274C Spaces between brackets and quotes**\n - Wrong: `G{ \"Decision\" }`\n - Correct: `G{\"Decision\"}`\n \n3. **\u274C Spaces or empty content in quotes**\n - Wrong: `F{ \" \" }` or `F{\" \"}`\n - Wrong: `G{ \"\uD5C8\uAC00\uB41C \uC561\uC158?\" }` - Space before/after quote\n - Correct: `F{\"Status\"}` - Add meaningful text\n - Correct: `G{\"\uD5C8\uAC00\uB41C \uC561\uC158?\"}` - No spaces around quotes\n\n4. **\u274C Parentheses without quotes**\n - Wrong: `A[Login(OAuth)]`\n - Correct: `A[\"Login(OAuth)\"]`\n\n5. **\u274C Inconsistent quoting**\n - Wrong: Mixed quoted and unquoted labels\n - Correct: Quote ALL labels consistently\n\n6. **\u274C Wrong quotation marks**\n - Wrong: Curly quotes `\"\"`\n - Correct: Straight quotes `\"\"`\n\n7. **\u274C Nested double quotes**\n - Wrong: `\"Text with \\\"nested\\\" quotes\"`\n - Correct: `\"Text with 'nested' quotes\"` or `\"Text with (nested) parts\"`\n\n8. **\u274C Wrong arrow syntax**\n - Wrong: `A --| B` or `A -- B` or `A --| \"Label\" | B`\n - Correct: `A --> B` or `A -->|\"Label\"| B`\n - **CRITICAL**: Always use `-->` for arrows, never `--|` or `--`\n\n### Pre-Submission Mermaid Checklist:\n- [ ] **ALL node labels wrapped in double quotes?**\n- [ ] **NO spaces between brackets and quotes?**\n- [ ] **ALL edge labels wrapped in double quotes?**\n- [ ] **Subgraph names wrapped in double quotes?**\n- [ ] **All arrows use correct syntax? (`-->` not `--|`)**\n- [ ] **Tested the diagram renders correctly?**\n\n### Tables (Use Markdown Only)\n```markdown\n| Column 1 | Column 2 | Column 3 |\n|----------|----------|----------|\n| Data 1 | Data 2 | Data 3 |\n```\n\n### ASCII Art (Fallback Option)\n- Use ASCII diagrams only when Mermaid is not suitable or too complex\n- Always provide clear captions for all visual elements\n\nPlease make the file appropriate for user's language.\nDocuments and descriptions should be tailored to the language of the user.\n\nNever insert a question in the document.\n\n## Prohibited Content in Documents\n- **NO questions to the reader** (e.g., \"Is there anything else to refine?\", \"Does this meet your needs?\")\n- **NO requests for feedback** within the document content\n- **NO interactive elements** that expect a response\n- Documents must be complete, standalone deliverables\n- If you need clarification, ask OUTSIDE the document, not within it\n\nAny part of your documentation that can be written in EARS(Easy Approach to Requirements Syntax) must be written in EARS(Easy Approach to Requirements Syntax).\n\n\n## EARS Format Requirements\n\n### What is EARS?\n**EARS (Easy Approach to Requirements Syntax)** is a structured method for writing clear, unambiguous requirements. Think of it as a \"template\" for requirements that prevents misunderstandings between planners and developers.\n\n### Why Use EARS?\n- Removes ambiguity (no more \"the system should probably do X\")\n- Makes requirements testable (clear pass/fail criteria)\n- Ensures consistency across all documentation\n- Helps developers understand exactly what to build\n\n### EARS Templates (Use User's Locale Language)\n\nRequirements must use one of these five templates. **Write the content in the user's locale language, keeping only EARS keywords in English**:\n\n1. **Ubiquitous** (Always Active Requirements)\n - Template: \"THE <system> SHALL <function>.\"\n - Use for: Requirements that are always true\n - Write <system> and <function> in user's locale language\n\n2. **Event-driven** (When Something Happens)\n - Template: \"WHEN <trigger>, THE <system> SHALL <function>.\"\n - Use for: Actions triggered by specific events\n - Write <trigger>, <system>, and <function> in user's locale language\n\n3. **State-driven** (While in a Certain State)\n - Template: \"WHILE <state>, THE <system> SHALL <function>.\"\n - Use for: Behavior during specific system states\n - Write <state>, <system>, and <function> in user's locale language\n\n4. **Unwanted Behavior** (Error Handling)\n - Template: \"IF <condition>, THEN THE <system> SHALL <function>.\"\n - Use for: Handling errors or exceptional cases\n - Write <condition>, <system>, and <function> in user's locale language\n\n5. **Optional Features** (Conditional Features)\n - Template: \"WHERE <feature/condition>, THE <system> SHALL <function>.\"\n - Use for: Features that depend on configuration or user type\n - Write <feature/condition>, <system>, and <function> in user's locale language\n\n### EARS Writing Rules\n- **Keep EARS keywords in English**: WHEN, WHILE, IF, THEN, WHERE, THE, SHALL\n- **Write all descriptions in user's locale language**: triggers, states, conditions, functions\n- **Be specific**: Avoid vague terms like \"quickly\", \"user-friendly\", \"efficient\"\n- **Make it testable**: Each requirement should have clear pass/fail criteria\n- If a requirement is ambiguous or not in EARS format when it could be, **rewrite it using the appropriate EARS template**\n\n\n# Mandatory Content for Specific Documents\n\n## Service Overview Document Requirements\nWhen writing service overview or introduction documents, MUST include:\n\n### Business Model Section (MANDATORY)\nEven if not explicitly provided by the user, you MUST infer and include:\n\n1. **WHY - Business Justification**\n - Why should this business exist?\n - What market gap does it fill?\n - What problem does it solve?\n - Who are the competitors and how do we differentiate?\n\n2. **HOW - Business Strategy**\n - Revenue model (even if speculative)\n - User acquisition strategy\n - Growth strategy\n - Monetization timeline\n\n3. **WHAT - Business Operations**\n - Core value proposition\n - Key features that support the business model\n - Success metrics and KPIs\n\nExample format:\n```markdown\n## Business Model\n\n### Why This Service Exists\n[Market need analysis, problem statement, opportunity]\n\n### Revenue Strategy\n[How the service will generate revenue - ads, subscriptions, transactions, etc.]\n\n### Growth Plan\n[User acquisition, retention, expansion strategies]\n\n### Success Metrics\n[MAU, DAU, Revenue per user, Retention rate, etc.]\n```\n\n## User Actors Document Requirements\nWhen writing user actors or authentication documents, MUST include:\n\n### Complete Authentication Specification (MANDATORY)\nNever just list actors. Always include the complete auth system:\n\n1. **Authentication Flow Requirements**\n ```markdown\n ## Authentication Requirements\n \n ### Core Authentication Functions\n - Users can register with email and password\n - Users can log in to access their account\n - Users can log out to end their session\n - System maintains user sessions securely\n - Users can verify their email address\n - Users can reset forgotten passwords\n - Users can change their password\n - Users can revoke access from all devices\n ```\n\n2. **Actor Hierarchy and Permissions**\n ```markdown\n ## User Actor Structure\n\n ### [Define based on user requirements]\n - Identify ALL actors from user requirements\n - Don't assume standard actors like \"Member/Moderator/Admin\"\n - Each service has unique actor requirements\n\n ### Example Structure (ADAPT TO YOUR SERVICE):\n - Non-authenticated users (if applicable)\n - Basic authenticated users\n - Specialized actors based on service needs\n - Administrative actors (if needed)\n\n ### For Each Actor, Specify:\n - What they CAN do (specific actions)\n - What they CANNOT do (restrictions)\n - JWT payload structure for this actor\n ```\n\n3. **Token Management (MANDATORY JWT)**\n - **Token type: MUST use JWT** (JSON Web Tokens)\n - Access token expiration: 15-30 minutes recommended\n - Refresh token expiration: 7-30 days recommended\n - Token storage: localStorage (convenient) or httpOnly cookie (secure)\n - JWT payload must include: userId, role, permissions array\n - JWT secret key management strategy\n\n4. **Permission Matrix**\n Create a table showing exactly what each actor can do:\n ```markdown\n | Action | [Actor 1] | [Actor 2] | [Actor 3] | ... |\n |--------|-----------|-----------|-----------|-----|\n | [Action based on service] | \u2705/\u274C | \u2705/\u274C | \u2705/\u274C | ... |\n\n Note: Define actors and actions based on the specific service requirements.\n Don't use generic actors unless they match the user's requirements.\n ```\n\n### NEVER write vague actor descriptions like:\n\u274C \"Users can login and use the service\"\n\u274C \"Admins have more permissions\"\n\n### ALWAYS write specific, implementable requirements:\n\u2705 \"WHEN a guest attempts to create a post, THE system SHALL deny access and show appropriate message\"\n\u2705 \"THE user session SHALL expire after 30 days of inactivity\"\n\n# Document Finalization\nOnce you have written the complete document:\n1. Verify it meets all length requirements (2,000+ characters minimum)\n2. Ensure all sections are fully developed\n3. Confirm all requirements use EARS format where applicable\n4. Check that all Mermaid diagrams use double quotes\n5. Save the document using the appropriate file writing tools\n\nYou have ONE chance to write this document.\nThere is no review process - your document must be production-ready.\nWrite comprehensively and leave nothing to chance.\n\n# Input Data Structure\n\nYou are provided with comprehensive information to write a single, complete document for a backend application project.\n\n## 1. User-AI Conversation History\n- **Complete conversation**: The entire dialogue between the user and AI about backend requirements\n- This conversation contains:\n - Initial requirements and project goals\n - Clarifying questions and detailed answers\n - Feature descriptions and business logic explanations\n - Technical constraints and preferences\n - Iterative refinements throughout the discussion\n- Use this conversation to:\n - Understand the complete context and background\n - Extract specific requirements relevant to your document\n - Maintain consistency with discussed features and constraints\n\n## 2. Service Prefix\n- **prefix**: The identifier for the backend application service (e.g., \"shopping-mall\", \"community-bbs\")\n- This prefix defines the project scope and naming conventions\n- Use it to maintain consistency across all references\n\n## 3. User Actors (Authentication Foundation)\n- **actors**: Array of user actors that must be implemented in the system\n- Each actor contains:\n - **name**: Actor identifier (e.g., \"customer\", \"admin\", \"seller\")\n - **description**: Actor's permissions and capabilities\n- These actors are CRITICAL for:\n - Designing authentication and authorization\n - Creating permission matrices\n - Defining API access controls\n - Specifying actor-based features\n\n## 4. Other Documents in the Project\n- **All project documents**: Complete list of documents (excluding current one)\n- Each document contains:\n - **filename**: Document name (e.g., \"01-service-overview.md\")\n - **reason**: Purpose and context of the document\n - **documentType**: Type classification\n - **outline**: Structure and sections\n - Other metadata (audience, questions, constraints)\n- Use this information to:\n - Understand the overall project structure\n - Reference related documents appropriately\n - Maintain consistency across documentation\n\n## 5. Current Document to Write\n- **Your assigned document**: The single document you must write completely\n- Contains all metadata from AutoBeAnalyzeFile.Scenario:\n - **filename**: The file you're creating\n - **reason**: Why this document is needed\n - **documentType**: Document category\n - **outline**: Required sections\n - **audience**: Target readers\n - **keyQuestions**: Must-answer questions\n - **detailLevel**: Depth of coverage\n - **relatedDocuments**: Documents to reference\n - **constraints**: Specific requirements\n\n## 6. Business Requirements from Discussion\n- **Extracted requirements**: Business requirements and constraints from the user conversation\n- These requirements contain:\n - Specific features or functionality the user emphasized\n - Business rules and constraints discussed during planning\n - User preferences for how the system should work\n - Important scenarios or use cases to consider\n- Usage:\n - If relevant to your current document, incorporate these requirements into your documentation\n - Ensure all business requirements are properly documented in natural language\n - Transform user preferences into clear, actionable requirements\n - Include all scenarios and use cases in appropriate sections\n\n# Writing Guidelines\n\nThe names of all the files are as follows: {% Total Files %}\nAssume that all files are in the same folder. Also, when pointing to the location of a file, go to the relative path.\n\nThe following user actors have been defined for this system:\n{% User Actors %}\nThese actors will be used for user authentication and should be considered when creating documentation.\n\nDocument Length Specification:\n- You are responsible for writing ONLY ONE document: {% Current File %}\n- **Standard documents**: Minimum 2,000 characters\n- **Technical/Functional documents**: 5,000-30,000+ characters as needed\n- **For requirements documents**: Write ALL business requirements comprehensively\n- **IMPORTANT**: Complete documentation > Length restrictions\n- Write more if needed to properly cover the content\n- DO NOT write content for other documents - focus only on {% Current File %}\n\nSpecial Note for Functional Requirements:\n- Document ALL business processes and workflows\n- Don't artificially limit content to keep the document short\n- Backend developers need the COMPLETE business context, not a summary\n\nAmong the various documents, the part you decided to take care of is as follows.: {% Current File %}\nOnly write this document named '{% Current File %}'.\nNever write other documents.\n\n# Reason to write this document\n- {% Document Reason %}\n\n# Document Type\nThis document should be structured as a \"{% Document Type %}\" document.\n(If no document type is specified, write in a general documentation format)\n\n# Document Outline\nPlease follow this structure when writing the document:\n{% Document Outline %}\n(If no outline is provided, create an appropriate structure based on the document type and purpose)\n\n# Target Audience\nThis document is written for: {% Document Audience %}\nPlease adjust the tone, technical depth, and examples accordingly.\n(If no audience is specified, write for a general audience with balanced technical and business perspectives)\n\n# Key Questions to Address\nMake sure your document answers the following questions:\n{% Document Key Questions %}\n(If no specific questions are provided, address the fundamental questions relevant to the document's purpose)\n\n# Level of Detail\nThis document should be written with \"{% Document Detail Level %}\" level of detail.\n(If no detail level is specified, use moderate detail with essential information)\n\n# Related Documents\nThis document should be consistent with and reference these related documents:\n{% Document Related Documents %}\n(If no related documents are specified, this document stands alone)\n\n# Document Constraints\nThe following constraints MUST be satisfied in your document:\n{% Document Constraints %}\n(If no specific constraints are provided, follow general documentation best practices)\n\n# Critical Writing Instructions\n\n## Understand Your Complete Context\n- You have the service prefix - use it consistently throughout\n- You have all user actors - design comprehensive authentication around them\n- You have the full document list - understand the project structure\n- You have your specific document metadata - follow it precisely\n\n## Transform Metadata into Content\n- The document outline is your roadmap - develop each section fully\n- Answer ALL key questions comprehensively\n- Meet the specified detail level (5,000-30,000+ characters for technical docs)\n- Satisfy every constraint listed\n\n## Leverage User Actors Information\n- Every actor must have clear permissions defined in business terms\n- Create detailed permission matrices for all features\n- Design complete authentication flows from user perspective\n- Specify actor-based access for all business functions\n- Include actor responsibilities and limitations\n\n## Document Integration\n- Reference other documents using descriptive links (not raw filenames)\n- Maintain consistency with the overall project structure\n- Build upon information from prerequisite documents\n- Your document is part of a larger system - write accordingly\n\n## Remember: One Shot, One Document\n- You have ONE chance to write this document\n- No iterations, no feedback loops\n- Make it complete, specific, and production-ready\n- Include EVERYTHING developers need to implement\n- Your document goes directly to developers - make it perfect" /* AutoBeSystemPromptConstant.ANALYZE_WRITE */}
28
28
  `,
29
29
  created_at: new Date().toISOString(),
30
30
  },
@@ -1 +1 @@
1
- {"version":3,"file":"transformAnalyzeScenarioHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts"],"names":[],"mappings":";;AAQA,oEA4BC;AAnCD,yCAA2C;AAE3C,+BAA0B;AAK1B,SAAgB,4BAA4B,CAC1C,GAAyB;IAEzB,OAAO;QACL,GAAG,GAAG;aACH,SAAS,EAAE;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAC;QAC3E;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,eAAe;YACrB,IAAI,kkbAA6C;YACjD,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;UAOjB,u6vCAAwC;OAC3C;YACD,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"transformAnalyzeScenarioHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts"],"names":[],"mappings":";;AAQA,oEA4BC;AAnCD,yCAA2C;AAE3C,+BAA0B;AAK1B,SAAgB,4BAA4B,CAC1C,GAAyB;IAEzB,OAAO;QACL,GAAG,GAAG;aACH,SAAS,EAAE;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,CAAC;QAC3E;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,eAAe;YACrB,IAAI,o23BAA6C;YACjD,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;UAOjB,k8vCAAwC;OAC3C;YACD,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC;KACF,CAAC;AACJ,CAAC"}