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

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 (1310) 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 +36 -32
  5. package/analyzer-template/packages/ai/index.ts +21 -5
  6. package/analyzer-template/packages/ai/package.json +5 -5
  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 +239 -13
  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 +247 -66
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +2788 -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/coercePrimitivesToArraysBySchema.ts +62 -0
  32. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +163 -14
  33. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
  34. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  35. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  36. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +441 -82
  37. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  38. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  39. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -0
  40. package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
  41. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  42. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  43. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
  44. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
  45. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +63 -2
  46. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1495 -101
  47. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +216 -109
  48. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +677 -0
  49. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
  50. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -0
  51. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  52. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  53. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  54. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
  55. package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
  56. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
  57. package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
  58. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +17 -7
  59. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
  60. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
  61. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  62. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  63. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +110 -6
  64. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -53
  65. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
  66. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  67. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  68. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
  69. package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
  70. package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
  71. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +127 -3
  72. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +121 -2
  73. package/analyzer-template/packages/analyze/index.ts +2 -0
  74. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
  75. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +132 -33
  76. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  77. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  78. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  79. package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
  80. package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
  81. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  82. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  83. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  84. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  85. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  86. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  87. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +570 -180
  88. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +62 -1
  89. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +15 -0
  90. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  91. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
  92. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
  93. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
  94. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
  95. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  96. package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
  97. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +22 -13
  98. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1352 -0
  99. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +313 -0
  100. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
  101. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +711 -78
  102. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  103. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
  104. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +633 -137
  105. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +166 -0
  106. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
  107. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
  108. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1087 -168
  109. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  110. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  111. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  112. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  113. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  114. package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
  115. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
  116. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
  117. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
  118. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
  119. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
  120. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
  121. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
  122. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  123. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
  124. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
  125. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
  126. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  127. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  128. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  129. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  130. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  131. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
  132. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
  133. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
  134. package/analyzer-template/packages/aws/package.json +10 -10
  135. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  136. package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
  137. package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
  138. package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
  139. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  140. package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
  141. package/analyzer-template/packages/database/index.ts +1 -0
  142. package/analyzer-template/packages/database/package.json +4 -4
  143. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  144. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  145. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  146. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  147. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  148. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  149. package/analyzer-template/packages/database/src/lib/kysely/db.ts +26 -5
  150. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  151. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  152. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
  153. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +68 -0
  154. package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
  155. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  156. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  157. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  158. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  159. package/analyzer-template/packages/database/src/lib/loadCommits.ts +58 -19
  160. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  161. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  162. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +25 -5
  163. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  164. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  165. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  166. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +153 -144
  167. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  168. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  169. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  170. package/analyzer-template/packages/generate/index.ts +3 -0
  171. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
  172. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +221 -0
  173. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
  174. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +42 -9
  175. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  176. package/analyzer-template/packages/generate/src/lib/directExecutionScript.ts +17 -2
  177. package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
  178. package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
  179. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  180. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  181. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  182. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  183. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  184. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  185. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  186. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  187. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  188. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  189. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  190. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  191. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  192. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  193. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  194. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  195. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +6 -2
  196. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  197. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +18 -3
  198. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  199. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  200. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
  201. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  202. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  203. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  204. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  205. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  206. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +30 -7
  207. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  208. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  209. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  210. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +22 -0
  211. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  212. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
  213. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  214. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
  215. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
  216. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
  217. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
  218. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  219. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  220. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +7 -6
  221. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  222. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  223. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  224. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  225. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  226. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  227. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  228. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  229. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  230. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  231. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  232. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  233. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  234. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  235. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  236. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +45 -14
  237. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  238. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  239. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  240. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  241. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  242. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  243. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  244. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  245. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  246. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +20 -5
  247. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  248. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  249. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  250. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  251. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  252. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  253. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  254. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  255. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  256. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -88
  257. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  258. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  259. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  260. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  261. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  262. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  263. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  264. package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
  265. package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
  266. package/analyzer-template/packages/github/dist/generate/index.js +3 -0
  267. package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
  268. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
  269. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  270. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  271. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
  272. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
  273. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +217 -0
  274. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  275. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
  276. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
  277. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  278. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  279. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  280. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +41 -9
  281. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  282. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  283. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  284. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  285. package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.d.ts.map +1 -1
  286. package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js +10 -1
  287. package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js.map +1 -1
  288. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
  289. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
  290. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  291. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
  292. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
  293. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
  294. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  295. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
  296. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
  297. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
  298. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
  299. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
  300. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
  301. package/analyzer-template/packages/github/dist/types/index.d.ts +2 -2
  302. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  303. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  304. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +87 -13
  305. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  306. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  307. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  308. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
  309. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
  310. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  311. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  312. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +21 -6
  313. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  314. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
  315. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  316. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  317. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  318. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
  319. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  320. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  321. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  322. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  323. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  324. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  325. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  326. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  327. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  328. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  329. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  330. package/analyzer-template/packages/github/package.json +2 -2
  331. package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
  332. package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
  333. package/analyzer-template/packages/process/index.ts +2 -0
  334. package/analyzer-template/packages/process/package.json +12 -0
  335. package/analyzer-template/packages/process/tsconfig.json +8 -0
  336. package/analyzer-template/packages/types/index.ts +5 -0
  337. package/analyzer-template/packages/types/src/types/Analysis.ts +104 -13
  338. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  339. package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
  340. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +8 -0
  341. package/analyzer-template/packages/types/src/types/Scenario.ts +21 -10
  342. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +228 -3
  343. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  344. package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
  345. package/analyzer-template/packages/ui-components/package.json +4 -4
  346. package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
  347. package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
  348. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  349. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  350. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +87 -13
  351. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  352. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  353. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  354. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
  355. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
  356. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  357. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  358. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +21 -6
  359. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  360. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
  361. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  362. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  363. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  364. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
  365. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  366. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  367. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  368. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  369. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  370. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
  371. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  372. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  373. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  374. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  375. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  376. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  377. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  378. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  379. package/analyzer-template/packages/utils/src/lib/applyUniversalMocks.ts +28 -2
  380. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
  381. package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
  382. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  383. package/analyzer-template/playwright/capture.ts +57 -26
  384. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  385. package/analyzer-template/playwright/captureStatic.ts +1 -1
  386. package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
  387. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  388. package/analyzer-template/playwright/takeScreenshot.ts +15 -9
  389. package/analyzer-template/playwright/waitForServer.ts +21 -6
  390. package/analyzer-template/project/TESTING.md +83 -0
  391. package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
  392. package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
  393. package/analyzer-template/project/analyzeFileEntities.ts +4 -0
  394. package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
  395. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  396. package/analyzer-template/project/constructMockCode.ts +1459 -178
  397. package/analyzer-template/project/controller/startController.ts +16 -1
  398. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  399. package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
  400. package/analyzer-template/project/loadReadyToBeCaptured.ts +82 -42
  401. package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
  402. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  403. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +13 -9
  404. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +93 -42
  405. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  406. package/analyzer-template/project/orchestrateCapture.ts +92 -13
  407. package/analyzer-template/project/reconcileMockDataKeys.ts +251 -3
  408. package/analyzer-template/project/runAnalysis.ts +11 -0
  409. package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
  410. package/analyzer-template/project/serverOnlyModules.ts +413 -0
  411. package/analyzer-template/project/start.ts +75 -19
  412. package/analyzer-template/project/startScenarioCapture.ts +88 -41
  413. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  414. package/analyzer-template/project/writeMockDataTsx.ts +483 -73
  415. package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
  416. package/analyzer-template/project/writeScenarioComponents.ts +1538 -226
  417. package/analyzer-template/project/writeScenarioFiles.ts +26 -0
  418. package/analyzer-template/project/writeSimpleRoot.ts +56 -22
  419. package/analyzer-template/project/writeUniversalMocks.ts +32 -11
  420. package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
  421. package/analyzer-template/scripts/defaultCmd.sh +9 -0
  422. package/analyzer-template/tsconfig.json +14 -1
  423. package/background/src/lib/local/createLocalAnalyzer.js +2 -30
  424. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  425. package/background/src/lib/local/execAsync.js +1 -1
  426. package/background/src/lib/local/execAsync.js.map +1 -1
  427. package/background/src/lib/virtualized/common/execAsync.js +1 -1
  428. package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
  429. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +7 -1
  430. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  431. package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
  432. package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
  433. package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
  434. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  435. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +7 -1
  436. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  437. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  438. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  439. package/background/src/lib/virtualized/project/constructMockCode.js +1288 -133
  440. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  441. package/background/src/lib/virtualized/project/controller/startController.js +11 -1
  442. package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
  443. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  444. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  445. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
  446. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
  447. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +34 -9
  448. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  449. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
  450. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
  451. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  452. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  453. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +12 -6
  454. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  455. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +73 -36
  456. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  457. package/background/src/lib/virtualized/project/orchestrateCapture.js +76 -14
  458. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  459. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +211 -3
  460. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  461. package/background/src/lib/virtualized/project/runAnalysis.js +9 -0
  462. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  463. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
  464. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  465. package/background/src/lib/virtualized/project/serverOnlyModules.js +338 -0
  466. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
  467. package/background/src/lib/virtualized/project/start.js +64 -19
  468. package/background/src/lib/virtualized/project/start.js.map +1 -1
  469. package/background/src/lib/virtualized/project/startScenarioCapture.js +66 -31
  470. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  471. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  472. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  473. package/background/src/lib/virtualized/project/writeMockDataTsx.js +416 -62
  474. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  475. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
  476. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
  477. package/background/src/lib/virtualized/project/writeScenarioComponents.js +1134 -153
  478. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  479. package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
  480. package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
  481. package/background/src/lib/virtualized/project/writeSimpleRoot.js +57 -20
  482. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  483. package/background/src/lib/virtualized/project/writeUniversalMocks.js +27 -12
  484. package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
  485. package/codeyam-cli/scripts/apply-setup.js +386 -9
  486. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  487. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  488. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  489. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  490. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  491. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  492. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  493. package/codeyam-cli/src/cli.js +39 -22
  494. package/codeyam-cli/src/cli.js.map +1 -1
  495. package/codeyam-cli/src/codeyam-cli.js +18 -2
  496. package/codeyam-cli/src/codeyam-cli.js.map +1 -1
  497. package/codeyam-cli/src/commands/analyze.js +22 -10
  498. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  499. package/codeyam-cli/src/commands/baseline.js +176 -0
  500. package/codeyam-cli/src/commands/baseline.js.map +1 -0
  501. package/codeyam-cli/src/commands/debug.js +44 -18
  502. package/codeyam-cli/src/commands/debug.js.map +1 -1
  503. package/codeyam-cli/src/commands/default.js +43 -35
  504. package/codeyam-cli/src/commands/default.js.map +1 -1
  505. package/codeyam-cli/src/commands/editor.js +2607 -0
  506. package/codeyam-cli/src/commands/editor.js.map +1 -0
  507. package/codeyam-cli/src/commands/init.js +81 -260
  508. package/codeyam-cli/src/commands/init.js.map +1 -1
  509. package/codeyam-cli/src/commands/memory.js +278 -0
  510. package/codeyam-cli/src/commands/memory.js.map +1 -0
  511. package/codeyam-cli/src/commands/recapture.js +228 -0
  512. package/codeyam-cli/src/commands/recapture.js.map +1 -0
  513. package/codeyam-cli/src/commands/report.js +72 -24
  514. package/codeyam-cli/src/commands/report.js.map +1 -1
  515. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  516. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  517. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  518. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  519. package/codeyam-cli/src/commands/start.js +8 -12
  520. package/codeyam-cli/src/commands/start.js.map +1 -1
  521. package/codeyam-cli/src/commands/status.js +23 -1
  522. package/codeyam-cli/src/commands/status.js.map +1 -1
  523. package/codeyam-cli/src/commands/test-startup.js +3 -1
  524. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  525. package/codeyam-cli/src/commands/verify.js +14 -2
  526. package/codeyam-cli/src/commands/verify.js.map +1 -1
  527. package/codeyam-cli/src/commands/wipe.js +108 -0
  528. package/codeyam-cli/src/commands/wipe.js.map +1 -0
  529. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  530. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  531. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
  532. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  533. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +635 -0
  534. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  535. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  536. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  537. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +155 -0
  538. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  539. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
  540. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  541. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  542. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  543. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  544. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  545. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +393 -0
  546. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  547. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  548. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  549. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  550. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  551. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +266 -0
  552. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  553. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  554. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  555. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  556. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  557. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +221 -0
  558. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  559. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +213 -0
  560. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  561. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1686 -0
  562. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  563. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  564. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  565. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  566. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  567. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  568. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  569. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +101 -0
  570. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  571. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  572. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  573. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  574. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  575. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  576. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  577. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +246 -0
  578. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  579. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
  580. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
  581. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +174 -82
  582. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  583. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +50 -0
  584. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  585. package/codeyam-cli/src/utils/analysisRunner.js +29 -15
  586. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  587. package/codeyam-cli/src/utils/analyzer.js +7 -0
  588. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  589. package/codeyam-cli/src/utils/backgroundServer.js +122 -25
  590. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  591. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  592. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  593. package/codeyam-cli/src/utils/database.js +91 -5
  594. package/codeyam-cli/src/utils/database.js.map +1 -1
  595. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  596. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  597. package/codeyam-cli/src/utils/devServerState.js +71 -0
  598. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  599. package/codeyam-cli/src/utils/editorApi.js +73 -0
  600. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  601. package/codeyam-cli/src/utils/editorAudit.js +159 -0
  602. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  603. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  604. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  605. package/codeyam-cli/src/utils/editorDevServer.js +109 -0
  606. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  607. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  608. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  609. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  610. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  611. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  612. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  613. package/codeyam-cli/src/utils/editorLoaderHelpers.js +81 -0
  614. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  615. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  616. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  617. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  618. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  619. package/codeyam-cli/src/utils/editorPreview.js +106 -0
  620. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  621. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  622. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  623. package/codeyam-cli/src/utils/editorScenarios.js +96 -0
  624. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  625. package/codeyam-cli/src/utils/editorSeedAdapter.js +173 -0
  626. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  627. package/codeyam-cli/src/utils/entityChangeStatus.js +337 -0
  628. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  629. package/codeyam-cli/src/utils/entityChangeStatus.server.js +107 -0
  630. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  631. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  632. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  633. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  634. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  635. package/codeyam-cli/src/utils/generateReport.js +253 -106
  636. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  637. package/codeyam-cli/src/utils/git.js +182 -0
  638. package/codeyam-cli/src/utils/git.js.map +1 -0
  639. package/codeyam-cli/src/utils/install-skills.js +120 -44
  640. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  641. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  642. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  643. package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
  644. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
  645. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  646. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  647. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  648. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  649. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  650. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  651. package/codeyam-cli/src/utils/progress.js +7 -0
  652. package/codeyam-cli/src/utils/progress.js.map +1 -1
  653. package/codeyam-cli/src/utils/project.js +15 -5
  654. package/codeyam-cli/src/utils/project.js.map +1 -1
  655. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  656. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  657. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +60 -0
  658. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  659. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  660. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  661. package/codeyam-cli/src/utils/queue/job.js +319 -17
  662. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  663. package/codeyam-cli/src/utils/queue/manager.js +104 -7
  664. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  665. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  666. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  667. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  668. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  669. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  670. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +229 -0
  671. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  672. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  673. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  674. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  675. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  676. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  677. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  678. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  679. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  680. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
  681. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  682. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
  683. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  684. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +113 -0
  685. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  686. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  687. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  688. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  689. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  690. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  691. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  692. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  693. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  694. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  695. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  696. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  697. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  698. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  699. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  700. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  701. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  702. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  703. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  704. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  705. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  706. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  707. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  708. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  709. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  710. package/codeyam-cli/src/utils/rules/index.js +7 -0
  711. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  712. package/codeyam-cli/src/utils/rules/parser.js +93 -0
  713. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  714. package/codeyam-cli/src/utils/rules/pathMatcher.js +49 -0
  715. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  716. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  717. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  718. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  719. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  720. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  721. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  722. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  723. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  724. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  725. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  726. package/codeyam-cli/src/utils/scenariosManifest.js +112 -0
  727. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  728. package/codeyam-cli/src/utils/serverState.js +64 -12
  729. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  730. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +95 -45
  731. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  732. package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
  733. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  734. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  735. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  736. package/codeyam-cli/src/utils/testRunner.js +158 -0
  737. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  738. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  739. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  740. package/codeyam-cli/src/utils/versionInfo.js +67 -15
  741. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  742. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  743. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  744. package/codeyam-cli/src/utils/wipe.js +128 -0
  745. package/codeyam-cli/src/utils/wipe.js.map +1 -0
  746. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  747. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  748. package/codeyam-cli/src/webserver/app/lib/database.js +159 -33
  749. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  750. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  751. package/codeyam-cli/src/webserver/app/lib/git.js +396 -0
  752. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  753. package/codeyam-cli/src/webserver/backgroundServer.js +171 -26
  754. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  755. package/codeyam-cli/src/webserver/bootstrap.js +60 -0
  756. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
  757. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-DmJveP3T.js +1 -0
  758. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-C76mRRiF.js +11 -0
  759. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-kykTbcnD.js → EntityTypeBadge-g3saevPb.js} +1 -1
  760. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CobE682z.js +41 -0
  761. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  762. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +25 -0
  763. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +3 -0
  764. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-BU_OAEMP.js +6 -0
  765. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-ceAyBX-H.js +3 -0
  766. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-djPLI-WV.js +11 -0
  767. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +1 -0
  768. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-ZlRKbhrq.js +10 -0
  769. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  770. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-C06nsHKY.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  771. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
  772. package/codeyam-cli/src/webserver/build/client/assets/_index-C96V0n15.js +11 -0
  773. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BpKzcsJz.js +27 -0
  774. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  775. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  776. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  777. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  778. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
  779. package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
  780. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  781. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  782. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  783. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  784. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  785. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  786. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  787. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  788. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  789. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  790. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  791. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  792. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  793. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  794. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  795. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  796. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  797. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  798. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  799. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  800. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  801. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  802. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  803. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  804. package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
  805. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  806. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  807. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  808. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  809. package/codeyam-cli/src/webserver/build/client/assets/book-open-D_nMCFmP.js +6 -0
  810. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BH2h1Ea2.js +6 -0
  811. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-C4pqxYJB.js +51 -0
  812. package/codeyam-cli/src/webserver/build/client/assets/circle-check-DyIKORY6.js +6 -0
  813. package/codeyam-cli/src/webserver/build/client/assets/copy-NDbZjXao.js +11 -0
  814. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CMT1jU2q.js +21 -0
  815. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
  816. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
  817. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CltMNppm.js +1 -0
  818. package/codeyam-cli/src/webserver/build/client/assets/editor-DTEBHY7Z.js +10 -0
  819. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +41 -0
  820. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CYqBrC9s.js → entity._sha._-DItJnD8s.js} +22 -15
  821. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.js +6 -0
  822. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +6 -0
  823. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  824. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BMvVHNXU.js +5 -0
  825. package/codeyam-cli/src/webserver/build/client/assets/entry.client-DTvKq3TY.js +29 -0
  826. package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
  827. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +1 -0
  828. package/codeyam-cli/src/webserver/build/client/assets/files-DO4CZ16O.js +1 -0
  829. package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +1 -0
  830. package/codeyam-cli/src/webserver/build/client/assets/globals-JMY99HpD.css +1 -0
  831. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  832. package/codeyam-cli/src/webserver/build/client/assets/index-10oVnAAH.js +9 -0
  833. package/codeyam-cli/src/webserver/build/client/assets/index-BcvgDzbZ.js +3 -0
  834. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  835. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  836. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-BAXYRVEO.js +6 -0
  837. package/codeyam-cli/src/webserver/build/client/assets/manifest-7aab51c4.js +1 -0
  838. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
  839. package/codeyam-cli/src/webserver/build/client/assets/pause-DTAcYxBt.js +11 -0
  840. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  841. package/codeyam-cli/src/webserver/build/client/assets/root-FRztnN-P.js +67 -0
  842. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  843. package/codeyam-cli/src/webserver/build/client/assets/search-fKo7v0Zo.js +6 -0
  844. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
  845. package/codeyam-cli/src/webserver/build/client/assets/simulations-B3aOzpCZ.js +1 -0
  846. package/codeyam-cli/src/webserver/build/client/assets/terminal-BG4heKCG.js +11 -0
  847. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-DtSmdtM4.js +6 -0
  848. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +1 -0
  849. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  850. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +1 -0
  851. package/codeyam-cli/src/webserver/build/client/assets/{useToast-Bbf4Hokd.js → useToast-9FIWuYfK.js} +1 -1
  852. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  853. package/codeyam-cli/src/webserver/build/server/assets/index-Cz751Dm2.js +1 -0
  854. package/codeyam-cli/src/webserver/build/server/assets/server-build-DSylnYVM.js +367 -0
  855. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  856. package/codeyam-cli/src/webserver/build-info.json +5 -5
  857. package/codeyam-cli/src/webserver/devServer.js +40 -8
  858. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  859. package/codeyam-cli/src/webserver/editorProxy.js +431 -0
  860. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  861. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  862. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
  863. package/codeyam-cli/src/webserver/server.js +293 -26
  864. package/codeyam-cli/src/webserver/server.js.map +1 -1
  865. package/codeyam-cli/src/webserver/terminalServer.js +706 -0
  866. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  867. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  868. package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
  869. package/codeyam-cli/templates/commands/codeyam-diagnose.md +481 -0
  870. package/codeyam-cli/templates/editor-step-hook.py +208 -0
  871. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  872. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  873. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  874. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  875. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  876. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  877. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  878. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  879. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  880. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  881. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  882. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  883. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  884. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  885. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  886. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
  887. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  888. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +38 -0
  889. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  890. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  891. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  892. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  893. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +89 -0
  894. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  895. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  896. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  897. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  898. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  899. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  900. package/codeyam-cli/templates/rule-notification-hook.py +83 -0
  901. package/codeyam-cli/templates/rule-reflection-hook.py +647 -0
  902. package/codeyam-cli/templates/rules-instructions.md +78 -0
  903. package/codeyam-cli/templates/{codeyam-debug-skill.md → skills/codeyam-debug/SKILL.md} +48 -4
  904. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  905. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +136 -0
  906. package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +611 -0
  907. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  908. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  909. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  910. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  911. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  912. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  913. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  914. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  915. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  916. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  917. package/codeyam-cli/templates/skills/codeyam-new-rule/SKILL.md +11 -0
  918. package/codeyam-cli/templates/{codeyam-setup-skill.md → skills/codeyam-setup/SKILL.md} +151 -4
  919. package/codeyam-cli/templates/{codeyam-sim-skill.md → skills/codeyam-sim/SKILL.md} +1 -1
  920. package/codeyam-cli/templates/{codeyam-test-skill.md → skills/codeyam-test/SKILL.md} +1 -1
  921. package/codeyam-cli/templates/{codeyam-verify-skill.md → skills/codeyam-verify/SKILL.md} +1 -1
  922. package/package.json +39 -29
  923. package/packages/ai/index.js +8 -6
  924. package/packages/ai/index.js.map +1 -1
  925. package/packages/ai/src/lib/analyzeScope.js +181 -13
  926. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  927. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  928. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  929. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +176 -13
  930. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  931. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
  932. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
  933. package/packages/ai/src/lib/astScopes/methodSemantics.js +138 -23
  934. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  935. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  936. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  937. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
  938. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
  939. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +23 -0
  940. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  941. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
  942. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  943. package/packages/ai/src/lib/astScopes/processExpression.js +1235 -104
  944. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  945. package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
  946. package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
  947. package/packages/ai/src/lib/checkAllAttributes.js +24 -9
  948. package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
  949. package/packages/ai/src/lib/completionCall.js +188 -38
  950. package/packages/ai/src/lib/completionCall.js.map +1 -1
  951. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +2192 -224
  952. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  953. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +19 -4
  954. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  955. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +661 -0
  956. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  957. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +180 -56
  958. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  959. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  960. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  961. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  962. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  963. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +66 -2
  964. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  965. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +139 -13
  966. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  967. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  968. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  969. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  970. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  971. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +142 -12
  972. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  973. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  974. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  975. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  976. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  977. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  978. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  979. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +371 -73
  980. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  981. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  982. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  983. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  984. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  985. package/packages/ai/src/lib/dataStructureChunking.js +130 -0
  986. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  987. package/packages/ai/src/lib/deepEqual.js +32 -0
  988. package/packages/ai/src/lib/deepEqual.js.map +1 -0
  989. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  990. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  991. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  992. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  993. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
  994. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  995. package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
  996. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  997. package/packages/ai/src/lib/generateEntityDataStructure.js +50 -1
  998. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  999. package/packages/ai/src/lib/generateEntityScenarioData.js +1182 -91
  1000. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  1001. package/packages/ai/src/lib/generateEntityScenarios.js +193 -83
  1002. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  1003. package/packages/ai/src/lib/generateExecutionFlows.js +484 -0
  1004. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
  1005. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
  1006. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
  1007. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1807 -0
  1008. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
  1009. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  1010. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  1011. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  1012. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  1013. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  1014. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  1015. package/packages/ai/src/lib/isolateScopes.js +270 -7
  1016. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  1017. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
  1018. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
  1019. package/packages/ai/src/lib/mergeStatements.js +88 -46
  1020. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  1021. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
  1022. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
  1023. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +16 -4
  1024. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  1025. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
  1026. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
  1027. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -64
  1028. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  1029. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  1030. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  1031. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +83 -6
  1032. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  1033. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -34
  1034. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  1035. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
  1036. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
  1037. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  1038. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  1039. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  1040. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  1041. package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
  1042. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
  1043. package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
  1044. package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
  1045. package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
  1046. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  1047. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +98 -1
  1048. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  1049. package/packages/analyze/index.js +1 -0
  1050. package/packages/analyze/index.js.map +1 -1
  1051. package/packages/analyze/src/lib/FileAnalyzer.js +75 -36
  1052. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  1053. package/packages/analyze/src/lib/ProjectAnalyzer.js +109 -30
  1054. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  1055. package/packages/analyze/src/lib/analysisContext.js +30 -5
  1056. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  1057. package/packages/analyze/src/lib/asts/index.js +4 -2
  1058. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  1059. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  1060. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  1061. package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
  1062. package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
  1063. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
  1064. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
  1065. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  1066. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  1067. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  1068. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  1069. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  1070. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  1071. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  1072. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  1073. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  1074. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  1075. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  1076. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  1077. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +428 -123
  1078. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  1079. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +49 -1
  1080. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  1081. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +11 -0
  1082. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  1083. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  1084. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  1085. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
  1086. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  1087. package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
  1088. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  1089. package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
  1090. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  1091. package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
  1092. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  1093. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  1094. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  1095. package/packages/analyze/src/lib/files/enums/steps.js +1 -1
  1096. package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
  1097. package/packages/analyze/src/lib/files/getImportedExports.js +17 -8
  1098. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  1099. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +907 -0
  1100. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  1101. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +255 -0
  1102. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  1103. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
  1104. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
  1105. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +550 -62
  1106. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  1107. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  1108. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  1109. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
  1110. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  1111. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +469 -85
  1112. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  1113. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +104 -0
  1114. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
  1115. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
  1116. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  1117. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
  1118. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  1119. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +891 -143
  1120. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  1121. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  1122. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  1123. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  1124. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  1125. package/packages/analyze/src/lib/index.js +1 -0
  1126. package/packages/analyze/src/lib/index.js.map +1 -1
  1127. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  1128. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  1129. package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
  1130. package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  1131. package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
  1132. package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  1133. package/packages/database/index.js +1 -0
  1134. package/packages/database/index.js.map +1 -1
  1135. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  1136. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  1137. package/packages/database/src/lib/analysisToDb.js +1 -1
  1138. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  1139. package/packages/database/src/lib/branchToDb.js +1 -1
  1140. package/packages/database/src/lib/branchToDb.js.map +1 -1
  1141. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  1142. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  1143. package/packages/database/src/lib/commitToDb.js +1 -1
  1144. package/packages/database/src/lib/commitToDb.js.map +1 -1
  1145. package/packages/database/src/lib/fileToDb.js +1 -1
  1146. package/packages/database/src/lib/fileToDb.js.map +1 -1
  1147. package/packages/database/src/lib/kysely/db.js +18 -3
  1148. package/packages/database/src/lib/kysely/db.js.map +1 -1
  1149. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  1150. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  1151. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  1152. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  1153. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
  1154. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  1155. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  1156. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  1157. package/packages/database/src/lib/loadAnalyses.js +45 -2
  1158. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  1159. package/packages/database/src/lib/loadAnalysis.js +8 -0
  1160. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  1161. package/packages/database/src/lib/loadBranch.js +11 -1
  1162. package/packages/database/src/lib/loadBranch.js.map +1 -1
  1163. package/packages/database/src/lib/loadCommit.js +7 -0
  1164. package/packages/database/src/lib/loadCommit.js.map +1 -1
  1165. package/packages/database/src/lib/loadCommits.js +45 -14
  1166. package/packages/database/src/lib/loadCommits.js.map +1 -1
  1167. package/packages/database/src/lib/loadEntities.js +23 -4
  1168. package/packages/database/src/lib/loadEntities.js.map +1 -1
  1169. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  1170. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  1171. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +20 -5
  1172. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  1173. package/packages/database/src/lib/projectToDb.js +1 -1
  1174. package/packages/database/src/lib/projectToDb.js.map +1 -1
  1175. package/packages/database/src/lib/saveFiles.js +1 -1
  1176. package/packages/database/src/lib/saveFiles.js.map +1 -1
  1177. package/packages/database/src/lib/scenarioToDb.js +1 -1
  1178. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  1179. package/packages/database/src/lib/updateCommitMetadata.js +100 -88
  1180. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  1181. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  1182. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  1183. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  1184. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  1185. package/packages/generate/index.js +3 -0
  1186. package/packages/generate/index.js.map +1 -1
  1187. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  1188. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  1189. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +217 -0
  1190. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  1191. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  1192. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  1193. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +41 -9
  1194. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  1195. package/packages/generate/src/lib/deepMerge.js +27 -1
  1196. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  1197. package/packages/generate/src/lib/directExecutionScript.js +10 -1
  1198. package/packages/generate/src/lib/directExecutionScript.js.map +1 -1
  1199. package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
  1200. package/packages/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  1201. package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
  1202. package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  1203. package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
  1204. package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
  1205. package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
  1206. package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
  1207. package/packages/process/index.js +3 -0
  1208. package/packages/process/index.js.map +1 -0
  1209. package/packages/process/src/GlobalProcessManager.js.map +1 -0
  1210. package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
  1211. package/packages/process/src/ProcessManager.js.map +1 -0
  1212. package/packages/process/src/index.js.map +1 -0
  1213. package/packages/process/src/managedExecAsync.js.map +1 -0
  1214. package/packages/types/index.js.map +1 -1
  1215. package/packages/utils/src/lib/applyUniversalMocks.js +26 -2
  1216. package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
  1217. package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
  1218. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  1219. package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
  1220. package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  1221. package/packages/utils/src/lib/safeFileName.js +29 -3
  1222. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  1223. package/scripts/npm-post-install.cjs +34 -0
  1224. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
  1225. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
  1226. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
  1227. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
  1228. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
  1229. package/analyzer-template/packages/ai/src/lib/transformMockDataToMatchSchema.ts +0 -156
  1230. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
  1231. package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
  1232. package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
  1233. package/analyzer-template/process/README.md +0 -507
  1234. package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
  1235. package/background/src/lib/process/ProcessManager.js.map +0 -1
  1236. package/background/src/lib/process/index.js.map +0 -1
  1237. package/background/src/lib/process/managedExecAsync.js.map +0 -1
  1238. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  1239. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  1240. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
  1241. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  1242. package/codeyam-cli/src/commands/list.js +0 -31
  1243. package/codeyam-cli/src/commands/list.js.map +0 -1
  1244. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  1245. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  1246. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  1247. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  1248. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-D4htqD-x.js +0 -1
  1249. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Catz6XEN.js +0 -1
  1250. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-TlHocYno.js +0 -26
  1251. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CVMmGuIc.js +0 -3
  1252. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-JkfQ-VaI.js +0 -3
  1253. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-CVZ0H4BL.js +0 -1
  1254. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BrMAP1nP.js +0 -1
  1255. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CJhE4cCv.js +0 -5
  1256. package/codeyam-cli/src/webserver/build/client/assets/_index-faVIcr_i.js +0 -1
  1257. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLMa2sgx.js +0 -7
  1258. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DwYjrK_h.js +0 -1
  1259. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CgXbbZRx.js +0 -26
  1260. package/codeyam-cli/src/webserver/build/client/assets/circle-check-B2oHQ-zo.js +0 -1
  1261. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BBYuR56H.js +0 -1
  1262. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CT0Q5lVu.js +0 -1
  1263. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-Bj5GHkhb.js +0 -1
  1264. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-eW5z9AyZ.js +0 -5
  1265. package/codeyam-cli/src/webserver/build/client/assets/entry.client-B9tSboXM.js +0 -5
  1266. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-CmO-EZAB.js +0 -1
  1267. package/codeyam-cli/src/webserver/build/client/assets/files-DLinnTOx.js +0 -1
  1268. package/codeyam-cli/src/webserver/build/client/assets/git-CIxwBQvb.js +0 -12
  1269. package/codeyam-cli/src/webserver/build/client/assets/globals-xPz593l2.css +0 -1
  1270. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  1271. package/codeyam-cli/src/webserver/build/client/assets/index-_LjBsTxX.js +0 -8
  1272. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-D_EGChhq.js +0 -1
  1273. package/codeyam-cli/src/webserver/build/client/assets/manifest-ca438c41.js +0 -1
  1274. package/codeyam-cli/src/webserver/build/client/assets/root-CHHYHuzL.js +0 -16
  1275. package/codeyam-cli/src/webserver/build/client/assets/search-DY8yoDpH.js +0 -1
  1276. package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
  1277. package/codeyam-cli/src/webserver/build/client/assets/settings-BT6wVHd5.js +0 -1
  1278. package/codeyam-cli/src/webserver/build/client/assets/simulations-gv3H7JV7.js +0 -1
  1279. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BthANBVv.js +0 -1
  1280. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-Blr5oZDE.js +0 -2
  1281. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CANr3QJ5.js +0 -1
  1282. package/codeyam-cli/src/webserver/build/server/assets/index-BtBPtyHx.js +0 -1
  1283. package/codeyam-cli/src/webserver/build/server/assets/server-build-N2cTnejq.js +0 -166
  1284. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  1285. package/codeyam-cli/templates/debug-command.md +0 -141
  1286. package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
  1287. package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
  1288. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -136
  1289. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
  1290. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
  1291. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
  1292. package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
  1293. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
  1294. package/packages/ai/src/lib/isFrontend.js +0 -5
  1295. package/packages/ai/src/lib/isFrontend.js.map +0 -1
  1296. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
  1297. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
  1298. package/packages/ai/src/lib/transformMockDataToMatchSchema.js +0 -124
  1299. package/packages/ai/src/lib/transformMockDataToMatchSchema.js.map +0 -1
  1300. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -72
  1301. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
  1302. package/scripts/finalize-analyzer.cjs +0 -79
  1303. /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
  1304. /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
  1305. /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
  1306. /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
  1307. /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
  1308. /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
  1309. /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
  1310. /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
@@ -1,9 +1,13 @@
1
1
  import completionCall from './completionCall';
2
2
  import generateEntityScenarioDataGenerator from './promptGenerators/generateEntityScenarioDataGenerator';
3
+ import generateMissingKeysPrompt from './promptGenerators/generateMissingKeysPrompt';
4
+ import generateChunkPrompt from './promptGenerators/generateChunkPrompt';
3
5
  import { saveLlmCall } from '~codeyam/aws/dynamodb';
6
+ import { trackDataSnapshot } from './e2eDataTracking';
4
7
  import type {
5
8
  Analysis,
6
9
  Entity,
10
+ ExecutionFlow,
7
11
  Scenario,
8
12
  ScenarioData,
9
13
  ScenariosDataStructure,
@@ -11,16 +15,702 @@ import type {
11
15
  import validateJson from './validateJson';
12
16
  import { awsLog, awsLogDebugLevel } from '~codeyam/utils';
13
17
  import { AI, parseJsonSafe } from '~codeyam/ai';
14
- import transformMockDataToMatchSchema from './transformMockDataToMatchSchema';
18
+ import convertNullToUndefinedBySchema from './dataStructure/helpers/convertNullToUndefinedBySchema';
19
+ import convertTypeAnnotationsToValues from './dataStructure/helpers/convertTypeAnnotationsToValues';
20
+ import fixNullIdsBySchema from './dataStructure/helpers/fixNullIdsBySchema';
21
+ import coerceObjectsToPrimitivesBySchema from './dataStructure/helpers/coerceObjectsToPrimitivesBySchema';
22
+ import coercePrimitivesToArraysBySchema from './dataStructure/helpers/coercePrimitivesToArraysBySchema';
23
+ import stripNullableMarkers from './dataStructure/helpers/stripNullableMarkers';
24
+ import { JsonTypeDefinition } from '~codeyam/types';
25
+ import { deepMerge } from '~codeyam/generate';
26
+ import {
27
+ chunkDataStructure,
28
+ getRequiredValuesForChunk,
29
+ } from './dataStructureChunking';
30
+
31
+ /**
32
+ * Check if any of the scenario's covered flows require error data.
33
+ * Returns true if any requiredValue has an error path with truthy comparison.
34
+ */
35
+ function scenarioRequiresErrorData(
36
+ scenario: Scenario,
37
+ executionFlows: ExecutionFlow[] | undefined,
38
+ ): boolean {
39
+ const coveredFlowIds = scenario.metadata?.coveredFlows || [];
40
+ for (const flowId of coveredFlowIds) {
41
+ const flow = executionFlows?.find((f) => f.id === flowId);
42
+ if (!flow?.requiredValues) continue;
43
+ for (const rv of flow.requiredValues) {
44
+ // Check if any requiredValue has an error path and requires it to be truthy
45
+ if (
46
+ rv.attributePath?.toLowerCase().includes('.error') &&
47
+ rv.comparison === 'truthy'
48
+ ) {
49
+ return true;
50
+ }
51
+ }
52
+ }
53
+ return false;
54
+ }
55
+
56
+ /**
57
+ * Deep merge scenario data with default scenario data.
58
+ * The scenario-specific data takes precedence, with default filling in missing fields.
59
+ *
60
+ * IMPORTANT: null values are PRESERVED (not removed) in the result.
61
+ * This is critical because writeMockDataTsx.ts does another deepMerge with default data,
62
+ * and it needs null values to prevent defaults from being filled back in.
63
+ * If we removed null here, the second merge would restore the defaults,
64
+ * making scenarios identical to the default scenario.
65
+ */
66
+ function deepMergeScenarioData(
67
+ defaultData: Record<string, any>,
68
+ scenarioData: Record<string, any>,
69
+ ): Record<string, any> {
70
+ // Guard against non-object inputs (LLM sometimes returns primitives)
71
+ if (
72
+ typeof scenarioData !== 'object' ||
73
+ scenarioData === null ||
74
+ Array.isArray(scenarioData)
75
+ ) {
76
+ // Return scenario value directly if it's not a mergeable object
77
+ return scenarioData;
78
+ }
79
+ if (
80
+ typeof defaultData !== 'object' ||
81
+ defaultData === null ||
82
+ Array.isArray(defaultData)
83
+ ) {
84
+ // Return scenario value if default isn't mergeable
85
+ return scenarioData;
86
+ }
87
+
88
+ const result: Record<string, any> = {};
89
+
90
+ // Start with all keys from default
91
+ for (const key of Object.keys(defaultData)) {
92
+ if (key in scenarioData) {
93
+ const scenarioValue = scenarioData[key];
94
+ const defaultValue = defaultData[key];
95
+
96
+ // null means explicitly override with null (falsy value)
97
+ // IMPORTANT: We preserve null instead of removing the key
98
+ // This ensures writeMockDataTsx's deepMerge won't fill in defaults
99
+ if (scenarioValue === null) {
100
+ result[key] = null;
101
+ continue;
102
+ }
103
+
104
+ // Deep merge objects (but not arrays)
105
+ if (
106
+ typeof scenarioValue === 'object' &&
107
+ !Array.isArray(scenarioValue) &&
108
+ typeof defaultValue === 'object' &&
109
+ !Array.isArray(defaultValue) &&
110
+ defaultValue !== null
111
+ ) {
112
+ result[key] = deepMergeScenarioData(defaultValue, scenarioValue);
113
+ } else {
114
+ // Use scenario value (overrides default)
115
+ result[key] = scenarioValue;
116
+ }
117
+ } else {
118
+ // Key not in scenario, use default
119
+ result[key] = defaultData[key];
120
+ }
121
+ }
122
+
123
+ // Add any keys that are only in scenario data (including null values)
124
+ for (const key of Object.keys(scenarioData)) {
125
+ if (!(key in defaultData)) {
126
+ result[key] = scenarioData[key];
127
+ }
128
+ }
129
+
130
+ return result;
131
+ }
15
132
 
16
133
  const DEFAULT_SCENARIO_NAME = 'Default Scenario';
17
134
 
135
+ /**
136
+ * Find the path to a key within a nested dataForMocks structure.
137
+ * Returns the path as an array of keys, or null if not found.
138
+ *
139
+ * @example
140
+ * // dataForMocks = { trpc: { fastener: { "useMutation()": { isLoading: "boolean" } } } }
141
+ * // findKeyPath("fastener", dataForMocks) returns ["trpc"]
142
+ */
143
+ function findKeyPath(
144
+ targetKey: string,
145
+ obj: JsonTypeDefinition,
146
+ currentPath: string[] = [],
147
+ ): string[] | null {
148
+ if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
149
+ return null;
150
+ }
151
+
152
+ for (const key of Object.keys(obj)) {
153
+ if (key === targetKey) {
154
+ return currentPath;
155
+ }
156
+
157
+ // Recursively search in nested objects
158
+ const nested = obj[key];
159
+ if (
160
+ typeof nested === 'object' &&
161
+ nested !== null &&
162
+ !Array.isArray(nested)
163
+ ) {
164
+ const result = findKeyPath(targetKey, nested as JsonTypeDefinition, [
165
+ ...currentPath,
166
+ key,
167
+ ]);
168
+ if (result !== null) {
169
+ return result;
170
+ }
171
+ }
172
+ }
173
+
174
+ return null;
175
+ }
176
+
177
+ /**
178
+ * Strip primitive values from `source` when the `destination` already has an
179
+ * array or object at the same key. Returns a cleaned copy of source (or null
180
+ * if nothing remains after stripping).
181
+ *
182
+ * This prevents misplaced LLM data (e.g., `{ webapps: true }`) from
183
+ * overwriting correct complex values (e.g., `{ webapps: [...] }`) during
184
+ * deep merge in relocateMisplacedNestedKeys.
185
+ */
186
+ function stripPrimitivesOverwritingComplexValues(
187
+ destination: Record<string, unknown>,
188
+ source: unknown,
189
+ ): Record<string, unknown> | null {
190
+ if (typeof source !== 'object' || source === null || Array.isArray(source)) {
191
+ return null;
192
+ }
193
+
194
+ const result: Record<string, unknown> = {};
195
+ let hasKeys = false;
196
+
197
+ for (const key of Object.keys(source as Record<string, unknown>)) {
198
+ const srcVal = (source as Record<string, unknown>)[key];
199
+ const dstVal = destination[key];
200
+
201
+ // If destination has an array or object but source has a primitive, skip it
202
+ if (
203
+ typeof dstVal === 'object' &&
204
+ dstVal !== null &&
205
+ typeof srcVal !== 'object'
206
+ ) {
207
+ continue;
208
+ }
209
+
210
+ result[key] = srcVal;
211
+ hasKeys = true;
212
+ }
213
+
214
+ return hasKeys ? result : null;
215
+ }
216
+
217
+ /**
218
+ * Relocate misplaced nested keys in mockData to their correct position
219
+ * based on the dataForMocks structure.
220
+ *
221
+ * When the LLM returns mockData with keys at the wrong nesting level
222
+ * (e.g., { trpc: { quote: {...} }, fastener: {...} } when fastener should
223
+ * be inside trpc), this function moves them to the correct position.
224
+ *
225
+ * This function works recursively to handle nested misplacements, not just
226
+ * root-level ones. For example, if getQuote is at trpc.getQuote instead of
227
+ * trpc.quote.getQuote, it will be relocated.
228
+ *
229
+ * @example
230
+ * // dataForMocks: { trpc: { quote: {...}, fastener: {...} } }
231
+ * // mockData: { trpc: { quote: {...} }, fastener: {...} }
232
+ * // After: mockData: { trpc: { quote: {...}, fastener: {...} } }
233
+ *
234
+ * @example (nested case)
235
+ * // dataForMocks: { trpc: { quote: { getQuote: {...} } } }
236
+ * // mockData: { trpc: { quote: {...}, getQuote: {...} } }
237
+ * // After: mockData: { trpc: { quote: { getQuote: {...} } } }
238
+ */
239
+ function relocateMisplacedNestedKeys(
240
+ mockData: Record<string, unknown>,
241
+ dataForMocks: JsonTypeDefinition,
242
+ currentPathForLogging: string[] = [],
243
+ ): void {
244
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
245
+ return;
246
+ }
247
+
248
+ const keysInSchema = Object.keys(dataForMocks);
249
+ const keysToRelocate: { key: string; path: string[] }[] = [];
250
+
251
+ // Find keys in mockData that are NOT at this level in dataForMocks
252
+ // but DO exist somewhere nested in dataForMocks
253
+ for (const key of Object.keys(mockData)) {
254
+ if (!keysInSchema.includes(key)) {
255
+ // This key is at this level in mockData but not at this level in dataForMocks
256
+ // Check if it exists somewhere nested in dataForMocks
257
+ const path = findKeyPath(key, dataForMocks);
258
+ if (path !== null && path.length > 0) {
259
+ keysToRelocate.push({ key, path });
260
+ }
261
+ }
262
+ }
263
+
264
+ // Relocate each misplaced key to its correct nested position
265
+ for (const { key, path } of keysToRelocate) {
266
+ const value = mockData[key];
267
+
268
+ // Navigate to the correct parent in mockData, creating nested objects if needed
269
+ let current: Record<string, unknown> = mockData;
270
+ for (const pathKey of path) {
271
+ if (current[pathKey] === undefined) {
272
+ current[pathKey] = {};
273
+ }
274
+ current = current[pathKey] as Record<string, unknown>;
275
+ }
276
+
277
+ // Deep merge the value into the correct location
278
+ // Use deep merge to preserve existing data at that location.
279
+ // Before merging, strip primitives from the misplaced value that would
280
+ // overwrite arrays/objects at the destination. The misplaced data is lower
281
+ // quality — the LLM put it in the wrong place — so primitives like `true`
282
+ // should not overwrite correct complex values like arrays.
283
+ if (current[key] !== undefined && typeof current[key] === 'object') {
284
+ const safeValue = stripPrimitivesOverwritingComplexValues(
285
+ current[key] as Record<string, unknown>,
286
+ value as Record<string, unknown>,
287
+ );
288
+ if (safeValue !== null) {
289
+ current[key] = deepMerge(
290
+ current[key] as Record<string, unknown>,
291
+ safeValue,
292
+ );
293
+ }
294
+ } else {
295
+ current[key] = value;
296
+ }
297
+
298
+ // Remove the key from its current (wrong) level
299
+ delete mockData[key];
300
+
301
+ const fullPath = [...currentPathForLogging, ...path].join('.');
302
+ awsLog(
303
+ `CodeYam: Relocated misplaced key "${key}" from [${currentPathForLogging.join('.')}] to [${fullPath}]`,
304
+ );
305
+ }
306
+
307
+ // Recursively process nested objects to handle deeply nested misplacements
308
+ for (const key of Object.keys(mockData)) {
309
+ const mockValue = mockData[key];
310
+ const schemaValue = dataForMocks[key];
311
+
312
+ // Only recurse if both mockData and schema have nested objects at this key
313
+ if (
314
+ typeof mockValue === 'object' &&
315
+ mockValue !== null &&
316
+ !Array.isArray(mockValue) &&
317
+ typeof schemaValue === 'object' &&
318
+ schemaValue !== null &&
319
+ !Array.isArray(schemaValue)
320
+ ) {
321
+ relocateMisplacedNestedKeys(
322
+ mockValue as Record<string, unknown>,
323
+ schemaValue as JsonTypeDefinition,
324
+ [...currentPathForLogging, key],
325
+ );
326
+ }
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Generate default mock data for a schema type.
332
+ * Returns reasonable default values based on the schema type string.
333
+ */
334
+ function generateDefaultForSchemaType(schemaType: unknown): unknown {
335
+ if (typeof schemaType === 'string') {
336
+ // Handle common type strings
337
+ if (schemaType === 'function') return () => {};
338
+ if (schemaType === 'promise') return Promise.resolve();
339
+ if (schemaType === 'boolean') return false;
340
+ if (schemaType === 'string') return '';
341
+ if (schemaType === 'number') return 0;
342
+ if (schemaType.includes('number | undefined')) return undefined;
343
+ if (schemaType.includes('string | undefined')) return undefined;
344
+ if (schemaType.includes('boolean | undefined')) return undefined;
345
+ if (schemaType.includes('| undefined')) return undefined;
346
+ if (schemaType.includes('| null')) return null;
347
+ return schemaType; // Return the type as a string placeholder
348
+ }
349
+ if (Array.isArray(schemaType)) {
350
+ if (schemaType.length === 0) return [];
351
+ // Generate a single default element based on the first element's schema
352
+ const elementDefault = generateDefaultForSchemaType(schemaType[0]);
353
+ return elementDefault !== undefined ? [elementDefault] : [];
354
+ }
355
+ if (typeof schemaType === 'object' && schemaType !== null) {
356
+ // Recursively generate defaults for nested objects
357
+ const result: Record<string, unknown> = {};
358
+ for (const [key, value] of Object.entries(schemaType)) {
359
+ result[key] = generateDefaultForSchemaType(value);
360
+ }
361
+ return result;
362
+ }
363
+ return undefined;
364
+ }
365
+
366
+ /**
367
+ * Detect if a string should be converted to an array.
368
+ * Returns the array if the field appears to be an array field, or null if it should remain a string.
369
+ *
370
+ * This handles two cases:
371
+ * 1. Comma-separated values: "color,size" -> ["color", "size"]
372
+ * 2. Single values for array-named fields: "Finish" -> ["Finish"]
373
+ */
374
+ function parseCommaSeparatedStringAsArray(
375
+ value: string,
376
+ key: string,
377
+ ): string[] | null {
378
+ // Heuristic: if the key name suggests it's an array field, convert it
379
+ // Common patterns: *_attributes, *_ids, *_items, *_tags, *_values, plural names
380
+ // Check this FIRST because array-named fields should be converted regardless
381
+ // of whether they contain commas (single values become single-element arrays).
382
+ const arrayFieldPatterns = [
383
+ /_attributes$/i,
384
+ /_ids$/i,
385
+ /_items$/i,
386
+ /_tags$/i,
387
+ /_values$/i,
388
+ /_types$/i,
389
+ /_names$/i,
390
+ /_keys$/i,
391
+ /^attributes$/i,
392
+ /^items$/i,
393
+ /^tags$/i,
394
+ /^values$/i,
395
+ ];
396
+
397
+ const looksLikeArrayField = arrayFieldPatterns.some((pattern) =>
398
+ pattern.test(key),
399
+ );
400
+
401
+ if (looksLikeArrayField) {
402
+ // Skip newlines check - multiline values shouldn't be split
403
+ if (value.includes('\n')) {
404
+ return null;
405
+ }
406
+ // Split by comma and trim whitespace
407
+ const parts = value.split(',').map((s) => s.trim());
408
+ // Filter out empty strings - this handles both "Finish" -> ["Finish"]
409
+ // and "" -> []
410
+ return parts.filter((s) => s.length > 0);
411
+ }
412
+
413
+ // For non-array-named fields, only convert if there are commas
414
+ if (!value.includes(',')) {
415
+ return null;
416
+ }
417
+
418
+ // For non-array-named fields, apply stricter sentence detection
419
+ // Skip if it looks like a sentence (comma followed by space and lowercase)
420
+ if (/,\s+[a-z]/.test(value)) {
421
+ return null;
422
+ }
423
+ // Skip if it contains newlines (likely formatted text)
424
+ if (value.includes('\n')) {
425
+ return null;
426
+ }
427
+
428
+ return null;
429
+ }
430
+
431
+ /**
432
+ * Convert comma-separated string values to arrays when they look like array data.
433
+ * This handles cases where the LLM generates strings like "color,size" instead
434
+ * of arrays like ["color", "size"] due to schema type misdetection.
435
+ */
436
+ function convertCommaSeparatedStringsToArrays(
437
+ mockData: Record<string, unknown>,
438
+ ): void {
439
+ for (const [key, value] of Object.entries(mockData)) {
440
+ if (typeof value === 'string') {
441
+ const asArray = parseCommaSeparatedStringAsArray(value, key);
442
+ if (asArray !== null) {
443
+ mockData[key] = asArray;
444
+ awsLog(
445
+ `CodeYam: Converted comma-separated string to array for key "${key}": "${value}" -> [${asArray.map((s) => `"${s}"`).join(', ')}]`,
446
+ );
447
+ }
448
+ } else if (
449
+ value !== null &&
450
+ typeof value === 'object' &&
451
+ !Array.isArray(value)
452
+ ) {
453
+ // Recursively process nested objects
454
+ convertCommaSeparatedStringsToArrays(value as Record<string, unknown>);
455
+ } else if (Array.isArray(value)) {
456
+ // Recursively process arrays (each element could be an object)
457
+ for (const item of value) {
458
+ if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
459
+ convertCommaSeparatedStringsToArrays(item as Record<string, unknown>);
460
+ }
461
+ }
462
+ }
463
+ }
464
+ }
465
+
466
+ /**
467
+ * Ensure all keys from dataForMocks have corresponding data in mockData.
468
+ * For missing keys, generate default values based on the schema.
469
+ * Recursively checks nested objects to fill in any missing nested fields.
470
+ */
471
+ function fillMissingMockDataKeysWithDefaults(
472
+ mockData: Record<string, unknown>,
473
+ dataForMocks: JsonTypeDefinition,
474
+ pathPrefix: string = '',
475
+ ): void {
476
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
477
+ return;
478
+ }
479
+
480
+ const missingKeys: string[] = [];
481
+
482
+ for (const key of Object.keys(dataForMocks)) {
483
+ if (key === '_nullable') continue; // Internal marker, not a data key
484
+
485
+ const fullPath = pathPrefix ? `${pathPrefix}.${key}` : key;
486
+
487
+ if (mockData[key] === undefined) {
488
+ missingKeys.push(fullPath);
489
+ // Generate default data based on schema
490
+ const schemaForKey = dataForMocks[key];
491
+ mockData[key] = generateDefaultForSchemaType(schemaForKey);
492
+ } else {
493
+ // Key exists, but if both are objects, recursively check for missing nested keys
494
+ const schemaValue = dataForMocks[key];
495
+ const mockValue = mockData[key];
496
+ if (
497
+ typeof schemaValue === 'object' &&
498
+ schemaValue !== null &&
499
+ !Array.isArray(schemaValue) &&
500
+ typeof mockValue === 'object' &&
501
+ mockValue !== null &&
502
+ !Array.isArray(mockValue)
503
+ ) {
504
+ fillMissingMockDataKeysWithDefaults(
505
+ mockValue as Record<string, unknown>,
506
+ schemaValue as JsonTypeDefinition,
507
+ fullPath,
508
+ );
509
+ }
510
+ }
511
+ }
512
+
513
+ if (missingKeys.length > 0) {
514
+ awsLog(
515
+ `CodeYam: Generated default mock data for ${missingKeys.length} missing key(s): ${missingKeys.slice(0, 10).join(', ')}${missingKeys.length > 10 ? '...' : ''}`,
516
+ );
517
+ }
518
+ }
519
+
520
+ /**
521
+ * Enforce execution flow requiredValues by setting falsy paths to null.
522
+ *
523
+ * The LLM doesn't reliably generate null for `comparison: 'falsy'` requirements.
524
+ * For example, a flow like "diffView: falsy" should hide a modal, but the LLM
525
+ * might generate a truthy object, causing the modal to show in all screenshots.
526
+ *
527
+ * This function:
528
+ * 1. Gets requiredValues from covered flows
529
+ * 2. For 'falsy' comparisons: sets the value to null
530
+ * 3. For 'truthy' comparisons with falsy values: generates a default truthy value
531
+ */
532
+ function enforceRequiredValues(
533
+ mockData: Record<string, unknown>,
534
+ coveredFlowIds: string[],
535
+ executionFlows: ExecutionFlow[],
536
+ ): void {
537
+ if (!coveredFlowIds.length || !executionFlows.length) {
538
+ return;
539
+ }
540
+
541
+ // Get all requiredValues from covered flows
542
+ const coveredFlows = executionFlows.filter((flow) =>
543
+ coveredFlowIds.includes(flow.id),
544
+ );
545
+
546
+ for (const flow of coveredFlows) {
547
+ if (!flow.requiredValues) continue;
548
+
549
+ for (const rv of flow.requiredValues) {
550
+ if (!rv.attributePath) continue;
551
+
552
+ // Find the value in mockData - the path could be nested
553
+ // e.g., attributePath: "diffView" could be at mockData['useDiffModal()'].diffView
554
+ const result = findAndSetValueInMockData(
555
+ mockData,
556
+ rv.attributePath,
557
+ rv.comparison,
558
+ rv.valueType,
559
+ );
560
+
561
+ if (result.found) {
562
+ awsLog(
563
+ `CodeYam: Enforced ${rv.comparison} for ${rv.attributePath} (set to ${result.newValue === null ? 'null' : typeof result.newValue})`,
564
+ );
565
+ }
566
+ }
567
+ }
568
+ }
569
+
570
+ /**
571
+ * Find a value in mockData by attributePath and enforce the comparison.
572
+ * The attributePath could be a simple key or a nested path.
573
+ *
574
+ * Returns { found: boolean, newValue: unknown }
575
+ */
576
+ function findAndSetValueInMockData(
577
+ mockData: Record<string, unknown>,
578
+ attributePath: string,
579
+ comparison: string,
580
+ valueType?: string,
581
+ ): { found: boolean; newValue?: unknown } {
582
+ // Try to find the path at various nesting levels
583
+ // The attributePath might be "diffView" but the actual location is
584
+ // mockData['useDiffModal()'].diffView
585
+
586
+ // Strategy 1: Direct path (e.g., mockData[attributePath])
587
+ if (attributePath in mockData) {
588
+ const currentValue = mockData[attributePath];
589
+ const { shouldChange, newValue } = getEnforcedValue(
590
+ currentValue,
591
+ comparison,
592
+ valueType,
593
+ );
594
+ if (shouldChange) {
595
+ mockData[attributePath] = newValue;
596
+ return { found: true, newValue };
597
+ }
598
+ return { found: true, newValue: currentValue };
599
+ }
600
+
601
+ // Strategy 2: Search in nested objects
602
+ for (const [key, value] of Object.entries(mockData)) {
603
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
604
+ const nestedObj = value as Record<string, unknown>;
605
+
606
+ // Check if attributePath exists in this nested object
607
+ if (attributePath in nestedObj) {
608
+ const currentValue = nestedObj[attributePath];
609
+ const { shouldChange, newValue } = getEnforcedValue(
610
+ currentValue,
611
+ comparison,
612
+ valueType,
613
+ );
614
+ if (shouldChange) {
615
+ nestedObj[attributePath] = newValue;
616
+ return { found: true, newValue };
617
+ }
618
+ return { found: true, newValue: currentValue };
619
+ }
620
+
621
+ // Also check dot-notation paths (e.g., "diffView.type")
622
+ if (attributePath.includes('.')) {
623
+ const parts = attributePath.split('.');
624
+ const firstPart = parts[0];
625
+ if (firstPart in nestedObj) {
626
+ // Recurse with the rest of the path
627
+ const result = findAndSetValueInMockData(
628
+ nestedObj,
629
+ attributePath,
630
+ comparison,
631
+ valueType,
632
+ );
633
+ if (result.found) return result;
634
+ }
635
+ }
636
+
637
+ // Recursively search deeper
638
+ const result = findAndSetValueInMockData(
639
+ nestedObj,
640
+ attributePath,
641
+ comparison,
642
+ valueType,
643
+ );
644
+ if (result.found) return result;
645
+ }
646
+ }
647
+
648
+ return { found: false };
649
+ }
650
+
651
+ /**
652
+ * Determine if a value should be changed to match a comparison requirement.
653
+ *
654
+ * For 'falsy' comparison: truthy values should become null
655
+ * For 'truthy' comparison: falsy values should become a default truthy value
656
+ */
657
+ function getEnforcedValue(
658
+ currentValue: unknown,
659
+ comparison: string,
660
+ valueType?: string,
661
+ ): { shouldChange: boolean; newValue: unknown } {
662
+ const isTruthy = Boolean(currentValue);
663
+
664
+ if (comparison === 'falsy') {
665
+ // Value should be falsy
666
+ if (isTruthy) {
667
+ return { shouldChange: true, newValue: null };
668
+ }
669
+ return { shouldChange: false, newValue: currentValue };
670
+ }
671
+
672
+ if (comparison === 'truthy') {
673
+ // Value should be truthy
674
+ if (!isTruthy) {
675
+ // Generate a default truthy value based on valueType
676
+ const defaultValue = generateDefaultTruthyValue(valueType);
677
+ return { shouldChange: true, newValue: defaultValue };
678
+ }
679
+ return { shouldChange: false, newValue: currentValue };
680
+ }
681
+
682
+ // For other comparisons (equals, exists, etc.), don't auto-enforce
683
+ return { shouldChange: false, newValue: currentValue };
684
+ }
685
+
686
+ /**
687
+ * Generate a default truthy value for a given type.
688
+ */
689
+ function generateDefaultTruthyValue(valueType?: string): unknown {
690
+ if (!valueType) return { _placeholder: true };
691
+
692
+ switch (valueType.toLowerCase()) {
693
+ case 'string':
694
+ return 'default-value';
695
+ case 'number':
696
+ return 1;
697
+ case 'boolean':
698
+ return true;
699
+ case 'array':
700
+ return [{ _placeholder: true }];
701
+ case 'object':
702
+ default:
703
+ return { _placeholder: true };
704
+ }
705
+ }
706
+
18
707
  type ScenarioDataWithoutDescription = Omit<ScenarioData, 'scenarioDescription'>;
19
708
 
20
709
  interface GenerateEntityScenarioDataArgs {
21
710
  entity: Pick<Entity, 'name' | 'filePath' | 'metadata'>;
22
711
  structure: ScenariosDataStructure;
23
712
  scenarios: Scenario[];
713
+ executionFlows?: ExecutionFlow[];
24
714
  incompleteResponse?: string;
25
715
  analysis: Analysis;
26
716
  model?: AI.Model;
@@ -34,10 +724,96 @@ type GenerateDataForScenarioArgs = Omit<
34
724
  defaultScenarioData?: ScenarioData;
35
725
  };
36
726
 
727
+ interface FillMissingMockDataKeysArgs {
728
+ structure: ScenariosDataStructure;
729
+ scenario: Scenario;
730
+ executionFlows: ExecutionFlow[] | undefined;
731
+ fullScenarioData: ScenarioData;
732
+ model: AI.Model | undefined;
733
+ }
734
+
735
+ /**
736
+ * For Default Scenario only: detect missing mockData keys and make a follow-up
737
+ * LLM call to fill them in. This handles cases where the LLM completes normally
738
+ * but misses some keys (often small/simple ones when the schema is large).
739
+ */
740
+ async function fillMissingMockDataKeys({
741
+ structure,
742
+ scenario,
743
+ executionFlows,
744
+ fullScenarioData,
745
+ model,
746
+ }: FillMissingMockDataKeysArgs): Promise<void> {
747
+ if (
748
+ !structure.dataForMocks ||
749
+ typeof structure.dataForMocks !== 'object' ||
750
+ Array.isArray(structure.dataForMocks)
751
+ ) {
752
+ return;
753
+ }
754
+
755
+ const expectedKeys = Object.keys(structure.dataForMocks);
756
+ const generatedKeys = Object.keys(fullScenarioData.data.mockData || {});
757
+ const missingKeys = expectedKeys.filter((k) => !generatedKeys.includes(k));
758
+
759
+ if (missingKeys.length === 0) {
760
+ return;
761
+ }
762
+
763
+ awsLog(
764
+ `Default Scenario missing ${missingKeys.length} keys, making follow-up call`,
765
+ { missingKeys },
766
+ );
767
+
768
+ // Build subset schema with only missing keys
769
+ const missingSchema: Record<string, any> = {};
770
+ for (const key of missingKeys) {
771
+ missingSchema[key] = (structure.dataForMocks as Record<string, any>)[key];
772
+ }
773
+
774
+ const followUpPrompt = generateMissingKeysPrompt({
775
+ scenario,
776
+ executionFlows,
777
+ generatedMockData: fullScenarioData.data.mockData || {},
778
+ missingSchema,
779
+ });
780
+
781
+ const followUpResponse = await completionCall({
782
+ type: 'generateMissingMockData',
783
+ systemMessage: generateMissingKeysSystemMessage(),
784
+ prompt: followUpPrompt,
785
+ model,
786
+ });
787
+
788
+ if (!followUpResponse.completion) {
789
+ return;
790
+ }
791
+
792
+ const followUpJson = validateJson(followUpResponse.completion);
793
+ const followUpParsed = parseJsonSafe(followUpJson);
794
+
795
+ if (
796
+ !followUpParsed ||
797
+ typeof followUpParsed !== 'object' ||
798
+ !('mockData' in followUpParsed)
799
+ ) {
800
+ return;
801
+ }
802
+
803
+ const followUpMockData = (followUpParsed as any).mockData;
804
+ if (followUpMockData && typeof followUpMockData === 'object') {
805
+ fullScenarioData.data.mockData = {
806
+ ...fullScenarioData.data.mockData,
807
+ ...followUpMockData,
808
+ };
809
+ }
810
+ }
811
+
37
812
  export async function generateDataForScenario({
38
813
  entity,
39
814
  structure,
40
815
  scenario,
816
+ executionFlows,
41
817
  defaultScenarioData,
42
818
  incompleteResponse,
43
819
  analysis,
@@ -45,11 +821,122 @@ export async function generateDataForScenario({
45
821
  }: GenerateDataForScenarioArgs) {
46
822
  awsLogDebugLevel(1, `Generating data for ${entity.name}: ${scenario.name}`);
47
823
 
824
+ // Check if we should chunk the data structure for focused processing
825
+ let chunkedMockData: Record<string, unknown> | undefined;
826
+ const coveredFlowIds = scenario.metadata?.coveredFlows || [];
827
+
828
+ if (
829
+ structure.dataForMocks &&
830
+ !incompleteResponse // Don't do chunked calls on continuation
831
+ ) {
832
+ const chunks = chunkDataStructure(structure.dataForMocks);
833
+
834
+ // If we have multiple chunks, process each one with a focused call
835
+ if (chunks.length > 1) {
836
+ awsLog(
837
+ `Data structure has ${Object.keys(structure.dataForMocks).length} keys, splitting into ${chunks.length} chunks for focused processing`,
838
+ );
839
+
840
+ chunkedMockData = {};
841
+
842
+ for (let i = 0; i < chunks.length; i++) {
843
+ const chunk = chunks[i];
844
+ const chunkKeys = Object.keys(chunk || {});
845
+
846
+ // Get relevant requiredValues for this chunk
847
+ const relevantRequiredValues = getRequiredValuesForChunk(
848
+ chunk,
849
+ executionFlows || [],
850
+ coveredFlowIds,
851
+ );
852
+
853
+ awsLog(
854
+ `Processing chunk ${i + 1}/${chunks.length}: ${chunkKeys.join(', ')}`,
855
+ );
856
+
857
+ const chunkPrompt = generateChunkPrompt({
858
+ scenario,
859
+ chunk,
860
+ chunkIndex: i,
861
+ totalChunks: chunks.length,
862
+ relevantRequiredValues,
863
+ });
864
+
865
+ const chunkResponse = await completionCall({
866
+ type: 'generateChunkMockData',
867
+ systemMessage: generateChunkSystemMessage(scenario.name),
868
+ prompt: chunkPrompt,
869
+ model,
870
+ });
871
+
872
+ // Save chunk call to LLM log for replay support
873
+ await saveLlmCall({
874
+ object_type: 'analysis',
875
+ object_id: analysis.id,
876
+ propsJson: {
877
+ entity: { name: entity.name, filePath: entity.filePath },
878
+ scenario: { name: scenario.name },
879
+ chunkIndex: i,
880
+ totalChunks: chunks.length,
881
+ },
882
+ ...chunkResponse.stats,
883
+ });
884
+
885
+ if (chunkResponse.completion) {
886
+ const validJson = validateJson(chunkResponse.completion);
887
+ const parsed = parseJsonSafe(validJson);
888
+ if (parsed && typeof parsed === 'object' && 'mockData' in parsed) {
889
+ const chunkMockData = (parsed as any).mockData;
890
+ if (chunkMockData && typeof chunkMockData === 'object') {
891
+ Object.assign(chunkedMockData, chunkMockData);
892
+ awsLog(
893
+ `Chunk ${i + 1} generated data for: ${Object.keys(chunkMockData).join(', ')}`,
894
+ );
895
+ }
896
+ }
897
+ }
898
+ }
899
+
900
+ // Detect keys that were lost from failed or partial chunk responses
901
+ // and fill them with schema-based defaults so they aren't permanently lost.
902
+ const allChunkedKeys = chunks.flatMap((c) => Object.keys(c || {}));
903
+ const returnedKeys = new Set(Object.keys(chunkedMockData));
904
+ const missingChunkKeys = allChunkedKeys.filter(
905
+ (k) => !returnedKeys.has(k),
906
+ );
907
+
908
+ if (missingChunkKeys.length > 0) {
909
+ awsLog(
910
+ `Chunked processing: ${missingChunkKeys.length} key(s) missing from chunk results, filling with defaults: ${missingChunkKeys.join(', ')}`,
911
+ );
912
+ const dataForMocksRecord = structure.dataForMocks as Record<
913
+ string,
914
+ unknown
915
+ >;
916
+ for (const key of missingChunkKeys) {
917
+ chunkedMockData[key] = generateDefaultForSchemaType(
918
+ dataForMocksRecord[key],
919
+ );
920
+ }
921
+ }
922
+
923
+ awsLog(
924
+ `Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`,
925
+ );
926
+ }
927
+ }
928
+
929
+ // When we have chunked mock data with actual content, tell the main prompt to skip mockData generation
930
+ // Important: Check for actual keys, not just truthy object, because {} would skip generation incorrectly
931
+ const hasChunkedData =
932
+ chunkedMockData && Object.keys(chunkedMockData).length > 0;
48
933
  const prompt = generateEntityScenarioDataGenerator(
49
934
  structure,
50
935
  scenario,
936
+ executionFlows,
51
937
  defaultScenarioData,
52
938
  incompleteResponse,
939
+ { mockDataAlreadyGenerated: hasChunkedData },
53
940
  );
54
941
 
55
942
  const isDefault = scenario.name === DEFAULT_SCENARIO_NAME;
@@ -92,7 +979,7 @@ export async function generateDataForScenario({
92
979
  ...response.stats,
93
980
  });
94
981
 
95
- const { completion, finishReason } = response;
982
+ let { completion, finishReason } = response;
96
983
 
97
984
  if (!completion) {
98
985
  console.log(
@@ -101,51 +988,79 @@ export async function generateDataForScenario({
101
988
  return null;
102
989
  }
103
990
 
104
- awsLog(
105
- `LLMCall ${llmCall ? llmCall.id : 'N/A'}: ${entity.filePath} ${entity.metadata?.exportAlias ?? entity.name} scenario data completion :>> Finish reason:`,
106
- {
107
- finishReason,
108
- completion,
109
- },
991
+ awsLogDebugLevel(
992
+ 1,
993
+ `LLMCall ${llmCall ? llmCall.id : 'N/A'}: ${entity.filePath} ${entity.metadata?.exportAlias ?? entity.name} finishReason: ${finishReason}`,
110
994
  );
111
995
 
996
+ // If response was truncated due to token limit, make a continuation call
997
+ if (finishReason === 'length') {
998
+ awsLogDebugLevel(1, 'Response truncated, making continuation call');
999
+
1000
+ const continuationResponse = await completionCall({
1001
+ type: 'generateEntityScenarioData',
1002
+ systemMessage: generateIncompleteSystemMessage(scenario.name, isDefault),
1003
+ prompt: completion, // Pass the incomplete response as the prompt
1004
+ model,
1005
+ });
1006
+
1007
+ if (continuationResponse.completion) {
1008
+ completion = completion + continuationResponse.completion;
1009
+ finishReason = continuationResponse.finishReason;
1010
+ }
1011
+ }
1012
+
112
1013
  const validJson = validateJson(completion);
113
1014
 
114
1015
  const parsed = parseJsonSafe(validJson);
115
1016
  if (!parsed || typeof parsed !== 'object' || !('scenarioData' in parsed)) {
116
- console.log('CodeYam Debug: generateDataForScenario failed to parse', {
117
- entityName: entity.name,
118
- scenarioName: scenario.name,
119
- hasParsed: !!parsed,
120
- parsedType: typeof parsed,
121
- hasScenarioData: parsed && 'scenarioData' in parsed,
122
- completionPreview: completion.substring(0, 200),
123
- });
1017
+ awsLog(`Failed to parse scenario data for ${entity.name}/${scenario.name}`);
124
1018
  return null;
125
1019
  }
126
1020
 
127
- const { scenarioData: scenarioDataWithoutDescription } = parsed as {
1021
+ let { scenarioData: scenarioDataWithoutDescription } = parsed as {
128
1022
  scenarioData: ScenarioDataWithoutDescription;
129
1023
  };
130
1024
 
131
- console.log('CodeYam Debug: generateDataForScenario parsed successfully', {
132
- entityName: entity.name,
133
- scenarioName: scenario.name,
134
- parsedScenarioName: scenarioDataWithoutDescription.scenarioName,
135
- hasData: !!scenarioDataWithoutDescription.data,
136
- dataKeys: scenarioDataWithoutDescription.data
137
- ? Object.keys(scenarioDataWithoutDescription.data)
138
- : [],
139
- });
1025
+ // FIX: LLM sometimes puts mock data keys directly under scenarioData instead of
1026
+ // under scenarioData.data.mockData. Detect and fix this structural issue.
1027
+ if (structure.dataForMocks) {
1028
+ const scenarioDataAsAny = scenarioDataWithoutDescription as any;
1029
+ const reservedKeys = new Set([
1030
+ 'scenarioName',
1031
+ 'data',
1032
+ 'scenarioDescription',
1033
+ ]);
1034
+ const misplacedKeys: string[] = [];
140
1035
 
141
- // Transform mock data values to match expected schema types
142
- // (e.g., LLM might generate array for route params that should be strings)
143
- if (scenarioDataWithoutDescription.data?.mockData && structure.dataForMocks) {
144
- scenarioDataWithoutDescription.data.mockData =
145
- transformMockDataToMatchSchema(
146
- scenarioDataWithoutDescription.data.mockData as Record<string, unknown>,
147
- structure.dataForMocks as Record<string, unknown>,
148
- ) as typeof scenarioDataWithoutDescription.data.mockData;
1036
+ // Find keys that are directly under scenarioData but should be in mockData
1037
+ for (const key of Object.keys(scenarioDataAsAny)) {
1038
+ if (reservedKeys.has(key)) continue;
1039
+ // If this key exists in the dataForMocks schema, it's misplaced
1040
+ if (key in structure.dataForMocks) {
1041
+ misplacedKeys.push(key);
1042
+ }
1043
+ }
1044
+
1045
+ if (misplacedKeys.length > 0) {
1046
+ // Ensure data.mockData exists
1047
+ if (!scenarioDataAsAny.data) {
1048
+ scenarioDataAsAny.data = {};
1049
+ }
1050
+ if (!scenarioDataAsAny.data.mockData) {
1051
+ scenarioDataAsAny.data.mockData = {};
1052
+ }
1053
+
1054
+ // Move misplaced keys to mockData
1055
+ for (const key of misplacedKeys) {
1056
+ scenarioDataAsAny.data.mockData[key] = scenarioDataAsAny[key];
1057
+ delete scenarioDataAsAny[key];
1058
+ }
1059
+
1060
+ // Update the reference
1061
+ scenarioDataWithoutDescription =
1062
+ scenarioDataAsAny as ScenarioDataWithoutDescription;
1063
+ }
149
1064
  }
150
1065
 
151
1066
  const fullScenarioData: ScenarioData = {
@@ -155,8 +1070,9 @@ export async function generateDataForScenario({
155
1070
 
156
1071
  if (structure.dataForMocks && !fullScenarioData.data.argumentsData) {
157
1072
  fullScenarioData.data.argumentsData = [];
158
- if (structure.arguments && !fullScenarioData.data.argumentsData) {
159
- fullScenarioData.data.argumentsData = [];
1073
+ // Populate argumentsData from structure.arguments using top-level data values
1074
+ // Bug fix: removed redundant !argumentsData check that was always false after setting to []
1075
+ if (structure.arguments) {
160
1076
  for (let i = 0; i < structure.arguments.length; ++i) {
161
1077
  if (!fullScenarioData.data.argumentsData[i]) {
162
1078
  fullScenarioData.data.argumentsData[i] = {};
@@ -169,14 +1085,182 @@ export async function generateDataForScenario({
169
1085
  }
170
1086
  }
171
1087
 
172
- if (structure.dataForMocks && !fullScenarioData.data.mockData) {
173
- fullScenarioData.data.mockData = {};
174
- for (const propKey of Object.keys(structure.arguments)) {
175
- const dataAsAny = fullScenarioData.data as any;
176
- fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
1088
+ // Merge flat-level mock data into mockData.
1089
+ // Sometimes the LLM returns some data inside data.mockData but other data at the flat
1090
+ // data level (e.g., data.useRouter() instead of data.mockData.useRouter()).
1091
+ // This code ensures all dataForMocks keys end up in mockData.
1092
+ if (structure.dataForMocks) {
1093
+ fullScenarioData.data.mockData ||= {};
1094
+ const dataAsAny = fullScenarioData.data as any;
1095
+ for (const propKey of Object.keys(structure.dataForMocks)) {
1096
+ // Only copy if it exists at flat level and not already in mockData
1097
+ if (
1098
+ dataAsAny[propKey] !== undefined &&
1099
+ !fullScenarioData.data.mockData[propKey]
1100
+ ) {
1101
+ fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
1102
+ }
1103
+ }
1104
+ }
1105
+
1106
+ // Merge chunked mock data from focused calls (takes priority over main call's data)
1107
+ // This ensures keys processed with focused attention are correctly generated.
1108
+ if (chunkedMockData && fullScenarioData.data.mockData) {
1109
+ for (const [key, value] of Object.entries(chunkedMockData)) {
1110
+ // Chunked data takes priority - overwrite main call's potentially wrong data
1111
+ fullScenarioData.data.mockData[key] = value;
1112
+ }
1113
+ awsLog(
1114
+ `Merged chunked mock data for keys: ${Object.keys(chunkedMockData).join(', ')}`,
1115
+ );
1116
+ }
1117
+
1118
+ // Strip _nullable markers from LLM-generated mock data.
1119
+ // The _nullable marker is an internal CodeYam concept used in type definitions
1120
+ // to indicate that a field can be null/undefined. The LLM sometimes includes
1121
+ // these markers in its generated data, which causes runtime errors when code
1122
+ // iterates over object keys (e.g., Object.keys(importedBy) picks up "_nullable",
1123
+ // then Object.keys(importedBy["_nullable"]) calls Object.keys(null) and throws).
1124
+ if (fullScenarioData.data.mockData) {
1125
+ stripNullableMarkers(
1126
+ fullScenarioData.data.mockData as Record<string, unknown>,
1127
+ );
1128
+ }
1129
+
1130
+ // Relocate misplaced nested keys to their correct position.
1131
+ // The LLM sometimes places nested keys at root level instead of inside their
1132
+ // parent object (e.g., 'fastener' at root instead of inside 'trpc').
1133
+ // This ensures the mockData structure matches the dataForMocks schema.
1134
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
1135
+ relocateMisplacedNestedKeys(
1136
+ fullScenarioData.data.mockData,
1137
+ structure.dataForMocks,
1138
+ );
1139
+ }
1140
+
1141
+ // Convert null values to undefined based on schema type constraints.
1142
+ // LLM uses null for "no value" (JSON doesn't support undefined), but TypeScript
1143
+ // types like "string | undefined" don't accept null. This converts null→undefined
1144
+ // for fields typed as "T | undefined" (but preserves null for "T | null").
1145
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
1146
+ convertNullToUndefinedBySchema(
1147
+ fullScenarioData.data.mockData,
1148
+ structure.dataForMocks,
1149
+ );
1150
+ }
1151
+
1152
+ // Coerce objects/arrays to primitives when the schema expects a primitive type.
1153
+ // The LLM sometimes generates an object where the schema expects "string",
1154
+ // e.g., { body: { "env": "production" } } instead of { body: "some string" }.
1155
+ // This causes runtime errors like "TypeError: body.match is not a function".
1156
+ // Must run BEFORE convertCommaSeparatedStringsToArrays, which intentionally
1157
+ // overrides schema types for array-like field names.
1158
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
1159
+ coerceObjectsToPrimitivesBySchema(
1160
+ fullScenarioData.data.mockData,
1161
+ structure.dataForMocks,
1162
+ );
1163
+ }
1164
+
1165
+ // Coerce primitives to empty arrays when the schema expects an array.
1166
+ // The LLM sometimes generates a primitive (e.g., `webapps: true`) where the
1167
+ // schema expects an array (e.g., `webapps: [{ name: "string" }]`).
1168
+ // This causes runtime errors like "TypeError: config.webapps?.forEach is not a function".
1169
+ // Must run AFTER coerceObjectsToPrimitivesBySchema and BEFORE convertCommaSeparatedStringsToArrays.
1170
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
1171
+ coercePrimitivesToArraysBySchema(
1172
+ fullScenarioData.data.mockData,
1173
+ structure.dataForMocks,
1174
+ );
1175
+ }
1176
+
1177
+ // Convert comma-separated strings to arrays when appropriate.
1178
+ // The LLM sometimes generates strings like "color,size" instead of arrays
1179
+ // like ["color", "size"] when the schema type is incorrectly inferred as
1180
+ // 'string' instead of 'string[]'. This causes runtime errors when code
1181
+ // calls array methods like .map() on the value.
1182
+ if (fullScenarioData.data.mockData) {
1183
+ convertCommaSeparatedStringsToArrays(fullScenarioData.data.mockData);
1184
+ }
1185
+
1186
+ // Convert type annotation strings that appear as values to actual values.
1187
+ // The LLM sometimes echoes the schema type annotation as the value.
1188
+ // For example, if the schema says { filePath: "string | undefined" },
1189
+ // the LLM might return { filePath: "string | undefined" } instead of
1190
+ // generating an actual value. This converts those type strings to
1191
+ // appropriate default values (e.g., "string | undefined" → undefined).
1192
+ if (fullScenarioData.data.mockData) {
1193
+ convertTypeAnnotationsToValues(fullScenarioData.data.mockData);
1194
+ }
1195
+
1196
+ // Fix null values for ID fields when the schema indicates they should be non-null.
1197
+ // The LLM sometimes generates `null` for ID fields (e.g., `"id": null`) when
1198
+ // the schema type is `"number"`. This causes runtime issues when code checks
1199
+ // `if (!data?.id)` expecting a truthy value.
1200
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
1201
+ fixNullIdsBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
1202
+ }
1203
+
1204
+ // Enforce execution flow requiredValues by setting falsy paths to null.
1205
+ // The LLM doesn't reliably generate null for falsy requirements (e.g., diffView: falsy
1206
+ // to hide a modal). This post-processing ensures that scenarios match their
1207
+ // covered flows' requiredValues.
1208
+ if (fullScenarioData.data.mockData && executionFlows) {
1209
+ enforceRequiredValues(
1210
+ fullScenarioData.data.mockData,
1211
+ scenario.metadata?.coveredFlows || [],
1212
+ executionFlows,
1213
+ );
1214
+ }
1215
+
1216
+ if (structure.arguments && fullScenarioData.data.argumentsData) {
1217
+ for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
1218
+ if (structure.arguments[i]) {
1219
+ convertNullToUndefinedBySchema(
1220
+ fullScenarioData.data.argumentsData[i],
1221
+ structure.arguments[i],
1222
+ );
1223
+ }
177
1224
  }
178
1225
  }
179
1226
 
1227
+ // For Default Scenario only: check for missing keys and make follow-up call if needed.
1228
+ // This tries to get better-quality data via LLM before falling back to defaults.
1229
+ if (isDefault) {
1230
+ await fillMissingMockDataKeys({
1231
+ structure,
1232
+ scenario,
1233
+ executionFlows,
1234
+ fullScenarioData,
1235
+ model,
1236
+ });
1237
+ }
1238
+
1239
+ // Fill in missing mock data keys with default values (after trying LLM follow-up).
1240
+ // The LLM sometimes doesn't generate data for all keys in large schemas.
1241
+ // This ensures all dataForMocks keys have corresponding data to prevent
1242
+ // runtime errors like "Cannot read properties of undefined".
1243
+ // Only run for Default Scenario - non-default scenarios will get missing
1244
+ // data filled in from the merge with default scenario data.
1245
+ if (isDefault && structure.dataForMocks && fullScenarioData.data.mockData) {
1246
+ fillMissingMockDataKeysWithDefaults(
1247
+ fullScenarioData.data.mockData,
1248
+ structure.dataForMocks,
1249
+ );
1250
+ }
1251
+
1252
+ // Track the final scenario data for E2E debugging
1253
+ trackDataSnapshot(
1254
+ 'generateDataForScenario_result',
1255
+ {
1256
+ scenarioName: scenario.name,
1257
+ mockData: fullScenarioData.data.mockData,
1258
+ argumentsData: fullScenarioData.data.argumentsData,
1259
+ },
1260
+ entity.name,
1261
+ scenario.name,
1262
+ );
1263
+
180
1264
  return {
181
1265
  scenarioData: fullScenarioData,
182
1266
  llmCall: { name: scenario.name, id: llmCall.id },
@@ -187,6 +1271,7 @@ export default async function generateEntityScenarioData({
187
1271
  entity,
188
1272
  structure,
189
1273
  scenarios,
1274
+ executionFlows,
190
1275
  incompleteResponse,
191
1276
  analysis,
192
1277
  model,
@@ -207,6 +1292,7 @@ export default async function generateEntityScenarioData({
207
1292
  entity,
208
1293
  structure,
209
1294
  scenario: defaultScenario,
1295
+ executionFlows,
210
1296
  incompleteResponse,
211
1297
  analysis,
212
1298
  model,
@@ -229,6 +1315,7 @@ export default async function generateEntityScenarioData({
229
1315
  entity,
230
1316
  structure,
231
1317
  scenario,
1318
+ executionFlows,
232
1319
  defaultScenarioData,
233
1320
  incompleteResponse,
234
1321
  analysis,
@@ -249,37 +1336,131 @@ export default async function generateEntityScenarioData({
249
1336
  );
250
1337
  }
251
1338
 
252
- scenarioDatas.push(...validResults.map((result) => result.scenarioData));
253
- llmCalls.push(...validResults.map((result) => result.llmCall));
1339
+ // Merge non-default scenario data with default scenario data
1340
+ // The LLM generates partial data (only differences), we need to merge with default
1341
+ const mergedScenarioDatas = validResults.map((result) => {
1342
+ const scenarioData = result.scenarioData;
1343
+
1344
+ // Merge mockData with default mockData
1345
+ if (defaultScenarioData.data?.mockData && scenarioData.data?.mockData) {
1346
+ scenarioData.data.mockData = deepMergeScenarioData(
1347
+ defaultScenarioData.data.mockData,
1348
+ scenarioData.data.mockData,
1349
+ );
1350
+ } else if (
1351
+ defaultScenarioData.data?.mockData &&
1352
+ !scenarioData.data?.mockData
1353
+ ) {
1354
+ // Use default mockData if scenario has none
1355
+ scenarioData.data.mockData = { ...defaultScenarioData.data.mockData };
1356
+ }
1357
+
1358
+ // Merge argumentsData with default argumentsData
1359
+ if (
1360
+ defaultScenarioData.data?.argumentsData &&
1361
+ Array.isArray(defaultScenarioData.data.argumentsData) &&
1362
+ scenarioData.data?.argumentsData &&
1363
+ Array.isArray(scenarioData.data.argumentsData)
1364
+ ) {
1365
+ for (
1366
+ let i = 0;
1367
+ i < defaultScenarioData.data.argumentsData.length;
1368
+ i++
1369
+ ) {
1370
+ const scenarioArg = scenarioData.data.argumentsData[i];
1371
+ const defaultArg = defaultScenarioData.data.argumentsData[i];
1372
+
1373
+ // Only merge if both are objects (LLM sometimes returns primitives)
1374
+ if (
1375
+ scenarioArg &&
1376
+ typeof scenarioArg === 'object' &&
1377
+ !Array.isArray(scenarioArg) &&
1378
+ defaultArg &&
1379
+ typeof defaultArg === 'object' &&
1380
+ !Array.isArray(defaultArg)
1381
+ ) {
1382
+ scenarioData.data.argumentsData[i] = deepMergeScenarioData(
1383
+ defaultArg,
1384
+ scenarioArg,
1385
+ );
1386
+ } else if (scenarioArg !== undefined) {
1387
+ // Keep the scenario value as-is (even if primitive)
1388
+ scenarioData.data.argumentsData[i] = scenarioArg;
1389
+ } else if (defaultArg && typeof defaultArg === 'object') {
1390
+ // Use default if scenario is undefined and default is an object
1391
+ scenarioData.data.argumentsData[i] = { ...defaultArg };
1392
+ } else {
1393
+ scenarioData.data.argumentsData[i] = defaultArg;
1394
+ }
1395
+ }
1396
+ } else if (
1397
+ defaultScenarioData.data?.argumentsData &&
1398
+ !scenarioData.data?.argumentsData
1399
+ ) {
1400
+ // Use default argumentsData if scenario has none
1401
+ scenarioData.data.argumentsData =
1402
+ defaultScenarioData.data.argumentsData.map((arg) => ({ ...arg }));
1403
+ }
1404
+
1405
+ // Enforce requiredValues AFTER merge for non-default scenarios
1406
+ // This ensures that if a non-default scenario doesn't cover a certain flow,
1407
+ // it inherits the enforcement from the default scenario
1408
+ if (scenarioData.data?.mockData && executionFlows) {
1409
+ // Get the flows covered by this scenario
1410
+ const scenarioCoveredFlows =
1411
+ nonDefaultScenarios.find(
1412
+ (s) => s.name === result.scenarioData.scenarioDescription,
1413
+ )?.metadata?.coveredFlows || [];
1414
+
1415
+ // Get the paths that the scenario's flows affect
1416
+ const scenarioAffectedPaths = new Set<string>();
1417
+ for (const flowId of scenarioCoveredFlows) {
1418
+ const flow = executionFlows.find((f) => f.id === flowId);
1419
+ if (flow?.requiredValues) {
1420
+ for (const rv of flow.requiredValues) {
1421
+ if (rv.attributePath) {
1422
+ // Extract base path (e.g., "diffView" from "diffView.type")
1423
+ const basePath = rv.attributePath.split('.')[0];
1424
+ scenarioAffectedPaths.add(basePath);
1425
+ }
1426
+ }
1427
+ }
1428
+ }
254
1429
 
255
- console.log('CodeYam Debug: generateEntityScenarioData results', {
256
- filePath: entity.filePath,
257
- entityName: entity.name,
258
- totalScenarios: scenarios.length,
259
- defaultScenarioGenerated: !!defaultScenarioResult,
260
- otherScenariosRequested: scenarios.length - 1,
261
- otherScenariosResults: results.length,
262
- nullResults: results.filter((r) => r === null).length,
263
- validResults: validResults.length,
264
- finalScenarioDatasCount: scenarioDatas.length,
1430
+ // Get the default scenario's flows
1431
+ const defaultCoveredFlows =
1432
+ defaultScenario.metadata?.coveredFlows || [];
1433
+
1434
+ // For paths NOT affected by the scenario, apply default's enforcement
1435
+ const defaultFlowsForUnaffectedPaths = defaultCoveredFlows.filter(
1436
+ (flowId) => {
1437
+ const flow = executionFlows.find((f) => f.id === flowId);
1438
+ if (!flow?.requiredValues) return false;
1439
+
1440
+ // Check if this flow affects a path that the scenario doesn't cover
1441
+ return flow.requiredValues.some((rv) => {
1442
+ if (!rv.attributePath) return false;
1443
+ const basePath = rv.attributePath.split('.')[0];
1444
+ return !scenarioAffectedPaths.has(basePath);
1445
+ });
1446
+ },
1447
+ );
1448
+
1449
+ // Apply enforcement from default scenario for unaffected paths
1450
+ if (defaultFlowsForUnaffectedPaths.length > 0) {
1451
+ enforceRequiredValues(
1452
+ scenarioData.data.mockData,
1453
+ defaultFlowsForUnaffectedPaths,
1454
+ executionFlows,
1455
+ );
1456
+ }
1457
+ }
1458
+
1459
+ return scenarioData;
265
1460
  });
266
1461
 
267
- awsLog(
268
- 'CodeYam: scenarioDatas :>> ',
269
- JSON.stringify(
270
- {
271
- filePath: entity.filePath,
272
- entityName: entity.name,
273
- scenarioDatas: scenarioDatas.map((sd) => ({
274
- scenarioName: sd.scenarioName,
275
- hasData: !!sd.data,
276
- dataKeys: sd.data ? Object.keys(sd.data) : [],
277
- })),
278
- },
279
- null,
280
- 2,
281
- ),
282
- );
1462
+ scenarioDatas.push(...mergedScenarioDatas);
1463
+ llmCalls.push(...validResults.map((result) => result.llmCall));
283
1464
 
284
1465
  return { scenarioDatas, llmCalls };
285
1466
  } catch (error) {
@@ -291,28 +1472,85 @@ export default async function generateEntityScenarioData({
291
1472
  export const generateSystemMessage = (
292
1473
  scenarioName: string,
293
1474
  defaultScenario: boolean,
1475
+ requiresErrorData: boolean = false,
294
1476
  ) => {
295
1477
  const scenarioType = defaultScenario
296
1478
  ? `## Default Scenario
297
1479
  Generate COMPLETE, robust data for the entire data structure.
298
- - Fill ALL fields with realistic values (except error attributes and key attributes set to null or undefined)
299
- - Arrays should have 2-3 items
300
- - Don't skip nested attributes unless the key attributes specify a parent attribute should be null or undefined
1480
+ - Fill ALL fields with realistic values (except error attributes)
1481
+ - Do not skip any keys, even simple or small entries
1482
+ - Arrays should have 3-5 items to provide realistic test data variety
1483
+ - Don't skip nested attributes unless the execution flow requirements specify a parent attribute should be null or undefined
301
1484
  - This provides the baseline data for all other scenarios`
302
1485
  : `## Non-Default Scenario
303
1486
  Generate ONLY the differences from the default scenario.
304
1487
  - Include only fields that need to change
305
- - Set to \`null\` to remove data
1488
+ - For object/scalar fields: set to \`null\` to remove/unset the data
1489
+ - For array fields: use \`[]\` for empty arrays (not \`null\`) unless the schema type explicitly includes \`| null\`
306
1490
  - Omit unchanged fields—they merge from default`;
307
1491
 
1492
+ // Only include the "NO ERROR DATA" instruction when the scenario doesn't require error data
1493
+ const noErrorDataInstruction = requiresErrorData
1494
+ ? `## IMPORTANT: ERROR DATA REQUIRED
1495
+ This scenario tests error handling. You MUST include "error" fields with realistic error messages.
1496
+ - Set error fields to truthy values (e.g., "Error: Operation failed" or "Something went wrong")
1497
+ - The error data is REQUIRED to trigger the correct error UI state`
1498
+ : `## CRITICAL: NO ERROR DATA
1499
+ NEVER include "error" fields in responses. Skip them entirely.
1500
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
1501
+ - Leave out any attribute named "error"—do not set to null, omit entirely`;
1502
+
308
1503
  return `You are a test data generator. Create mock data matching a data structure and scenario requirements.
309
1504
 
1505
+ ## Execution Flow Requirements
1506
+ Each scenario has \`coveredFlows\` which lists the execution flows (distinct outcomes/behaviors) this scenario should demonstrate.
1507
+ Each flow has \`requiredValues\` - the attribute values that MUST be set to produce that outcome.
1508
+
1509
+ **Your job**: Generate mock data that satisfies ALL the requiredValues from ALL coveredFlows.
1510
+
1511
+ For example, if a flow requires:
1512
+ \`\`\`json
1513
+ {
1514
+ "attributePath": "signature[0].isLoading",
1515
+ "value": "false",
1516
+ "comparison": "equals",
1517
+ "valueType": "boolean"
1518
+ }
1519
+ \`\`\`
1520
+ Then set \`isLoading: false\` in the mockData.
1521
+
1522
+ ### Array Length Requirements (length< and length>)
1523
+ For array size variation flows:
1524
+ - \`comparison: "length<"\` with \`value: "0"\` → generate EMPTY array \`[]\`
1525
+ - \`comparison: "length<"\` with \`value: "3"\` → generate 1-2 items (few items)
1526
+ - \`comparison: "length>"\` with \`value: "10"\` → generate 12+ items (many items)
1527
+
1528
+ ### String Length Requirements (normal vs long)
1529
+ For text length variation flows:
1530
+ - \`value: "normal"\` with \`valueType: "string"\` → generate normal length text (10-50 chars)
1531
+ - \`value: "long"\` with \`valueType: "string"\` → generate LONG text (200+ chars) to test overflow/truncation
1532
+
1533
+ ## CRITICAL: Blocking Flows to Avoid
1534
+ If the scenario includes \`blockingFlowsToAvoid\`, these are flows (like modals, overlays) that would BLOCK the expected UI.
1535
+ You MUST generate mock data that PREVENTS these flows from triggering:
1536
+
1537
+ - For \`comparison: "truthy"\` requirements → set the value to \`false\`, \`null\`, \`undefined\`, or \`0\`
1538
+ - For \`comparison: "exists"\` requirements → set the value to \`null\` or omit it entirely
1539
+ - For \`comparison: "equals"\` requirements → set a DIFFERENT value than what's required
1540
+
1541
+ For example, if a blocking flow has:
1542
+ \`\`\`json
1543
+ {
1544
+ "attributePath": "useFetcher().data.success",
1545
+ "value": "true",
1546
+ "comparison": "truthy"
1547
+ }
1548
+ \`\`\`
1549
+ Then you MUST set \`useFetcher().data\` to \`null\` or \`{ success: false }\` to prevent the modal from appearing.
1550
+
310
1551
  ${scenarioType}
311
1552
 
312
- ## CRITICAL: NO ERROR DATA
313
- NEVER include "error" fields in responses. Skip them entirely.
314
- - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
315
- - Leave out any attribute named "error"—do not set to null, omit entirely
1553
+ ${noErrorDataInstruction}
316
1554
 
317
1555
  ## Special Markers
318
1556
 
@@ -328,30 +1566,20 @@ Use for relative dates. Code runs in Node (no browser APIs, no external librarie
328
1566
  \`\`\`
329
1567
  Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
330
1568
 
331
- ## Mock Data Keys
332
- Preserve keys exactly as written in the structure. There are two formats:
1569
+ ### Arrays
1570
+ - Arrays should have many items (at least 4) unless specified otherwise
1571
+ - Each item must follow the exact structure provided
1572
+ - In general we want robust data, not minimal data unless specified otherwise
1573
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
333
1574
 
334
- ### Standard function calls
335
- \`\`\`json
336
- {
337
- "mockData": {
338
- "useUser()": { "user": { "name": "John" } },
339
- "from().select()": [{ "id": "1" }]
340
- }
341
- }
342
- \`\`\`
343
-
344
- ### Variable-qualified calls (for multiple calls to the same function)
345
- When the same function is called multiple times with results stored in different variables, keys use the format \`variableName <- functionName\`:
346
- \`\`\`json
347
- {
348
- "mockData": {
349
- "entityDiffFetcher <- useFetcher": { "data": null, "state": "idle" },
350
- "reportFetcher <- useFetcher": { "data": { "reportId": "abc123" }, "state": "idle" }
351
- }
352
- }
353
- \`\`\`
354
- This reads as "entityDiffFetcher receives from useFetcher". Each variable gets its own distinct mock data.
1575
+ ## CRITICAL: Preserve Exact Structure
1576
+ Your response MUST mirror the EXACT nested structure provided in mockData Structure.
1577
+ - Do NOT reorganize, split, or create duplicate keys
1578
+ - The hierarchy of nested objects must match exactly what was provided unless overridden by scenario rules
1579
+ - Only change the leaf VALUES (replacing type descriptions like "string" with actual data like "hello")
1580
+ - Copy the key strings EXACTLY from the structure
1581
+ - Do NOT modify type parameters, arguments, or any part of the key
1582
+ - The keys preserve the exact function call as written in the original code
355
1583
 
356
1584
  ## Response Format
357
1585
  \`\`\`json
@@ -369,9 +1597,15 @@ This reads as "entityDiffFetcher receives from useFetcher". Each variable gets i
369
1597
  ## Rules
370
1598
  - Valid JSON only—no raw code outside markers
371
1599
  - No \`undefined\`—use \`null\` or omit
372
- - No data references (can't use \`posts[0]\` elsewhere—duplicate the value)
1600
+ - No data references (can't use \`posts[0]\` elsewhere duplicate the value)
373
1601
  - Scenario name must match exactly: "${scenarioName}"
374
1602
  - Empty mockData: \`{}\`, empty argumentsData: \`[]\`
1603
+
1604
+ ## IMPORTANT: Avoid Identifier Collisions
1605
+ When generating identifier values (SHA hashes, entity IDs, etc.):
1606
+ - Use DISTINCT values for different identifier fields
1607
+ - Avoid matching: if \`entity.sha\` is "abc123", arrays like \`jobs[].entityShas\` or \`currentlyExecuting.entityShas\` should NOT contain "abc123"
1608
+ - This prevents accidental blocking of UI conditionals that check if IDs are in/not-in arrays
375
1609
  `;
376
1610
  };
377
1611
 
@@ -387,3 +1621,163 @@ Here is the original system message as well:
387
1621
  ${generateSystemMessage(scenarioName, isDefault)}
388
1622
  \`\`\`
389
1623
  `;
1624
+
1625
+ /**
1626
+ * System message for follow-up calls to generate missing mockData keys.
1627
+ * Includes the same rules as the main system message but with a simpler response format.
1628
+ */
1629
+ export const generateMissingKeysSystemMessage =
1630
+ () => `You are completing mock data generation for the Default Scenario. The initial response was missing some keys.
1631
+
1632
+ Generate data ONLY for the missing keys provided in the prompt. Do not skip any of them.
1633
+
1634
+ - Scenario name must match exactly: "Default Scenario"
1635
+
1636
+ ## Special Markers
1637
+
1638
+ ### Dynamic Dates (\`~~codeyam-code~~\`)
1639
+ \`\`\`json
1640
+ { "createdAt": { "~~codeyam-code~~": "new Date(Date.now() - 24*60*60*1000)" } }
1641
+ \`\`\`
1642
+ Use for relative dates. Code runs in Node (no browser APIs, no external libraries).
1643
+
1644
+ ### JSX Children (\`~~codeyam-jsx~~\`)
1645
+ \`\`\`json
1646
+ { "children": { "~~codeyam-jsx~~": "<div>Hello</div>" } }
1647
+ \`\`\`
1648
+ Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
1649
+
1650
+ ### Arrays
1651
+ - Arrays should have many items (at least 4) unless specified otherwise
1652
+ - Each item must follow the exact structure provided
1653
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
1654
+
1655
+ ## CRITICAL: Preserve Exact Structure
1656
+ Your response MUST mirror the EXACT nested structure provided for the missing keys.
1657
+ - Only change the leaf VALUES (replacing type descriptions like "string" with actual data)
1658
+ - Copy the key strings EXACTLY from the structure
1659
+ - Do NOT modify type parameters, arguments, or any part of the key
1660
+
1661
+ ## CRITICAL: NO ERROR DATA
1662
+ NEVER include "error" fields in responses. Skip them entirely.
1663
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
1664
+ - Leave out any attribute named "error"—do not set to null, omit entirely
1665
+
1666
+ ## Response Format
1667
+ \`\`\`json
1668
+ {
1669
+ "mockData": {
1670
+ // fill in ONLY the missing keys
1671
+ }
1672
+ }
1673
+ \`\`\`
1674
+
1675
+ ## Rules
1676
+ - Valid JSON only—no raw code outside markers
1677
+ - No \`undefined\`—use \`null\` or omit
1678
+ - No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
1679
+ `;
1680
+
1681
+ /**
1682
+ * System message for focused calls to generate critical mockData keys.
1683
+ * These are keys referenced by the scenario's execution flow requiredValues.
1684
+ */
1685
+ export const generateCriticalKeysSystemMessage = (
1686
+ scenarioName: string,
1687
+ ) => `You are generating mock data for CRITICAL keys that control scenario behavior.
1688
+
1689
+ These keys are referenced by the execution flow's requiredValues - they directly determine
1690
+ what the component renders. Pay EXTRA attention to matching the exact structure and values.
1691
+
1692
+ - Scenario name must match exactly: "${scenarioName}"
1693
+
1694
+ ## CRITICAL: Special Characters in Keys
1695
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1696
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1697
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1698
+
1699
+ ## CRITICAL: Preserve Exact Structure
1700
+ Your response MUST mirror the EXACT nested structure provided.
1701
+ - Copy key strings EXACTLY as shown (including special characters)
1702
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1703
+ - Do NOT modify keys, type parameters, or add extra keys
1704
+
1705
+ ## Matching requiredValues
1706
+ When the prompt shows requiredValues like:
1707
+ - \`attributePath: "useParams().functionCallReturnValue.*"\`
1708
+ - \`value: "scenarios"\`
1709
+
1710
+ This means set the \`*\` key to include "scenarios". For URL paths split by \`/\`,
1711
+ generate a path like \`"scenarios/id/mode"\` where segments match requirements.
1712
+
1713
+ ## Response Format
1714
+ \`\`\`json
1715
+ {
1716
+ "scenarioData": {
1717
+ "scenarioName": "${scenarioName}",
1718
+ "data": {
1719
+ "mockData": {
1720
+ // generate data for ONLY the critical keys
1721
+ }
1722
+ }
1723
+ }
1724
+ }
1725
+ \`\`\`
1726
+
1727
+ ## Rules
1728
+ - Valid JSON only
1729
+ - No \`undefined\`—use \`null\` or omit
1730
+ - Match the exact schema structure provided
1731
+ `;
1732
+
1733
+ /**
1734
+ * System message for focused calls to generate mock data for a chunk of keys.
1735
+ * Used when data structures are large and need to be processed in smaller pieces.
1736
+ */
1737
+ export const generateChunkSystemMessage = (
1738
+ scenarioName: string,
1739
+ ) => `You are generating mock data for a SUBSET of keys from a larger data structure.
1740
+
1741
+ This chunk contains fewer keys so you can focus on generating HIGH QUALITY data for each one.
1742
+ Pay EXTRA attention to matching the exact structure and values for each key.
1743
+
1744
+ - Scenario name must match exactly: "${scenarioName}"
1745
+
1746
+ ## CRITICAL: Special Characters in Keys
1747
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1748
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1749
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1750
+
1751
+ ## CRITICAL: Preserve Exact Structure
1752
+ Your response MUST mirror the EXACT nested structure provided.
1753
+ - Copy key strings EXACTLY as shown (including special characters)
1754
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1755
+ - Do NOT modify keys, type parameters, or add extra keys
1756
+
1757
+ ## Matching requiredValues
1758
+ If the prompt includes requiredValues, these are specific values that MUST be set:
1759
+ - For \`attributePath: "useParams().functionCallReturnValue.*"\` with \`value: "scenarios"\`
1760
+ → Set the \`*\` key to include "scenarios" (e.g., "scenarios/id/mode")
1761
+ - For URL paths, generate realistic paths that satisfy the requirements
1762
+
1763
+ ## CRITICAL: NO ERROR DATA
1764
+ NEVER include "error" fields in responses. Skip them entirely.
1765
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
1766
+ - Leave out any attribute named "error"—do not set to null, omit entirely
1767
+
1768
+ ## Response Format
1769
+ \`\`\`json
1770
+ {
1771
+ "mockData": {
1772
+ // generate data for ONLY the keys in this chunk
1773
+ }
1774
+ }
1775
+ \`\`\`
1776
+
1777
+ ## Rules
1778
+ - Valid JSON only
1779
+ - No \`undefined\`—use \`null\` or omit
1780
+ - Generate data for ALL keys in the chunk (don't skip any)
1781
+ - Arrays should have many items (at least 4) unless specified otherwise
1782
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
1783
+ `;