@codeyam/codeyam-cli 0.1.0-staging.e38f7bd → 0.1.0-staging.fef152f

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