@codeyam/codeyam-cli 0.1.7 → 0.1.8

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 (382) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +6 -6
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  6. package/analyzer-template/packages/ai/src/lib/completionCall.ts +14 -2
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +27 -0
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  9. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
  10. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +6 -0
  11. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  12. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  13. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  14. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  15. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  16. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
  17. package/analyzer-template/packages/aws/package.json +1 -1
  18. package/analyzer-template/packages/database/index.ts +1 -0
  19. package/analyzer-template/packages/database/package.json +3 -3
  20. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  21. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +62 -0
  22. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  23. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  24. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  25. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  26. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  27. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  28. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  29. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  30. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  31. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  32. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  33. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  34. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  35. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  36. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  37. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +20 -0
  38. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  39. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  40. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  41. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  42. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  43. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  44. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  45. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  46. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  47. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  48. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  49. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  50. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  51. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  52. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  53. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  54. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  56. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  57. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  58. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  59. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  60. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  61. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  62. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  63. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  64. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  65. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  66. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  67. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  68. package/analyzer-template/packages/github/package.json +1 -1
  69. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  70. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  71. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  72. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  73. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  74. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  75. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  76. package/analyzer-template/project/constructMockCode.ts +136 -43
  77. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  78. package/analyzer-template/project/start.ts +3 -0
  79. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  80. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  81. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  82. package/analyzer-template/project/writeScenarioComponents.ts +36 -7
  83. package/analyzer-template/tsconfig.json +13 -1
  84. package/background/src/lib/virtualized/project/constructMockCode.js +115 -34
  85. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  86. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  87. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  88. package/background/src/lib/virtualized/project/start.js +2 -0
  89. package/background/src/lib/virtualized/project/start.js.map +1 -1
  90. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  91. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  92. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  93. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  94. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  95. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  96. package/background/src/lib/virtualized/project/writeScenarioComponents.js +29 -7
  97. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  98. package/codeyam-cli/scripts/apply-setup.js +208 -11
  99. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  100. package/codeyam-cli/src/cli.js +2 -0
  101. package/codeyam-cli/src/cli.js.map +1 -1
  102. package/codeyam-cli/src/commands/analyze.js +17 -7
  103. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  104. package/codeyam-cli/src/commands/default.js +58 -3
  105. package/codeyam-cli/src/commands/default.js.map +1 -1
  106. package/codeyam-cli/src/commands/editor.js +1839 -0
  107. package/codeyam-cli/src/commands/editor.js.map +1 -0
  108. package/codeyam-cli/src/commands/init.js +40 -11
  109. package/codeyam-cli/src/commands/init.js.map +1 -1
  110. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +246 -0
  111. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  112. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +126 -0
  113. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  114. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +295 -0
  115. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  116. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  117. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  118. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +100 -0
  119. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  120. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +147 -0
  121. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  122. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +76 -0
  123. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  124. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  125. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  126. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  127. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  128. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  129. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  130. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  131. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  132. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +26 -0
  133. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  134. package/codeyam-cli/src/utils/backgroundServer.js +19 -3
  135. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  136. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  137. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  138. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  139. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  140. package/codeyam-cli/src/utils/editorAudit.js +82 -0
  141. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  142. package/codeyam-cli/src/utils/editorDevServer.js +98 -0
  143. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  144. package/codeyam-cli/src/utils/editorJournal.js +137 -0
  145. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  146. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  147. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  148. package/codeyam-cli/src/utils/editorPreloadHelpers.js +64 -0
  149. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  150. package/codeyam-cli/src/utils/editorPreview.js +66 -0
  151. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  152. package/codeyam-cli/src/utils/editorScenarios.js +56 -0
  153. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  154. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  155. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  156. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  157. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  158. package/codeyam-cli/src/utils/git.js +103 -0
  159. package/codeyam-cli/src/utils/git.js.map +1 -1
  160. package/codeyam-cli/src/utils/install-skills.js +55 -13
  161. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  162. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  163. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  164. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  165. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  166. package/codeyam-cli/src/utils/project.js +15 -5
  167. package/codeyam-cli/src/utils/project.js.map +1 -1
  168. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  169. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  170. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  171. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  172. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  173. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  174. package/codeyam-cli/src/utils/queue/job.js +70 -1
  175. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  176. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  177. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  178. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  179. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  180. package/codeyam-cli/src/utils/serverState.js +27 -2
  181. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  182. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +45 -4
  183. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  184. package/codeyam-cli/src/utils/testRunner.js +158 -0
  185. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  186. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  187. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  188. package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
  189. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  190. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  191. package/codeyam-cli/src/webserver/backgroundServer.js +108 -18
  192. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  193. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CtmbP4Gl.js → CopyButton-DmJveP3T.js} +1 -1
  194. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DlMph_Hm.js → EntityItem-C76mRRiF.js} +1 -1
  195. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-B-0PjGOU.js → EntityTypeBadge-g3saevPb.js} +1 -1
  196. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-DN9eiJAO.js → EntityTypeIcon-CobE682z.js} +1 -1
  197. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-rE_fI2h2.js → InteractivePreview-DYFW3lDD.js} +3 -3
  199. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CnatsCw2.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-CSP6DZrh.js → LoadingDots-BU_OAEMP.js} +1 -1
  201. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CMK8Q7yk.js → LogViewer-ceAyBX-H.js} +1 -1
  202. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-TCV_HBjy.js → ReportIssueModal-djPLI-WV.js} +1 -1
  203. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CG2uh31y.js → SafeScreenshot-BED4B6sP.js} +1 -1
  204. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CU_TDYd8.js → ScenarioViewer-B76aig_2.js} +1 -1
  205. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/Terminal-Dnj5CY9R.js +41 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D7IoaWUW.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  208. package/codeyam-cli/src/webserver/build/client/assets/{_index-B8z7mjR-.js → _index-C96V0n15.js} +1 -1
  209. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DZu78RI1.js → activity.(_tab)-BpKzcsJz.js} +1 -1
  210. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-CUXOrorO.js +1 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Dm5RS9il.js → agent-transcripts-D9hemwl6.js} +1 -1
  213. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  214. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  215. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  217. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  218. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  219. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  220. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  221. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  222. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  223. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  224. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  225. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  226. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  227. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  228. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  229. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  230. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  231. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  232. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  233. package/codeyam-cli/src/webserver/build/client/assets/{book-open-Bp5FLkd4.js → book-open-D_nMCFmP.js} +1 -1
  234. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DQJA9f4o.js → chevron-down-BH2h1Ea2.js} +1 -1
  235. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-7VptmeIr.js → chunk-JZWAC4HX-C4pqxYJB.js} +1 -1
  236. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-B6C4LY9o.js → circle-check-DyIKORY6.js} +1 -1
  237. package/codeyam-cli/src/webserver/build/client/assets/{copy-6nzYCu0G.js → copy-NDbZjXao.js} +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-D-QUFOwe.js → createLucideIcon-CMT1jU2q.js} +1 -1
  239. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BiM6z3Do.js +1 -0
  240. package/codeyam-cli/src/webserver/build/client/assets/editor-D1DAKXtT.js +8 -0
  241. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-C6PQhwY5.js → entity._sha._-CrjR3zZW.js} +8 -8
  242. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-DkzqFzFj.js +6 -0
  243. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C28BiQzt.js +6 -0
  244. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  245. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-C7ysA4Jq.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  246. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CU6EUArK.js → entry.client-DTvKq3TY.js} +1 -1
  247. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-EWpfFU4X.js → fileTableUtils-cPo8LiG3.js} +1 -1
  248. package/codeyam-cli/src/webserver/build/client/assets/{files-CrxAoWIL.js → files-DO4CZ16O.js} +1 -1
  249. package/codeyam-cli/src/webserver/build/client/assets/{git-BldHtKeW.js → git-CFCTYk9I.js} +1 -1
  250. package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +1 -0
  251. package/codeyam-cli/src/webserver/build/client/assets/{index-7-1FmlHo.js → index-10oVnAAH.js} +1 -1
  252. package/codeyam-cli/src/webserver/build/client/assets/{index-DuYcwYp_.js → index-BcvgDzbZ.js} +1 -1
  253. package/codeyam-cli/src/webserver/build/client/assets/{labs-CPPVOSWB.js → labs-Zk7ryIM1.js} +1 -1
  254. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BnDcD54R.js → loader-circle-BAXYRVEO.js} +1 -1
  255. package/codeyam-cli/src/webserver/build/client/assets/manifest-a632de18.js +1 -0
  256. package/codeyam-cli/src/webserver/build/client/assets/{memory-0wMU4KXe.js → memory-Dg0mvYrI.js} +5 -2
  257. package/codeyam-cli/src/webserver/build/client/assets/{pause-DhQX2g22.js → pause-DTAcYxBt.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/root-DUKqhFlb.js +67 -0
  259. package/codeyam-cli/src/webserver/build/client/assets/{search-DborVoKD.js → search-fKo7v0Zo.js} +1 -1
  260. package/codeyam-cli/src/webserver/build/client/assets/{settings-BWunYSXt.js → settings-DfuTtcJP.js} +1 -1
  261. package/codeyam-cli/src/webserver/build/client/assets/{simulations-BtrtCYJg.js → simulations-B3aOzpCZ.js} +1 -1
  262. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Bs4NC-VZ.js → terminal-BG4heKCG.js} +1 -1
  263. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-DTf3Jojp.js → triangle-alert-DtSmdtM4.js} +1 -1
  264. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-D_bDZyDU.js → useCustomSizes-ByhSyh0W.js} +1 -1
  265. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  266. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-BsQb6rFd.js → useReportContext-O-jkvSPx.js} +1 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/{useToast-BOur3mUv.js → useToast-9FIWuYfK.js} +1 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  269. package/codeyam-cli/src/webserver/build/server/assets/index-HfLydfDq.js +1 -0
  270. package/codeyam-cli/src/webserver/build/server/assets/server-build-CUu_F-oo.js +366 -0
  271. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  272. package/codeyam-cli/src/webserver/build-info.json +5 -5
  273. package/codeyam-cli/src/webserver/devServer.js +39 -5
  274. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  275. package/codeyam-cli/src/webserver/editorProxy.js +440 -0
  276. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  277. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +175 -0
  278. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +140 -0
  279. package/codeyam-cli/src/webserver/server.js +226 -1
  280. package/codeyam-cli/src/webserver/server.js.map +1 -1
  281. package/codeyam-cli/src/webserver/terminalServer.js +698 -0
  282. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  283. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  284. package/codeyam-cli/templates/editor-step-hook.py +147 -0
  285. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  286. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  287. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  288. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  289. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  290. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  291. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  292. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  293. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  294. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  295. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  296. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  297. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  298. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +43 -0
  299. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  300. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +35 -0
  301. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  302. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  303. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  304. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  305. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  306. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  307. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +69 -0
  308. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  309. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  310. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +108 -0
  311. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +69 -0
  312. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  313. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  314. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +12 -0
  315. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +45 -0
  316. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +139 -0
  317. package/package.json +4 -2
  318. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  319. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  320. package/packages/ai/src/lib/completionCall.js +10 -2
  321. package/packages/ai/src/lib/completionCall.js.map +1 -1
  322. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +21 -0
  323. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  324. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  325. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  326. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  327. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  328. package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
  329. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  330. package/packages/analyze/src/lib/ProjectAnalyzer.js +3 -0
  331. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  332. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  333. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  334. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  335. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  336. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  337. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  338. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  339. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  340. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  341. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  342. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
  343. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  344. package/packages/database/index.js +1 -0
  345. package/packages/database/index.js.map +1 -1
  346. package/packages/database/src/lib/kysely/db.js +5 -0
  347. package/packages/database/src/lib/kysely/db.js.map +1 -1
  348. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  349. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  350. package/packages/database/src/lib/loadCommits.js +23 -13
  351. package/packages/database/src/lib/loadCommits.js.map +1 -1
  352. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  353. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  354. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  355. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  356. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  357. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  358. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  359. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  360. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  361. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  362. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  363. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  364. package/scripts/npm-post-install.cjs +34 -0
  365. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C1rIyZdV.js +0 -34
  366. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DmzSmblj.js +0 -1
  367. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DVTcUnur.js +0 -6
  368. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BVgNO76F.js +0 -6
  369. package/codeyam-cli/src/webserver/build/client/assets/globals-CLmFdUae.css +0 -1
  370. package/codeyam-cli/src/webserver/build/client/assets/manifest-717e346a.js +0 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/root-DqfSDjyQ.js +0 -62
  372. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DZp6rrQD.js +0 -2
  373. package/codeyam-cli/src/webserver/build/server/assets/index-B8jmgmn2.js +0 -1
  374. package/codeyam-cli/src/webserver/build/server/assets/server-build-9OU4lmvL.js +0 -285
  375. package/scripts/finalize-analyzer.cjs +0 -13
  376. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  377. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  378. /package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -0
  379. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  380. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  381. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  382. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -341,6 +341,7 @@ export default function constructMockCode(
341
341
  let dataStructureValue: string | undefined;
342
342
  let foundEntityWithSignature = false;
343
343
  let signatureSchema: DataStructure['signatureSchema'] | undefined;
344
+ let baseSchemaHasMethodCalls = false;
344
345
 
345
346
  entitySearch: for (const filePath in dependencySchemas) {
346
347
  for (const entityName in dependencySchemas[filePath]) {
@@ -378,8 +379,53 @@ export default function constructMockCode(
378
379
  });
379
380
 
380
381
  if (dataStructurePath) {
382
+ // Start with the base entity's return value schema
383
+ const baseReturnValueSchema =
384
+ dependencySchemas[filePath][entityName]?.returnValueSchema;
385
+ const mergedSchema = {
386
+ ...baseReturnValueSchema,
387
+ };
388
+
389
+ // Check if the base schema has method-call entries (e.g., .map().functionCallReturnValue)
390
+ // When it does, the scenario data is stored as an object with method keys, and
391
+ // array prototype methods need mock implementations. When it doesn't, the data
392
+ // is a raw array and native methods like .includes() work directly.
393
+ if (baseReturnValueSchema) {
394
+ baseSchemaHasMethodCalls = Object.keys(baseReturnValueSchema).some(
395
+ (k) =>
396
+ k.startsWith(baseMockName + '.') &&
397
+ k.includes('(') &&
398
+ k.includes('.functionCallReturnValue'),
399
+ );
400
+ }
401
+
402
+ // Merge in method-call dependencies that are separate entries.
403
+ // e.g., "activityTypes.find((a) => a.value === type)" is a separate dependency
404
+ // for a .find() call on activityTypes. We need to include these with a
405
+ // .functionCallReturnValue path so constructMockCode generates callable mock methods.
406
+ for (const otherEntityName in dependencySchemas[filePath]) {
407
+ if (otherEntityName === entityName) continue;
408
+ if (
409
+ otherEntityName.startsWith(baseMockName + '.') &&
410
+ otherEntityName.includes('(')
411
+ ) {
412
+ // Add a functionCallReturnValue entry for this method call.
413
+ // This ensures constructMockCode treats it as a function that returns data,
414
+ // generating a proper mock method with data lookup.
415
+ const fcrvPath = `${otherEntityName}.functionCallReturnValue`;
416
+ if (!mergedSchema[fcrvPath]) {
417
+ // Infer the return type from the method-call dependency's schema
418
+ const otherSchema =
419
+ dependencySchemas[filePath][otherEntityName]?.returnValueSchema;
420
+ // Look for element type (baseMockName[]) or fall back to 'unknown'
421
+ const elementType = otherSchema?.[`${baseMockName}[]`];
422
+ mergedSchema[fcrvPath] = elementType || 'unknown';
423
+ }
424
+ }
425
+ }
426
+
381
427
  relevantReturnValueSchema = fillInDirectSchemaGapsAndUnknowns({
382
- schema: dependencySchemas[filePath][entityName]?.returnValueSchema,
428
+ schema: mergedSchema,
383
429
  });
384
430
  // NOTE: clearAttributesFromMapping is disabled because it deletes
385
431
  // method calls on arrays (like .eq() after functionCallReturnValue: 'array')
@@ -462,7 +508,10 @@ export default function constructMockCode(
462
508
  const argsString = args.join(', ');
463
509
 
464
510
  // Generate empty mock function
465
- return `function ${mockName}(${argsString}) {
511
+ // Use baseMockName (not mockName) because mockName may contain a full call
512
+ // signature with argument expressions (e.g., "logSignOutAction(sessionUser.id, ...)")
513
+ // which would produce invalid syntax as function parameter names.
514
+ return `function ${baseMockName}(${argsString}) {
466
515
  // Empty mock - original function mocked out
467
516
  }`;
468
517
  }
@@ -510,13 +559,13 @@ export default function constructMockCode(
510
559
 
511
560
  if (firstArgIsFunctionOrUnknown && returnsFunction) {
512
561
  // HOC pattern detected - return the first argument
513
- return `function ${mockName}(${argsString}) {
562
+ return `function ${baseMockName}(${argsString}) {
514
563
  return arg1;
515
564
  }`;
516
565
  }
517
566
 
518
567
  // Generate empty mock function
519
- return `function ${mockName}(${argsString}) {
568
+ return `function ${baseMockName}(${argsString}) {
520
569
  // Empty mock - original function mocked out
521
570
  }`;
522
571
  }
@@ -697,10 +746,6 @@ export default function constructMockCode(
697
746
  }
698
747
 
699
748
  const addReturnValueFunctionAccessor = (dataPath: string) => {
700
- // Add function call accessor if:
701
- // - There are actual arguments, OR
702
- // - This is a callable (not a method that returns an array directly)
703
- // For methods like getAll() that return arrays, the data is at ["getAll()"] not ["getAll()"]["()"]
704
749
  if (
705
750
  returnValue.returnsFunctionArgs &&
706
751
  (returnValue.returnsFunctionArgs.length > 0 ||
@@ -709,7 +754,17 @@ export default function constructMockCode(
709
754
  if (returnValue.isArray) {
710
755
  dataPath = `${dataPath}${optionalAccess('[0]')}`;
711
756
  }
712
- dataPath = `${dataPath}${optionalAccess(`(${safeString(returnValue.returnsFunctionArgs.join(', '))})`)}`;
757
+ // Only add the function call accessor ?.["(args)"] when there are actual
758
+ // arguments. When returnsFunctionArgs is empty [] (function-returns-function
759
+ // with no specific arg patterns), skip the ?.["()"] because:
760
+ // 1. preprocessSchemaForMocks collapses nested functionCallReturnValue chains
761
+ // into flat entries (e.g., getTranslate() = string, not {(): string})
762
+ // 2. The mock data is a flat value, so ?.["()"] on a string returns undefined
763
+ // 3. constructContent still wraps the return in a function (via returnsFunctionArgs)
764
+ // so the function-returns-function behavior is preserved without data nesting
765
+ if (returnValue.returnsFunctionArgs.length > 0) {
766
+ dataPath = `${dataPath}${optionalAccess(`(${safeString(returnValue.returnsFunctionArgs.join(', '))})`)}`;
767
+ }
713
768
  }
714
769
  return dataPath;
715
770
  };
@@ -750,29 +805,6 @@ export default function constructMockCode(
750
805
  hasNoReturnData,
751
806
  } = returnValue;
752
807
 
753
- // When an array has differentiated indices ([0], [1], etc.), filter out any
754
- // non-index items from nested. These non-index items come from generic [] paths
755
- // like [].filter or [].sort, which describe element properties, not array elements.
756
- // Including them would generate invalid syntax like "sort: ..." inside an array literal.
757
- const hasDifferentiatedIndices =
758
- isArray &&
759
- nested &&
760
- nested.some((n) => n.name.match(/^\[\d+\]$/) && n.name !== '[0]');
761
- const filteredNested =
762
- hasDifferentiatedIndices && nested
763
- ? nested.filter((n) => n.name.match(/^\[\d+\]$/))
764
- : nested;
765
-
766
- const nestedContent: (string | undefined)[] = (filteredNested ?? []).map(
767
- (nestedItem) => {
768
- const nestedContent = constructReturnValueString(
769
- nestedItem,
770
- dataPaths,
771
- );
772
- return nestedContent;
773
- },
774
- );
775
-
776
808
  // Array prototype methods that should be ignored when building mocks
777
809
  // (these work on any array - we don't need to mock them)
778
810
  const ARRAY_PROTOTYPE_METHODS = new Set([
@@ -817,6 +849,48 @@ export default function constructMockCode(
817
849
  'length',
818
850
  ]);
819
851
 
852
+ // When an array has differentiated indices ([0], [1], etc.), filter out any
853
+ // non-index items from nested. These non-index items come from generic [] paths
854
+ // like [].filter or [].sort, which describe element properties, not array elements.
855
+ // Including them would generate invalid syntax like "sort: ..." inside an array literal.
856
+ const hasDifferentiatedIndices =
857
+ isArray &&
858
+ nested &&
859
+ nested.some((n) => n.name.match(/^\[\d+\]$/) && n.name !== '[0]');
860
+ let filteredNested =
861
+ hasDifferentiatedIndices && nested
862
+ ? nested.filter((n) => n.name.match(/^\[\d+\]$/))
863
+ : nested;
864
+
865
+ // When a variable IS an array (not a function returning an array),
866
+ // filter out array prototype methods like .includes(), .filter(), etc.
867
+ // ONLY when the base schema has no method-call entries. When the base
868
+ // schema has methods (e.g., .map().functionCallReturnValue), the scenario
869
+ // data is stored as an object with method-call keys, and ALL methods
870
+ // need mock implementations. When the base schema has no methods, the
871
+ // data is a raw array and native methods like .includes() work directly.
872
+ if (
873
+ isArray &&
874
+ !returnsFunctionArray &&
875
+ !baseSchemaHasMethodCalls &&
876
+ filteredNested
877
+ ) {
878
+ filteredNested = filteredNested.filter((n) => {
879
+ const methodName = n.name.replace(/[<(].*$/, '');
880
+ return !ARRAY_PROTOTYPE_METHODS.has(methodName);
881
+ });
882
+ }
883
+
884
+ const nestedContent: (string | undefined)[] = (filteredNested ?? []).map(
885
+ (nestedItem) => {
886
+ const nestedContent = constructReturnValueString(
887
+ nestedItem,
888
+ dataPaths,
889
+ );
890
+ return nestedContent;
891
+ },
892
+ );
893
+
820
894
  const levelContentItems = [];
821
895
  // Add spread for data paths when:
822
896
  // - Not a function returning an array, OR function returns array with custom methods
@@ -1636,19 +1710,38 @@ export default function constructMockCode(
1636
1710
  fallbackContent;
1637
1711
  content = `${cleanOutTypes(name)}: ${isAsyncFunction ? 'async ' : ''}(${argsString}) => {\n${indent(funcContents)}\n}`;
1638
1712
  } else {
1639
- // No argument variants - use existing behavior
1640
- // But if there's nested content, we need to include it in the return object
1641
- // (similar to how argument variant branches handle this at line 1070-1072)
1642
- const hasNestedContent = validNestedContent.length > 0;
1643
- let funcReturnContents: string;
1644
- if (hasNestedContent && levelContentItems.length > 1) {
1645
- // Include both spread and nested content in the return
1646
- funcReturnContents = `{\n${indent(levelContents)}\n}`;
1713
+ // No argument variants
1714
+ // Check if this is an array method callback containing JSX.
1715
+ // JSX can't be serialized to JSON, so the LLM generates [{}] as data.
1716
+ // Instead of returning that unusable data, generate a passthrough that
1717
+ // calls the real callback on the best available array data from siblings.
1718
+ const containsJsx = dataPaths.some((p) => /<[A-Z]/.test(p));
1719
+ const isArrayMethod = ARRAY_PROTOTYPE_METHODS.has(name);
1720
+
1721
+ if (containsJsx && isArrayMethod && dataPaths.length > 0) {
1722
+ // Extract parent data path by removing the last ?.["..."] segment
1723
+ const parentPath = dataPaths[0].replace(/\?\.\["[^"]*"\]$/, '');
1724
+ const funcLines = [
1725
+ `const _d = ${parentPath};`,
1726
+ `const _a = Object.values(_d || {}).filter(v => Array.isArray(v) && v.length > 0 && v.some(i => i && typeof i === "object" && Object.keys(i).length > 0)).sort((a, b) => b.length - a.length);`,
1727
+ `return _a[0] ? _a[0].${name}(${argsString}) : []`,
1728
+ ];
1729
+ const funcContents = funcLines.join('\n');
1730
+ content = `${cleanOutTypes(name)}: ${isAsyncFunction ? 'async ' : ''}(${argsString}) => {\n${indent(funcContents)}\n}`;
1647
1731
  } else {
1648
- funcReturnContents = returnValueContents;
1732
+ // But if there's nested content, we need to include it in the return object
1733
+ // (similar to how argument variant branches handle this at line 1070-1072)
1734
+ const hasNestedContent = validNestedContent.length > 0;
1735
+ let funcReturnContents: string;
1736
+ if (hasNestedContent && levelContentItems.length > 1) {
1737
+ // Include both spread and nested content in the return
1738
+ funcReturnContents = `{\n${indent(levelContents)}\n}`;
1739
+ } else {
1740
+ funcReturnContents = returnValueContents;
1741
+ }
1742
+ const funcContents = `return ${funcReturnContents}`;
1743
+ content = `${cleanOutTypes(name)}: ${isAsyncFunction ? 'async ' : ''}(${argsString}) => {\n${indent(funcContents)}\n}`;
1649
1744
  }
1650
- const funcContents = `return ${funcReturnContents}`;
1651
- content = `${cleanOutTypes(name)}: ${isAsyncFunction ? 'async ' : ''}(${argsString}) => {\n${indent(funcContents)}\n}`;
1652
1745
  }
1653
1746
  } else {
1654
1747
  if (!isValidKey(name)) {
@@ -26,22 +26,21 @@ export function reconcileMockDataKeys(
26
26
  ? reconcileMockDataKeys(value as Record<string, unknown>, expectedKeys)
27
27
  : value;
28
28
 
29
- // Check if key matches an expected key exactly
30
- if (expectedKeys.includes(key)) {
31
- result[key] = reconciledValue;
32
- continue;
33
- }
34
-
35
- // Check if this is a flat dotted key that should be converted to nested structure
36
- // e.g., "trpc.fastener.getAttributeValues.useQuery({ ... })"
29
+ // Check if this is a flat dotted key (method chain) that should be nested.
30
+ // e.g., "ZId.safeParse(params.surveyId)" → { ZId: { "safeParse(params.surveyId)": ... } }
31
+ // e.g., "trpc.fastener.getAttributeValues.useQuery({ ... })" → nested structure
32
+ // constructMockCode generates nested lookups like data["ZId"]["safeParse(...)"]
33
+ // for method chains, so the data must be nested to match.
37
34
  const flatKeyParts = parseFlatDottedKey(key);
38
35
  if (flatKeyParts && flatKeyParts.length > 1) {
39
- // Check if the parts match expected keys (indicating this should be nested)
40
- const partsMatchExpected = flatKeyParts.some((part) =>
41
- expectedKeys.includes(part),
42
- );
43
- if (partsMatchExpected) {
44
- // Convert flat key to nested structure and merge
36
+ // Nest when:
37
+ // 1. The full key matches an expected key exactly (e.g., "ZId.safeParse(params.surveyId)")
38
+ // 2. OR individual parts match expected keys (e.g., "trpc" is an expected key)
39
+ // This handles LLM-generated flat keys that should be nested (Issue 8)
40
+ const shouldNest =
41
+ expectedKeys.includes(key) ||
42
+ flatKeyParts.some((part) => expectedKeys.includes(part));
43
+ if (shouldNest) {
45
44
  deepMergeIntoResult(
46
45
  result,
47
46
  flatKeyParts,
@@ -52,6 +51,12 @@ export function reconcileMockDataKeys(
52
51
  }
53
52
  }
54
53
 
54
+ // Check if key matches an expected key exactly (for non-dotted keys)
55
+ if (expectedKeys.includes(key)) {
56
+ result[key] = reconciledValue;
57
+ continue;
58
+ }
59
+
55
60
  // Try to find closest match using existing logic
56
61
  const closestKey = findClosestKey(key, expectedKeys);
57
62
  if (closestKey) {
@@ -313,6 +313,9 @@ async function main({
313
313
  : envConfig.entityShas,
314
314
  full: orchestrateCapture === 'local-sequential',
315
315
  taskRunner,
316
+ // Poll faster in local mode - no DB load concerns like in cloud
317
+ pollingInterval:
318
+ orchestrateCapture === 'local-sequential' ? 5 * 1000 : undefined,
316
319
  // Always track capture progress on the commit, even when not filtering by it.
317
320
  metadataCommit: sharedContext.commit ?? sharedContext.branchCommit,
318
321
  });
@@ -6,6 +6,7 @@ import writeUniversalMocks from './writeUniversalMocks';
6
6
  import writeScenario from './writeScenario';
7
7
  import writeSimpleRoot from './writeSimpleRoot';
8
8
  import writeCodeYamPage from './writeCodeYamPage';
9
+ import writeClientLogRoute from './writeClientLogRoute';
9
10
  import {
10
11
  runMultiScenarioServer,
11
12
  ScenarioToCapture,
@@ -497,6 +498,14 @@ export async function startScenarioCapture({
497
498
  );
498
499
  allGeneratedFiles.push(codeyamPagePath);
499
500
 
501
+ // Write client-log API route so client-side errors appear in the server log
502
+ const clientLogPath = await writeClientLogRoute(
503
+ project,
504
+ framework,
505
+ analysis.filePath,
506
+ );
507
+ if (clientLogPath) allGeneratedFiles.push(clientLogPath);
508
+
500
509
  // Persist file tracking for crash/debug recovery
501
510
  writeTrackingFile(allGeneratedFiles, backupFiles);
502
511
  }
@@ -0,0 +1,125 @@
1
+ import { Project, ProjectFramework } from '~codeyam/types';
2
+ import { findWebAppForFile, PROJECT_RELATIVE_PATH } from '~codeyam/utils';
3
+ import writeFile from '../common/writeFile';
4
+ import * as path from 'path';
5
+
6
+ /**
7
+ * Writes a client-log API route to the project so that client-side errors
8
+ * (window.onerror, unhandledrejection, console.error) are reported back to
9
+ * the server log where they can be read from the terminal.
10
+ *
11
+ * The route receives JSON POST requests and console.log's them, which sends
12
+ * the output to the dev server's stdout (captured in the server log file).
13
+ */
14
+ export default async function writeClientLogRoute(
15
+ project: Project,
16
+ framework: ProjectFramework,
17
+ analysisFilePath?: string,
18
+ ) {
19
+ const relativePath = PROJECT_RELATIVE_PATH;
20
+ const fullAppPath = getFullAppPath(project, analysisFilePath);
21
+
22
+ let routePath: string;
23
+ let content: string;
24
+
25
+ switch (framework) {
26
+ case ProjectFramework.Remix:
27
+ case ProjectFramework.CRA:
28
+ case ProjectFramework.CodeYam:
29
+ routePath = `${relativePath}/${fullAppPath}/routes/api.client-log.ts`;
30
+ content = getRemixRoute();
31
+ break;
32
+ case ProjectFramework.Next:
33
+ routePath = `${relativePath}/${fullAppPath}/api/client-log/route.ts`;
34
+ content = getNextAppRoute();
35
+ break;
36
+ case ProjectFramework.NextPages:
37
+ routePath = `${relativePath}/pages/api/client-log.ts`;
38
+ content = getNextPagesRoute();
39
+ break;
40
+ default:
41
+ return;
42
+ }
43
+
44
+ await writeFile(routePath, content);
45
+ return routePath;
46
+ }
47
+
48
+ function getFullAppPath(project: Project, analysisFilePath?: string): string {
49
+ if (analysisFilePath) {
50
+ const webapp = findWebAppForFile(
51
+ analysisFilePath,
52
+ project.metadata?.webapps ?? [],
53
+ );
54
+ if (webapp) {
55
+ const webappPath = webapp.path === '.' ? '' : webapp.path;
56
+ const appDirectory = webapp.appDirectory ?? 'app';
57
+ return webappPath ? path.join(webappPath, appDirectory) : appDirectory;
58
+ }
59
+ }
60
+ const firstWebapp = project.metadata?.webapps?.[0];
61
+ if (firstWebapp) {
62
+ const webappPath = firstWebapp.path === '.' ? '' : firstWebapp.path;
63
+ const appDirectory = firstWebapp.appDirectory ?? 'app';
64
+ return webappPath ? path.join(webappPath, appDirectory) : appDirectory;
65
+ }
66
+ return 'app';
67
+ }
68
+
69
+ function formatLogEntry(): string {
70
+ return `
71
+ function formatEntry(body) {
72
+ const ts = new Date().toLocaleString();
73
+ const scenario = body.scenario ? ' [' + body.scenario + ']' : '';
74
+ const type = (body.type || 'error').toUpperCase();
75
+ const lines = ['[' + ts + '] [CLIENT ' + type + ']' + scenario + ' ' + (body.message || 'Unknown error')];
76
+ if (body.stack) lines.push(body.stack);
77
+ if (body.url) lines.push(' at ' + body.url);
78
+ return lines.join('\\n');
79
+ }`;
80
+ }
81
+
82
+ function getRemixRoute(): string {
83
+ return `// Auto-generated by CodeYam — client error reporting endpoint
84
+ ${formatLogEntry()}
85
+
86
+ export async function action({ request }) {
87
+ try {
88
+ const body = await request.json();
89
+ console.log(formatEntry(body));
90
+ } catch (e) {}
91
+ return new Response('ok', { status: 200 });
92
+ }
93
+ `;
94
+ }
95
+
96
+ function getNextAppRoute(): string {
97
+ return `// Auto-generated by CodeYam — client error reporting endpoint
98
+ import { NextResponse } from 'next/server';
99
+ ${formatLogEntry()}
100
+
101
+ export async function POST(request: Request) {
102
+ try {
103
+ const body = await request.json();
104
+ console.log(formatEntry(body));
105
+ } catch (e) {}
106
+ return NextResponse.json({ ok: true });
107
+ }
108
+ `;
109
+ }
110
+
111
+ function getNextPagesRoute(): string {
112
+ return `// Auto-generated by CodeYam — client error reporting endpoint
113
+ import type { NextApiRequest, NextApiResponse } from 'next';
114
+ ${formatLogEntry()}
115
+
116
+ export default async function handler(req: NextApiRequest, res: NextApiResponse) {
117
+ if (req.method !== 'POST') return res.status(405).end();
118
+ try {
119
+ const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
120
+ console.log(formatEntry(body));
121
+ } catch (e) {}
122
+ res.status(200).json({ ok: true });
123
+ }
124
+ `;
125
+ }
@@ -8,6 +8,7 @@ import type { AnyNode } from 'domhandler';
8
8
  import { safeFileName } from '~codeyam/utils';
9
9
  import { cleanOutBoundary } from '~codeyam/ai';
10
10
  import { reconcileMockDataKeys } from './reconcileMockDataKeys';
11
+ import coerceObjectsToPrimitivesBySchema from '~codeyam/ai/src/lib/dataStructure/helpers/coerceObjectsToPrimitivesBySchema';
11
12
 
12
13
  /**
13
14
  * Normalize useParams mock data by fixing the React Router splat param (*).
@@ -1029,6 +1030,14 @@ export default async function writeMockDataTsx(
1029
1030
  expectedKeys,
1030
1031
  );
1031
1032
 
1033
+ // Coerce objects/arrays to primitives when the schema expects a primitive type.
1034
+ // Defense-in-depth: the generation pipeline already runs this coercion, but
1035
+ // data in the DB may have wrong types from older code versions or edge cases.
1036
+ // This prevents runtime errors like "TypeError: body.match is not a function".
1037
+ if (dataForMocks) {
1038
+ coerceObjectsToPrimitivesBySchema(reconciledMockData, dataForMocks);
1039
+ }
1040
+
1032
1041
  // Convert comma-separated strings to arrays for fields that should be arrays
1033
1042
  // This handles cases where LLM generates "color,size" instead of ["color", "size"]
1034
1043
  const defaultMockData =
@@ -1076,6 +1085,14 @@ import React from 'react';
1076
1085
  expectedKeys,
1077
1086
  );
1078
1087
 
1088
+ // Coerce objects/arrays to primitives for non-default scenario data too
1089
+ if (dataForMocks) {
1090
+ coerceObjectsToPrimitivesBySchema(
1091
+ reconciledScenarioMockData,
1092
+ dataForMocks,
1093
+ );
1094
+ }
1095
+
1079
1096
  // Convert comma-separated strings to arrays for scenario data
1080
1097
  const scenarioMockData = convertCommaSeparatedStringsToArrays(
1081
1098
  reconciledScenarioMockData,
@@ -1055,11 +1055,17 @@ function addMockToContent(
1055
1055
  // use the base name (e.g., "trpc") when calling constructMockCode. This ensures
1056
1056
  // constructMockCode generates a complete nested mock from the schema without
1057
1057
  // referencing __cyOriginal variables.
1058
+ // NOTE: Only check for dots BEFORE the first open paren. Function calls with
1059
+ // dotted arguments like "getSurveyWithMetadata(params.surveyId)" have dots
1060
+ // INSIDE parens — these are NOT method chains and should keep the full signature.
1058
1061
  const dataKeyBaseName = dataKey.split(/[.<(]/)[0];
1062
+ const firstParenIndex = dataKey.indexOf('(');
1063
+ const partBeforeFirstParen =
1064
+ firstParenIndex >= 0 ? dataKey.substring(0, firstParenIndex) : dataKey;
1059
1065
  const isMethodChainDataKey =
1060
1066
  dataKeyBaseName === importedExport.name &&
1061
1067
  dataKey !== importedExport.name &&
1062
- dataKey.includes('.');
1068
+ partBeforeFirstParen.includes('.');
1063
1069
  const mockNameToUse = isMethodChainDataKey
1064
1070
  ? importedExport.name
1065
1071
  : dataKey;
@@ -1145,12 +1151,20 @@ function ${importedExport.name}(...args) {
1145
1151
  // referencing __cyOriginal variables. The __cyOriginal pattern is only needed
1146
1152
  // for partial mocking where we preserve some original methods, not for complete
1147
1153
  // method-chain mocks where we provide all implementations.
1154
+ // NOTE: Only check for dots BEFORE the first open paren. Function calls with
1155
+ // dotted arguments like "getSurveyWithMetadata(params.surveyId)" have dots
1156
+ // INSIDE parens — these are NOT method chains and should keep the full signature.
1148
1157
  const dataKeyBaseName = dataKey?.split(/[.<(]/)[0];
1158
+ const elseFirstParenIndex = dataKey?.indexOf('(') ?? -1;
1159
+ const elsePartBeforeFirstParen =
1160
+ dataKey && elseFirstParenIndex >= 0
1161
+ ? dataKey.substring(0, elseFirstParenIndex)
1162
+ : dataKey;
1149
1163
  const isMethodChainDataKey =
1150
1164
  dataKey &&
1151
1165
  dataKeyBaseName === importedExport.name &&
1152
1166
  dataKey !== importedExport.name &&
1153
- dataKey.includes('.');
1167
+ (elsePartBeforeFirstParen?.includes('.') ?? false);
1154
1168
  const mockNameToUse = isMethodChainDataKey
1155
1169
  ? importedExport.name
1156
1170
  : (dataKey ?? importedExport.calls?.[0] ?? `${importedExport.name}()`);
@@ -1920,6 +1934,17 @@ export default async function writeScenarioComponents({
1920
1934
  dataFileContent = stripServerOnlyImport(dataFileContent);
1921
1935
  dataFileContent = applyServerOnlyMocks(dataFileContent);
1922
1936
 
1937
+ // Process transitive imports: if the data entity file imports from files
1938
+ // that have `import "server-only"`, rewrite those imports to transitive
1939
+ // copies with server-only stripped. Without this, data entity files that
1940
+ // end up in a client bundle (e.g., via a stripped "use server" boundary)
1941
+ // would pull in server-only code and cause build failures.
1942
+ dataFileContent = await processTransitiveImportsRecursively(
1943
+ dataFileContent,
1944
+ fileNotMocked.path,
1945
+ dataScenarioPath,
1946
+ );
1947
+
1923
1948
  // Write the transformed data entity file
1924
1949
  await writeFile(dataScenarioPath, dataFileContent);
1925
1950
  scenarioComponentPaths.push(dataScenarioPath);
@@ -1945,9 +1970,9 @@ export default async function writeScenarioComponents({
1945
1970
  importedExport.name,
1946
1971
  );
1947
1972
 
1948
- // Don't recurse - data entities don't need their dependencies processed
1949
- // The import rewriting will happen later in this same loop iteration
1950
- // (at lines ~1590-1702) to point imports to this transformed file
1973
+ // Don't recurse into full writeScenarioComponents - data entities don't
1974
+ // need mock generation for their dependencies. Transitive server-only
1975
+ // import processing is already handled above via processTransitiveImportsRecursively.
1951
1976
  } else {
1952
1977
  // For visual/library entities, recurse to process their dependencies
1953
1978
 
@@ -3062,10 +3087,14 @@ ${exportKeyword}const ${functionName} = new Proxy(() => scenarios().data()?.["${
3062
3087
  fileContent = `import { scenarios } from "${mockDataPath}";\n\n${fileContent}`;
3063
3088
  }
3064
3089
 
3065
- // Add wrapper default export that injects argumentsData as props
3090
+ // Add wrapper default export that injects argumentsData as props.
3091
+ // Filter null values: the LLM uses null to mean "don't pass this prop"
3092
+ // but spreading { prop: null } explicitly passes null, which differs from
3093
+ // undefined (absent) and crashes components that check `prop !== undefined`.
3066
3094
  fileContent += `\n\nexport default function _CYRouteWrapper(props: any) {
3067
3095
  const _cyArgs = scenarios().data()?.['arguments']?.[0] ?? {};
3068
- return <${funcName} {...props} {..._cyArgs} />;
3096
+ const _cyCleanArgs = Object.fromEntries(Object.entries(_cyArgs).filter(([_, v]) => v !== null));
3097
+ return <${funcName} {...props} {..._cyCleanArgs} />;
3069
3098
  }\n`;
3070
3099
  }
3071
3100
  }
@@ -15,6 +15,18 @@
15
15
  "~codeyam/*": ["./packages/*"]
16
16
  },
17
17
  "sourceMap": true,
18
- "skipLibCheck": true
18
+ "skipLibCheck": true,
19
+ "types": [
20
+ "node",
21
+ "jest",
22
+ "jsdom",
23
+ "better-sqlite3",
24
+ "yargs",
25
+ "pg",
26
+ "ws",
27
+ "react",
28
+ "react-dom",
29
+ "react-resizable"
30
+ ]
19
31
  }
20
32
  }