@codeyam/codeyam-cli 0.1.0-staging.76566f9 → 0.1.0-staging.79ef713

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 (850) 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 +15 -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 +212 -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 +183 -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 +15 -0
  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 +1128 -30
  18. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +259 -6
  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 +1577 -313
  22. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +5 -1
  23. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +296 -35
  24. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
  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 +54 -3
  28. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +129 -20
  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 +80 -5
  31. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.ts +179 -0
  32. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.ts +40 -30
  33. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +393 -90
  34. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  35. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
  36. package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
  37. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  38. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  39. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +33 -7
  40. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +86 -142
  41. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +59 -3
  42. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +1358 -67
  43. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +200 -196
  44. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +578 -0
  45. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.ts +528 -0
  46. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +2267 -0
  47. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  48. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +5 -5
  49. package/analyzer-template/packages/ai/src/lib/isolateScopes.ts +328 -7
  50. package/analyzer-template/packages/ai/src/lib/mergeStatements.ts +111 -87
  51. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +10 -7
  52. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.ts +1 -1
  53. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -142
  54. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  55. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  56. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +90 -6
  57. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +14 -89
  58. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.ts +58 -0
  59. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +11 -11
  60. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  61. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +824 -0
  62. package/analyzer-template/packages/ai/src/lib/splitOutsideParentheses.ts +5 -1
  63. package/analyzer-template/packages/ai/src/lib/validateExecutionFlowPaths.ts +531 -0
  64. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +122 -3
  65. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  66. package/analyzer-template/packages/analyze/index.ts +2 -0
  67. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +79 -59
  68. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +113 -26
  69. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  70. package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
  71. package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
  72. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +19 -0
  73. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.ts +19 -0
  74. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllExports.ts +11 -0
  75. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.ts +8 -0
  76. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.ts +49 -1
  77. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.ts +2 -1
  78. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +449 -283
  79. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +34 -1
  80. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
  81. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
  82. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +4 -2
  83. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -10
  84. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +31 -15
  85. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +11 -7
  86. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +11 -12
  87. package/analyzer-template/packages/analyze/src/lib/files/analyzeRemixRoute.ts +4 -5
  88. package/analyzer-template/packages/analyze/src/lib/files/enums/steps.ts +1 -1
  89. package/analyzer-template/packages/analyze/src/lib/files/getImportedExports.ts +14 -12
  90. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +1315 -0
  91. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +201 -46
  92. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
  93. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +254 -41
  94. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +28 -62
  95. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +306 -20
  96. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +264 -0
  97. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +1 -0
  98. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -3
  99. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +723 -46
  100. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  101. package/analyzer-template/packages/analyze/src/lib/files/scenarios/propagateArrayItemSchemas.ts +474 -0
  102. package/analyzer-template/packages/analyze/src/lib/files/setImportedExports.ts +2 -1
  103. package/analyzer-template/packages/analyze/src/lib/index.ts +1 -0
  104. package/analyzer-template/packages/analyze/src/lib/utils/getFileByPath.ts +19 -0
  105. package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
  106. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
  107. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
  108. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
  109. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
  110. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
  111. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
  112. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
  113. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  114. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
  115. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
  116. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
  117. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  118. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
  119. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
  120. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
  121. package/analyzer-template/packages/aws/package.json +3 -3
  122. package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
  123. package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
  124. package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
  125. package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
  126. package/analyzer-template/packages/database/package.json +1 -1
  127. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
  128. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  129. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +17 -1
  130. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  131. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  132. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  133. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  134. package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
  135. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  136. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  137. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +7 -3
  138. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
  139. package/analyzer-template/packages/generate/index.ts +3 -0
  140. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
  141. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
  142. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
  143. package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
  144. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  145. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
  146. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  147. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +1 -18
  148. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  149. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  150. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  151. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  152. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  153. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +17 -1
  154. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  155. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  156. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
  157. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
  158. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +2 -6
  159. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  160. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  161. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  162. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  163. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  164. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  165. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  166. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  167. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  168. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  169. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  170. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  171. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  172. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  173. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  174. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
  175. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  176. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  177. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  178. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  179. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  180. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  181. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  182. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  183. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  184. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
  185. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  186. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  187. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  188. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
  189. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  190. package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
  191. package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
  192. package/analyzer-template/packages/github/dist/generate/index.js +3 -0
  193. package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
  194. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
  195. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  196. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  197. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
  198. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
  199. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  200. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  201. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
  202. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
  203. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  204. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  205. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
  206. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
  207. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
  208. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  209. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
  210. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
  211. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
  212. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
  213. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
  214. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
  215. package/analyzer-template/packages/github/dist/types/index.d.ts +3 -4
  216. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  217. package/analyzer-template/packages/github/dist/types/index.js +0 -1
  218. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  219. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +71 -27
  220. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  221. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  222. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  223. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
  224. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
  225. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  226. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  227. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +9 -54
  228. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  229. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +1 -21
  230. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
  231. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +153 -5
  232. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  233. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  234. package/analyzer-template/packages/github/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  235. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts +2 -0
  236. package/analyzer-template/packages/github/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  237. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  238. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  239. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  240. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  241. package/analyzer-template/packages/github/package.json +1 -1
  242. package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
  243. package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
  244. package/analyzer-template/packages/process/index.ts +2 -0
  245. package/analyzer-template/packages/process/package.json +12 -0
  246. package/analyzer-template/packages/process/tsconfig.json +8 -0
  247. package/analyzer-template/packages/types/index.ts +3 -6
  248. package/analyzer-template/packages/types/src/types/Analysis.ts +87 -27
  249. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  250. package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
  251. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  252. package/analyzer-template/packages/types/src/types/Scenario.ts +9 -77
  253. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +181 -5
  254. package/analyzer-template/packages/types/src/types/ScopeAnalysis.ts +6 -1
  255. package/analyzer-template/packages/types/src/types/StatementInfo.ts +2 -0
  256. package/analyzer-template/packages/utils/dist/types/index.d.ts +3 -4
  257. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  258. package/analyzer-template/packages/utils/dist/types/index.js +0 -1
  259. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  260. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +71 -27
  261. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  262. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  263. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  264. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
  265. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
  266. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +3 -0
  267. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  268. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +9 -54
  269. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  270. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +1 -21
  271. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
  272. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +153 -5
  273. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  274. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts +6 -1
  275. package/analyzer-template/packages/utils/dist/types/src/types/ScopeAnalysis.d.ts.map +1 -1
  276. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts +2 -0
  277. package/analyzer-template/packages/utils/dist/types/src/types/StatementInfo.d.ts.map +1 -1
  278. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  279. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  280. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  281. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  282. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  283. package/analyzer-template/playwright/capture.ts +57 -26
  284. package/analyzer-template/playwright/captureStatic.ts +1 -1
  285. package/analyzer-template/playwright/getCodeYamInfo.ts +12 -7
  286. package/analyzer-template/playwright/waitForServer.ts +21 -6
  287. package/analyzer-template/project/analyzeBaselineCommit.ts +9 -0
  288. package/analyzer-template/project/analyzeBranchCommit.ts +4 -0
  289. package/analyzer-template/project/analyzeFileEntities.ts +4 -0
  290. package/analyzer-template/project/analyzeRegularCommit.ts +9 -0
  291. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  292. package/analyzer-template/project/constructMockCode.ts +1004 -105
  293. package/analyzer-template/project/controller/startController.ts +16 -1
  294. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  295. package/analyzer-template/project/executeLibraryFunctionDirect.ts +7 -3
  296. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  297. package/analyzer-template/project/mocks/analyzeFileMock.ts +8 -7
  298. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  299. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
  300. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
  301. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  302. package/analyzer-template/project/orchestrateCapture.ts +81 -9
  303. package/analyzer-template/project/reconcileMockDataKeys.ts +240 -0
  304. package/analyzer-template/project/runAnalysis.ts +11 -0
  305. package/analyzer-template/project/serverOnlyModules.ts +127 -2
  306. package/analyzer-template/project/start.ts +51 -15
  307. package/analyzer-template/project/startScenarioCapture.ts +6 -0
  308. package/analyzer-template/project/writeMockDataTsx.ts +298 -11
  309. package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
  310. package/analyzer-template/project/writeScenarioComponents.ts +312 -42
  311. package/analyzer-template/project/writeScenarioFiles.ts +26 -0
  312. package/analyzer-template/project/writeSimpleRoot.ts +23 -13
  313. package/analyzer-template/scripts/comboWorkerLoop.cjs +99 -50
  314. package/analyzer-template/scripts/defaultCmd.sh +9 -0
  315. package/analyzer-template/tsconfig.json +2 -1
  316. package/background/src/lib/local/createLocalAnalyzer.js +1 -29
  317. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  318. package/background/src/lib/local/execAsync.js +1 -1
  319. package/background/src/lib/local/execAsync.js.map +1 -1
  320. package/background/src/lib/virtualized/common/execAsync.js +1 -1
  321. package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
  322. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +7 -1
  323. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  324. package/background/src/lib/virtualized/project/analyzeBranchCommit.js +2 -1
  325. package/background/src/lib/virtualized/project/analyzeBranchCommit.js.map +1 -1
  326. package/background/src/lib/virtualized/project/analyzeFileEntities.js +2 -1
  327. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  328. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +7 -1
  329. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  330. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  331. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  332. package/background/src/lib/virtualized/project/constructMockCode.js +879 -69
  333. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  334. package/background/src/lib/virtualized/project/controller/startController.js +11 -1
  335. package/background/src/lib/virtualized/project/controller/startController.js.map +1 -1
  336. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  337. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  338. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js +6 -3
  339. package/background/src/lib/virtualized/project/executeLibraryFunctionDirect.js.map +1 -1
  340. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  341. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  342. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js +7 -7
  343. package/background/src/lib/virtualized/project/mocks/analyzeFileMock.js.map +1 -1
  344. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  345. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  346. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
  347. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  348. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
  349. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  350. package/background/src/lib/virtualized/project/orchestrateCapture.js +65 -10
  351. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  352. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +199 -0
  353. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  354. package/background/src/lib/virtualized/project/runAnalysis.js +9 -0
  355. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  356. package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
  357. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
  358. package/background/src/lib/virtualized/project/start.js +47 -15
  359. package/background/src/lib/virtualized/project/start.js.map +1 -1
  360. package/background/src/lib/virtualized/project/startScenarioCapture.js +7 -0
  361. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  362. package/background/src/lib/virtualized/project/writeMockDataTsx.js +255 -8
  363. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  364. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
  365. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
  366. package/background/src/lib/virtualized/project/writeScenarioComponents.js +245 -41
  367. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  368. package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
  369. package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
  370. package/background/src/lib/virtualized/project/writeSimpleRoot.js +23 -13
  371. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  372. package/codeyam-cli/scripts/apply-setup.js +180 -0
  373. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  374. package/codeyam-cli/src/cli.js +7 -1
  375. package/codeyam-cli/src/cli.js.map +1 -1
  376. package/codeyam-cli/src/commands/analyze.js +1 -1
  377. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  378. package/codeyam-cli/src/commands/baseline.js +174 -0
  379. package/codeyam-cli/src/commands/baseline.js.map +1 -0
  380. package/codeyam-cli/src/commands/debug.js +35 -23
  381. package/codeyam-cli/src/commands/debug.js.map +1 -1
  382. package/codeyam-cli/src/commands/default.js +0 -15
  383. package/codeyam-cli/src/commands/default.js.map +1 -1
  384. package/codeyam-cli/src/commands/memory.js +264 -0
  385. package/codeyam-cli/src/commands/memory.js.map +1 -0
  386. package/codeyam-cli/src/commands/recapture.js +29 -18
  387. package/codeyam-cli/src/commands/recapture.js.map +1 -1
  388. package/codeyam-cli/src/commands/report.js +46 -1
  389. package/codeyam-cli/src/commands/report.js.map +1 -1
  390. package/codeyam-cli/src/commands/start.js +8 -12
  391. package/codeyam-cli/src/commands/start.js.map +1 -1
  392. package/codeyam-cli/src/commands/status.js +23 -1
  393. package/codeyam-cli/src/commands/status.js.map +1 -1
  394. package/codeyam-cli/src/commands/test-startup.js +1 -1
  395. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  396. package/codeyam-cli/src/commands/wipe.js +108 -0
  397. package/codeyam-cli/src/commands/wipe.js.map +1 -0
  398. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js +81 -0
  399. package/codeyam-cli/src/utils/__tests__/serverVersionStaleness.test.js.map +1 -0
  400. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +31 -27
  401. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  402. package/codeyam-cli/src/utils/analysisRunner.js +29 -15
  403. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  404. package/codeyam-cli/src/utils/backgroundServer.js +16 -2
  405. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  406. package/codeyam-cli/src/utils/database.js +91 -5
  407. package/codeyam-cli/src/utils/database.js.map +1 -1
  408. package/codeyam-cli/src/utils/generateReport.js +4 -3
  409. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  410. package/codeyam-cli/src/utils/git.js +79 -0
  411. package/codeyam-cli/src/utils/git.js.map +1 -0
  412. package/codeyam-cli/src/utils/install-skills.js +76 -17
  413. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  414. package/codeyam-cli/src/utils/queue/job.js +109 -0
  415. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  416. package/codeyam-cli/src/utils/queue/manager.js +6 -0
  417. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  418. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  419. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js +82 -0
  420. package/codeyam-cli/src/utils/ruleReflection/__tests__/confusionDetector.test.js.map +1 -0
  421. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +230 -0
  422. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -0
  423. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +67 -0
  424. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -0
  425. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js +105 -0
  426. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/captureFixture.js.map +1 -0
  427. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js +34 -0
  428. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/loadCapturedFixture.js.map +1 -0
  429. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js +162 -0
  430. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/runClaude.js.map +1 -0
  431. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +75 -0
  432. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -0
  433. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +285 -0
  434. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -0
  435. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +115 -0
  436. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -0
  437. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js +127 -0
  438. package/codeyam-cli/src/utils/ruleReflection/__tests__/transcriptParser.test.js.map +1 -0
  439. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js +50 -0
  440. package/codeyam-cli/src/utils/ruleReflection/confusionDetector.js.map +1 -0
  441. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +116 -0
  442. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -0
  443. package/codeyam-cli/src/utils/ruleReflection/index.js +5 -0
  444. package/codeyam-cli/src/utils/ruleReflection/index.js.map +1 -0
  445. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js +44 -0
  446. package/codeyam-cli/src/utils/ruleReflection/promptBuilder.js.map +1 -0
  447. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js +85 -0
  448. package/codeyam-cli/src/utils/ruleReflection/transcriptParser.js.map +1 -0
  449. package/codeyam-cli/src/utils/ruleReflection/types.js +5 -0
  450. package/codeyam-cli/src/utils/ruleReflection/types.js.map +1 -0
  451. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +293 -0
  452. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -0
  453. package/codeyam-cli/src/utils/rules/index.js +6 -0
  454. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  455. package/codeyam-cli/src/utils/rules/parser.js +78 -0
  456. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  457. package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
  458. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  459. package/codeyam-cli/src/utils/rules/ruleState.js +150 -0
  460. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -0
  461. package/codeyam-cli/src/utils/rules/staleness.js +137 -0
  462. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  463. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  464. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +7 -5
  465. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  466. package/codeyam-cli/src/utils/versionInfo.js +25 -19
  467. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  468. package/codeyam-cli/src/utils/wipe.js +128 -0
  469. package/codeyam-cli/src/utils/wipe.js.map +1 -0
  470. package/codeyam-cli/src/webserver/app/lib/database.js +74 -20
  471. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  472. package/codeyam-cli/src/webserver/bootstrap.js +40 -0
  473. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  474. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CA3JxPb7.js +1 -0
  475. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-B86KKU7e.js +11 -0
  476. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CzGX-miz.js → EntityTypeBadge-B5ctlSYt.js} +1 -1
  477. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-BqY8gDAW.js +41 -0
  478. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-ClaLpuOo.js +34 -0
  479. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-BDhPilK7.js +25 -0
  480. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CBQPrpT0.js → LibraryFunctionPreview-VeqEBv9v.js} +1 -1
  481. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-Bs7Nn1Jr.js} +1 -1
  482. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-Bm3PmcCz.js} +1 -1
  483. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-C6PKeMYR.js +11 -0
  484. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-BfmDgXxG.js → SafeScreenshot-Gq3Ocjo6.js} +1 -1
  485. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BNLaXBHR.js +10 -0
  486. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-6J7zDUD5.js → TruncatedFilePath-CiwXDxLh.js} +1 -1
  487. package/codeyam-cli/src/webserver/build/client/assets/_index-B3TDXxnk.js +11 -0
  488. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BtBFH820.js +27 -0
  489. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +11 -0
  490. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  491. package/codeyam-cli/src/webserver/build/client/assets/api.save-fixture-l0sNRNKZ.js +1 -0
  492. package/codeyam-cli/src/webserver/build/client/assets/book-open-PttOB2SF.js +6 -0
  493. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-TJp6ofnp.js} +1 -1
  494. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-JE9ZIoBl.js +51 -0
  495. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-CXhHQYrI.js} +1 -1
  496. package/codeyam-cli/src/webserver/build/client/assets/copy-6y9ALfGT.js +11 -0
  497. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CgUsG7ib.js → createLucideIcon-Ca9fAY46.js} +1 -1
  498. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-C1gnJVOL.svg → cy-logo-cli-CCKUIm0S.svg} +2 -2
  499. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +1 -0
  500. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C5lqplTC.js +1 -0
  501. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-Dt-SjPsw.js → entity._sha._-n38keI1k.js} +12 -12
  502. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js +6 -0
  503. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DGgZjdFg.js +6 -0
  504. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-38yPijoD.js} +1 -1
  505. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-BSHEfydn.js} +6 -6
  506. package/codeyam-cli/src/webserver/build/client/assets/executionFlowCoverage-BWhdfn70.js +1 -0
  507. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DAtOlaWE.js → fileTableUtils-DCPhhSMo.js} +1 -1
  508. package/codeyam-cli/src/webserver/build/client/assets/files-0N0YJQv7.js +1 -0
  509. package/codeyam-cli/src/webserver/build/client/assets/{git-D62Lxxmv.js → git-DXnyr8uP.js} +8 -8
  510. package/codeyam-cli/src/webserver/build/client/assets/globals-Bh6jH0cL.css +1 -0
  511. package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-CcsFv748.js} +1 -1
  512. package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-ChN9-fAY.js} +1 -1
  513. package/codeyam-cli/src/webserver/build/client/assets/labs-CdVUfvji.js +1 -0
  514. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-CTqLEAGU.js} +1 -1
  515. package/codeyam-cli/src/webserver/build/client/assets/manifest-87319d0f.js +1 -0
  516. package/codeyam-cli/src/webserver/build/client/assets/memory-CPIDnDEj.js +76 -0
  517. package/codeyam-cli/src/webserver/build/client/assets/pause-D6vreykR.js +11 -0
  518. package/codeyam-cli/src/webserver/build/client/assets/root-D6oziHts.js +62 -0
  519. package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-B8VUL8nl.js} +1 -1
  520. package/codeyam-cli/src/webserver/build/client/assets/settings-eBI36Yv5.js +1 -0
  521. package/codeyam-cli/src/webserver/build/client/assets/simulations-CPoAg7Zo.js +1 -0
  522. package/codeyam-cli/src/webserver/build/client/assets/terminal-BrCP7uQo.js +11 -0
  523. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-BZz2NjYa.js} +1 -1
  524. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DNwUduNu.js +1 -0
  525. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BqPPNjAl.js → useLastLogLine-COky1GVF.js} +1 -1
  526. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-CpZgwliL.js +1 -0
  527. package/codeyam-cli/src/webserver/build/client/assets/{useToast-DWHcCcl1.js → useToast-Bv9JFvUO.js} +1 -1
  528. package/codeyam-cli/src/webserver/build/server/assets/index-9ox9LcrG.js +1 -0
  529. package/codeyam-cli/src/webserver/build/server/assets/server-build-Cq5Vqcob.js +260 -0
  530. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  531. package/codeyam-cli/src/webserver/build-info.json +5 -5
  532. package/codeyam-cli/src/webserver/server.js +35 -25
  533. package/codeyam-cli/src/webserver/server.js.map +1 -1
  534. package/codeyam-cli/templates/codeyam-memory-hook.sh +199 -0
  535. package/codeyam-cli/templates/{codeyam-debug-skill.md → codeyam:debug.md} +48 -4
  536. package/codeyam-cli/templates/{debug-codeyam.md → codeyam:diagnose.md} +204 -26
  537. package/codeyam-cli/templates/codeyam:memory.md +404 -0
  538. package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
  539. package/codeyam-cli/templates/{codeyam-setup-skill.md → codeyam:setup.md} +1 -1
  540. package/codeyam-cli/templates/{codeyam-sim-skill.md → codeyam:sim.md} +1 -1
  541. package/codeyam-cli/templates/{codeyam-test-skill.md → codeyam:test.md} +1 -1
  542. package/codeyam-cli/templates/{codeyam-verify-skill.md → codeyam:verify.md} +1 -1
  543. package/codeyam-cli/templates/rule-notification-hook.py +56 -0
  544. package/codeyam-cli/templates/rule-reflection-hook.py +590 -0
  545. package/codeyam-cli/templates/rules-instructions.md +123 -0
  546. package/package.json +12 -9
  547. package/packages/ai/index.js +8 -6
  548. package/packages/ai/index.js.map +1 -1
  549. package/packages/ai/src/lib/analyzeScope.js +165 -13
  550. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  551. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  552. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  553. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +138 -9
  554. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  555. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js +435 -0
  556. package/packages/ai/src/lib/astScopes/conditionalEffectsExtractor.js.map +1 -0
  557. package/packages/ai/src/lib/astScopes/methodSemantics.js +138 -23
  558. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  559. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js +10 -14
  560. package/packages/ai/src/lib/astScopes/patterns/forInStatementHandler.js.map +1 -1
  561. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js +8 -0
  562. package/packages/ai/src/lib/astScopes/patterns/ifStatementHandler.js.map +1 -1
  563. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +7 -0
  564. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  565. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +138 -1
  566. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  567. package/packages/ai/src/lib/astScopes/processExpression.js +866 -29
  568. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  569. package/packages/ai/src/lib/checkAllAttributes.js +24 -9
  570. package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
  571. package/packages/ai/src/lib/completionCall.js +178 -31
  572. package/packages/ai/src/lib/completionCall.js.map +1 -1
  573. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +1240 -181
  574. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  575. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +5 -1
  576. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  577. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +230 -23
  578. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
  579. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
  580. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  581. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js +13 -3
  582. package/packages/ai/src/lib/dataStructure/helpers/BatchSchemaProcessor.js.map +1 -1
  583. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js +6 -4
  584. package/packages/ai/src/lib/dataStructure/helpers/ScopeTreeManager.js.map +1 -1
  585. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +52 -3
  586. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  587. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +111 -14
  588. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  589. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js +63 -0
  590. package/packages/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema.js.map +1 -0
  591. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +73 -5
  592. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  593. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js +173 -0
  594. package/packages/ai/src/lib/dataStructure/helpers/convertTypeAnnotationsToValues.js.map +1 -0
  595. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js +37 -20
  596. package/packages/ai/src/lib/dataStructure/helpers/deduplicateFunctionSchemas.js.map +1 -1
  597. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +333 -81
  598. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  599. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  600. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  601. package/packages/ai/src/lib/dataStructureChunking.js +111 -0
  602. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  603. package/packages/ai/src/lib/deepEqual.js +32 -0
  604. package/packages/ai/src/lib/deepEqual.js.map +1 -0
  605. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  606. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  607. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  608. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  609. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +21 -5
  610. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  611. package/packages/ai/src/lib/generateChangesEntityScenarios.js +78 -120
  612. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  613. package/packages/ai/src/lib/generateEntityDataStructure.js +47 -2
  614. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  615. package/packages/ai/src/lib/generateEntityScenarioData.js +1082 -62
  616. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  617. package/packages/ai/src/lib/generateEntityScenarios.js +177 -163
  618. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  619. package/packages/ai/src/lib/generateExecutionFlows.js +400 -0
  620. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -0
  621. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js +380 -0
  622. package/packages/ai/src/lib/generateExecutionFlowsFromConditionalEffects.js.map +1 -0
  623. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +1646 -0
  624. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -0
  625. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  626. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  627. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -2
  628. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  629. package/packages/ai/src/lib/isolateScopes.js +270 -7
  630. package/packages/ai/src/lib/isolateScopes.js.map +1 -1
  631. package/packages/ai/src/lib/mergeStatements.js +88 -46
  632. package/packages/ai/src/lib/mergeStatements.js.map +1 -1
  633. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +10 -4
  634. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  635. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js +1 -1
  636. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenarioDataGenerator.js.map +1 -1
  637. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +21 -100
  638. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  639. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  640. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  641. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +68 -6
  642. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  643. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +10 -70
  644. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  645. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js +45 -0
  646. package/packages/ai/src/lib/promptGenerators/generateMissingKeysPrompt.js.map +1 -0
  647. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +9 -9
  648. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  649. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  650. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  651. package/packages/ai/src/lib/resolvePathToControllable.js +677 -0
  652. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -0
  653. package/packages/ai/src/lib/splitOutsideParentheses.js +3 -1
  654. package/packages/ai/src/lib/splitOutsideParentheses.js.map +1 -1
  655. package/packages/ai/src/lib/worker/SerializableDataStructure.js +29 -0
  656. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  657. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  658. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  659. package/packages/analyze/index.js +1 -0
  660. package/packages/analyze/index.js.map +1 -1
  661. package/packages/analyze/src/lib/FileAnalyzer.js +75 -36
  662. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  663. package/packages/analyze/src/lib/ProjectAnalyzer.js +96 -26
  664. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  665. package/packages/analyze/src/lib/analysisContext.js +30 -5
  666. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  667. package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
  668. package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
  669. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
  670. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
  671. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +14 -0
  672. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -1
  673. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js +14 -0
  674. package/packages/analyze/src/lib/asts/sourceFiles/getAllEntityNodes.js.map +1 -1
  675. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js +6 -0
  676. package/packages/analyze/src/lib/asts/sourceFiles/getAllExports.js.map +1 -1
  677. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js +6 -0
  678. package/packages/analyze/src/lib/asts/sourceFiles/getImportsAnalysis.js.map +1 -1
  679. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js +39 -1
  680. package/packages/analyze/src/lib/asts/sourceFiles/getResolvedModule.js.map +1 -1
  681. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js +2 -1
  682. package/packages/analyze/src/lib/asts/sourceFiles/getSourceFilesForAllImports.js.map +1 -1
  683. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +196 -57
  684. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  685. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +24 -1
  686. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  687. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
  688. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  689. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
  690. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  691. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +2 -1
  692. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  693. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -10
  694. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  695. package/packages/analyze/src/lib/files/analyzeChange.js +21 -11
  696. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  697. package/packages/analyze/src/lib/files/analyzeEntity.js +9 -8
  698. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  699. package/packages/analyze/src/lib/files/analyzeInitial.js +9 -10
  700. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  701. package/packages/analyze/src/lib/files/analyzeRemixRoute.js +3 -2
  702. package/packages/analyze/src/lib/files/analyzeRemixRoute.js.map +1 -1
  703. package/packages/analyze/src/lib/files/enums/steps.js +1 -1
  704. package/packages/analyze/src/lib/files/enums/steps.js.map +1 -1
  705. package/packages/analyze/src/lib/files/getImportedExports.js +11 -7
  706. package/packages/analyze/src/lib/files/getImportedExports.js.map +1 -1
  707. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +880 -0
  708. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -0
  709. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +170 -40
  710. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  711. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
  712. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
  713. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +211 -29
  714. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  715. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +29 -34
  716. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  717. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +218 -20
  718. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  719. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +144 -0
  720. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -0
  721. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +1 -0
  722. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  723. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -3
  724. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  725. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +599 -38
  726. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  727. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  728. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  729. package/packages/analyze/src/lib/files/setImportedExports.js +2 -1
  730. package/packages/analyze/src/lib/files/setImportedExports.js.map +1 -1
  731. package/packages/analyze/src/lib/index.js +1 -0
  732. package/packages/analyze/src/lib/index.js.map +1 -1
  733. package/packages/analyze/src/lib/utils/getFileByPath.js +12 -0
  734. package/packages/analyze/src/lib/utils/getFileByPath.js.map +1 -0
  735. package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
  736. package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  737. package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
  738. package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  739. package/packages/database/src/lib/kysely/db.js +8 -1
  740. package/packages/database/src/lib/kysely/db.js.map +1 -1
  741. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  742. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  743. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  744. package/packages/database/src/lib/loadAnalyses.js +45 -2
  745. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  746. package/packages/database/src/lib/loadAnalysis.js +8 -0
  747. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  748. package/packages/database/src/lib/loadBranch.js +11 -1
  749. package/packages/database/src/lib/loadBranch.js.map +1 -1
  750. package/packages/database/src/lib/loadCommit.js +7 -0
  751. package/packages/database/src/lib/loadCommit.js.map +1 -1
  752. package/packages/database/src/lib/loadCommits.js +22 -1
  753. package/packages/database/src/lib/loadCommits.js.map +1 -1
  754. package/packages/database/src/lib/loadEntities.js +23 -4
  755. package/packages/database/src/lib/loadEntities.js.map +1 -1
  756. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  757. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  758. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +7 -4
  759. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  760. package/packages/database/src/lib/updateCommitMetadata.js +5 -4
  761. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  762. package/packages/generate/index.js +3 -0
  763. package/packages/generate/index.js.map +1 -1
  764. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  765. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  766. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  767. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  768. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  769. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  770. package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
  771. package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  772. package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
  773. package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
  774. package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
  775. package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
  776. package/packages/process/index.js +3 -0
  777. package/packages/process/index.js.map +1 -0
  778. package/packages/process/src/GlobalProcessManager.js.map +1 -0
  779. package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
  780. package/packages/process/src/ProcessManager.js.map +1 -0
  781. package/packages/process/src/index.js.map +1 -0
  782. package/packages/process/src/managedExecAsync.js.map +1 -0
  783. package/packages/types/index.js +0 -1
  784. package/packages/types/index.js.map +1 -1
  785. package/packages/types/src/types/Scenario.js +1 -21
  786. package/packages/types/src/types/Scenario.js.map +1 -1
  787. package/packages/utils/src/lib/safeFileName.js +29 -3
  788. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  789. package/scripts/finalize-analyzer.cjs +3 -3
  790. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +0 -102
  791. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +0 -409
  792. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +0 -288
  793. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +0 -495
  794. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.ts +0 -67
  795. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +0 -120
  796. package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
  797. package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
  798. package/analyzer-template/process/README.md +0 -507
  799. package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
  800. package/background/src/lib/process/ProcessManager.js.map +0 -1
  801. package/background/src/lib/process/index.js.map +0 -1
  802. package/background/src/lib/process/managedExecAsync.js.map +0 -1
  803. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +0 -1
  804. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +0 -41
  805. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +0 -25
  806. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +0 -11
  807. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +0 -15
  808. package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +0 -11
  809. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CVP_WGQ3.js +0 -32
  810. package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
  811. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +0 -1
  812. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +0 -1
  813. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +0 -1
  814. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +0 -1
  815. package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +0 -1
  816. package/codeyam-cli/src/webserver/build/client/assets/globals-C9s7Lhdl.css +0 -1
  817. package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +0 -1
  818. package/codeyam-cli/src/webserver/build/client/assets/manifest-0d27da29.js +0 -1
  819. package/codeyam-cli/src/webserver/build/client/assets/root-B_wIKCIf.js +0 -56
  820. package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +0 -1
  821. package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
  822. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +0 -1
  823. package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +0 -1
  824. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +0 -1
  825. package/codeyam-cli/src/webserver/build/server/assets/index-CU58-Ttc.js +0 -1
  826. package/codeyam-cli/src/webserver/build/server/assets/server-build-D35o2uae.js +0 -175
  827. package/packages/ai/src/lib/findMatchingAttribute.js +0 -77
  828. package/packages/ai/src/lib/findMatchingAttribute.js.map +0 -1
  829. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +0 -298
  830. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +0 -1
  831. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +0 -226
  832. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +0 -1
  833. package/packages/ai/src/lib/generateEntityKeyAttributes.js +0 -408
  834. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +0 -1
  835. package/packages/ai/src/lib/isFrontend.js +0 -5
  836. package/packages/ai/src/lib/isFrontend.js.map +0 -1
  837. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js +0 -40
  838. package/packages/ai/src/lib/promptGenerators/generateEntityKeyAttributesGenerator.js.map +0 -1
  839. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +0 -77
  840. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +0 -1
  841. /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
  842. /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
  843. /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
  844. /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
  845. /package/codeyam-cli/src/webserver/build/client/assets/{api.link-scenario-value-l0sNRNKZ.js → api.agent-transcripts-l0sNRNKZ.js} +0 -0
  846. /package/codeyam-cli/src/webserver/build/client/assets/{api.update-key-attributes-l0sNRNKZ.js → api.health-l0sNRNKZ.js} +0 -0
  847. /package/codeyam-cli/src/webserver/build/client/assets/{api.update-valid-values-l0sNRNKZ.js → api.memory-profile-l0sNRNKZ.js} +0 -0
  848. /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
  849. /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
  850. /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
@@ -19,6 +19,265 @@ import {
19
19
  unwrapExpression,
20
20
  } from './sharedPatterns';
21
21
  import { processBindingPattern } from './processBindings';
22
+ import {
23
+ extractConditionalEffectsFromTernary,
24
+ findUseStateSetters,
25
+ } from './conditionalEffectsExtractor';
26
+ import { detectArrayDerivedPattern } from './arrayDerivationDetector';
27
+
28
+ /**
29
+ * Checks if a JSX element has props that reference variables from the parent scope.
30
+ * This is used to detect unconditionally-rendered children that should have their
31
+ * execution flows merged into the parent.
32
+ *
33
+ * We want to track children where the parent controls data that affects the child's
34
+ * conditional rendering. Static props (like title="Dashboard") don't need tracking
35
+ * because they don't create variable execution flows.
36
+ *
37
+ * Examples:
38
+ * - <WorkoutsView workouts={workouts} /> → true (workouts is a variable)
39
+ * - <ItemList items={items} count={count} /> → true (items, count are variables)
40
+ * - <Header title="Dashboard" /> → false (static string)
41
+ * - <Footer /> → false (no props)
42
+ * - <Button onClick={handleClick} /> → false (only callback, no data props)
43
+ *
44
+ * @returns true if the component has at least one prop that references a variable
45
+ * (excluding callbacks which typically start with 'on' or 'handle')
46
+ */
47
+ function hasDataPropsFromParent(
48
+ node: ts.JsxElement | ts.JsxSelfClosingElement,
49
+ componentName: string,
50
+ ): { hasDataProps: boolean; dataProps: string[] } {
51
+ const attributes = ts.isJsxElement(node)
52
+ ? node.openingElement.attributes.properties
53
+ : node.attributes.properties;
54
+
55
+ const dataProps: string[] = [];
56
+
57
+ for (const attr of attributes) {
58
+ // Spread attributes always reference parent data: {...props}
59
+ if (ts.isJsxSpreadAttribute(attr)) {
60
+ const spreadText = attr.expression?.getText() || '...spread';
61
+ dataProps.push(`{...${spreadText}}`);
62
+ console.log(
63
+ `[UnconditionalChild] ${componentName}: Found spread attribute {${spreadText}}`,
64
+ );
65
+ continue;
66
+ }
67
+
68
+ if (ts.isJsxAttribute(attr)) {
69
+ const propName = attr.name.getText();
70
+
71
+ // Skip callback props - they don't create data-driven execution flows
72
+ // Callbacks typically start with 'on' (onClick, onChange) or 'handle' (handleSubmit)
73
+ if (
74
+ propName.startsWith('on') ||
75
+ propName.startsWith('handle') ||
76
+ propName === 'ref'
77
+ ) {
78
+ console.log(
79
+ `[UnconditionalChild] ${componentName}: Skipping callback prop '${propName}'`,
80
+ );
81
+ continue;
82
+ }
83
+
84
+ // Check if the prop value is a JSX expression (references a variable)
85
+ // vs a string literal which is static
86
+ if (attr.initializer) {
87
+ if (ts.isJsxExpression(attr.initializer)) {
88
+ // JSX expression like prop={value} - this references a variable
89
+ // Could be a simple identifier, property access, or more complex expression
90
+ const expression = attr.initializer.expression;
91
+ if (expression) {
92
+ // Skip if it's just a function/arrow function (callback)
93
+ if (
94
+ ts.isArrowFunction(expression) ||
95
+ ts.isFunctionExpression(expression)
96
+ ) {
97
+ console.log(
98
+ `[UnconditionalChild] ${componentName}: Skipping inline callback prop '${propName}'`,
99
+ );
100
+ continue;
101
+ }
102
+ // This is a data prop that references parent state/props
103
+ const exprText = expression.getText();
104
+ dataProps.push(`${propName}={${exprText}}`);
105
+ console.log(
106
+ `[UnconditionalChild] ${componentName}: Found data prop '${propName}' = {${exprText}}`,
107
+ );
108
+ }
109
+ } else {
110
+ // String literals like prop="value" are static
111
+ console.log(
112
+ `[UnconditionalChild] ${componentName}: Skipping static prop '${propName}'`,
113
+ );
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+ const hasDataProps = dataProps.length > 0;
120
+ if (hasDataProps) {
121
+ console.log(
122
+ `[UnconditionalChild] ${componentName}: Has ${dataProps.length} data props: [${dataProps.join(', ')}]`,
123
+ );
124
+ } else {
125
+ console.log(
126
+ `[UnconditionalChild] ${componentName}: No data props found, will NOT track`,
127
+ );
128
+ }
129
+
130
+ return { hasDataProps, dataProps };
131
+ }
132
+
133
+ /**
134
+ * Extracts the component name from a JSX element.
135
+ * Returns null for intrinsic elements (div, span, etc.) since we only care about
136
+ * custom components for gating condition tracking.
137
+ *
138
+ * Examples:
139
+ * - <ChildViewer /> → "ChildViewer"
140
+ * - <ScenarioViewer scenario={...} /> → "ScenarioViewer"
141
+ * - <div> → null (intrinsic element)
142
+ */
143
+ function getComponentNameFromJsx(
144
+ node: ts.JsxElement | ts.JsxSelfClosingElement,
145
+ ): string | null {
146
+ let tagName: ts.JsxTagNameExpression;
147
+
148
+ if (ts.isJsxElement(node)) {
149
+ tagName = node.openingElement.tagName;
150
+ } else {
151
+ tagName = node.tagName;
152
+ }
153
+
154
+ // Get the text of the tag name
155
+ const name = tagName.getText();
156
+
157
+ // Check if it's a custom component (starts with uppercase) vs intrinsic element
158
+ // Custom components start with uppercase: <MyComponent />
159
+ // Intrinsic elements start with lowercase: <div />
160
+ if (
161
+ name &&
162
+ name[0] === name[0].toUpperCase() &&
163
+ name[0] !== name[0].toLowerCase()
164
+ ) {
165
+ return name;
166
+ }
167
+
168
+ return null;
169
+ }
170
+
171
+ /**
172
+ * Extracts condition paths from a logical AND chain expression.
173
+ * Used for creating gating conditions for child components.
174
+ *
175
+ * Example: `hasData && isReady && <Component />` returns ['hasData', 'isReady']
176
+ */
177
+ function extractConditionPathsFromAndChain(
178
+ expr: ts.Expression,
179
+ sourceFile: ts.SourceFile,
180
+ ): string[] {
181
+ const paths: string[] = [];
182
+ const unwrapped = unwrapExpression(expr);
183
+
184
+ if (
185
+ ts.isBinaryExpression(unwrapped) &&
186
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
187
+ ) {
188
+ // Recursively get conditions from left side
189
+ paths.push(
190
+ ...extractConditionPathsFromAndChain(unwrapped.left, sourceFile),
191
+ );
192
+
193
+ // Process right side if it's not JSX (JSX is the consequence, not a condition)
194
+ const rightUnwrapped = unwrapExpression(unwrapped.right);
195
+ if (
196
+ !ts.isJsxElement(rightUnwrapped) &&
197
+ !ts.isJsxSelfClosingElement(rightUnwrapped) &&
198
+ !ts.isJsxFragment(rightUnwrapped)
199
+ ) {
200
+ paths.push(
201
+ ...extractConditionPathsFromAndChain(unwrapped.right, sourceFile),
202
+ );
203
+ }
204
+ } else {
205
+ // Base case: extract path from this expression
206
+ const path = StructuredPath.fromNode(unwrapped, sourceFile);
207
+ if (path) {
208
+ paths.push(path.toString());
209
+ }
210
+ }
211
+
212
+ return paths;
213
+ }
214
+
215
+ /**
216
+ * Finds the rightmost JSX element in an && chain.
217
+ * Example: `a && b && <Component />` returns <Component />
218
+ */
219
+ function findJsxInAndChain(
220
+ expr: ts.Expression,
221
+ ): ts.JsxElement | ts.JsxSelfClosingElement | null {
222
+ const unwrapped = unwrapExpression(expr);
223
+
224
+ if (ts.isJsxElement(unwrapped) || ts.isJsxSelfClosingElement(unwrapped)) {
225
+ return unwrapped;
226
+ }
227
+
228
+ if (
229
+ ts.isBinaryExpression(unwrapped) &&
230
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
231
+ ) {
232
+ // Check right side first (most common case: condition && <Jsx />)
233
+ const rightResult = findJsxInAndChain(unwrapped.right);
234
+ if (rightResult) return rightResult;
235
+
236
+ // Also check left side for rare cases
237
+ return findJsxInAndChain(unwrapped.left);
238
+ }
239
+
240
+ return null;
241
+ }
242
+
243
+ /**
244
+ * Fix 32: Finds a JSX fragment in an && chain.
245
+ * Example: `activeTab && <><ChildA /><ChildB /></>` returns the fragment
246
+ * This is needed to propagate parent conditions through fragments.
247
+ */
248
+ function findJsxFragmentInAndChain(expr: ts.Expression): ts.JsxFragment | null {
249
+ const unwrapped = unwrapExpression(expr);
250
+
251
+ if (ts.isJsxFragment(unwrapped)) {
252
+ return unwrapped;
253
+ }
254
+
255
+ if (
256
+ ts.isBinaryExpression(unwrapped) &&
257
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
258
+ ) {
259
+ // Check right side first (most common case: condition && <></>)
260
+ const rightResult = findJsxFragmentInAndChain(unwrapped.right);
261
+ if (rightResult) return rightResult;
262
+
263
+ // Also check left side for rare cases
264
+ return findJsxFragmentInAndChain(unwrapped.left);
265
+ }
266
+
267
+ return null;
268
+ }
269
+
270
+ /**
271
+ * Detects if a property access looks like an environment variable store access.
272
+ * Matches patterns like `env.DATABASE_URL`, `env.IS_FORMBRICKS_CLOUD`, etc.
273
+ * where the object is named "env" and the property looks like an env var name.
274
+ */
275
+ function isEnvStoreAccess(fullText: string): boolean {
276
+ // Match: env.SOME_VAR or env.someVar (but object must be exactly "env")
277
+ // This catches patterns from @t3-oss/env-nextjs and similar packages
278
+ const envStorePattern = /^env\.[A-Z_][A-Z0-9_]*$/;
279
+ return envStorePattern.test(fullText);
280
+ }
22
281
 
23
282
  /**
24
283
  * Converts a call expression argument to a StructuredPath.
@@ -215,6 +474,149 @@ function getSourceLocation(
215
474
  };
216
475
  }
217
476
 
477
+ /**
478
+ * Extracts the root array path from an expression that ends with .map().
479
+ * Handles chained methods like .filter().map(), .slice().map(), etc.
480
+ *
481
+ * Examples:
482
+ * - items.map(...) → "items"
483
+ * - data.users.map(...) → "data.users"
484
+ * - items.filter(...).map(...) → "items"
485
+ * - items.slice(0, 5).map(...) → "items"
486
+ */
487
+ function extractArrayPathFromMapCall(
488
+ expr: ts.CallExpression,
489
+ sourceFile: ts.SourceFile,
490
+ ): string | null {
491
+ // Walk up the chain to find the root array
492
+ let current: ts.Expression = expr.expression;
493
+
494
+ while (ts.isPropertyAccessExpression(current)) {
495
+ const methodName = current.name.getText(sourceFile);
496
+
497
+ // Common array methods that return arrays (so we keep going up)
498
+ const arrayReturningMethods = [
499
+ 'map',
500
+ 'filter',
501
+ 'slice',
502
+ 'concat',
503
+ 'flat',
504
+ 'flatMap',
505
+ 'reverse',
506
+ 'sort',
507
+ 'toReversed',
508
+ 'toSorted',
509
+ 'toSpliced',
510
+ ];
511
+
512
+ if (arrayReturningMethods.includes(methodName)) {
513
+ const objectExpr = current.expression;
514
+
515
+ // If the object is a call expression (chained method), keep going
516
+ if (ts.isCallExpression(objectExpr)) {
517
+ current = objectExpr.expression;
518
+ } else {
519
+ // Found the root - it's an identifier or property access
520
+ const path = StructuredPath.fromNode(objectExpr, sourceFile);
521
+ return path ? path.toString() : null;
522
+ }
523
+ } else {
524
+ // Not an array method we recognize
525
+ break;
526
+ }
527
+ }
528
+
529
+ return null;
530
+ }
531
+
532
+ /**
533
+ * Extracts JSX rendering usages from a JSX expression.
534
+ * Detects:
535
+ * - array.map() calls → 'array-map' type
536
+ * - string interpolations (identifiers/property access) → 'text-interpolation' type
537
+ *
538
+ * Recursively searches inside && chains and ternary expressions.
539
+ *
540
+ * @param expr The expression inside {expr}
541
+ * @param context The analysis context
542
+ */
543
+ function extractJsxRenderingUsage(
544
+ expr: ts.Expression,
545
+ context: AnalysisContext,
546
+ ): void {
547
+ const unwrapped = unwrapExpression(expr);
548
+ const sourceLocation = getSourceLocation(expr, context.sourceFile);
549
+
550
+ // Detect array.map() calls
551
+ if (ts.isCallExpression(unwrapped)) {
552
+ const calleeExpr = unwrapped.expression;
553
+
554
+ if (ts.isPropertyAccessExpression(calleeExpr)) {
555
+ const methodName = calleeExpr.name.getText(context.sourceFile);
556
+
557
+ if (methodName === 'map') {
558
+ const arrayPath = extractArrayPathFromMapCall(
559
+ unwrapped,
560
+ context.sourceFile,
561
+ );
562
+
563
+ if (arrayPath) {
564
+ context.addJsxRenderingUsage({
565
+ path: arrayPath,
566
+ renderingType: 'array-map',
567
+ valueType: 'array',
568
+ sourceLocation,
569
+ });
570
+ }
571
+ }
572
+ }
573
+ }
574
+ // Detect simple string interpolations: {title} or {user.name}
575
+ else if (
576
+ ts.isIdentifier(unwrapped) ||
577
+ ts.isPropertyAccessExpression(unwrapped)
578
+ ) {
579
+ const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
580
+
581
+ if (path) {
582
+ const pathStr = path.toString();
583
+ const typeInfo = context.getTypeInfo(path);
584
+
585
+ // Only track as text interpolation if it's a string type
586
+ // Check for 'string' type, or types that contain 'string' (but not 'string[]')
587
+ if (
588
+ typeInfo === 'string' ||
589
+ (typeInfo &&
590
+ typeInfo.includes('string') &&
591
+ !typeInfo.includes('string[]'))
592
+ ) {
593
+ context.addJsxRenderingUsage({
594
+ path: pathStr,
595
+ renderingType: 'text-interpolation',
596
+ valueType: 'string',
597
+ sourceLocation,
598
+ });
599
+ }
600
+ }
601
+ }
602
+ // Recursively search inside && chains: {showList && items.map(...)}
603
+ else if (
604
+ ts.isBinaryExpression(unwrapped) &&
605
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
606
+ ) {
607
+ // Check the right side of the && chain (where .map() typically appears)
608
+ const rightSide = unwrapExpression(unwrapped.right);
609
+ extractJsxRenderingUsage(rightSide, context);
610
+ // Also check nested && chains on the left
611
+ extractJsxRenderingUsage(unwrapped.left, context);
612
+ }
613
+ // Recursively search inside ternaries: {isEmpty ? null : items.map(...)}
614
+ else if (ts.isConditionalExpression(unwrapped)) {
615
+ extractJsxRenderingUsage(unwrapped.whenTrue, context);
616
+ extractJsxRenderingUsage(unwrapped.whenFalse, context);
617
+ }
618
+ }
619
+
218
620
  /**
219
621
  * Counts the number of conditions in an && chain (excluding JSX consequence)
220
622
  */
@@ -251,6 +653,492 @@ interface ChainInfo {
251
653
  chainExpression: string;
252
654
  currentPosition: number;
253
655
  compound: CompoundConditional;
656
+ /**
657
+ * When processing OR expressions within an && chain, this tracks the
658
+ * current OR group ID. Conditions added while this is set will be marked
659
+ * as OR alternatives (only one needs to be true).
660
+ */
661
+ currentOrGroupId?: string;
662
+ }
663
+
664
+ /**
665
+ * Parent gating condition accumulated during JSX traversal.
666
+ * Used to track conditions from parent && chains that gate child components.
667
+ */
668
+ interface ParentGatingCondition {
669
+ path: string;
670
+ sourceLocation: { lineNumber: number; column: number; codeSnippet: string };
671
+ isNegated?: boolean;
672
+ }
673
+
674
+ /**
675
+ * Extracts conditionals from JSX elements by recursively traversing children.
676
+ *
677
+ * This is CRITICAL for extracting compound conditionals from JSX expressions
678
+ * like `{hasNewerVersion && !isActive && <Banner />}`.
679
+ *
680
+ * This function is called BEFORE the child boundary check in processExpression
681
+ * because JSX elements are NOT scopes - their expressions use variables from
682
+ * the parent scope and should have their conditionals extracted regardless of
683
+ * whether the JSX is within a child boundary.
684
+ *
685
+ * Fix 32: Added parentConditions parameter to track gating conditions from
686
+ * parent && chains. When we find a component nested inside multiple conditionals
687
+ * like `{activeTab && <>{ternary ? ... : <Component />}</>}`, ALL parent
688
+ * conditions should be added as gating conditions for the component.
689
+ *
690
+ * @param node The JSX element, self-closing element, or fragment to traverse
691
+ * @param context The analysis context
692
+ * @param parentConditions Accumulated gating conditions from parent && chains
693
+ */
694
+ function extractConditionalsFromJsx(
695
+ node: ts.JsxElement | ts.JsxSelfClosingElement | ts.JsxFragment,
696
+ context: AnalysisContext,
697
+ parentConditions: ParentGatingCondition[] = [],
698
+ ): void {
699
+ // Get children to process
700
+ let children: ts.NodeArray<ts.JsxChild> | undefined;
701
+
702
+ if (ts.isJsxElement(node)) {
703
+ children = node.children;
704
+ } else if (ts.isJsxFragment(node)) {
705
+ children = node.children;
706
+ }
707
+ // JsxSelfClosingElement has no children
708
+
709
+ if (!children) {
710
+ return;
711
+ }
712
+
713
+ for (const child of children) {
714
+ // Process JSX expressions: {expr}
715
+ if (ts.isJsxExpression(child) && child.expression) {
716
+ const expr = unwrapExpression(child.expression);
717
+
718
+ // Extract JSX rendering usages (array.map, text interpolation)
719
+ // This handles direct usages like {items.map(...)} or {user.name}
720
+ extractJsxRenderingUsage(expr, context);
721
+
722
+ // If the expression is an && chain, extract its conditional usages
723
+ if (
724
+ ts.isBinaryExpression(expr) &&
725
+ expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
726
+ ) {
727
+ // Mark nullable variables
728
+ markConditionVariablesAsNullable(expr, context);
729
+ // Extract conditional usage (this handles compound conditionals)
730
+ // Pass controlsJsxRendering: true since this conditional controls JSX rendering
731
+ extractConditionalUsage(expr, context, 'logical-and', {
732
+ controlsJsxRendering: true,
733
+ });
734
+
735
+ // Extract all condition paths from the && chain for gating tracking
736
+ const conditionPaths = extractConditionPathsFromAndChain(
737
+ expr,
738
+ context.sourceFile,
739
+ );
740
+ const sourceLocation = getSourceLocation(expr, context.sourceFile);
741
+
742
+ // Fix 32: Build accumulated conditions including parent conditions
743
+ const accumulatedConditions: ParentGatingCondition[] = [
744
+ ...parentConditions,
745
+ ...conditionPaths.map((path) => ({
746
+ path,
747
+ sourceLocation,
748
+ isNegated: false,
749
+ })),
750
+ ];
751
+
752
+ // Track gating conditions for child components
753
+ // Example: {hasAnalysis && <ScenarioViewer />}
754
+ const jsxElement = findJsxInAndChain(expr);
755
+ if (jsxElement) {
756
+ const componentName = getComponentNameFromJsx(jsxElement);
757
+ if (componentName) {
758
+ // Fix 32: Add ALL accumulated conditions (parent + current) as gating conditions
759
+ for (const condition of accumulatedConditions) {
760
+ context.addChildBoundaryGatingCondition(componentName, {
761
+ path: condition.path,
762
+ conditionType: 'truthiness',
763
+ location: 'logical-and',
764
+ sourceLocation: condition.sourceLocation,
765
+ controlsJsxRendering: true,
766
+ isNegated: condition.isNegated,
767
+ });
768
+ }
769
+ }
770
+
771
+ // Fix 32: Recursively process nested JSX with accumulated conditions
772
+ if (
773
+ ts.isJsxElement(jsxElement) ||
774
+ ts.isJsxSelfClosingElement(jsxElement)
775
+ ) {
776
+ extractConditionalsFromJsx(
777
+ jsxElement,
778
+ context,
779
+ accumulatedConditions,
780
+ );
781
+ }
782
+ }
783
+
784
+ // Fix 32: Also check for nested JSX fragments
785
+ const jsxFragment = findJsxFragmentInAndChain(expr);
786
+ if (jsxFragment) {
787
+ extractConditionalsFromJsx(
788
+ jsxFragment,
789
+ context,
790
+ accumulatedConditions,
791
+ );
792
+ }
793
+ }
794
+ // If the expression is a ternary, extract its conditional
795
+ else if (ts.isConditionalExpression(expr)) {
796
+ // Pass controlsJsxRendering: true since this conditional controls JSX rendering
797
+ extractConditionalUsage(expr.condition, context, 'ternary', {
798
+ controlsJsxRendering: true,
799
+ });
800
+
801
+ // Track gating conditions for components in both branches of the ternary
802
+ // Example: {isError ? <ErrorView /> : <SuccessView />}
803
+ const conditionPath = StructuredPath.fromNode(
804
+ unwrapExpression(expr.condition),
805
+ context.sourceFile,
806
+ );
807
+ const sourceLocation = getSourceLocation(expr, context.sourceFile);
808
+
809
+ // Recursively process the whenTrue and whenFalse branches for JSX
810
+ const whenTrue = unwrapExpression(expr.whenTrue);
811
+ const whenFalse = unwrapExpression(expr.whenFalse);
812
+
813
+ // Fix 32: Build conditions for whenTrue branch (parent conditions + ternary condition truthy)
814
+ const whenTrueConditions: ParentGatingCondition[] = [
815
+ ...parentConditions,
816
+ ...(conditionPath
817
+ ? [
818
+ {
819
+ path: conditionPath.toString(),
820
+ sourceLocation,
821
+ isNegated: false,
822
+ },
823
+ ]
824
+ : []),
825
+ ];
826
+
827
+ // Fix 32: Build conditions for whenFalse branch (parent conditions + ternary condition falsy)
828
+ const whenFalseConditions: ParentGatingCondition[] = [
829
+ ...parentConditions,
830
+ ...(conditionPath
831
+ ? [
832
+ {
833
+ path: conditionPath.toString(),
834
+ sourceLocation,
835
+ isNegated: true,
836
+ },
837
+ ]
838
+ : []),
839
+ ];
840
+
841
+ // Handle whenTrue branch (condition is truthy)
842
+ if (ts.isJsxElement(whenTrue) || ts.isJsxSelfClosingElement(whenTrue)) {
843
+ const componentName = getComponentNameFromJsx(whenTrue);
844
+ if (componentName) {
845
+ // Fix 32: Add ALL conditions (parent + ternary) as gating conditions
846
+ for (const condition of whenTrueConditions) {
847
+ context.addChildBoundaryGatingCondition(componentName, {
848
+ path: condition.path,
849
+ conditionType: 'truthiness',
850
+ location: 'ternary',
851
+ sourceLocation: condition.sourceLocation,
852
+ controlsJsxRendering: true,
853
+ isNegated: condition.isNegated,
854
+ });
855
+ }
856
+ }
857
+ }
858
+ if (
859
+ ts.isJsxElement(whenTrue) ||
860
+ ts.isJsxSelfClosingElement(whenTrue) ||
861
+ ts.isJsxFragment(whenTrue)
862
+ ) {
863
+ extractConditionalsFromJsx(whenTrue, context, whenTrueConditions);
864
+ }
865
+
866
+ // Handle whenFalse branch (condition is falsy/negated)
867
+ if (
868
+ ts.isJsxElement(whenFalse) ||
869
+ ts.isJsxSelfClosingElement(whenFalse)
870
+ ) {
871
+ const componentName = getComponentNameFromJsx(whenFalse);
872
+ if (componentName) {
873
+ // Fix 32: Add ALL conditions (parent + ternary) as gating conditions
874
+ for (const condition of whenFalseConditions) {
875
+ context.addChildBoundaryGatingCondition(componentName, {
876
+ path: condition.path,
877
+ conditionType: 'truthiness',
878
+ location: 'ternary',
879
+ sourceLocation: condition.sourceLocation,
880
+ controlsJsxRendering: true,
881
+ isNegated: condition.isNegated,
882
+ });
883
+ }
884
+ }
885
+ }
886
+ if (
887
+ ts.isJsxElement(whenFalse) ||
888
+ ts.isJsxSelfClosingElement(whenFalse) ||
889
+ ts.isJsxFragment(whenFalse)
890
+ ) {
891
+ extractConditionalsFromJsx(whenFalse, context, whenFalseConditions);
892
+ }
893
+ // Handle chained ternaries: a ? <A/> : b ? <B/> : <C/>
894
+ // When whenFalse is another ConditionalExpression, recursively process it
895
+ else if (ts.isConditionalExpression(whenFalse)) {
896
+ // Extract conditional usage for the nested ternary's condition
897
+ extractConditionalUsage(whenFalse.condition, context, 'ternary', {
898
+ controlsJsxRendering: true,
899
+ });
900
+
901
+ // Get the nested condition path
902
+ const nestedConditionPath = StructuredPath.fromNode(
903
+ unwrapExpression(whenFalse.condition),
904
+ context.sourceFile,
905
+ );
906
+ const nestedSourceLocation = getSourceLocation(
907
+ whenFalse,
908
+ context.sourceFile,
909
+ );
910
+
911
+ const nestedWhenTrue = unwrapExpression(whenFalse.whenTrue);
912
+ const nestedWhenFalse = unwrapExpression(whenFalse.whenFalse);
913
+
914
+ // Fix 32: Build conditions for nested whenTrue (parent falsy + nested truthy)
915
+ const nestedWhenTrueConditions: ParentGatingCondition[] = [
916
+ ...whenFalseConditions, // Parent ternary was falsy to get here
917
+ ...(nestedConditionPath
918
+ ? [
919
+ {
920
+ path: nestedConditionPath.toString(),
921
+ sourceLocation: nestedSourceLocation,
922
+ isNegated: false,
923
+ },
924
+ ]
925
+ : []),
926
+ ];
927
+
928
+ // Fix 32: Build conditions for nested whenFalse (parent falsy + nested falsy)
929
+ const nestedWhenFalseConditions: ParentGatingCondition[] = [
930
+ ...whenFalseConditions, // Parent ternary was falsy to get here
931
+ ...(nestedConditionPath
932
+ ? [
933
+ {
934
+ path: nestedConditionPath.toString(),
935
+ sourceLocation: nestedSourceLocation,
936
+ isNegated: true,
937
+ },
938
+ ]
939
+ : []),
940
+ ];
941
+
942
+ // Handle nested whenTrue branch
943
+ if (
944
+ ts.isJsxElement(nestedWhenTrue) ||
945
+ ts.isJsxSelfClosingElement(nestedWhenTrue)
946
+ ) {
947
+ const componentName = getComponentNameFromJsx(nestedWhenTrue);
948
+ if (componentName) {
949
+ // Fix 32: Add ALL accumulated conditions
950
+ for (const condition of nestedWhenTrueConditions) {
951
+ context.addChildBoundaryGatingCondition(componentName, {
952
+ path: condition.path,
953
+ conditionType: 'truthiness',
954
+ location: 'ternary',
955
+ sourceLocation: condition.sourceLocation,
956
+ controlsJsxRendering: true,
957
+ isNegated: condition.isNegated,
958
+ });
959
+ }
960
+ }
961
+ }
962
+ if (
963
+ ts.isJsxElement(nestedWhenTrue) ||
964
+ ts.isJsxSelfClosingElement(nestedWhenTrue) ||
965
+ ts.isJsxFragment(nestedWhenTrue)
966
+ ) {
967
+ extractConditionalsFromJsx(
968
+ nestedWhenTrue,
969
+ context,
970
+ nestedWhenTrueConditions,
971
+ );
972
+ }
973
+
974
+ // Handle nested whenFalse branch (this could be another chained ternary or JSX)
975
+ if (
976
+ ts.isJsxElement(nestedWhenFalse) ||
977
+ ts.isJsxSelfClosingElement(nestedWhenFalse)
978
+ ) {
979
+ const componentName = getComponentNameFromJsx(nestedWhenFalse);
980
+ if (componentName) {
981
+ // Fix 32: Add ALL accumulated conditions
982
+ for (const condition of nestedWhenFalseConditions) {
983
+ context.addChildBoundaryGatingCondition(componentName, {
984
+ path: condition.path,
985
+ conditionType: 'truthiness',
986
+ location: 'ternary',
987
+ sourceLocation: condition.sourceLocation,
988
+ controlsJsxRendering: true,
989
+ isNegated: condition.isNegated,
990
+ });
991
+ }
992
+ }
993
+ }
994
+ if (
995
+ ts.isJsxElement(nestedWhenFalse) ||
996
+ ts.isJsxSelfClosingElement(nestedWhenFalse) ||
997
+ ts.isJsxFragment(nestedWhenFalse)
998
+ ) {
999
+ extractConditionalsFromJsx(
1000
+ nestedWhenFalse,
1001
+ context,
1002
+ nestedWhenFalseConditions,
1003
+ );
1004
+ }
1005
+ // If nestedWhenFalse is yet another ConditionalExpression, the recursion
1006
+ // will handle it on the next iteration when this function processes it
1007
+ else if (ts.isConditionalExpression(nestedWhenFalse)) {
1008
+ // Recursively handle deeper nesting by wrapping in a synthetic process
1009
+ // We create a fake JsxExpression context to reuse the same logic
1010
+ const syntheticChild = {
1011
+ kind: ts.SyntaxKind.JsxExpression,
1012
+ expression: nestedWhenFalse,
1013
+ } as unknown as ts.JsxExpression;
1014
+ // Process via the main JSX expression handler by recursing
1015
+ // For now, just extract conditionals directly
1016
+ extractConditionalUsage(
1017
+ nestedWhenFalse.condition,
1018
+ context,
1019
+ 'ternary',
1020
+ { controlsJsxRendering: true },
1021
+ );
1022
+ }
1023
+ }
1024
+ }
1025
+ }
1026
+ // Recursively process nested JSX elements - Fix 32: pass parent conditions
1027
+ else if (ts.isJsxElement(child)) {
1028
+ // Check if this is a user-defined component (vs intrinsic element like div)
1029
+ const componentName = getComponentNameFromJsx(child);
1030
+ if (componentName) {
1031
+ if (parentConditions.length > 0) {
1032
+ // If there are parent conditions, record them as gating conditions
1033
+ console.log(
1034
+ `[ChildBoundary] ${componentName}: Conditionally rendered with ${parentConditions.length} gating conditions`,
1035
+ );
1036
+ for (const condition of parentConditions) {
1037
+ console.log(
1038
+ `[ChildBoundary] ${componentName}: Adding gating condition path='${condition.path}' isNegated=${condition.isNegated}`,
1039
+ );
1040
+ context.addChildBoundaryGatingCondition(componentName, {
1041
+ path: condition.path,
1042
+ conditionType: 'truthiness',
1043
+ location: 'ternary',
1044
+ sourceLocation: condition.sourceLocation,
1045
+ controlsJsxRendering: true,
1046
+ isNegated: condition.isNegated,
1047
+ });
1048
+ }
1049
+ } else {
1050
+ // No parent conditions - check if it has data props for unconditional tracking
1051
+ console.log(
1052
+ `[ChildBoundary] ${componentName}: Checking for unconditional rendering with data props...`,
1053
+ );
1054
+ const { hasDataProps, dataProps } = hasDataPropsFromParent(
1055
+ child,
1056
+ componentName,
1057
+ );
1058
+ if (hasDataProps) {
1059
+ // Fix: Track unconditionally-rendered children that receive data props
1060
+ // These need to be tracked for flow merging even without gating conditions
1061
+ // Example: <WorkoutsView workouts={workouts} /> - parent controls workouts data
1062
+ console.log(
1063
+ `[ChildBoundary] ${componentName}: TRACKING as unconditionally-rendered with data props: [${dataProps.join(', ')}]`,
1064
+ );
1065
+ context.addChildBoundaryGatingCondition(componentName, {
1066
+ path: '__unconditional__',
1067
+ conditionType: 'truthiness',
1068
+ location: 'unconditional',
1069
+ controlsJsxRendering: true,
1070
+ isNegated: false,
1071
+ });
1072
+ }
1073
+ }
1074
+ }
1075
+ extractConditionalsFromJsx(child, context, parentConditions);
1076
+ }
1077
+ // Handle self-closing JSX elements (e.g., <ScenarioViewer />)
1078
+ else if (ts.isJsxSelfClosingElement(child)) {
1079
+ // Check if this is a user-defined component (vs intrinsic element like div)
1080
+ const componentName = getComponentNameFromJsx(child);
1081
+ if (componentName) {
1082
+ if (parentConditions.length > 0) {
1083
+ // If there are parent conditions, record them as gating conditions
1084
+ console.log(
1085
+ `[ChildBoundary] ${componentName}: Conditionally rendered (self-closing) with ${parentConditions.length} gating conditions`,
1086
+ );
1087
+ for (const condition of parentConditions) {
1088
+ console.log(
1089
+ `[ChildBoundary] ${componentName}: Adding gating condition path='${condition.path}' isNegated=${condition.isNegated}`,
1090
+ );
1091
+ context.addChildBoundaryGatingCondition(componentName, {
1092
+ path: condition.path,
1093
+ conditionType: 'truthiness',
1094
+ location: 'ternary',
1095
+ sourceLocation: condition.sourceLocation,
1096
+ controlsJsxRendering: true,
1097
+ isNegated: condition.isNegated,
1098
+ });
1099
+ }
1100
+ } else {
1101
+ // No parent conditions - check if it has data props for unconditional tracking
1102
+ console.log(
1103
+ `[ChildBoundary] ${componentName}: Checking for unconditional rendering (self-closing) with data props...`,
1104
+ );
1105
+ const { hasDataProps, dataProps } = hasDataPropsFromParent(
1106
+ child,
1107
+ componentName,
1108
+ );
1109
+ if (hasDataProps) {
1110
+ // Fix: Track unconditionally-rendered children that receive data props
1111
+ console.log(
1112
+ `[ChildBoundary] ${componentName}: TRACKING as unconditionally-rendered (self-closing) with data props: [${dataProps.join(', ')}]`,
1113
+ );
1114
+ context.addChildBoundaryGatingCondition(componentName, {
1115
+ path: '__unconditional__',
1116
+ conditionType: 'truthiness',
1117
+ location: 'unconditional',
1118
+ controlsJsxRendering: true,
1119
+ isNegated: false,
1120
+ });
1121
+ }
1122
+ }
1123
+ }
1124
+ // Self-closing elements have no children, so no recursion needed
1125
+ }
1126
+ // Recursively process nested JSX fragments - Fix 32: pass parent conditions
1127
+ else if (ts.isJsxFragment(child)) {
1128
+ extractConditionalsFromJsx(child, context, parentConditions);
1129
+ }
1130
+ }
1131
+ }
1132
+
1133
+ /**
1134
+ * Options for extractConditionalUsage
1135
+ */
1136
+ interface ExtractConditionalOptions {
1137
+ /**
1138
+ * Whether this conditional controls JSX rendering.
1139
+ * Set to true when the conditional appears in a JSX expression like {cond && <Component />}
1140
+ */
1141
+ controlsJsxRendering?: boolean;
254
1142
  }
255
1143
 
256
1144
  /**
@@ -261,12 +1149,15 @@ interface ChainInfo {
261
1149
  * @param condition The condition expression to analyze
262
1150
  * @param context The analysis context
263
1151
  * @param location Where this condition appears (if, ternary, logical-and, switch)
1152
+ * @param options Additional options including controlsJsxRendering flag
264
1153
  */
265
1154
  export function extractConditionalUsage(
266
1155
  condition: ts.Expression,
267
1156
  context: AnalysisContext,
268
1157
  location: ConditionalUsage['location'],
1158
+ options: ExtractConditionalOptions = {},
269
1159
  ): void {
1160
+ const { controlsJsxRendering } = options;
270
1161
  // Internal recursive function with chain tracking
271
1162
  function extractWithChainTracking(
272
1163
  expr: ts.Expression,
@@ -300,6 +1191,7 @@ export function extractConditionalUsage(
300
1191
  conditions: [],
301
1192
  location,
302
1193
  sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
1194
+ controlsJsxRendering,
303
1195
  };
304
1196
  chainInfo = {
305
1197
  chainId,
@@ -333,14 +1225,37 @@ export function extractConditionalUsage(
333
1225
  }
334
1226
 
335
1227
  // Handle binary expressions with || (logical OR)
336
- // OR breaks the chain - each side is independent
1228
+ // When OR is inside an && chain, we need to continue chain tracking
1229
+ // and mark conditions as OR alternatives
337
1230
  if (
338
1231
  ts.isBinaryExpression(unwrapped) &&
339
1232
  unwrapped.operatorToken.kind === ts.SyntaxKind.BarBarToken
340
1233
  ) {
341
- // Both sides of || are independent conditional checks (no chain tracking)
342
- extractWithChainTracking(unwrapped.left, null, false);
343
- extractWithChainTracking(unwrapped.right, null, false);
1234
+ if (chainInfo) {
1235
+ // We're inside an && chain - continue tracking but mark as OR alternatives
1236
+ // Generate an orGroupId so conditions from both sides can be grouped
1237
+ const orGroupId =
1238
+ chainInfo.currentOrGroupId ?? `or_${crypto.randomUUID().slice(0, 8)}`;
1239
+
1240
+ // Process left side with OR group tracking
1241
+ const leftChainInfo = {
1242
+ ...chainInfo,
1243
+ currentOrGroupId: orGroupId,
1244
+ };
1245
+ extractWithChainTracking(unwrapped.left, leftChainInfo, false);
1246
+
1247
+ // Process right side with same OR group
1248
+ // Note: we use leftChainInfo's currentPosition which may have been updated
1249
+ const rightChainInfo = {
1250
+ ...leftChainInfo,
1251
+ currentPosition: chainInfo.currentPosition,
1252
+ };
1253
+ extractWithChainTracking(unwrapped.right, rightChainInfo, false);
1254
+ } else {
1255
+ // Not inside a chain - OR breaks into independent conditional checks
1256
+ extractWithChainTracking(unwrapped.left, null, false);
1257
+ extractWithChainTracking(unwrapped.right, null, false);
1258
+ }
344
1259
  return;
345
1260
  }
346
1261
 
@@ -385,6 +1300,7 @@ export function extractConditionalUsage(
385
1300
  conditionType: 'comparison' | 'truthiness',
386
1301
  comparedValues?: string[],
387
1302
  requiredValue?: string | boolean,
1303
+ sourceExpr?: ts.Expression,
388
1304
  ) => {
389
1305
  const usage: ConditionalUsage = {
390
1306
  path,
@@ -393,8 +1309,20 @@ export function extractConditionalUsage(
393
1309
  location,
394
1310
  sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
395
1311
  isNegated,
1312
+ controlsJsxRendering,
396
1313
  };
397
1314
 
1315
+ // Check for inline array-derived patterns (.length) on the source expression
1316
+ if (sourceExpr) {
1317
+ const arrayDerived = detectArrayDerivedPattern(sourceExpr);
1318
+ if (arrayDerived) {
1319
+ usage.derivedFrom = {
1320
+ operation: arrayDerived.operation,
1321
+ sourcePath: arrayDerived.sourcePath,
1322
+ };
1323
+ }
1324
+ }
1325
+
398
1326
  // Add chain info if part of a compound conditional
399
1327
  if (chainInfo) {
400
1328
  usage.chainId = chainInfo.chainId;
@@ -410,6 +1338,9 @@ export function extractConditionalUsage(
410
1338
  comparedValues,
411
1339
  isNegated,
412
1340
  requiredValue,
1341
+ ...(chainInfo.currentOrGroupId && {
1342
+ orGroupId: chainInfo.currentOrGroupId,
1343
+ }),
413
1344
  });
414
1345
  }
415
1346
 
@@ -424,6 +1355,7 @@ export function extractConditionalUsage(
424
1355
  'comparison',
425
1356
  literalValue !== undefined ? [literalValue] : undefined,
426
1357
  getRequiredValue(literalValue, isNegated),
1358
+ unwrapped.left, // Pass source expression for array derivation detection
427
1359
  );
428
1360
  return;
429
1361
  }
@@ -436,16 +1368,29 @@ export function extractConditionalUsage(
436
1368
  'comparison',
437
1369
  literalValue !== undefined ? [literalValue] : undefined,
438
1370
  getRequiredValue(literalValue, isNegated),
1371
+ unwrapped.right, // Pass source expression for array derivation detection
439
1372
  );
440
1373
  return;
441
1374
  }
442
1375
 
443
1376
  // Both sides are variables - record both as comparisons without specific values
444
1377
  if (leftPath) {
445
- addCondition(leftPath.toLeftHandSideString(), 'comparison');
1378
+ addCondition(
1379
+ leftPath.toLeftHandSideString(),
1380
+ 'comparison',
1381
+ undefined,
1382
+ undefined,
1383
+ unwrapped.left,
1384
+ );
446
1385
  }
447
1386
  if (rightPath) {
448
- addCondition(rightPath.toLeftHandSideString(), 'comparison');
1387
+ addCondition(
1388
+ rightPath.toLeftHandSideString(),
1389
+ 'comparison',
1390
+ undefined,
1391
+ undefined,
1392
+ unwrapped.right,
1393
+ );
449
1394
  }
450
1395
  return;
451
1396
  }
@@ -471,8 +1416,19 @@ export function extractConditionalUsage(
471
1416
  location,
472
1417
  sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
473
1418
  isNegated,
1419
+ controlsJsxRendering,
474
1420
  };
475
1421
 
1422
+ // Check for inline array-derived patterns (.some(), .every(), .includes(), .length)
1423
+ // This populates derivedFrom so downstream code can resolve to the base array path
1424
+ const arrayDerived = detectArrayDerivedPattern(unwrapped);
1425
+ if (arrayDerived) {
1426
+ usage.derivedFrom = {
1427
+ operation: arrayDerived.operation,
1428
+ sourcePath: arrayDerived.sourcePath,
1429
+ };
1430
+ }
1431
+
476
1432
  // Add chain info if part of a compound conditional
477
1433
  if (chainInfo) {
478
1434
  usage.chainId = chainInfo.chainId;
@@ -488,6 +1444,9 @@ export function extractConditionalUsage(
488
1444
  conditionType: 'truthiness',
489
1445
  isNegated,
490
1446
  requiredValue: !isNegated,
1447
+ ...(chainInfo.currentOrGroupId && {
1448
+ orGroupId: chainInfo.currentOrGroupId,
1449
+ }),
491
1450
  });
492
1451
  }
493
1452
 
@@ -611,6 +1570,18 @@ export function processExpression({
611
1570
  }
612
1571
  }
613
1572
 
1573
+ // CRITICAL: Extract conditionals from JSX BEFORE checking child boundaries
1574
+ // JSX elements are NOT scopes - their expressions use variables from the parent scope.
1575
+ // Even if the JSX element is within a child boundary (e.g., because it contains callbacks),
1576
+ // we must still extract conditionals from JSX expression children like {x && <div>...</div>}
1577
+ if (
1578
+ ts.isJsxElement(unwrappedNode) ||
1579
+ ts.isJsxSelfClosingElement(unwrappedNode) ||
1580
+ ts.isJsxFragment(unwrappedNode)
1581
+ ) {
1582
+ extractConditionalsFromJsx(unwrappedNode, context);
1583
+ }
1584
+
614
1585
  // If the node falls within an excluded child scope, stop processing it.
615
1586
  if (context.isChildBoundary(node)) {
616
1587
  return true;
@@ -645,7 +1616,7 @@ export function processExpression({
645
1616
  const structure = context.getStructure();
646
1617
 
647
1618
  // Propagate existing equivalencies for sub-properties
648
- for (const [key, value] of Object.entries(equivalentVariables)) {
1619
+ for (const [key, rawValue] of Object.entries(equivalentVariables)) {
649
1620
  // Check if this equivalency is for a sub-property of the identifier
650
1621
  // e.g., completeDataStructure['Function Arguments'] or completeDataStructure.foo
651
1622
  if (
@@ -656,8 +1627,14 @@ export function processExpression({
656
1627
  const newTargetPath = StructuredPath.fromBase(
657
1628
  targetPath.toString() + subPath,
658
1629
  );
659
- const valuePath = StructuredPath.fromBase(value);
660
- context.addEquivalence(newTargetPath, valuePath);
1630
+ // Handle both string and string[] values
1631
+ const values = Array.isArray(rawValue) ? rawValue : [rawValue];
1632
+ for (const value of values) {
1633
+ if (typeof value === 'string') {
1634
+ const valuePath = StructuredPath.fromBase(value);
1635
+ context.addEquivalence(newTargetPath, valuePath);
1636
+ }
1637
+ }
661
1638
  }
662
1639
  }
663
1640
 
@@ -802,7 +1779,8 @@ export function processExpression({
802
1779
  // Check if this is an environment variable access
803
1780
  const fullText = unwrappedNode.getText(context.sourceFile);
804
1781
  if (
805
- fullText.includes('.env.') // simple heuristic for env var access but not great
1782
+ fullText.includes('.env.') || // process.env.X, window.env.X
1783
+ isEnvStoreAccess(fullText) // env.X where env is likely an env config object
806
1784
  ) {
807
1785
  context.addEnvironmentVariable(fullText);
808
1786
  }
@@ -1109,6 +2087,14 @@ export function processExpression({
1109
2087
  // e.g., `const tab = segments[0] || 'default'` should trace tab back to segments[0]
1110
2088
  if (operatorKind === ts.SyntaxKind.QuestionQuestionToken) {
1111
2089
  // specifically for ?? we create an equivalence to the left side
2090
+ // IMPORTANT: Also process the left side recursively to apply method semantics
2091
+ // (e.g., for `const segments = splat?.split('/') ?? []`, we need split semantics)
2092
+ processExpression({
2093
+ node: unwrappedNode.left,
2094
+ context,
2095
+ // Don't pass targetPath here - we'll establish equivalence separately below
2096
+ });
2097
+
1112
2098
  if (targetPath) {
1113
2099
  resultPath = StructuredPath.fromNode(
1114
2100
  unwrappedNode.left,
@@ -1126,15 +2112,55 @@ export function processExpression({
1126
2112
  );
1127
2113
  }
1128
2114
  } else if (operatorKind === ts.SyntaxKind.BarBarToken) {
1129
- // For ||, also create an equivalence to the left side
2115
+ // For ||, create equivalences to BOTH sides
1130
2116
  // This enables data flow tracing through fallback expressions
2117
+ // e.g., `const item = items.find(...) || null` should trace to both:
2118
+ // - items[] (from the find result)
2119
+ // - null (from the fallback)
1131
2120
  if (targetPath) {
1132
- resultPath = StructuredPath.fromNode(
2121
+ // Get paths for both sides
2122
+ const leftPath = StructuredPath.fromNode(
1133
2123
  unwrappedNode.left,
1134
2124
  context.sourceFile,
1135
2125
  );
2126
+ const rightPath = StructuredPath.fromNode(
2127
+ unwrappedNode.right,
2128
+ context.sourceFile,
2129
+ );
2130
+
2131
+ // Collect all valid paths
2132
+ const allPaths: StructuredPath[] = [];
2133
+ if (leftPath) allPaths.push(leftPath);
2134
+ if (rightPath) allPaths.push(rightPath);
2135
+
2136
+ // Add multiple equivalencies to track both sources
2137
+ if (allPaths.length > 0) {
2138
+ context.addMultipleEquivalencies(targetPath, allPaths);
2139
+ }
2140
+
2141
+ // Process both sides to capture their internal structures
2142
+ processExpression({
2143
+ node: unwrappedNode.left,
2144
+ context,
2145
+ });
2146
+ processExpression({
2147
+ node: unwrappedNode.right,
2148
+ context,
2149
+ });
2150
+
2151
+ // Register the type for the target path
2152
+ const leftType = context.inferTypeFromNode(unwrappedNode.left);
2153
+ const rightType = context.inferTypeFromNode(unwrappedNode.right);
2154
+ const orResultType = isDefinedType(leftType)
2155
+ ? leftType
2156
+ : rightType || 'unknown';
2157
+ context.addType(targetPath, orResultType);
2158
+
2159
+ // Return early - we've already handled equivalencies with addMultipleEquivalencies
2160
+ // Don't fall through to the generic addEquivalence call below
2161
+ return true;
1136
2162
  }
1137
- // Note: Unlike ??, we don't set targetPath when there's no target
2163
+ // Note: When there's no targetPath, we don't recursively process
1138
2164
  // because || is often used in boolean contexts where the full expression matters
1139
2165
  }
1140
2166
  } else if (operatorKind === ts.SyntaxKind.InstanceOfKeyword) {
@@ -1242,24 +2268,56 @@ export function processExpression({
1242
2268
 
1243
2269
  // Get the source expression path (e.g., the object for obj.method())
1244
2270
  const sourceExpr = unwrappedNode.expression.expression;
1245
- const sourcePath = StructuredPath.fromNode(
1246
- sourceExpr,
1247
- context.sourceFile,
1248
- );
1249
-
1250
- if (sourcePath) {
1251
- // For array-specific semantics (like push), verify the source is actually an array
1252
- // This prevents router.push() from being mistakenly treated as Array.push()
1253
- const isArraySemantics = semantics instanceof ArrayPushSemantics;
1254
- const shouldApply =
1255
- !isArraySemantics ||
1256
- isLikelyArrayType(sourceExpr, context.typeChecker);
2271
+ const unwrappedSourceExpr = unwrapExpression(sourceExpr);
2272
+
2273
+ // When the source is a ternary expression like (cond ? arr : arr.slice()),
2274
+ // apply method semantics to BOTH branches directly. The ternary itself isn't
2275
+ // a variable - it's just a choice between two paths that both flow to the result.
2276
+ if (ts.isConditionalExpression(unwrappedSourceExpr)) {
2277
+ const branches = [
2278
+ unwrappedSourceExpr.whenTrue,
2279
+ unwrappedSourceExpr.whenFalse,
2280
+ ];
2281
+
2282
+ for (const branch of branches) {
2283
+ const branchPath = StructuredPath.fromNode(
2284
+ branch,
2285
+ context.sourceFile,
2286
+ );
2287
+ if (branchPath) {
2288
+ const isArraySemantics = semantics instanceof ArrayPushSemantics;
2289
+ const shouldApply =
2290
+ !isArraySemantics ||
2291
+ isLikelyArrayType(branch, context.typeChecker);
2292
+
2293
+ if (shouldApply) {
2294
+ semantics.addEquivalences(callPath, branchPath, context);
2295
+ returnType = semantics.getReturnType();
2296
+ handledBySemantics = true;
2297
+ }
2298
+ }
2299
+ }
2300
+ } else {
2301
+ // Regular (non-ternary) source expression
2302
+ const sourcePath = StructuredPath.fromNode(
2303
+ sourceExpr,
2304
+ context.sourceFile,
2305
+ );
1257
2306
 
1258
- if (shouldApply) {
1259
- // Apply method semantics
1260
- semantics.addEquivalences(callPath, sourcePath, context);
1261
- returnType = semantics.getReturnType();
1262
- handledBySemantics = true;
2307
+ if (sourcePath) {
2308
+ // For array-specific semantics (like push), verify the source is actually an array
2309
+ // This prevents router.push() from being mistakenly treated as Array.push()
2310
+ const isArraySemantics = semantics instanceof ArrayPushSemantics;
2311
+ const shouldApply =
2312
+ !isArraySemantics ||
2313
+ isLikelyArrayType(sourceExpr, context.typeChecker);
2314
+
2315
+ if (shouldApply) {
2316
+ // Apply method semantics
2317
+ semantics.addEquivalences(callPath, sourcePath, context);
2318
+ returnType = semantics.getReturnType();
2319
+ handledBySemantics = true;
2320
+ }
1263
2321
  }
1264
2322
  }
1265
2323
  }
@@ -1673,6 +2731,17 @@ export function processExpression({
1673
2731
  // Extract conditional usages for key attribute detection
1674
2732
  extractConditionalUsage(unwrappedNode.condition, context, 'ternary');
1675
2733
 
2734
+ // Extract conditional effects (setter calls in ternary branches)
2735
+ const knownSetters = findUseStateSetters(context.sourceFile);
2736
+ const effects = extractConditionalEffectsFromTernary(
2737
+ unwrappedNode,
2738
+ context,
2739
+ knownSetters,
2740
+ );
2741
+ for (const effect of effects) {
2742
+ context.addConditionalEffect(effect);
2743
+ }
2744
+
1676
2745
  // Process all parts recursively
1677
2746
  processExpression({
1678
2747
  node: unwrappedNode.condition,
@@ -1806,6 +2875,35 @@ export function processExpression({
1806
2875
 
1807
2876
  // Handle Arrow Functions: (p) => p.prop, (a, b) => { ... }
1808
2877
  if (ts.isArrowFunction(unwrappedNode)) {
2878
+ // If this arrow function is a child boundary (e.g., a .map() callback),
2879
+ // don't process its parameters here - they will be processed when the
2880
+ // child scope is analyzed separately. This prevents parameter variables
2881
+ // from leaking into the parent scope's equivalencies.
2882
+ // Check if this arrow function is a child boundary (i.e., should be processed
2883
+ // as a separate child scope, not here in the parent scope).
2884
+ //
2885
+ // We use two checks because childBoundary positions can be unreliable:
2886
+ // 1. Position-based check (standard isChildBoundary)
2887
+ // 2. Text-based check: if the arrow function text doesn't appear in the
2888
+ // statement text, it was replaced with a cyScope placeholder
2889
+ const isChildBoundary = context.isChildBoundary(unwrappedNode);
2890
+
2891
+ // Text-based child scope detection for when positions are unreliable
2892
+ const arrowFnText = unwrappedNode.getText(context.sourceFile);
2893
+ const firstLine = arrowFnText.split('\n')[0].trim();
2894
+ const searchText = firstLine.substring(0, Math.min(20, firstLine.length));
2895
+ const isInStatementText = context.statementInfo.text.includes(searchText);
2896
+ const isChildScope = !isInStatementText && arrowFnText.length > 10;
2897
+
2898
+ if (isChildBoundary || isChildScope) {
2899
+ // The method semantics (e.g., ArrayMapSemantics) have already established
2900
+ // the necessary equivalences between the child scope placeholder and array elements
2901
+ if (targetPath) {
2902
+ context.addType(targetPath, 'function');
2903
+ }
2904
+ return true;
2905
+ }
2906
+
1809
2907
  // Create a path for the function
1810
2908
  const functionPath = StructuredPath.empty();
1811
2909