@codeyam/codeyam-cli 0.1.0-staging.036391e → 0.1.0-staging.039fa00

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 (588) 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 +19 -19
  4. package/analyzer-template/packages/ai/index.ts +1 -0
  5. package/analyzer-template/packages/ai/package.json +2 -2
  6. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +14 -0
  7. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  8. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +101 -0
  9. package/analyzer-template/packages/ai/src/lib/astScopes/sharedPatterns.ts +28 -0
  10. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +6 -0
  11. package/analyzer-template/packages/ai/src/lib/completionCall.ts +114 -113
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +435 -13
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +70 -19
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  16. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +40 -13
  17. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +110 -7
  18. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +134 -2
  19. package/analyzer-template/packages/ai/src/lib/generateExecutionFlowsFromConditionals.ts +359 -142
  20. package/analyzer-template/packages/ai/src/lib/mergeJsonTypeDefinitions.ts +5 -0
  21. package/analyzer-template/packages/ai/src/lib/promptGenerators/collapseNullableObjects.ts +118 -0
  22. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.ts +24 -4
  23. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +6 -0
  24. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  25. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +18 -0
  26. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  27. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  28. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  29. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  30. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +50 -25
  31. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  32. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +176 -80
  33. package/analyzer-template/packages/aws/package.json +10 -10
  34. package/analyzer-template/packages/database/index.ts +1 -0
  35. package/analyzer-template/packages/database/package.json +3 -3
  36. package/analyzer-template/packages/database/src/lib/analysisBranchToDb.ts +1 -1
  37. package/analyzer-template/packages/database/src/lib/analysisToDb.ts +1 -1
  38. package/analyzer-template/packages/database/src/lib/branchToDb.ts +1 -1
  39. package/analyzer-template/packages/database/src/lib/commitBranchToDb.ts +1 -1
  40. package/analyzer-template/packages/database/src/lib/commitToDb.ts +1 -1
  41. package/analyzer-template/packages/database/src/lib/fileToDb.ts +1 -1
  42. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  43. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +1 -1
  44. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +62 -0
  45. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  46. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  47. package/analyzer-template/packages/database/src/lib/projectToDb.ts +1 -1
  48. package/analyzer-template/packages/database/src/lib/saveFiles.ts +1 -1
  49. package/analyzer-template/packages/database/src/lib/scenarioToDb.ts +1 -1
  50. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  51. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  52. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  53. package/analyzer-template/packages/database/src/lib/userScenarioToDb.ts +1 -1
  54. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  55. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  56. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  57. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  58. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  59. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  60. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js +1 -1
  61. package/analyzer-template/packages/github/dist/database/src/lib/analysisBranchToDb.js.map +1 -1
  62. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js +1 -1
  63. package/analyzer-template/packages/github/dist/database/src/lib/analysisToDb.js.map +1 -1
  64. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js +1 -1
  65. package/analyzer-template/packages/github/dist/database/src/lib/branchToDb.js.map +1 -1
  66. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js +1 -1
  67. package/analyzer-template/packages/github/dist/database/src/lib/commitBranchToDb.js.map +1 -1
  68. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js +1 -1
  69. package/analyzer-template/packages/github/dist/database/src/lib/commitToDb.js.map +1 -1
  70. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js +1 -1
  71. package/analyzer-template/packages/github/dist/database/src/lib/fileToDb.js.map +1 -1
  72. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  73. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  74. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  75. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  76. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +1 -1
  77. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +20 -0
  78. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  79. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  80. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  81. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  82. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  83. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  84. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  85. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  86. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  87. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  88. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  89. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js +1 -1
  90. package/analyzer-template/packages/github/dist/database/src/lib/projectToDb.js.map +1 -1
  91. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js +1 -1
  92. package/analyzer-template/packages/github/dist/database/src/lib/saveFiles.js.map +1 -1
  93. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js +1 -1
  94. package/analyzer-template/packages/github/dist/database/src/lib/scenarioToDb.js.map +1 -1
  95. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  96. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  97. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  98. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  99. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  100. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  101. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  102. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  103. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  104. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  105. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  106. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  107. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  108. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  109. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  110. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  111. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  112. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  113. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  114. package/analyzer-template/packages/github/package.json +1 -1
  115. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  116. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  117. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  118. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  119. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  120. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  121. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  122. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +98 -3
  123. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  124. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +121 -3
  125. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  126. package/analyzer-template/project/constructMockCode.ts +170 -50
  127. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  128. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  129. package/analyzer-template/project/start.ts +3 -0
  130. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  131. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  132. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  133. package/analyzer-template/project/writeScenarioComponents.ts +110 -17
  134. package/analyzer-template/tsconfig.json +13 -1
  135. package/background/src/lib/local/createLocalAnalyzer.js +1 -1
  136. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  137. package/background/src/lib/virtualized/project/constructMockCode.js +145 -41
  138. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  139. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  140. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  141. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  142. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  143. package/background/src/lib/virtualized/project/start.js +2 -0
  144. package/background/src/lib/virtualized/project/start.js.map +1 -1
  145. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  146. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  147. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  148. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  149. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  150. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  151. package/background/src/lib/virtualized/project/writeScenarioComponents.js +83 -12
  152. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  153. package/codeyam-cli/scripts/apply-setup.js +209 -12
  154. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  155. package/codeyam-cli/src/cli.js +33 -24
  156. package/codeyam-cli/src/cli.js.map +1 -1
  157. package/codeyam-cli/src/codeyam-cli.js +18 -2
  158. package/codeyam-cli/src/codeyam-cli.js.map +1 -1
  159. package/codeyam-cli/src/commands/analyze.js +21 -9
  160. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  161. package/codeyam-cli/src/commands/baseline.js +2 -0
  162. package/codeyam-cli/src/commands/baseline.js.map +1 -1
  163. package/codeyam-cli/src/commands/debug.js +2 -0
  164. package/codeyam-cli/src/commands/debug.js.map +1 -1
  165. package/codeyam-cli/src/commands/default.js +87 -21
  166. package/codeyam-cli/src/commands/default.js.map +1 -1
  167. package/codeyam-cli/src/commands/editor.js +1839 -0
  168. package/codeyam-cli/src/commands/editor.js.map +1 -0
  169. package/codeyam-cli/src/commands/init.js +81 -260
  170. package/codeyam-cli/src/commands/init.js.map +1 -1
  171. package/codeyam-cli/src/commands/memory.js +95 -81
  172. package/codeyam-cli/src/commands/memory.js.map +1 -1
  173. package/codeyam-cli/src/commands/recapture.js +2 -0
  174. package/codeyam-cli/src/commands/recapture.js.map +1 -1
  175. package/codeyam-cli/src/commands/setup-sandbox.js +2 -0
  176. package/codeyam-cli/src/commands/setup-sandbox.js.map +1 -1
  177. package/codeyam-cli/src/commands/setup-simulations.js +284 -0
  178. package/codeyam-cli/src/commands/setup-simulations.js.map +1 -0
  179. package/codeyam-cli/src/commands/test-startup.js +2 -0
  180. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  181. package/codeyam-cli/src/commands/verify.js +14 -2
  182. package/codeyam-cli/src/commands/verify.js.map +1 -1
  183. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +246 -0
  184. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  185. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +126 -0
  186. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  187. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +295 -0
  188. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  189. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  190. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  191. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +100 -0
  192. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  193. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +147 -0
  194. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  195. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +76 -0
  196. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  197. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  198. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  199. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  200. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  201. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  202. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  203. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  204. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  205. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  206. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  207. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +154 -86
  208. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  209. package/codeyam-cli/src/utils/analyzer.js +7 -0
  210. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  211. package/codeyam-cli/src/utils/backgroundServer.js +109 -26
  212. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  213. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  214. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  215. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  216. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  217. package/codeyam-cli/src/utils/editorAudit.js +82 -0
  218. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  219. package/codeyam-cli/src/utils/editorDevServer.js +98 -0
  220. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  221. package/codeyam-cli/src/utils/editorJournal.js +137 -0
  222. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  223. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  224. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  225. package/codeyam-cli/src/utils/editorPreloadHelpers.js +64 -0
  226. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  227. package/codeyam-cli/src/utils/editorPreview.js +66 -0
  228. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  229. package/codeyam-cli/src/utils/editorScenarios.js +56 -0
  230. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  231. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  232. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  233. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  234. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  235. package/codeyam-cli/src/utils/generateReport.js +2 -2
  236. package/codeyam-cli/src/utils/git.js +103 -0
  237. package/codeyam-cli/src/utils/git.js.map +1 -1
  238. package/codeyam-cli/src/utils/install-skills.js +87 -65
  239. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  240. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  241. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  242. package/codeyam-cli/src/utils/labsAutoCheck.js +0 -29
  243. package/codeyam-cli/src/utils/labsAutoCheck.js.map +1 -1
  244. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  245. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  246. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  247. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  248. package/codeyam-cli/src/utils/progress.js +7 -0
  249. package/codeyam-cli/src/utils/progress.js.map +1 -1
  250. package/codeyam-cli/src/utils/project.js +15 -5
  251. package/codeyam-cli/src/utils/project.js.map +1 -1
  252. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  253. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  254. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  255. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  256. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  257. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  258. package/codeyam-cli/src/utils/queue/job.js +70 -1
  259. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  260. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  261. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  262. package/codeyam-cli/src/utils/requireSimulations.js +10 -0
  263. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -0
  264. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +7 -8
  265. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
  266. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
  267. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
  268. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
  269. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
  270. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +97 -6
  271. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
  272. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +4 -6
  273. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
  274. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +3 -3
  275. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -1
  276. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  277. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  278. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  279. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  280. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  281. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  282. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js +23 -23
  283. package/codeyam-cli/src/utils/rules/__tests__/ruleState.test.js.map +1 -1
  284. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  285. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  286. package/codeyam-cli/src/utils/rules/index.js +1 -0
  287. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  288. package/codeyam-cli/src/utils/rules/parser.js +19 -4
  289. package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
  290. package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
  291. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
  292. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  293. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  294. package/codeyam-cli/src/utils/rules/ruleState.js +10 -10
  295. package/codeyam-cli/src/utils/rules/ruleState.js.map +1 -1
  296. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  297. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  298. package/codeyam-cli/src/utils/rules/staleness.js +6 -6
  299. package/codeyam-cli/src/utils/rules/staleness.js.map +1 -1
  300. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  301. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  302. package/codeyam-cli/src/utils/serverState.js +64 -12
  303. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  304. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +61 -43
  305. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  306. package/codeyam-cli/src/utils/simulationGateMiddleware.js +159 -0
  307. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  308. package/codeyam-cli/src/utils/syncMocksMiddleware.js +5 -24
  309. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  310. package/codeyam-cli/src/utils/testRunner.js +158 -0
  311. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  312. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  313. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  314. package/codeyam-cli/src/utils/versionInfo.js +46 -0
  315. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  316. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  317. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  318. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  319. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  320. package/codeyam-cli/src/webserver/app/lib/database.js +55 -30
  321. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  322. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  323. package/codeyam-cli/src/webserver/backgroundServer.js +144 -25
  324. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  325. package/codeyam-cli/src/webserver/bootstrap.js +11 -0
  326. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -1
  327. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CA3JxPb7.js → CopyButton-DmJveP3T.js} +1 -1
  328. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-B86KKU7e.js → EntityItem-C76mRRiF.js} +1 -1
  329. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-B5ctlSYt.js → EntityTypeBadge-g3saevPb.js} +1 -1
  330. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-BqY8gDAW.js → EntityTypeIcon-CobE682z.js} +1 -1
  331. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  332. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-BDhPilK7.js → InteractivePreview-DYFW3lDD.js} +3 -3
  333. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-VeqEBv9v.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  334. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-Bs7Nn1Jr.js → LoadingDots-BU_OAEMP.js} +1 -1
  335. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Bm3PmcCz.js → LogViewer-ceAyBX-H.js} +1 -1
  336. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-C6PKeMYR.js → ReportIssueModal-djPLI-WV.js} +2 -2
  337. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-Gq3Ocjo6.js → SafeScreenshot-BED4B6sP.js} +1 -1
  338. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-BNLaXBHR.js → ScenarioViewer-B76aig_2.js} +2 -2
  339. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  340. package/codeyam-cli/src/webserver/build/client/assets/Terminal-Dnj5CY9R.js +41 -0
  341. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-CiwXDxLh.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  342. package/codeyam-cli/src/webserver/build/client/assets/{_index-B3TDXxnk.js → _index-C96V0n15.js} +1 -1
  343. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BtBFH820.js → activity.(_tab)-BpKzcsJz.js} +1 -1
  344. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-CUXOrorO.js +1 -0
  345. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  346. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-D9hemwl6.js +22 -0
  347. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  348. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  349. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  350. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  351. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  352. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  353. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  354. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  355. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  356. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  357. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  358. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  359. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  360. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  361. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  362. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  363. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  364. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  365. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  366. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  367. package/codeyam-cli/src/webserver/build/client/assets/{book-open-PttOB2SF.js → book-open-D_nMCFmP.js} +1 -1
  368. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-TJp6ofnp.js → chevron-down-BH2h1Ea2.js} +1 -1
  369. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-JE9ZIoBl.js → chunk-JZWAC4HX-C4pqxYJB.js} +9 -9
  370. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CXhHQYrI.js → circle-check-DyIKORY6.js} +1 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/{copy-6y9ALfGT.js → copy-NDbZjXao.js} +1 -1
  372. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-Ca9fAY46.js → createLucideIcon-CMT1jU2q.js} +1 -1
  373. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BiM6z3Do.js +1 -0
  374. package/codeyam-cli/src/webserver/build/client/assets/editor-D1DAKXtT.js +8 -0
  375. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-n38keI1k.js → entity._sha._-CrjR3zZW.js} +10 -10
  376. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-DkzqFzFj.js +6 -0
  377. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C28BiQzt.js +6 -0
  378. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  379. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-38yPijoD.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  380. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-BSHEfydn.js → entry.client-DTvKq3TY.js} +1 -1
  381. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DCPhhSMo.js → fileTableUtils-cPo8LiG3.js} +1 -1
  382. package/codeyam-cli/src/webserver/build/client/assets/{files-0N0YJQv7.js → files-DO4CZ16O.js} +1 -1
  383. package/codeyam-cli/src/webserver/build/client/assets/{git-DXnyr8uP.js → git-CFCTYk9I.js} +1 -1
  384. package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +1 -0
  385. package/codeyam-cli/src/webserver/build/client/assets/{index-ChN9-fAY.js → index-10oVnAAH.js} +1 -1
  386. package/codeyam-cli/src/webserver/build/client/assets/{index-CcsFv748.js → index-BcvgDzbZ.js} +1 -1
  387. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  388. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CTqLEAGU.js → loader-circle-BAXYRVEO.js} +1 -1
  389. package/codeyam-cli/src/webserver/build/client/assets/manifest-a632de18.js +1 -0
  390. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +96 -0
  391. package/codeyam-cli/src/webserver/build/client/assets/{pause-D6vreykR.js → pause-DTAcYxBt.js} +1 -1
  392. package/codeyam-cli/src/webserver/build/client/assets/root-DUKqhFlb.js +67 -0
  393. package/codeyam-cli/src/webserver/build/client/assets/{search-B8VUL8nl.js → search-fKo7v0Zo.js} +1 -1
  394. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +1 -0
  395. package/codeyam-cli/src/webserver/build/client/assets/{simulations-CPoAg7Zo.js → simulations-B3aOzpCZ.js} +1 -1
  396. package/codeyam-cli/src/webserver/build/client/assets/{terminal-BrCP7uQo.js → terminal-BG4heKCG.js} +1 -1
  397. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BZz2NjYa.js → triangle-alert-DtSmdtM4.js} +1 -1
  398. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-DNwUduNu.js → useCustomSizes-ByhSyh0W.js} +1 -1
  399. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  400. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-CpZgwliL.js → useReportContext-O-jkvSPx.js} +1 -1
  401. package/codeyam-cli/src/webserver/build/client/assets/{useToast-Bv9JFvUO.js → useToast-9FIWuYfK.js} +1 -1
  402. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  403. package/codeyam-cli/src/webserver/build/server/assets/index-HfLydfDq.js +1 -0
  404. package/codeyam-cli/src/webserver/build/server/assets/server-build-CUu_F-oo.js +366 -0
  405. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  406. package/codeyam-cli/src/webserver/build-info.json +5 -5
  407. package/codeyam-cli/src/webserver/devServer.js +39 -5
  408. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  409. package/codeyam-cli/src/webserver/editorProxy.js +440 -0
  410. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  411. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +175 -0
  412. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +140 -0
  413. package/codeyam-cli/src/webserver/server.js +226 -1
  414. package/codeyam-cli/src/webserver/server.js.map +1 -1
  415. package/codeyam-cli/src/webserver/terminalServer.js +698 -0
  416. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  417. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  418. package/codeyam-cli/templates/codeyam-memory-hook.sh +14 -14
  419. package/codeyam-cli/templates/commands/codeyam-diagnose.md +481 -0
  420. package/codeyam-cli/templates/editor-step-hook.py +147 -0
  421. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  422. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  423. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  424. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  425. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  426. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  427. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  428. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  429. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  430. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  431. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  432. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  433. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  434. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  435. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +43 -0
  436. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  437. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +35 -0
  438. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  439. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  440. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  441. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  442. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  443. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  444. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  445. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  446. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  447. package/codeyam-cli/templates/rule-notification-hook.py +44 -17
  448. package/codeyam-cli/templates/rule-reflection-hook.py +88 -31
  449. package/codeyam-cli/templates/rules-instructions.md +45 -90
  450. package/codeyam-cli/templates/{codeyam:debug.md → skills/codeyam-debug/SKILL.md} +1 -1
  451. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  452. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +69 -0
  453. package/codeyam-cli/templates/{codeyam:memory.md → skills/codeyam-memory/SKILL.md} +231 -24
  454. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  455. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +108 -0
  456. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +69 -0
  457. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  458. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  459. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +12 -0
  460. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +45 -0
  461. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +139 -0
  462. package/codeyam-cli/templates/{codeyam:new-rule.md → skills/codeyam-new-rule/SKILL.md} +1 -3
  463. package/codeyam-cli/templates/{codeyam:setup.md → skills/codeyam-setup/SKILL.md} +13 -1
  464. package/codeyam-cli/templates/{codeyam:sim.md → skills/codeyam-sim/SKILL.md} +1 -1
  465. package/codeyam-cli/templates/{codeyam:test.md → skills/codeyam-test/SKILL.md} +1 -1
  466. package/codeyam-cli/templates/{codeyam:verify.md → skills/codeyam-verify/SKILL.md} +1 -1
  467. package/package.json +15 -13
  468. package/packages/ai/index.js +1 -1
  469. package/packages/ai/index.js.map +1 -1
  470. package/packages/ai/src/lib/analyzeScope.js +14 -0
  471. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  472. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  473. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  474. package/packages/ai/src/lib/astScopes/processExpression.js +78 -1
  475. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  476. package/packages/ai/src/lib/astScopes/sharedPatterns.js +25 -0
  477. package/packages/ai/src/lib/astScopes/sharedPatterns.js.map +1 -1
  478. package/packages/ai/src/lib/completionCall.js +10 -7
  479. package/packages/ai/src/lib/completionCall.js.map +1 -1
  480. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +362 -10
  481. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  482. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  483. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  484. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +59 -17
  485. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  486. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  487. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  488. package/packages/ai/src/lib/dataStructureChunking.js +30 -11
  489. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
  490. package/packages/ai/src/lib/generateEntityScenarioData.js +79 -5
  491. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  492. package/packages/ai/src/lib/generateExecutionFlows.js +97 -2
  493. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  494. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js +242 -81
  495. package/packages/ai/src/lib/generateExecutionFlowsFromConditionals.js.map +1 -1
  496. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js +5 -0
  497. package/packages/ai/src/lib/mergeJsonTypeDefinitions.js.map +1 -1
  498. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js +97 -0
  499. package/packages/ai/src/lib/promptGenerators/collapseNullableObjects.js.map +1 -0
  500. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js +17 -2
  501. package/packages/ai/src/lib/promptGenerators/generateEntityScenarioDataGenerator.js.map +1 -1
  502. package/packages/analyze/src/lib/ProjectAnalyzer.js +3 -0
  503. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  504. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  505. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  506. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +11 -1
  507. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  508. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  509. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  510. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  511. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  512. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  513. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  514. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  515. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  516. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +42 -13
  517. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  518. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  519. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  520. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +141 -71
  521. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  522. package/packages/database/index.js +1 -0
  523. package/packages/database/index.js.map +1 -1
  524. package/packages/database/src/lib/analysisBranchToDb.js +1 -1
  525. package/packages/database/src/lib/analysisBranchToDb.js.map +1 -1
  526. package/packages/database/src/lib/analysisToDb.js +1 -1
  527. package/packages/database/src/lib/analysisToDb.js.map +1 -1
  528. package/packages/database/src/lib/branchToDb.js +1 -1
  529. package/packages/database/src/lib/branchToDb.js.map +1 -1
  530. package/packages/database/src/lib/commitBranchToDb.js +1 -1
  531. package/packages/database/src/lib/commitBranchToDb.js.map +1 -1
  532. package/packages/database/src/lib/commitToDb.js +1 -1
  533. package/packages/database/src/lib/commitToDb.js.map +1 -1
  534. package/packages/database/src/lib/fileToDb.js +1 -1
  535. package/packages/database/src/lib/fileToDb.js.map +1 -1
  536. package/packages/database/src/lib/kysely/db.js +5 -0
  537. package/packages/database/src/lib/kysely/db.js.map +1 -1
  538. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  539. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  540. package/packages/database/src/lib/loadCommits.js +23 -13
  541. package/packages/database/src/lib/loadCommits.js.map +1 -1
  542. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  543. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  544. package/packages/database/src/lib/projectToDb.js +1 -1
  545. package/packages/database/src/lib/projectToDb.js.map +1 -1
  546. package/packages/database/src/lib/saveFiles.js +1 -1
  547. package/packages/database/src/lib/saveFiles.js.map +1 -1
  548. package/packages/database/src/lib/scenarioToDb.js +1 -1
  549. package/packages/database/src/lib/scenarioToDb.js.map +1 -1
  550. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  551. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  552. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  553. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  554. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  555. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  556. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  557. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  558. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  559. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  560. package/packages/utils/src/lib/fs/rsyncCopy.js +98 -3
  561. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  562. package/scripts/npm-post-install.cjs +34 -0
  563. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -118
  564. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  565. package/codeyam-cli/src/commands/list.js +0 -31
  566. package/codeyam-cli/src/commands/list.js.map +0 -1
  567. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  568. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  569. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  570. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  571. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-ClaLpuOo.js +0 -34
  572. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-DfKzxuoe.js +0 -11
  573. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C5lqplTC.js +0 -1
  574. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CBoafmVs.js +0 -6
  575. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DGgZjdFg.js +0 -6
  576. package/codeyam-cli/src/webserver/build/client/assets/globals-DoeDFXZN.css +0 -1
  577. package/codeyam-cli/src/webserver/build/client/assets/labs-CmBYA0PH.js +0 -1
  578. package/codeyam-cli/src/webserver/build/client/assets/manifest-76786b8e.js +0 -1
  579. package/codeyam-cli/src/webserver/build/client/assets/memory-CrNQfdMO.js +0 -76
  580. package/codeyam-cli/src/webserver/build/client/assets/root-QAY34PIo.js +0 -62
  581. package/codeyam-cli/src/webserver/build/client/assets/settings-eBI36Yv5.js +0 -1
  582. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-COky1GVF.js +0 -2
  583. package/codeyam-cli/src/webserver/build/server/assets/index-DV1ykEI6.js +0 -1
  584. package/codeyam-cli/src/webserver/build/server/assets/server-build-BrcVrUEv.js +0 -260
  585. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  586. package/codeyam-cli/templates/codeyam:diagnose.md +0 -805
  587. package/scripts/finalize-analyzer.cjs +0 -81
  588. /package/codeyam-cli/src/webserver/build/client/assets/{api.labs-survey-l0sNRNKZ.js → api.dev-mode-events-l0sNRNKZ.js} +0 -0
@@ -1,805 +0,0 @@
1
- # Debug Scenario or Analysis
2
-
3
- When a user asks to debug a scenario or analysis (e.g., `/codeyam:diagnose [ID]`), use this systematic process.
4
-
5
- ## Goal
6
-
7
- **Capture quality screenshots** by fixing all errors, then document what was wrong. Every issue can be fixed locally—the question is whether the fix is in the database (Categories 1-3) or in the tmp folder code (Category 4). Either way, you must capture screenshots before concluding.
8
-
9
- ## Definition of Done
10
-
11
- **Debugging is NOT complete until one of these conditions is met:**
12
-
13
- 1. **SUCCESS (Database Fix)**: Issue fixed via database/config changes, screenshots recaptured, ALL screenshot files verified on disk AND visually inspected
14
- 2. **SUCCESS (File Fix)**: Issue fixed via tmp folder edits, screenshots recaptured with `--capture-only`, ALL screenshot files verified AND visually inspected, changes documented for CodeYam team
15
- 3. **UNFIXABLE**: Issue cannot be fixed locally (rare), documented in final report with full details
16
-
17
- **CRITICAL: NEVER stop debugging before capturing quality screenshots.** Even if you identify the root cause as a "Category 4 engine bug", you MUST:
18
-
19
- 1. Fix the issue manually in the tmp folder (this is always possible)
20
- 2. Run `codeyam recapture --capture-only` to capture screenshots with your fixes in place
21
- 3. Verify the screenshots show the component rendering correctly
22
- 4. ONLY THEN document the engine bug for the CodeYam team
23
-
24
- Stopping after identifying a bug category without capturing screenshots defeats the purpose of debugging.
25
-
26
- ## Critical: Persistence and User Communication
27
-
28
- **DO NOT give up prematurely.** Every issue can be fixed by editing files in the tmp folder. If you find yourself thinking:
29
-
30
- - "This requires an engine-level fix"
31
- - "This is blocked by a code generation bug"
32
- - "The engine doesn't properly handle X"
33
-
34
- **STOP.** These statements are incorrect. You have full access to edit any file in `/tmp/codeyam/local-dev/{slug}/project/`. The "engine" just wrote those files—they're plain TypeScript/JavaScript that you can edit directly.
35
-
36
- ### Before Stopping or Concluding
37
-
38
- 1. **Try at least 3 different approaches** to fix the issue
39
- 2. **Never unilaterally decide to stop.** If you've been debugging and aren't making progress, ASK THE USER:
40
- > "I've tried X, Y, and Z but haven't resolved the issue yet. Would you like me to continue investigating other approaches, or should I document what I've found so far?"
41
- 3. **Only stop when the user agrees** or when you've successfully captured quality screenshots
42
-
43
- ### The "Engine Bug" Misconception
44
-
45
- When you identify a Category 4 issue (code generation bug), this does NOT mean you're blocked. It means:
46
-
47
- - The bug is in how CodeYam generates code (useful info for the CodeYam team)
48
- - You MUST still fix it manually by editing files in the tmp folder
49
- - You MUST still capture quality screenshots
50
- - You document what you fixed so the CodeYam team can improve the engine
51
-
52
- **"Engine bug" is a diagnosis category, not an excuse to stop.**
53
-
54
- ---
55
-
56
- ## Debug Flow Summary
57
-
58
- ```
59
- ┌─────────────────────────────────────────────────────────────────────┐
60
- │ Step 0: Query database for scenario status (DO THIS FIRST!) │
61
- │ Check ALL scenarios in the analysis for failures │
62
- │ Retrieve the analysis id to use in the debug command │
63
- │ │ │
64
- │ ▼ │
65
- │ Step 1: Copy the logs to a temporary location (see below). |
66
- | Step 2: codeyam debug [ANALYSIS ID] (generates files to inspect) │
67
- │ Step 3: Identify error type from logs/output │
68
- │ Step 4: Diagnose root cause category (1-4) │
69
- │ Step 5: Attempt fix (database edit or universal mock) │
70
- │ Step 6: Verify locally (curl returns 200) │
71
- │ │ │
72
- │ ┌─────────┴─────────┐ │
73
- │ ▼ ▼ │
74
- │ Fix worked Fix didn't work │
75
- │ (DB changes) │ │
76
- │ │ ▼ │
77
- │ │ Step 5a: Fix code in tmp folder │
78
- │ │ (edit files directly, track changes) │
79
- │ │ │ │
80
- │ │ ▼ │
81
- │ │ Verify without regenerating │
82
- │ │ │ │
83
- │ ▼ ▼ │
84
- │ Step 7: Recapture Step 7: Recapture --capture-only │
85
- │ (normal) (preserves file fixes) │
86
- │ │ │ │
87
- │ └─────────┬─────────┘ │
88
- │ ▼ │
89
- │ Step 8: Verify screenshots (check for client-side errors) │
90
- │ │ │
91
- │ ▼ │
92
- │ Verify ALL files exist on disk │
93
- │ │ │
94
- │ ▼ │
95
- │ ✅ DONE - Produce Final Debug Report │
96
- │ (document ALL changes for CodeYam team) │
97
- └─────────────────────────────────────────────────────────────────────┘
98
- ```
99
-
100
- **Database:** The codeyam database relevant for this command should always be found in the repo where this command is called in the `.codeyam/db.sqlite3` file.
101
-
102
- **Logs:** Before debugging copy the original logs to a temorary location as the debugging will overwrite these logs and they are valuable for debugging issues.
103
-
104
- Original Logs Locaion: `/tmp/codeyam/local-dev/{slug}/codeyam/logs.txt`
105
- Temporary location: `/tmp/codeyam/local-dev/{slug}/debug/original-logs.txt`
106
-
107
- **Notice:** Both paths lead to "Recapture" and "Verify screenshots". There is no path that ends after just identifying a bug category. You must always capture quality screenshots before completing.
108
-
109
- ---
110
-
111
- ## MANDATORY: Session Context (Do This First!)
112
-
113
- Long debugging sessions cause context loss. To prevent forgetting critical information:
114
-
115
- ### Step 1: Create Session Context File
116
-
117
- At the **very start** of debugging, create `.codeyam/debug-session.md` in the **original project directory**:
118
-
119
- ```markdown
120
- # Debug Session Context
121
-
122
- **IMPORTANT**: Keep a todo item "📍 Re-read debug session context" that is NEVER marked complete.
123
- If the todo disappears, add it back immediately.
124
-
125
- ## Key Locations
126
-
127
- - **Original project**: [FULL PATH - run all codeyam commands here]
128
- - **Tmp folder**: /tmp/codeyam/local-dev/[SLUG]/project (edit files here, do NOT run codeyam commands)
129
- - **Database**: [ORIGINAL PROJECT]/.codeyam/db.sqlite3
130
- - **Logs**: /tmp/codeyam/local-dev/[SLUG]/codeyam/log.txt
131
-
132
- ## IDs
133
-
134
- - **Analysis ID**: [ID]
135
- - **Scenario ID**: [ID]
136
- - **Entity**: [NAME] at [FILE PATH]
137
-
138
- ## URLs (fill in after running codeyam debug)
139
-
140
- - **Scenario URL**: http://localhost:[PORT]/static/codeyam-sample
141
- - **Dev server port**: [PORT from codeyam debug output]
142
-
143
- ## Commands Reference
144
-
145
- All commands run from: [ORIGINAL PROJECT PATH]
146
-
147
- - `codeyam debug [ANALYSIS_ID]` - regenerate files (overwrites tmp folder!)
148
- - `codeyam recapture [ID]` - regenerate AND capture (overwrites tmp folder!)
149
- - `codeyam recapture [ID] --capture-only` - capture WITHOUT regenerating (preserves your edits)
150
- - `codeyam test-startup` - test startup (overwrites tmp folder!)
151
- ```
152
-
153
- ### Step 2: Create Persistent Todo
154
-
155
- Use TodoWrite to create this todo list with the first item being a persistent reminder:
156
-
157
- ```
158
- 📍 Re-read .codeyam/debug-session.md before any codeyam command (NEVER complete this)
159
- ```
160
-
161
- **CRITICAL**: The first todo item must NEVER be marked as completed. It serves as a constant reminder to check your session context before running commands. If you accidentally complete it or it disappears, add it back immediately.
162
-
163
- ### Step 3: Read Context Before Actions
164
-
165
- **Before running ANY of these commands**, re-read `.codeyam/debug-session.md`:
166
-
167
- - `codeyam debug`
168
- - `codeyam recapture`
169
- - `codeyam test-startup`
170
- - Any database queries
171
-
172
- This prevents running commands from the wrong directory or forgetting key IDs.
173
-
174
- ---
175
-
176
- ## Critical: Where to Run Commands
177
-
178
- **All `codeyam` commands MUST be run from the ORIGINAL PROJECT DIRECTORY**, not from the tmp folder.
179
-
180
- | Location | What's There | Run Commands Here? |
181
- | ---------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------- |
182
- | **Original project** (e.g., `/Users/.../clients-codeyam/boltwise/app`) | Database (`.codeyam/db.sqlite3`), config, universal mocks | **YES - run all codeyam commands here** |
183
- | **Tmp folder** (`/tmp/codeyam/local-dev/{slug}/project/`) | Copy of project with mock injections, generated scenario files | **NO - only edit files here, don't run commands** |
184
-
185
- **Common mistake:** Running `codeyam recapture` from the tmp folder. This will fail with "Not in a CodeYam project" because the database doesn't exist there.
186
-
187
- ```bash
188
- # WRONG - running from tmp folder
189
- cd /tmp/codeyam/local-dev/boltwise-app/project
190
- codeyam recapture abc123 # ❌ Fails: "Not in a CodeYam project"
191
-
192
- # CORRECT - running from original project directory
193
- cd /Users/jaredcosulich/workspace/codeyam/clients-codeyam/boltwise/app
194
- codeyam recapture abc123 # ✅ Works
195
- ```
196
-
197
- **Workflow:**
198
-
199
- 1. Edit files in `/tmp/codeyam/local-dev/{slug}/project/` to fix issues
200
- 2. Test by curling the dev server running from the tmp folder
201
- 3. **Switch back to the original project directory** to run `codeyam recapture`
202
-
203
- ---
204
-
205
- ## What You Can and Cannot Modify
206
-
207
- **NEVER modify the client's original source code in the workspace.** Only modify files in the tmp folder.
208
-
209
- ### CRITICAL: Fix the Mocks, Never the Client Code
210
-
211
- When debugging errors, the fix is ALWAYS in the mock data or mock code—never in the client's components or application code.
212
-
213
- **If a component crashes due to unexpected data:**
214
-
215
- - Fix the mock data to provide what the component expects
216
- - Do NOT modify the component to handle the bad data
217
-
218
- **The client's code is sacred.** Our job is to make the simulation environment correct, not to "improve" or "harden" the client's code. Even if a component could be more defensive, that's not our fix to make.
219
-
220
- **You CAN modify:**
221
-
222
- - Data in the local SQLite database (`.codeyam/db.sqlite3`) - in the **original project directory**
223
- - Universal mocks in `.codeyam/universal-mocks` - in the **original project directory**
224
- - **Files in `/tmp/codeyam/local-dev/{slug}/project/`** - These are temporary copies used for simulation
225
- - Generated mock files in `__codeyamMocks__/` directories
226
- - Layout/route files that wrap scenarios
227
- - Any generated code that has errors
228
- - Mock data files for testing
229
-
230
- **IMPORTANT**: When you edit files in the tmp folder, you MUST use `codeyam recapture --capture-only` when recapturing, otherwise your changes will be overwritten! Be sure to address all issues so that the simulation runs correctly. Then, if one of the issues required editing code in the tmp directory you MUST use `codeyam recapture --capture-only`, but if only data was changed then as long as that data is updated in the local database as well you can run `codeyam recapture` and have the system overwrite the tmp project code and use the valid data from the database.
231
-
232
- ---
233
-
234
- ## Step 0: Check for Other Failing Scenarios (MANDATORY FIRST STEP)
235
-
236
- **DO NOT run `codeyam debug` yet!** First, query the database to check if other scenarios in the same analysis are also failing.
237
-
238
- ```bash
239
- # First, get the analysis ID (if you have a scenario ID)
240
- sqlite3 .codeyam/db.sqlite3 "SELECT analysis_id FROM scenarios WHERE id = 'SCENARIO_ID'"
241
-
242
- # Then check ALL scenarios for that analysis
243
- sqlite3 .codeyam/db.sqlite3 "
244
- SELECT
245
- s.id,
246
- s.name,
247
- json_extract(s.metadata, '$.screenshotPaths') as screenshots
248
- FROM scenarios s
249
- WHERE s.analysis_id = 'ANALYSIS_ID'
250
- "
251
-
252
- # Check for errors in scenario status
253
- sqlite3 .codeyam/db.sqlite3 "
254
- SELECT json_extract(status, '$.scenarios') FROM analyses WHERE id = 'ANALYSIS_ID'
255
- "
256
- ```
257
-
258
- **If multiple scenarios are failing, ASK THE USER** whether to fix just the requested scenario or all failing scenarios.
259
-
260
- ### Check for Client-Side Errors in Screenshots
261
-
262
- **IMPORTANT:** Even if the database shows no errors and screenshots exist, the scenario may still have a client-side error. Use the Read tool to view the screenshot file and check for:
263
-
264
- - Red error boundaries or error messages in the rendered UI
265
- - "Something went wrong" or similar error text
266
- - Blank/white screens that should have content
267
- - React error overlays
268
-
269
- ```bash
270
- # View the screenshot to check for client-side errors
271
- # Use the Read tool on the screenshot path from the database
272
- ```
273
-
274
- If the screenshot shows a client-side error, proceed to Step 1 to debug it.
275
-
276
- ---
277
-
278
- ## Step 1: Run Debug Command
279
-
280
- ```bash
281
- codeyam debug ANALYSIS_ID
282
- ```
283
-
284
- Output includes:
285
-
286
- - **Project path**: `/tmp/codeyam/local-dev/{slug}/project`
287
- - **Start command**: How to run the dev server
288
- - **URL**: Where to access the scenario
289
- - **Log path**: Where to watch for errors
290
-
291
- ---
292
-
293
- ## Step 2: Identify the Error Type
294
-
295
- Read the log file or error output to categorize the issue:
296
-
297
- | Error Type | Symptoms | Likely Category |
298
- | ---------------------------------- | ----------------------------------- | ---------------------------------------- |
299
- | **Syntax error in generated file** | `Unexpected token`, `Parse error` | Category 4 (mock code writing) |
300
- | **Runtime error** | `TypeError`, `ReferenceError` | Category 1-3 (data issue) or 4 |
301
- | **Missing mock** | `Cannot read property of undefined` | Category 1-2 (missing in data structure) |
302
- | **Wrong mock type** | `X is not a function` | Category 3-4 (wrong data or mock code) |
303
-
304
- ---
305
-
306
- ## Step 3: Diagnose Root Cause Category
307
-
308
- This is the most important step. Determine WHERE in the pipeline the bug originated.
309
-
310
- ### The 4 Error Categories
311
-
312
- | Category | What's Wrong | Where to Check | Fixable Locally? |
313
- | -------- | ---------------------------------------------------- | ------------------------- | ----------------------------- |
314
- | **1** | Missing attribute in `isolatedDataStructure` | `entities.metadata` | Sometimes (re-analyze) |
315
- | **2** | Attribute not merged into `mergedDataStructure` | `analyses.metadata` | Sometimes (re-analyze) |
316
- | **3** | Data structure complete, but scenario data wrong | `scenarios.metadata` | Yes (edit mockData) |
317
- | **4** | Data complete, but mock code/mock data written wrong | Generated files in `/tmp` | **Yes (edit files directly)** |
318
-
319
- ### Diagnostic Queries
320
-
321
- ```bash
322
- # Category 1: Check isolatedDataStructure
323
- # Is the attribute traced at all in the entity?
324
- sqlite3 .codeyam/db.sqlite3 \
325
- "SELECT json_extract(metadata, '$.isolatedDataStructure') FROM entities WHERE sha = 'ENTITY_SHA'" \
326
- | python3 -m json.tool
327
-
328
- # Category 2: Check mergedDataStructure
329
- # Was the attribute properly merged from dependencies?
330
- sqlite3 .codeyam/db.sqlite3 \
331
- "SELECT json_extract(metadata, '$.mergedDataStructure') FROM analyses WHERE id = 'ANALYSIS_ID'" \
332
- | python3 -m json.tool
333
-
334
- # Category 2 (also check): scenariosDataStructure
335
- sqlite3 .codeyam/db.sqlite3 \
336
- "SELECT json_extract(metadata, '$.scenariosDataStructure') FROM analyses WHERE id = 'ANALYSIS_ID'" \
337
- | python3 -m json.tool
338
-
339
- # Category 3: Check scenario mockData
340
- # Did the LLM generate correct mock data?
341
- sqlite3 .codeyam/db.sqlite3 \
342
- "SELECT json_extract(metadata, '$.data.mockData') FROM scenarios WHERE id = 'SCENARIO_ID'" \
343
- | python3 -m json.tool
344
- ```
345
-
346
- ### Diagnosis Flow
347
-
348
- 1. **Start with the error** - What attribute/value is missing or wrong at runtime?
349
- 2. **Check `isolatedDataStructure`** - Is the attribute traced in the entity? If missing → Category 1
350
- 3. **Check `mergedDataStructure`** - Is the attribute present after merging? If missing → Category 2
351
- 4. **Check `scenariosDataStructure`** - Is the data structure for mocks correct? If wrong → Category 2
352
- 5. **Check scenario `mockData`** - Does the scenario have correct mock values? If wrong → Category 3
353
- 6. **Check generated mock code** - Is the mock code syntactically/semantically correct? If wrong → **Category 4 (engine bug)**
354
- 7. **Check generated imports** - Are the imports correct? Are entities containing environment variables mocked out? If wrong → **Category 4 (engine bug)**
355
-
356
- ### Category 4 Indicators (Code Generation Issue)
357
-
358
- The issue is Category 4 if:
359
-
360
- - All data structures in the database look correct
361
- - The scenario's mockData has the right keys and values
362
- - BUT the generated mock code has syntax errors, wrong structure, or doesn't match the data
363
- - Database edits don't fix the generated code (it regenerates wrong)
364
-
365
- **Category 4 does NOT mean you are blocked.** You have full access to fix these issues:
366
-
367
- 1. **Edit the files directly** in `/tmp/codeyam/local-dev/{slug}/project/`
368
- 2. **Fix any syntax errors, wrong imports, missing mocks** - these are just TypeScript files
369
- 3. **Restart the dev server** and verify the fix works
370
- 4. **Capture quality screenshots** with `codeyam recapture --capture-only`
371
- 5. **Document what you fixed** for the CodeYam team to improve the engine
372
-
373
- The term "engine bug" means the CodeYam code generation has a bug—it does NOT mean you cannot fix the issue locally. You always can.
374
-
375
- ---
376
-
377
- ## Step 4: Attempt Fix
378
-
379
- ### For Categories 1-2 (Data Structure Issues)
380
-
381
- These usually require re-running analysis. You can try:
382
-
383
- ```bash
384
- # Delete the analysis and re-analyze
385
- codeyam analyze --entity EntityName path/to/file.tsx
386
- ```
387
-
388
- ### For Category 3 (Scenario Data Issues)
389
-
390
- Fix the mockData directly in the database:
391
-
392
- ```bash
393
- # Export metadata
394
- sqlite3 .codeyam/db.sqlite3 "SELECT metadata FROM scenarios WHERE id = 'SCENARIO_ID'" > /tmp/metadata.json
395
-
396
- # Edit with Python
397
- python3 << 'EOF'
398
- import json
399
- with open('/tmp/metadata.json') as f:
400
- data = json.loads(f.read())
401
-
402
- # Fix the mockData
403
- data['data']['mockData']['keyName'] = {"fixed": "value"}
404
-
405
- with open('/tmp/metadata_fixed.json', 'w') as f:
406
- f.write(json.dumps(data))
407
- EOF
408
-
409
- # Update database (use Python to avoid escaping issues)
410
- python3 << 'EOF'
411
- import sqlite3
412
- import json
413
-
414
- with open('/tmp/metadata_fixed.json') as f:
415
- metadata = f.read()
416
-
417
- conn = sqlite3.connect('.codeyam/db.sqlite3')
418
- conn.execute("UPDATE scenarios SET metadata = ? WHERE id = 'SCENARIO_ID'", (metadata,))
419
- conn.commit()
420
- conn.close()
421
- EOF
422
- ```
423
-
424
- ### For Category 4 (Code Generation Issues)
425
-
426
- **MUST be fixed locally by editing files in the tmp folder.** This is a REQUIRED step, not optional.
427
-
428
- 1. Go to Step 5a and fix all code issues in the tmp folder
429
- 2. Verify the scenario loads correctly (curl returns 200)
430
- 3. Run `codeyam recapture --capture-only` to capture screenshots (this preserves your fixes)
431
- 4. Verify the screenshots look correct
432
- 5. THEN document the engine bug in your final report
433
-
434
- **DO NOT stop after identifying a Category 4 issue.** The goal is to capture quality screenshots, then document what you fixed.
435
-
436
- ### Universal Mocks (for infrastructure dependencies)
437
-
438
- You can use universal mocks to mock out functions that are not detected by the analysis (are not part of the dependency tree). This often includes things like middleware or functions that run on startup and require environment variables.
439
-
440
- ## Quick Reference: Mock Path Decision Tree
441
-
442
- ```
443
- Where is the error coming from?
444
-
445
- ├── node_modules package (e.g., @prisma/client, @supabase/supabase-js)
446
- │ └── Mock path: .codeyam/universal-mocks/node_modules/{package}.ts
447
- │ Example: .codeyam/universal-mocks/node_modules/@prisma/client.ts
448
-
449
- └── Project file (e.g., lib/db.ts, packages/prisma/index.ts)
450
- └── Mock path: .codeyam/universal-mocks/{same-path-as-original}
451
- Example: .codeyam/universal-mocks/lib/db.ts
452
- Example: .codeyam/universal-mocks/packages/prisma/index.ts
453
- ```
454
-
455
- ## Quick Reference: Mock Writing Rules
456
-
457
- **BEFORE writing any mock:**
458
-
459
- 1. Read the original file first
460
- 2. Note all its export names exactly
461
-
462
- **WHEN writing the mock:**
463
-
464
- 1. Export names MUST match exactly (case-sensitive)
465
- 2. ALL code MUST be inside exports (no helper variables outside)
466
- 3. Keep it minimal - empty methods are fine
467
-
468
- **AFTER writing the mock:**
469
-
470
- ```bash
471
- codeyam validate-mock .codeyam/universal-mocks/{path-to-your-mock}
472
- ```
473
-
474
- ---
475
-
476
- ## Step 5: Verify Database Fixes Locally
477
-
478
- After making **database changes** (Categories 1-3):
479
-
480
- 1. **Re-run `codeyam debug ID`** to regenerate scenario files with updated data
481
- 2. **Start the dev server** and curl the URL to check for errors:
482
- ```bash
483
- curl -s http://localhost:3112/static/... | head -50
484
- ```
485
- 3. **Check for 200 response** (no `statusCode:500`)
486
-
487
- **If verification fails and you've already tried database fixes:** Proceed to Step 5a to fix code directly.
488
-
489
- ---
490
-
491
- ## Step 5a: Fix Code Issues in Tmp Folder (Category 4)
492
-
493
- If the error is in bad imports, generated code or mock files, you can fix them directly in the tmp folder.
494
-
495
- **REMINDER: Only fix GENERATED files (mocks, layouts, routes)—never the client's application code.** If a client component crashes, the fix is in the mock data or mock code, not in the component itself.
496
-
497
- ### Locate the Problematic File
498
-
499
- Files are in `/tmp/codeyam/local-dev/{slug}/project/`. Common locations:
500
-
501
- - **Generated mocks**: `__codeyamMocks__/MockData_*.tsx` or `__codeyamMocks__/MockCode_*.tsx`
502
- - **Scenario layouts**: `app/static/{projectSlug}/{analysisId}/{entitySlug}/{scenarioSlug}/`
503
- - **Route files**: `app/routes/` or `pages/` depending on framework
504
-
505
- ### Make the Fix
506
-
507
- Edit the problematic file directly using the Edit tool. Common fixes include:
508
-
509
- - **Syntax errors**: Fix missing brackets, commas, or quotes in generated code
510
- - **Wrong import paths**: Correct import statements
511
- - **Missing exports**: Add missing named or default exports
512
- - **Type errors**: Fix TypeScript type issues
513
- - **Wrong mock structure**: Adjust the shape of generated mock data
514
-
515
- ### Track Your Changes (MANDATORY)
516
-
517
- For every file you edit, record:
518
-
519
- - The full file path
520
- - What you changed (brief description)
521
- - The before/after code (for the final report)
522
-
523
- ### Verify Without Regenerating
524
-
525
- After editing files, **do NOT run `codeyam debug` again** (it would overwrite your changes).
526
-
527
- Instead, manually start the dev server:
528
-
529
- ```bash
530
- cd /tmp/codeyam/local-dev/{slug}/project
531
- npm run dev # or pnpm dev / yarn dev
532
- ```
533
-
534
- Then verify the fix works. You can either:
535
-
536
- 1. **Curl the URL** to check for errors:
537
-
538
- ```bash
539
- curl -s http://localhost:3112/static/codeyam-sample | head -50
540
- ```
541
-
542
- 2. **Ask the user to verify visually**: If the fix involves visual output or you're unsure if it worked, ask the user to visit the URL and confirm:
543
-
544
- > "I've fixed the mock data. Can you visit http://localhost:3112/static/codeyam-sample and let me know if the component renders correctly now?"
545
-
546
- This is especially useful for client-side rendering issues that curl won't catch.
547
-
548
- ---
549
-
550
- ## Change Tracking (MANDATORY)
551
-
552
- **You MUST track all changes for the final report.** This is essential for the CodeYam team to fix engine bugs.
553
-
554
- ### Database Changes
555
-
556
- For each database modification, record:
557
-
558
- | Table | Record ID | Field Path | Before | After |
559
- | ----------- | --------- | ---------------------------- | --------- | ----------- |
560
- | `scenarios` | `abc123` | `metadata.data.mockData.key` | `"wrong"` | `"correct"` |
561
-
562
- ### File Changes
563
-
564
- For each file modification in the tmp folder, record:
565
-
566
- | File Path | Change Description |
567
- | ---------------------------------------------------- | ------------------------------------- |
568
- | `/tmp/.../project/__codeyamMocks__/MockData_xyz.tsx` | Fixed missing comma in object literal |
569
-
570
- Include the actual diff:
571
-
572
- ```diff
573
- --- before
574
- +++ after
575
- @@ -10,3 +10,3 @@
576
- - key: "value"
577
- + key: "value",
578
- anotherKey: "value2"
579
- ```
580
-
581
- ---
582
-
583
- ## Step 6: Recapture Screenshots
584
-
585
- **Only proceed here if Step 5 or 5a verification passed.**
586
-
587
- ### Choose the Right Recapture Mode
588
-
589
- **If you only made DATABASE changes (Categories 1-3):**
590
-
591
- ```bash
592
- codeyam recapture SCENARIO_ID
593
- ```
594
-
595
- This will regenerate the tmp folder files using the updated database data, then capture screenshots.
596
-
597
- **If you made FILE changes in the tmp folder (Category 4):**
598
-
599
- ```bash
600
- codeyam recapture SCENARIO_ID --capture-only
601
- ```
602
-
603
- **CRITICAL**: The `--capture-only` flag preserves your manual file fixes. Without this flag, your changes would be overwritten!
604
-
605
- ### Verify Files After Capture
606
-
607
- ```bash
608
- # Check database for screenshot paths
609
- sqlite3 .codeyam/db.sqlite3 "SELECT name, json_extract(metadata, '$.screenshotPaths') FROM scenarios WHERE analysis_id = 'ANALYSIS_ID'"
610
-
611
- # Verify files actually exist
612
- find .codeyam/captures -name "*.png" -path "*ANALYSIS_ID*" -mmin -5
613
- ```
614
-
615
- ---
616
-
617
- ## Step 7: Verify Screenshots for Client-Side Errors
618
-
619
- **IMPORTANT**: Even if capture completes successfully, the screenshots may show client-side errors!
620
-
621
- ### View the Screenshots
622
-
623
- Use the Read tool to view each captured screenshot file:
624
-
625
- ```bash
626
- # Get the screenshot path from the database
627
- sqlite3 .codeyam/db.sqlite3 "SELECT json_extract(metadata, '$.screenshotPaths[0]') FROM scenarios WHERE id = 'SCENARIO_ID'"
628
- ```
629
-
630
- Then read the screenshot file to visually inspect it.
631
-
632
- ### Check for These Issues
633
-
634
- - **Red error boundaries** or React error overlays
635
- - **"Something went wrong"** or similar error text
636
- - **Blank/white screens** that should have content
637
- - **Missing components** or broken layouts
638
- - **Console errors** shown in error overlays
639
-
640
- If the screenshot shows a dedicated 500 page with no clear error then you may want to find and comment out any error boundary logic that is catching errors and preventing you from easily reading them.
641
-
642
- ### If Screenshot Shows Errors
643
-
644
- 1. The fix didn't fully work - go back to Step 5 or 5a
645
- 2. Check the log file for additional error details:
646
- ```bash
647
- tail -100 /tmp/codeyam/local-dev/{slug}/codeyam/log.txt
648
- ```
649
- 3. Fix the remaining issues
650
- 4. Run recapture again (with `--capture-only` if you edited files)
651
-
652
- ---
653
-
654
- ## Final Debug Report (MANDATORY)
655
-
656
- **Always produce this report**, whether the issue was fixed or identified as an engine bug.
657
-
658
- ---
659
-
660
- ## Debug Session Report
661
-
662
- ### Issue Summary
663
-
664
- **Error:** `[Exact error message, e.g., "Transform failed: Unexpected token at line 66"]`
665
-
666
- **Entity:** `[Entity name]` in `[file/path.tsx]`
667
-
668
- **Root Cause Category:** [1, 2, 3, or 4]
669
-
670
- **Outcome:** [Fixed via database changes / Fixed via file edits (engine bug) / Unfixable]
671
-
672
- ### Affected Scenarios
673
-
674
- | Scenario ID | Name | Analysis ID | Status |
675
- | ----------- | -------- | --------------- | -------------------- |
676
- | `[id]` | `[name]` | `[analysis-id]` | [Fixed / Engine bug] |
677
-
678
- ### Root Cause Category Determination
679
-
680
- **Category identified:** [1 / 2 / 3 / 4]
681
-
682
- **Evidence:**
683
-
684
- - [ ] **Category 1** (isolatedDataStructure): [What was missing/wrong in entity metadata?]
685
- - [ ] **Category 2** (mergedDataStructure): [What was missing/wrong after merge?]
686
- - [ ] **Category 3** (scenario mockData): [What was wrong in the LLM-generated data?]
687
- - [ ] **Category 4** (mock code writing): [What was wrong in the generated code?]
688
-
689
- **How determined:**
690
- [Explain what you checked and what you found. Include relevant JSON snippets.]
691
-
692
- ### Database Changes Made (if any)
693
-
694
- | Table | Record ID | Field Path | Before | After |
695
- | --------- | --------- | ---------- | ------------- | ------------- |
696
- | `[table]` | `[id]` | `[path]` | `[old value]` | `[new value]` |
697
-
698
- **SQL/Python commands used:**
699
-
700
- ```sql
701
- [Include the exact commands]
702
- ```
703
-
704
- ### File Changes Made (if any)
705
-
706
- If you edited files in the tmp folder to fix Category 4 issues:
707
-
708
- | File Path | Change Description |
709
- | -------------------------------------------------------- | -------------------------- |
710
- | `/tmp/codeyam/local-dev/{slug}/project/path/to/file.tsx` | [Brief description of fix] |
711
-
712
- **Diffs:**
713
-
714
- ```diff
715
- --- before
716
- +++ after
717
- @@ -line,count +line,count @@
718
- -[old code]
719
- +[new code]
720
- ```
721
-
722
- **Recapture command used:**
723
-
724
- ```bash
725
- codeyam recapture SCENARIO_ID --capture-only
726
- ```
727
-
728
- ### For Category 4 (Code Generation Bug) - Required Details
729
-
730
- If this is an engine bug, include:
731
-
732
- **What the data looks like (correct):**
733
-
734
- ```json
735
- [Show the relevant data structure from the database that looks correct]
736
- ```
737
-
738
- **What the generated code looks like (wrong):**
739
-
740
- ```javascript
741
- [Show the problematic generated mock code]
742
- ```
743
-
744
- **What the generated code should look like:**
745
-
746
- ```javascript
747
- [Show what correct code would look like]
748
- ```
749
-
750
- **Pattern/Edge case:**
751
- [Describe the pattern that causes this bug, e.g., "Function call signatures like '()' in array item schemas get converted to empty computed property keys"]
752
-
753
- ### Verification
754
-
755
- **All of these must be checked before the debug session is complete:**
756
-
757
- - [ ] Scenario loads without errors (curl returns 200)
758
- - [ ] Screenshots recaptured successfully (this is REQUIRED, not optional)
759
- - [ ] Used `--capture-only` flag (if file changes were made)
760
- - [ ] Screenshot files verified to exist on disk
761
- - [ ] Screenshots visually inspected - no client-side errors visible
762
- - [ ] All changes documented above for CodeYam team
763
-
764
- ---
765
-
766
- ## Saving and Uploading the Report (MANDATORY)
767
-
768
- After completing the debug session, **you MUST save the report**:
769
-
770
- 1. **Write the report to file:**
771
-
772
- ```bash
773
- # Write the full "Debug Session Report" section above to this file
774
- # Use the Write tool to save to:
775
- .codeyam/debug-report.md
776
- ```
777
-
778
- 2. **Ask user if they want to upload:**
779
- After saving, ask the user: "Would you like me to upload this debug report to CodeYam for the team to review?"
780
-
781
- - If the user response affirmatively then run `codeyam report --upload` to upload the report.
782
-
783
- The report will be:
784
-
785
- - Included in the delta tarball at the root level for easy access
786
- - Stored in the database metadata for searchability
787
- - Available to CodeYam engineers when they download the report
788
-
789
- ---
790
-
791
- ### Helper Queries
792
-
793
- ```bash
794
- # Get scenario details
795
- sqlite3 .codeyam/db.sqlite3 "SELECT id, analysis_id, name FROM scenarios WHERE id = 'ID'"
796
-
797
- # Get entity for analysis
798
- sqlite3 .codeyam/db.sqlite3 "SELECT e.name, e.file_path FROM entities e JOIN analyses a ON e.sha = a.entity_sha WHERE a.id = 'ANALYSIS_ID'"
799
-
800
- # List all scenarios for an analysis
801
- sqlite3 .codeyam/db.sqlite3 "SELECT id, name FROM scenarios WHERE analysis_id = 'ANALYSIS_ID'"
802
-
803
- # Check for dependent analyses
804
- sqlite3 .codeyam/db.sqlite3 "SELECT json_extract(metadata, '$.dependentAnalyses') FROM analyses WHERE id = 'ANALYSIS_ID'" | python3 -m json.tool
805
- ```