@codeyam/codeyam-cli 0.1.0-staging.8778565 → 0.1.0-staging.87dd4be

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 (310) 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 +2 -2
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/aws/package.json +1 -1
  6. package/analyzer-template/packages/database/package.json +1 -1
  7. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +82 -0
  8. package/analyzer-template/packages/database/src/lib/loadEntities.ts +0 -6
  9. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +0 -65
  10. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +5 -0
  11. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
  12. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +84 -0
  13. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  14. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  15. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +0 -6
  16. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  17. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  18. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +0 -25
  19. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  20. package/codeyam-cli/src/cli.js +9 -0
  21. package/codeyam-cli/src/cli.js.map +1 -1
  22. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
  23. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
  24. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +56 -0
  25. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
  26. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
  27. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  28. package/codeyam-cli/src/commands/editor.js +2369 -346
  29. package/codeyam-cli/src/commands/editor.js.map +1 -1
  30. package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
  31. package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
  32. package/codeyam-cli/src/commands/init.js +69 -34
  33. package/codeyam-cli/src/commands/init.js.map +1 -1
  34. package/codeyam-cli/src/commands/telemetry.js +37 -0
  35. package/codeyam-cli/src/commands/telemetry.js.map +1 -0
  36. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
  37. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
  38. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +18 -8
  39. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
  40. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +2046 -1
  41. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  42. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  43. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  44. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
  45. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
  46. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
  47. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
  48. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +76 -3
  49. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -1
  50. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +381 -0
  51. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  52. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +202 -1
  53. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -1
  54. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
  55. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  56. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +88 -1
  57. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
  58. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +47 -1
  59. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
  60. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +70 -0
  61. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
  62. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1335 -1
  63. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  64. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +67 -0
  65. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
  66. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
  67. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
  68. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  69. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  70. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  71. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  72. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +363 -11
  73. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  74. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
  75. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
  76. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +30 -2
  77. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -1
  78. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  79. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  80. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +284 -0
  81. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  82. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +649 -223
  83. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -1
  84. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +1 -0
  85. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  86. package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
  87. package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
  88. package/codeyam-cli/src/utils/analysisRunner.js +3 -1
  89. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  90. package/codeyam-cli/src/utils/analyzer.js +9 -0
  91. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  92. package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
  93. package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
  94. package/codeyam-cli/src/utils/backgroundServer.js +3 -9
  95. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  96. package/codeyam-cli/src/utils/database.js +37 -2
  97. package/codeyam-cli/src/utils/database.js.map +1 -1
  98. package/codeyam-cli/src/utils/editorApi.js +11 -5
  99. package/codeyam-cli/src/utils/editorApi.js.map +1 -1
  100. package/codeyam-cli/src/utils/editorAudit.js +372 -5
  101. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  102. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  103. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  104. package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
  105. package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
  106. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +13 -7
  107. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -1
  108. package/codeyam-cli/src/utils/editorEntityHelpers.js +144 -0
  109. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  110. package/codeyam-cli/src/utils/editorLoaderHelpers.js +72 -1
  111. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -1
  112. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  113. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  114. package/codeyam-cli/src/utils/editorPreview.js +31 -0
  115. package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
  116. package/codeyam-cli/src/utils/editorRecapture.js +109 -0
  117. package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
  118. package/codeyam-cli/src/utils/editorScenarioSwitch.js +24 -2
  119. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
  120. package/codeyam-cli/src/utils/editorScenarios.js +458 -0
  121. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  122. package/codeyam-cli/src/utils/editorSeedAdapter.js +253 -4
  123. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
  124. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  125. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  126. package/codeyam-cli/src/utils/entityChangeStatus.js +53 -6
  127. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  128. package/codeyam-cli/src/utils/entityChangeStatus.server.js +41 -3
  129. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
  130. package/codeyam-cli/src/utils/fileWatcher.js +38 -0
  131. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  132. package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
  133. package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
  134. package/codeyam-cli/src/utils/install-skills.js +14 -0
  135. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  136. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -1
  137. package/codeyam-cli/src/utils/progress.js +2 -2
  138. package/codeyam-cli/src/utils/progress.js.map +1 -1
  139. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  140. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  141. package/codeyam-cli/src/utils/scenarioCoverage.js +77 -0
  142. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  143. package/codeyam-cli/src/utils/scenariosManifest.js +269 -74
  144. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
  145. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +1 -0
  146. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  147. package/codeyam-cli/src/utils/simulationGateMiddleware.js +8 -1
  148. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
  149. package/codeyam-cli/src/utils/slugUtils.js +25 -0
  150. package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
  151. package/codeyam-cli/src/utils/syncMocksMiddleware.js +2 -2
  152. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  153. package/codeyam-cli/src/utils/telemetry.js +106 -0
  154. package/codeyam-cli/src/utils/telemetry.js.map +1 -0
  155. package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
  156. package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
  157. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
  158. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
  159. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +80 -0
  160. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  161. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +218 -0
  162. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  163. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +217 -0
  164. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
  165. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +71 -0
  166. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  167. package/codeyam-cli/src/webserver/app/lib/git.js +3 -2
  168. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -1
  169. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  170. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  171. package/codeyam-cli/src/webserver/backgroundServer.js +60 -61
  172. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  173. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CLe80MMu.js +1 -0
  174. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BcgbViKV.js → EntityItem-Crt_KN_U.js} +3 -3
  175. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  176. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CQIG2qda.js → EntityTypeIcon-CD7lGABo.js} +1 -1
  177. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CgTNOhnu.js +1 -0
  178. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-CKeQT5Ty.js +25 -0
  179. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-D3s1MFkb.js +3 -0
  180. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
  181. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CM5zg40N.js} +3 -3
  182. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-BzHcG7SE.js → ReportIssueModal-C2PLkej3.js} +2 -2
  183. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DanvyBPb.js +1 -0
  184. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-0DY_NKil.js → ScenarioViewer-DUMfcNVK.js} +3 -3
  185. package/codeyam-cli/src/webserver/build/client/assets/Spinner-D0LgAaSa.js +34 -0
  186. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  187. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-BA_Ry-rs.js +1 -0
  188. package/codeyam-cli/src/webserver/build/client/assets/{_index-DLxKhri3.js → _index-BAWd-Xjf.js} +2 -2
  189. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BcY3q6nt.js → activity.(_tab)-BOARiB-g.js} +3 -3
  190. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-CHx25PAe.js} +1 -1
  191. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bni3iiUj.js → agent-transcripts-Bg3e7q4S.js} +3 -3
  192. package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
  193. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  194. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  195. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  196. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  197. package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/{book-open-BYOypzCa.js → book-open-CL-lMgHh.js} +1 -1
  199. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-C_Pmso5S.js → chevron-down-GmAjGS9-.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +43 -0
  201. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-BVMi9VA5.js → circle-check-DFcQkN5j.js} +1 -1
  202. package/codeyam-cli/src/webserver/build/client/assets/{copy-n2FB0_Sw.js → copy-C6iF61Xs.js} +1 -1
  203. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CC6AbExI.js → createLucideIcon-4ImjHTVC.js} +1 -1
  204. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-C8y4mmyv.js +1 -0
  205. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-Gbk_i5Js.js +1 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-Bnx7yUP0.js +58 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-oepecPae.js +41 -0
  208. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-BF4oLwaE.js → entity._sha._-Blfy9UlN.js} +2 -2
  209. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-KTQuL0aj.js +6 -0
  210. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C6eeL24i.js +6 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DQM8E7L4.js +6 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-CAoXLsQr.js} +2 -2
  213. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-SuW9syRS.js} +6 -6
  214. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  215. package/codeyam-cli/src/webserver/build/client/assets/files-D-xGrg29.js +1 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/git-Bq_fbXP5.js +1 -0
  217. package/codeyam-cli/src/webserver/build/client/assets/globals-fAqOD9ex.css +1 -0
  218. package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-Bp1l4hSv.js} +1 -1
  219. package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-CWV9XZiG.js} +1 -1
  220. package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-DE3jI_dv.js} +1 -1
  221. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  222. package/codeyam-cli/src/webserver/build/client/assets/labs-B_IX45ih.js +1 -0
  223. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-DaAZ_H2w.js → loader-circle-De-7qQ2u.js} +1 -1
  224. package/codeyam-cli/src/webserver/build/client/assets/manifest-b9d4d267.js +1 -0
  225. package/codeyam-cli/src/webserver/build/client/assets/memory-Cx2xEx7s.js +101 -0
  226. package/codeyam-cli/src/webserver/build/client/assets/{pause-f5-1lKBt.js → pause-CFxEKL1u.js} +1 -1
  227. package/codeyam-cli/src/webserver/build/client/assets/root-DB3O9_9j.js +67 -0
  228. package/codeyam-cli/src/webserver/build/client/assets/{search-Di64LWVb.js → search-BdBb5aqc.js} +1 -1
  229. package/codeyam-cli/src/webserver/build/client/assets/settings-DdE-Untf.js +1 -0
  230. package/codeyam-cli/src/webserver/build/client/assets/simulations-DSCdE99u.js +1 -0
  231. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Br7MOqts.js → terminal-CrplD4b1.js} +1 -1
  232. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-BLdiCuG-.js → triangle-alert-DqJ0j69l.js} +1 -1
  233. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DhXHbEjP.js +1 -0
  234. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-C14nCb1q.js → useLastLogLine-BNd5hYuW.js} +1 -1
  235. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-Cy5Qg_UR.js +1 -0
  236. package/codeyam-cli/src/webserver/build/client/assets/useToast-5HR2j9ZE.js +1 -0
  237. package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
  238. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-CGwTN3V2.js +13 -0
  239. package/codeyam-cli/src/webserver/build/server/assets/index-D4meMKy3.js +1 -0
  240. package/codeyam-cli/src/webserver/build/server/assets/init-odGJ_c2-.js +10 -0
  241. package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
  242. package/codeyam-cli/src/webserver/build/server/assets/server-build-TmPfF7pT.js +552 -0
  243. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  244. package/codeyam-cli/src/webserver/build-info.json +5 -5
  245. package/codeyam-cli/src/webserver/editorProxy.js +208 -17
  246. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  247. package/codeyam-cli/src/webserver/idleDetector.js +106 -0
  248. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
  249. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  250. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  251. package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
  252. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +36 -0
  253. package/codeyam-cli/src/webserver/server.js +87 -4
  254. package/codeyam-cli/src/webserver/server.js.map +1 -1
  255. package/codeyam-cli/src/webserver/terminalServer.js +140 -35
  256. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  257. package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
  258. package/codeyam-cli/templates/chrome-extension-react/package.json +1 -0
  259. package/codeyam-cli/templates/codeyam-editor-claude.md +84 -5
  260. package/codeyam-cli/templates/codeyam-editor-reference.md +214 -0
  261. package/codeyam-cli/templates/editor-step-hook.py +114 -24
  262. package/codeyam-cli/templates/expo-react-native/README.md +41 -0
  263. package/codeyam-cli/templates/expo-react-native/package.json +1 -0
  264. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +14 -0
  265. package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
  266. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +2 -1
  267. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +42 -7
  268. package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
  269. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +2 -1
  270. package/codeyam-cli/templates/seed-adapters/supabase.ts +282 -0
  271. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +1 -1
  272. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +76 -10
  273. package/package.json +2 -1
  274. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +84 -0
  275. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  276. package/packages/database/src/lib/loadEntities.js +0 -6
  277. package/packages/database/src/lib/loadEntities.js.map +1 -1
  278. package/packages/database/src/lib/updateCommitMetadata.js +0 -25
  279. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  280. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +0 -1
  281. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
  282. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
  283. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
  284. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
  285. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
  286. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
  287. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
  288. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +0 -1
  289. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-C4pqxYJB.js +0 -51
  290. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Csi0_PMl.js +0 -1
  291. package/codeyam-cli/src/webserver/build/client/assets/editor-DgN1LTTt.js +0 -10
  292. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-BLQMSKZa.js +0 -41
  293. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-C7YX6r3H.js +0 -6
  294. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CF164ouH.js +0 -6
  295. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
  296. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
  297. package/codeyam-cli/src/webserver/build/client/assets/files-BZrlFE1F.js +0 -1
  298. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +0 -1
  299. package/codeyam-cli/src/webserver/build/client/assets/globals-BkWJ_UNc.css +0 -1
  300. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
  301. package/codeyam-cli/src/webserver/build/client/assets/manifest-c26eb85b.js +0 -1
  302. package/codeyam-cli/src/webserver/build/client/assets/memory-Bl2rpw8u.js +0 -96
  303. package/codeyam-cli/src/webserver/build/client/assets/root-ClvYBUSA.js +0 -67
  304. package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +0 -1
  305. package/codeyam-cli/src/webserver/build/client/assets/simulations-DWT-CvLy.js +0 -1
  306. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CrAK28Bc.js +0 -1
  307. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
  308. package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
  309. package/codeyam-cli/src/webserver/build/server/assets/index-DflIr5SD.js +0 -1
  310. package/codeyam-cli/src/webserver/build/server/assets/server-build-OhKy839M.js +0 -416
@@ -1,5 +1,5 @@
1
- import { buildReverseDependencyGraph, classifyDirectChanges, computeEntityChangeStatus, buildChangedFilesMap, pageNameFromUrl, scenarioEntityName, buildEntityInfosFromScenarios, buildEntityInfosFromGlossary, filterGroupsByChangeStatus, filterGlossaryByChangeStatus, filterScenarioScreenshotsByChangeStatus, } from "../entityChangeStatus.js";
2
- import { scanPageFilePaths, detectFirstFeature, readFeatureStartedAt, } from "../entityChangeStatus.server.js";
1
+ import { buildReverseDependencyGraph, classifyDirectChanges, computeEntityChangeStatus, buildChangedFilesMap, pageNameFromUrl, isIsolationUrl, scenarioEntityName, buildEntityInfosFromScenarios, buildEntityInfosFromGlossary, filterGroupsByChangeStatus, filterGlossaryByChangeStatus, filterScenarioScreenshotsByChangeStatus, } from "../entityChangeStatus.js";
2
+ import { scanPageFilePaths, detectFirstFeature, readFeatureStartedAt, readEditorStep, readEditorSessionId, } from "../entityChangeStatus.server.js";
3
3
  import * as fsModule from 'fs';
4
4
  import * as pathModule from 'path';
5
5
  import * as os from 'os';
@@ -128,10 +128,20 @@ describe('entityChangeStatus', () => {
128
128
  // This is an edge case — empty string is falsy so returns Home
129
129
  expect(pageNameFromUrl('')).toBe('Home');
130
130
  });
131
+ it('should return Home for root path with query string', () => {
132
+ expect(pageNameFromUrl('/?demo=empty')).toBe('Home');
133
+ expect(pageNameFromUrl('/?state=seeded')).toBe('Home');
134
+ expect(pageNameFromUrl('/?tab=overview&sort=date')).toBe('Home');
135
+ });
131
136
  it('should handle dynamic route segments', () => {
132
137
  expect(pageNameFromUrl('/drinks/[id]')).toBe('Drinks');
133
138
  expect(pageNameFromUrl('/users/[userId]/posts')).toBe('Users');
134
139
  });
140
+ it('should strip file extensions from URL segments', () => {
141
+ expect(pageNameFromUrl('/library.html')).toBe('Library');
142
+ expect(pageNameFromUrl('/about.htm')).toBe('About');
143
+ expect(pageNameFromUrl('/library.html?article=a1')).toBe('Library');
144
+ });
135
145
  });
136
146
  // ── buildEntityInfosFromScenarios ─────────────────────────────────────
137
147
  describe('buildEntityInfosFromScenarios', () => {
@@ -1044,6 +1054,34 @@ describe('entityChangeStatus', () => {
1044
1054
  expect(result).toHaveLength(1);
1045
1055
  expect(result[0].importedBy).toBeDefined();
1046
1056
  });
1057
+ it('should use displayName for non-app/ pageFilePath instead of collapsing to Home', () => {
1058
+ // Margo bug: Chrome extension has two entry points:
1059
+ // "/" → src/popup/App.tsx (Home)
1060
+ // "/library.html" → src/library/FullPageLibrary.tsx (Library)
1061
+ // Without displayName, buildRoutePattern('src/library/FullPageLibrary.tsx')
1062
+ // returns '/' since it doesn't start with 'app/', collapsing both to "Home".
1063
+ const scenarios = [
1064
+ {
1065
+ componentName: null,
1066
+ componentPath: null,
1067
+ url: '/',
1068
+ pageFilePath: 'src/popup/App.tsx',
1069
+ displayName: 'Home',
1070
+ },
1071
+ {
1072
+ componentName: null,
1073
+ componentPath: null,
1074
+ url: '/library.html',
1075
+ pageFilePath: 'src/library/FullPageLibrary.tsx',
1076
+ displayName: 'Library',
1077
+ },
1078
+ ];
1079
+ const result = buildEntityInfosFromScenarios(scenarios, {}, []);
1080
+ expect(result).toHaveLength(2);
1081
+ expect(result.map((e) => e.name).sort()).toEqual(['Home', 'Library']);
1082
+ expect(result.find((e) => e.name === 'Home')?.filePath).toBe('src/popup/App.tsx');
1083
+ expect(result.find((e) => e.name === 'Library')?.filePath).toBe('src/library/FullPageLibrary.tsx');
1084
+ });
1047
1085
  });
1048
1086
  // ── Full pipeline regression tests ───────────────────────────────
1049
1087
  describe('full pipeline regression tests', () => {
@@ -1591,7 +1629,7 @@ describe('entityChangeStatus', () => {
1591
1629
  });
1592
1630
  fsModule.writeFileSync(pathModule.join(appDir, 'settings', 'profile', 'page.tsx'), '');
1593
1631
  const result = scanPageFilePaths(tempDir);
1594
- expect(result).toEqual({
1632
+ expect(result.map).toEqual({
1595
1633
  Home: 'app/page.tsx',
1596
1634
  Drinks: 'app/drinks/page.tsx',
1597
1635
  Settings: 'app/settings/profile/page.tsx',
@@ -1602,7 +1640,7 @@ describe('entityChangeStatus', () => {
1602
1640
  fsModule.mkdirSync(appDir, { recursive: true });
1603
1641
  fsModule.writeFileSync(pathModule.join(appDir, 'page.js'), '');
1604
1642
  const result = scanPageFilePaths(tempDir);
1605
- expect(result).toEqual({ Home: 'app/page.js' });
1643
+ expect(result.map).toEqual({ Home: 'app/page.js' });
1606
1644
  });
1607
1645
  it('should skip isolated-components directories', () => {
1608
1646
  const appDir = pathModule.join(tempDir, 'app');
@@ -1611,11 +1649,11 @@ describe('entityChangeStatus', () => {
1611
1649
  });
1612
1650
  fsModule.writeFileSync(pathModule.join(appDir, 'isolated-components', 'test', 'page.tsx'), '');
1613
1651
  const result = scanPageFilePaths(tempDir);
1614
- expect(result).toEqual({});
1652
+ expect(result.map).toEqual({});
1615
1653
  });
1616
1654
  it('should return empty map when app/ does not exist', () => {
1617
1655
  const result = scanPageFilePaths(tempDir);
1618
- expect(result).toEqual({});
1656
+ expect(result.map).toEqual({});
1619
1657
  });
1620
1658
  // ── Expo Router support ──────────────────────────────────────────────
1621
1659
  it('should find index.tsx as Home page (Expo Router)', () => {
@@ -1623,7 +1661,7 @@ describe('entityChangeStatus', () => {
1623
1661
  fsModule.mkdirSync(appDir, { recursive: true });
1624
1662
  fsModule.writeFileSync(pathModule.join(appDir, 'index.tsx'), '');
1625
1663
  const result = scanPageFilePaths(tempDir);
1626
- expect(result).toEqual({ Home: 'app/index.tsx' });
1664
+ expect(result.map).toEqual({ Home: 'app/index.tsx' });
1627
1665
  });
1628
1666
  it('should find named route files as pages (Expo Router)', () => {
1629
1667
  const appDir = pathModule.join(tempDir, 'app');
@@ -1633,7 +1671,7 @@ describe('entityChangeStatus', () => {
1633
1671
  fsModule.mkdirSync(pathModule.join(appDir, 'tea'), { recursive: true });
1634
1672
  fsModule.writeFileSync(pathModule.join(appDir, 'tea', '[id].tsx'), '');
1635
1673
  const result = scanPageFilePaths(tempDir);
1636
- expect(result).toEqual({
1674
+ expect(result.map).toEqual({
1637
1675
  Home: 'app/index.tsx',
1638
1676
  'Add-tea': 'app/add-tea.tsx',
1639
1677
  Tea: 'app/tea/[id].tsx',
@@ -1645,7 +1683,7 @@ describe('entityChangeStatus', () => {
1645
1683
  fsModule.writeFileSync(pathModule.join(appDir, '_layout.tsx'), '');
1646
1684
  fsModule.writeFileSync(pathModule.join(appDir, 'index.tsx'), '');
1647
1685
  const result = scanPageFilePaths(tempDir);
1648
- expect(result).toEqual({ Home: 'app/index.tsx' });
1686
+ expect(result.map).toEqual({ Home: 'app/index.tsx' });
1649
1687
  });
1650
1688
  it('should handle route groups like (tabs) transparently (Expo Router)', () => {
1651
1689
  const appDir = pathModule.join(tempDir, 'app');
@@ -1655,7 +1693,7 @@ describe('entityChangeStatus', () => {
1655
1693
  fsModule.writeFileSync(pathModule.join(tabsDir, 'index.tsx'), '');
1656
1694
  fsModule.writeFileSync(pathModule.join(tabsDir, 'settings.tsx'), '');
1657
1695
  const result = scanPageFilePaths(tempDir);
1658
- expect(result).toEqual({
1696
+ expect(result.map).toEqual({
1659
1697
  Home: 'app/(tabs)/index.tsx',
1660
1698
  Settings: 'app/(tabs)/settings.tsx',
1661
1699
  });
@@ -1666,7 +1704,32 @@ describe('entityChangeStatus', () => {
1666
1704
  fsModule.writeFileSync(pathModule.join(appDir, 'page.tsx'), '');
1667
1705
  fsModule.writeFileSync(pathModule.join(appDir, 'index.tsx'), '');
1668
1706
  const result = scanPageFilePaths(tempDir);
1669
- expect(result).toEqual({ Home: 'app/page.tsx' });
1707
+ expect(result.map).toEqual({ Home: 'app/page.tsx' });
1708
+ });
1709
+ it('should include all page files in allFiles when multiple routes share a page name', () => {
1710
+ const appDir = pathModule.join(tempDir, 'app');
1711
+ fsModule.mkdirSync(appDir, { recursive: true });
1712
+ fsModule.writeFileSync(pathModule.join(appDir, 'page.tsx'), '');
1713
+ fsModule.mkdirSync(pathModule.join(appDir, 'feedback', '[id]', 'edit'), {
1714
+ recursive: true,
1715
+ });
1716
+ fsModule.mkdirSync(pathModule.join(appDir, 'feedback', 'new'), {
1717
+ recursive: true,
1718
+ });
1719
+ fsModule.writeFileSync(pathModule.join(appDir, 'feedback', '[id]', 'page.tsx'), '');
1720
+ fsModule.writeFileSync(pathModule.join(appDir, 'feedback', '[id]', 'edit', 'page.tsx'), '');
1721
+ fsModule.writeFileSync(pathModule.join(appDir, 'feedback', 'new', 'page.tsx'), '');
1722
+ const result = scanPageFilePaths(tempDir);
1723
+ // Map picks one canonical file per page name
1724
+ expect(result.map['Home']).toBe('app/page.tsx');
1725
+ expect(result.map['Feedback']).toBeDefined();
1726
+ // allFiles includes ALL page files, even those that collided on page name
1727
+ expect(result.allFiles.sort()).toEqual([
1728
+ 'app/feedback/[id]/edit/page.tsx',
1729
+ 'app/feedback/[id]/page.tsx',
1730
+ 'app/feedback/new/page.tsx',
1731
+ 'app/page.tsx',
1732
+ ]);
1670
1733
  });
1671
1734
  });
1672
1735
  // ── detectFirstFeature ─────────────────────────────────────────────────
@@ -1733,5 +1796,294 @@ describe('entityChangeStatus', () => {
1733
1796
  expect(readFeatureStartedAt(tempDir)).toBeNull();
1734
1797
  });
1735
1798
  });
1799
+ // ── readEditorStep ──────────────────────────────────────────────────────
1800
+ describe('readEditorStep', () => {
1801
+ let tempDir;
1802
+ beforeEach(() => {
1803
+ tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'editorstep-test-'));
1804
+ fsModule.mkdirSync(pathModule.join(tempDir, '.codeyam'), {
1805
+ recursive: true,
1806
+ });
1807
+ });
1808
+ afterEach(() => {
1809
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1810
+ });
1811
+ it('should return step and label from editor-step.json', () => {
1812
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), JSON.stringify({ step: 3, label: 'Confirm', feature: 'Add login' }));
1813
+ expect(readEditorStep(tempDir)).toEqual({ step: 3, label: 'Confirm' });
1814
+ });
1815
+ it('should return null when file does not exist', () => {
1816
+ expect(readEditorStep(tempDir)).toBeNull();
1817
+ });
1818
+ it('should return null when step field is missing', () => {
1819
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), JSON.stringify({ feature: 'Add login' }));
1820
+ expect(readEditorStep(tempDir)).toBeNull();
1821
+ });
1822
+ it('should return null for invalid JSON', () => {
1823
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'editor-step.json'), 'not json');
1824
+ expect(readEditorStep(tempDir)).toBeNull();
1825
+ });
1826
+ });
1827
+ // ── readEditorSessionId ─────────────────────────────────────────────────
1828
+ describe('readEditorSessionId', () => {
1829
+ let tempDir;
1830
+ beforeEach(() => {
1831
+ tempDir = fsModule.mkdtempSync(pathModule.join(os.tmpdir(), 'sessionid-test-'));
1832
+ fsModule.mkdirSync(pathModule.join(tempDir, '.codeyam'), {
1833
+ recursive: true,
1834
+ });
1835
+ });
1836
+ afterEach(() => {
1837
+ fsModule.rmSync(tempDir, { recursive: true, force: true });
1838
+ });
1839
+ it('should return session ID from claude-session-id.txt', () => {
1840
+ const uuid = '550e8400-e29b-41d4-a716-446655440000';
1841
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'claude-session-id.txt'), uuid);
1842
+ expect(readEditorSessionId(tempDir)).toBe(uuid);
1843
+ });
1844
+ it('should trim whitespace from session ID', () => {
1845
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'claude-session-id.txt'), ' abc-123 \n');
1846
+ expect(readEditorSessionId(tempDir)).toBe('abc-123');
1847
+ });
1848
+ it('should return null when file does not exist', () => {
1849
+ expect(readEditorSessionId(tempDir)).toBeNull();
1850
+ });
1851
+ it('should return null when file is empty', () => {
1852
+ fsModule.writeFileSync(pathModule.join(tempDir, '.codeyam', 'claude-session-id.txt'), '');
1853
+ expect(readEditorSessionId(tempDir)).toBeNull();
1854
+ });
1855
+ });
1856
+ describe('isIsolationUrl', () => {
1857
+ it('should return true for /isolated-components/ URLs', () => {
1858
+ expect(isIsolationUrl('/isolated-components/Foo')).toBe(true);
1859
+ expect(isIsolationUrl('/isolated-components/Foo?s=Default')).toBe(true);
1860
+ });
1861
+ it('should return true for /codeyam-isolate/ URLs', () => {
1862
+ expect(isIsolationUrl('/codeyam-isolate/Foo')).toBe(true);
1863
+ expect(isIsolationUrl('/codeyam-isolate/Foo?s=Default')).toBe(true);
1864
+ });
1865
+ it('should return false for regular page URLs', () => {
1866
+ expect(isIsolationUrl('/library')).toBe(false);
1867
+ expect(isIsolationUrl('/drinks/1')).toBe(false);
1868
+ expect(isIsolationUrl('/')).toBe(false);
1869
+ });
1870
+ it('should return false for null/undefined', () => {
1871
+ expect(isIsolationUrl(null)).toBe(false);
1872
+ expect(isIsolationUrl(undefined)).toBe(false);
1873
+ });
1874
+ });
1875
+ // ── buildReverseDependencyGraph: filePath-based importer resolution ────
1876
+ describe('buildReverseDependencyGraph — filePath-based resolution', () => {
1877
+ it('should resolve importer via filePath when DB name differs from display name', () => {
1878
+ // In Margo Reader: ArticleTable's importedBy lists "LibraryPage" as importer name
1879
+ // under filePath "app/library/page.tsx". But the entity list has name "Library"
1880
+ // with filePath "app/library/page.tsx". The reverse graph should map
1881
+ // ArticleTable → {"Library"} (not "LibraryPage").
1882
+ const entities = [
1883
+ {
1884
+ name: 'ArticleTable',
1885
+ filePath: 'app/components/ArticleTable.tsx',
1886
+ importedBy: {
1887
+ 'app/library/page.tsx': {
1888
+ LibraryPage: { shas: ['sha1'] },
1889
+ },
1890
+ },
1891
+ },
1892
+ {
1893
+ name: 'Library',
1894
+ filePath: 'app/library/page.tsx',
1895
+ },
1896
+ ];
1897
+ const graph = buildReverseDependencyGraph(entities);
1898
+ expect(graph.get('ArticleTable')).toEqual(new Set(['Library']));
1899
+ });
1900
+ it('should fall back to DB importer name when filePath has no matching entity', () => {
1901
+ // When the importer filePath doesn't match any entity in the list,
1902
+ // fall back to the DB's importer name.
1903
+ const entities = [
1904
+ {
1905
+ name: 'Button',
1906
+ filePath: 'components/Button.tsx',
1907
+ importedBy: {
1908
+ 'components/UnknownPage.tsx': {
1909
+ SomeComponent: { shas: ['sha1'] },
1910
+ },
1911
+ },
1912
+ },
1913
+ ];
1914
+ const graph = buildReverseDependencyGraph(entities);
1915
+ expect(graph.get('Button')).toEqual(new Set(['SomeComponent']));
1916
+ });
1917
+ it('should resolve multiple importers via filePath correctly', () => {
1918
+ const entities = [
1919
+ {
1920
+ name: 'ArticleTableRow',
1921
+ filePath: 'app/components/ArticleTableRow.tsx',
1922
+ importedBy: {
1923
+ 'app/components/ArticleTable.tsx': {
1924
+ ArticleTable: { shas: ['sha1'] },
1925
+ },
1926
+ 'app/library/page.tsx': {
1927
+ LibraryPage: { shas: ['sha2'] },
1928
+ },
1929
+ },
1930
+ },
1931
+ {
1932
+ name: 'ArticleTable',
1933
+ filePath: 'app/components/ArticleTable.tsx',
1934
+ },
1935
+ {
1936
+ name: 'Library',
1937
+ filePath: 'app/library/page.tsx',
1938
+ },
1939
+ ];
1940
+ const graph = buildReverseDependencyGraph(entities);
1941
+ expect(graph.get('ArticleTableRow')).toEqual(new Set(['ArticleTable', 'Library']));
1942
+ });
1943
+ });
1944
+ // ── buildEntityInfosFromScenarios: filePath-based metadata matching ────
1945
+ describe('buildEntityInfosFromScenarios — filePath-based metadata matching', () => {
1946
+ it('should attach importedBy metadata when entity names differ but filePaths match', () => {
1947
+ // Page scenario with displayName "Library" but DB entity named "LibraryPage"
1948
+ // with filePath "app/library/page.tsx". The metadata lookup should match by
1949
+ // filePath and attach importedBy.
1950
+ const scenarios = [
1951
+ {
1952
+ componentName: null,
1953
+ componentPath: null,
1954
+ pageFilePath: 'app/library/page.tsx',
1955
+ url: '/library',
1956
+ displayName: 'Library',
1957
+ },
1958
+ ];
1959
+ const entitiesWithMetadata = [
1960
+ {
1961
+ name: 'LibraryPage',
1962
+ filePath: 'app/library/page.tsx',
1963
+ metadata: {
1964
+ importedBy: {
1965
+ 'app/layout.tsx': {
1966
+ RootLayout: { shas: ['sha1'] },
1967
+ },
1968
+ },
1969
+ },
1970
+ },
1971
+ ];
1972
+ const result = buildEntityInfosFromScenarios(scenarios, {}, entitiesWithMetadata);
1973
+ expect(result).toHaveLength(1);
1974
+ expect(result[0].name).toBe('Library');
1975
+ expect(result[0].importedBy).toEqual({
1976
+ 'app/layout.tsx': {
1977
+ RootLayout: { shas: ['sha1'] },
1978
+ },
1979
+ });
1980
+ });
1981
+ it('should prefer name match over filePath match in multi-entity files', () => {
1982
+ // Bug: app/components/ArticleTable.tsx exports both Props (rowid 33) and
1983
+ // ArticleTable (rowid 34). find() with OR condition matches Props first
1984
+ // via filePath, so ArticleTable gets Props' importedBy (missing the
1985
+ // critical ArticleTable → LibraryPage edge). Fix: try name match first.
1986
+ const scenarios = [
1987
+ {
1988
+ componentName: 'ArticleTable',
1989
+ componentPath: 'app/components/ArticleTable.tsx',
1990
+ },
1991
+ ];
1992
+ const entitiesWithMetadata = [
1993
+ {
1994
+ name: 'Props',
1995
+ filePath: 'app/components/ArticleTable.tsx',
1996
+ metadata: {
1997
+ importedBy: {
1998
+ 'app/components/ArticleTable.tsx': {
1999
+ ArticleTable: { shas: ['sha-internal'] },
2000
+ },
2001
+ },
2002
+ },
2003
+ },
2004
+ {
2005
+ name: 'ArticleTable',
2006
+ filePath: 'app/components/ArticleTable.tsx',
2007
+ metadata: {
2008
+ importedBy: {
2009
+ 'app/library/page.tsx': {
2010
+ LibraryPage: { shas: ['sha1'] },
2011
+ },
2012
+ },
2013
+ },
2014
+ },
2015
+ ];
2016
+ const result = buildEntityInfosFromScenarios(scenarios, {}, entitiesWithMetadata);
2017
+ expect(result).toHaveLength(1);
2018
+ expect(result[0].name).toBe('ArticleTable');
2019
+ // Must get ArticleTable's importedBy (LibraryPage), NOT Props' importedBy
2020
+ expect(result[0].importedBy).toEqual({
2021
+ 'app/library/page.tsx': {
2022
+ LibraryPage: { shas: ['sha1'] },
2023
+ },
2024
+ });
2025
+ });
2026
+ it('should still match by name when names are identical', () => {
2027
+ const scenarios = [
2028
+ {
2029
+ componentName: 'ArticleTable',
2030
+ componentPath: 'app/components/ArticleTable.tsx',
2031
+ },
2032
+ ];
2033
+ const entitiesWithMetadata = [
2034
+ {
2035
+ name: 'ArticleTable',
2036
+ filePath: 'app/components/ArticleTable.tsx',
2037
+ metadata: {
2038
+ importedBy: {
2039
+ 'app/library/page.tsx': {
2040
+ LibraryPage: { shas: ['sha1'] },
2041
+ },
2042
+ },
2043
+ },
2044
+ },
2045
+ ];
2046
+ const result = buildEntityInfosFromScenarios(scenarios, {}, entitiesWithMetadata);
2047
+ expect(result[0].importedBy).toBeDefined();
2048
+ });
2049
+ });
2050
+ // ── End-to-end: filePath resolution enables impact propagation ────
2051
+ describe('end-to-end: filePath resolution enables page impact detection', () => {
2052
+ it('should detect Library page as impacted when ArticleTable is edited', () => {
2053
+ // This is the Margo Reader bug: ArticleTable is edited, Library page
2054
+ // should be detected as impacted because ArticleTable's importedBy
2055
+ // metadata shows it's imported by "app/library/page.tsx" → "Library".
2056
+ const changedFiles = new Map([
2057
+ ['app/components/ArticleTable.tsx', 'edited'],
2058
+ ]);
2059
+ const entities = [
2060
+ {
2061
+ name: 'ArticleTable',
2062
+ filePath: 'app/components/ArticleTable.tsx',
2063
+ importedBy: {
2064
+ 'app/library/page.tsx': {
2065
+ LibraryPage: { shas: ['sha1'] },
2066
+ },
2067
+ },
2068
+ },
2069
+ {
2070
+ name: 'Library',
2071
+ filePath: 'app/library/page.tsx',
2072
+ },
2073
+ ];
2074
+ const result = computeEntityChangeStatus(changedFiles, entities);
2075
+ expect(result['ArticleTable']).toEqual({ status: 'edited' });
2076
+ expect(result['Library']).toEqual({
2077
+ status: 'impacted',
2078
+ impactedBy: [
2079
+ {
2080
+ name: 'ArticleTable',
2081
+ filePath: 'app/components/ArticleTable.tsx',
2082
+ changeType: 'edited',
2083
+ },
2084
+ ],
2085
+ });
2086
+ });
2087
+ });
1736
2088
  });
1737
2089
  //# sourceMappingURL=entityChangeStatus.test.js.map