@codeyam/codeyam-cli 0.1.0-staging.1669d45 → 0.1.0-staging.2a88920

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 (437) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +5 -5
  4. package/analyzer-template/packages/ai/index.ts +15 -2
  5. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +87 -51
  6. package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
  7. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +98 -9
  8. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +139 -23
  9. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +6 -126
  10. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +555 -28
  11. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +88 -7
  12. package/analyzer-template/packages/ai/src/lib/completionCall.ts +198 -34
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +772 -243
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +205 -0
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  18. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +43 -1
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +122 -15
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +160 -0
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +319 -88
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  24. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
  25. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  26. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  27. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +642 -7
  28. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +35 -6
  29. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +383 -6
  30. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +1 -1
  31. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1299 -51
  32. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  33. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +90 -96
  34. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
  35. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  36. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  37. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +23 -6
  38. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  39. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +179 -45
  40. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +26 -4
  41. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  42. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
  43. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
  44. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  45. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  46. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  47. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  48. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  49. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  50. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  51. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +30 -19
  52. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +14 -4
  53. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
  54. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  55. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
  56. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  57. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
  58. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +189 -76
  59. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +29 -0
  60. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +77 -9
  61. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +118 -10
  62. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +276 -17
  63. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  64. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  65. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  66. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  67. package/analyzer-template/packages/aws/package.json +2 -2
  68. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
  69. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  70. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  71. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  72. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  73. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  74. package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
  75. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  76. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  77. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
  78. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  79. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
  80. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  81. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  82. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  83. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  84. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  85. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  86. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  87. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  88. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  89. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  90. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  91. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  92. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  93. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  94. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  95. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  96. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  97. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  98. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  99. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  100. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
  101. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  102. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  103. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  104. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  105. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  106. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  107. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  108. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  109. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  110. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  111. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
  112. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  113. package/analyzer-template/packages/github/dist/types/index.d.ts +1 -1
  114. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  115. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  116. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +25 -1
  117. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  118. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  119. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  120. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +56 -6
  121. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  122. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  123. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  124. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  125. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  126. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  127. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  128. package/analyzer-template/packages/github/package.json +1 -1
  129. package/analyzer-template/packages/types/index.ts +1 -0
  130. package/analyzer-template/packages/types/src/types/Analysis.ts +25 -0
  131. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  132. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +70 -6
  133. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  134. package/analyzer-template/packages/utils/dist/types/index.d.ts +1 -1
  135. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  136. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  137. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +25 -1
  138. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  139. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  140. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  141. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +56 -6
  142. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  143. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  144. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  145. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  146. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  147. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  148. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  149. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  150. package/analyzer-template/playwright/capture.ts +20 -8
  151. package/analyzer-template/playwright/captureStatic.ts +1 -1
  152. package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
  153. package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
  154. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  155. package/analyzer-template/project/constructMockCode.ts +367 -37
  156. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  157. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  158. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  159. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
  160. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  161. package/analyzer-template/project/orchestrateCapture.ts +71 -6
  162. package/analyzer-template/project/reconcileMockDataKeys.ts +152 -9
  163. package/analyzer-template/project/runAnalysis.ts +4 -0
  164. package/analyzer-template/project/start.ts +35 -11
  165. package/analyzer-template/project/writeMockDataTsx.ts +127 -4
  166. package/analyzer-template/project/writeScenarioComponents.ts +101 -8
  167. package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
  168. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
  169. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  170. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
  171. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  172. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  173. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  174. package/background/src/lib/virtualized/project/constructMockCode.js +300 -7
  175. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  176. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  177. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  178. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  179. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  180. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  181. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  182. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
  183. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  184. package/background/src/lib/virtualized/project/orchestrateCapture.js +58 -6
  185. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  186. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +126 -9
  187. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  188. package/background/src/lib/virtualized/project/runAnalysis.js +3 -0
  189. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  190. package/background/src/lib/virtualized/project/start.js +32 -11
  191. package/background/src/lib/virtualized/project/start.js.map +1 -1
  192. package/background/src/lib/virtualized/project/writeMockDataTsx.js +101 -4
  193. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  194. package/background/src/lib/virtualized/project/writeScenarioComponents.js +57 -8
  195. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  196. package/codeyam-cli/src/cli.js +2 -0
  197. package/codeyam-cli/src/cli.js.map +1 -1
  198. package/codeyam-cli/src/commands/debug.js +7 -5
  199. package/codeyam-cli/src/commands/debug.js.map +1 -1
  200. package/codeyam-cli/src/commands/memory.js +273 -0
  201. package/codeyam-cli/src/commands/memory.js.map +1 -0
  202. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +4 -0
  203. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  204. package/codeyam-cli/src/utils/analysisRunner.js +21 -2
  205. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  206. package/codeyam-cli/src/utils/install-skills.js +42 -6
  207. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  208. package/codeyam-cli/src/utils/queue/job.js +1 -0
  209. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  210. package/codeyam-cli/src/utils/queue/manager.js +6 -0
  211. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  212. package/codeyam-cli/src/utils/rules/index.js +5 -0
  213. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  214. package/codeyam-cli/src/utils/rules/parser.js +106 -0
  215. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  216. package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
  217. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  218. package/codeyam-cli/src/utils/rules/staleness.js +132 -0
  219. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  220. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +2 -0
  221. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  222. package/codeyam-cli/src/webserver/app/lib/database.js +7 -3
  223. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  224. package/codeyam-cli/src/webserver/bootstrap.js +40 -0
  225. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  226. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-DsN1wKrm.js +11 -0
  227. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-COi5OvsN.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
  228. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BwdQv49w.js → EntityTypeIcon-Ba2JVPzP.js} +1 -1
  229. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-CEleMv_j.js → InlineSpinner-C8lyxW9k.js} +1 -1
  230. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D68KarMg.js → InteractivePreview-aht4aafF.js} +2 -2
  231. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-L75Wvqgw.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
  232. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-C53WM8qn.js → LoadingDots-B0GLXMsr.js} +1 -1
  233. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CrNkmy4i.js → LogViewer-xgeCVgSM.js} +1 -1
  234. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-OApQuNyq.js +16 -0
  235. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CQifa1n-.js → SafeScreenshot-DuDvi0jm.js} +1 -1
  236. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CyaBFX7l.js → ScenarioViewer-DzccYyI8.js} +3 -13
  237. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D36O1rzU.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
  239. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BwavGCpm.js +32 -0
  240. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  241. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  242. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  243. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DgTPh8H-.js → chevron-down-Cx24_aWc.js} +1 -1
  244. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-DdQKK6on.js → chunk-EPOLDU6W-CXRTFQ3F.js} +1 -1
  245. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-Dmr2bb1R.js → circle-check-BOARzkeR.js} +1 -1
  246. package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +6 -0
  247. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Do4ZLUYa.js → createLucideIcon-BdhJEx6B.js} +1 -1
  248. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BBnGWYga.js +1 -0
  249. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CbdFyxZh.js → entity._sha._-BJUiQqZF.js} +12 -12
  250. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js → entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js} +1 -1
  251. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-wDWZZO1W.js → entity._sha_.create-scenario-D1T4TGjf.js} +1 -1
  252. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMbl7MeQ.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
  253. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-5wRKRIH9.js → entry.client-CS2cb_eZ.js} +1 -1
  254. package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +6 -0
  255. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DD3SDH7t.js → fileTableUtils-DMJ7zii9.js} +1 -1
  256. package/codeyam-cli/src/webserver/build/client/assets/files-CJ6lTdTA.js +1 -0
  257. package/codeyam-cli/src/webserver/build/client/assets/{git-zXjT7J0G.js → git-CPTZZ-JZ.js} +8 -8
  258. package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +1 -0
  259. package/codeyam-cli/src/webserver/build/client/assets/{index-DLbXwndH.js → index-B1h680n5.js} +1 -1
  260. package/codeyam-cli/src/webserver/build/client/assets/{index-gPZ-lad1.js → index-lzqtyFU8.js} +1 -1
  261. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BsPXJ81F.js → loader-circle-B7B9V-bu.js} +1 -1
  262. package/codeyam-cli/src/webserver/build/client/assets/manifest-a78b90a2.js +1 -0
  263. package/codeyam-cli/src/webserver/build/client/assets/memory--GCbFsBE.js +92 -0
  264. package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +62 -0
  265. package/codeyam-cli/src/webserver/build/client/assets/{search-P2FKIUql.js → search-CxXUmBSd.js} +1 -1
  266. package/codeyam-cli/src/webserver/build/client/assets/{settings-B2eDuBj8.js → settings-CS5f3WzT.js} +1 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/{simulations-L18M6-kN.js → simulations-DwFIBT09.js} +1 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BDz7kbVA.js → triangle-alert-B6LgvRJg.js} +1 -1
  269. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-29dDmbH8.js → useCustomSizes-C1v1PQzo.js} +1 -1
  270. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BUm0UVJm.js → useLastLogLine-aSv48UbS.js} +1 -1
  271. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CkIOKTrZ.js → useReportContext-DYxHZQuP.js} +1 -1
  272. package/codeyam-cli/src/webserver/build/client/assets/{useToast-KKw5kTn-.js → useToast-mBRpZPiu.js} +1 -1
  273. package/codeyam-cli/src/webserver/build/server/assets/index-BM6TDT1Y.js +1 -0
  274. package/codeyam-cli/src/webserver/build/server/assets/server-build-dYC34MHw.js +257 -0
  275. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  276. package/codeyam-cli/src/webserver/build-info.json +5 -5
  277. package/codeyam-cli/templates/codeyam-memory-hook.sh +200 -0
  278. package/codeyam-cli/templates/codeyam:debug.md +47 -3
  279. package/codeyam-cli/templates/codeyam:diagnose.md +203 -25
  280. package/codeyam-cli/templates/codeyam:memory.md +341 -0
  281. package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
  282. package/codeyam-cli/templates/rule-reflection-hook.py +160 -0
  283. package/codeyam-cli/templates/rules-instructions.md +93 -0
  284. package/package.json +8 -5
  285. package/packages/ai/index.js +7 -3
  286. package/packages/ai/index.js.map +1 -1
  287. package/packages/ai/src/lib/analyzeScope.js +70 -29
  288. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  289. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  290. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  291. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +78 -8
  292. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  293. package/packages/ai/src/lib/astScopes/methodSemantics.js +109 -23
  294. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  295. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +1 -102
  296. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  297. package/packages/ai/src/lib/astScopes/processExpression.js +440 -27
  298. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  299. package/packages/ai/src/lib/completionCall.js +161 -30
  300. package/packages/ai/src/lib/completionCall.js.map +1 -1
  301. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +589 -166
  302. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  303. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +179 -0
  304. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
  305. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
  306. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  307. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  308. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  309. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  310. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  311. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +41 -1
  312. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  313. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +104 -11
  314. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  315. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +159 -0
  316. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  317. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  318. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  319. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +265 -79
  320. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  321. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  322. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  323. package/packages/ai/src/lib/dataStructureChunking.js +111 -0
  324. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  325. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  326. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  327. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  328. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  329. package/packages/ai/src/lib/generateEntityScenarioData.js +525 -8
  330. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  331. package/packages/ai/src/lib/generateEntityScenarios.js +26 -2
  332. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  333. package/packages/ai/src/lib/generateExecutionFlows.js +281 -4
  334. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  335. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +946 -42
  336. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  337. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  338. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  339. package/packages/ai/src/lib/mergeStatements.js +70 -51
  340. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  341. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
  342. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  343. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  344. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  345. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +15 -7
  346. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  347. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  348. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  349. package/packages/ai/src/lib/resolvePathToControllable.js +155 -41
  350. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
  351. package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
  352. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  353. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  354. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  355. package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
  356. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  357. package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
  358. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  359. package/packages/analyze/src/lib/analysisContext.js +30 -5
  360. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  361. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  362. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  363. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  364. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  365. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  366. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  367. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  368. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  369. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  370. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  371. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  372. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  373. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +21 -9
  374. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  375. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +14 -4
  376. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  377. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
  378. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  379. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  380. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  381. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
  382. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  383. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  384. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  385. package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
  386. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  387. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +160 -68
  388. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  389. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +25 -8
  390. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  391. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +71 -9
  392. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  393. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +57 -9
  394. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  395. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +233 -9
  396. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  397. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  398. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  399. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  400. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  401. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  402. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  403. package/packages/database/src/lib/kysely/db.js +8 -1
  404. package/packages/database/src/lib/kysely/db.js.map +1 -1
  405. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  406. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  407. package/packages/database/src/lib/loadAnalyses.js +45 -2
  408. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  409. package/packages/database/src/lib/loadAnalysis.js +8 -0
  410. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  411. package/packages/database/src/lib/loadBranch.js +11 -1
  412. package/packages/database/src/lib/loadBranch.js.map +1 -1
  413. package/packages/database/src/lib/loadCommit.js +7 -0
  414. package/packages/database/src/lib/loadCommit.js.map +1 -1
  415. package/packages/database/src/lib/loadCommits.js +22 -1
  416. package/packages/database/src/lib/loadCommits.js.map +1 -1
  417. package/packages/database/src/lib/loadEntities.js +23 -4
  418. package/packages/database/src/lib/loadEntities.js.map +1 -1
  419. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  420. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  421. package/packages/database/src/lib/updateCommitMetadata.js +5 -4
  422. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  423. package/packages/types/index.js.map +1 -1
  424. package/packages/utils/src/lib/safeFileName.js +29 -3
  425. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  426. package/scripts/finalize-analyzer.cjs +3 -3
  427. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +0 -1
  428. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +0 -11
  429. package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +0 -11
  430. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +0 -37
  431. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +0 -1
  432. package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +0 -1
  433. package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +0 -1
  434. package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +0 -1
  435. package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +0 -57
  436. package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +0 -1
  437. package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +0 -228
@@ -1,11 +1,17 @@
1
1
  import completionCall from "./completionCall.js";
2
2
  import generateEntityScenarioDataGenerator from "./promptGenerators/generateEntityScenarioDataGenerator.js";
3
3
  import generateMissingKeysPrompt from "./promptGenerators/generateMissingKeysPrompt.js";
4
+ import generateChunkPrompt from "./promptGenerators/generateChunkPrompt.js";
4
5
  import { saveLlmCall } from "../../../../packages/aws/dynamodb/index.js";
6
+ import { trackDataSnapshot } from "./e2eDataTracking.js";
5
7
  import validateJson from "./validateJson.js";
6
8
  import { awsLog, awsLogDebugLevel } from "../../../../packages/utils/index.js";
7
9
  import { parseJsonSafe } from "../../../../packages/ai/index.js";
8
10
  import convertNullToUndefinedBySchema from "./dataStructure/helpers/convertNullToUndefinedBySchema.js";
11
+ import convertTypeAnnotationsToValues from "./dataStructure/helpers/convertTypeAnnotationsToValues.js";
12
+ import fixNullIdsBySchema from "./dataStructure/helpers/fixNullIdsBySchema.js";
13
+ import { deepMerge } from "../../../../packages/generate/index.js";
14
+ import { chunkDataStructure, getRequiredValuesForChunk, } from "./dataStructureChunking.js";
9
15
  /**
10
16
  * Check if any of the scenario's covered flows require error data.
11
17
  * Returns true if any requiredValue has an error path with truthy comparison.
@@ -90,6 +96,278 @@ function deepMergeScenarioData(defaultData, scenarioData) {
90
96
  return result;
91
97
  }
92
98
  const DEFAULT_SCENARIO_NAME = 'Default Scenario';
99
+ /**
100
+ * Find the path to a key within a nested dataForMocks structure.
101
+ * Returns the path as an array of keys, or null if not found.
102
+ *
103
+ * @example
104
+ * // dataForMocks = { trpc: { fastener: { "useMutation()": { isLoading: "boolean" } } } }
105
+ * // findKeyPath("fastener", dataForMocks) returns ["trpc"]
106
+ */
107
+ function findKeyPath(targetKey, obj, currentPath = []) {
108
+ if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
109
+ return null;
110
+ }
111
+ for (const key of Object.keys(obj)) {
112
+ if (key === targetKey) {
113
+ return currentPath;
114
+ }
115
+ // Recursively search in nested objects
116
+ const nested = obj[key];
117
+ if (typeof nested === 'object' &&
118
+ nested !== null &&
119
+ !Array.isArray(nested)) {
120
+ const result = findKeyPath(targetKey, nested, [
121
+ ...currentPath,
122
+ key,
123
+ ]);
124
+ if (result !== null) {
125
+ return result;
126
+ }
127
+ }
128
+ }
129
+ return null;
130
+ }
131
+ /**
132
+ * Relocate misplaced nested keys in mockData to their correct position
133
+ * based on the dataForMocks structure.
134
+ *
135
+ * When the LLM returns mockData with keys at the wrong nesting level
136
+ * (e.g., { trpc: { quote: {...} }, fastener: {...} } when fastener should
137
+ * be inside trpc), this function moves them to the correct position.
138
+ *
139
+ * This function works recursively to handle nested misplacements, not just
140
+ * root-level ones. For example, if getQuote is at trpc.getQuote instead of
141
+ * trpc.quote.getQuote, it will be relocated.
142
+ *
143
+ * @example
144
+ * // dataForMocks: { trpc: { quote: {...}, fastener: {...} } }
145
+ * // mockData: { trpc: { quote: {...} }, fastener: {...} }
146
+ * // After: mockData: { trpc: { quote: {...}, fastener: {...} } }
147
+ *
148
+ * @example (nested case)
149
+ * // dataForMocks: { trpc: { quote: { getQuote: {...} } } }
150
+ * // mockData: { trpc: { quote: {...}, getQuote: {...} } }
151
+ * // After: mockData: { trpc: { quote: { getQuote: {...} } } }
152
+ */
153
+ function relocateMisplacedNestedKeys(mockData, dataForMocks, currentPathForLogging = []) {
154
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
155
+ return;
156
+ }
157
+ const keysInSchema = Object.keys(dataForMocks);
158
+ const keysToRelocate = [];
159
+ // Find keys in mockData that are NOT at this level in dataForMocks
160
+ // but DO exist somewhere nested in dataForMocks
161
+ for (const key of Object.keys(mockData)) {
162
+ if (!keysInSchema.includes(key)) {
163
+ // This key is at this level in mockData but not at this level in dataForMocks
164
+ // Check if it exists somewhere nested in dataForMocks
165
+ const path = findKeyPath(key, dataForMocks);
166
+ if (path !== null && path.length > 0) {
167
+ keysToRelocate.push({ key, path });
168
+ }
169
+ }
170
+ }
171
+ // Relocate each misplaced key to its correct nested position
172
+ for (const { key, path } of keysToRelocate) {
173
+ const value = mockData[key];
174
+ // Navigate to the correct parent in mockData, creating nested objects if needed
175
+ let current = mockData;
176
+ for (const pathKey of path) {
177
+ if (current[pathKey] === undefined) {
178
+ current[pathKey] = {};
179
+ }
180
+ current = current[pathKey];
181
+ }
182
+ // Deep merge the value into the correct location
183
+ // Use deep merge to preserve existing data at that location
184
+ if (current[key] !== undefined && typeof current[key] === 'object') {
185
+ current[key] = deepMerge(current[key], value);
186
+ }
187
+ else {
188
+ current[key] = value;
189
+ }
190
+ // Remove the key from its current (wrong) level
191
+ delete mockData[key];
192
+ const fullPath = [...currentPathForLogging, ...path].join('.');
193
+ awsLog(`CodeYam: Relocated misplaced key "${key}" from [${currentPathForLogging.join('.')}] to [${fullPath}]`);
194
+ }
195
+ // Recursively process nested objects to handle deeply nested misplacements
196
+ for (const key of Object.keys(mockData)) {
197
+ const mockValue = mockData[key];
198
+ const schemaValue = dataForMocks[key];
199
+ // Only recurse if both mockData and schema have nested objects at this key
200
+ if (typeof mockValue === 'object' &&
201
+ mockValue !== null &&
202
+ !Array.isArray(mockValue) &&
203
+ typeof schemaValue === 'object' &&
204
+ schemaValue !== null &&
205
+ !Array.isArray(schemaValue)) {
206
+ relocateMisplacedNestedKeys(mockValue, schemaValue, [...currentPathForLogging, key]);
207
+ }
208
+ }
209
+ }
210
+ /**
211
+ * Generate default mock data for a schema type.
212
+ * Returns reasonable default values based on the schema type string.
213
+ */
214
+ function generateDefaultForSchemaType(schemaType) {
215
+ if (typeof schemaType === 'string') {
216
+ // Handle common type strings
217
+ if (schemaType === 'function')
218
+ return () => { };
219
+ if (schemaType === 'promise')
220
+ return Promise.resolve();
221
+ if (schemaType === 'boolean')
222
+ return false;
223
+ if (schemaType === 'string')
224
+ return '';
225
+ if (schemaType === 'number')
226
+ return 0;
227
+ if (schemaType.includes('number | undefined'))
228
+ return undefined;
229
+ if (schemaType.includes('string | undefined'))
230
+ return undefined;
231
+ if (schemaType.includes('boolean | undefined'))
232
+ return undefined;
233
+ if (schemaType.includes('| undefined'))
234
+ return undefined;
235
+ if (schemaType.includes('| null'))
236
+ return null;
237
+ return schemaType; // Return the type as a string placeholder
238
+ }
239
+ if (typeof schemaType === 'object' &&
240
+ schemaType !== null &&
241
+ !Array.isArray(schemaType)) {
242
+ // Recursively generate defaults for nested objects
243
+ const result = {};
244
+ for (const [key, value] of Object.entries(schemaType)) {
245
+ result[key] = generateDefaultForSchemaType(value);
246
+ }
247
+ return result;
248
+ }
249
+ return undefined;
250
+ }
251
+ /**
252
+ * Detect if a string should be converted to an array.
253
+ * Returns the array if the field appears to be an array field, or null if it should remain a string.
254
+ *
255
+ * This handles two cases:
256
+ * 1. Comma-separated values: "color,size" -> ["color", "size"]
257
+ * 2. Single values for array-named fields: "Finish" -> ["Finish"]
258
+ */
259
+ function parseCommaSeparatedStringAsArray(value, key) {
260
+ // Heuristic: if the key name suggests it's an array field, convert it
261
+ // Common patterns: *_attributes, *_ids, *_items, *_tags, *_values, plural names
262
+ // Check this FIRST because array-named fields should be converted regardless
263
+ // of whether they contain commas (single values become single-element arrays).
264
+ const arrayFieldPatterns = [
265
+ /_attributes$/i,
266
+ /_ids$/i,
267
+ /_items$/i,
268
+ /_tags$/i,
269
+ /_values$/i,
270
+ /_types$/i,
271
+ /_names$/i,
272
+ /_keys$/i,
273
+ /^attributes$/i,
274
+ /^items$/i,
275
+ /^tags$/i,
276
+ /^values$/i,
277
+ ];
278
+ const looksLikeArrayField = arrayFieldPatterns.some((pattern) => pattern.test(key));
279
+ if (looksLikeArrayField) {
280
+ // Skip newlines check - multiline values shouldn't be split
281
+ if (value.includes('\n')) {
282
+ return null;
283
+ }
284
+ // Split by comma and trim whitespace
285
+ const parts = value.split(',').map((s) => s.trim());
286
+ // Filter out empty strings - this handles both "Finish" -> ["Finish"]
287
+ // and "" -> []
288
+ return parts.filter((s) => s.length > 0);
289
+ }
290
+ // For non-array-named fields, only convert if there are commas
291
+ if (!value.includes(',')) {
292
+ return null;
293
+ }
294
+ // For non-array-named fields, apply stricter sentence detection
295
+ // Skip if it looks like a sentence (comma followed by space and lowercase)
296
+ if (/,\s+[a-z]/.test(value)) {
297
+ return null;
298
+ }
299
+ // Skip if it contains newlines (likely formatted text)
300
+ if (value.includes('\n')) {
301
+ return null;
302
+ }
303
+ return null;
304
+ }
305
+ /**
306
+ * Convert comma-separated string values to arrays when they look like array data.
307
+ * This handles cases where the LLM generates strings like "color,size" instead
308
+ * of arrays like ["color", "size"] due to schema type misdetection.
309
+ */
310
+ function convertCommaSeparatedStringsToArrays(mockData) {
311
+ for (const [key, value] of Object.entries(mockData)) {
312
+ if (typeof value === 'string') {
313
+ const asArray = parseCommaSeparatedStringAsArray(value, key);
314
+ if (asArray !== null) {
315
+ mockData[key] = asArray;
316
+ awsLog(`CodeYam: Converted comma-separated string to array for key "${key}": "${value}" -> [${asArray.map((s) => `"${s}"`).join(', ')}]`);
317
+ }
318
+ }
319
+ else if (value !== null &&
320
+ typeof value === 'object' &&
321
+ !Array.isArray(value)) {
322
+ // Recursively process nested objects
323
+ convertCommaSeparatedStringsToArrays(value);
324
+ }
325
+ else if (Array.isArray(value)) {
326
+ // Recursively process arrays (each element could be an object)
327
+ for (const item of value) {
328
+ if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
329
+ convertCommaSeparatedStringsToArrays(item);
330
+ }
331
+ }
332
+ }
333
+ }
334
+ }
335
+ /**
336
+ * Ensure all keys from dataForMocks have corresponding data in mockData.
337
+ * For missing keys, generate default values based on the schema.
338
+ * Recursively checks nested objects to fill in any missing nested fields.
339
+ */
340
+ function fillMissingMockDataKeysWithDefaults(mockData, dataForMocks, pathPrefix = '') {
341
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
342
+ return;
343
+ }
344
+ const missingKeys = [];
345
+ for (const key of Object.keys(dataForMocks)) {
346
+ const fullPath = pathPrefix ? `${pathPrefix}.${key}` : key;
347
+ if (mockData[key] === undefined) {
348
+ missingKeys.push(fullPath);
349
+ // Generate default data based on schema
350
+ const schemaForKey = dataForMocks[key];
351
+ mockData[key] = generateDefaultForSchemaType(schemaForKey);
352
+ }
353
+ else {
354
+ // Key exists, but if both are objects, recursively check for missing nested keys
355
+ const schemaValue = dataForMocks[key];
356
+ const mockValue = mockData[key];
357
+ if (typeof schemaValue === 'object' &&
358
+ schemaValue !== null &&
359
+ !Array.isArray(schemaValue) &&
360
+ typeof mockValue === 'object' &&
361
+ mockValue !== null &&
362
+ !Array.isArray(mockValue)) {
363
+ fillMissingMockDataKeysWithDefaults(mockValue, schemaValue, fullPath);
364
+ }
365
+ }
366
+ }
367
+ if (missingKeys.length > 0) {
368
+ awsLog(`CodeYam: Generated default mock data for ${missingKeys.length} missing key(s): ${missingKeys.slice(0, 10).join(', ')}${missingKeys.length > 10 ? '...' : ''}`);
369
+ }
370
+ }
93
371
  /**
94
372
  * For Default Scenario only: detect missing mockData keys and make a follow-up
95
373
  * LLM call to fill them in. This handles cases where the LLM completes normally
@@ -144,8 +422,69 @@ async function fillMissingMockDataKeys({ structure, scenario, executionFlows, fu
144
422
  }
145
423
  }
146
424
  export async function generateDataForScenario({ entity, structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, analysis, model, }) {
425
+ var _a;
147
426
  awsLogDebugLevel(1, `Generating data for ${entity.name}: ${scenario.name}`);
148
- const prompt = generateEntityScenarioDataGenerator(structure, scenario, executionFlows, defaultScenarioData, incompleteResponse);
427
+ // Check if we should chunk the data structure for focused processing
428
+ let chunkedMockData;
429
+ const coveredFlowIds = scenario.metadata?.coveredFlows || [];
430
+ if (structure.dataForMocks &&
431
+ !incompleteResponse // Don't do chunked calls on continuation
432
+ ) {
433
+ const chunks = chunkDataStructure(structure.dataForMocks);
434
+ // If we have multiple chunks, process each one with a focused call
435
+ if (chunks.length > 1) {
436
+ awsLog(`Data structure has ${Object.keys(structure.dataForMocks).length} keys, splitting into ${chunks.length} chunks for focused processing`);
437
+ chunkedMockData = {};
438
+ for (let i = 0; i < chunks.length; i++) {
439
+ const chunk = chunks[i];
440
+ const chunkKeys = Object.keys(chunk || {});
441
+ // Get relevant requiredValues for this chunk
442
+ const relevantRequiredValues = getRequiredValuesForChunk(chunk, executionFlows || [], coveredFlowIds);
443
+ awsLog(`Processing chunk ${i + 1}/${chunks.length}: ${chunkKeys.join(', ')}`);
444
+ const chunkPrompt = generateChunkPrompt({
445
+ scenario,
446
+ chunk,
447
+ chunkIndex: i,
448
+ totalChunks: chunks.length,
449
+ relevantRequiredValues,
450
+ });
451
+ const chunkResponse = await completionCall({
452
+ type: 'generateChunkMockData',
453
+ systemMessage: generateChunkSystemMessage(scenario.name),
454
+ prompt: chunkPrompt,
455
+ model,
456
+ });
457
+ // Save chunk call to LLM log for replay support
458
+ await saveLlmCall({
459
+ object_type: 'analysis',
460
+ object_id: analysis.id,
461
+ propsJson: {
462
+ entity: { name: entity.name, filePath: entity.filePath },
463
+ scenario: { name: scenario.name },
464
+ chunkIndex: i,
465
+ totalChunks: chunks.length,
466
+ },
467
+ ...chunkResponse.stats,
468
+ });
469
+ if (chunkResponse.completion) {
470
+ const validJson = validateJson(chunkResponse.completion);
471
+ const parsed = parseJsonSafe(validJson);
472
+ if (parsed && typeof parsed === 'object' && 'mockData' in parsed) {
473
+ const chunkMockData = parsed.mockData;
474
+ if (chunkMockData && typeof chunkMockData === 'object') {
475
+ Object.assign(chunkedMockData, chunkMockData);
476
+ awsLog(`Chunk ${i + 1} generated data for: ${Object.keys(chunkMockData).join(', ')}`);
477
+ }
478
+ }
479
+ }
480
+ }
481
+ awsLog(`Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`);
482
+ }
483
+ }
484
+ // When we have chunked mock data with actual content, tell the main prompt to skip mockData generation
485
+ // Important: Check for actual keys, not just truthy object, because {} would skip generation incorrectly
486
+ const hasChunkedData = chunkedMockData && Object.keys(chunkedMockData).length > 0;
487
+ const prompt = generateEntityScenarioDataGenerator(structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, { mockDataAlreadyGenerated: hasChunkedData });
149
488
  const isDefault = scenario.name === DEFAULT_SCENARIO_NAME;
150
489
  const response = await completionCall({
151
490
  type: 'generateEntityScenarioData',
@@ -267,12 +606,36 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
267
606
  }
268
607
  }
269
608
  }
270
- if (structure.dataForMocks && !fullScenarioData.data.mockData) {
271
- fullScenarioData.data.mockData = {};
272
- for (const propKey of Object.keys(structure.arguments)) {
273
- const dataAsAny = fullScenarioData.data;
274
- fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
609
+ // Merge flat-level mock data into mockData.
610
+ // Sometimes the LLM returns some data inside data.mockData but other data at the flat
611
+ // data level (e.g., data.useRouter() instead of data.mockData.useRouter()).
612
+ // This code ensures all dataForMocks keys end up in mockData.
613
+ if (structure.dataForMocks) {
614
+ (_a = fullScenarioData.data).mockData || (_a.mockData = {});
615
+ const dataAsAny = fullScenarioData.data;
616
+ for (const propKey of Object.keys(structure.dataForMocks)) {
617
+ // Only copy if it exists at flat level and not already in mockData
618
+ if (dataAsAny[propKey] !== undefined &&
619
+ !fullScenarioData.data.mockData[propKey]) {
620
+ fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
621
+ }
622
+ }
623
+ }
624
+ // Merge chunked mock data from focused calls (takes priority over main call's data)
625
+ // This ensures keys processed with focused attention are correctly generated.
626
+ if (chunkedMockData && fullScenarioData.data.mockData) {
627
+ for (const [key, value] of Object.entries(chunkedMockData)) {
628
+ // Chunked data takes priority - overwrite main call's potentially wrong data
629
+ fullScenarioData.data.mockData[key] = value;
275
630
  }
631
+ awsLog(`Merged chunked mock data for keys: ${Object.keys(chunkedMockData).join(', ')}`);
632
+ }
633
+ // Relocate misplaced nested keys to their correct position.
634
+ // The LLM sometimes places nested keys at root level instead of inside their
635
+ // parent object (e.g., 'fastener' at root instead of inside 'trpc').
636
+ // This ensures the mockData structure matches the dataForMocks schema.
637
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
638
+ relocateMisplacedNestedKeys(fullScenarioData.data.mockData, structure.dataForMocks);
276
639
  }
277
640
  // Convert null values to undefined based on schema type constraints.
278
641
  // LLM uses null for "no value" (JSON doesn't support undefined), but TypeScript
@@ -281,6 +644,30 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
281
644
  if (structure.dataForMocks && fullScenarioData.data.mockData) {
282
645
  convertNullToUndefinedBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
283
646
  }
647
+ // Convert comma-separated strings to arrays when appropriate.
648
+ // The LLM sometimes generates strings like "color,size" instead of arrays
649
+ // like ["color", "size"] when the schema type is incorrectly inferred as
650
+ // 'string' instead of 'string[]'. This causes runtime errors when code
651
+ // calls array methods like .map() on the value.
652
+ if (fullScenarioData.data.mockData) {
653
+ convertCommaSeparatedStringsToArrays(fullScenarioData.data.mockData);
654
+ }
655
+ // Convert type annotation strings that appear as values to actual values.
656
+ // The LLM sometimes echoes the schema type annotation as the value.
657
+ // For example, if the schema says { filePath: "string | undefined" },
658
+ // the LLM might return { filePath: "string | undefined" } instead of
659
+ // generating an actual value. This converts those type strings to
660
+ // appropriate default values (e.g., "string | undefined" → undefined).
661
+ if (fullScenarioData.data.mockData) {
662
+ convertTypeAnnotationsToValues(fullScenarioData.data.mockData);
663
+ }
664
+ // Fix null values for ID fields when the schema indicates they should be non-null.
665
+ // The LLM sometimes generates `null` for ID fields (e.g., `"id": null`) when
666
+ // the schema type is `"number"`. This causes runtime issues when code checks
667
+ // `if (!data?.id)` expecting a truthy value.
668
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
669
+ fixNullIdsBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
670
+ }
284
671
  if (structure.arguments && fullScenarioData.data.argumentsData) {
285
672
  for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
286
673
  if (structure.arguments[i]) {
@@ -288,7 +675,8 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
288
675
  }
289
676
  }
290
677
  }
291
- // For Default Scenario only: check for missing keys and make follow-up call if needed
678
+ // For Default Scenario only: check for missing keys and make follow-up call if needed.
679
+ // This tries to get better-quality data via LLM before falling back to defaults.
292
680
  if (isDefault) {
293
681
  await fillMissingMockDataKeys({
294
682
  structure,
@@ -298,6 +686,21 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
298
686
  model,
299
687
  });
300
688
  }
689
+ // Fill in missing mock data keys with default values (after trying LLM follow-up).
690
+ // The LLM sometimes doesn't generate data for all keys in large schemas.
691
+ // This ensures all dataForMocks keys have corresponding data to prevent
692
+ // runtime errors like "Cannot read properties of undefined".
693
+ // Only run for Default Scenario - non-default scenarios will get missing
694
+ // data filled in from the merge with default scenario data.
695
+ if (isDefault && structure.dataForMocks && fullScenarioData.data.mockData) {
696
+ fillMissingMockDataKeysWithDefaults(fullScenarioData.data.mockData, structure.dataForMocks);
697
+ }
698
+ // Track the final scenario data for E2E debugging
699
+ trackDataSnapshot('generateDataForScenario_result', {
700
+ scenarioName: scenario.name,
701
+ mockData: fullScenarioData.data.mockData,
702
+ argumentsData: fullScenarioData.data.argumentsData,
703
+ }, entity.name, scenario.name);
301
704
  return {
302
705
  scenarioData: fullScenarioData,
303
706
  llmCall: { name: scenario.name, id: llmCall.id },
@@ -417,7 +820,8 @@ Generate COMPLETE, robust data for the entire data structure.
417
820
  : `## Non-Default Scenario
418
821
  Generate ONLY the differences from the default scenario.
419
822
  - Include only fields that need to change
420
- - Set to \`null\` to remove data
823
+ - For object/scalar fields: set to \`null\` to remove/unset the data
824
+ - For array fields: use \`[]\` for empty arrays (not \`null\`) unless the schema type explicitly includes \`| null\`
421
825
  - Omit unchanged fields—they merge from default`;
422
826
  // Only include the "NO ERROR DATA" instruction when the scenario doesn't require error data
423
827
  const noErrorDataInstruction = requiresErrorData
@@ -448,6 +852,17 @@ For example, if a flow requires:
448
852
  \`\`\`
449
853
  Then set \`isLoading: false\` in the mockData.
450
854
 
855
+ ### Array Length Requirements (length< and length>)
856
+ For array size variation flows:
857
+ - \`comparison: "length<"\` with \`value: "0"\` → generate EMPTY array \`[]\`
858
+ - \`comparison: "length<"\` with \`value: "3"\` → generate 1-2 items (few items)
859
+ - \`comparison: "length>"\` with \`value: "10"\` → generate 12+ items (many items)
860
+
861
+ ### String Length Requirements (normal vs long)
862
+ For text length variation flows:
863
+ - \`value: "normal"\` with \`valueType: "string"\` → generate normal length text (10-50 chars)
864
+ - \`value: "long"\` with \`valueType: "string"\` → generate LONG text (200+ chars) to test overflow/truncation
865
+
451
866
  ## CRITICAL: Blocking Flows to Avoid
452
867
  If the scenario includes \`blockingFlowsToAvoid\`, these are flows (like modals, overlays) that would BLOCK the expected UI.
453
868
  You MUST generate mock data that PREVENTS these flows from triggering:
@@ -488,6 +903,7 @@ Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
488
903
  - Arrays should have many items (at least 4) unless specified otherwise
489
904
  - Each item must follow the exact structure provided
490
905
  - In general we want robust data, not minimal data unless specified otherwise
906
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
491
907
 
492
908
  ## CRITICAL: Preserve Exact Structure
493
909
  Your response MUST mirror the EXACT nested structure provided in mockData Structure.
@@ -542,6 +958,8 @@ export const generateMissingKeysSystemMessage = () => `You are completing mock d
542
958
 
543
959
  Generate data ONLY for the missing keys provided in the prompt. Do not skip any of them.
544
960
 
961
+ - Scenario name must match exactly: "Default Scenario"
962
+
545
963
  ## Special Markers
546
964
 
547
965
  ### Dynamic Dates (\`~~codeyam-code~~\`)
@@ -559,6 +977,7 @@ Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
559
977
  ### Arrays
560
978
  - Arrays should have many items (at least 4) unless specified otherwise
561
979
  - Each item must follow the exact structure provided
980
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
562
981
 
563
982
  ## CRITICAL: Preserve Exact Structure
564
983
  Your response MUST mirror the EXACT nested structure provided for the missing keys.
@@ -585,4 +1004,102 @@ NEVER include "error" fields in responses. Skip them entirely.
585
1004
  - No \`undefined\`—use \`null\` or omit
586
1005
  - No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
587
1006
  `;
1007
+ /**
1008
+ * System message for focused calls to generate critical mockData keys.
1009
+ * These are keys referenced by the scenario's execution flow requiredValues.
1010
+ */
1011
+ export const generateCriticalKeysSystemMessage = (scenarioName) => `You are generating mock data for CRITICAL keys that control scenario behavior.
1012
+
1013
+ These keys are referenced by the execution flow's requiredValues - they directly determine
1014
+ what the component renders. Pay EXTRA attention to matching the exact structure and values.
1015
+
1016
+ - Scenario name must match exactly: "${scenarioName}"
1017
+
1018
+ ## CRITICAL: Special Characters in Keys
1019
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1020
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1021
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1022
+
1023
+ ## CRITICAL: Preserve Exact Structure
1024
+ Your response MUST mirror the EXACT nested structure provided.
1025
+ - Copy key strings EXACTLY as shown (including special characters)
1026
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1027
+ - Do NOT modify keys, type parameters, or add extra keys
1028
+
1029
+ ## Matching requiredValues
1030
+ When the prompt shows requiredValues like:
1031
+ - \`attributePath: "useParams().functionCallReturnValue.*"\`
1032
+ - \`value: "scenarios"\`
1033
+
1034
+ This means set the \`*\` key to include "scenarios". For URL paths split by \`/\`,
1035
+ generate a path like \`"scenarios/id/mode"\` where segments match requirements.
1036
+
1037
+ ## Response Format
1038
+ \`\`\`json
1039
+ {
1040
+ "scenarioData": {
1041
+ "scenarioName": "${scenarioName}",
1042
+ "data": {
1043
+ "mockData": {
1044
+ // generate data for ONLY the critical keys
1045
+ }
1046
+ }
1047
+ }
1048
+ }
1049
+ \`\`\`
1050
+
1051
+ ## Rules
1052
+ - Valid JSON only
1053
+ - No \`undefined\`—use \`null\` or omit
1054
+ - Match the exact schema structure provided
1055
+ `;
1056
+ /**
1057
+ * System message for focused calls to generate mock data for a chunk of keys.
1058
+ * Used when data structures are large and need to be processed in smaller pieces.
1059
+ */
1060
+ export const generateChunkSystemMessage = (scenarioName) => `You are generating mock data for a SUBSET of keys from a larger data structure.
1061
+
1062
+ This chunk contains fewer keys so you can focus on generating HIGH QUALITY data for each one.
1063
+ Pay EXTRA attention to matching the exact structure and values for each key.
1064
+
1065
+ - Scenario name must match exactly: "${scenarioName}"
1066
+
1067
+ ## CRITICAL: Special Characters in Keys
1068
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1069
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1070
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1071
+
1072
+ ## CRITICAL: Preserve Exact Structure
1073
+ Your response MUST mirror the EXACT nested structure provided.
1074
+ - Copy key strings EXACTLY as shown (including special characters)
1075
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1076
+ - Do NOT modify keys, type parameters, or add extra keys
1077
+
1078
+ ## Matching requiredValues
1079
+ If the prompt includes requiredValues, these are specific values that MUST be set:
1080
+ - For \`attributePath: "useParams().functionCallReturnValue.*"\` with \`value: "scenarios"\`
1081
+ → Set the \`*\` key to include "scenarios" (e.g., "scenarios/id/mode")
1082
+ - For URL paths, generate realistic paths that satisfy the requirements
1083
+
1084
+ ## CRITICAL: NO ERROR DATA
1085
+ NEVER include "error" fields in responses. Skip them entirely.
1086
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
1087
+ - Leave out any attribute named "error"—do not set to null, omit entirely
1088
+
1089
+ ## Response Format
1090
+ \`\`\`json
1091
+ {
1092
+ "mockData": {
1093
+ // generate data for ONLY the keys in this chunk
1094
+ }
1095
+ }
1096
+ \`\`\`
1097
+
1098
+ ## Rules
1099
+ - Valid JSON only
1100
+ - No \`undefined\`—use \`null\` or omit
1101
+ - Generate data for ALL keys in the chunk (don't skip any)
1102
+ - Arrays should have many items (at least 4) unless specified otherwise
1103
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
1104
+ `;
588
1105
  //# sourceMappingURL=generateEntityScenarioData.js.map