@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
@@ -8,6 +8,7 @@ import {
8
8
  PlaywrightInstruction,
9
9
  ReadonlyAnalysisMap,
10
10
  Scenario,
11
+ ValueOptionRef,
11
12
  } from '~codeyam/types';
12
13
  // import findMatchingAttribute from './findMatchingAttribute';
13
14
  import { awsLog } from '~codeyam/utils';
@@ -18,14 +19,20 @@ export interface ScenarioResult {
18
19
  name: string;
19
20
  testName: string;
20
21
  description: string;
21
- // New format: { dataStructurePath: { localVariable, instruction } }
22
- // Old format (deprecated): { path: instruction_string }
22
+ /**
23
+ * Key attribute instructions with structured value references.
24
+ * Format: { dataStructurePath: { localVariable, instruction, valueOptionRef? } }
25
+ */
23
26
  keyAttributeInstructions: {
24
27
  [key: string]:
25
28
  | string
26
29
  | {
27
30
  localVariable: string;
28
31
  instruction: string;
32
+ /** Reference to validValueOption index for tracking coverage */
33
+ valueOptionRef?: ValueOptionRef;
34
+ /** Reference to errorValueOption index for error scenarios */
35
+ errorOptionRef?: ValueOptionRef;
29
36
  };
30
37
  };
31
38
  codeSnippet: string;
@@ -212,6 +219,17 @@ Focus scenarios on demonstrating this specific behavior change.
212
219
 
213
220
  ${contextSection}${scenarioCountText}
214
221
 
222
+ ## Coverage Goals (IMPORTANT)
223
+ Your primary goal is to MAXIMIZE coverage of key attributes across all scenarios:
224
+
225
+ 1. **Use ALL validValueOptions**: Each key attribute has indexed \`validValueOptions\`. Across your scenarios, try to use EVERY option at least once. If an attribute has 3 options (indices 0, 1, 2), create scenarios that collectively cover all 3.
226
+
227
+ 2. **Prioritize attributes with dependencies**: Key attributes with a \`dependencies\` array are HIGH PRIORITY - they control conditionally-rendered content. Create scenarios that satisfy these dependencies to reveal gated UI/behavior.
228
+
229
+ 3. **Cover conditional branches**: Use \`codeUsages\` to identify all conditional paths. If code shows \`status === 'active'\` and \`status === 'pending'\`, ensure scenarios cover BOTH values.
230
+
231
+ 4. **Vary values strategically**: Don't repeat the same validValueOption across scenarios unless necessary. Use different indices to maximize coverage.
232
+
215
233
  ## Default Scenario Rules
216
234
  The FIRST scenario MUST be named exactly "${DEFAULT_SCENARIO_NAME}" (case-sensitive).
217
235
  - Fill ALL key attributes using values from their \`validValueOptions\` list
@@ -219,23 +237,69 @@ The FIRST scenario MUST be named exactly "${DEFAULT_SCENARIO_NAME}" (case-sensit
219
237
  - Ignore error-related attributes (set to null)
220
238
  - NEVER include \`playwrightInstructions\` - we need a screenshot BEFORE any user interaction
221
239
  - Do NOT add playwrightInstructions even if the component has forms/buttons - default shows initial state only
240
+ - **For attributes WITH dependencies**: The Default scenario should satisfy ALL dependencies so the attribute's effect is visible
222
241
 
223
242
  ## Other Scenarios
224
243
  - Each produces DISTINCT output (visual: different screenshot; backend: different return/side-effect)
244
+ - **Use DIFFERENT validValueOptions** than the Default scenario - this is how we achieve coverage
225
245
  - Only specify attributes that DIFFER from default
246
+ - Target uncovered validValueOptions: check which indices you haven't used yet
226
247
  - May include \`playwrightInstructions\` for user interactions (clicks, form fills)
227
248
 
249
+ ## Using codeUsages for Branch Coverage
250
+ Key attributes may include a \`codeUsages\` array showing exactly where they're used in conditionals:
251
+ \`\`\`json
252
+ {
253
+ "codeUsages": [
254
+ { "line": 45, "code": "if (status === 'active')", "context": "Used in if statement (comparison check)" }
255
+ ]
256
+ }
257
+ \`\`\`
258
+ Use this to ensure scenarios cover all conditional branches. If you see \`status === 'active'\`, create scenarios for both active AND non-active states.
259
+
260
+ ## Handling Dependencies (Compound Conditionals) - HIGH PRIORITY
261
+ Key attributes with \`dependencies\` are the MOST IMPORTANT to cover because they reveal conditionally-gated content that only appears when multiple conditions are satisfied together.
262
+
263
+ **Why this matters**: If you see \`items.length > 0 && !isLoading && !hasError\`, the content only renders when ALL THREE conditions are true. Missing even one dependency means the UI won't show.
264
+
265
+ **Strategy for dependent attributes**:
266
+ 1. **Default scenario**: MUST satisfy ALL dependencies of the highest-impact key attributes
267
+ 2. **Other scenarios**: Can vary the dependent values to show alternative states (e.g., what happens when isLoading=true)
268
+
269
+ When a key attribute has dependencies like:
270
+ \`\`\`json
271
+ {
272
+ "dependencies": [
273
+ { "path": "signature[0].isLoading", "requiredValue": false },
274
+ { "path": "signature[0].hasError", "requiredValue": false }
275
+ ]
276
+ }
277
+ \`\`\`
278
+ The Default scenario MUST set BOTH dependent attributes to their required values so the key attribute's effect is visible.
279
+
280
+ **Creating scenarios for dependent pathways**:
281
+ - Create at least one scenario where ALL dependencies are satisfied (usually Default)
282
+ - Consider creating additional scenarios that intentionally break dependencies to show the "hidden" state
283
+
228
284
  ## keyAttributeInstructions Format
229
- Use \`dataStructurePath\` as key, include both variable name and instruction:
285
+ Use \`dataStructurePath\` as key. Include variable name, instruction, AND a valueOptionRef that references which validValueOption you're using:
230
286
  \`\`\`json
231
287
  {
232
288
  "useDiffModal().diffView": {
233
289
  "localVariable": "diffView",
234
- "instruction": "Set to 'split' mode"
290
+ "instruction": "Set to 'split' mode",
291
+ "valueOptionRef": { "index": 0, "refType": "exact" }
235
292
  }
236
293
  }
237
294
  \`\`\`
238
295
 
296
+ ### valueOptionRef Types
297
+ - \`"exact"\`: Uses the validValueOption at this index exactly
298
+ - \`"derived"\`: Based on this validValueOption but modified (include \`derivation\` field explaining how)
299
+ - \`"custom"\`: Value not from validValueOptions list (use sparingly)
300
+
301
+ The \`index\` refers to the validValueOptions array position (0 = first option).
302
+
239
303
  ## playwrightInstructions (optional, non-default only)
240
304
  \`\`\`json
241
305
  {
@@ -263,24 +327,63 @@ Use when: data only appears after user action (button click, form submit), or ke
263
327
  "dataScenarios": [
264
328
  {
265
329
  "name": "${DEFAULT_SCENARIO_NAME}",
266
- "testName": "it(\"displays notifications with unread indicator\")",
267
- "description": "Default state with 3 unread and 2 read notifications",
330
+ "testName": "it(\"displays items list with data\")",
331
+ "description": "Shows item list when data is loaded and no errors",
268
332
  "keyAttributeInstructions": {
269
- "useNotifications().notifications[]": { "localVariable": "notifications[]", "instruction": "Create 5 notifications" },
270
- "useNotifications().notifications[].read": { "localVariable": "notifications[].read", "instruction": "false for 3, true for 2" }
333
+ "useData().items[]": {
334
+ "localVariable": "items[]",
335
+ "instruction": "Array with 3 items",
336
+ "valueOptionRef": { "index": 0, "refType": "exact" }
337
+ },
338
+ "useData().isLoading": {
339
+ "localVariable": "isLoading",
340
+ "instruction": "false - satisfies dependency for items to show",
341
+ "valueOptionRef": { "index": 1, "refType": "exact" }
342
+ },
343
+ "useData().status": {
344
+ "localVariable": "status",
345
+ "instruction": "Set to 'success'",
346
+ "valueOptionRef": { "index": 0, "refType": "exact" }
347
+ }
348
+ }
349
+ },
350
+ {
351
+ "name": "Loading state",
352
+ "testName": "it(\"shows spinner when loading\")",
353
+ "description": "Data is loading - items hidden, spinner shown",
354
+ "keyAttributeInstructions": {
355
+ "useData().isLoading": {
356
+ "localVariable": "isLoading",
357
+ "instruction": "true - breaks dependency, items won't show",
358
+ "valueOptionRef": { "index": 0, "refType": "exact" }
359
+ },
360
+ "useData().status": {
361
+ "localVariable": "status",
362
+ "instruction": "Set to 'loading' for coverage of loading state",
363
+ "valueOptionRef": { "index": 1, "refType": "exact" }
364
+ }
271
365
  }
272
366
  },
273
367
  {
274
368
  "name": "Empty state",
275
- "testName": "it(\"shows placeholder when no notifications\")",
276
- "description": "User has no notifications",
369
+ "testName": "it(\"shows empty message when no items\")",
370
+ "description": "No items to display",
277
371
  "keyAttributeInstructions": {
278
- "useNotifications().notifications[]": { "localVariable": "notifications[]", "instruction": "Empty array" }
372
+ "useData().items[]": {
373
+ "localVariable": "items[]",
374
+ "instruction": "Empty array [] to show empty state",
375
+ "valueOptionRef": { "index": 1, "refType": "exact" }
376
+ }
279
377
  }
280
378
  }
281
379
  ]
282
380
  }
283
381
  \`\`\`
382
+ Note how the example:
383
+ - Default satisfies ALL dependencies (isLoading=false) so items content shows
384
+ - "Loading state" uses a different valueOptionRef for status to cover that code path
385
+ - "Empty state" covers the empty array case to maximize coverage
386
+ - Instructions describe the VALUE, not the index (e.g., "Empty array []" not "uses index 1")
284
387
  `;
285
388
  }
286
389
 
@@ -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 {