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

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 (317) 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 +9 -9
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +0 -33
  6. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +13 -7
  7. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  8. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
  9. package/analyzer-template/packages/aws/package.json +2 -2
  10. package/analyzer-template/packages/database/package.json +3 -3
  11. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +20 -0
  12. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +4 -0
  13. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
  14. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +20 -0
  15. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  16. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  17. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  18. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
  19. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js.map +1 -1
  20. package/analyzer-template/packages/github/package.json +1 -1
  21. package/analyzer-template/packages/types/src/enums/ProjectFramework.ts +2 -0
  22. package/analyzer-template/packages/ui-components/package.json +1 -1
  23. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  24. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  25. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
  26. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
  27. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  28. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  29. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  30. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  31. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  32. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  33. package/codeyam-cli/src/commands/default.js +3 -46
  34. package/codeyam-cli/src/commands/default.js.map +1 -1
  35. package/codeyam-cli/src/commands/editor.js +1893 -215
  36. package/codeyam-cli/src/commands/editor.js.map +1 -1
  37. package/codeyam-cli/src/commands/init.js +6 -1
  38. package/codeyam-cli/src/commands/init.js.map +1 -1
  39. package/codeyam-cli/src/data/techStacks.js +82 -0
  40. package/codeyam-cli/src/data/techStacks.js.map +1 -0
  41. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  42. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  43. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
  44. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  45. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +635 -0
  46. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  47. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  48. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  49. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +279 -0
  50. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  51. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
  52. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  53. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  54. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  55. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  56. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  57. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +393 -0
  58. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  59. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  60. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  61. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  62. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  63. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +266 -0
  64. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  65. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +107 -0
  66. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -0
  67. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  68. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  69. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  70. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  71. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +221 -0
  72. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  73. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +213 -0
  74. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  75. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1737 -0
  76. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  77. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  78. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  79. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  80. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  81. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +101 -0
  82. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  83. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  84. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  85. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  86. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  87. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +246 -0
  88. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  89. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +25 -5
  90. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  91. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +51 -0
  92. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  93. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +142 -0
  94. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
  95. package/codeyam-cli/src/utils/backgroundServer.js +2 -2
  96. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  97. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  98. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  99. package/codeyam-cli/src/utils/devServerState.js +71 -0
  100. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  101. package/codeyam-cli/src/utils/editorApi.js +73 -0
  102. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  103. package/codeyam-cli/src/utils/editorAudit.js +159 -0
  104. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  105. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  106. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  107. package/codeyam-cli/src/utils/editorDevServer.js +193 -0
  108. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  109. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  110. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  111. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  112. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  113. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  114. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  115. package/codeyam-cli/src/utils/editorLoaderHelpers.js +81 -0
  116. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  117. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  118. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  119. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  120. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  121. package/codeyam-cli/src/utils/editorPreview.js +106 -0
  122. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  123. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  124. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  125. package/codeyam-cli/src/utils/editorScenarios.js +96 -0
  126. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  127. package/codeyam-cli/src/utils/editorSeedAdapter.js +173 -0
  128. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  129. package/codeyam-cli/src/utils/entityChangeStatus.js +347 -0
  130. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  131. package/codeyam-cli/src/utils/entityChangeStatus.server.js +158 -0
  132. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  133. package/codeyam-cli/src/utils/git.js +51 -0
  134. package/codeyam-cli/src/utils/git.js.map +1 -1
  135. package/codeyam-cli/src/utils/install-skills.js +28 -17
  136. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  137. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  138. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  139. package/codeyam-cli/src/utils/project.js +15 -5
  140. package/codeyam-cli/src/utils/project.js.map +1 -1
  141. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  142. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  143. package/codeyam-cli/src/utils/scenariosManifest.js +112 -0
  144. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  145. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +46 -16
  146. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  147. package/codeyam-cli/src/utils/testRunner.js +1 -1
  148. package/codeyam-cli/src/utils/testRunner.js.map +1 -1
  149. package/codeyam-cli/src/utils/webappDetection.js +21 -0
  150. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  151. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +178 -0
  152. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
  153. package/codeyam-cli/src/webserver/app/lib/git.js +396 -0
  154. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  155. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-DmJveP3T.js → CopyButton-BPXZwM4t.js} +1 -1
  156. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-C76mRRiF.js → EntityItem-BcgbViKV.js} +3 -3
  157. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CobE682z.js → EntityTypeIcon-CQIG2qda.js} +9 -9
  158. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-djPLI-WV.js → ReportIssueModal-BzHcG7SE.js} +3 -3
  159. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-B76aig_2.js → ScenarioViewer-0DY_NKil.js} +3 -3
  160. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
  161. package/codeyam-cli/src/webserver/build/client/assets/{_index-C96V0n15.js → _index-DLxKhri3.js} +3 -3
  162. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BpKzcsJz.js → activity.(_tab)-BcY3q6nt.js} +6 -6
  163. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  164. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  165. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  166. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-D9hemwl6.js → agent-transcripts-Bni3iiUj.js} +5 -5
  167. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  168. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  169. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  170. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  171. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  172. package/codeyam-cli/src/webserver/build/client/assets/{book-open-D_nMCFmP.js → book-open-BYOypzCa.js} +2 -2
  173. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BH2h1Ea2.js → chevron-down-C_Pmso5S.js} +2 -2
  174. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-DyIKORY6.js → circle-check-BVMi9VA5.js} +2 -2
  175. package/codeyam-cli/src/webserver/build/client/assets/{copy-NDbZjXao.js → copy-n2FB0_Sw.js} +3 -3
  176. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CC6AbExI.js +41 -0
  177. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Csi0_PMl.js +1 -0
  178. package/codeyam-cli/src/webserver/build/client/assets/editor-BuT_Huj0.js +10 -0
  179. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-B7ztwLut.js +41 -0
  180. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CrjR3zZW.js → entity._sha._-BF4oLwaE.js} +3 -3
  181. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D5rYBT5x.js +6 -0
  182. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +6 -0
  183. package/codeyam-cli/src/webserver/build/client/assets/{files-DO4CZ16O.js → files-BZrlFE1F.js} +1 -1
  184. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +1 -0
  185. package/codeyam-cli/src/webserver/build/client/assets/globals-BkWJ_UNc.css +1 -0
  186. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  187. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BAXYRVEO.js → loader-circle-DaAZ_H2w.js} +2 -2
  188. package/codeyam-cli/src/webserver/build/client/assets/manifest-b0f1372e.js +1 -0
  189. package/codeyam-cli/src/webserver/build/client/assets/{memory-FweZHj5U.js → memory-Bl2rpw8u.js} +13 -10
  190. package/codeyam-cli/src/webserver/build/client/assets/{pause-DTAcYxBt.js → pause-f5-1lKBt.js} +3 -3
  191. package/codeyam-cli/src/webserver/build/client/assets/{root-DiRdBreB.js → root-B_X8HS1x.js} +18 -18
  192. package/codeyam-cli/src/webserver/build/client/assets/{search-fKo7v0Zo.js → search-Di64LWVb.js} +2 -2
  193. package/codeyam-cli/src/webserver/build/client/assets/{settings-DfuTtcJP.js → settings-0OrEMU6J.js} +1 -1
  194. package/codeyam-cli/src/webserver/build/client/assets/{simulations-B3aOzpCZ.js → simulations-DWT-CvLy.js} +1 -1
  195. package/codeyam-cli/src/webserver/build/client/assets/{terminal-BG4heKCG.js → terminal-Br7MOqts.js} +3 -3
  196. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-DtSmdtM4.js → triangle-alert-BLdiCuG-.js} +2 -2
  197. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +1 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  199. package/codeyam-cli/src/webserver/build/server/assets/{index-BzAbACSx.js → index-CbF6h3dj.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/server/assets/server-build-DRFwTJqO.js +367 -0
  201. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  202. package/codeyam-cli/src/webserver/build-info.json +5 -5
  203. package/codeyam-cli/src/webserver/editorProxy.js +383 -50
  204. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  205. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  206. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +94 -4
  207. package/codeyam-cli/src/webserver/server.js +93 -12
  208. package/codeyam-cli/src/webserver/server.js.map +1 -1
  209. package/codeyam-cli/src/webserver/terminalServer.js +65 -112
  210. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  211. package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
  212. package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
  213. package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
  214. package/codeyam-cli/templates/chrome-extension-react/package.json +26 -0
  215. package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
  216. package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
  217. package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
  218. package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
  219. package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
  220. package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
  221. package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
  222. package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
  223. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +35 -0
  224. package/codeyam-cli/templates/editor-step-hook.py +95 -9
  225. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +89 -0
  226. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +33 -0
  227. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +12 -0
  228. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +12 -0
  229. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +12 -0
  230. package/codeyam-cli/templates/expo-react-native/app.json +18 -0
  231. package/codeyam-cli/templates/expo-react-native/babel.config.js +9 -0
  232. package/codeyam-cli/templates/expo-react-native/gitignore +12 -0
  233. package/codeyam-cli/templates/expo-react-native/global.css +3 -0
  234. package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
  235. package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
  236. package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
  237. package/codeyam-cli/templates/expo-react-native/package.json +37 -0
  238. package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
  239. package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
  240. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_PATTERNS.md +308 -0
  241. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
  242. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +112 -0
  243. package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
  244. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  245. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +9 -4
  246. package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -0
  247. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +21 -0
  248. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +4 -1
  249. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +4 -1
  250. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +92 -0
  251. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  252. package/codeyam-cli/templates/{nextjs-prisma-sqlite/PRISMA_SETUP.md → nextjs-prisma-supabase/SUPABASE_SETUP.md} +37 -17
  253. package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
  254. package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
  255. package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
  256. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
  257. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
  258. package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
  259. package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
  260. package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
  261. package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
  262. package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
  263. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +36 -0
  264. package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
  265. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
  266. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
  267. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
  268. package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -0
  269. package/codeyam-cli/templates/{codeyam-dev-mode.md → skills/codeyam-dev-mode/SKILL.md} +2 -2
  270. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +145 -0
  271. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  272. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  273. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  274. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  275. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  276. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  277. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  278. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  279. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  280. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  281. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  282. package/package.json +15 -10
  283. package/packages/ai/src/lib/generateExecutionFlows.js +0 -11
  284. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  285. package/packages/analyze/src/lib/ProjectAnalyzer.js +10 -4
  286. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  287. package/packages/analyze/src/lib/asts/index.js +4 -2
  288. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  289. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
  290. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  291. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +20 -0
  292. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  293. package/packages/types/src/enums/ProjectFramework.js +2 -0
  294. package/packages/types/src/enums/ProjectFramework.js.map +1 -1
  295. package/scripts/npm-post-install.cjs +34 -0
  296. package/codeyam-cli/src/webserver/build/client/assets/Terminal-CcG8YTLx.js +0 -41
  297. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-CUXOrorO.js +0 -1
  298. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CMT1jU2q.js +0 -21
  299. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BiM6z3Do.js +0 -1
  300. package/codeyam-cli/src/webserver/build/client/assets/editor-W_IGJ2Kd.js +0 -7
  301. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-D6SEzMCu.js +0 -6
  302. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C28BiQzt.js +0 -6
  303. package/codeyam-cli/src/webserver/build/client/assets/git-CFCTYk9I.js +0 -15
  304. package/codeyam-cli/src/webserver/build/client/assets/globals-BZB_H1w2.css +0 -1
  305. package/codeyam-cli/src/webserver/build/client/assets/manifest-8daa4147.js +0 -1
  306. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-ByhSyh0W.js +0 -1
  307. package/codeyam-cli/src/webserver/build/client/assets/xterm-DMSzMhqy.js +0 -9
  308. package/codeyam-cli/src/webserver/build/server/assets/server-build-OdUocH6P.js +0 -362
  309. package/codeyam-cli/templates/codeyam-editor.md +0 -68
  310. package/scripts/finalize-analyzer.cjs +0 -13
  311. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  312. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  313. /package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -0
  314. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  315. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  316. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  317. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Shared scenario switching logic.
3
+ *
4
+ * Both `/api/dev-mode-preview` (Express, server.ts) and
5
+ * `/api/editor-switch-scenario` (React Router action) need to switch
6
+ * the active scenario. This module consolidates that logic so both
7
+ * code paths handle seed-based scenarios correctly.
8
+ */
9
+ import fs from 'fs';
10
+ import path from 'path';
11
+ import { runSeedAdapter, detectSeedAdapter } from "./editorSeedAdapter.js";
12
+ /**
13
+ * Track in-flight seed operations to deduplicate concurrent requests
14
+ * for the same scenario.
15
+ */
16
+ let activeSeedOperation = null;
17
+ /**
18
+ * Switch the active editor scenario.
19
+ *
20
+ * 1. Resolves the scenario type from the data file if not provided
21
+ * 2. Writes `active-scenario.json` (including `type`)
22
+ * 3. Runs the seed adapter for application/user scenarios
23
+ * 4. Returns the result (caller is responsible for cache invalidation and refresh)
24
+ */
25
+ export async function switchActiveScenario(params) {
26
+ const { scenarioId, projectRoot } = params;
27
+ const codeyamDir = path.join(projectRoot, '.codeyam');
28
+ const scenariosDir = path.join(codeyamDir, 'editor-scenarios');
29
+ // Resolve slug from data file if not provided
30
+ let effectiveSlug = params.scenarioSlug || null;
31
+ if (!effectiveSlug) {
32
+ try {
33
+ const dataFile = path.join(scenariosDir, `${scenarioId}.json`);
34
+ if (fs.existsSync(dataFile)) {
35
+ const data = JSON.parse(fs.readFileSync(dataFile, 'utf-8'));
36
+ effectiveSlug = data.name || scenarioId;
37
+ }
38
+ else {
39
+ effectiveSlug = scenarioId;
40
+ }
41
+ }
42
+ catch {
43
+ effectiveSlug = scenarioId;
44
+ }
45
+ }
46
+ // Resolve type: prefer explicit param, fall back to data file
47
+ let effectiveType = params.scenarioType || null;
48
+ if (!effectiveType) {
49
+ try {
50
+ const dataFile = path.join(scenariosDir, `${scenarioId}.json`);
51
+ if (fs.existsSync(dataFile)) {
52
+ const data = JSON.parse(fs.readFileSync(dataFile, 'utf-8'));
53
+ effectiveType = data.type || null;
54
+ }
55
+ }
56
+ catch {
57
+ // Non-fatal
58
+ }
59
+ }
60
+ // Write active-scenario.json — MUST include type so proxy is type-aware
61
+ const activeScenarioPath = path.join(codeyamDir, 'active-scenario.json');
62
+ fs.mkdirSync(codeyamDir, { recursive: true });
63
+ fs.writeFileSync(activeScenarioPath, JSON.stringify({
64
+ scenarioSlug: effectiveSlug,
65
+ scenarioName: params.scenarioName || effectiveSlug,
66
+ scenarioId,
67
+ type: effectiveType,
68
+ dataFile: `.codeyam/editor-scenarios/${scenarioId}.json`,
69
+ switchedAt: new Date().toISOString(),
70
+ }, null, 2));
71
+ // Run seed adapter for application/user scenarios
72
+ let seedResult = null;
73
+ const isSeedScenario = effectiveType === 'application' || effectiveType === 'user';
74
+ if (isSeedScenario) {
75
+ // Deduplicate concurrent seed requests for the same scenario
76
+ if (activeSeedOperation && activeSeedOperation.scenarioId === scenarioId) {
77
+ seedResult = await activeSeedOperation.promise;
78
+ }
79
+ else {
80
+ const adapterPath = detectSeedAdapter(projectRoot);
81
+ const seedDataPath = path.join(scenariosDir, `${scenarioId}.seed.json`);
82
+ if (adapterPath && fs.existsSync(seedDataPath)) {
83
+ const seedPromise = runSeedAdapter(adapterPath, seedDataPath).then((result) => ({
84
+ success: result.success,
85
+ error: result.error,
86
+ }));
87
+ activeSeedOperation = { scenarioId, promise: seedPromise };
88
+ try {
89
+ seedResult = await seedPromise;
90
+ }
91
+ finally {
92
+ if (activeSeedOperation &&
93
+ activeSeedOperation.scenarioId === scenarioId) {
94
+ activeSeedOperation = null;
95
+ }
96
+ }
97
+ }
98
+ else if (!adapterPath) {
99
+ seedResult = { success: false, error: 'No seed adapter found' };
100
+ }
101
+ }
102
+ }
103
+ return {
104
+ success: true,
105
+ scenarioSlug: effectiveSlug,
106
+ scenarioId,
107
+ type: effectiveType,
108
+ seeded: isSeedScenario,
109
+ ...(seedResult ? { seedResult } : {}),
110
+ };
111
+ }
112
+ //# sourceMappingURL=editorScenarioSwitch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorScenarioSwitch.js","sourceRoot":"","sources":["../../../../src/utils/editorScenarioSwitch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAmBxE;;;GAGG;AACH,IAAI,mBAAmB,GAGZ,IAAI,CAAC;AAEhB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA4B;IAE5B,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;IAE/D,8CAA8C;IAC9C,IAAI,aAAa,GAAG,MAAM,CAAC,YAAY,IAAI,IAAI,CAAC;IAChD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;YAC/D,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,aAAa,GAAG,IAAI,CAAC,IAAI,IAAI,UAAU,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,aAAa,GAAG,UAAU,CAAC;YAC7B,C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,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Shared scenario utilities used across editor routes and components.
3
+ *
4
+ * Extracted from inline logic in editor.tsx, api.editor-journal-entry.ts,
5
+ * and api.editor-register-scenario.ts.
6
+ */
7
+ import fs from 'fs';
8
+ import path from 'path';
9
+ /**
10
+ * Generic Map-based deduplication that keeps the last item for each key.
11
+ * Items are iterated in order, so later entries overwrite earlier ones.
12
+ * Map preserves insertion order of first appearance.
13
+ */
14
+ export function deduplicateByName(items, keyFn) {
15
+ const byKey = new Map();
16
+ for (const item of items) {
17
+ byKey.set(keyFn(item), item);
18
+ }
19
+ return [...byKey.values()];
20
+ }
21
+ /**
22
+ * Convert a scenario name to a URL-safe slug.
23
+ * Replaces any run of non-alphanumeric, non-underscore characters with a single underscore.
24
+ */
25
+ export function generateScenarioSlug(name) {
26
+ return name.replace(/[^a-zA-Z0-9_]+/g, '_');
27
+ }
28
+ /**
29
+ * Convert an ISO 8601 timestamp (e.g. "2026-02-28T19:00:00.000Z") to
30
+ * SQLite-compatible format (e.g. "2026-02-28 19:00:00").
31
+ *
32
+ * SQLite's CURRENT_TIMESTAMP uses space-separated "YYYY-MM-DD HH:MM:SS" format,
33
+ * so we need this conversion for date comparisons.
34
+ */
35
+ export function convertIsoToSqliteTimestamp(iso) {
36
+ return iso.replace('T', ' ').replace(/\.\d{3}Z$/, '');
37
+ }
38
+ /**
39
+ * Resolve which URL to use for Playwright screenshot capture.
40
+ *
41
+ * Priority:
42
+ * 1. Path-based URL + proxy → combine (component isolation with API interception)
43
+ * 2. Full URL → use directly (legacy)
44
+ * 3. No URL → proxy root or dev server root (page scenarios)
45
+ */
46
+ /**
47
+ * Resolve the navigation path for preview refresh.
48
+ * Priority: explicit path > scenario URL from DB > undefined (plain refresh).
49
+ */
50
+ export function resolvePreviewNavPath(explicitPath, scenarioUrl) {
51
+ if (explicitPath)
52
+ return explicitPath;
53
+ if (scenarioUrl)
54
+ return scenarioUrl;
55
+ return undefined;
56
+ }
57
+ /**
58
+ * Clear the editor step state file (for starting a new feature).
59
+ * This should NOT touch the user prompt file — the prompt is captured
60
+ * by the hook before step 1 runs, so deleting it here would lose it.
61
+ */
62
+ export function clearEditorState(root) {
63
+ const statePath = path.join(root, '.codeyam', 'editor-step.json');
64
+ try {
65
+ fs.unlinkSync(statePath);
66
+ }
67
+ catch {
68
+ // File doesn't exist, that's fine
69
+ }
70
+ }
71
+ /**
72
+ * Clear the user prompt file so the hook can capture the next feature request.
73
+ * Call this after a feature is committed, not during step 1.
74
+ */
75
+ export function clearEditorUserPrompt(root) {
76
+ const promptPath = path.join(root, '.codeyam', 'editor-user-prompt.txt');
77
+ try {
78
+ fs.unlinkSync(promptPath);
79
+ }
80
+ catch {
81
+ // File doesn't exist, that's fine
82
+ }
83
+ }
84
+ export function determineCaptureUrl(url, proxyUrl, devServerUrl) {
85
+ const isPath = url && url.startsWith('/');
86
+ if (isPath && proxyUrl) {
87
+ return `${proxyUrl}${url}`;
88
+ }
89
+ else if (url && !isPath) {
90
+ return url;
91
+ }
92
+ else {
93
+ return proxyUrl || devServerUrl || null;
94
+ }
95
+ }
96
+ //# sourceMappingURL=editorScenarios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorScenarios.js","sourceRoot":"","sources":["../../../../src/utils/editorScenarios.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAU,EACV,KAA0B;IAE1B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAa,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IACD,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AAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1C,IAAI,MAAM,IAAI,QAAQ,EAAE,CAAC;QACvB,OAAO,GAAG,QAAQ,GAAG,GAAG,EAAE,CAAC;IAC7B,CAAC;SAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACb,CAAC;SAAM,CAAC;QACN,OAAO,QAAQ,IAAI,YAAY,IAAI,IAAI,CAAC;IAC1C,CAAC;AACH,CAAC"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Seed adapter runner for application/user scenarios.
3
+ *
4
+ * Runs the project's seed-adapter script to wipe and re-seed
5
+ * the dev database with scenario-specific data.
6
+ */
7
+ import { spawn } from 'child_process';
8
+ import * as fs from 'fs';
9
+ import * as path from 'path';
10
+ const DEFAULT_TIMEOUT_MS = 30000;
11
+ /**
12
+ * Run a seed adapter script, passing the seed data JSON file path as the first CLI arg.
13
+ *
14
+ * For .ts files, runs via `npx tsx`. For other files, runs directly.
15
+ * The cwd defaults to the project root (parent of `.codeyam/`) so the adapter
16
+ * can access node_modules, prisma/, etc.
17
+ */
18
+ export function runSeedAdapter(scriptPath, seedDataPath, options) {
19
+ const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
20
+ // Default cwd: go up from .codeyam/ to project root
21
+ const cwd = options?.cwd ??
22
+ (path.basename(path.dirname(scriptPath)) === '.codeyam'
23
+ ? path.dirname(path.dirname(scriptPath))
24
+ : path.dirname(scriptPath));
25
+ return new Promise((resolve) => {
26
+ const start = Date.now();
27
+ const isTsFile = scriptPath.endsWith('.ts');
28
+ const command = isTsFile ? 'npx' : scriptPath;
29
+ const args = isTsFile ? ['tsx', scriptPath, seedDataPath] : [seedDataPath];
30
+ const child = spawn(command, args, {
31
+ cwd,
32
+ env: { ...process.env },
33
+ });
34
+ let stdout = '';
35
+ let stderr = '';
36
+ let killed = false;
37
+ const timer = setTimeout(() => {
38
+ killed = true;
39
+ child.kill('SIGTERM');
40
+ }, timeoutMs);
41
+ child.stdout.on('data', (data) => {
42
+ stdout += data.toString();
43
+ });
44
+ child.stderr.on('data', (data) => {
45
+ stderr += data.toString();
46
+ });
47
+ child.on('close', (code) => {
48
+ clearTimeout(timer);
49
+ const durationMs = Date.now() - start;
50
+ if (killed) {
51
+ resolve({
52
+ success: false,
53
+ output: stdout,
54
+ error: `Seed adapter timeout after ${timeoutMs}ms`,
55
+ durationMs,
56
+ });
57
+ }
58
+ else if (code === 0) {
59
+ resolve({ success: true, output: stdout, durationMs });
60
+ }
61
+ else {
62
+ resolve({
63
+ success: false,
64
+ output: stdout,
65
+ error: stderr || `Seed adapter exited with code ${code}`,
66
+ durationMs,
67
+ });
68
+ }
69
+ });
70
+ child.on('error', (err) => {
71
+ clearTimeout(timer);
72
+ resolve({
73
+ success: false,
74
+ output: '',
75
+ error: err.message,
76
+ durationMs: Date.now() - start,
77
+ });
78
+ });
79
+ });
80
+ }
81
+ /**
82
+ * Extract just the seed data from a scenario JSON file and write it to a
83
+ * temporary file. The adapter receives clean seed data ({drinks: [...]})
84
+ * without the CodeYam envelope ({type, seed, externalApis}).
85
+ *
86
+ * Returns the path to the temp file (caller should clean up after use).
87
+ */
88
+ export function prepareSeedDataFile(scenarioFilePath) {
89
+ try {
90
+ const raw = fs.readFileSync(scenarioFilePath, 'utf-8');
91
+ const data = JSON.parse(raw);
92
+ // Extract seed data from envelope, or use as-is if no envelope
93
+ const seedData = data.seed || data;
94
+ const tempPath = scenarioFilePath.replace(/\.json$/, '.seed.json');
95
+ fs.writeFileSync(tempPath, JSON.stringify(seedData, null, 2));
96
+ return tempPath;
97
+ }
98
+ catch {
99
+ return null;
100
+ }
101
+ }
102
+ /**
103
+ * Clean up a temporary seed data file created by prepareSeedDataFile.
104
+ */
105
+ export function cleanupSeedDataFile(tempPath) {
106
+ try {
107
+ if (fs.existsSync(tempPath)) {
108
+ fs.unlinkSync(tempPath);
109
+ }
110
+ }
111
+ catch {
112
+ // Best effort
113
+ }
114
+ }
115
+ /**
116
+ * Detect a seed adapter script in the project's .codeyam directory.
117
+ * Returns the absolute path if found, null otherwise.
118
+ */
119
+ export function detectSeedAdapter(projectRoot) {
120
+ const candidates = ['seed-adapter.ts', 'seed-adapter.js'];
121
+ for (const filename of candidates) {
122
+ const fullPath = path.join(projectRoot, '.codeyam', filename);
123
+ try {
124
+ fs.accessSync(fullPath);
125
+ return fullPath;
126
+ }
127
+ catch {
128
+ // Try next
129
+ }
130
+ }
131
+ return null;
132
+ }
133
+ /**
134
+ * Validate that seed data has the expected structure:
135
+ * a non-empty object where every value is an array of objects (table rows).
136
+ */
137
+ export function validateSeedData(data) {
138
+ const errors = [];
139
+ const keys = Object.keys(data);
140
+ if (keys.length === 0) {
141
+ errors.push('Seed data must contain at least one table');
142
+ return { valid: false, errors };
143
+ }
144
+ for (const key of keys) {
145
+ const value = data[key];
146
+ if (!Array.isArray(value)) {
147
+ errors.push(`"${key}" must be an array of objects, got ${typeof value}`);
148
+ continue;
149
+ }
150
+ for (let i = 0; i < value.length; i++) {
151
+ if (typeof value[i] !== 'object' || value[i] === null) {
152
+ errors.push(`"${key}[${i}]" must be an object, got ${typeof value[i]}`);
153
+ }
154
+ }
155
+ }
156
+ return { valid: errors.length === 0, errors };
157
+ }
158
+ /**
159
+ * Merge base scenario seed data with an overlay (user scenario).
160
+ * Overlay tables replace base tables entirely (no row-level merge).
161
+ * Does not mutate inputs.
162
+ */
163
+ export function mergeSeedData(base, overlay) {
164
+ const result = {};
165
+ for (const [key, value] of Object.entries(base)) {
166
+ result[key] = JSON.parse(JSON.stringify(value));
167
+ }
168
+ for (const [key, value] of Object.entries(overlay)) {
169
+ result[key] = JSON.parse(JSON.stringify(value));
170
+ }
171
+ return result;
172
+ }
173
+ //# sourceMappingURL=editorSeedAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorSeedAdapter.js","sourceRoot":"","sources":["../../../../src/utils/editorSeedAdapter.ts"],"names":[],"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