@codeyam/codeyam-cli 0.1.0-staging.596f0eb → 0.1.0-staging.76566f9

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 (354) 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 +2 -1
  4. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +2 -0
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +22 -0
  6. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +23 -1
  7. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +401 -106
  8. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +60 -0
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +734 -45
  10. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
  11. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +715 -0
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +233 -75
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +34 -1
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -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/generateChangesEntityScenarioData.ts +41 -0
  21. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +37 -4
  22. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +5 -0
  23. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +213 -12
  24. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +36 -25
  25. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +114 -11
  26. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  27. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  28. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
  29. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +42 -2
  30. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +38 -2
  31. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  32. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +5 -0
  33. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
  34. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +127 -43
  35. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +158 -0
  36. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +405 -45
  37. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  38. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +260 -133
  39. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +10 -5
  40. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +77 -83
  41. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -5
  42. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +196 -86
  43. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  44. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  45. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  46. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  47. package/analyzer-template/packages/aws/package.json +1 -1
  48. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  49. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  50. package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
  51. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  52. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +20 -9
  53. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
  54. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
  56. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
  57. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  58. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +8 -1
  59. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  60. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +14 -7
  61. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  62. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  63. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  64. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -1
  65. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  66. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  67. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  68. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  69. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  70. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  71. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  72. package/analyzer-template/packages/github/dist/types/index.d.ts +4 -3
  73. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  74. package/analyzer-template/packages/github/dist/types/index.js +1 -0
  75. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  76. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +31 -1
  77. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  78. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +51 -1
  79. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  80. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +21 -1
  81. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
  82. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
  83. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  84. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  85. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  86. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  87. package/analyzer-template/packages/types/index.ts +8 -0
  88. package/analyzer-template/packages/types/src/types/Analysis.ts +32 -1
  89. package/analyzer-template/packages/types/src/types/Scenario.ts +75 -6
  90. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +49 -0
  91. package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
  92. package/analyzer-template/packages/utils/dist/types/index.d.ts +4 -3
  93. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  94. package/analyzer-template/packages/utils/dist/types/index.js +1 -0
  95. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  96. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +31 -1
  97. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  98. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +51 -1
  99. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  100. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +21 -1
  101. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
  102. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
  103. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  104. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  105. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  106. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  107. package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
  108. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  109. package/analyzer-template/playwright/takeScreenshot.ts +9 -7
  110. package/analyzer-template/project/constructMockCode.ts +286 -84
  111. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +77 -37
  112. package/analyzer-template/project/reconcileMockDataKeys.ts +5 -2
  113. package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
  114. package/analyzer-template/project/serverOnlyModules.ts +71 -23
  115. package/analyzer-template/project/start.ts +10 -0
  116. package/analyzer-template/project/startScenarioCapture.ts +73 -41
  117. package/analyzer-template/project/writeMockDataTsx.ts +115 -54
  118. package/analyzer-template/project/writeScenarioComponents.ts +571 -162
  119. package/analyzer-template/project/writeSimpleRoot.ts +11 -13
  120. package/background/src/lib/virtualized/project/constructMockCode.js +265 -75
  121. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  122. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +67 -32
  123. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  124. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +5 -2
  125. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  126. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
  127. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  128. package/background/src/lib/virtualized/project/serverOnlyModules.js +62 -25
  129. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
  130. package/background/src/lib/virtualized/project/start.js +6 -0
  131. package/background/src/lib/virtualized/project/start.js.map +1 -1
  132. package/background/src/lib/virtualized/project/startScenarioCapture.js +54 -31
  133. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  134. package/background/src/lib/virtualized/project/writeMockDataTsx.js +106 -46
  135. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  136. package/background/src/lib/virtualized/project/writeScenarioComponents.js +399 -106
  137. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  138. package/background/src/lib/virtualized/project/writeSimpleRoot.js +11 -11
  139. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  140. package/codeyam-cli/src/cli.js +2 -0
  141. package/codeyam-cli/src/cli.js.map +1 -1
  142. package/codeyam-cli/src/commands/debug.js +14 -2
  143. package/codeyam-cli/src/commands/debug.js.map +1 -1
  144. package/codeyam-cli/src/commands/recapture.js +215 -0
  145. package/codeyam-cli/src/commands/recapture.js.map +1 -0
  146. package/codeyam-cli/src/commands/report.js +26 -23
  147. package/codeyam-cli/src/commands/report.js.map +1 -1
  148. package/codeyam-cli/src/utils/backgroundServer.js +2 -2
  149. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  150. package/codeyam-cli/src/utils/generateReport.js +252 -106
  151. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  152. package/codeyam-cli/src/utils/install-skills.js +2 -2
  153. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  154. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
  155. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  156. package/codeyam-cli/src/utils/queue/job.js +140 -16
  157. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  158. package/codeyam-cli/src/utils/queue/manager.js +19 -7
  159. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  160. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  161. package/codeyam-cli/src/webserver/app/lib/database.js +47 -0
  162. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  163. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  164. package/codeyam-cli/src/webserver/backgroundServer.js +5 -10
  165. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  166. package/codeyam-cli/src/webserver/bootstrap.js +9 -0
  167. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
  168. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +1 -0
  169. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-efWKDYMr.js → EntityTypeBadge-CzGX-miz.js} +1 -1
  170. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +41 -0
  171. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +25 -0
  172. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CBQPrpT0.js +3 -0
  173. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-D1CdlbrV.js +6 -0
  174. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-wDPcZNKx.js +3 -0
  175. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +11 -0
  176. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BfmDgXxG.js +1 -0
  177. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +15 -0
  178. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-COPstp9J.js → TruncatedFilePath-6J7zDUD5.js} +1 -1
  179. package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +11 -0
  180. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CVP_WGQ3.js +32 -0
  181. package/codeyam-cli/src/webserver/build/client/assets/api.link-scenario-value-l0sNRNKZ.js +1 -0
  182. package/codeyam-cli/src/webserver/build/client/assets/api.update-key-attributes-l0sNRNKZ.js +1 -0
  183. package/codeyam-cli/src/webserver/build/client/assets/api.update-valid-values-l0sNRNKZ.js +1 -0
  184. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BYimnrHg.js +6 -0
  185. package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +51 -0
  186. package/codeyam-cli/src/webserver/build/client/assets/circle-check-CaVsIRxt.js +6 -0
  187. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgUsG7ib.js +21 -0
  188. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +1 -0
  189. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +1 -0
  190. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-Dt-SjPsw.js +23 -0
  191. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +1 -0
  192. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +1 -0
  193. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-CfLCUi9S.js +5 -0
  194. package/codeyam-cli/src/webserver/build/client/assets/entry.client-DKJyZfAY.js +29 -0
  195. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DAtOlaWE.js +1 -0
  196. package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +1 -0
  197. package/codeyam-cli/src/webserver/build/client/assets/git-D62Lxxmv.js +15 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/globals-C9s7Lhdl.css +1 -0
  199. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  200. package/codeyam-cli/src/webserver/build/client/assets/index-BosqDOlH.js +3 -0
  201. package/codeyam-cli/src/webserver/build/client/assets/index-CzNNiTkw.js +9 -0
  202. package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +1 -0
  203. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-CNp9QFCX.js +6 -0
  204. package/codeyam-cli/src/webserver/build/client/assets/manifest-0d27da29.js +1 -0
  205. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/root-B_wIKCIf.js +56 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  208. package/codeyam-cli/src/webserver/build/client/assets/search-DDGjYAMJ.js +6 -0
  209. package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +1 -0
  210. package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +1 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CBc5dE1s.js +6 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +1 -0
  213. package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +1 -0
  214. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-3pmpUQB-.js → useLastLogLine-BqPPNjAl.js} +1 -1
  215. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +1 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/{useToast-DEyawJ8r.js → useToast-DWHcCcl1.js} +1 -1
  217. package/codeyam-cli/src/webserver/build/server/assets/index-CU58-Ttc.js +1 -0
  218. package/codeyam-cli/src/webserver/build/server/assets/server-build-D35o2uae.js +175 -0
  219. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  220. package/codeyam-cli/src/webserver/build-info.json +5 -5
  221. package/codeyam-cli/src/webserver/devServer.js +1 -3
  222. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  223. package/codeyam-cli/templates/codeyam-setup-skill.md +138 -3
  224. package/codeyam-cli/templates/debug-codeyam.md +625 -0
  225. package/package.json +14 -14
  226. package/packages/ai/src/lib/analyzeScope.js +2 -0
  227. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  228. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +16 -0
  229. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  230. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +16 -0
  231. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  232. package/packages/ai/src/lib/astScopes/processExpression.js +305 -88
  233. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  234. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +582 -41
  235. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  236. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
  237. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  238. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +454 -0
  239. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  240. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +173 -55
  241. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  242. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
  243. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  244. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +30 -1
  245. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  246. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
  247. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  248. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  249. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  250. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +28 -2
  251. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  252. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +179 -17
  253. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
  254. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +6 -0
  255. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
  256. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +41 -0
  257. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  258. package/packages/ai/src/lib/generateChangesEntityScenarios.js +37 -4
  259. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  260. package/packages/ai/src/lib/generateEntityDataStructure.js +4 -0
  261. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  262. package/packages/ai/src/lib/generateEntityKeyAttributes.js +176 -9
  263. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
  264. package/packages/ai/src/lib/generateEntityScenarioData.js +29 -25
  265. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  266. package/packages/ai/src/lib/generateEntityScenarios.js +105 -9
  267. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  268. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  269. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  270. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  271. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  272. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
  273. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  274. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +38 -2
  275. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  276. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +38 -2
  277. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  278. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  279. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  280. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  281. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
  282. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  283. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +100 -23
  284. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  285. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +125 -0
  286. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  287. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +298 -45
  288. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  289. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  290. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  291. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +201 -80
  292. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  293. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +10 -5
  294. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
  295. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +55 -69
  296. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  297. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -5
  298. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  299. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +171 -81
  300. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  301. package/packages/database/src/lib/kysely/db.js +2 -2
  302. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  303. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  304. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  305. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  306. package/packages/generate/src/lib/deepMerge.js +27 -1
  307. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  308. package/packages/types/index.js +1 -0
  309. package/packages/types/index.js.map +1 -1
  310. package/packages/types/src/types/Scenario.js +21 -1
  311. package/packages/types/src/types/Scenario.js.map +1 -1
  312. package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
  313. package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  314. package/scripts/finalize-analyzer.cjs +3 -1
  315. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  316. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  317. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-CVbSvOjo.js +0 -1
  318. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-DcwcHyl5.js +0 -1
  319. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-WgwC1GfJ.js +0 -26
  320. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-IEKom9O2.js +0 -3
  321. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-BYnfxbUG.js +0 -3
  322. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-_lBPJCzG.js +0 -1
  323. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-lHVhvsu_.js +0 -1
  324. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-d_TBk4GQ.js +0 -5
  325. package/codeyam-cli/src/webserver/build/client/assets/_index-kGT7VUqj.js +0 -1
  326. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DDGmhu7P.js +0 -7
  327. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-n_HPRfM_.js +0 -1
  328. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CbVoyx1U.js +0 -26
  329. package/codeyam-cli/src/webserver/build/client/assets/circle-check-D1VOYveA.js +0 -1
  330. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-YR8jjAlu.js +0 -1
  331. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-B8vP3V_s.js +0 -1
  332. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CN6aLCT1.js +0 -16
  333. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DA5Jeu2P.js +0 -1
  334. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BTeitalf.js +0 -5
  335. package/codeyam-cli/src/webserver/build/client/assets/entry.client-du6UEYD-.js +0 -13
  336. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-BpjkhMoi.js +0 -1
  337. package/codeyam-cli/src/webserver/build/client/assets/files-BQGvk4lJ.js +0 -1
  338. package/codeyam-cli/src/webserver/build/client/assets/git-DVdYRT-I.js +0 -12
  339. package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.css +0 -1
  340. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  341. package/codeyam-cli/src/webserver/build/client/assets/index-DCG-vks0.js +0 -1
  342. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-GazdNeLl.js +0 -1
  343. package/codeyam-cli/src/webserver/build/client/assets/manifest-0b694d28.js +0 -1
  344. package/codeyam-cli/src/webserver/build/client/assets/root-D3tQP7hx.js +0 -16
  345. package/codeyam-cli/src/webserver/build/client/assets/search-CIY6XmtE.js +0 -1
  346. package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
  347. package/codeyam-cli/src/webserver/build/client/assets/settings-CoMDgElu.js +0 -1
  348. package/codeyam-cli/src/webserver/build/client/assets/simulations-agkniXp2.js +0 -1
  349. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-B2VUcygF.js +0 -1
  350. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-EvdK-zXP.js +0 -1
  351. package/codeyam-cli/src/webserver/build/server/assets/index-DGVHQEXD.js +0 -1
  352. package/codeyam-cli/src/webserver/build/server/assets/server-build-CghkTkIL.js +0 -166
  353. package/codeyam-cli/templates/debug-command.md +0 -303
  354. /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
@@ -1,5 +1,5 @@
1
1
  import ts from 'typescript';
2
- import { ConditionalUsage } from './astScopes/types';
2
+ import { CompoundConditional, ConditionalUsage } from './astScopes/types';
3
3
  import { StructuredPath } from './astScopes/paths';
4
4
  import {
5
5
  isComparisonOperator,
@@ -28,20 +28,50 @@ export default function getConditionalUsagesFromCode(
28
28
  ts.ScriptKind.TSX,
29
29
  );
30
30
 
31
- function addUsage(usage: ConditionalUsage) {
31
+ /**
32
+ * Helper to get source location from an AST node
33
+ */
34
+ function getSourceLocation(
35
+ node: ts.Node,
36
+ ): ConditionalUsage['sourceLocation'] {
37
+ const start = node.getStart(sourceFile);
38
+ const { line, character } = sourceFile.getLineAndCharacterOfPosition(start);
39
+ const codeSnippet = node.getText(sourceFile);
40
+
41
+ return {
42
+ lineNumber: line + 1, // Convert to 1-based
43
+ column: character,
44
+ codeSnippet:
45
+ codeSnippet.length > 100
46
+ ? codeSnippet.slice(0, 100) + '...'
47
+ : codeSnippet,
48
+ };
49
+ }
50
+
51
+ function addUsage(
52
+ usage: Omit<ConditionalUsage, 'sourceLocation'>,
53
+ node: ts.Node,
54
+ ) {
55
+ const fullUsage: ConditionalUsage = {
56
+ ...usage,
57
+ sourceLocation: getSourceLocation(node),
58
+ };
59
+
32
60
  if (!conditionalUsages[usage.path]) {
33
61
  conditionalUsages[usage.path] = [];
34
62
  }
35
- // Avoid duplicates
63
+ // Avoid duplicates (but allow different source locations)
36
64
  const exists = conditionalUsages[usage.path].some(
37
65
  (existing) =>
38
- existing.location === usage.location &&
39
- existing.conditionType === usage.conditionType &&
66
+ existing.location === fullUsage.location &&
67
+ existing.conditionType === fullUsage.conditionType &&
68
+ existing.sourceLocation?.lineNumber ===
69
+ fullUsage.sourceLocation?.lineNumber &&
40
70
  JSON.stringify(existing.comparedValues) ===
41
- JSON.stringify(usage.comparedValues),
71
+ JSON.stringify(fullUsage.comparedValues),
42
72
  );
43
73
  if (!exists) {
44
- conditionalUsages[usage.path].push(usage);
74
+ conditionalUsages[usage.path].push(fullUsage);
45
75
  }
46
76
  }
47
77
 
@@ -91,33 +121,45 @@ export default function getConditionalUsagesFromCode(
91
121
 
92
122
  if (leftPath && isLiteralExpression(unwrapped.right)) {
93
123
  const literalValue = getLiteralValue(unwrapped.right);
94
- addUsage({
95
- path: leftPath,
96
- conditionType: 'comparison',
97
- comparedValues:
98
- literalValue !== undefined ? [literalValue] : undefined,
99
- location,
100
- });
124
+ addUsage(
125
+ {
126
+ path: leftPath,
127
+ conditionType: 'comparison',
128
+ comparedValues:
129
+ literalValue !== undefined ? [literalValue] : undefined,
130
+ location,
131
+ },
132
+ unwrapped,
133
+ );
101
134
  return;
102
135
  }
103
136
 
104
137
  if (rightPath && isLiteralExpression(unwrapped.left)) {
105
138
  const literalValue = getLiteralValue(unwrapped.left);
106
- addUsage({
107
- path: rightPath,
108
- conditionType: 'comparison',
109
- comparedValues:
110
- literalValue !== undefined ? [literalValue] : undefined,
111
- location,
112
- });
139
+ addUsage(
140
+ {
141
+ path: rightPath,
142
+ conditionType: 'comparison',
143
+ comparedValues:
144
+ literalValue !== undefined ? [literalValue] : undefined,
145
+ location,
146
+ },
147
+ unwrapped,
148
+ );
113
149
  return;
114
150
  }
115
151
 
116
152
  if (leftPath) {
117
- addUsage({ path: leftPath, conditionType: 'comparison', location });
153
+ addUsage(
154
+ { path: leftPath, conditionType: 'comparison', location },
155
+ unwrapped,
156
+ );
118
157
  }
119
158
  if (rightPath) {
120
- addUsage({ path: rightPath, conditionType: 'comparison', location });
159
+ addUsage(
160
+ { path: rightPath, conditionType: 'comparison', location },
161
+ unwrapped,
162
+ );
121
163
  }
122
164
  return;
123
165
  }
@@ -134,7 +176,7 @@ export default function getConditionalUsagesFromCode(
134
176
  // Handle simple identifiers or property accesses (truthiness checks)
135
177
  const path = getPathFromNode(unwrapped, sourceFile);
136
178
  if (path) {
137
- addUsage({ path, conditionType: 'truthiness', location });
179
+ addUsage({ path, conditionType: 'truthiness', location }, unwrapped);
138
180
  }
139
181
  }
140
182
 
@@ -170,12 +212,15 @@ export default function getConditionalUsagesFromCode(
170
212
  }
171
213
  }
172
214
  }
173
- addUsage({
174
- path: discriminantPath,
175
- conditionType: 'switch',
176
- comparedValues: caseValues.length > 0 ? caseValues : undefined,
177
- location: 'switch',
178
- });
215
+ addUsage(
216
+ {
217
+ path: discriminantPath,
218
+ conditionType: 'switch',
219
+ comparedValues: caseValues.length > 0 ? caseValues : undefined,
220
+ location: 'switch',
221
+ },
222
+ node,
223
+ );
179
224
  }
180
225
  }
181
226
 
@@ -269,9 +314,13 @@ interface EnrichedConditionalUsageInput extends ConditionalUsage {
269
314
 
270
315
  export function formatConditionalUsagesForPrompt(
271
316
  conditionalUsages: Record<string, EnrichedConditionalUsageInput[]>,
317
+ compoundConditionals?: CompoundConditional[],
272
318
  ): string {
273
319
  const entries = Object.entries(conditionalUsages);
274
- if (entries.length === 0) {
320
+ if (
321
+ entries.length === 0 &&
322
+ (!compoundConditionals || compoundConditionals.length === 0)
323
+ ) {
275
324
  return '';
276
325
  }
277
326
 
@@ -315,9 +364,72 @@ export function formatConditionalUsagesForPrompt(
315
364
  description += 'Used in truthiness check (presence/absence matters)';
316
365
  }
317
366
 
367
+ // Include source locations if available (show up to 3 examples)
368
+ const usagesWithLocation = usages.filter((u) => u.sourceLocation);
369
+ if (usagesWithLocation.length > 0) {
370
+ description += '\n - Locations:';
371
+ for (const usage of usagesWithLocation.slice(0, 3)) {
372
+ const loc = usage.sourceLocation!;
373
+ const snippet =
374
+ loc.codeSnippet.length > 60
375
+ ? loc.codeSnippet.slice(0, 60) + '...'
376
+ : loc.codeSnippet;
377
+ description += `\n - Line ${loc.lineNumber}: \`${snippet}\``;
378
+ }
379
+ if (usagesWithLocation.length > 3) {
380
+ description += `\n - ... and ${usagesWithLocation.length - 3} more`;
381
+ }
382
+ }
383
+
318
384
  lines.push(description);
319
385
  }
320
386
 
387
+ // Add compound conditionals section if present
388
+ if (compoundConditionals && compoundConditionals.length > 0) {
389
+ lines.push('');
390
+ lines.push(
391
+ '### Compound Conditionals (ALL conditions must be true together)',
392
+ );
393
+ lines.push('');
394
+ lines.push(
395
+ 'These conditions are combined with && and must ALL be satisfied together for a code path to execute.',
396
+ );
397
+ lines.push(
398
+ 'IMPORTANT: Ensure at least one scenario satisfies ALL conditions in each compound conditional simultaneously.',
399
+ );
400
+ lines.push('');
401
+
402
+ for (const compound of compoundConditionals) {
403
+ lines.push(`- Chain at line ${compound.sourceLocation.lineNumber}:`);
404
+ lines.push(` - Expression: \`${compound.expression}\``);
405
+ lines.push(` - All these conditions must be TRUE together:`);
406
+
407
+ for (const condition of compound.conditions) {
408
+ let conditionDesc = ` - \`${condition.path}\``;
409
+ if (
410
+ condition.conditionType === 'comparison' &&
411
+ condition.comparedValues?.length
412
+ ) {
413
+ const op = condition.isNegated ? '!== ' : '=== ';
414
+ conditionDesc += ` ${op}${condition.comparedValues.map((v) => `"${v}"`).join(' or ')}`;
415
+ } else if (condition.conditionType === 'truthiness') {
416
+ conditionDesc += condition.isNegated
417
+ ? ' must be falsy (false, null, undefined, 0, "")'
418
+ : ' must be truthy';
419
+ }
420
+ if (condition.requiredValue !== undefined) {
421
+ conditionDesc += ` (required: ${JSON.stringify(condition.requiredValue)})`;
422
+ }
423
+ lines.push(conditionDesc);
424
+ }
425
+ }
426
+
427
+ lines.push('');
428
+ lines.push(
429
+ 'When key attributes are part of compound conditionals, list the other conditions as dependencies.',
430
+ );
431
+ }
432
+
321
433
  lines.push('');
322
434
  lines.push(
323
435
  'Consider these attributes as candidates for key attributes, especially those with specific comparison values.',
@@ -1,18 +1,22 @@
1
1
  import { saveLlmCall } from '~codeyam/aws/dynamodb';
2
2
  import { ScenariosDataStructure, Scenario } from '~codeyam/types';
3
- import * as lib from '.';
4
3
  import completionCall from './completionCall';
5
- import guessNewScenarioDataFromDescriptionGenerator from './promptGenerators/guessNewScenarioDataFromDescriptionGenerator';
4
+ import guessNewScenarioDataFromDescriptionGenerator, {
5
+ KeyAttributeSelection,
6
+ } from './promptGenerators/guessNewScenarioDataFromDescriptionGenerator';
6
7
  import guessEditScenarioDataFromDescriptionGenerator from './promptGenerators/guessEditScenarioDataFromDescriptionGenerator';
7
8
  import { AI, DEFAULT_LARGER_MODEL } from '~codeyam/ai';
8
9
  import { parseJsonSafe } from './parsers/parseJsonSafe';
9
10
 
11
+ export type { KeyAttributeSelection };
12
+
10
13
  export interface GuessScenarioDataFromDescriptionArgs {
11
14
  description: string;
12
15
  editingMockName?: string;
13
16
  editingMockData?: { [key: string]: unknown };
14
17
  existingScenarios: Scenario[];
15
18
  scenariosDataStructure: ScenariosDataStructure;
19
+ keyAttributeSelections?: KeyAttributeSelection[];
16
20
  model?: AI.Model;
17
21
  }
18
22
 
@@ -22,6 +26,7 @@ export default async function generateEntityScenarios({
22
26
  editingMockData,
23
27
  existingScenarios,
24
28
  scenariosDataStructure,
29
+ keyAttributeSelections,
25
30
  model,
26
31
  }: GuessScenarioDataFromDescriptionArgs): Promise<
27
32
  Scenario['metadata']['data'] | null
@@ -38,6 +43,7 @@ export default async function generateEntityScenarios({
38
43
  description,
39
44
  existingScenarios,
40
45
  scenariosDataStructure,
46
+ keyAttributeSelections,
41
47
  });
42
48
 
43
49
  const response = await completionCall({
@@ -198,6 +198,13 @@ export function gatherAttributesMap(
198
198
  const pathParts = splitOutsideParenthesesAndArrays(path);
199
199
  if (pathParts.length < 2) continue;
200
200
 
201
+ // Filter out paths that contain signature[N] anywhere
202
+ // These represent function input parameters, not data from data sources
203
+ // Key attributes must reference data sources, not function inputs
204
+ if (pathParts.some((part) => part.startsWith('signature['))) {
205
+ continue;
206
+ }
207
+
201
208
  if (mergedReturnValueSchema[path] === 'function') {
202
209
  continue;
203
210
  }
@@ -64,10 +64,28 @@ export default function generateChangesEntityScenariosGenerator({
64
64
  dataStructurePath: ka.dataStructurePath,
65
65
  localVariable: ka.internalPath,
66
66
  description: ka.description,
67
- validValueOptions: ka.validValueOptions,
67
+ // Include indexed validValueOptions for structured references
68
+ validValueOptions: ka.validValueOptions.map((value, index) => ({
69
+ index,
70
+ value,
71
+ })),
72
+ ...(ka.errorValueOptions?.length && {
73
+ errorValueOptions: ka.errorValueOptions.map((value, index) => ({
74
+ index,
75
+ value,
76
+ })),
77
+ }),
68
78
  // Include new fields when present
69
79
  ...(ka.valueType && { valueType: ka.valueType }),
70
80
  ...(ka.dependencies && { dependencies: ka.dependencies }),
81
+ // Include source locations showing where this attribute is used in conditionals
82
+ ...(ka.sourceLocations?.length && {
83
+ codeUsages: ka.sourceLocations.map((loc) => ({
84
+ line: loc.lineNumber,
85
+ code: loc.codeSnippet,
86
+ context: loc.description,
87
+ })),
88
+ }),
71
89
  }));
72
90
 
73
91
  const addedSection =
@@ -131,10 +149,32 @@ ${JSON.stringify(
131
149
  dataStructurePath: ka.dataStructurePath,
132
150
  localVariable: ka.path || ka.internalPath,
133
151
  description: ka.description,
134
- validValueOptions: ka.validValueOptions,
152
+ // Include indexed validValueOptions for structured references
153
+ validValueOptions: (ka.validValueOptions || []).map(
154
+ (value: string, index: number) => ({
155
+ index,
156
+ value,
157
+ }),
158
+ ),
159
+ ...(ka.errorValueOptions?.length && {
160
+ errorValueOptions: ka.errorValueOptions.map(
161
+ (value: string, index: number) => ({
162
+ index,
163
+ value,
164
+ }),
165
+ ),
166
+ }),
135
167
  // Include new fields when present
136
168
  ...(ka.valueType && { valueType: ka.valueType }),
137
169
  ...(ka.dependencies && { dependencies: ka.dependencies }),
170
+ // Include source locations showing where this attribute is used in conditionals
171
+ ...(ka.sourceLocations?.length && {
172
+ codeUsages: ka.sourceLocations.map((loc: any) => ({
173
+ line: loc.lineNumber,
174
+ code: loc.codeSnippet,
175
+ context: loc.description,
176
+ })),
177
+ }),
138
178
  }));
139
179
  return entityAcc;
140
180
  },
@@ -24,10 +24,28 @@ export default function generateEntityScenariosGenerator({
24
24
  dataStructurePath: ka.dataStructurePath,
25
25
  localVariable: ka.internalPath,
26
26
  description: ka.description,
27
- validValueOptions: ka.validValueOptions,
27
+ // Include indexed validValueOptions for structured references
28
+ validValueOptions: ka.validValueOptions.map((value, index) => ({
29
+ index,
30
+ value,
31
+ })),
32
+ ...(ka.errorValueOptions?.length && {
33
+ errorValueOptions: ka.errorValueOptions.map((value, index) => ({
34
+ index,
35
+ value,
36
+ })),
37
+ }),
28
38
  // Include new fields when present
29
39
  ...(ka.valueType && { valueType: ka.valueType }),
30
40
  ...(ka.dependencies && { dependencies: ka.dependencies }),
41
+ // Include source locations showing where this attribute is used in conditionals
42
+ ...(ka.sourceLocations?.length && {
43
+ codeUsages: ka.sourceLocations.map((loc) => ({
44
+ line: loc.lineNumber,
45
+ code: loc.codeSnippet,
46
+ context: loc.description,
47
+ })),
48
+ }),
31
49
  })),
32
50
  null,
33
51
  2,
@@ -46,10 +64,28 @@ ${JSON.stringify(
46
64
  localVariable: ka.internalPath,
47
65
  forDependency: ka.dependentEntityName,
48
66
  description: ka.description,
49
- validValueOptions: ka.validValueOptions,
67
+ // Include indexed validValueOptions for structured references
68
+ validValueOptions: ka.validValueOptions.map((value, index) => ({
69
+ index,
70
+ value,
71
+ })),
72
+ ...(ka.errorValueOptions?.length && {
73
+ errorValueOptions: ka.errorValueOptions.map((value, index) => ({
74
+ index,
75
+ value,
76
+ })),
77
+ }),
50
78
  // Include new fields when present
51
79
  ...(ka.valueType && { valueType: ka.valueType }),
52
80
  ...(ka.dependencies && { dependencies: ka.dependencies }),
81
+ // Include source locations showing where this attribute is used in conditionals
82
+ ...(ka.sourceLocations?.length && {
83
+ codeUsages: ka.sourceLocations.map((loc) => ({
84
+ line: loc.lineNumber,
85
+ code: loc.codeSnippet,
86
+ context: loc.description,
87
+ })),
88
+ }),
53
89
  })),
54
90
  null,
55
91
  2,
@@ -1,24 +1,50 @@
1
1
  import { ScenariosDataStructure, Scenario } from '~codeyam/types';
2
2
 
3
+ export interface KeyAttributeSelection {
4
+ path: string;
5
+ value: string;
6
+ valueOptionIndex?: number;
7
+ isCustom: boolean;
8
+ }
9
+
3
10
  interface GenerateEntityScenariosGeneratorArgs {
4
11
  description: string;
5
12
  existingScenarios: Scenario[];
6
13
  scenariosDataStructure: ScenariosDataStructure;
14
+ keyAttributeSelections?: KeyAttributeSelection[];
7
15
  }
8
16
 
9
17
  export default function guessNewScenarioDataFromDescriptionGenerator({
10
18
  description,
11
19
  existingScenarios,
12
20
  scenariosDataStructure,
21
+ keyAttributeSelections,
13
22
  }: GenerateEntityScenariosGeneratorArgs) {
23
+ let keyAttributesSection = '';
24
+ if (keyAttributeSelections && keyAttributeSelections.length > 0) {
25
+ keyAttributesSection = `
26
+ User-selected Key Attributes and Values:
27
+ The user has specifically requested these key attributes and values be used in the scenario:
28
+ ${keyAttributeSelections
29
+ .map(
30
+ (sel) =>
31
+ ` - ${sel.path}: ${sel.value}${sel.isCustom ? ' (custom value)' : ''}`,
32
+ )
33
+ .join('\n')}
34
+
35
+ IMPORTANT: The mockData MUST include these specific values for the specified paths. Generate a scenario name and description that reflects these choices.
36
+ `;
37
+ }
38
+
14
39
  return `Mock Scenario Data Structure:
15
40
  \`\`\`
16
41
  ${JSON.stringify(scenariosDataStructure, null, 2)}
17
- \`\`\
42
+ \`\`\`
18
43
  Existing Mock Scenario Data:
19
44
  \`\`\`
20
45
  ${JSON.stringify(existingScenarios, null, 2)}
21
46
  \`\`\`
22
- New Scenario user-created prompt: "${description}"
47
+ ${keyAttributesSection}
48
+ New Scenario user-created prompt: "${description || '(No additional description - generate based on selected key attributes)'}"
23
49
  `;
24
50
  }
@@ -28,6 +28,11 @@ export interface SerializableFunctionCallInfo {
28
28
  receivingVariableNames?: string[];
29
29
  /** Maps each call signature to the variable that receives its return value */
30
30
  callSignatureToVariable?: Record<string, string>;
31
+ /**
32
+ * Stores individual return value schemas per receiving variable, BEFORE merging.
33
+ * Key is the receiving variable name (e.g., "userFetcher", "reportFetcher").
34
+ */
35
+ perVariableSchemas?: Record<string, Record<string, string>>;
31
36
  }
32
37
 
33
38
  export interface SerializableFunctionResult {
@@ -8,7 +8,10 @@
8
8
  import { Entity } from '~codeyam/types';
9
9
  import { FileAnalyzer, ProjectAnalyzer } from '~codeyam/analyze';
10
10
  import { analyzeScopeLocal } from '../analyzeScope';
11
- import { ScopeInfo } from '../dataStructure/ScopeDataStructure';
11
+ import {
12
+ ScopeInfo,
13
+ resetScopeDataStructureMetrics,
14
+ } from '../dataStructure/ScopeDataStructure';
12
15
  import { SerializableDataStructure } from './SerializableDataStructure';
13
16
  import { AI } from '~codeyam/ai';
14
17
  import { setThreadContext } from '~codeyam/utils';
@@ -48,6 +51,10 @@ let fileAnalyzerPath: string | null = null;
48
51
  export default async function runAnalyzeScope(
49
52
  input: AnalyzeScopeWorkerInput,
50
53
  ): Promise<AnalyzeScopeWorkerOutput> {
54
+ // Reset metrics counters at the start of each entity analysis to prevent
55
+ // false "infinite loop" detection when processing multiple entities
56
+ resetScopeDataStructureMetrics();
57
+
51
58
  try {
52
59
  const { entity, project, dirPath, filePath, file, scope, model } = input;
53
60