@codeyam/codeyam-cli 0.1.0-staging.1669d45 → 0.1.0-staging.323686

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 (362) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +3 -3
  4. package/analyzer-template/packages/ai/index.ts +9 -1
  5. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +48 -34
  6. package/analyzer-template/packages/ai/src/lib/astScopes/arrayDerivationDetector.ts +199 -0
  7. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +31 -0
  8. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +139 -23
  9. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.ts +6 -126
  10. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +277 -8
  11. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +73 -1
  12. package/analyzer-template/packages/ai/src/lib/completionCall.ts +198 -34
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +108 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +205 -0
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +10 -2
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +23 -0
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +87 -2
  18. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +32 -7
  19. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.ts +129 -0
  20. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +156 -0
  21. package/analyzer-template/packages/ai/src/lib/e2eDataTracking.ts +334 -0
  22. package/analyzer-template/packages/ai/src/lib/extractCriticalDataKeys.ts +120 -0
  23. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +626 -6
  24. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +26 -1
  25. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +375 -6
  26. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +1003 -45
  27. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.ts +239 -0
  28. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChunkPrompt.ts +82 -0
  29. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateCriticalKeysPrompt.ts +103 -0
  30. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +23 -6
  31. package/analyzer-template/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.ts +391 -0
  32. package/analyzer-template/packages/ai/src/lib/resolvePathToControllable.ts +154 -32
  33. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +22 -1
  34. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +114 -2
  35. package/analyzer-template/packages/analyze/src/lib/analysisContext.ts +44 -4
  36. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +10 -13
  37. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +6 -0
  38. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +33 -7
  39. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +142 -73
  40. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +42 -5
  41. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +1 -1
  42. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +77 -0
  43. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.ts +56 -11
  44. package/analyzer-template/packages/aws/package.json +1 -1
  45. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -1
  46. package/analyzer-template/packages/database/src/lib/kysely/tables/commitsTable.ts +6 -0
  47. package/analyzer-template/packages/database/src/lib/loadAnalyses.ts +58 -1
  48. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +13 -0
  49. package/analyzer-template/packages/database/src/lib/loadBranch.ts +16 -1
  50. package/analyzer-template/packages/database/src/lib/loadCommit.ts +11 -0
  51. package/analyzer-template/packages/database/src/lib/loadCommits.ts +28 -0
  52. package/analyzer-template/packages/database/src/lib/loadEntities.ts +26 -3
  53. package/analyzer-template/packages/database/src/lib/loadEntityBranches.ts +12 -0
  54. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +7 -14
  55. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  56. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +8 -1
  57. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  58. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  59. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts +1 -0
  60. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.d.ts.map +1 -1
  61. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js +3 -0
  62. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  63. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts +2 -0
  64. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.d.ts.map +1 -1
  65. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js +45 -2
  66. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalyses.js.map +1 -1
  67. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  68. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +8 -0
  69. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  70. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js +11 -1
  71. package/analyzer-template/packages/github/dist/database/src/lib/loadBranch.js.map +1 -1
  72. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.d.ts.map +1 -1
  73. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js +7 -0
  74. package/analyzer-template/packages/github/dist/database/src/lib/loadCommit.js.map +1 -1
  75. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts +3 -1
  76. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  77. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +22 -1
  78. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  79. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts +3 -1
  80. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  81. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +23 -4
  82. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  83. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.d.ts.map +1 -1
  84. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js +9 -0
  85. package/analyzer-template/packages/github/dist/database/src/lib/loadEntityBranches.js.map +1 -1
  86. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts +2 -2
  87. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  88. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +5 -4
  89. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  90. package/analyzer-template/packages/github/dist/types/index.d.ts +1 -1
  91. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  92. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  93. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +25 -1
  94. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  95. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts +2 -0
  96. package/analyzer-template/packages/github/dist/types/src/types/Commit.d.ts.map +1 -1
  97. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +51 -1
  98. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  99. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts +9 -1
  100. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  101. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js +29 -3
  102. package/analyzer-template/packages/github/dist/utils/src/lib/safeFileName.js.map +1 -1
  103. package/analyzer-template/packages/types/index.ts +1 -0
  104. package/analyzer-template/packages/types/src/types/Analysis.ts +25 -0
  105. package/analyzer-template/packages/types/src/types/Commit.ts +2 -0
  106. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +64 -1
  107. package/analyzer-template/packages/utils/dist/types/index.d.ts +1 -1
  108. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  109. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  110. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +25 -1
  111. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  112. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts +2 -0
  113. package/analyzer-template/packages/utils/dist/types/src/types/Commit.d.ts.map +1 -1
  114. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +51 -1
  115. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  116. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts +9 -1
  117. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.d.ts.map +1 -1
  118. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js +29 -3
  119. package/analyzer-template/packages/utils/dist/utils/src/lib/safeFileName.js.map +1 -1
  120. package/analyzer-template/packages/utils/src/lib/safeFileName.ts +48 -3
  121. package/analyzer-template/playwright/capture.ts +20 -8
  122. package/analyzer-template/playwright/captureStatic.ts +1 -1
  123. package/analyzer-template/project/analyzeBaselineCommit.ts +5 -0
  124. package/analyzer-template/project/analyzeRegularCommit.ts +5 -0
  125. package/analyzer-template/project/captureLibraryFunctionDirect.ts +29 -26
  126. package/analyzer-template/project/constructMockCode.ts +314 -29
  127. package/analyzer-template/project/createEntitiesAndSortFiles.ts +83 -0
  128. package/analyzer-template/project/loadReadyToBeCaptured.ts +65 -41
  129. package/analyzer-template/project/orchestrateCapture/AwsCaptureTaskRunner.ts +12 -4
  130. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +18 -7
  131. package/analyzer-template/project/orchestrateCapture/taskRunner.ts +4 -2
  132. package/analyzer-template/project/orchestrateCapture.ts +71 -6
  133. package/analyzer-template/project/reconcileMockDataKeys.ts +152 -9
  134. package/analyzer-template/project/runAnalysis.ts +4 -0
  135. package/analyzer-template/project/start.ts +35 -11
  136. package/analyzer-template/project/writeMockDataTsx.ts +114 -2
  137. package/analyzer-template/project/writeScenarioComponents.ts +101 -8
  138. package/analyzer-template/scripts/comboWorkerLoop.cjs +98 -50
  139. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js +5 -0
  140. package/background/src/lib/virtualized/project/analyzeBaselineCommit.js.map +1 -1
  141. package/background/src/lib/virtualized/project/analyzeRegularCommit.js +5 -0
  142. package/background/src/lib/virtualized/project/analyzeRegularCommit.js.map +1 -1
  143. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js +3 -3
  144. package/background/src/lib/virtualized/project/captureLibraryFunctionDirect.js.map +1 -1
  145. package/background/src/lib/virtualized/project/constructMockCode.js +255 -4
  146. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  147. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js +73 -1
  148. package/background/src/lib/virtualized/project/createEntitiesAndSortFiles.js.map +1 -1
  149. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js +19 -8
  150. package/background/src/lib/virtualized/project/loadReadyToBeCaptured.js.map +1 -1
  151. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js +2 -2
  152. package/background/src/lib/virtualized/project/orchestrateCapture/AwsCaptureTaskRunner.js.map +1 -1
  153. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +7 -5
  154. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  155. package/background/src/lib/virtualized/project/orchestrateCapture.js +58 -6
  156. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  157. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +126 -9
  158. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  159. package/background/src/lib/virtualized/project/runAnalysis.js +3 -0
  160. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  161. package/background/src/lib/virtualized/project/start.js +32 -11
  162. package/background/src/lib/virtualized/project/start.js.map +1 -1
  163. package/background/src/lib/virtualized/project/writeMockDataTsx.js +89 -2
  164. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  165. package/background/src/lib/virtualized/project/writeScenarioComponents.js +57 -8
  166. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  167. package/codeyam-cli/src/cli.js +2 -0
  168. package/codeyam-cli/src/cli.js.map +1 -1
  169. package/codeyam-cli/src/commands/memory.js +273 -0
  170. package/codeyam-cli/src/commands/memory.js.map +1 -0
  171. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +4 -0
  172. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  173. package/codeyam-cli/src/utils/analysisRunner.js +21 -2
  174. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  175. package/codeyam-cli/src/utils/install-skills.js +20 -6
  176. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  177. package/codeyam-cli/src/utils/queue/job.js +1 -0
  178. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  179. package/codeyam-cli/src/utils/queue/manager.js +6 -0
  180. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  181. package/codeyam-cli/src/utils/rules/index.js +5 -0
  182. package/codeyam-cli/src/utils/rules/index.js.map +1 -0
  183. package/codeyam-cli/src/utils/rules/parser.js +106 -0
  184. package/codeyam-cli/src/utils/rules/parser.js.map +1 -0
  185. package/codeyam-cli/src/utils/rules/pathMatcher.js +18 -0
  186. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -0
  187. package/codeyam-cli/src/utils/rules/staleness.js +132 -0
  188. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -0
  189. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +2 -0
  190. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  191. package/codeyam-cli/src/webserver/app/lib/database.js +7 -3
  192. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  193. package/codeyam-cli/src/webserver/bootstrap.js +40 -0
  194. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  195. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-DsN1wKrm.js +11 -0
  196. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-COi5OvsN.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
  197. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BwdQv49w.js → EntityTypeIcon-Ba2JVPzP.js} +1 -1
  198. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-CEleMv_j.js → InlineSpinner-C8lyxW9k.js} +1 -1
  199. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D68KarMg.js → InteractivePreview-aht4aafF.js} +2 -2
  200. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-L75Wvqgw.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
  201. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-C53WM8qn.js → LoadingDots-B0GLXMsr.js} +1 -1
  202. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CrNkmy4i.js → LogViewer-xgeCVgSM.js} +1 -1
  203. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-OApQuNyq.js +16 -0
  204. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CQifa1n-.js → SafeScreenshot-DuDvi0jm.js} +1 -1
  205. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CyaBFX7l.js → ScenarioViewer-DzccYyI8.js} +3 -13
  206. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D36O1rzU.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
  207. package/codeyam-cli/src/webserver/build/client/assets/_index-BwqWJOgH.js +11 -0
  208. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BwavGCpm.js +32 -0
  209. package/codeyam-cli/src/webserver/build/client/assets/api.health-l0sNRNKZ.js +1 -0
  210. package/codeyam-cli/src/webserver/build/client/assets/api.memory-profile-l0sNRNKZ.js +1 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/api.restart-server-l0sNRNKZ.js +1 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DgTPh8H-.js → chevron-down-Cx24_aWc.js} +1 -1
  213. package/codeyam-cli/src/webserver/build/client/assets/{chunk-EPOLDU6W-DdQKK6on.js → chunk-EPOLDU6W-CXRTFQ3F.js} +1 -1
  214. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-Dmr2bb1R.js → circle-check-BOARzkeR.js} +1 -1
  215. package/codeyam-cli/src/webserver/build/client/assets/copy-Bb-80kDT.js +6 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Do4ZLUYa.js → createLucideIcon-BdhJEx6B.js} +1 -1
  217. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BBnGWYga.js +1 -0
  218. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CbdFyxZh.js → entity._sha._-BJUiQqZF.js} +12 -12
  219. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-B4iCfs5M.js → entity._sha.scenarios._scenarioId.fullscreen-DavjRmOY.js} +1 -1
  220. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-wDWZZO1W.js → entity._sha_.create-scenario-D1T4TGjf.js} +1 -1
  221. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMbl7MeQ.js → entity._sha_.edit._scenarioId-CTBG2mmz.js} +1 -1
  222. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-5wRKRIH9.js → entry.client-CS2cb_eZ.js} +1 -1
  223. package/codeyam-cli/src/webserver/build/client/assets/file-code-Dhef1kWN.js +6 -0
  224. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DD3SDH7t.js → fileTableUtils-DMJ7zii9.js} +1 -1
  225. package/codeyam-cli/src/webserver/build/client/assets/files-CJ6lTdTA.js +1 -0
  226. package/codeyam-cli/src/webserver/build/client/assets/{git-zXjT7J0G.js → git-CPTZZ-JZ.js} +8 -8
  227. package/codeyam-cli/src/webserver/build/client/assets/globals-D3yhhV8x.css +1 -0
  228. package/codeyam-cli/src/webserver/build/client/assets/{index-DLbXwndH.js → index-B1h680n5.js} +1 -1
  229. package/codeyam-cli/src/webserver/build/client/assets/{index-gPZ-lad1.js → index-lzqtyFU8.js} +1 -1
  230. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BsPXJ81F.js → loader-circle-B7B9V-bu.js} +1 -1
  231. package/codeyam-cli/src/webserver/build/client/assets/manifest-7522edd4.js +1 -0
  232. package/codeyam-cli/src/webserver/build/client/assets/memory-yxFcrxBX.js +92 -0
  233. package/codeyam-cli/src/webserver/build/client/assets/root-eVAaavTS.js +62 -0
  234. package/codeyam-cli/src/webserver/build/client/assets/{search-P2FKIUql.js → search-CxXUmBSd.js} +1 -1
  235. package/codeyam-cli/src/webserver/build/client/assets/{settings-B2eDuBj8.js → settings-CS5f3WzT.js} +1 -1
  236. package/codeyam-cli/src/webserver/build/client/assets/{simulations-L18M6-kN.js → simulations-DwFIBT09.js} +1 -1
  237. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BDz7kbVA.js → triangle-alert-B6LgvRJg.js} +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-29dDmbH8.js → useCustomSizes-C1v1PQzo.js} +1 -1
  239. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BUm0UVJm.js → useLastLogLine-aSv48UbS.js} +1 -1
  240. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CkIOKTrZ.js → useReportContext-DYxHZQuP.js} +1 -1
  241. package/codeyam-cli/src/webserver/build/client/assets/{useToast-KKw5kTn-.js → useToast-mBRpZPiu.js} +1 -1
  242. package/codeyam-cli/src/webserver/build/server/assets/index-DVzYx8PN.js +1 -0
  243. package/codeyam-cli/src/webserver/build/server/assets/server-build-4Cr0uToj.js +257 -0
  244. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  245. package/codeyam-cli/src/webserver/build-info.json +5 -5
  246. package/codeyam-cli/templates/codeyam-memory-hook.sh +200 -0
  247. package/codeyam-cli/templates/codeyam:debug.md +47 -3
  248. package/codeyam-cli/templates/codeyam:diagnose.md +203 -25
  249. package/codeyam-cli/templates/codeyam:memory.md +462 -0
  250. package/codeyam-cli/templates/codeyam:new-rule.md +13 -0
  251. package/package.json +8 -5
  252. package/packages/ai/index.js +5 -2
  253. package/packages/ai/index.js.map +1 -1
  254. package/packages/ai/src/lib/analyzeScope.js +41 -17
  255. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  256. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js +150 -0
  257. package/packages/ai/src/lib/astScopes/arrayDerivationDetector.js.map +1 -0
  258. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +24 -0
  259. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  260. package/packages/ai/src/lib/astScopes/methodSemantics.js +109 -23
  261. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  262. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js +1 -102
  263. package/packages/ai/src/lib/astScopes/patterns/variableDeclarationHandler.js.map +1 -1
  264. package/packages/ai/src/lib/astScopes/processExpression.js +228 -11
  265. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  266. package/packages/ai/src/lib/completionCall.js +161 -30
  267. package/packages/ai/src/lib/completionCall.js.map +1 -1
  268. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +86 -1
  269. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  270. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +179 -0
  271. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
  272. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +7 -1
  273. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  274. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +19 -0
  275. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  276. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +70 -2
  277. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  278. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +29 -7
  279. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  280. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js +107 -0
  281. package/packages/ai/src/lib/dataStructure/helpers/fixNullIdsBySchema.js.map +1 -0
  282. package/packages/ai/src/lib/dataStructureChunking.js +111 -0
  283. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -0
  284. package/packages/ai/src/lib/e2eDataTracking.js +241 -0
  285. package/packages/ai/src/lib/e2eDataTracking.js.map +1 -0
  286. package/packages/ai/src/lib/extractCriticalDataKeys.js +96 -0
  287. package/packages/ai/src/lib/extractCriticalDataKeys.js.map +1 -0
  288. package/packages/ai/src/lib/generateEntityScenarioData.js +510 -7
  289. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  290. package/packages/ai/src/lib/generateEntityScenarios.js +19 -1
  291. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  292. package/packages/ai/src/lib/generateExecutionFlows.js +273 -4
  293. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  294. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +738 -40
  295. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  296. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js +194 -0
  297. package/packages/ai/src/lib/generateExecutionFlowsFromJsxUsages.js.map +1 -0
  298. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js +54 -0
  299. package/packages/ai/src/lib/promptGenerators/generateChunkPrompt.js.map +1 -0
  300. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +15 -7
  301. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  302. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js +335 -0
  303. package/packages/ai/src/lib/promptGenerators/simplifyKeysForLLM.js.map +1 -0
  304. package/packages/ai/src/lib/resolvePathToControllable.js +131 -27
  305. package/packages/ai/src/lib/resolvePathToControllable.js.map +1 -1
  306. package/packages/ai/src/lib/worker/SerializableDataStructure.js +7 -0
  307. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  308. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +94 -1
  309. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  310. package/packages/analyze/src/lib/analysisContext.js +30 -5
  311. package/packages/analyze/src/lib/analysisContext.js.map +1 -1
  312. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +8 -4
  313. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  314. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +5 -0
  315. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  316. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +31 -7
  317. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  318. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +116 -66
  319. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  320. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +37 -5
  321. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  322. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +1 -1
  323. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  324. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +65 -0
  325. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  326. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js +46 -9
  327. package/packages/analyze/src/lib/files/scenarios/mergeValidatedDataStructures.js.map +1 -1
  328. package/packages/database/src/lib/kysely/db.js +8 -1
  329. package/packages/database/src/lib/kysely/db.js.map +1 -1
  330. package/packages/database/src/lib/kysely/tables/commitsTable.js +3 -0
  331. package/packages/database/src/lib/kysely/tables/commitsTable.js.map +1 -1
  332. package/packages/database/src/lib/loadAnalyses.js +45 -2
  333. package/packages/database/src/lib/loadAnalyses.js.map +1 -1
  334. package/packages/database/src/lib/loadAnalysis.js +8 -0
  335. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  336. package/packages/database/src/lib/loadBranch.js +11 -1
  337. package/packages/database/src/lib/loadBranch.js.map +1 -1
  338. package/packages/database/src/lib/loadCommit.js +7 -0
  339. package/packages/database/src/lib/loadCommit.js.map +1 -1
  340. package/packages/database/src/lib/loadCommits.js +22 -1
  341. package/packages/database/src/lib/loadCommits.js.map +1 -1
  342. package/packages/database/src/lib/loadEntities.js +23 -4
  343. package/packages/database/src/lib/loadEntities.js.map +1 -1
  344. package/packages/database/src/lib/loadEntityBranches.js +9 -0
  345. package/packages/database/src/lib/loadEntityBranches.js.map +1 -1
  346. package/packages/database/src/lib/updateCommitMetadata.js +5 -4
  347. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  348. package/packages/types/index.js.map +1 -1
  349. package/packages/utils/src/lib/safeFileName.js +29 -3
  350. package/packages/utils/src/lib/safeFileName.js.map +1 -1
  351. package/scripts/finalize-analyzer.cjs +3 -3
  352. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-vauWK972.js +0 -1
  353. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-DzJRkCkr.js +0 -11
  354. package/codeyam-cli/src/webserver/build/client/assets/_index-Be83mo_j.js +0 -11
  355. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BN6wu6Y-.js +0 -37
  356. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Bn6aCAy_.js +0 -1
  357. package/codeyam-cli/src/webserver/build/client/assets/files-DKyMFI90.js +0 -1
  358. package/codeyam-cli/src/webserver/build/client/assets/globals-DTTQ3gY7.css +0 -1
  359. package/codeyam-cli/src/webserver/build/client/assets/manifest-22590fcf.js +0 -1
  360. package/codeyam-cli/src/webserver/build/client/assets/root-BsAarjAM.js +0 -57
  361. package/codeyam-cli/src/webserver/build/server/assets/index-BND5I5fv.js +0 -1
  362. package/codeyam-cli/src/webserver/build/server/assets/server-build-CFXnd7MG.js +0 -228
@@ -23,6 +23,7 @@ import {
23
23
  extractConditionalEffectsFromTernary,
24
24
  findUseStateSetters,
25
25
  } from './conditionalEffectsExtractor';
26
+ import { detectArrayDerivedPattern } from './arrayDerivationDetector';
26
27
 
27
28
  /**
28
29
  * Extracts the component name from a JSX element.
@@ -368,6 +369,149 @@ function getSourceLocation(
368
369
  };
369
370
  }
370
371
 
372
+ /**
373
+ * Extracts the root array path from an expression that ends with .map().
374
+ * Handles chained methods like .filter().map(), .slice().map(), etc.
375
+ *
376
+ * Examples:
377
+ * - items.map(...) → "items"
378
+ * - data.users.map(...) → "data.users"
379
+ * - items.filter(...).map(...) → "items"
380
+ * - items.slice(0, 5).map(...) → "items"
381
+ */
382
+ function extractArrayPathFromMapCall(
383
+ expr: ts.CallExpression,
384
+ sourceFile: ts.SourceFile,
385
+ ): string | null {
386
+ // Walk up the chain to find the root array
387
+ let current: ts.Expression = expr.expression;
388
+
389
+ while (ts.isPropertyAccessExpression(current)) {
390
+ const methodName = current.name.getText(sourceFile);
391
+
392
+ // Common array methods that return arrays (so we keep going up)
393
+ const arrayReturningMethods = [
394
+ 'map',
395
+ 'filter',
396
+ 'slice',
397
+ 'concat',
398
+ 'flat',
399
+ 'flatMap',
400
+ 'reverse',
401
+ 'sort',
402
+ 'toReversed',
403
+ 'toSorted',
404
+ 'toSpliced',
405
+ ];
406
+
407
+ if (arrayReturningMethods.includes(methodName)) {
408
+ const objectExpr = current.expression;
409
+
410
+ // If the object is a call expression (chained method), keep going
411
+ if (ts.isCallExpression(objectExpr)) {
412
+ current = objectExpr.expression;
413
+ } else {
414
+ // Found the root - it's an identifier or property access
415
+ const path = StructuredPath.fromNode(objectExpr, sourceFile);
416
+ return path ? path.toString() : null;
417
+ }
418
+ } else {
419
+ // Not an array method we recognize
420
+ break;
421
+ }
422
+ }
423
+
424
+ return null;
425
+ }
426
+
427
+ /**
428
+ * Extracts JSX rendering usages from a JSX expression.
429
+ * Detects:
430
+ * - array.map() calls → 'array-map' type
431
+ * - string interpolations (identifiers/property access) → 'text-interpolation' type
432
+ *
433
+ * Recursively searches inside && chains and ternary expressions.
434
+ *
435
+ * @param expr The expression inside {expr}
436
+ * @param context The analysis context
437
+ */
438
+ function extractJsxRenderingUsage(
439
+ expr: ts.Expression,
440
+ context: AnalysisContext,
441
+ ): void {
442
+ const unwrapped = unwrapExpression(expr);
443
+ const sourceLocation = getSourceLocation(expr, context.sourceFile);
444
+
445
+ // Detect array.map() calls
446
+ if (ts.isCallExpression(unwrapped)) {
447
+ const calleeExpr = unwrapped.expression;
448
+
449
+ if (ts.isPropertyAccessExpression(calleeExpr)) {
450
+ const methodName = calleeExpr.name.getText(context.sourceFile);
451
+
452
+ if (methodName === 'map') {
453
+ const arrayPath = extractArrayPathFromMapCall(
454
+ unwrapped,
455
+ context.sourceFile,
456
+ );
457
+
458
+ if (arrayPath) {
459
+ context.addJsxRenderingUsage({
460
+ path: arrayPath,
461
+ renderingType: 'array-map',
462
+ valueType: 'array',
463
+ sourceLocation,
464
+ });
465
+ }
466
+ }
467
+ }
468
+ }
469
+ // Detect simple string interpolations: {title} or {user.name}
470
+ else if (
471
+ ts.isIdentifier(unwrapped) ||
472
+ ts.isPropertyAccessExpression(unwrapped)
473
+ ) {
474
+ const path = StructuredPath.fromNode(unwrapped, context.sourceFile);
475
+
476
+ if (path) {
477
+ const pathStr = path.toString();
478
+ const typeInfo = context.getTypeInfo(path);
479
+
480
+ // Only track as text interpolation if it's a string type
481
+ // Check for 'string' type, or types that contain 'string' (but not 'string[]')
482
+ if (
483
+ typeInfo === 'string' ||
484
+ (typeInfo &&
485
+ typeInfo.includes('string') &&
486
+ !typeInfo.includes('string[]'))
487
+ ) {
488
+ context.addJsxRenderingUsage({
489
+ path: pathStr,
490
+ renderingType: 'text-interpolation',
491
+ valueType: 'string',
492
+ sourceLocation,
493
+ });
494
+ }
495
+ }
496
+ }
497
+ // Recursively search inside && chains: {showList && items.map(...)}
498
+ else if (
499
+ ts.isBinaryExpression(unwrapped) &&
500
+ unwrapped.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken
501
+ ) {
502
+ // Check the right side of the && chain (where .map() typically appears)
503
+ const rightSide = unwrapExpression(unwrapped.right);
504
+ extractJsxRenderingUsage(rightSide, context);
505
+ // Also check nested && chains on the left
506
+ extractJsxRenderingUsage(unwrapped.left, context);
507
+ }
508
+ // Recursively search inside ternaries: {isEmpty ? null : items.map(...)}
509
+ else if (ts.isConditionalExpression(unwrapped)) {
510
+ extractJsxRenderingUsage(unwrapped.whenTrue, context);
511
+ extractJsxRenderingUsage(unwrapped.whenFalse, context);
512
+ }
513
+ }
514
+
371
515
  /**
372
516
  * Counts the number of conditions in an && chain (excluding JSX consequence)
373
517
  */
@@ -404,6 +548,12 @@ interface ChainInfo {
404
548
  chainExpression: string;
405
549
  currentPosition: number;
406
550
  compound: CompoundConditional;
551
+ /**
552
+ * When processing OR expressions within an && chain, this tracks the
553
+ * current OR group ID. Conditions added while this is set will be marked
554
+ * as OR alternatives (only one needs to be true).
555
+ */
556
+ currentOrGroupId?: string;
407
557
  }
408
558
 
409
559
  /**
@@ -460,6 +610,10 @@ function extractConditionalsFromJsx(
460
610
  if (ts.isJsxExpression(child) && child.expression) {
461
611
  const expr = unwrapExpression(child.expression);
462
612
 
613
+ // Extract JSX rendering usages (array.map, text interpolation)
614
+ // This handles direct usages like {items.map(...)} or {user.name}
615
+ extractJsxRenderingUsage(expr, context);
616
+
463
617
  // If the expression is an && chain, extract its conditional usages
464
618
  if (
465
619
  ts.isBinaryExpression(expr) &&
@@ -766,8 +920,42 @@ function extractConditionalsFromJsx(
766
920
  }
767
921
  // Recursively process nested JSX elements - Fix 32: pass parent conditions
768
922
  else if (ts.isJsxElement(child)) {
923
+ // Check if this is a user-defined component (vs intrinsic element like div)
924
+ // If it's a component AND there are parent conditions, record the gating conditions
925
+ const componentName = getComponentNameFromJsx(child);
926
+ if (componentName && parentConditions.length > 0) {
927
+ for (const condition of parentConditions) {
928
+ context.addChildBoundaryGatingCondition(componentName, {
929
+ path: condition.path,
930
+ conditionType: 'truthiness',
931
+ location: 'ternary',
932
+ sourceLocation: condition.sourceLocation,
933
+ controlsJsxRendering: true,
934
+ isNegated: condition.isNegated,
935
+ });
936
+ }
937
+ }
769
938
  extractConditionalsFromJsx(child, context, parentConditions);
770
939
  }
940
+ // Handle self-closing JSX elements (e.g., <ScenarioViewer />)
941
+ else if (ts.isJsxSelfClosingElement(child)) {
942
+ // Check if this is a user-defined component (vs intrinsic element like div)
943
+ // If it's a component AND there are parent conditions, record the gating conditions
944
+ const componentName = getComponentNameFromJsx(child);
945
+ if (componentName && parentConditions.length > 0) {
946
+ for (const condition of parentConditions) {
947
+ context.addChildBoundaryGatingCondition(componentName, {
948
+ path: condition.path,
949
+ conditionType: 'truthiness',
950
+ location: 'ternary',
951
+ sourceLocation: condition.sourceLocation,
952
+ controlsJsxRendering: true,
953
+ isNegated: condition.isNegated,
954
+ });
955
+ }
956
+ }
957
+ // Self-closing elements have no children, so no recursion needed
958
+ }
771
959
  // Recursively process nested JSX fragments - Fix 32: pass parent conditions
772
960
  else if (ts.isJsxFragment(child)) {
773
961
  extractConditionalsFromJsx(child, context, parentConditions);
@@ -870,14 +1058,37 @@ export function extractConditionalUsage(
870
1058
  }
871
1059
 
872
1060
  // Handle binary expressions with || (logical OR)
873
- // OR breaks the chain - each side is independent
1061
+ // When OR is inside an && chain, we need to continue chain tracking
1062
+ // and mark conditions as OR alternatives
874
1063
  if (
875
1064
  ts.isBinaryExpression(unwrapped) &&
876
1065
  unwrapped.operatorToken.kind === ts.SyntaxKind.BarBarToken
877
1066
  ) {
878
- // Both sides of || are independent conditional checks (no chain tracking)
879
- extractWithChainTracking(unwrapped.left, null, false);
880
- extractWithChainTracking(unwrapped.right, null, false);
1067
+ if (chainInfo) {
1068
+ // We're inside an && chain - continue tracking but mark as OR alternatives
1069
+ // Generate an orGroupId so conditions from both sides can be grouped
1070
+ const orGroupId =
1071
+ chainInfo.currentOrGroupId ?? `or_${crypto.randomUUID().slice(0, 8)}`;
1072
+
1073
+ // Process left side with OR group tracking
1074
+ const leftChainInfo = {
1075
+ ...chainInfo,
1076
+ currentOrGroupId: orGroupId,
1077
+ };
1078
+ extractWithChainTracking(unwrapped.left, leftChainInfo, false);
1079
+
1080
+ // Process right side with same OR group
1081
+ // Note: we use leftChainInfo's currentPosition which may have been updated
1082
+ const rightChainInfo = {
1083
+ ...leftChainInfo,
1084
+ currentPosition: chainInfo.currentPosition,
1085
+ };
1086
+ extractWithChainTracking(unwrapped.right, rightChainInfo, false);
1087
+ } else {
1088
+ // Not inside a chain - OR breaks into independent conditional checks
1089
+ extractWithChainTracking(unwrapped.left, null, false);
1090
+ extractWithChainTracking(unwrapped.right, null, false);
1091
+ }
881
1092
  return;
882
1093
  }
883
1094
 
@@ -922,6 +1133,7 @@ export function extractConditionalUsage(
922
1133
  conditionType: 'comparison' | 'truthiness',
923
1134
  comparedValues?: string[],
924
1135
  requiredValue?: string | boolean,
1136
+ sourceExpr?: ts.Expression,
925
1137
  ) => {
926
1138
  const usage: ConditionalUsage = {
927
1139
  path,
@@ -933,6 +1145,17 @@ export function extractConditionalUsage(
933
1145
  controlsJsxRendering,
934
1146
  };
935
1147
 
1148
+ // Check for inline array-derived patterns (.length) on the source expression
1149
+ if (sourceExpr) {
1150
+ const arrayDerived = detectArrayDerivedPattern(sourceExpr);
1151
+ if (arrayDerived) {
1152
+ usage.derivedFrom = {
1153
+ operation: arrayDerived.operation,
1154
+ sourcePath: arrayDerived.sourcePath,
1155
+ };
1156
+ }
1157
+ }
1158
+
936
1159
  // Add chain info if part of a compound conditional
937
1160
  if (chainInfo) {
938
1161
  usage.chainId = chainInfo.chainId;
@@ -948,6 +1171,9 @@ export function extractConditionalUsage(
948
1171
  comparedValues,
949
1172
  isNegated,
950
1173
  requiredValue,
1174
+ ...(chainInfo.currentOrGroupId && {
1175
+ orGroupId: chainInfo.currentOrGroupId,
1176
+ }),
951
1177
  });
952
1178
  }
953
1179
 
@@ -962,6 +1188,7 @@ export function extractConditionalUsage(
962
1188
  'comparison',
963
1189
  literalValue !== undefined ? [literalValue] : undefined,
964
1190
  getRequiredValue(literalValue, isNegated),
1191
+ unwrapped.left, // Pass source expression for array derivation detection
965
1192
  );
966
1193
  return;
967
1194
  }
@@ -974,16 +1201,29 @@ export function extractConditionalUsage(
974
1201
  'comparison',
975
1202
  literalValue !== undefined ? [literalValue] : undefined,
976
1203
  getRequiredValue(literalValue, isNegated),
1204
+ unwrapped.right, // Pass source expression for array derivation detection
977
1205
  );
978
1206
  return;
979
1207
  }
980
1208
 
981
1209
  // Both sides are variables - record both as comparisons without specific values
982
1210
  if (leftPath) {
983
- addCondition(leftPath.toLeftHandSideString(), 'comparison');
1211
+ addCondition(
1212
+ leftPath.toLeftHandSideString(),
1213
+ 'comparison',
1214
+ undefined,
1215
+ undefined,
1216
+ unwrapped.left,
1217
+ );
984
1218
  }
985
1219
  if (rightPath) {
986
- addCondition(rightPath.toLeftHandSideString(), 'comparison');
1220
+ addCondition(
1221
+ rightPath.toLeftHandSideString(),
1222
+ 'comparison',
1223
+ undefined,
1224
+ undefined,
1225
+ unwrapped.right,
1226
+ );
987
1227
  }
988
1228
  return;
989
1229
  }
@@ -1012,6 +1252,16 @@ export function extractConditionalUsage(
1012
1252
  controlsJsxRendering,
1013
1253
  };
1014
1254
 
1255
+ // Check for inline array-derived patterns (.some(), .every(), .includes(), .length)
1256
+ // This populates derivedFrom so downstream code can resolve to the base array path
1257
+ const arrayDerived = detectArrayDerivedPattern(unwrapped);
1258
+ if (arrayDerived) {
1259
+ usage.derivedFrom = {
1260
+ operation: arrayDerived.operation,
1261
+ sourcePath: arrayDerived.sourcePath,
1262
+ };
1263
+ }
1264
+
1015
1265
  // Add chain info if part of a compound conditional
1016
1266
  if (chainInfo) {
1017
1267
  usage.chainId = chainInfo.chainId;
@@ -1027,6 +1277,9 @@ export function extractConditionalUsage(
1027
1277
  conditionType: 'truthiness',
1028
1278
  isNegated,
1029
1279
  requiredValue: !isNegated,
1280
+ ...(chainInfo.currentOrGroupId && {
1281
+ orGroupId: chainInfo.currentOrGroupId,
1282
+ }),
1030
1283
  });
1031
1284
  }
1032
1285
 
@@ -1686,15 +1939,31 @@ export function processExpression({
1686
1939
  );
1687
1940
  }
1688
1941
  } else if (operatorKind === ts.SyntaxKind.BarBarToken) {
1689
- // For ||, also create an equivalence to the left side
1942
+ // For ||, create equivalences to BOTH sides
1690
1943
  // This enables data flow tracing through fallback expressions
1944
+ // e.g., `const item = items.find(...) || null` should trace to both:
1945
+ // - items[] (from the find result)
1946
+ // - null (from the fallback)
1691
1947
  if (targetPath) {
1948
+ // Process left side recursively to capture its full equivalency chain
1949
+ processExpression({
1950
+ node: unwrappedNode.left,
1951
+ context,
1952
+ targetPath,
1953
+ });
1954
+ // Process right side recursively for completeness
1955
+ processExpression({
1956
+ node: unwrappedNode.right,
1957
+ context,
1958
+ targetPath,
1959
+ });
1960
+ // Set resultPath to left side for type inference
1692
1961
  resultPath = StructuredPath.fromNode(
1693
1962
  unwrappedNode.left,
1694
1963
  context.sourceFile,
1695
1964
  );
1696
1965
  }
1697
- // Note: Unlike ??, we don't set targetPath when there's no target
1966
+ // Note: When there's no targetPath, we don't recursively process
1698
1967
  // because || is often used in boolean contexts where the full expression matters
1699
1968
  }
1700
1969
  } else if (operatorKind === ts.SyntaxKind.InstanceOfKeyword) {
@@ -217,6 +217,7 @@ export interface ConditionalEffect {
217
217
  * - equals/notEquals: value comparisons (x === 'value', x !== 'value')
218
218
  * - or/and: logical combinations (a || b, a && b)
219
219
  * - arrayIncludes/arraySome/arrayEvery: array predicate methods
220
+ * - arrayLength: array.length property access
220
221
  */
221
222
  export type DerivedVariableOperation =
222
223
  | 'notNull'
@@ -227,7 +228,8 @@ export type DerivedVariableOperation =
227
228
  | 'and'
228
229
  | 'arrayIncludes'
229
230
  | 'arraySome'
230
- | 'arrayEvery';
231
+ | 'arrayEvery'
232
+ | 'arrayLength';
231
233
 
232
234
  /**
233
235
  * Information about how a variable was derived from other variables.
@@ -244,6 +246,43 @@ export interface DerivedVariableInfo {
244
246
  comparedValue?: string;
245
247
  }
246
248
 
249
+ /**
250
+ * Represents a JSX rendering usage where arrays or strings are rendered directly.
251
+ * Used to generate execution flows for array sizes and text lengths
252
+ * even without explicit conditionals.
253
+ *
254
+ * Examples:
255
+ * - `{items.map(i => <Item {...i} />)}` → array-map usage for 'items'
256
+ * - `{user.name}` → text-interpolation usage for 'user.name'
257
+ */
258
+ export interface JsxRenderingUsage {
259
+ /**
260
+ * The path to the rendered value (e.g., "items", "data.users", "user.name")
261
+ */
262
+ path: string;
263
+
264
+ /**
265
+ * Type of rendering:
266
+ * - 'array-map': Array rendered via .map() method
267
+ * - 'text-interpolation': String rendered directly in JSX
268
+ */
269
+ renderingType: 'array-map' | 'text-interpolation';
270
+
271
+ /**
272
+ * The detected type of the value being rendered
273
+ */
274
+ valueType?: 'array' | 'string' | 'unknown';
275
+
276
+ /**
277
+ * Source location information
278
+ */
279
+ sourceLocation?: {
280
+ lineNumber: number;
281
+ column: number;
282
+ codeSnippet: string;
283
+ };
284
+ }
285
+
247
286
  export interface AstScopeAnalysisResult {
248
287
  // Variable structure map (variable path -> type)
249
288
  structure: Record<string, string>;
@@ -274,6 +313,11 @@ export interface AstScopeAnalysisResult {
274
313
  // Example: {hasAnalysis && <ScenarioViewer />} → { ScenarioViewer: [{ path: 'hasAnalysis', ... }] }
275
314
  childBoundaryGatingConditions?: Record<string, ConditionalUsage[]>;
276
315
 
316
+ // JSX rendering usages - tracks arrays rendered via .map() and strings interpolated in JSX
317
+ // Used to generate execution flows for array sizes and text lengths without explicit conditionals
318
+ // Example: {items.map(i => <Item {...i} />)} → array-map usage for 'items'
319
+ jsxRenderingUsages?: JsxRenderingUsage[];
320
+
277
321
  // Whether the analysis is complete enough to skip LLM calls
278
322
  isComplete: boolean;
279
323
 
@@ -355,6 +399,19 @@ export interface ConditionalUsage {
355
399
  /** For comparison operations, the value being compared to */
356
400
  comparedValue?: string;
357
401
  };
402
+
403
+ /**
404
+ * The full original expression as a semantic constraint for LLM reasoning.
405
+ * Used when the path contains complex operations (filter, map, etc.) that
406
+ * can't be simply resolved to a mock value.
407
+ *
408
+ * Examples:
409
+ * - `scenarios.filter(s => s.active).length > 1`
410
+ * - `users.some(u => u.role === 'admin' && u.active)`
411
+ *
412
+ * The LLM can interpret this constraint to generate appropriate mock data.
413
+ */
414
+ constraintExpression?: string;
358
415
  }
359
416
 
360
417
  /**
@@ -374,6 +431,14 @@ export interface CompoundConditional {
374
431
  isNegated: boolean;
375
432
  /** Required value for this condition to be true */
376
433
  requiredValue?: string | boolean;
434
+ /**
435
+ * When conditions are part of an OR expression within an && chain,
436
+ * they share the same orGroupId. Conditions with the same orGroupId
437
+ * are alternatives - only ONE needs to be satisfied.
438
+ * Example: `A && (B || C)` creates conditions where B and C share an orGroupId.
439
+ * This allows flow generation to expand into separate flows: A&&B and A&&C.
440
+ */
441
+ orGroupId?: string;
377
442
  }[];
378
443
  /** Where this compound conditional occurs */
379
444
  location: 'if' | 'ternary' | 'logical-and' | 'switch';
@@ -553,4 +618,11 @@ export interface AnalysisContext {
553
618
 
554
619
  // Get all conditional effects
555
620
  getConditionalEffects(): ConditionalEffect[];
621
+
622
+ // Add a JSX rendering usage (array.map() or text interpolation)
623
+ // Called when we see patterns like: {items.map(i => <Item />)} or {user.name}
624
+ addJsxRenderingUsage(usage: JsxRenderingUsage): void;
625
+
626
+ // Get all JSX rendering usages
627
+ getJsxRenderingUsages(): JsxRenderingUsage[];
556
628
  }