@codeyam/codeyam-cli 0.1.0-staging.1669d45 → 0.1.0-staging.27d5a59

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 (898) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +26 -26
  4. package/analyzer-template/packages/ai/index.ts +16 -2
  5. package/analyzer-template/packages/ai/package.json +3 -3
  6. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +110 -52
  7. package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
  8. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +132 -12
  9. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +139 -23
  10. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  11. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +6 -126
  12. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +656 -28
  13. package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
  14. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +94 -7
  15. package/analyzer-template/packages/ai/src/lib/completionCall.ts +229 -64
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1358 -254
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  18. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +205 -0
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +54 -3
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +124 -17
  24. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  25. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  26. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +140 -14
  27. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  28. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  29. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -97
  30. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  31. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  32. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -0
  33. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  34. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  35. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +58 -3
  36. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1012 -7
  37. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +35 -6
  38. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +515 -6
  39. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +1 -1
  40. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1540 -75
  41. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  42. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +51 -3
  43. package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
  44. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +90 -96
  45. package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
  46. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
  47. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  48. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  49. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +44 -7
  50. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  51. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +179 -45
  52. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +26 -4
  53. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  54. package/analyzer-template/packages/analyze/index.ts +2 -0
  55. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +65 -59
  56. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +132 -33
  57. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  58. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  59. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  60. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  61. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  62. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  63. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  64. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  65. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  66. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +99 -22
  67. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +27 -4
  68. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  69. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  70. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
  71. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  72. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
  73. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1352 -0
  74. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +193 -76
  75. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +87 -25
  76. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +352 -22
  77. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +118 -10
  78. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +667 -74
  79. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  80. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  81. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  82. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  83. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  84. package/analyzer-template/packages/aws/package.json +10 -10
  85. package/analyzer-template/packages/database/index.ts +1 -0
  86. package/analyzer-template/packages/database/package.json +4 -4
  87. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  88. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  89. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  90. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  91. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  92. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  93. package/analyzer-template/packages/database/src/lib/kysely/db.ts +22 -1
  94. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  95. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +1 -1
  96. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +62 -0
  97. package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
  98. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  99. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  100. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  101. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  102. package/analyzer-template/packages/database/src/lib/loadCommits.ts +58 -19
  103. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  104. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  105. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  106. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  107. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  108. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  109. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +153 -144
  110. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  111. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  112. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  113. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  114. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  115. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  116. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  117. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  118. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  119. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  120. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  121. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  122. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  123. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  124. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  125. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  126. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  127. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  128. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  129. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  130. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  131. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +4 -0
  132. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  133. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +16 -1
  134. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  135. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  136. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  137. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  138. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  139. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  140. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +1 -1
  141. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +20 -0
  142. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  143. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  144. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  145. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
  146. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
  147. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  148. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  149. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  150. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  151. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  152. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  153. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  154. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  155. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  156. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  157. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  158. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  159. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  160. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  161. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  162. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  163. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  164. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  165. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +45 -14
  166. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  167. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  168. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  169. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  170. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  171. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  172. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  173. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  174. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  175. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  176. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  177. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  178. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  179. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  180. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  181. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  182. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  183. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  184. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  185. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -88
  186. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  187. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  188. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  189. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  190. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  191. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  192. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  193. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  194. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  195. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  196. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  197. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  198. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  199. package/analyzer-template/packages/github/dist/types/index.d.ts +1 -1
  200. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  201. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  202. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +25 -1
  203. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  204. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  205. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  206. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  207. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  208. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  209. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  210. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +56 -6
  211. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  212. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  213. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  214. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  215. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  216. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  217. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  218. package/analyzer-template/packages/github/package.json +2 -2
  219. package/analyzer-template/packages/types/index.ts +1 -0
  220. package/analyzer-template/packages/types/src/types/Analysis.ts +25 -0
  221. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  222. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +8 -0
  223. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  224. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +70 -6
  225. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  226. package/analyzer-template/packages/utils/dist/types/index.d.ts +1 -1
  227. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  228. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  229. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +25 -1
  230. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  231. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  232. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  233. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +8 -0
  234. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  235. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  236. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  237. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +56 -6
  238. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  239. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  240. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  241. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  242. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
  243. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  244. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  245. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  246. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  247. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  248. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
  249. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  250. package/analyzer-template/playwright/capture.ts +20 -8
  251. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  252. package/analyzer-template/playwright/captureStatic.ts +1 -1
  253. package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
  254. package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
  255. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  256. package/analyzer-template/project/constructMockCode.ts +572 -87
  257. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  258. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  259. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  260. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
  261. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  262. package/analyzer-template/project/orchestrateCapture.ts +75 -7
  263. package/analyzer-template/project/reconcileMockDataKeys.ts +158 -10
  264. package/analyzer-template/project/runAnalysis.ts +4 -0
  265. package/analyzer-template/project/start.ts +38 -11
  266. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  267. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  268. package/analyzer-template/project/writeMockDataTsx.ts +312 -10
  269. package/analyzer-template/project/writeScenarioComponents.ts +271 -37
  270. package/analyzer-template/project/writeSimpleRoot.ts +21 -11
  271. package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
  272. package/analyzer-template/tsconfig.json +13 -1
  273. package/background/src/lib/local/createLocalAnalyzer.js +1 -1
  274. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  275. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
  276. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  277. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
  278. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  279. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  280. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  281. package/background/src/lib/virtualized/project/constructMockCode.js +474 -48
  282. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  283. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  284. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  285. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  286. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  287. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  288. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  289. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
  290. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  291. package/background/src/lib/virtualized/project/orchestrateCapture.js +62 -7
  292. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  293. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +133 -10
  294. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  295. package/background/src/lib/virtualized/project/runAnalysis.js +3 -0
  296. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  297. package/background/src/lib/virtualized/project/start.js +34 -11
  298. package/background/src/lib/virtualized/project/start.js.map +1 -1
  299. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  300. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  301. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  302. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  303. package/background/src/lib/virtualized/project/writeMockDataTsx.js +263 -6
  304. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  305. package/background/src/lib/virtualized/project/writeScenarioComponents.js +200 -35
  306. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  307. package/background/src/lib/virtualized/project/writeSimpleRoot.js +21 -11
  308. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  309. package/codeyam-cli/scripts/apply-setup.js +386 -9
  310. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  311. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  312. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  313. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  314. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  315. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  316. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  317. package/codeyam-cli/src/cli.js +35 -24
  318. package/codeyam-cli/src/cli.js.map +1 -1
  319. package/codeyam-cli/src/codeyam-cli.js +18 -2
  320. package/codeyam-cli/src/codeyam-cli.js.map +1 -1
  321. package/codeyam-cli/src/commands/analyze.js +21 -9
  322. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  323. package/codeyam-cli/src/commands/baseline.js +2 -0
  324. package/codeyam-cli/src/commands/baseline.js.map +1 -1
  325. package/codeyam-cli/src/commands/debug.js +9 -5
  326. package/codeyam-cli/src/commands/debug.js.map +1 -1
  327. package/codeyam-cli/src/commands/default.js +37 -21
  328. package/codeyam-cli/src/commands/default.js.map +1 -1
  329. package/codeyam-cli/src/commands/editor.js +1982 -0
  330. package/codeyam-cli/src/commands/editor.js.map +1 -0
  331. package/codeyam-cli/src/commands/init.js +81 -260
  332. package/codeyam-cli/src/commands/init.js.map +1 -1
  333. package/codeyam-cli/src/commands/memory.js +278 -0
  334. package/codeyam-cli/src/commands/memory.js.map +1 -0
  335. package/codeyam-cli/src/commands/recapture.js +2 -0
  336. package/codeyam-cli/src/commands/recapture.js.map +1 -1
  337. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  338. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  339. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  340. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  341. package/codeyam-cli/src/commands/test-startup.js +2 -0
  342. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  343. package/codeyam-cli/src/commands/verify.js +14 -2
  344. package/codeyam-cli/src/commands/verify.js.map +1 -1
  345. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +246 -0
  346. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  347. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +126 -0
  348. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  349. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +295 -0
  350. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  351. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  352. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  353. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +100 -0
  354. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  355. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +147 -0
  356. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  357. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +76 -0
  358. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  359. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  360. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  361. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  362. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  363. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  364. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  365. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  366. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  367. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  368. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  369. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +154 -82
  370. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  371. package/codeyam-cli/src/utils/analysisRunner.js +21 -2
  372. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  373. package/codeyam-cli/src/utils/analyzer.js +7 -0
  374. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  375. package/codeyam-cli/src/utils/backgroundServer.js +109 -22
  376. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  377. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  378. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  379. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  380. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  381. package/codeyam-cli/src/utils/editorAudit.js +82 -0
  382. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  383. package/codeyam-cli/src/utils/editorDevServer.js +98 -0
  384. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  385. package/codeyam-cli/src/utils/editorJournal.js +137 -0
  386. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  387. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  388. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  389. package/codeyam-cli/src/utils/editorPreloadHelpers.js +64 -0
  390. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  391. package/codeyam-cli/src/utils/editorPreview.js +66 -0
  392. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  393. package/codeyam-cli/src/utils/editorScenarios.js +56 -0
  394. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  395. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  396. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  397. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  398. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  399. package/codeyam-cli/src/utils/generateReport.js +2 -2
  400. package/codeyam-cli/src/utils/git.js +103 -0
  401. package/codeyam-cli/src/utils/git.js.map +1 -1
  402. package/codeyam-cli/src/utils/install-skills.js +120 -39
  403. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  404. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  405. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  406. package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
  407. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
  408. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  409. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  410. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  411. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  412. package/codeyam-cli/src/utils/progress.js +7 -0
  413. package/codeyam-cli/src/utils/progress.js.map +1 -1
  414. package/codeyam-cli/src/utils/project.js +15 -5
  415. package/codeyam-cli/src/utils/project.js.map +1 -1
  416. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  417. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  418. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  419. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  420. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  421. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  422. package/codeyam-cli/src/utils/queue/job.js +75 -1
  423. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  424. package/codeyam-cli/src/utils/queue/manager.js +7 -0
  425. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  426. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  427. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  428. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  429. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  430. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +229 -0
  431. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  432. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  433. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  434. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  435. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  436. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  437. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  438. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  439. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  440. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
  441. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  442. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
  443. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  444. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +113 -0
  445. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  446. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  447. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  448. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  449. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  450. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  451. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  452. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  453. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  454. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  455. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  456. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  457. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  458. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  459. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  460. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  461. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  462. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  463. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  464. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  465. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  466. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  467. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  468. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  469. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  470. package/codeyam-cli/src/utils/rules/index.js +7 -0
  471. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  472. package/codeyam-cli/src/utils/rules/parser.js +93 -0
  473. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  474. package/codeyam-cli/src/utils/rules/pathMatcher.js +49 -0
  475. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  476. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  477. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  478. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  479. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  480. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  481. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  482. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  483. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  484. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  485. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  486. package/codeyam-cli/src/utils/serverState.js +64 -12
  487. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  488. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +61 -41
  489. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  490. package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
  491. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  492. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  493. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  494. package/codeyam-cli/src/utils/testRunner.js +158 -0
  495. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  496. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  497. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  498. package/codeyam-cli/src/utils/versionInfo.js +46 -0
  499. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  500. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  501. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  502. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  503. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  504. package/codeyam-cli/src/webserver/app/lib/database.js +63 -33
  505. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  506. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  507. package/codeyam-cli/src/webserver/backgroundServer.js +166 -16
  508. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  509. package/codeyam-cli/src/webserver/bootstrap.js +51 -0
  510. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  511. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-DmJveP3T.js +1 -0
  512. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-C76mRRiF.js +11 -0
  513. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-COi5OvsN.js → EntityTypeBadge-g3saevPb.js} +1 -1
  514. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BwdQv49w.js → EntityTypeIcon-CobE682z.js} +1 -1
  515. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  516. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D68KarMg.js → InteractivePreview-DYFW3lDD.js} +3 -3
  517. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-L75Wvqgw.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  518. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-C53WM8qn.js → LoadingDots-BU_OAEMP.js} +1 -1
  519. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CrNkmy4i.js → LogViewer-ceAyBX-H.js} +1 -1
  520. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-djPLI-WV.js +11 -0
  521. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CQifa1n-.js → SafeScreenshot-BED4B6sP.js} +1 -1
  522. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CyaBFX7l.js → ScenarioViewer-B76aig_2.js} +3 -13
  523. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  524. package/codeyam-cli/src/webserver/build/client/assets/Terminal-nZNBALox.js +41 -0
  525. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D36O1rzU.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  526. package/codeyam-cli/src/webserver/build/client/assets/_index-C96V0n15.js +11 -0
  527. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BpKzcsJz.js +27 -0
  528. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-CUXOrorO.js +1 -0
  529. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  530. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
  531. package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
  532. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  533. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  534. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  535. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  536. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  537. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  538. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  539. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  540. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  541. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  542. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  543. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  544. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  545. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  546. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  547. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  548. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  549. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  550. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  551. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  552. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  553. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  554. package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
  555. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  556. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  557. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  558. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  559. package/codeyam-cli/src/webserver/build/client/assets/book-open-D_nMCFmP.js +6 -0
  560. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DgTPh8H-.js → chevron-down-BH2h1Ea2.js} +1 -1
  561. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-DdQKK6on.js → chunk-JZWAC4HX-C4pqxYJB.js} +12 -12
  562. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-Dmr2bb1R.js → circle-check-DyIKORY6.js} +1 -1
  563. package/codeyam-cli/src/webserver/build/client/assets/copy-NDbZjXao.js +11 -0
  564. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Do4ZLUYa.js → createLucideIcon-CMT1jU2q.js} +1 -1
  565. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BiM6z3Do.js +1 -0
  566. package/codeyam-cli/src/webserver/build/client/assets/editor-B2KwhQph.js +8 -0
  567. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CbdFyxZh.js → entity._sha._-CrjR3zZW.js} +12 -12
  568. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-DjACbfdI.js +6 -0
  569. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C28BiQzt.js +6 -0
  570. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  571. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMbl7MeQ.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  572. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-5wRKRIH9.js → entry.client-DTvKq3TY.js} +1 -1
  573. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DD3SDH7t.js → fileTableUtils-cPo8LiG3.js} +1 -1
  574. package/codeyam-cli/src/webserver/build/client/assets/files-DO4CZ16O.js +1 -0
  575. package/codeyam-cli/src/webserver/build/client/assets/{git-zXjT7J0G.js → git-CFCTYk9I.js} +8 -8
  576. package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +1 -0
  577. package/codeyam-cli/src/webserver/build/client/assets/{index-DLbXwndH.js → index-10oVnAAH.js} +1 -1
  578. package/codeyam-cli/src/webserver/build/client/assets/{index-gPZ-lad1.js → index-BcvgDzbZ.js} +1 -1
  579. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  580. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BsPXJ81F.js → loader-circle-BAXYRVEO.js} +1 -1
  581. package/codeyam-cli/src/webserver/build/client/assets/manifest-af20abcd.js +1 -0
  582. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
  583. package/codeyam-cli/src/webserver/build/client/assets/pause-DTAcYxBt.js +11 -0
  584. package/codeyam-cli/src/webserver/build/client/assets/root-DUKqhFlb.js +67 -0
  585. package/codeyam-cli/src/webserver/build/client/assets/{search-P2FKIUql.js → search-fKo7v0Zo.js} +1 -1
  586. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
  587. package/codeyam-cli/src/webserver/build/client/assets/{simulations-L18M6-kN.js → simulations-B3aOzpCZ.js} +1 -1
  588. package/codeyam-cli/src/webserver/build/client/assets/terminal-BG4heKCG.js +11 -0
  589. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BDz7kbVA.js → triangle-alert-DtSmdtM4.js} +1 -1
  590. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-29dDmbH8.js → useCustomSizes-ByhSyh0W.js} +1 -1
  591. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  592. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CkIOKTrZ.js → useReportContext-O-jkvSPx.js} +1 -1
  593. package/codeyam-cli/src/webserver/build/client/assets/{useToast-KKw5kTn-.js → useToast-9FIWuYfK.js} +1 -1
  594. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  595. package/codeyam-cli/src/webserver/build/server/assets/index-D_kZbNJs.js +1 -0
  596. package/codeyam-cli/src/webserver/build/server/assets/server-build-CWy5OIH9.js +366 -0
  597. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  598. package/codeyam-cli/src/webserver/build-info.json +5 -5
  599. package/codeyam-cli/src/webserver/devServer.js +39 -5
  600. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  601. package/codeyam-cli/src/webserver/editorProxy.js +440 -0
  602. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  603. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +175 -0
  604. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +140 -0
  605. package/codeyam-cli/src/webserver/server.js +226 -1
  606. package/codeyam-cli/src/webserver/server.js.map +1 -1
  607. package/codeyam-cli/src/webserver/terminalServer.js +698 -0
  608. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  609. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  610. package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
  611. package/codeyam-cli/templates/commands/codeyam-diagnose.md +481 -0
  612. package/codeyam-cli/templates/editor-step-hook.py +147 -0
  613. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  614. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  615. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  616. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  617. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  618. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  619. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  620. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  621. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  622. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  623. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  624. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  625. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  626. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  627. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +43 -0
  628. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  629. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +35 -0
  630. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  631. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  632. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  633. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  634. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  635. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  636. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  637. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  638. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  639. package/codeyam-cli/templates/rule-notification-hook.py +83 -0
  640. package/codeyam-cli/templates/rule-reflection-hook.py +647 -0
  641. package/codeyam-cli/templates/rules-instructions.md +78 -0
  642. package/codeyam-cli/templates/{codeyam:debug.md → skills/codeyam-debug/SKILL.md} +48 -4
  643. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  644. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +69 -0
  645. package/codeyam-cli/templates/skills/codeyam-memory/SKILL.md +611 -0
  646. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  647. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  648. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  649. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  650. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  651. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  652. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  653. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  654. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  655. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  656. package/codeyam-cli/templates/skills/codeyam-new-rule/SKILL.md +11 -0
  657. package/codeyam-cli/templates/{codeyam:setup.md → skills/codeyam-setup/SKILL.md} +13 -1
  658. package/codeyam-cli/templates/{codeyam:sim.md → skills/codeyam-sim/SKILL.md} +1 -1
  659. package/codeyam-cli/templates/{codeyam:test.md → skills/codeyam-test/SKILL.md} +1 -1
  660. package/codeyam-cli/templates/{codeyam:verify.md → skills/codeyam-verify/SKILL.md} +1 -1
  661. package/package.json +27 -22
  662. package/packages/ai/index.js +7 -3
  663. package/packages/ai/index.js.map +1 -1
  664. package/packages/ai/src/lib/analyzeScope.js +91 -30
  665. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  666. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  667. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  668. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +100 -12
  669. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  670. package/packages/ai/src/lib/astScopes/methodSemantics.js +109 -23
  671. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  672. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  673. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  674. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +1 -102
  675. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  676. package/packages/ai/src/lib/astScopes/processExpression.js +518 -28
  677. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  678. package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
  679. package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
  680. package/packages/ai/src/lib/completionCall.js +171 -37
  681. package/packages/ai/src/lib/completionCall.js.map +1 -1
  682. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1082 -174
  683. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  684. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  685. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  686. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +179 -0
  687. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
  688. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
  689. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  690. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  691. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  692. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  693. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  694. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +52 -3
  695. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  696. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +106 -13
  697. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  698. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  699. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  700. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  701. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  702. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +122 -12
  703. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  704. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  705. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  706. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  707. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  708. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -86
  709. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  710. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  711. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  712. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  713. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  714. package/packages/ai/src/lib/dataStructureChunking.js +130 -0
  715. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  716. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  717. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  718. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  719. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  720. package/packages/ai/src/lib/generateEntityDataStructure.js +46 -2
  721. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  722. package/packages/ai/src/lib/generateEntityScenarioData.js +789 -8
  723. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  724. package/packages/ai/src/lib/generateEntityScenarios.js +26 -2
  725. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  726. package/packages/ai/src/lib/generateExecutionFlows.js +376 -4
  727. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  728. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1124 -59
  729. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  730. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  731. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  732. package/packages/ai/src/lib/isolateScopes.js +39 -3
  733. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  734. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
  735. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
  736. package/packages/ai/src/lib/mergeStatements.js +70 -51
  737. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  738. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
  739. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
  740. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
  741. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  742. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  743. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  744. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +30 -7
  745. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  746. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  747. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  748. package/packages/ai/src/lib/resolvePathToControllable.js +155 -41
  749. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
  750. package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
  751. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  752. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  753. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  754. package/packages/analyze/index.js +1 -0
  755. package/packages/analyze/index.js.map +1 -1
  756. package/packages/analyze/src/lib/FileAnalyzer.js +60 -36
  757. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  758. package/packages/analyze/src/lib/ProjectAnalyzer.js +109 -30
  759. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  760. package/packages/analyze/src/lib/analysisContext.js +30 -5
  761. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  762. package/packages/analyze/src/lib/asts/index.js +4 -2
  763. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  764. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  765. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  766. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  767. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  768. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  769. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  770. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  771. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  772. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  773. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  774. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  775. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  776. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  777. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  778. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +72 -10
  779. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  780. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +24 -4
  781. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  782. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  783. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  784. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  785. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  786. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
  787. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  788. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  789. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  790. package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
  791. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  792. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +907 -0
  793. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  794. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +164 -68
  795. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  796. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +75 -21
  797. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  798. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +250 -20
  799. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  800. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +57 -9
  801. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  802. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +558 -55
  803. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  804. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  805. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  806. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  807. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  808. package/packages/analyze/src/lib/index.js +1 -0
  809. package/packages/analyze/src/lib/index.js.map +1 -1
  810. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  811. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  812. package/packages/database/index.js +1 -0
  813. package/packages/database/index.js.map +1 -1
  814. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  815. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  816. package/packages/database/src/lib/analysisToDb.js +1 -1
  817. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  818. package/packages/database/src/lib/branchToDb.js +1 -1
  819. package/packages/database/src/lib/branchToDb.js.map +1 -1
  820. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  821. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  822. package/packages/database/src/lib/commitToDb.js +1 -1
  823. package/packages/database/src/lib/commitToDb.js.map +1 -1
  824. package/packages/database/src/lib/fileToDb.js +1 -1
  825. package/packages/database/src/lib/fileToDb.js.map +1 -1
  826. package/packages/database/src/lib/kysely/db.js +16 -1
  827. package/packages/database/src/lib/kysely/db.js.map +1 -1
  828. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  829. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  830. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  831. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  832. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  833. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  834. package/packages/database/src/lib/loadAnalyses.js +45 -2
  835. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  836. package/packages/database/src/lib/loadAnalysis.js +8 -0
  837. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  838. package/packages/database/src/lib/loadBranch.js +11 -1
  839. package/packages/database/src/lib/loadBranch.js.map +1 -1
  840. package/packages/database/src/lib/loadCommit.js +7 -0
  841. package/packages/database/src/lib/loadCommit.js.map +1 -1
  842. package/packages/database/src/lib/loadCommits.js +45 -14
  843. package/packages/database/src/lib/loadCommits.js.map +1 -1
  844. package/packages/database/src/lib/loadEntities.js +23 -4
  845. package/packages/database/src/lib/loadEntities.js.map +1 -1
  846. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  847. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  848. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  849. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  850. package/packages/database/src/lib/projectToDb.js +1 -1
  851. package/packages/database/src/lib/projectToDb.js.map +1 -1
  852. package/packages/database/src/lib/saveFiles.js +1 -1
  853. package/packages/database/src/lib/saveFiles.js.map +1 -1
  854. package/packages/database/src/lib/scenarioToDb.js +1 -1
  855. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  856. package/packages/database/src/lib/updateCommitMetadata.js +100 -88
  857. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  858. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  859. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  860. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  861. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  862. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  863. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  864. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  865. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  866. package/packages/types/index.js.map +1 -1
  867. package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
  868. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  869. package/packages/utils/src/lib/safeFileName.js +29 -3
  870. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  871. package/scripts/npm-post-install.cjs +34 -0
  872. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
  873. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  874. package/codeyam-cli/src/commands/list.js +0 -31
  875. package/codeyam-cli/src/commands/list.js.map +0 -1
  876. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  877. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  878. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  879. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  880. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +0 -1
  881. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CEleMv_j.js +0 -34
  882. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +0 -11
  883. package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +0 -11
  884. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +0 -37
  885. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +0 -1
  886. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js +0 -6
  887. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-wDWZZO1W.js +0 -6
  888. package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +0 -1
  889. package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +0 -1
  890. package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +0 -1
  891. package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +0 -57
  892. package/codeyam-cli/src/webserver/build/client/assets/settings-B2eDuBj8.js +0 -1
  893. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-BUm0UVJm.js +0 -2
  894. package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +0 -1
  895. package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +0 -228
  896. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  897. package/codeyam-cli/templates/codeyam:diagnose.md +0 -625
  898. package/scripts/finalize-analyzer.cjs +0 -81
@@ -1,11 +1,20 @@
1
1
  import completionCall from "./completionCall.js";
2
2
  import generateEntityScenarioDataGenerator from "./promptGenerators/generateEntityScenarioDataGenerator.js";
3
3
  import generateMissingKeysPrompt from "./promptGenerators/generateMissingKeysPrompt.js";
4
+ import generateChunkPrompt from "./promptGenerators/generateChunkPrompt.js";
4
5
  import { saveLlmCall } from "../../../../packages/aws/dynamodb/index.js";
6
+ import { trackDataSnapshot } from "./e2eDataTracking.js";
5
7
  import validateJson from "./validateJson.js";
6
8
  import { awsLog, awsLogDebugLevel } from "../../../../packages/utils/index.js";
7
9
  import { parseJsonSafe } from "../../../../packages/ai/index.js";
8
10
  import convertNullToUndefinedBySchema from "./dataStructure/helpers/convertNullToUndefinedBySchema.js";
11
+ import convertTypeAnnotationsToValues from "./dataStructure/helpers/convertTypeAnnotationsToValues.js";
12
+ import fixNullIdsBySchema from "./dataStructure/helpers/fixNullIdsBySchema.js";
13
+ import coerceObjectsToPrimitivesBySchema from "./dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js";
14
+ import coercePrimitivesToArraysBySchema from "./dataStructure/helpers/coercePrimitivesToArraysBySchema.js";
15
+ import stripNullableMarkers from "./dataStructure/helpers/stripNullableMarkers.js";
16
+ import { deepMerge } from "../../../../packages/generate/index.js";
17
+ import { chunkDataStructure, getRequiredValuesForChunk, } from "./dataStructureChunking.js";
9
18
  /**
10
19
  * Check if any of the scenario's covered flows require error data.
11
20
  * Returns true if any requiredValue has an error path with truthy comparison.
@@ -90,6 +99,454 @@ function deepMergeScenarioData(defaultData, scenarioData) {
90
99
  return result;
91
100
  }
92
101
  const DEFAULT_SCENARIO_NAME = 'Default Scenario';
102
+ /**
103
+ * Find the path to a key within a nested dataForMocks structure.
104
+ * Returns the path as an array of keys, or null if not found.
105
+ *
106
+ * @example
107
+ * // dataForMocks = { trpc: { fastener: { "useMutation()": { isLoading: "boolean" } } } }
108
+ * // findKeyPath("fastener", dataForMocks) returns ["trpc"]
109
+ */
110
+ function findKeyPath(targetKey, obj, currentPath = []) {
111
+ if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
112
+ return null;
113
+ }
114
+ for (const key of Object.keys(obj)) {
115
+ if (key === targetKey) {
116
+ return currentPath;
117
+ }
118
+ // Recursively search in nested objects
119
+ const nested = obj[key];
120
+ if (typeof nested === 'object' &&
121
+ nested !== null &&
122
+ !Array.isArray(nested)) {
123
+ const result = findKeyPath(targetKey, nested, [
124
+ ...currentPath,
125
+ key,
126
+ ]);
127
+ if (result !== null) {
128
+ return result;
129
+ }
130
+ }
131
+ }
132
+ return null;
133
+ }
134
+ /**
135
+ * Strip primitive values from `source` when the `destination` already has an
136
+ * array or object at the same key. Returns a cleaned copy of source (or null
137
+ * if nothing remains after stripping).
138
+ *
139
+ * This prevents misplaced LLM data (e.g., `{ webapps: true }`) from
140
+ * overwriting correct complex values (e.g., `{ webapps: [...] }`) during
141
+ * deep merge in relocateMisplacedNestedKeys.
142
+ */
143
+ function stripPrimitivesOverwritingComplexValues(destination, source) {
144
+ if (typeof source !== 'object' || source === null || Array.isArray(source)) {
145
+ return null;
146
+ }
147
+ const result = {};
148
+ let hasKeys = false;
149
+ for (const key of Object.keys(source)) {
150
+ const srcVal = source[key];
151
+ const dstVal = destination[key];
152
+ // If destination has an array or object but source has a primitive, skip it
153
+ if (typeof dstVal === 'object' &&
154
+ dstVal !== null &&
155
+ typeof srcVal !== 'object') {
156
+ continue;
157
+ }
158
+ result[key] = srcVal;
159
+ hasKeys = true;
160
+ }
161
+ return hasKeys ? result : null;
162
+ }
163
+ /**
164
+ * Relocate misplaced nested keys in mockData to their correct position
165
+ * based on the dataForMocks structure.
166
+ *
167
+ * When the LLM returns mockData with keys at the wrong nesting level
168
+ * (e.g., { trpc: { quote: {...} }, fastener: {...} } when fastener should
169
+ * be inside trpc), this function moves them to the correct position.
170
+ *
171
+ * This function works recursively to handle nested misplacements, not just
172
+ * root-level ones. For example, if getQuote is at trpc.getQuote instead of
173
+ * trpc.quote.getQuote, it will be relocated.
174
+ *
175
+ * @example
176
+ * // dataForMocks: { trpc: { quote: {...}, fastener: {...} } }
177
+ * // mockData: { trpc: { quote: {...} }, fastener: {...} }
178
+ * // After: mockData: { trpc: { quote: {...}, fastener: {...} } }
179
+ *
180
+ * @example (nested case)
181
+ * // dataForMocks: { trpc: { quote: { getQuote: {...} } } }
182
+ * // mockData: { trpc: { quote: {...}, getQuote: {...} } }
183
+ * // After: mockData: { trpc: { quote: { getQuote: {...} } } }
184
+ */
185
+ function relocateMisplacedNestedKeys(mockData, dataForMocks, currentPathForLogging = []) {
186
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
187
+ return;
188
+ }
189
+ const keysInSchema = Object.keys(dataForMocks);
190
+ const keysToRelocate = [];
191
+ // Find keys in mockData that are NOT at this level in dataForMocks
192
+ // but DO exist somewhere nested in dataForMocks
193
+ for (const key of Object.keys(mockData)) {
194
+ if (!keysInSchema.includes(key)) {
195
+ // This key is at this level in mockData but not at this level in dataForMocks
196
+ // Check if it exists somewhere nested in dataForMocks
197
+ const path = findKeyPath(key, dataForMocks);
198
+ if (path !== null && path.length > 0) {
199
+ keysToRelocate.push({ key, path });
200
+ }
201
+ }
202
+ }
203
+ // Relocate each misplaced key to its correct nested position
204
+ for (const { key, path } of keysToRelocate) {
205
+ const value = mockData[key];
206
+ // Navigate to the correct parent in mockData, creating nested objects if needed
207
+ let current = mockData;
208
+ for (const pathKey of path) {
209
+ if (current[pathKey] === undefined) {
210
+ current[pathKey] = {};
211
+ }
212
+ current = current[pathKey];
213
+ }
214
+ // Deep merge the value into the correct location
215
+ // Use deep merge to preserve existing data at that location.
216
+ // Before merging, strip primitives from the misplaced value that would
217
+ // overwrite arrays/objects at the destination. The misplaced data is lower
218
+ // quality — the LLM put it in the wrong place — so primitives like `true`
219
+ // should not overwrite correct complex values like arrays.
220
+ if (current[key] !== undefined && typeof current[key] === 'object') {
221
+ const safeValue = stripPrimitivesOverwritingComplexValues(current[key], value);
222
+ if (safeValue !== null) {
223
+ current[key] = deepMerge(current[key], safeValue);
224
+ }
225
+ }
226
+ else {
227
+ current[key] = value;
228
+ }
229
+ // Remove the key from its current (wrong) level
230
+ delete mockData[key];
231
+ const fullPath = [...currentPathForLogging, ...path].join('.');
232
+ awsLog(`CodeYam: Relocated misplaced key "${key}" from [${currentPathForLogging.join('.')}] to [${fullPath}]`);
233
+ }
234
+ // Recursively process nested objects to handle deeply nested misplacements
235
+ for (const key of Object.keys(mockData)) {
236
+ const mockValue = mockData[key];
237
+ const schemaValue = dataForMocks[key];
238
+ // Only recurse if both mockData and schema have nested objects at this key
239
+ if (typeof mockValue === 'object' &&
240
+ mockValue !== null &&
241
+ !Array.isArray(mockValue) &&
242
+ typeof schemaValue === 'object' &&
243
+ schemaValue !== null &&
244
+ !Array.isArray(schemaValue)) {
245
+ relocateMisplacedNestedKeys(mockValue, schemaValue, [...currentPathForLogging, key]);
246
+ }
247
+ }
248
+ }
249
+ /**
250
+ * Generate default mock data for a schema type.
251
+ * Returns reasonable default values based on the schema type string.
252
+ */
253
+ function generateDefaultForSchemaType(schemaType) {
254
+ if (typeof schemaType === 'string') {
255
+ // Handle common type strings
256
+ if (schemaType === 'function')
257
+ return () => { };
258
+ if (schemaType === 'promise')
259
+ return Promise.resolve();
260
+ if (schemaType === 'boolean')
261
+ return false;
262
+ if (schemaType === 'string')
263
+ return '';
264
+ if (schemaType === 'number')
265
+ return 0;
266
+ if (schemaType.includes('number | undefined'))
267
+ return undefined;
268
+ if (schemaType.includes('string | undefined'))
269
+ return undefined;
270
+ if (schemaType.includes('boolean | undefined'))
271
+ return undefined;
272
+ if (schemaType.includes('| undefined'))
273
+ return undefined;
274
+ if (schemaType.includes('| null'))
275
+ return null;
276
+ return schemaType; // Return the type as a string placeholder
277
+ }
278
+ if (Array.isArray(schemaType)) {
279
+ if (schemaType.length === 0)
280
+ return [];
281
+ // Generate a single default element based on the first element's schema
282
+ const elementDefault = generateDefaultForSchemaType(schemaType[0]);
283
+ return elementDefault !== undefined ? [elementDefault] : [];
284
+ }
285
+ if (typeof schemaType === 'object' && schemaType !== null) {
286
+ // Recursively generate defaults for nested objects
287
+ const result = {};
288
+ for (const [key, value] of Object.entries(schemaType)) {
289
+ result[key] = generateDefaultForSchemaType(value);
290
+ }
291
+ return result;
292
+ }
293
+ return undefined;
294
+ }
295
+ /**
296
+ * Detect if a string should be converted to an array.
297
+ * Returns the array if the field appears to be an array field, or null if it should remain a string.
298
+ *
299
+ * This handles two cases:
300
+ * 1. Comma-separated values: "color,size" -> ["color", "size"]
301
+ * 2. Single values for array-named fields: "Finish" -> ["Finish"]
302
+ */
303
+ function parseCommaSeparatedStringAsArray(value, key) {
304
+ // Heuristic: if the key name suggests it's an array field, convert it
305
+ // Common patterns: *_attributes, *_ids, *_items, *_tags, *_values, plural names
306
+ // Check this FIRST because array-named fields should be converted regardless
307
+ // of whether they contain commas (single values become single-element arrays).
308
+ const arrayFieldPatterns = [
309
+ /_attributes$/i,
310
+ /_ids$/i,
311
+ /_items$/i,
312
+ /_tags$/i,
313
+ /_values$/i,
314
+ /_types$/i,
315
+ /_names$/i,
316
+ /_keys$/i,
317
+ /^attributes$/i,
318
+ /^items$/i,
319
+ /^tags$/i,
320
+ /^values$/i,
321
+ ];
322
+ const looksLikeArrayField = arrayFieldPatterns.some((pattern) => pattern.test(key));
323
+ if (looksLikeArrayField) {
324
+ // Skip newlines check - multiline values shouldn't be split
325
+ if (value.includes('\n')) {
326
+ return null;
327
+ }
328
+ // Split by comma and trim whitespace
329
+ const parts = value.split(',').map((s) => s.trim());
330
+ // Filter out empty strings - this handles both "Finish" -> ["Finish"]
331
+ // and "" -> []
332
+ return parts.filter((s) => s.length > 0);
333
+ }
334
+ // For non-array-named fields, only convert if there are commas
335
+ if (!value.includes(',')) {
336
+ return null;
337
+ }
338
+ // For non-array-named fields, apply stricter sentence detection
339
+ // Skip if it looks like a sentence (comma followed by space and lowercase)
340
+ if (/,\s+[a-z]/.test(value)) {
341
+ return null;
342
+ }
343
+ // Skip if it contains newlines (likely formatted text)
344
+ if (value.includes('\n')) {
345
+ return null;
346
+ }
347
+ return null;
348
+ }
349
+ /**
350
+ * Convert comma-separated string values to arrays when they look like array data.
351
+ * This handles cases where the LLM generates strings like "color,size" instead
352
+ * of arrays like ["color", "size"] due to schema type misdetection.
353
+ */
354
+ function convertCommaSeparatedStringsToArrays(mockData) {
355
+ for (const [key, value] of Object.entries(mockData)) {
356
+ if (typeof value === 'string') {
357
+ const asArray = parseCommaSeparatedStringAsArray(value, key);
358
+ if (asArray !== null) {
359
+ mockData[key] = asArray;
360
+ awsLog(`CodeYam: Converted comma-separated string to array for key "${key}": "${value}" -> [${asArray.map((s) => `"${s}"`).join(', ')}]`);
361
+ }
362
+ }
363
+ else if (value !== null &&
364
+ typeof value === 'object' &&
365
+ !Array.isArray(value)) {
366
+ // Recursively process nested objects
367
+ convertCommaSeparatedStringsToArrays(value);
368
+ }
369
+ else if (Array.isArray(value)) {
370
+ // Recursively process arrays (each element could be an object)
371
+ for (const item of value) {
372
+ if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
373
+ convertCommaSeparatedStringsToArrays(item);
374
+ }
375
+ }
376
+ }
377
+ }
378
+ }
379
+ /**
380
+ * Ensure all keys from dataForMocks have corresponding data in mockData.
381
+ * For missing keys, generate default values based on the schema.
382
+ * Recursively checks nested objects to fill in any missing nested fields.
383
+ */
384
+ function fillMissingMockDataKeysWithDefaults(mockData, dataForMocks, pathPrefix = '') {
385
+ if (typeof dataForMocks !== 'object' || dataForMocks === null) {
386
+ return;
387
+ }
388
+ const missingKeys = [];
389
+ for (const key of Object.keys(dataForMocks)) {
390
+ if (key === '_nullable')
391
+ continue; // Internal marker, not a data key
392
+ const fullPath = pathPrefix ? `${pathPrefix}.${key}` : key;
393
+ if (mockData[key] === undefined) {
394
+ missingKeys.push(fullPath);
395
+ // Generate default data based on schema
396
+ const schemaForKey = dataForMocks[key];
397
+ mockData[key] = generateDefaultForSchemaType(schemaForKey);
398
+ }
399
+ else {
400
+ // Key exists, but if both are objects, recursively check for missing nested keys
401
+ const schemaValue = dataForMocks[key];
402
+ const mockValue = mockData[key];
403
+ if (typeof schemaValue === 'object' &&
404
+ schemaValue !== null &&
405
+ !Array.isArray(schemaValue) &&
406
+ typeof mockValue === 'object' &&
407
+ mockValue !== null &&
408
+ !Array.isArray(mockValue)) {
409
+ fillMissingMockDataKeysWithDefaults(mockValue, schemaValue, fullPath);
410
+ }
411
+ }
412
+ }
413
+ if (missingKeys.length > 0) {
414
+ awsLog(`CodeYam: Generated default mock data for ${missingKeys.length} missing key(s): ${missingKeys.slice(0, 10).join(', ')}${missingKeys.length > 10 ? '...' : ''}`);
415
+ }
416
+ }
417
+ /**
418
+ * Enforce execution flow requiredValues by setting falsy paths to null.
419
+ *
420
+ * The LLM doesn't reliably generate null for `comparison: 'falsy'` requirements.
421
+ * For example, a flow like "diffView: falsy" should hide a modal, but the LLM
422
+ * might generate a truthy object, causing the modal to show in all screenshots.
423
+ *
424
+ * This function:
425
+ * 1. Gets requiredValues from covered flows
426
+ * 2. For 'falsy' comparisons: sets the value to null
427
+ * 3. For 'truthy' comparisons with falsy values: generates a default truthy value
428
+ */
429
+ function enforceRequiredValues(mockData, coveredFlowIds, executionFlows) {
430
+ if (!coveredFlowIds.length || !executionFlows.length) {
431
+ return;
432
+ }
433
+ // Get all requiredValues from covered flows
434
+ const coveredFlows = executionFlows.filter((flow) => coveredFlowIds.includes(flow.id));
435
+ for (const flow of coveredFlows) {
436
+ if (!flow.requiredValues)
437
+ continue;
438
+ for (const rv of flow.requiredValues) {
439
+ if (!rv.attributePath)
440
+ continue;
441
+ // Find the value in mockData - the path could be nested
442
+ // e.g., attributePath: "diffView" could be at mockData['useDiffModal()'].diffView
443
+ const result = findAndSetValueInMockData(mockData, rv.attributePath, rv.comparison, rv.valueType);
444
+ if (result.found) {
445
+ awsLog(`CodeYam: Enforced ${rv.comparison} for ${rv.attributePath} (set to ${result.newValue === null ? 'null' : typeof result.newValue})`);
446
+ }
447
+ }
448
+ }
449
+ }
450
+ /**
451
+ * Find a value in mockData by attributePath and enforce the comparison.
452
+ * The attributePath could be a simple key or a nested path.
453
+ *
454
+ * Returns { found: boolean, newValue: unknown }
455
+ */
456
+ function findAndSetValueInMockData(mockData, attributePath, comparison, valueType) {
457
+ // Try to find the path at various nesting levels
458
+ // The attributePath might be "diffView" but the actual location is
459
+ // mockData['useDiffModal()'].diffView
460
+ // Strategy 1: Direct path (e.g., mockData[attributePath])
461
+ if (attributePath in mockData) {
462
+ const currentValue = mockData[attributePath];
463
+ const { shouldChange, newValue } = getEnforcedValue(currentValue, comparison, valueType);
464
+ if (shouldChange) {
465
+ mockData[attributePath] = newValue;
466
+ return { found: true, newValue };
467
+ }
468
+ return { found: true, newValue: currentValue };
469
+ }
470
+ // Strategy 2: Search in nested objects
471
+ for (const [key, value] of Object.entries(mockData)) {
472
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
473
+ const nestedObj = value;
474
+ // Check if attributePath exists in this nested object
475
+ if (attributePath in nestedObj) {
476
+ const currentValue = nestedObj[attributePath];
477
+ const { shouldChange, newValue } = getEnforcedValue(currentValue, comparison, valueType);
478
+ if (shouldChange) {
479
+ nestedObj[attributePath] = newValue;
480
+ return { found: true, newValue };
481
+ }
482
+ return { found: true, newValue: currentValue };
483
+ }
484
+ // Also check dot-notation paths (e.g., "diffView.type")
485
+ if (attributePath.includes('.')) {
486
+ const parts = attributePath.split('.');
487
+ const firstPart = parts[0];
488
+ if (firstPart in nestedObj) {
489
+ // Recurse with the rest of the path
490
+ const result = findAndSetValueInMockData(nestedObj, attributePath, comparison, valueType);
491
+ if (result.found)
492
+ return result;
493
+ }
494
+ }
495
+ // Recursively search deeper
496
+ const result = findAndSetValueInMockData(nestedObj, attributePath, comparison, valueType);
497
+ if (result.found)
498
+ return result;
499
+ }
500
+ }
501
+ return { found: false };
502
+ }
503
+ /**
504
+ * Determine if a value should be changed to match a comparison requirement.
505
+ *
506
+ * For 'falsy' comparison: truthy values should become null
507
+ * For 'truthy' comparison: falsy values should become a default truthy value
508
+ */
509
+ function getEnforcedValue(currentValue, comparison, valueType) {
510
+ const isTruthy = Boolean(currentValue);
511
+ if (comparison === 'falsy') {
512
+ // Value should be falsy
513
+ if (isTruthy) {
514
+ return { shouldChange: true, newValue: null };
515
+ }
516
+ return { shouldChange: false, newValue: currentValue };
517
+ }
518
+ if (comparison === 'truthy') {
519
+ // Value should be truthy
520
+ if (!isTruthy) {
521
+ // Generate a default truthy value based on valueType
522
+ const defaultValue = generateDefaultTruthyValue(valueType);
523
+ return { shouldChange: true, newValue: defaultValue };
524
+ }
525
+ return { shouldChange: false, newValue: currentValue };
526
+ }
527
+ // For other comparisons (equals, exists, etc.), don't auto-enforce
528
+ return { shouldChange: false, newValue: currentValue };
529
+ }
530
+ /**
531
+ * Generate a default truthy value for a given type.
532
+ */
533
+ function generateDefaultTruthyValue(valueType) {
534
+ if (!valueType)
535
+ return { _placeholder: true };
536
+ switch (valueType.toLowerCase()) {
537
+ case 'string':
538
+ return 'default-value';
539
+ case 'number':
540
+ return 1;
541
+ case 'boolean':
542
+ return true;
543
+ case 'array':
544
+ return [{ _placeholder: true }];
545
+ case 'object':
546
+ default:
547
+ return { _placeholder: true };
548
+ }
549
+ }
93
550
  /**
94
551
  * For Default Scenario only: detect missing mockData keys and make a follow-up
95
552
  * LLM call to fill them in. This handles cases where the LLM completes normally
@@ -144,8 +601,81 @@ async function fillMissingMockDataKeys({ structure, scenario, executionFlows, fu
144
601
  }
145
602
  }
146
603
  export async function generateDataForScenario({ entity, structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, analysis, model, }) {
604
+ var _a;
147
605
  awsLogDebugLevel(1, `Generating data for ${entity.name}: ${scenario.name}`);
148
- const prompt = generateEntityScenarioDataGenerator(structure, scenario, executionFlows, defaultScenarioData, incompleteResponse);
606
+ // Check if we should chunk the data structure for focused processing
607
+ let chunkedMockData;
608
+ const coveredFlowIds = scenario.metadata?.coveredFlows || [];
609
+ if (structure.dataForMocks &&
610
+ !incompleteResponse // Don't do chunked calls on continuation
611
+ ) {
612
+ const chunks = chunkDataStructure(structure.dataForMocks);
613
+ // If we have multiple chunks, process each one with a focused call
614
+ if (chunks.length > 1) {
615
+ awsLog(`Data structure has ${Object.keys(structure.dataForMocks).length} keys, splitting into ${chunks.length} chunks for focused processing`);
616
+ chunkedMockData = {};
617
+ for (let i = 0; i < chunks.length; i++) {
618
+ const chunk = chunks[i];
619
+ const chunkKeys = Object.keys(chunk || {});
620
+ // Get relevant requiredValues for this chunk
621
+ const relevantRequiredValues = getRequiredValuesForChunk(chunk, executionFlows || [], coveredFlowIds);
622
+ awsLog(`Processing chunk ${i + 1}/${chunks.length}: ${chunkKeys.join(', ')}`);
623
+ const chunkPrompt = generateChunkPrompt({
624
+ scenario,
625
+ chunk,
626
+ chunkIndex: i,
627
+ totalChunks: chunks.length,
628
+ relevantRequiredValues,
629
+ });
630
+ const chunkResponse = await completionCall({
631
+ type: 'generateChunkMockData',
632
+ systemMessage: generateChunkSystemMessage(scenario.name),
633
+ prompt: chunkPrompt,
634
+ model,
635
+ });
636
+ // Save chunk call to LLM log for replay support
637
+ await saveLlmCall({
638
+ object_type: 'analysis',
639
+ object_id: analysis.id,
640
+ propsJson: {
641
+ entity: { name: entity.name, filePath: entity.filePath },
642
+ scenario: { name: scenario.name },
643
+ chunkIndex: i,
644
+ totalChunks: chunks.length,
645
+ },
646
+ ...chunkResponse.stats,
647
+ });
648
+ if (chunkResponse.completion) {
649
+ const validJson = validateJson(chunkResponse.completion);
650
+ const parsed = parseJsonSafe(validJson);
651
+ if (parsed && typeof parsed === 'object' && 'mockData' in parsed) {
652
+ const chunkMockData = parsed.mockData;
653
+ if (chunkMockData && typeof chunkMockData === 'object') {
654
+ Object.assign(chunkedMockData, chunkMockData);
655
+ awsLog(`Chunk ${i + 1} generated data for: ${Object.keys(chunkMockData).join(', ')}`);
656
+ }
657
+ }
658
+ }
659
+ }
660
+ // Detect keys that were lost from failed or partial chunk responses
661
+ // and fill them with schema-based defaults so they aren't permanently lost.
662
+ const allChunkedKeys = chunks.flatMap((c) => Object.keys(c || {}));
663
+ const returnedKeys = new Set(Object.keys(chunkedMockData));
664
+ const missingChunkKeys = allChunkedKeys.filter((k) => !returnedKeys.has(k));
665
+ if (missingChunkKeys.length > 0) {
666
+ awsLog(`Chunked processing: ${missingChunkKeys.length} key(s) missing from chunk results, filling with defaults: ${missingChunkKeys.join(', ')}`);
667
+ const dataForMocksRecord = structure.dataForMocks;
668
+ for (const key of missingChunkKeys) {
669
+ chunkedMockData[key] = generateDefaultForSchemaType(dataForMocksRecord[key]);
670
+ }
671
+ }
672
+ awsLog(`Chunked processing complete. Generated ${Object.keys(chunkedMockData).length} keys total`);
673
+ }
674
+ }
675
+ // When we have chunked mock data with actual content, tell the main prompt to skip mockData generation
676
+ // Important: Check for actual keys, not just truthy object, because {} would skip generation incorrectly
677
+ const hasChunkedData = chunkedMockData && Object.keys(chunkedMockData).length > 0;
678
+ const prompt = generateEntityScenarioDataGenerator(structure, scenario, executionFlows, defaultScenarioData, incompleteResponse, { mockDataAlreadyGenerated: hasChunkedData });
149
679
  const isDefault = scenario.name === DEFAULT_SCENARIO_NAME;
150
680
  const response = await completionCall({
151
681
  type: 'generateEntityScenarioData',
@@ -267,12 +797,45 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
267
797
  }
268
798
  }
269
799
  }
270
- if (structure.dataForMocks && !fullScenarioData.data.mockData) {
271
- fullScenarioData.data.mockData = {};
272
- for (const propKey of Object.keys(structure.arguments)) {
273
- const dataAsAny = fullScenarioData.data;
274
- fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
800
+ // Merge flat-level mock data into mockData.
801
+ // Sometimes the LLM returns some data inside data.mockData but other data at the flat
802
+ // data level (e.g., data.useRouter() instead of data.mockData.useRouter()).
803
+ // This code ensures all dataForMocks keys end up in mockData.
804
+ if (structure.dataForMocks) {
805
+ (_a = fullScenarioData.data).mockData || (_a.mockData = {});
806
+ const dataAsAny = fullScenarioData.data;
807
+ for (const propKey of Object.keys(structure.dataForMocks)) {
808
+ // Only copy if it exists at flat level and not already in mockData
809
+ if (dataAsAny[propKey] !== undefined &&
810
+ !fullScenarioData.data.mockData[propKey]) {
811
+ fullScenarioData.data.mockData[propKey] = dataAsAny[propKey];
812
+ }
813
+ }
814
+ }
815
+ // Merge chunked mock data from focused calls (takes priority over main call's data)
816
+ // This ensures keys processed with focused attention are correctly generated.
817
+ if (chunkedMockData && fullScenarioData.data.mockData) {
818
+ for (const [key, value] of Object.entries(chunkedMockData)) {
819
+ // Chunked data takes priority - overwrite main call's potentially wrong data
820
+ fullScenarioData.data.mockData[key] = value;
275
821
  }
822
+ awsLog(`Merged chunked mock data for keys: ${Object.keys(chunkedMockData).join(', ')}`);
823
+ }
824
+ // Strip _nullable markers from LLM-generated mock data.
825
+ // The _nullable marker is an internal CodeYam concept used in type definitions
826
+ // to indicate that a field can be null/undefined. The LLM sometimes includes
827
+ // these markers in its generated data, which causes runtime errors when code
828
+ // iterates over object keys (e.g., Object.keys(importedBy) picks up "_nullable",
829
+ // then Object.keys(importedBy["_nullable"]) calls Object.keys(null) and throws).
830
+ if (fullScenarioData.data.mockData) {
831
+ stripNullableMarkers(fullScenarioData.data.mockData);
832
+ }
833
+ // Relocate misplaced nested keys to their correct position.
834
+ // The LLM sometimes places nested keys at root level instead of inside their
835
+ // parent object (e.g., 'fastener' at root instead of inside 'trpc').
836
+ // This ensures the mockData structure matches the dataForMocks schema.
837
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
838
+ relocateMisplacedNestedKeys(fullScenarioData.data.mockData, structure.dataForMocks);
276
839
  }
277
840
  // Convert null values to undefined based on schema type constraints.
278
841
  // LLM uses null for "no value" (JSON doesn't support undefined), but TypeScript
@@ -281,6 +844,54 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
281
844
  if (structure.dataForMocks && fullScenarioData.data.mockData) {
282
845
  convertNullToUndefinedBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
283
846
  }
847
+ // Coerce objects/arrays to primitives when the schema expects a primitive type.
848
+ // The LLM sometimes generates an object where the schema expects "string",
849
+ // e.g., { body: { "env": "production" } } instead of { body: "some string" }.
850
+ // This causes runtime errors like "TypeError: body.match is not a function".
851
+ // Must run BEFORE convertCommaSeparatedStringsToArrays, which intentionally
852
+ // overrides schema types for array-like field names.
853
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
854
+ coerceObjectsToPrimitivesBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
855
+ }
856
+ // Coerce primitives to empty arrays when the schema expects an array.
857
+ // The LLM sometimes generates a primitive (e.g., `webapps: true`) where the
858
+ // schema expects an array (e.g., `webapps: [{ name: "string" }]`).
859
+ // This causes runtime errors like "TypeError: config.webapps?.forEach is not a function".
860
+ // Must run AFTER coerceObjectsToPrimitivesBySchema and BEFORE convertCommaSeparatedStringsToArrays.
861
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
862
+ coercePrimitivesToArraysBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
863
+ }
864
+ // Convert comma-separated strings to arrays when appropriate.
865
+ // The LLM sometimes generates strings like "color,size" instead of arrays
866
+ // like ["color", "size"] when the schema type is incorrectly inferred as
867
+ // 'string' instead of 'string[]'. This causes runtime errors when code
868
+ // calls array methods like .map() on the value.
869
+ if (fullScenarioData.data.mockData) {
870
+ convertCommaSeparatedStringsToArrays(fullScenarioData.data.mockData);
871
+ }
872
+ // Convert type annotation strings that appear as values to actual values.
873
+ // The LLM sometimes echoes the schema type annotation as the value.
874
+ // For example, if the schema says { filePath: "string | undefined" },
875
+ // the LLM might return { filePath: "string | undefined" } instead of
876
+ // generating an actual value. This converts those type strings to
877
+ // appropriate default values (e.g., "string | undefined" → undefined).
878
+ if (fullScenarioData.data.mockData) {
879
+ convertTypeAnnotationsToValues(fullScenarioData.data.mockData);
880
+ }
881
+ // Fix null values for ID fields when the schema indicates they should be non-null.
882
+ // The LLM sometimes generates `null` for ID fields (e.g., `"id": null`) when
883
+ // the schema type is `"number"`. This causes runtime issues when code checks
884
+ // `if (!data?.id)` expecting a truthy value.
885
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
886
+ fixNullIdsBySchema(fullScenarioData.data.mockData, structure.dataForMocks);
887
+ }
888
+ // Enforce execution flow requiredValues by setting falsy paths to null.
889
+ // The LLM doesn't reliably generate null for falsy requirements (e.g., diffView: falsy
890
+ // to hide a modal). This post-processing ensures that scenarios match their
891
+ // covered flows' requiredValues.
892
+ if (fullScenarioData.data.mockData && executionFlows) {
893
+ enforceRequiredValues(fullScenarioData.data.mockData, scenario.metadata?.coveredFlows || [], executionFlows);
894
+ }
284
895
  if (structure.arguments && fullScenarioData.data.argumentsData) {
285
896
  for (let i = 0; i < fullScenarioData.data.argumentsData.length; i++) {
286
897
  if (structure.arguments[i]) {
@@ -288,7 +899,8 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
288
899
  }
289
900
  }
290
901
  }
291
- // For Default Scenario only: check for missing keys and make follow-up call if needed
902
+ // For Default Scenario only: check for missing keys and make follow-up call if needed.
903
+ // This tries to get better-quality data via LLM before falling back to defaults.
292
904
  if (isDefault) {
293
905
  await fillMissingMockDataKeys({
294
906
  structure,
@@ -298,6 +910,21 @@ export async function generateDataForScenario({ entity, structure, scenario, exe
298
910
  model,
299
911
  });
300
912
  }
913
+ // Fill in missing mock data keys with default values (after trying LLM follow-up).
914
+ // The LLM sometimes doesn't generate data for all keys in large schemas.
915
+ // This ensures all dataForMocks keys have corresponding data to prevent
916
+ // runtime errors like "Cannot read properties of undefined".
917
+ // Only run for Default Scenario - non-default scenarios will get missing
918
+ // data filled in from the merge with default scenario data.
919
+ if (isDefault && structure.dataForMocks && fullScenarioData.data.mockData) {
920
+ fillMissingMockDataKeysWithDefaults(fullScenarioData.data.mockData, structure.dataForMocks);
921
+ }
922
+ // Track the final scenario data for E2E debugging
923
+ trackDataSnapshot('generateDataForScenario_result', {
924
+ scenarioName: scenario.name,
925
+ mockData: fullScenarioData.data.mockData,
926
+ argumentsData: fullScenarioData.data.argumentsData,
927
+ }, entity.name, scenario.name);
301
928
  return {
302
929
  scenarioData: fullScenarioData,
303
930
  llmCall: { name: scenario.name, id: llmCall.id },
@@ -394,6 +1021,46 @@ export default async function generateEntityScenarioData({ entity, structure, sc
394
1021
  scenarioData.data.argumentsData =
395
1022
  defaultScenarioData.data.argumentsData.map((arg) => ({ ...arg }));
396
1023
  }
1024
+ // Enforce requiredValues AFTER merge for non-default scenarios
1025
+ // This ensures that if a non-default scenario doesn't cover a certain flow,
1026
+ // it inherits the enforcement from the default scenario
1027
+ if (scenarioData.data?.mockData && executionFlows) {
1028
+ // Get the flows covered by this scenario
1029
+ const scenarioCoveredFlows = nonDefaultScenarios.find((s) => s.name === result.scenarioData.scenarioDescription)?.metadata?.coveredFlows || [];
1030
+ // Get the paths that the scenario's flows affect
1031
+ const scenarioAffectedPaths = new Set();
1032
+ for (const flowId of scenarioCoveredFlows) {
1033
+ const flow = executionFlows.find((f) => f.id === flowId);
1034
+ if (flow?.requiredValues) {
1035
+ for (const rv of flow.requiredValues) {
1036
+ if (rv.attributePath) {
1037
+ // Extract base path (e.g., "diffView" from "diffView.type")
1038
+ const basePath = rv.attributePath.split('.')[0];
1039
+ scenarioAffectedPaths.add(basePath);
1040
+ }
1041
+ }
1042
+ }
1043
+ }
1044
+ // Get the default scenario's flows
1045
+ const defaultCoveredFlows = defaultScenario.metadata?.coveredFlows || [];
1046
+ // For paths NOT affected by the scenario, apply default's enforcement
1047
+ const defaultFlowsForUnaffectedPaths = defaultCoveredFlows.filter((flowId) => {
1048
+ const flow = executionFlows.find((f) => f.id === flowId);
1049
+ if (!flow?.requiredValues)
1050
+ return false;
1051
+ // Check if this flow affects a path that the scenario doesn't cover
1052
+ return flow.requiredValues.some((rv) => {
1053
+ if (!rv.attributePath)
1054
+ return false;
1055
+ const basePath = rv.attributePath.split('.')[0];
1056
+ return !scenarioAffectedPaths.has(basePath);
1057
+ });
1058
+ });
1059
+ // Apply enforcement from default scenario for unaffected paths
1060
+ if (defaultFlowsForUnaffectedPaths.length > 0) {
1061
+ enforceRequiredValues(scenarioData.data.mockData, defaultFlowsForUnaffectedPaths, executionFlows);
1062
+ }
1063
+ }
397
1064
  return scenarioData;
398
1065
  });
399
1066
  scenarioDatas.push(...mergedScenarioDatas);
@@ -417,7 +1084,8 @@ Generate COMPLETE, robust data for the entire data structure.
417
1084
  : `## Non-Default Scenario
418
1085
  Generate ONLY the differences from the default scenario.
419
1086
  - Include only fields that need to change
420
- - Set to \`null\` to remove data
1087
+ - For object/scalar fields: set to \`null\` to remove/unset the data
1088
+ - For array fields: use \`[]\` for empty arrays (not \`null\`) unless the schema type explicitly includes \`| null\`
421
1089
  - Omit unchanged fields—they merge from default`;
422
1090
  // Only include the "NO ERROR DATA" instruction when the scenario doesn't require error data
423
1091
  const noErrorDataInstruction = requiresErrorData
@@ -448,6 +1116,17 @@ For example, if a flow requires:
448
1116
  \`\`\`
449
1117
  Then set \`isLoading: false\` in the mockData.
450
1118
 
1119
+ ### Array Length Requirements (length< and length>)
1120
+ For array size variation flows:
1121
+ - \`comparison: "length<"\` with \`value: "0"\` → generate EMPTY array \`[]\`
1122
+ - \`comparison: "length<"\` with \`value: "3"\` → generate 1-2 items (few items)
1123
+ - \`comparison: "length>"\` with \`value: "10"\` → generate 12+ items (many items)
1124
+
1125
+ ### String Length Requirements (normal vs long)
1126
+ For text length variation flows:
1127
+ - \`value: "normal"\` with \`valueType: "string"\` → generate normal length text (10-50 chars)
1128
+ - \`value: "long"\` with \`valueType: "string"\` → generate LONG text (200+ chars) to test overflow/truncation
1129
+
451
1130
  ## CRITICAL: Blocking Flows to Avoid
452
1131
  If the scenario includes \`blockingFlowsToAvoid\`, these are flows (like modals, overlays) that would BLOCK the expected UI.
453
1132
  You MUST generate mock data that PREVENTS these flows from triggering:
@@ -488,6 +1167,7 @@ Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
488
1167
  - Arrays should have many items (at least 4) unless specified otherwise
489
1168
  - Each item must follow the exact structure provided
490
1169
  - In general we want robust data, not minimal data unless specified otherwise
1170
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
491
1171
 
492
1172
  ## CRITICAL: Preserve Exact Structure
493
1173
  Your response MUST mirror the EXACT nested structure provided in mockData Structure.
@@ -542,6 +1222,8 @@ export const generateMissingKeysSystemMessage = () => `You are completing mock d
542
1222
 
543
1223
  Generate data ONLY for the missing keys provided in the prompt. Do not skip any of them.
544
1224
 
1225
+ - Scenario name must match exactly: "Default Scenario"
1226
+
545
1227
  ## Special Markers
546
1228
 
547
1229
  ### Dynamic Dates (\`~~codeyam-code~~\`)
@@ -559,6 +1241,7 @@ Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
559
1241
  ### Arrays
560
1242
  - Arrays should have many items (at least 4) unless specified otherwise
561
1243
  - Each item must follow the exact structure provided
1244
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
562
1245
 
563
1246
  ## CRITICAL: Preserve Exact Structure
564
1247
  Your response MUST mirror the EXACT nested structure provided for the missing keys.
@@ -585,4 +1268,102 @@ NEVER include "error" fields in responses. Skip them entirely.
585
1268
  - No \`undefined\`—use \`null\` or omit
586
1269
  - No data references (can't use \`posts[0]\` elsewhere — duplicate the value)
587
1270
  `;
1271
+ /**
1272
+ * System message for focused calls to generate critical mockData keys.
1273
+ * These are keys referenced by the scenario's execution flow requiredValues.
1274
+ */
1275
+ export const generateCriticalKeysSystemMessage = (scenarioName) => `You are generating mock data for CRITICAL keys that control scenario behavior.
1276
+
1277
+ These keys are referenced by the execution flow's requiredValues - they directly determine
1278
+ what the component renders. Pay EXTRA attention to matching the exact structure and values.
1279
+
1280
+ - Scenario name must match exactly: "${scenarioName}"
1281
+
1282
+ ## CRITICAL: Special Characters in Keys
1283
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1284
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1285
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1286
+
1287
+ ## CRITICAL: Preserve Exact Structure
1288
+ Your response MUST mirror the EXACT nested structure provided.
1289
+ - Copy key strings EXACTLY as shown (including special characters)
1290
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1291
+ - Do NOT modify keys, type parameters, or add extra keys
1292
+
1293
+ ## Matching requiredValues
1294
+ When the prompt shows requiredValues like:
1295
+ - \`attributePath: "useParams().functionCallReturnValue.*"\`
1296
+ - \`value: "scenarios"\`
1297
+
1298
+ This means set the \`*\` key to include "scenarios". For URL paths split by \`/\`,
1299
+ generate a path like \`"scenarios/id/mode"\` where segments match requirements.
1300
+
1301
+ ## Response Format
1302
+ \`\`\`json
1303
+ {
1304
+ "scenarioData": {
1305
+ "scenarioName": "${scenarioName}",
1306
+ "data": {
1307
+ "mockData": {
1308
+ // generate data for ONLY the critical keys
1309
+ }
1310
+ }
1311
+ }
1312
+ }
1313
+ \`\`\`
1314
+
1315
+ ## Rules
1316
+ - Valid JSON only
1317
+ - No \`undefined\`—use \`null\` or omit
1318
+ - Match the exact schema structure provided
1319
+ `;
1320
+ /**
1321
+ * System message for focused calls to generate mock data for a chunk of keys.
1322
+ * Used when data structures are large and need to be processed in smaller pieces.
1323
+ */
1324
+ export const generateChunkSystemMessage = (scenarioName) => `You are generating mock data for a SUBSET of keys from a larger data structure.
1325
+
1326
+ This chunk contains fewer keys so you can focus on generating HIGH QUALITY data for each one.
1327
+ Pay EXTRA attention to matching the exact structure and values for each key.
1328
+
1329
+ - Scenario name must match exactly: "${scenarioName}"
1330
+
1331
+ ## CRITICAL: Special Characters in Keys
1332
+ Keys like \`*\` are LITERAL string keys, NOT wildcards or patterns.
1333
+ - If the schema shows \`{ "*": "string" }\`, generate \`{ "*": "some value" }\`
1334
+ - Do NOT interpret \`*\` as "any key" - use it as an actual key name
1335
+
1336
+ ## CRITICAL: Preserve Exact Structure
1337
+ Your response MUST mirror the EXACT nested structure provided.
1338
+ - Copy key strings EXACTLY as shown (including special characters)
1339
+ - Only change leaf VALUES (replacing type descriptions with actual data)
1340
+ - Do NOT modify keys, type parameters, or add extra keys
1341
+
1342
+ ## Matching requiredValues
1343
+ If the prompt includes requiredValues, these are specific values that MUST be set:
1344
+ - For \`attributePath: "useParams().functionCallReturnValue.*"\` with \`value: "scenarios"\`
1345
+ → Set the \`*\` key to include "scenarios" (e.g., "scenarios/id/mode")
1346
+ - For URL paths, generate realistic paths that satisfy the requirements
1347
+
1348
+ ## CRITICAL: NO ERROR DATA
1349
+ NEVER include "error" fields in responses. Skip them entirely.
1350
+ - If structure has \`{ data: {...}, error: {...} }\`, only fill \`data\`
1351
+ - Leave out any attribute named "error"—do not set to null, omit entirely
1352
+
1353
+ ## Response Format
1354
+ \`\`\`json
1355
+ {
1356
+ "mockData": {
1357
+ // generate data for ONLY the keys in this chunk
1358
+ }
1359
+ }
1360
+ \`\`\`
1361
+
1362
+ ## Rules
1363
+ - Valid JSON only
1364
+ - No \`undefined\`—use \`null\` or omit
1365
+ - Generate data for ALL keys in the chunk (don't skip any)
1366
+ - Arrays should have many items (at least 4) unless specified otherwise
1367
+ - For empty arrays, use \`[]\` (not \`null\`) unless the schema type explicitly includes \`| null\` and the scenario requires the attribute be removed
1368
+ `;
588
1369
  //# sourceMappingURL=generateEntityScenarioData.js.map