@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
@@ -5,6 +5,198 @@ import { nodeToSource } from "./nodeToSource.js";
5
5
  import { methodRegistry, ArrayPushSemantics } from "./methodSemantics.js";
6
6
  import { isArithmeticOperator, isAssignmentOperator, isBitwiseCompoundOperator, isComparisonOperator, isDefinedType, isNumericCompoundOperator, leftOrRightType, unwrapExpression, } from "./sharedPatterns.js";
7
7
  import { processBindingPattern } from "./processBindings.js";
8
+ import { extractConditionalEffectsFromTernary, findUseStateSetters, } from "./conditionalEffectsExtractor.js";
9
+ import { detectArrayDerivedPattern } from "./arrayDerivationDetector.js";
10
+ /**
11
+ * Checks if a JSX element has props that reference variables from the parent scope.
12
+ * This is used to detect unconditionally-rendered children that should have their
13
+ * execution flows merged into the parent.
14
+ *
15
+ * We want to track children where the parent controls data that affects the child's
16
+ * conditional rendering. Static props (like title="Dashboard") don't need tracking
17
+ * because they don't create variable execution flows.
18
+ *
19
+ * Examples:
20
+ * - <WorkoutsView workouts={workouts} /> → true (workouts is a variable)
21
+ * - <ItemList items={items} count={count} /> → true (items, count are variables)
22
+ * - <Header title="Dashboard" /> → false (static string)
23
+ * - <Footer /> → false (no props)
24
+ * - <Button onClick={handleClick} /> → false (only callback, no data props)
25
+ *
26
+ * @returns true if the component has at least one prop that references a variable
27
+ * (excluding callbacks which typically start with 'on' or 'handle')
28
+ */
29
+ function hasDataPropsFromParent(node, componentName) {
30
+ const attributes = ts.isJsxElement(node)
31
+ ? node.openingElement.attributes.properties
32
+ : node.attributes.properties;
33
+ const dataProps = [];
34
+ for (const attr of attributes) {
35
+ // Spread attributes always reference parent data: {...props}
36
+ if (ts.isJsxSpreadAttribute(attr)) {
37
+ const spreadText = attr.expression?.getText() || '...spread';
38
+ dataProps.push(`{...${spreadText}}`);
39
+ console.log(`[UnconditionalChild] ${componentName}: Found spread attribute {${spreadText}}`);
40
+ continue;
41
+ }
42
+ if (ts.isJsxAttribute(attr)) {
43
+ const propName = attr.name.getText();
44
+ // Skip callback props - they don't create data-driven execution flows
45
+ // Callbacks typically start with 'on' (onClick, onChange) or 'handle' (handleSubmit)
46
+ if (propName.startsWith('on') ||
47
+ propName.startsWith('handle') ||
48
+ propName === 'ref') {
49
+ console.log(`[UnconditionalChild] ${componentName}: Skipping callback prop '${propName}'`);
50
+ continue;
51
+ }
52
+ // Check if the prop value is a JSX expression (references a variable)
53
+ // vs a string literal which is static
54
+ if (attr.initializer) {
55
+ if (ts.isJsxExpression(attr.initializer)) {
56
+ // JSX expression like prop={value} - this references a variable
57
+ // Could be a simple identifier, property access, or more complex expression
58
+ const expression = attr.initializer.expression;
59
+ if (expression) {
60
+ // Skip if it's just a function/arrow function (callback)
61
+ if (ts.isArrowFunction(expression) ||
62
+ ts.isFunctionExpression(expression)) {
63
+ console.log(`[UnconditionalChild] ${componentName}: Skipping inline callback prop '${propName}'`);
64
+ continue;
65
+ }
66
+ // This is a data prop that references parent state/props
67
+ const exprText = expression.getText();
68
+ dataProps.push(`${propName}={${exprText}}`);
69
+ console.log(`[UnconditionalChild] ${componentName}: Found data prop '${propName}' = {${exprText}}`);
70
+ }
71
+ }
72
+ else {
73
+ // String literals like prop="value" are static
74
+ console.log(`[UnconditionalChild] ${componentName}: Skipping static prop '${propName}'`);
75
+ }
76
+ }
77
+ }
78
+ }
79
+ const hasDataProps = dataProps.length > 0;
80
+ if (hasDataProps) {
81
+ console.log(`[UnconditionalChild] ${componentName}: Has ${dataProps.length} data props: [${dataProps.join(', ')}]`);
82
+ }
83
+ else {
84
+ console.log(`[UnconditionalChild] ${componentName}: No data props found, will NOT track`);
85
+ }
86
+ return { hasDataProps, dataProps };
87
+ }
88
+ /**
89
+ * Extracts the component name from a JSX element.
90
+ * Returns null for intrinsic elements (div, span, etc.) since we only care about
91
+ * custom components for gating condition tracking.
92
+ *
93
+ * Examples:
94
+ * - <ChildViewer /> → "ChildViewer"
95
+ * - <ScenarioViewer scenario={...} /> → "ScenarioViewer"
96
+ * - <div> → null (intrinsic element)
97
+ */
98
+ function getComponentNameFromJsx(node) {
99
+ let tagName;
100
+ if (ts.isJsxElement(node)) {
101
+ tagName = node.openingElement.tagName;
102
+ }
103
+ else {
104
+ tagName = node.tagName;
105
+ }
106
+ // Get the text of the tag name
107
+ const name = tagName.getText();
108
+ // Check if it's a custom component (starts with uppercase) vs intrinsic element
109
+ // Custom components start with uppercase: <MyComponent />
110
+ // Intrinsic elements start with lowercase: <div />
111
+ if (name &&
112
+ name[0] === name[0].toUpperCase() &&
113
+ name[0] !== name[0].toLowerCase()) {
114
+ return name;
115
+ }
116
+ return null;
117
+ }
118
+ /**
119
+ * Extracts condition paths from a logical AND chain expression.
120
+ * Used for creating gating conditions for child components.
121
+ *
122
+ * Example: `hasData && isReady && <Component />` returns ['hasData', 'isReady']
123
+ */
124
+ function extractConditionPathsFromAndChain(expr, sourceFile) {
125
+ const paths = [];
126
+ const unwrapped = unwrapExpression(expr);
127
+ if (ts.isBinaryExpression(unwrapped) &&
128
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
129
+ // Recursively get conditions from left side
130
+ paths.push(...extractConditionPathsFromAndChain(unwrapped.left, sourceFile));
131
+ // Process right side if it's not JSX (JSX is the consequence, not a condition)
132
+ const rightUnwrapped = unwrapExpression(unwrapped.right);
133
+ if (!ts.isJsxElement(rightUnwrapped) &&
134
+ !ts.isJsxSelfClosingElement(rightUnwrapped) &&
135
+ !ts.isJsxFragment(rightUnwrapped)) {
136
+ paths.push(...extractConditionPathsFromAndChain(unwrapped.right, sourceFile));
137
+ }
138
+ }
139
+ else {
140
+ // Base case: extract path from this expression
141
+ const path = StructuredPath.fromNode(unwrapped, sourceFile);
142
+ if (path) {
143
+ paths.push(path.toString());
144
+ }
145
+ }
146
+ return paths;
147
+ }
148
+ /**
149
+ * Finds the rightmost JSX element in an && chain.
150
+ * Example: `a && b && <Component />` returns <Component />
151
+ */
152
+ function findJsxInAndChain(expr) {
153
+ const unwrapped = unwrapExpression(expr);
154
+ if (ts.isJsxElement(unwrapped) || ts.isJsxSelfClosingElement(unwrapped)) {
155
+ return unwrapped;
156
+ }
157
+ if (ts.isBinaryExpression(unwrapped) &&
158
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
159
+ // Check right side first (most common case: condition && <Jsx />)
160
+ const rightResult = findJsxInAndChain(unwrapped.right);
161
+ if (rightResult)
162
+ return rightResult;
163
+ // Also check left side for rare cases
164
+ return findJsxInAndChain(unwrapped.left);
165
+ }
166
+ return null;
167
+ }
168
+ /**
169
+ * Fix 32: Finds a JSX fragment in an && chain.
170
+ * Example: `activeTab && <><ChildA /><ChildB /></>` returns the fragment
171
+ * This is needed to propagate parent conditions through fragments.
172
+ */
173
+ function findJsxFragmentInAndChain(expr) {
174
+ const unwrapped = unwrapExpression(expr);
175
+ if (ts.isJsxFragment(unwrapped)) {
176
+ return unwrapped;
177
+ }
178
+ if (ts.isBinaryExpression(unwrapped) &&
179
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
180
+ // Check right side first (most common case: condition && <></>)
181
+ const rightResult = findJsxFragmentInAndChain(unwrapped.right);
182
+ if (rightResult)
183
+ return rightResult;
184
+ // Also check left side for rare cases
185
+ return findJsxFragmentInAndChain(unwrapped.left);
186
+ }
187
+ return null;
188
+ }
189
+ /**
190
+ * Detects if a property access looks like an environment variable store access.
191
+ * Matches patterns like `env.DATABASE_URL`, `env.IS_FORMBRICKS_CLOUD`, etc.
192
+ * where the object is named "env" and the property looks like an env var name.
193
+ */
194
+ function isEnvStoreAccess(fullText) {
195
+ // Match: env.SOME_VAR or env.someVar (but object must be exactly "env")
196
+ // This catches patterns from @t3-oss/env-nextjs and similar packages
197
+ const envStorePattern = /^env\.[A-Z_][A-Z0-9_]*$/;
198
+ return envStorePattern.test(fullText);
199
+ }
8
200
  /**
9
201
  * Converts a call expression argument to a StructuredPath.
10
202
  *
@@ -160,6 +352,123 @@ function getSourceLocation(node, sourceFile) {
160
352
  : codeSnippet,
161
353
  };
162
354
  }
355
+ /**
356
+ * Extracts the root array path from an expression that ends with .map().
357
+ * Handles chained methods like .filter().map(), .slice().map(), etc.
358
+ *
359
+ * Examples:
360
+ * - items.map(...) → "items"
361
+ * - data.users.map(...) → "data.users"
362
+ * - items.filter(...).map(...) → "items"
363
+ * - items.slice(0, 5).map(...) → "items"
364
+ */
365
+ function extractArrayPathFromMapCall(expr, sourceFile) {
366
+ // Walk up the chain to find the root array
367
+ let current = expr.expression;
368
+ while (ts.isPropertyAccessExpression(current)) {
369
+ const methodName = current.name.getText(sourceFile);
370
+ // Common array methods that return arrays (so we keep going up)
371
+ const arrayReturningMethods = [
372
+ 'map',
373
+ 'filter',
374
+ 'slice',
375
+ 'concat',
376
+ 'flat',
377
+ 'flatMap',
378
+ 'reverse',
379
+ 'sort',
380
+ 'toReversed',
381
+ 'toSorted',
382
+ 'toSpliced',
383
+ ];
384
+ if (arrayReturningMethods.includes(methodName)) {
385
+ const objectExpr = current.expression;
386
+ // If the object is a call expression (chained method), keep going
387
+ if (ts.isCallExpression(objectExpr)) {
388
+ current = objectExpr.expression;
389
+ }
390
+ else {
391
+ // Found the root - it's an identifier or property access
392
+ const path = StructuredPath.fromNode(objectExpr, sourceFile);
393
+ return path ? path.toString() : null;
394
+ }
395
+ }
396
+ else {
397
+ // Not an array method we recognize
398
+ break;
399
+ }
400
+ }
401
+ return null;
402
+ }
403
+ /**
404
+ * Extracts JSX rendering usages from a JSX expression.
405
+ * Detects:
406
+ * - array.map() calls → 'array-map' type
407
+ * - string interpolations (identifiers/property access) → 'text-interpolation' type
408
+ *
409
+ * Recursively searches inside && chains and ternary expressions.
410
+ *
411
+ * @param expr The expression inside {expr}
412
+ * @param context The analysis context
413
+ */
414
+ function extractJsxRenderingUsage(expr, context) {
415
+ const unwrapped = unwrapExpression(expr);
416
+ const sourceLocation = getSourceLocation(expr, context.sourceFile);
417
+ // Detect array.map() calls
418
+ if (ts.isCallExpression(unwrapped)) {
419
+ const calleeExpr = unwrapped.expression;
420
+ if (ts.isPropertyAccessExpression(calleeExpr)) {
421
+ const methodName = calleeExpr.name.getText(context.sourceFile);
422
+ if (methodName === 'map') {
423
+ const arrayPath = extractArrayPathFromMapCall(unwrapped, context.sourceFile);
424
+ if (arrayPath) {
425
+ context.addJsxRenderingUsage({
426
+ path: arrayPath,
427
+ renderingType: 'array-map',
428
+ valueType: 'array',
429
+ sourceLocation,
430
+ });
431
+ }
432
+ }
433
+ }
434
+ }
435
+ // Detect simple string interpolations: {title} or {user.name}
436
+ else if (ts.isIdentifier(unwrapped) ||
437
+ ts.isPropertyAccessExpression(unwrapped)) {
438
+ const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
439
+ if (path) {
440
+ const pathStr = path.toString();
441
+ const typeInfo = context.getTypeInfo(path);
442
+ // Only track as text interpolation if it's a string type
443
+ // Check for 'string' type, or types that contain 'string' (but not 'string[]')
444
+ if (typeInfo === 'string' ||
445
+ (typeInfo &&
446
+ typeInfo.includes('string') &&
447
+ !typeInfo.includes('string[]'))) {
448
+ context.addJsxRenderingUsage({
449
+ path: pathStr,
450
+ renderingType: 'text-interpolation',
451
+ valueType: 'string',
452
+ sourceLocation,
453
+ });
454
+ }
455
+ }
456
+ }
457
+ // Recursively search inside && chains: {showList && items.map(...)}
458
+ else if (ts.isBinaryExpression(unwrapped) &&
459
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
460
+ // Check the right side of the && chain (where .map() typically appears)
461
+ const rightSide = unwrapExpression(unwrapped.right);
462
+ extractJsxRenderingUsage(rightSide, context);
463
+ // Also check nested && chains on the left
464
+ extractJsxRenderingUsage(unwrapped.left, context);
465
+ }
466
+ // Recursively search inside ternaries: {isEmpty ? null : items.map(...)}
467
+ else if (ts.isConditionalExpression(unwrapped)) {
468
+ extractJsxRenderingUsage(unwrapped.whenTrue, context);
469
+ extractJsxRenderingUsage(unwrapped.whenFalse, context);
470
+ }
471
+ }
163
472
  /**
164
473
  * Counts the number of conditions in an && chain (excluding JSX consequence)
165
474
  */
@@ -180,6 +489,368 @@ function countConditionsInAndChain(expr) {
180
489
  // Single condition (not an && chain)
181
490
  return 1;
182
491
  }
492
+ /**
493
+ * Extracts conditionals from JSX elements by recursively traversing children.
494
+ *
495
+ * This is CRITICAL for extracting compound conditionals from JSX expressions
496
+ * like `{hasNewerVersion && !isActive && <Banner />}`.
497
+ *
498
+ * This function is called BEFORE the child boundary check in processExpression
499
+ * because JSX elements are NOT scopes - their expressions use variables from
500
+ * the parent scope and should have their conditionals extracted regardless of
501
+ * whether the JSX is within a child boundary.
502
+ *
503
+ * Fix 32: Added parentConditions parameter to track gating conditions from
504
+ * parent && chains. When we find a component nested inside multiple conditionals
505
+ * like `{activeTab && <>{ternary ? ... : <Component />}</>}`, ALL parent
506
+ * conditions should be added as gating conditions for the component.
507
+ *
508
+ * @param node The JSX element, self-closing element, or fragment to traverse
509
+ * @param context The analysis context
510
+ * @param parentConditions Accumulated gating conditions from parent && chains
511
+ */
512
+ function extractConditionalsFromJsx(node, context, parentConditions = []) {
513
+ // Get children to process
514
+ let children;
515
+ if (ts.isJsxElement(node)) {
516
+ children = node.children;
517
+ }
518
+ else if (ts.isJsxFragment(node)) {
519
+ children = node.children;
520
+ }
521
+ // JsxSelfClosingElement has no children
522
+ if (!children) {
523
+ return;
524
+ }
525
+ for (const child of children) {
526
+ // Process JSX expressions: {expr}
527
+ if (ts.isJsxExpression(child) && child.expression) {
528
+ const expr = unwrapExpression(child.expression);
529
+ // Extract JSX rendering usages (array.map, text interpolation)
530
+ // This handles direct usages like {items.map(...)} or {user.name}
531
+ extractJsxRenderingUsage(expr, context);
532
+ // If the expression is an && chain, extract its conditional usages
533
+ if (ts.isBinaryExpression(expr) &&
534
+ expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
535
+ // Mark nullable variables
536
+ markConditionVariablesAsNullable(expr, context);
537
+ // Extract conditional usage (this handles compound conditionals)
538
+ // Pass controlsJsxRendering: true since this conditional controls JSX rendering
539
+ extractConditionalUsage(expr, context, 'logical-and', {
540
+ controlsJsxRendering: true,
541
+ });
542
+ // Extract all condition paths from the && chain for gating tracking
543
+ const conditionPaths = extractConditionPathsFromAndChain(expr, context.sourceFile);
544
+ const sourceLocation = getSourceLocation(expr, context.sourceFile);
545
+ // Fix 32: Build accumulated conditions including parent conditions
546
+ const accumulatedConditions = [
547
+ ...parentConditions,
548
+ ...conditionPaths.map((path) => ({
549
+ path,
550
+ sourceLocation,
551
+ isNegated: false,
552
+ })),
553
+ ];
554
+ // Track gating conditions for child components
555
+ // Example: {hasAnalysis && <ScenarioViewer />}
556
+ const jsxElement = findJsxInAndChain(expr);
557
+ if (jsxElement) {
558
+ const componentName = getComponentNameFromJsx(jsxElement);
559
+ if (componentName) {
560
+ // Fix 32: Add ALL accumulated conditions (parent + current) as gating conditions
561
+ for (const condition of accumulatedConditions) {
562
+ context.addChildBoundaryGatingCondition(componentName, {
563
+ path: condition.path,
564
+ conditionType: 'truthiness',
565
+ location: 'logical-and',
566
+ sourceLocation: condition.sourceLocation,
567
+ controlsJsxRendering: true,
568
+ isNegated: condition.isNegated,
569
+ });
570
+ }
571
+ }
572
+ // Fix 32: Recursively process nested JSX with accumulated conditions
573
+ if (ts.isJsxElement(jsxElement) ||
574
+ ts.isJsxSelfClosingElement(jsxElement)) {
575
+ extractConditionalsFromJsx(jsxElement, context, accumulatedConditions);
576
+ }
577
+ }
578
+ // Fix 32: Also check for nested JSX fragments
579
+ const jsxFragment = findJsxFragmentInAndChain(expr);
580
+ if (jsxFragment) {
581
+ extractConditionalsFromJsx(jsxFragment, context, accumulatedConditions);
582
+ }
583
+ }
584
+ // If the expression is a ternary, extract its conditional
585
+ else if (ts.isConditionalExpression(expr)) {
586
+ // Pass controlsJsxRendering: true since this conditional controls JSX rendering
587
+ extractConditionalUsage(expr.condition, context, 'ternary', {
588
+ controlsJsxRendering: true,
589
+ });
590
+ // Track gating conditions for components in both branches of the ternary
591
+ // Example: {isError ? <ErrorView /> : <SuccessView />}
592
+ const conditionPath = StructuredPath.fromNode(unwrapExpression(expr.condition), context.sourceFile);
593
+ const sourceLocation = getSourceLocation(expr, context.sourceFile);
594
+ // Recursively process the whenTrue and whenFalse branches for JSX
595
+ const whenTrue = unwrapExpression(expr.whenTrue);
596
+ const whenFalse = unwrapExpression(expr.whenFalse);
597
+ // Fix 32: Build conditions for whenTrue branch (parent conditions + ternary condition truthy)
598
+ const whenTrueConditions = [
599
+ ...parentConditions,
600
+ ...(conditionPath
601
+ ? [
602
+ {
603
+ path: conditionPath.toString(),
604
+ sourceLocation,
605
+ isNegated: false,
606
+ },
607
+ ]
608
+ : []),
609
+ ];
610
+ // Fix 32: Build conditions for whenFalse branch (parent conditions + ternary condition falsy)
611
+ const whenFalseConditions = [
612
+ ...parentConditions,
613
+ ...(conditionPath
614
+ ? [
615
+ {
616
+ path: conditionPath.toString(),
617
+ sourceLocation,
618
+ isNegated: true,
619
+ },
620
+ ]
621
+ : []),
622
+ ];
623
+ // Handle whenTrue branch (condition is truthy)
624
+ if (ts.isJsxElement(whenTrue) || ts.isJsxSelfClosingElement(whenTrue)) {
625
+ const componentName = getComponentNameFromJsx(whenTrue);
626
+ if (componentName) {
627
+ // Fix 32: Add ALL conditions (parent + ternary) as gating conditions
628
+ for (const condition of whenTrueConditions) {
629
+ context.addChildBoundaryGatingCondition(componentName, {
630
+ path: condition.path,
631
+ conditionType: 'truthiness',
632
+ location: 'ternary',
633
+ sourceLocation: condition.sourceLocation,
634
+ controlsJsxRendering: true,
635
+ isNegated: condition.isNegated,
636
+ });
637
+ }
638
+ }
639
+ }
640
+ if (ts.isJsxElement(whenTrue) ||
641
+ ts.isJsxSelfClosingElement(whenTrue) ||
642
+ ts.isJsxFragment(whenTrue)) {
643
+ extractConditionalsFromJsx(whenTrue, context, whenTrueConditions);
644
+ }
645
+ // Handle whenFalse branch (condition is falsy/negated)
646
+ if (ts.isJsxElement(whenFalse) ||
647
+ ts.isJsxSelfClosingElement(whenFalse)) {
648
+ const componentName = getComponentNameFromJsx(whenFalse);
649
+ if (componentName) {
650
+ // Fix 32: Add ALL conditions (parent + ternary) as gating conditions
651
+ for (const condition of whenFalseConditions) {
652
+ context.addChildBoundaryGatingCondition(componentName, {
653
+ path: condition.path,
654
+ conditionType: 'truthiness',
655
+ location: 'ternary',
656
+ sourceLocation: condition.sourceLocation,
657
+ controlsJsxRendering: true,
658
+ isNegated: condition.isNegated,
659
+ });
660
+ }
661
+ }
662
+ }
663
+ if (ts.isJsxElement(whenFalse) ||
664
+ ts.isJsxSelfClosingElement(whenFalse) ||
665
+ ts.isJsxFragment(whenFalse)) {
666
+ extractConditionalsFromJsx(whenFalse, context, whenFalseConditions);
667
+ }
668
+ // Handle chained ternaries: a ? <A/> : b ? <B/> : <C/>
669
+ // When whenFalse is another ConditionalExpression, recursively process it
670
+ else if (ts.isConditionalExpression(whenFalse)) {
671
+ // Extract conditional usage for the nested ternary's condition
672
+ extractConditionalUsage(whenFalse.condition, context, 'ternary', {
673
+ controlsJsxRendering: true,
674
+ });
675
+ // Get the nested condition path
676
+ const nestedConditionPath = StructuredPath.fromNode(unwrapExpression(whenFalse.condition), context.sourceFile);
677
+ const nestedSourceLocation = getSourceLocation(whenFalse, context.sourceFile);
678
+ const nestedWhenTrue = unwrapExpression(whenFalse.whenTrue);
679
+ const nestedWhenFalse = unwrapExpression(whenFalse.whenFalse);
680
+ // Fix 32: Build conditions for nested whenTrue (parent falsy + nested truthy)
681
+ const nestedWhenTrueConditions = [
682
+ ...whenFalseConditions, // Parent ternary was falsy to get here
683
+ ...(nestedConditionPath
684
+ ? [
685
+ {
686
+ path: nestedConditionPath.toString(),
687
+ sourceLocation: nestedSourceLocation,
688
+ isNegated: false,
689
+ },
690
+ ]
691
+ : []),
692
+ ];
693
+ // Fix 32: Build conditions for nested whenFalse (parent falsy + nested falsy)
694
+ const nestedWhenFalseConditions = [
695
+ ...whenFalseConditions, // Parent ternary was falsy to get here
696
+ ...(nestedConditionPath
697
+ ? [
698
+ {
699
+ path: nestedConditionPath.toString(),
700
+ sourceLocation: nestedSourceLocation,
701
+ isNegated: true,
702
+ },
703
+ ]
704
+ : []),
705
+ ];
706
+ // Handle nested whenTrue branch
707
+ if (ts.isJsxElement(nestedWhenTrue) ||
708
+ ts.isJsxSelfClosingElement(nestedWhenTrue)) {
709
+ const componentName = getComponentNameFromJsx(nestedWhenTrue);
710
+ if (componentName) {
711
+ // Fix 32: Add ALL accumulated conditions
712
+ for (const condition of nestedWhenTrueConditions) {
713
+ context.addChildBoundaryGatingCondition(componentName, {
714
+ path: condition.path,
715
+ conditionType: 'truthiness',
716
+ location: 'ternary',
717
+ sourceLocation: condition.sourceLocation,
718
+ controlsJsxRendering: true,
719
+ isNegated: condition.isNegated,
720
+ });
721
+ }
722
+ }
723
+ }
724
+ if (ts.isJsxElement(nestedWhenTrue) ||
725
+ ts.isJsxSelfClosingElement(nestedWhenTrue) ||
726
+ ts.isJsxFragment(nestedWhenTrue)) {
727
+ extractConditionalsFromJsx(nestedWhenTrue, context, nestedWhenTrueConditions);
728
+ }
729
+ // Handle nested whenFalse branch (this could be another chained ternary or JSX)
730
+ if (ts.isJsxElement(nestedWhenFalse) ||
731
+ ts.isJsxSelfClosingElement(nestedWhenFalse)) {
732
+ const componentName = getComponentNameFromJsx(nestedWhenFalse);
733
+ if (componentName) {
734
+ // Fix 32: Add ALL accumulated conditions
735
+ for (const condition of nestedWhenFalseConditions) {
736
+ context.addChildBoundaryGatingCondition(componentName, {
737
+ path: condition.path,
738
+ conditionType: 'truthiness',
739
+ location: 'ternary',
740
+ sourceLocation: condition.sourceLocation,
741
+ controlsJsxRendering: true,
742
+ isNegated: condition.isNegated,
743
+ });
744
+ }
745
+ }
746
+ }
747
+ if (ts.isJsxElement(nestedWhenFalse) ||
748
+ ts.isJsxSelfClosingElement(nestedWhenFalse) ||
749
+ ts.isJsxFragment(nestedWhenFalse)) {
750
+ extractConditionalsFromJsx(nestedWhenFalse, context, nestedWhenFalseConditions);
751
+ }
752
+ // If nestedWhenFalse is yet another ConditionalExpression, the recursion
753
+ // will handle it on the next iteration when this function processes it
754
+ else if (ts.isConditionalExpression(nestedWhenFalse)) {
755
+ // Recursively handle deeper nesting by wrapping in a synthetic process
756
+ // We create a fake JsxExpression context to reuse the same logic
757
+ const syntheticChild = {
758
+ kind: ts.SyntaxKind.JsxExpression,
759
+ expression: nestedWhenFalse,
760
+ };
761
+ // Process via the main JSX expression handler by recursing
762
+ // For now, just extract conditionals directly
763
+ extractConditionalUsage(nestedWhenFalse.condition, context, 'ternary', { controlsJsxRendering: true });
764
+ }
765
+ }
766
+ }
767
+ }
768
+ // Recursively process nested JSX elements - Fix 32: pass parent conditions
769
+ else if (ts.isJsxElement(child)) {
770
+ // Check if this is a user-defined component (vs intrinsic element like div)
771
+ const componentName = getComponentNameFromJsx(child);
772
+ if (componentName) {
773
+ if (parentConditions.length > 0) {
774
+ // If there are parent conditions, record them as gating conditions
775
+ console.log(`[ChildBoundary] ${componentName}: Conditionally rendered with ${parentConditions.length} gating conditions`);
776
+ for (const condition of parentConditions) {
777
+ console.log(`[ChildBoundary] ${componentName}: Adding gating condition path='${condition.path}' isNegated=${condition.isNegated}`);
778
+ context.addChildBoundaryGatingCondition(componentName, {
779
+ path: condition.path,
780
+ conditionType: 'truthiness',
781
+ location: 'ternary',
782
+ sourceLocation: condition.sourceLocation,
783
+ controlsJsxRendering: true,
784
+ isNegated: condition.isNegated,
785
+ });
786
+ }
787
+ }
788
+ else {
789
+ // No parent conditions - check if it has data props for unconditional tracking
790
+ console.log(`[ChildBoundary] ${componentName}: Checking for unconditional rendering with data props...`);
791
+ const { hasDataProps, dataProps } = hasDataPropsFromParent(child, componentName);
792
+ if (hasDataProps) {
793
+ // Fix: Track unconditionally-rendered children that receive data props
794
+ // These need to be tracked for flow merging even without gating conditions
795
+ // Example: <WorkoutsView workouts={workouts} /> - parent controls workouts data
796
+ console.log(`[ChildBoundary] ${componentName}: TRACKING as unconditionally-rendered with data props: [${dataProps.join(', ')}]`);
797
+ context.addChildBoundaryGatingCondition(componentName, {
798
+ path: '__unconditional__',
799
+ conditionType: 'truthiness',
800
+ location: 'unconditional',
801
+ controlsJsxRendering: true,
802
+ isNegated: false,
803
+ });
804
+ }
805
+ }
806
+ }
807
+ extractConditionalsFromJsx(child, context, parentConditions);
808
+ }
809
+ // Handle self-closing JSX elements (e.g., <ScenarioViewer />)
810
+ else if (ts.isJsxSelfClosingElement(child)) {
811
+ // Check if this is a user-defined component (vs intrinsic element like div)
812
+ const componentName = getComponentNameFromJsx(child);
813
+ if (componentName) {
814
+ if (parentConditions.length > 0) {
815
+ // If there are parent conditions, record them as gating conditions
816
+ console.log(`[ChildBoundary] ${componentName}: Conditionally rendered (self-closing) with ${parentConditions.length} gating conditions`);
817
+ for (const condition of parentConditions) {
818
+ console.log(`[ChildBoundary] ${componentName}: Adding gating condition path='${condition.path}' isNegated=${condition.isNegated}`);
819
+ context.addChildBoundaryGatingCondition(componentName, {
820
+ path: condition.path,
821
+ conditionType: 'truthiness',
822
+ location: 'ternary',
823
+ sourceLocation: condition.sourceLocation,
824
+ controlsJsxRendering: true,
825
+ isNegated: condition.isNegated,
826
+ });
827
+ }
828
+ }
829
+ else {
830
+ // No parent conditions - check if it has data props for unconditional tracking
831
+ console.log(`[ChildBoundary] ${componentName}: Checking for unconditional rendering (self-closing) with data props...`);
832
+ const { hasDataProps, dataProps } = hasDataPropsFromParent(child, componentName);
833
+ if (hasDataProps) {
834
+ // Fix: Track unconditionally-rendered children that receive data props
835
+ console.log(`[ChildBoundary] ${componentName}: TRACKING as unconditionally-rendered (self-closing) with data props: [${dataProps.join(', ')}]`);
836
+ context.addChildBoundaryGatingCondition(componentName, {
837
+ path: '__unconditional__',
838
+ conditionType: 'truthiness',
839
+ location: 'unconditional',
840
+ controlsJsxRendering: true,
841
+ isNegated: false,
842
+ });
843
+ }
844
+ }
845
+ }
846
+ // Self-closing elements have no children, so no recursion needed
847
+ }
848
+ // Recursively process nested JSX fragments - Fix 32: pass parent conditions
849
+ else if (ts.isJsxFragment(child)) {
850
+ extractConditionalsFromJsx(child, context, parentConditions);
851
+ }
852
+ }
853
+ }
183
854
  /**
184
855
  * Extracts conditional usages from a condition expression for key attribute detection.
185
856
  * This function identifies which attributes are used in conditionals and how they're used.
@@ -188,8 +859,10 @@ function countConditionsInAndChain(expr) {
188
859
  * @param condition The condition expression to analyze
189
860
  * @param context The analysis context
190
861
  * @param location Where this condition appears (if, ternary, logical-and, switch)
862
+ * @param options Additional options including controlsJsxRendering flag
191
863
  */
192
- export function extractConditionalUsage(condition, context, location) {
864
+ export function extractConditionalUsage(condition, context, location, options = {}) {
865
+ const { controlsJsxRendering } = options;
193
866
  // Internal recursive function with chain tracking
194
867
  function extractWithChainTracking(expr, chainInfo, isNegated) {
195
868
  const unwrapped = unwrapExpression(expr);
@@ -214,6 +887,7 @@ export function extractConditionalUsage(condition, context, location) {
214
887
  conditions: [],
215
888
  location,
216
889
  sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
890
+ controlsJsxRendering,
217
891
  };
218
892
  chainInfo = {
219
893
  chainId,
@@ -241,12 +915,33 @@ export function extractConditionalUsage(condition, context, location) {
241
915
  return;
242
916
  }
243
917
  // Handle binary expressions with || (logical OR)
244
- // OR breaks the chain - each side is independent
918
+ // When OR is inside an && chain, we need to continue chain tracking
919
+ // and mark conditions as OR alternatives
245
920
  if (ts.isBinaryExpression(unwrapped) &&
246
921
  unwrapped.operatorToken.kind === ts.SyntaxKind.BarBarToken) {
247
- // Both sides of || are independent conditional checks (no chain tracking)
248
- extractWithChainTracking(unwrapped.left, null, false);
249
- extractWithChainTracking(unwrapped.right, null, false);
922
+ if (chainInfo) {
923
+ // We're inside an && chain - continue tracking but mark as OR alternatives
924
+ // Generate an orGroupId so conditions from both sides can be grouped
925
+ const orGroupId = chainInfo.currentOrGroupId ?? `or_${crypto.randomUUID().slice(0, 8)}`;
926
+ // Process left side with OR group tracking
927
+ const leftChainInfo = {
928
+ ...chainInfo,
929
+ currentOrGroupId: orGroupId,
930
+ };
931
+ extractWithChainTracking(unwrapped.left, leftChainInfo, false);
932
+ // Process right side with same OR group
933
+ // Note: we use leftChainInfo's currentPosition which may have been updated
934
+ const rightChainInfo = {
935
+ ...leftChainInfo,
936
+ currentPosition: chainInfo.currentPosition,
937
+ };
938
+ extractWithChainTracking(unwrapped.right, rightChainInfo, false);
939
+ }
940
+ else {
941
+ // Not inside a chain - OR breaks into independent conditional checks
942
+ extractWithChainTracking(unwrapped.left, null, false);
943
+ extractWithChainTracking(unwrapped.right, null, false);
944
+ }
250
945
  return;
251
946
  }
252
947
  // Handle comparison operators (===, !==, <, >, <=, >=)
@@ -272,7 +967,7 @@ export function extractConditionalUsage(condition, context, location) {
272
967
  return literalValue;
273
968
  };
274
969
  // Helper to add a condition
275
- const addCondition = (path, conditionType, comparedValues, requiredValue) => {
970
+ const addCondition = (path, conditionType, comparedValues, requiredValue, sourceExpr) => {
276
971
  const usage = {
277
972
  path,
278
973
  conditionType,
@@ -280,7 +975,18 @@ export function extractConditionalUsage(condition, context, location) {
280
975
  location,
281
976
  sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
282
977
  isNegated,
978
+ controlsJsxRendering,
283
979
  };
980
+ // Check for inline array-derived patterns (.length) on the source expression
981
+ if (sourceExpr) {
982
+ const arrayDerived = detectArrayDerivedPattern(sourceExpr);
983
+ if (arrayDerived) {
984
+ usage.derivedFrom = {
985
+ operation: arrayDerived.operation,
986
+ sourcePath: arrayDerived.sourcePath,
987
+ };
988
+ }
989
+ }
284
990
  // Add chain info if part of a compound conditional
285
991
  if (chainInfo) {
286
992
  usage.chainId = chainInfo.chainId;
@@ -295,6 +1001,9 @@ export function extractConditionalUsage(condition, context, location) {
295
1001
  comparedValues,
296
1002
  isNegated,
297
1003
  requiredValue,
1004
+ ...(chainInfo.currentOrGroupId && {
1005
+ orGroupId: chainInfo.currentOrGroupId,
1006
+ }),
298
1007
  });
299
1008
  }
300
1009
  context.addConditionalUsage(usage);
@@ -302,21 +1011,21 @@ export function extractConditionalUsage(condition, context, location) {
302
1011
  // Check if left is a variable and right is a literal
303
1012
  if (leftPath && isLiteralExpression(unwrapped.right)) {
304
1013
  const literalValue = getLiteralValue(unwrapped.right, context);
305
- addCondition(leftPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated));
1014
+ addCondition(leftPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated), unwrapped.left);
306
1015
  return;
307
1016
  }
308
1017
  // Check if right is a variable and left is a literal
309
1018
  if (rightPath && isLiteralExpression(unwrapped.left)) {
310
1019
  const literalValue = getLiteralValue(unwrapped.left, context);
311
- addCondition(rightPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated));
1020
+ addCondition(rightPath.toLeftHandSideString(), 'comparison', literalValue !== undefined ? [literalValue] : undefined, getRequiredValue(literalValue, isNegated), unwrapped.right);
312
1021
  return;
313
1022
  }
314
1023
  // Both sides are variables - record both as comparisons without specific values
315
1024
  if (leftPath) {
316
- addCondition(leftPath.toLeftHandSideString(), 'comparison');
1025
+ addCondition(leftPath.toLeftHandSideString(), 'comparison', undefined, undefined, unwrapped.left);
317
1026
  }
318
1027
  if (rightPath) {
319
- addCondition(rightPath.toLeftHandSideString(), 'comparison');
1028
+ addCondition(rightPath.toLeftHandSideString(), 'comparison', undefined, undefined, unwrapped.right);
320
1029
  }
321
1030
  return;
322
1031
  }
@@ -338,7 +1047,17 @@ export function extractConditionalUsage(condition, context, location) {
338
1047
  location,
339
1048
  sourceLocation: getSourceLocation(unwrapped, context.sourceFile),
340
1049
  isNegated,
1050
+ controlsJsxRendering,
341
1051
  };
1052
+ // Check for inline array-derived patterns (.some(), .every(), .includes(), .length)
1053
+ // This populates derivedFrom so downstream code can resolve to the base array path
1054
+ const arrayDerived = detectArrayDerivedPattern(unwrapped);
1055
+ if (arrayDerived) {
1056
+ usage.derivedFrom = {
1057
+ operation: arrayDerived.operation,
1058
+ sourcePath: arrayDerived.sourcePath,
1059
+ };
1060
+ }
342
1061
  // Add chain info if part of a compound conditional
343
1062
  if (chainInfo) {
344
1063
  usage.chainId = chainInfo.chainId;
@@ -353,6 +1072,9 @@ export function extractConditionalUsage(condition, context, location) {
353
1072
  conditionType: 'truthiness',
354
1073
  isNegated,
355
1074
  requiredValue: !isNegated,
1075
+ ...(chainInfo.currentOrGroupId && {
1076
+ orGroupId: chainInfo.currentOrGroupId,
1077
+ }),
356
1078
  });
357
1079
  }
358
1080
  context.addConditionalUsage(usage);
@@ -447,6 +1169,15 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
447
1169
  extractConditionalUsage(unwrappedNode, context, 'logical-and');
448
1170
  }
449
1171
  }
1172
+ // CRITICAL: Extract conditionals from JSX BEFORE checking child boundaries
1173
+ // JSX elements are NOT scopes - their expressions use variables from the parent scope.
1174
+ // Even if the JSX element is within a child boundary (e.g., because it contains callbacks),
1175
+ // we must still extract conditionals from JSX expression children like {x && <div>...</div>}
1176
+ if (ts.isJsxElement(unwrappedNode) ||
1177
+ ts.isJsxSelfClosingElement(unwrappedNode) ||
1178
+ ts.isJsxFragment(unwrappedNode)) {
1179
+ extractConditionalsFromJsx(unwrappedNode, context);
1180
+ }
450
1181
  // If the node falls within an excluded child scope, stop processing it.
451
1182
  if (context.isChildBoundary(node)) {
452
1183
  return true;
@@ -475,15 +1206,21 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
475
1206
  const equivalentVariables = context.getEquivalentVariables();
476
1207
  const structure = context.getStructure();
477
1208
  // Propagate existing equivalencies for sub-properties
478
- for (const [key, value] of Object.entries(equivalentVariables)) {
1209
+ for (const [key, rawValue] of Object.entries(equivalentVariables)) {
479
1210
  // Check if this equivalency is for a sub-property of the identifier
480
1211
  // e.g., completeDataStructure['Function Arguments'] or completeDataStructure.foo
481
1212
  if (key.startsWith(nodePathStr + '.') ||
482
1213
  key.startsWith(nodePathStr + '[')) {
483
1214
  const subPath = key.substring(nodePathStr.length);
484
1215
  const newTargetPath = StructuredPath.fromBase(targetPath.toString() + subPath);
485
- const valuePath = StructuredPath.fromBase(value);
486
- context.addEquivalence(newTargetPath, valuePath);
1216
+ // Handle both string and string[] values
1217
+ const values = Array.isArray(rawValue) ? rawValue : [rawValue];
1218
+ for (const value of values) {
1219
+ if (typeof value === 'string') {
1220
+ const valuePath = StructuredPath.fromBase(value);
1221
+ context.addEquivalence(newTargetPath, valuePath);
1222
+ }
1223
+ }
487
1224
  }
488
1225
  }
489
1226
  // Propagate existing structure entries for sub-properties
@@ -577,7 +1314,8 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
577
1314
  const propertyPath = objectPath.withProperty(unwrappedNode.name.text);
578
1315
  // Check if this is an environment variable access
579
1316
  const fullText = unwrappedNode.getText(context.sourceFile);
580
- if (fullText.includes('.env.') // simple heuristic for env var access but not great
1317
+ if (fullText.includes('.env.') || // process.env.X, window.env.X
1318
+ isEnvStoreAccess(fullText) // env.X where env is likely an env config object
581
1319
  ) {
582
1320
  context.addEnvironmentVariable(fullText);
583
1321
  }
@@ -801,6 +1539,13 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
801
1539
  // e.g., `const tab = segments[0] || 'default'` should trace tab back to segments[0]
802
1540
  if (operatorKind === ts.SyntaxKind.QuestionQuestionToken) {
803
1541
  // specifically for ?? we create an equivalence to the left side
1542
+ // IMPORTANT: Also process the left side recursively to apply method semantics
1543
+ // (e.g., for `const segments = splat?.split('/') ?? []`, we need split semantics)
1544
+ processExpression({
1545
+ node: unwrappedNode.left,
1546
+ context,
1547
+ // Don't pass targetPath here - we'll establish equivalence separately below
1548
+ });
804
1549
  if (targetPath) {
805
1550
  resultPath = StructuredPath.fromNode(unwrappedNode.left, context.sourceFile);
806
1551
  }
@@ -811,12 +1556,46 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
811
1556
  }
812
1557
  }
813
1558
  else if (operatorKind === ts.SyntaxKind.BarBarToken) {
814
- // For ||, also create an equivalence to the left side
1559
+ // For ||, create equivalences to BOTH sides
815
1560
  // This enables data flow tracing through fallback expressions
1561
+ // e.g., `const item = items.find(...) || null` should trace to both:
1562
+ // - items[] (from the find result)
1563
+ // - null (from the fallback)
816
1564
  if (targetPath) {
817
- resultPath = StructuredPath.fromNode(unwrappedNode.left, context.sourceFile);
1565
+ // Get paths for both sides
1566
+ const leftPath = StructuredPath.fromNode(unwrappedNode.left, context.sourceFile);
1567
+ const rightPath = StructuredPath.fromNode(unwrappedNode.right, context.sourceFile);
1568
+ // Collect all valid paths
1569
+ const allPaths = [];
1570
+ if (leftPath)
1571
+ allPaths.push(leftPath);
1572
+ if (rightPath)
1573
+ allPaths.push(rightPath);
1574
+ // Add multiple equivalencies to track both sources
1575
+ if (allPaths.length > 0) {
1576
+ context.addMultipleEquivalencies(targetPath, allPaths);
1577
+ }
1578
+ // Process both sides to capture their internal structures
1579
+ processExpression({
1580
+ node: unwrappedNode.left,
1581
+ context,
1582
+ });
1583
+ processExpression({
1584
+ node: unwrappedNode.right,
1585
+ context,
1586
+ });
1587
+ // Register the type for the target path
1588
+ const leftType = context.inferTypeFromNode(unwrappedNode.left);
1589
+ const rightType = context.inferTypeFromNode(unwrappedNode.right);
1590
+ const orResultType = isDefinedType(leftType)
1591
+ ? leftType
1592
+ : rightType || 'unknown';
1593
+ context.addType(targetPath, orResultType);
1594
+ // Return early - we've already handled equivalencies with addMultipleEquivalencies
1595
+ // Don't fall through to the generic addEquivalence call below
1596
+ return true;
818
1597
  }
819
- // Note: Unlike ??, we don't set targetPath when there's no target
1598
+ // Note: When there's no targetPath, we don't recursively process
820
1599
  // because || is often used in boolean contexts where the full expression matters
821
1600
  }
822
1601
  }
@@ -894,18 +1673,44 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
894
1673
  const semantics = semanticsList[0];
895
1674
  // Get the source expression path (e.g., the object for obj.method())
896
1675
  const sourceExpr = unwrappedNode.expression.expression;
897
- const sourcePath = StructuredPath.fromNode(sourceExpr, context.sourceFile);
898
- if (sourcePath) {
899
- // For array-specific semantics (like push), verify the source is actually an array
900
- // This prevents router.push() from being mistakenly treated as Array.push()
901
- const isArraySemantics = semantics instanceof ArrayPushSemantics;
902
- const shouldApply = !isArraySemantics ||
903
- isLikelyArrayType(sourceExpr, context.typeChecker);
904
- if (shouldApply) {
905
- // Apply method semantics
906
- semantics.addEquivalences(callPath, sourcePath, context);
907
- returnType = semantics.getReturnType();
908
- handledBySemantics = true;
1676
+ const unwrappedSourceExpr = unwrapExpression(sourceExpr);
1677
+ // When the source is a ternary expression like (cond ? arr : arr.slice()),
1678
+ // apply method semantics to BOTH branches directly. The ternary itself isn't
1679
+ // a variable - it's just a choice between two paths that both flow to the result.
1680
+ if (ts.isConditionalExpression(unwrappedSourceExpr)) {
1681
+ const branches = [
1682
+ unwrappedSourceExpr.whenTrue,
1683
+ unwrappedSourceExpr.whenFalse,
1684
+ ];
1685
+ for (const branch of branches) {
1686
+ const branchPath = StructuredPath.fromNode(branch, context.sourceFile);
1687
+ if (branchPath) {
1688
+ const isArraySemantics = semantics instanceof ArrayPushSemantics;
1689
+ const shouldApply = !isArraySemantics ||
1690
+ isLikelyArrayType(branch, context.typeChecker);
1691
+ if (shouldApply) {
1692
+ semantics.addEquivalences(callPath, branchPath, context);
1693
+ returnType = semantics.getReturnType();
1694
+ handledBySemantics = true;
1695
+ }
1696
+ }
1697
+ }
1698
+ }
1699
+ else {
1700
+ // Regular (non-ternary) source expression
1701
+ const sourcePath = StructuredPath.fromNode(sourceExpr, context.sourceFile);
1702
+ if (sourcePath) {
1703
+ // For array-specific semantics (like push), verify the source is actually an array
1704
+ // This prevents router.push() from being mistakenly treated as Array.push()
1705
+ const isArraySemantics = semantics instanceof ArrayPushSemantics;
1706
+ const shouldApply = !isArraySemantics ||
1707
+ isLikelyArrayType(sourceExpr, context.typeChecker);
1708
+ if (shouldApply) {
1709
+ // Apply method semantics
1710
+ semantics.addEquivalences(callPath, sourcePath, context);
1711
+ returnType = semantics.getReturnType();
1712
+ handledBySemantics = true;
1713
+ }
909
1714
  }
910
1715
  }
911
1716
  }
@@ -1230,6 +2035,12 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
1230
2035
  markConditionVariablesAsNullable(unwrappedNode.condition, context);
1231
2036
  // Extract conditional usages for key attribute detection
1232
2037
  extractConditionalUsage(unwrappedNode.condition, context, 'ternary');
2038
+ // Extract conditional effects (setter calls in ternary branches)
2039
+ const knownSetters = findUseStateSetters(context.sourceFile);
2040
+ const effects = extractConditionalEffectsFromTernary(unwrappedNode, context, knownSetters);
2041
+ for (const effect of effects) {
2042
+ context.addConditionalEffect(effect);
2043
+ }
1233
2044
  // Process all parts recursively
1234
2045
  processExpression({
1235
2046
  node: unwrappedNode.condition,
@@ -1328,6 +2139,32 @@ export function processExpression({ node, context, targetPath, typeHint, }) {
1328
2139
  }
1329
2140
  // Handle Arrow Functions: (p) => p.prop, (a, b) => { ... }
1330
2141
  if (ts.isArrowFunction(unwrappedNode)) {
2142
+ // If this arrow function is a child boundary (e.g., a .map() callback),
2143
+ // don't process its parameters here - they will be processed when the
2144
+ // child scope is analyzed separately. This prevents parameter variables
2145
+ // from leaking into the parent scope's equivalencies.
2146
+ // Check if this arrow function is a child boundary (i.e., should be processed
2147
+ // as a separate child scope, not here in the parent scope).
2148
+ //
2149
+ // We use two checks because childBoundary positions can be unreliable:
2150
+ // 1. Position-based check (standard isChildBoundary)
2151
+ // 2. Text-based check: if the arrow function text doesn't appear in the
2152
+ // statement text, it was replaced with a cyScope placeholder
2153
+ const isChildBoundary = context.isChildBoundary(unwrappedNode);
2154
+ // Text-based child scope detection for when positions are unreliable
2155
+ const arrowFnText = unwrappedNode.getText(context.sourceFile);
2156
+ const firstLine = arrowFnText.split('\n')[0].trim();
2157
+ const searchText = firstLine.substring(0, Math.min(20, firstLine.length));
2158
+ const isInStatementText = context.statementInfo.text.includes(searchText);
2159
+ const isChildScope = !isInStatementText && arrowFnText.length > 10;
2160
+ if (isChildBoundary || isChildScope) {
2161
+ // The method semantics (e.g., ArrayMapSemantics) have already established
2162
+ // the necessary equivalences between the child scope placeholder and array elements
2163
+ if (targetPath) {
2164
+ context.addType(targetPath, 'function');
2165
+ }
2166
+ return true;
2167
+ }
1331
2168
  // Create a path for the function
1332
2169
  const functionPath = StructuredPath.empty();
1333
2170
  // Process parameters