@codeyam/codeyam-cli 0.1.0-staging.596f0eb → 0.1.0-staging.62d4615

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