@codeyam/codeyam-cli 0.1.0-staging.eb21b2f → 0.1.0-staging.f777668

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 (544) 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 +21 -21
  4. package/analyzer-template/packages/ai/package.json +2 -2
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  6. package/analyzer-template/packages/ai/src/lib/completionCall.ts +114 -113
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +259 -5
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  10. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
  11. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +0 -33
  12. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +19 -7
  13. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  14. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  15. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  17. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  18. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  19. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  20. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
  22. package/analyzer-template/packages/aws/package.json +10 -10
  23. package/analyzer-template/packages/database/index.ts +1 -0
  24. package/analyzer-template/packages/database/package.json +3 -3
  25. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  26. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +68 -0
  27. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  28. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  29. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  30. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  31. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  32. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  33. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  34. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  35. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  36. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  37. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  38. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  39. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  40. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  41. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  42. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +22 -0
  43. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  44. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
  45. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  46. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  47. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  48. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  49. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  50. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  51. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  52. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  53. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  54. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  56. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  57. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  58. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  59. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  60. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  61. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  62. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  63. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  64. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  65. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  66. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  67. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  68. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  69. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  70. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  71. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  72. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  73. package/analyzer-template/packages/github/package.json +1 -1
  74. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  75. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  76. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  77. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  78. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  79. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  80. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  81. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +6 -2
  82. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  83. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +14 -2
  84. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  85. package/analyzer-template/project/constructMockCode.ts +168 -48
  86. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  87. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  88. package/analyzer-template/project/start.ts +3 -0
  89. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  90. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  91. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  92. package/analyzer-template/project/writeScenarioComponents.ts +96 -17
  93. package/analyzer-template/tsconfig.json +13 -1
  94. package/background/src/lib/virtualized/project/constructMockCode.js +143 -39
  95. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  96. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  97. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  98. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  99. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  100. package/background/src/lib/virtualized/project/start.js +2 -0
  101. package/background/src/lib/virtualized/project/start.js.map +1 -1
  102. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  103. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  104. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  105. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  106. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  107. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  108. package/background/src/lib/virtualized/project/writeScenarioComponents.js +73 -12
  109. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  110. package/codeyam-cli/scripts/apply-setup.js +208 -11
  111. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  112. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  113. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  114. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  115. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  116. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  117. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  118. package/codeyam-cli/src/cli.js +32 -25
  119. package/codeyam-cli/src/cli.js.map +1 -1
  120. package/codeyam-cli/src/commands/analyze.js +17 -7
  121. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  122. package/codeyam-cli/src/commands/default.js +14 -2
  123. package/codeyam-cli/src/commands/default.js.map +1 -1
  124. package/codeyam-cli/src/commands/editor.js +2607 -0
  125. package/codeyam-cli/src/commands/editor.js.map +1 -0
  126. package/codeyam-cli/src/commands/init.js +40 -11
  127. package/codeyam-cli/src/commands/init.js.map +1 -1
  128. package/codeyam-cli/src/commands/memory.js +29 -58
  129. package/codeyam-cli/src/commands/memory.js.map +1 -1
  130. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  131. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  132. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
  133. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  134. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +635 -0
  135. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  136. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  137. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  138. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +155 -0
  139. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  140. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
  141. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  142. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  143. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  144. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  145. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  146. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +393 -0
  147. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  148. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  149. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  150. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  151. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  152. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +266 -0
  153. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  154. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  155. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  156. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  157. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  158. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +221 -0
  159. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  160. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +213 -0
  161. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  162. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1686 -0
  163. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  164. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  165. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  166. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  167. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  168. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +6 -0
  169. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -1
  170. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +101 -0
  171. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  172. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  173. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  174. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  175. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  176. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  177. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  178. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +246 -0
  179. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  180. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +50 -4
  181. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  182. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +50 -0
  183. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  184. package/codeyam-cli/src/utils/backgroundServer.js +21 -5
  185. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  186. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  187. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  188. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  189. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  190. package/codeyam-cli/src/utils/devServerState.js +71 -0
  191. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  192. package/codeyam-cli/src/utils/editorApi.js +73 -0
  193. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  194. package/codeyam-cli/src/utils/editorAudit.js +159 -0
  195. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  196. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  197. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  198. package/codeyam-cli/src/utils/editorDevServer.js +109 -0
  199. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  200. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  201. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  202. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  203. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  204. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  205. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  206. package/codeyam-cli/src/utils/editorLoaderHelpers.js +81 -0
  207. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  208. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  209. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  210. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  211. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  212. package/codeyam-cli/src/utils/editorPreview.js +106 -0
  213. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  214. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  215. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  216. package/codeyam-cli/src/utils/editorScenarios.js +96 -0
  217. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  218. package/codeyam-cli/src/utils/editorSeedAdapter.js +173 -0
  219. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  220. package/codeyam-cli/src/utils/entityChangeStatus.js +337 -0
  221. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  222. package/codeyam-cli/src/utils/entityChangeStatus.server.js +107 -0
  223. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  224. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  225. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  226. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  227. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  228. package/codeyam-cli/src/utils/git.js +103 -0
  229. package/codeyam-cli/src/utils/git.js.map +1 -1
  230. package/codeyam-cli/src/utils/install-skills.js +57 -15
  231. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  232. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  233. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  234. package/codeyam-cli/src/utils/npmVersionCheck.js +2 -2
  235. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -1
  236. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  237. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  238. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  239. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  240. package/codeyam-cli/src/utils/project.js +15 -5
  241. package/codeyam-cli/src/utils/project.js.map +1 -1
  242. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  243. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  244. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  245. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  246. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  247. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  248. package/codeyam-cli/src/utils/queue/job.js +70 -1
  249. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  250. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  251. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  252. package/codeyam-cli/src/utils/requireSimulations.js +1 -1
  253. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -1
  254. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +5 -6
  255. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
  256. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
  257. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
  258. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
  259. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
  260. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +2 -4
  261. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
  262. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +2 -5
  263. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
  264. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  265. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  266. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  267. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  268. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  269. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  270. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  271. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  272. package/codeyam-cli/src/utils/rules/index.js +1 -0
  273. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  274. package/codeyam-cli/src/utils/rules/parser.js +14 -4
  275. package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
  276. package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
  277. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
  278. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  279. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  280. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  281. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  282. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  283. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  284. package/codeyam-cli/src/utils/scenariosManifest.js +112 -0
  285. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  286. package/codeyam-cli/src/utils/serverState.js +27 -2
  287. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  288. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +82 -11
  289. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  290. package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
  291. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  292. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  293. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  294. package/codeyam-cli/src/utils/testRunner.js +158 -0
  295. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  296. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  297. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  298. package/codeyam-cli/src/utils/versionInfo.js +21 -0
  299. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  300. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  301. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  302. package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
  303. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  304. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  305. package/codeyam-cli/src/webserver/app/lib/git.js +396 -0
  306. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  307. package/codeyam-cli/src/webserver/backgroundServer.js +118 -18
  308. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  309. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-jNYXRRNI.js → CopyButton-DmJveP3T.js} +1 -1
  310. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-bwuHPyTa.js → EntityItem-C76mRRiF.js} +1 -1
  311. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CvzqMxcu.js → EntityTypeBadge-g3saevPb.js} +1 -1
  312. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BH0XDim7.js → EntityTypeIcon-CobE682z.js} +1 -1
  313. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  314. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-yjIHlOGa.js → InteractivePreview-DYFW3lDD.js} +3 -3
  315. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-Cq5o8jL4.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  316. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BvMu2i-g.js → LoadingDots-BU_OAEMP.js} +1 -1
  317. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-kgBTLoJD.js → LogViewer-ceAyBX-H.js} +1 -1
  318. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzPgx-xO.js → ReportIssueModal-djPLI-WV.js} +1 -1
  319. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CwZrv-Ok.js → SafeScreenshot-BED4B6sP.js} +1 -1
  320. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BX2Ny2Qj.js → ScenarioViewer-ZlRKbhrq.js} +3 -3
  321. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  322. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CDpEprKa.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  323. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
  324. package/codeyam-cli/src/webserver/build/client/assets/{_index-BRx8ZGZo.js → _index-C96V0n15.js} +1 -1
  325. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-4S4yPfFw.js → activity.(_tab)-BpKzcsJz.js} +1 -1
  326. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  327. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  328. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  329. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  330. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
  331. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  332. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  333. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  334. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  335. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  336. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  337. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  338. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  339. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  340. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  341. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  342. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  343. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  344. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  345. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  346. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  347. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  348. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  349. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  350. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  351. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  352. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  353. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  354. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  355. package/codeyam-cli/src/webserver/build/client/assets/{book-open-D4IPYH_y.js → book-open-D_nMCFmP.js} +1 -1
  356. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-CG65viiV.js → chevron-down-BH2h1Ea2.js} +1 -1
  357. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-DB3aFuEO.js → chunk-JZWAC4HX-C4pqxYJB.js} +1 -1
  358. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-igfMr5DY.js → circle-check-DyIKORY6.js} +1 -1
  359. package/codeyam-cli/src/webserver/build/client/assets/{copy-Coc4o_8c.js → copy-NDbZjXao.js} +1 -1
  360. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-D1zB-pYc.js → createLucideIcon-CMT1jU2q.js} +1 -1
  361. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CltMNppm.js +1 -0
  362. package/codeyam-cli/src/webserver/build/client/assets/editor-DTEBHY7Z.js +10 -0
  363. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +41 -0
  364. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-B0h9AqE6.js → entity._sha._-DItJnD8s.js} +10 -10
  365. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.js +6 -0
  366. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +6 -0
  367. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  368. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-PePWg17F.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  369. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-I-Wo99C_.js → entry.client-DTvKq3TY.js} +1 -1
  370. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-9sMMAiWJ.js → fileTableUtils-cPo8LiG3.js} +1 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/{files-Co65J0s3.js → files-DO4CZ16O.js} +1 -1
  372. package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +1 -0
  373. package/codeyam-cli/src/webserver/build/client/assets/globals-JMY99HpD.css +1 -0
  374. package/codeyam-cli/src/webserver/build/client/assets/{index-CUM5iXwc.js → index-10oVnAAH.js} +1 -1
  375. package/codeyam-cli/src/webserver/build/client/assets/{index-_417gcQW.js → index-BcvgDzbZ.js} +1 -1
  376. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  377. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  378. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-TzRHMVog.js → loader-circle-BAXYRVEO.js} +1 -1
  379. package/codeyam-cli/src/webserver/build/client/assets/manifest-7aab51c4.js +1 -0
  380. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
  381. package/codeyam-cli/src/webserver/build/client/assets/{pause-hjzB7t2z.js → pause-DTAcYxBt.js} +1 -1
  382. package/codeyam-cli/src/webserver/build/client/assets/root-FRztnN-P.js +67 -0
  383. package/codeyam-cli/src/webserver/build/client/assets/{search-DcAwD_Ln.js → search-fKo7v0Zo.js} +1 -1
  384. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
  385. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DVNJVQgD.js → simulations-B3aOzpCZ.js} +1 -1
  386. package/codeyam-cli/src/webserver/build/client/assets/{terminal-DbEAHMbA.js → terminal-BG4heKCG.js} +1 -1
  387. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CAD5b1o_.js → triangle-alert-DtSmdtM4.js} +1 -1
  388. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +1 -0
  389. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  390. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DZlYx2c4.js → useReportContext-O-jkvSPx.js} +1 -1
  391. package/codeyam-cli/src/webserver/build/client/assets/{useToast-ihdMtlf6.js → useToast-9FIWuYfK.js} +1 -1
  392. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  393. package/codeyam-cli/src/webserver/build/server/assets/index-Cz751Dm2.js +1 -0
  394. package/codeyam-cli/src/webserver/build/server/assets/server-build-DSylnYVM.js +367 -0
  395. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  396. package/codeyam-cli/src/webserver/build-info.json +5 -5
  397. package/codeyam-cli/src/webserver/devServer.js +39 -5
  398. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  399. package/codeyam-cli/src/webserver/editorProxy.js +431 -0
  400. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  401. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  402. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
  403. package/codeyam-cli/src/webserver/server.js +258 -1
  404. package/codeyam-cli/src/webserver/server.js.map +1 -1
  405. package/codeyam-cli/src/webserver/terminalServer.js +706 -0
  406. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  407. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  408. package/codeyam-cli/templates/editor-step-hook.py +208 -0
  409. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  410. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  411. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  412. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  413. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  414. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  415. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  416. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  417. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  418. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  419. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  420. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  421. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  422. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  423. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  424. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
  425. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  426. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +38 -0
  427. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  428. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  429. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  430. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  431. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +89 -0
  432. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  433. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  434. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  435. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  436. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  437. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  438. package/codeyam-cli/templates/rule-notification-hook.py +44 -17
  439. package/codeyam-cli/templates/rule-reflection-hook.py +24 -4
  440. package/codeyam-cli/templates/rules-instructions.md +34 -88
  441. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  442. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +136 -0
  443. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  444. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  445. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  446. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  447. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  448. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  449. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  450. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  451. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  452. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  453. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  454. package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -2
  455. package/package.json +21 -14
  456. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  457. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  458. package/packages/ai/src/lib/completionCall.js +10 -7
  459. package/packages/ai/src/lib/completionCall.js.map +1 -1
  460. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +234 -3
  461. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  462. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  463. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  464. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  465. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  466. package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
  467. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  468. package/packages/ai/src/lib/generateExecutionFlows.js +0 -11
  469. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  470. package/packages/analyze/src/lib/ProjectAnalyzer.js +13 -4
  471. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  472. package/packages/analyze/src/lib/asts/index.js +4 -2
  473. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  474. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  475. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  476. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  477. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  478. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  479. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  480. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  481. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  482. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  483. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  484. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  485. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  486. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
  487. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  488. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
  489. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  490. package/packages/database/index.js +1 -0
  491. package/packages/database/index.js.map +1 -1
  492. package/packages/database/src/lib/kysely/db.js +5 -0
  493. package/packages/database/src/lib/kysely/db.js.map +1 -1
  494. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +51 -0
  495. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  496. package/packages/database/src/lib/loadCommits.js +23 -13
  497. package/packages/database/src/lib/loadCommits.js.map +1 -1
  498. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  499. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  500. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  501. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  502. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  503. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  504. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  505. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  506. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  507. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  508. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  509. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  510. package/packages/utils/src/lib/fs/rsyncCopy.js +6 -2
  511. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  512. package/scripts/npm-post-install.cjs +34 -0
  513. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -120
  514. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  515. package/codeyam-cli/src/commands/list.js +0 -31
  516. package/codeyam-cli/src/commands/list.js.map +0 -1
  517. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  518. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  519. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  520. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  521. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-EhOseatT.js +0 -34
  522. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DHKuQSmR.js +0 -17
  523. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-JTAjQ54M.js +0 -1
  524. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DjLxr2JB.js +0 -6
  525. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-CtYowLOt.js +0 -6
  526. package/codeyam-cli/src/webserver/build/client/assets/git-BdHOxVfg.js +0 -15
  527. package/codeyam-cli/src/webserver/build/client/assets/globals-CCgBKWy4.css +0 -1
  528. package/codeyam-cli/src/webserver/build/client/assets/labs-BK0C1H1T.js +0 -1
  529. package/codeyam-cli/src/webserver/build/client/assets/manifest-390cb8fa.js +0 -1
  530. package/codeyam-cli/src/webserver/build/client/assets/memory-CzZySbBE.js +0 -78
  531. package/codeyam-cli/src/webserver/build/client/assets/root-DnbDhvTU.js +0 -62
  532. package/codeyam-cli/src/webserver/build/client/assets/settings-CclxrcPK.js +0 -1
  533. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BqgrAzs3.js +0 -1
  534. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DAFqfEDH.js +0 -2
  535. package/codeyam-cli/src/webserver/build/server/assets/index-CXfuiwt3.js +0 -1
  536. package/codeyam-cli/src/webserver/build/server/assets/server-build-BSvme_Ao.js +0 -259
  537. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  538. package/scripts/finalize-analyzer.cjs +0 -13
  539. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  540. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  541. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  542. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  543. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  544. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -1108,6 +1108,33 @@ export class ScopeDataStructure {
1108
1108
  return;
1109
1109
  }
1110
1110
 
1111
+ // Case 3: Circular reference through scope-suffixed names (____cyScope pattern)
1112
+ // When a named arrow function is defined inside a scope (e.g., useEffect callback):
1113
+ // const identifyUser = async () => { ... };
1114
+ // identifyUser();
1115
+ // This creates a variable "identifyUser" and a scope "identifyUser____cyScope9F".
1116
+ // Mutual equivalencies between these cause infinite loops in Phase 2 because
1117
+ // processing one triggers addToSchema → followEquivalencies → addEquivalency
1118
+ // on the reverse, which repeats indefinitely.
1119
+ // Only block when the REVERSE direction already exists (creating a cycle).
1120
+ // The initial one-directional equivalency is necessary for scope resolution.
1121
+ if (
1122
+ path &&
1123
+ equivalentPath &&
1124
+ (equivalentPath.startsWith(path + '____') ||
1125
+ path.startsWith(equivalentPath + '____'))
1126
+ ) {
1127
+ // Check if the reverse equivalency already exists
1128
+ const reverseEquivalencies =
1129
+ scopeNode.equivalencies[equivalentPath] || [];
1130
+ const reverseExists = reverseEquivalencies.some(
1131
+ (v) => v.schemaPath === path,
1132
+ );
1133
+ if (reverseExists) {
1134
+ return;
1135
+ }
1136
+ }
1137
+
1111
1138
  if (!equivalentScopeName) {
1112
1139
  console.error(
1113
1140
  'CodeYam Error: Missing equivalent scope name - FULL CONTEXT:',
@@ -3360,6 +3387,22 @@ export class ScopeDataStructure {
3360
3387
  * ensure all sub-paths of that variable are reflected under signature[N].
3361
3388
  */
3362
3389
  private propagateParameterToSignaturePaths(scopeNode: ScopeNode) {
3390
+ // Helper: check if a type is a concrete scalar that cannot have sub-properties.
3391
+ const SCALAR_TYPES = new Set([
3392
+ 'string',
3393
+ 'number',
3394
+ 'boolean',
3395
+ 'bigint',
3396
+ 'symbol',
3397
+ 'void',
3398
+ 'never',
3399
+ ]);
3400
+ const isDefinitelyScalar = (type: string): boolean => {
3401
+ const parts = type.split('|').map((s) => s.trim());
3402
+ const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
3403
+ return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
3404
+ };
3405
+
3363
3406
  // Find variable → signature[N] equivalencies
3364
3407
  for (const [varName, equivalencies] of Object.entries(
3365
3408
  scopeNode.equivalencies,
@@ -3390,7 +3433,38 @@ export class ScopeDataStructure {
3390
3433
 
3391
3434
  // Only add if the signature path doesn't already exist
3392
3435
  if (!scopeNode.schema[sigKey]) {
3393
- scopeNode.schema[sigKey] = scopeNode.schema[key];
3436
+ // Check if this path represents variable conflation:
3437
+ // When a standalone variable (e.g., showWorkoutForm from useState)
3438
+ // appears as a sub-property of a scalar-typed ancestor (e.g.,
3439
+ // activity_type = "string"), it's from scope conflation, not real
3440
+ // property access. Block these while allowing legitimate built-in
3441
+ // accesses like string.length or string.slice.
3442
+ let isConflatedPath = false;
3443
+ let checkPos = signaturePath.length;
3444
+ while (true) {
3445
+ checkPos = sigKey.indexOf('.', checkPos + 1);
3446
+ if (checkPos === -1) break;
3447
+ const ancestorPath = sigKey.substring(0, checkPos);
3448
+ const ancestorType = scopeNode.schema[ancestorPath];
3449
+ if (ancestorType && isDefinitelyScalar(ancestorType)) {
3450
+ // Ancestor is scalar — check if the immediate sub-property
3451
+ // is also a standalone variable (indicating conflation)
3452
+ const afterDot = sigKey.substring(checkPos + 1);
3453
+ const nextSep = afterDot.search(/[.\[]/);
3454
+ const subPropName =
3455
+ nextSep === -1
3456
+ ? afterDot
3457
+ : afterDot.substring(0, nextSep);
3458
+ if (scopeNode.schema[subPropName] !== undefined) {
3459
+ isConflatedPath = true;
3460
+ break;
3461
+ }
3462
+ }
3463
+ }
3464
+
3465
+ if (!isConflatedPath) {
3466
+ scopeNode.schema[sigKey] = scopeNode.schema[key];
3467
+ }
3394
3468
  }
3395
3469
  }
3396
3470
  }
@@ -4165,6 +4239,24 @@ export class ScopeDataStructure {
4165
4239
  }
4166
4240
  }
4167
4241
 
4242
+ // Helper: check if a type is a concrete scalar that cannot have sub-properties.
4243
+ // e.g., "string", "number | undefined", "boolean | null" are scalar.
4244
+ // "object", "array", "function", "unknown", "Workout", etc. are NOT scalar.
4245
+ const SCALAR_TYPES = new Set([
4246
+ 'string',
4247
+ 'number',
4248
+ 'boolean',
4249
+ 'bigint',
4250
+ 'symbol',
4251
+ 'void',
4252
+ 'never',
4253
+ ]);
4254
+ const isDefinitelyScalarType = (type: string): boolean => {
4255
+ const parts = type.split('|').map((s) => s.trim());
4256
+ const base = parts.filter((s) => s !== 'undefined' && s !== 'null');
4257
+ return base.length > 0 && base.every((b) => SCALAR_TYPES.has(b));
4258
+ };
4259
+
4168
4260
  // Propagate nested paths from variables to their signature equivalents
4169
4261
  // e.g., if workouts = signature[0].workouts, then workouts[].title becomes
4170
4262
  // signature[0].workouts[].title
@@ -4189,7 +4281,69 @@ export class ScopeDataStructure {
4189
4281
 
4190
4282
  // Add to schema if not already present
4191
4283
  if (!tempScopeNode.schema[signatureKey]) {
4192
- tempScopeNode.schema[signatureKey] = schema[schemaKey];
4284
+ // Check if this path represents variable conflation:
4285
+ // When a standalone variable (e.g., showWorkoutForm from useState)
4286
+ // appears as a sub-property of a scalar-typed ancestor (e.g.,
4287
+ // activity_type = "string"), it's from scope conflation, not real
4288
+ // property access. Block these while allowing legitimate built-in
4289
+ // accesses like string.length or string.slice.
4290
+ let isConflatedPath = false;
4291
+ let checkPos = signaturePath.length;
4292
+ while (true) {
4293
+ checkPos = signatureKey.indexOf('.', checkPos + 1);
4294
+ if (checkPos === -1) break;
4295
+ const ancestorPath = signatureKey.substring(0, checkPos);
4296
+ const ancestorType = tempScopeNode.schema[ancestorPath];
4297
+ if (ancestorType && isDefinitelyScalarType(ancestorType)) {
4298
+ // Ancestor is scalar — check if the immediate sub-property
4299
+ // is also a standalone variable (indicating conflation)
4300
+ const afterDot = signatureKey.substring(checkPos + 1);
4301
+ const nextSep = afterDot.search(/[.\[]/);
4302
+ const subPropName =
4303
+ nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
4304
+ if (schema[subPropName] !== undefined) {
4305
+ isConflatedPath = true;
4306
+ break;
4307
+ }
4308
+ }
4309
+ }
4310
+
4311
+ if (!isConflatedPath) {
4312
+ tempScopeNode.schema[signatureKey] = schema[schemaKey];
4313
+ }
4314
+ }
4315
+ }
4316
+ }
4317
+ }
4318
+
4319
+ // Post-process: filter out conflated signature paths.
4320
+ // During phase 2 scope analysis, useState(false) conflation can create
4321
+ // bad paths like signature[0].mockWorkouts[].activity_type.showWorkoutForm
4322
+ // directly in scopeNode.schema. These flow through signatureInSchema into
4323
+ // tempScopeNode.schema without any guard. Filter them out here by checking:
4324
+ // 1. An ancestor in the path has a concrete scalar type (string, number, boolean, etc.)
4325
+ // 2. The immediate sub-property of that scalar ancestor is also a standalone
4326
+ // variable in the schema (indicating conflation, not a real property access)
4327
+ for (const key of Object.keys(tempScopeNode.schema)) {
4328
+ if (!key.startsWith('signature[')) continue;
4329
+
4330
+ // Walk through the path looking for scalar-typed ancestors
4331
+ let pos = 0;
4332
+ while (true) {
4333
+ pos = key.indexOf('.', pos + 1);
4334
+ if (pos === -1) break;
4335
+ const ancestorPath = key.substring(0, pos);
4336
+ const ancestorType = tempScopeNode.schema[ancestorPath];
4337
+ if (ancestorType && isDefinitelyScalarType(ancestorType)) {
4338
+ // Found a scalar ancestor — check if the sub-property name
4339
+ // is a standalone variable in the getSchema() result
4340
+ const afterDot = key.substring(pos + 1);
4341
+ const nextSep = afterDot.search(/[.\[]/);
4342
+ const subPropName =
4343
+ nextSep === -1 ? afterDot : afterDot.substring(0, nextSep);
4344
+ if (schema[subPropName] !== undefined) {
4345
+ delete tempScopeNode.schema[key];
4346
+ break;
4193
4347
  }
4194
4348
  }
4195
4349
  }
@@ -4929,9 +5083,109 @@ export class ScopeDataStructure {
4929
5083
  // Replace cyScope placeholders in all external function call data
4930
5084
  // This ensures call signatures and schema paths use actual callback text
4931
5085
  // instead of internal cyScope names, preventing mock data merge conflicts.
4932
- return this.externalFunctionCalls.map((efc) =>
4933
- this.cleanCyScopeFromFunctionCallInfo(efc),
4934
- );
5086
+ const rootScopeName = this.scopeTreeManager.getRootName();
5087
+ const rootSchema = this.scopeNodes[rootScopeName]?.schema ?? {};
5088
+
5089
+ return this.externalFunctionCalls.map((efc) => {
5090
+ const cleaned = this.cleanCyScopeFromFunctionCallInfo(efc);
5091
+ return this.filterConflatedExternalPaths(cleaned, rootSchema);
5092
+ });
5093
+ }
5094
+
5095
+ /**
5096
+ * Filters out conflated paths from external function call schemas.
5097
+ *
5098
+ * When multiple useState(false) calls create equivalency conflation during
5099
+ * Phase 1 analysis, standalone boolean state variables (like showWorkoutForm,
5100
+ * showGoalForm) can bleed into external function call schemas as sub-properties
5101
+ * of unrelated data fields (like data[].activity_type.showWorkoutForm).
5102
+ *
5103
+ * Detection: group sub-properties by parent path. If 2+ sub-properties of
5104
+ * the same parent all match standalone root scope variable names, treat them
5105
+ * as conflation artifacts and remove them.
5106
+ */
5107
+ private filterConflatedExternalPaths(
5108
+ efc: FunctionCallInfo,
5109
+ rootSchema: Record<string, string>,
5110
+ ): FunctionCallInfo {
5111
+ // Build a set of top-level root scope variable names (simple names, no dots/brackets)
5112
+ const topLevelRootVars = new Set<string>();
5113
+ for (const key of Object.keys(rootSchema)) {
5114
+ if (!key.includes('.') && !key.includes('[')) {
5115
+ topLevelRootVars.add(key);
5116
+ }
5117
+ }
5118
+
5119
+ if (topLevelRootVars.size === 0) return efc;
5120
+
5121
+ // Group sub-property matches by their parent path.
5122
+ // For a path like "...data[].activity_type.showWorkoutForm",
5123
+ // parent = "...data[].activity_type", child = "showWorkoutForm"
5124
+ const parentToConflatedKeys = new Map<string, string[]>();
5125
+
5126
+ for (const key of Object.keys(efc.schema)) {
5127
+ const lastDot = key.lastIndexOf('.');
5128
+ if (lastDot === -1) continue;
5129
+
5130
+ const parent = key.substring(0, lastDot);
5131
+ const child = key.substring(lastDot + 1);
5132
+
5133
+ // Skip array access or function call patterns
5134
+ if (child.includes('[') || child.includes('(')) continue;
5135
+
5136
+ // Only consider paths inside array element chains (contains []).
5137
+ // Direct children of functionCallReturnValue are legitimate destructured
5138
+ // return values, not conflation. Conflation happens deeper in the chain
5139
+ // when array element fields get corrupted sub-properties.
5140
+ if (!parent.includes('[')) continue;
5141
+
5142
+ if (topLevelRootVars.has(child)) {
5143
+ if (!parentToConflatedKeys.has(parent)) {
5144
+ parentToConflatedKeys.set(parent, []);
5145
+ }
5146
+ parentToConflatedKeys.get(parent)!.push(key);
5147
+ }
5148
+ }
5149
+
5150
+ // Only filter when 2+ sub-properties of the same parent match root scope vars.
5151
+ // This threshold avoids false positives from coincidental name matches.
5152
+ const keysToRemove = new Set<string>();
5153
+ const parentsToRestore = new Set<string>();
5154
+
5155
+ for (const [parent, conflatedKeys] of parentToConflatedKeys) {
5156
+ if (conflatedKeys.length >= 2) {
5157
+ for (const key of conflatedKeys) {
5158
+ keysToRemove.add(key);
5159
+ }
5160
+ parentsToRestore.add(parent);
5161
+ }
5162
+ }
5163
+
5164
+ if (keysToRemove.size === 0) return efc;
5165
+
5166
+ // Create a new schema without the conflated paths
5167
+ const newSchema: Record<string, string> = {};
5168
+ for (const [key, value] of Object.entries(efc.schema)) {
5169
+ if (keysToRemove.has(key)) continue;
5170
+
5171
+ // Restore parent type: if it was changed to "object" because of conflated
5172
+ // sub-properties, and now all those sub-properties are removed, change it
5173
+ // back to "unknown" (we don't know the original type)
5174
+ if (parentsToRestore.has(key) && value === 'object') {
5175
+ // Check if there are any remaining sub-properties
5176
+ const hasRemainingSubProps = Object.keys(efc.schema).some(
5177
+ (k) =>
5178
+ !keysToRemove.has(k) &&
5179
+ k !== key &&
5180
+ (k.startsWith(key + '.') || k.startsWith(key + '[')),
5181
+ );
5182
+ newSchema[key] = hasRemainingSubProps ? value : 'unknown';
5183
+ } else {
5184
+ newSchema[key] = value;
5185
+ }
5186
+ }
5187
+
5188
+ return { ...efc, schema: newSchema };
4935
5189
  }
4936
5190
 
4937
5191
  /**
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Coerces primitive values to empty arrays when the schema expects an array.
3
+ *
4
+ * The LLM sometimes generates a primitive (boolean, number, string) where the
5
+ * schema expects an array. For example:
6
+ * Schema: { webapps: [{ name: "string" }] }
7
+ * LLM output: { webapps: true }
8
+ *
9
+ * This causes runtime errors like `TypeError: config.webapps?.forEach is not a function`
10
+ * because the code expects an array but gets a boolean.
11
+ *
12
+ * Coercion rule:
13
+ * - primitive → array: replace with []
14
+ *
15
+ * Null and undefined values are preserved (they may be intentionally nullable).
16
+ *
17
+ * @param data The mock data object to coerce (mutated in place)
18
+ * @param schema The schema describing expected types
19
+ */
20
+ export default function coercePrimitivesToArraysBySchema<T>(
21
+ data: T,
22
+ schema: unknown,
23
+ ): T {
24
+ if (data === null || data === undefined) {
25
+ return data;
26
+ }
27
+
28
+ if (typeof data !== 'object') {
29
+ return data;
30
+ }
31
+
32
+ if (Array.isArray(data)) {
33
+ const itemSchema = Array.isArray(schema) ? schema[0] : undefined;
34
+ for (let i = 0; i < data.length; i++) {
35
+ data[i] = coercePrimitivesToArraysBySchema(data[i], itemSchema);
36
+ }
37
+ return data;
38
+ }
39
+
40
+ const dataObj = data as Record<string, unknown>;
41
+ const schemaObj = schema as Record<string, unknown> | undefined;
42
+
43
+ for (const key of Object.keys(dataObj)) {
44
+ const value = dataObj[key];
45
+ const fieldSchema = schemaObj?.[key];
46
+
47
+ if (value === null || value === undefined) {
48
+ continue;
49
+ }
50
+
51
+ if (typeof value !== 'object' && Array.isArray(fieldSchema)) {
52
+ // Schema expects an array but the value is a primitive.
53
+ // Replace with an empty array.
54
+ dataObj[key] = [];
55
+ } else if (typeof value === 'object' && value !== null) {
56
+ // Both value and schema are objects — recurse
57
+ coercePrimitivesToArraysBySchema(value, fieldSchema);
58
+ }
59
+ }
60
+
61
+ return data;
62
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Recursively strips `_nullable` keys from LLM-generated mock data.
3
+ *
4
+ * The `_nullable` marker is an internal CodeYam concept used in type definitions
5
+ * to indicate that a field can be null/undefined. The LLM sometimes includes
6
+ * these markers in its generated scenario data, which causes runtime errors
7
+ * when code iterates over object keys (e.g., `Object.keys(importedBy)` picks
8
+ * up `_nullable` as a key alongside real data).
9
+ *
10
+ * This function mutates the input object in-place, consistent with other
11
+ * post-processing helpers like `convertNullToUndefinedBySchema`.
12
+ */
13
+ export default function stripNullableMarkers(
14
+ data: Record<string, unknown>,
15
+ ): void {
16
+ if (data == null || typeof data !== 'object') return;
17
+
18
+ // Delete _nullable from this level
19
+ if ('_nullable' in data) {
20
+ delete data._nullable;
21
+ }
22
+
23
+ // Recurse into nested objects and arrays
24
+ for (const value of Object.values(data)) {
25
+ if (Array.isArray(value)) {
26
+ for (const item of value) {
27
+ if (item !== null && typeof item === 'object' && !Array.isArray(item)) {
28
+ stripNullableMarkers(item as Record<string, unknown>);
29
+ }
30
+ }
31
+ } else if (value !== null && typeof value === 'object') {
32
+ stripNullableMarkers(value as Record<string, unknown>);
33
+ }
34
+ }
35
+ }
@@ -19,6 +19,8 @@ import convertNullToUndefinedBySchema from './dataStructure/helpers/convertNullT
19
19
  import convertTypeAnnotationsToValues from './dataStructure/helpers/convertTypeAnnotationsToValues';
20
20
  import fixNullIdsBySchema from './dataStructure/helpers/fixNullIdsBySchema';
21
21
  import coerceObjectsToPrimitivesBySchema from './dataStructure/helpers/coerceObjectsToPrimitivesBySchema';
22
+ import coercePrimitivesToArraysBySchema from './dataStructure/helpers/coercePrimitivesToArraysBySchema';
23
+ import stripNullableMarkers from './dataStructure/helpers/stripNullableMarkers';
22
24
  import { JsonTypeDefinition } from '~codeyam/types';
23
25
  import { deepMerge } from '~codeyam/generate';
24
26
  import {
@@ -172,6 +174,46 @@ function findKeyPath(
172
174
  return null;
173
175
  }
174
176
 
177
+ /**
178
+ * Strip primitive values from `source` when the `destination` already has an
179
+ * array or object at the same key. Returns a cleaned copy of source (or null
180
+ * if nothing remains after stripping).
181
+ *
182
+ * This prevents misplaced LLM data (e.g., `{ webapps: true }`) from
183
+ * overwriting correct complex values (e.g., `{ webapps: [...] }`) during
184
+ * deep merge in relocateMisplacedNestedKeys.
185
+ */
186
+ function stripPrimitivesOverwritingComplexValues(
187
+ destination: Record<string, unknown>,
188
+ source: unknown,
189
+ ): Record<string, unknown> | null {
190
+ if (typeof source !== 'object' || source === null || Array.isArray(source)) {
191
+ return null;
192
+ }
193
+
194
+ const result: Record<string, unknown> = {};
195
+ let hasKeys = false;
196
+
197
+ for (const key of Object.keys(source as Record<string, unknown>)) {
198
+ const srcVal = (source as Record<string, unknown>)[key];
199
+ const dstVal = destination[key];
200
+
201
+ // If destination has an array or object but source has a primitive, skip it
202
+ if (
203
+ typeof dstVal === 'object' &&
204
+ dstVal !== null &&
205
+ typeof srcVal !== 'object'
206
+ ) {
207
+ continue;
208
+ }
209
+
210
+ result[key] = srcVal;
211
+ hasKeys = true;
212
+ }
213
+
214
+ return hasKeys ? result : null;
215
+ }
216
+
175
217
  /**
176
218
  * Relocate misplaced nested keys in mockData to their correct position
177
219
  * based on the dataForMocks structure.
@@ -233,12 +275,22 @@ function relocateMisplacedNestedKeys(
233
275
  }
234
276
 
235
277
  // Deep merge the value into the correct location
236
- // Use deep merge to preserve existing data at that location
278
+ // Use deep merge to preserve existing data at that location.
279
+ // Before merging, strip primitives from the misplaced value that would
280
+ // overwrite arrays/objects at the destination. The misplaced data is lower
281
+ // quality — the LLM put it in the wrong place — so primitives like `true`
282
+ // should not overwrite correct complex values like arrays.
237
283
  if (current[key] !== undefined && typeof current[key] === 'object') {
238
- current[key] = deepMerge(
284
+ const safeValue = stripPrimitivesOverwritingComplexValues(
239
285
  current[key] as Record<string, unknown>,
240
286
  value as Record<string, unknown>,
241
287
  );
288
+ if (safeValue !== null) {
289
+ current[key] = deepMerge(
290
+ current[key] as Record<string, unknown>,
291
+ safeValue,
292
+ );
293
+ }
242
294
  } else {
243
295
  current[key] = value;
244
296
  }
@@ -1063,6 +1115,18 @@ export async function generateDataForScenario({
1063
1115
  );
1064
1116
  }
1065
1117
 
1118
+ // Strip _nullable markers from LLM-generated mock data.
1119
+ // The _nullable marker is an internal CodeYam concept used in type definitions
1120
+ // to indicate that a field can be null/undefined. The LLM sometimes includes
1121
+ // these markers in its generated data, which causes runtime errors when code
1122
+ // iterates over object keys (e.g., Object.keys(importedBy) picks up "_nullable",
1123
+ // then Object.keys(importedBy["_nullable"]) calls Object.keys(null) and throws).
1124
+ if (fullScenarioData.data.mockData) {
1125
+ stripNullableMarkers(
1126
+ fullScenarioData.data.mockData as Record<string, unknown>,
1127
+ );
1128
+ }
1129
+
1066
1130
  // Relocate misplaced nested keys to their correct position.
1067
1131
  // The LLM sometimes places nested keys at root level instead of inside their
1068
1132
  // parent object (e.g., 'fastener' at root instead of inside 'trpc').
@@ -1098,6 +1162,18 @@ export async function generateDataForScenario({
1098
1162
  );
1099
1163
  }
1100
1164
 
1165
+ // Coerce primitives to empty arrays when the schema expects an array.
1166
+ // The LLM sometimes generates a primitive (e.g., `webapps: true`) where the
1167
+ // schema expects an array (e.g., `webapps: [{ name: "string" }]`).
1168
+ // This causes runtime errors like "TypeError: config.webapps?.forEach is not a function".
1169
+ // Must run AFTER coerceObjectsToPrimitivesBySchema and BEFORE convertCommaSeparatedStringsToArrays.
1170
+ if (structure.dataForMocks && fullScenarioData.data.mockData) {
1171
+ coercePrimitivesToArraysBySchema(
1172
+ fullScenarioData.data.mockData,
1173
+ structure.dataForMocks,
1174
+ );
1175
+ }
1176
+
1101
1177
  // Convert comma-separated strings to arrays when appropriate.
1102
1178
  // The LLM sometimes generates strings like "color,size" instead of arrays
1103
1179
  // like ["color", "size"] when the schema type is incorrectly inferred as
@@ -129,19 +129,6 @@ export default function generateExecutionFlows({
129
129
  fullToShortPathMap[fullPath] = shortPath;
130
130
  }
131
131
 
132
- console.log(
133
- `[generateExecutionFlows] ${entity.name}: attributesMap has ${Object.keys(resolvedAttributesMap).length} keys, fullToShortPathMap has ${Object.keys(fullToShortPathMap).length} entries`,
134
- );
135
- console.log(
136
- `[generateExecutionFlows] ${entity.name}: attributesMap keys: [${Object.keys(resolvedAttributesMap).join(', ')}]`,
137
- );
138
- console.log(
139
- `[generateExecutionFlows] ${entity.name}: fullToShortPathMap: ${JSON.stringify(fullToShortPathMap)}`,
140
- );
141
- console.log(
142
- `[generateExecutionFlows] ${entity.name}: equivalentSignatureVariables: ${JSON.stringify(equivalentSignatureVariables)}`,
143
- );
144
-
145
132
  // Get pre-computed conditional data from metadata
146
133
  const conditionalUsages: Record<string, ConditionalUsage[]> =
147
134
  entity.metadata?.isolatedDataStructure?.conditionalUsages ?? {};
@@ -186,26 +173,6 @@ export default function generateExecutionFlows({
186
173
  }
187
174
  }
188
175
 
189
- console.log(
190
- `[generateExecutionFlows] ${entity.name}: conditionalUsages keys: [${Object.keys(conditionalUsages).join(', ')}]`,
191
- );
192
- console.log(
193
- `[generateExecutionFlows] ${entity.name}: conditionalUsages sourceDataPaths: ${JSON.stringify(
194
- Object.fromEntries(
195
- Object.entries(conditionalUsages).map(([k, v]) => [
196
- k,
197
- (v as any[]).map((u: any) => u.sourceDataPath ?? '(none)'),
198
- ]),
199
- ),
200
- )}`,
201
- );
202
- console.log(
203
- `[generateExecutionFlows] ${entity.name}: compoundConditionals count: ${compoundConditionals.length}`,
204
- );
205
- console.log(
206
- `[generateExecutionFlows] ${entity.name}: sourceEquivalencies keys count: ${Object.keys(mergedDataStructure.sourceEquivalencies ?? {}).length}`,
207
- );
208
-
209
176
  const conditionalsBasedFlows = generateExecutionFlowsFromConditionals({
210
177
  conditionalUsages,
211
178
  compoundConditionals,
@@ -46,6 +46,12 @@ export class ProjectAnalyzer {
46
46
  lib.asts.createProgramFromTsConfigPath(configPath, excludePatterns),
47
47
  );
48
48
 
49
+ if (this.programs.length === 0) {
50
+ throw new Error(
51
+ 'No TypeScript programs could be created — no tsconfig.json found',
52
+ );
53
+ }
54
+
49
55
  // Primary program is the first one (usually root) for backward compatibility
50
56
  this.program = this.programs[0];
51
57
  this.typeChecker = this.program.getTypeChecker();
@@ -334,17 +340,23 @@ export class ProjectAnalyzer {
334
340
  * Refresh the TypeScript program to pick up file changes
335
341
  */
336
342
  refreshProgram(): void {
337
- // Memory logging: Capture state before refresh
338
- const memBefore = process.memoryUsage();
339
-
340
343
  // Apply the same unapprovedPaths filtering when refreshing
341
344
  const excludePatterns =
342
345
  this.project.metadata?.unapprovedPaths?.filter(Boolean) || [];
343
346
 
344
- // Refresh all programs
345
- this.programs = this.tsConfigPaths.map((configPath) =>
346
- lib.asts.createProgramFromTsConfigPath(configPath, excludePatterns),
347
- );
347
+ // Release old programs and caches BEFORE creating new ones to reduce peak memory.
348
+ // Without this, both old (~1.7GB) and new (~1.7GB) programs coexist during creation,
349
+ // causing OOM on monorepos with multiple tsconfigs.
350
+ this.programs = [];
351
+ this.sourceFileByPath.clear();
352
+ this.typeCheckerByPath.clear();
353
+
354
+ // Create programs one at a time so each old program can be GC'd before the next
355
+ for (const configPath of this.tsConfigPaths) {
356
+ this.programs.push(
357
+ lib.asts.createProgramFromTsConfigPath(configPath, excludePatterns),
358
+ );
359
+ }
348
360
 
349
361
  // Update primary program for backward compatibility
350
362
  this.program = this.programs[0];
@@ -95,8 +95,13 @@ export function createProgramFromTsConfigPath(
95
95
  throw new Error('Could not parse tsconfig.json');
96
96
  }
97
97
 
98
- // Filter file names based on exclude patterns to reduce memory usage
99
- let fileNames = parsedCommandLine.fileNames;
98
+ // Always filter out node_modules from root files to prevent OOM on large projects.
99
+ // This only removes them as root compilation targets — TypeScript's module resolution
100
+ // still follows imports into node_modules for type info when processing source files.
101
+ let fileNames = parsedCommandLine.fileNames.filter(
102
+ (f) => !f.includes('/node_modules/'),
103
+ );
104
+
100
105
  if (excludePatterns && excludePatterns.length > 0) {
101
106
  const regexPatterns = excludePatterns
102
107
  .map((pattern) => {
@@ -39,6 +39,7 @@ export function getNodeType(node: ts.Node, sourceFile: ts.SourceFile) {
39
39
  case 'StringLiteral':
40
40
  case 'NumericLiteral':
41
41
  case 'ObjectLiteralExpression':
42
+ case 'ArrayLiteralExpression':
42
43
  nodeType = 'data';
43
44
  break;
44
45
  case 'TypeAliasDeclaration':
@@ -310,7 +310,15 @@ export default async function analyzeEntities({
310
310
  );
311
311
 
312
312
  // Flush transformation trace if tracing is enabled
313
- transformationTracer.flush();
313
+ // Wrapped in try/catch because trace data can exceed V8's max string length
314
+ // for large projects, and we must not crash the analysis process over tracing.
315
+ try {
316
+ transformationTracer.flush();
317
+ } catch (e) {
318
+ console.warn(
319
+ `CodeYam Warning: Failed to flush transformation trace: ${e.message}`,
320
+ );
321
+ }
314
322
 
315
323
  return analyses;
316
324
 
@@ -100,12 +100,6 @@ export function getCandidatesReadyForCapture(
100
100
  continue;
101
101
  }
102
102
 
103
- // Skip notExported entities - they can't be imported into the simulation
104
- // environment and will always fail capture. Don't mark them as ready.
105
- if (candidate.entity?.metadata?.notExported) {
106
- continue;
107
- }
108
-
109
103
  // Get all transitive dependencies
110
104
  const candidateKey = `${candidate.filePath}:${candidate.entityName}`;
111
105
  const { missingDependencies } = getTransitiveDependencies(