@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
@@ -97,11 +97,15 @@ function resetDebugTiming(): void {
97
97
  */
98
98
  function findEndOfImports(content: string): number {
99
99
  try {
100
+ // Use temp.tsx to enable JSX parsing - otherwise TypeScript may misparse
101
+ // JSX content containing the word "import" (e.g., "Entities that import this")
102
+ // as an import statement, causing mock code to be inserted in the wrong location.
100
103
  const sourceFile = ts.createSourceFile(
101
- 'temp.ts',
104
+ 'temp.tsx',
102
105
  content,
103
106
  ts.ScriptTarget.Latest,
104
107
  true,
108
+ ts.ScriptKind.TSX,
105
109
  );
106
110
 
107
111
  let lastImportEnd = 0;
@@ -710,11 +714,13 @@ function extractInternalImportPathsAst(fileContent: string): string[] {
710
714
  const importPaths: string[] = [];
711
715
 
712
716
  try {
717
+ // Use temp.tsx to enable JSX parsing for consistent handling of JSX files
713
718
  const sourceFile = ts.createSourceFile(
714
- 'temp.ts',
719
+ 'temp.tsx',
715
720
  fileContent,
716
721
  ts.ScriptTarget.Latest,
717
722
  true,
723
+ ts.ScriptKind.TSX,
718
724
  );
719
725
 
720
726
  for (const statement of sourceFile.statements) {
@@ -864,22 +870,72 @@ function addMockToContent(
864
870
 
865
871
  // Check if we have multiple calls with different variable names
866
872
  // This requires generating separate mock functions for each call site
873
+ //
874
+ // IMPORTANT: calls array may contain BOTH base hook calls (e.g., "useFetcher<Type>()")
875
+ // AND method chain usages (e.g., "useFetcher().functionCallReturnValue.submit(...)").
876
+ // We only want to count base hook calls for the length comparison with callVariableNames.
877
+ // A "base call" is one that ends with "()" possibly preceded by a type annotation,
878
+ // without any subsequent method chains like ".functionCallReturnValue" or ".submit(...)".
879
+ const baseHookCalls = importedExport.calls?.filter((call) => {
880
+ // Base hook calls match patterns like:
881
+ // - "useFetcher()"
882
+ // - "useFetcher<Type>()"
883
+ // - "useFetcher<{ complex: Type }>()"
884
+ // They end with "()" and don't have method chains after the call.
885
+ // Method chains contain ".functionCallReturnValue" or have property access after "()".
886
+ return (
887
+ call.endsWith('()') &&
888
+ !call.includes('.functionCallReturnValue') &&
889
+ // Also exclude method chains like "hook().something" or "hook().method()"
890
+ !call.match(/\(\)\.[a-zA-Z]/)
891
+ );
892
+ });
893
+
894
+ // Determine if we can generate unique mock functions for multiple variables.
895
+ // We need:
896
+ // 1. Multiple variable names (callVariableNames.length > 1)
897
+ // 2. Base hook calls to match them (baseHookCalls.length > 0)
898
+ // Note: We use min(baseHookCalls.length, callVariableNames.length) for iteration
899
+ // to handle cases where data might be slightly out of sync (stale entries).
867
900
  const hasMultipleCallsWithVariables =
868
- importedExport.calls &&
869
- importedExport.calls.length > 1 &&
901
+ baseHookCalls &&
902
+ baseHookCalls.length > 1 &&
870
903
  importedExport.callVariableNames &&
871
- importedExport.callVariableNames.length === importedExport.calls.length;
904
+ importedExport.callVariableNames.length > 1 &&
905
+ // Only proceed if we have at least as many base calls as variable names,
906
+ // OR they're close enough (within 1) to handle minor sync issues
907
+ Math.abs(baseHookCalls.length - importedExport.callVariableNames.length) <=
908
+ 1;
872
909
 
873
910
  let mockCode: string | undefined;
874
911
  const variableMockCodes: string[] = [];
875
912
 
876
913
  if (hasMultipleCallsWithVariables) {
877
914
  // Generate separate mock functions for each variable-qualified call
878
- // Track variable name occurrences to disambiguate when same variable is reused
879
- // (mirrors the logic in gatherDataForMocks)
915
+ // Look up canonical keys from dataForMocks and track variable names for function naming
916
+
917
+ // Get all call signature keys for this hook from dataForMocks
918
+ const dataForMocks =
919
+ rootAnalysis.metadata?.scenariosDataStructure?.dataForMocks;
920
+ // Match keys that start with the hook name (e.g., "useFetcher" matches "useFetcher<User>()")
921
+ const callSignatureKeysForHook = dataForMocks
922
+ ? Object.keys(dataForMocks).filter((key) => {
923
+ const hookBaseName = importedExport.name.split(/[<(]/)[0];
924
+ const keyBaseName = key.split(/[<(]/)[0];
925
+ return keyBaseName === hookBaseName;
926
+ })
927
+ : [];
928
+
929
+ // Track variable name occurrences for unique function naming
880
930
  const variableNameCounts: Record<string, number> = {};
881
931
 
882
- for (let i = 0; i < importedExport.calls!.length; i++) {
932
+ // Use the minimum of both array lengths to handle slight mismatches
933
+ // (e.g., stale data from previous analysis runs)
934
+ const iterationLimit = Math.min(
935
+ baseHookCalls!.length,
936
+ importedExport.callVariableNames!.length,
937
+ );
938
+ for (let i = 0; i < iterationLimit; i++) {
883
939
  const variableName = importedExport.callVariableNames![i];
884
940
  if (!variableName) continue;
885
941
 
@@ -887,18 +943,37 @@ function addMockToContent(
887
943
  const occurrence = variableNameCounts[variableName] ?? 0;
888
944
  variableNameCounts[variableName] = occurrence + 1;
889
945
 
890
- // If this is a reused variable name (occurrence > 0), append index
891
- // e.g., "fetcher[1] <- useFetcher" for the second usage of "fetcher"
946
+ // Build indexed variable name for function naming
892
947
  const indexedVariableName =
893
948
  occurrence > 0 ? `${variableName}[${occurrence}]` : variableName;
894
949
 
895
- // Generate mock code for this specific call using variable-qualified name
896
- // Format: "variableName <- functionName" (reads as "variableName receives from functionName")
897
- const qualifiedName = `${indexedVariableName} <- ${importedExport.name}`;
950
+ // Use safe function name with underscores instead of brackets
951
+ // e.g., fetcher[1] -> fetcher_1
952
+ const safeFunctionName = indexedVariableName.replace(/\[(\d+)\]/g, '_$1');
953
+ // Compute unique mock function name for call site replacement
954
+ // e.g., useFetcher_entityDiffFetcher, useFetcher_reportFetcher
955
+ const mockFunctionName = `${importedExport.name}_${safeFunctionName}`;
956
+
957
+ // Use the call signature from baseHookCalls[i] as the data key
958
+ // This matches what's stored in dataForMocks
959
+ const callSignature = baseHookCalls![i];
960
+
961
+ // Generate mock code using the call signature directly
962
+ // This prevents "symbol already declared" errors when multiple calls exist
963
+ // Check if this is a package import that won't have scenario copies
964
+ const isPackageImportForMock = importPath?.startsWith('@');
898
965
  const variableMockCode = constructMockCode(
899
- qualifiedName,
966
+ callSignature, // Use call signature format for data lookup
900
967
  dependencySchemas,
901
968
  importedExport.entityType,
969
+ undefined, // No need for separate canonical key
970
+ {
971
+ uniqueFunctionSuffix: safeFunctionName, // Use variable name for unique function naming
972
+ // For node_modules or package imports, skip spreading from __cyOriginal
973
+ // since those packages/files don't export *__cyOriginal variants
974
+ skipOriginalSpread:
975
+ importedExport.isNodeModule || isPackageImportForMock,
976
+ },
902
977
  );
903
978
 
904
979
  if (variableMockCode) {
@@ -907,8 +982,6 @@ function addMockToContent(
907
982
  // Replace the call site with the variable-specific mock function
908
983
  // e.g., useFetcher<BranchEntityDiffResult>() -> useFetcher_entityDiffFetcher()
909
984
  // e.g., useFetcher() -> useFetcher_reportFetcher()
910
- // For indexed variables: useFetcher() -> useFetcher_fetcher_1()
911
- const callSignature = importedExport.calls![i];
912
985
  // Escape special regex characters in the call signature
913
986
  const escapedCallSignature = callSignature.replace(
914
987
  /[.*+?^${}()|[\]\\]/g,
@@ -919,13 +992,6 @@ function addMockToContent(
919
992
  escapedCallSignature.replace(/\s+/g, '\\s*'),
920
993
  'g',
921
994
  );
922
- // Use safe function name with underscores instead of brackets
923
- // e.g., fetcher[1] -> fetcher_1
924
- const safeFunctionName = indexedVariableName.replace(
925
- /\[(\d+)\]/g,
926
- '_$1',
927
- );
928
- const mockFunctionName = `${importedExport.name}_${safeFunctionName}`;
929
995
  fileContent = fileContent.replace(callRegex, `${mockFunctionName}()`);
930
996
  }
931
997
  }
@@ -941,83 +1007,133 @@ function addMockToContent(
941
1007
  : undefined;
942
1008
 
943
1009
  if (singleCallVariableName) {
944
- // For single variable assignments, use the variable-qualified key for data lookup
945
- // Use constructMockCode to generate proper dispatch functions for nested function calls
946
- // (e.g., useTranslation returns { t } where t() needs to dispatch based on translation key)
947
- const qualifiedKey = `${singleCallVariableName} <- ${importedExport.name}`;
948
- // Keep the original function name since there's only one call - no need for unique names
1010
+ // For single variable assignments, use the call signature directly from dataForMocks
1011
+ const dataForMocks =
1012
+ rootAnalysis.metadata?.scenariosDataStructure?.dataForMocks;
1013
+
1014
+ // Find matching call signature key in dataForMocks
1015
+ const hookBaseName = importedExport.name.split(/[<(]/)[0];
1016
+ const callSignatureKey = dataForMocks
1017
+ ? Object.keys(dataForMocks).find((key) => {
1018
+ // Split on ., <, or ( to get the true base name
1019
+ // This handles both "useFlags()" -> "useFlags" and "trpc.useUtils()" -> "trpc"
1020
+ const keyBaseName = key.split(/[.<(]/)[0];
1021
+ return keyBaseName === hookBaseName;
1022
+ })
1023
+ : undefined;
1024
+
1025
+ // Use the call signature if found, otherwise construct it
1026
+ const dataKey =
1027
+ callSignatureKey ??
1028
+ importedExport.calls?.[0] ??
1029
+ `${importedExport.name}()`;
1030
+
1031
+ // IMPORTANT: If the dataKey is a method chain (e.g., "trpc.useUtils()"), we should
1032
+ // use the base name (e.g., "trpc") when calling constructMockCode. This ensures
1033
+ // constructMockCode generates a complete nested mock from the schema without
1034
+ // referencing __cyOriginal variables.
1035
+ const dataKeyBaseName = dataKey.split(/[.<(]/)[0];
1036
+ const isMethodChainDataKey =
1037
+ dataKeyBaseName === importedExport.name &&
1038
+ dataKey !== importedExport.name &&
1039
+ dataKey.includes('.');
1040
+ const mockNameToUse = isMethodChainDataKey
1041
+ ? importedExport.name
1042
+ : dataKey;
1043
+
1044
+ // Keep the original function name since there's only one call
1045
+ // Check if this is a package import that won't have scenario copies
1046
+ const isPackageImportForSingleCall = importPath?.startsWith('@');
949
1047
  mockCode = constructMockCode(
950
- qualifiedKey,
1048
+ mockNameToUse,
951
1049
  dependencySchemas,
952
1050
  importedExport.entityType,
953
- { keepOriginalFunctionName: true },
1051
+ undefined,
1052
+ {
1053
+ keepOriginalFunctionName: true,
1054
+ // For node_modules or package imports, skip spreading from __cyOriginal
1055
+ // since those packages/files don't export *__cyOriginal variants
1056
+ skipOriginalSpread:
1057
+ importedExport.isNodeModule || isPackageImportForSingleCall,
1058
+ },
954
1059
  );
955
1060
  // If constructMockCode didn't generate code, fall back to simple return
1061
+ // IMPORTANT: We inline scenarios().data() inside the function rather than
1062
+ // storing in a const - see comment in constructMockCode.ts for why.
956
1063
  if (!mockCode) {
957
- mockCode = `const ${importedExport.name}ReturnValue = scenarios().data()?.["${qualifiedKey}"];
958
-
959
- function ${importedExport.name}() {
960
- return ${importedExport.name}ReturnValue;
1064
+ mockCode = `function ${importedExport.name}(...args) {
1065
+ return scenarios().data()?.["${dataKey}"];
961
1066
  }`;
962
1067
  }
963
1068
  } else {
964
- // Check if any analysis (fileAnalyses or rootAnalysis) has this function's data
965
- // under a variable-qualified key. The entity that CALLS the function (e.g., FileTableRow)
966
- // has the dataForMocks with the variable-qualified key, not the root analysis (e.g., GitView).
967
- let variableQualifiedKey: string | undefined;
968
-
969
- // First check fileAnalyses (the analyses for the entity being written)
970
- for (const analysis of fileAnalyses) {
971
- const dataForMocks =
972
- analysis.metadata?.scenariosDataStructure?.dataForMocks;
973
- if (dataForMocks) {
974
- variableQualifiedKey = Object.keys(dataForMocks).find((key) => {
975
- const match = key.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*<-\s*(.+)$/);
976
- return match && match[2] === importedExport.name;
977
- });
978
- if (variableQualifiedKey) {
979
- break;
980
- }
981
- }
982
- }
1069
+ // Helper to find matching call signature key from dataForMocks
1070
+ const hookBaseName = importedExport.name.split(/[<(]/)[0];
1071
+ const findMatchingKey = (
1072
+ dataForMocks: Record<string, unknown> | undefined,
1073
+ ): string | undefined => {
1074
+ if (!dataForMocks) return undefined;
1075
+ return Object.keys(dataForMocks).find((key) => {
1076
+ // Split on ., <, or ( to get the true base name
1077
+ // This handles both "useFlags()" -> "useFlags" and "trpc.useUtils()" -> "trpc"
1078
+ const keyBaseName = key.split(/[.<(]/)[0];
1079
+ return keyBaseName === hookBaseName;
1080
+ });
1081
+ };
983
1082
 
984
- // If not found in fileAnalyses, fall back to rootAnalysis
985
- if (!variableQualifiedKey) {
986
- const dataForMocks =
987
- rootAnalysis.metadata?.scenariosDataStructure?.dataForMocks;
988
- if (dataForMocks) {
989
- variableQualifiedKey = Object.keys(dataForMocks).find((key) => {
990
- const match = key.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*<-\s*(.+)$/);
991
- return match && match[2] === importedExport.name;
992
- });
1083
+ // Check rootAnalysis FIRST for matching keys.
1084
+ // The mock DATA is generated from rootAnalysis, so the mock CODE must
1085
+ // also use rootAnalysis keys to ensure the lookup succeeds.
1086
+ let dataKey = findMatchingKey(
1087
+ rootAnalysis.metadata?.scenariosDataStructure?.dataForMocks,
1088
+ );
1089
+
1090
+ // If not found in rootAnalysis, fall back to fileAnalyses
1091
+ if (!dataKey) {
1092
+ for (const analysis of fileAnalyses) {
1093
+ dataKey = findMatchingKey(
1094
+ analysis.metadata?.scenariosDataStructure?.dataForMocks,
1095
+ );
1096
+ if (dataKey) break;
993
1097
  }
994
1098
  }
995
1099
 
996
- if (variableQualifiedKey) {
997
- // Use the variable-qualified key found in the analysis
998
- // Use constructMockCode to generate proper dispatch functions for nested function calls
999
- // Keep the original function name since there's only one call - no need for unique names
1000
- mockCode = constructMockCode(
1001
- variableQualifiedKey,
1002
- dependencySchemas,
1003
- importedExport.entityType,
1004
- { keepOriginalFunctionName: true },
1005
- );
1006
- // If constructMockCode didn't generate code, fall back to simple return
1007
- if (!mockCode) {
1008
- mockCode = `const ${importedExport.name}ReturnValue = scenarios().data()?.["${variableQualifiedKey}"];
1100
+ // Use the data key if found, otherwise use call signature or function name.
1101
+ // IMPORTANT: If the dataKey is a method chain (e.g., "trpc.useUtils()"), we should
1102
+ // use the base name (e.g., "trpc") when calling constructMockCode. This ensures
1103
+ // constructMockCode generates a complete nested mock from the schema without
1104
+ // referencing __cyOriginal variables. The __cyOriginal pattern is only needed
1105
+ // for partial mocking where we preserve some original methods, not for complete
1106
+ // method-chain mocks where we provide all implementations.
1107
+ const dataKeyBaseName = dataKey?.split(/[.<(]/)[0];
1108
+ const isMethodChainDataKey =
1109
+ dataKey &&
1110
+ dataKeyBaseName === importedExport.name &&
1111
+ dataKey !== importedExport.name &&
1112
+ dataKey.includes('.');
1113
+ const mockNameToUse = isMethodChainDataKey
1114
+ ? importedExport.name
1115
+ : (dataKey ?? importedExport.calls?.[0] ?? `${importedExport.name}()`);
1009
1116
 
1010
- function ${importedExport.name}() {
1011
- return ${importedExport.name}ReturnValue;
1117
+ mockCode = constructMockCode(
1118
+ mockNameToUse,
1119
+ dependencySchemas,
1120
+ importedExport.entityType,
1121
+ undefined,
1122
+ {
1123
+ keepOriginalFunctionName: true,
1124
+ // For node_modules or package imports, skip spreading from __cyOriginal
1125
+ // since those packages/files don't export *__cyOriginal variants
1126
+ skipOriginalSpread:
1127
+ importedExport.isNodeModule || importPath?.startsWith('@'),
1128
+ },
1129
+ );
1130
+ // If constructMockCode didn't generate code, fall back to simple return
1131
+ // IMPORTANT: We inline scenarios().data() inside the function rather than
1132
+ // storing in a const - see comment in constructMockCode.ts for why.
1133
+ if (!mockCode && dataKey) {
1134
+ mockCode = `function ${importedExport.name}(...args) {
1135
+ return scenarios().data()?.["${dataKey}"];
1012
1136
  }`;
1013
- }
1014
- } else {
1015
- // Original behavior for calls without variable names
1016
- mockCode = constructMockCode(
1017
- importedExport.name,
1018
- dependencySchemas,
1019
- importedExport.entityType,
1020
- );
1021
1137
  }
1022
1138
  }
1023
1139
  }
@@ -1048,12 +1164,39 @@ function ${importedExport.name}() {
1048
1164
  /[.*+?^${}()|[\]\\]/g,
1049
1165
  '\\$&',
1050
1166
  );
1167
+ // Use a simpler, more robust regex pattern that matches the fallback path.
1168
+ // Key improvements:
1169
+ // 1. Uses escapeRegExp(firstPart) to handle special characters in function names
1170
+ // 2. Uses word boundaries (\b) to prevent partial matches
1171
+ // 3. Handles comma BEFORE or AFTER the name: (?:,\s*|\s*,)?
1172
+ // 4. Matches specific import path (escapedImportPath)
1051
1173
  const importRegExp = new RegExp(
1052
- `(import(?:(?!${firstPart}|from|import)[\\s\\S])*?)${firstPart}(?:,\\s*)?((?:(?!import)[\\s\\S])*?from\\s+['"]${escapedImportPath}['"])`,
1174
+ `(import\\s*\\{[^}]*?)\\b${escapeRegExp(firstPart)}\\b(?:,\\s*|\\s*,)?((?:[^}]*\\}\\s*from\\s*['"]${escapedImportPath}['"];?))`,
1053
1175
  'm',
1054
1176
  );
1055
1177
 
1056
- if (importedExportNameParts.length > 1) {
1178
+ // Check if any call signature has multiple parts (e.g., "logger.error(error)")
1179
+ // If so, the mock code will spread from __cyOriginal, so we need to rename the import
1180
+ // EXCEPT:
1181
+ // 1. For node_module imports, the __cyOriginal pattern doesn't work because
1182
+ // the original package doesn't export *__cyOriginal variants.
1183
+ // 2. For package imports (starting with @), the __cyOriginal pattern doesn't work
1184
+ // because scenario copies aren't created for package files - they keep the
1185
+ // original import path which doesn't export *__cyOriginal.
1186
+ const anyCallHasMultipleParts = importedExport.calls?.some((call) => {
1187
+ const callParts = splitOutsideParenthesesAndArrays(call);
1188
+ return callParts.length > 1;
1189
+ });
1190
+
1191
+ // Package imports (starting with @) don't get scenario copies, so __cyOriginal won't exist
1192
+ const isPackageImport = importPath.startsWith('@');
1193
+
1194
+ const shouldRenameToOriginal =
1195
+ !importedExport.isNodeModule &&
1196
+ !isPackageImport &&
1197
+ (importedExportNameParts.length > 1 || anyCallHasMultipleParts);
1198
+
1199
+ if (shouldRenameToOriginal) {
1057
1200
  fileContent = fileContent.replace(
1058
1201
  importRegExp,
1059
1202
  `$1${firstPart}__cyOriginal$2`,
@@ -1086,7 +1229,20 @@ function ${importedExport.name}() {
1086
1229
  'm',
1087
1230
  );
1088
1231
 
1089
- if (importedExportNameParts.length > 1) {
1232
+ // Check if any call signature has multiple parts (e.g., "logger.error(error)")
1233
+ // If so, the mock code will spread from __cyOriginal, so we need to rename the import
1234
+ // EXCEPT: For node_module imports, the __cyOriginal pattern doesn't work because
1235
+ // the original package doesn't export *__cyOriginal variants.
1236
+ const anyCallHasMultipleParts = importedExport.calls?.some((call) => {
1237
+ const callParts = splitOutsideParenthesesAndArrays(call);
1238
+ return callParts.length > 1;
1239
+ });
1240
+
1241
+ const shouldRenameToOriginal =
1242
+ !importedExport.isNodeModule &&
1243
+ (importedExportNameParts.length > 1 || anyCallHasMultipleParts);
1244
+
1245
+ if (shouldRenameToOriginal) {
1090
1246
  // Rename the import instead of removing (for destructured access patterns)
1091
1247
  fileContent = fileContent.replace(
1092
1248
  namedImportRegExp,
@@ -2105,9 +2261,28 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
2105
2261
  }
2106
2262
  }
2107
2263
 
2264
+ // Collect universal mocks BEFORE processing nodeModuleImports
2265
+ // This is needed to check if a node module import is handled by a universal mock
2266
+ const universalMocks = project.metadata?.universalMocks ?? [];
2267
+ const nodeModuleUniversalMocks = universalMocks.filter(
2268
+ (mock) => mock.nodeModule && mock.content,
2269
+ );
2270
+
2271
+ // Create a set of import paths that have universal mocks for quick lookup
2272
+ const universalMockPaths = new Set(
2273
+ nodeModuleUniversalMocks.map((mock) => mock.filePath),
2274
+ );
2275
+
2108
2276
  for (const nodeModuleImport of nodeModuleImports) {
2109
2277
  if (!nodeModuleImport.isMocked) continue;
2110
2278
 
2279
+ // Skip generating local mock functions for imports that have universal mocks.
2280
+ // Universal mocks provide the exports via rewritten import paths (handled below).
2281
+ // Generating a local mock function would cause "name defined multiple times" errors.
2282
+ if (universalMockPaths.has(nodeModuleImport.filePath)) {
2283
+ continue;
2284
+ }
2285
+
2111
2286
  fileContent = addMockToContent(
2112
2287
  fileContent,
2113
2288
  nodeModuleImport,
@@ -2123,10 +2298,6 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
2123
2298
  // Universal mocks create mock files at __codeyamMocks__/{safeFileName}.tsx
2124
2299
  // We need to rewrite imports like `import { logger } from "@formbricks/logger"`
2125
2300
  // to `import { logger } from "../__codeyamMocks__/_formbricks_logger"`
2126
- const universalMocks = project.metadata?.universalMocks ?? [];
2127
- const nodeModuleUniversalMocks = universalMocks.filter(
2128
- (mock) => mock.nodeModule && mock.content,
2129
- );
2130
2301
 
2131
2302
  for (const universalMock of nodeModuleUniversalMocks) {
2132
2303
  const originalPath = universalMock.filePath;
@@ -12,6 +12,7 @@ import writeLibComponent from './writeLibComponent';
12
12
  import writeMockDataTsx from './writeMockDataTsx';
13
13
  import writeScenarioComponents from './writeScenarioComponents';
14
14
  import writeScenarioPage from './writeScenarioPage';
15
+ import writeScenarioClientWrapper from './writeScenarioClientWrapper';
15
16
  import { LazyFileStore } from './LazyFileStore';
16
17
 
17
18
  export interface WriteSimulatorFilesArgs {
@@ -62,6 +63,31 @@ export default async function writeScenarioFiles({
62
63
  );
63
64
  generatedFiles.push(mockDataFilePath);
64
65
 
66
+ // Determine if entity is async (Server Component)
67
+ // First check metadata, then fall back to source code detection for existing analyses
68
+ let isAsync = entity.metadata?.isAsync;
69
+ if (isAsync === undefined) {
70
+ const fileAnalyzer = projectAnalyzer.getFileAnalyzerByPath(file.path);
71
+ if (fileAnalyzer) {
72
+ const localEntityName =
73
+ entity.name === 'default' ? 'default' : entity.name;
74
+ isAsync = fileAnalyzer.isEntityAsync(localEntityName);
75
+ }
76
+ }
77
+
78
+ // For async components (Server Components), write the client wrapper
79
+ // and update entity metadata so page generation knows to use Server Component format
80
+ if (isAsync) {
81
+ entity.metadata = entity.metadata || {};
82
+ entity.metadata.isAsync = true;
83
+
84
+ const clientWrapperPath = await writeScenarioClientWrapper(
85
+ scenario,
86
+ mocksDir,
87
+ );
88
+ generatedFiles.push(clientWrapperPath);
89
+ }
90
+
65
91
  // For library files create components that allow you to interact with them
66
92
  const libComponentPath = await writeLibComponent(
67
93
  project,
@@ -255,19 +255,19 @@ export default async function writeSimpleRoot(
255
255
 
256
256
  if (!newContent.match(importRegex)) continue;
257
257
 
258
- // Find the correct variable-qualified mock key for ROOT's usage
259
- // The mock data is stored under keys like "variableName <- functionName"
260
- // For root.tsx, we need to find the key that corresponds to ROOT's usage,
261
- // NOT the route's (Settings') usage.
258
+ // Find the correct mock key for ROOT's usage
259
+ // The mock data is stored under call signature keys like "useLoaderData()"
262
260
  const dataForMocks =
263
261
  options.routeAnalysis?.metadata?.scenariosDataStructure
264
262
  ?.dataForMocks;
265
263
 
266
- // Find all keys that end with this entity name
264
+ // Find all keys that match this entity/hook by base name
265
+ const entityBaseName = entityName.split(/[<(]/)[0];
267
266
  const matchingKeys = dataForMocks
268
- ? Object.keys(dataForMocks).filter((key) =>
269
- key.endsWith(` <- ${entityName}`),
270
- )
267
+ ? Object.keys(dataForMocks).filter((key) => {
268
+ const keyBaseName = key.split(/[<(]/)[0];
269
+ return keyBaseName === entityBaseName;
270
+ })
271
271
  : [];
272
272
 
273
273
  // If there are multiple keys (e.g., one for root.tsx and one for Settings),
@@ -302,11 +302,9 @@ export default async function writeSimpleRoot(
302
302
  }
303
303
  }
304
304
 
305
- // Find a key that uses one of root's property names
306
- mockKey = matchingKeys.find((key) => {
307
- const varName = key.split(' <- ')[0];
308
- return rootPropertyNames.includes(varName);
309
- });
305
+ // Find a key that matches by call signature
306
+ // For call signature format (e.g., "useLoaderData()"), just use the first match
307
+ mockKey = matchingKeys[0];
310
308
 
311
309
  // Fallback: if no match found but there are multiple keys,
312
310
  // exclude the route's key (which we can identify from mockedImports variable names)
@@ -347,11 +345,11 @@ export default async function writeSimpleRoot(
347
345
  ...scenarios().data()?.["${mockKey}"]
348
346
  };
349
347
 
350
- function ${entityName}() {
348
+ function ${entityName}(...args) {
351
349
  return ${entityName}ReturnValue;
352
350
  }`;
353
351
  } else {
354
- mockCode = `const ${entityName}ReturnValue = scenarios().data()?.["${mockKey}"];\n\nfunction ${entityName}() {\n return ${entityName}ReturnValue;\n}`;
352
+ mockCode = `const ${entityName}ReturnValue = scenarios().data()?.["${mockKey}"];\n\nfunction ${entityName}(...args) {\n return ${entityName}ReturnValue;\n}`;
355
353
  }
356
354
  } else {
357
355
  // Fallback to constructMockCode for simple cases
@@ -202,6 +202,7 @@ const startPlaywrightCapture = () => {
202
202
  process.env.PROJECT_SLUG,
203
203
  ],
204
204
  'playwright',
205
+ { PROJECT_URL: 'http://localhost:3000' },
205
206
  );
206
207
  };
207
208
 
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ echo "Error: No command specified for this container."
3
+ echo ""
4
+ echo "This image requires an explicit command override in the ECS task definition:"
5
+ echo " - Analysis tasks: node --enable-source-maps ./dist/project/start.js ..."
6
+ echo " - Orchestration workers: node scripts/comboWorkerLoop.cjs"
7
+ echo ""
8
+ echo "If you're seeing this, the task definition is misconfigured."
9
+ exit 1
@@ -14,6 +14,7 @@
14
14
  "paths": {
15
15
  "~codeyam/*": ["./packages/*"]
16
16
  },
17
- "sourceMap": true
17
+ "sourceMap": true,
18
+ "skipLibCheck": true
18
19
  }
19
20
  }
@@ -1,6 +1,6 @@
1
1
  import copyFolderToArchive from "../copyFolderToArchive.js";
2
2
  import writeFile from "../writeFile.js";
3
- import execAsync, { execAsyncWithProcess } from "./execAsync.js";
3
+ import execAsync, { execAsyncWithProcess, } from "./execAsync.js";
4
4
  import buildCliArgs from "../virtualized/project/buildCliArgs.js";
5
5
  import * as fs from 'fs';
6
6
  /**
@@ -20,34 +20,6 @@ export async function createAnalyzerTemplate(absoluteCodeyamRootPath) {
20
20
  recursive: true,
21
21
  });
22
22
  }
23
- // Copy the process management system at the root level
24
- await copyFolderToArchive({
25
- source: './src/lib/process',
26
- destination: `${absoluteCodeyamRootPath}/process`,
27
- exclude: ['__tests__'],
28
- recursive: true,
29
- });
30
- // Fix the import path in common/execAsync.ts for the flat template structure
31
- const execAsyncPath = `${absoluteCodeyamRootPath}/common/execAsync.ts`;
32
- if (fs.existsSync(execAsyncPath)) {
33
- let content = fs.readFileSync(execAsyncPath, 'utf8');
34
- // Change ../../process to ../process to match the flat structure
35
- // Use template literals to avoid postbuild.cjs modifying these strings
36
- const oldImport = `from ${String.fromCharCode(39)}../../process${String.fromCharCode(39)}`;
37
- const newImport = `from ${String.fromCharCode(39)}../process${String.fromCharCode(39)}`;
38
- content = content.replace(oldImport, newImport);
39
- fs.writeFileSync(execAsyncPath, content);
40
- }
41
- // Fix the import path in project/start.ts for the flat template structure
42
- const startPath = `${absoluteCodeyamRootPath}/project/start.ts`;
43
- if (fs.existsSync(startPath)) {
44
- let content = fs.readFileSync(startPath, 'utf8');
45
- // Change ../../process to ../process to match the flat structure
46
- const oldImport = `from ${String.fromCharCode(39)}../../process${String.fromCharCode(39)}`;
47
- const newImport = `from ${String.fromCharCode(39)}../process${String.fromCharCode(39)}`;
48
- content = content.replace(oldImport, newImport);
49
- fs.writeFileSync(startPath, content);
50
- }
51
23
  await copyFolderToArchive({
52
24
  source: '../packages',
53
25
  destination: `${absoluteCodeyamRootPath}/packages`,