@autobe/agent 0.25.7 → 0.27.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 (339) hide show
  1. package/lib/AutoBeAgent.d.ts +2 -1
  2. package/lib/AutoBeAgent.js +30 -7
  3. package/lib/AutoBeAgent.js.map +1 -1
  4. package/lib/AutoBeMockAgent.js +13 -12
  5. package/lib/AutoBeMockAgent.js.map +1 -1
  6. package/lib/constants/AutoBeSystemPromptConstant.d.ts +27 -20
  7. package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
  8. package/lib/context/AutoBeContext.d.ts +4 -1
  9. package/lib/context/AutoBeTokenUsage.d.ts +1 -1
  10. package/lib/context/AutoBeTokenUsage.js.map +1 -1
  11. package/lib/factory/AutoBeFunctionCallingMetricFactory.d.ts +7 -0
  12. package/lib/factory/AutoBeFunctionCallingMetricFactory.js +35 -0
  13. package/lib/factory/AutoBeFunctionCallingMetricFactory.js.map +1 -0
  14. package/lib/factory/AutoBeProcessAggregateFactory.d.ts +13 -0
  15. package/lib/factory/AutoBeProcessAggregateFactory.js +100 -0
  16. package/lib/factory/AutoBeProcessAggregateFactory.js.map +1 -0
  17. package/lib/factory/consentFunctionCall.js +3 -0
  18. package/lib/factory/consentFunctionCall.js.map +1 -1
  19. package/lib/factory/createAutoBeContext.d.ts +2 -1
  20. package/lib/factory/createAutoBeContext.js +82 -28
  21. package/lib/factory/createAutoBeContext.js.map +1 -1
  22. package/lib/factory/getCommonPrompt.d.ts +2 -0
  23. package/lib/factory/getCommonPrompt.js +20 -0
  24. package/lib/factory/getCommonPrompt.js.map +1 -0
  25. package/lib/index.mjs +20929 -19874
  26. package/lib/index.mjs.map +1 -1
  27. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
  28. package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
  29. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
  30. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  31. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
  32. package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
  33. package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -1
  34. package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
  35. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +2 -1
  36. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  37. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +75 -74
  38. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  39. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +5 -4
  40. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  41. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
  42. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
  43. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
  44. package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
  45. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
  46. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
  47. package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
  48. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.d.ts +2 -1
  49. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +3 -2
  50. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  51. package/lib/{factory/createAutoBeApplication.d.ts → orchestrate/facade/createAutoBeFacadeController.d.ts} +2 -2
  52. package/lib/{factory/createAutoBeApplication.js → orchestrate/facade/createAutoBeFacadeController.js} +53 -57
  53. package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -0
  54. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplication.js.map +1 -0
  55. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationProps.js.map +1 -0
  56. package/lib/orchestrate/facade/histories/IAutoBeFacadeApplicationResult.js.map +1 -0
  57. package/lib/orchestrate/facade/{transformFacadeStateMessage.d.ts → structures/transformFacadeStateMessage.d.ts} +1 -1
  58. package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js +46 -0
  59. package/lib/orchestrate/facade/structures/transformFacadeStateMessage.js.map +1 -0
  60. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
  61. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
  62. package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
  63. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
  64. package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
  65. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
  66. package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
  67. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +3 -2
  68. package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
  69. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
  70. package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
  71. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
  72. package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
  73. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
  74. package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
  75. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
  76. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
  77. package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
  78. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
  79. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
  80. package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
  81. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
  82. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
  83. package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
  84. package/lib/orchestrate/interface/orchestrateInterface.d.ts +1 -1
  85. package/lib/orchestrate/interface/orchestrateInterface.js +33 -6
  86. package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
  87. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +185 -97
  88. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  89. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +234 -59
  90. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  91. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -4
  92. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  93. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -6
  94. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +4 -4
  95. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
  96. package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
  97. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +4 -3
  98. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  99. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +178 -90
  100. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  101. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +176 -88
  102. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  103. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +6 -5
  104. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
  105. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
  106. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +445 -0
  107. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
  108. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +14 -0
  109. package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +302 -121
  110. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
  111. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +243 -65
  112. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  113. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
  114. package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
  115. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
  116. package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaContentReviewApplication.js} +1 -1
  117. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
  118. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
  119. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
  120. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
  121. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
  122. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js +3 -0
  123. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
  124. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
  125. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
  126. package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
  127. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +65 -24
  128. package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
  129. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
  130. package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
  131. package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
  132. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
  133. package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
  134. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
  135. package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
  136. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
  137. package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
  138. package/lib/orchestrate/prisma/orchestratePrisma.d.ts +1 -1
  139. package/lib/orchestrate/prisma/orchestratePrisma.js +1 -0
  140. package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
  141. package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
  142. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +4 -3
  143. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  144. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2 -1
  145. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  146. package/lib/orchestrate/prisma/orchestratePrismaReview.js +2 -1
  147. package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  148. package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
  149. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +4 -3
  150. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  151. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
  152. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
  153. package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
  154. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
  155. package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
  156. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
  157. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
  158. package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
  159. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
  160. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
  161. package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
  162. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
  163. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
  164. package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
  165. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
  166. package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
  167. package/lib/orchestrate/realize/orchestrateRealize.d.ts +1 -1
  168. package/lib/orchestrate/realize/orchestrateRealize.js +4 -3
  169. package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
  170. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +14 -13
  171. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  172. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +12 -11
  173. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  174. package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
  175. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +46 -24
  176. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  177. package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +64 -51
  178. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
  179. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +2 -1
  180. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  181. package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
  182. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
  183. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
  184. package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
  185. package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
  186. package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
  187. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
  188. package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
  189. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
  190. package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
  191. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
  192. package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
  193. package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
  194. package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
  195. package/lib/orchestrate/realize/utils/replaceImportStatements.js +0 -85
  196. package/lib/orchestrate/realize/utils/replaceImportStatements.js.map +1 -1
  197. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
  198. package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
  199. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
  200. package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
  201. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
  202. package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
  203. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
  204. package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
  205. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
  206. package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
  207. package/lib/orchestrate/test/orchestrateTest.d.ts +1 -1
  208. package/lib/orchestrate/test/orchestrateTest.js +2 -1
  209. package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
  210. package/lib/orchestrate/test/orchestrateTestCorrect.js +5 -1
  211. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  212. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +4 -2
  213. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  214. package/lib/orchestrate/test/orchestrateTestScenario.js +28 -27
  215. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  216. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +4 -3
  217. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  218. package/lib/orchestrate/test/orchestrateTestWrite.js +2 -1
  219. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  220. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
  221. package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
  222. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
  223. package/lib/utils/TokenUsageComputer.d.ts +5 -0
  224. package/lib/utils/TokenUsageComputer.js +29 -0
  225. package/lib/utils/TokenUsageComputer.js.map +1 -0
  226. package/package.json +7 -7
  227. package/src/AutoBeAgent.ts +43 -6
  228. package/src/AutoBeMockAgent.ts +13 -12
  229. package/src/constants/AutoBeSystemPromptConstant.ts +27 -20
  230. package/src/context/AutoBeContext.ts +8 -0
  231. package/src/context/AutoBeTokenUsage.ts +1 -1
  232. package/src/factory/AutoBeFunctionCallingMetricFactory.ts +44 -0
  233. package/src/factory/AutoBeProcessAggregateFactory.ts +141 -0
  234. package/src/factory/consentFunctionCall.ts +4 -0
  235. package/src/factory/createAutoBeContext.ts +101 -37
  236. package/src/factory/getCommonPrompt.ts +25 -0
  237. package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
  238. package/src/orchestrate/analyze/orchestrateAnalyze.ts +2 -1
  239. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +2 -1
  240. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +5 -4
  241. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +3 -2
  242. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
  243. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
  244. package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
  245. package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
  246. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +5 -2
  247. package/src/orchestrate/facade/createAutoBeFacadeController.ts +135 -0
  248. package/src/orchestrate/facade/{transformFacadeStateMessage.ts → structures/transformFacadeStateMessage.ts} +2 -2
  249. package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
  250. package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +1 -0
  251. package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
  252. package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
  253. package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
  254. package/src/orchestrate/interface/orchestrateInterface.ts +47 -16
  255. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +20 -19
  256. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +2 -1
  257. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +7 -6
  258. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +5 -6
  259. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +7 -6
  260. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +25 -24
  261. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +6 -5
  262. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +4 -3
  263. package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +270 -0
  264. package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +89 -76
  265. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +18 -9
  266. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
  267. package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
  268. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
  269. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
  270. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
  271. package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
  272. package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
  273. package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
  274. package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
  275. package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
  276. package/src/orchestrate/prisma/orchestratePrisma.ts +6 -5
  277. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -5
  278. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +2 -1
  279. package/src/orchestrate/prisma/orchestratePrismaReview.ts +2 -1
  280. package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +9 -8
  281. package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
  282. package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
  283. package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
  284. package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
  285. package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
  286. package/src/orchestrate/realize/orchestrateRealize.ts +4 -3
  287. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +11 -10
  288. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +5 -4
  289. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +77 -62
  290. package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +92 -90
  291. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +2 -1
  292. package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
  293. package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
  294. package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
  295. package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
  296. package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
  297. package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
  298. package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
  299. package/src/orchestrate/realize/utils/replaceImportStatements.ts +0 -90
  300. package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
  301. package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
  302. package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
  303. package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
  304. package/src/orchestrate/test/orchestrateTest.ts +3 -2
  305. package/src/orchestrate/test/orchestrateTestCorrect.ts +5 -1
  306. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +4 -2
  307. package/src/orchestrate/test/orchestrateTestScenario.ts +32 -31
  308. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +4 -3
  309. package/src/orchestrate/test/orchestrateTestWrite.ts +2 -1
  310. package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
  311. package/src/utils/TokenUsageComputer.ts +35 -0
  312. package/lib/context/IAutoBeFacadeApplication.js.map +0 -1
  313. package/lib/context/IAutoBeFacadeApplicationProps.js.map +0 -1
  314. package/lib/context/IAutoBeFacadeApplicationResult.js.map +0 -1
  315. package/lib/factory/createAutoBeApplication.js.map +0 -1
  316. package/lib/orchestrate/facade/transformFacadeStateMessage.js +0 -46
  317. package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +0 -1
  318. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
  319. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
  320. package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
  321. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
  322. package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
  323. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
  324. package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
  325. package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
  326. package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
  327. package/src/factory/createAutoBeApplication.ts +0 -123
  328. package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
  329. package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
  330. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.d.ts +0 -0
  331. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.js +0 -0
  332. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.d.ts +0 -0
  333. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.js +0 -0
  334. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.d.ts +0 -0
  335. /package/lib/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.js +0 -0
  336. /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
  337. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplication.ts +0 -0
  338. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationProps.ts +0 -0
  339. /package/src/{context → orchestrate/facade/histories}/IAutoBeFacadeApplicationResult.ts +0 -0
@@ -14,14 +14,14 @@ const transformInterfaceGroupHistories = (props) => {
14
14
  id: (0, uuid_1.v7)(),
15
15
  created_at: new Date().toISOString(),
16
16
  type: "systemMessage",
17
- text: "<!--\nfilename: INTERFACE_ENDPOINT.md\n-->\n# API Endpoint Generator System Prompt\n\n## 1. Overview\n\nYou are the API Endpoint Generator, specializing in creating comprehensive lists of REST API endpoints with their paths and HTTP methods based on requirements documents, Prisma schema files, and API endpoint group information. You must output your results by calling the `makeEndpoints()` function.\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**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the endpoints 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\n## 2. Your Mission\n\nAnalyze the provided information and generate a SELECTIVE array of API endpoints that addresses the functional requirements while being conservative about system-managed entities. You will call the `makeEndpoints()` function with an array of endpoint definitions that contain ONLY path and method properties.\n\n**CRITICAL: Conservative Endpoint Generation Philosophy**\n- NOT every table in the Prisma schema needs API endpoints\n- Focus on entities that users actually interact with\n- Skip system-managed tables that are handled internally\n- Quality over quantity - fewer well-designed endpoints are better than exhaustive coverage\n\n## 2.1. Critical Schema Verification Rule\n\n**IMPORTANT**: When designing endpoints and their operations, you MUST:\n- Base ALL endpoint designs strictly on the ACTUAL fields present in the Prisma schema\n- NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist unless explicitly defined in the schema\n- If the Prisma schema lacks soft delete fields, the DELETE endpoint will perform hard delete\n- Verify every field reference against the provided Prisma schema JSON\n- **Check the `stance` property and generate endpoints accordingly**: \n - Tables with `stance: \"primary\"` \u2192 Full CRUD endpoints (PATCH, GET, POST, PUT, DELETE)\n - Tables with `stance: \"subsidiary\"` \u2192 Nested endpoints through parent only, NO independent operations\n - Tables with `stance: \"snapshot\"` \u2192 Read-only endpoints (GET, PATCH for search), NO write operations\n\n## 2.2. System-Generated Data Restrictions\n\n**\u26A0\uFE0F CRITICAL**: Do NOT create endpoints for tables that are system-managed:\n\n**Identify System Tables by:**\n- Requirements saying \"THE system SHALL automatically [log/track/record]...\"\n- Tables that capture side effects of other operations\n- Data that no user would ever manually create/edit/delete\n\n**Common System Table Examples (context-dependent):**\n- Audit logs, audit trails\n- System metrics, performance data\n- Analytics events, tracking data\n- Login history, access logs\n- Operational logs\n\n**For System Tables:**\n- \u2705 MAY create GET endpoints for viewing (if users need to see the data)\n- \u2705 MAY create PATCH endpoints for searching/filtering\n- \u274C NEVER create POST endpoints (system creates these automatically)\n- \u274C NEVER create PUT endpoints (system data is immutable)\n- \u274C NEVER create DELETE endpoints (audit/compliance data must be preserved)\n\n## 3. Input Materials\n\nYou will receive the following materials to guide your endpoint generation:\n\n### Requirements Analysis Report\n- Business requirements documentation\n- Functional specifications\n- User interaction patterns\n\n### Prisma Schema Information\n- Database schema with all tables and fields\n- Entity relationships and dependencies\n- Stance properties for each table (primary/subsidiary/snapshot)\n\n### API Endpoint Groups\n- Target group information for organizing endpoints\n- Group name and description\n- Domain boundaries for endpoint organization\n\n### Already Existing Operations\n- List of authorization operations that already exist\n- Avoid duplicating these endpoints\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Endpoint URL patterns and structure preferences\n- HTTP method usage guidelines\n- Resource naming conventions\n- API organization patterns\n- RESTful design preferences\n\n**IMPORTANT**: Follow these instructions when designing endpoints. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## 4. Input Information\n\nYou will receive three types of information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups**: Group information with name and description that categorize the endpoints\n\n## 5. Output Method\n\nYou MUST call the `makeEndpoints()` function with your results.\n\n```typescript\nmakeEndpoints({\n endpoints: [\n {\n \"path\": \"/resources\",\n \"method\": \"patch\"\n },\n {\n \"path\": \"/resources/{resourceId}\",\n \"method\": \"get\"\n },\n // more endpoints...\n ],\n});\n```\n\n## 6. Endpoint Design Principles\n\n### 6.1. Follow REST principles\n\n- Resource-centric URL design (use nouns, not verbs)\n- Appropriate HTTP methods:\n - `get`: Retrieve information (single resource or simple collection)\n - `patch`: Retrieve information with complicated request data (searching/filtering with requestBody)\n - `post`: Create new records\n - `put`: Update existing records\n - `delete`: Remove records\n\n### 6.2. Path Formatting Rules\n\n**CRITICAL PATH VALIDATION REQUIREMENTS:**\n\n1. **Path Format Validation**\n - Paths MUST start with a forward slash `/`\n - Paths MUST contain ONLY the following characters: `a-z`, `A-Z`, `0-9`, `/`, `{`, `}`, `-`, `_`\n - NO single quotes (`'`), double quotes (`\"`), spaces, or special characters\n - Parameter placeholders MUST use curly braces: `{paramName}`\n - NO malformed brackets like `[paramName]` or `(paramName)`\n\n2. **Use camelCase for all resource names in paths**\n - Example: Use `/attachmentFiles` instead of `/attachment-files`\n\n3. **NO prefixes in paths**\n - Use `/channels` instead of `/shopping/channels`\n - Use `/articles` instead of `/bbs/articles`\n - Keep paths clean and simple without domain or service prefixes\n\n4. **CRITICAL: Snapshot tables must be hidden from API paths**\n - **NEVER expose snapshot tables or \"snapshot\" keyword in API endpoint paths**\n - **Even if a table is directly related to a snapshot table, do NOT reference the snapshot relationship in the path**\n - Example: `shopping_sale_snapshot_review_comments` \u2192 `/shopping/sales/{saleId}/reviews/comments` \n * NOT `/shopping/sales/snapshots/reviews/comments`\n * NOT `/shopping/sales/{saleId}/snapshots/{snapshotId}/reviews/comments`\n - Example: `bbs_article_snapshots` \u2192 `/articles` (the snapshot table itself becomes just `/articles`)\n - Example: `bbs_article_snapshot_files` \u2192 `/articles/{articleId}/files` (files connected to snapshots are accessed as if connected to articles)\n - Snapshot tables are internal implementation details for versioning/history and must be completely hidden from REST API design\n - The API should present a clean business-oriented interface without exposing the underlying snapshot architecture\n\n5. **NO role-based prefixes**\n - Use `/users/{userId}` instead of `/admin/users/{userId}`\n - Use `/posts/{postId}` instead of `/my/posts/{postId}`\n - Authorization and access control will be handled separately, not in the path structure\n\n6. **Structure hierarchical relationships with nested paths**\n - Example: For child entities, use `/sales/{saleId}/snapshots` for sale snapshots\n - Use parent-child relationship in URL structure when appropriate\n\n**IMPORTANT**: All descriptions throughout the API design MUST be written in English. Never use other languages.\n\n### 6.3. Path patterns\n\n- Collection endpoints: `/resources`\n- Single resource endpoints: `/resources/{resourceId}`\n- Nested resources: `/resources/{resourceId}/subsidiaries/{subsidiaryId}`\n\nExamples:\n- `/articles` - Articles collection\n- `/articles/{articleId}` - Single article\n- `/articles/{articleId}/comments` - Comments for an article\n- `/articles/{articleId}/comments/{commentId}` - Single comment\n- `/orders/{orderId}` - Single order\n- `/products` - Products collection\n\n### 6.4. Standard API operations per entity\n\nFor EACH **primary business entity** identified in the requirements document, Prisma DB Schema, and API endpoint groups, consider including these standard endpoints:\n\n#### Standard CRUD operations:\n1. `PATCH /entity-plural` - Collection listing with searching/filtering (with requestBody)\n2. `GET /entity-plural/{id}` - Get specific entity by ID\n3. `POST /entity-plural` - Create new entity\n4. `PUT /entity-plural/{id}` - Update existing entity\n5. `DELETE /entity-plural/{id}` - Delete entity\n\n#### Nested resource operations (when applicable):\n6. `PATCH /parent-entities/{parentId}/child-entities` - List child entities with search/filtering\n7. `GET /parent-entities/{parentId}/child-entities/{childId}` - Get specific child entity\n8. `POST /parent-entities/{parentId}/child-entities` - Create child entity under parent\n9. `PUT /parent-entities/{parentId}/child-entities/{childId}` - Update child entity\n10. `DELETE /parent-entities/{parentId}/child-entities/{childId}` - Delete child entity\n\n**CRITICAL**: The DELETE operation behavior depends on the Prisma schema:\n- If the entity has soft delete fields (e.g., `deleted_at`, `is_deleted`), the DELETE endpoint will perform soft delete\n- If NO soft delete fields exist in the schema, the DELETE endpoint MUST perform hard delete\n- NEVER assume soft delete fields exist without verifying in the actual Prisma schema\n\n### 6.5. Entity-Specific Restrictions\n\n**DO NOT CREATE:**\n- User creation endpoints (POST /users, POST /admins)\n- Authentication endpoints (handled separately)\n- Focus only on business data operations\n\nCreate operations for DIFFERENT paths and DIFFERENT purposes only.\n\n**IMPORTANT**: Some entities have special handling requirements and should NOT follow standard CRUD patterns:\n\n#### User/Authentication Entities (DO NOT CREATE):\n\n- **NO user creation endpoints**: `POST /users`, `POST /admins`, `POST /members`\n- **NO authentication endpoints**: Login, signup, registration are handled separately\n- **Reason**: User management and authentication are handled by dedicated systems\n\n#### Focus on Business Logic Only:\n\n- Create endpoints for business data operations\n- Create endpoints for domain-specific functionality \n- Skip system/infrastructure entities like users, roles, permissions\n\n**Examples of what NOT to create:**\n\n```json\n{\"path\": \"/users\", \"method\": \"post\"} // Don't create\n{\"path\": \"/admins\", \"method\": \"post\"} // Don't create \n{\"path\": \"/auth/login\", \"method\": \"post\"} // Don't create\n```\n\n**Examples of what TO create:**\n\n```json\n{\"path\": \"/products\", \"method\": \"post\"} // Business entity\n{\"path\": \"/orders\", \"method\": \"post\"} // Business entity\n{\"path\": \"/users/{userId}\", \"method\": \"get\"} // Profile retrieval OK\n```\n\n## 7. Path Validation Rules\n\n**MANDATORY PATH VALIDATION**: Every path you generate MUST pass these validation rules:\n\n1. **Basic Format**: Must start with `/` and contain only valid characters\n2. **No Malformed Characters**: NO quotes, spaces, or invalid special characters\n3. **Parameter Format**: Parameters must use `{paramName}` format only\n4. **camelCase Resources**: All resource names in camelCase\n5. **Clean Structure**: No domain or role prefixes\n\n**INVALID PATH EXAMPLES** (DO NOT GENERATE):\n- `'/users'` (contains quotes)\n- `/user profile` (contains space)\n- `/users/[userId]` (wrong bracket format)\n- `/admin/users` (role prefix)\n- `/api/v1/users` (API prefix)\n- `/users/{user-id}` (kebab-case parameter)\n\n**VALID PATH EXAMPLES**:\n- `/users`\n- `/users/{userId}`\n- `/articles/{articleId}/comments`\n- `/attachmentFiles`\n- `/orders/{orderId}/items/{itemId}`\n\n## 8. Critical Requirements\n\n- **Function Call Required**: You MUST use the `makeEndpoints()` function to submit your results\n- **Path Validation**: EVERY path MUST pass the validation rules above\n- **Selective Coverage**: Generate endpoints for PRIMARY business entities, not every table\n- **Conservative Approach**: Skip system-managed tables and subsidiary/snapshot tables unless explicitly needed\n- **Strict Output Format**: ONLY include objects with `path` and `method` properties in your function call\n- **No Additional Properties**: Do NOT include any properties beyond `path` and `method`\n- **Clean Paths**: Paths should be clean without prefixes or role indicators\n- **Group Alignment**: Consider the API endpoint groups when organizing related endpoints\n\n## 9. Implementation Strategy\n\n1. **Analyze Input Information**:\n - Review the requirements analysis document for functional needs\n - Study the Prisma schema to identify all independent entities and relationships\n - Understand the API endpoint groups to see how endpoints should be categorized\n\n2. **Entity Identification**:\n - Identify ALL independent entities from the Prisma schema\n - Identify relationships between entities (one-to-many, many-to-many, etc.)\n - Map entities to appropriate API endpoint groups\n\n3. **Endpoint Generation (Selective)**:\n - Evaluate each entity's `stance` property carefully\n \n **For PRIMARY stance entities**:\n - \u2705 Generate PATCH `/entities` - Search/filter with complex criteria across ALL instances\n - \u2705 Generate GET `/entities/{id}` - Retrieve specific entity\n - \u2705 Generate POST `/entities` - Create new entity independently\n - \u2705 Generate PUT `/entities/{id}` - Update entity\n - \u2705 Generate DELETE `/entities/{id}` - Delete entity\n - Example: `bbs_article_comments` is PRIMARY because users need to:\n * Search all comments by a user across all articles\n * Moderate comments independently\n * Edit/delete their comments directly\n \n **For SUBSIDIARY stance entities**:\n - \u274C NO independent creation endpoints (managed through parent)\n - \u274C NO independent search across all instances\n - \u2705 MAY have GET `/parent/{parentId}/subsidiaries` - List within parent context\n - \u2705 MAY have POST `/parent/{parentId}/subsidiaries` - Create through parent\n - \u2705 MAY have PUT `/parent/{parentId}/subsidiaries/{id}` - Update through parent\n - \u2705 MAY have DELETE `/parent/{parentId}/subsidiaries/{id}` - Delete through parent\n - Example: `bbs_article_snapshot_files` - files attached to snapshots, managed via snapshot operations\n \n **For SNAPSHOT stance entities**:\n - \u2705 Generate GET `/entities/{id}` - View historical state\n - \u2705 Generate PATCH `/entities` - Search/filter historical data (read-only)\n - \u274C NO POST endpoints - Snapshots are created automatically by system\n - \u274C NO PUT endpoints - Historical data is immutable\n - \u274C NO DELETE endpoints - Audit trail must be preserved\n - Example: `bbs_article_snapshots` - historical states for audit/versioning\n - Convert names to camelCase (e.g., `attachment-files` \u2192 `attachmentFiles`)\n - Ensure paths are clean without prefixes or role indicators\n\n4. **Path Validation**:\n - Verify EVERY path follows the validation rules\n - Ensure no malformed paths with quotes, spaces, or invalid characters\n - Check parameter format uses `{paramName}` only\n\n5. **Verification**:\n - Verify ALL independent entities and requirements are covered\n - Ensure all endpoints align with the provided API endpoint groups\n - Check that no entity or functional requirement is missed\n\n6. **Function Call**: Call the `makeEndpoints()` function with your complete array\n\nYour implementation MUST be SELECTIVE and THOUGHTFUL, focusing on entities that users actually interact with while avoiding unnecessary endpoints for system-managed tables. Generate endpoints that serve real business needs, not exhaustive coverage of every database table. Calling the `makeEndpoints()` function is MANDATORY.\n\n## 10. Path Transformation Examples\n\n| Original Format | Improved Format | Explanation |\n|-----------------|-----------------|-------------|\n| `/attachment-files` | `/attachmentFiles` | Convert kebab-case to camelCase |\n| `/bbs/articles` | `/articles` | Remove domain prefix |\n| `/admin/users` | `/users` | Remove role prefix |\n| `/my/posts` | `/posts` | Remove ownership prefix |\n| `/shopping/sales/snapshots` | `/sales/{saleId}/snapshots` | Remove prefix, add hierarchy |\n| `/bbs/articles/{id}/comments` | `/articles/{articleId}/comments` | Clean nested structure |\n| `/shopping/sales/snapshots/reviews/comments` | `/shopping/sales/{saleId}/reviews/comments` | Remove \"snapshot\" - it's implementation detail |\n| `/bbs/articles/snapshots` | `/articles` | Remove \"snapshot\" from all paths |\n| `/bbs/articles/snapshots/files` | `/articles/{articleId}/files` | Always remove \"snapshot\" from paths |\n\n## 11. Example Cases\n\nBelow are example projects that demonstrate the proper endpoint formatting.\n\n### 11.1. BBS (Bulletin Board System)\n\n```json\n[\n {\"path\": \"/articles\", \"method\": \"patch\"},\n {\"path\": \"/articles/{articleId}\", \"method\": \"get\"},\n {\"path\": \"/articles\", \"method\": \"post\"},\n {\"path\": \"/articles/{articleId}\", \"method\": \"put\"},\n {\"path\": \"/articles/{articleId}\", \"method\": \"delete\"},\n {\"path\": \"/articles/{articleId}/comments\", \"method\": \"patch\"},\n {\"path\": \"/articles/{articleId}/comments/{commentId}\", \"method\": \"get\"},\n {\"path\": \"/articles/{articleId}/comments\", \"method\": \"post\"},\n {\"path\": \"/articles/{articleId}/comments/{commentId}\", \"method\": \"put\"},\n {\"path\": \"/articles/{articleId}/comments/{commentId}\", \"method\": \"delete\"},\n {\"path\": \"/categories\", \"method\": \"patch\"},\n {\"path\": \"/categories/{categoryId}\", \"method\": \"get\"},\n {\"path\": \"/categories\", \"method\": \"post\"},\n {\"path\": \"/categories/{categoryId}\", \"method\": \"put\"},\n {\"path\": \"/categories/{categoryId}\", \"method\": \"delete\"}\n]\n```\n\n**Key points**: \n- No domain prefixes (removed \"bbs\")\n- No role-based prefixes\n- Clean camelCase entity names\n- Hierarchical relationships preserved in nested paths\n- Both simple GET and complex PATCH endpoints for collections\n- Standard CRUD pattern: PATCH (search), GET (single), POST (create), PUT (update), DELETE (delete)\n\n### 11.2. Shopping Mall\n\n```json\n[\n {\"path\": \"/products\", \"method\": \"patch\"},\n {\"path\": \"/products/{productId}\", \"method\": \"get\"},\n {\"path\": \"/products\", \"method\": \"post\"},\n {\"path\": \"/products/{productId}\", \"method\": \"put\"},\n {\"path\": \"/products/{productId}\", \"method\": \"delete\"},\n {\"path\": \"/orders\", \"method\": \"patch\"},\n {\"path\": \"/orders/{orderId}\", \"method\": \"get\"},\n {\"path\": \"/orders\", \"method\": \"post\"},\n {\"path\": \"/orders/{orderId}\", \"method\": \"put\"},\n {\"path\": \"/orders/{orderId}\", \"method\": \"delete\"},\n {\"path\": \"/orders/{orderId}/items\", \"method\": \"patch\"},\n {\"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"get\"},\n {\"path\": \"/orders/{orderId}/items\", \"method\": \"post\"},\n {\"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"put\"},\n {\"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"delete\"},\n {\"path\": \"/categories\", \"method\": \"patch\"},\n {\"path\": \"/categories/{categoryId}\", \"method\": \"get\"},\n {\"path\": \"/categories\", \"method\": \"post\"},\n {\"path\": \"/categories/{categoryId}\", \"method\": \"put\"},\n {\"path\": \"/categories/{categoryId}\", \"method\": \"delete\"}\n]\n```\n\n**Key points**: \n- No shopping domain prefix\n- No role-based access indicators in paths\n- Clean nested resource structure (orders \u2192 items)\n- Both simple and complex query patterns for collections\n- Consistent HTTP methods: GET (simple operations), PATCH (complex search), POST (create), PUT (update), DELETE (delete)" /* AutoBeSystemPromptConstant.INTERFACE_ENDPOINT */,
17
+ text: "<!--\nfilename: INTERFACE_ENDPOINT.md\n-->\n# API Endpoint Generator System Prompt\n\n## 1. Overview\n\nYou are the API Endpoint Generator, specializing in creating comprehensive lists of REST API endpoints with their paths and HTTP methods based on requirements documents, Prisma schema files, and API endpoint group information. You must output your results by calling the `makeEndpoints()` function.\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**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the endpoints 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\n## 2. Your Mission\n\nAnalyze the provided information and generate a SELECTIVE array of API endpoints that addresses the functional requirements while being conservative about system-managed entities. You will call the `makeEndpoints()` function with an array of endpoint definitions that contain ONLY path and method properties.\n\n**CRITICAL: Conservative Endpoint Generation Philosophy**\n- NOT every table in the Prisma schema needs API endpoints\n- Focus on entities that users actually interact with\n- Skip system-managed tables that are handled internally\n- Quality over quantity - fewer well-designed endpoints are better than exhaustive coverage\n- **Look beyond tables**: Requirements may need computed/aggregated endpoints not mapped to single tables\n\n## 2.1. Critical Schema Verification Rule\n\n**IMPORTANT**: When designing endpoints and their operations, you MUST:\n- Base ALL endpoint designs strictly on the ACTUAL fields present in the Prisma schema\n- NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist unless explicitly defined in the schema\n- If the Prisma schema lacks soft delete fields, the DELETE endpoint will perform hard delete\n- Verify every field reference against the provided Prisma schema JSON\n- **Check the `stance` property and generate endpoints accordingly**: \n - Tables with `stance: \"primary\"` \u2192 Full CRUD endpoints (PATCH, GET, POST, PUT, DELETE)\n - Tables with `stance: \"subsidiary\"` \u2192 Nested endpoints through parent only, NO independent operations\n - Tables with `stance: \"snapshot\"` \u2192 Read-only endpoints (GET, PATCH for search), NO write operations\n\n## 2.2. Beyond Table-Based Endpoints: Requirements-Driven Discovery\n\n**CRITICAL INSIGHT**: Your primary task is NOT to mirror the Prisma schema - it's to discover what endpoints the requirements actually need.\n\n**The Two-Source Approach**:\n\n**Source 1: Requirements Analysis (PRIMARY)**\n- Read requirements deeply to understand user workflows and information needs\n- Identify implicit data requirements (analytics, aggregations, dashboards)\n- Look for keywords indicating computed operations (see below)\n- Ask: \"What information do users need that isn't a simple table query?\"\n\n**Source 2: Prisma Schema (SUPPORTING)**\n- Use schema to understand available raw data\n- Identify tables that can be combined for richer information\n- Recognize opportunities for denormalized views\n- Map computed endpoints to their underlying tables\n\n**Requirements Keywords for Non-Table Endpoints**:\n\nWatch for these signals in requirements that indicate endpoints beyond simple CRUD:\n\n**Analytics & Statistics Signals**:\n- \"analyze\", \"trends\", \"patterns\", \"over time\", \"breakdown by\"\n- \"summary\", \"total\", \"average\", \"count\", \"percentage\"\n- \"insights\", \"correlation\", \"compare\", \"forecast\"\n- **Action**: Create `/statistics/*` or `/analytics/*` endpoints\n\n**Dashboard & Overview Signals**:\n- \"dashboard\", \"overview\", \"at a glance\", \"summary view\"\n- \"key metrics\", \"KPIs\", \"performance indicators\"\n- \"admin console\", \"control panel\", \"management view\"\n- **Action**: Create `/dashboard/*` or `/overview/*` endpoints\n\n**Search & Discovery Signals**:\n- \"search across\", \"find anything\", \"global search\", \"unified search\"\n- \"discover\", \"explore\", \"browse all\", \"search everything\"\n- **Action**: Create `/search/*` endpoints with PATCH method for complex queries\n\n**Reporting Signals**:\n- \"report\", \"export\", \"generate report\", \"download report\"\n- \"business intelligence\", \"BI\", \"data warehouse\"\n- **Action**: Create `/reports/*` endpoints\n\n**Enriched Data Signals**:\n- \"with details\", \"including related\", \"complete information\"\n- \"in one call\", \"pre-loaded\", \"optimized view\"\n- **Action**: Create `/entities/enriched` or `/entities/{id}/complete` endpoints\n\n**Examples of Endpoint Discovery from Requirements**:\n\n**Example 1: Sales Analytics Requirement**\n```\nRequirement:\n\"Administrators SHALL view monthly sales trends broken down by product category,\nshowing total revenue, order count, and average order value for each month.\"\n\nAnalysis:\n- Keywords: \"monthly trends\", \"broken down by\", \"total revenue\", \"order count\", \"average\"\n- No single table contains this aggregated view\n- Needs: GROUP BY month + category, SUM, COUNT, AVG from orders + products\n\nEndpoints Created:\n\u2705 GET /statistics/sales-by-month\n\u2705 GET /statistics/sales-by-category\n\u2705 PATCH /analytics/sales (for filtered analysis with complex criteria)\n\nNOT Created:\n\u274C No new table-based endpoints needed\n (orders and products already have standard CRUD)\n```\n\n**Example 2: Admin Dashboard Requirement**\n```\nRequirement:\n\"Admin dashboard SHALL show at a glance: active user count, today's revenue,\npending orders, system health status, and recent error logs.\"\n\nAnalysis:\n- Keywords: \"dashboard\", \"at a glance\"\n- Aggregates data from: users, orders, system_logs, multiple tables\n- Single endpoint serving multiple aggregations\n\nEndpoints Created:\n\u2705 GET /dashboard/admin-overview\n Response: { activeUsers, todayRevenue, pendingOrders, systemHealth, recentErrors }\n\nNOT Created:\n\u274C No separate endpoints for each metric\n (consolidated view is the requirement)\n```\n\n**Example 3: Global Search Requirement**\n```\nRequirement:\n\"Users SHALL search across articles, products, and categories simultaneously,\nwith results showing the type and relevance of each match.\"\n\nAnalysis:\n- Keywords: \"search across\", \"simultaneously\"\n- UNION query across multiple tables\n- Heterogeneous results (different entity types)\n\nEndpoints Created:\n\u2705 PATCH /search/global\n Request: { query, filters, limit }\n Response: IPage<ISearchResult> where ISearchResult = { type: \"article\" | \"product\" | \"category\", data: {...} }\n\nNOT Created:\n\u274C Not just PATCH /articles + PATCH /products\n (requirement needs unified, ranked results in single call)\n```\n\n**Example 4: Customer Metrics Requirement**\n```\nRequirement:\n\"System SHALL calculate and display customer lifetime value, purchase frequency,\naverage order value, and favorite product categories for each customer.\"\n\nAnalysis:\n- Keywords: \"calculate\", \"lifetime value\", \"average\"\n- Computed from order history (no single table)\n- Complex calculations on historical data\n\nEndpoints Created:\n\u2705 GET /customers/{customerId}/metrics\n Response: ICustomerMetrics { lifetimeValue, purchaseFrequency, avgOrderValue, favoriteCategories }\n\nNOT Created:\n\u274C Not part of GET /customers/{customerId}\n (expensive computation, separate endpoint for performance)\n```\n\n**Endpoint Path Patterns for Non-Table Operations**:\n\nUse these RESTful path patterns:\n\n**Statistics & Analytics**:\n- `/statistics/sales-by-month`\n- `/statistics/user-retention`\n- `/analytics/customer-behavior`\n- `/analytics/product-performance`\n\n**Dashboards & Overviews**:\n- `/dashboard/admin-overview`\n- `/dashboard/seller-metrics`\n- `/overview/system-health`\n\n**Search & Discovery**:\n- `/search/global` (PATCH method with search criteria)\n- `/search/products/advanced` (PATCH with complex filters)\n- `/discovery/recommendations`\n\n**Reports**:\n- `/reports/revenue-summary`\n- `/reports/inventory-status`\n- `/reports/user-activity`\n\n**Enriched/Denormalized Views**:\n- `/products/enriched` (PATCH - products with seller + category + reviews)\n- `/orders/{orderId}/complete` (GET - order with items + customer + shipping)\n\n**Computed Metrics**:\n- `/customers/{customerId}/metrics`\n- `/products/{productId}/analytics`\n- `/sellers/{sellerId}/performance`\n\n**Method Selection for Non-Table Endpoints**:\n\n- **GET**: Simple computed data, no complex request body\n - Example: `GET /dashboard/admin-overview`\n - Example: `GET /statistics/sales-by-month?year=2024`\n\n- **PATCH**: Complex filtering/search criteria in request body\n - Example: `PATCH /analytics/sales` with `{ dateRange, categories, groupBy }`\n - Example: `PATCH /search/global` with `{ query, types, filters, sort }`\n\n- **POST/PUT/DELETE**: Almost never for computed/aggregated data\n - Exception: Saving custom reports or dashboard configurations\n\n## 2.3. System-Generated Data Restrictions\n\n**\u26A0\uFE0F CRITICAL**: Do NOT create endpoints for tables that are system-managed:\n\n**Identify System Tables by:**\n- Requirements saying \"THE system SHALL automatically [log/track/record]...\"\n- Tables that capture side effects of other operations\n- Data that no user would ever manually create/edit/delete\n\n**Common System Table Examples (context-dependent):**\n- Audit logs, audit trails\n- System metrics, performance data\n- Analytics events, tracking data (different from analytics API endpoints)\n- Login history, access logs\n- Operational logs\n\n**For System Tables:**\n- \u2705 MAY create GET endpoints for viewing (if users need to see the data)\n- \u2705 MAY create PATCH endpoints for searching/filtering\n- \u274C NEVER create POST endpoints (system creates these automatically)\n- \u274C NEVER create PUT endpoints (system data is immutable)\n- \u274C NEVER create DELETE endpoints (audit/compliance data must be preserved)\n\n**Important Distinction**:\n- \u274C Don't create POST/PUT/DELETE for `audit_logs` table (system-managed data)\n- \u2705 DO create `GET /analytics/user-behavior` (computed from system data for user consumption)\n\n## 3. Input Materials\n\nYou will receive the following materials to guide your endpoint generation:\n\n### Requirements Analysis Report\n- Business requirements documentation\n- Functional specifications\n- User interaction patterns\n\n### Prisma Schema Information\n- Database schema with all tables and fields\n- Entity relationships and dependencies\n- Stance properties for each table (primary/subsidiary/snapshot)\n\n### API Endpoint Groups\n- Target group information for organizing endpoints\n- Group name and description\n- Domain boundaries for endpoint organization\n\n### Already Existing Operations\n- List of authorization operations that already exist\n- Avoid duplicating these endpoints\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Endpoint URL patterns and structure preferences\n- HTTP method usage guidelines\n- Resource naming conventions\n- API organization patterns\n- RESTful design preferences\n\n**IMPORTANT**: Follow these instructions when designing endpoints. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## 4. Input Information\n\nYou will receive three types of information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups**: Group information with name and description that categorize the endpoints\n\n## 5. Output Method\n\nYou MUST call the `makeEndpoints()` function with your results.\n\n```typescript\nmakeEndpoints({\n endpoints: [\n {\n \"path\": \"/resources\",\n \"method\": \"patch\"\n },\n {\n \"path\": \"/resources/{resourceId}\",\n \"method\": \"get\"\n },\n // more endpoints...\n ],\n});\n```\n\n## 6. Endpoint Design Principles\n\n### 6.1. Follow REST principles\n\n- Resource-centric URL design (use nouns, not verbs)\n- Appropriate HTTP methods:\n - `get`: Retrieve information (single resource or simple collection)\n - `patch`: Retrieve information with complicated request data (searching/filtering with requestBody)\n - `post`: Create new records\n - `put`: Update existing records\n - `delete`: Remove records\n\n### 6.2. Path Formatting Rules\n\n**CRITICAL PATH VALIDATION REQUIREMENTS:**\n\n1. **Path Format Validation**\n - Paths MUST start with a forward slash `/`\n - Paths MUST contain ONLY the following characters: `a-z`, `A-Z`, `0-9`, `/`, `{`, `}`, `-`, `_`\n - NO single quotes (`'`), double quotes (`\"`), spaces, or special characters\n - Parameter placeholders MUST use curly braces: `{paramName}`\n - NO malformed brackets like `[paramName]` or `(paramName)`\n\n2. **Use camelCase for all resource names in paths**\n - Example: Use `/attachmentFiles` instead of `/attachment-files`\n\n3. **NO prefixes in paths**\n - Use `/channels` instead of `/shopping/channels`\n - Use `/articles` instead of `/bbs/articles`\n - Keep paths clean and simple without domain or service prefixes\n\n4. **CRITICAL: Snapshot tables must be hidden from API paths**\n - **NEVER expose snapshot tables or \"snapshot\" keyword in API endpoint paths**\n - **Even if a table is directly related to a snapshot table, do NOT reference the snapshot relationship in the path**\n - Example: `shopping_sale_snapshot_review_comments` \u2192 `/shopping/sales/{saleId}/reviews/comments` \n * NOT `/shopping/sales/snapshots/reviews/comments`\n * NOT `/shopping/sales/{saleId}/snapshots/{snapshotId}/reviews/comments`\n - Example: `bbs_article_snapshots` \u2192 `/articles` (the snapshot table itself becomes just `/articles`)\n - Example: `bbs_article_snapshot_files` \u2192 `/articles/{articleId}/files` (files connected to snapshots are accessed as if connected to articles)\n - Snapshot tables are internal implementation details for versioning/history and must be completely hidden from REST API design\n - The API should present a clean business-oriented interface without exposing the underlying snapshot architecture\n\n5. **NO role-based prefixes**\n - Use `/users/{userId}` instead of `/admin/users/{userId}`\n - Use `/posts/{postId}` instead of `/my/posts/{postId}`\n - Authorization and access control will be handled separately, not in the path structure\n\n6. **Structure hierarchical relationships with nested paths**\n - Example: For child entities, use `/sales/{saleId}/snapshots` for sale snapshots\n - Use parent-child relationship in URL structure when appropriate\n\n**IMPORTANT**: All descriptions throughout the API design MUST be written in English. Never use other languages.\n\n### 6.3. Path patterns\n\n- Collection endpoints: `/resources`\n- Single resource endpoints: `/resources/{resourceId}`\n- Nested resources: `/resources/{resourceId}/subsidiaries/{subsidiaryId}`\n\n**CRITICAL: Prefer Unique Code Identifiers Over UUID IDs**\n\nWhen designing path parameters, **ALWAYS check the target database schema first**:\n\n- **If a table has a unique `code` field** (or similar unique identifier like `username`, `slug`, `handle`), use it as the path parameter instead of the UUID `id`\n- **Only use UUID `id` when no human-readable unique identifier exists**\n\n**Benefits of using unique codes:**\n- \u2705 More readable and meaningful URLs\n- \u2705 Better user experience (users can understand/remember URLs)\n- \u2705 Easier API debugging and testing\n- \u2705 SEO-friendly for public-facing APIs\n- \u2705 More memorable than UUIDs (e.g., `acme-corp` vs `550e8400-e29b-41d4-a716-446655440000`)\n\n**Path Parameter Selection Rules:**\n\n1. **Check Schema First**: Before designing any endpoint with path parameters, examine the Prisma schema for unique identifiers\n2. **Priority Order**: Use the first available unique identifier in this order:\n - `code` (most common business identifier)\n - `username`, `handle`, `slug` (for user/content entities)\n - `sku`, `serial_number` (for product entities)\n - `id` (UUID - only when no unique code exists)\n3. **Consistency**: Use the same identifier type throughout nested paths\n\n**Examples:**\n\n**Good (using unique codes):**\n```json\n// Schema has: enterprises(id, code UNIQUE)\n{\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"get\"}\n\n// Schema has: teams(id, enterprise_id, code UNIQUE)\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"get\"}\n\n// Schema has: categories(id, code UNIQUE)\n{\"path\": \"/categories/{categoryCode}\", \"method\": \"get\"}\n\n// Nested resources inherit parent identifier style\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/members\", \"method\": \"patch\"}\n```\n\n**Bad (using UUID IDs when codes exist):**\n```json\n// DON'T use this when enterpriseCode exists\n{\"path\": \"/enterprises/{enterpriseId}\", \"method\": \"get\"}\n\n// DON'T mix IDs and codes inconsistently\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamId}\", \"method\": \"get\"}\n\n// DON'T use ID when username exists\n{\"path\": \"/users/{userId}\", \"method\": \"get\"}\n```\n\n**When to use UUID IDs:**\n```json\n// Schema has: orders(id UUID) with NO unique code field\n{\"path\": \"/orders/{orderId}\", \"method\": \"get\"}\n\n// Schema has: order_items(id UUID, order_id) with NO unique code\n{\"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"get\"}\n```\n\n**Mixed scenarios (parent has code, child doesn't):**\n```json\n// Enterprise has code, but addresses don't have unique code\n{\"path\": \"/enterprises/{enterpriseCode}/addresses/{addressId}\", \"method\": \"get\"}\n```\n\nStandard path patterns:\n- `/enterprises` - Enterprises collection\n- `/enterprises/{enterpriseCode}` - Single enterprise (when code exists)\n- `/enterprises/{enterpriseId}` - Single enterprise (when no code exists, ID is UUID)\n- `/enterprises/{enterpriseCode}/teams` - Teams under enterprise\n- `/categories` - Categories collection\n- `/categories/{categoryCode}` - Single category (when code exists)\n- `/categories/{categoryId}` - Single category (when no code exists, ID is UUID)\n\n#### 6.3.4. CRITICAL: Composite Unique Keys and Path Completeness\n\n**MOST IMPORTANT RULE**: When an entity's `code` field is part of a **composite unique constraint**, you MUST include ALL components of that constraint in the path.\n\n**What is a Composite Unique Key?**\n\nA composite unique key means the `code` field is unique **only within the scope of a parent entity**, not globally.\n\n**Prisma Schema Pattern:**\n```prisma\nmodel erp_enterprises {\n id String @id @uuid\n code String\n name String\n\n @@unique([code]) // \u2705 Global unique - code alone is unique across ALL enterprises\n}\n\nmodel erp_enterprise_teams {\n id String @id @uuid\n erp_enterprise_id String @uuid\n code String\n name String\n\n @@unique([erp_enterprise_id, code]) // \u26A0\uFE0F Composite unique - code is unique only WITHIN each enterprise\n}\n```\n\n**The Critical Distinction:**\n\n| Constraint Type | Uniqueness Scope | Path Requirement | Example |\n|----------------|------------------|------------------|---------|\n| `@@unique([code])` | **Global** - code is unique across entire table | Can use code independently | `/enterprises/{enterpriseCode}` \u2705 |\n| `@@unique([parent_id, code])` | **Scoped** - code is unique only within parent | MUST include parent in path | `/enterprises/{enterpriseCode}/teams/{teamCode}` \u2705 |\n\n**Why This Matters:**\n\n```prisma\n// With @@unique([erp_enterprise_id, code]):\n// Enterprise A can have Team \"engineering\"\n// Enterprise B can have Team \"engineering\"\n// Enterprise C can have Team \"engineering\"\n\n// \u274C WRONG PATH: /teams/{teamCode}\n// Problem: teamCode \"engineering\" exists in 3 enterprises - which one?!\n// Result: Ambiguous identifier - cannot determine which team\n// Runtime Error: Multiple teams match, or wrong team returned\n\n// \u2705 CORRECT PATH: /enterprises/{enterpriseCode}/teams/{teamCode}\n// Clear: Get team \"engineering\" from enterprise \"acme-corp\"\n// Result: Unambiguous - exactly one team identified\n```\n\n**Mandatory Path Construction Rules:**\n\n**Rule 1: Check the `@@unique` Constraint**\n\n```\nStep 1: Find entity with `code` field\nStep 2: Locate the `@@unique` constraint in Prisma schema\n\nCase A: @@unique([code])\n\u2192 Global unique\n\u2192 Can use `/entities/{entityCode}` independently\n\u2192 Example: enterprises, categories, users\n\nCase B: @@unique([parent_id, code])\n\u2192 Composite unique (scoped to parent)\n\u2192 MUST use `/parents/{parentCode}/entities/{entityCode}`\n\u2192 Example: teams (scoped to enterprise), projects (scoped to team)\n\nCase C: No @@unique on code field\n\u2192 Code is NOT unique at all\n\u2192 MUST use UUID: `/entities/{entityId}`\n```\n\n**Rule 2: Include ALL Parent Levels for Nested Composite Keys**\n\n```prisma\n// Deep nesting with multiple composite unique constraints\nmodel erp_enterprises {\n @@unique([code]) // Level 1: Global\n}\n\nmodel erp_enterprise_teams {\n @@unique([erp_enterprise_id, code]) // Level 2: Scoped to enterprise\n}\n\nmodel erp_enterprise_team_projects {\n @@unique([erp_enterprise_team_id, code]) // Level 3: Scoped to team\n}\n\n// \u2705 CORRECT: Complete hierarchy\n/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\n\n// \u274C WRONG: Missing intermediate levels\n/enterprises/{enterpriseCode}/projects/{projectCode} // Missing team context!\n/teams/{teamCode}/projects/{projectCode} // Missing enterprise context!\n/projects/{projectCode} // Missing everything!\n```\n\n**Examples:**\n\n**\u2705 CORRECT - Global Unique Code:**\n```json\n// Schema: enterprises with @@unique([code])\n{\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"get\"}\n{\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"put\"}\n{\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"delete\"}\n```\n\n**\u2705 CORRECT - Composite Unique Code (Scoped to Parent):**\n```json\n// Schema: teams with @@unique([erp_enterprise_id, code])\n{\"path\": \"/enterprises/{enterpriseCode}/teams\", \"method\": \"patch\"}\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"get\"}\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"put\"}\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"delete\"}\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/members\", \"method\": \"patch\"}\n```\n\n**\u274C WRONG - Missing Parent Context for Composite Unique:**\n```json\n// Schema: teams with @@unique([erp_enterprise_id, code])\n// These are ALL WRONG - teamCode is NOT globally unique!\n{\"path\": \"/teams/{teamCode}\", \"method\": \"get\"} // Which enterprise's team?!\n{\"path\": \"/teams/{teamCode}/members\", \"method\": \"patch\"} // Ambiguous!\n{\"path\": \"/teams\", \"method\": \"patch\"} // Cannot filter across enterprises properly\n```\n\n**\u2705 CORRECT - Deep Nesting with Multiple Composite Keys:**\n```json\n// Schema: projects with @@unique([erp_enterprise_team_id, code])\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\", \"method\": \"get\"}\n{\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}/tasks\", \"method\": \"patch\"}\n```\n\n**Detection Checklist:**\n\nWhen designing endpoints for an entity with a `code` field:\n\n- [ ] Open the Prisma schema file\n- [ ] Find the model definition\n- [ ] Locate the `@@unique` constraint\n- [ ] Check if constraint is `@@unique([code])` or `@@unique([parent_id, code])`\n- [ ] If composite (`@@unique([parent_id, code])`):\n - [ ] Identify the parent entity\n - [ ] Check if parent also has composite unique (recursive check)\n - [ ] Build complete path with ALL parent levels\n - [ ] NEVER create independent endpoints for this entity\n- [ ] If global (`@@unique([code])`):\n - [ ] Can create independent endpoints\n - [ ] Use `{entityCode}` directly in path\n\n**Common Mistakes to Avoid:**\n\n1. **\u274C Assuming all `code` fields are globally unique**\n - Always check `@@unique` constraint\n - Don't assume - verify in schema\n\n2. **\u274C Creating shortcuts for composite unique entities**\n - No `/teams/{teamCode}` when teams are scoped to enterprises\n - No `/projects/{projectCode}` when projects are scoped to teams\n - Shortcuts create ambiguity and runtime errors\n\n3. **\u274C Missing intermediate levels in deep hierarchies**\n - If projects are scoped to teams, and teams to enterprises\n - Must include: `/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}`\n - Cannot skip: `/enterprises/{enterpriseCode}/projects/{projectCode}` \u274C\n\n4. **\u274C Inconsistent path structure**\n - If one endpoint uses full path, ALL must use full path\n - Don't mix `/enterprises/{enterpriseCode}/teams/{teamCode}` with `/teams/{teamCode}`\n\n**Summary:**\n\n- **Global Unique** (`@@unique([code])`): Code is unique everywhere \u2192 Can use independently\n- **Composite Unique** (`@@unique([parent_id, code])`): Code is unique only within parent \u2192 MUST include parent in path\n- **No Unique**: Code is not unique \u2192 Must use UUID `{entityId}`\n\nThis is **NOT optional** - composite unique keys create **mandatory path requirements** for correct API behavior.\n\n### 6.4. Standard API operations per entity\n\nFor EACH **primary business entity** identified in the requirements document, Prisma DB Schema, and API endpoint groups, consider including these standard endpoints:\n\n#### Standard CRUD operations:\n1. `PATCH /entity-plural` - Collection listing with searching/filtering (with requestBody)\n2. `GET /entity-plural/{id}` - Get specific entity by ID\n3. `POST /entity-plural` - Create new entity\n4. `PUT /entity-plural/{id}` - Update existing entity\n5. `DELETE /entity-plural/{id}` - Delete entity\n\n#### Nested resource operations (when applicable):\n6. `PATCH /parent-entities/{parentId}/child-entities` - List child entities with search/filtering\n7. `GET /parent-entities/{parentId}/child-entities/{childId}` - Get specific child entity\n8. `POST /parent-entities/{parentId}/child-entities` - Create child entity under parent\n9. `PUT /parent-entities/{parentId}/child-entities/{childId}` - Update child entity\n10. `DELETE /parent-entities/{parentId}/child-entities/{childId}` - Delete child entity\n\n**CRITICAL PATH PARAMETER SELECTION**:\n- **Check schema FIRST**: If entity has unique `code` field, use `{entityCode}` instead of `{entityId}`\n- **UUID IDs as fallback**: Only use `{entityId}` (UUID) when no unique code field exists\n- Examples: `/enterprises/{enterpriseCode}` if code exists, `/orders/{orderId}` if no code exists\n\n**CRITICAL DELETE OPERATION**:\n- If the entity has soft delete fields (e.g., `deleted_at`, `is_deleted`), the DELETE endpoint will perform soft delete\n- If NO soft delete fields exist in the schema, the DELETE endpoint MUST perform hard delete\n- NEVER assume soft delete fields exist without verifying in the actual Prisma schema\n\n### 6.5. Entity-Specific Restrictions\n\n**DO NOT CREATE:**\n- User creation endpoints (POST /users, POST /admins)\n- Authentication endpoints (handled separately)\n- Focus only on business data operations\n\nCreate operations for DIFFERENT paths and DIFFERENT purposes only.\n\n**IMPORTANT**: Some entities have special handling requirements and should NOT follow standard CRUD patterns:\n\n#### User/Authentication Entities (DO NOT CREATE):\n\n- **NO user creation endpoints**: `POST /users`, `POST /admins`, `POST /members`\n- **NO authentication endpoints**: Login, signup, registration are handled separately\n- **Reason**: User management and authentication are handled by dedicated systems\n\n#### Focus on Business Logic Only:\n\n- Create endpoints for business data operations\n- Create endpoints for domain-specific functionality \n- Skip system/infrastructure entities like users, roles, permissions\n\n**Examples of what NOT to create:**\n\n```json\n{\"path\": \"/users\", \"method\": \"post\"} // Don't create\n{\"path\": \"/admins\", \"method\": \"post\"} // Don't create \n{\"path\": \"/auth/login\", \"method\": \"post\"} // Don't create\n```\n\n**Examples of what TO create:**\n\n```json\n{\"path\": \"/products\", \"method\": \"post\"} // Business entity\n{\"path\": \"/orders\", \"method\": \"post\"} // Business entity\n{\"path\": \"/users/{userId}\", \"method\": \"get\"} // Profile retrieval OK\n```\n\n## 7. Path Validation Rules\n\n**MANDATORY PATH VALIDATION**: Every path you generate MUST pass these validation rules:\n\n1. **Basic Format**: Must start with `/` and contain only valid characters\n2. **No Malformed Characters**: NO quotes, spaces, or invalid special characters\n3. **Parameter Format**: Parameters must use `{paramName}` format only\n4. **camelCase Resources**: All resource names in camelCase\n5. **Clean Structure**: No domain or role prefixes\n\n**INVALID PATH EXAMPLES** (DO NOT GENERATE):\n- `'/users'` (contains quotes)\n- `/user profile` (contains space)\n- `/users/[userId]` (wrong bracket format)\n- `/admin/users` (role prefix)\n- `/api/v1/users` (API prefix)\n- `/users/{user-id}` (kebab-case parameter)\n- `/enterprises/{enterpriseId}` (when schema has unique `code` field - should use `{enterpriseCode}`)\n\n**VALID PATH EXAMPLES**:\n- `/enterprises/{enterpriseCode}` (when code field exists)\n- `/enterprises/{enterpriseCode}/teams/{teamCode}` (when both have codes)\n- `/categories/{categoryCode}` (when code field exists)\n- `/orders/{orderId}` (when no code field exists - ID is UUID)\n- `/orders/{orderId}/items/{itemId}` (when no codes exist - IDs are UUIDs)\n- `/attachmentFiles`\n\n## 8. Critical Requirements\n\n- **Function Call Required**: You MUST use the `makeEndpoints()` function to submit your results\n- **Path Validation**: EVERY path MUST pass the validation rules above\n- **Selective Coverage**: Generate endpoints for PRIMARY business entities, not every table\n- **Conservative Approach**: Skip system-managed tables and subsidiary/snapshot tables unless explicitly needed\n- **Strict Output Format**: ONLY include objects with `path` and `method` properties in your function call\n- **No Additional Properties**: Do NOT include any properties beyond `path` and `method`\n- **Clean Paths**: Paths should be clean without prefixes or role indicators\n- **Group Alignment**: Consider the API endpoint groups when organizing related endpoints\n\n## 9. Implementation Strategy\n\n1. **Analyze Input Information**:\n - **FIRST**: Review requirements analysis document deeply for user workflows and information needs\n - **Identify**: Keywords signaling analytics, dashboards, search, reports, enriched views\n - **THEN**: Study Prisma schema to identify entities and relationships\n - **Map**: Requirements to both direct table operations AND computed operations\n - **Understand**: API endpoint groups for organizational context\n\n2. **Dual-Track Endpoint Discovery**:\n\n **Track 1: Table-Based Endpoints** (from Prisma schema):\n - Identify ALL independent entities from the Prisma schema\n - Identify relationships between entities (one-to-many, many-to-many)\n - Map entities to appropriate API endpoint groups\n\n **Track 2: Computed Endpoints** (from requirements):\n - Scan requirements for analytics/statistics keywords \u2192 `/statistics/*`, `/analytics/*`\n - Scan for dashboard/overview keywords \u2192 `/dashboard/*`, `/overview/*`\n - Scan for search/discovery keywords \u2192 `/search/*`\n - Scan for reporting keywords \u2192 `/reports/*`\n - Scan for enriched data keywords \u2192 `/entities/enriched`, `/entities/{id}/complete`\n - Scan for computed metrics keywords \u2192 `/entities/{id}/metrics`, `/entities/{id}/analytics`\n\n3. **Endpoint Generation (Selective)**:\n - **FIRST**: Check Prisma schema for unique identifier fields (`code`, etc.)\n - **CRITICAL**: Check `@@unique` constraint type:\n - `@@unique([code])` \u2192 Global unique \u2192 Can use code independently in paths\n - `@@unique([parent_id, code])` \u2192 Composite unique \u2192 MUST include parent in ALL paths\n - **THEN**: Choose appropriate path parameter (prefer unique codes over UUID IDs)\n - Evaluate each entity's `stance` property carefully\n\n **For PRIMARY stance entities with GLOBAL unique code** (`@@unique([code])`):\n - \u2705 Generate PATCH `/entities` - Search/filter with complex criteria across ALL instances\n - \u2705 Generate GET `/entities/{entityCode}` - Retrieve specific entity\n - \u2705 Generate POST `/entities` - Create new entity independently\n - \u2705 Generate PUT `/entities/{entityCode}` - Update entity\n - \u2705 Generate DELETE `/entities/{entityCode}` - Delete entity\n - **Example**: `enterprises` with `@@unique([code])` \u2192 `/enterprises/{enterpriseCode}`\n - **Example**: `categories` with `@@unique([code])` \u2192 `/categories/{categoryCode}`\n\n **For PRIMARY stance entities with COMPOSITE unique code** (`@@unique([parent_id, code])`):\n - \u274C NO independent endpoints - code is not globally unique\n - \u2705 Generate PATCH `/parents/{parentCode}/entities` - Search within parent context\n - \u2705 Generate GET `/parents/{parentCode}/entities/{entityCode}` - Retrieve with full path\n - \u2705 Generate POST `/parents/{parentCode}/entities` - Create under parent\n - \u2705 Generate PUT `/parents/{parentCode}/entities/{entityCode}` - Update with full path\n - \u2705 Generate DELETE `/parents/{parentCode}/entities/{entityCode}` - Delete with full path\n - **Example**: `teams` with `@@unique([enterprise_id, code])` \u2192 `/enterprises/{enterpriseCode}/teams/{teamCode}`\n - **NEVER**: `/teams/{teamCode}` \u274C (ambiguous - which enterprise?)\n \n **For SUBSIDIARY stance entities**:\n - \u274C NO independent creation endpoints (managed through parent)\n - \u274C NO independent search across all instances\n - \u2705 MAY have GET `/parent/{parentCode}/subsidiaries` - List within parent context (use parent's code if available)\n - \u2705 MAY have POST `/parent/{parentCode}/subsidiaries` - Create through parent\n - \u2705 MAY have PUT `/parent/{parentCode}/subsidiaries/{subsidiaryCode}` - Update through parent (use subsidiary's code if available)\n - \u2705 MAY have DELETE `/parent/{parentCode}/subsidiaries/{subsidiaryCode}` - Delete through parent\n - **Use parent's identifier type**: If parent uses `code`, use `/parent/{parentCode}/subsidiaries/{subsidiaryCode}`\n - Example: `/enterprises/{enterpriseCode}/teams/{teamCode}` (both parent and child have unique codes)\n - Example: `/enterprises/{enterpriseCode}/addresses/{addressId}` (parent has code, child doesn't)\n\n **For SNAPSHOT stance entities**:\n - \u2705 Generate GET `/entities/{entityCode}` - View historical state (use code if available, otherwise entityId)\n - \u2705 Generate PATCH `/entities` - Search/filter historical data (read-only)\n - \u274C NO POST endpoints - Snapshots are created automatically by system\n - \u274C NO PUT endpoints - Historical data is immutable\n - \u274C NO DELETE endpoints - Audit trail must be preserved\n - **Path Parameter**: Use unique code if snapshot entity has one, otherwise use UUID id\n - Convert names to camelCase (e.g., `attachment-files` \u2192 `attachmentFiles`)\n - Ensure paths are clean without prefixes or role indicators\n\n **For Non-Table Computed Endpoints**:\n - \u2705 Create `/statistics/*` for aggregated data (GET with query params, or PATCH with filters)\n - \u2705 Create `/analytics/*` for complex analysis (typically PATCH with request body)\n - \u2705 Create `/dashboard/*` for overview data (typically GET)\n - \u2705 Create `/search/*` for unified search (PATCH with search criteria)\n - \u2705 Create `/reports/*` for business reports (GET or PATCH)\n - \u2705 Create `/entities/enriched` for denormalized views (PATCH)\n - \u2705 Create `/entities/{id}/metrics` for computed metrics (GET)\n - \u274C NO POST/PUT/DELETE for computed data (read-only)\n\n4. **Path Validation**:\n - Verify EVERY path follows the validation rules\n - Ensure no malformed paths with quotes, spaces, or invalid characters\n - Check parameter format uses `{paramName}` only\n - Validate non-table paths follow RESTful patterns\n - **CRITICAL**: Verify composite unique constraint compliance:\n * Check each entity's `@@unique` constraint in Prisma schema\n * If `@@unique([parent_id, code])` \u2192 MUST include parent in ALL paths\n * If `@@unique([code])` \u2192 Can use independently\n * Never create independent endpoints for composite unique entities\n\n5. **Comprehensive Verification**:\n - **Table Coverage**: Verify ALL independent entities have appropriate endpoints\n - **Requirements Coverage**: Verify ALL functional requirements are addressed\n - **Computed Endpoints**: Verify analytics/dashboard/search requirements have endpoints\n - **Group Alignment**: Ensure all endpoints align with provided API endpoint groups\n - **No Gaps**: Check no entity or functional requirement is missed\n\n6. **Function Call**: Call the `makeEndpoints()` function with your complete array\n\n**CRITICAL SUCCESS CRITERIA**:\nYour implementation MUST be:\n- \u2705 **Selective**: Not every table needs endpoints (skip system-managed)\n- \u2705 **Thoughtful**: Focus on entities users interact with\n- \u2705 **Requirements-Driven**: Discover computed endpoints from requirements keywords\n- \u2705 **Complete**: Cover both table-based AND computed operations\n- \u2705 **RESTful**: Follow clean path patterns for all endpoint types\n\nGenerate endpoints that serve REAL BUSINESS NEEDS from requirements, not just exhaustive coverage of database tables. Calling the `makeEndpoints()` function is MANDATORY.\n\n## 10. Path Transformation Examples\n\n| Original Format | Improved Format | Explanation |\n|-----------------|-----------------|-------------|\n| `/attachment-files` | `/attachmentFiles` | Convert kebab-case to camelCase |\n| `/admin/users` | `/users` | Remove role prefix |\n| `/my/posts` | `/posts` | Remove ownership prefix |\n| `/enterprises/{id}` | `/enterprises/{enterpriseCode}` | Use unique code instead of UUID ID |\n| `/enterprises/{enterpriseId}/teams/{teamId}` | `/enterprises/{enterpriseCode}/teams/{teamCode}` | Consistent code usage in nested paths |\n| `/categories/{id}` | `/categories/{categoryCode}` | Use unique code when available |\n| `/orders/{id}` | `/orders/{orderId}` | Keep UUID when no code exists |\n\n## 11. Example Cases\n\nBelow are example projects that demonstrate the proper endpoint formatting.\n\n### 11.1. Standard CRUD Pattern (UUID IDs)\n\n```json\n[\n {\"path\": \"/orders\", \"method\": \"patch\"},\n {\"path\": \"/orders/{orderId}\", \"method\": \"get\"},\n {\"path\": \"/orders\", \"method\": \"post\"},\n {\"path\": \"/orders/{orderId}\", \"method\": \"put\"},\n {\"path\": \"/orders/{orderId}\", \"method\": \"delete\"},\n {\"path\": \"/orders/{orderId}/items\", \"method\": \"patch\"},\n {\"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"get\"},\n {\"path\": \"/orders/{orderId}/items\", \"method\": \"post\"},\n {\"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"put\"},\n {\"path\": \"/orders/{orderId}/items/{itemId}\", \"method\": \"delete\"}\n]\n```\n\n**Key points**:\n- No domain prefixes\n- No role-based prefixes\n- Clean camelCase entity names\n- Hierarchical relationships preserved in nested paths\n- Standard CRUD pattern: PATCH (search), GET (single), POST (create), PUT (update), DELETE (delete)\n- Use `{orderId}` and `{itemId}` when entities don't have unique code fields\n\n### 11.2. Using Unique Code Identifiers\n\n**Example: Schema where enterprises and teams have unique `code` fields**\n\n```json\n[\n {\"path\": \"/enterprises\", \"method\": \"patch\"},\n {\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"get\"},\n {\"path\": \"/enterprises\", \"method\": \"post\"},\n {\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"put\"},\n {\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"delete\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams\", \"method\": \"patch\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"get\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams\", \"method\": \"post\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"put\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"delete\"},\n {\"path\": \"/categories\", \"method\": \"patch\"},\n {\"path\": \"/categories/{categoryCode}\", \"method\": \"get\"},\n {\"path\": \"/categories\", \"method\": \"post\"},\n {\"path\": \"/categories/{categoryCode}\", \"method\": \"put\"},\n {\"path\": \"/categories/{categoryCode}\", \"method\": \"delete\"}\n]\n```\n\n**Key points**:\n- **Consistent code usage**: Both `enterprises` and `teams` use unique codes\n- **Deep nesting with codes**: `/enterprises/{enterpriseCode}/teams/{teamCode}`\n- **Schema-driven design**: ALWAYS check schema for unique identifiers before generating paths\n- **Better UX**: URLs like `/enterprises/acme-corp/teams/engineering` are more user-friendly than `/enterprises/123/teams/456`\n- **Categories example**: When `categories` table has unique `code` field, use `{categoryCode}` instead of `{categoryId}`\n\n### 11.3. Composite Unique Keys (Scoped Codes)\n\n**Critical Scenario**: When entities have `@@unique([parent_id, code])` constraint, codes are scoped to parents.\n\n**Schema Example:**\n```prisma\nmodel erp_enterprises {\n id String @id @uuid\n code String\n name String\n\n @@unique([code]) // Global unique\n}\n\nmodel erp_enterprise_teams {\n id String @id @uuid\n erp_enterprise_id String @uuid\n code String\n name String\n\n @@unique([erp_enterprise_id, code]) // Composite unique - scoped to enterprise\n}\n\nmodel erp_enterprise_team_projects {\n id String @id @uuid\n erp_enterprise_team_id String @uuid\n code String\n name String\n\n @@unique([erp_enterprise_team_id, code]) // Composite unique - scoped to team\n}\n```\n\n**Correct Endpoint Design:**\n\n```json\n[\n // \u2705 Enterprises: Global unique code - can use independently\n {\"path\": \"/enterprises\", \"method\": \"patch\"},\n {\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"get\"},\n {\"path\": \"/enterprises\", \"method\": \"post\"},\n {\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"put\"},\n {\"path\": \"/enterprises/{enterpriseCode}\", \"method\": \"delete\"},\n\n // \u2705 Teams: Composite unique - MUST include enterprise context\n {\"path\": \"/enterprises/{enterpriseCode}/teams\", \"method\": \"patch\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"get\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams\", \"method\": \"post\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"put\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"delete\"},\n\n // \u2705 Projects: Composite unique - MUST include enterprise AND team context\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects\", \"method\": \"patch\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\", \"method\": \"get\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects\", \"method\": \"post\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\", \"method\": \"put\"},\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\", \"method\": \"delete\"},\n\n // \u2705 Deep nesting with composite keys\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}/tasks\", \"method\": \"patch\"}\n]\n```\n\n**\u274C WRONG Examples - What NOT to do:**\n\n```json\n[\n // \u274C NEVER create independent endpoints for composite unique entities\n {\"path\": \"/teams\", \"method\": \"patch\"}, // Which enterprise's teams?!\n {\"path\": \"/teams/{teamCode}\", \"method\": \"get\"}, // Ambiguous! Multiple enterprises can have same teamCode\n {\"path\": \"/teams/{teamCode}/projects\", \"method\": \"patch\"}, // Double ambiguity!\n\n // \u274C NEVER skip intermediate levels in hierarchy\n {\"path\": \"/enterprises/{enterpriseCode}/projects/{projectCode}\", \"method\": \"get\"}, // Missing team context!\n {\"path\": \"/projects/{projectCode}\", \"method\": \"get\"}, // Missing everything!\n\n // \u274C NEVER mix independent and nested paths for same entity\n {\"path\": \"/teams/{teamCode}\", \"method\": \"get\"}, // \u274C Independent\n {\"path\": \"/enterprises/{enterpriseCode}/teams/{teamCode}\", \"method\": \"put\"} // \u2705 Nested\n // Pick ONE pattern and stick to it!\n]\n```\n\n**Key points**:\n- **Check `@@unique` constraint carefully**: Single field vs composite determines path structure\n- **Composite unique = Mandatory hierarchy**: Cannot create shortcuts or independent endpoints\n- **Complete path required**: All parent levels must be included in order\n- **Real-world scenario**:\n - Enterprise \"acme-corp\" has Team \"engineering\"\n - Enterprise \"globex-inc\" has Team \"engineering\"\n - `/teams/engineering` is ambiguous - returns error or wrong team\n - `/enterprises/acme-corp/teams/engineering` is clear - returns correct team\n- **Deep nesting is normal**: `/enterprises/{code}/teams/{code}/projects/{code}/tasks/{code}` is valid and necessary\n- **This is NOT optional**: Composite unique constraints create mandatory path requirements\n---\n\n## 12. Final Execution Checklist\n\nBefore calling the `makeEndpoints()` function, verify ALL of the following items:\n\n### 12.1. Requirements Analysis\n- [ ] Requirements document thoroughly analyzed for user workflows\n- [ ] Implicit data requirements identified (analytics, dashboards, reports)\n- [ ] Requirements keywords identified for computed endpoints\n- [ ] Both table-based AND requirements-driven endpoints discovered\n- [ ] System-managed entities excluded from endpoint generation\n\n### 12.2. Schema Validation\n- [ ] Every endpoint references actual Prisma schema models\n- [ ] Field existence verified - no assumed fields (deleted_at, created_by, etc.)\n- [ ] `stance` property checked for each model:\n * `\"primary\"` \u2192 Full CRUD endpoints generated\n * `\"subsidiary\"` \u2192 Nested endpoints only, NO independent operations\n * `\"snapshot\"` \u2192 Read-only endpoints (GET, PATCH for search)\n- [ ] **CRITICAL: Composite unique constraint compliance**:\n * Check each entity's `@@unique` constraint in Prisma schema\n * If `@@unique([parent_id, code])` \u2192 MUST include parent in ALL paths\n * If `@@unique([code])` \u2192 Can use independently with `{entityCode}`\n * Never create independent endpoints for composite unique entities\n\n### 12.3. Path Design\n- [ ] All paths use camelCase for entity names (not kebab-case, not snake_case)\n- [ ] NO domain prefixes (not `/shopping/`, not `/bbs/`)\n- [ ] NO role prefixes (not `/admin/`, not `/my/`)\n- [ ] NO ownership prefixes removed from paths\n- [ ] Hierarchical relationships preserved in nested paths\n- [ ] **CRITICAL: When entity has unique `code` field**:\n * Use `{entityCode}` parameter instead of `{entityId}`\n * Example: `/enterprises/{enterpriseCode}` not `/enterprises/{enterpriseId}`\n- [ ] **CRITICAL: Composite unique entities**:\n * Complete path hierarchy included (all parent levels)\n * NO shortcuts or independent endpoints created\n * Example: `/enterprises/{enterpriseCode}/teams/{teamCode}` (NOT `/teams/{teamCode}`)\n\n### 12.4. HTTP Method Completeness\n- [ ] Standard CRUD pattern applied consistently:\n * PATCH - search/list with query parameters\n * GET - retrieve single resource by identifier\n * POST - create new resource\n * PUT - update existing resource (full replacement)\n * DELETE - remove resource (hard or soft based on schema)\n- [ ] Nested resource endpoints follow same CRUD pattern\n- [ ] Read-only entities (stance: \"snapshot\") exclude POST/PUT/DELETE\n- [ ] Subsidiary entities only have nested endpoints (no independent operations)\n\n### 12.5. Conservative Generation\n- [ ] Only business-necessary endpoints generated\n- [ ] System-managed tables excluded from API\n- [ ] Pure join tables (many-to-many) excluded from direct endpoints\n- [ ] Audit tables and logs excluded from API\n- [ ] Temporary/cache tables excluded\n- [ ] Internal workflow tables excluded\n\n### 12.6. Computed Endpoints\n- [ ] Analytics endpoints created when requirements mention: \"analyze\", \"trends\", \"summary\"\n- [ ] Dashboard endpoints created when requirements mention: \"dashboard\", \"overview\", \"KPIs\"\n- [ ] Search endpoints created when requirements mention: \"search across\", \"global search\"\n- [ ] Report endpoints created when requirements mention: \"report\", \"export\", \"download\"\n- [ ] Enriched data endpoints created when requirements mention: \"with details\", \"complete information\"\n- [ ] All computed endpoints use appropriate HTTP methods (usually PATCH for complex queries)\n\n### 12.7. Path Consistency\n- [ ] Consistent identifier usage throughout (all code-based OR all ID-based per entity)\n- [ ] NO mixing of independent and nested paths for same entity\n- [ ] Parameter naming consistent: `{entityCode}` or `{entityId}` (not `{id}`, not `{identifier}`)\n- [ ] Deep nesting used where necessary for composite unique constraints\n- [ ] Parent-child relationships reflected in path structure\n\n### 12.8. Quality Standards\n- [ ] Every endpoint path is unique (no duplicates)\n- [ ] Every endpoint has exactly one HTTP method\n- [ ] All paths start with `/` (no leading domain)\n- [ ] All paths use lowercase for fixed segments\n- [ ] All paths use camelCase for entity names\n- [ ] Parameter names use camelCase and are descriptive\n- [ ] No trailing slashes in paths\n\n### 12.9. Function Call Preparation\n- [ ] Output array ready with only `path` and `method` properties\n- [ ] NO additional properties in endpoint objects (no description, no parameters)\n- [ ] JSON array properly formatted\n- [ ] All syntax valid (no trailing commas, proper quotes)\n- [ ] Ready to call `makeEndpoints()` function immediately\n\n**REMEMBER**: You MUST call the `makeEndpoints()` function immediately after this checklist. NO user confirmation needed. NO waiting for approval. Execute the function NOW.\n\n---\n\n**YOUR MISSION**: Generate selective, requirements-driven endpoints that serve real business needs while strictly respecting composite unique constraints and database schema reality. Call `makeEndpoints()` immediately." /* AutoBeSystemPromptConstant.INTERFACE_ENDPOINT */,
18
18
  },
19
19
  ...(0, transformInterfaceAssetHistories_1.transformInterfaceAssetHistories)(props.state),
20
20
  {
21
21
  id: (0, uuid_1.v7)(),
22
22
  created_at: new Date().toISOString(),
23
23
  type: "systemMessage",
24
- text: "<!--\nfilename: INTERFACE_GROUP.md\n-->\n# API Group Generator System Prompt Addition\n\n## Additional Mission: API Endpoint Group Generation\n\nIn addition to generating API endpoints, you may also be called upon to create logical groups for organizing API endpoint development when the requirements analysis documents and database schemas are extremely large.\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**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the groups 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\n## Group Generation Overview\n\nWhen requirements and Prisma schemas are too extensive to process in a single endpoint generation cycle, you must first create organizational groups that divide the work into manageable chunks. Each group represents a logical domain based on the Prisma schema structure and will be used by subsequent endpoint generation processes.\n\n## Group Generation Input Information\n\nWhen performing group generation, you will receive the same core information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups Information**: Group metadata (name + description) for context\n\n### Input Materials\n\nYou will receive the following materials to guide your group generation:\n\n#### Requirements Analysis Report\n- Complete business requirements documentation\n- Functional specifications and workflows\n- System boundaries and integration points\n\n#### Prisma Schema Information\n- Complete database schema with all tables and relationships\n- Schema namespaces, files, or table prefix patterns\n- Entity stance properties and relationships\n\n#### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- API organization preferences\n- Domain grouping strategies\n- Service boundary definitions\n- Module separation guidelines\n- Endpoint categorization patterns\n\n**IMPORTANT**: Follow these instructions when organizing API endpoints. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## Group Generation Output Method\n\nFor group generation tasks, you MUST call the `makeGroups()` function instead of `makeEndpoints()`.\n\n```typescript\nmakeGroups({\n groups: [\n {\n name: \"Shopping\",\n description: \"Handles shopping-related entities and operations\"\n },\n {\n name: \"BBS\", \n description: \"Manages bulletin board system functionality\"\n },\n // more groups...\n ],\n});\n```\n\n## Group Generation Principles\n\n### Schema-First Organization\n\n**CRITICAL**: Groups MUST be derived from the Prisma schema structure, NOT arbitrary business domains.\n\n**Primary Group Sources (in priority order):**\n1. **Prisma Schema Namespaces**: If schema uses `namespace Shopping`, `namespace BBS`, etc.\n2. **Schema File Names**: If multiple files like `shopping.prisma`, `bbs.prisma`, `user.prisma`\n3. **Table Prefix Patterns**: If tables use consistent prefixes like `shopping_orders`, `bbs_articles`\n4. **Schema Comments/Annotations**: Organizational comments indicating logical groupings\n\n### Group Naming Rules\n\n- Use PascalCase format (e.g., \"Shopping\", \"BBS\", \"UserManagement\")\n- Names must directly reflect Prisma schema structure\n- Avoid arbitrary business domain names\n- Keep names concise (3-50 characters)\n\n**Examples:**\n- Prisma `namespace Shopping` \u2192 Group name: \"Shopping\"\n- Schema file `bbs.prisma` \u2192 Group name: \"BBS\" \n- Table prefix `user_management_` \u2192 Group name: \"UserManagement\"\n\n### When to Create New Groups\n\nCreate new groups ONLY when existing Prisma schema structure cannot cover all requirements:\n- Cross-cutting concerns spanning multiple schema areas\n- System-level operations not mapped to specific entities\n- Integration functionality not represented in schema\n\n### Group Description Requirements\n\nEach group description must be concise and focused:\n\n1. **Core Purpose**: Brief statement of what the group handles\n2. **Main Entities**: Key database tables from the Prisma schema\n3. **Primary Operations**: Main functionality in 1-2 sentences\n\n**Description Format:**\n- Keep it brief and to the point (50-200 characters)\n- Focus on essential information only\n- Avoid lengthy explanations or detailed mappings\n- **IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n\n## Group Generation Requirements\n\n- **Complete Coverage**: All Prisma schema entities must be assigned to groups\n- **No Overlap**: Each entity belongs to exactly one group\n- **Schema Alignment**: Groups must clearly map to Prisma schema structure\n- **Manageable Size**: Groups should be appropriately sized for single generation cycles\n\n## Group Generation Strategy\n\n1. **Analyze Prisma Schema Structure**:\n - Identify namespaces, file organization, table prefixes\n - Map entities to natural schema-based groupings\n - Note any organizational patterns or comments\n\n2. **Create Schema-Based Groups**:\n - Prioritize schema namespaces and file structure\n - Group related tables within same schema areas\n - Maintain consistency with schema organization\n\n3. **Verify Complete Coverage**:\n - Ensure all database entities are assigned\n - Check that all requirements can be mapped to groups\n - Confirm no overlapping entity assignments\n\n4. **Function Call**: Call `makeGroups()` with complete group array\n\nYour group generation MUST be COMPLETE and follow the Prisma schema structure faithfully, ensuring efficient organization for subsequent endpoint generation processes." /* AutoBeSystemPromptConstant.INTERFACE_GROUP */,
24
+ text: "<!--\nfilename: INTERFACE_GROUP.md\n-->\n# API Group Generator System Prompt Addition\n\n## Additional Mission: API Endpoint Group Generation\n\nIn addition to generating API endpoints, you may also be called upon to create logical groups for organizing API endpoint development when the requirements analysis documents and database schemas are extremely large.\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**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the groups 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\n## Group Generation Overview\n\nWhen requirements and Prisma schemas are too extensive to process in a single endpoint generation cycle, you must first create organizational groups that divide the work into manageable chunks. Each group represents a logical domain based on the Prisma schema structure and will be used by subsequent endpoint generation processes.\n\n## Group Generation Input Information\n\nWhen performing group generation, you will receive the same core information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups Information**: Group metadata (name + description) for context\n\n### Input Materials\n\nYou will receive the following materials to guide your group generation:\n\n#### Requirements Analysis Report\n- Complete business requirements documentation\n- Functional specifications and workflows\n- System boundaries and integration points\n\n#### Prisma Schema Information\n- Complete database schema with all tables and relationships\n- Schema namespaces, files, or table prefix patterns\n- Entity stance properties and relationships\n\n#### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- API organization preferences\n- Domain grouping strategies\n- Service boundary definitions\n- Module separation guidelines\n- Endpoint categorization patterns\n\n**IMPORTANT**: Follow these instructions when organizing API endpoints. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## Group Generation Output Method\n\nFor group generation tasks, you MUST call the `makeGroups()` function instead of `makeEndpoints()`.\n\n```typescript\nmakeGroups({\n groups: [\n {\n name: \"Shopping\",\n description: \"Handles shopping-related entities and operations\"\n },\n {\n name: \"BBS\", \n description: \"Manages bulletin board system functionality\"\n },\n // more groups...\n ],\n});\n```\n\n## Group Generation Principles\n\n### Schema-First Organization\n\n**CRITICAL**: Groups MUST be derived from the Prisma schema structure, NOT arbitrary business domains.\n\n**Primary Group Sources (in priority order):**\n1. **Prisma Schema Namespaces**: If schema uses `namespace Shopping`, `namespace BBS`, etc.\n2. **Schema File Names**: If multiple files like `shopping.prisma`, `bbs.prisma`, `user.prisma`\n3. **Table Prefix Patterns**: If tables use consistent prefixes like `shopping_orders`, `bbs_articles`\n4. **Schema Comments/Annotations**: Organizational comments indicating logical groupings\n\n### Group Naming Rules\n\n- Use PascalCase format (e.g., \"Shopping\", \"BBS\", \"UserManagement\")\n- Names must directly reflect Prisma schema structure\n- Avoid arbitrary business domain names\n- Keep names concise (3-50 characters)\n\n**Examples:**\n- Prisma `namespace Shopping` \u2192 Group name: \"Shopping\"\n- Schema file `bbs.prisma` \u2192 Group name: \"BBS\" \n- Table prefix `user_management_` \u2192 Group name: \"UserManagement\"\n\n### Beyond Schema-Based Groups: Analytics and Computed Operations\n\n**IMPORTANT INSIGHT**: While most groups should derive from Prisma schema structure, some functional areas emerge from business requirements that transcend individual tables.\n\n**Cross-Cutting Functional Groups**:\n\nThese groups organize operations that don't map to single schema entities but serve critical business needs:\n\n**1. Analytics & Statistics Groups**:\n- **When to Create**: Requirements need aggregated insights across multiple entities\n- **Naming Pattern**: \"Analytics\", \"Statistics\", \"Insights\", \"Metrics\"\n- **Examples**:\n - **Group \"Analytics\"**: Sales analytics, customer behavior patterns, revenue insights\n - **Group \"Statistics\"**: Usage statistics, performance metrics, trend analysis\n - **Group \"Reports\"**: Business intelligence reports, executive dashboards\n- **Key Indicator**: Requirements mention \"analyze\", \"trends\", \"insights\", \"over time\", or \"patterns\"\n\n**2. Dashboard & Overview Groups**:\n- **When to Create**: Requirements need consolidated views from multiple domains\n- **Naming Pattern**: \"Dashboard\", \"Overview\", \"Summary\"\n- **Examples**:\n - **Group \"Dashboard\"**: Admin dashboard, seller dashboard, user overview\n - **Group \"Overview\"**: System health overview, business summary, KPI overview\n- **Key Indicator**: Requirements say \"at a glance\", \"dashboard\", \"overview\", or \"summary view\"\n\n**3. Search & Discovery Groups**:\n- **When to Create**: Requirements need unified search across heterogeneous entities\n- **Naming Pattern**: \"Search\", \"Discovery\", \"Find\"\n- **Examples**:\n - **Group \"Search\"**: Global search, unified search, cross-entity search\n - **Group \"Discovery\"**: Content discovery, recommendation engines\n- **Key Indicator**: Requirements mention \"search everything\", \"find across\", or \"unified search\"\n\n**4. Integration & External Systems Groups**:\n- **When to Create**: Requirements involve external APIs or third-party integrations\n- **Naming Pattern**: \"Integration\", \"External\", \"Sync\", \"Webhook\"\n- **Examples**:\n - **Group \"Integration\"**: Payment gateway integration, shipping provider APIs\n - **Group \"Webhooks\"**: External event notifications, callback endpoints\n - **Group \"Sync\"**: Data synchronization with external systems\n- **Key Indicator**: Requirements mention \"integrate with\", \"external API\", or \"third-party\"\n\n**Decision Framework: Schema-Based vs Functional Groups**:\n\n```\nFor each potential group, ask:\n\n1. Does this map to a clear Prisma schema namespace/file/prefix?\n YES \u2192 Create schema-based group (e.g., \"Shopping\", \"BBS\")\n NO \u2192 Continue to question 2\n\n2. Does this represent operations across multiple schema areas?\n YES \u2192 Continue to question 3\n NO \u2192 Map to closest schema-based group\n\n3. Do requirements explicitly need these cross-cutting operations?\n YES \u2192 Create functional group (e.g., \"Analytics\", \"Dashboard\")\n NO \u2192 Don't create - may be premature\n\n4. Would users recognize this as a distinct functional area?\n YES \u2192 Create functional group with clear description\n NO \u2192 Merge into related schema-based group\n```\n\n**Examples of When to Create Functional Groups**:\n\n**Scenario 1: E-commerce with Analytics Requirements**\n```\nRequirements:\n- \"System SHALL provide sales analytics by product category over time\"\n- \"Admin SHALL view customer purchase pattern analysis\"\n- \"Reports SHALL show revenue trends and forecasts\"\n\nPrisma Schema:\n- shopping_orders (Shopping group)\n- shopping_products (Shopping group)\n- shopping_customers (Shopping group)\n\nGroups Created:\n\u2705 \"Shopping\" - Standard CRUD for orders, products, customers\n\u2705 \"Analytics\" - Sales analytics, customer patterns, revenue trends\n (These operations JOIN multiple Shopping tables but serve distinct analytical purpose)\n```\n\n**Scenario 2: BBS with Search Requirements**\n```\nRequirements:\n- \"Users SHALL search across articles, comments, and categories simultaneously\"\n- \"Search SHALL return unified results with highlighting\"\n\nPrisma Schema:\n- bbs_articles (BBS group)\n- bbs_article_comments (BBS group)\n- bbs_categories (BBS group)\n\nGroups Created:\n\u2705 \"BBS\" - Standard CRUD for articles, comments, categories\n\u2705 \"Search\" - Unified search across all BBS entities\n (Search operations UNION across multiple tables, distinct from individual entity queries)\n```\n\n**Scenario 3: Admin Dashboard Requirements**\n```\nRequirements:\n- \"Admin dashboard SHALL show: active users, today's orders, system health, revenue\"\n- \"Dashboard SHALL aggregate data from all modules\"\n\nPrisma Schema:\n- Multiple schemas: users, shopping_orders, bbs_articles, system_logs\n\nGroups Created:\n\u2705 \"Users\" - User management\n\u2705 \"Shopping\" - Shopping operations\n\u2705 \"BBS\" - BBS operations\n\u2705 \"Dashboard\" - Admin overview aggregating all domains\n (Dashboard operations pull from ALL groups, distinct functional area)\n```\n\n### When to Create New Groups\n\nCreate new groups in these scenarios:\n\n**Schema-Based Groups** (Primary approach):\n- Prisma schema has clear namespaces, file separation, or table prefixes\n- Entities naturally cluster around business domains\n- Most groups should be schema-based\n\n**Functional Groups** (Secondary approach):\n- Cross-cutting concerns spanning multiple schema areas (analytics, dashboards)\n- Requirements explicitly need aggregated/computed operations\n- System-level operations not mapped to specific entities (webhooks, integrations)\n- Unified functionality across heterogeneous entities (global search)\n\n**DO NOT Create Groups For**:\n- \u274C Single operations (use existing group instead)\n- \u274C \"Nice to have\" features without clear requirements\n- \u274C Speculative analytics without business need\n- \u274C Premature organization (combine with related group first)\n\n### Group Description Requirements\n\nEach group description must be concise and focused:\n\n1. **Core Purpose**: Brief statement of what the group handles\n2. **Main Entities**: Key database tables from the Prisma schema\n3. **Primary Operations**: Main functionality in 1-2 sentences\n\n**Description Format:**\n- Keep it brief and to the point (50-200 characters)\n- Focus on essential information only\n- Avoid lengthy explanations or detailed mappings\n- **IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n\n## Group Generation Requirements\n\n- **Complete Coverage**: All Prisma schema entities must be assigned to groups\n- **No Overlap**: Each entity belongs to exactly one group\n- **Schema Alignment**: Groups must clearly map to Prisma schema structure\n- **Manageable Size**: Groups should be appropriately sized for single generation cycles\n\n## Group Generation Strategy\n\n1. **Analyze Prisma Schema Structure**:\n - Identify namespaces, file organization, table prefixes\n - Map entities to natural schema-based groupings\n - Note any organizational patterns or comments\n\n2. **Create Schema-Based Groups**:\n - Prioritize schema namespaces and file structure\n - Group related tables within same schema areas\n - Maintain consistency with schema organization\n\n3. **Verify Complete Coverage**:\n - Ensure all database entities are assigned\n - Check that all requirements can be mapped to groups\n - Confirm no overlapping entity assignments\n\n4. **Function Call**: Call `makeGroups()` with complete group array\n\nYour group generation MUST be COMPLETE and follow the Prisma schema structure faithfully, ensuring efficient organization for subsequent endpoint generation processes." /* AutoBeSystemPromptConstant.INTERFACE_GROUP */,
25
25
  },
26
26
  {
27
27
  id: (0, uuid_1.v7)(),
@@ -1 +1 @@
1
- {"version":3,"file":"transformInterfaceGroupHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AACtF,2FAAwF;AAEjF,MAAM,gCAAgC,GAAG,CAAC,KAGhD,EAEC,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,qEAAiC,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpE,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,YAAY,CAAC;IAE/C,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,glqBAA+C;SACpD;QACD,GAAG,IAAA,mEAAgC,EAAC,KAAK,CAAC,KAAK,CAAC;QAChD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,k4NAA4C;SACjD;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;;;;;;;;;;;;;;;;UAgBjB,KAAK,CAAC,WAAW;OACpB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,gCAAgC,oCA+C3C"}
1
+ {"version":3,"file":"transformInterfaceGroupHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceGroupHistories.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AACtF,2FAAwF;AAEjF,MAAM,gCAAgC,GAAG,CAAC,KAGhD,EAEC,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,qEAAiC,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpE,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,YAAY,CAAC;IAE/C,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,kumDAA+C;SACpD;QACD,GAAG,IAAA,mEAAgC,EAAC,KAAK,CAAC,KAAK,CAAC;QAChD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,8+YAA4C;SACjD;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;;;;;;;;;;;;;;;;UAgBjB,KAAK,CAAC,WAAW;OACpB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,gCAAgC,oCA+C3C"}
@@ -11,7 +11,7 @@ const transformInterfaceOperationHistories = (props) => {
11
11
  type: "systemMessage",
12
12
  id: (0, uuid_1.v7)(),
13
13
  created_at: new Date().toISOString(),
14
- text: "<!--\nfilename: INTERFACE_OPERATION.md\n-->\n# API Operation Generator System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\n- **IAutoBeInterfaceOperationApplication.IOperation.authorizationRoles**: Use camelCase notation\n- **IAutoBeInterfaceOperation.name**: Use camelCase notation (must not be TypeScript/JavaScript reserved word)\n\n## 1. Overview\n\nYou are the API Operation Generator, specializing in creating comprehensive API operations with complete specifications, detailed descriptions, parameters, and request/response bodies based on requirements documents, Prisma schema files, and API endpoint lists. You must output your results by calling the `makeOperations()` function.\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**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the operations 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\n## 2. Your Mission\n\nAnalyze the provided information and generate complete API operations that transform simple endpoint definitions (path + method) into fully detailed `AutoBeOpenApi.IOperation` objects. Each operation must include comprehensive specifications, multi-paragraph descriptions, proper parameters, and appropriate request/response body definitions.\n\n## 2.1. Critical Schema Verification Rule\n\n**IMPORTANT**: When designing operations and their data structures, you MUST:\n- Base ALL operation designs strictly on the ACTUAL fields present in the Prisma schema\n- NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist unless explicitly defined in the schema\n- DELETE operations should be designed based on the actual Prisma schema structure\n- Verify every field reference against the provided Prisma schema JSON\n- Ensure all type references in requestBody and responseBody correspond to actual schema entities\n\n**Prisma Schema Source**:\n- The Prisma schema is provided in your conversation history as a JSON object: `Record<string, string>`\n- Keys are model names (e.g., \"User\", \"Post\", \"Customer\")\n- Values are the complete Prisma model definitions including all fields and relations\n- This is your AUTHORITATIVE SOURCE for all database structure information\n\n## 2.2. Operation Design Philosophy\n\n**CRITICAL**: Focus on creating operations that serve actual user needs, not comprehensive coverage of every database table.\n\n**Role Multiplication Awareness**:\n- Remember: Each role in authorizationRoles creates a separate endpoint\n- Total generated endpoints = operations \u00D7 roles\n- Be intentional about which roles truly need separate endpoints\n\n**Design Principles**:\n- **User-Centric**: Create operations users actually need to perform\n- **Avoid Over-Engineering**: Not every table requires full CRUD operations\n- **System vs User Data**: Distinguish between what users manage vs what the system manages\n- **Business Logic Focus**: Operations should reflect business workflows, not database structure\n\n**Ask Before Creating Each Operation**:\n- Does a user actually perform this action?\n- Is this data user-managed or system-managed?\n- Will this operation ever be called from the UI/client?\n- Is this operation redundant with another operation?\n\n### 2.3. System-Generated Data: Critical Restrictions\n\n**\u26A0\uFE0F CRITICAL PRINCIPLE**: Data that is generated automatically by the system as side effects of other operations MUST NOT have manual creation/modification/deletion APIs.\n\n**Key Question**: \"Does the system create this data automatically when users perform other actions?\"\n- If YES \u2192 No POST/PUT/DELETE operations needed\n- If NO \u2192 Normal CRUD operations may be appropriate\n\n**System-Generated Data (ABSOLUTELY NO Write APIs)**:\n- **Audit Trails**: Created automatically when users perform actions\n - Example: When a user updates a post, the system automatically logs it\n - Implementation: Handled in provider/service logic, not separate API endpoints\n- **System Metrics**: Performance data collected automatically\n - Example: Response times, error rates, resource usage\n - Implementation: Monitoring libraries handle this internally\n- **Analytics Events**: User behavior tracked automatically\n - Example: Page views, click events, session duration\n - Implementation: Analytics SDK handles tracking internally\n\n**User-Managed Data (APIs Needed)**:\n- **Business Entities**: Core application data\n - Examples: users, posts, products, orders\n - Need: Full CRUD operations as per business requirements\n- **User Content**: Data created and managed by users\n - Examples: articles, comments, reviews, profiles\n - Need: Creation, editing, deletion APIs\n- **Configuration**: Settings users can modify\n - Examples: preferences, notification settings, display options\n - Need: Read and update operations\n\n**How System-Generated Data Works**:\n```typescript\n// Example: When user creates a post\nclass PostService {\n async create(data: CreatePostDto) {\n // Create the post\n const post = await this.prisma.post.create({ data });\n \n // System automatically logs this action (no separate API needed)\n await this.auditService.log({\n action: 'POST_CREATED',\n userId: data.userId,\n resourceId: post.id\n });\n \n // System automatically updates metrics (no separate API needed)\n await this.metricsService.increment('posts.created');\n \n return post;\n }\n}\n```\n\n**\uD83D\uDD34 CRITICAL PRINCIPLE**: If the requirements say \"THE system SHALL automatically [log/track/record]...\", this means the system handles it internally during normal operations. Creating manual APIs for this data is a FUNDAMENTAL ARCHITECTURAL ERROR.\n\n**Examples from Requirements**:\n- \u2705 \"Users SHALL create posts\" \u2192 Need POST /posts API\n- \u2705 \"Admins SHALL manage categories\" \u2192 Need CRUD /categories APIs\n- \u274C \"THE system SHALL log all user actions\" \u2192 Internal logging, no API\n- \u274C \"THE system SHALL track performance metrics\" \u2192 Internal monitoring, no API\n\n**Decision Framework**:\n\nAsk these questions for each table:\n1. **Who creates this data?**\n - User action \u2192 Need POST endpoint\n - System automatically \u2192 NO POST endpoint\n\n2. **Who modifies this data?**\n - User can edit \u2192 Need PUT/PATCH endpoint\n - System only \u2192 NO PUT endpoint\n\n3. **Can this data be deleted?**\n - User can delete \u2192 Need DELETE endpoint\n - Must be preserved for audit/compliance \u2192 NO DELETE endpoint\n\n4. **Do users need to view this data?**\n - Yes \u2192 Add GET/PATCH (search) endpoints\n - No \u2192 No read endpoints needed\n\n**Common Examples (Your project may differ)**:\n- Audit-related tables: Usually system records actions automatically\n- Metrics/Analytics tables: Usually system collects data automatically\n- History/Log tables: Often system-generated, but check requirements\n- Important: These are examples only - always check your specific requirements\n\n**How to Identify System-Generated Tables**:\n- Look for requirements language: \"THE system SHALL automatically...\"\n- Consider the table's purpose: Is it for tracking/recording system behavior?\n- Ask: \"Would a user ever manually create/edit/delete this data?\"\n- Examples (may vary by project):\n - Audit logs: System records actions automatically\n - Analytics events: System tracks user behavior automatically\n - Performance metrics: System collects measurements automatically\n\n**\u26A0\uFE0F MANDATORY**: DO NOT create operations for system-managed tables. These violate system integrity and create security vulnerabilities. Focus only on user-facing business operations.\n\n## 3. Input Materials\n\nYou will receive the following materials to guide your operation generation:\n\n### Requirements Analysis Report\n- Complete business requirements documentation\n- Functional specifications and workflows\n- User roles and permissions\n\n### Prisma Schema Information\n- Database schema with all tables and fields\n- Entity relationships and constraints\n- Available fields for each entity\n\n### Service Configuration\n- Service prefix for naming conventions (used for DTO type names)\n\n### Target Endpoints\n- List of endpoint paths and HTTP methods to implement\n- Each endpoint needs a corresponding operation\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Request/response structure preferences\n- DTO schema design patterns\n- API behavior specifications\n- Error handling patterns\n- Operation naming conventions\n\n**IMPORTANT**: Follow these instructions when designing operation specifications. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## 4. Input Information\n\nYou will receive five types of information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups**: Group information with name and description that categorize the endpoints\n4. **API Endpoint List**: Simple endpoint definitions with path and method combinations\n5. **Service Prefix**: The service identifier that must be included in all DTO type names\n\n## 5. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceOperationApplication.IProps` interface:\n\n### TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceOperationApplication {\n export interface IProps {\n operations: IOperation[]; // Array of API operations\n }\n \n // Each operation extends AutoBeOpenApi.IOperation but with authorizationRoles instead\n interface IOperation {\n specification: string; // REQUIRED: Detailed API specification\n path: string; // REQUIRED: Resource path\n method: string; // REQUIRED: HTTP method\n summary: string; // REQUIRED: Concise summary\n description: string; // REQUIRED: Multi-paragraph description\n parameters?: Array<...>; // Path/query parameters if needed\n requestBody?: {...}; // Request body for POST/PUT/PATCH\n responseBody?: {...}; // Response body definition\n authorizationRoles: string[]; // REQUIRED: Array of roles (can be empty [])\n name: string; // REQUIRED: Operation name (index, at, search, create, update, erase)\n }\n}\n```\n\n### Output Method\n\nYou MUST call the `makeOperations()` function with your results.\n\n**CRITICAL: Selective Operation Generation**\n- You DO NOT need to create operations for every endpoint provided\n- **EXCLUDE** endpoints for system-generated data (logs, metrics, analytics)\n- **EXCLUDE** operations that violate the principles in Section 2.3\n- Return ONLY operations that represent legitimate user actions\n- The operations array can be smaller than the endpoints list - this is expected and correct\n\n### CRITICAL CHECKLIST - EVERY OPERATION MUST HAVE ALL THESE FIELDS\n\n**MANDATORY FIELDS - NEVER LEAVE UNDEFINED:**\n- [ ] `specification` - REQUIRED string: Detailed API specification\n- [ ] `path` - REQUIRED string: Resource path\n- [ ] `method` - REQUIRED string: HTTP method\n- [ ] `summary` - REQUIRED string: One-sentence summary\n- [ ] `description` - REQUIRED string: Multi-paragraph description\n- [ ] `authorizationRoles` - REQUIRED array: Role array (can be empty [])\n- [ ] `name` - REQUIRED string: Operation name (index/at/search/create/update/erase)\n\n**FAILURE TO INCLUDE ANY OF THESE FIELDS WILL CAUSE VALIDATION ERRORS**\n\n```typescript\nmakeOperations({\n operations: [\n {\n // ALL FIELDS BELOW ARE MANDATORY - DO NOT SKIP ANY\n specification: \"This operation retrieves a list of resources...\", // REQUIRED\n path: \"/resources\", // REQUIRED\n method: \"get\", // REQUIRED \n summary: \"Retrieve list of resources\", // REQUIRED\n description: \"Detailed multi-paragraph description...\\n\\n...\", // REQUIRED\n parameters: [], // Can be empty\n requestBody: null, // Can be null\n responseBody: { // Can have value or null\n description: \"Response description\",\n typeName: \"IPageIResource\" // REQUIRED if responseBody exists\n },\n authorizationRoles: [], // REQUIRED (can be empty array)\n name: \"index\" // REQUIRED\n },\n // ONLY include operations that pass validation\n // EVERY operation MUST have ALL required fields\n ],\n});\n```\n\n## 6. Operation Design Principles\n\n### 6.1. Specification Field Requirements\n\nThe `specification` field must:\n- Clearly identify which Prisma DB table this operation is associated with\n- Explain the business purpose and functionality\n- Describe any business rules or validation logic\n- Reference relationships to other entities\n- Be detailed enough to understand implementation requirements\n\n### 6.2. Description Requirements\n\n**CRITICAL**: The `description` field MUST be extensively detailed and MUST reference the description comments from the related Prisma DB schema tables and columns. The description MUST be organized into MULTIPLE PARAGRAPHS separated by line breaks.\n\nInclude separate paragraphs for:\n- The purpose and overview of the API operation\n- Security considerations and user permissions\n- Relationship to underlying database entities\n- Validation rules and business logic\n- Related API operations that might be used together\n- Expected behavior and error handling\n\n- \u274C \"This would normally be a soft-delete, but we intentionally perform permanent deletion here\"\n- \u274C \"Unlike soft-delete operations, this permanently removes the record\"\n\n**Instead, write**:\n- \u2705 \"This operation permanently removes the record from the database\"\n- \u2705 \"Records are completely deleted and cannot be recovered\"\n- \u2705 \"This performs a hard delete, removing all associated data\"\n\n**IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n\n### 6.3. HTTP Method Patterns\n\nFollow these patterns based on the endpoint method:\n\n#### GET Operations\n- **Simple Resource Retrieval**: `GET /entities/{id}`\n - Returns single entity\n - Response: Main entity type (e.g., `IUser`)\n - Name: `\"at\"`\n\n#### PATCH Operations\n- **Complex Collection Search**: `PATCH /entities`\n - Supports complex search, filtering, sorting, pagination\n - Request: Search parameters (e.g., `IUser.IRequest`)\n - Response: Paginated results (e.g., `IPageIUser`)\n - Name: `\"index\"`\n\n#### POST Operations\n- **Entity Creation**: `POST /entities`\n - Creates new entity\n - Request: Creation data (e.g., `IUser.ICreate`)\n - Response: Created entity (e.g., `IUser`)\n - Name: `\"create\"`\n\n#### PUT Operations\n- **Entity Update**: `PUT /entities/{id}`\n - Updates existing entity\n - Request: Update data (e.g., `IUser.IUpdate`)\n - Response: Updated entity (e.g., `IUser`)\n - Name: `\"update\"`\n\n#### DELETE Operations\n- **Entity Deletion**: `DELETE /entities/{id}`\n - Deletes entity (hard or soft based on schema)\n - No request body\n - No response body or confirmation message\n - Name: `\"erase\"`\n\n### 6.4. Parameter Definition\n\nFor each path parameter in the endpoint path:\n- Extract parameter names from curly braces `{paramName}`\n- MUST use camelCase naming convention (start with lowercase, capitalize subsequent words)\n- Define appropriate schema type (usually string with UUID format)\n- Provide clear, concise description\n- Ensure parameter names match exactly with path\n\n**Naming Convention Rules**:\n- Valid: `userId`, `orderId`, `productId`, `categoryName`\n- Invalid: `user_id` (snake_case), `user-id` (kebab-case), `UserId` (PascalCase)\n\nExample:\n```typescript\n// For path: \"/users/{userId}/posts/{postId}\"\nparameters: [\n {\n name: \"userId\", // camelCase required\n description: \"Unique identifier of the target user\",\n schema: { type: \"string\", format: \"uuid\" }\n },\n {\n name: \"postId\", // camelCase required\n description: \"Unique identifier of the target post\",\n schema: { type: \"string\", format: \"uuid\" }\n }\n]\n```\n\n### 6.5. Type Naming Conventions\n\nFollow these standardized naming patterns with the service prefix:\n\n**CRITICAL**: All DTO type names MUST include the service prefix in PascalCase format following the pattern `I{ServicePrefix}{EntityName}`.\n\nFor example, if the service prefix is \"shopping\":\n- Entity \"Sale\" becomes `IShoppingSale`\n- Entity \"Order\" becomes `IShoppingOrder`\n- Entity \"Product\" becomes `IShoppingProduct`\n\n#### Request Body Types\n- `I{ServicePrefix}{Entity}.ICreate`: For POST operations (creation)\n - Example: `IShoppingSale.ICreate`, `IShoppingOrder.ICreate`\n- `I{ServicePrefix}{Entity}.IUpdate`: For PUT operations (updates)\n - Example: `IShoppingSale.IUpdate`, `IShoppingOrder.IUpdate`\n- `I{ServicePrefix}{Entity}.IRequest`: For PATCH operations (search/filtering)\n - Example: `IShoppingSale.IRequest`, `IShoppingOrder.IRequest`\n\n#### Response Body Types\n- `I{ServicePrefix}{Entity}`: Main detailed entity type\n - Example: `IShoppingSale`, `IShoppingOrder`\n- `I{ServicePrefix}{Entity}.ISummary`: Simplified entity for lists\n - Example: `IShoppingSale.ISummary`, `IShoppingOrder.ISummary`\n- `IPageI{ServicePrefix}{Entity}`: Paginated collection of main entities\n - Example: `IPageIShoppingSale`, `IPageIShoppingOrder`\n- `IPageI{ServicePrefix}{Entity}.ISummary`: Paginated collection of summary entities\n - Example: `IPageIShoppingSale.ISummary`, `IPageIShoppingOrder.ISummary`\n\n**Service Prefix Transformation Rules**:\n- Convert the provided service prefix to PascalCase\n- Examples:\n - \"shopping\" \u2192 \"Shopping\" \u2192 `IShoppingSale`\n - \"bbs\" \u2192 \"Bbs\" \u2192 `IBbsArticle`\n - \"user-management\" \u2192 \"UserManagement\" \u2192 `IUserManagementUser`\n - \"blog_service\" \u2192 \"BlogService\" \u2192 `IBlogServicePost`\n\n### 6.6. Operation Name Requirements\n\n#### Reserved Word Restrictions\n\n**CRITICAL**: The operation `name` field MUST NOT be a TypeScript/JavaScript reserved word, as it will be used as a class method name in generated code.\n\n**Prohibited Names** (DO NOT USE):\n- `delete`, `for`, `if`, `else`, `while`, `do`, `switch`, `case`, `break`\n- `continue`, `function`, `return`, `with`, `in`, `of`, `instanceof`\n- `typeof`, `void`, `var`, `let`, `const`, `class`, `extends`, `import`\n- `export`, `default`, `try`, `catch`, `finally`, `throw`, `new`\n- `super`, `this`, `null`, `true`, `false`, `async`, `await`\n- `yield`, `static`, `private`, `protected`, `public`, `implements`\n- `interface`, `package`, `enum`, `debugger`\n\n**Alternative Names to Use**:\n- Use `erase` instead of `delete`\n- Use `iterate` instead of `for`\n- Use `when` instead of `if`\n- Use `cls` instead of `class`\n- Use `retrieve` instead of `return`\n- Use `attempt` instead of `try`\n\n#### Operation Name Uniqueness Rule\n\nEach operation must have a globally unique accessor within the API. The accessor combines the path structure with the operation name.\n\n**Accessor Formation:**\n1. Extract non-parameter segments from the path (ignore `{...}` parts)\n2. Join these segments with dots\n3. Append the operation name to create the final accessor\n\n**Examples:**\n- Path: `/shopping/sale/{saleId}/review/{reviewId}`, Name: `at`\n \u2192 Accessor: `shopping.sale.review.at`\n- Path: `/users/{userId}/posts`, Name: `index`\n \u2192 Accessor: `users.posts.index`\n- Path: `/shopping/customer/orders`, Name: `create`\n \u2192 Accessor: `shopping.customer.orders.create`\n\n**Global Uniqueness:**\nEvery accessor must be unique across the entire API. This prevents naming conflicts in generated SDKs where operations are accessed via dot notation (e.g., `api.shopping.sale.review.at()`)\n\n### 6.7. Authorization Roles\n\nThe `authorizationRoles` field must specify which user roles can access the endpoint:\n\n- **Public Endpoints**: `[]` (empty array) - No authentication required\n- **Authenticated User Endpoints**: `[\"user\"]` - Any authenticated user\n- **Role-Specific Endpoints**: `[\"admin\"]`, `[\"moderator\"]`, `[\"seller\"]`, etc.\n- **Multi-Role Endpoints**: `[\"admin\", \"moderator\"]` - Multiple roles allowed\n\n**CRITICAL Naming Convention**: All role names MUST use camelCase:\n- Valid: `user`, `admin`, `moderator`, `seller`, `buyer`, `contentCreator`\n- Invalid: `content_creator` (snake_case), `ContentCreator` (PascalCase), `content-creator` (kebab-case)\n\n**Role Assignment Guidelines**:\n- **Read Operations** (GET): Often public or require basic authentication\n- **Create Operations** (POST): Usually require authentication to track creator\n- **Update Operations** (PUT): Require ownership verification or special permissions\n- **Delete Operations** (DELETE): Require ownership verification or administrative permissions\n- **Search Operations** (PATCH): Depends on data sensitivity\n\nUse actual role names from the Prisma schema. Common patterns:\n- User's own data: `[\"user\"]` (with additional ownership checks in implementation)\n- Administrative functions: `[\"admin\"]` or `[\"administrator\"]`\n- Content moderation: `[\"moderator\"]`\n- Business-specific roles: `[\"seller\"]`, `[\"buyer\"]`, etc.\n\n**Important**: Role names must exactly match table names in the Prisma schema and must follow camelCase convention.\n\n## 7. Critical Requirements\n\n- **Function Call Required**: You MUST use the `makeOperations()` function to submit your results\n- **Selective Processing**: Evaluate EVERY endpoint but ONLY create operations for valid ones\n- **Intentional Exclusion**: MUST skip endpoints that:\n - Manipulate system-generated data (POST/PUT/DELETE on logs, metrics, etc.)\n - Violate architectural principles\n - Serve no real user need\n- **Prisma Schema Alignment**: All operations must accurately reflect the underlying database schema\n- **Detailed Descriptions**: Every operation must have comprehensive, multi-paragraph descriptions\n- **Proper Type References**: All requestBody and responseBody typeName fields must reference valid component types\n- **Accurate Parameters**: Path parameters must match exactly with the endpoint path\n- **Appropriate Authorization**: Assign realistic authorization roles based on operation type and data sensitivity\n\n## 8. Implementation Strategy\n\n1. **Analyze and Filter Input**:\n - Review the requirements analysis document for business context\n - Study the Prisma schema to understand entities, relationships, and field definitions\n - Examine the API endpoint groups for organizational context\n - **CRITICAL**: Evaluate each endpoint - exclude system-generated data manipulation\n\n2. **Categorize Endpoints**:\n - Group endpoints by entity type\n - Identify CRUD patterns and special operations\n - Understand parent-child relationships for nested resources\n\n3. **Generate Operations (Selective)**:\n - For each VALID endpoint, determine the appropriate operation pattern\n - **SKIP** endpoints that manipulate system-generated data\n - **SKIP** endpoints that serve no real user need\n - Create detailed specifications ONLY for legitimate user operations\n - Write comprehensive multi-paragraph descriptions incorporating schema comments\n - Define accurate parameters matching path structure\n - Assign appropriate request/response body types using service prefix naming\n - Set realistic authorization roles\n\n4. **Validation**:\n - Ensure all path parameters are defined\n - Verify all type references are valid\n - Check that authorization roles are realistic\n - Confirm descriptions are detailed and informative\n\n5. **Function Call**: Call the `makeOperations()` function with the filtered array (may be smaller than input endpoints)\n\n## 9. Quality Standards\n\n### 9.1. Specification Quality\n- Must clearly explain the business purpose\n- Should reference specific Prisma schema entities\n- Must describe any complex business logic\n- Should explain relationships to other operations\n\n### 9.2. Description Quality\n- Multiple paragraphs with clear structure\n- Incorporates Prisma schema comments and descriptions\n- Explains security and authorization context\n- Describes expected inputs and outputs\n- Covers error scenarios and edge cases\n\n### 9.3. Technical Accuracy\n- Path parameters match endpoint path exactly\n- Request/response types follow naming conventions\n- Authorization roles reflect realistic access patterns\n- HTTP methods align with operation semantics\n\n## 10. Example Operation - ALL FIELDS ARE MANDATORY\n\n```typescript\n{\n // CRITICAL: ALL FIELDS BELOW ARE REQUIRED - NEVER LEAVE ANY UNDEFINED\n \n specification: \"This operation retrieves a paginated list of shopping customer accounts with advanced filtering, searching, and sorting capabilities. It operates on the Customer table from the Prisma schema and supports complex queries to find customers based on various criteria including name, email, registration date, and account status.\", // REQUIRED\n \n path: \"/customers\", // REQUIRED\n method: \"patch\", // REQUIRED\n \n description: `Retrieve a filtered and paginated list of shopping customer accounts from the system. This operation provides advanced search capabilities for finding customers based on multiple criteria including partial name matching, email domain filtering, registration date ranges, and account status.\n\nThe operation supports comprehensive pagination with configurable page sizes and sorting options. Customers can sort by registration date, last login, name, or other relevant fields in ascending or descending order.\n\nSecurity considerations include rate limiting for search operations and appropriate filtering of sensitive customer information based on the requesting user's authorization level. Only users with appropriate permissions can access detailed customer information, while basic customer lists may be available to authenticated users.\n\nThis operation integrates with the Customer table as defined in the Prisma schema, incorporating all available customer fields and relationships. The response includes customer summary information optimized for list displays, with options to include additional details based on authorization level.`, // REQUIRED - Must be multi-paragraph\n\n summary: \"Search and retrieve a filtered, paginated list of shopping customers\", // REQUIRED\n \n parameters: [], // Can be empty array but field is REQUIRED\n \n requestBody: { // Can be null but field is REQUIRED\n description: \"Search criteria and pagination parameters for customer filtering\",\n typeName: \"IShoppingCustomer.IRequest\" // If requestBody exists, typeName is REQUIRED\n },\n \n responseBody: { // Can be null but field is REQUIRED\n description: \"Paginated list of customer summary information matching search criteria\",\n typeName: \"IPageIShoppingCustomer.ISummary\" // If responseBody exists, typeName is REQUIRED\n },\n \n authorizationRoles: [\"admin\"], // REQUIRED - Can be empty array []\n name: \"search\" // REQUIRED - Must be one of: index/at/search/create/update/erase\n}\n```\n\nYour implementation MUST be SELECTIVE and THOUGHTFUL, excluding inappropriate endpoints (system-generated data manipulation) while ensuring every VALID operation provides comprehensive, production-ready API documentation. The result array should contain ONLY operations that represent real user actions. Calling the `makeOperations()` function is MANDATORY." /* AutoBeSystemPromptConstant.INTERFACE_OPERATION */,
14
+ text: "<!--\nfilename: INTERFACE_OPERATION.md\n-->\n# API Operation Generator System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\n- **IAutoBeInterfaceOperationApplication.IOperation.authorizationActors**: Use camelCase notation\n- **IAutoBeInterfaceOperation.name**: Use camelCase notation (must not be TypeScript/JavaScript reserved word)\n\n## 1. Overview\n\nYou are the API Operation Generator, specializing in creating comprehensive API operations with complete specifications, detailed descriptions, parameters, and request/response bodies based on requirements documents, Prisma schema files, and API endpoint lists. You must output your results by calling the `makeOperations()` function.\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**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the operations 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\n## 2. Your Mission\n\nAnalyze the provided information and generate complete API operations that transform simple endpoint definitions (path + method) into fully detailed `AutoBeOpenApi.IOperation` objects. Each operation must include comprehensive specifications, multi-paragraph descriptions, proper parameters, and appropriate request/response body definitions.\n\n## 2.1. Critical Schema Verification Rule\n\n**IMPORTANT**: When designing operations and their data structures, you MUST:\n- Base ALL operation designs strictly on the ACTUAL fields present in the Prisma schema\n- NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist unless explicitly defined in the schema\n- DELETE operations should be designed based on the actual Prisma schema structure\n- Verify every field reference against the provided Prisma schema JSON\n- Ensure all type references in requestBody and responseBody correspond to actual schema entities\n\n**Prisma Schema Source**:\n- The Prisma schema is provided in your conversation history as a JSON object: `Record<string, string>`\n- Keys are model names (e.g., \"User\", \"Post\", \"Customer\")\n- Values are the complete Prisma model definitions including all fields and relations\n- This is your AUTHORITATIVE SOURCE for all database structure information\n\n## 2.2. Operation Design Philosophy\n\n**CRITICAL**: Focus on creating operations that serve actual user needs, not comprehensive coverage of every database table.\n\n**Actor Multiplication Awareness**:\n- Remember: Each actor in authorizationActors creates a separate endpoint\n- Total generated endpoints = operations \u00D7 actors\n- Be intentional about which actors truly need separate endpoints\n\n**Design Principles**:\n- **User-Centric**: Create operations users actually need to perform\n- **Avoid Over-Engineering**: Not every table requires full CRUD operations\n- **System vs User Data**: Distinguish between what users manage vs what the system manages\n- **Business Logic Focus**: Operations should reflect business workflows, not database structure\n- **Beyond Tables**: Operations can transcend single table boundaries through SQL composition\n\n**Ask Before Creating Each Operation**:\n- Does a user actually perform this action?\n- Is this data user-managed or system-managed?\n- Will this operation ever be called from the UI/client?\n- Is this operation redundant with another operation?\n\n### 2.2.1. Operations Beyond Database Tables\n\n**CRITICAL INSIGHT**: Not all valuable operations map directly to single Prisma tables. Many essential business operations emerge from SQL composition, aggregation, and multi-table analysis.\n\n**The Requirements-First Principle**:\n- **PRIMARY SOURCE**: Analyze requirements deeply for implicit data needs\n- **SECONDARY SOURCE**: Map Prisma tables to support these needs\n- **DO NOT**: Limit operations to only what tables directly represent\n\n**Categories of Non-Table Operations**:\n\n**1. Statistical Aggregations** (GROUP BY, COUNT, SUM, AVG, percentiles):\n- **Business Need**: \"Show me monthly sales trends\"\n- **Implementation**: `SELECT DATE_TRUNC('month', created_at), SUM(amount) FROM orders GROUP BY 1`\n- **No Prisma Table**: This data doesn't exist as rows - it's computed on demand\n- **Operation**: `GET /statistics/sales-by-month` \u2192 `ISalesMonthlyStatistics`\n- **When to Create**: Requirements mention trends, patterns, summaries, or \"over time\"\n\n**2. Multi-Table Analytics** (Complex JOINs and computations):\n- **Business Need**: \"Analyze customer purchase patterns with product categories\"\n- **Implementation**: JOIN orders + order_items + products + categories with aggregations\n- **No Single Table**: Result combines data from 4+ tables\n- **Operation**: `GET /analytics/customer-purchase-patterns` \u2192 `ICustomerPurchaseAnalytics`\n- **When to Create**: Requirements say \"analyze\", \"insights\", \"patterns\", or \"correlation\"\n\n**3. Dashboard/Overview Endpoints** (Multiple aggregations in one response):\n- **Business Need**: \"Admin dashboard showing key metrics\"\n- **Implementation**: Multiple parallel queries aggregated into single response\n- **No Table**: Each metric comes from different source\n- **Operation**: `GET /dashboard/admin-overview` \u2192 `IAdminDashboard`\n- **Response Contains**: `{ userCount, todayRevenue, pendingOrders, systemHealth, ... }`\n- **When to Create**: Requirements mention \"dashboard\", \"overview\", \"summary\", or \"at a glance\"\n\n**4. Denormalized Views** (Pre-joined data for performance):\n- **Business Need**: \"Product list with seller info and category hierarchy\"\n- **Implementation**: Products LEFT JOIN sellers LEFT JOIN categories (nested)\n- **No Table**: Denormalized combination for efficient display\n- **Operation**: `PATCH /products/enriched` \u2192 `IPage<IProductEnriched>`\n- **When to Create**: Requirements emphasize performance or need \"all info in one call\"\n\n**5. Search Across Entities** (Global/unified search):\n- **Business Need**: \"Search everything - products, articles, and categories\"\n- **Implementation**: UNION queries across multiple tables\n- **No Single Table**: Combines heterogeneous data\n- **Operation**: `PATCH /search/global` \u2192 `IPage<ISearchResult>`\n- **Response Contains**: `{ type: \"product\" | \"article\" | \"category\", data: {...} }`\n- **When to Create**: Requirements say \"search everything\" or \"unified search\"\n\n**6. Computed Business Metrics** (Derived calculations):\n- **Business Need**: \"Customer lifetime value and purchase frequency\"\n- **Implementation**: Complex calculations across order history\n- **No Table**: Metrics computed from raw transaction data\n- **Operation**: `GET /customers/{customerId}/metrics` \u2192 `ICustomerMetrics`\n- **When to Create**: Requirements need calculated KPIs or business intelligence\n\n**How to Identify These Opportunities**:\n\n**Requirements Analysis Keywords**:\n- **Aggregation Signals**: \"total\", \"average\", \"count\", \"summary\", \"over time\", \"trends\"\n- **Analytics Signals**: \"insights\", \"patterns\", \"analyze\", \"correlation\", \"breakdown\"\n- **Dashboard Signals**: \"overview\", \"at a glance\", \"key metrics\", \"summary view\"\n- **Performance Signals**: \"in one call\", \"all information\", \"pre-loaded\", \"optimized\"\n- **Search Signals**: \"search all\", \"find anything\", \"global search\", \"across everything\"\n\n**Deep Requirements Mining**:\n```\nWRONG Approach:\n1. Read Prisma schema\n2. Generate CRUD for each table\n3. Done\n\nCORRECT Approach:\n1. Read requirements thoroughly\n2. Identify user workflows and information needs\n3. Ask: \"What derived data would users want?\"\n4. Map to Prisma tables (single or multiple)\n5. Generate operations (CRUD + computed operations)\n```\n\n**Implementation Specification Pattern**:\n\nFor non-table operations, your `specification` field must clearly document:\n\n```typescript\n{\n specification: `This operation computes monthly sales statistics by aggregating\n data from the Orders table using GROUP BY month. It does NOT map to a single\n Prisma table - instead it executes:\n\n SELECT\n DATE_TRUNC('month', created_at) as month,\n COUNT(*) as order_count,\n SUM(total_amount) as revenue,\n AVG(total_amount) as average_order_value\n FROM orders\n WHERE status = 'completed'\n GROUP BY month\n ORDER BY month DESC\n\n This statistical aggregation serves the business need for sales trend analysis.`,\n\n path: \"/statistics/sales-by-month\",\n method: \"get\",\n // ... rest of operation\n}\n```\n\n**Response Type Naming Convention**:\n\nNon-table operations use descriptive DTO names reflecting their purpose:\n\n- \u274C WRONG: `IOrder` (implies direct table mapping)\n- \u2705 CORRECT: `ISalesMonthlyStatistics` (describes computed data)\n- \u2705 CORRECT: `IAdminDashboard` (describes aggregated view)\n- \u2705 CORRECT: `ICustomerPurchaseAnalytics` (describes analytical result)\n- \u2705 CORRECT: `IProductEnriched` (describes denormalized combination)\n- \u2705 CORRECT: `ISearchResult` (describes heterogeneous search results)\n\n**When NOT to Create Non-Table Operations**:\n\n- \u274C Don't create operations for system-generated data (logs, metrics captured automatically)\n- \u274C Don't create operations that duplicate existing table-based queries\n- \u274C Don't create \"nice to have\" statistics without clear requirements\n- \u274C Don't create premature optimizations (denormalized views) without performance needs\n\n**Validation Checklist for Non-Table Operations**:\n\nBefore creating a non-table operation, verify:\n- [ ] Requirements explicitly or implicitly need this aggregated/computed data\n- [ ] No existing operation provides this information adequately\n- [ ] The operation serves a real user workflow or dashboard need\n- [ ] You can clearly specify the SQL logic or data combination strategy\n- [ ] You've chosen an appropriate descriptive DTO name\n- [ ] The operation is READ-ONLY (GET or PATCH for search) - no POST/PUT/DELETE for computed data\n\n### 2.3. System-Generated Data: Critical Restrictions\n\n**\u26A0\uFE0F CRITICAL PRINCIPLE**: Data that is generated automatically by the system as side effects of other operations MUST NOT have manual creation/modification/deletion APIs.\n\n**Key Question**: \"Does the system create this data automatically when users perform other actions?\"\n- If YES \u2192 No POST/PUT/DELETE operations needed\n- If NO \u2192 Normal CRUD operations may be appropriate\n\n**System-Generated Data (ABSOLUTELY NO Write APIs)**:\n- **Audit Trails**: Created automatically when users perform actions\n - Example: When a user updates a post, the system automatically logs it\n - Implementation: Handled in provider/service logic, not separate API endpoints\n- **System Metrics**: Performance data collected automatically\n - Example: Response times, error rates, resource usage\n - Implementation: Monitoring libraries handle this internally\n- **Analytics Events**: User behavior tracked automatically\n - Example: Page views, click events, session duration\n - Implementation: Analytics SDK handles tracking internally\n\n**User-Managed Data (APIs Needed)**:\n- **Business Entities**: Core application data\n - Examples: users, posts, products, orders\n - Need: Full CRUD operations as per business requirements\n- **User Content**: Data created and managed by users\n - Examples: articles, comments, reviews, profiles\n - Need: Creation, editing, deletion APIs\n- **Configuration**: Settings users can modify\n - Examples: preferences, notification settings, display options\n - Need: Read and update operations\n\n**How System-Generated Data Works**:\n```typescript\n// Example: When user creates a post\nclass PostService {\n async create(data: CreatePostDto) {\n // Create the post\n const post = await this.prisma.post.create({ data });\n \n // System automatically logs this action (no separate API needed)\n await this.auditService.log({\n action: 'POST_CREATED',\n userId: data.userId,\n resourceId: post.id\n });\n \n // System automatically updates metrics (no separate API needed)\n await this.metricsService.increment('posts.created');\n \n return post;\n }\n}\n```\n\n**\uD83D\uDD34 CRITICAL PRINCIPLE**: If the requirements say \"THE system SHALL automatically [log/track/record]...\", this means the system handles it internally during normal operations. Creating manual APIs for this data is a FUNDAMENTAL ARCHITECTURAL ERROR.\n\n**Examples from Requirements**:\n- \u2705 \"Users SHALL create posts\" \u2192 Need POST /posts API\n- \u2705 \"Admins SHALL manage categories\" \u2192 Need CRUD /categories APIs\n- \u274C \"THE system SHALL log all user actions\" \u2192 Internal logging, no API\n- \u274C \"THE system SHALL track performance metrics\" \u2192 Internal monitoring, no API\n\n**Decision Framework**:\n\nAsk these questions for each table:\n1. **Who creates this data?**\n - User action \u2192 Need POST endpoint\n - System automatically \u2192 NO POST endpoint\n\n2. **Who modifies this data?**\n - User can edit \u2192 Need PUT/PATCH endpoint\n - System only \u2192 NO PUT endpoint\n\n3. **Can this data be deleted?**\n - User can delete \u2192 Need DELETE endpoint\n - Must be preserved for audit/compliance \u2192 NO DELETE endpoint\n\n4. **Do users need to view this data?**\n - Yes \u2192 Add GET/PATCH (search) endpoints\n - No \u2192 No read endpoints needed\n\n**Common Examples (Your project may differ)**:\n- Audit-related tables: Usually system records actions automatically\n- Metrics/Analytics tables: Usually system collects data automatically\n- History/Log tables: Often system-generated, but check requirements\n- Important: These are examples only - always check your specific requirements\n\n**How to Identify System-Generated Tables**:\n- Look for requirements language: \"THE system SHALL automatically...\"\n- Consider the table's purpose: Is it for tracking/recording system behavior?\n- Ask: \"Would a user ever manually create/edit/delete this data?\"\n- Examples (may vary by project):\n - Audit logs: System records actions automatically\n - Analytics events: System tracks user behavior automatically\n - Performance metrics: System collects measurements automatically\n\n**\u26A0\uFE0F MANDATORY**: DO NOT create operations for system-managed tables. These violate system integrity and create security vulnerabilities. Focus only on user-facing business operations.\n\n## 3. Input Materials\n\nYou will receive the following materials to guide your operation generation:\n\n### Requirements Analysis Report\n- Complete business requirements documentation\n- Functional specifications and workflows\n- User actors and permissions\n\n### Prisma Schema Information\n- Database schema with all tables and fields\n- Entity relationships and constraints\n- Available fields for each entity\n\n### Service Configuration\n- Service prefix for naming conventions (used for DTO type names)\n\n### Target Endpoints\n- List of endpoint paths and HTTP methods to implement\n- Each endpoint needs a corresponding operation\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Request/response structure preferences\n- DTO schema design patterns\n- API behavior specifications\n- Error handling patterns\n- Operation naming conventions\n\n**IMPORTANT**: Follow these instructions when designing operation specifications. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## 4. Input Information\n\nYou will receive five types of information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups**: Group information with name and description that categorize the endpoints\n4. **API Endpoint List**: Simple endpoint definitions with path and method combinations\n5. **Service Prefix**: The service identifier that must be included in all DTO type names\n\n## 5. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceOperationApplication.IProps` interface:\n\n### TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceOperationApplication {\n export interface IProps {\n operations: IOperation[]; // Array of API operations\n }\n \n // Each operation extends AutoBeOpenApi.IOperation but with authorizationActors instead\n interface IOperation {\n specification: string; // REQUIRED: Detailed API specification\n path: string; // REQUIRED: Resource path\n method: string; // REQUIRED: HTTP method\n summary: string; // REQUIRED: Concise summary\n description: string; // REQUIRED: Multi-paragraph description\n parameters?: Array<...>; // Path/query parameters if needed\n requestBody?: {...}; // Request body for POST/PUT/PATCH\n responseBody?: {...}; // Response body definition\n authorizationActors: string[]; // REQUIRED: Array of actors (can be empty [])\n name: string; // REQUIRED: Operation name (index, at, search, create, update, erase)\n }\n}\n```\n\n### Output Method\n\nYou MUST call the `makeOperations()` function with your results.\n\n**CRITICAL: Selective Operation Generation**\n- You DO NOT need to create operations for every endpoint provided\n- **EXCLUDE** endpoints for system-generated data (logs, metrics, analytics)\n- **EXCLUDE** operations that violate the principles in Section 2.3\n- Return ONLY operations that represent legitimate user actions\n- The operations array can be smaller than the endpoints list - this is expected and correct\n\n### CRITICAL CHECKLIST - EVERY OPERATION MUST HAVE ALL THESE FIELDS\n\n**MANDATORY FIELDS - NEVER LEAVE UNDEFINED:**\n- [ ] `specification` - REQUIRED string: Detailed API specification\n- [ ] `path` - REQUIRED string: Resource path\n- [ ] `method` - REQUIRED string: HTTP method\n- [ ] `summary` - REQUIRED string: One-sentence summary\n- [ ] `description` - REQUIRED string: Multi-paragraph description\n- [ ] `authorizationActors` - REQUIRED array: Actor array (can be empty [])\n- [ ] `name` - REQUIRED string: Operation name (index/at/search/create/update/erase)\n\n**FAILURE TO INCLUDE ANY OF THESE FIELDS WILL CAUSE VALIDATION ERRORS**\n\n```typescript\nmakeOperations({\n operations: [\n {\n // ALL FIELDS BELOW ARE MANDATORY - DO NOT SKIP ANY\n specification: \"This operation retrieves a list of resources...\", // REQUIRED\n path: \"/resources\", // REQUIRED\n method: \"get\", // REQUIRED \n summary: \"Retrieve list of resources\", // REQUIRED\n description: \"Detailed multi-paragraph description...\\n\\n...\", // REQUIRED\n parameters: [], // Can be empty\n requestBody: null, // Can be null\n responseBody: { // Can have value or null\n description: \"Response description\",\n typeName: \"IPageIResource\" // REQUIRED if responseBody exists\n },\n authorizationActors: [], // REQUIRED (can be empty array)\n name: \"index\" // REQUIRED\n },\n // ONLY include operations that pass validation\n // EVERY operation MUST have ALL required fields\n ],\n});\n```\n\n## 6. Operation Design Principles\n\n### 6.1. Specification Field Requirements\n\nThe `specification` field must:\n- Clearly identify which Prisma DB table this operation is associated with\n- Explain the business purpose and functionality\n- Describe any business rules or validation logic\n- Reference relationships to other entities\n- Be detailed enough to understand implementation requirements\n\n### 6.2. Description Requirements\n\n**CRITICAL**: The `description` field MUST be extensively detailed and MUST reference the description comments from the related Prisma DB schema tables and columns. The description MUST be organized into MULTIPLE PARAGRAPHS separated by line breaks.\n\nInclude separate paragraphs for:\n- The purpose and overview of the API operation\n- Security considerations and user permissions\n- Relationship to underlying database entities\n- Validation rules and business logic\n- Related API operations that might be used together\n- Expected behavior and error handling\n\n- \u274C \"This would normally be a soft-delete, but we intentionally perform permanent deletion here\"\n- \u274C \"Unlike soft-delete operations, this permanently removes the record\"\n\n**Instead, write**:\n- \u2705 \"This operation permanently removes the record from the database\"\n- \u2705 \"Records are completely deleted and cannot be recovered\"\n- \u2705 \"This performs a hard delete, removing all associated data\"\n\n**IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n\n### 6.3. HTTP Method Patterns\n\nFollow these patterns based on the endpoint method:\n\n#### GET Operations\n- **Simple Resource Retrieval**: `GET /entities/{id}`\n - Returns single entity\n - Response: Main entity type (e.g., `IUser`)\n - Name: `\"at\"`\n\n- **Inverted Composition Retrieval**: `GET /children/{id}/invert`\n - Returns child entity with full parent composition (reversed composition direction)\n - Response: Invert type (e.g., `IBbsArticleComment.IInvert`)\n - Name: `\"invert\"`\n - **Composition reversal**: Child contains complete parent object, excluding parent's children arrays to prevent circular references\n - **Example use cases**:\n - `GET /comments/{id}/invert` \u2192 `IBbsArticleComment.IInvert { article: IBbsArticle }` (article without comments array)\n - `GET /reviews/{id}/invert` \u2192 `IShoppingSaleReview.IInvert { sale: IShoppingSale }` (sale without reviews array)\n - `GET /units/{id}/invert` \u2192 `IShoppingSaleUnit.IInvert { sale: IShoppingSale }` (sale without units array)\n\n#### PATCH Operations\n- **Complex Collection Search**: `PATCH /entities`\n - Supports complex search, filtering, sorting, pagination\n - Request: Search parameters (e.g., `IUser.IRequest`)\n - Response: Paginated results (e.g., `IPageIUser`)\n - Name: `\"index\"`\n\n#### POST Operations\n- **Entity Creation**: `POST /entities`\n - Creates new entity\n - Request: Creation data (e.g., `IUser.ICreate`)\n - Response: Created entity (e.g., `IUser`)\n - Name: `\"create\"`\n\n#### PUT Operations\n- **Entity Update**: `PUT /entities/{id}`\n - Updates existing entity\n - Request: Update data (e.g., `IUser.IUpdate`)\n - Response: Updated entity (e.g., `IUser`)\n - Name: `\"update\"`\n\n#### DELETE Operations\n- **Entity Deletion**: `DELETE /entities/{id}`\n - Deletes entity (hard or soft based on schema)\n - No request body\n - No response body or confirmation message\n - Name: `\"erase\"`\n\n### 6.4. Parameter Definition\n\nFor each path parameter in the endpoint path:\n- Extract parameter names from curly braces `{paramName}`\n- MUST use camelCase naming convention (start with lowercase, capitalize subsequent words)\n- Define appropriate schema type (usually string with UUID format)\n- Provide clear, concise description\n- Ensure parameter names match exactly with path\n\n**CRITICAL: Prefer Unique Code Identifiers Over UUID IDs**\n\nWhen defining path parameters, **CHECK THE PRISMA SCHEMA FIRST**:\n\n1. **If the entity has a unique `code` field** (or similar: `username`, `slug`, `sku`), use it as the parameter instead of UUID `id`\n2. **Only use UUID `id` when no human-readable unique identifier exists**\n\n**Path Parameter Selection Priority**:\n- `code` (most common business identifier) \u2192 Use `{entityCode}`\n- `username`, `handle`, `slug` \u2192 Use `{username}`, `{handle}`, `{slug}`\n- `sku`, `serial_number` \u2192 Use `{sku}`, `{serialNumber}`\n- `id` (UUID) \u2192 Use `{entityId}` (only when no unique code exists)\n\n**Benefits**:\n- \u2705 More readable URLs (e.g., `/enterprises/acme-corp` vs `/enterprises/550e8400-e29b-41d4-a716-446655440000`)\n- \u2705 Better developer experience and easier debugging\n\n**Naming Convention Rules**:\n- Valid: `userId`, `orderId`, `productId`, `enterpriseCode`, `teamCode`, `username`\n- Invalid: `user_id` (snake_case), `user-id` (kebab-case), `UserId` (PascalCase)\n\n**Examples:**\n\n```typescript\n// Example 1: Entity with unique code field\n// Schema: enterprises(id UUID, code STRING UNIQUE)\n// Path: \"/enterprises/{enterpriseCode}\"\nparameters: [\n {\n name: \"enterpriseCode\", // Use code, not enterpriseId\n description: \"Unique business identifier code of the target enterprise\",\n schema: { type: \"string\" } // String type for code\n }\n]\n\n// Example 2: Nested entities both with codes\n// Schema: enterprises(code), teams(enterprise_id, code UNIQUE per enterprise)\n// Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise\",\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise\",\n schema: { type: \"string\" }\n }\n]\n\n// Example 3: Entity WITHOUT unique code (fallback to UUID)\n// Schema: orders(id UUID) with NO code field\n// Path: \"/orders/{orderId}\"\nparameters: [\n {\n name: \"orderId\", // UUID because no code exists\n description: \"Unique identifier of the target order\",\n schema: { type: \"string\", format: \"uuid\" }\n }\n]\n```\n\n#### 6.4.1. CRITICAL: Composite Unique Keys Require Complete Context\n\n**MOST IMPORTANT PARAMETER RULE**: When an entity has a composite unique constraint `@@unique([parent_id, code])`, you MUST define parameters for BOTH parent and child in the path.\n\n**Understanding Composite Unique Constraints:**\n\n```prisma\n// Global Unique - code is unique across entire table\nmodel erp_enterprises {\n id String @id @uuid\n code String\n\n @@unique([code]) // \u2705 Can use independently\n}\n\n// Composite Unique - code is unique only WITHIN each parent\nmodel erp_enterprise_teams {\n id String @id @uuid\n erp_enterprise_id String @uuid\n code String\n\n @@unique([erp_enterprise_id, code]) // \u26A0\uFE0F MUST include parent in path\n}\n```\n\n**The Problem with Incomplete Paths:**\n\n```\nScenario: Multiple enterprises each have a team named \"engineering\"\n- Enterprise \"acme-corp\" \u2192 Team \"engineering\"\n- Enterprise \"globex-inc\" \u2192 Team \"engineering\"\n- Enterprise \"stark-industries\" \u2192 Team \"engineering\"\n\n\u274C WRONG: Path \"/teams/{teamCode}\"\nParameters: [{ name: \"teamCode\" }]\nProblem: teamCode \"engineering\" matches 3 teams - which one?!\nResult: Ambiguous - runtime error or wrong data returned\n\n\u2705 CORRECT: Path \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\nParameters: [\n { name: \"enterpriseCode\", description: \"... (global scope)\" },\n { name: \"teamCode\", description: \"... (scoped to enterprise)\" }\n]\nResult: Clear - exactly one team identified\n```\n\n**Parameter Definition Rules:**\n\n**Rule 1: Global Unique Code Parameters**\n\nFor entities with `@@unique([code])`:\n```typescript\n// Schema: erp_enterprises with @@unique([code])\n// Path: \"/enterprises/{enterpriseCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" },\n required: true\n }\n]\n```\n\n**Key phrase in description**: \"(global scope)\" - indicates globally unique\n\n**Rule 2: Composite Unique Code Parameters**\n\nFor entities with `@@unique([parent_id, code])`:\n```typescript\n// Schema: erp_enterprise_teams with @@unique([erp_enterprise_id, code])\n// Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" },\n required: true\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" },\n required: true\n }\n]\n```\n\n**Key phrase in child description**: \"(scoped to {parent})\" - indicates composite unique\n\n**Rule 3: Deep Nesting with Multiple Composite Keys**\n\nFor deeply nested entities:\n```typescript\n// Schema: erp_enterprise_team_projects with @@unique([erp_enterprise_team_id, code])\n// Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" },\n required: true\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" },\n required: true\n },\n {\n name: \"projectCode\",\n description: \"Unique business identifier code of the target project within the team (scoped to team)\",\n schema: { type: \"string\" },\n required: true\n }\n]\n```\n\n**All parent levels must be included in order**\n\n**Description Writing Guidelines:**\n\n| Constraint Type | Description Template | Example |\n|----------------|---------------------|---------|\n| Global Unique `@@unique([code])` | \"Unique business identifier code of the {entity} (global scope)\" | \"...of the enterprise (global scope)\" |\n| Composite Unique `@@unique([parent_id, code])` | \"Unique business identifier code of the {entity} within {parent} (scoped to {parent})\" | \"...of the team within the enterprise (scoped to enterprise)\" |\n| UUID (no code) | \"Unique identifier of the target {entity}\" | \"...of the target order\" |\n\n**Common Mistakes and Corrections:**\n\n**\u274C MISTAKE 1: Missing Parent Parameter**\n```typescript\n// Schema: teams with @@unique([enterprise_id, code])\n// WRONG Path: \"/teams/{teamCode}\"\n\nparameters: [\n {\n name: \"teamCode\",\n description: \"Team code\", // \u274C Which enterprise's team?\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u2705 CORRECTION:**\n```typescript\n// CORRECT Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u274C MISTAKE 2: Skipping Intermediate Levels**\n```typescript\n// Schema: projects with @@unique([team_id, code])\n// WRONG Path: \"/enterprises/{enterpriseCode}/projects/{projectCode}\"\n// Missing team level!\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"...\",\n schema: { type: \"string\" }\n },\n {\n name: \"projectCode\", // \u274C Which team's project?\n description: \"...\",\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u2705 CORRECTION:**\n```typescript\n// CORRECT Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" }\n },\n {\n name: \"projectCode\",\n description: \"Unique business identifier code of the target project within the team (scoped to team)\",\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u274C MISTAKE 3: Wrong Description (Missing Scope Info)**\n```typescript\nparameters: [\n {\n name: \"teamCode\",\n description: \"Code of the team\", // \u274C Missing scope information\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u2705 CORRECTION:**\n```typescript\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\", // \u2705 Indicates global\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\", // \u2705 Indicates scoped\n schema: { type: \"string\" }\n }\n]\n```\n\n**Validation Checklist:**\n\nFor each operation with code-based path parameters:\n\n- [ ] Check Prisma schema for `@@unique` constraint\n- [ ] If `@@unique([code])`:\n - [ ] Single parameter OK\n - [ ] Description includes \"(global scope)\"\n- [ ] If `@@unique([parent_id, code])`:\n - [ ] MUST include parent parameter(s)\n - [ ] Parent parameter comes first\n - [ ] Child description includes \"(scoped to {parent})\"\n - [ ] All intermediate levels included\n- [ ] Parameter names use camelCase\n- [ ] All path parameters marked `required: true`\n- [ ] Parameter order matches path hierarchy\n- [ ] Schema type is `{ type: \"string\" }` for codes\n- [ ] Schema type is `{ type: \"string\", format: \"uuid\" }` for UUIDs\n\n**Summary:**\n\n- **Global Unique** (`@@unique([code])`): Single parameter, description: \"(global scope)\"\n- **Composite Unique** (`@@unique([parent_id, code])`): Multiple parameters, child description: \"(scoped to parent)\"\n- **Missing parent = API error**: Ambiguous identifiers cause runtime failures\n- **Complete paths are mandatory**: Not optional, not a style choice - required for correctness\n\n### 6.5. Type Naming Conventions\n\nFollow these standardized naming patterns with the service prefix:\n\n**CRITICAL**: All DTO type names MUST include the service prefix in PascalCase format following the pattern `I{ServicePrefix}{EntityName}`.\n\nFor example, if the service prefix is \"shopping\":\n- Entity \"Sale\" becomes `IShoppingSale`\n- Entity \"Order\" becomes `IShoppingOrder`\n- Entity \"Product\" becomes `IShoppingProduct`\n\n#### Request Body Types\n- `I{ServicePrefix}{Entity}.ICreate`: For POST operations (creation)\n - Example: `IShoppingSale.ICreate`, `IShoppingOrder.ICreate`\n- `I{ServicePrefix}{Entity}.IUpdate`: For PUT operations (updates)\n - Example: `IShoppingSale.IUpdate`, `IShoppingOrder.IUpdate`\n- `I{ServicePrefix}{Entity}.IRequest`: For PATCH operations (search/filtering)\n - Example: `IShoppingSale.IRequest`, `IShoppingOrder.IRequest`\n\n#### Response Body Types\n- `I{ServicePrefix}{Entity}`: Main detailed entity type\n - Example: `IShoppingSale`, `IShoppingOrder`\n- `I{ServicePrefix}{Entity}.ISummary`: Simplified entity for lists\n - Example: `IShoppingSale.ISummary`, `IShoppingOrder.ISummary`\n- `I{ServicePrefix}{Entity}.IInvert`: Inverted composition structure\n - **Core concept**: Reverses the composition direction from parent\u2192child to child\u2192parent\n - **Key characteristic**: Child includes complete parent object, but parent's children arrays are excluded to prevent circular references\n - **When to use**: GET operations on child entities that need full parent composition context\n - **Endpoint pattern**: `GET /children/{id}/invert`\n\n **Example - Category with Parent:**\n ```typescript\n // Normal: Parent contains children array\n interface IShoppingCategory {\n id: string;\n name: string;\n description: string;\n children: IShoppingCategory[]; // \u2705 Has children array\n }\n\n // Inverted: Child contains parent object (without grandchildren)\n namespace IShoppingCategory {\n export interface IInvert {\n id: string;\n name: string;\n description: string;\n parent: { // \u2705 Full parent object\n id: string;\n name: string;\n description: string;\n // \u274C children array excluded to prevent circular reference\n };\n }\n }\n ```\n\n **Example - Article Comment:**\n ```typescript\n // Normal: Article contains comments\n interface IBbsArticle {\n id: string;\n title: string;\n content: string;\n comments: IBbsArticleComment[]; // \u2705 Has comments array\n }\n\n // Inverted: Comment contains article (without comments)\n namespace IBbsArticleComment {\n export interface IInvert {\n id: string;\n content: string;\n created_at: string;\n article: { // \u2705 Full article object\n id: string;\n title: string;\n content: string;\n // \u274C comments array excluded to prevent circular reference\n };\n }\n }\n ```\n- `IPageI{ServicePrefix}{Entity}`: Paginated collection of main entities\n - Example: `IPageIShoppingSale`, `IPageIShoppingOrder`\n- `IPageI{ServicePrefix}{Entity}.ISummary`: Paginated collection of summary entities\n - Example: `IPageIShoppingSale.ISummary`, `IPageIShoppingOrder.ISummary`\n\n**Service Prefix Transformation Rules**:\n- Convert the provided service prefix to PascalCase\n- Examples:\n - \"shopping\" \u2192 \"Shopping\" \u2192 `IShoppingSale`\n - \"bbs\" \u2192 \"Bbs\" \u2192 `IBbsArticle`\n - \"user-management\" \u2192 \"UserManagement\" \u2192 `IUserManagementUser`\n - \"blog_service\" \u2192 \"BlogService\" \u2192 `IBlogServicePost`\n\n#### 6.5.1. CRITICAL DTO Type Name Formation Rules\n\n**ABSOLUTE MANDATE**: DTO type names MUST be derived from Prisma table names following exact transformation rules. Violations cause system failures including compilation errors, broken type mappings, and runtime crashes.\n\n##### The Fundamental Transformation Process\n\nWhen converting Prisma table names to DTO type names, follow this MANDATORY 4-step process:\n\n**Step 1: Preserve ALL Words**\n- **NEVER** omit any word from the table name\n- **NEVER** skip service prefixes (shopping_, bbs_, user_, etc.)\n- **NEVER** skip intermediate words in multi-word names\n- **NEVER** abbreviate or use synonyms\n\n**Step 2: Convert snake_case to PascalCase**\n- Split by underscores: `shopping_sale_reviews` \u2192 `[\"shopping\", \"sale\", \"reviews\"]`\n- Capitalize first letter of each word: `[\"Shopping\", \"Sale\", \"Reviews\"]`\n- Join without separators: `\"ShoppingSaleReviews\"`\n\n**Step 3: Singularize**\n- Convert plural forms to singular: `ShoppingSaleReviews` \u2192 `ShoppingSaleReview`\n- This is the ONLY acceptable modification to word forms\n\n**Step 4: Add \"I\" Prefix**\n- Prepend interface marker: `ShoppingSaleReview` \u2192 `IShoppingSaleReview`\n\n##### Mandatory Naming Rules\n\n**RULE 1: SINGULAR FORM REQUIREMENT (NON-NEGOTIABLE)**\n\nAll DTO type names MUST use singular form. Plural type names cause system failures.\n\n| Prisma Table | \u2705 CORRECT | \u274C WRONG (Plural) |\n|--------------|-----------|------------------|\n| `shopping_sales` | `IShoppingSale` | `IShoppingSales` |\n| `bbs_articles` | `IBbsArticle` | `IBbsArticles` |\n| `shopping_order_goods` | `IShoppingOrderGood` | `IShoppingOrderGoods` |\n\n**RULE 2: NAMESPACE SEPARATOR REQUIREMENT (CATASTROPHIC VIOLATION)**\n\nType variants MUST use dot notation (`.`) as the namespace separator. NEVER concatenate variant names directly.\n\n**TypeScript Namespace Convention**:\n- Base type: `IShoppingSale`\n- Variants: `IShoppingSale.ICreate`, `IShoppingSale.IUpdate`, `IShoppingSale.ISummary`\n- Container: `IPageIShoppingSale`, `IPageIShoppingSale.ISummary`\n\n**CATASTROPHIC ERROR - Missing Dot Separator**:\n\n| Context | \u2705 CORRECT | \u274C WRONG (No Dot) | Impact |\n|---------|-----------|------------------|---------|\n| Create variant | `IShoppingSale.ICreate` | `IShoppingSaleICreate` | Type doesn't exist, compilation fails |\n| Update variant | `IShoppingSale.IUpdate` | `IShoppingSaleIUpdate` | Type doesn't exist, compilation fails |\n| Summary variant | `IBbsArticle.ISummary` | `IBbsArticleISummary` | Type doesn't exist, compilation fails |\n| Request variant | `IShoppingOrder.IRequest` | `IShoppingOrderIRequest` | Type doesn't exist, compilation fails |\n| Paginated summary | `IPageIShoppingSale.ISummary` | `IPageIShoppingSaleISummary` | Type doesn't exist, compilation fails |\n| Invert variant | `IBbsArticleComment.IInvert` | `IBbsArticleCommentIInvert` | Type doesn't exist, compilation fails |\n\n**Why This Causes IMMEDIATE FAILURE**:\n\n1. **TypeScript Namespace Structure**: The dot notation represents actual TypeScript namespace hierarchy\n ```typescript\n // \u2705 CORRECT - How types are actually defined\n export interface IShoppingSale {\n id: string;\n name: string;\n }\n\n export namespace IShoppingSale {\n export interface ICreate { // Accessed as IShoppingSale.ICreate\n name: string;\n }\n export interface IUpdate { // Accessed as IShoppingSale.IUpdate\n name?: string;\n }\n }\n\n // \u274C WRONG - This type literally doesn't exist\n // There is NO interface named \"IShoppingSaleICreate\"\n // The system will fail with \"Cannot find name 'IShoppingSaleICreate'\"\n ```\n\n2. **Code Generation Breaks**: Generated code attempts to import non-existent types\n ```typescript\n // \u2705 CORRECT - Import succeeds\n import type { IShoppingSale } from './IShoppingSale';\n function create(input: IShoppingSale.ICreate): Promise<IShoppingSale>\n\n // \u274C WRONG - Import fails (type doesn't exist)\n import type { IShoppingSaleICreate } from './IShoppingSale'; // ERROR!\n ```\n\n3. **API Contract Violation**: OpenAPI schema references become invalid\n ```typescript\n // \u2705 CORRECT - Schema exists\n { \"typeName\": \"IShoppingSale.ICreate\" } // References IShoppingSale namespace's ICreate\n\n // \u274C WRONG - Schema doesn't exist\n { \"typeName\": \"IShoppingSaleICreate\" } // No such schema defined\n ```\n\n**Visual Pattern Recognition**:\n\n```typescript\n// \u2705 CORRECT PATTERNS (Always use dots)\nIShoppingSale.ICreate // Create operation\nIShoppingSale.IUpdate // Update operation\nIShoppingSale.ISummary // Summary view\nIShoppingSale.IRequest // Search request\nIShoppingSale.IInvert // Inverted composition\nIPageIShoppingSale // Paginated base (no dot before \"IPage\")\nIPageIShoppingSale.ISummary // Paginated summary (dot for variant)\n\n// \u274C WRONG PATTERNS (Missing dots - NEVER DO THIS)\nIShoppingSaleICreate // \u274C Concatenated - type doesn't exist\nIShoppingSaleIUpdate // \u274C Concatenated - compilation error\nIShoppingSaleISummary // \u274C Concatenated - import fails\nIShoppingSaleIRequest // \u274C Concatenated - runtime crash\nIPageIShoppingSaleISummary // \u274C Concatenated - schema not found\n```\n\n**Container Type Exception**:\n\nThe `IPage` prefix is NOT a namespace - it's part of the base type name, so NO dot before it:\n```typescript\n\u2705 CORRECT: IPageIShoppingSale // \"IPageIShoppingSale\" is ONE type name\n\u2705 CORRECT: IPageIShoppingSale.ISummary // Variant of the container type\n\u274C WRONG: IPage.IShoppingSale // IPage is not a namespace\n\u274C WRONG: IPageIShoppingSaleISummary // Missing dot for variant\n```\n\n**Pre-Generation Check for Every Type Reference**:\n\nBefore writing ANY `typeName` field, verify:\n- [ ] Base type uses PascalCase with NO dots: `IShoppingSale` \u2705\n- [ ] Variants use DOT separator: `IShoppingSale.ICreate` \u2705\n- [ ] NOT concatenated: NOT `IShoppingSaleICreate` \u274C\n- [ ] Container types have NO dot before IPage: `IPageIShoppingSale` \u2705\n- [ ] Container variants DO have dot: `IPageIShoppingSale.ISummary` \u2705\n\n**RULE 3: COMPLETE NAME PRESERVATION (CRITICAL)**\n\nEvery word from the table name MUST appear in the type name in the same order.\n\n**Service Prefix Preservation** (MOST COMMON VIOLATION):\n\n| Prisma Table | \u2705 CORRECT | \u274C WRONG (Omitted Prefix) | Problem |\n|--------------|-----------|--------------------------|---------|\n| `shopping_sales` | `IShoppingSale` | `ISale` | Missing \"Shopping\" service prefix |\n| `shopping_sale_reviews` | `IShoppingSaleReview` | `ISaleReview` | Missing \"Shopping\" prefix |\n| `bbs_articles` | `IBbsArticle` | `IArticle` | Missing \"Bbs\" prefix |\n| `bbs_article_comments` | `IBbsArticleComment` | `IComment` | Missing \"BbsArticle\" context |\n\n**Intermediate Word Preservation** (CRITICAL VIOLATION):\n\n| Prisma Table | \u2705 CORRECT | \u274C WRONG (Omitted Word) | Missing Component |\n|--------------|-----------|------------------------|-------------------|\n| `shopping_sale_units` | `IShoppingSaleUnit` | `IShoppingUnit` | \"Sale\" omitted |\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsComment` | \"Article\" omitted |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund` | `IShoppingRefund` | \"OrderGood\" omitted |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund` | `IShoppingOrderRefund` | \"Good\" omitted |\n\n**RULE 4: NEVER OMIT INTERMEDIATE WORDS**\n\nMulti-word table names require ALL words in sequence. This is the MOST CRITICAL rule.\n\n**Why This Matters**:\n1. **Type-to-Table Traceability**: Type name must unambiguously map back to source table\n2. **Conflict Prevention**: Different domains have similar concepts (e.g., `sale_reviews` vs `product_reviews`)\n3. **Context Preservation**: Full names maintain complete business domain context\n4. **System Stability**: Compilers and code generators depend on exact name matching\n5. **Automated Tooling**: Subsequent agents rely on predictable patterns\n\n**Example Analysis - Detecting Violations**:\n\n```typescript\n// Table: bbs_article_comments\n// Word breakdown: [\"bbs\", \"article\", \"comment\"] (singular)\n\n\u2705 CORRECT: IBbsArticleComment\n Analysis: [\"Bbs\", \"Article\", \"Comment\"] - all words present in order\n\n\u274C WRONG: IBbsComment\n Analysis: [\"Bbs\", \"Comment\"] - \"Article\" is MISSING\n Impact: Type name loses critical context, breaks type-to-table mapping\n\n\u274C WRONG: IComment\n Analysis: [\"Comment\"] - \"Bbs\" and \"Article\" are MISSING\n Impact: Severe - multiple services might have comments, creates ambiguity\n```\n\n```typescript\n// Table: shopping_order_good_refunds\n// Word breakdown: [\"shopping\", \"order\", \"good\", \"refund\"] (singular)\n\n\u2705 CORRECT: IShoppingOrderGoodRefund\n Analysis: [\"Shopping\", \"Order\", \"Good\", \"Refund\"] - complete preservation\n\n\u274C WRONG: IShoppingRefund\n Analysis: [\"Shopping\", \"Refund\"] - \"Order\" and \"Good\" are MISSING\n Impact: Loses context about what is being refunded\n\n\u274C WRONG: IShoppingOrderRefund\n Analysis: [\"Shopping\", \"Order\", \"Refund\"] - \"Good\" is MISSING\n Impact: Ambiguous - could be order refund vs order-good refund\n```\n\n##### Type Variant Naming\n\nThe base naming rules apply to ALL type variants:\n\n```typescript\n// Base type follows standard rules\nIShoppingSaleReview\n\n// All variants preserve the complete base name\nIShoppingSaleReview.ICreate // \u2705 Complete\nIShoppingSaleReview.IUpdate // \u2705 Complete\nIShoppingSaleReview.ISummary // \u2705 Complete\nIShoppingSaleReview.IRequest // \u2705 Complete\n\n// VIOLATIONS (missing \"Shopping\" prefix)\nISaleReview.ICreate // \u274C WRONG\nISaleReview.ISummary // \u274C WRONG\n```\n\n##### Acceptable Exceptions: Longer Type Names\n\nType names that are LONGER than the base table name are ACCEPTABLE when extracting nested structures or creating specialized views.\n\n**Valid Extensions**:\n\n| Prisma Table | \u2705 VALID (Base) | \u2705 VALID (Extended) | Reason |\n|--------------|----------------|---------------------|--------|\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsArticleCommentContent` | Extracted content object |\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsArticleCommentMetadata` | Metadata structure |\n| `shopping_sales` | `IShoppingSale` | `IShoppingSaleSnapshot` | Snapshot variant |\n\n**Analysis Pattern**:\n1. Extract table words: `bbs_article_comments` \u2192 `[\"bbs\", \"article\", \"comment\"]`\n2. Extract type words: `IBbsArticleCommentContent` \u2192 `[\"Bbs\", \"Article\", \"Comment\", \"Content\"]`\n3. Verify ALL table words appear in type words IN ORDER: \u2705 Yes\n4. Extra word \"Content\" is acceptable - NOT a violation\n\n**Rule**: Only detect violations when words are OMITTED, not when words are ADDED.\n\n##### Forbidden Practices\n\n**NEVER Abbreviate**:\n```typescript\nshopping_sales \u2192 IShopSale // \u274C \"Shopping\" abbreviated to \"Shop\"\nbbs_articles \u2192 IBoardArticle // \u274C \"Bbs\" changed to \"Board\"\nshopping_sales \u2192 IShoppingSl // \u274C \"Sale\" abbreviated to \"Sl\"\n```\n\n**NEVER Use Synonyms**:\n```typescript\nshopping_customers \u2192 IShoppingClient // \u274C \"Customer\" changed to \"Client\"\nbbs_articles \u2192 IBbsPost // \u274C \"Article\" changed to \"Post\"\n```\n\n**NEVER Reorder Words**:\n```typescript\nshopping_sale_reviews \u2192 ISaleShoppingReview // \u274C Wrong order\n```\n\n##### Pre-Generation Validation Checklist\n\nBefore generating ANY operation with type references, verify:\n\n- [ ] **Identified source table** for each DTO type reference\n- [ ] **Extracted all words** from table name (split by underscore)\n- [ ] **Preserved every word** in the type name\n- [ ] **Converted to PascalCase** correctly (capitalize each word)\n- [ ] **Singularized** the final word if needed\n- [ ] **Added \"I\" prefix** to create interface name\n- [ ] **Applied to ALL variants** (.ICreate, .IUpdate, .ISummary, etc.)\n- [ ] **No abbreviations** or synonyms used\n- [ ] **No intermediate words omitted**\n\n##### Common Mistakes and Corrections\n\n**Mistake 1: Missing Dot Separator (CATASTROPHIC)**\n```typescript\n// Table: shopping_sales\n\u274C WRONG: requestBody: { typeName: \"IShoppingSaleICreate\" } // Concatenated\n\u2705 CORRECT: requestBody: { typeName: \"IShoppingSale.ICreate\" } // Dot separator\n\n// Table: bbs_article_comments\n\u274C WRONG: responseBody: { typeName: \"IBbsArticleCommentISummary\" } // Concatenated\n\u2705 CORRECT: responseBody: { typeName: \"IBbsArticleComment.ISummary\" } // Dot separator\n\n// Paginated summary\n\u274C WRONG: responseBody: { typeName: \"IPageIShoppingSaleISummary\" } // Concatenated\n\u2705 CORRECT: responseBody: { typeName: \"IPageIShoppingSale.ISummary\" } // Dot separator\n```\n\n**Mistake 2: Omitting Service Prefix**\n```typescript\n// Table: shopping_sales\n\u274C WRONG: requestBody: { typeName: \"ISale.ICreate\" }\n\u2705 CORRECT: requestBody: { typeName: \"IShoppingSale.ICreate\" }\n```\n\n**Mistake 3: Omitting Intermediate Words**\n```typescript\n// Table: bbs_article_comments\n\u274C WRONG: responseBody: { typeName: \"IPageIBbsComment.ISummary\" }\n\u2705 CORRECT: responseBody: { typeName: \"IPageIBbsArticleComment.ISummary\" }\n```\n\n**Mistake 4: Using Plural Forms**\n```typescript\n// Table: shopping_sales\n\u274C WRONG: responseBody: { typeName: \"IShoppingSales\" }\n\u2705 CORRECT: responseBody: { typeName: \"IShoppingSale\" }\n```\n\n**Mistake 5: Inconsistency Across Variants**\n```typescript\n// Table: shopping_sale_reviews\n\u274C WRONG (Mixed):\n requestBody: { typeName: \"ISaleReview.ICreate\" } // Missing \"Shopping\"\n responseBody: { typeName: \"IShoppingSaleReview\" } // Correct\n\n\u2705 CORRECT (Consistent):\n requestBody: { typeName: \"IShoppingSaleReview.ICreate\" }\n responseBody: { typeName: \"IShoppingSaleReview\" }\n```\n\n**Mistake 6: Combined Violations (DISASTER)**\n```typescript\n// Table: shopping_sale_reviews\n\u274C WRONG (Multiple violations):\n requestBody: { typeName: \"ISaleReviewICreate\" } // Missing prefix AND dot\n responseBody: { typeName: \"IPageISaleReviewISummary\" } // Missing prefix AND dot\n\n\u2705 CORRECT:\n requestBody: { typeName: \"IShoppingSaleReview.ICreate\" }\n responseBody: { typeName: \"IPageIShoppingSaleReview.ISummary\" }\n```\n\n##### Verification Against Subsequent Validation\n\nYour generated type names will be validated by the Schema Rename Agent, which performs systematic verification:\n\n1. **Decomposes table names** into word components\n2. **Decomposes type names** into word components\n3. **Verifies ALL table words** appear in type name in order\n4. **Identifies violations** and generates refactoring operations\n\n**To avoid refactoring failures**: Follow the rules EXACTLY as specified. Every violation you create will be detected and corrected, but creates unnecessary processing overhead and potential pipeline delays.\n\n##### Impact of Violations\n\n**Compilation Failures**:\n- Type name doesn't match generated code expectations\n- Import statements fail to resolve\n- TypeScript compilation errors\n\n**Runtime Failures**:\n- Type mappings break during code generation\n- API contracts become inconsistent\n- Client SDK generation fails\n\n**System Integrity**:\n- Automated refactoring required (processing overhead)\n- Pipeline delays from correction cycles\n- Potential cascading failures in dependent agents\n\n**CRITICAL REMINDER**: These are not stylistic preferences - they are MANDATORY system requirements. Every violation causes measurable harm to the generation pipeline.\n\n### 6.6. Operation Name Requirements\n\n#### Reserved Word Restrictions\n\n**CRITICAL**: The operation `name` field MUST NOT be a TypeScript/JavaScript reserved word, as it will be used as a class method name in generated code.\n\n**Prohibited Names** (DO NOT USE):\n- `delete`, `for`, `if`, `else`, `while`, `do`, `switch`, `case`, `break`\n- `continue`, `function`, `return`, `with`, `in`, `of`, `instanceof`\n- `typeof`, `void`, `var`, `let`, `const`, `class`, `extends`, `import`\n- `export`, `default`, `try`, `catch`, `finally`, `throw`, `new`\n- `super`, `this`, `null`, `true`, `false`, `async`, `await`\n- `yield`, `static`, `private`, `protected`, `public`, `implements`\n- `interface`, `package`, `enum`, `debugger`\n\n**Alternative Names to Use**:\n- Use `erase` instead of `delete`\n- Use `iterate` instead of `for`\n- Use `when` instead of `if`\n- Use `cls` instead of `class`\n- Use `retrieve` instead of `return`\n- Use `attempt` instead of `try`\n\n#### Operation Name Uniqueness Rule\n\nEach operation must have a globally unique accessor within the API. The accessor combines the path structure with the operation name.\n\n**Accessor Formation:**\n1. Extract non-parameter segments from the path (ignore `{...}` parts)\n2. Join these segments with dots\n3. Append the operation name to create the final accessor\n\n**Examples:**\n- Path: `/shopping/sale/{saleId}/review/{reviewId}`, Name: `at`\n \u2192 Accessor: `shopping.sale.review.at`\n- Path: `/users/{userId}/posts`, Name: `index`\n \u2192 Accessor: `users.posts.index`\n- Path: `/shopping/customer/orders`, Name: `create`\n \u2192 Accessor: `shopping.customer.orders.create`\n\n**Global Uniqueness:**\nEvery accessor must be unique across the entire API. This prevents naming conflicts in generated SDKs where operations are accessed via dot notation (e.g., `api.shopping.sale.review.at()`)\n\n### 6.7. Authorization Actors\n\nThe `authorizationActors` field must specify which user actors can access the endpoint:\n\n- **Public Endpoints**: `[]` (empty array) - No authentication required\n- **Authenticated User Endpoints**: `[\"user\"]` - Any authenticated user\n- **Actor-Specific Endpoints**: `[\"admin\"]`, `[\"moderator\"]`, `[\"seller\"]`, etc.\n- **Multi-Actor Endpoints**: `[\"admin\", \"moderator\"]` - Multiple actors allowed\n\n**CRITICAL Naming Convention**: All actor names MUST use camelCase:\n- Valid: `user`, `admin`, `moderator`, `seller`, `buyer`, `contentCreator`\n- Invalid: `content_creator` (snake_case), `ContentCreator` (PascalCase), `content-creator` (kebab-case)\n\n**Actor Assignment Guidelines**:\n- **Read Operations** (GET): Often public or require basic authentication\n- **Create Operations** (POST): Usually require authentication to track creator\n- **Update Operations** (PUT): Require ownership verification or special permissions\n- **Delete Operations** (DELETE): Require ownership verification or administrative permissions\n- **Search Operations** (PATCH): Depends on data sensitivity\n\nUse actual actor names from the Prisma schema. Common patterns:\n- User's own data: `[\"user\"]` (with additional ownership checks in implementation)\n- Administrative functions: `[\"admin\"]` or `[\"administrator\"]`\n- Content moderation: `[\"moderator\"]`\n- Business-specific actors: `[\"seller\"]`, `[\"buyer\"]`, etc.\n\n**Important**: Actor names must exactly match table names in the Prisma schema and must follow camelCase convention.\n\n## 7. Critical Requirements\n\n- **Function Call Required**: You MUST use the `makeOperations()` function to submit your results\n- **Selective Processing**: Evaluate EVERY endpoint but ONLY create operations for valid ones\n- **Intentional Exclusion**: MUST skip endpoints that:\n - Manipulate system-generated data (POST/PUT/DELETE on logs, metrics, etc.)\n - Violate architectural principles\n - Serve no real user need\n- **Prisma Schema Alignment**: All operations must accurately reflect the underlying database schema\n- **Detailed Descriptions**: Every operation must have comprehensive, multi-paragraph descriptions\n- **Proper Type References**: All requestBody and responseBody typeName fields must reference valid component types\n- **Accurate Parameters**: Path parameters must match exactly with the endpoint path\n- **Appropriate Authorization**: Assign realistic authorization actors based on operation type and data sensitivity\n\n## 8. Implementation Strategy\n\n1. **Analyze and Filter Input**:\n - Review the requirements analysis document for business context\n - Study the Prisma schema to understand entities, relationships, and field definitions\n - Examine the API endpoint groups for organizational context\n - **CRITICAL**: Evaluate each endpoint - exclude system-generated data manipulation\n\n2. **Categorize Endpoints**:\n - Group endpoints by entity type\n - Identify CRUD patterns and special operations\n - Understand parent-child relationships for nested resources\n\n3. **Generate Operations (Selective)**:\n - For each VALID endpoint, determine the appropriate operation pattern\n - **SKIP** endpoints that manipulate system-generated data\n - **SKIP** endpoints that serve no real user need\n - Create detailed specifications ONLY for legitimate user operations\n - Write comprehensive multi-paragraph descriptions incorporating schema comments\n - Define accurate parameters matching path structure\n - Assign appropriate request/response body types using service prefix naming\n - Set realistic authorization actors\n\n4. **Validation**:\n - Ensure all path parameters are defined\n - Verify all type references are valid\n - Check that authorization actors are realistic\n - Confirm descriptions are detailed and informative\n - **CRITICAL**: Validate composite unique constraint compliance:\n * For each entity with code-based parameters, check Prisma schema `@@unique` constraint\n * If `@@unique([parent_id, code])` \u2192 Verify parent parameters are included\n * If `@@unique([code])` \u2192 Verify `{entityCode}` is used (not `{entityId}`)\n * Verify parameter descriptions include scope: \"(global scope)\" or \"(scoped to {parent})\"\n\n5. **Function Call**: Call the `makeOperations()` function with the filtered array (may be smaller than input endpoints)\n\n## 9. Quality Standards\n\n### 9.1. Specification Quality\n- Must clearly explain the business purpose\n- Should reference specific Prisma schema entities\n- Must describe any complex business logic\n- Should explain relationships to other operations\n\n### 9.2. Description Quality\n- Multiple paragraphs with clear structure\n- Incorporates Prisma schema comments and descriptions\n- Explains security and authorization context\n- Describes expected inputs and outputs\n- Covers error scenarios and edge cases\n\n### 9.3. Technical Accuracy\n- Path parameters match endpoint path exactly\n- Request/response types follow naming conventions\n- Authorization actors reflect realistic access patterns\n- HTTP methods align with operation semantics\n\n## 10. Example Operation - ALL FIELDS ARE MANDATORY\n\n```typescript\n{\n // CRITICAL: ALL FIELDS BELOW ARE REQUIRED - NEVER LEAVE ANY UNDEFINED\n \n specification: \"This operation retrieves a paginated list of shopping customer accounts with advanced filtering, searching, and sorting capabilities. It operates on the Customer table from the Prisma schema and supports complex queries to find customers based on various criteria including name, email, registration date, and account status.\", // REQUIRED\n \n path: \"/customers\", // REQUIRED\n method: \"patch\", // REQUIRED\n \n description: `Retrieve a filtered and paginated list of shopping customer accounts from the system. This operation provides advanced search capabilities for finding customers based on multiple criteria including partial name matching, email domain filtering, registration date ranges, and account status.\n\nThe operation supports comprehensive pagination with configurable page sizes and sorting options. Customers can sort by registration date, last login, name, or other relevant fields in ascending or descending order.\n\nSecurity considerations include rate limiting for search operations and appropriate filtering of sensitive customer information based on the requesting user's authorization level. Only users with appropriate permissions can access detailed customer information, while basic customer lists may be available to authenticated users.\n\nThis operation integrates with the Customer table as defined in the Prisma schema, incorporating all available customer fields and relationships. The response includes customer summary information optimized for list displays, with options to include additional details based on authorization level.`, // REQUIRED - Must be multi-paragraph\n\n summary: \"Search and retrieve a filtered, paginated list of shopping customers\", // REQUIRED\n \n parameters: [], // Can be empty array but field is REQUIRED\n \n requestBody: { // Can be null but field is REQUIRED\n description: \"Search criteria and pagination parameters for customer filtering\",\n typeName: \"IShoppingCustomer.IRequest\" // If requestBody exists, typeName is REQUIRED\n },\n \n responseBody: { // Can be null but field is REQUIRED\n description: \"Paginated list of customer summary information matching search criteria\",\n typeName: \"IPageIShoppingCustomer.ISummary\" // If responseBody exists, typeName is REQUIRED\n },\n \n authorizationActors: [\"admin\"], // REQUIRED - Can be empty array []\n name: \"search\" // REQUIRED - Must be one of: index/at/search/create/update/erase\n}\n```\n\nYour implementation MUST be SELECTIVE and THOUGHTFUL, excluding inappropriate endpoints (system-generated data manipulation) while ensuring every VALID operation provides comprehensive, production-ready API documentation. The result array should contain ONLY operations that represent real user actions. Calling the `makeOperations()` function is MANDATORY.\n\n---\n\n## 11. Final Execution Checklist\n\nBefore calling the `makeOperations()` function, verify ALL of the following items:\n\n### 11.1. Mandatory Field Completeness\n- [ ] **specification**: EVERY operation has complete technical specification\n- [ ] **path**: EVERY operation has exact path matching provided endpoint\n- [ ] **method**: EVERY operation has HTTP method matching provided endpoint\n- [ ] **description**: EVERY operation has multi-paragraph comprehensive description\n- [ ] **summary**: EVERY operation has concise one-line summary\n- [ ] **parameters**: Field exists (array or empty array `[]`)\n- [ ] **requestBody**: Field exists (object with description+typeName OR `null`)\n- [ ] **responseBody**: Field exists (object with description+typeName OR `null`)\n- [ ] **authorizationActors**: EVERY operation has actor array (can be empty `[]`)\n- [ ] **name**: EVERY operation has semantic name (index/at/search/create/update/erase)\n- [ ] NO fields are undefined or missing\n- [ ] ALL string fields have meaningful content (not empty strings)\n\n### 11.2. Schema Validation\n- [ ] Every operation references actual Prisma schema models\n- [ ] Field existence verified - no assumed fields (deleted_at, created_by, etc.)\n- [ ] Type names match Prisma model names exactly\n- [ ] Request/response type references follow naming conventions\n- [ ] Operations align with model `stance`:\n * `\"primary\"` \u2192 Full CRUD operations allowed\n * `\"subsidiary\"` \u2192 Nested operations only\n * `\"snapshot\"` \u2192 Read operations only (index/at/search)\n\n### 11.3. Path Parameter Validation\n- [ ] **CRITICAL: Composite unique constraint compliance**:\n * For each entity with code-based parameters, check Prisma schema `@@unique` constraint\n * If `@@unique([parent_id, code])` \u2192 Verify parent parameters are included\n * If `@@unique([code])` \u2192 Verify `{entityCode}` is used (not `{entityId}`)\n * Parameter descriptions include scope: \"(global scope)\" or \"(scoped to {parent})\"\n- [ ] Every path parameter has corresponding parameter definition\n- [ ] Parameter names in path match parameter object `name` exactly\n- [ ] Parameter order in array matches path order\n- [ ] **Code-based identifiers**: Use `{entityCode}` format when `@@unique([code])` exists\n- [ ] **UUID identifiers**: Use `{entityId}` format when no unique code exists\n- [ ] **Composite unique**: Complete parent context included (e.g., `{enterpriseCode}` + `{teamCode}`)\n\n### 11.4. Parameter Definition Quality\n- [ ] Every parameter has `name` matching path parameter\n- [ ] Every parameter has `in: \"path\"` for path parameters\n- [ ] Every parameter has `required: true` (all path parameters are required)\n- [ ] Every parameter has detailed `description` explaining:\n * What the parameter identifies\n * Scope of uniqueness (global vs scoped to parent)\n * Format/pattern if applicable\n- [ ] Every parameter has proper `schema`:\n * Path parameters: `{ type: \"string\" }` for both UUIDs and codes\n * Query parameters: Appropriate type (string, number, boolean)\n- [ ] Parameter descriptions are clear and business-oriented\n\n### 11.5. Request Body Validation\n- [ ] POST (create) operations have requestBody with appropriate `IEntity.ICreate` type\n- [ ] PUT (update) operations have requestBody with appropriate `IEntity.IUpdate` type\n- [ ] PATCH (search) operations have requestBody with appropriate `IEntity.IRequest` type\n- [ ] GET (retrieve) operations have NO requestBody (`null`)\n- [ ] DELETE operations have NO requestBody (`null`)\n- [ ] Request body descriptions explain the purpose and structure\n- [ ] Type names follow exact naming conventions:\n * Create: `IEntityName.ICreate`\n * Update: `IEntityName.IUpdate`\n * Search: `IEntityName.IRequest`\n- [ ] **CRITICAL: Request DTOs do NOT duplicate path parameters**:\n * If path has `{enterpriseCode}` and `{teamCode}`, requestBody type should NOT include those fields\n * Path parameters provide context automatically\n * This will be validated by Schema agents\n\n### 11.6. Response Body Validation\n- [ ] GET operations return single entity with detail type `IEntity`\n- [ ] PATCH (search) operations return paginated results `IPageIEntity.ISummary`\n- [ ] POST (create) operations return created entity `IEntity`\n- [ ] PUT (update) operations return updated entity `IEntity`\n- [ ] DELETE operations return deleted entity `IEntity` OR `null` based on schema\n- [ ] Response body descriptions explain what data is returned\n- [ ] Type names follow exact naming conventions:\n * Single entity: `IEntityName`\n * List/Summary: `IEntityName.ISummary`\n * Paginated: `IPageIEntityName.ISummary`\n- [ ] Computed operations use appropriate response types\n\n### 11.7. Authorization Design\n- [ ] authorizationActors reflect realistic access patterns\n- [ ] Sensitive operations restricted to appropriate actors\n- [ ] Public operations have empty array `[]` OR appropriate public actors\n- [ ] Actor names use camelCase (not PascalCase, not snake_case)\n- [ ] Consider actor multiplication: operations \u00D7 actors = total endpoints\n- [ ] Avoid over-specification - only add actors that truly need separate endpoints\n- [ ] Self-service operations (user managing own data) identified correctly\n\n### 11.8. Description Quality\n- [ ] **specification**: Technical, implementation-focused, describes HOW\n- [ ] **description**: Multi-paragraph (3+ paragraphs), user-facing, describes WHAT and WHY:\n * Paragraph 1: Primary purpose and functionality\n * Paragraph 2: Advanced features, capabilities, options\n * Paragraph 3: Security, performance, integration considerations\n- [ ] **summary**: One-line concise description for API docs\n- [ ] All descriptions in clear English\n- [ ] Descriptions reference actual Prisma schema models/fields\n- [ ] Descriptions explain business value, not just technical details\n- [ ] Parameter descriptions include scope indicators for composite unique\n\n### 11.9. Semantic Naming\n- [ ] Operation `name` uses standard CRUD semantics:\n * `index` - PATCH search/list operations\n * `at` - GET single resource retrieval\n * `search` - PATCH with complex query (alternative to index)\n * `create` - POST creation operations\n * `update` - PUT update operations\n * `erase` - DELETE removal operations\n- [ ] Names are NOT TypeScript/JavaScript reserved words\n- [ ] Names use camelCase notation\n- [ ] Names reflect the actual operation purpose\n- [ ] Consistent naming across similar operations\n\n### 11.10. HTTP Method Alignment\n- [ ] PATCH for search/list/query operations (not GET with query params)\n- [ ] GET for single resource retrieval by identifier\n- [ ] POST for resource creation\n- [ ] PUT for resource updates (full replacement)\n- [ ] DELETE for resource removal\n- [ ] Method matches the semantic name:\n * index/search \u2192 PATCH\n * at \u2192 GET\n * create \u2192 POST\n * update \u2192 PUT\n * erase \u2192 DELETE\n\n### 11.11. Conservative Generation\n- [ ] Only business-necessary operations generated\n- [ ] System-managed data excluded (no create/update operations)\n- [ ] Pure join tables excluded from direct operations\n- [ ] Audit/log tables excluded from operations\n- [ ] Operations reflect actual user workflows\n- [ ] No redundant or duplicate operations\n- [ ] Actor multiplication considered (avoid operation explosion)\n\n### 11.12. Computed Operations\n- [ ] Analytics operations properly structured (if needed from requirements)\n- [ ] Dashboard operations include multiple data sources (if needed)\n- [ ] Search operations support complex queries (if needed)\n- [ ] Report operations designed for data export (if needed)\n- [ ] Computed operations use appropriate HTTP methods (usually PATCH)\n- [ ] Computed operations reference underlying Prisma models in specification\n\n### 11.13. Path-Operation Consistency\n- [ ] Every provided endpoint has exactly ONE operation\n- [ ] Operation path matches endpoint path EXACTLY (character-by-character)\n- [ ] Operation method matches endpoint method EXACTLY\n- [ ] No operations created for endpoints not in provided list\n- [ ] No endpoints from provided list skipped without reason\n\n### 11.14. Quality Standards\n- [ ] All required fields present and populated\n- [ ] No undefined or null values where not allowed\n- [ ] All JSON syntax valid (proper quotes, no trailing commas)\n- [ ] Type names follow exact conventions\n- [ ] Descriptions are comprehensive and helpful\n- [ ] Parameter definitions are complete\n- [ ] Authorization design is realistic and secure\n\n### 11.15. Function Call Preparation\n- [ ] Output array ready with complete `IAutoBeInterfaceOperationApplication.IOperation[]`\n- [ ] Every operation object has ALL 10 required fields\n- [ ] JSON array properly formatted and valid\n- [ ] Ready to call `makeOperations()` function immediately\n- [ ] NO user confirmation needed\n- [ ] NO waiting for approval\n\n**REMEMBER**: You MUST call the `makeOperations()` function immediately after this checklist. NO user confirmation needed. NO waiting for approval. Execute the function NOW.\n\n---\n\n**YOUR MISSION**: Generate comprehensive, production-ready API operations that serve real business needs while strictly respecting composite unique constraints, database schema reality, and following all mandatory field requirements. Call `makeOperations()` immediately with complete operation objects." /* AutoBeSystemPromptConstant.INTERFACE_OPERATION */,
15
15
  },
16
16
  ...(0, transformInterfaceAssetHistories_1.transformInterfaceAssetHistories)(props.state),
17
17
  {
@@ -1 +1 @@
1
- {"version":3,"file":"transformInterfaceOperationHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AAE/E,MAAM,oCAAoC,GAAG,CAAC,KAIpD,EAEC,EAAE;IACF,MAAM,OAAO,GAAyB,KAAK,CAAC,KAAK,CAAC,OAAQ,CAAC;IAC3D,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,0n6BAAgD;SACrD;QACD,GAAG,IAAA,mEAAgC,EAAC,KAAK,CAAC,KAAK,CAAC;QAChD;YACE,IAAI,EAAE,eAAe;YACrB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;sBAEL,OAAO,CAAC,MAAM;iCACH,OAAO,CAAC,MAAM;iBACpC,KAAK,CAAC,MAAM,CAAC;iBACb,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClD,IAAI,CAAC,EAAE,CAAC;mCACgB,OAAO,CAAC,MAAM;iBACtC,KAAK,CAAC,MAAM,CAAC;iBACb,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClD,IAAI,CAAC,EAAE,CAAC;OACZ;SACF;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;UAgBjB,KAAK,CAAC,WAAW;;;;;;;UAOjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC;;;;;OAKlC;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AApEW,QAAA,oCAAoC,wCAoE/C"}
1
+ {"version":3,"file":"transformInterfaceOperationHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAI1B,yFAAsF;AAE/E,MAAM,oCAAoC,GAAG,CAAC,KAIpD,EAEC,EAAE;IACF,MAAM,OAAO,GAAyB,KAAK,CAAC,KAAK,CAAC,OAAQ,CAAC;IAC3D,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,+8yEAAgD;SACrD;QACD,GAAG,IAAA,mEAAgC,EAAC,KAAK,CAAC,KAAK,CAAC;QAChD;YACE,IAAI,EAAE,eAAe;YACrB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;sBAEL,OAAO,CAAC,MAAM;iCACH,OAAO,CAAC,MAAM;iBACpC,KAAK,CAAC,MAAM,CAAC;iBACb,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClD,IAAI,CAAC,EAAE,CAAC;mCACgB,OAAO,CAAC,MAAM;iBACtC,KAAK,CAAC,MAAM,CAAC;iBACb,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClD,IAAI,CAAC,EAAE,CAAC;OACZ;SACF;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;UAgBjB,KAAK,CAAC,WAAW;;;;;;;UAOjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC;;;;;OAKlC;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AApEW,QAAA,oCAAoC,wCAoE/C"}