@codeyam/codeyam-cli 0.1.0-staging.8e7b1bd → 0.1.0-staging.b8a55ba

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 (385) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +7 -6
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +2 -0
  6. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +22 -0
  7. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +23 -1
  8. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +401 -106
  9. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +60 -0
  10. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +661 -50
  11. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +14 -2
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +715 -0
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +123 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +23 -1
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +34 -1
  18. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +236 -24
  19. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +18 -1
  20. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +37 -4
  21. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +5 -0
  22. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +213 -12
  23. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +11 -15
  24. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +114 -11
  25. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  26. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  27. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
  28. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +42 -2
  29. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +38 -2
  30. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  31. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +5 -0
  32. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
  33. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +339 -145
  34. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +20 -0
  35. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +8 -1
  36. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +158 -0
  37. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +107 -18
  38. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  39. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +223 -103
  40. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +10 -5
  41. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +172 -83
  42. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -5
  43. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +97 -27
  44. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  45. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  46. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  47. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  48. package/analyzer-template/packages/aws/package.json +1 -1
  49. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  50. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  51. package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
  52. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  53. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +20 -9
  54. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +3 -2
  55. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
  56. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  57. package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
  58. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
  59. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
  60. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  61. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +8 -1
  62. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  63. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +14 -7
  64. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  65. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  66. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  67. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -1
  68. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  69. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  70. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +4 -2
  71. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  72. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  73. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  74. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  75. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  76. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  77. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  78. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
  79. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
  80. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  81. package/analyzer-template/packages/github/dist/types/index.d.ts +4 -3
  82. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  83. package/analyzer-template/packages/github/dist/types/index.js +1 -0
  84. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  85. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +31 -1
  86. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  87. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +51 -1
  88. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  89. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +21 -1
  90. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
  91. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
  92. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  93. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  94. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  95. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  96. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  97. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  98. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  99. package/analyzer-template/packages/types/index.ts +8 -0
  100. package/analyzer-template/packages/types/src/types/Analysis.ts +32 -1
  101. package/analyzer-template/packages/types/src/types/Scenario.ts +75 -6
  102. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +49 -0
  103. package/analyzer-template/packages/ui-components/package.json +4 -4
  104. package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
  105. package/analyzer-template/packages/utils/dist/types/index.d.ts +4 -3
  106. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  107. package/analyzer-template/packages/utils/dist/types/index.js +1 -0
  108. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  109. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +31 -1
  110. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  111. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +51 -1
  112. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  113. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +21 -1
  114. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
  115. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
  116. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  117. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  118. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  119. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  120. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  121. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  122. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  123. package/analyzer-template/packages/utils/src/lib/applyUniversalMocks.ts +28 -2
  124. package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
  125. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  126. package/analyzer-template/playwright/takeScreenshot.ts +9 -7
  127. package/analyzer-template/project/TESTING.md +83 -0
  128. package/analyzer-template/project/constructMockCode.ts +151 -30
  129. package/analyzer-template/project/loadReadyToBeCaptured.ts +17 -1
  130. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +16 -9
  131. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +77 -37
  132. package/analyzer-template/project/reconcileMockDataKeys.ts +104 -3
  133. package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
  134. package/analyzer-template/project/serverOnlyModules.ts +288 -0
  135. package/analyzer-template/project/start.ts +10 -0
  136. package/analyzer-template/project/startScenarioCapture.ts +73 -41
  137. package/analyzer-template/project/writeMockDataTsx.ts +103 -40
  138. package/analyzer-template/project/writeScenarioComponents.ts +1162 -203
  139. package/analyzer-template/project/writeSimpleRoot.ts +26 -4
  140. package/analyzer-template/project/writeUniversalMocks.ts +32 -11
  141. package/background/src/lib/virtualized/project/constructMockCode.js +132 -25
  142. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  143. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +15 -1
  144. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  145. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +11 -6
  146. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  147. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +67 -32
  148. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  149. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +65 -4
  150. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  151. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
  152. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  153. package/background/src/lib/virtualized/project/serverOnlyModules.js +235 -0
  154. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
  155. package/background/src/lib/virtualized/project/start.js +6 -0
  156. package/background/src/lib/virtualized/project/start.js.map +1 -1
  157. package/background/src/lib/virtualized/project/startScenarioCapture.js +54 -31
  158. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  159. package/background/src/lib/virtualized/project/writeMockDataTsx.js +87 -34
  160. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  161. package/background/src/lib/virtualized/project/writeScenarioComponents.js +852 -133
  162. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  163. package/background/src/lib/virtualized/project/writeSimpleRoot.js +25 -2
  164. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  165. package/background/src/lib/virtualized/project/writeUniversalMocks.js +27 -12
  166. package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
  167. package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js +7 -0
  168. package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js.map +1 -0
  169. package/codeyam-cli/src/cli.js +2 -0
  170. package/codeyam-cli/src/cli.js.map +1 -1
  171. package/codeyam-cli/src/commands/debug.js +14 -2
  172. package/codeyam-cli/src/commands/debug.js.map +1 -1
  173. package/codeyam-cli/src/commands/recapture.js +215 -0
  174. package/codeyam-cli/src/commands/recapture.js.map +1 -0
  175. package/codeyam-cli/src/commands/report.js +26 -23
  176. package/codeyam-cli/src/commands/report.js.map +1 -1
  177. package/codeyam-cli/src/utils/backgroundServer.js +2 -2
  178. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  179. package/codeyam-cli/src/utils/generateReport.js +252 -106
  180. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  181. package/codeyam-cli/src/utils/install-skills.js +2 -7
  182. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  183. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
  184. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  185. package/codeyam-cli/src/utils/queue/job.js +140 -16
  186. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  187. package/codeyam-cli/src/utils/queue/manager.js +19 -7
  188. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  189. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  190. package/codeyam-cli/src/webserver/app/lib/database.js +47 -0
  191. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  192. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  193. package/codeyam-cli/src/webserver/backgroundServer.js +5 -10
  194. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  195. package/codeyam-cli/src/webserver/bootstrap.js +9 -0
  196. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
  197. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +1 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DQeyk25_.js → EntityTypeBadge-CzGX-miz.js} +1 -1
  199. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +41 -0
  200. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +25 -0
  201. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CBQPrpT0.js +3 -0
  202. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-D1CdlbrV.js +6 -0
  203. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-wDPcZNKx.js +3 -0
  204. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +11 -0
  205. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BfmDgXxG.js +1 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +15 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-ayCJdUAc.js → TruncatedFilePath-6J7zDUD5.js} +1 -1
  208. package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +11 -0
  209. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-2mG6mjVb.js +32 -0
  210. package/codeyam-cli/src/webserver/build/client/assets/api.link-scenario-value-l0sNRNKZ.js +1 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/api.update-key-attributes-l0sNRNKZ.js +1 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/api.update-valid-values-l0sNRNKZ.js +1 -0
  213. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BYimnrHg.js +6 -0
  214. package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +51 -0
  215. package/codeyam-cli/src/webserver/build/client/assets/circle-check-CaVsIRxt.js +6 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgUsG7ib.js +21 -0
  217. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +1 -0
  218. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +1 -0
  219. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-FHOVOgFN.js → entity._sha._-zUEpfPsu.js} +22 -15
  220. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +1 -0
  221. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +1 -0
  222. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-CfLCUi9S.js +5 -0
  223. package/codeyam-cli/src/webserver/build/client/assets/entry.client-DKJyZfAY.js +29 -0
  224. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DAtOlaWE.js +1 -0
  225. package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +1 -0
  226. package/codeyam-cli/src/webserver/build/client/assets/git-D62Lxxmv.js +15 -0
  227. package/codeyam-cli/src/webserver/build/client/assets/globals-C6vQASxy.css +1 -0
  228. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  229. package/codeyam-cli/src/webserver/build/client/assets/index-BosqDOlH.js +3 -0
  230. package/codeyam-cli/src/webserver/build/client/assets/index-CzNNiTkw.js +9 -0
  231. package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +1 -0
  232. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-CNp9QFCX.js +6 -0
  233. package/codeyam-cli/src/webserver/build/client/assets/manifest-09d684be.js +1 -0
  234. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  235. package/codeyam-cli/src/webserver/build/client/assets/root-BxJUvKau.js +56 -0
  236. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  237. package/codeyam-cli/src/webserver/build/client/assets/search-DDGjYAMJ.js +6 -0
  238. package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +1 -0
  239. package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +1 -0
  240. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CBc5dE1s.js +6 -0
  241. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +1 -0
  242. package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +1 -0
  243. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-DOGXmJcI.js → useLastLogLine-BqPPNjAl.js} +1 -1
  244. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +1 -0
  245. package/codeyam-cli/src/webserver/build/client/assets/{useToast-C07gRg7Z.js → useToast-DWHcCcl1.js} +1 -1
  246. package/codeyam-cli/src/webserver/build/server/assets/index-CV6i1S1A.js +1 -0
  247. package/codeyam-cli/src/webserver/build/server/assets/server-build-BDlyhfrv.js +175 -0
  248. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  249. package/codeyam-cli/src/webserver/build-info.json +5 -5
  250. package/codeyam-cli/src/webserver/devServer.js +1 -3
  251. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  252. package/codeyam-cli/templates/debug-codeyam.md +620 -0
  253. package/package.json +14 -14
  254. package/packages/ai/src/lib/analyzeScope.js +2 -0
  255. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  256. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +16 -0
  257. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  258. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +16 -0
  259. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  260. package/packages/ai/src/lib/astScopes/processExpression.js +305 -88
  261. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  262. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +523 -42
  263. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  264. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +12 -2
  265. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  266. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +454 -0
  267. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  268. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +103 -1
  269. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  270. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
  271. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  272. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +19 -1
  273. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  274. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
  275. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  276. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +28 -2
  277. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  278. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +179 -17
  279. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
  280. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +6 -0
  281. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
  282. package/packages/ai/src/lib/generateChangesEntityScenarios.js +37 -4
  283. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  284. package/packages/ai/src/lib/generateEntityDataStructure.js +4 -0
  285. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  286. package/packages/ai/src/lib/generateEntityKeyAttributes.js +176 -9
  287. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
  288. package/packages/ai/src/lib/generateEntityScenarioData.js +11 -15
  289. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  290. package/packages/ai/src/lib/generateEntityScenarios.js +105 -9
  291. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  292. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  293. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  294. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  295. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  296. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
  297. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  298. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +38 -2
  299. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  300. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +38 -2
  301. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  302. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  303. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  304. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  305. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
  306. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  307. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +258 -110
  308. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  309. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +18 -0
  310. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  311. package/packages/analyze/src/lib/files/getImportedExports.js +6 -1
  312. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  313. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +125 -0
  314. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  315. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +74 -19
  316. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  317. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  318. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  319. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +175 -58
  320. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  321. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +10 -5
  322. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
  323. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +127 -69
  324. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  325. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -5
  326. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  327. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +74 -23
  328. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  329. package/packages/database/src/lib/kysely/db.js +2 -2
  330. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  331. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  332. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +4 -2
  333. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  334. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  335. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  336. package/packages/generate/src/lib/deepMerge.js +27 -1
  337. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  338. package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
  339. package/packages/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  340. package/packages/types/index.js +1 -0
  341. package/packages/types/index.js.map +1 -1
  342. package/packages/types/src/types/Scenario.js +21 -1
  343. package/packages/types/src/types/Scenario.js.map +1 -1
  344. package/packages/utils/src/lib/applyUniversalMocks.js +26 -2
  345. package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
  346. package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
  347. package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  348. package/scripts/finalize-analyzer.cjs +3 -1
  349. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-CWKV2GEz.js +0 -1
  350. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-D2hFeDeg.js +0 -1
  351. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-C8K-4kKP.js +0 -26
  352. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DgXLv61M.js +0 -3
  353. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-DFdLQbPS.js +0 -3
  354. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DlRDjT4h.js +0 -1
  355. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-7UkVL-UI.js +0 -1
  356. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-XjtsGuPo.js +0 -5
  357. package/codeyam-cli/src/webserver/build/client/assets/_index-D2eJjWLf.js +0 -1
  358. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-w6sbwlOd.js +0 -7
  359. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BBNQ8hup.js +0 -1
  360. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-Bex4RrGs.js +0 -26
  361. package/codeyam-cli/src/webserver/build/client/assets/circle-check-cdhjVtom.js +0 -1
  362. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DkgmwwRC.js +0 -1
  363. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CwLmCS0J.js +0 -1
  364. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-YZ-kM3ZG.js +0 -1
  365. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BeQlz94_.js +0 -5
  366. package/codeyam-cli/src/webserver/build/client/assets/entry.client-DN2XXM7Z.js +0 -5
  367. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-CUeAIQNI.js +0 -1
  368. package/codeyam-cli/src/webserver/build/client/assets/files-ccMQfhGf.js +0 -1
  369. package/codeyam-cli/src/webserver/build/client/assets/git-JmESAHx5.js +0 -12
  370. package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.css +0 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  372. package/codeyam-cli/src/webserver/build/client/assets/index-DsL9BiOc.js +0 -8
  373. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-COYCR2oZ.js +0 -1
  374. package/codeyam-cli/src/webserver/build/client/assets/manifest-90adba57.js +0 -1
  375. package/codeyam-cli/src/webserver/build/client/assets/root-DfbVEEjF.js +0 -16
  376. package/codeyam-cli/src/webserver/build/client/assets/search-DvK9iMBu.js +0 -1
  377. package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
  378. package/codeyam-cli/src/webserver/build/client/assets/settings-9LTbit4Z.js +0 -1
  379. package/codeyam-cli/src/webserver/build/client/assets/simulations-BrxN5ZtV.js +0 -1
  380. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-Iv0p8T-1.js +0 -1
  381. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-BWmSRPH6.js +0 -1
  382. package/codeyam-cli/src/webserver/build/server/assets/index-CE_1qXCG.js +0 -1
  383. package/codeyam-cli/src/webserver/build/server/assets/server-build-BY_VDhiD.js +0 -166
  384. package/codeyam-cli/templates/debug-command.md +0 -141
  385. /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
@@ -1,11 +1,17 @@
1
1
  import completionCall from './completionCall';
2
2
  import { saveLlmCall } from '~codeyam/aws/dynamodb';
3
- import { Analysis, Entity } from '~codeyam/types';
3
+ import type {
4
+ Analysis,
5
+ CompoundConditional,
6
+ ConditionalUsage,
7
+ Entity,
8
+ } from '~codeyam/types';
4
9
  import generateEntityKeyAttributesGenerator from './promptGenerators/generateEntityKeyAttributesGenerator';
5
10
  import { awsLog } from '~codeyam/utils';
6
11
  import { AI, DEFAULT_LARGER_MODEL } from '~codeyam/ai';
7
12
  import isFrontend from './isFrontend';
8
13
  import { gatherAttributesMap } from './promptGenerators/gatherAttributesMap';
14
+ import { formatConditionalUsagesForPrompt } from './getConditionalUsagesFromCode';
9
15
 
10
16
  interface GenerateChangesEntityKeyAttributesArgs {
11
17
  entity: Entity;
@@ -41,11 +47,22 @@ export default async function generateChangesEntityKeyAttributes({
41
47
  true,
42
48
  );
43
49
 
50
+ // Use pre-computed conditional usages from metadata for static analysis context
51
+ const conditionalUsages: Record<string, ConditionalUsage[]> =
52
+ isolatedDataStructure?.conditionalUsages ?? {};
53
+ const compoundConditionals: CompoundConditional[] =
54
+ isolatedDataStructure?.compoundConditionals ?? [];
55
+ const staticAnalysisContext = formatConditionalUsagesForPrompt(
56
+ conditionalUsages,
57
+ compoundConditionals,
58
+ );
59
+
44
60
  const prompt = generateEntityKeyAttributesGenerator({
45
61
  code: entity.code,
46
62
  attributesMap,
47
63
  existingKeyAttributes,
48
64
  commitDiff,
65
+ staticAnalysisContext,
49
66
  });
50
67
 
51
68
  const response = await completionCall({
@@ -288,7 +288,16 @@ Focus scenario updates on demonstrating this change.${scenarioCount ? ` Generate
288
288
 
289
289
  return `You are updating data scenarios after a code change. Determine which existing scenarios need updating, which should be removed, and if new ones are needed.
290
290
 
291
- ${contextSection}## Update Rules
291
+ ${contextSection}## Coverage Goals (IMPORTANT)
292
+ Your primary goal is to MAXIMIZE coverage of key attributes across all scenarios:
293
+
294
+ 1. **Use indexed validValueOptions**: Each key attribute has indexed \`validValueOptions\` (with \`index\` and \`value\`). Reference these by index in your valueOptionRef.
295
+
296
+ 2. **Prioritize attributes with dependencies**: Key attributes with a \`dependencies\` array control conditionally-rendered content. Satisfy these dependencies to reveal gated UI/behavior.
297
+
298
+ 3. **Cover conditional branches**: Use \`codeUsages\` to identify all conditional paths that need coverage.
299
+
300
+ ## Update Rules
292
301
 
293
302
  ### Removed Key Attributes
294
303
  - Update scenarios using removed attributes—replace with new attributes or remove if no longer relevant
@@ -297,6 +306,7 @@ ${contextSection}## Update Rules
297
306
 
298
307
  ### Added Key Attributes
299
308
  - Create or update scenarios to demonstrate new behavior
309
+ - Use different validValueOption indices than existing scenarios to maximize coverage
300
310
 
301
311
  ### Playwright Instructions
302
312
  - Validate existing instructions still work after code changes
@@ -308,7 +318,26 @@ ${contextSection}## Update Rules
308
318
  ### Default Scenario
309
319
  - First scenario must be "${DEFAULT_SCENARIO_NAME}" (exact name)
310
320
  - NEVER include playwrightInstructions—captures initial state only
311
- - Must include all current key attributes with valid values
321
+ - Must include all current key attributes with valid values from their validValueOptions
322
+
323
+ ## keyAttributeInstructions Format
324
+ Use \`dataStructurePath\` as key. Include variable name, instruction, AND a valueOptionRef that references which validValueOption you're using:
325
+ \`\`\`json
326
+ {
327
+ "useStatus().status": {
328
+ "localVariable": "status",
329
+ "instruction": "Set to 'active' mode",
330
+ "valueOptionRef": { "index": 0, "refType": "exact" }
331
+ }
332
+ }
333
+ \`\`\`
334
+
335
+ ### valueOptionRef Types
336
+ - \`"exact"\`: Uses the validValueOption at this index exactly
337
+ - \`"derived"\`: Based on this validValueOption but modified (include \`derivation\` field explaining how)
338
+ - \`"custom"\`: Value not from validValueOptions list (use sparingly)
339
+
340
+ The \`index\` refers to the validValueOptions array position (0 = first option).
312
341
 
313
342
  ## Response Format
314
343
 
@@ -332,7 +361,11 @@ Otherwise:
332
361
  "testName": "it(\\"shows empty message when no notifications\\")",
333
362
  "description": "User has no notifications.",
334
363
  "keyAttributeInstructions": {
335
- "notifications[]": { "localVariable": "notifications[]", "instruction": "Empty array" }
364
+ "useData().notifications[]": {
365
+ "localVariable": "notifications[]",
366
+ "instruction": "Empty array [] to show empty state",
367
+ "valueOptionRef": { "index": 1, "refType": "exact" }
368
+ }
336
369
  }
337
370
  }
338
371
  ]
@@ -342,7 +375,7 @@ Otherwise:
342
375
  ## Rules
343
376
  - Scenario names: letters, numbers, spaces only
344
377
  - testName: Jest style with specific expectations
345
- - Use values from \`validValueOptions\` in key attributes list
378
+ - Use values from \`validValueOptions\` in key attributes list (reference by index)
346
379
  - Include dependency key attributes if dependencies involved
347
380
  - React elements: simple only (\`<div>\`, \`<span>\`)
348
381
  - No external library references—plain JS/TS values
@@ -3,6 +3,7 @@ import isolateScopes from './isolateScopes';
3
3
  import analyzeScope from './analyzeScope';
4
4
  import { FileAnalyzer } from '~codeyam/analyze';
5
5
  import { AI, SerializableDataStructure } from '~codeyam/ai';
6
+ import { resetScopeDataStructureMetrics } from './dataStructure/ScopeDataStructure';
6
7
 
7
8
  // import { awsLog } from '~codeyam/utils';
8
9
 
@@ -17,6 +18,10 @@ export default async function generateEntityDataStructure({
17
18
  fileAnalyzer,
18
19
  model,
19
20
  }: GenerateEntityDataStructureArgs): Promise<SerializableDataStructure> {
21
+ // Reset metrics counters to prevent false "infinite loop" detection when
22
+ // processing multiple entities in the same run
23
+ resetScopeDataStructureMetrics();
24
+
20
25
  // awsLog('CodeYam: Generating entity data structure', {
21
26
  // filePath: entity.filePath,
22
27
  // entityName: entity.name,
@@ -1,15 +1,16 @@
1
1
  import completionCall from './completionCall';
2
2
  import { saveLlmCall } from '~codeyam/aws/dynamodb';
3
- import { DataStructure, Entity } from '~codeyam/types';
3
+ import { DataStructure, Entity, SourceLocation } from '~codeyam/types';
4
4
  import generateEntityKeyAttributesGenerator from './promptGenerators/generateEntityKeyAttributesGenerator';
5
5
  import { awsLog } from '~codeyam/utils';
6
6
  import { DEFAULT_LARGER_MODEL } from './aiConfig';
7
7
  import { gatherAttributesMap } from './promptGenerators/gatherAttributesMap';
8
8
  import { fillInDirectSchemaGapsAndUnknowns } from './dataStructure/helpers/fillInSchemaGapsAndUnknowns';
9
+ import { clearAttributesFromMapping } from './dataStructure/helpers/cleanNonObjectFunctions';
9
10
  import isFrontend from './isFrontend';
10
11
  import { AI } from '~codeyam/ai';
11
12
  import { formatConditionalUsagesForPrompt } from './getConditionalUsagesFromCode';
12
- import type { ConditionalUsage } from '~codeyam/types';
13
+ import type { CompoundConditional, ConditionalUsage } from '~codeyam/types';
13
14
 
14
15
  interface GenerateEntityKeyAttributesArgs {
15
16
  entity: Pick<Entity, 'sha' | 'name' | 'filePath' | 'code' | 'metadata'>;
@@ -38,6 +39,11 @@ export default async function generateEntityKeyAttributes({
38
39
  true,
39
40
  );
40
41
 
42
+ // Clean the attributes map to remove primitive-returning array method paths
43
+ // like .includes().functionCallReturnValue, .indexOf().functionCallReturnValue, etc.
44
+ // These paths are not mockable and should not be presented as key attributes.
45
+ clearAttributesFromMapping(attributesMap);
46
+
41
47
  if (Object.keys(attributesMap).length === 0) {
42
48
  console.log(
43
49
  `CodeYam Error: No valid attributes found for ${entity.filePath} ${entity.name}`,
@@ -48,17 +54,31 @@ export default async function generateEntityKeyAttributes({
48
54
  };
49
55
  }
50
56
 
57
+ // Build merged schema for type inference (has more complete nested paths)
58
+ // Strip signature[N] prefix to match attributesMap format
59
+ const mergedSchemaForTypeLookup = Object.fromEntries(
60
+ Object.entries(mergedDataStructure.signatureSchema ?? {})
61
+ .filter(([k]) => k.startsWith('signature['))
62
+ .map(([k, v]) => [k.replace(/^signature\[\d+\]\./, ''), v]),
63
+ );
64
+
51
65
  // Resolve unknown types using heuristics (e.g., "unknown | undefined" -> "string | undefined")
66
+ // Pass mergedSchema so checkIfObjectOrFunction can detect nested paths that prove a type is an object
52
67
  const resolvedAttributesMap = fillInDirectSchemaGapsAndUnknowns({
53
68
  scopeName: entity.name,
54
69
  schema: { ...attributesMap },
70
+ mergedSchema: mergedSchemaForTypeLookup,
55
71
  });
56
72
 
57
73
  // Use pre-computed conditional usages from metadata, or compute on-the-fly as fallback
58
74
  const conditionalUsages: Record<string, ConditionalUsage[]> =
59
75
  entity.metadata?.isolatedDataStructure?.conditionalUsages ?? {};
60
- const staticAnalysisContext =
61
- formatConditionalUsagesForPrompt(conditionalUsages);
76
+ const compoundConditionals: CompoundConditional[] =
77
+ entity.metadata?.isolatedDataStructure?.compoundConditionals ?? [];
78
+ const staticAnalysisContext = formatConditionalUsagesForPrompt(
79
+ conditionalUsages,
80
+ compoundConditionals,
81
+ );
62
82
 
63
83
  const prompt = generateEntityKeyAttributesGenerator({
64
84
  code: entity.code,
@@ -133,6 +153,106 @@ export default async function generateEntityKeyAttributes({
133
153
  ]),
134
154
  );
135
155
 
156
+ // Helper to extract source locations from conditional usages for a given path
157
+ const getSourceLocationsForPath = (path: string): SourceLocation[] => {
158
+ const usages = conditionalUsages[path] || [];
159
+ const locations: SourceLocation[] = [];
160
+
161
+ for (const usage of usages.slice(0, 5)) {
162
+ // Limit to 5 locations
163
+ if (usage.sourceLocation) {
164
+ locations.push({
165
+ entityName: entity.name,
166
+ filePath: entity.filePath,
167
+ lineNumber: usage.sourceLocation.lineNumber,
168
+ column: usage.sourceLocation.column,
169
+ codeSnippet: usage.sourceLocation.codeSnippet,
170
+ usageType: 'conditional',
171
+ description: `Used in ${usage.location} statement (${usage.conditionType} check)`,
172
+ });
173
+ }
174
+ }
175
+
176
+ return locations;
177
+ };
178
+
179
+ // Helper to find source locations by matching sourceDataPath
180
+ // This handles cases where local variables (e.g., displayState.hasError) trace back
181
+ // to data structure paths (e.g., getScenarioDisplayState().functionCallReturnValue.hasError)
182
+ const getSourceLocationsBySourceDataPath = (
183
+ targetPath: string,
184
+ ): SourceLocation[] => {
185
+ const locations: SourceLocation[] = [];
186
+
187
+ // Search all conditional usages for ones whose sourceDataPath matches
188
+ for (const [, usages] of Object.entries(conditionalUsages)) {
189
+ for (const usage of usages) {
190
+ const sourceDataPath = (usage as { sourceDataPath?: string })
191
+ .sourceDataPath;
192
+ if (!sourceDataPath || !usage.sourceLocation) continue;
193
+
194
+ // Check if sourceDataPath ends with the target path
195
+ // e.g., "LibraryFunctionPreview.signature[0].isOutdated" ends with "isOutdated"
196
+ // or "getScenarioDisplayState.getScenarioDisplayState(...).functionCallReturnValue.hasError" ends with "hasError"
197
+ const normalizedSourcePath = sourceDataPath
198
+ .replace(/\.functionCallReturnValue/g, '')
199
+ .replace(/\([^)]*\)/g, '()');
200
+
201
+ if (
202
+ normalizedSourcePath.endsWith('.' + targetPath) ||
203
+ normalizedSourcePath.endsWith('.' + targetPath.replace(/\./g, '.'))
204
+ ) {
205
+ locations.push({
206
+ entityName: entity.name,
207
+ filePath: entity.filePath,
208
+ lineNumber: usage.sourceLocation.lineNumber,
209
+ column: usage.sourceLocation.column,
210
+ codeSnippet: usage.sourceLocation.codeSnippet,
211
+ usageType: 'conditional',
212
+ description: `Used in ${usage.location} statement (${usage.conditionType} check)`,
213
+ });
214
+ }
215
+ }
216
+ }
217
+
218
+ return locations.slice(0, 5); // Limit to 5
219
+ };
220
+
221
+ // Helper to find source locations from LLM-provided code snippets
222
+ const getSourceLocationsFromSnippets = (
223
+ codeSnippets: string[] | undefined,
224
+ ): SourceLocation[] => {
225
+ if (!codeSnippets || !Array.isArray(codeSnippets)) return [];
226
+
227
+ const locations: SourceLocation[] = [];
228
+ const codeLines = entity.code.split('\n');
229
+
230
+ for (const snippet of codeSnippets.slice(0, 3)) {
231
+ // Limit to 3 snippets
232
+ if (!snippet || typeof snippet !== 'string') continue;
233
+
234
+ // Normalize whitespace for matching
235
+ const normalizedSnippet = snippet.trim().replace(/\s+/g, ' ');
236
+
237
+ for (let i = 0; i < codeLines.length; i++) {
238
+ const normalizedLine = codeLines[i].replace(/\s+/g, ' ');
239
+ if (normalizedLine.includes(normalizedSnippet)) {
240
+ locations.push({
241
+ entityName: entity.name,
242
+ filePath: entity.filePath,
243
+ lineNumber: i + 1, // 1-based line numbers
244
+ codeSnippet: codeLines[i].trim(),
245
+ usageType: 'conditional',
246
+ description: `Key usage identified by analysis`,
247
+ });
248
+ break; // Only find first occurrence of each snippet
249
+ }
250
+ }
251
+ }
252
+
253
+ return locations;
254
+ };
255
+
136
256
  const fullKeyAttributes = keyAttributes
137
257
  .filter(Boolean)
138
258
  .filter(
@@ -144,6 +264,46 @@ export default async function generateEntityKeyAttributes({
144
264
  .filter((keyAttribute) => fullPathToInternalPath[keyAttribute.fullPath])
145
265
  .map((keyAttribute) => {
146
266
  const internalPath = fullPathToInternalPath[keyAttribute.fullPath];
267
+
268
+ // Get source locations from conditional usages
269
+ // Try multiple path formats since conditionalUsages might use different formats:
270
+ // - internalPath: the short path like "status"
271
+ // - fullPath: the LLM's path like "signature[0].status"
272
+ // - dataStructurePath: the external path like "useStatus().status"
273
+ // - Also try stripping signature[N] prefix since conditional usages use AST paths
274
+ let sourceLocations = getSourceLocationsForPath(internalPath);
275
+ if (sourceLocations.length === 0) {
276
+ sourceLocations = getSourceLocationsForPath(keyAttribute.fullPath);
277
+ }
278
+ if (sourceLocations.length === 0) {
279
+ const dataStructurePath =
280
+ dataStructurePathMap[internalPath] || keyAttribute.fullPath;
281
+ sourceLocations = getSourceLocationsForPath(dataStructurePath);
282
+ }
283
+ // Also try the path without signature[N] prefix since AST uses local variable names
284
+ if (sourceLocations.length === 0) {
285
+ const pathWithoutSignature = internalPath.replace(
286
+ /^signature\[\d+\]\./,
287
+ '',
288
+ );
289
+ if (pathWithoutSignature !== internalPath) {
290
+ sourceLocations = getSourceLocationsForPath(pathWithoutSignature);
291
+ }
292
+ }
293
+ // Finally, search by sourceDataPath which traces local variables back to data sources
294
+ // This handles cases like displayState.hasError → getScenarioDisplayState().hasError
295
+ if (sourceLocations.length === 0) {
296
+ sourceLocations = getSourceLocationsBySourceDataPath(internalPath);
297
+ }
298
+
299
+ // Last resort: use LLM-provided code snippets to find source locations
300
+ // This ensures every key attribute the LLM identifies has a source location
301
+ if (sourceLocations.length === 0 && keyAttribute.codeSnippets) {
302
+ sourceLocations = getSourceLocationsFromSnippets(
303
+ keyAttribute.codeSnippets,
304
+ );
305
+ }
306
+
147
307
  return {
148
308
  internalPath,
149
309
  externalPath: associationMap[internalPath],
@@ -155,6 +315,9 @@ export default async function generateEntityKeyAttributes({
155
315
  // Preserve new fields from LLM response
156
316
  valueType: keyAttribute.valueType,
157
317
  dependencies: keyAttribute.dependencies,
318
+ // Add source locations from static analysis or LLM snippets
319
+ sourceLocations:
320
+ sourceLocations.length > 0 ? sourceLocations : undefined,
158
321
  };
159
322
  });
160
323
 
@@ -184,15 +347,31 @@ NOT key attributes:
184
347
 
185
348
  We've provided a list of variables that are used in conditional statements in the code. These are very likely key attributes.
186
349
 
187
- Each conditional lists it's source and how it is used. This should help you identify which attributes to include and what values to suggest.
350
+ Each conditional lists its source and how it is used. This should help you identify which attributes to include and what values to suggest.
351
+
352
+ **IMPORTANT**: Only include attributes with explicit evidence of impact in THIS code:
353
+ - Used directly in a conditional statement (if/ternary/switch)
354
+ - Displayed or rendered directly (e.g., text content, list length)
355
+ - Used in a computation that affects rendering
356
+
357
+ Do NOT include attributes that are only passed as arguments to other functions without direct usage here. We analyze those functions separately and merge their key attributes automatically.
188
358
 
189
359
  ## Path Format
190
360
 
191
361
  Only return attributes from the "Attributes and Value Types" list — these are the only values we can control. Use the exact \`fullPath\` provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
192
362
 
193
- ## Dependencies
363
+ ## Dependencies and Compound Conditionals
364
+
365
+ When attributes are used in && chains (compound conditionals), they form dependencies on each other:
366
+ - Each attribute in the chain only has effect when ALL other conditions in the chain are satisfied
367
+ - Include these as dependencies with the required value for the code path to execute
194
368
 
195
- If this key attribute is only used if one or more other attributes have specific values, include those dependencies in a \`dependencies\` array.
369
+ Example: For \`a && b && !c\`:
370
+ - \`a\` has dependencies: \`b\` must be truthy, \`c\` must be falsy
371
+ - \`b\` has dependencies: \`a\` must be truthy, \`c\` must be falsy
372
+ - \`c\` has dependencies: \`a\` must be truthy, \`b\` must be truthy (for the falsy check to matter)
373
+
374
+ The static analysis section may show "Compound Conditionals" that list which conditions must be true together. Use this to populate the \`dependencies\` array with \`{ "path": "...", "requiredValue": "..." }\` entries.
196
375
 
197
376
  ## Value Type
198
377
 
@@ -218,8 +397,9 @@ List all key attributes in order from most impactful to least impactful regardin
218
397
  {
219
398
  "fullPath": "signature[0].user",
220
399
  "description": "Controls whether the main form or redirect screen displays",
400
+ "codeSnippets": ["if (!user) return <Redirect />", "user.name"],
221
401
  "dependencies": [
222
- "signature[0].projectId": "must be a valid project ID for 'user' to have effect"
402
+ { "path": "signature[0].projectId", "requiredValue": "truthy", "description": "must be a valid project ID for 'user' to have effect" }
223
403
  ],
224
404
  "valueType": "object",
225
405
  "validValueOptions": ["an empty object {}", "null/undefined"]
@@ -227,6 +407,8 @@ List all key attributes in order from most impactful to least impactful regardin
227
407
  ]
228
408
  }
229
409
  \`\`\`
410
+
411
+ The \`codeSnippets\` field is required - provide 1-3 short code excerpts (under 80 chars each) showing exactly where and how this attribute is used. These snippets must appear verbatim in the code.
230
412
  `;
231
413
 
232
414
  const BACKEND_SYSTEM_MESSAGE = `You analyze backend functions to identify key data attributes that significantly impact behavior.
@@ -248,15 +430,31 @@ NOT key attributes:
248
430
 
249
431
  We've provided a list of variables that are used in conditional statements in the code. These are very likely key attributes.
250
432
 
251
- Each conditional lists it's source and how it is used. This should help you identify which attributes to include and what values to suggest.
433
+ Each conditional lists its source and how it is used. This should help you identify which attributes to include and what values to suggest.
434
+
435
+ **IMPORTANT**: Only include attributes with explicit evidence of impact in THIS code:
436
+ - Used directly in a conditional statement (if/ternary/switch)
437
+ - Displayed or rendered directly (e.g., text content, list length)
438
+ - Used in a computation that affects rendering
439
+
440
+ Do NOT include attributes that are only passed as arguments to other functions without direct usage here. We analyze those functions separately and merge their key attributes automatically.
252
441
 
253
442
  ## Path Format
254
443
 
255
444
  Only return attributes from the "Attributes and Value Types" list — these are the only values we can control. Use the exact \`fullPath\` provided. Use \`functionCallReturnValue\` for function return values. Use \`[]\` for array items (e.g., \`items[]\`).
256
445
 
257
- ## Dependencies
446
+ ## Dependencies and Compound Conditionals
258
447
 
259
- If this key attribute is only used if one or more other attributes have specific values, include those dependencies in a \`dependencies\` array.
448
+ When attributes are used in && chains (compound conditionals), they form dependencies on each other:
449
+ - Each attribute in the chain only has effect when ALL other conditions in the chain are satisfied
450
+ - Include these as dependencies with the required value for the code path to execute
451
+
452
+ Example: For \`a && b && !c\`:
453
+ - \`a\` has dependencies: \`b\` must be truthy, \`c\` must be falsy
454
+ - \`b\` has dependencies: \`a\` must be truthy, \`c\` must be falsy
455
+ - \`c\` has dependencies: \`a\` must be truthy, \`b\` must be truthy (for the falsy check to matter)
456
+
457
+ The static analysis section may show "Compound Conditionals" that list which conditions must be true together. Use this to populate the \`dependencies\` array with \`{ "path": "...", "requiredValue": "..." }\` entries.
260
458
 
261
459
  ## Value Type
262
460
 
@@ -282,8 +480,9 @@ List all key attributes in order from most impactful to least impactful using th
282
480
  {
283
481
  "fullPath": "signature[0].config.enabled",
284
482
  "description": "Controls whether the main processing logic runs",
483
+ "codeSnippets": ["if (!config.enabled) return", "enabled && processData()"],
285
484
  "dependencies": [
286
- "signature[0].analysisMode": "must be 'full' for 'enabled' to have effect"
485
+ { "path": "signature[0].analysisMode", "requiredValue": "full", "description": "must be 'full' for 'enabled' to have effect" }
287
486
  ],
288
487
  "valueType": "boolean",
289
488
  "validValueOptions": ["true", "false"]
@@ -291,4 +490,6 @@ List all key attributes in order from most impactful to least impactful using th
291
490
  ]
292
491
  }
293
492
  \`\`\`
493
+
494
+ The \`codeSnippets\` field is required - provide 1-3 short code excerpts (under 80 chars each) showing exactly where and how this attribute is used. These snippets must appear verbatim in the code.
294
495
  `;
@@ -318,29 +318,25 @@ Use for relative dates. Code runs in Node (no browser APIs, no external librarie
318
318
  Use simple elements only (\`<div>\`, \`<span>\`). No custom components.
319
319
 
320
320
  ## Mock Data Keys
321
- Preserve keys exactly as written in the structure. There are two formats:
321
+ **CRITICAL: Use keys EXACTLY as provided in the structure. Do NOT change key formats.**
322
322
 
323
- ### Standard function calls
323
+ Keys use the canonical format: \`EntityName::hookName::index\`
324
324
  \`\`\`json
325
325
  {
326
326
  "mockData": {
327
- "useUser()": { "user": { "name": "John" } },
328
- "from().select()": [{ "id": "1" }]
327
+ "DashboardPage::useLoaderData::0": { "user": { "name": "John" } },
328
+ "DashboardPage::useFetcher::0": { "data": null, "state": "idle" },
329
+ "DashboardPage::useFetcher::1": { "data": { "reportId": "abc123" } }
329
330
  }
330
331
  }
331
332
  \`\`\`
332
333
 
333
- ### Variable-qualified calls (for multiple calls to the same function)
334
- When the same function is called multiple times with results stored in different variables, keys use the format \`variableName <- functionName\`:
335
- \`\`\`json
336
- {
337
- "mockData": {
338
- "entityDiffFetcher <- useFetcher": { "data": null, "state": "idle" },
339
- "reportFetcher <- useFetcher": { "data": { "reportId": "abc123" }, "state": "idle" }
340
- }
341
- }
342
- \`\`\`
343
- This reads as "entityDiffFetcher receives from useFetcher". Each variable gets its own distinct mock data.
334
+ The format is deterministic:
335
+ - \`EntityName\` - the component name
336
+ - \`hookName\` - the function/hook being called
337
+ - \`index\` - distinguishes multiple calls to the same hook (0, 1, 2...)
338
+
339
+ **You MUST use the exact keys provided in the structure. Do NOT substitute variable names or use alternative formats.**
344
340
 
345
341
  ## Response Format
346
342
  \`\`\`json