@codeyam/codeyam-cli 0.1.0-staging.ad88eeb → 0.1.0-staging.b147f46

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 (437) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +4 -4
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +135 -0
  6. package/analyzer-template/packages/ai/src/lib/astScopes/nodeToSource.ts +19 -0
  7. package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +11 -4
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +36 -9
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.ts +10 -3
  10. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +16 -6
  11. package/analyzer-template/packages/analyze/index.ts +4 -1
  12. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +28 -2
  13. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -36
  14. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +10 -6
  15. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +9 -12
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
  17. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +82 -10
  18. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +4 -0
  19. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +4 -0
  20. package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +239 -58
  22. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1684 -1462
  23. package/analyzer-template/packages/aws/package.json +2 -2
  24. package/analyzer-template/packages/database/package.json +2 -2
  25. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +82 -0
  26. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +19 -15
  27. package/analyzer-template/packages/database/src/lib/loadEntities.ts +0 -6
  28. package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
  29. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +0 -65
  30. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +5 -0
  31. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
  32. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +84 -0
  33. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  34. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  35. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +1 -1
  36. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  37. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  38. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +0 -6
  39. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  40. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
  41. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
  42. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
  43. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
  44. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  45. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +0 -25
  46. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  47. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
  48. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  49. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
  50. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  51. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
  52. package/analyzer-template/project/analyzeFileEntities.ts +26 -0
  53. package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
  54. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  55. package/codeyam-cli/src/cli.js +24 -0
  56. package/codeyam-cli/src/cli.js.map +1 -1
  57. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
  58. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
  59. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
  60. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
  61. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
  62. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
  63. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +56 -0
  64. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
  65. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
  66. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  67. package/codeyam-cli/src/commands/editor.js +3495 -553
  68. package/codeyam-cli/src/commands/editor.js.map +1 -1
  69. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
  70. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
  71. package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
  72. package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
  73. package/codeyam-cli/src/commands/init.js +69 -34
  74. package/codeyam-cli/src/commands/init.js.map +1 -1
  75. package/codeyam-cli/src/commands/telemetry.js +37 -0
  76. package/codeyam-cli/src/commands/telemetry.js.map +1 -0
  77. package/codeyam-cli/src/data/techStacks.js +2 -7
  78. package/codeyam-cli/src/data/techStacks.js.map +1 -1
  79. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
  80. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
  81. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
  82. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
  83. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +18 -8
  84. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
  85. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +3380 -1
  86. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  87. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  88. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  89. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
  90. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
  91. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
  92. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
  93. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +27 -2
  94. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -1
  95. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +76 -3
  96. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
  97. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +381 -0
  98. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  99. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
  100. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
  101. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +202 -1
  102. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
  103. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
  104. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  105. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +96 -1
  106. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
  107. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +47 -1
  108. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
  109. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +70 -0
  110. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
  111. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1548 -1
  112. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  113. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +117 -1
  114. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
  115. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
  116. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
  117. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  118. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  119. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  120. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  121. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +395 -11
  122. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  123. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
  124. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
  125. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +16 -1
  126. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -1
  127. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
  128. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
  129. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +30 -2
  130. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -1
  131. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
  132. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
  133. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  134. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  135. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +284 -0
  136. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  137. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +649 -223
  138. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
  139. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
  140. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
  141. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +1 -0
  142. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  143. package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
  144. package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
  145. package/codeyam-cli/src/utils/__tests__/testRunner.test.js +217 -0
  146. package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
  147. package/codeyam-cli/src/utils/analysisRunner.js +39 -8
  148. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  149. package/codeyam-cli/src/utils/analyzer.js +19 -0
  150. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  151. package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
  152. package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
  153. package/codeyam-cli/src/utils/backgroundServer.js +93 -17
  154. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  155. package/codeyam-cli/src/utils/database.js +37 -2
  156. package/codeyam-cli/src/utils/database.js.map +1 -1
  157. package/codeyam-cli/src/utils/editorApi.js +11 -5
  158. package/codeyam-cli/src/utils/editorApi.js.map +1 -1
  159. package/codeyam-cli/src/utils/editorAudit.js +673 -5
  160. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  161. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  162. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  163. package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
  164. package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
  165. package/codeyam-cli/src/utils/editorDevServer.js +5 -1
  166. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -1
  167. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
  168. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
  169. package/codeyam-cli/src/utils/editorEntityHelpers.js +144 -0
  170. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  171. package/codeyam-cli/src/utils/editorGuard.js +36 -0
  172. package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
  173. package/codeyam-cli/src/utils/editorLoaderHelpers.js +72 -1
  174. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
  175. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  176. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  177. package/codeyam-cli/src/utils/editorPreview.js +33 -0
  178. package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
  179. package/codeyam-cli/src/utils/editorRecapture.js +109 -0
  180. package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
  181. package/codeyam-cli/src/utils/editorScenarioSwitch.js +24 -2
  182. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
  183. package/codeyam-cli/src/utils/editorScenarios.js +580 -0
  184. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  185. package/codeyam-cli/src/utils/editorSeedAdapter.js +295 -6
  186. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
  187. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  188. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  189. package/codeyam-cli/src/utils/entityChangeStatus.js +53 -6
  190. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  191. package/codeyam-cli/src/utils/entityChangeStatus.server.js +57 -3
  192. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
  193. package/codeyam-cli/src/utils/fileWatcher.js +38 -0
  194. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  195. package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
  196. package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
  197. package/codeyam-cli/src/utils/install-skills.js +14 -0
  198. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  199. package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
  200. package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
  201. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -1
  202. package/codeyam-cli/src/utils/progress.js +2 -2
  203. package/codeyam-cli/src/utils/progress.js.map +1 -1
  204. package/codeyam-cli/src/utils/queue/job.js +26 -5
  205. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  206. package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
  207. package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
  208. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  209. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  210. package/codeyam-cli/src/utils/scenarioCoverage.js +77 -0
  211. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  212. package/codeyam-cli/src/utils/scenariosManifest.js +269 -74
  213. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
  214. package/codeyam-cli/src/utils/screenshotHash.js +26 -0
  215. package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
  216. package/codeyam-cli/src/utils/serverState.js +30 -0
  217. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  218. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -0
  219. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  220. package/codeyam-cli/src/utils/simulationGateMiddleware.js +17 -1
  221. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
  222. package/codeyam-cli/src/utils/slugUtils.js +25 -0
  223. package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
  224. package/codeyam-cli/src/utils/syncMocksMiddleware.js +2 -2
  225. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  226. package/codeyam-cli/src/utils/telemetry.js +106 -0
  227. package/codeyam-cli/src/utils/telemetry.js.map +1 -0
  228. package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
  229. package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
  230. package/codeyam-cli/src/utils/testRunner.js +199 -1
  231. package/codeyam-cli/src/utils/testRunner.js.map +1 -1
  232. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
  233. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
  234. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +107 -0
  235. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  236. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +469 -0
  237. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  238. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +283 -0
  239. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
  240. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
  241. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
  242. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +86 -0
  243. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  244. package/codeyam-cli/src/webserver/app/lib/git.js +3 -2
  245. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -1
  246. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  247. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  248. package/codeyam-cli/src/webserver/backgroundServer.js +60 -61
  249. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  250. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CLe80MMu.js +1 -0
  251. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-Crt_KN_U.js} +3 -3
  252. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  253. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-CD7lGABo.js} +1 -1
  254. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CgTNOhnu.js +1 -0
  255. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CKeQT5Ty.js +25 -0
  256. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-D3s1MFkb.js +3 -0
  257. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CM5zg40N.js} +3 -3
  259. package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-CQENLSrF.js +36 -0
  260. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-C2PLkej3.js} +2 -2
  261. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DanvyBPb.js +1 -0
  262. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-0DY_NKil.js → ScenarioViewer-DUMfcNVK.js} +3 -3
  263. package/codeyam-cli/src/webserver/build/client/assets/Spinner-D0LgAaSa.js +34 -0
  264. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  265. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-BA_Ry-rs.js +1 -0
  266. package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-BAWd-Xjf.js} +2 -2
  267. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-BOARiB-g.js} +3 -3
  268. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-CHx25PAe.js} +1 -1
  269. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-Bg3e7q4S.js} +3 -3
  270. package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
  271. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  272. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
  273. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  274. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  275. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  276. package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
  277. package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
  278. package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-CL-lMgHh.js} +1 -1
  279. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-GmAjGS9-.js} +1 -1
  280. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +43 -0
  281. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-DFcQkN5j.js} +1 -1
  282. package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-C6iF61Xs.js} +1 -1
  283. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-4ImjHTVC.js} +1 -1
  284. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
  285. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
  286. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C8y4mmyv.js +1 -0
  287. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-Gbk_i5Js.js +1 -0
  288. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DMv5ESGo.js +96 -0
  289. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CluPkvXJ.js +41 -0
  290. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BF4oLwaE.js → entity._sha._-ByHz6rAQ.js} +13 -12
  291. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-CmLO432x.js +6 -0
  292. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Bz9sCUF_.js +6 -0
  293. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DQM8E7L4.js +6 -0
  294. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-CAoXLsQr.js} +2 -2
  295. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-SuW9syRS.js} +6 -6
  296. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  297. package/codeyam-cli/src/webserver/build/client/assets/files-D-xGrg29.js +1 -0
  298. package/codeyam-cli/src/webserver/build/client/assets/git-Bq_fbXP5.js +1 -0
  299. package/codeyam-cli/src/webserver/build/client/assets/globals-oyPmV37k.css +1 -0
  300. package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-Bp1l4hSv.js} +1 -1
  301. package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-CWV9XZiG.js} +1 -1
  302. package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-DE3jI_dv.js} +1 -1
  303. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  304. package/codeyam-cli/src/webserver/build/client/assets/labs-B_IX45ih.js +1 -0
  305. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-De-7qQ2u.js} +1 -1
  306. package/codeyam-cli/src/webserver/build/client/assets/manifest-1a45e154.js +1 -0
  307. package/codeyam-cli/src/webserver/build/client/assets/memory-Cx2xEx7s.js +101 -0
  308. package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-CFxEKL1u.js} +1 -1
  309. package/codeyam-cli/src/webserver/build/client/assets/root-D2_tktnk.js +80 -0
  310. package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-BdBb5aqc.js} +1 -1
  311. package/codeyam-cli/src/webserver/build/client/assets/settings-DdE-Untf.js +1 -0
  312. package/codeyam-cli/src/webserver/build/client/assets/simulations-DSCdE99u.js +1 -0
  313. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-CrplD4b1.js} +1 -1
  314. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-DqJ0j69l.js} +1 -1
  315. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DhXHbEjP.js +1 -0
  316. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BNd5hYuW.js} +1 -1
  317. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-Cy5Qg_UR.js +1 -0
  318. package/codeyam-cli/src/webserver/build/client/assets/useToast-5HR2j9ZE.js +1 -0
  319. package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
  320. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-By5slFjw.js +16 -0
  321. package/codeyam-cli/src/webserver/build/server/assets/index-DXaOwBnm.js +1 -0
  322. package/codeyam-cli/src/webserver/build/server/assets/init-CLG1LjQM.js +10 -0
  323. package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
  324. package/codeyam-cli/src/webserver/build/server/assets/server-build-NZmUqQv6.js +688 -0
  325. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  326. package/codeyam-cli/src/webserver/build-info.json +5 -5
  327. package/codeyam-cli/src/webserver/editorProxy.js +436 -13
  328. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  329. package/codeyam-cli/src/webserver/idleDetector.js +121 -0
  330. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
  331. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  332. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  333. package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
  334. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +53 -0
  335. package/codeyam-cli/src/webserver/server.js +125 -4
  336. package/codeyam-cli/src/webserver/server.js.map +1 -1
  337. package/codeyam-cli/src/webserver/terminalServer.js +288 -43
  338. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  339. package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
  340. package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
  341. package/codeyam-cli/templates/chrome-extension-react/package.json +1 -0
  342. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +6 -0
  343. package/codeyam-cli/templates/codeyam-editor-claude.md +86 -5
  344. package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
  345. package/codeyam-cli/templates/editor-step-hook.py +193 -56
  346. package/codeyam-cli/templates/expo-react-native/README.md +41 -0
  347. package/codeyam-cli/templates/expo-react-native/package.json +1 -0
  348. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +14 -0
  349. package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
  350. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +2 -1
  351. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +83 -40
  352. package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
  353. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +2 -1
  354. package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
  355. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +1 -1
  356. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +94 -10
  357. package/package.json +2 -1
  358. package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
  359. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  360. package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
  361. package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
  362. package/packages/ai/src/lib/astScopes/paths.js +12 -3
  363. package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
  364. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
  365. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  366. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
  367. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
  368. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
  369. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  370. package/packages/analyze/index.js +1 -1
  371. package/packages/analyze/index.js.map +1 -1
  372. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
  373. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  374. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
  375. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  376. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
  377. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  378. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
  379. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  380. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
  381. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
  382. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
  383. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  384. package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
  385. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  386. package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
  387. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  388. package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
  389. package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
  390. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
  391. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  392. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
  393. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  394. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +84 -0
  395. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  396. package/packages/database/src/lib/loadAnalysis.js +1 -1
  397. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  398. package/packages/database/src/lib/loadEntities.js +0 -6
  399. package/packages/database/src/lib/loadEntities.js.map +1 -1
  400. package/packages/database/src/lib/loadEntity.js +5 -5
  401. package/packages/database/src/lib/loadEntity.js.map +1 -1
  402. package/packages/database/src/lib/updateCommitMetadata.js +0 -25
  403. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  404. package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
  405. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  406. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
  407. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
  408. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
  409. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
  410. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
  411. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
  412. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
  413. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
  414. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
  415. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-C4pqxYJB.js +0 -51
  416. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
  417. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Csi0_PMl.js +0 -1
  418. package/codeyam-cli/src/webserver/build/client/assets/editor-BuT_Huj0.js +0 -10
  419. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +0 -41
  420. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.js +0 -6
  421. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +0 -6
  422. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
  423. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
  424. package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
  425. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
  426. package/codeyam-cli/src/webserver/build/client/assets/globals-BkWJ_UNc.css +0 -1
  427. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
  428. package/codeyam-cli/src/webserver/build/client/assets/manifest-b0f1372e.js +0 -1
  429. package/codeyam-cli/src/webserver/build/client/assets/memory-Bl2rpw8u.js +0 -96
  430. package/codeyam-cli/src/webserver/build/client/assets/root-B_X8HS1x.js +0 -67
  431. package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
  432. package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
  433. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +0 -1
  434. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
  435. package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
  436. package/codeyam-cli/src/webserver/build/server/assets/index-CbF6h3dj.js +0 -1
  437. package/codeyam-cli/src/webserver/build/server/assets/server-build-DRFwTJqO.js +0 -367
@@ -15,34 +15,70 @@ from datetime import datetime, timezone
15
15
 
16
16
  STEP_LABELS = {
17
17
  1: "Plan",
18
- 2: "Prototype",
19
- 3: "Confirm",
20
- 4: "Deconstruct",
21
- 5: "Extract",
22
- 6: "Glossary",
23
- 7: "Analyze",
24
- 8: "App Scenarios",
25
- 9: "User Scenarios",
26
- 10: "Verify",
27
- 11: "Journal",
28
- 12: "Review",
29
- 13: "Present",
18
+ 2: "Prepare",
19
+ 3: "Prototype",
20
+ 4: "Verify Prototype",
21
+ 5: "Confirm",
22
+ 6: "Deconstruct",
23
+ 7: "Extract",
24
+ 8: "Glossary",
25
+ 9: "Analyze",
26
+ 10: "App Scenarios",
27
+ 11: "User Scenarios",
28
+ 12: "Verify",
29
+ 13: "Journal",
30
+ 14: "Review",
31
+ 15: "Present",
32
+ 16: "Commit",
33
+ 17: "Finalize",
34
+ 18: "Push",
30
35
  }
31
36
 
32
37
  STEP_RESTRICTIONS = {
33
38
  1: "Do NOT write any code. Plan and describe only. Wait for user confirmation.",
34
- 2: "Do NOT create scenarios or run codeyam analyze. Build fast working prototype with real data.",
35
- 3: "Present a selection menu (AskUserQuestion) for confirmation. Do NOT refactor or create scenarios until approved.",
36
- 4: "Do NOT write any code. Read every file, identify all extractable pieces, write a numbered plan. Planning only.",
37
- 5: "Execute the extraction plan from step 4. Components first (no tests), then library functions via TDD. Page files must contain ZERO direct JSX.",
38
- 6: "Do NOT write application code or scenarios. Update the glossary only.",
39
- 7: "Create isolation routes for visual components, run tests for library functions. Register component scenarios via codeyam editor register.",
40
- 8: "Do NOT modify application code. Create and register app-level scenarios only.",
41
- 9: "Do NOT modify application code. Create user-persona scenarios only (or skip if no users).",
42
- 10: "Verify component isolation screenshots AND editor scenarios. After ANY code fix, re-register affected components. Fix only — do NOT add features.",
43
- 11: "Create or update the journal entry for this feature. Do NOT create a duplicate check if one exists first.",
44
- 12: "Verify ALL screenshots exist and NO client-side errors (/api/editor-client-errors). Run codeyam editor audit. Do not proceed until all checks pass.",
45
- 13: "Show the results panel, present summary, then selection menu (AskUserQuestion): Save or make changes.",
39
+ 2: "Do NOT write any code or build features. Set up the project and prepare the database only.",
40
+ 3: "Do NOT create scenarios or run codeyam analyze. Build fast working prototype with real data.",
41
+ 4: "Verify the prototype works. Do NOT add features only fix broken functionality.",
42
+ 5: "Present a selection menu (AskUserQuestion) for confirmation. Do NOT refactor or create scenarios until approved.",
43
+ 6: "Do NOT write any code. Read every file, identify all extractable pieces, write a numbered plan. Planning only.",
44
+ 7: "Execute the extraction plan from step 6. Components first (no tests), then library functions via TDD. Page files must contain ZERO direct JSX.",
45
+ 8: "Do NOT write application code or scenarios. Update the glossary only.",
46
+ 9: "Create isolation routes for visual components, run tests for library functions. Register component scenarios via codeyam editor register.",
47
+ 10: "Do NOT modify application code. Create and register app-level scenarios only.",
48
+ 11: "Do NOT modify application code. Create user-persona scenarios only (or skip if no users).",
49
+ 12: "Verify component isolation screenshots AND editor scenarios. After ANY code fix, re-register affected components. Fix only do NOT add features.",
50
+ 13: "Create or update the journal entry for this feature. Do NOT create a duplicate check if one exists first.",
51
+ 14: "Verify ALL screenshots exist and NO client-side errors (/api/editor-client-errors). Run codeyam editor audit. Do not proceed until all checks pass.",
52
+ 15: "Show the results panel, present summary, then selection menu (AskUserQuestion): Save or make changes.",
53
+ 16: "Hide the results panel and commit all changes. Do NOT push — that happens in step 18.",
54
+ 17: "Update the journal entry with the commit SHA and amend the commit to include the journal update.",
55
+ 18: "Check for a git remote and offer to push. WAIT for the user's answer before starting the next feature.",
56
+ }
57
+
58
+ MIGRATION_STEP_LABELS = {
59
+ 1: "Survey",
60
+ 2: "App Scenarios",
61
+ 3: "Component Scenarios",
62
+ 4: "Preview",
63
+ 5: "Discuss",
64
+ 6: "Decompose",
65
+ 7: "Extract",
66
+ 8: "Recapture",
67
+ 9: "Journal",
68
+ 10: "Present",
69
+ }
70
+
71
+ MIGRATION_STEP_RESTRICTIONS = {
72
+ 1: "Survey the page and start the dev server. Read all files and map data flow. Do NOT register scenarios yet.",
73
+ 2: "Set up seed adapter if needed, then register application scenarios for the ACTUAL page route with seed data.",
74
+ 3: "Create isolation routes and register component scenarios for individual visual components.",
75
+ 4: "Verify screenshots and show results to the user. Do NOT modify application code.",
76
+ 5: "Assess complexity and ask user about decomposition. Wait for user decision before proceeding.",
77
+ 6: "Plan-only. Identify all extractions, mark existing components as REUSE. Do NOT write code.",
78
+ 7: "Execute the extraction plan. Components first, then functions via TDD.",
79
+ 8: "Update glossary, re-register scenarios after code changes, verify screenshots. Fix issues only.",
80
+ 9: "Create the journal entry for this page's migration.",
81
+ 10: "Show results, present summary, commit or make changes. After commit run `codeyam editor migrate complete` then `codeyam editor migrate next`.",
46
82
  }
47
83
 
48
84
 
@@ -81,6 +117,13 @@ def detect_event():
81
117
 
82
118
 
83
119
  def main():
120
+ # Only run in editor Build sessions. The env var is set by the terminal
121
+ # server when launching Claude in editor mode. Without this guard, hooks
122
+ # fire in every Claude session in the project (scenario editing, bare
123
+ # claude, etc.) and inject unwanted step restrictions.
124
+ if not os.environ.get("CODEYAM_EDITOR_ACTIVE"):
125
+ return
126
+
84
127
  project_dir = os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
85
128
  state_path = os.path.join(project_dir, ".codeyam", "editor-step.json")
86
129
  prompt_path = os.path.join(project_dir, ".codeyam", "editor-user-prompt.txt")
@@ -88,17 +131,34 @@ def main():
88
131
  # Detect event early so we can capture the user prompt even before state exists
89
132
  event_type, event_data = detect_event()
90
133
 
91
- # Capture the very first user prompt (before state file may exist).
92
- # Save to a separate file so it persists across state transitions.
93
- if event_type == "user_prompt" and not os.path.exists(prompt_path):
134
+ # Capture the user's feature request prompt.
135
+ # Write when: (a) no prompt file yet, (b) no state file (between features),
136
+ # or (c) previous feature is done (step >= 18). This ensures the prompt
137
+ # is refreshed for each new feature instead of persisting stale text.
138
+ # Skip slash commands (e.g. /codeyam-editor) — they aren't user prompts.
139
+ if event_type == "user_prompt":
94
140
  prompt_text = event_data.get("prompt", "").strip()
95
- if prompt_text:
96
- try:
97
- os.makedirs(os.path.dirname(prompt_path), exist_ok=True)
98
- with open(prompt_path, "w") as f:
99
- f.write(prompt_text)
100
- except Exception:
101
- pass # Best-effort
141
+ if prompt_text and not prompt_text.startswith("/"):
142
+ should_capture = not os.path.exists(prompt_path)
143
+ if not should_capture:
144
+ # Overwrite stale prompt when between features
145
+ if not os.path.exists(state_path):
146
+ should_capture = True
147
+ else:
148
+ try:
149
+ with open(state_path, "r") as f:
150
+ prev = json.load(f)
151
+ if prev.get("step", 0) >= 18:
152
+ should_capture = True
153
+ except Exception:
154
+ pass
155
+ if should_capture:
156
+ try:
157
+ os.makedirs(os.path.dirname(prompt_path), exist_ok=True)
158
+ with open(prompt_path, "w") as f:
159
+ f.write(prompt_text)
160
+ except Exception:
161
+ pass # Best-effort
102
162
 
103
163
  if not os.path.exists(state_path):
104
164
  return
@@ -112,24 +172,61 @@ def main():
112
172
  step = state.get("step")
113
173
  label = state.get("label", "Unknown")
114
174
  feature = state.get("feature", "")
175
+ migration = state.get("migration") # Optional migration context
115
176
 
116
177
  if not step:
117
178
  return
118
179
 
180
+ # ── Task tracking ──────────────────────────────────────────────────
181
+ # Track whether TaskCreate was called between step transitions.
182
+ # If Claude advances to the next step without creating a task, block it.
183
+ task_tracking_path = os.path.join(project_dir, ".codeyam", "editor-task-tracking.json")
184
+
185
+ if event_type == "post_tool_use":
186
+ tool_name = event_data.get("tool_name", "")
187
+
188
+ # Record when TaskCreate is called
189
+ if tool_name == "TaskCreate":
190
+ try:
191
+ tracking = {}
192
+ if os.path.exists(task_tracking_path):
193
+ with open(task_tracking_path, "r") as f:
194
+ tracking = json.load(f)
195
+ tracking["taskCreated"] = True
196
+ with open(task_tracking_path, "w") as f:
197
+ json.dump(tracking, f)
198
+ except Exception:
199
+ pass
200
+
119
201
  # Log the hook firing
120
202
  log_data = {"step": step, "label": label, "feature": feature, "hook": event_type}
203
+ if migration:
204
+ log_data["migration"] = True
121
205
  if event_type == "post_tool_use":
122
206
  log_data["tool"] = event_data.get("tool_name", "")
123
207
  log_event(project_dir, "hook", log_data)
124
208
 
125
- restriction = STEP_RESTRICTIONS.get(step, "")
126
- next_cmd = f"codeyam editor {step + 1}" if step < 13 else "codeyam editor 1"
209
+ # Use migration-specific labels/restrictions when in migration mode
210
+ if migration:
211
+ restriction = MIGRATION_STEP_RESTRICTIONS.get(step, "")
212
+ next_cmd = f"codeyam editor migrate {step + 1}" if step < 10 else "codeyam editor migrate next"
213
+ else:
214
+ restriction = STEP_RESTRICTIONS.get(step, "")
215
+ next_cmd = f"codeyam editor {step + 1}" if step < 18 else "codeyam editor 1"
127
216
 
128
217
  # UserPromptSubmit: concise workflow reminder injected before Claude processes the user's message
129
218
  if event_type == "user_prompt":
219
+ mode_label = "Migration Mode" if migration else "Editor Mode"
220
+ page_info = ""
221
+ if migration:
222
+ page_name = migration.get("pageName", "")
223
+ page_idx = migration.get("pageIndex", 0)
224
+ total = migration.get("totalPages", 0)
225
+ page_info = f" — Page {page_idx + 1}/{total} ({page_name})"
226
+
130
227
  lines = [
131
228
  f'<user-prompt-submit-hook>',
132
- f'Editor Mode — Step {step} ({label}): "{feature}"',
229
+ f'{mode_label} — Step {step} ({label}): "{feature}"{page_info}',
133
230
  ]
134
231
 
135
232
  # Include the active scenario so Claude knows what the user is looking at
@@ -149,15 +246,26 @@ def main():
149
246
  except (IOError, json.JSONDecodeError):
150
247
  pass
151
248
 
152
- if step == 13:
249
+ if migration and step == 8:
250
+ lines.append(
251
+ "If the user is requesting changes (even indirectly), "
252
+ "run `codeyam editor change` BEFORE making any modifications. "
253
+ "The change workflow ensures Working Session Results are shown to the user. "
254
+ "If the user chose to commit, run `codeyam editor migrate next` to advance to the next page."
255
+ )
256
+ elif step in (15, 16, 17, 18) and not migration:
153
257
  lines.append(
154
258
  "If the user is requesting changes (even indirectly), "
155
259
  "run `codeyam editor change` BEFORE making any modifications "
156
260
  "(code, scenarios, data, styles — everything). "
157
261
  "The change command gives you the post-change checklist. "
158
262
  "The change workflow ensures Working Session Results are shown to the user. "
159
- "If the user chose to commit, run `codeyam editor steps` after committing "
160
- "to start the next feature."
263
+ "If the user chose to commit, run `codeyam editor 16` to advance to the commit step."
264
+ )
265
+ elif migration:
266
+ lines.append(
267
+ f"You are on migration step {step}. Follow the `codeyam editor migrate` workflow. "
268
+ f"Do NOT skip ahead or make changes outside the current step."
161
269
  )
162
270
  else:
163
271
  lines.append(
@@ -170,8 +278,9 @@ def main():
170
278
  print("\n".join(lines))
171
279
  return
172
280
 
281
+ mode_label = "Migration Mode" if migration else "Editor Mode"
173
282
  lines = [
174
- f'Editor Mode \u2014 Step {step} ({label}): "{feature}"',
283
+ f'{mode_label} \u2014 Step {step} ({label}): "{feature}"',
175
284
  ]
176
285
  if restriction:
177
286
  lines.append(restriction)
@@ -182,18 +291,40 @@ def main():
182
291
  BOLD_CYAN = "\033[1;36m"
183
292
  DIM = "\033[2m"
184
293
  RESET = "\033[0m"
185
- tracker = [f"{DIM} \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510{RESET}"]
186
- for i in range(1, 14):
187
- lbl = STEP_LABELS[i].ljust(28)
188
- num = f" {i}" if i < 10 else f"{i}"
189
- content = f"{num}. {lbl}"
190
- if i < step:
191
- tracker.append(f"{DIM} \u2502{RESET}{GREEN} \u2713 {content}{RESET}{DIM}\u2502{RESET}")
192
- elif i == step:
193
- tracker.append(f"{DIM} \u2502{RESET}{BOLD_CYAN} \u2192 {content}{RESET}{DIM}\u2502{RESET}")
194
- else:
195
- tracker.append(f"{DIM} \u2502 \u25cb {content}\u2502{RESET}")
196
- tracker.append(f"{DIM} \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518{RESET}")
294
+
295
+ if migration:
296
+ # Migration progress tracker (10 steps)
297
+ page_name = migration.get("pageName", "")
298
+ page_idx = migration.get("pageIndex", 0)
299
+ total = migration.get("totalPages", 0)
300
+ tracker = [f"{DIM} Migration: Page {page_idx + 1}/{total} ({page_name}){RESET}"]
301
+ tracker.append(f"{DIM} \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510{RESET}")
302
+ for i in range(1, 11):
303
+ lbl = MIGRATION_STEP_LABELS[i].ljust(28)
304
+ num = f" {i}" if i < 10 else f"{i}"
305
+ cntnt = f"{num}. {lbl}"
306
+ if i < step:
307
+ tracker.append(f"{DIM} \u2502{RESET}{GREEN} \u2713 {cntnt}{RESET}{DIM}\u2502{RESET}")
308
+ elif i == step:
309
+ tracker.append(f"{DIM} \u2502{RESET}{BOLD_CYAN} \u2192 {cntnt}{RESET}{DIM}\u2502{RESET}")
310
+ else:
311
+ tracker.append(f"{DIM} \u2502 \u25cb {cntnt}\u2502{RESET}")
312
+ tracker.append(f"{DIM} \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518{RESET}")
313
+ else:
314
+ # Standard progress tracker (18 steps)
315
+ tracker = [f"{DIM} \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510{RESET}"]
316
+ for i in range(1, 19):
317
+ lbl = STEP_LABELS[i].ljust(28)
318
+ num = f" {i}" if i < 10 else f"{i}"
319
+ content = f"{num}. {lbl}"
320
+ if i < step:
321
+ tracker.append(f"{DIM} \u2502{RESET}{GREEN} \u2713 {content}{RESET}{DIM}\u2502{RESET}")
322
+ elif i == step:
323
+ tracker.append(f"{DIM} \u2502{RESET}{BOLD_CYAN} \u2192 {content}{RESET}{DIM}\u2502{RESET}")
324
+ else:
325
+ tracker.append(f"{DIM} \u2502 \u25cb {content}\u2502{RESET}")
326
+ tracker.append(f"{DIM} \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518{RESET}")
327
+
197
328
  lines.append("Present this progress tracker to the user (copy verbatim):")
198
329
  lines.extend(tracker)
199
330
  lines.append(
@@ -201,7 +332,7 @@ def main():
201
332
  "\u2713 (done) or \u2717 (skipped + reason)."
202
333
  )
203
334
 
204
- if event_type == "stop" and step == 13:
335
+ if event_type == "stop" and ((step in (15, 16) and not migration) or (step == 8 and migration)):
205
336
  import subprocess as _sp
206
337
  try:
207
338
  _result = _sp.run(
@@ -218,10 +349,16 @@ def main():
218
349
  "\n\033[1;31m⚠️ You have uncommitted changes but haven't shown Working Session Results.\033[0m"
219
350
  )
220
351
  lines.append(
221
- "\033[31mRun `codeyam editor change` if you haven't already, then complete the "
222
- "checklist and run `codeyam editor 13` to show results to the user.\033[0m"
352
+ f"\033[31mRun `codeyam editor change` if you haven't already, then complete the "
353
+ f"checklist and run `{'codeyam editor migrate 8' if migration else 'codeyam editor 15'}` to show results to the user.\033[0m"
223
354
  )
224
355
 
356
+ if event_type == "stop":
357
+ lines.append(
358
+ f"\n\033[2mReminder: Only use `codeyam editor` subcommands in the Build terminal. "
359
+ f"Follow `codeyam editor steps` when changing code.\033[0m"
360
+ )
361
+
225
362
  lines.append(f"When this step is complete, run: {next_cmd}")
226
363
 
227
364
  print("\n".join(lines))
@@ -0,0 +1,41 @@
1
+ # Project Name
2
+
3
+ Brief description of what this app does.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ npm run setup
9
+ ```
10
+
11
+ ## Development
12
+
13
+ Start the Expo dev server (web):
14
+
15
+ ```bash
16
+ npm run dev
17
+ ```
18
+
19
+ For native platforms:
20
+
21
+ ```bash
22
+ npm run ios # iOS simulator
23
+ npm run android # Android emulator
24
+ ```
25
+
26
+ ## Using CodeYam Editor
27
+
28
+ This project was built with [CodeYam](https://codeyam.com). To launch the editor:
29
+
30
+ ```bash
31
+ codeyam editor
32
+ ```
33
+
34
+ ## Scripts
35
+
36
+ | Script | Description |
37
+ | ----------------- | --------------------------- |
38
+ | `npm run setup` | Install dependencies |
39
+ | `npm run dev` | Start Expo dev server (web) |
40
+ | `npm run ios` | Run on iOS simulator |
41
+ | `npm run android` | Run on Android emulator |
@@ -4,6 +4,7 @@
4
4
  "private": true,
5
5
  "main": "expo-router/entry",
6
6
  "scripts": {
7
+ "setup": "npm install",
7
8
  "dev": "expo start --web",
8
9
  "start": "expo start",
9
10
  "android": "expo start --android",
@@ -23,6 +23,20 @@ npm run db:reset
23
23
  npx prisma studio
24
24
  ```
25
25
 
26
+ ## Adding Columns to Existing Tables
27
+
28
+ When adding a new **required** column to a table that already has data, `db push` will fail because existing rows have no value for the new column. To avoid this:
29
+
30
+ - **Add a `@default(...)` value** so Prisma can fill existing rows automatically:
31
+ ```prisma
32
+ model Rating {
33
+ userId String @default("anonymous") // existing rows get "anonymous"
34
+ }
35
+ ```
36
+ - Once all rows have real values, you can remove the default if desired.
37
+ - **Never use `--force-reset`** — it drops ALL tables and deletes all data.
38
+ - Optional columns (`String?`) don't need a default — existing rows get `null`.
39
+
26
40
  ## Using the Database
27
41
 
28
42
  ```typescript
@@ -0,0 +1,53 @@
1
+ # Project Name
2
+
3
+ Brief description of what this app does.
4
+
5
+ ## Setup
6
+
7
+ Run the setup script to install dependencies, initialize the database, and seed it with demo data:
8
+
9
+ ```bash
10
+ npm run setup
11
+ ```
12
+
13
+ ## Development
14
+
15
+ Start the dev server:
16
+
17
+ ```bash
18
+ npm run dev
19
+ ```
20
+
21
+ Open [http://localhost:3000](http://localhost:3000) in your browser.
22
+
23
+ ## Using CodeYam Editor
24
+
25
+ This project was built with [CodeYam](https://codeyam.com). To launch the editor:
26
+
27
+ ```bash
28
+ codeyam editor
29
+ ```
30
+
31
+ The editor provides a live preview alongside a Claude Code terminal for iterating on the app.
32
+
33
+ ## Database
34
+
35
+ This project uses SQLite via Prisma. Common commands:
36
+
37
+ ```bash
38
+ npm run db:push # Apply schema changes and generate Prisma client
39
+ npm run db:seed # Seed the database with demo data
40
+ npm run db:reset # Reset database: drop, recreate, and re-seed
41
+ ```
42
+
43
+ ## Scripts
44
+
45
+ | Script | Description |
46
+ | ------------------ | -------------------------------------------- |
47
+ | `npm run setup` | One-line project setup (install + db + seed) |
48
+ | `npm run dev` | Start the development server |
49
+ | `npm run build` | Build for production |
50
+ | `npm run test` | Run tests |
51
+ | `npm run db:push` | Apply Prisma schema changes |
52
+ | `npm run db:seed` | Seed the database |
53
+ | `npm run db:reset` | Reset and re-seed the database |
@@ -3,6 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "scripts": {
6
+ "setup": "npm install && npm run db:push && npm run db:seed",
6
7
  "dev": "next dev --turbopack",
7
8
  "build": "next build",
8
9
  "start": "next start",
@@ -17,7 +18,7 @@
17
18
  "@prisma/adapter-better-sqlite3": "^7.4.1",
18
19
  "@prisma/client": "^7.4.1",
19
20
  "better-sqlite3": "^12.6.2",
20
- "next": "^15.3.3",
21
+ "next": "^16.1.7",
21
22
  "prisma": "^7.4.1",
22
23
  "react": "^19.1.0",
23
24
  "react-dom": "^19.1.0"
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import 'dotenv/config';
20
- import { PrismaClient } from '@prisma/client';
20
+ import { PrismaClient, Prisma } from '@prisma/client';
21
21
  import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3';
22
22
  import * as fs from 'fs';
23
23
 
@@ -37,56 +37,99 @@ async function main() {
37
37
  const data = JSON.parse(raw);
38
38
  const seed = data.seed || data;
39
39
 
40
- console.log(`Seeding tables: ${Object.keys(seed).join(', ')}`);
41
-
42
- // Wipe all tables in reverse order (to respect foreign keys)
43
40
  const tableNames = Object.keys(seed);
44
- for (const table of [...tableNames].reverse()) {
45
- try {
46
- await (prisma as any)[table].deleteMany();
47
- console.log(` Cleared ${table}`);
48
- } catch (err) {
49
- console.warn(
50
- ` Could not clear ${table}: ${err instanceof Error ? err.message : err}`,
51
- );
41
+
42
+ // Run everything in a single transaction for atomicity and speed.
43
+ // SQLite auto-commits each statement by default — wrapping in a transaction
44
+ // avoids per-statement fsync and is significantly faster for bulk operations.
45
+ await prisma.$transaction(async (tx) => {
46
+ // Disable foreign key checks during wipe+insert — allows deleting in any
47
+ // order and avoids FK constraint errors during the brief window between
48
+ // clearing parent and child tables.
49
+ await tx.$executeRawUnsafe('PRAGMA foreign_keys = OFF');
50
+
51
+ // Wipe all tables
52
+ for (const table of [...tableNames].reverse()) {
53
+ try {
54
+ await (tx as any)[table].deleteMany();
55
+ } catch {
56
+ // Table may not exist in current schema — skip
57
+ }
52
58
  }
53
- }
54
59
 
55
- // Reset auto-increment counters so IDs start from 1 after each re-seed.
56
- // Without this, SQLite IDs keep climbing (1, 2, ... then 9, 10, ...)
57
- // across scenario switches, causing hardcoded URLs like /drinks/1 to 404.
58
- for (const table of tableNames) {
60
+ // Batch-reset auto-increment counters in a single statement.
61
+ // Without this, SQLite IDs keep climbing across scenario switches,
62
+ // causing hardcoded URLs like /drinks/1 to 404.
63
+ const seqNames = tableNames
64
+ .flatMap((t) => [`'${t}'`, `'${t.charAt(0).toUpperCase() + t.slice(1)}'`])
65
+ .join(', ');
59
66
  try {
60
- // Prisma uses PascalCase model names; sqlite_sequence stores the actual table name.
61
- // Try both the seed key (which matches the Prisma model) and common casings.
62
- await prisma.$executeRawUnsafe(
63
- `DELETE FROM sqlite_sequence WHERE name = '${table}' OR name = '${table.charAt(0).toUpperCase() + table.slice(1)}'`,
67
+ await tx.$executeRawUnsafe(
68
+ `DELETE FROM sqlite_sequence WHERE name IN (${seqNames})`,
64
69
  );
65
70
  } catch {
66
- // sqlite_sequence may not exist if no autoincrement columns — safe to ignore
71
+ // sqlite_sequence may not exist — safe to ignore
67
72
  }
68
- }
69
73
 
70
- // Insert seed data
71
- for (const [table, rows] of Object.entries(seed)) {
72
- if (!Array.isArray(rows) || rows.length === 0) continue;
74
+ // Insert seed data
75
+ for (const [table, rows] of Object.entries(seed)) {
76
+ if (!Array.isArray(rows) || rows.length === 0) continue;
77
+ try {
78
+ await (tx as any)[table].createMany({ data: rows });
79
+ console.log(` Seeded ${rows.length} rows into ${table}`);
80
+ } catch (err) {
81
+ console.error(
82
+ ` Failed to seed ${table}: ${err instanceof Error ? err.message : err}`,
83
+ );
84
+ process.exit(1);
85
+ }
86
+ }
87
+
88
+ // Re-enable foreign key checks
89
+ await tx.$executeRawUnsafe('PRAGMA foreign_keys = ON');
90
+ });
91
+
92
+ console.log('Seed complete');
93
+ }
94
+
95
+ /**
96
+ * Export mode: dump current database state to a JSON file.
97
+ * Used by CodeYam to save interactive changes back to scenario seed data.
98
+ *
99
+ * Usage: npx tsx .codeyam/seed-adapter.ts --export <output-path.json>
100
+ */
101
+ async function exportData(outputPath: string) {
102
+ const modelNames = Prisma.dmmf.datamodel.models.map((m) => m.name);
103
+
104
+ const seed: Record<string, unknown[]> = {};
105
+ for (const model of modelNames) {
106
+ const camelCase = model.charAt(0).toLowerCase() + model.slice(1);
73
107
  try {
74
- await (prisma as any)[table].createMany({ data: rows });
75
- console.log(` Seeded ${rows.length} rows into ${table}`);
76
- } catch (err) {
77
- console.error(
78
- ` Failed to seed ${table}: ${err instanceof Error ? err.message : err}`,
79
- );
80
- process.exit(1);
108
+ const rows = await (prisma as any)[camelCase].findMany();
109
+ if (rows.length > 0) {
110
+ seed[camelCase] = rows;
111
+ }
112
+ } catch {
113
+ // Skip tables that can't be queried
81
114
  }
82
115
  }
83
116
 
84
- console.log('Seed complete');
117
+ fs.writeFileSync(outputPath, JSON.stringify(seed, null, 2));
118
+ console.log(`Exported ${Object.keys(seed).length} tables`);
85
119
  }
86
120
 
87
- main()
88
- .then(() => prisma.$disconnect())
89
- .catch((e) => {
90
- console.error('Seed adapter error:', e);
91
- process.exit(1);
92
- });
121
+ if (process.argv[2] === '--export') {
122
+ exportData(process.argv[3])
123
+ .then(() => prisma.$disconnect())
124
+ .catch((e) => {
125
+ console.error('Seed adapter export error:', e);
126
+ process.exit(1);
127
+ });
128
+ } else {
129
+ main()
130
+ .then(() => prisma.$disconnect())
131
+ .catch((e) => {
132
+ console.error('Seed adapter error:', e);
133
+ process.exit(1);
134
+ });
135
+ }