@codeyam/codeyam-cli 0.1.0-staging.15d0f46 → 0.1.0-staging.1669d45

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 (625) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/common/execAsync.ts +1 -1
  3. package/analyzer-template/log.txt +3 -3
  4. package/analyzer-template/package.json +9 -5
  5. package/analyzer-template/packages/ai/index.ts +5 -3
  6. package/analyzer-template/packages/ai/package.json +1 -1
  7. package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
  8. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +152 -6
  9. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +107 -1
  10. package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
  11. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +42 -0
  12. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
  13. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +38 -1
  14. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +301 -1
  15. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +972 -106
  16. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +232 -0
  17. package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
  18. package/analyzer-template/packages/ai/src/lib/completionCall.ts +18 -2
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +1409 -138
  20. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
  21. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +771 -0
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +233 -75
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
  24. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +39 -4
  25. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
  26. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
  27. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +42 -2
  28. package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
  29. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
  30. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
  31. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +6 -0
  32. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +486 -86
  33. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +182 -104
  34. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +201 -0
  35. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
  36. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1019 -0
  37. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  38. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  39. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +276 -3
  40. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +33 -3
  41. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
  42. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
  43. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
  44. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +71 -4
  45. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -53
  46. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
  47. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  48. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +690 -0
  49. package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
  50. package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
  51. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +102 -0
  52. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
  53. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
  54. package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
  55. package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
  56. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +458 -267
  57. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +18 -0
  58. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
  59. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
  60. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
  61. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
  62. package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
  63. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +196 -0
  64. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
  65. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +588 -52
  66. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  67. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
  68. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +299 -133
  69. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +156 -0
  70. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
  71. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
  72. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +384 -94
  73. package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
  74. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
  75. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
  76. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
  77. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
  78. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
  79. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
  80. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
  81. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  82. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
  83. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
  84. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
  85. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  86. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  87. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  88. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  89. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  90. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
  91. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
  92. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
  93. package/analyzer-template/packages/aws/package.json +2 -2
  94. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  95. package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
  96. package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
  97. package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
  98. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  99. package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
  100. package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
  101. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  102. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
  103. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
  104. package/analyzer-template/packages/generate/index.ts +3 -0
  105. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
  106. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
  107. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
  108. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
  109. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  110. package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
  111. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
  112. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
  113. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  114. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
  115. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  116. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +30 -7
  117. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  118. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  119. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  120. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
  121. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
  122. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
  123. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  124. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  125. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
  126. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  127. package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
  128. package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
  129. package/analyzer-template/packages/github/dist/generate/index.js +3 -0
  130. package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
  131. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
  132. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  133. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  134. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
  135. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
  136. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  137. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  138. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
  139. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
  140. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  141. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  142. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  143. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  144. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  145. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  146. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  147. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  148. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
  149. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
  150. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
  151. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  152. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
  153. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
  154. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
  155. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
  156. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
  157. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
  158. package/analyzer-template/packages/github/dist/types/index.d.ts +2 -2
  159. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  160. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  161. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +63 -13
  162. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  163. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
  164. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
  165. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +11 -6
  166. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  167. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +146 -0
  168. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  169. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
  170. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  171. package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
  172. package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
  173. package/analyzer-template/packages/process/index.ts +2 -0
  174. package/analyzer-template/packages/process/package.json +12 -0
  175. package/analyzer-template/packages/process/tsconfig.json +8 -0
  176. package/analyzer-template/packages/types/index.ts +4 -0
  177. package/analyzer-template/packages/types/src/types/Analysis.ts +79 -13
  178. package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
  179. package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
  180. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +161 -0
  181. package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
  182. package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
  183. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  184. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  185. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +63 -13
  186. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  187. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
  188. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
  189. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +11 -6
  190. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  191. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +146 -0
  192. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  193. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
  194. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  195. package/analyzer-template/playwright/capture.ts +37 -18
  196. package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
  197. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  198. package/analyzer-template/playwright/waitForServer.ts +21 -6
  199. package/analyzer-template/project/analyzeBaselineCommit.ts +4 -0
  200. package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
  201. package/analyzer-template/project/analyzeFileEntities.ts +4 -0
  202. package/analyzer-template/project/analyzeRegularCommit.ts +4 -0
  203. package/analyzer-template/project/constructMockCode.ts +868 -132
  204. package/analyzer-template/project/controller/startController.ts +16 -1
  205. package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
  206. package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
  207. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
  208. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +49 -33
  209. package/analyzer-template/project/orchestrateCapture.ts +10 -3
  210. package/analyzer-template/project/reconcileMockDataKeys.ts +102 -2
  211. package/analyzer-template/project/runAnalysis.ts +7 -0
  212. package/analyzer-template/project/serverOnlyModules.ts +127 -2
  213. package/analyzer-template/project/start.ts +26 -4
  214. package/analyzer-template/project/startScenarioCapture.ts +72 -40
  215. package/analyzer-template/project/writeMockDataTsx.ts +118 -55
  216. package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
  217. package/analyzer-template/project/writeScenarioComponents.ts +263 -92
  218. package/analyzer-template/project/writeScenarioFiles.ts +26 -0
  219. package/analyzer-template/project/writeSimpleRoot.ts +13 -15
  220. package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
  221. package/analyzer-template/scripts/defaultCmd.sh +9 -0
  222. package/analyzer-template/tsconfig.json +2 -1
  223. package/background/src/lib/local/createLocalAnalyzer.js +1 -29
  224. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  225. package/background/src/lib/local/execAsync.js +1 -1
  226. package/background/src/lib/local/execAsync.js.map +1 -1
  227. package/background/src/lib/virtualized/common/execAsync.js +1 -1
  228. package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
  229. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +2 -1
  230. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  231. package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
  232. package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
  233. package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
  234. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  235. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +2 -1
  236. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  237. package/background/src/lib/virtualized/project/constructMockCode.js +799 -121
  238. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  239. package/background/src/lib/virtualized/project/controller/startController.js +11 -1
  240. package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
  241. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
  242. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
  243. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
  244. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
  245. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
  246. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  247. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +42 -28
  248. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  249. package/background/src/lib/virtualized/project/orchestrateCapture.js +7 -4
  250. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  251. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +87 -2
  252. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  253. package/background/src/lib/virtualized/project/runAnalysis.js +6 -0
  254. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  255. package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
  256. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
  257. package/background/src/lib/virtualized/project/start.js +21 -4
  258. package/background/src/lib/virtualized/project/start.js.map +1 -1
  259. package/background/src/lib/virtualized/project/startScenarioCapture.js +56 -30
  260. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  261. package/background/src/lib/virtualized/project/writeMockDataTsx.js +110 -48
  262. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  263. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
  264. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
  265. package/background/src/lib/virtualized/project/writeScenarioComponents.js +211 -75
  266. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  267. package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
  268. package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
  269. package/background/src/lib/virtualized/project/writeSimpleRoot.js +13 -13
  270. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  271. package/codeyam-cli/src/cli.js +5 -1
  272. package/codeyam-cli/src/cli.js.map +1 -1
  273. package/codeyam-cli/src/commands/analyze.js +1 -1
  274. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  275. package/codeyam-cli/src/commands/baseline.js +174 -0
  276. package/codeyam-cli/src/commands/baseline.js.map +1 -0
  277. package/codeyam-cli/src/commands/debug.js +28 -18
  278. package/codeyam-cli/src/commands/debug.js.map +1 -1
  279. package/codeyam-cli/src/commands/default.js +0 -15
  280. package/codeyam-cli/src/commands/default.js.map +1 -1
  281. package/codeyam-cli/src/commands/recapture.js +44 -23
  282. package/codeyam-cli/src/commands/recapture.js.map +1 -1
  283. package/codeyam-cli/src/commands/report.js +72 -24
  284. package/codeyam-cli/src/commands/report.js.map +1 -1
  285. package/codeyam-cli/src/commands/start.js +8 -12
  286. package/codeyam-cli/src/commands/start.js.map +1 -1
  287. package/codeyam-cli/src/commands/status.js +23 -1
  288. package/codeyam-cli/src/commands/status.js.map +1 -1
  289. package/codeyam-cli/src/commands/test-startup.js +1 -1
  290. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  291. package/codeyam-cli/src/commands/wipe.js +108 -0
  292. package/codeyam-cli/src/commands/wipe.js.map +1 -0
  293. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
  294. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
  295. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +27 -27
  296. package/codeyam-cli/src/utils/analysisRunner.js +8 -13
  297. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  298. package/codeyam-cli/src/utils/backgroundServer.js +12 -2
  299. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  300. package/codeyam-cli/src/utils/database.js +91 -5
  301. package/codeyam-cli/src/utils/database.js.map +1 -1
  302. package/codeyam-cli/src/utils/generateReport.js +253 -106
  303. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  304. package/codeyam-cli/src/utils/git.js +79 -0
  305. package/codeyam-cli/src/utils/git.js.map +1 -0
  306. package/codeyam-cli/src/utils/install-skills.js +11 -11
  307. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  308. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
  309. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  310. package/codeyam-cli/src/utils/queue/job.js +239 -16
  311. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  312. package/codeyam-cli/src/utils/queue/manager.js +19 -7
  313. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  314. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  315. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  316. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +5 -5
  317. package/codeyam-cli/src/utils/versionInfo.js +25 -19
  318. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  319. package/codeyam-cli/src/utils/wipe.js +128 -0
  320. package/codeyam-cli/src/utils/wipe.js.map +1 -0
  321. package/codeyam-cli/src/webserver/app/lib/database.js +96 -0
  322. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  323. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  324. package/codeyam-cli/src/webserver/backgroundServer.js +2 -5
  325. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  326. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +1 -0
  327. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-DKdsUF7Y.js → EntityTypeBadge-COi5OvsN.js} +1 -1
  328. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BwdQv49w.js +41 -0
  329. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CEleMv_j.js +34 -0
  330. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D68KarMg.js +25 -0
  331. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-L75Wvqgw.js +3 -0
  332. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-C53WM8qn.js +6 -0
  333. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-CrNkmy4i.js +3 -0
  334. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +11 -0
  335. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CQifa1n-.js +1 -0
  336. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CyaBFX7l.js +20 -0
  337. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CWjSsLqY.js → TruncatedFilePath-D36O1rzU.js} +1 -1
  338. package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +11 -0
  339. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +37 -0
  340. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DgTPh8H-.js +6 -0
  341. package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-DdQKK6on.js +51 -0
  342. package/codeyam-cli/src/webserver/build/client/assets/circle-check-Dmr2bb1R.js +6 -0
  343. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-Do4ZLUYa.js +21 -0
  344. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
  345. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
  346. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +1 -0
  347. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CbdFyxZh.js +23 -0
  348. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js +6 -0
  349. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-wDWZZO1W.js +6 -0
  350. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BMbl7MeQ.js +5 -0
  351. package/codeyam-cli/src/webserver/build/client/assets/entry.client-5wRKRIH9.js +29 -0
  352. package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
  353. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DD3SDH7t.js +1 -0
  354. package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +1 -0
  355. package/codeyam-cli/src/webserver/build/client/assets/git-zXjT7J0G.js +15 -0
  356. package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +1 -0
  357. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  358. package/codeyam-cli/src/webserver/build/client/assets/index-DLbXwndH.js +9 -0
  359. package/codeyam-cli/src/webserver/build/client/assets/index-gPZ-lad1.js +3 -0
  360. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-BsPXJ81F.js +6 -0
  361. package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +1 -0
  362. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  363. package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +57 -0
  364. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  365. package/codeyam-cli/src/webserver/build/client/assets/search-P2FKIUql.js +6 -0
  366. package/codeyam-cli/src/webserver/build/client/assets/settings-B2eDuBj8.js +1 -0
  367. package/codeyam-cli/src/webserver/build/client/assets/simulations-L18M6-kN.js +1 -0
  368. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BDz7kbVA.js +6 -0
  369. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-29dDmbH8.js +1 -0
  370. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-CmrTPlIB.js → useLastLogLine-BUm0UVJm.js} +1 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CkIOKTrZ.js +1 -0
  372. package/codeyam-cli/src/webserver/build/client/assets/{useToast-C1ig_BmP.js → useToast-KKw5kTn-.js} +1 -1
  373. package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +1 -0
  374. package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +228 -0
  375. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  376. package/codeyam-cli/src/webserver/build-info.json +5 -5
  377. package/codeyam-cli/src/webserver/devServer.js +1 -3
  378. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  379. package/codeyam-cli/src/webserver/server.js +35 -25
  380. package/codeyam-cli/src/webserver/server.js.map +1 -1
  381. package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +1 -1
  382. package/codeyam-cli/templates/codeyam:diagnose.md +625 -0
  383. package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +139 -4
  384. package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam:sim.md} +1 -1
  385. package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam:test.md} +1 -1
  386. package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam:verify.md} +1 -1
  387. package/package.json +8 -8
  388. package/packages/ai/index.js +2 -4
  389. package/packages/ai/index.js.map +1 -1
  390. package/packages/ai/src/lib/analyzeScope.js +107 -0
  391. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  392. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +76 -1
  393. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  394. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
  395. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
  396. package/packages/ai/src/lib/astScopes/methodSemantics.js +29 -0
  397. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  398. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
  399. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
  400. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +23 -0
  401. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  402. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +239 -1
  403. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  404. package/packages/ai/src/lib/astScopes/processExpression.js +728 -87
  405. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  406. package/packages/ai/src/lib/checkAllAttributes.js +24 -9
  407. package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
  408. package/packages/ai/src/lib/completionCall.js +17 -1
  409. package/packages/ai/src/lib/completionCall.js.map +1 -1
  410. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1126 -82
  411. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  412. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
  413. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  414. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +482 -0
  415. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  416. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +173 -55
  417. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  418. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
  419. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  420. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +35 -2
  421. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  422. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
  423. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  424. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  425. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  426. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +34 -3
  427. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  428. package/packages/ai/src/lib/deepEqual.js +32 -0
  429. package/packages/ai/src/lib/deepEqual.js.map +1 -0
  430. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
  431. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  432. package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
  433. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  434. package/packages/ai/src/lib/generateEntityDataStructure.js +5 -0
  435. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  436. package/packages/ai/src/lib/generateEntityScenarioData.js +398 -81
  437. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  438. package/packages/ai/src/lib/generateEntityScenarios.js +168 -82
  439. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  440. package/packages/ai/src/lib/generateExecutionFlows.js +123 -0
  441. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
  442. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
  443. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
  444. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +742 -0
  445. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
  446. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  447. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  448. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  449. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  450. package/packages/ai/src/lib/isolateScopes.js +231 -4
  451. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  452. package/packages/ai/src/lib/mergeStatements.js +26 -3
  453. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  454. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
  455. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  456. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
  457. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
  458. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -64
  459. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  460. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +58 -4
  461. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  462. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -34
  463. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  464. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
  465. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
  466. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  467. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  468. package/packages/ai/src/lib/resolvePathToControllable.js +563 -0
  469. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
  470. package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
  471. package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
  472. package/packages/ai/src/lib/worker/SerializableDataStructure.js +22 -0
  473. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  474. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
  475. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  476. package/packages/analyze/src/lib/FileAnalyzer.js +15 -0
  477. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  478. package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
  479. package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
  480. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
  481. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
  482. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +214 -50
  483. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  484. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +10 -0
  485. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  486. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
  487. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  488. package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
  489. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  490. package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
  491. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  492. package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
  493. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  494. package/packages/analyze/src/lib/files/enums/steps.js +1 -1
  495. package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
  496. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +159 -0
  497. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  498. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
  499. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
  500. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +458 -48
  501. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  502. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  503. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  504. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
  505. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  506. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +235 -81
  507. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  508. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +96 -0
  509. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
  510. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
  511. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  512. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
  513. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  514. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +307 -89
  515. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  516. package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
  517. package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  518. package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
  519. package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  520. package/packages/database/src/lib/kysely/db.js +2 -2
  521. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  522. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  523. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
  524. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  525. package/packages/generate/index.js +3 -0
  526. package/packages/generate/index.js.map +1 -1
  527. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  528. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  529. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  530. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  531. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  532. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  533. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  534. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  535. package/packages/generate/src/lib/deepMerge.js +27 -1
  536. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  537. package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
  538. package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  539. package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
  540. package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
  541. package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
  542. package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
  543. package/packages/process/index.js +3 -0
  544. package/packages/process/index.js.map +1 -0
  545. package/packages/process/src/GlobalProcessManager.js.map +1 -0
  546. package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
  547. package/packages/process/src/ProcessManager.js.map +1 -0
  548. package/packages/process/src/index.js.map +1 -0
  549. package/packages/process/src/managedExecAsync.js.map +1 -0
  550. package/packages/types/index.js.map +1 -1
  551. package/scripts/finalize-analyzer.cjs +3 -1
  552. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
  553. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
  554. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
  555. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
  556. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
  557. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
  558. package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
  559. package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
  560. package/analyzer-template/process/README.md +0 -507
  561. package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
  562. package/background/src/lib/process/ProcessManager.js.map +0 -1
  563. package/background/src/lib/process/index.js.map +0 -1
  564. package/background/src/lib/process/managedExecAsync.js.map +0 -1
  565. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  566. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  567. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-D0VW1-W7.js +0 -1
  568. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BAk4S4pI.js +0 -1
  569. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-Y756iZxZ.js +0 -25
  570. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-zzrrjW1p.js +0 -3
  571. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-QMn7bJg6.js +0 -3
  572. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DmP5mRxX.js +0 -1
  573. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BXwvsbLw.js +0 -1
  574. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-DAmUX_1y.js +0 -5
  575. package/codeyam-cli/src/webserver/build/client/assets/_index-Df-nk4J5.js +0 -1
  576. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-_ZUyFdie.js +0 -7
  577. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-Eoh0PhcW.js +0 -1
  578. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CZgPLy5i.js +0 -26
  579. package/codeyam-cli/src/webserver/build/client/assets/circle-check-DI-p9ZLZ.js +0 -1
  580. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DvyV2x6y.js +0 -1
  581. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DURu2qlF.js +0 -1
  582. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-DDobn9Xh.js +0 -16
  583. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CGdWnLD_.js +0 -1
  584. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-DgMmzrKs.js +0 -5
  585. package/codeyam-cli/src/webserver/build/client/assets/entry.client-DEVXuhkn.js +0 -13
  586. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-WPRQyc68.js +0 -1
  587. package/codeyam-cli/src/webserver/build/client/assets/files-B9u3lJer.js +0 -1
  588. package/codeyam-cli/src/webserver/build/client/assets/git-YGnKIuHU.js +0 -11
  589. package/codeyam-cli/src/webserver/build/client/assets/globals-28lrWTTo.css +0 -1
  590. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  591. package/codeyam-cli/src/webserver/build/client/assets/index-CJ0uPJjV.js +0 -1
  592. package/codeyam-cli/src/webserver/build/client/assets/index-CfqeA2XG.js +0 -3
  593. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DIjSvh6B.js +0 -1
  594. package/codeyam-cli/src/webserver/build/client/assets/manifest-8125c15c.js +0 -1
  595. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-BXl3LOEh.js +0 -1
  596. package/codeyam-cli/src/webserver/build/client/assets/root-C-g286WP.js +0 -16
  597. package/codeyam-cli/src/webserver/build/client/assets/search-xBKWfOxd.js +0 -1
  598. package/codeyam-cli/src/webserver/build/client/assets/settings-DVY_wGOx.js +0 -1
  599. package/codeyam-cli/src/webserver/build/client/assets/simulations-Be1pJo5A.js +0 -1
  600. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CR-FkSvx.js +0 -1
  601. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DABetnSj.js +0 -1
  602. package/codeyam-cli/src/webserver/build/server/assets/index-DcR7DH9q.js +0 -1
  603. package/codeyam-cli/src/webserver/build/server/assets/server-build-BDBrfp7e.js +0 -175
  604. package/codeyam-cli/templates/debug-codeyam.md +0 -527
  605. package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
  606. package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
  607. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -136
  608. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
  609. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
  610. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
  611. package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
  612. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
  613. package/packages/ai/src/lib/isFrontend.js +0 -5
  614. package/packages/ai/src/lib/isFrontend.js.map +0 -1
  615. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
  616. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
  617. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -72
  618. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
  619. /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
  620. /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
  621. /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
  622. /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
  623. /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
  624. /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
  625. /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +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
+ ExecutionFlowSelection,
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 { ExecutionFlowSelection };
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
+ flowSelections?: ExecutionFlowSelection[];
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
+ flowSelections,
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
+ flowSelections,
41
47
  });
42
48
 
43
49
  const response = await completionCall({
@@ -119,6 +119,16 @@ function processScope({
119
119
  }
120
120
  const childScopesRanges: ChildRange[] = [];
121
121
 
122
+ // Extract gating conditions BEFORE any JSX is extracted into child scopes
123
+ // This ensures we capture conditions like {cond && <ChildComponent />}
124
+ // before the JSX is replaced with placeholders.
125
+ // Only extract when maxJSXLimit > 0 (i.e., when JSX will actually be extracted).
126
+ const extractedGatingConditions: ScopeInfo['extractedGatingConditions'] = {};
127
+
128
+ if (maxJSXLimit > 0) {
129
+ extractGatingConditionsFromJsx(node, sourceFile, extractedGatingConditions);
130
+ }
131
+
122
132
  const addChildScopesRange = ({
123
133
  start,
124
134
  end,
@@ -726,6 +736,10 @@ function processScope({
726
736
  text: modifiedText,
727
737
  variables: Array.from(variables),
728
738
  childScopes,
739
+ // Include gating conditions if any were found
740
+ ...(Object.keys(extractedGatingConditions).length > 0 && {
741
+ extractedGatingConditions,
742
+ }),
729
743
  };
730
744
  }
731
745
 
@@ -772,7 +786,11 @@ export default function isolateScopes(
772
786
  // }
773
787
  // logChildIds(isolatedScopes);
774
788
 
775
- processJSXForScope(isolatedScopes, generateSyntheticName);
789
+ // Process JSX for the root scope only (not child scopes)
790
+ // Child scopes contain callback functions that should preserve their JSX
791
+ // for analysis - gating conditions are now detected in processScope BEFORE extraction
792
+ const jsxLimit = options?.jsxLimit ?? 10;
793
+ processJSXForScope(isolatedScopes, generateSyntheticName, jsxLimit);
776
794
 
777
795
  // If the root scope text is empty and there's only one child scope,
778
796
  // return that child scope as the root scope
@@ -800,9 +818,224 @@ export default function isolateScopes(
800
818
  * Any errors during parsing are caught and logged, ensuring robust handling
801
819
  * of invalid or unexpected input.
802
820
  */
821
+ /**
822
+ * Helper to get the component name from a JSX element (returns null for intrinsic elements like 'div')
823
+ */
824
+ function getJsxComponentName(
825
+ node: ts.JsxElement | ts.JsxSelfClosingElement,
826
+ sourceFile: ts.SourceFile,
827
+ ): string | null {
828
+ let tagName: string;
829
+ if (ts.isJsxElement(node)) {
830
+ tagName = node.openingElement.tagName.getText(sourceFile);
831
+ } else {
832
+ tagName = node.tagName.getText(sourceFile);
833
+ }
834
+ // Intrinsic elements start with lowercase
835
+ if (tagName[0] === tagName[0].toLowerCase()) {
836
+ return null;
837
+ }
838
+ return tagName;
839
+ }
840
+
841
+ /**
842
+ * Helper to extract a simple path string from an expression (for gating conditions)
843
+ */
844
+ function getSimplePathFromExpression(
845
+ expr: ts.Expression,
846
+ sourceFile: ts.SourceFile,
847
+ ): string | null {
848
+ // Unwrap parentheses
849
+ while (ts.isParenthesizedExpression(expr)) {
850
+ expr = expr.expression;
851
+ }
852
+
853
+ if (ts.isIdentifier(expr)) {
854
+ return expr.text;
855
+ }
856
+ if (ts.isPropertyAccessExpression(expr)) {
857
+ const base = getSimplePathFromExpression(expr.expression, sourceFile);
858
+ if (base) {
859
+ return `${base}.${expr.name.text}`;
860
+ }
861
+ }
862
+ if (ts.isBinaryExpression(expr)) {
863
+ // For comparisons like `x === 'value'`, return the left side path
864
+ if (
865
+ expr.operatorToken.kind === ts.SyntaxKind.EqualsEqualsEqualsToken ||
866
+ expr.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsEqualsToken
867
+ ) {
868
+ return getSimplePathFromExpression(expr.left, sourceFile);
869
+ }
870
+ // For && chains, try to get a path from either side
871
+ if (expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
872
+ return (
873
+ getSimplePathFromExpression(expr.left, sourceFile) ||
874
+ getSimplePathFromExpression(expr.right, sourceFile)
875
+ );
876
+ }
877
+ }
878
+ return null;
879
+ }
880
+
881
+ /**
882
+ * Extracts gating conditions from JSX before it's extracted into child scopes.
883
+ * This detects patterns like:
884
+ * - {condition && <Component />}
885
+ * - {condition ? <ComponentA /> : <ComponentB />}
886
+ * - {a ? <A/> : b ? <B/> : <C/>} (chained ternaries)
887
+ */
888
+ function extractGatingConditionsFromJsx(
889
+ node: ts.Node,
890
+ sourceFile: ts.SourceFile,
891
+ gatingConditions: ScopeInfo['extractedGatingConditions'],
892
+ ): void {
893
+ // Process JSX expression children like {condition && <Component />}
894
+ const processJsxExpression = (expr: ts.Expression): void => {
895
+ // Unwrap parentheses
896
+ while (ts.isParenthesizedExpression(expr)) {
897
+ expr = expr.expression;
898
+ }
899
+
900
+ // Handle && chains: {condition && <Component />}
901
+ if (
902
+ ts.isBinaryExpression(expr) &&
903
+ expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
904
+ ) {
905
+ // The right side might be JSX or another && expression
906
+ let rightExpr = expr.right;
907
+ while (ts.isParenthesizedExpression(rightExpr)) {
908
+ rightExpr = rightExpr.expression;
909
+ }
910
+
911
+ if (ts.isJsxElement(rightExpr) || ts.isJsxSelfClosingElement(rightExpr)) {
912
+ const componentName = getJsxComponentName(rightExpr, sourceFile);
913
+ if (componentName) {
914
+ // Extract all conditions from the && chain
915
+ const extractConditions = (e: ts.Expression): string[] => {
916
+ while (ts.isParenthesizedExpression(e)) {
917
+ e = e.expression;
918
+ }
919
+ if (
920
+ ts.isBinaryExpression(e) &&
921
+ e.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
922
+ ) {
923
+ // Check if right side is JSX (terminal) or more conditions
924
+ let right = e.right;
925
+ while (ts.isParenthesizedExpression(right)) {
926
+ right = right.expression;
927
+ }
928
+ if (ts.isJsxElement(right) || ts.isJsxSelfClosingElement(right)) {
929
+ // Right is JSX, so left contains all conditions
930
+ return extractConditions(e.left);
931
+ }
932
+ // Both sides are conditions
933
+ return [
934
+ ...extractConditions(e.left),
935
+ ...extractConditions(e.right),
936
+ ];
937
+ }
938
+ const path = getSimplePathFromExpression(e, sourceFile);
939
+ return path ? [path] : [];
940
+ };
941
+
942
+ const conditions = extractConditions(expr.left);
943
+ if (!gatingConditions![componentName]) {
944
+ gatingConditions![componentName] = [];
945
+ }
946
+ for (const path of conditions) {
947
+ gatingConditions![componentName].push({
948
+ path,
949
+ conditionType: 'truthiness',
950
+ location: 'logical-and',
951
+ });
952
+ }
953
+ }
954
+ }
955
+ }
956
+
957
+ // Handle ternaries: {condition ? <A /> : <B />}
958
+ if (ts.isConditionalExpression(expr)) {
959
+ processConditionalExpression(expr, sourceFile, gatingConditions, false);
960
+ }
961
+ };
962
+
963
+ // Recursive function to handle chained ternaries
964
+ const processConditionalExpression = (
965
+ expr: ts.ConditionalExpression,
966
+ sf: ts.SourceFile,
967
+ gc: ScopeInfo['extractedGatingConditions'],
968
+ parentConditionNegated: boolean,
969
+ ): void => {
970
+ const conditionPath = getSimplePathFromExpression(expr.condition, sf);
971
+
972
+ // Process whenTrue branch
973
+ let whenTrue = expr.whenTrue;
974
+ while (ts.isParenthesizedExpression(whenTrue)) {
975
+ whenTrue = whenTrue.expression;
976
+ }
977
+ if (ts.isJsxElement(whenTrue) || ts.isJsxSelfClosingElement(whenTrue)) {
978
+ const componentName = getJsxComponentName(whenTrue, sf);
979
+ if (componentName && conditionPath) {
980
+ if (!gc![componentName]) {
981
+ gc![componentName] = [];
982
+ }
983
+ gc![componentName].push({
984
+ path: conditionPath,
985
+ conditionType: 'truthiness',
986
+ location: 'ternary',
987
+ isNegated: false,
988
+ });
989
+ }
990
+ }
991
+
992
+ // Process whenFalse branch
993
+ let whenFalse = expr.whenFalse;
994
+ while (ts.isParenthesizedExpression(whenFalse)) {
995
+ whenFalse = whenFalse.expression;
996
+ }
997
+
998
+ if (ts.isJsxElement(whenFalse) || ts.isJsxSelfClosingElement(whenFalse)) {
999
+ const componentName = getJsxComponentName(whenFalse, sf);
1000
+ if (componentName && conditionPath) {
1001
+ if (!gc![componentName]) {
1002
+ gc![componentName] = [];
1003
+ }
1004
+ gc![componentName].push({
1005
+ path: conditionPath,
1006
+ conditionType: 'truthiness',
1007
+ location: 'ternary',
1008
+ isNegated: true, // else branch = negated condition
1009
+ });
1010
+ }
1011
+ } else if (ts.isConditionalExpression(whenFalse)) {
1012
+ // Chained ternary: a ? <A/> : b ? <B/> : <C/>
1013
+ // Recursively process the nested ternary
1014
+ processConditionalExpression(whenFalse, sf, gc, true);
1015
+ }
1016
+ };
1017
+
1018
+ // Traverse JSX children to find expressions
1019
+ let jsxExpressionCount = 0;
1020
+ let ternaryCount = 0;
1021
+ const traverseJsx = (n: ts.Node): void => {
1022
+ if (ts.isJsxExpression(n) && n.expression) {
1023
+ jsxExpressionCount++;
1024
+ if (ts.isConditionalExpression(n.expression)) {
1025
+ ternaryCount++;
1026
+ }
1027
+ processJsxExpression(n.expression);
1028
+ }
1029
+ ts.forEachChild(n, traverseJsx);
1030
+ };
1031
+
1032
+ traverseJsx(node);
1033
+ }
1034
+
803
1035
  function processJSXForScope(
804
1036
  scope: ScopeInfo,
805
1037
  generateSyntheticName: () => string,
1038
+ jsxLimit: number = 10,
806
1039
  ) {
807
1040
  // Parse the scope text as a TypeScript AST to find JSX elements
808
1041
  const scopeText = scope.text;
@@ -818,6 +1051,34 @@ function processJSXForScope(
818
1051
  ts.ScriptKind.TSX,
819
1052
  );
820
1053
 
1054
+ // Extract gating conditions BEFORE extraction (while JSX is still complete)
1055
+ const gatingConditions: ScopeInfo['extractedGatingConditions'] = {};
1056
+
1057
+ extractGatingConditionsFromJsx(
1058
+ tempSourceFile,
1059
+ tempSourceFile,
1060
+ gatingConditions,
1061
+ );
1062
+
1063
+ // Merge with any existing gating conditions from processScope
1064
+ // (processScope extracts from original text, this extracts from modified text)
1065
+ if (Object.keys(gatingConditions).length > 0) {
1066
+ if (scope.extractedGatingConditions) {
1067
+ for (const [componentName, conditions] of Object.entries(
1068
+ gatingConditions,
1069
+ )) {
1070
+ if (scope.extractedGatingConditions[componentName]) {
1071
+ // Merge conditions, avoiding duplicates
1072
+ scope.extractedGatingConditions[componentName].push(...conditions);
1073
+ } else {
1074
+ scope.extractedGatingConditions[componentName] = conditions;
1075
+ }
1076
+ }
1077
+ } else {
1078
+ scope.extractedGatingConditions = gatingConditions;
1079
+ }
1080
+ }
1081
+
821
1082
  const nodeMap = new Map<ts.Node, string>();
822
1083
 
823
1084
  // Find all JSX elements in this scope without recursing into child scopes
@@ -841,6 +1102,7 @@ function processJSXForScope(
841
1102
  end: number;
842
1103
  id: string;
843
1104
  code: string;
1105
+ jsxTagName?: string;
844
1106
  }> = [];
845
1107
 
846
1108
  for (const [node, id] of nodeMap.entries()) {
@@ -848,13 +1110,23 @@ function processJSXForScope(
848
1110
  const nodeEnd = node.getEnd();
849
1111
  const code = node.getText(tempSourceFile);
850
1112
 
851
- // Only process reasonably sized JSX elements
852
- if (code.length > 10) {
1113
+ // Extract the JSX tag name
1114
+ let jsxTagName: string | undefined;
1115
+ if (ts.isJsxElement(node)) {
1116
+ const tagNameNode = node.openingElement.tagName;
1117
+ jsxTagName = tagNameNode.getText(tempSourceFile);
1118
+ } else if (ts.isJsxSelfClosingElement(node)) {
1119
+ jsxTagName = node.tagName.getText(tempSourceFile);
1120
+ }
1121
+
1122
+ // Only process JSX elements larger than the limit
1123
+ if (code.length > jsxLimit) {
853
1124
  replacements.push({
854
1125
  start: scopeStart + nodeStart,
855
1126
  end: scopeStart + nodeEnd,
856
1127
  id,
857
1128
  code,
1129
+ jsxTagName,
858
1130
  });
859
1131
  }
860
1132
  }
@@ -876,6 +1148,7 @@ function processJSXForScope(
876
1148
  end: replacement.end,
877
1149
  variables: [],
878
1150
  childScopes: {},
1151
+ jsxTagName: replacement.jsxTagName,
879
1152
  };
880
1153
 
881
1154
  // Replace in text
@@ -166,6 +166,12 @@ export default function mergeStatements(statements: Statement[]) {
166
166
  return acc;
167
167
  }, {});
168
168
 
169
+ // Track variable reassignments: when a variable is reassigned (creating ::cyDuplicateKey::),
170
+ // subsequent references to that variable in VALUES should use the duplicate key.
171
+ // This ensures configData → fetcher.data.data uses the FIRST fetcher, while
172
+ // settingsData → fetcher.data.data uses fetcher::cyDuplicateKey1::.data.data
173
+ const activeRemappings: Record<string, string> = {};
174
+
169
175
  const equivalentVariables = statements.reduce((acc: any, result) => {
170
176
  for (const [key, value] of Object.entries(
171
177
  result.equivalentVariables ?? {},
@@ -196,16 +202,40 @@ export default function mergeStatements(statements: Statement[]) {
196
202
  for (const [key, value] of Object.entries(
197
203
  result.equivalentVariables ?? {},
198
204
  )) {
205
+ // Apply any active remappings to the VALUE, but ONLY for property paths
206
+ // e.g., if fetcher was remapped to fetcher::cyDuplicateKey1::,
207
+ // then "fetcher.data.data" should become "fetcher::cyDuplicateKey1::.data.data"
208
+ // However, we should NOT remap standalone variable references like "description"
209
+ // because that would lose type information from the original variable.
210
+ let remappedValue = value;
211
+ for (const [originalKey, remappedKey] of Object.entries(
212
+ activeRemappings,
213
+ )) {
214
+ // Only remap if the value is a property path (contains a dot after the key)
215
+ // This preserves type information for simple variable references
216
+ const keyRegex = new RegExp(
217
+ `^${originalKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?=\\.)`,
218
+ );
219
+ if (keyRegex.test(remappedValue)) {
220
+ remappedValue = remappedValue.replace(keyRegex, remappedKey);
221
+ }
222
+ }
223
+
199
224
  if (acc[key]) {
200
- if (acc[key] === value) continue;
225
+ if (acc[key] === remappedValue) continue;
201
226
 
202
227
  let duplicateId = 1;
203
228
  while (acc[`${key}::cyDuplicateKey${duplicateId}::`]) {
204
229
  duplicateId++;
205
230
  }
206
- acc[`${key}::cyDuplicateKey${duplicateId}::`] = value;
231
+ const duplicateKey = `${key}::cyDuplicateKey${duplicateId}::`;
232
+ acc[duplicateKey] = remappedValue;
233
+
234
+ // Track this remapping for subsequent statements
235
+ // Any future references to 'key' in VALUES should use duplicateKey instead
236
+ activeRemappings[key] = duplicateKey;
207
237
  } else {
208
- acc[key] = value;
238
+ acc[key] = remappedValue;
209
239
  }
210
240
  }
211
241
  return acc;
@@ -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
  }