@codeyam/codeyam-cli 0.1.0-staging.596f0eb → 0.1.0-staging.62d4615

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