@codeyam/codeyam-cli 0.1.0-staging.e38f7bd → 0.1.0-staging.fef152f

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 (1052) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/common/execAsync.ts +1 -1
  3. package/analyzer-template/log.txt +3 -3
  4. package/analyzer-template/package.json +30 -26
  5. package/analyzer-template/packages/ai/index.ts +21 -5
  6. package/analyzer-template/packages/ai/package.json +4 -4
  7. package/analyzer-template/packages/ai/src/lib/__mocks__/completionCall.ts +122 -0
  8. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +228 -24
  9. package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
  10. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +205 -10
  11. package/analyzer-template/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.ts +644 -0
  12. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +181 -23
  13. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.ts +10 -17
  14. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.ts +18 -0
  15. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +38 -1
  16. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +181 -1
  17. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +1619 -125
  18. package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
  19. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +324 -5
  20. package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
  21. package/analyzer-template/packages/ai/src/lib/completionCall.ts +216 -36
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +2761 -390
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +21 -4
  24. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +976 -0
  25. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +243 -77
  26. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.ts +16 -3
  27. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.ts +6 -4
  28. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +71 -2
  29. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +161 -19
  30. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.ts +70 -0
  31. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +163 -14
  32. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
  33. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  34. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  35. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +441 -82
  36. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  37. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  38. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +183 -0
  39. package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
  40. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  41. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  42. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +74 -7
  43. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +89 -112
  44. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +63 -2
  45. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1419 -101
  46. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +216 -109
  47. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +710 -0
  48. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
  49. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2484 -0
  50. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  51. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  52. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  53. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
  54. package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
  55. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
  56. package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
  57. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +17 -7
  58. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
  59. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -102
  60. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  61. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  62. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +110 -6
  63. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -53
  64. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
  65. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  66. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  67. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
  68. package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
  69. package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
  70. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +127 -3
  71. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +121 -2
  72. package/analyzer-template/packages/analyze/index.ts +2 -0
  73. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
  74. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
  75. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  76. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  77. package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
  78. package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
  79. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  80. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  81. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  82. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  83. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  84. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  85. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +570 -180
  86. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +54 -1
  87. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
  88. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
  89. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  90. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
  91. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
  92. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
  93. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
  94. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  95. package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
  96. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +22 -13
  97. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
  98. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +313 -0
  99. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
  100. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +711 -78
  101. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  102. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
  103. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +550 -137
  104. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +264 -0
  105. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +78 -83
  106. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +4 -8
  107. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1067 -167
  108. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  109. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  110. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  111. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  112. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  113. package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
  114. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
  115. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
  116. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
  117. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
  118. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
  119. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
  120. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
  121. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  122. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
  123. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
  124. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
  125. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  126. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  127. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  128. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  129. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  130. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
  131. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
  132. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
  133. package/analyzer-template/packages/aws/package.json +10 -10
  134. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  135. package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
  136. package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
  137. package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
  138. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  139. package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
  140. package/analyzer-template/packages/database/package.json +1 -1
  141. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  142. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  143. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  144. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  145. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  146. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  147. package/analyzer-template/packages/database/src/lib/kysely/db.ts +18 -5
  148. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  149. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  150. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +36 -9
  151. package/analyzer-template/packages/database/src/lib/kysely/tables/labsRequestsTable.ts +52 -0
  152. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  153. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  154. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  155. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  156. package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
  157. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  158. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  159. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +30 -5
  160. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  161. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  162. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  163. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
  164. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  165. package/analyzer-template/packages/generate/index.ts +3 -0
  166. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
  167. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
  168. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
  169. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
  170. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  171. package/analyzer-template/packages/generate/src/lib/directExecutionScript.ts +17 -2
  172. package/analyzer-template/packages/generate/src/lib/getComponentScenarioPath.ts +8 -3
  173. package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
  174. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  175. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  176. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  177. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  178. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  179. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  180. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  181. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  182. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  183. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  184. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  185. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  186. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +4 -2
  187. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  188. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +13 -3
  189. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  190. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  191. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -11
  192. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  193. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  194. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  195. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  196. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  197. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +30 -7
  198. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  199. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  200. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  201. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
  202. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
  203. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts +23 -0
  204. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.d.ts.map +1 -0
  205. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  206. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  207. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
  208. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  209. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  210. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  211. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  212. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  213. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  214. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  215. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  216. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  217. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  218. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  219. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  220. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  221. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  222. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  223. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
  224. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  225. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  226. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  227. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  228. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  229. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  230. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  231. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  232. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  233. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +23 -5
  234. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  235. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  236. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  237. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  238. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  239. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  240. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  241. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  242. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  243. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
  244. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  245. package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
  246. package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
  247. package/analyzer-template/packages/github/dist/generate/index.js +3 -0
  248. package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
  249. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
  250. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  251. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  252. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
  253. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
  254. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  255. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  256. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
  257. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
  258. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  259. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  260. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  261. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  262. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  263. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  264. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  265. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  266. package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.d.ts.map +1 -1
  267. package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js +10 -1
  268. package/analyzer-template/packages/github/dist/generate/src/lib/directExecutionScript.js.map +1 -1
  269. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.d.ts.map +1 -1
  270. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js +7 -3
  271. package/analyzer-template/packages/github/dist/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  272. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
  273. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
  274. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
  275. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  276. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
  277. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
  278. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
  279. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
  280. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
  281. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
  282. package/analyzer-template/packages/github/dist/types/index.d.ts +2 -2
  283. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  284. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  285. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +87 -13
  286. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  287. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  288. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  289. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
  290. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
  291. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +7 -0
  292. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  293. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +11 -6
  294. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  295. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
  296. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  297. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  298. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  299. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
  300. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  301. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  302. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  303. package/analyzer-template/packages/github/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  304. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  305. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  306. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  307. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  308. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  309. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  310. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  311. package/analyzer-template/packages/github/package.json +1 -1
  312. package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
  313. package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
  314. package/analyzer-template/packages/process/index.ts +2 -0
  315. package/analyzer-template/packages/process/package.json +12 -0
  316. package/analyzer-template/packages/process/tsconfig.json +8 -0
  317. package/analyzer-template/packages/types/index.ts +5 -0
  318. package/analyzer-template/packages/types/src/types/Analysis.ts +104 -13
  319. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  320. package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
  321. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +7 -0
  322. package/analyzer-template/packages/types/src/types/Scenario.ts +11 -10
  323. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +228 -3
  324. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  325. package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
  326. package/analyzer-template/packages/ui-components/package.json +4 -4
  327. package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
  328. package/analyzer-template/packages/utils/dist/types/index.d.ts +2 -2
  329. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  330. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  331. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +87 -13
  332. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  333. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  334. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  335. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
  336. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
  337. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +7 -0
  338. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  339. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +11 -6
  340. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  341. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +199 -3
  342. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  343. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  344. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  345. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
  346. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  347. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.d.ts.map +1 -1
  348. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js +26 -2
  349. package/analyzer-template/packages/utils/dist/utils/src/lib/applyUniversalMocks.js.map +1 -1
  350. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  351. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
  352. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  353. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  354. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  355. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  356. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  357. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  358. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  359. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  360. package/analyzer-template/packages/utils/src/lib/applyUniversalMocks.ts +28 -2
  361. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
  362. package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
  363. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  364. package/analyzer-template/playwright/capture.ts +57 -26
  365. package/analyzer-template/playwright/captureStatic.ts +1 -1
  366. package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
  367. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  368. package/analyzer-template/playwright/takeScreenshot.ts +15 -9
  369. package/analyzer-template/playwright/waitForServer.ts +21 -6
  370. package/analyzer-template/project/TESTING.md +83 -0
  371. package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
  372. package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
  373. package/analyzer-template/project/analyzeFileEntities.ts +4 -0
  374. package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
  375. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  376. package/analyzer-template/project/constructMockCode.ts +1347 -159
  377. package/analyzer-template/project/controller/startController.ts +16 -1
  378. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  379. package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
  380. package/analyzer-template/project/loadReadyToBeCaptured.ts +82 -42
  381. package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
  382. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  383. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +13 -9
  384. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +93 -42
  385. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  386. package/analyzer-template/project/orchestrateCapture.ts +92 -13
  387. package/analyzer-template/project/reconcileMockDataKeys.ts +245 -2
  388. package/analyzer-template/project/runAnalysis.ts +11 -0
  389. package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
  390. package/analyzer-template/project/serverOnlyModules.ts +413 -0
  391. package/analyzer-template/project/start.ts +72 -19
  392. package/analyzer-template/project/startScenarioCapture.ts +79 -41
  393. package/analyzer-template/project/writeMockDataTsx.ts +466 -73
  394. package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
  395. package/analyzer-template/project/writeScenarioComponents.ts +1509 -226
  396. package/analyzer-template/project/writeScenarioFiles.ts +26 -0
  397. package/analyzer-template/project/writeSimpleRoot.ts +56 -22
  398. package/analyzer-template/project/writeUniversalMocks.ts +32 -11
  399. package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
  400. package/analyzer-template/scripts/defaultCmd.sh +9 -0
  401. package/analyzer-template/tsconfig.json +2 -1
  402. package/background/src/lib/local/createLocalAnalyzer.js +2 -30
  403. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  404. package/background/src/lib/local/execAsync.js +1 -1
  405. package/background/src/lib/local/execAsync.js.map +1 -1
  406. package/background/src/lib/virtualized/common/execAsync.js +1 -1
  407. package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
  408. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +7 -1
  409. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  410. package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
  411. package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
  412. package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
  413. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  414. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +7 -1
  415. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  416. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  417. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  418. package/background/src/lib/virtualized/project/constructMockCode.js +1194 -120
  419. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  420. package/background/src/lib/virtualized/project/controller/startController.js +11 -1
  421. package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
  422. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  423. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  424. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
  425. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
  426. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +34 -9
  427. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  428. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
  429. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
  430. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  431. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  432. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +12 -6
  433. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  434. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +73 -36
  435. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  436. package/background/src/lib/virtualized/project/orchestrateCapture.js +76 -14
  437. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  438. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +204 -2
  439. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  440. package/background/src/lib/virtualized/project/runAnalysis.js +9 -0
  441. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  442. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
  443. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  444. package/background/src/lib/virtualized/project/serverOnlyModules.js +338 -0
  445. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -0
  446. package/background/src/lib/virtualized/project/start.js +62 -19
  447. package/background/src/lib/virtualized/project/start.js.map +1 -1
  448. package/background/src/lib/virtualized/project/startScenarioCapture.js +61 -31
  449. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  450. package/background/src/lib/virtualized/project/writeMockDataTsx.js +404 -62
  451. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  452. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
  453. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
  454. package/background/src/lib/virtualized/project/writeScenarioComponents.js +1112 -153
  455. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  456. package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
  457. package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
  458. package/background/src/lib/virtualized/project/writeSimpleRoot.js +57 -20
  459. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  460. package/background/src/lib/virtualized/project/writeUniversalMocks.js +27 -12
  461. package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
  462. package/codeyam-cli/scripts/apply-setup.js +180 -0
  463. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  464. package/codeyam-cli/src/cli.js +38 -17
  465. package/codeyam-cli/src/cli.js.map +1 -1
  466. package/codeyam-cli/src/codeyam-cli.js +18 -2
  467. package/codeyam-cli/src/codeyam-cli.js.map +1 -1
  468. package/codeyam-cli/src/commands/analyze.js +5 -3
  469. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  470. package/codeyam-cli/src/commands/baseline.js +176 -0
  471. package/codeyam-cli/src/commands/baseline.js.map +1 -0
  472. package/codeyam-cli/src/commands/debug.js +44 -18
  473. package/codeyam-cli/src/commands/debug.js.map +1 -1
  474. package/codeyam-cli/src/commands/default.js +30 -34
  475. package/codeyam-cli/src/commands/default.js.map +1 -1
  476. package/codeyam-cli/src/commands/detect-universal-mocks.js +2 -0
  477. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +1 -1
  478. package/codeyam-cli/src/commands/init.js +49 -257
  479. package/codeyam-cli/src/commands/init.js.map +1 -1
  480. package/codeyam-cli/src/commands/memory.js +254 -0
  481. package/codeyam-cli/src/commands/memory.js.map +1 -0
  482. package/codeyam-cli/src/commands/recapture.js +228 -0
  483. package/codeyam-cli/src/commands/recapture.js.map +1 -0
  484. package/codeyam-cli/src/commands/report.js +72 -24
  485. package/codeyam-cli/src/commands/report.js.map +1 -1
  486. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  487. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  488. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  489. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  490. package/codeyam-cli/src/commands/start.js +8 -12
  491. package/codeyam-cli/src/commands/start.js.map +1 -1
  492. package/codeyam-cli/src/commands/status.js +23 -1
  493. package/codeyam-cli/src/commands/status.js.map +1 -1
  494. package/codeyam-cli/src/commands/test-startup.js +3 -1
  495. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  496. package/codeyam-cli/src/commands/verify.js +14 -2
  497. package/codeyam-cli/src/commands/verify.js.map +1 -1
  498. package/codeyam-cli/src/commands/wipe.js +108 -0
  499. package/codeyam-cli/src/commands/wipe.js.map +1 -0
  500. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  501. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  502. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
  503. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
  504. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +128 -82
  505. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  506. package/codeyam-cli/src/utils/analysisRunner.js +29 -15
  507. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  508. package/codeyam-cli/src/utils/analyzer.js +7 -0
  509. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  510. package/codeyam-cli/src/utils/backgroundServer.js +104 -23
  511. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  512. package/codeyam-cli/src/utils/database.js +91 -5
  513. package/codeyam-cli/src/utils/database.js.map +1 -1
  514. package/codeyam-cli/src/utils/generateReport.js +253 -106
  515. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  516. package/codeyam-cli/src/utils/git.js +79 -0
  517. package/codeyam-cli/src/utils/git.js.map +1 -0
  518. package/codeyam-cli/src/utils/install-skills.js +76 -42
  519. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  520. package/codeyam-cli/src/utils/labsAutoCheck.js +19 -0
  521. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -0
  522. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  523. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  524. package/codeyam-cli/src/utils/progress.js +7 -0
  525. package/codeyam-cli/src/utils/progress.js.map +1 -1
  526. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
  527. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  528. package/codeyam-cli/src/utils/queue/job.js +249 -16
  529. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  530. package/codeyam-cli/src/utils/queue/manager.js +103 -7
  531. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  532. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  533. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  534. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  535. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  536. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  537. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
  538. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  539. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  540. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  541. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  542. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  543. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  544. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  545. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  546. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  547. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +74 -0
  548. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  549. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +376 -0
  550. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  551. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +116 -0
  552. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  553. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  554. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  555. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  556. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  557. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  558. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  559. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  560. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  561. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  562. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  563. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  564. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  565. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  566. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  567. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +84 -0
  568. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  569. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  570. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  571. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +83 -0
  572. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  573. package/codeyam-cli/src/utils/rules/index.js +7 -0
  574. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  575. package/codeyam-cli/src/utils/rules/parser.js +83 -0
  576. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  577. package/codeyam-cli/src/utils/rules/pathMatcher.js +28 -0
  578. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  579. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  580. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  581. package/codeyam-cli/src/utils/rules/sourceFiles.js +47 -0
  582. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  583. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  584. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  585. package/codeyam-cli/src/utils/serverState.js +37 -10
  586. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  587. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +21 -42
  588. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  589. package/codeyam-cli/src/utils/simulationGateMiddleware.js +138 -0
  590. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  591. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  592. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  593. package/codeyam-cli/src/utils/versionInfo.js +67 -15
  594. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  595. package/codeyam-cli/src/utils/wipe.js +128 -0
  596. package/codeyam-cli/src/utils/wipe.js.map +1 -0
  597. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  598. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  599. package/codeyam-cli/src/webserver/app/lib/database.js +118 -6
  600. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  601. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  602. package/codeyam-cli/src/webserver/backgroundServer.js +55 -10
  603. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  604. package/codeyam-cli/src/webserver/bootstrap.js +60 -0
  605. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
  606. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-jNYXRRNI.js +1 -0
  607. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-bwuHPyTa.js +11 -0
  608. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-kykTbcnD.js → EntityTypeBadge-CvzqMxcu.js} +1 -1
  609. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BH0XDim7.js +41 -0
  610. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +34 -0
  611. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-yjIHlOGa.js +25 -0
  612. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-Cq5o8jL4.js +3 -0
  613. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-BvMu2i-g.js +6 -0
  614. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-kgBTLoJD.js +3 -0
  615. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-BzPgx-xO.js +11 -0
  616. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-CwZrv-Ok.js +1 -0
  617. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BX2Ny2Qj.js +10 -0
  618. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-C06nsHKY.js → TruncatedFilePath-CDpEprKa.js} +1 -1
  619. package/codeyam-cli/src/webserver/build/client/assets/_index-BRx8ZGZo.js +11 -0
  620. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-4S4yPfFw.js +27 -0
  621. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +17 -0
  622. package/codeyam-cli/src/webserver/build/client/assets/api.agent-transcripts-l0sNRNKZ.js +1 -0
  623. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  624. package/codeyam-cli/src/webserver/build/client/assets/api.labs-unlock-l0sNRNKZ.js +1 -0
  625. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  626. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  627. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  628. package/codeyam-cli/src/webserver/build/client/assets/book-open-D4IPYH_y.js +6 -0
  629. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-CG65viiV.js +6 -0
  630. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-DB3aFuEO.js +51 -0
  631. package/codeyam-cli/src/webserver/build/client/assets/circle-check-igfMr5DY.js +6 -0
  632. package/codeyam-cli/src/webserver/build/client/assets/copy-Coc4o_8c.js +11 -0
  633. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-D1zB-pYc.js +21 -0
  634. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
  635. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
  636. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-JTAjQ54M.js +1 -0
  637. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CYqBrC9s.js → entity._sha._-B0h9AqE6.js} +22 -15
  638. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +6 -0
  639. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +6 -0
  640. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-PePWg17F.js +5 -0
  641. package/codeyam-cli/src/webserver/build/client/assets/entry.client-I-Wo99C_.js +29 -0
  642. package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
  643. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-9sMMAiWJ.js +1 -0
  644. package/codeyam-cli/src/webserver/build/client/assets/files-Co65J0s3.js +1 -0
  645. package/codeyam-cli/src/webserver/build/client/assets/git-BdHOxVfg.js +15 -0
  646. package/codeyam-cli/src/webserver/build/client/assets/globals-Dzl-jeq-.css +1 -0
  647. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  648. package/codeyam-cli/src/webserver/build/client/assets/index-CUM5iXwc.js +9 -0
  649. package/codeyam-cli/src/webserver/build/client/assets/index-_417gcQW.js +3 -0
  650. package/codeyam-cli/src/webserver/build/client/assets/labs-DAvt-sy-.js +1 -0
  651. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-TzRHMVog.js +6 -0
  652. package/codeyam-cli/src/webserver/build/client/assets/manifest-2d0e2ebb.js +1 -0
  653. package/codeyam-cli/src/webserver/build/client/assets/memory-DVGtTawo.js +92 -0
  654. package/codeyam-cli/src/webserver/build/client/assets/pause-hjzB7t2z.js +11 -0
  655. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  656. package/codeyam-cli/src/webserver/build/client/assets/root-Bg3WICdl.js +62 -0
  657. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  658. package/codeyam-cli/src/webserver/build/client/assets/search-DcAwD_Ln.js +6 -0
  659. package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +1 -0
  660. package/codeyam-cli/src/webserver/build/client/assets/simulations-DVNJVQgD.js +1 -0
  661. package/codeyam-cli/src/webserver/build/client/assets/terminal-DbEAHMbA.js +11 -0
  662. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CAD5b1o_.js +6 -0
  663. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +1 -0
  664. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-Blr5oZDE.js → useLastLogLine-DAFqfEDH.js} +1 -1
  665. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DZlYx2c4.js +1 -0
  666. package/codeyam-cli/src/webserver/build/client/assets/{useToast-Bbf4Hokd.js → useToast-ihdMtlf6.js} +1 -1
  667. package/codeyam-cli/src/webserver/build/server/assets/index-CpreP2n8.js +1 -0
  668. package/codeyam-cli/src/webserver/build/server/assets/server-build-DyvoFrHR.js +273 -0
  669. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  670. package/codeyam-cli/src/webserver/build-info.json +5 -5
  671. package/codeyam-cli/src/webserver/devServer.js +1 -3
  672. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  673. package/codeyam-cli/src/webserver/server.js +35 -25
  674. package/codeyam-cli/src/webserver/server.js.map +1 -1
  675. package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam-debug.md} +48 -4
  676. package/codeyam-cli/templates/codeyam-diagnose.md +481 -0
  677. package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
  678. package/codeyam-cli/templates/codeyam-memory.md +396 -0
  679. package/codeyam-cli/templates/codeyam-new-rule.md +13 -0
  680. package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam-setup.md} +151 -4
  681. package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam-sim.md} +1 -1
  682. package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam-test.md} +1 -1
  683. package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam-verify.md} +1 -1
  684. package/codeyam-cli/templates/rule-notification-hook.py +56 -0
  685. package/codeyam-cli/templates/rule-reflection-hook.py +627 -0
  686. package/codeyam-cli/templates/rules-instructions.md +132 -0
  687. package/package.json +26 -23
  688. package/packages/ai/index.js +8 -6
  689. package/packages/ai/index.js.map +1 -1
  690. package/packages/ai/src/lib/analyzeScope.js +181 -13
  691. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  692. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  693. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  694. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +154 -9
  695. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  696. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
  697. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
  698. package/packages/ai/src/lib/astScopes/methodSemantics.js +138 -23
  699. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  700. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  701. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  702. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
  703. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
  704. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +23 -0
  705. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  706. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
  707. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  708. package/packages/ai/src/lib/astScopes/processExpression.js +1235 -104
  709. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  710. package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
  711. package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
  712. package/packages/ai/src/lib/checkAllAttributes.js +24 -9
  713. package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
  714. package/packages/ai/src/lib/completionCall.js +178 -31
  715. package/packages/ai/src/lib/completionCall.js.map +1 -1
  716. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +2171 -224
  717. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  718. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +19 -4
  719. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  720. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +661 -0
  721. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  722. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +180 -56
  723. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  724. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  725. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  726. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  727. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  728. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +66 -2
  729. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  730. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +139 -13
  731. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  732. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  733. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  734. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +142 -12
  735. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  736. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  737. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  738. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  739. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  740. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  741. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  742. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +371 -73
  743. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  744. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  745. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  746. package/packages/ai/src/lib/dataStructureChunking.js +130 -0
  747. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  748. package/packages/ai/src/lib/deepEqual.js +32 -0
  749. package/packages/ai/src/lib/deepEqual.js.map +1 -0
  750. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  751. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  752. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  753. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  754. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +62 -5
  755. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  756. package/packages/ai/src/lib/generateChangesEntityScenarios.js +81 -90
  757. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  758. package/packages/ai/src/lib/generateEntityDataStructure.js +50 -1
  759. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  760. package/packages/ai/src/lib/generateEntityScenarioData.js +1127 -91
  761. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  762. package/packages/ai/src/lib/generateEntityScenarios.js +193 -83
  763. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  764. package/packages/ai/src/lib/generateExecutionFlows.js +495 -0
  765. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
  766. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
  767. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
  768. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1807 -0
  769. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
  770. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  771. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  772. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  773. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  774. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  775. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  776. package/packages/ai/src/lib/isolateScopes.js +270 -7
  777. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  778. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
  779. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
  780. package/packages/ai/src/lib/mergeStatements.js +88 -46
  781. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  782. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
  783. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
  784. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +16 -4
  785. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  786. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
  787. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
  788. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -64
  789. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  790. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  791. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  792. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +83 -6
  793. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  794. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -34
  795. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  796. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
  797. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
  798. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  799. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  800. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  801. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  802. package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
  803. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
  804. package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
  805. package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
  806. package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
  807. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  808. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +98 -1
  809. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  810. package/packages/analyze/index.js +1 -0
  811. package/packages/analyze/index.js.map +1 -1
  812. package/packages/analyze/src/lib/FileAnalyzer.js +75 -36
  813. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  814. package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
  815. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  816. package/packages/analyze/src/lib/analysisContext.js +30 -5
  817. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  818. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  819. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  820. package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
  821. package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
  822. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
  823. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
  824. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  825. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  826. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  827. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  828. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  829. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  830. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  831. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  832. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  833. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  834. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  835. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  836. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +428 -123
  837. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  838. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +42 -1
  839. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  840. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
  841. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  842. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
  843. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  844. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  845. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  846. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
  847. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  848. package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
  849. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  850. package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
  851. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  852. package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
  853. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  854. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  855. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  856. package/packages/analyze/src/lib/files/enums/steps.js +1 -1
  857. package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
  858. package/packages/analyze/src/lib/files/getImportedExports.js +17 -8
  859. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  860. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
  861. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  862. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +255 -0
  863. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  864. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
  865. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
  866. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +550 -62
  867. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  868. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  869. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  870. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
  871. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  872. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +404 -85
  873. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  874. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +144 -0
  875. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
  876. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +56 -69
  877. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  878. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +4 -8
  879. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  880. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +875 -141
  881. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  882. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  883. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  884. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  885. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  886. package/packages/analyze/src/lib/index.js +1 -0
  887. package/packages/analyze/src/lib/index.js.map +1 -1
  888. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  889. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  890. package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
  891. package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  892. package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
  893. package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  894. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  895. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  896. package/packages/database/src/lib/analysisToDb.js +1 -1
  897. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  898. package/packages/database/src/lib/branchToDb.js +1 -1
  899. package/packages/database/src/lib/branchToDb.js.map +1 -1
  900. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  901. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  902. package/packages/database/src/lib/commitToDb.js +1 -1
  903. package/packages/database/src/lib/commitToDb.js.map +1 -1
  904. package/packages/database/src/lib/fileToDb.js +1 -1
  905. package/packages/database/src/lib/fileToDb.js.map +1 -1
  906. package/packages/database/src/lib/kysely/db.js +13 -3
  907. package/packages/database/src/lib/kysely/db.js.map +1 -1
  908. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  909. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  910. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  911. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  912. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js +35 -0
  913. package/packages/database/src/lib/kysely/tables/labsRequestsTable.js.map +1 -0
  914. package/packages/database/src/lib/loadAnalyses.js +45 -2
  915. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  916. package/packages/database/src/lib/loadAnalysis.js +8 -0
  917. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  918. package/packages/database/src/lib/loadBranch.js +11 -1
  919. package/packages/database/src/lib/loadBranch.js.map +1 -1
  920. package/packages/database/src/lib/loadCommit.js +7 -0
  921. package/packages/database/src/lib/loadCommit.js.map +1 -1
  922. package/packages/database/src/lib/loadCommits.js +22 -1
  923. package/packages/database/src/lib/loadCommits.js.map +1 -1
  924. package/packages/database/src/lib/loadEntities.js +23 -4
  925. package/packages/database/src/lib/loadEntities.js.map +1 -1
  926. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  927. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  928. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +23 -5
  929. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  930. package/packages/database/src/lib/projectToDb.js +1 -1
  931. package/packages/database/src/lib/projectToDb.js.map +1 -1
  932. package/packages/database/src/lib/saveFiles.js +1 -1
  933. package/packages/database/src/lib/saveFiles.js.map +1 -1
  934. package/packages/database/src/lib/scenarioToDb.js +1 -1
  935. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  936. package/packages/database/src/lib/updateCommitMetadata.js +5 -4
  937. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  938. package/packages/generate/index.js +3 -0
  939. package/packages/generate/index.js.map +1 -1
  940. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  941. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  942. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  943. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  944. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  945. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  946. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  947. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  948. package/packages/generate/src/lib/deepMerge.js +27 -1
  949. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  950. package/packages/generate/src/lib/directExecutionScript.js +10 -1
  951. package/packages/generate/src/lib/directExecutionScript.js.map +1 -1
  952. package/packages/generate/src/lib/getComponentScenarioPath.js +7 -3
  953. package/packages/generate/src/lib/getComponentScenarioPath.js.map +1 -1
  954. package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
  955. package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  956. package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
  957. package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
  958. package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
  959. package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
  960. package/packages/process/index.js +3 -0
  961. package/packages/process/index.js.map +1 -0
  962. package/packages/process/src/GlobalProcessManager.js.map +1 -0
  963. package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
  964. package/packages/process/src/ProcessManager.js.map +1 -0
  965. package/packages/process/src/index.js.map +1 -0
  966. package/packages/process/src/managedExecAsync.js.map +1 -0
  967. package/packages/types/index.js.map +1 -1
  968. package/packages/utils/src/lib/applyUniversalMocks.js +26 -2
  969. package/packages/utils/src/lib/applyUniversalMocks.js.map +1 -1
  970. package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
  971. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  972. package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
  973. package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  974. package/packages/utils/src/lib/safeFileName.js +29 -3
  975. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  976. package/scripts/finalize-analyzer.cjs +8 -74
  977. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
  978. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -197
  979. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -271
  980. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -294
  981. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
  982. package/analyzer-template/packages/ai/src/lib/transformMockDataToMatchSchema.ts +0 -156
  983. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -115
  984. package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
  985. package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
  986. package/analyzer-template/process/README.md +0 -507
  987. package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
  988. package/background/src/lib/process/ProcessManager.js.map +0 -1
  989. package/background/src/lib/process/index.js.map +0 -1
  990. package/background/src/lib/process/managedExecAsync.js.map +0 -1
  991. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  992. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  993. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-D4htqD-x.js +0 -1
  994. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-Catz6XEN.js +0 -1
  995. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-TlHocYno.js +0 -26
  996. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CVMmGuIc.js +0 -3
  997. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-JkfQ-VaI.js +0 -3
  998. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-CVZ0H4BL.js +0 -1
  999. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BrMAP1nP.js +0 -1
  1000. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CJhE4cCv.js +0 -5
  1001. package/codeyam-cli/src/webserver/build/client/assets/_index-faVIcr_i.js +0 -1
  1002. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLMa2sgx.js +0 -7
  1003. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-DwYjrK_h.js +0 -1
  1004. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CgXbbZRx.js +0 -26
  1005. package/codeyam-cli/src/webserver/build/client/assets/circle-check-B2oHQ-zo.js +0 -1
  1006. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-BBYuR56H.js +0 -1
  1007. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CT0Q5lVu.js +0 -1
  1008. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-Bj5GHkhb.js +0 -1
  1009. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-eW5z9AyZ.js +0 -5
  1010. package/codeyam-cli/src/webserver/build/client/assets/entry.client-B9tSboXM.js +0 -5
  1011. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-CmO-EZAB.js +0 -1
  1012. package/codeyam-cli/src/webserver/build/client/assets/files-DLinnTOx.js +0 -1
  1013. package/codeyam-cli/src/webserver/build/client/assets/git-CIxwBQvb.js +0 -12
  1014. package/codeyam-cli/src/webserver/build/client/assets/globals-xPz593l2.css +0 -1
  1015. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  1016. package/codeyam-cli/src/webserver/build/client/assets/index-_LjBsTxX.js +0 -8
  1017. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-D_EGChhq.js +0 -1
  1018. package/codeyam-cli/src/webserver/build/client/assets/manifest-ca438c41.js +0 -1
  1019. package/codeyam-cli/src/webserver/build/client/assets/root-CHHYHuzL.js +0 -16
  1020. package/codeyam-cli/src/webserver/build/client/assets/search-DY8yoDpH.js +0 -1
  1021. package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
  1022. package/codeyam-cli/src/webserver/build/client/assets/settings-BT6wVHd5.js +0 -1
  1023. package/codeyam-cli/src/webserver/build/client/assets/simulations-gv3H7JV7.js +0 -1
  1024. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-BthANBVv.js +0 -1
  1025. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CANr3QJ5.js +0 -1
  1026. package/codeyam-cli/src/webserver/build/server/assets/index-BtBPtyHx.js +0 -1
  1027. package/codeyam-cli/src/webserver/build/server/assets/server-build-N2cTnejq.js +0 -166
  1028. package/codeyam-cli/templates/debug-command.md +0 -141
  1029. package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
  1030. package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
  1031. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -136
  1032. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
  1033. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -220
  1034. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
  1035. package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -241
  1036. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
  1037. package/packages/ai/src/lib/isFrontend.js +0 -5
  1038. package/packages/ai/src/lib/isFrontend.js.map +0 -1
  1039. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
  1040. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
  1041. package/packages/ai/src/lib/transformMockDataToMatchSchema.js +0 -124
  1042. package/packages/ai/src/lib/transformMockDataToMatchSchema.js.map +0 -1
  1043. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -72
  1044. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
  1045. /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
  1046. /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
  1047. /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
  1048. /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
  1049. /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
  1050. /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
  1051. /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
  1052. /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
@@ -0,0 +1,1807 @@
1
+ /**
2
+ * Generates execution flows from conditional usages using pure static analysis.
3
+ *
4
+ * This replaces LLM-driven flow generation with deterministic flow generation
5
+ * based on conditionalUsages extracted from the AST. Only paths that resolve
6
+ * to controllable data sources (exist in attributesMap) produce flows.
7
+ *
8
+ * Flow generation rules:
9
+ * - truthiness conditions → truthy flow + falsy flow
10
+ * - comparison conditions → one flow per compared value
11
+ * - switch conditions → one flow per case value
12
+ * - compound conditionals → one flow with all conditions (only if ALL paths controllable)
13
+ */
14
+ import resolvePathToControllable from "./resolvePathToControllable.js";
15
+ import cleanPathOfNonTransformingFunctions from "./dataStructure/helpers/cleanPathOfNonTransformingFunctions.js";
16
+ /**
17
+ * Recursively expands a derived variable to its leaf data sources.
18
+ *
19
+ * For OR expressions like `isAnalyzing = a || b || c`:
20
+ * - Returns all source paths [a, b, c] so they can all be set appropriately
21
+ *
22
+ * For nested derivations like `isAnalyzing = isInCurrentRun || isInQueue`:
23
+ * - Where `isInCurrentRun` is derived from `currentRun.entityShas.includes(x)`
24
+ * - Returns the final data sources: [currentRun.entityShas, queueState.jobs]
25
+ *
26
+ * @param path The variable path to expand
27
+ * @param conditionalUsages All conditional usages (to look up derivedFrom info)
28
+ * @param attributesMap Map of controllable paths
29
+ * @param equivalentSignatureVariables Variable-to-path mappings
30
+ * @param fullToShortPathMap Full-to-short path mappings
31
+ * @param visited Set of already-visited paths (prevents infinite recursion)
32
+ * @param derivedVariables Optional map of all derived variables (for intermediate tracing)
33
+ * @returns Array of resolved source paths that are controllable
34
+ */
35
+ function expandDerivedVariableToSources(path, conditionalUsages, attributesMap, equivalentSignatureVariables, fullToShortPathMap, visited = new Set(), derivedVariables) {
36
+ // Prevent infinite recursion
37
+ if (visited.has(path)) {
38
+ return [];
39
+ }
40
+ visited.add(path);
41
+ // First, check if this path is directly controllable
42
+ const directResolution = resolvePathToControllable(path, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
43
+ if (directResolution.isControllable && directResolution.resolvedPath) {
44
+ return [{ path: directResolution.resolvedPath }];
45
+ }
46
+ // Look up derivedFrom info for this path
47
+ // First check conditionalUsages, then fall back to derivedVariables
48
+ const usage = conditionalUsages[path]?.[0];
49
+ let derivedFrom = usage?.derivedFrom;
50
+ // CRITICAL: If not found in conditionalUsages, check derivedVariables
51
+ // This handles intermediate derived variables like `isInCurrentRun` that aren't
52
+ // directly used in conditionals but ARE derived from data sources
53
+ if (!derivedFrom && derivedVariables?.[path]) {
54
+ derivedFrom = derivedVariables[path];
55
+ }
56
+ if (!derivedFrom) {
57
+ return [];
58
+ }
59
+ const { operation, sourcePath, sourcePaths } = derivedFrom;
60
+ // For OR/AND operations, recursively expand all source paths
61
+ if ((operation === 'or' || operation === 'and') && sourcePaths) {
62
+ const allSources = [];
63
+ for (const sp of sourcePaths) {
64
+ const expanded = expandDerivedVariableToSources(sp, conditionalUsages, attributesMap, equivalentSignatureVariables, fullToShortPathMap, visited, derivedVariables);
65
+ // Add all expanded sources
66
+ for (const source of expanded) {
67
+ // Avoid duplicates
68
+ if (!allSources.some((s) => s.path === source.path)) {
69
+ allSources.push(source);
70
+ }
71
+ }
72
+ }
73
+ return allSources;
74
+ }
75
+ // For single-source operations (arrayIncludes, arraySome, notNull, etc.)
76
+ if (sourcePath) {
77
+ // Try to resolve the source path directly
78
+ const sourceResolution = resolvePathToControllable(sourcePath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
79
+ if (sourceResolution.isControllable && sourceResolution.resolvedPath) {
80
+ return [{ path: sourceResolution.resolvedPath, operation }];
81
+ }
82
+ // If not directly resolvable, recursively expand
83
+ return expandDerivedVariableToSources(sourcePath, conditionalUsages, attributesMap, equivalentSignatureVariables, fullToShortPathMap, visited, derivedVariables);
84
+ }
85
+ return [];
86
+ }
87
+ /**
88
+ * Clean up sourceDataPath by removing redundant scope prefixes.
89
+ *
90
+ * This function ONLY handles the specific pattern where a scope name is
91
+ * duplicated before the hook call:
92
+ *
93
+ * Example:
94
+ * "useLoaderData<LoaderData>.useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
95
+ * → "useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
96
+ *
97
+ * For paths with multiple function calls (like fetch().json()), or paths
98
+ * that don't match the expected pattern, returns null to indicate the
99
+ * fallback resolution should be used.
100
+ */
101
+ function cleanSourceDataPath(sourceDataPath) {
102
+ // Count function call patterns - both empty () and with content (...)
103
+ // We detect multiple function calls by counting:
104
+ // 1. Empty () patterns
105
+ // 2. Patterns like functionName(...) - closing paren followed by dot or end
106
+ const emptyFnCalls = (sourceDataPath.match(/\(\)/g) || []).length;
107
+ const fnCallReturnValues = (sourceDataPath.match(/\.functionCallReturnValue/g) || []).length;
108
+ // For chained function calls (e.g., fetch().json()) or paths with non-standard
109
+ // fn call patterns, return the original path so findInAttributesMapForPath can
110
+ // try to look it up in fullToShortPathMap. If it doesn't match, the caller
111
+ // falls through to fallback resolution anyway.
112
+ if (fnCallReturnValues > 1 || emptyFnCalls !== 1) {
113
+ console.log(`[cleanSourceDataPath] chained/non-standard path (fnCallRVs=${fnCallReturnValues}, emptyFnCalls=${emptyFnCalls}), returning original: "${sourceDataPath}"`);
114
+ return sourceDataPath;
115
+ }
116
+ // Find the "()" which marks the function call
117
+ const fnCallIndex = sourceDataPath.indexOf('()');
118
+ // Find where the function name starts (go back to find the start of this segment)
119
+ const beforeFnCall = sourceDataPath.slice(0, fnCallIndex);
120
+ const lastDotBeforeFn = beforeFnCall.lastIndexOf('.');
121
+ if (lastDotBeforeFn === -1) {
122
+ return sourceDataPath;
123
+ }
124
+ // Extract the scope prefix and the actual path
125
+ const scopePrefix = sourceDataPath.slice(0, lastDotBeforeFn);
126
+ const actualPath = sourceDataPath.slice(lastDotBeforeFn + 1);
127
+ // Verify this is actually a redundant scope prefix pattern
128
+ // The actualPath should start with something that matches the scopePrefix
129
+ // e.g., scopePrefix="useLoaderData<LoaderData>" and actualPath starts with "useLoaderData<LoaderData>()..."
130
+ if (!actualPath.startsWith(scopePrefix.split('.').pop() || '')) {
131
+ // Not a redundant prefix pattern - return the original path
132
+ return sourceDataPath;
133
+ }
134
+ return actualPath;
135
+ }
136
+ /**
137
+ * Strip .length suffix from a path if present.
138
+ *
139
+ * When we have a path like "items.length", the controllable attribute is "items"
140
+ * (the array), not "items.length". The length is derived from the array contents.
141
+ *
142
+ * This ensures that execution flows reference the actual controllable attribute
143
+ * rather than the derived .length property.
144
+ */
145
+ function stripLengthSuffix(path) {
146
+ if (path.endsWith('.length')) {
147
+ return path.slice(0, -7); // Remove ".length" (7 characters)
148
+ }
149
+ return path;
150
+ }
151
+ /**
152
+ * Remove contradictory required values from a compound flow.
153
+ *
154
+ * When a lifecycle boolean (like isLoadingAuditData) is traced to a fetch call's
155
+ * return value, a negated condition (!isLoadingAuditData) produces "falsy" on
156
+ * the fetch path. But if another condition in the same compound requires data
157
+ * from a sub-path of that fetch (e.g., topPaths length > 0), the "falsy" on the
158
+ * parent path contradicts it — a null/falsy response has no .json() to call.
159
+ *
160
+ * This function removes "falsy" required values whose attributePath is a prefix
161
+ * of another required value's attributePath. The child data requirement already
162
+ * implies the parent (fetch) succeeded.
163
+ */
164
+ function removeContradictoryFalsyValues(requiredValues) {
165
+ return requiredValues.filter((rv) => {
166
+ if (rv.comparison === 'falsy') {
167
+ const hasChildRequirement = requiredValues.some((other) => other !== rv &&
168
+ other.attributePath.startsWith(rv.attributePath + '.'));
169
+ if (hasChildRequirement) {
170
+ return false;
171
+ }
172
+ }
173
+ return true;
174
+ });
175
+ }
176
+ /**
177
+ * Generate a human-readable description snippet for a required value,
178
+ * incorporating the comparison type so the LLM understands the intent.
179
+ */
180
+ function describeRequiredValue(rv) {
181
+ const name = generateNameFromPath(rv.attributePath).toLowerCase();
182
+ switch (rv.comparison) {
183
+ case 'truthy':
184
+ return `${name} is present`;
185
+ case 'falsy':
186
+ return `${name} is absent`;
187
+ case 'length>':
188
+ return rv.value === '0'
189
+ ? `${name} has items`
190
+ : `${name} has more than ${rv.value} items`;
191
+ case 'length<':
192
+ return `${name} has fewer than ${rv.value} items`;
193
+ case 'equals':
194
+ return `${name} is ${rv.value}`;
195
+ case 'exists':
196
+ return `${name} exists`;
197
+ case 'not-exists':
198
+ return `${name} does not exist`;
199
+ default:
200
+ return `${name} is ${rv.value}`;
201
+ }
202
+ }
203
+ /**
204
+ * Check whether a resolved path has child entries in the fullToShortPathMap.
205
+ *
206
+ * When a lifecycle boolean (e.g., isLoadingAuditData) resolves to a parent path
207
+ * like fetch(...).functionCallReturnValue, and that path has children (like
208
+ * .json().functionCallReturnValue.topPaths), individual truthy/falsy flows on
209
+ * the parent are misleading. Compound flows with specific child requirements
210
+ * provide better guidance for mock data generation.
211
+ */
212
+ function hasChildPathsInMap(resolvedPath, fullToShortPathMap) {
213
+ return Object.keys(fullToShortPathMap).some((fullPath) => fullPath.startsWith(resolvedPath + '.') ||
214
+ fullPath.startsWith(resolvedPath + '['));
215
+ }
216
+ /**
217
+ * Extract the controllable base path from a path that may contain method calls.
218
+ *
219
+ * This handles complex expressions like:
220
+ * - `scenarios.filter((s) => s.active).length` → `scenarios`
221
+ * - `users.some((u) => u.role === 'admin')` → `users`
222
+ * - `items.map(x => x.name).join(', ')` → `items`
223
+ *
224
+ * The controllable base is the path that can be mocked - we can control
225
+ * what `scenarios` contains, but we can't control what `.filter()` returns.
226
+ *
227
+ * @param path - The path that may contain method calls
228
+ * @returns The controllable base path with method calls stripped
229
+ */
230
+ function extractControllableBase(path) {
231
+ // First strip .length suffix if present
232
+ const pathWithoutLength = stripLengthSuffix(path);
233
+ // Use cleanPathOfNonTransformingFunctions to strip method calls like .filter(), .some()
234
+ const cleanedPath = cleanPathOfNonTransformingFunctions(pathWithoutLength);
235
+ // If the cleaned path is different, return it
236
+ if (cleanedPath !== pathWithoutLength) {
237
+ return cleanedPath;
238
+ }
239
+ // Otherwise, return the path with just .length stripped
240
+ return pathWithoutLength;
241
+ }
242
+ /**
243
+ * Find a path in attributesMap, using fullToShortPathMap to verify the path is controllable.
244
+ *
245
+ * IMPORTANT: Returns the FULL path (preserving data source context) when possible.
246
+ * This ensures execution flows can be traced back to specific data sources,
247
+ * which is critical when multiple data sources have the same property names
248
+ * (e.g., multiple useFetcher hooks all having 'state' and 'data').
249
+ *
250
+ * The attributesMap contains short relative paths (e.g., "entity.sha")
251
+ * The sourceDataPath contains full paths (e.g., "useLoaderData<LoaderData>().functionCallReturnValue.entity.sha")
252
+ * The fullToShortPathMap maps full paths to short paths
253
+ */
254
+ export function findInAttributesMapForPath(path, attributesMap, fullToShortPathMap) {
255
+ // Direct match in attributesMap (already a short path)
256
+ if (path in attributesMap) {
257
+ console.log(`[findInAttributesMapForPath] "${path}" → DIRECT match in attributesMap`);
258
+ return path;
259
+ }
260
+ // Try looking up the path in fullToShortPathMap to verify it's controllable
261
+ // IMPORTANT: Return the FULL path, not the short path, to preserve data source context
262
+ if (path in fullToShortPathMap) {
263
+ const shortPath = fullToShortPathMap[path];
264
+ if (shortPath in attributesMap) {
265
+ console.log(`[findInAttributesMapForPath] "${path}" → fullToShortPathMap match: shortPath="${shortPath}" found in attributesMap`);
266
+ return path; // Return FULL path to preserve data source context
267
+ }
268
+ console.log(`[findInAttributesMapForPath] "${path}" → fullToShortPathMap match shortPath="${shortPath}" but NOT in attributesMap`);
269
+ }
270
+ // Normalized match (array indices [N] → [])
271
+ const normalizedPath = path.replace(/\[\d+\]/g, '[]');
272
+ if (normalizedPath !== path) {
273
+ if (normalizedPath in attributesMap) {
274
+ console.log(`[findInAttributesMapForPath] "${path}" → normalized "${normalizedPath}" DIRECT match in attributesMap`);
275
+ return normalizedPath;
276
+ }
277
+ if (normalizedPath in fullToShortPathMap) {
278
+ const shortPath = fullToShortPathMap[normalizedPath];
279
+ if (shortPath in attributesMap) {
280
+ console.log(`[findInAttributesMapForPath] "${path}" → normalized "${normalizedPath}" fullToShortPathMap match: shortPath="${shortPath}"`);
281
+ return normalizedPath; // Return normalized FULL path
282
+ }
283
+ }
284
+ }
285
+ // Try prefix matching for child paths
286
+ // e.g., path is "entity.sha.something" and attributesMap has "entity.sha"
287
+ // OR path is a full path like "useLoaderData<...>().functionCallReturnValue.entity.sha"
288
+ // and we need to find matching short path prefix
289
+ for (const attrPath of Object.keys(attributesMap)) {
290
+ if (path.startsWith(attrPath + '.') || path.startsWith(attrPath + '[')) {
291
+ console.log(`[findInAttributesMapForPath] "${path}" → PREFIX match: starts with attributesMap key "${attrPath}"`);
292
+ return path;
293
+ }
294
+ }
295
+ // Try suffix matching: if the path ends with ".X.Y.Z" and attributesMap has "X.Y.Z"
296
+ // Return the FULL input path to preserve data source context
297
+ // Skip suffix matching for chained function calls (multiple .functionCallReturnValue segments)
298
+ // to avoid false matches: e.g., fetch(...).json().functionCallReturnValue.data falsely matching
299
+ // "data" from a completely different data source like useFetcher
300
+ const fnCallReturnValueCount = (path.match(/\.functionCallReturnValue/g) || []).length;
301
+ if (fnCallReturnValueCount <= 1) {
302
+ for (const attrPath of Object.keys(attributesMap)) {
303
+ if (path.endsWith('.' + attrPath) ||
304
+ path.endsWith('.' + attrPath.replace(/\[\d+\]/g, '[]'))) {
305
+ console.log(`[findInAttributesMapForPath] "${path}" → SUFFIX match: ends with attributesMap key "${attrPath}"`);
306
+ return path; // Return FULL path, not short attrPath
307
+ }
308
+ }
309
+ }
310
+ // Try child path matching against fullToShortPathMap keys
311
+ // If the path starts with a known full path + '.' or '[', it's a child
312
+ // of a controllable path. Build the equivalent short child path.
313
+ // e.g., path = "fetch(...).fCRV.json().fCRV.topPaths.length"
314
+ // fullToShortPathMap has "fetch(...).fCRV.json().fCRV.topPaths" → "json().fCRV.topPaths"
315
+ // → check if "json().fCRV.topPaths.length" is in attributesMap
316
+ for (const [fullPath, shortPath] of Object.entries(fullToShortPathMap)) {
317
+ if (path.startsWith(fullPath + '.') || path.startsWith(fullPath + '[')) {
318
+ const suffix = path.slice(fullPath.length); // e.g., ".length"
319
+ const shortChildPath = shortPath + suffix;
320
+ if (shortChildPath in attributesMap) {
321
+ console.log(`[findInAttributesMapForPath] "${path}" → CHILD of fullToShortPathMap key "${fullPath}": shortChildPath="${shortChildPath}" found in attributesMap`);
322
+ return path; // Return full path to preserve data source context
323
+ }
324
+ // Also check if the base short path is an array and suffix is .length
325
+ if (suffix === '.length' && shortPath in attributesMap) {
326
+ console.log(`[findInAttributesMapForPath] "${path}" → CHILD .length of fullToShortPathMap key "${fullPath}": base shortPath="${shortPath}" is in attributesMap (array .length)`);
327
+ return path; // Array .length is controllable via the array
328
+ }
329
+ }
330
+ }
331
+ // Try parent matching: if the path is a prefix of any fullToShortPathMap key,
332
+ // it's a parent of controllable data and therefore controllable itself
333
+ for (const fullPath of Object.keys(fullToShortPathMap)) {
334
+ if (fullPath.startsWith(path + '.') || fullPath.startsWith(path + '[')) {
335
+ console.log(`[findInAttributesMapForPath] "${path}" → PARENT match: fullToShortPathMap key "${fullPath}" starts with this path`);
336
+ return path;
337
+ }
338
+ }
339
+ console.log(`[findInAttributesMapForPath] "${path}" → NO MATCH (checked ${Object.keys(attributesMap).length} attributesMap keys, ${Object.keys(fullToShortPathMap).length} fullToShortPathMap keys)`);
340
+ return null;
341
+ }
342
+ /**
343
+ * Generate a slug from a path for use in flow IDs and exclusive groups.
344
+ */
345
+ function pathToSlug(path) {
346
+ return path
347
+ .replace(/\[\d+\]/g, '')
348
+ .replace(/\[\]/g, '')
349
+ .replace(/\(\)/g, '')
350
+ .replace(/\.functionCallReturnValue/g, '')
351
+ .replace(/[<>]/g, '')
352
+ .replace(/\./g, '-')
353
+ .toLowerCase();
354
+ }
355
+ /**
356
+ * Generate a human-readable name from a path.
357
+ * Extracts the last meaningful part of the path.
358
+ *
359
+ * Examples:
360
+ * - "useFetcher<...>().functionCallReturnValue.state" → "state"
361
+ * - "useLoaderData<...>().functionCallReturnValue.user.isActive" → "isActive"
362
+ */
363
+ function generateNameFromPath(path) {
364
+ // Remove function call markers and get the last meaningful segment
365
+ const cleanPath = path
366
+ .replace(/\(\)/g, '')
367
+ .replace(/\.functionCallReturnValue/g, '');
368
+ const parts = cleanPath.split('.');
369
+ const lastPart = parts[parts.length - 1];
370
+ // Convert camelCase to Title Case with spaces
371
+ return lastPart
372
+ .replace(/([A-Z])/g, ' $1')
373
+ .replace(/^./, (str) => str.toUpperCase())
374
+ .trim();
375
+ }
376
+ /**
377
+ * Generate a flow ID from path and value.
378
+ * Creates a unique, URL-safe identifier.
379
+ */
380
+ function generateFlowId(path, value) {
381
+ // Clean the path for use in ID
382
+ const cleanPath = path
383
+ .replace(/\(\)/g, '')
384
+ .replace(/\.functionCallReturnValue/g, '')
385
+ .replace(/[<>]/g, '')
386
+ .replace(/\./g, '-');
387
+ // Clean the value
388
+ const cleanValue = value
389
+ .toString()
390
+ .toLowerCase()
391
+ .replace(/[^a-z0-9]/g, '-')
392
+ .replace(/-+/g, '-')
393
+ .replace(/^-|-$/g, '');
394
+ return `${cleanPath}-${cleanValue}`.toLowerCase();
395
+ }
396
+ /**
397
+ * Infer value type from a string value.
398
+ */
399
+ function inferValueType(value) {
400
+ if (value === 'true' || value === 'false')
401
+ return 'boolean';
402
+ if (value === 'null' || value === 'undefined')
403
+ return 'null';
404
+ if (!isNaN(Number(value)) && value !== '')
405
+ return 'number';
406
+ return 'string';
407
+ }
408
+ /**
409
+ * Generate flows from a single conditional usage.
410
+ * Sets impact to 'high' if the conditional controls JSX rendering.
411
+ *
412
+ * When the usage has a `constraintExpression`, it represents a complex expression
413
+ * that can't be simply resolved (e.g., `scenarios.filter(x => x.active).length > 1`).
414
+ * In this case:
415
+ * - `attributePath` is set to the controllable base (e.g., `scenarios`)
416
+ * - `constraint` is set to the full expression for LLM reasoning
417
+ */
418
+ function generateFlowsFromUsage(usage, resolvedPath) {
419
+ const flows = [];
420
+ const baseName = generateNameFromPath(resolvedPath);
421
+ // Determine impact based on whether this conditional controls JSX rendering
422
+ // Conditionals that control visual output are high-impact
423
+ const impact = usage.controlsJsxRendering
424
+ ? 'high'
425
+ : 'medium';
426
+ // When there's a constraintExpression, use the controllable base for attributePath
427
+ // and pass through the constraint for LLM reasoning
428
+ const hasConstraint = !!usage.constraintExpression;
429
+ const attributePath = hasConstraint
430
+ ? extractControllableBase(resolvedPath)
431
+ : stripLengthSuffix(resolvedPath);
432
+ const constraint = usage.constraintExpression;
433
+ if (usage.conditionType === 'truthiness') {
434
+ // Generate both truthy and falsy flows
435
+ const isNegated = usage.isNegated ?? false;
436
+ // Truthy flow (or falsy if negated)
437
+ flows.push({
438
+ id: generateFlowId(resolvedPath, isNegated ? 'falsy' : 'truthy'),
439
+ name: `${baseName} ${isNegated ? 'False' : 'True'}`,
440
+ description: `When ${baseName.toLowerCase()} is ${isNegated ? 'falsy' : 'truthy'}`,
441
+ requiredValues: [
442
+ {
443
+ attributePath,
444
+ value: isNegated ? 'falsy' : 'truthy',
445
+ comparison: isNegated ? 'falsy' : 'truthy',
446
+ valueType: 'boolean',
447
+ constraint,
448
+ },
449
+ ],
450
+ impact,
451
+ sourceLocation: usage.sourceLocation
452
+ ? {
453
+ lineNumber: usage.sourceLocation.lineNumber,
454
+ column: usage.sourceLocation.column,
455
+ }
456
+ : undefined,
457
+ codeSnippet: usage.sourceLocation?.codeSnippet,
458
+ });
459
+ // Falsy flow (or truthy if negated)
460
+ flows.push({
461
+ id: generateFlowId(resolvedPath, isNegated ? 'truthy' : 'falsy'),
462
+ name: `${baseName} ${isNegated ? 'True' : 'False'}`,
463
+ description: `When ${baseName.toLowerCase()} is ${isNegated ? 'truthy' : 'falsy'}`,
464
+ requiredValues: [
465
+ {
466
+ attributePath,
467
+ value: isNegated ? 'truthy' : 'falsy',
468
+ comparison: isNegated ? 'truthy' : 'falsy',
469
+ valueType: 'boolean',
470
+ constraint,
471
+ },
472
+ ],
473
+ impact,
474
+ sourceLocation: usage.sourceLocation
475
+ ? {
476
+ lineNumber: usage.sourceLocation.lineNumber,
477
+ column: usage.sourceLocation.column,
478
+ }
479
+ : undefined,
480
+ codeSnippet: usage.sourceLocation?.codeSnippet,
481
+ });
482
+ }
483
+ else if (usage.conditionType === 'comparison' ||
484
+ usage.conditionType === 'switch') {
485
+ // Generate one flow per compared value
486
+ const values = usage.comparedValues ?? [];
487
+ for (const value of values) {
488
+ flows.push({
489
+ id: generateFlowId(resolvedPath, value),
490
+ name: `${baseName}: ${value}`,
491
+ description: `When ${baseName.toLowerCase()} equals "${value}"`,
492
+ requiredValues: [
493
+ {
494
+ attributePath,
495
+ value: value,
496
+ comparison: 'equals',
497
+ valueType: inferValueType(value),
498
+ constraint,
499
+ },
500
+ ],
501
+ impact,
502
+ sourceLocation: usage.sourceLocation
503
+ ? {
504
+ lineNumber: usage.sourceLocation.lineNumber,
505
+ column: usage.sourceLocation.column,
506
+ }
507
+ : undefined,
508
+ codeSnippet: usage.sourceLocation?.codeSnippet,
509
+ });
510
+ }
511
+ }
512
+ return flows;
513
+ }
514
+ /**
515
+ * Generate a flow from a compound conditional (all conditions must be satisfied).
516
+ * Sets impact to 'high' if the compound conditional controls JSX rendering.
517
+ */
518
+ function generateFlowFromCompound(compound, resolvedPaths) {
519
+ // Determine impact based on whether this compound conditional controls JSX rendering
520
+ const impact = compound.controlsJsxRendering
521
+ ? 'high'
522
+ : 'medium';
523
+ const requiredValues = [];
524
+ for (const condition of compound.conditions) {
525
+ const resolvedPath = resolvedPaths.get(condition.path);
526
+ if (!resolvedPath) {
527
+ // This shouldn't happen if we pre-filtered, but safety check
528
+ return null;
529
+ }
530
+ // Determine the required value based on condition type
531
+ let value;
532
+ let comparison;
533
+ if (condition.conditionType === 'truthiness') {
534
+ // If negated (!foo), we need falsy; otherwise truthy
535
+ value = condition.isNegated ? 'falsy' : 'truthy';
536
+ comparison = condition.isNegated ? 'falsy' : 'truthy';
537
+ }
538
+ else {
539
+ // For comparison/switch, use the first compared value or required value
540
+ value =
541
+ condition.requiredValue?.toString() ??
542
+ condition.comparedValues?.[0] ??
543
+ 'truthy';
544
+ // Map comparison operator to flow comparison type
545
+ const op = condition.comparisonOperator;
546
+ if (op === '>' || op === '>=') {
547
+ comparison = 'length>';
548
+ }
549
+ else if (op === '<' || op === '<=') {
550
+ comparison = 'length<';
551
+ }
552
+ else {
553
+ comparison = 'equals';
554
+ }
555
+ }
556
+ requiredValues.push({
557
+ attributePath: stripLengthSuffix(resolvedPath),
558
+ value,
559
+ comparison,
560
+ valueType: inferValueType(value),
561
+ });
562
+ }
563
+ // Remove contradictory "falsy" values where a child path requires data
564
+ const cleanedValues = removeContradictoryFalsyValues(requiredValues);
565
+ if (cleanedValues.length === 0) {
566
+ return null;
567
+ }
568
+ // Generate a combined ID from all paths + values to distinguish different comparisons
569
+ const pathParts = cleanedValues
570
+ .map((rv) => {
571
+ const name = generateNameFromPath(rv.attributePath);
572
+ const suffix = rv.comparison === 'truthy' || rv.comparison === 'falsy'
573
+ ? `-${rv.comparison}`
574
+ : `-${rv.comparison}-${rv.value}`;
575
+ return name.toLowerCase().replace(/\s+/g, '-') + suffix;
576
+ })
577
+ .join('-and-');
578
+ return {
579
+ id: `compound-${pathParts}`,
580
+ name: cleanedValues
581
+ .map((rv) => generateNameFromPath(rv.attributePath))
582
+ .join(' + '),
583
+ description: `When ${cleanedValues.map((rv) => describeRequiredValue(rv)).join(' and ')}`,
584
+ requiredValues: cleanedValues,
585
+ impact,
586
+ sourceLocation: {
587
+ lineNumber: compound.sourceLocation.lineNumber,
588
+ column: compound.sourceLocation.column,
589
+ },
590
+ codeSnippet: compound.sourceLocation.codeSnippet,
591
+ };
592
+ }
593
+ /**
594
+ * Expand a compound conditional with OR groups into multiple condition sets.
595
+ *
596
+ * For a compound like `A && (B || C)`:
597
+ * - Conditions: [{ path: 'A' }, { path: 'B', orGroupId: 'or_xxx' }, { path: 'C', orGroupId: 'or_xxx' }]
598
+ * - Returns: [[A, B], [A, C]] - two sets of conditions
599
+ *
600
+ * For multiple OR groups like `A && (B || C) && (D || E)`:
601
+ * - Returns: [[A, B, D], [A, B, E], [A, C, D], [A, C, E]]
602
+ */
603
+ function expandOrGroups(conditions) {
604
+ // Separate conditions into mandatory (no orGroupId) and OR groups
605
+ const mandatory = conditions.filter((c) => !c.orGroupId);
606
+ const orGroups = new Map();
607
+ for (const condition of conditions) {
608
+ if (condition.orGroupId) {
609
+ const group = orGroups.get(condition.orGroupId) ?? [];
610
+ group.push(condition);
611
+ orGroups.set(condition.orGroupId, group);
612
+ }
613
+ }
614
+ // If no OR groups, return the original conditions
615
+ if (orGroups.size === 0) {
616
+ return [conditions];
617
+ }
618
+ // Generate all combinations by picking one condition from each OR group
619
+ const groupArrays = Array.from(orGroups.values());
620
+ const combinations = [];
621
+ function generateCombinations(index, current) {
622
+ if (index === groupArrays.length) {
623
+ // We've picked one from each OR group - combine with mandatory conditions
624
+ combinations.push([...mandatory, ...current]);
625
+ return;
626
+ }
627
+ // Pick each option from the current OR group
628
+ for (const option of groupArrays[index]) {
629
+ generateCombinations(index + 1, [...current, option]);
630
+ }
631
+ }
632
+ generateCombinations(0, []);
633
+ return combinations;
634
+ }
635
+ /**
636
+ * Generate execution flows from conditional usages using pure static analysis.
637
+ *
638
+ * Only generates flows where all paths resolve to controllable data sources.
639
+ * This ensures we never produce flows with invalid paths like useState variables.
640
+ */
641
+ /**
642
+ * Normalize a resolved path to a canonical form for deduplication.
643
+ * Uses fullToShortPathMap to convert full paths to short paths.
644
+ * This ensures that both "hasNewerVersion" and
645
+ * "useLoaderData<LoaderData>().functionCallReturnValue.hasNewerVersion"
646
+ * normalize to the same canonical path.
647
+ */
648
+ function normalizePathForDeduplication(resolvedPath, fullToShortPathMap) {
649
+ // If the path is in fullToShortPathMap, use the short path as canonical
650
+ if (resolvedPath in fullToShortPathMap) {
651
+ return fullToShortPathMap[resolvedPath];
652
+ }
653
+ // Otherwise, the path itself is canonical
654
+ return resolvedPath;
655
+ }
656
+ /**
657
+ * Translate a child component path to a parent path using prop mappings.
658
+ *
659
+ * Given:
660
+ * - childPath: "selectedScenario.metadata.screenshotPaths[0]" (path in child's context)
661
+ * - childEquiv: { selectedScenario: "signature[0].selectedScenario" } (child's internal-to-prop mapping)
662
+ * - parentEquiv: { "ChildName().signature[0].selectedScenario": "selectedScenario" } (parent's prop assignments)
663
+ * - childName: "ChildName"
664
+ *
665
+ * Returns: "selectedScenario.metadata.screenshotPaths[0]" (path in parent's context)
666
+ *
667
+ * The translation works by:
668
+ * 1. Finding the root variable in the child path (e.g., "selectedScenario")
669
+ * 2. Looking up the child's equivalence to find the prop path (e.g., "signature[0].selectedScenario")
670
+ * 3. Building the full child prop path (e.g., "ChildName().signature[0].selectedScenario")
671
+ * 4. Looking up the parent's equivalence to find the parent path (e.g., "selectedScenario")
672
+ * 5. Replacing the root with the parent path and preserving the suffix
673
+ */
674
+ function translateChildPathToParent(childPath, childEquivalentSignatureVariables, parentEquivalentSignatureVariables, childName) {
675
+ // Extract the root variable from the child path
676
+ // e.g., "selectedScenario.metadata.screenshotPaths[0]" → "selectedScenario"
677
+ const dotIndex = childPath.indexOf('.');
678
+ const bracketIndex = childPath.indexOf('[');
679
+ let rootVar;
680
+ let suffix;
681
+ if (dotIndex === -1 && bracketIndex === -1) {
682
+ rootVar = childPath;
683
+ suffix = '';
684
+ }
685
+ else if (dotIndex === -1) {
686
+ rootVar = childPath.slice(0, bracketIndex);
687
+ suffix = childPath.slice(bracketIndex);
688
+ }
689
+ else if (bracketIndex === -1) {
690
+ rootVar = childPath.slice(0, dotIndex);
691
+ suffix = childPath.slice(dotIndex);
692
+ }
693
+ else {
694
+ const firstIndex = Math.min(dotIndex, bracketIndex);
695
+ rootVar = childPath.slice(0, firstIndex);
696
+ suffix = childPath.slice(firstIndex);
697
+ }
698
+ // Look up the child's equivalence for this root variable
699
+ // e.g., childEquiv[selectedScenario] = "signature[0].selectedScenario"
700
+ // Handle array case (OR expressions) - use first element if array
701
+ const rawChildPropPath = childEquivalentSignatureVariables[rootVar];
702
+ const childPropPath = Array.isArray(rawChildPropPath)
703
+ ? rawChildPropPath[0]
704
+ : rawChildPropPath;
705
+ if (!childPropPath) {
706
+ // No mapping found - this might be internal state, not a prop
707
+ return null;
708
+ }
709
+ // Build the full child prop path as seen from parent
710
+ // e.g., "ChildName().signature[0].selectedScenario"
711
+ const fullChildPropPath = `${childName}().${childPropPath}`;
712
+ // Look up parent's equivalence to find what value was passed to this prop
713
+ // e.g., parentEquiv["ChildName().signature[0].selectedScenario"] = "selectedScenario"
714
+ // Handle array case (OR expressions) - use first element if array
715
+ const rawParentValue = parentEquivalentSignatureVariables[fullChildPropPath];
716
+ const parentValue = Array.isArray(rawParentValue)
717
+ ? rawParentValue[0]
718
+ : rawParentValue;
719
+ if (!parentValue) {
720
+ // No parent mapping found - log ALL parent keys that contain the childName
721
+ const relevantParentKeys = Object.keys(parentEquivalentSignatureVariables).filter((k) => k.includes(childName));
722
+ return null;
723
+ }
724
+ // Build the translated path: parentValue + suffix
725
+ // e.g., "selectedScenario" + ".metadata.screenshotPaths[0]"
726
+ const result = parentValue + suffix;
727
+ return result;
728
+ }
729
+ export default function generateExecutionFlowsFromConditionals(args) {
730
+ const { conditionalUsages, compoundConditionals, attributesMap, equivalentSignatureVariables, fullToShortPathMap, childComponentData, derivedVariables, sourceEquivalencies, } = args;
731
+ const flows = [];
732
+ const seenFlowIds = new Set();
733
+ console.log(`[genFlowsFromConditionals] INPUT: ${Object.keys(conditionalUsages).length} conditional paths, ${Object.keys(attributesMap).length} attributesMap entries, ${Object.keys(fullToShortPathMap).length} fullToShortPathMap entries, ${Object.keys(equivalentSignatureVariables).length} equivSigVars, ${compoundConditionals.length} compound conditionals`);
734
+ console.log(`[genFlowsFromConditionals] conditionalUsages keys: [${Object.keys(conditionalUsages).join(', ')}]`);
735
+ console.log(`[genFlowsFromConditionals] attributesMap keys: [${Object.keys(attributesMap).join(', ')}]`);
736
+ console.log(`[genFlowsFromConditionals] fullToShortPathMap: ${JSON.stringify(fullToShortPathMap)}`);
737
+ console.log(`[genFlowsFromConditionals] equivalentSignatureVariables: ${JSON.stringify(equivalentSignatureVariables)}`);
738
+ // Track normalized resolved paths to prevent duplicate flows
739
+ // This handles the case where we have usages for both:
740
+ // - "hasNewerVersion" (short path from destructured variable)
741
+ // - "useLoaderData<LoaderData>().functionCallReturnValue.hasNewerVersion" (full path)
742
+ // Both resolve to the same logical data source, so we only want ONE set of flows.
743
+ const seenNormalizedPaths = new Set();
744
+ // Track which usages are part of compound conditionals (to avoid duplicates)
745
+ const compoundChainIds = new Set(compoundConditionals.map((c) => c.chainId).filter(Boolean));
746
+ // Process individual conditional usages
747
+ for (const [_path, usages] of Object.entries(conditionalUsages)) {
748
+ for (const usage of usages) {
749
+ // Skip usages that are part of compound conditionals (handled separately)
750
+ if (usage.chainId && compoundChainIds.has(usage.chainId)) {
751
+ console.log(`[genFlowsFromConditionals] "${usage.path}" SKIP: part of compound conditional chain=${usage.chainId}`);
752
+ continue;
753
+ }
754
+ console.log(`[genFlowsFromConditionals] --- Processing "${usage.path}" (type=${usage.conditionType}, negated=${usage.isNegated}, sourceDataPath="${usage.sourceDataPath ?? '(none)'}", derivedFrom=${usage.derivedFrom ? JSON.stringify(usage.derivedFrom) : 'none'})`);
755
+ // First, try to use pre-computed sourceDataPath if available
756
+ let resolvedPath = null;
757
+ if (usage.sourceDataPath) {
758
+ // Clean up the sourceDataPath - it may have redundant scope prefixes
759
+ // e.g., "useLoaderData<LoaderData>.useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
760
+ // should become "useLoaderData<LoaderData>().functionCallReturnValue.entity.sha"
761
+ // Returns null for malformed paths (e.g., chained function calls like fetch().json())
762
+ const cleanedPath = cleanSourceDataPath(usage.sourceDataPath);
763
+ console.log(`[genFlowsFromConditionals] "${usage.path}" cleanSourceDataPath("${usage.sourceDataPath}") → "${cleanedPath}"`);
764
+ if (cleanedPath) {
765
+ // Verify the cleaned path exists in attributesMap
766
+ const pathMatch = findInAttributesMapForPath(cleanedPath, attributesMap, fullToShortPathMap);
767
+ console.log(`[genFlowsFromConditionals] "${usage.path}" findInAttributesMapForPath("${cleanedPath}") → ${pathMatch ? `"${pathMatch}"` : 'null (not found)'}`);
768
+ if (pathMatch) {
769
+ resolvedPath = pathMatch;
770
+ }
771
+ }
772
+ // If cleanedPath is null, fall through to use fallback resolution
773
+ }
774
+ // Fall back to resolution via equivalentSignatureVariables
775
+ if (!resolvedPath) {
776
+ console.log(`[genFlowsFromConditionals] "${usage.path}" sourceDataPath resolution failed, trying resolvePathToControllable("${usage.path}")...`);
777
+ const resolution = resolvePathToControllable(usage.path, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
778
+ console.log(`[genFlowsFromConditionals] "${usage.path}" resolvePathToControllable → isControllable=${resolution.isControllable}, resolvedPath="${resolution.resolvedPath ?? '(none)'}"`);
779
+ if (resolution.isControllable && resolution.resolvedPath) {
780
+ resolvedPath = resolution.resolvedPath;
781
+ }
782
+ }
783
+ // If still not resolved, try using derivedFrom info to find the source path
784
+ // This handles cases like: const hasAnalysis = analysis !== null
785
+ // where hasAnalysis is not in attributesMap but analysis is
786
+ if (!resolvedPath && usage.derivedFrom) {
787
+ const { operation, sourcePath, sourcePaths, comparedValue } = usage.derivedFrom;
788
+ console.log(`[genFlowsFromConditionals] "${usage.path}" trying derivedFrom: operation=${operation}, sourcePath="${sourcePath ?? '(none)'}", sourcePaths=${sourcePaths ? JSON.stringify(sourcePaths) : '(none)'}, comparedValue="${comparedValue ?? '(none)'}"`);
789
+ // For single-source derivations (notNull, equals, etc.)
790
+ if (sourcePath) {
791
+ const resolution = resolvePathToControllable(sourcePath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
792
+ if (resolution.isControllable && resolution.resolvedPath) {
793
+ resolvedPath = resolution.resolvedPath;
794
+ }
795
+ }
796
+ // For equals/notEquals derivations with comparedValue, generate comparison flows
797
+ // e.g., canEdit derived from user.role === 'admin'
798
+ // When canEdit is used in truthiness check, we need:
799
+ // - Truthy flow: user.role = 'admin' (comparison: 'equals')
800
+ // - Falsy flow: user.role != 'admin' (comparison: 'notEquals')
801
+ if ((operation === 'equals' || operation === 'notEquals') &&
802
+ comparedValue !== undefined &&
803
+ resolvedPath &&
804
+ usage.conditionType === 'truthiness') {
805
+ const baseName = generateNameFromPath(usage.path);
806
+ const impact = usage.controlsJsxRendering
807
+ ? 'high'
808
+ : 'medium';
809
+ const isNegated = usage.isNegated ?? false;
810
+ // For equals derivation:
811
+ // - Truthy check (!negated): needs value = comparedValue (equals)
812
+ // - Falsy check (negated): needs value != comparedValue (notEquals)
813
+ // For notEquals derivation: inverse of above
814
+ const isEqualsDerivation = operation === 'equals';
815
+ const truthyNeedsEquals = isEqualsDerivation !== isNegated;
816
+ // Generate truthy flow
817
+ const truthyFlow = {
818
+ id: generateFlowId(usage.path, 'truthy'),
819
+ name: `${baseName} True`,
820
+ description: `When ${baseName.toLowerCase()} is truthy (${resolvedPath} ${truthyNeedsEquals ? '=' : '!='} ${comparedValue})`,
821
+ requiredValues: [
822
+ {
823
+ attributePath: stripLengthSuffix(resolvedPath),
824
+ value: comparedValue,
825
+ comparison: truthyNeedsEquals ? 'equals' : 'notEquals',
826
+ valueType: inferValueType(comparedValue),
827
+ },
828
+ ],
829
+ impact,
830
+ sourceLocation: usage.sourceLocation
831
+ ? {
832
+ lineNumber: usage.sourceLocation.lineNumber,
833
+ column: usage.sourceLocation.column,
834
+ }
835
+ : undefined,
836
+ codeSnippet: usage.sourceLocation?.codeSnippet,
837
+ };
838
+ // Generate falsy flow
839
+ const falsyFlow = {
840
+ id: generateFlowId(usage.path, 'falsy'),
841
+ name: `${baseName} False`,
842
+ description: `When ${baseName.toLowerCase()} is falsy (${resolvedPath} ${truthyNeedsEquals ? '!=' : '='} ${comparedValue})`,
843
+ requiredValues: [
844
+ {
845
+ attributePath: stripLengthSuffix(resolvedPath),
846
+ value: comparedValue,
847
+ comparison: truthyNeedsEquals ? 'notEquals' : 'equals',
848
+ valueType: inferValueType(comparedValue),
849
+ },
850
+ ],
851
+ impact,
852
+ sourceLocation: usage.sourceLocation
853
+ ? {
854
+ lineNumber: usage.sourceLocation.lineNumber,
855
+ column: usage.sourceLocation.column,
856
+ }
857
+ : undefined,
858
+ codeSnippet: usage.sourceLocation?.codeSnippet,
859
+ };
860
+ // Add flows and skip normal flow generation
861
+ if (!seenFlowIds.has(truthyFlow.id)) {
862
+ seenFlowIds.add(truthyFlow.id);
863
+ flows.push(truthyFlow);
864
+ }
865
+ if (!seenFlowIds.has(falsyFlow.id)) {
866
+ seenFlowIds.add(falsyFlow.id);
867
+ flows.push(falsyFlow);
868
+ }
869
+ continue;
870
+ }
871
+ // For OR derivations with negation, we need ALL sources to be falsy
872
+ // e.g., !isBusy where isBusy = isRunning || isQueued || isPending
873
+ // For the falsy flow, ALL sources must be falsy
874
+ if (operation === 'or' &&
875
+ usage.conditionType === 'truthiness' &&
876
+ usage.isNegated === true &&
877
+ sourcePaths &&
878
+ sourcePaths.length > 0) {
879
+ // Use expandDerivedVariableToSources to recursively resolve all sources
880
+ const allSources = expandDerivedVariableToSources(usage.path, conditionalUsages, attributesMap, equivalentSignatureVariables, fullToShortPathMap, new Set(), derivedVariables);
881
+ if (allSources.length > 0) {
882
+ // Generate a compound-style flow with all sources set to falsy
883
+ const baseName = generateNameFromPath(usage.path);
884
+ const impact = usage.controlsJsxRendering
885
+ ? 'high'
886
+ : 'medium';
887
+ const requiredValues = allSources.map((source) => ({
888
+ attributePath: source.path,
889
+ value: 'falsy',
890
+ comparison: 'falsy',
891
+ valueType: 'boolean',
892
+ }));
893
+ // Create a single falsy flow with all sources
894
+ const falsyFlow = {
895
+ id: generateFlowId(usage.path, 'falsy'),
896
+ name: `${baseName} False`,
897
+ description: `When ${baseName.toLowerCase()} is falsy (all sources are falsy)`,
898
+ requiredValues,
899
+ impact,
900
+ sourceLocation: usage.sourceLocation
901
+ ? {
902
+ lineNumber: usage.sourceLocation.lineNumber,
903
+ column: usage.sourceLocation.column,
904
+ }
905
+ : undefined,
906
+ codeSnippet: usage.sourceLocation?.codeSnippet,
907
+ };
908
+ // Create a truthy flow - for OR, ANY source being truthy is sufficient
909
+ // We use the first resolvable source for the truthy flow
910
+ const firstSource = allSources[0];
911
+ const truthyFlow = {
912
+ id: generateFlowId(usage.path, 'truthy'),
913
+ name: `${baseName} True`,
914
+ description: `When ${baseName.toLowerCase()} is truthy`,
915
+ requiredValues: [
916
+ {
917
+ attributePath: firstSource.path,
918
+ value: 'truthy',
919
+ comparison: 'truthy',
920
+ valueType: 'boolean',
921
+ },
922
+ ],
923
+ impact,
924
+ sourceLocation: usage.sourceLocation
925
+ ? {
926
+ lineNumber: usage.sourceLocation.lineNumber,
927
+ column: usage.sourceLocation.column,
928
+ }
929
+ : undefined,
930
+ codeSnippet: usage.sourceLocation?.codeSnippet,
931
+ };
932
+ // Add both flows (falsy needs all sources, truthy needs one)
933
+ if (!seenFlowIds.has(falsyFlow.id)) {
934
+ seenFlowIds.add(falsyFlow.id);
935
+ flows.push(falsyFlow);
936
+ }
937
+ if (!seenFlowIds.has(truthyFlow.id)) {
938
+ seenFlowIds.add(truthyFlow.id);
939
+ flows.push(truthyFlow);
940
+ }
941
+ // Skip the normal flow generation for this usage
942
+ continue;
943
+ }
944
+ }
945
+ // For AND derivations without negation, we need ALL sources to be truthy
946
+ // e.g., isReady where isReady = hasData && isLoaded && isValid
947
+ // For the truthy flow, ALL sources must be truthy
948
+ // For negated AND (!isReady), ANY source being falsy is sufficient (fallback behavior)
949
+ if (operation === 'and' &&
950
+ usage.conditionType === 'truthiness' &&
951
+ usage.isNegated !== true &&
952
+ sourcePaths &&
953
+ sourcePaths.length > 0) {
954
+ // Use expandDerivedVariableToSources to recursively resolve all sources
955
+ const allSources = expandDerivedVariableToSources(usage.path, conditionalUsages, attributesMap, equivalentSignatureVariables, fullToShortPathMap, new Set(), derivedVariables);
956
+ if (allSources.length > 0) {
957
+ // Generate a compound-style flow with all sources set to truthy
958
+ const baseName = generateNameFromPath(usage.path);
959
+ const impact = usage.controlsJsxRendering
960
+ ? 'high'
961
+ : 'medium';
962
+ const requiredValues = allSources.map((source) => ({
963
+ attributePath: source.path,
964
+ value: 'truthy',
965
+ comparison: 'truthy',
966
+ valueType: 'boolean',
967
+ }));
968
+ // Create a truthy flow with all sources
969
+ const truthyFlow = {
970
+ id: generateFlowId(usage.path, 'truthy'),
971
+ name: `${baseName} True`,
972
+ description: `When ${baseName.toLowerCase()} is truthy (all sources are truthy)`,
973
+ requiredValues,
974
+ impact,
975
+ sourceLocation: usage.sourceLocation
976
+ ? {
977
+ lineNumber: usage.sourceLocation.lineNumber,
978
+ column: usage.sourceLocation.column,
979
+ }
980
+ : undefined,
981
+ codeSnippet: usage.sourceLocation?.codeSnippet,
982
+ };
983
+ // Create a falsy flow - for AND, ANY source being falsy is sufficient
984
+ // We use the first resolvable source for the falsy flow
985
+ const firstSource = allSources[0];
986
+ const falsyFlow = {
987
+ id: generateFlowId(usage.path, 'falsy'),
988
+ name: `${baseName} False`,
989
+ description: `When ${baseName.toLowerCase()} is falsy`,
990
+ requiredValues: [
991
+ {
992
+ attributePath: firstSource.path,
993
+ value: 'falsy',
994
+ comparison: 'falsy',
995
+ valueType: 'boolean',
996
+ },
997
+ ],
998
+ impact,
999
+ sourceLocation: usage.sourceLocation
1000
+ ? {
1001
+ lineNumber: usage.sourceLocation.lineNumber,
1002
+ column: usage.sourceLocation.column,
1003
+ }
1004
+ : undefined,
1005
+ codeSnippet: usage.sourceLocation?.codeSnippet,
1006
+ };
1007
+ // Add both flows (truthy needs all sources, falsy needs one)
1008
+ if (!seenFlowIds.has(truthyFlow.id)) {
1009
+ seenFlowIds.add(truthyFlow.id);
1010
+ flows.push(truthyFlow);
1011
+ }
1012
+ if (!seenFlowIds.has(falsyFlow.id)) {
1013
+ seenFlowIds.add(falsyFlow.id);
1014
+ flows.push(falsyFlow);
1015
+ }
1016
+ // Skip the normal flow generation for this usage
1017
+ continue;
1018
+ }
1019
+ }
1020
+ // For multi-source derivations (or, and) without special handling,
1021
+ // try the first resolvable path as a fallback
1022
+ if (!resolvedPath && sourcePaths && sourcePaths.length > 0) {
1023
+ for (const sp of sourcePaths) {
1024
+ const resolution = resolvePathToControllable(sp, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1025
+ if (resolution.isControllable && resolution.resolvedPath) {
1026
+ resolvedPath = resolution.resolvedPath;
1027
+ break;
1028
+ }
1029
+ }
1030
+ }
1031
+ }
1032
+ if (!resolvedPath) {
1033
+ // Path is not controllable - skip (no invalid flows possible)
1034
+ console.log(`[genFlowsFromConditionals] "${usage.path}" SKIP: not controllable (no resolvedPath after all attempts)`);
1035
+ continue;
1036
+ }
1037
+ // Normalize the resolved path to detect duplicates
1038
+ // E.g., both "hasNewerVersion" and "useLoaderData<...>().hasNewerVersion"
1039
+ // should normalize to the same canonical path
1040
+ const normalizedPath = normalizePathForDeduplication(resolvedPath, fullToShortPathMap);
1041
+ // Skip if we've already generated flows for this normalized path
1042
+ // This prevents duplicate flows when we have usages for both short and full paths
1043
+ if (seenNormalizedPaths.has(normalizedPath)) {
1044
+ console.log(`[genFlowsFromConditionals] "${usage.path}" SKIP: duplicate normalizedPath="${normalizedPath}" (resolvedPath="${resolvedPath}")`);
1045
+ continue;
1046
+ }
1047
+ seenNormalizedPaths.add(normalizedPath);
1048
+ // Skip individual truthy/falsy flows on parent paths that have child data entries.
1049
+ // Lifecycle booleans (like isLoadingAuditData) traced to fetch(...).functionCallReturnValue
1050
+ // produce misleading truthy/falsy flows: "truthy" can't show loading (mock resolves instantly),
1051
+ // "falsy" tells the LLM to return null (breaking .json()). Compound flows with specific child
1052
+ // data requirements provide the correct mock guidance.
1053
+ if (usage.conditionType === 'truthiness' &&
1054
+ resolvedPath &&
1055
+ hasChildPathsInMap(resolvedPath, fullToShortPathMap)) {
1056
+ console.log(`[genFlowsFromConditionals] "${usage.path}" SKIP: parent path "${resolvedPath}" has child data paths — compound flows will handle this`);
1057
+ continue;
1058
+ }
1059
+ console.log(`[genFlowsFromConditionals] "${usage.path}" RESOLVED → resolvedPath="${resolvedPath}", normalizedPath="${normalizedPath}" — generating flows`);
1060
+ // Generate flows for this controllable usage
1061
+ const usageFlows = generateFlowsFromUsage(usage, resolvedPath);
1062
+ for (const flow of usageFlows) {
1063
+ // Deduplicate by flow ID
1064
+ if (!seenFlowIds.has(flow.id)) {
1065
+ seenFlowIds.add(flow.id);
1066
+ flows.push(flow);
1067
+ console.log(`[genFlowsFromConditionals] "${usage.path}" FLOW ADDED: id="${flow.id}", requiredValues=${JSON.stringify(flow.requiredValues.map((rv) => ({ attr: rv.attributePath, val: rv.value })))}`);
1068
+ }
1069
+ }
1070
+ }
1071
+ }
1072
+ // Process compound conditionals
1073
+ for (const compound of compoundConditionals) {
1074
+ // Expand OR groups into separate condition sets
1075
+ // For example, `A && (B || C)` becomes [[A, B], [A, C]]
1076
+ const expandedConditionSets = expandOrGroups(compound.conditions);
1077
+ // Process each expanded condition set as a separate potential flow
1078
+ for (const conditionSet of expandedConditionSets) {
1079
+ // First, check if ALL paths in this condition set are controllable (or can be expanded to controllable sources)
1080
+ const resolvedPaths = new Map();
1081
+ // Track expanded sources for derived variables (path -> array of expanded sources)
1082
+ const expandedSources = new Map();
1083
+ let allControllable = true;
1084
+ for (const condition of conditionSet) {
1085
+ // Check if this condition path has derivation info
1086
+ // First check conditionalUsages, then fall back to derivedVariables
1087
+ const usagesForPath = conditionalUsages[condition.path];
1088
+ let derivedFromInfo = usagesForPath?.find((u) => u.derivedFrom?.operation)?.derivedFrom;
1089
+ // CRITICAL: Also check derivedVariables for intermediate derived variables
1090
+ if (!derivedFromInfo && derivedVariables?.[condition.path]) {
1091
+ derivedFromInfo = derivedVariables[condition.path];
1092
+ }
1093
+ if (derivedFromInfo) {
1094
+ // This is a derived variable - expand to its sources
1095
+ const sources = expandDerivedVariableToSources(condition.path, conditionalUsages, attributesMap, equivalentSignatureVariables, fullToShortPathMap, new Set(), derivedVariables);
1096
+ if (sources.length > 0) {
1097
+ // Store the expanded sources for this condition
1098
+ expandedSources.set(condition.path, sources);
1099
+ // Use the first source's path for the resolvedPaths map (for ID generation)
1100
+ resolvedPaths.set(condition.path, sources[0].path);
1101
+ }
1102
+ else {
1103
+ // Derived variable expansion failed — try sourceDataPath fallback
1104
+ // This handles cases where the derivation chain goes through useMemo/useState
1105
+ // but the enriched sourceDataPath already traced to the actual data source
1106
+ const usageWithSource = usagesForPath?.find((u) => u.sourceDataPath);
1107
+ let derivedFallbackPath = null;
1108
+ if (usageWithSource?.sourceDataPath) {
1109
+ const cleanedPath = cleanSourceDataPath(usageWithSource.sourceDataPath);
1110
+ if (cleanedPath) {
1111
+ const pathMatch = findInAttributesMapForPath(cleanedPath, attributesMap, fullToShortPathMap);
1112
+ if (pathMatch) {
1113
+ derivedFallbackPath = pathMatch;
1114
+ }
1115
+ }
1116
+ }
1117
+ if (derivedFallbackPath) {
1118
+ resolvedPaths.set(condition.path, derivedFallbackPath);
1119
+ console.log(`[genFlowsFromConditionals] COMPOUND "${condition.path}" derived expansion failed but sourceDataPath fallback resolved → "${derivedFallbackPath}"`);
1120
+ }
1121
+ else {
1122
+ // Truly not controllable
1123
+ console.log(`[genFlowsFromConditionals] COMPOUND "${condition.path}" derived but no controllable sources and no sourceDataPath fallback → NOT controllable`);
1124
+ allControllable = false;
1125
+ break;
1126
+ }
1127
+ }
1128
+ }
1129
+ else {
1130
+ // Not a derived variable - resolve directly
1131
+ // First try sourceDataPath from the usage (same as individual processing)
1132
+ let compoundResolvedPath = null;
1133
+ const usageWithSource = usagesForPath?.find((u) => u.sourceDataPath);
1134
+ if (usageWithSource?.sourceDataPath) {
1135
+ const cleanedPath = cleanSourceDataPath(usageWithSource.sourceDataPath);
1136
+ if (cleanedPath) {
1137
+ const pathMatch = findInAttributesMapForPath(cleanedPath, attributesMap, fullToShortPathMap);
1138
+ if (pathMatch) {
1139
+ compoundResolvedPath = pathMatch;
1140
+ }
1141
+ }
1142
+ }
1143
+ if (!compoundResolvedPath) {
1144
+ const resolution = resolvePathToControllable(condition.path, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1145
+ if (resolution.isControllable && resolution.resolvedPath) {
1146
+ compoundResolvedPath = resolution.resolvedPath;
1147
+ }
1148
+ }
1149
+ if (!compoundResolvedPath) {
1150
+ allControllable = false;
1151
+ break;
1152
+ }
1153
+ resolvedPaths.set(condition.path, compoundResolvedPath);
1154
+ }
1155
+ }
1156
+ // Only create a flow if ALL paths are controllable
1157
+ if (allControllable && resolvedPaths.size > 0) {
1158
+ // If any conditions were expanded from derived variables, we need to build a custom flow
1159
+ if (expandedSources.size > 0) {
1160
+ const requiredValues = [];
1161
+ for (const condition of conditionSet) {
1162
+ const sources = expandedSources.get(condition.path);
1163
+ if (sources) {
1164
+ // This condition was expanded - add all its sources
1165
+ // Determine the required value based on condition type and derivation operation
1166
+ const usagesForPath = conditionalUsages[condition.path];
1167
+ let expandedDerivedFrom = usagesForPath?.find((u) => u.derivedFrom?.operation)?.derivedFrom;
1168
+ // Also check derivedVariables for intermediate derived variables
1169
+ if (!expandedDerivedFrom && derivedVariables?.[condition.path]) {
1170
+ expandedDerivedFrom = derivedVariables[condition.path];
1171
+ }
1172
+ const operation = expandedDerivedFrom?.operation;
1173
+ for (const source of sources) {
1174
+ // For OR-derived truthy: ANY source truthy
1175
+ // For AND-derived truthy: ALL sources truthy
1176
+ // For negated: inverse
1177
+ let value;
1178
+ let comparison;
1179
+ if (condition.conditionType === 'truthiness') {
1180
+ const isNegated = condition.isNegated === true;
1181
+ // For OR: truthy needs ANY source truthy, falsy needs ALL sources falsy
1182
+ // For AND: truthy needs ALL sources truthy, falsy needs ANY source falsy
1183
+ // In compound conditionals, we generate the truthy path by default
1184
+ // (the compound expression must be truthy)
1185
+ if (operation === 'or') {
1186
+ // For OR-derived, truthy means we need at least one source truthy
1187
+ // We'll use the first source as truthy (simplification)
1188
+ value = isNegated ? 'falsy' : 'truthy';
1189
+ }
1190
+ else if (operation === 'and') {
1191
+ // For AND-derived, truthy means ALL sources truthy
1192
+ value = isNegated ? 'falsy' : 'truthy';
1193
+ }
1194
+ else {
1195
+ value = isNegated ? 'falsy' : 'truthy';
1196
+ }
1197
+ comparison = isNegated ? 'falsy' : 'truthy';
1198
+ }
1199
+ else {
1200
+ value = 'truthy';
1201
+ comparison = 'truthy';
1202
+ }
1203
+ requiredValues.push({
1204
+ attributePath: source.path,
1205
+ value,
1206
+ comparison,
1207
+ valueType: 'boolean',
1208
+ });
1209
+ }
1210
+ }
1211
+ else {
1212
+ // This condition was resolved directly
1213
+ const resolvedPath = resolvedPaths.get(condition.path);
1214
+ if (resolvedPath) {
1215
+ let value;
1216
+ let comparison;
1217
+ if (condition.conditionType === 'truthiness') {
1218
+ value = condition.isNegated ? 'falsy' : 'truthy';
1219
+ comparison = condition.isNegated ? 'falsy' : 'truthy';
1220
+ }
1221
+ else {
1222
+ value =
1223
+ condition.requiredValue?.toString() ??
1224
+ condition.comparedValues?.[0] ??
1225
+ 'truthy';
1226
+ const op = condition.comparisonOperator;
1227
+ if (op === '>' || op === '>=') {
1228
+ comparison = 'length>';
1229
+ }
1230
+ else if (op === '<' || op === '<=') {
1231
+ comparison = 'length<';
1232
+ }
1233
+ else {
1234
+ comparison = 'equals';
1235
+ }
1236
+ }
1237
+ requiredValues.push({
1238
+ attributePath: stripLengthSuffix(resolvedPath),
1239
+ value,
1240
+ comparison,
1241
+ valueType: inferValueType(value),
1242
+ });
1243
+ }
1244
+ }
1245
+ }
1246
+ // Remove contradictory "falsy" values where a child path requires data
1247
+ const cleanedValues = removeContradictoryFalsyValues(requiredValues);
1248
+ if (cleanedValues.length > 0) {
1249
+ const impact = compound.controlsJsxRendering ? 'high' : 'medium';
1250
+ // Generate a combined ID from all paths + values
1251
+ const pathParts = cleanedValues
1252
+ .map((rv) => {
1253
+ const name = generateNameFromPath(rv.attributePath);
1254
+ const suffix = rv.comparison === 'truthy' || rv.comparison === 'falsy'
1255
+ ? `-${rv.comparison}`
1256
+ : `-${rv.comparison}-${rv.value}`;
1257
+ return name.toLowerCase().replace(/\s+/g, '-') + suffix;
1258
+ })
1259
+ .join('-and-');
1260
+ const compoundFlow = {
1261
+ id: `${pathParts}`,
1262
+ name: generateNameFromPath(cleanedValues[0].attributePath),
1263
+ description: `When ${cleanedValues.map((rv) => describeRequiredValue(rv)).join(' and ')}`,
1264
+ impact,
1265
+ requiredValues: cleanedValues,
1266
+ sourceLocation: compound.sourceLocation,
1267
+ };
1268
+ if (!seenFlowIds.has(compoundFlow.id)) {
1269
+ seenFlowIds.add(compoundFlow.id);
1270
+ flows.push(compoundFlow);
1271
+ }
1272
+ }
1273
+ }
1274
+ else {
1275
+ // No derived variables - use the original generateFlowFromCompound
1276
+ // Create a modified compound with just this condition set
1277
+ const modifiedCompound = {
1278
+ ...compound,
1279
+ conditions: conditionSet,
1280
+ };
1281
+ const compoundFlow = generateFlowFromCompound(modifiedCompound, resolvedPaths);
1282
+ if (compoundFlow && !seenFlowIds.has(compoundFlow.id)) {
1283
+ seenFlowIds.add(compoundFlow.id);
1284
+ flows.push(compoundFlow);
1285
+ }
1286
+ }
1287
+ }
1288
+ }
1289
+ }
1290
+ // Process child component conditional usages
1291
+ // Translate child paths to parent paths and merge flows
1292
+ if (childComponentData) {
1293
+ for (const [childName, childData] of Object.entries(childComponentData)) {
1294
+ // First, resolve gating conditions to get required values that must be added to all child flows
1295
+ const gatingRequiredValues = [];
1296
+ if (childData.gatingConditions) {
1297
+ for (const gatingCondition of childData.gatingConditions) {
1298
+ // Try to resolve via derivedFrom first
1299
+ let gatingPath = gatingCondition.path;
1300
+ if (gatingCondition.derivedFrom?.sourcePath) {
1301
+ gatingPath = gatingCondition.derivedFrom.sourcePath;
1302
+ }
1303
+ // Fix 32: Handle comparison expressions like "activeTab === 'scenarios'"
1304
+ // Extract the variable name and the compared value
1305
+ const comparisonMatch = gatingPath.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*(===?|!==?)\s*['"]?([^'"]+)['"]?$/);
1306
+ if (comparisonMatch) {
1307
+ const [, varName, operator, comparedValue] = comparisonMatch;
1308
+ // Try to resolve the variable name
1309
+ const varResolution = resolvePathToControllable(varName, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1310
+ // Only use controllable paths for gating conditions (whitelist approach).
1311
+ // Do NOT fall back to equivalentSignatureVariables because those may contain
1312
+ // uncontrollable paths like useState that cannot be mocked.
1313
+ let resolvedVarPath = null;
1314
+ if (varResolution.isControllable && varResolution.resolvedPath) {
1315
+ resolvedVarPath = varResolution.resolvedPath;
1316
+ }
1317
+ // Note: We intentionally do NOT fall back to equivalentSignatureVariables here
1318
+ // because that would allow uncontrollable paths (like useState) to be added
1319
+ // as gating conditions.
1320
+ if (resolvedVarPath) {
1321
+ const isNegated = gatingCondition.isNegated === true;
1322
+ const isNotEquals = operator === '!=' || operator === '!==';
1323
+ // Determine the effective value for this gating condition
1324
+ // If condition is "activeTab === 'scenarios'" and NOT negated, flow needs activeTab = 'scenarios'
1325
+ // If condition is "activeTab === 'scenarios'" and IS negated, flow needs activeTab != 'scenarios' (falsy/other value)
1326
+ // If condition is "activeTab !== 'scenarios'" and NOT negated, flow needs activeTab != 'scenarios'
1327
+ // XOR logic: isNegated XOR isNotEquals
1328
+ const needsExactValue = isNegated !== isNotEquals;
1329
+ gatingRequiredValues.push({
1330
+ attributePath: resolvedVarPath,
1331
+ value: needsExactValue ? 'falsy' : comparedValue,
1332
+ comparison: needsExactValue ? 'falsy' : 'equals',
1333
+ });
1334
+ continue; // Skip to next gating condition
1335
+ }
1336
+ }
1337
+ // Fix 31: Handle compound gating conditions (containing && or ||)
1338
+ // e.g., "isEditMode && selectedScenario" should be parsed into individual paths
1339
+ const isAndExpression = gatingPath.includes(' && ');
1340
+ const isOrExpression = gatingPath.includes(' || ');
1341
+ const isCompoundExpression = isAndExpression || isOrExpression;
1342
+ if (isCompoundExpression) {
1343
+ // Parse the compound expression into individual variable names
1344
+ // Split on && and || (with optional spaces)
1345
+ const parts = gatingPath.split(/\s*(?:&&|\|\|)\s*/);
1346
+ const isNegated = gatingCondition.isNegated === true;
1347
+ // Fix 37: Apply DeMorgan's law correctly for compound conditions
1348
+ // - !(A && B) = !A || !B: EITHER A is false OR B is false (can't know which)
1349
+ // - !(A || B) = !A && !B: BOTH must be false
1350
+ // - (A && B): BOTH must be true
1351
+ // - (A || B): EITHER is true (can't know which)
1352
+ //
1353
+ // We should only add gating requirements when we can definitively say
1354
+ // all parts must have the same value. This is true for:
1355
+ // - Non-negated &&: all parts must be truthy
1356
+ // - Negated ||: all parts must be falsy (DeMorgan: !(A || B) = !A && !B)
1357
+ //
1358
+ // We should NOT add gating requirements when either part could be true/false:
1359
+ // - Negated && (DeMorgan: !(A && B) = !A || !B): can't constrain both to falsy
1360
+ // - Non-negated ||: can't constrain both to truthy
1361
+ const shouldSkipGating = (isAndExpression && isNegated) || // !(A && B) - either could be falsy
1362
+ (isOrExpression && !isNegated); // (A || B) - either could be truthy
1363
+ if (shouldSkipGating) {
1364
+ // Don't add gating requirements for this compound condition
1365
+ // The child flow's own requirements will determine what values are needed
1366
+ }
1367
+ else {
1368
+ for (const part of parts) {
1369
+ // Clean up the part (remove parentheses, negation, etc.)
1370
+ const cleanPart = part
1371
+ .replace(/^\(+|\)+$/g, '') // Remove leading/trailing parens
1372
+ .replace(/^!+/, '') // Remove leading negation
1373
+ .trim();
1374
+ if (!cleanPart)
1375
+ continue;
1376
+ // Try to resolve this individual path
1377
+ const partResolution = resolvePathToControllable(cleanPart, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1378
+ if (partResolution.isControllable &&
1379
+ partResolution.resolvedPath) {
1380
+ // For non-negated &&: all parts must be truthy
1381
+ // For negated ||: all parts must be falsy (DeMorgan: !(A || B) = !A && !B)
1382
+ gatingRequiredValues.push({
1383
+ attributePath: stripLengthSuffix(partResolution.resolvedPath),
1384
+ value: isNegated ? 'falsy' : 'truthy',
1385
+ comparison: isNegated ? 'falsy' : 'truthy',
1386
+ });
1387
+ }
1388
+ }
1389
+ }
1390
+ }
1391
+ else {
1392
+ // Simple gating condition (single path)
1393
+ // Resolve the gating path in parent context
1394
+ const gatingResolution = resolvePathToControllable(gatingPath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1395
+ // Only use controllable paths for gating conditions (whitelist approach).
1396
+ // Do NOT fall back to equivalentSignatureVariables because those may contain
1397
+ // uncontrollable paths like useState that cannot be mocked.
1398
+ let resolvedGatingPath = null;
1399
+ if (gatingResolution.isControllable &&
1400
+ gatingResolution.resolvedPath) {
1401
+ resolvedGatingPath = gatingResolution.resolvedPath;
1402
+ }
1403
+ // Note: We intentionally do NOT fall back to equivalentSignatureVariables here
1404
+ // because that would allow uncontrollable paths (like useState) to be added
1405
+ // as gating conditions.
1406
+ if (resolvedGatingPath) {
1407
+ // For truthiness conditions on gating, check if the condition is negated
1408
+ // e.g., ternary else branch: isError ? <ErrorView /> : <SuccessView />
1409
+ // SuccessView has isNegated: true, meaning it renders when isError is falsy
1410
+ const isNegated = gatingCondition.isNegated === true;
1411
+ gatingRequiredValues.push({
1412
+ attributePath: resolvedGatingPath,
1413
+ value: isNegated ? 'falsy' : 'truthy',
1414
+ comparison: isNegated ? 'falsy' : 'truthy',
1415
+ });
1416
+ }
1417
+ }
1418
+ }
1419
+ }
1420
+ // Track which child usages are part of compound conditionals (to avoid duplicates)
1421
+ // Fix 33: Only skip usages that are part of compound conditionals, not all usages with chainIds
1422
+ const childCompoundChainIds = new Set(childData.compoundConditionals.map((c) => c.chainId).filter(Boolean));
1423
+ for (const [_path, usages] of Object.entries(childData.conditionalUsages)) {
1424
+ for (const usage of usages) {
1425
+ // Skip usages that are part of compound conditionals (handled separately)
1426
+ // Fix 33: Only skip if the chainId is in the child's compound conditionals
1427
+ if (usage.chainId && childCompoundChainIds.has(usage.chainId)) {
1428
+ continue;
1429
+ }
1430
+ // Determine the child path to translate
1431
+ let childPath = usage.path;
1432
+ // If the usage has derivedFrom, use the source path instead
1433
+ if (usage.derivedFrom?.sourcePath) {
1434
+ childPath = usage.derivedFrom.sourcePath;
1435
+ }
1436
+ // Translate the child path to a parent path
1437
+ let translatedPath = translateChildPathToParent(childPath, childData.equivalentSignatureVariables, equivalentSignatureVariables, childName);
1438
+ // If translation failed but we have sourceDataPath, try to extract the prop path from it
1439
+ // sourceDataPath format: "ChildName.signature[n].propPath.rest" → extract "propPath.rest"
1440
+ if (!translatedPath && usage.sourceDataPath) {
1441
+ const signatureMatch = usage.sourceDataPath.match(/\.signature\[\d+\]\.(.+)$/);
1442
+ if (signatureMatch) {
1443
+ translatedPath = signatureMatch[1];
1444
+ }
1445
+ }
1446
+ if (!translatedPath) {
1447
+ // Could not translate - skip this usage
1448
+ continue;
1449
+ }
1450
+ // Now resolve the translated path in the parent context
1451
+ // First, try standard resolution
1452
+ const resolution = resolvePathToControllable(translatedPath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1453
+ // Only create flows for controllable paths (whitelist approach).
1454
+ // If the path doesn't resolve to something in attributesMap, skip it.
1455
+ // This prevents creating flows for useState values which are not
1456
+ // controllable via mock data injection.
1457
+ let resolvedPath = resolution.resolvedPath;
1458
+ if (!resolution.isControllable || !resolvedPath) {
1459
+ // Path is not controllable via standard resolution.
1460
+ // Try fallback: For useState values (cyScope*().functionCallReturnValue),
1461
+ // look for a related URL parameter like "varNameFromUrl" that might
1462
+ // control the initial state.
1463
+ //
1464
+ // Example: viewMode → cyScope20().functionCallReturnValue (useState value)
1465
+ // Fallback: viewModeFromUrl → segments[2] (URL param that initializes the useState)
1466
+ const useStateMatch = translatedPath.match(/^cyScope\d+\(\)\.functionCallReturnValue$/);
1467
+ if (useStateMatch) {
1468
+ // Find what variable this useState value corresponds to by looking
1469
+ // for entries like "varName": "cyScope20()" in equivalentSignatureVariables
1470
+ const useStatePattern = translatedPath.replace(/\.functionCallReturnValue$/, ''); // e.g., "cyScope20()"
1471
+ // Find the variable name that maps to this useState
1472
+ let useStateVarName = null;
1473
+ for (const [varName, varPath] of Object.entries(equivalentSignatureVariables)) {
1474
+ if (varPath === useStatePattern) {
1475
+ useStateVarName = varName;
1476
+ break;
1477
+ }
1478
+ }
1479
+ if (useStateVarName) {
1480
+ // Look for a related URL param like "varNameFromUrl"
1481
+ const urlParamName = `${useStateVarName}FromUrl`;
1482
+ const urlParamPath = equivalentSignatureVariables[urlParamName];
1483
+ if (urlParamPath) {
1484
+ // For useState values initialized from URL params, use the
1485
+ // URL param variable name directly (e.g., "viewModeFromUrl")
1486
+ // rather than fully resolving it. This keeps the path meaningful
1487
+ // for scenario generation and avoids overly generic paths like
1488
+ // "useParams().functionCallReturnValue.*".
1489
+ //
1490
+ // The flow will use the URL param name as the attributePath,
1491
+ // which gets properly resolved when generating mock data.
1492
+ resolvedPath = urlParamName;
1493
+ }
1494
+ }
1495
+ }
1496
+ // Fallback 2: Try sourceEquivalencies to find the actual data source
1497
+ // This handles the case where props flow through useState but originate
1498
+ // from a mockable data source (e.g., API call, fetcher).
1499
+ //
1500
+ // Example: WorkoutsView receives `workouts` prop which in parent is stored
1501
+ // in useState, but ultimately comes from a Supabase query.
1502
+ // sourceEquivalencies tells us: "WorkoutsView().signature[0].workouts" → "createClient()...data"
1503
+ if (!resolvedPath && sourceEquivalencies) {
1504
+ // Build the child prop path to look up in sourceEquivalencies
1505
+ // Format: "ChildName().signature[0].propName"
1506
+ // First, find what prop this child path maps to
1507
+ let childPropName = null;
1508
+ for (const [varName, varPath] of Object.entries(childData.equivalentSignatureVariables)) {
1509
+ // Check if childPath starts with this variable name
1510
+ // e.g., childPath = "workouts.length", varName = "workouts", varPath = "signature[0].workouts"
1511
+ if (childPath === varName ||
1512
+ childPath.startsWith(`${varName}.`)) {
1513
+ childPropName = varName;
1514
+ break;
1515
+ }
1516
+ }
1517
+ if (childPropName) {
1518
+ // Build the full sourceEquivalencies key
1519
+ const sourceEquivKey = `${childName}().signature[0].${childPropName}`;
1520
+ const sourceEquivEntry = sourceEquivalencies[sourceEquivKey];
1521
+ if (sourceEquivEntry && sourceEquivEntry.length > 0) {
1522
+ const dataSourcePath = sourceEquivEntry[0].schemaPath;
1523
+ // Check if this data source path is controllable
1524
+ const dataSourceResolution = resolvePathToControllable(dataSourcePath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1525
+ if (dataSourceResolution.isControllable &&
1526
+ dataSourceResolution.resolvedPath) {
1527
+ // Preserve any suffix from the child path
1528
+ // e.g., childPath = "workouts.length" → suffix = ".length"
1529
+ const suffix = childPath.startsWith(`${childPropName}.`)
1530
+ ? childPath.slice(childPropName.length)
1531
+ : '';
1532
+ resolvedPath = dataSourceResolution.resolvedPath + suffix;
1533
+ }
1534
+ }
1535
+ }
1536
+ }
1537
+ // If still not resolved after fallback, skip
1538
+ if (!resolvedPath) {
1539
+ continue;
1540
+ }
1541
+ }
1542
+ // Check for duplicates
1543
+ const normalizedPath = normalizePathForDeduplication(resolvedPath, fullToShortPathMap);
1544
+ if (seenNormalizedPaths.has(normalizedPath)) {
1545
+ continue;
1546
+ }
1547
+ seenNormalizedPaths.add(normalizedPath);
1548
+ // Generate flows for this translated usage
1549
+ // Create a modified usage with the translated path for flow generation
1550
+ const translatedUsage = {
1551
+ ...usage,
1552
+ path: resolvedPath,
1553
+ };
1554
+ const usageFlows = generateFlowsFromUsage(translatedUsage, resolvedPath);
1555
+ // Add gating conditions to each flow
1556
+ for (const flow of usageFlows) {
1557
+ // Add gating required values to the flow
1558
+ if (gatingRequiredValues.length > 0) {
1559
+ // Filter out any gating values that are already in the flow
1560
+ const existingPaths = new Set(flow.requiredValues.map((rv) => rv.attributePath));
1561
+ const newGatingValues = gatingRequiredValues.filter((gv) => !existingPaths.has(gv.attributePath));
1562
+ flow.requiredValues = [
1563
+ ...flow.requiredValues,
1564
+ ...newGatingValues,
1565
+ ];
1566
+ // Update the flow ID to include gating conditions
1567
+ if (newGatingValues.length > 0) {
1568
+ const gatingIdPart = newGatingValues
1569
+ .map((gv) => `${gv.attributePath}-${gv.value}`)
1570
+ .join('-');
1571
+ flow.id = `${flow.id}-gated-${gatingIdPart}`;
1572
+ }
1573
+ }
1574
+ if (!seenFlowIds.has(flow.id)) {
1575
+ seenFlowIds.add(flow.id);
1576
+ flows.push(flow);
1577
+ }
1578
+ }
1579
+ }
1580
+ }
1581
+ // Process child's compound conditionals
1582
+ for (const compound of childData.compoundConditionals) {
1583
+ const resolvedPaths = new Map();
1584
+ let allResolvable = true;
1585
+ for (const condition of compound.conditions) {
1586
+ // Determine the child path to translate
1587
+ const childPath = condition.path;
1588
+ // Translate the child path to a parent path
1589
+ const translatedPath = translateChildPathToParent(childPath, childData.equivalentSignatureVariables, equivalentSignatureVariables, childName);
1590
+ if (!translatedPath) {
1591
+ allResolvable = false;
1592
+ break;
1593
+ }
1594
+ const resolution = resolvePathToControllable(translatedPath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1595
+ // Only create flows for controllable paths (whitelist approach).
1596
+ // If the path doesn't resolve to something in attributesMap, skip it.
1597
+ // This prevents creating flows for useState values which are not
1598
+ // controllable via mock data injection.
1599
+ let resolvedPath = resolution.resolvedPath;
1600
+ if (!resolution.isControllable || !resolvedPath) {
1601
+ // Path is not controllable via standard resolution.
1602
+ // Try fallback: For useState values (cyScope*().functionCallReturnValue),
1603
+ // look for a related URL parameter like "varNameFromUrl" that might
1604
+ // control the initial state.
1605
+ const useStateMatch = translatedPath.match(/^cyScope\d+\(\)\.functionCallReturnValue$/);
1606
+ if (useStateMatch) {
1607
+ const useStatePattern = translatedPath.replace(/\.functionCallReturnValue$/, '');
1608
+ // Find the variable name that maps to this useState
1609
+ let useStateVarName = null;
1610
+ for (const [varName, varPath] of Object.entries(equivalentSignatureVariables)) {
1611
+ if (varPath === useStatePattern) {
1612
+ useStateVarName = varName;
1613
+ break;
1614
+ }
1615
+ }
1616
+ if (useStateVarName) {
1617
+ const urlParamName = `${useStateVarName}FromUrl`;
1618
+ const urlParamPath = equivalentSignatureVariables[urlParamName];
1619
+ if (urlParamPath) {
1620
+ resolvedPath = urlParamName;
1621
+ }
1622
+ }
1623
+ }
1624
+ }
1625
+ if (!resolvedPath) {
1626
+ allResolvable = false;
1627
+ break;
1628
+ }
1629
+ resolvedPaths.set(condition.path, resolvedPath);
1630
+ }
1631
+ if (allResolvable && resolvedPaths.size > 0) {
1632
+ const compoundFlow = generateFlowFromCompound(compound, resolvedPaths);
1633
+ if (compoundFlow) {
1634
+ // Add gating conditions to compound flow (same as regular usage flows)
1635
+ if (gatingRequiredValues.length > 0) {
1636
+ // Filter out any gating values that are already in the flow
1637
+ const existingPaths = new Set(compoundFlow.requiredValues.map((rv) => rv.attributePath));
1638
+ const newGatingValues = gatingRequiredValues.filter((gv) => !existingPaths.has(gv.attributePath));
1639
+ compoundFlow.requiredValues = [
1640
+ ...compoundFlow.requiredValues,
1641
+ ...newGatingValues,
1642
+ ];
1643
+ // Update the flow ID to include gating conditions
1644
+ if (newGatingValues.length > 0) {
1645
+ const gatingIdPart = newGatingValues
1646
+ .map((gv) => `${gv.attributePath}-${gv.value}`)
1647
+ .join('-');
1648
+ compoundFlow.id = `${compoundFlow.id}-gated-${gatingIdPart}`;
1649
+ }
1650
+ }
1651
+ if (!seenFlowIds.has(compoundFlow.id)) {
1652
+ seenFlowIds.add(compoundFlow.id);
1653
+ flows.push(compoundFlow);
1654
+ }
1655
+ }
1656
+ }
1657
+ }
1658
+ // Process child's jsxRenderingUsages (array.map flows)
1659
+ // This generates array variation flows (empty, few, many) for arrays rendered in child
1660
+ if (childData.jsxRenderingUsages) {
1661
+ for (const jsxUsage of childData.jsxRenderingUsages) {
1662
+ // Translate the child path to a parent path
1663
+ const translatedPath = translateChildPathToParent(jsxUsage.path, childData.equivalentSignatureVariables, equivalentSignatureVariables, childName);
1664
+ if (!translatedPath) {
1665
+ continue;
1666
+ }
1667
+ // Resolve to controllable path in parent context
1668
+ const resolution = resolvePathToControllable(translatedPath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1669
+ let resolvedPath = resolution.resolvedPath;
1670
+ // Try sourceEquivalencies fallback if not controllable
1671
+ if (!resolution.isControllable || !resolvedPath) {
1672
+ if (sourceEquivalencies) {
1673
+ // Build the sourceEquivalencies key
1674
+ // The child path (e.g., "workouts") maps to a prop path (e.g., "signature[0].workouts")
1675
+ let childPropName = null;
1676
+ for (const [varName, varPath] of Object.entries(childData.equivalentSignatureVariables)) {
1677
+ if (jsxUsage.path === varName ||
1678
+ jsxUsage.path.startsWith(`${varName}.`)) {
1679
+ childPropName = varName;
1680
+ break;
1681
+ }
1682
+ }
1683
+ if (childPropName) {
1684
+ const sourceEquivKey = `${childName}().signature[0].${childPropName}`;
1685
+ const sourceEquivEntry = sourceEquivalencies[sourceEquivKey];
1686
+ if (sourceEquivEntry && sourceEquivEntry.length > 0) {
1687
+ const dataSourcePath = sourceEquivEntry[0].schemaPath;
1688
+ const dataSourceResolution = resolvePathToControllable(dataSourcePath, attributesMap, equivalentSignatureVariables, fullToShortPathMap);
1689
+ if (dataSourceResolution.isControllable &&
1690
+ dataSourceResolution.resolvedPath) {
1691
+ resolvedPath = dataSourceResolution.resolvedPath;
1692
+ }
1693
+ }
1694
+ }
1695
+ }
1696
+ }
1697
+ if (!resolvedPath) {
1698
+ continue;
1699
+ }
1700
+ // Check for duplicates
1701
+ const normalizedPath = normalizePathForDeduplication(resolvedPath, fullToShortPathMap);
1702
+ const dedupeKey = `${normalizedPath}:${jsxUsage.renderingType}`;
1703
+ if (seenNormalizedPaths.has(dedupeKey)) {
1704
+ continue;
1705
+ }
1706
+ seenNormalizedPaths.add(dedupeKey);
1707
+ // Generate array variation flows for array-map rendering
1708
+ if (jsxUsage.renderingType === 'array-map') {
1709
+ const baseName = generateNameFromPath(resolvedPath);
1710
+ const pathSlug = pathToSlug(resolvedPath);
1711
+ const exclusiveGroup = `array-length-${pathSlug}`;
1712
+ // Empty array flow
1713
+ const emptyFlow = {
1714
+ id: `${pathSlug}-empty-array`,
1715
+ name: `${baseName} Empty`,
1716
+ description: `When ${baseName.toLowerCase()} array is empty`,
1717
+ requiredValues: [
1718
+ {
1719
+ attributePath: resolvedPath,
1720
+ value: '0',
1721
+ comparison: 'length<',
1722
+ valueType: 'array',
1723
+ },
1724
+ ...gatingRequiredValues,
1725
+ ],
1726
+ impact: 'medium',
1727
+ exclusiveGroup,
1728
+ sourceLocation: jsxUsage.sourceLocation
1729
+ ? {
1730
+ lineNumber: jsxUsage.sourceLocation.lineNumber,
1731
+ column: jsxUsage.sourceLocation.column,
1732
+ }
1733
+ : undefined,
1734
+ codeSnippet: jsxUsage.sourceLocation?.codeSnippet,
1735
+ };
1736
+ if (!seenFlowIds.has(emptyFlow.id)) {
1737
+ seenFlowIds.add(emptyFlow.id);
1738
+ flows.push(emptyFlow);
1739
+ }
1740
+ // Few items flow (1-3)
1741
+ const fewFlow = {
1742
+ id: `${pathSlug}-few-items`,
1743
+ name: `${baseName} Few Items`,
1744
+ description: `When ${baseName.toLowerCase()} array has 1-3 items`,
1745
+ requiredValues: [
1746
+ {
1747
+ attributePath: resolvedPath,
1748
+ value: '3',
1749
+ comparison: 'length<',
1750
+ valueType: 'array',
1751
+ },
1752
+ ...gatingRequiredValues,
1753
+ ],
1754
+ impact: 'low',
1755
+ exclusiveGroup,
1756
+ sourceLocation: jsxUsage.sourceLocation
1757
+ ? {
1758
+ lineNumber: jsxUsage.sourceLocation.lineNumber,
1759
+ column: jsxUsage.sourceLocation.column,
1760
+ }
1761
+ : undefined,
1762
+ codeSnippet: jsxUsage.sourceLocation?.codeSnippet,
1763
+ };
1764
+ if (!seenFlowIds.has(fewFlow.id)) {
1765
+ seenFlowIds.add(fewFlow.id);
1766
+ flows.push(fewFlow);
1767
+ }
1768
+ // Many items flow (10+)
1769
+ const manyFlow = {
1770
+ id: `${pathSlug}-many-items`,
1771
+ name: `${baseName} Many Items`,
1772
+ description: `When ${baseName.toLowerCase()} array has many items`,
1773
+ requiredValues: [
1774
+ {
1775
+ attributePath: resolvedPath,
1776
+ value: '10',
1777
+ comparison: 'length>',
1778
+ valueType: 'array',
1779
+ },
1780
+ ...gatingRequiredValues,
1781
+ ],
1782
+ impact: 'low',
1783
+ exclusiveGroup,
1784
+ sourceLocation: jsxUsage.sourceLocation
1785
+ ? {
1786
+ lineNumber: jsxUsage.sourceLocation.lineNumber,
1787
+ column: jsxUsage.sourceLocation.column,
1788
+ }
1789
+ : undefined,
1790
+ codeSnippet: jsxUsage.sourceLocation?.codeSnippet,
1791
+ };
1792
+ if (!seenFlowIds.has(manyFlow.id)) {
1793
+ seenFlowIds.add(manyFlow.id);
1794
+ flows.push(manyFlow);
1795
+ }
1796
+ }
1797
+ }
1798
+ }
1799
+ }
1800
+ }
1801
+ console.log(`[genFlowsFromConditionals] RESULT: ${flows.length} total flows generated`);
1802
+ for (const flow of flows) {
1803
+ console.log(`[genFlowsFromConditionals] FLOW: id="${flow.id}" requiredValues=[${flow.requiredValues.map((rv) => `${rv.attributePath}=${rv.value}`).join(', ')}]`);
1804
+ }
1805
+ return flows;
1806
+ }
1807
+ //# sourceMappingURL=generateExecutionFlowsFromConditionals.js.map