@codeyam/codeyam-cli 0.1.0-staging.596f0eb → 0.1.0-staging.6e699e5

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 (696) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/common/execAsync.ts +1 -1
  3. package/analyzer-template/log.txt +3 -3
  4. package/analyzer-template/package.json +10 -6
  5. package/analyzer-template/packages/ai/index.ts +10 -3
  6. package/analyzer-template/packages/ai/package.json +1 -1
  7. package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
  8. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +128 -6
  9. package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
  10. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +138 -1
  11. package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
  12. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +140 -6
  13. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
  14. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +38 -1
  15. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
  16. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1239 -104
  17. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +304 -0
  18. package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
  19. package/analyzer-template/packages/ai/src/lib/completionCall.ts +216 -36
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1501 -138
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +976 -0
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +243 -77
  24. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
  25. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +103 -6
  26. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
  27. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
  28. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +42 -2
  29. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  30. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
  31. package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
  32. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  33. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  34. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
  35. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
  36. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +6 -0
  37. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1111 -91
  38. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +207 -104
  39. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +570 -0
  40. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
  41. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1977 -0
  42. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  43. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  44. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  45. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +276 -3
  46. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +33 -3
  47. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
  48. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
  49. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
  50. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  51. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  52. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +90 -6
  53. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -53
  54. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
  55. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  56. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  57. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +812 -0
  58. package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
  59. package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
  60. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +123 -0
  61. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
  62. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
  63. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  64. package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
  65. package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
  66. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +455 -267
  67. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +18 -0
  68. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
  69. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -7
  70. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
  71. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
  72. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
  73. package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
  74. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +265 -0
  75. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
  76. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +588 -52
  77. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  78. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
  79. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +336 -133
  80. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +156 -0
  81. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
  82. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
  83. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +461 -94
  84. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  85. package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
  86. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
  87. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
  88. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
  89. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
  90. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
  91. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
  92. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
  93. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  94. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
  95. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
  96. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
  97. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  98. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  99. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  100. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  101. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  102. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
  103. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
  104. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
  105. package/analyzer-template/packages/aws/package.json +3 -3
  106. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  107. package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
  108. package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
  109. package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
  110. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  111. package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
  112. package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
  113. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  114. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
  115. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
  116. package/analyzer-template/packages/generate/index.ts +3 -0
  117. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
  118. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
  119. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
  120. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
  121. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  122. package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
  123. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
  124. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
  125. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  126. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
  127. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  128. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +30 -7
  129. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  130. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  131. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  132. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
  133. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
  134. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
  135. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  136. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  137. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
  138. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  139. package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
  140. package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
  141. package/analyzer-template/packages/github/dist/generate/index.js +3 -0
  142. package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
  143. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
  144. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  145. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  146. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
  147. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
  148. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  149. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  150. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
  151. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
  152. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  153. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  154. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  155. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  156. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  157. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  158. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  159. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  160. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
  161. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
  162. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
  163. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  164. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
  165. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
  166. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
  167. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
  168. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
  169. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
  170. package/analyzer-template/packages/github/dist/types/index.d.ts +2 -2
  171. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  172. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  173. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +87 -13
  174. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  175. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
  176. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
  177. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +11 -6
  178. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  179. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +196 -0
  180. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  181. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
  182. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  183. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  184. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  185. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  186. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  187. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  188. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  189. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  190. package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
  191. package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
  192. package/analyzer-template/packages/process/index.ts +2 -0
  193. package/analyzer-template/packages/process/package.json +12 -0
  194. package/analyzer-template/packages/process/tsconfig.json +8 -0
  195. package/analyzer-template/packages/types/index.ts +5 -0
  196. package/analyzer-template/packages/types/src/types/Analysis.ts +104 -13
  197. package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
  198. package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
  199. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +224 -0
  200. package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
  201. package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
  202. package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
  203. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  204. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  205. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +87 -13
  206. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  207. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
  208. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
  209. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +11 -6
  210. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  211. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +196 -0
  212. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  213. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
  214. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  215. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  216. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  217. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  218. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  219. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  220. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  221. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  222. package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
  223. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  224. package/analyzer-template/playwright/capture.ts +37 -18
  225. package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
  226. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  227. package/analyzer-template/playwright/takeScreenshot.ts +9 -7
  228. package/analyzer-template/playwright/waitForServer.ts +21 -6
  229. package/analyzer-template/project/analyzeBaselineCommit.ts +4 -0
  230. package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
  231. package/analyzer-template/project/analyzeFileEntities.ts +4 -0
  232. package/analyzer-template/project/analyzeRegularCommit.ts +4 -0
  233. package/analyzer-template/project/constructMockCode.ts +1181 -160
  234. package/analyzer-template/project/controller/startController.ts +16 -1
  235. package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
  236. package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
  237. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
  238. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +82 -36
  239. package/analyzer-template/project/orchestrateCapture.ts +36 -3
  240. package/analyzer-template/project/reconcileMockDataKeys.ts +245 -2
  241. package/analyzer-template/project/runAnalysis.ts +11 -0
  242. package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
  243. package/analyzer-template/project/serverOnlyModules.ts +194 -21
  244. package/analyzer-template/project/start.ts +26 -4
  245. package/analyzer-template/project/startScenarioCapture.ts +79 -41
  246. package/analyzer-template/project/writeMockDataTsx.ts +232 -57
  247. package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
  248. package/analyzer-template/project/writeScenarioComponents.ts +769 -181
  249. package/analyzer-template/project/writeScenarioFiles.ts +26 -0
  250. package/analyzer-template/project/writeSimpleRoot.ts +13 -15
  251. package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
  252. package/analyzer-template/scripts/defaultCmd.sh +9 -0
  253. package/analyzer-template/tsconfig.json +2 -1
  254. package/background/src/lib/local/createLocalAnalyzer.js +1 -29
  255. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  256. package/background/src/lib/local/execAsync.js +1 -1
  257. package/background/src/lib/local/execAsync.js.map +1 -1
  258. package/background/src/lib/virtualized/common/execAsync.js +1 -1
  259. package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
  260. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +2 -1
  261. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  262. package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
  263. package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
  264. package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
  265. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  266. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +2 -1
  267. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  268. package/background/src/lib/virtualized/project/constructMockCode.js +1053 -124
  269. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  270. package/background/src/lib/virtualized/project/controller/startController.js +11 -1
  271. package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
  272. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
  273. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
  274. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
  275. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
  276. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
  277. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  278. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +69 -32
  279. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  280. package/background/src/lib/virtualized/project/orchestrateCapture.js +27 -4
  281. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  282. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +204 -2
  283. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  284. package/background/src/lib/virtualized/project/runAnalysis.js +9 -0
  285. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  286. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
  287. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  288. package/background/src/lib/virtualized/project/serverOnlyModules.js +163 -23
  289. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
  290. package/background/src/lib/virtualized/project/start.js +21 -4
  291. package/background/src/lib/virtualized/project/start.js.map +1 -1
  292. package/background/src/lib/virtualized/project/startScenarioCapture.js +61 -31
  293. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  294. package/background/src/lib/virtualized/project/writeMockDataTsx.js +199 -50
  295. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  296. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
  297. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
  298. package/background/src/lib/virtualized/project/writeScenarioComponents.js +552 -125
  299. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  300. package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
  301. package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
  302. package/background/src/lib/virtualized/project/writeSimpleRoot.js +13 -13
  303. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  304. package/codeyam-cli/src/cli.js +7 -1
  305. package/codeyam-cli/src/cli.js.map +1 -1
  306. package/codeyam-cli/src/commands/analyze.js +1 -1
  307. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  308. package/codeyam-cli/src/commands/baseline.js +174 -0
  309. package/codeyam-cli/src/commands/baseline.js.map +1 -0
  310. package/codeyam-cli/src/commands/debug.js +40 -18
  311. package/codeyam-cli/src/commands/debug.js.map +1 -1
  312. package/codeyam-cli/src/commands/default.js +0 -15
  313. package/codeyam-cli/src/commands/default.js.map +1 -1
  314. package/codeyam-cli/src/commands/recapture.js +226 -0
  315. package/codeyam-cli/src/commands/recapture.js.map +1 -0
  316. package/codeyam-cli/src/commands/report.js +72 -24
  317. package/codeyam-cli/src/commands/report.js.map +1 -1
  318. package/codeyam-cli/src/commands/start.js +8 -12
  319. package/codeyam-cli/src/commands/start.js.map +1 -1
  320. package/codeyam-cli/src/commands/status.js +23 -1
  321. package/codeyam-cli/src/commands/status.js.map +1 -1
  322. package/codeyam-cli/src/commands/test-startup.js +1 -1
  323. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  324. package/codeyam-cli/src/commands/wipe.js +108 -0
  325. package/codeyam-cli/src/commands/wipe.js.map +1 -0
  326. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
  327. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
  328. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +31 -27
  329. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  330. package/codeyam-cli/src/utils/analysisRunner.js +8 -13
  331. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  332. package/codeyam-cli/src/utils/backgroundServer.js +14 -4
  333. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  334. package/codeyam-cli/src/utils/database.js +91 -5
  335. package/codeyam-cli/src/utils/database.js.map +1 -1
  336. package/codeyam-cli/src/utils/generateReport.js +253 -106
  337. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  338. package/codeyam-cli/src/utils/git.js +79 -0
  339. package/codeyam-cli/src/utils/git.js.map +1 -0
  340. package/codeyam-cli/src/utils/install-skills.js +31 -17
  341. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  342. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
  343. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  344. package/codeyam-cli/src/utils/queue/job.js +245 -16
  345. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  346. package/codeyam-cli/src/utils/queue/manager.js +25 -7
  347. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  348. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  349. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  350. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +7 -5
  351. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  352. package/codeyam-cli/src/utils/versionInfo.js +25 -19
  353. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  354. package/codeyam-cli/src/utils/wipe.js +128 -0
  355. package/codeyam-cli/src/utils/wipe.js.map +1 -0
  356. package/codeyam-cli/src/webserver/app/lib/database.js +98 -1
  357. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  358. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  359. package/codeyam-cli/src/webserver/backgroundServer.js +5 -10
  360. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  361. package/codeyam-cli/src/webserver/bootstrap.js +49 -0
  362. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
  363. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-BXhEawa3.js +1 -0
  364. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-efWKDYMr.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
  365. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Ba2JVPzP.js +41 -0
  366. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C8lyxW9k.js +34 -0
  367. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-aht4aafF.js +25 -0
  368. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CVtiBnY5.js +3 -0
  369. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-B0GLXMsr.js +6 -0
  370. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-xgeCVgSM.js +3 -0
  371. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-D4TZhLuw.js +21 -0
  372. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DuDvi0jm.js +1 -0
  373. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DEx02QDa.js +10 -0
  374. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-COPstp9J.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
  375. package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
  376. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DoLIqZX2.js +37 -0
  377. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  378. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  379. package/codeyam-cli/src/webserver/build/client/assets/api.rules-l0sNRNKZ.js +1 -0
  380. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-Cx24_aWc.js +6 -0
  381. package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +51 -0
  382. package/codeyam-cli/src/webserver/build/client/assets/circle-check-BOARzkeR.js +6 -0
  383. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BdhJEx6B.js +21 -0
  384. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
  385. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
  386. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BRb-0kQl.js +1 -0
  387. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-C2N4Op8e.js +23 -0
  388. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js +6 -0
  389. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D1T4TGjf.js +6 -0
  390. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-CTBG2mmz.js +5 -0
  391. package/codeyam-cli/src/webserver/build/client/assets/entry.client-CS2cb_eZ.js +29 -0
  392. package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
  393. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DMJ7zii9.js +1 -0
  394. package/codeyam-cli/src/webserver/build/client/assets/files-Cs4MdYtv.js +1 -0
  395. package/codeyam-cli/src/webserver/build/client/assets/git-B4RJRvYB.js +15 -0
  396. package/codeyam-cli/src/webserver/build/client/assets/git-commit-horizontal-CysbcZxi.js +6 -0
  397. package/codeyam-cli/src/webserver/build/client/assets/globals-DMUaGAqV.css +1 -0
  398. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  399. package/codeyam-cli/src/webserver/build/client/assets/index-B1h680n5.js +9 -0
  400. package/codeyam-cli/src/webserver/build/client/assets/index-lzqtyFU8.js +3 -0
  401. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-B7B9V-bu.js +6 -0
  402. package/codeyam-cli/src/webserver/build/client/assets/manifest-f874c610.js +1 -0
  403. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  404. package/codeyam-cli/src/webserver/build/client/assets/root-Bz5TunQg.js +57 -0
  405. package/codeyam-cli/src/webserver/build/client/assets/rules-hEkvVw2-.js +97 -0
  406. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  407. package/codeyam-cli/src/webserver/build/client/assets/search-CxXUmBSd.js +6 -0
  408. package/codeyam-cli/src/webserver/build/client/assets/settings-CS5f3WzT.js +1 -0
  409. package/codeyam-cli/src/webserver/build/client/assets/simulations-DwFIBT09.js +1 -0
  410. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-B6LgvRJg.js +6 -0
  411. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C1v1PQzo.js +1 -0
  412. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-3pmpUQB-.js → useLastLogLine-aSv48UbS.js} +1 -1
  413. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DYxHZQuP.js +1 -0
  414. package/codeyam-cli/src/webserver/build/client/assets/{useToast-DEyawJ8r.js → useToast-mBRpZPiu.js} +1 -1
  415. package/codeyam-cli/src/webserver/build/server/assets/index-967OuJoF.js +1 -0
  416. package/codeyam-cli/src/webserver/build/server/assets/server-build-DRTmerg9.js +257 -0
  417. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  418. package/codeyam-cli/src/webserver/build-info.json +5 -5
  419. package/codeyam-cli/src/webserver/devServer.js +1 -3
  420. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  421. package/codeyam-cli/src/webserver/server.js +35 -25
  422. package/codeyam-cli/src/webserver/server.js.map +1 -1
  423. package/codeyam-cli/templates/codeyam-power-rules-hook.sh +200 -0
  424. package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +48 -4
  425. package/codeyam-cli/templates/codeyam:diagnose.md +650 -0
  426. package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
  427. package/codeyam-cli/templates/codeyam:power-rules.md +447 -0
  428. package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +139 -4
  429. package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam:sim.md} +1 -1
  430. package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam:test.md} +1 -1
  431. package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam:verify.md} +1 -1
  432. package/package.json +17 -16
  433. package/packages/ai/index.js +5 -4
  434. package/packages/ai/index.js.map +1 -1
  435. package/packages/ai/src/lib/analyzeScope.js +99 -0
  436. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  437. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  438. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  439. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +100 -1
  440. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  441. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
  442. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
  443. package/packages/ai/src/lib/astScopes/methodSemantics.js +97 -6
  444. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  445. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
  446. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
  447. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +23 -0
  448. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  449. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
  450. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  451. package/packages/ai/src/lib/astScopes/processExpression.js +945 -87
  452. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  453. package/packages/ai/src/lib/checkAllAttributes.js +24 -9
  454. package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
  455. package/packages/ai/src/lib/completionCall.js +178 -31
  456. package/packages/ai/src/lib/completionCall.js.map +1 -1
  457. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1198 -82
  458. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  459. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
  460. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  461. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +661 -0
  462. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  463. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +180 -56
  464. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  465. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
  466. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  467. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +86 -4
  468. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  469. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
  470. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  471. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  472. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  473. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +34 -3
  474. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  475. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  476. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  477. package/packages/ai/src/lib/dataStructureChunking.js +111 -0
  478. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  479. package/packages/ai/src/lib/deepEqual.js +32 -0
  480. package/packages/ai/src/lib/deepEqual.js.map +1 -0
  481. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  482. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  483. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  484. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  485. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
  486. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  487. package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
  488. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  489. package/packages/ai/src/lib/generateEntityDataStructure.js +5 -0
  490. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  491. package/packages/ai/src/lib/generateEntityScenarioData.js +904 -84
  492. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  493. package/packages/ai/src/lib/generateEntityScenarios.js +186 -82
  494. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  495. package/packages/ai/src/lib/generateExecutionFlows.js +392 -0
  496. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
  497. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
  498. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
  499. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1440 -0
  500. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
  501. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  502. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  503. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  504. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  505. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  506. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  507. package/packages/ai/src/lib/isolateScopes.js +231 -4
  508. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  509. package/packages/ai/src/lib/mergeStatements.js +26 -3
  510. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  511. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
  512. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  513. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
  514. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
  515. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -64
  516. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  517. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  518. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  519. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +68 -6
  520. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  521. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -34
  522. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  523. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
  524. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
  525. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  526. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  527. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  528. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  529. package/packages/ai/src/lib/resolvePathToControllable.js +667 -0
  530. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
  531. package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
  532. package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
  533. package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
  534. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  535. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
  536. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  537. package/packages/analyze/src/lib/FileAnalyzer.js +15 -0
  538. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  539. package/packages/analyze/src/lib/analysisContext.js +30 -5
  540. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  541. package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
  542. package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
  543. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
  544. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
  545. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +218 -50
  546. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  547. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +10 -0
  548. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  549. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
  550. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  551. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -7
  552. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  553. package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
  554. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  555. package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
  556. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  557. package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
  558. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  559. package/packages/analyze/src/lib/files/enums/steps.js +1 -1
  560. package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
  561. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +209 -0
  562. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  563. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
  564. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
  565. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +458 -48
  566. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  567. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  568. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  569. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
  570. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  571. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +264 -78
  572. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  573. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +96 -0
  574. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
  575. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
  576. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  577. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
  578. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  579. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +372 -89
  580. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  581. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  582. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  583. package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
  584. package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  585. package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
  586. package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  587. package/packages/database/src/lib/kysely/db.js +2 -2
  588. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  589. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  590. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
  591. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  592. package/packages/generate/index.js +3 -0
  593. package/packages/generate/index.js.map +1 -1
  594. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  595. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  596. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  597. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  598. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  599. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  600. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  601. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  602. package/packages/generate/src/lib/deepMerge.js +27 -1
  603. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  604. package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
  605. package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  606. package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
  607. package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
  608. package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
  609. package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
  610. package/packages/process/index.js +3 -0
  611. package/packages/process/index.js.map +1 -0
  612. package/packages/process/src/GlobalProcessManager.js.map +1 -0
  613. package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
  614. package/packages/process/src/ProcessManager.js.map +1 -0
  615. package/packages/process/src/index.js.map +1 -0
  616. package/packages/process/src/managedExecAsync.js.map +1 -0
  617. package/packages/types/index.js.map +1 -1
  618. package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
  619. package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  620. package/packages/utils/src/lib/safeFileName.js +29 -3
  621. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  622. package/scripts/finalize-analyzer.cjs +6 -4
  623. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
  624. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
  625. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
  626. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
  627. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
  628. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
  629. package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
  630. package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
  631. package/analyzer-template/process/README.md +0 -507
  632. package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
  633. package/background/src/lib/process/ProcessManager.js.map +0 -1
  634. package/background/src/lib/process/index.js.map +0 -1
  635. package/background/src/lib/process/managedExecAsync.js.map +0 -1
  636. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  637. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  638. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-CVbSvOjo.js +0 -1
  639. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-DcwcHyl5.js +0 -1
  640. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-WgwC1GfJ.js +0 -26
  641. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-IEKom9O2.js +0 -3
  642. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-BYnfxbUG.js +0 -3
  643. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-_lBPJCzG.js +0 -1
  644. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-lHVhvsu_.js +0 -1
  645. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-d_TBk4GQ.js +0 -5
  646. package/codeyam-cli/src/webserver/build/client/assets/_index-kGT7VUqj.js +0 -1
  647. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DDGmhu7P.js +0 -7
  648. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-n_HPRfM_.js +0 -1
  649. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CbVoyx1U.js +0 -26
  650. package/codeyam-cli/src/webserver/build/client/assets/circle-check-D1VOYveA.js +0 -1
  651. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-YR8jjAlu.js +0 -1
  652. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-B8vP3V_s.js +0 -1
  653. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CN6aLCT1.js +0 -16
  654. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DA5Jeu2P.js +0 -1
  655. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BTeitalf.js +0 -5
  656. package/codeyam-cli/src/webserver/build/client/assets/entry.client-du6UEYD-.js +0 -13
  657. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-BpjkhMoi.js +0 -1
  658. package/codeyam-cli/src/webserver/build/client/assets/files-BQGvk4lJ.js +0 -1
  659. package/codeyam-cli/src/webserver/build/client/assets/git-DVdYRT-I.js +0 -12
  660. package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.css +0 -1
  661. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  662. package/codeyam-cli/src/webserver/build/client/assets/index-DCG-vks0.js +0 -1
  663. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-GazdNeLl.js +0 -1
  664. package/codeyam-cli/src/webserver/build/client/assets/manifest-0b694d28.js +0 -1
  665. package/codeyam-cli/src/webserver/build/client/assets/root-D3tQP7hx.js +0 -16
  666. package/codeyam-cli/src/webserver/build/client/assets/search-CIY6XmtE.js +0 -1
  667. package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
  668. package/codeyam-cli/src/webserver/build/client/assets/settings-CoMDgElu.js +0 -1
  669. package/codeyam-cli/src/webserver/build/client/assets/simulations-agkniXp2.js +0 -1
  670. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-B2VUcygF.js +0 -1
  671. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-EvdK-zXP.js +0 -1
  672. package/codeyam-cli/src/webserver/build/server/assets/index-DGVHQEXD.js +0 -1
  673. package/codeyam-cli/src/webserver/build/server/assets/server-build-CghkTkIL.js +0 -166
  674. package/codeyam-cli/templates/debug-command.md +0 -303
  675. package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
  676. package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
  677. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -136
  678. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
  679. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
  680. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
  681. package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
  682. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
  683. package/packages/ai/src/lib/isFrontend.js +0 -5
  684. package/packages/ai/src/lib/isFrontend.js.map +0 -1
  685. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
  686. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
  687. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -72
  688. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
  689. /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
  690. /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
  691. /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
  692. /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
  693. /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
  694. /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
  695. /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
  696. /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
@@ -1,13 +1,489 @@
1
1
  import completionCall from "./completionCall.js";
2
2
  import generateEntityScenarioDataGenerator from "./promptGenerators/generateEntityScenarioDataGenerator.js";
3
+ import generateMissingKeysPrompt from "./promptGenerators/generateMissingKeysPrompt.js";
4
+ import generateChunkPrompt from "./promptGenerators/generateChunkPrompt.js";
3
5
  import { saveLlmCall } from "../../../../packages/aws/dynamodb/index.js";
6
+ import { trackDataSnapshot } from "./e2eDataTracking.js";
4
7
  import validateJson from "./validateJson.js";
5
8
  import { awsLog, awsLogDebugLevel } from "../../../../packages/utils/index.js";
6
9
  import { parseJsonSafe } from "../../../../packages/ai/index.js";
10
+ import convertNullToUndefinedBySchema from "./dataStructure/helpers/convertNullToUndefinedBySchema.js";
11
+ import fixNullIdsBySchema from "./dataStructure/helpers/fixNullIdsBySchema.js";
12
+ import { deepMerge } from "../../../../packages/generate/index.js";
13
+ import { chunkDataStructure, getRequiredValuesForChunk, } from "./dataStructureChunking.js";
14
+ /**
15
+ * Check if any of the scenario's covered flows require error data.
16
+ * Returns true if any requiredValue has an error path with truthy comparison.
17
+ */
18
+ function scenarioRequiresErrorData(scenario, executionFlows) {
19
+ const coveredFlowIds = scenario.metadata?.coveredFlows || [];
20
+ for (const flowId of coveredFlowIds) {
21
+ const flow = executionFlows?.find((f) => f.id === flowId);
22
+ if (!flow?.requiredValues)
23
+ continue;
24
+ for (const rv of flow.requiredValues) {
25
+ // Check if any requiredValue has an error path and requires it to be truthy
26
+ if (rv.attributePath?.toLowerCase().includes('.error') &&
27
+ rv.comparison === 'truthy') {
28
+ return true;
29
+ }
30
+ }
31
+ }
32
+ return false;
33
+ }
34
+ /**
35
+ * Deep merge scenario data with default scenario data.
36
+ * The scenario-specific data takes precedence, with default filling in missing fields.
37
+ *
38
+ * IMPORTANT: null values are PRESERVED (not removed) in the result.
39
+ * This is critical because writeMockDataTsx.ts does another deepMerge with default data,
40
+ * and it needs null values to prevent defaults from being filled back in.
41
+ * If we removed null here, the second merge would restore the defaults,
42
+ * making scenarios identical to the default scenario.
43
+ */
44
+ function deepMergeScenarioData(defaultData, scenarioData) {
45
+ // Guard against non-object inputs (LLM sometimes returns primitives)
46
+ if (typeof scenarioData !== 'object' ||
47
+ scenarioData === null ||
48
+ Array.isArray(scenarioData)) {
49
+ // Return scenario value directly if it's not a mergeable object
50
+ return scenarioData;
51
+ }
52
+ if (typeof defaultData !== 'object' ||
53
+ defaultData === null ||
54
+ Array.isArray(defaultData)) {
55
+ // Return scenario value if default isn't mergeable
56
+ return scenarioData;
57
+ }
58
+ const result = {};
59
+ // Start with all keys from default
60
+ for (const key of Object.keys(defaultData)) {
61
+ if (key in scenarioData) {
62
+ const scenarioValue = scenarioData[key];
63
+ const defaultValue = defaultData[key];
64
+ // null means explicitly override with null (falsy value)
65
+ // IMPORTANT: We preserve null instead of removing the key
66
+ // This ensures writeMockDataTsx's deepMerge won't fill in defaults
67
+ if (scenarioValue === null) {
68
+ result[key] = null;
69
+ continue;
70
+ }
71
+ // Deep merge objects (but not arrays)
72
+ if (typeof scenarioValue === 'object' &&
73
+ !Array.isArray(scenarioValue) &&
74
+ typeof defaultValue === 'object' &&
75
+ !Array.isArray(defaultValue) &&
76
+ defaultValue !== null) {
77
+ result[key] = deepMergeScenarioData(defaultValue, scenarioValue);
78
+ }
79
+ else {
80
+ // Use scenario value (overrides default)
81
+ result[key] = scenarioValue;
82
+ }
83
+ }
84
+ else {
85
+ // Key not in scenario, use default
86
+ result[key] = defaultData[key];
87
+ }
88
+ }
89
+ // Add any keys that are only in scenario data (including null values)
90
+ for (const key of Object.keys(scenarioData)) {
91
+ if (!(key in defaultData)) {
92
+ result[key] = scenarioData[key];
93
+ }
94
+ }
95
+ return result;
96
+ }
7
97
  const DEFAULT_SCENARIO_NAME = 'Default Scenario';
8
- export async function generateDataForScenario({ entity, structure, scenario, defaultScenarioData, incompleteResponse, analysis, model, }) {
98
+ /**
99
+ * Find the path to a key within a nested dataForMocks structure.
100
+ * Returns the path as an array of keys, or null if not found.
101
+ *
102
+ * @example
103
+ * // dataForMocks = { trpc: { fastener: { "useMutation()": { isLoading: "boolean" } } } }
104
+ * // findKeyPath("fastener", dataForMocks) returns ["trpc"]
105
+ */
106
+ function findKeyPath(targetKey, obj, currentPath = []) {
107
+ if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
108
+ return null;
109
+ }
110
+ for (const key of Object.keys(obj)) {
111
+ if (key === targetKey) {
112
+ return currentPath;
113
+ }
114
+ // Recursively search in nested objects
115
+ const nested = obj[key];
116
+ if (typeof nested === 'object' &&
117
+ nested !== null &&
118
+ !Array.isArray(nested)) {
119
+ const result = findKeyPath(targetKey, nested, [
120
+ ...currentPath,
121
+ key,
122
+ ]);
123
+ if (result !== null) {
124
+ return result;
125
+ }
126
+ }
127
+ }
128
+ return null;
129
+ }
130
+ /**
131
+ * Relocate misplaced nested keys in mockData to their correct position
132
+ * based on the dataForMocks structure.
133
+ *
134
+ * When the LLM returns mockData with keys at the wrong nesting level
135
+ * (e.g., { trpc: { quote: {...} }, fastener: {...} } when fastener should
136
+ * be inside trpc), this function moves them to the correct position.
137
+ *
138
+ * This function works recursively to handle nested misplacements, not just
139
+ * root-level ones. For example, if getQuote is at trpc.getQuote instead of
140
+ * trpc.quote.getQuote, it will be relocated.
141
+ *
142
+ * @example
143
+ * // dataForMocks: { trpc: { quote: {...}, fastener: {...} } }
144
+ * // mockData: { trpc: { quote: {...} }, fastener: {...} }
145
+ * // After: mockData: { trpc: { quote: {...}, fastener: {...} } }
146
+ *
147
+ * @example (nested case)
148
+ * // dataForMocks: { trpc: { quote: { getQuote: {...} } } }
149
+ * // mockData: { trpc: { quote: {...}, getQuote: {...} } }
150
+ * // After: mockData: { trpc: { quote: { getQuote: {...} } } }
151
+ */
152
+ function relocateMisplacedNestedKeys(mockData, dataForMocks, currentPathForLogging = []) {
153
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
154
+ return;
155
+ }
156
+ const keysInSchema = Object.keys(dataForMocks);
157
+ const keysToRelocate = [];
158
+ // Find keys in mockData that are NOT at this level in dataForMocks
159
+ // but DO exist somewhere nested in dataForMocks
160
+ for (const key of Object.keys(mockData)) {
161
+ if (!keysInSchema.includes(key)) {
162
+ // This key is at this level in mockData but not at this level in dataForMocks
163
+ // Check if it exists somewhere nested in dataForMocks
164
+ const path = findKeyPath(key, dataForMocks);
165
+ if (path !== null && path.length > 0) {
166
+ keysToRelocate.push({ key, path });
167
+ }
168
+ }
169
+ }
170
+ // Relocate each misplaced key to its correct nested position
171
+ for (const { key, path } of keysToRelocate) {
172
+ const value = mockData[key];
173
+ // Navigate to the correct parent in mockData, creating nested objects if needed
174
+ let current = mockData;
175
+ for (const pathKey of path) {
176
+ if (current[pathKey] === undefined) {
177
+ current[pathKey] = {};
178
+ }
179
+ current = current[pathKey];
180
+ }
181
+ // Deep merge the value into the correct location
182
+ // Use deep merge to preserve existing data at that location
183
+ if (current[key] !== undefined && typeof current[key] === 'object') {
184
+ current[key] = deepMerge(current[key], value);
185
+ }
186
+ else {
187
+ current[key] = value;
188
+ }
189
+ // Remove the key from its current (wrong) level
190
+ delete mockData[key];
191
+ const fullPath = [...currentPathForLogging, ...path].join('.');
192
+ awsLog(`CodeYam: Relocated misplaced key "${key}" from [${currentPathForLogging.join('.')}] to [${fullPath}]`);
193
+ }
194
+ // Recursively process nested objects to handle deeply nested misplacements
195
+ for (const key of Object.keys(mockData)) {
196
+ const mockValue = mockData[key];
197
+ const schemaValue = dataForMocks[key];
198
+ // Only recurse if both mockData and schema have nested objects at this key
199
+ if (typeof mockValue === 'object' &&
200
+ mockValue !== null &&
201
+ !Array.isArray(mockValue) &&
202
+ typeof schemaValue === 'object' &&
203
+ schemaValue !== null &&
204
+ !Array.isArray(schemaValue)) {
205
+ relocateMisplacedNestedKeys(mockValue, schemaValue, [...currentPathForLogging, key]);
206
+ }
207
+ }
208
+ }
209
+ /**
210
+ * Generate default mock data for a schema type.
211
+ * Returns reasonable default values based on the schema type string.
212
+ */
213
+ function generateDefaultForSchemaType(schemaType) {
214
+ if (typeof schemaType === 'string') {
215
+ // Handle common type strings
216
+ if (schemaType === 'function')
217
+ return () => { };
218
+ if (schemaType === 'promise')
219
+ return Promise.resolve();
220
+ if (schemaType === 'boolean')
221
+ return false;
222
+ if (schemaType === 'string')
223
+ return '';
224
+ if (schemaType === 'number')
225
+ return 0;
226
+ if (schemaType.includes('number | undefined'))
227
+ return undefined;
228
+ if (schemaType.includes('string | undefined'))
229
+ return undefined;
230
+ if (schemaType.includes('boolean | undefined'))
231
+ return undefined;
232
+ if (schemaType.includes('| undefined'))
233
+ return undefined;
234
+ if (schemaType.includes('| null'))
235
+ return null;
236
+ return schemaType; // Return the type as a string placeholder
237
+ }
238
+ if (typeof schemaType === 'object' &&
239
+ schemaType !== null &&
240
+ !Array.isArray(schemaType)) {
241
+ // Recursively generate defaults for nested objects
242
+ const result = {};
243
+ for (const [key, value] of Object.entries(schemaType)) {
244
+ result[key] = generateDefaultForSchemaType(value);
245
+ }
246
+ return result;
247
+ }
248
+ return undefined;
249
+ }
250
+ /**
251
+ * Detect if a string should be converted to an array.
252
+ * Returns the array if the field appears to be an array field, or null if it should remain a string.
253
+ *
254
+ * This handles two cases:
255
+ * 1. Comma-separated values: "color,size" -> ["color", "size"]
256
+ * 2. Single values for array-named fields: "Finish" -> ["Finish"]
257
+ */
258
+ function parseCommaSeparatedStringAsArray(value, key) {
259
+ // Heuristic: if the key name suggests it's an array field, convert it
260
+ // Common patterns: *_attributes, *_ids, *_items, *_tags, *_values, plural names
261
+ // Check this FIRST because array-named fields should be converted regardless
262
+ // of whether they contain commas (single values become single-element arrays).
263
+ const arrayFieldPatterns = [
264
+ /_attributes$/i,
265
+ /_ids$/i,
266
+ /_items$/i,
267
+ /_tags$/i,
268
+ /_values$/i,
269
+ /_types$/i,
270
+ /_names$/i,
271
+ /_keys$/i,
272
+ /^attributes$/i,
273
+ /^items$/i,
274
+ /^tags$/i,
275
+ /^values$/i,
276
+ ];
277
+ const looksLikeArrayField = arrayFieldPatterns.some((pattern) => pattern.test(key));
278
+ if (looksLikeArrayField) {
279
+ // Skip newlines check - multiline values shouldn't be split
280
+ if (value.includes('\n')) {
281
+ return null;
282
+ }
283
+ // Split by comma and trim whitespace
284
+ const parts = value.split(',').map((s) => s.trim());
285
+ // Filter out empty strings - this handles both "Finish" -> ["Finish"]
286
+ // and "" -> []
287
+ return parts.filter((s) => s.length > 0);
288
+ }
289
+ // For non-array-named fields, only convert if there are commas
290
+ if (!value.includes(',')) {
291
+ return null;
292
+ }
293
+ // For non-array-named fields, apply stricter sentence detection
294
+ // Skip if it looks like a sentence (comma followed by space and lowercase)
295
+ if (/,\s+[a-z]/.test(value)) {
296
+ return null;
297
+ }
298
+ // Skip if it contains newlines (likely formatted text)
299
+ if (value.includes('\n')) {
300
+ return null;
301
+ }
302
+ return null;
303
+ }
304
+ /**
305
+ * Convert comma-separated string values to arrays when they look like array data.
306
+ * This handles cases where the LLM generates strings like "color,size" instead
307
+ * of arrays like ["color", "size"] due to schema type misdetection.
308
+ */
309
+ function convertCommaSeparatedStringsToArrays(mockData) {
310
+ for (const [key, value] of Object.entries(mockData)) {
311
+ if (typeof value === 'string') {
312
+ const asArray = parseCommaSeparatedStringAsArray(value, key);
313
+ if (asArray !== null) {
314
+ mockData[key] = asArray;
315
+ awsLog(`CodeYam: Converted comma-separated string to array for key "${key}": "${value}" -> [${asArray.map((s) => `"${s}"`).join(', ')}]`);
316
+ }
317
+ }
318
+ else if (value !== null &&
319
+ typeof value === 'object' &&
320
+ !Array.isArray(value)) {
321
+ // Recursively process nested objects
322
+ convertCommaSeparatedStringsToArrays(value);
323
+ }
324
+ else if (Array.isArray(value)) {
325
+ // Recursively process arrays (each element could be an object)
326
+ for (const item of value) {
327
+ if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
328
+ convertCommaSeparatedStringsToArrays(item);
329
+ }
330
+ }
331
+ }
332
+ }
333
+ }
334
+ /**
335
+ * Ensure all keys from dataForMocks have corresponding data in mockData.
336
+ * For missing keys, generate default values based on the schema.
337
+ * Recursively checks nested objects to fill in any missing nested fields.
338
+ */
339
+ function fillMissingMockDataKeysWithDefaults(mockData, dataForMocks, pathPrefix = '') {
340
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
341
+ return;
342
+ }
343
+ const missingKeys = [];
344
+ for (const key of Object.keys(dataForMocks)) {
345
+ const fullPath = pathPrefix ? `${pathPrefix}.${key}` : key;
346
+ if (mockData[key] === undefined) {
347
+ missingKeys.push(fullPath);
348
+ // Generate default data based on schema
349
+ const schemaForKey = dataForMocks[key];
350
+ mockData[key] = generateDefaultForSchemaType(schemaForKey);
351
+ }
352
+ else {
353
+ // Key exists, but if both are objects, recursively check for missing nested keys
354
+ const schemaValue = dataForMocks[key];
355
+ const mockValue = mockData[key];
356
+ if (typeof schemaValue === 'object' &&
357
+ schemaValue !== null &&
358
+ !Array.isArray(schemaValue) &&
359
+ typeof mockValue === 'object' &&
360
+ mockValue !== null &&
361
+ !Array.isArray(mockValue)) {
362
+ fillMissingMockDataKeysWithDefaults(mockValue, schemaValue, fullPath);
363
+ }
364
+ }
365
+ }
366
+ if (missingKeys.length > 0) {
367
+ awsLog(`CodeYam: Generated default mock data for ${missingKeys.length} missing key(s): ${missingKeys.slice(0, 10).join(', ')}${missingKeys.length > 10 ? '...' : ''}`);
368
+ }
369
+ }
370
+ /**
371
+ * For Default Scenario only: detect missing mockData keys and make a follow-up
372
+ * LLM call to fill them in. This handles cases where the LLM completes normally
373
+ * but misses some keys (often small/simple ones when the schema is large).
374
+ */
375
+ async function fillMissingMockDataKeys({ structure, scenario, executionFlows, fullScenarioData, model, }) {
376
+ if (!structure.dataForMocks ||
377
+ typeof structure.dataForMocks !== 'object' ||
378
+ Array.isArray(structure.dataForMocks)) {
379
+ return;
380
+ }
381
+ const expectedKeys = Object.keys(structure.dataForMocks);
382
+ const generatedKeys = Object.keys(fullScenarioData.data.mockData || {});
383
+ const missingKeys = expectedKeys.filter((k) => !generatedKeys.includes(k));
384
+ if (missingKeys.length === 0) {
385
+ return;
386
+ }
387
+ awsLog(`Default Scenario missing ${missingKeys.length} keys, making follow-up call`, { missingKeys });
388
+ // Build subset schema with only missing keys
389
+ const missingSchema = {};
390
+ for (const key of missingKeys) {
391
+ missingSchema[key] = structure.dataForMocks[key];
392
+ }
393
+ const followUpPrompt = generateMissingKeysPrompt({
394
+ scenario,
395
+ executionFlows,
396
+ generatedMockData: fullScenarioData.data.mockData || {},
397
+ missingSchema,
398
+ });
399
+ const followUpResponse = await completionCall({
400
+ type: 'generateMissingMockData',
401
+ systemMessage: generateMissingKeysSystemMessage(),
402
+ prompt: followUpPrompt,
403
+ model,
404
+ });
405
+ if (!followUpResponse.completion) {
406
+ return;
407
+ }
408
+ const followUpJson = validateJson(followUpResponse.completion);
409
+ const followUpParsed = parseJsonSafe(followUpJson);
410
+ if (!followUpParsed ||
411
+ typeof followUpParsed !== 'object' ||
412
+ !('mockData' in followUpParsed)) {
413
+ return;
414
+ }
415
+ const followUpMockData = followUpParsed.mockData;
416
+ if (followUpMockData && typeof followUpMockData === 'object') {
417
+ fullScenarioData.data.mockData = {
418
+ ...fullScenarioData.data.mockData,
419
+ ...followUpMockData,
420
+ };
421
+ }
422
+ }
423
+ export async function generateDataForScenario({ entity, structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, analysis, model, }) {
424
+ var _a;
9
425
  awsLogDebugLevel(1, `Generating data for ${entity.name}: ${scenario.name}`);
10
- const prompt = generateEntityScenarioDataGenerator(structure, scenario, defaultScenarioData, incompleteResponse);
426
+ // Check if we should chunk the data structure for focused processing
427
+ let chunkedMockData;
428
+ const coveredFlowIds = scenario.metadata?.coveredFlows || [];
429
+ if (structure.dataForMocks &&
430
+ !incompleteResponse // Don't do chunked calls on continuation
431
+ ) {
432
+ const chunks = chunkDataStructure(structure.dataForMocks);
433
+ // If we have multiple chunks, process each one with a focused call
434
+ if (chunks.length > 1) {
435
+ awsLog(`Data structure has ${Object.keys(structure.dataForMocks).length} keys, splitting into ${chunks.length} chunks for focused processing`);
436
+ chunkedMockData = {};
437
+ for (let i = 0; i < chunks.length; i++) {
438
+ const chunk = chunks[i];
439
+ const chunkKeys = Object.keys(chunk || {});
440
+ // Get relevant requiredValues for this chunk
441
+ const relevantRequiredValues = getRequiredValuesForChunk(chunk, executionFlows || [], coveredFlowIds);
442
+ awsLog(`Processing chunk ${i + 1}/${chunks.length}: ${chunkKeys.join(', ')}`);
443
+ const chunkPrompt = generateChunkPrompt({
444
+ scenario,
445
+ chunk,
446
+ chunkIndex: i,
447
+ totalChunks: chunks.length,
448
+ relevantRequiredValues,
449
+ });
450
+ const chunkResponse = await completionCall({
451
+ type: 'generateChunkMockData',
452
+ systemMessage: generateChunkSystemMessage(scenario.name),
453
+ prompt: chunkPrompt,
454
+ model,
455
+ });
456
+ // Save chunk call to LLM log for replay support
457
+ await saveLlmCall({
458
+ object_type: 'analysis',
459
+ object_id: analysis.id,
460
+ propsJson: {
461
+ entity: { name: entity.name, filePath: entity.filePath },
462
+ scenario: { name: scenario.name },
463
+ chunkIndex: i,
464
+ totalChunks: chunks.length,
465
+ },
466
+ ...chunkResponse.stats,
467
+ });
468
+ if (chunkResponse.completion) {
469
+ const validJson = validateJson(chunkResponse.completion);
470
+ const parsed = parseJsonSafe(validJson);
471
+ if (parsed && typeof parsed === 'object' && 'mockData' in parsed) {
472
+ const chunkMockData = parsed.mockData;
473
+ if (chunkMockData && typeof chunkMockData === 'object') {
474
+ Object.assign(chunkedMockData, chunkMockData);
475
+ awsLog(`Chunk ${i + 1} generated data for: ${Object.keys(chunkMockData).join(', ')}`);
476
+ }
477
+ }
478
+ }
479
+ }
480
+ awsLog(`Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`);
481
+ }
482
+ }
483
+ // When we have chunked mock data with actual content, tell the main prompt to skip mockData generation
484
+ // Important: Check for actual keys, not just truthy object, because {} would skip generation incorrectly
485
+ const hasChunkedData = chunkedMockData && Object.keys(chunkedMockData).length > 0;
486
+ const prompt = generateEntityScenarioDataGenerator(structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, { mockDataAlreadyGenerated: hasChunkedData });
11
487
  const isDefault = scenario.name === DEFAULT_SCENARIO_NAME;
12
488
  const response = await completionCall({
13
489
  type: 'generateEntityScenarioData',
@@ -45,46 +521,79 @@ export async function generateDataForScenario({ entity, structure, scenario, def
45
521
  },
46
522
  ...response.stats,
47
523
  });
48
- const { completion, finishReason } = response;
524
+ let { completion, finishReason } = response;
49
525
  if (!completion) {
50
526
  console.log('CodeYam Error: Example data generation failed: No response from AI');
51
527
  return null;
52
528
  }
53
- awsLog(`LLMCall ${llmCall ? llmCall.id : 'N/A'}: ${entity.filePath} ${entity.metadata?.exportAlias ?? entity.name} scenario data completion :>> Finish reason:`, {
54
- finishReason,
55
- completion,
56
- });
529
+ awsLogDebugLevel(1, `LLMCall ${llmCall ? llmCall.id : 'N/A'}: ${entity.filePath} ${entity.metadata?.exportAlias ?? entity.name} finishReason: ${finishReason}`);
530
+ // If response was truncated due to token limit, make a continuation call
531
+ if (finishReason === 'length') {
532
+ awsLogDebugLevel(1, 'Response truncated, making continuation call');
533
+ const continuationResponse = await completionCall({
534
+ type: 'generateEntityScenarioData',
535
+ systemMessage: generateIncompleteSystemMessage(scenario.name, isDefault),
536
+ prompt: completion, // Pass the incomplete response as the prompt
537
+ model,
538
+ });
539
+ if (continuationResponse.completion) {
540
+ completion = completion + continuationResponse.completion;
541
+ finishReason = continuationResponse.finishReason;
542
+ }
543
+ }
57
544
  const validJson = validateJson(completion);
58
545
  const parsed = parseJsonSafe(validJson);
59
546
  if (!parsed || typeof parsed !== 'object' || !('scenarioData' in parsed)) {
60
- console.log('CodeYam Debug: generateDataForScenario failed to parse', {
61
- entityName: entity.name,
62
- scenarioName: scenario.name,
63
- hasParsed: !!parsed,
64
- parsedType: typeof parsed,
65
- hasScenarioData: parsed && 'scenarioData' in parsed,
66
- completionPreview: completion.substring(0, 200),
67
- });
547
+ awsLog(`Failed to parse scenario data for ${entity.name}/${scenario.name}`);
68
548
  return null;
69
549
  }
70
- const { scenarioData: scenarioDataWithoutDescription } = parsed;
71
- console.log('CodeYam Debug: generateDataForScenario parsed successfully', {
72
- entityName: entity.name,
73
- scenarioName: scenario.name,
74
- parsedScenarioName: scenarioDataWithoutDescription.scenarioName,
75
- hasData: !!scenarioDataWithoutDescription.data,
76
- dataKeys: scenarioDataWithoutDescription.data
77
- ? Object.keys(scenarioDataWithoutDescription.data)
78
- : [],
79
- });
550
+ let { scenarioData: scenarioDataWithoutDescription } = parsed;
551
+ // FIX: LLM sometimes puts mock data keys directly under scenarioData instead of
552
+ // under scenarioData.data.mockData. Detect and fix this structural issue.
553
+ if (structure.dataForMocks) {
554
+ const scenarioDataAsAny = scenarioDataWithoutDescription;
555
+ const reservedKeys = new Set([
556
+ 'scenarioName',
557
+ 'data',
558
+ 'scenarioDescription',
559
+ ]);
560
+ const misplacedKeys = [];
561
+ // Find keys that are directly under scenarioData but should be in mockData
562
+ for (const key of Object.keys(scenarioDataAsAny)) {
563
+ if (reservedKeys.has(key))
564
+ continue;
565
+ // If this key exists in the dataForMocks schema, it's misplaced
566
+ if (key in structure.dataForMocks) {
567
+ misplacedKeys.push(key);
568
+ }
569
+ }
570
+ if (misplacedKeys.length > 0) {
571
+ // Ensure data.mockData exists
572
+ if (!scenarioDataAsAny.data) {
573
+ scenarioDataAsAny.data = {};
574
+ }
575
+ if (!scenarioDataAsAny.data.mockData) {
576
+ scenarioDataAsAny.data.mockData = {};
577
+ }
578
+ // Move misplaced keys to mockData
579
+ for (const key of misplacedKeys) {
580
+ scenarioDataAsAny.data.mockData[key] = scenarioDataAsAny[key];
581
+ delete scenarioDataAsAny[key];
582
+ }
583
+ // Update the reference
584
+ scenarioDataWithoutDescription =
585
+ scenarioDataAsAny;
586
+ }
587
+ }
80
588
  const fullScenarioData = {
81
589
  ...scenarioDataWithoutDescription,
82
590
  scenarioDescription: scenario?.description ?? '',
83
591
  };
84
592
  if (structure.dataForMocks && !fullScenarioData.data.argumentsData) {
85
593
  fullScenarioData.data.argumentsData = [];
86
- if (structure.arguments && !fullScenarioData.data.argumentsData) {
87
- fullScenarioData.data.argumentsData = [];
594
+ // Populate argumentsData from structure.arguments using top-level data values
595
+ // Bug fix: removed redundant !argumentsData check that was always false after setting to []
596
+ if (structure.arguments) {
88
597
  for (let i = 0; i < structure.arguments.length; ++i) {
89
598
  if (!fullScenarioData.data.argumentsData[i]) {
90
599
  fullScenarioData.data.argumentsData[i] = {};
@@ -96,19 +605,98 @@ export async function generateDataForScenario({ entity, structure, scenario, def
96
605
  }
97
606
  }
98
607
  }
99
- if (structure.dataForMocks && !fullScenarioData.data.mockData) {
100
- fullScenarioData.data.mockData = {};
101
- for (const propKey of Object.keys(structure.arguments)) {
102
- const dataAsAny = fullScenarioData.data;
103
- fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
608
+ // Merge flat-level mock data into mockData.
609
+ // Sometimes the LLM returns some data inside data.mockData but other data at the flat
610
+ // data level (e.g., data.useRouter() instead of data.mockData.useRouter()).
611
+ // This code ensures all dataForMocks keys end up in mockData.
612
+ if (structure.dataForMocks) {
613
+ (_a = fullScenarioData.data).mockData || (_a.mockData = {});
614
+ const dataAsAny = fullScenarioData.data;
615
+ for (const propKey of Object.keys(structure.dataForMocks)) {
616
+ // Only copy if it exists at flat level and not already in mockData
617
+ if (dataAsAny[propKey] !== undefined &&
618
+ !fullScenarioData.data.mockData[propKey]) {
619
+ fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
620
+ }
621
+ }
622
+ }
623
+ // Merge chunked mock data from focused calls (takes priority over main call's data)
624
+ // This ensures keys processed with focused attention are correctly generated.
625
+ if (chunkedMockData && fullScenarioData.data.mockData) {
626
+ for (const [key, value] of Object.entries(chunkedMockData)) {
627
+ // Chunked data takes priority - overwrite main call's potentially wrong data
628
+ fullScenarioData.data.mockData[key] = value;
629
+ }
630
+ awsLog(`Merged chunked mock data for keys: ${Object.keys(chunkedMockData).join(', ')}`);
631
+ }
632
+ // Relocate misplaced nested keys to their correct position.
633
+ // The LLM sometimes places nested keys at root level instead of inside their
634
+ // parent object (e.g., 'fastener' at root instead of inside 'trpc').
635
+ // This ensures the mockData structure matches the dataForMocks schema.
636
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
637
+ relocateMisplacedNestedKeys(fullScenarioData.data.mockData, structure.dataForMocks);
638
+ }
639
+ // Convert null values to undefined based on schema type constraints.
640
+ // LLM uses null for "no value" (JSON doesn't support undefined), but TypeScript
641
+ // types like "string | undefined" don't accept null. This converts null→undefined
642
+ // for fields typed as "T | undefined" (but preserves null for "T | null").
643
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
644
+ convertNullToUndefinedBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
645
+ }
646
+ // Convert comma-separated strings to arrays when appropriate.
647
+ // The LLM sometimes generates strings like "color,size" instead of arrays
648
+ // like ["color", "size"] when the schema type is incorrectly inferred as
649
+ // 'string' instead of 'string[]'. This causes runtime errors when code
650
+ // calls array methods like .map() on the value.
651
+ if (fullScenarioData.data.mockData) {
652
+ convertCommaSeparatedStringsToArrays(fullScenarioData.data.mockData);
653
+ }
654
+ // Fix null values for ID fields when the schema indicates they should be non-null.
655
+ // The LLM sometimes generates `null` for ID fields (e.g., `"id": null`) when
656
+ // the schema type is `"number"`. This causes runtime issues when code checks
657
+ // `if (!data?.id)` expecting a truthy value.
658
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
659
+ fixNullIdsBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
660
+ }
661
+ if (structure.arguments && fullScenarioData.data.argumentsData) {
662
+ for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
663
+ if (structure.arguments[i]) {
664
+ convertNullToUndefinedBySchema(fullScenarioData.data.argumentsData[i], structure.arguments[i]);
665
+ }
104
666
  }
105
667
  }
668
+ // For Default Scenario only: check for missing keys and make follow-up call if needed.
669
+ // This tries to get better-quality data via LLM before falling back to defaults.
670
+ if (isDefault) {
671
+ await fillMissingMockDataKeys({
672
+ structure,
673
+ scenario,
674
+ executionFlows,
675
+ fullScenarioData,
676
+ model,
677
+ });
678
+ }
679
+ // Fill in missing mock data keys with default values (after trying LLM follow-up).
680
+ // The LLM sometimes doesn't generate data for all keys in large schemas.
681
+ // This ensures all dataForMocks keys have corresponding data to prevent
682
+ // runtime errors like "Cannot read properties of undefined".
683
+ // Only run for Default Scenario - non-default scenarios will get missing
684
+ // data filled in from the merge with default scenario data.
685
+ if (isDefault && structure.dataForMocks && fullScenarioData.data.mockData) {
686
+ fillMissingMockDataKeysWithDefaults(fullScenarioData.data.mockData, structure.dataForMocks);
687
+ }
688
+ // Track the final scenario data for E2E debugging
689
+ trackDataSnapshot('generateDataForScenario_result', {
690
+ scenarioName: scenario.name,
691
+ mockData: fullScenarioData.data.mockData,
692
+ argumentsData: fullScenarioData.data.argumentsData,
693
+ }, entity.name, scenario.name);
106
694
  return {
107
695
  scenarioData: fullScenarioData,
108
696
  llmCall: { name: scenario.name, id: llmCall.id },
109
697
  };
110
698
  }
111
- export default async function generateEntityScenarioData({ entity, structure, scenarios, incompleteResponse, analysis, model, }) {
699
+ export default async function generateEntityScenarioData({ entity, structure, scenarios, executionFlows, incompleteResponse, analysis, model, }) {
112
700
  if (scenarios.length === 0) {
113
701
  return { scenarioDatas: [], llmCalls: [] };
114
702
  }
@@ -120,6 +708,7 @@ export default async function generateEntityScenarioData({ entity, structure, sc
120
708
  entity,
121
709
  structure,
122
710
  scenario: defaultScenario,
711
+ executionFlows,
123
712
  incompleteResponse,
124
713
  analysis,
125
714
  model,
@@ -136,6 +725,7 @@ export default async function generateEntityScenarioData({ entity, structure, sc
136
725
  entity,
137
726
  structure,
138
727
  scenario,
728
+ executionFlows,
139
729
  defaultScenarioData,
140
730
  incompleteResponse,
141
731
  analysis,
@@ -148,28 +738,59 @@ export default async function generateEntityScenarioData({ entity, structure, sc
148
738
  if (nullCount > 0) {
149
739
  awsLog(`⚠️ Warning: ${nullCount} of ${results.length} non-default scenarios failed to generate data for ${entity.name}`);
150
740
  }
151
- scenarioDatas.push(...validResults.map((result) => result.scenarioData));
152
- llmCalls.push(...validResults.map((result) => result.llmCall));
153
- console.log('CodeYam Debug: generateEntityScenarioData results', {
154
- filePath: entity.filePath,
155
- entityName: entity.name,
156
- totalScenarios: scenarios.length,
157
- defaultScenarioGenerated: !!defaultScenarioResult,
158
- otherScenariosRequested: scenarios.length - 1,
159
- otherScenariosResults: results.length,
160
- nullResults: results.filter((r) => r === null).length,
161
- validResults: validResults.length,
162
- finalScenarioDatasCount: scenarioDatas.length,
741
+ // Merge non-default scenario data with default scenario data
742
+ // The LLM generates partial data (only differences), we need to merge with default
743
+ const mergedScenarioDatas = validResults.map((result) => {
744
+ const scenarioData = result.scenarioData;
745
+ // Merge mockData with default mockData
746
+ if (defaultScenarioData.data?.mockData && scenarioData.data?.mockData) {
747
+ scenarioData.data.mockData = deepMergeScenarioData(defaultScenarioData.data.mockData, scenarioData.data.mockData);
748
+ }
749
+ else if (defaultScenarioData.data?.mockData &&
750
+ !scenarioData.data?.mockData) {
751
+ // Use default mockData if scenario has none
752
+ scenarioData.data.mockData = { ...defaultScenarioData.data.mockData };
753
+ }
754
+ // Merge argumentsData with default argumentsData
755
+ if (defaultScenarioData.data?.argumentsData &&
756
+ Array.isArray(defaultScenarioData.data.argumentsData) &&
757
+ scenarioData.data?.argumentsData &&
758
+ Array.isArray(scenarioData.data.argumentsData)) {
759
+ for (let i = 0; i < defaultScenarioData.data.argumentsData.length; i++) {
760
+ const scenarioArg = scenarioData.data.argumentsData[i];
761
+ const defaultArg = defaultScenarioData.data.argumentsData[i];
762
+ // Only merge if both are objects (LLM sometimes returns primitives)
763
+ if (scenarioArg &&
764
+ typeof scenarioArg === 'object' &&
765
+ !Array.isArray(scenarioArg) &&
766
+ defaultArg &&
767
+ typeof defaultArg === 'object' &&
768
+ !Array.isArray(defaultArg)) {
769
+ scenarioData.data.argumentsData[i] = deepMergeScenarioData(defaultArg, scenarioArg);
770
+ }
771
+ else if (scenarioArg !== undefined) {
772
+ // Keep the scenario value as-is (even if primitive)
773
+ scenarioData.data.argumentsData[i] = scenarioArg;
774
+ }
775
+ else if (defaultArg && typeof defaultArg === 'object') {
776
+ // Use default if scenario is undefined and default is an object
777
+ scenarioData.data.argumentsData[i] = { ...defaultArg };
778
+ }
779
+ else {
780
+ scenarioData.data.argumentsData[i] = defaultArg;
781
+ }
782
+ }
783
+ }
784
+ else if (defaultScenarioData.data?.argumentsData &&
785
+ !scenarioData.data?.argumentsData) {
786
+ // Use default argumentsData if scenario has none
787
+ scenarioData.data.argumentsData =
788
+ defaultScenarioData.data.argumentsData.map((arg) => ({ ...arg }));
789
+ }
790
+ return scenarioData;
163
791
  });
164
- awsLog('CodeYam: scenarioDatas :>> ', JSON.stringify({
165
- filePath: entity.filePath,
166
- entityName: entity.name,
167
- scenarioDatas: scenarioDatas.map((sd) => ({
168
- scenarioName: sd.scenarioName,
169
- hasData: !!sd.data,
170
- dataKeys: sd.data ? Object.keys(sd.data) : [],
171
- })),
172
- }, null, 2));
792
+ scenarioDatas.push(...mergedScenarioDatas);
793
+ llmCalls.push(...validResults.map((result) => result.llmCall));
173
794
  return { scenarioDatas, llmCalls };
174
795
  }
175
796
  catch (error) {
@@ -177,27 +798,81 @@ export default async function generateEntityScenarioData({ entity, structure, sc
177
798
  throw error;
178
799
  }
179
800
  }
180
- export const generateSystemMessage = (scenarioName, defaultScenario) => {
801
+ export const generateSystemMessage = (scenarioName, defaultScenario, requiresErrorData = false) => {
181
802
  const scenarioType = defaultScenario
182
803
  ? `## Default Scenario
183
804
  Generate COMPLETE, robust data for the entire data structure.
184
- - Fill ALL fields with realistic values (except error attributes and key attributes set to null or undefined)
185
- - Arrays should have 2-3 items
186
- - Don't skip nested attributes unless the key attributes specify a parent attribute should be null or undefined
805
+ - Fill ALL fields with realistic values (except error attributes)
806
+ - Do not skip any keys, even simple or small entries
807
+ - Arrays should have 3-5 items to provide realistic test data variety
808
+ - Don't skip nested attributes unless the execution flow requirements specify a parent attribute should be null or undefined
187
809
  - This provides the baseline data for all other scenarios`
188
810
  : `## Non-Default Scenario
189
811
  Generate ONLY the differences from the default scenario.
190
812
  - Include only fields that need to change
191
813
  - Set to \`null\` to remove data
192
814
  - Omit unchanged fields—they merge from default`;
815
+ // Only include the "NO ERROR DATA" instruction when the scenario doesn't require error data
816
+ const noErrorDataInstruction = requiresErrorData
817
+ ? `## IMPORTANT: ERROR DATA REQUIRED
818
+ This scenario tests error handling. You MUST include "error" fields with realistic error messages.
819
+ - Set error fields to truthy values (e.g., "Error: Operation failed" or "Something went wrong")
820
+ - The error data is REQUIRED to trigger the correct error UI state`
821
+ : `## CRITICAL: NO ERROR DATA
822
+ NEVER include "error" fields in responses. Skip them entirely.
823
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
824
+ - Leave out any attribute named "error"—do not set to null, omit entirely`;
193
825
  return `You are a test data generator. Create mock data matching a data structure and scenario requirements.
194
826
 
827
+ ## Execution Flow Requirements
828
+ Each scenario has \`coveredFlows\` which lists the execution flows (distinct outcomes/behaviors) this scenario should demonstrate.
829
+ Each flow has \`requiredValues\` - the attribute values that MUST be set to produce that outcome.
830
+
831
+ **Your job**: Generate mock data that satisfies ALL the requiredValues from ALL coveredFlows.
832
+
833
+ For example, if a flow requires:
834
+ \`\`\`json
835
+ {
836
+ "attributePath": "signature[0].isLoading",
837
+ "value": "false",
838
+ "comparison": "equals",
839
+ "valueType": "boolean"
840
+ }
841
+ \`\`\`
842
+ Then set \`isLoading: false\` in the mockData.
843
+
844
+ ### Array Length Requirements (length< and length>)
845
+ For array size variation flows:
846
+ - \`comparison: "length<"\` with \`value: "0"\` → generate EMPTY array \`[]\`
847
+ - \`comparison: "length<"\` with \`value: "3"\` → generate 1-2 items (few items)
848
+ - \`comparison: "length>"\` with \`value: "10"\` → generate 12+ items (many items)
849
+
850
+ ### String Length Requirements (normal vs long)
851
+ For text length variation flows:
852
+ - \`value: "normal"\` with \`valueType: "string"\` → generate normal length text (10-50 chars)
853
+ - \`value: "long"\` with \`valueType: "string"\` → generate LONG text (200+ chars) to test overflow/truncation
854
+
855
+ ## CRITICAL: Blocking Flows to Avoid
856
+ If the scenario includes \`blockingFlowsToAvoid\`, these are flows (like modals, overlays) that would BLOCK the expected UI.
857
+ You MUST generate mock data that PREVENTS these flows from triggering:
858
+
859
+ - For \`comparison: "truthy"\` requirements → set the value to \`false\`, \`null\`, \`undefined\`, or \`0\`
860
+ - For \`comparison: "exists"\` requirements → set the value to \`null\` or omit it entirely
861
+ - For \`comparison: "equals"\` requirements → set a DIFFERENT value than what's required
862
+
863
+ For example, if a blocking flow has:
864
+ \`\`\`json
865
+ {
866
+ "attributePath": "useFetcher().data.success",
867
+ "value": "true",
868
+ "comparison": "truthy"
869
+ }
870
+ \`\`\`
871
+ Then you MUST set \`useFetcher().data\` to \`null\` or \`{ success: false }\` to prevent the modal from appearing.
872
+
195
873
  ${scenarioType}
196
874
 
197
- ## CRITICAL: NO ERROR DATA
198
- NEVER include "error" fields in responses. Skip them entirely.
199
- - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
200
- - Leave out any attribute named "error"—do not set to null, omit entirely
875
+ ${noErrorDataInstruction}
201
876
 
202
877
  ## Special Markers
203
878
 
@@ -213,30 +888,138 @@ Use for relative dates. Code runs in Node (no browser APIs, no external librarie
213
888
  \`\`\`
214
889
  Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
215
890
 
216
- ## Mock Data Keys
217
- Preserve keys exactly as written in the structure. There are two formats:
891
+ ### Arrays
892
+ - Arrays should have many items (at least 4) unless specified otherwise
893
+ - Each item must follow the exact structure provided
894
+ - In general we want robust data, not minimal data unless specified otherwise
895
+
896
+ ## CRITICAL: Preserve Exact Structure
897
+ Your response MUST mirror the EXACT nested structure provided in mockData Structure.
898
+ - Do NOT reorganize, split, or create duplicate keys
899
+ - The hierarchy of nested objects must match exactly what was provided unless overridden by scenario rules
900
+ - Only change the leaf VALUES (replacing type descriptions like "string" with actual data like "hello")
901
+ - Copy the key strings EXACTLY from the structure
902
+ - Do NOT modify type parameters, arguments, or any part of the key
903
+ - The keys preserve the exact function call as written in the original code
218
904
 
219
- ### Standard function calls
905
+ ## Response Format
220
906
  \`\`\`json
221
907
  {
222
- "mockData": {
223
- "useUser()": { "user": { "name": "John" } },
224
- "from().select()": [{ "id": "1" }]
908
+ "scenarioData": {
909
+ "scenarioName": "${scenarioName}",
910
+ "data": {
911
+ "mockData": { ... },
912
+ "argumentsData": [ ... ]
913
+ }
225
914
  }
226
915
  }
227
916
  \`\`\`
228
917
 
229
- ### Variable-qualified calls (for multiple calls to the same function)
230
- When the same function is called multiple times with results stored in different variables, keys use the format \`variableName <- functionName\`:
918
+ ## Rules
919
+ - Valid JSON only—no raw code outside markers
920
+ - No \`undefined\`—use \`null\` or omit
921
+ - No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
922
+ - Scenario name must match exactly: "${scenarioName}"
923
+ - Empty mockData: \`{}\`, empty argumentsData: \`[]\`
924
+
925
+ ## IMPORTANT: Avoid Identifier Collisions
926
+ When generating identifier values (SHA hashes, entity IDs, etc.):
927
+ - Use DISTINCT values for different identifier fields
928
+ - Avoid matching: if \`entity.sha\` is "abc123", arrays like \`jobs[].entityShas\` or \`currentlyExecuting.entityShas\` should NOT contain "abc123"
929
+ - This prevents accidental blocking of UI conditionals that check if IDs are in/not-in arrays
930
+ `;
931
+ };
932
+ export const generateIncompleteSystemMessage = (scenarioName, isDefault) => `Your previous response provided us with an incomplete json object.
933
+
934
+ Can you help us complete it? The previous response got cut off because it was too long so to complete the response you'll need to pick up where you left off providing just the necessary text to make the full response a valid json object.
935
+
936
+ Here is the original system message as well:
937
+
938
+ ${generateSystemMessage(scenarioName, isDefault)}
939
+ \`\`\`
940
+ `;
941
+ /**
942
+ * System message for follow-up calls to generate missing mockData keys.
943
+ * Includes the same rules as the main system message but with a simpler response format.
944
+ */
945
+ export const generateMissingKeysSystemMessage = () => `You are completing mock data generation for the Default Scenario. The initial response was missing some keys.
946
+
947
+ Generate data ONLY for the missing keys provided in the prompt. Do not skip any of them.
948
+
949
+ - Scenario name must match exactly: "Default Scenario"
950
+
951
+ ## Special Markers
952
+
953
+ ### Dynamic Dates (\`~~codeyam-code~~\`)
954
+ \`\`\`json
955
+ { "createdAt": { "~~codeyam-code~~": "new Date(Date.now() - 24*60*60*1000)" } }
956
+ \`\`\`
957
+ Use for relative dates. Code runs in Node (no browser APIs, no external libraries).
958
+
959
+ ### JSX Children (\`~~codeyam-jsx~~\`)
960
+ \`\`\`json
961
+ { "children": { "~~codeyam-jsx~~": "<div>Hello</div>" } }
962
+ \`\`\`
963
+ Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
964
+
965
+ ### Arrays
966
+ - Arrays should have many items (at least 4) unless specified otherwise
967
+ - Each item must follow the exact structure provided
968
+
969
+ ## CRITICAL: Preserve Exact Structure
970
+ Your response MUST mirror the EXACT nested structure provided for the missing keys.
971
+ - Only change the leaf VALUES (replacing type descriptions like "string" with actual data)
972
+ - Copy the key strings EXACTLY from the structure
973
+ - Do NOT modify type parameters, arguments, or any part of the key
974
+
975
+ ## CRITICAL: NO ERROR DATA
976
+ NEVER include "error" fields in responses. Skip them entirely.
977
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
978
+ - Leave out any attribute named "error"—do not set to null, omit entirely
979
+
980
+ ## Response Format
231
981
  \`\`\`json
232
982
  {
233
983
  "mockData": {
234
- "entityDiffFetcher <- useFetcher": { "data": null, "state": "idle" },
235
- "reportFetcher <- useFetcher": { "data": { "reportId": "abc123" }, "state": "idle" }
984
+ // fill in ONLY the missing keys
236
985
  }
237
986
  }
238
987
  \`\`\`
239
- This reads as "entityDiffFetcher receives from useFetcher". Each variable gets its own distinct mock data.
988
+
989
+ ## Rules
990
+ - Valid JSON only—no raw code outside markers
991
+ - No \`undefined\`—use \`null\` or omit
992
+ - No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
993
+ `;
994
+ /**
995
+ * System message for focused calls to generate critical mockData keys.
996
+ * These are keys referenced by the scenario's execution flow requiredValues.
997
+ */
998
+ export const generateCriticalKeysSystemMessage = (scenarioName) => `You are generating mock data for CRITICAL keys that control scenario behavior.
999
+
1000
+ These keys are referenced by the execution flow's requiredValues - they directly determine
1001
+ what the component renders. Pay EXTRA attention to matching the exact structure and values.
1002
+
1003
+ - Scenario name must match exactly: "${scenarioName}"
1004
+
1005
+ ## CRITICAL: Special Characters in Keys
1006
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1007
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1008
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1009
+
1010
+ ## CRITICAL: Preserve Exact Structure
1011
+ Your response MUST mirror the EXACT nested structure provided.
1012
+ - Copy key strings EXACTLY as shown (including special characters)
1013
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1014
+ - Do NOT modify keys, type parameters, or add extra keys
1015
+
1016
+ ## Matching requiredValues
1017
+ When the prompt shows requiredValues like:
1018
+ - \`attributePath: "useParams().functionCallReturnValue.*"\`
1019
+ - \`value: "scenarios"\`
1020
+
1021
+ This means set the \`*\` key to include "scenarios". For URL paths split by \`/\`,
1022
+ generate a path like \`"scenarios/id/mode"\` where segments match requirements.
240
1023
 
241
1024
  ## Response Format
242
1025
  \`\`\`json
@@ -244,28 +1027,65 @@ This reads as "entityDiffFetcher receives from useFetcher". Each variable gets i
244
1027
  "scenarioData": {
245
1028
  "scenarioName": "${scenarioName}",
246
1029
  "data": {
247
- "mockData": { ... },
248
- "argumentsData": [ ... ]
1030
+ "mockData": {
1031
+ // generate data for ONLY the critical keys
1032
+ }
249
1033
  }
250
1034
  }
251
1035
  }
252
1036
  \`\`\`
253
1037
 
254
1038
  ## Rules
255
- - Valid JSON only—no raw code outside markers
1039
+ - Valid JSON only
256
1040
  - No \`undefined\`—use \`null\` or omit
257
- - No data references (can't use \`posts[0]\` elsewhere—duplicate the value)
258
- - Scenario name must match exactly: "${scenarioName}"
259
- - Empty mockData: \`{}\`, empty argumentsData: \`[]\`
1041
+ - Match the exact schema structure provided
260
1042
  `;
261
- };
262
- export const generateIncompleteSystemMessage = (scenarioName, isDefault) => `Your previous response provided us with an incomplete json object.
1043
+ /**
1044
+ * System message for focused calls to generate mock data for a chunk of keys.
1045
+ * Used when data structures are large and need to be processed in smaller pieces.
1046
+ */
1047
+ export const generateChunkSystemMessage = (scenarioName) => `You are generating mock data for a SUBSET of keys from a larger data structure.
263
1048
 
264
- Can you help us complete it? The previous response got cut off because it was too long so to complete the response you'll need to pick up where you left off providing just the necessary text to make the full response a valid json object.
1049
+ This chunk contains fewer keys so you can focus on generating HIGH QUALITY data for each one.
1050
+ Pay EXTRA attention to matching the exact structure and values for each key.
265
1051
 
266
- Here is the original system message as well:
1052
+ - Scenario name must match exactly: "${scenarioName}"
267
1053
 
268
- ${generateSystemMessage(scenarioName, isDefault)}
1054
+ ## CRITICAL: Special Characters in Keys
1055
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1056
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1057
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1058
+
1059
+ ## CRITICAL: Preserve Exact Structure
1060
+ Your response MUST mirror the EXACT nested structure provided.
1061
+ - Copy key strings EXACTLY as shown (including special characters)
1062
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1063
+ - Do NOT modify keys, type parameters, or add extra keys
1064
+
1065
+ ## Matching requiredValues
1066
+ If the prompt includes requiredValues, these are specific values that MUST be set:
1067
+ - For \`attributePath: "useParams().functionCallReturnValue.*"\` with \`value: "scenarios"\`
1068
+ → Set the \`*\` key to include "scenarios" (e.g., "scenarios/id/mode")
1069
+ - For URL paths, generate realistic paths that satisfy the requirements
1070
+
1071
+ ## CRITICAL: NO ERROR DATA
1072
+ NEVER include "error" fields in responses. Skip them entirely.
1073
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
1074
+ - Leave out any attribute named "error"—do not set to null, omit entirely
1075
+
1076
+ ## Response Format
1077
+ \`\`\`json
1078
+ {
1079
+ "mockData": {
1080
+ // generate data for ONLY the keys in this chunk
1081
+ }
1082
+ }
269
1083
  \`\`\`
1084
+
1085
+ ## Rules
1086
+ - Valid JSON only
1087
+ - No \`undefined\`—use \`null\` or omit
1088
+ - Generate data for ALL keys in the chunk (don't skip any)
1089
+ - Arrays should have many items (at least 4) unless specified otherwise
270
1090
  `;
271
1091
  //# sourceMappingURL=generateEntityScenarioData.js.map