@codeyam/codeyam-cli 0.1.0-staging.8b51541 → 0.1.0-staging.8c89b23

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 (452) 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 +6 -6
  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 +7 -7
  24. package/analyzer-template/packages/database/package.json +3 -3
  25. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +42 -16
  26. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
  27. package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
  28. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +3 -1
  29. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
  30. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
  31. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  32. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  33. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +7 -1
  34. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  35. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
  36. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
  37. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
  38. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
  39. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
  40. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  41. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
  42. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  43. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
  44. package/analyzer-template/project/analyzeFileEntities.ts +26 -0
  45. package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
  46. package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
  47. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  48. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
  49. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  50. package/codeyam-cli/src/cli.js +24 -0
  51. package/codeyam-cli/src/cli.js.map +1 -1
  52. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
  53. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
  54. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
  55. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
  56. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
  57. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
  58. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
  59. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
  60. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js +55 -0
  61. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js.map +1 -0
  62. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +20 -9
  63. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -1
  64. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +39 -3
  65. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  66. package/codeyam-cli/src/commands/editor.js +3489 -553
  67. package/codeyam-cli/src/commands/editor.js.map +1 -1
  68. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
  69. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
  70. package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
  71. package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
  72. package/codeyam-cli/src/commands/init.js +21 -0
  73. package/codeyam-cli/src/commands/init.js.map +1 -1
  74. package/codeyam-cli/src/commands/telemetry.js +37 -0
  75. package/codeyam-cli/src/commands/telemetry.js.map +1 -0
  76. package/codeyam-cli/src/data/designSystems.js +27 -0
  77. package/codeyam-cli/src/data/designSystems.js.map +1 -0
  78. package/codeyam-cli/src/data/techStacks.js +1 -1
  79. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +44 -0
  80. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
  81. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +3174 -1
  82. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  83. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  84. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  85. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
  86. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
  87. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
  88. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
  89. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +76 -3
  90. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
  91. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +381 -0
  92. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  93. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
  94. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
  95. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +75 -1
  96. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
  97. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
  98. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  99. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +11 -3
  100. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
  101. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +98 -1
  102. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
  103. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js +941 -0
  104. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js.map +1 -0
  105. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +190 -0
  106. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
  107. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +726 -17
  108. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  109. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +201 -1
  110. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
  111. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
  112. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
  113. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  114. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  115. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  116. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  117. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +333 -11
  118. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  119. package/codeyam-cli/src/utils/__tests__/envFile.test.js +125 -0
  120. package/codeyam-cli/src/utils/__tests__/envFile.test.js.map +1 -0
  121. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
  122. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
  123. package/codeyam-cli/src/utils/__tests__/handoffContext.test.js +500 -0
  124. package/codeyam-cli/src/utils/__tests__/handoffContext.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__/registerScenarioResult.test.js +127 -0
  130. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
  131. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  132. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  133. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +57 -0
  134. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -1
  135. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +220 -2
  136. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
  137. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
  138. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
  139. package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
  140. package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
  141. package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
  142. package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
  143. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +6 -0
  144. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -1
  145. package/codeyam-cli/src/utils/analysisRunner.js +39 -8
  146. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  147. package/codeyam-cli/src/utils/analyzer.js +11 -1
  148. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  149. package/codeyam-cli/src/utils/backgroundServer.js +1 -1
  150. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  151. package/codeyam-cli/src/utils/designSystemShowcase.js +810 -0
  152. package/codeyam-cli/src/utils/designSystemShowcase.js.map +1 -0
  153. package/codeyam-cli/src/utils/editorApi.js +16 -0
  154. package/codeyam-cli/src/utils/editorApi.js.map +1 -1
  155. package/codeyam-cli/src/utils/editorAudit.js +649 -10
  156. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  157. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  158. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  159. package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
  160. package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
  161. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
  162. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
  163. package/codeyam-cli/src/utils/editorEntityHelpers.js +144 -0
  164. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  165. package/codeyam-cli/src/utils/editorGuard.js +36 -0
  166. package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
  167. package/codeyam-cli/src/utils/editorLoaderHelpers.js +40 -1
  168. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
  169. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  170. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  171. package/codeyam-cli/src/utils/editorPreview.js +5 -3
  172. package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
  173. package/codeyam-cli/src/utils/editorRecapture.js +109 -0
  174. package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
  175. package/codeyam-cli/src/utils/editorRoadmap.js +530 -0
  176. package/codeyam-cli/src/utils/editorRoadmap.js.map +1 -0
  177. package/codeyam-cli/src/utils/editorScenarioSwitch.js +39 -2
  178. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
  179. package/codeyam-cli/src/utils/editorScenarios.js +307 -7
  180. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  181. package/codeyam-cli/src/utils/editorSeedAdapter.js +308 -6
  182. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
  183. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  184. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  185. package/codeyam-cli/src/utils/entityChangeStatus.js +50 -5
  186. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  187. package/codeyam-cli/src/utils/entityChangeStatus.server.js +38 -3
  188. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
  189. package/codeyam-cli/src/utils/envFile.js +90 -0
  190. package/codeyam-cli/src/utils/envFile.js.map +1 -0
  191. package/codeyam-cli/src/utils/fileWatcher.js +38 -0
  192. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  193. package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
  194. package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
  195. package/codeyam-cli/src/utils/handoffContext.js +257 -0
  196. package/codeyam-cli/src/utils/handoffContext.js.map +1 -0
  197. package/codeyam-cli/src/utils/install-skills.js +50 -6
  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/queue/__tests__/job.interactiveStart.test.js +159 -0
  202. package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
  203. package/codeyam-cli/src/utils/queue/job.js +35 -6
  204. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  205. package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
  206. package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
  207. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  208. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  209. package/codeyam-cli/src/utils/scenarioCoverage.js +12 -10
  210. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -1
  211. package/codeyam-cli/src/utils/scenariosManifest.js +84 -12
  212. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
  213. package/codeyam-cli/src/utils/screenshotHash.js +26 -0
  214. package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
  215. package/codeyam-cli/src/utils/simulationGateMiddleware.js +9 -0
  216. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
  217. package/codeyam-cli/src/utils/telemetry.js +106 -0
  218. package/codeyam-cli/src/utils/telemetry.js.map +1 -0
  219. package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
  220. package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
  221. package/codeyam-cli/src/utils/testResultCache.js +53 -0
  222. package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
  223. package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
  224. package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
  225. package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
  226. package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
  227. package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
  228. package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
  229. package/codeyam-cli/src/utils/testRunner.js +193 -1
  230. package/codeyam-cli/src/utils/testRunner.js.map +1 -1
  231. package/codeyam-cli/src/utils/webappDetection.js +4 -2
  232. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  233. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +99 -0
  234. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
  235. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
  236. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
  237. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +68 -1
  238. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -1
  239. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +203 -8
  240. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  241. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +190 -21
  242. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -1
  243. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
  244. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
  245. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +22 -1
  246. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -1
  247. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  248. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
  249. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
  250. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  251. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  252. package/codeyam-cli/src/webserver/backgroundServer.js +60 -61
  253. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  254. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-DTBZZfSk.js +1 -0
  255. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-BxclONWq.js} +3 -3
  256. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  257. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-BsnEOJZ_.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-ByaELMbv.js +1 -0
  259. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-6WjVfhxX.js +25 -0
  260. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-ChX-Hp7W.js +3 -0
  261. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
  262. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-C-9zQdXg.js} +3 -3
  263. package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-Bs2_Oua4.js +36 -0
  264. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-DQsceHVv.js} +2 -2
  265. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DThcm_9M.js +1 -0
  266. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-TSD3C211.js → ScenarioViewer-Cl4oOA3A.js} +3 -3
  267. package/codeyam-cli/src/webserver/build/client/assets/Spinner-CIil5-gb.js +34 -0
  268. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  269. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-BqkA9zyZ.js +1 -0
  270. package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-DnOgyseQ.js} +2 -2
  271. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-DqM9hbNE.js} +3 -3
  272. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-C58dYPwR.js} +1 -1
  273. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-B8NCeOrm.js} +3 -3
  274. package/codeyam-cli/src/webserver/build/client/assets/api.editor-github-verify-l0sNRNKZ.js +1 -0
  275. package/codeyam-cli/src/webserver/build/client/assets/api.editor-handoff-l0sNRNKZ.js +1 -0
  276. package/codeyam-cli/src/webserver/build/client/assets/api.editor-hosting-verify-l0sNRNKZ.js +1 -0
  277. package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
  278. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  279. package/codeyam-cli/src/webserver/build/client/assets/api.editor-roadmap-l0sNRNKZ.js +1 -0
  280. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
  281. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  282. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  283. package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
  284. package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
  285. package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
  286. package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-BFSIqZgO.js} +1 -1
  287. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-B9fDzFVh.js} +1 -1
  288. package/codeyam-cli/src/webserver/build/client/assets/chunk-UVKPFVEO-Bmq2apuh.js +43 -0
  289. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-DLPObLUx.js} +1 -1
  290. package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-DXEmO0TD.js} +1 -1
  291. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-BwyFiRot.js} +1 -1
  292. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
  293. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
  294. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-iRhRIFlp.js +1 -0
  295. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-BZPBzV73.js +1 -0
  296. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-D4cIaQC3.js +161 -0
  297. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-C6fEYHrh.js +41 -0
  298. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-DwCV5__E.js → entity._sha._-pc-vc6wO.js} +13 -12
  299. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-C8AyYgYT.js +6 -0
  300. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DziaVQX1.js +6 -0
  301. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BTcpgIpC.js +6 -0
  302. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-D_O_ajfZ.js} +2 -2
  303. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-j1Vi0bco.js} +6 -6
  304. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  305. package/codeyam-cli/src/webserver/build/client/assets/files-kuny2Q_s.js +1 -0
  306. package/codeyam-cli/src/webserver/build/client/assets/git-DgCZPMie.js +1 -0
  307. package/codeyam-cli/src/webserver/build/client/assets/globals-D4iGjX2m.css +1 -0
  308. package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-BliGSSpl.js} +1 -1
  309. package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-SqjQKTdH.js} +1 -1
  310. package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-vyrZD2g4.js} +1 -1
  311. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  312. package/codeyam-cli/src/webserver/build/client/assets/labs-c3yLxSEp.js +1 -0
  313. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-D-q28GLF.js} +1 -1
  314. package/codeyam-cli/src/webserver/build/client/assets/manifest-985e63d6.js +1 -0
  315. package/codeyam-cli/src/webserver/build/client/assets/{memory-9gnxSZlb.js → memory-CEWIUC4t.js} +2 -2
  316. package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-BP6fitdh.js} +1 -1
  317. package/codeyam-cli/src/webserver/build/client/assets/root-BRyJWJBA.js +80 -0
  318. package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-BooqacKS.js} +1 -1
  319. package/codeyam-cli/src/webserver/build/client/assets/settings-BM0nbryO.js +1 -0
  320. package/codeyam-cli/src/webserver/build/client/assets/simulations-ovy6FjRY.js +1 -0
  321. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-DHemCJIs.js} +1 -1
  322. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-D87ekDl8.js} +1 -1
  323. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-Dk0Tciqg.js +1 -0
  324. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C8QvIe05.js +2 -0
  325. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-jkCytuYz.js +1 -0
  326. package/codeyam-cli/src/webserver/build/client/assets/useToast-BgqkixU9.js +1 -0
  327. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-RX_oAulJ.js +16 -0
  328. package/codeyam-cli/src/webserver/build/server/assets/{index-DsZjKspK.js → index-DRb-tJ77.js} +1 -1
  329. package/codeyam-cli/src/webserver/build/server/assets/init-CzFOE1qs.js +14 -0
  330. package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
  331. package/codeyam-cli/src/webserver/build/server/assets/server-build-CPKq4t0v.js +765 -0
  332. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  333. package/codeyam-cli/src/webserver/build-info.json +5 -5
  334. package/codeyam-cli/src/webserver/editorProxy.js +244 -20
  335. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  336. package/codeyam-cli/src/webserver/idleDetector.js +65 -8
  337. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -1
  338. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  339. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  340. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +53 -0
  341. package/codeyam-cli/src/webserver/server.js +160 -14
  342. package/codeyam-cli/src/webserver/server.js.map +1 -1
  343. package/codeyam-cli/src/webserver/terminalServer.js +248 -28
  344. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  345. package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
  346. package/codeyam-cli/templates/codeyam-editor-claude.md +2 -0
  347. package/codeyam-cli/templates/codeyam-editor-codex.md +61 -0
  348. package/codeyam-cli/templates/codeyam-editor-gemini.md +59 -0
  349. package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
  350. package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
  351. package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
  352. package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
  353. package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
  354. package/codeyam-cli/templates/editor-step-hook.py +191 -60
  355. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +204 -5
  356. package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
  357. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +6 -3
  358. package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
  359. package/codeyam-cli/templates/expo-react-native/app.json +11 -0
  360. package/codeyam-cli/templates/expo-react-native/babel.config.js +1 -0
  361. package/codeyam-cli/templates/expo-react-native/gitignore +2 -0
  362. package/codeyam-cli/templates/expo-react-native/global.css +7 -0
  363. package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
  364. package/codeyam-cli/templates/expo-react-native/package.json +32 -16
  365. package/codeyam-cli/templates/expo-react-native/patches/expo-modules-autolinking+3.0.24.patch +29 -0
  366. package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
  367. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +1 -0
  368. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +1 -1
  369. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +88 -40
  370. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +1 -1
  371. package/codeyam-cli/templates/seed-adapters/supabase.ts +363 -0
  372. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +96 -1
  373. package/package.json +2 -1
  374. package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
  375. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  376. package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
  377. package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
  378. package/packages/ai/src/lib/astScopes/paths.js +12 -3
  379. package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
  380. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
  381. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  382. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
  383. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
  384. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
  385. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  386. package/packages/analyze/index.js +1 -1
  387. package/packages/analyze/index.js.map +1 -1
  388. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
  389. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  390. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
  391. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  392. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
  393. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  394. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
  395. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  396. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
  397. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
  398. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
  399. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  400. package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
  401. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  402. package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
  403. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  404. package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
  405. package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
  406. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
  407. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  408. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
  409. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  410. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +44 -16
  411. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  412. package/packages/database/src/lib/loadAnalysis.js +7 -1
  413. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  414. package/packages/database/src/lib/loadEntity.js +5 -5
  415. package/packages/database/src/lib/loadEntity.js.map +1 -1
  416. package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
  417. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  418. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
  419. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
  420. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
  421. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
  422. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
  423. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
  424. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
  425. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
  426. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
  427. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-C4pqxYJB.js +0 -51
  428. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
  429. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Ii3inc0_.js +0 -1
  430. package/codeyam-cli/src/webserver/build/client/assets/editor-16o0AIFV.js +0 -15
  431. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-7Uga8I59.js +0 -41
  432. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-BwKcai0j.js +0 -6
  433. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CHMiAog3.js +0 -6
  434. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
  435. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
  436. package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
  437. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
  438. package/codeyam-cli/src/webserver/build/client/assets/globals-CQPR0pFR.css +0 -1
  439. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
  440. package/codeyam-cli/src/webserver/build/client/assets/manifest-76e7b62c.js +0 -1
  441. package/codeyam-cli/src/webserver/build/client/assets/root-DBjt6o04.js +0 -67
  442. package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
  443. package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
  444. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C-_hOl_g.js +0 -1
  445. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +0 -2
  446. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
  447. package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
  448. package/codeyam-cli/src/webserver/build/server/assets/init-DdqKD2p4.js +0 -10
  449. package/codeyam-cli/src/webserver/build/server/assets/server-build-CKKeWtVK.js +0 -444
  450. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +0 -33
  451. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +0 -12
  452. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +0 -12
@@ -0,0 +1,363 @@
1
+ /**
2
+ * CodeYam Seed Adapter for Supabase.
3
+ *
4
+ * Seeds the database and optionally signs in a user for authenticated scenarios.
5
+ *
6
+ * Usage: npx tsx .codeyam/seed-adapter.ts <path-to-seed-data.json>
7
+ *
8
+ * Input JSON format:
9
+ * {
10
+ * "tableName": [{ "column": "value", ... }, ...],
11
+ * "_auth": { // optional
12
+ * "email": "alice@example.com",
13
+ * "password": "test123" // optional — default used if omitted
14
+ * }
15
+ * }
16
+ *
17
+ * When _auth is present, the adapter:
18
+ * 1. Creates the user if they don't exist (auto-confirms email)
19
+ * 2. Builds a synthetic JWT with far-future expiry (no real sign-in needed)
20
+ * 3. Writes session cookies + auth mocks to .codeyam/tmp/seed-session.json
21
+ * so the CodeYam proxy can inject them into the browser
22
+ *
23
+ * The password field is optional — if omitted, a default dev password is used.
24
+ * No real JWTs are stored; the preload module intercepts all auth API calls.
25
+ *
26
+ * Requirements:
27
+ * - A Supabase project URL (https://<ref>.supabase.co) in any env var
28
+ * - A secret key (sb_secret_... or legacy eyJ... service_role JWT) in any env var
29
+ *
30
+ * The adapter scans ALL env vars by value pattern — no specific naming required.
31
+ */
32
+
33
+ import { createClient } from '@supabase/supabase-js';
34
+ import { Prisma } from '@prisma/client';
35
+ import * as fs from 'fs';
36
+ import * as path from 'path';
37
+
38
+ /**
39
+ * Scan all env vars for values matching a pattern.
40
+ * Returns ALL unique matches (not just the first) so callers can disambiguate.
41
+ */
42
+ function findAllEnvByPattern(pattern: RegExp): string[] {
43
+ const matches = new Set<string>();
44
+ for (const value of Object.values(process.env)) {
45
+ if (value && pattern.test(value)) matches.add(value);
46
+ }
47
+ return [...matches];
48
+ }
49
+
50
+ /**
51
+ * For legacy Supabase JWTs, decode the payload to check the `role` claim.
52
+ * Returns the role string ("service_role", "anon", etc.) or undefined.
53
+ */
54
+ function getJwtRole(jwt: string): string | undefined {
55
+ try {
56
+ const payload = jwt.split('.')[1];
57
+ const decoded = JSON.parse(Buffer.from(payload, 'base64url').toString());
58
+ return decoded.role;
59
+ } catch {
60
+ return undefined;
61
+ }
62
+ }
63
+
64
+ // Detect Supabase credentials by value pattern, not env var name.
65
+ // This works regardless of what the user named their env vars.
66
+ const supabaseUrl = findAllEnvByPattern(
67
+ /^https:\/\/[a-z0-9]+\.supabase\.co\b/,
68
+ )[0];
69
+
70
+ // New-format keys are unambiguous by prefix
71
+ const newSecretKey = findAllEnvByPattern(/^sb_secret_/)[0];
72
+
73
+ // Legacy JWT keys — disambiguate by decoding the role claim
74
+ const legacyJwts = findAllEnvByPattern(
75
+ /^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/,
76
+ );
77
+ const legacyServiceRole = legacyJwts.find(
78
+ (jwt) => getJwtRole(jwt) === 'service_role',
79
+ );
80
+
81
+ const secretKey = newSecretKey || legacyServiceRole;
82
+
83
+ if (!supabaseUrl || !secretKey) {
84
+ console.error(
85
+ 'Could not find Supabase credentials in environment variables.',
86
+ );
87
+ console.error(
88
+ 'Looking for: a URL matching https://<ref>.supabase.co and a key starting with sb_secret_ (or a service_role JWT)',
89
+ );
90
+ console.error(
91
+ 'Add them to .env.local — the seed adapter scans all env vars by value pattern.',
92
+ );
93
+ process.exit(1);
94
+ }
95
+
96
+ // Admin client for user management (uses secret key to bypass RLS)
97
+ const supabase = createClient(supabaseUrl, secretKey, {
98
+ auth: { autoRefreshToken: false, persistSession: false },
99
+ });
100
+
101
+ // Derive the project ref from the URL for cookie naming
102
+ // e.g. "https://abcdefgh.supabase.co" → "abcdefgh"
103
+ function getProjectRef(): string {
104
+ try {
105
+ const hostname = new URL(supabaseUrl!).hostname;
106
+ return hostname.split('.')[0];
107
+ } catch {
108
+ return 'unknown';
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Build a mapping from lowercased seed-data keys to actual PostgreSQL table names.
114
+ * Prisma creates tables with the model name (PascalCase) unless @@map is used.
115
+ * PostgREST requires the exact table name, so we need this translation.
116
+ */
117
+ function buildTableNameMap(): Record<string, string> {
118
+ const map: Record<string, string> = {};
119
+ for (const model of Prisma.dmmf.datamodel.models) {
120
+ // dbName is set when @@map is used, otherwise null → use model name
121
+ const dbName = (model as any).dbName || model.name;
122
+ // Map lowercased model name → actual table name
123
+ const lowered = model.name.charAt(0).toLowerCase() + model.name.slice(1);
124
+ map[lowered] = dbName;
125
+ map[model.name] = dbName; // Also map PascalCase for safety
126
+ }
127
+ return map;
128
+ }
129
+
130
+ async function seedTables(seed: Record<string, unknown[]>) {
131
+ if (Object.keys(seed).length === 0) return;
132
+
133
+ const tableMap = buildTableNameMap();
134
+
135
+ // Discover ALL models from the Prisma schema — not just the tables in the seed data.
136
+ // This ensures FK-dependent tables are cleared even when the seed only contains
137
+ // the parent table's data. Every editor project has Prisma installed.
138
+ const allTables = Prisma.dmmf.datamodel.models.map(
139
+ (m) => (m as any).dbName || m.name,
140
+ );
141
+
142
+ console.log(
143
+ `Clearing ${allTables.length} tables, seeding: ${Object.keys(seed).join(', ')}`,
144
+ );
145
+
146
+ // Clear ALL tables in reverse order (children before parents for FK safety)
147
+ for (const table of [...allTables].reverse()) {
148
+ const { error } = await supabase.from(table).delete().gte('id', 0);
149
+ if (error) {
150
+ const { error: error2 } = await supabase
151
+ .from(table)
152
+ .delete()
153
+ .not('id', 'is', null);
154
+ if (error2) {
155
+ console.warn(` Could not clear ${table}: ${error2.message}`);
156
+ } else {
157
+ console.log(` Cleared ${table}`);
158
+ }
159
+ } else {
160
+ console.log(` Cleared ${table}`);
161
+ }
162
+ }
163
+
164
+ // Insert seed data — translate seed keys to actual table names
165
+ for (const [seedKey, rows] of Object.entries(seed)) {
166
+ if (!Array.isArray(rows) || rows.length === 0) continue;
167
+ const table = tableMap[seedKey] || seedKey;
168
+ const { error } = await supabase.from(table).insert(rows);
169
+ if (error) {
170
+ console.error(` Failed to seed ${table}: ${error.message}`);
171
+ process.exit(1);
172
+ }
173
+ console.log(` Seeded ${rows.length} rows into ${table}`);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Build a minimal JWT with a far-future expiry.
179
+ * The signature is fake — it doesn't matter because the CodeYam preload module
180
+ * intercepts the Supabase auth validation endpoint and returns mock data.
181
+ */
182
+ function buildFakeJwt(userId: string, email: string): string {
183
+ const header = { alg: 'HS256', typ: 'JWT' };
184
+ const payload = {
185
+ sub: userId,
186
+ email,
187
+ role: 'authenticated',
188
+ aud: 'authenticated',
189
+ exp: 9999999999,
190
+ iat: Math.floor(Date.now() / 1000),
191
+ };
192
+ const encode = (obj: object) =>
193
+ Buffer.from(JSON.stringify(obj)).toString('base64url');
194
+ return `${encode(header)}.${encode(payload)}.codeyam-mock-signature`;
195
+ }
196
+
197
+ /**
198
+ * Build a Supabase user response object matching the /auth/v1/user endpoint format.
199
+ */
200
+ function buildUserResponse(user: { id: string; email?: string }) {
201
+ return {
202
+ id: user.id,
203
+ aud: 'authenticated',
204
+ role: 'authenticated',
205
+ email: user.email || '',
206
+ email_confirmed_at: new Date().toISOString(),
207
+ app_metadata: { provider: 'email', providers: ['email'] },
208
+ user_metadata: {},
209
+ created_at: new Date().toISOString(),
210
+ };
211
+ }
212
+
213
+ const DEFAULT_AUTH_PASSWORD = 'codeyam-dev-password-123!';
214
+
215
+ /**
216
+ * Handle auth: create user, build synthetic session, write session cookies.
217
+ * Returns the user ID so callers can replace __AUTH_USER_ID__ placeholders in seed data.
218
+ *
219
+ * No real sign-in is performed — the session cookie uses a synthetic JWT with
220
+ * far-future expiry, and externalApis mocks intercept all Supabase auth API calls.
221
+ * This avoids storing real tokens (security risk + expiration) in scenario files.
222
+ */
223
+ async function handleAuth(auth: {
224
+ email: string;
225
+ password?: string;
226
+ }): Promise<string> {
227
+ const email = auth.email;
228
+ const password = auth.password || DEFAULT_AUTH_PASSWORD;
229
+
230
+ // Create user if they don't exist (auto-confirm email)
231
+ // We still need the auth.users row for PostgREST FK relationships.
232
+ const { data: createData, error: createError } =
233
+ await supabase.auth.admin.createUser({
234
+ email,
235
+ password,
236
+ email_confirm: true,
237
+ });
238
+
239
+ let userId: string;
240
+
241
+ if (createError) {
242
+ if (createError.message.includes('already been registered')) {
243
+ // User exists — look up their ID
244
+ const { data: listData } = await supabase.auth.admin.listUsers();
245
+ const existingUser = listData?.users?.find((u) => u.email === email);
246
+ if (existingUser) {
247
+ userId = existingUser.id;
248
+ console.log(` Found existing user ${email} (user: ${userId})`);
249
+ } else {
250
+ console.error(
251
+ ` User ${email} reported as registered but not found in listUsers`,
252
+ );
253
+ process.exit(1);
254
+ }
255
+ } else {
256
+ console.error(` Failed to create auth user: ${createError.message}`);
257
+ process.exit(1);
258
+ }
259
+ } else {
260
+ userId = createData!.user.id;
261
+ console.log(` Created user ${email} (user: ${userId})`);
262
+ }
263
+
264
+ // Build synthetic JWT and mock responses — no real sign-in needed.
265
+ // The preload module intercepts server-side getUser() calls so Next.js
266
+ // middleware returns the mock user without hitting real Supabase.
267
+ const fakeJwt = buildFakeJwt(userId!, email);
268
+ const userResponse = buildUserResponse({ id: userId!, email });
269
+
270
+ const projectRef = getProjectRef();
271
+ const sessionOutput = {
272
+ cookies: [
273
+ {
274
+ name: `sb-${projectRef}-auth-token`,
275
+ value: JSON.stringify({
276
+ access_token: fakeJwt,
277
+ refresh_token: 'codeyam-mock-refresh-token',
278
+ token_type: 'bearer',
279
+ expires_in: 315360000,
280
+ expires_at: 9999999999,
281
+ }),
282
+ path: '/',
283
+ sameSite: 'Lax' as const,
284
+ },
285
+ ],
286
+ externalApis: {
287
+ [`${supabaseUrl}/auth/v1/user`]: {
288
+ body: userResponse,
289
+ status: 200,
290
+ },
291
+ [`${supabaseUrl}/auth/v1/token`]: {
292
+ body: {
293
+ access_token: fakeJwt,
294
+ token_type: 'bearer',
295
+ expires_in: 315360000,
296
+ expires_at: 9999999999,
297
+ refresh_token: 'codeyam-mock-refresh-token',
298
+ user: userResponse,
299
+ },
300
+ status: 200,
301
+ },
302
+ },
303
+ };
304
+
305
+ const outputDir = path.join(process.cwd(), '.codeyam', 'tmp');
306
+ fs.mkdirSync(outputDir, { recursive: true });
307
+ const outputPath = path.join(outputDir, 'seed-session.json');
308
+ fs.writeFileSync(outputPath, JSON.stringify(sessionOutput, null, 2));
309
+ console.log(` Session cookies + auth mocks written to ${outputPath}`);
310
+
311
+ return userId!;
312
+ }
313
+
314
+ /**
315
+ * Replace __AUTH_USER_ID__ placeholders in seed data with the actual Supabase user ID.
316
+ * This lets scenarios reference the authenticated user in foreign key columns (e.g. user_id)
317
+ * without knowing the UUID ahead of time.
318
+ */
319
+ function replaceAuthPlaceholders(
320
+ seed: Record<string, unknown[]>,
321
+ userId: string,
322
+ ): Record<string, unknown[]> {
323
+ const json = JSON.stringify(seed);
324
+ const replaced = json.replace(/__AUTH_USER_ID__/g, userId);
325
+ return JSON.parse(replaced);
326
+ }
327
+
328
+ async function main() {
329
+ const seedDataPath = process.argv[2];
330
+ if (!seedDataPath) {
331
+ console.error('Usage: npx tsx .codeyam/seed-adapter.ts <seed-data.json>');
332
+ process.exit(1);
333
+ }
334
+
335
+ const raw = fs.readFileSync(seedDataPath, 'utf-8');
336
+ const data = JSON.parse(raw);
337
+
338
+ // Separate auth config from table data
339
+ const auth = data._auth;
340
+ let seed: Record<string, unknown[]> = {};
341
+ for (const [key, value] of Object.entries(data)) {
342
+ if (key === '_auth') continue;
343
+ seed[key] = value as unknown[];
344
+ }
345
+
346
+ // Auth first: we need the user ID to replace __AUTH_USER_ID__ placeholders
347
+ // in seed data (e.g. for user_id foreign key columns with Supabase RLS)
348
+ if (auth) {
349
+ const userId = await handleAuth(
350
+ auth as { email: string; password?: string },
351
+ );
352
+ seed = replaceAuthPlaceholders(seed, userId);
353
+ }
354
+
355
+ await seedTables(seed);
356
+
357
+ console.log('Seed complete');
358
+ }
359
+
360
+ main().catch((e) => {
361
+ console.error('Seed adapter error:', e);
362
+ process.exit(1);
363
+ });
@@ -16,6 +16,77 @@ You MUST follow a step-by-step workflow driven by `codeyam editor` commands. Eac
16
16
 
17
17
  **The rule:** After completing what a command tells you to do, run the NEXT command it specifies. The commands are your instructions — follow them one at a time.
18
18
 
19
+ ## TASK Directive
20
+
21
+ Some `codeyam editor N` commands output a `━━━ TASK ━━━` section with an `EXACT_TASK_TITLE:` line. When you see one:
22
+
23
+ 1. Delete ALL existing tasks: run TaskList, then run TaskUpdate with status "deleted" for every task returned
24
+ 2. Run TaskCreate with the EXACT title from the `EXACT_TASK_TITLE:` line — copy it character-for-character, do NOT paraphrase
25
+
26
+ This ensures only one task is ever visible. Do NOT create tasks on your own. Only create them when a `━━━ TASK ━━━` directive tells you to.
27
+
28
+ ## Migration Mode
29
+
30
+ When `codeyam editor steps` shows **"Project Migration"** instead of "Feature Cycle", the project is being migrated from an existing codebase. Follow the `codeyam editor migrate` commands instead of the normal 13-step cycle.
31
+
32
+ Migration uses a different command set:
33
+
34
+ ```
35
+ codeyam editor migrate → Survey the project (explore pages, confirm order)
36
+ codeyam editor migrate 1-8 → Run migration step N for the current page
37
+ codeyam editor migrate next → Advance to the next page
38
+ codeyam editor migrate status → Show migration progress
39
+ ```
40
+
41
+ **The same rule applies:** run the command shown in the output, follow its checklist, then run the next command it specifies. Migration steps are 1-8 per page: Capture → Preview → Discuss → Decompose → Extract → Recapture → Journal → Present. Steps 4-6 (Decompose/Extract/Recapture) are optional — the user decides at step 3 whether to decompose or skip to step 7. After all pages are migrated, the project transitions to the normal feature cycle.
42
+
43
+ **IMPORTANT:** When `codeyam editor steps` tells you to run a `codeyam editor migrate` command, run THAT command — do NOT run `codeyam editor 1` or any other normal step command.
44
+
45
+ ### Migration Survey (codeyam editor migrate)
46
+
47
+ When you run `codeyam editor migrate` with no arguments and no existing migration state, follow this survey checklist:
48
+
49
+ 1. Read `package.json` — understand the framework, dependencies, and scripts
50
+ 2. Explore the project structure — find all page/route files
51
+ - Next.js App Router: `app/**/page.tsx` | Pages Router: `pages/**/*.tsx`
52
+ - Check for other patterns: `src/` directory, custom routing, etc.
53
+ 3. Read each page/route to assess complexity and data flow
54
+ 4. Identify how the dev server starts (check `scripts` in package.json)
55
+ 5. Note any environment variables, databases, or external services needed
56
+ 6. Present a numbered list of all pages with:
57
+ - Page name and route
58
+ - File path
59
+ - Complexity assessment (simple / moderate / complex)
60
+ 7. Suggest a migration order — **start with the most complex pages** (dashboards, analytics, etc.) as they best demonstrate CodeYam's value and have rich decomposition opportunities
61
+ 8. Wait for user confirmation of the order
62
+
63
+ **After user confirms**, write `.codeyam/migration-state.json`:
64
+
65
+ ```json
66
+ {
67
+ "status": "surveyed",
68
+ "startedAt": "<ISO>",
69
+ "completedAt": null,
70
+ "pages": [
71
+ {
72
+ "name": "Home",
73
+ "route": "/",
74
+ "filePath": "app/page.tsx",
75
+ "status": "pending",
76
+ "startedAt": null,
77
+ "completedAt": null,
78
+ "extractedComponents": [],
79
+ "extractedFunctions": [],
80
+ "scenarioCount": 0
81
+ }
82
+ ],
83
+ "currentPageIndex": 0,
84
+ "sharedComponents": []
85
+ }
86
+ ```
87
+
88
+ Then run: `codeyam editor migrate 1`
89
+
19
90
  ## The Cycle
20
91
 
21
92
  Every feature follows 13 gated steps:
@@ -55,6 +126,9 @@ This command gives you the post-change checklist (re-register scenarios, re-run
55
126
  ## Key Rules
56
127
 
57
128
  - **Run the commands** — they ARE your instructions, not suggestions
129
+ - **One step at a time** — run each `codeyam editor N` command, read its FULL output, complete every checklist item, then advance. The CLI enforces a minimum time per step.
130
+ - **NEVER batch-run steps** — `for step in 5 6 7 8; do codeyam editor $step; done` or piping to `head` defeats the entire workflow. Each step has unique instructions you must read and follow.
131
+ - **NEVER delegate multiple steps to a subagent** — each step must be run, read, and completed in the main conversation. You MAY use subagents for parallelizable work _within_ a single step (e.g. extracting components + writing tests in step 5).
58
132
  - **Every feature gets scenarios** — this is the core value of CodeYam
59
133
  - **Always scaffold with a database** (Prisma + SQLite)
60
134
  - **Build real API routes** — the proxy handles scenario data transparently
@@ -101,6 +175,21 @@ Isolation routes are committed to git (not gitignored). They are protected by a
101
175
 
102
176
  When a collaborator clones the repo and runs `codeyam editor`, scenarios are auto-imported from `scenarios-manifest.json`. Run `codeyam editor sync` to manually re-sync after pulling new changes.
103
177
 
178
+ ## Expo / React Native Projects
179
+
180
+ When working with an Expo project (tech stack `expo-react-native`):
181
+
182
+ - Use `<View>`, `<Text>`, `<ScrollView>`, `<Pressable>` from `react-native` — **never use HTML elements** (`<div>`, `<span>`, `<h1>`, etc.)
183
+ - Do NOT use `'use client'` — this is a Next.js directive that has no meaning in Expo
184
+ - Do NOT import from `next/navigation`, `next/router`, or any `next/*` package
185
+ - Use `expo-router` for navigation: `useRouter()`, `useLocalSearchParams()`, `<Link>`
186
+ - Use `@/lib/theme` for all design tokens — not CSS custom properties (`var(--token)` does not work in React Native)
187
+ - AsyncStorage maps to localStorage on web — CodeYam's `localStorage` injection in scenarios works automatically
188
+ - Test with `npx jest`, not `npx vitest`
189
+ - Isolation routes use Expo Router: `app/isolated-components/ComponentName.tsx` (not a `/page.tsx` subdirectory)
190
+ - Capture wrappers use `nativeID="codeyam-capture"` (not `id="codeyam-capture"`) — `nativeID` maps to `id` on web
191
+ - The preview renders via react-native-web in a browser — some visual differences from native devices are expected (fonts, SafeAreaView, shadows). See `MOBILE_SETUP.md` for details.
192
+
104
193
  ## Quick Reference
105
194
 
106
195
  ```bash
@@ -114,7 +203,13 @@ codeyam editor register '{"name":"Full Catalog","type":"application","url":"/","
114
203
  # Register app scenario with localStorage (for apps using client-side storage instead of a database)
115
204
  codeyam editor register '{"name":"Full Library","type":"application","url":"/","dimensions":["<name from screenSizes>"],"localStorage":{"articles":[...],"collections":[...]}}'
116
205
 
117
- # For large seed/localStorage data, write JSON to a temp file and use @ prefix:
206
+ # BULK REGISTRATION (preferred register all scenarios at once):
207
+ # Write an array of scenarios to a temp file, then register with @ prefix.
208
+ # This is faster and avoids repeated screenshot capture overhead.
209
+ # File format: [{"name":"...","type":"...","url":"...","seed":{...}}, ...]
210
+ codeyam editor register @.codeyam/tmp/scenarios.json
211
+
212
+ # Single scenario from file (for large seed/localStorage data):
118
213
  codeyam editor register @/tmp/scenario-data.json
119
214
 
120
215
  # Journal entry (one per feature, references scenario names)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeyam/codeyam-cli",
3
- "version": "0.1.0-staging.8b51541",
3
+ "version": "0.1.0-staging.8c89b23",
4
4
  "description": "Local development CLI for CodeYam analysis",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46,6 +46,7 @@
46
46
  "p-queue": "^9.1.0",
47
47
  "p-retry": "^7.1.1",
48
48
  "pg": "^8.19.0",
49
+ "posthog-node": "^4.0.0",
49
50
  "piscina": "^5.1.4",
50
51
  "pixelmatch": "^5.3.0",
51
52
  "playwright": "1.58.0",
@@ -616,6 +616,97 @@ export class UseStateSemantics {
616
616
  return true;
617
617
  }
618
618
  }
619
+ // ─── Set/Map method semantics ──────────────────────────────────────────
620
+ //
621
+ // Set/Map membership operations (.has, .delete, .add, .get, .set, .clear)
622
+ // don't create data flow equivalencies — they're membership checks or
623
+ // mutations, not transformations that propagate schema structure.
624
+ // Without these semantics, code like `filterRatings.has(articleId)` creates
625
+ // spurious equivalencies (332 entries in the Margo LibraryPage case).
626
+ /**
627
+ * Set.has() / Map.has() — membership check, returns boolean
628
+ */
629
+ export class CollectionHasSemantics {
630
+ getReturnType() {
631
+ return 'boolean';
632
+ }
633
+ addEquivalences(methodCallPath, _sourcePath, context) {
634
+ context.addType(methodCallPath, 'boolean');
635
+ }
636
+ isComplete() {
637
+ return true;
638
+ }
639
+ }
640
+ /**
641
+ * Set.delete() / Map.delete() — removal, returns boolean
642
+ */
643
+ export class CollectionDeleteSemantics {
644
+ getReturnType() {
645
+ return 'boolean';
646
+ }
647
+ addEquivalences(methodCallPath, _sourcePath, context) {
648
+ context.addType(methodCallPath, 'boolean');
649
+ }
650
+ isComplete() {
651
+ return true;
652
+ }
653
+ }
654
+ /**
655
+ * Set.add() — adds an element, returns the Set (for chaining)
656
+ */
657
+ export class SetAddSemantics {
658
+ getReturnType() {
659
+ return 'object'; // Returns the Set itself
660
+ }
661
+ addEquivalences(_methodCallPath, _sourcePath, _context) {
662
+ // No equivalencies — add() doesn't create data flow
663
+ }
664
+ isComplete() {
665
+ return true;
666
+ }
667
+ }
668
+ /**
669
+ * Set.clear() / Map.clear() — removes all elements, returns void
670
+ */
671
+ export class CollectionClearSemantics {
672
+ getReturnType() {
673
+ return 'void';
674
+ }
675
+ addEquivalences() {
676
+ // No equivalencies
677
+ }
678
+ isComplete() {
679
+ return true;
680
+ }
681
+ }
682
+ /**
683
+ * Map.get() — retrieves a value by key, returns unknown (value type)
684
+ */
685
+ export class MapGetSemantics {
686
+ getReturnType() {
687
+ return 'unknown';
688
+ }
689
+ addEquivalences(_methodCallPath, _sourcePath, _context) {
690
+ // No equivalencies — the return value type depends on the map contents
691
+ }
692
+ isComplete() {
693
+ return true;
694
+ }
695
+ }
696
+ /**
697
+ * Map.set() — sets a key-value pair, returns the Map (for chaining)
698
+ */
699
+ export class MapSetSemantics {
700
+ getReturnType() {
701
+ return 'object'; // Returns the Map itself
702
+ }
703
+ addEquivalences() {
704
+ // No equivalencies
705
+ }
706
+ isComplete() {
707
+ return true;
708
+ }
709
+ }
619
710
  /**
620
711
  * Create and populate the registry with method semantics
621
712
  */
@@ -645,6 +736,14 @@ export function createMethodRegistry() {
645
736
  // Register React hooks
646
737
  registry.register('useState', new UseStateSemantics(), 'React');
647
738
  registry.register('useMemo', new UseMemoSemantics(), 'React');
739
+ // Register Set/Map collection methods.
740
+ // Only .has() and .delete() are safe to register by method name — they always
741
+ // return boolean regardless of the collection type (Set, Map, WeakSet, WeakMap,
742
+ // FormData, URLSearchParams, etc.).
743
+ // .add(), .clear(), .get(), .set() are too ambiguous across different types
744
+ // and can't be registered until the lookup code supports class-aware resolution.
745
+ registry.register('has', new CollectionHasSemantics());
746
+ registry.register('delete', new CollectionDeleteSemantics());
648
747
  return registry;
649
748
  }
650
749
  // Create a singleton instance of the registry for use throughout the codebase