@codeyam/codeyam-cli 0.1.0-staging.b8f4f94 → 0.1.0-staging.ba3f279

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 (580) 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 +5 -5
  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/ai/src/lib/generateExecutionFlows.ts +0 -33
  12. package/analyzer-template/packages/analyze/index.ts +4 -1
  13. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +28 -2
  14. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -36
  15. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +10 -6
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +9 -12
  17. package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
  18. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +82 -10
  19. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +4 -0
  20. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +4 -0
  21. package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
  22. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +239 -58
  23. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
  24. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1684 -1462
  25. package/analyzer-template/packages/aws/package.json +2 -2
  26. package/analyzer-template/packages/database/package.json +2 -2
  27. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +102 -0
  28. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
  29. package/analyzer-template/packages/database/src/lib/loadEntities.ts +0 -6
  30. package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
  31. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +0 -65
  32. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +9 -0
  33. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -1
  34. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +104 -0
  35. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  36. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  37. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +7 -1
  38. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  39. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  40. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +0 -6
  41. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  42. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
  43. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
  44. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
  45. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
  46. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  47. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +0 -25
  48. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  49. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  50. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  51. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
  52. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js.map +1 -1
  53. package/analyzer-template/packages/types/src/enums/ProjectFramework.ts +2 -0
  54. package/analyzer-template/packages/ui-components/package.json +1 -1
  55. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  56. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  57. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
  58. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
  59. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
  60. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  61. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
  62. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  63. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
  64. package/analyzer-template/project/analyzeFileEntities.ts +26 -0
  65. package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
  66. package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
  67. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  68. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
  69. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  70. package/codeyam-cli/src/cli.js +24 -0
  71. package/codeyam-cli/src/cli.js.map +1 -1
  72. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
  73. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
  74. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
  75. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
  76. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
  77. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
  78. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js +51 -0
  79. package/codeyam-cli/src/commands/__tests__/editor.isolateArgs.test.js.map +1 -0
  80. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js +55 -0
  81. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js.map +1 -0
  82. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +56 -0
  83. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
  84. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
  85. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  86. package/codeyam-cli/src/commands/editor.js +4623 -678
  87. package/codeyam-cli/src/commands/editor.js.map +1 -1
  88. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
  89. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
  90. package/codeyam-cli/src/commands/editorIsolateArgs.js +25 -0
  91. package/codeyam-cli/src/commands/editorIsolateArgs.js.map +1 -0
  92. package/codeyam-cli/src/commands/init.js +69 -34
  93. package/codeyam-cli/src/commands/init.js.map +1 -1
  94. package/codeyam-cli/src/commands/telemetry.js +37 -0
  95. package/codeyam-cli/src/commands/telemetry.js.map +1 -0
  96. package/codeyam-cli/src/data/designSystems.js +27 -0
  97. package/codeyam-cli/src/data/designSystems.js.map +1 -0
  98. package/codeyam-cli/src/data/techStacks.js +77 -0
  99. package/codeyam-cli/src/data/techStacks.js.map +1 -0
  100. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
  101. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
  102. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
  103. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
  104. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  105. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  106. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +181 -0
  107. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  108. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +3545 -1
  109. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  110. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js +76 -0
  111. package/codeyam-cli/src/utils/__tests__/editorBroadcastViewport.test.js.map +1 -0
  112. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  113. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  114. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js +137 -0
  115. package/codeyam-cli/src/utils/__tests__/editorCaptureScenarioSeeding.test.js.map +1 -0
  116. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js +100 -0
  117. package/codeyam-cli/src/utils/__tests__/editorDeleteScenario.test.js.map +1 -0
  118. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +181 -3
  119. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -1
  120. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +194 -0
  121. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  122. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +381 -0
  123. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -0
  124. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
  125. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
  126. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  127. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  128. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +238 -2
  129. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -1
  130. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +594 -0
  131. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  132. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js +435 -0
  133. package/codeyam-cli/src/utils/__tests__/editorMigration.test.js.map +1 -0
  134. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +118 -1
  135. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -1
  136. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +217 -3
  137. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
  138. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +153 -0
  139. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -0
  140. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  141. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  142. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +411 -0
  143. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  144. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1665 -2
  145. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  146. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +413 -0
  147. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  148. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js +143 -0
  149. package/codeyam-cli/src/utils/__tests__/editorSeedAdapterPrismaValidation.test.js.map +1 -0
  150. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js +66 -0
  151. package/codeyam-cli/src/utils/__tests__/editorSessionFilter.test.js.map +1 -0
  152. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js +53 -0
  153. package/codeyam-cli/src/utils/__tests__/editorShouldRevalidate.test.js.map +1 -0
  154. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +905 -1
  155. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  156. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js +177 -0
  157. package/codeyam-cli/src/utils/__tests__/glossaryAdd.test.js.map +1 -0
  158. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +122 -0
  159. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  160. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
  161. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
  162. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +129 -0
  163. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  164. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
  165. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
  166. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js +118 -0
  167. package/codeyam-cli/src/utils/__tests__/routePatternMatching.test.js.map +1 -0
  168. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +284 -0
  169. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  170. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +672 -0
  171. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  172. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
  173. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
  174. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +26 -5
  175. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  176. package/codeyam-cli/src/utils/__tests__/telemetry.test.js +159 -0
  177. package/codeyam-cli/src/utils/__tests__/telemetry.test.js.map +1 -0
  178. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +51 -0
  179. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  180. package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
  181. package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
  182. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +148 -0
  183. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
  184. package/codeyam-cli/src/utils/analysisRunner.js +39 -8
  185. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  186. package/codeyam-cli/src/utils/analyzer.js +19 -0
  187. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  188. package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
  189. package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
  190. package/codeyam-cli/src/utils/backgroundServer.js +93 -17
  191. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  192. package/codeyam-cli/src/utils/database.js +37 -2
  193. package/codeyam-cli/src/utils/database.js.map +1 -1
  194. package/codeyam-cli/src/utils/devServerState.js +71 -0
  195. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  196. package/codeyam-cli/src/utils/editorApi.js +95 -0
  197. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  198. package/codeyam-cli/src/utils/editorAudit.js +732 -10
  199. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  200. package/codeyam-cli/src/utils/editorBroadcastViewport.js +26 -0
  201. package/codeyam-cli/src/utils/editorBroadcastViewport.js.map +1 -0
  202. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  203. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  204. package/codeyam-cli/src/utils/editorDeleteScenario.js +67 -0
  205. package/codeyam-cli/src/utils/editorDeleteScenario.js.map +1 -0
  206. package/codeyam-cli/src/utils/editorDevServer.js +100 -1
  207. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -1
  208. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +50 -0
  209. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  210. package/codeyam-cli/src/utils/editorEntityHelpers.js +144 -0
  211. package/codeyam-cli/src/utils/editorEntityHelpers.js.map +1 -0
  212. package/codeyam-cli/src/utils/editorGuard.js +36 -0
  213. package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
  214. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  215. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  216. package/codeyam-cli/src/utils/editorJournal.js +85 -4
  217. package/codeyam-cli/src/utils/editorJournal.js.map +1 -1
  218. package/codeyam-cli/src/utils/editorLoaderHelpers.js +152 -0
  219. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  220. package/codeyam-cli/src/utils/editorMigration.js +224 -0
  221. package/codeyam-cli/src/utils/editorMigration.js.map +1 -0
  222. package/codeyam-cli/src/utils/editorMockState.js +1 -1
  223. package/codeyam-cli/src/utils/editorPreloadHelpers.js +72 -1
  224. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -1
  225. package/codeyam-cli/src/utils/editorPreview.js +74 -1
  226. package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
  227. package/codeyam-cli/src/utils/editorRecapture.js +109 -0
  228. package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
  229. package/codeyam-cli/src/utils/editorScenarioSwitch.js +149 -0
  230. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  231. package/codeyam-cli/src/utils/editorScenarios.js +621 -0
  232. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  233. package/codeyam-cli/src/utils/editorSeedAdapter.js +475 -0
  234. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  235. package/codeyam-cli/src/utils/editorShouldRevalidate.js +21 -0
  236. package/codeyam-cli/src/utils/editorShouldRevalidate.js.map +1 -0
  237. package/codeyam-cli/src/utils/entityChangeStatus.js +143 -4
  238. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  239. package/codeyam-cli/src/utils/entityChangeStatus.server.js +227 -0
  240. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  241. package/codeyam-cli/src/utils/fileWatcher.js +38 -0
  242. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  243. package/codeyam-cli/src/utils/glossaryAdd.js +74 -0
  244. package/codeyam-cli/src/utils/glossaryAdd.js.map +1 -0
  245. package/codeyam-cli/src/utils/install-skills.js +14 -0
  246. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  247. package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
  248. package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
  249. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  250. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  251. package/codeyam-cli/src/utils/progress.js +2 -2
  252. package/codeyam-cli/src/utils/progress.js.map +1 -1
  253. package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js +159 -0
  254. package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
  255. package/codeyam-cli/src/utils/queue/job.js +35 -6
  256. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  257. package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
  258. package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
  259. package/codeyam-cli/src/utils/routePatternMatching.js +129 -0
  260. package/codeyam-cli/src/utils/routePatternMatching.js.map +1 -0
  261. package/codeyam-cli/src/utils/scenarioCoverage.js +77 -0
  262. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  263. package/codeyam-cli/src/utils/scenariosManifest.js +313 -0
  264. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  265. package/codeyam-cli/src/utils/screenshotHash.js +26 -0
  266. package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
  267. package/codeyam-cli/src/utils/serverState.js +30 -0
  268. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  269. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +42 -15
  270. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  271. package/codeyam-cli/src/utils/simulationGateMiddleware.js +17 -1
  272. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
  273. package/codeyam-cli/src/utils/slugUtils.js +25 -0
  274. package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
  275. package/codeyam-cli/src/utils/syncMocksMiddleware.js +2 -2
  276. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  277. package/codeyam-cli/src/utils/telemetry.js +106 -0
  278. package/codeyam-cli/src/utils/telemetry.js.map +1 -0
  279. package/codeyam-cli/src/utils/telemetryMiddleware.js +22 -0
  280. package/codeyam-cli/src/utils/telemetryMiddleware.js.map +1 -0
  281. package/codeyam-cli/src/utils/testResultCache.js +53 -0
  282. package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
  283. package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
  284. package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
  285. package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
  286. package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
  287. package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
  288. package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
  289. package/codeyam-cli/src/utils/testRunner.js +193 -1
  290. package/codeyam-cli/src/utils/testRunner.js.map +1 -1
  291. package/codeyam-cli/src/utils/webappDetection.js +25 -2
  292. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  293. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +98 -0
  294. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
  295. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +35 -0
  296. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -0
  297. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +107 -0
  298. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  299. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +647 -0
  300. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
  301. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +315 -0
  302. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
  303. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
  304. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
  305. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +86 -0
  306. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  307. package/codeyam-cli/src/webserver/app/lib/git.js +397 -0
  308. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  309. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
  310. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
  311. package/codeyam-cli/src/webserver/app/types/editor.js +8 -0
  312. package/codeyam-cli/src/webserver/app/types/editor.js.map +1 -0
  313. package/codeyam-cli/src/webserver/backgroundServer.js +60 -61
  314. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  315. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-CLe80MMu.js +1 -0
  316. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-C76mRRiF.js → EntityItem-Crt_KN_U.js} +5 -5
  317. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-CQgyEGV-.js +1 -0
  318. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CobE682z.js → EntityTypeIcon-CD7lGABo.js} +9 -9
  319. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-CgTNOhnu.js +1 -0
  320. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DtYTSPL2.js +25 -0
  321. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-D3s1MFkb.js +3 -0
  322. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-BU_OAEMP.js → LoadingDots-By5zI316.js} +1 -1
  323. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-ceAyBX-H.js → LogViewer-CM5zg40N.js} +3 -3
  324. package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-CQENLSrF.js +36 -0
  325. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-djPLI-WV.js → ReportIssueModal-C2PLkej3.js} +4 -4
  326. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-DanvyBPb.js +1 -0
  327. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-B76aig_2.js → ScenarioViewer-CefgqbCr.js} +3 -3
  328. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bc8BG-Lw.js +34 -0
  329. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-CK7-NaPZ.js +1 -0
  330. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-BA_Ry-rs.js +1 -0
  331. package/codeyam-cli/src/webserver/build/client/assets/{_index-C96V0n15.js → _index-C1YkzTAV.js} +4 -4
  332. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BpKzcsJz.js → activity.(_tab)-yH46LLUz.js} +8 -8
  333. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  334. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  335. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-Duc5hnl7.js → addon-web-links-CHx25PAe.js} +1 -1
  336. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  337. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-D9hemwl6.js → agent-transcripts-Bg3e7q4S.js} +7 -7
  338. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  339. package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
  340. package/codeyam-cli/src/webserver/build/client/assets/api.editor-rename-scenario-l0sNRNKZ.js +1 -0
  341. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
  342. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-seed-state-l0sNRNKZ.js +1 -0
  343. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  344. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-prompt-l0sNRNKZ.js +1 -0
  345. package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
  346. package/codeyam-cli/src/webserver/build/client/assets/api.editor-session-l0sNRNKZ.js +1 -0
  347. package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
  348. package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
  349. package/codeyam-cli/src/webserver/build/client/assets/{book-open-D_nMCFmP.js → book-open-CL-lMgHh.js} +2 -2
  350. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BH2h1Ea2.js → chevron-down-GmAjGS9-.js} +2 -2
  351. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +43 -0
  352. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-DyIKORY6.js → circle-check-DFcQkN5j.js} +2 -2
  353. package/codeyam-cli/src/webserver/build/client/assets/{copy-NDbZjXao.js → copy-C6iF61Xs.js} +3 -3
  354. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-4ImjHTVC.js +41 -0
  355. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
  356. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
  357. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-CRepiabR.js +1 -0
  358. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-Gbk_i5Js.js +1 -0
  359. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-CRxPi2BB.js +96 -0
  360. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CluPkvXJ.js +41 -0
  361. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-CrjR3zZW.js → entity._sha._-DYJRGiDI.js} +14 -13
  362. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-wdiwx5-Z.js +6 -0
  363. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-BrkN-40Y.js +6 -0
  364. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DxfhekTZ.js +6 -0
  365. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BMvVHNXU.js → entity._sha_.edit._scenarioId-CRXJWmpB.js} +2 -2
  366. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DTvKq3TY.js → entry.client-SuW9syRS.js} +6 -6
  367. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-Daa96Fr1.js +1 -0
  368. package/codeyam-cli/src/webserver/build/client/assets/files-D-xGrg29.js +1 -0
  369. package/codeyam-cli/src/webserver/build/client/assets/git-Bq_fbXP5.js +1 -0
  370. package/codeyam-cli/src/webserver/build/client/assets/globals-BsGHu8WX.css +1 -0
  371. package/codeyam-cli/src/webserver/build/client/assets/{index-BcvgDzbZ.js → index-Bp1l4hSv.js} +1 -1
  372. package/codeyam-cli/src/webserver/build/client/assets/{index-10oVnAAH.js → index-CWV9XZiG.js} +1 -1
  373. package/codeyam-cli/src/webserver/build/client/assets/{index-yHOVb4rc.js → index-DE3jI_dv.js} +1 -1
  374. package/codeyam-cli/src/webserver/build/client/assets/jsx-runtime-D_zvdyIk.js +9 -0
  375. package/codeyam-cli/src/webserver/build/client/assets/labs-B_IX45ih.js +1 -0
  376. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BAXYRVEO.js → loader-circle-De-7qQ2u.js} +2 -2
  377. package/codeyam-cli/src/webserver/build/client/assets/manifest-9032538f.js +1 -0
  378. package/codeyam-cli/src/webserver/build/client/assets/memory-Cx2xEx7s.js +101 -0
  379. package/codeyam-cli/src/webserver/build/client/assets/{pause-DTAcYxBt.js → pause-CFxEKL1u.js} +3 -3
  380. package/codeyam-cli/src/webserver/build/client/assets/root-dKFRTYcy.js +80 -0
  381. package/codeyam-cli/src/webserver/build/client/assets/{search-fKo7v0Zo.js → search-BdBb5aqc.js} +2 -2
  382. package/codeyam-cli/src/webserver/build/client/assets/settings-DdE-Untf.js +1 -0
  383. package/codeyam-cli/src/webserver/build/client/assets/simulations-DSCdE99u.js +1 -0
  384. package/codeyam-cli/src/webserver/build/client/assets/{terminal-BG4heKCG.js → terminal-CrplD4b1.js} +3 -3
  385. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-DtSmdtM4.js → triangle-alert-DqJ0j69l.js} +2 -2
  386. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-DhXHbEjP.js +1 -0
  387. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-D9QZKaLJ.js +2 -0
  388. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-Cy5Qg_UR.js +1 -0
  389. package/codeyam-cli/src/webserver/build/client/assets/useToast-5HR2j9ZE.js +1 -0
  390. package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
  391. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-OLsM110H.js +16 -0
  392. package/codeyam-cli/src/webserver/build/server/assets/index-WHdB6WTN.js +1 -0
  393. package/codeyam-cli/src/webserver/build/server/assets/init-DbSiZoE6.js +10 -0
  394. package/codeyam-cli/src/webserver/build/server/assets/progress-CHTtrxFG.js +1 -0
  395. package/codeyam-cli/src/webserver/build/server/assets/server-build-DZbLY6O_.js +690 -0
  396. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  397. package/codeyam-cli/src/webserver/build-info.json +5 -5
  398. package/codeyam-cli/src/webserver/editorProxy.js +638 -50
  399. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  400. package/codeyam-cli/src/webserver/idleDetector.js +130 -0
  401. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
  402. package/codeyam-cli/src/webserver/mockStateEvents.js +28 -0
  403. package/codeyam-cli/src/webserver/mockStateEvents.js.map +1 -0
  404. package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
  405. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +242 -3
  406. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +147 -4
  407. package/codeyam-cli/src/webserver/server.js +153 -26
  408. package/codeyam-cli/src/webserver/server.js.map +1 -1
  409. package/codeyam-cli/src/webserver/terminalServer.js +305 -51
  410. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  411. package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
  412. package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
  413. package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
  414. package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
  415. package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
  416. package/codeyam-cli/templates/chrome-extension-react/package.json +27 -0
  417. package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
  418. package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
  419. package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
  420. package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
  421. package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
  422. package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
  423. package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
  424. package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
  425. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +41 -0
  426. package/codeyam-cli/templates/codeyam-editor-claude.md +86 -5
  427. package/codeyam-cli/templates/codeyam-editor-reference.md +216 -0
  428. package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
  429. package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
  430. package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
  431. package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
  432. package/codeyam-cli/templates/editor-step-hook.py +219 -45
  433. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +288 -0
  434. package/codeyam-cli/templates/expo-react-native/README.md +41 -0
  435. package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
  436. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +15 -0
  437. package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
  438. package/codeyam-cli/templates/expo-react-native/app.json +29 -0
  439. package/codeyam-cli/templates/expo-react-native/babel.config.js +10 -0
  440. package/codeyam-cli/templates/expo-react-native/gitignore +14 -0
  441. package/codeyam-cli/templates/expo-react-native/global.css +10 -0
  442. package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
  443. package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
  444. package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
  445. package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
  446. package/codeyam-cli/templates/expo-react-native/package.json +54 -0
  447. package/codeyam-cli/templates/expo-react-native/patches/expo-modules-autolinking+3.0.24.patch +29 -0
  448. package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
  449. package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
  450. package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
  451. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_PATTERNS.md +308 -0
  452. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
  453. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +126 -0
  454. package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
  455. package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
  456. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  457. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +9 -4
  458. package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -0
  459. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +21 -0
  460. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +6 -2
  461. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +4 -1
  462. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +140 -0
  463. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  464. package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
  465. package/codeyam-cli/templates/{nextjs-prisma-sqlite/PRISMA_SETUP.md → nextjs-prisma-supabase/SUPABASE_SETUP.md} +37 -17
  466. package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
  467. package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
  468. package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
  469. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
  470. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
  471. package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
  472. package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
  473. package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
  474. package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
  475. package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
  476. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +37 -0
  477. package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
  478. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
  479. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
  480. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
  481. package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -0
  482. package/codeyam-cli/templates/seed-adapters/supabase.ts +374 -0
  483. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +2 -2
  484. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +183 -13
  485. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +0 -0
  486. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +0 -0
  487. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +0 -0
  488. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +0 -0
  489. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +0 -0
  490. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +0 -0
  491. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +0 -0
  492. package/package.json +7 -1
  493. package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
  494. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  495. package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
  496. package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
  497. package/packages/ai/src/lib/astScopes/paths.js +12 -3
  498. package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
  499. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
  500. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  501. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
  502. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
  503. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
  504. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  505. package/packages/ai/src/lib/generateExecutionFlows.js +0 -11
  506. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  507. package/packages/analyze/index.js +1 -1
  508. package/packages/analyze/index.js.map +1 -1
  509. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
  510. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  511. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
  512. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  513. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
  514. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  515. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
  516. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  517. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
  518. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
  519. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
  520. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  521. package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
  522. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  523. package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
  524. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  525. package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
  526. package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
  527. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
  528. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  529. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
  530. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  531. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
  532. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  533. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +104 -0
  534. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -1
  535. package/packages/database/src/lib/loadAnalysis.js +7 -1
  536. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  537. package/packages/database/src/lib/loadEntities.js +0 -6
  538. package/packages/database/src/lib/loadEntities.js.map +1 -1
  539. package/packages/database/src/lib/loadEntity.js +5 -5
  540. package/packages/database/src/lib/loadEntity.js.map +1 -1
  541. package/packages/database/src/lib/updateCommitMetadata.js +0 -25
  542. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  543. package/packages/types/src/enums/ProjectFramework.js +2 -0
  544. package/packages/types/src/enums/ProjectFramework.js.map +1 -1
  545. package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
  546. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  547. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-DmJveP3T.js +0 -1
  548. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeBadge-g3saevPb.js +0 -1
  549. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +0 -1
  550. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-DYFW3lDD.js +0 -25
  551. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DLeucoVX.js +0 -3
  552. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BED4B6sP.js +0 -1
  553. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +0 -34
  554. package/codeyam-cli/src/webserver/build/client/assets/Terminal-nZNBALox.js +0 -41
  555. package/codeyam-cli/src/webserver/build/client/assets/TruncatedFilePath-C8OKAR5x.js +0 -1
  556. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-CUXOrorO.js +0 -1
  557. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-C4pqxYJB.js +0 -51
  558. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CMT1jU2q.js +0 -21
  559. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
  560. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BiM6z3Do.js +0 -1
  561. package/codeyam-cli/src/webserver/build/client/assets/editor-DTwKl1Xu.js +0 -10
  562. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-DjACbfdI.js +0 -6
  563. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C28BiQzt.js +0 -6
  564. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +0 -6
  565. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-cPo8LiG3.js +0 -1
  566. package/codeyam-cli/src/webserver/build/client/assets/files-DO4CZ16O.js +0 -1
  567. package/codeyam-cli/src/webserver/build/client/assets/git-CdN8sCqs.js +0 -1
  568. package/codeyam-cli/src/webserver/build/client/assets/globals-h1-1oFYI.css +0 -1
  569. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +0 -1
  570. package/codeyam-cli/src/webserver/build/client/assets/manifest-9422aeab.js +0 -1
  571. package/codeyam-cli/src/webserver/build/client/assets/memory-Dg0mvYrI.js +0 -96
  572. package/codeyam-cli/src/webserver/build/client/assets/root-BzQgN2ff.js +0 -67
  573. package/codeyam-cli/src/webserver/build/client/assets/settings-DfuTtcJP.js +0 -1
  574. package/codeyam-cli/src/webserver/build/client/assets/simulations-B3aOzpCZ.js +0 -1
  575. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-ByhSyh0W.js +0 -1
  576. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +0 -2
  577. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-O-jkvSPx.js +0 -1
  578. package/codeyam-cli/src/webserver/build/client/assets/useToast-9FIWuYfK.js +0 -1
  579. package/codeyam-cli/src/webserver/build/server/assets/index-Bh_pNxNA.js +0 -1
  580. package/codeyam-cli/src/webserver/build/server/assets/server-build-Bqr22tlO.js +0 -367
@@ -4,16 +4,34 @@
4
4
  * Cross-references glossary entries against registered scenarios (components)
5
5
  * and test files (functions) to detect gaps Claude may have missed.
6
6
  */
7
+ import { isIsolationUrl, scenarioEntityName, } from "./entityChangeStatus.js";
7
8
  // ─── Logic ───────────────────────────────────────────────────────────
8
9
  const COMPONENT_RETURN_PATTERNS = ['JSX', 'React', 'Element', 'ReactNode'];
10
+ /** File names that indicate page/route files — these are visual components
11
+ * verified via screenshots, not functions that need unit tests. */
12
+ const PAGE_FILE_NAMES = new Set([
13
+ 'page.tsx',
14
+ 'page.ts',
15
+ 'index.tsx',
16
+ 'index.ts',
17
+ ]);
9
18
  /**
10
- * Returns true when the entry's returnType indicates a React component
11
- * (contains "JSX", "React", "Element", or "ReactNode").
19
+ * Returns true when the entry represents a visual component (needs scenarios,
20
+ * not unit tests). Matches on returnType containing JSX/React patterns, OR
21
+ * on file path patterns for page/route files.
12
22
  */
13
23
  export function isComponent(entry) {
14
- if (!entry.returnType)
15
- return false;
16
- return COMPONENT_RETURN_PATTERNS.some((pat) => entry.returnType.includes(pat));
24
+ if (entry.returnType &&
25
+ COMPONENT_RETURN_PATTERNS.some((pat) => entry.returnType.includes(pat))) {
26
+ return true;
27
+ }
28
+ // Page/route files are visual components — verified via app scenarios, not tests
29
+ if (entry.filePath) {
30
+ const fileName = entry.filePath.split('/').pop() || '';
31
+ if (PAGE_FILE_NAMES.has(fileName))
32
+ return true;
33
+ }
34
+ return false;
17
35
  }
18
36
  /**
19
37
  * Split glossary entries into components (JSX-returning) and functions (everything else).
@@ -39,14 +57,62 @@ export function classifyGlossaryEntries(entries) {
39
57
  * @param scenarioCounts - Map of component_name → number of registered scenarios
40
58
  * @param testFileExistence - Map of testFile path → whether the file exists on disk
41
59
  */
42
- export function computeAudit({ components, functions, scenarioCounts, testFileExistence, testResults, }) {
60
+ export function computeAudit({ components, functions, scenarioCounts, testFileExistence, testResults, clientErrors, totalScenarioCounts, entityChangeStatus, analysisFailedEntities, }) {
43
61
  const componentResults = components.map((c) => {
44
62
  const count = scenarioCounts[c.name] || 0;
63
+ const totalCount = totalScenarioCounts?.[c.name] || 0;
64
+ const changeStatus = entityChangeStatus?.[c.name];
65
+ const errors = clientErrors?.[c.name];
66
+ const hasErrors = count > 0 && errors && errors.length > 0;
67
+ let status;
68
+ if (analysisFailedEntities?.has(c.name)) {
69
+ status = 'analysis_failed';
70
+ }
71
+ else if (count === 0) {
72
+ // Entities with existing scenarios from prior sessions don't need
73
+ // new scenarios — they need recapture. This applies to both "edited"
74
+ // and "impacted" entities: an edited page may not have been re-registered
75
+ // this session, and an impacted page's dependency changed.
76
+ if (changeStatus && totalCount > 0) {
77
+ status = 'needs_recapture';
78
+ }
79
+ else {
80
+ status = 'missing';
81
+ }
82
+ }
83
+ else if (hasErrors) {
84
+ status = 'has_errors';
85
+ }
86
+ else {
87
+ status = 'ok';
88
+ }
89
+ // Generate actionable hint for missing or needs_recapture components
90
+ let hint;
91
+ if (status === 'missing') {
92
+ const fileName = c.filePath.split('/').pop() || '';
93
+ if (fileName === 'layout.tsx' || fileName === 'layout.ts') {
94
+ hint = `This is a layout file — register an app-level scenario with pageFilePath instead of componentName: codeyam editor register '{"name":"${c.name} - Default","pageFilePath":"${c.filePath}","url":"/<route>","dimensions":["Desktop"]}'`;
95
+ }
96
+ else if (fileName === 'page.tsx' || fileName === 'page.ts') {
97
+ hint = `This is a page file — register an app-level scenario with pageFilePath: codeyam editor register '{"name":"${c.name} - Default","pageFilePath":"${c.filePath}","url":"/<route>","dimensions":["Desktop"]}'`;
98
+ }
99
+ else {
100
+ hint = `Register a component scenario via an isolation route: codeyam editor isolate ${c.name} then codeyam editor register '{"name":"${c.name} - Default","componentName":"${c.name}","url":"/isolated-components/${c.name}?s=Default","dimensions":["Desktop"]}'`;
101
+ }
102
+ }
103
+ else if (status === 'needs_recapture') {
104
+ hint = `This component's code or dependencies changed — recapture existing scenarios to update screenshots: codeyam editor recapture ${c.name}`;
105
+ }
106
+ else if (status === 'analysis_failed') {
107
+ hint = `Analysis failed for this component (likely timed out due to complex dependencies). The component has partial data but may be missing some dependency schemas. Try re-analyzing: codeyam editor analyze-imports`;
108
+ }
45
109
  return {
46
110
  name: c.name,
47
111
  filePath: c.filePath,
48
- scenarioCount: count,
49
- status: count > 0 ? 'ok' : 'missing',
112
+ scenarioCount: status === 'needs_recapture' ? totalCount : count,
113
+ status,
114
+ ...(hasErrors ? { clientErrors: errors } : {}),
115
+ ...(hint ? { hint } : {}),
50
116
  };
51
117
  });
52
118
  const functionResults = functions.map((f) => {
@@ -54,12 +120,17 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
54
120
  ? (testFileExistence[f.testFile] ?? false)
55
121
  : false;
56
122
  if (!exists) {
123
+ // Suggest conventional test file path when testFile isn't in the glossary
124
+ const suggestedTestFile = !f.testFile
125
+ ? f.filePath.replace(/\.tsx?$/, '.test.ts')
126
+ : undefined;
57
127
  return {
58
128
  name: f.name,
59
129
  filePath: f.filePath,
60
130
  testFile: f.testFile,
61
131
  testFileExists: false,
62
132
  status: 'missing',
133
+ ...(suggestedTestFile ? { suggestedTestFile } : {}),
63
134
  };
64
135
  }
65
136
  // If we have test results for this file, use them for deeper status
@@ -75,7 +146,10 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
75
146
  };
76
147
  }
77
148
  let status;
78
- if (!tr.passing) {
149
+ if (!tr.passing && tr.errorMessage) {
150
+ status = 'runner_error';
151
+ }
152
+ else if (!tr.passing) {
79
153
  status = 'failing';
80
154
  }
81
155
  else if (!tr.hasEntityNameDescribe) {
@@ -84,6 +158,14 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
84
158
  else {
85
159
  status = 'ok';
86
160
  }
161
+ // Generate actionable hint for non-ok functions
162
+ let hint;
163
+ if (status === 'name_mismatch') {
164
+ hint = `Tests pass but won't show in the CodeYam UI. Add a top-level describe("${f.name}", ...) block in ${f.testFile}`;
165
+ }
166
+ else if (status === 'runner_error' && tr.errorMessage) {
167
+ hint = `Test runner crashed (not a test failure): ${tr.errorMessage}`;
168
+ }
87
169
  return {
88
170
  name: f.name,
89
171
  filePath: f.filePath,
@@ -92,12 +174,18 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
92
174
  testsPassing: tr.passing,
93
175
  testsVisibleInUi: tr.hasEntityNameDescribe,
94
176
  status,
177
+ ...(tr.errorMessage ? { errorMessage: tr.errorMessage } : {}),
178
+ ...(hint ? { hint } : {}),
95
179
  };
96
180
  });
97
181
  const componentsOk = componentResults.filter((c) => c.status === 'ok').length;
98
- const componentsMissing = componentResults.length - componentsOk;
182
+ const componentsWithErrors = componentResults.filter((c) => c.status === 'has_errors').length;
183
+ const componentsMissing = componentResults.filter((c) => c.status === 'missing').length;
184
+ const componentsNeedingRecapture = componentResults.filter((c) => c.status === 'needs_recapture').length;
185
+ const componentsAnalysisFailed = componentResults.filter((c) => c.status === 'analysis_failed').length;
99
186
  const functionsOk = functionResults.filter((f) => f.status === 'ok').length;
100
187
  const functionsFailing = functionResults.filter((f) => f.status === 'failing').length;
188
+ const functionsRunnerError = functionResults.filter((f) => f.status === 'runner_error').length;
101
189
  const functionsNameMismatch = functionResults.filter((f) => f.status === 'name_mismatch').length;
102
190
  const functionsMissing = functionResults.filter((f) => f.status === 'missing').length;
103
191
  return {
@@ -107,16 +195,650 @@ export function computeAudit({ components, functions, scenarioCounts, testFileEx
107
195
  totalComponents: componentResults.length,
108
196
  componentsOk,
109
197
  componentsMissing,
198
+ componentsWithErrors,
199
+ componentsNeedingRecapture,
200
+ componentsAnalysisFailed,
110
201
  totalFunctions: functionResults.length,
111
202
  functionsOk,
112
203
  functionsMissing,
113
204
  functionsFailing,
205
+ functionsRunnerError,
114
206
  functionsNameMismatch,
115
207
  allPassing: componentsMissing === 0 &&
208
+ componentsWithErrors === 0 &&
209
+ componentsAnalysisFailed === 0 &&
116
210
  functionsFailing === 0 &&
211
+ functionsRunnerError === 0 &&
117
212
  functionsNameMismatch === 0 &&
118
213
  functionsMissing === 0,
119
214
  },
120
215
  };
121
216
  }
217
+ /**
218
+ * Returns true when the audit failure can be auto-fixed inline.
219
+ *
220
+ * Always returns false — full analyze-imports takes minutes on large projects
221
+ * and must never run as part of the audit. The audit only does lightweight
222
+ * entity SHA backfill. Users should run `codeyam editor analyze-imports`
223
+ * separately if incomplete entities persist.
224
+ */
225
+ export function isAutoRemediable(_summary, _alreadyAttempted) {
226
+ return false;
227
+ }
228
+ /**
229
+ * Determine whether the audit should auto-recapture stale scenarios.
230
+ * Returns true when the `--fix` flag is set AND there are stale scenarios.
231
+ */
232
+ export function shouldAutoRecapture(params) {
233
+ return params.fix && params.scenariosNeedingRecapture.length > 0;
234
+ }
235
+ /**
236
+ * Extract unique file paths that need targeted analysis from audit results.
237
+ *
238
+ * After a DB-only backfill attempt fails, these are the files that need
239
+ * `analyze-imports` to create entity records. Unlike full analyze-imports
240
+ * (which scans ALL glossary + page files), this returns only the specific
241
+ * files that have unresolved associations — typically 1-3 files.
242
+ */
243
+ export function determineTargetedAnalysisPaths(auditData) {
244
+ const paths = new Set();
245
+ for (const u of auditData.unassociatedScenarios) {
246
+ if (u.filePath)
247
+ paths.add(u.filePath);
248
+ }
249
+ for (const e of auditData.incompleteEntities) {
250
+ if (e.filePath)
251
+ paths.add(e.filePath);
252
+ }
253
+ return [...paths];
254
+ }
255
+ /**
256
+ * Generate clear, actionable guidance for an incomplete entity.
257
+ *
258
+ * Tells Claude exactly what's wrong, whether it's pre-existing, and
259
+ * the exact command to fix it — no guessing required.
260
+ */
261
+ export function formatIncompleteEntityGuidance(entity) {
262
+ const parts = [];
263
+ if (entity.preExisting) {
264
+ parts.push(`${entity.name}: ${entity.scenarioCount} scenario(s) without import graph (pre-existing issue, not from this session).`);
265
+ parts.push(`This is non-blocking — the entity had scenarios before this session but analyze-imports was never run for it.`);
266
+ }
267
+ else {
268
+ parts.push(`${entity.name}: ${entity.scenarioCount} scenario(s) without import graph — analyze-imports has not been run for this entity.`);
269
+ parts.push(`The entity has scenarios registered but its import graph is not built, so the editor cannot track its dependencies.`);
270
+ }
271
+ parts.push(`Fix: Run \`codeyam editor analyze-imports\` to build the import graph for all entities.`);
272
+ return parts.join(' ');
273
+ }
274
+ /**
275
+ * Generate step-by-step manual analysis instructions for an entity
276
+ * whose automated analysis has persistently failed.
277
+ *
278
+ * Used by the audit when analysis-failures.json contains the entity.
279
+ * Tells Claude exactly how to read the source, gather imports/types,
280
+ * and run `codeyam editor manual-entity` to unblock the audit.
281
+ */
282
+ export function formatManualAnalysisGuidance(entity) {
283
+ const lines = [];
284
+ lines.push(`${entity.name}: ${entity.scenarioCount} scenario(s) — automated analysis failed`);
285
+ lines.push(`Error: ${entity.error}`);
286
+ lines.push('');
287
+ lines.push('MANUAL ANALYSIS REQUIRED — follow these steps:');
288
+ lines.push(`1. Read ${entity.filePath}`);
289
+ lines.push('2. Identify which glossary entities it imports (check .codeyam/glossary.json)');
290
+ lines.push('3. Determine entity type: "visual" if it returns JSX, "library" otherwise');
291
+ lines.push('4. Identify the type structure:');
292
+ lines.push(' - For components: props interface and hook return types');
293
+ lines.push(' - For functions: parameter types and return type');
294
+ lines.push(`5. Write the JSON to .codeyam/tmp/manual-entity.json then run: codeyam editor manual-entity @.codeyam/tmp/manual-entity.json`);
295
+ return lines.join('\n');
296
+ }
297
+ /**
298
+ * Resolve incomplete entity SHAs to their source file paths.
299
+ *
300
+ * Used by the audit to run targeted analysis on just the files that need it,
301
+ * instead of scanning all 117+ project files. Returns deduplicated file paths.
302
+ */
303
+ export async function getIncompleteEntityFilePaths(db, incompleteEntities) {
304
+ if (incompleteEntities.length === 0)
305
+ return [];
306
+ const shas = incompleteEntities.map((e) => e.entitySha);
307
+ const rows = await db
308
+ .selectFrom('entities')
309
+ .select('file_path')
310
+ .where('sha', 'in', shas)
311
+ .execute();
312
+ const paths = new Set();
313
+ for (const row of rows) {
314
+ if (row.file_path)
315
+ paths.add(row.file_path);
316
+ }
317
+ return [...paths];
318
+ }
319
+ /**
320
+ * Returns true when the only audit failures are auto-fixable entity issues
321
+ * (incompleteEntities and/or unassociatedScenarios) — all other failure
322
+ * counts are zero. Used to decide whether auto-running analyze-imports +
323
+ * entity SHA sync can fix the audit without manual intervention.
324
+ */
325
+ export function isOnlyIncompleteEntities(summary) {
326
+ return ((summary.componentsMissing ?? 0) === 0 &&
327
+ (summary.componentsWithErrors ?? 0) === 0 &&
328
+ (summary.functionsFailing ?? 0) === 0 &&
329
+ (summary.functionsRunnerError ?? 0) === 0 &&
330
+ (summary.functionsNameMismatch ?? 0) === 0 &&
331
+ (summary.functionsMissing ?? 0) === 0 &&
332
+ (summary.missingFromGlossary ?? 0) === 0 &&
333
+ (summary.miscategorizedScenarios ?? 0) === 0 &&
334
+ (summary.scenariosNeedingRecapture ?? 0) === 0);
335
+ }
336
+ /**
337
+ * Returns true when the only audit failures are incomplete entities that ALL
338
+ * existed before the current session. Used by the step gate to avoid blocking
339
+ * progress on pre-existing issues the user didn't cause.
340
+ *
341
+ * Requires both the summary (to confirm no other failure types) and the
342
+ * incompleteEntities array (to verify every entry is pre-existing).
343
+ */
344
+ export function isOnlyPreExistingIncomplete(summary, incompleteEntities) {
345
+ // Must have at least one incomplete entity to be relevant
346
+ if (!incompleteEntities || incompleteEntities.length === 0)
347
+ return false;
348
+ // All other failure types must be zero
349
+ if (!isOnlyIncompleteEntities(summary))
350
+ return false;
351
+ // Every incomplete entity must be pre-existing
352
+ return incompleteEntities.every((e) => e.preExisting);
353
+ }
354
+ /**
355
+ * Filter a list of file paths to only those that need analysis.
356
+ *
357
+ * A file is excluded if ANY entity at that file path has an analysis
358
+ * record (direct or inherited from a sibling version with the same
359
+ * name+filePath). Everything else passes through.
360
+ *
361
+ * Used by handleAnalyzeImports to avoid re-analyzing ~120 files when
362
+ * only a few need it.
363
+ */
364
+ export async function filterToIncompleteFilePaths(db, _projectId, allFilePaths) {
365
+ if (allFilePaths.length === 0)
366
+ return [];
367
+ // Single query: find all file paths that have at least one entity
368
+ // with an analysis record. These are already analyzed and can be skipped.
369
+ const analyzedRows = await db
370
+ .selectFrom('entities')
371
+ .innerJoin('analyses', 'analyses.entity_sha', 'entities.sha')
372
+ .select('entities.file_path')
373
+ .where('entities.file_path', 'in', allFilePaths)
374
+ .groupBy('entities.file_path')
375
+ .execute();
376
+ const analyzedFilePaths = new Set(analyzedRows.map((r) => r.file_path));
377
+ return allFilePaths.filter((fp) => !analyzedFilePaths.has(fp));
378
+ }
379
+ /**
380
+ * Ensures the two audit filters — glossary scoping and scenario-count scoping —
381
+ * are consistent. When entityChangeStatus is empty/undefined (meaning the glossary
382
+ * will fall back to "audit all entries"), we must also drop the featureStartedAt
383
+ * filter so scenario counts include ALL scenarios, not just the current session.
384
+ *
385
+ * Without this, Feature 1 components get audited but their scenarios (created before
386
+ * the current feature session) aren't counted, causing false "no scenarios" failures.
387
+ */
388
+ export function resolveAuditSessionScope({ featureStartedAt, entityChangeStatus, }) {
389
+ const hasChangeStatus = entityChangeStatus && Object.keys(entityChangeStatus).length > 0;
390
+ if (!hasChangeStatus) {
391
+ // Glossary will include all entries — scenario counts must also include all
392
+ return { featureStartedAt: null, entityChangeStatus };
393
+ }
394
+ return { featureStartedAt, entityChangeStatus };
395
+ }
396
+ /**
397
+ * Filter glossary entries to only those whose entities are new, edited, or impacted
398
+ * in the current working session. When entityChangeStatus is empty or undefined,
399
+ * falls back to returning all entries (no filtering).
400
+ *
401
+ * Matches by entity name first, then by filePath as a fallback.
402
+ */
403
+ export function filterGlossaryByChangeStatus(entries, entityChangeStatus) {
404
+ if (!entityChangeStatus || Object.keys(entityChangeStatus).length === 0) {
405
+ return entries;
406
+ }
407
+ return entries.filter((entry) => {
408
+ // Match by entity name
409
+ if (entityChangeStatus[entry.name])
410
+ return true;
411
+ // Match by file path (entity names in changeStatus may be file-path keyed)
412
+ if (entityChangeStatus[entry.filePath])
413
+ return true;
414
+ return false;
415
+ });
416
+ }
417
+ /**
418
+ * Find entities that have scenarios but no analysis records.
419
+ * These entities need `codeyam editor analyze-imports` to run.
420
+ *
421
+ * Optionally scoped to the current feature session via featureStartedAt.
422
+ */
423
+ export async function queryIncompleteEntities(db, projectId, featureStartedAt) {
424
+ // Step 1: Get distinct entity SHAs from scenarios (with counts)
425
+ // No time filter — we check ALL scenarios to catch entities whose
426
+ // scenario SHAs were updated mid-session without touching updated_at.
427
+ const scenarioQuery = db
428
+ .selectFrom('editor_scenarios')
429
+ .select(['entity_sha'])
430
+ .select(db.fn.count('id').as('count'))
431
+ .where('project_id', '=', projectId)
432
+ .where('entity_sha', 'is not', null)
433
+ .groupBy('entity_sha');
434
+ const scenarioRows = await scenarioQuery.execute();
435
+ if (scenarioRows.length === 0)
436
+ return [];
437
+ const scenarioShas = scenarioRows.map((r) => r.entity_sha);
438
+ // Step 2: Get entity SHAs that have analyses
439
+ const analysisRows = await db
440
+ .selectFrom('analyses')
441
+ .select('entity_sha')
442
+ .where('entity_sha', 'in', scenarioShas)
443
+ .groupBy('entity_sha')
444
+ .execute();
445
+ const analyzedShas = new Set(analysisRows.map((r) => r.entity_sha));
446
+ // Step 3: Find scenario entity SHAs without direct analyses
447
+ const incompleteShas = scenarioRows.filter((r) => !analyzedShas.has(r.entity_sha));
448
+ if (incompleteShas.length === 0)
449
+ return [];
450
+ // Step 4: Look up entity names for incomplete SHAs
451
+ const incompleteShalist = incompleteShas.map((r) => r.entity_sha);
452
+ const entityRows = await db
453
+ .selectFrom('entities')
454
+ .select(['sha', 'name', 'file_path'])
455
+ .where('sha', 'in', incompleteShalist)
456
+ .execute();
457
+ const entityNameMap = new Map(entityRows.map((r) => [r.sha, r.name]));
458
+ // Step 4.5: Check for inherited analyses from sibling entity versions.
459
+ // A new entity version (created by the file watcher) may not have direct
460
+ // analyses, but an older version (same name+filePath) might. This matches
461
+ // getAllEntities() behavior which inherits analyses across versions.
462
+ // IMPORTANT: Must match by name+filePath, not name alone. When a component
463
+ // is extracted to a new file, the old version (different filePath) may have
464
+ // analyses but getAllEntities() won't inherit across different file paths.
465
+ const entityFilePathMap = new Map(entityRows.map((r) => [r.sha, r.file_path]));
466
+ const entityKeys = [
467
+ ...new Set(entityRows
468
+ .map((r) => `${r.name}::${r.file_path}`)
469
+ .filter((k) => !k.startsWith('::') && !k.endsWith('::'))),
470
+ ];
471
+ let keysWithInheritedAnalyses = new Set();
472
+ if (entityKeys.length > 0) {
473
+ // We need to find entities that share name+filePath AND have analyses.
474
+ // Since Kysely doesn't support WHERE (name || '::' || file_path) IN (...),
475
+ // query by the entity names and filter by filePath in JS.
476
+ const entityNames = [
477
+ ...new Set(entityRows.map((r) => r.name).filter(Boolean)),
478
+ ];
479
+ const siblingRows = await db
480
+ .selectFrom('entities')
481
+ .innerJoin('analyses', 'analyses.entity_sha', 'entities.sha')
482
+ .select(['entities.name', 'entities.file_path'])
483
+ .where('entities.name', 'in', entityNames)
484
+ .groupBy(['entities.name', 'entities.file_path'])
485
+ .execute();
486
+ keysWithInheritedAnalyses = new Set(siblingRows.map((r) => `${r.name}::${r.file_path}`));
487
+ }
488
+ // Filter out entities that have inherited analyses (same name+filePath)
489
+ const trulyIncompleteShas = incompleteShas.filter((r) => {
490
+ const sha = r.entity_sha;
491
+ const name = entityNameMap.get(sha);
492
+ const filePath = entityFilePathMap.get(sha);
493
+ if (!name)
494
+ return false; // No entity record (phantom SHA) — skip, not fixable by analysis
495
+ const key = `${name}::${filePath}`;
496
+ return !keysWithInheritedAnalyses.has(key);
497
+ });
498
+ if (trulyIncompleteShas.length === 0)
499
+ return [];
500
+ const trulyIncompleteShalist = trulyIncompleteShas.map((r) => r.entity_sha);
501
+ // Step 5: Also get component_name from scenarios as fallback for name
502
+ const scenarioNameRows = await db
503
+ .selectFrom('editor_scenarios')
504
+ .select(['entity_sha', 'component_name'])
505
+ .where('project_id', '=', projectId)
506
+ .where('entity_sha', 'in', trulyIncompleteShalist)
507
+ .where('component_name', 'is not', null)
508
+ .groupBy('entity_sha')
509
+ .execute();
510
+ const scenarioNameMap = new Map(scenarioNameRows.map((r) => [
511
+ r.entity_sha,
512
+ r.component_name,
513
+ ]));
514
+ // Step 6: Determine preExisting flag — if featureStartedAt is provided,
515
+ // check which entity SHAs have at least one scenario created/updated
516
+ // during the session. Those without any are pre-existing issues.
517
+ let sessionShas = new Set();
518
+ if (featureStartedAt) {
519
+ const sqliteTimestamp = featureStartedAt
520
+ .replace('T', ' ')
521
+ .replace(/\.\d{3}Z$/, '');
522
+ const sessionRows = await db
523
+ .selectFrom('editor_scenarios')
524
+ .select('entity_sha')
525
+ .where('project_id', '=', projectId)
526
+ .where('entity_sha', 'in', trulyIncompleteShalist)
527
+ .where((eb) => eb.or([
528
+ eb('created_at', '>=', sqliteTimestamp),
529
+ eb('updated_at', '>=', sqliteTimestamp),
530
+ ]))
531
+ .groupBy('entity_sha')
532
+ .execute();
533
+ sessionShas = new Set(sessionRows.map((r) => r.entity_sha));
534
+ }
535
+ return trulyIncompleteShas.map((r) => {
536
+ const sha = r.entity_sha;
537
+ return {
538
+ entitySha: sha,
539
+ name: entityNameMap.get(sha) || scenarioNameMap.get(sha) || 'Unknown',
540
+ scenarioCount: Number(r.count),
541
+ preExisting: featureStartedAt ? !sessionShas.has(sha) : false,
542
+ };
543
+ });
544
+ }
545
+ /**
546
+ * Find component scenarios that use non-isolation URLs.
547
+ *
548
+ * Component scenarios should always use `/isolated-components/...` URLs.
549
+ * When a component scenario points at a real page URL (e.g., `/library`),
550
+ * it's miscategorized — it should either be an application scenario
551
+ * (no componentName, with pageFilePath) or use an isolation route.
552
+ *
553
+ * Optionally scoped to the current feature session via featureStartedAt.
554
+ */
555
+ export async function queryMiscategorizedScenarios(db, projectId, featureStartedAt) {
556
+ let query = db
557
+ .selectFrom('editor_scenarios')
558
+ .select(['component_name', 'name', 'url'])
559
+ .where('project_id', '=', projectId)
560
+ .where('component_name', 'is not', null)
561
+ .where('url', 'is not', null);
562
+ if (featureStartedAt) {
563
+ const sqliteTimestamp = featureStartedAt
564
+ .replace('T', ' ')
565
+ .replace(/\.\d{3}Z$/, '');
566
+ query = query.where((eb) => eb.or([
567
+ eb('created_at', '>=', sqliteTimestamp),
568
+ eb('updated_at', '>=', sqliteTimestamp),
569
+ ]));
570
+ }
571
+ const rows = await query.execute();
572
+ // Filter to only rows where URL is NOT an isolation route
573
+ const miscategorized = rows.filter((r) => r.url && !isIsolationUrl(r.url));
574
+ if (miscategorized.length === 0)
575
+ return [];
576
+ // Group by (component_name, url)
577
+ const groups = new Map();
578
+ for (const row of miscategorized) {
579
+ const key = `${row.component_name}::${row.url}`;
580
+ const existing = groups.get(key);
581
+ if (existing) {
582
+ existing.scenarioNames.push(row.name);
583
+ }
584
+ else {
585
+ groups.set(key, {
586
+ componentName: row.component_name,
587
+ scenarioNames: [row.name],
588
+ url: row.url,
589
+ });
590
+ }
591
+ }
592
+ return [...groups.values()];
593
+ }
594
+ /**
595
+ * Query scenario counts per component, optionally scoped to the current
596
+ * feature session via featureStartedAt.
597
+ *
598
+ * A scenario belongs to the current session if it was created OR updated
599
+ * after featureStartedAt — re-registering a scenario during a new feature
600
+ * session updates `updated_at` but preserves the original `created_at`.
601
+ */
602
+ export async function queryScenarioCounts(db, projectId, featureStartedAt) {
603
+ let query = db
604
+ .selectFrom('editor_scenarios')
605
+ .select(['component_name'])
606
+ .select(db.fn.count('id').as('count'))
607
+ .where('project_id', '=', projectId)
608
+ .where('component_name', 'is not', null)
609
+ .groupBy('component_name');
610
+ if (featureStartedAt) {
611
+ const sqliteTimestamp = featureStartedAt
612
+ .replace('T', ' ')
613
+ .replace(/\.\d{3}Z$/, '');
614
+ query = query.where((eb) => eb.or([
615
+ eb('created_at', '>=', sqliteTimestamp),
616
+ eb('updated_at', '>=', sqliteTimestamp),
617
+ ]));
618
+ }
619
+ const rows = await query.execute();
620
+ const counts = {};
621
+ for (const row of rows) {
622
+ if (row.component_name) {
623
+ counts[row.component_name] = Number(row.count);
624
+ }
625
+ }
626
+ return counts;
627
+ }
628
+ /**
629
+ * Query scenario counts per page file path for app-level scenarios.
630
+ *
631
+ * App-level scenarios have `component_name = null` and are linked to pages
632
+ * via `page_file_path`. This mirrors `queryScenarioCounts` but groups by
633
+ * `page_file_path` instead of `component_name`.
634
+ */
635
+ export async function queryPageScenarioCounts(db, projectId, featureStartedAt) {
636
+ let query = db
637
+ .selectFrom('editor_scenarios')
638
+ .select(['page_file_path'])
639
+ .select(db.fn.count('id').as('count'))
640
+ .where('project_id', '=', projectId)
641
+ .where('component_name', 'is', null)
642
+ .where('page_file_path', 'is not', null)
643
+ .groupBy('page_file_path');
644
+ if (featureStartedAt) {
645
+ const sqliteTimestamp = featureStartedAt
646
+ .replace('T', ' ')
647
+ .replace(/\.\d{3}Z$/, '');
648
+ query = query.where((eb) => eb.or([
649
+ eb('created_at', '>=', sqliteTimestamp),
650
+ eb('updated_at', '>=', sqliteTimestamp),
651
+ ]));
652
+ }
653
+ const rows = await query.execute();
654
+ const counts = {};
655
+ for (const row of rows) {
656
+ if (row.page_file_path) {
657
+ counts[row.page_file_path] = Number(row.count);
658
+ }
659
+ }
660
+ return counts;
661
+ }
662
+ // ─── Unassociated Scenarios ───────────────────────────────────────────
663
+ /**
664
+ * Find scenarios with NULL entity_sha that have a file path
665
+ * (component_path or page_file_path). These scenarios were registered
666
+ * before entity records existed in the DB — typically because a subagent
667
+ * registered scenarios without running analyze-imports first.
668
+ *
669
+ * Fix: run `codeyam editor analyze-imports` to create entity records,
670
+ * then entity_sha backfill will associate them automatically.
671
+ *
672
+ * Optionally scoped to the current feature session via featureStartedAt.
673
+ */
674
+ export async function queryUnassociatedScenarios(db, projectId, featureStartedAt) {
675
+ let query = db
676
+ .selectFrom('editor_scenarios')
677
+ .select(['component_name', 'component_path', 'page_file_path', 'name'])
678
+ .where('project_id', '=', projectId)
679
+ .where('entity_sha', 'is', null)
680
+ .where((eb) => eb.or([
681
+ eb('component_path', 'is not', null),
682
+ eb('page_file_path', 'is not', null),
683
+ ]));
684
+ if (featureStartedAt) {
685
+ const sqliteTimestamp = featureStartedAt
686
+ .replace('T', ' ')
687
+ .replace(/\.\d{3}Z$/, '');
688
+ query = query.where((eb) => eb.or([
689
+ eb('created_at', '>=', sqliteTimestamp),
690
+ eb('updated_at', '>=', sqliteTimestamp),
691
+ ]));
692
+ }
693
+ const rows = await query.execute();
694
+ if (rows.length === 0)
695
+ return [];
696
+ // Group by file path (component_path or page_file_path)
697
+ const groups = new Map();
698
+ for (const row of rows) {
699
+ const r = row;
700
+ const filePath = r.component_path || r.page_file_path;
701
+ const existing = groups.get(filePath);
702
+ if (existing) {
703
+ existing.scenarioNames.push(r.name);
704
+ }
705
+ else {
706
+ // Derive a display name: use component_name if available,
707
+ // otherwise extract from file path (e.g., "src/lib/LibraryApp.tsx" → "LibraryApp")
708
+ const displayName = r.component_name ||
709
+ filePath
710
+ .split('/')
711
+ .pop()
712
+ ?.replace(/\.\w+$/, '') ||
713
+ filePath;
714
+ groups.set(filePath, {
715
+ name: displayName,
716
+ filePath,
717
+ scenarioNames: [r.name],
718
+ });
719
+ }
720
+ }
721
+ return [...groups.values()].map((g) => ({
722
+ name: g.name,
723
+ filePath: g.filePath,
724
+ scenarioCount: g.scenarioNames.length,
725
+ scenarioNames: g.scenarioNames,
726
+ }));
727
+ }
728
+ // ─── Duplicate Name Detection ─────────────────────────────────────────
729
+ /**
730
+ * Detect glossary entries that share the same `name`.
731
+ *
732
+ * Returns a Map of name → entries[] for names that appear more than once.
733
+ * Single-occurrence names are excluded. Used to warn Claude that ambiguous
734
+ * names will make audit output confusing (e.g., three entries all named "Page").
735
+ */
736
+ export function detectDuplicateNames(entries) {
737
+ const groups = new Map();
738
+ for (const entry of entries) {
739
+ const existing = groups.get(entry.name);
740
+ if (existing)
741
+ existing.push(entry);
742
+ else
743
+ groups.set(entry.name, [entry]);
744
+ }
745
+ // Only return groups with duplicates
746
+ for (const [name, group] of groups) {
747
+ if (group.length <= 1)
748
+ groups.delete(name);
749
+ }
750
+ return groups;
751
+ }
752
+ /**
753
+ * Identify scenarios that need recapture because their entity (or an entity
754
+ * in their dependency tree) has changed.
755
+ *
756
+ * Each scenario's entity name is resolved from its entity_sha (which points
757
+ * to the default export for app-level scenarios). The caller joins
758
+ * editor_scenarios.entity_sha → entities.name before calling this function.
759
+ *
760
+ * A scenario needs recapture when its entity has status 'edited' or 'impacted'
761
+ * AND the scenario was NOT re-registered in the current feature session.
762
+ */
763
+ export function identifyScenariosNeedingRecapture(params) {
764
+ const { scenarios, entityChangeStatus } = params;
765
+ if (!entityChangeStatus || Object.keys(entityChangeStatus).length === 0) {
766
+ return [];
767
+ }
768
+ const result = [];
769
+ for (const scenario of scenarios) {
770
+ if (scenario.updatedInSession)
771
+ continue;
772
+ if (!scenario.entityName)
773
+ continue;
774
+ const changeStatus = entityChangeStatus[scenario.entityName];
775
+ if (!changeStatus)
776
+ continue;
777
+ // "new" entities need initial scenario creation, not recapture.
778
+ // Only "edited" and "impacted" entities have stale screenshots.
779
+ if (changeStatus.status === 'new')
780
+ continue;
781
+ result.push({
782
+ scenarioName: scenario.name,
783
+ entityName: scenario.entityName,
784
+ status: changeStatus,
785
+ });
786
+ }
787
+ return result;
788
+ }
789
+ // ─── Client Error Aggregation ─────────────────────────────────────────
790
+ /**
791
+ * Aggregate client errors by component name using scenario metadata.
792
+ *
793
+ * Given a map of scenario ID → { scenarioName, errors } and a list of
794
+ * scenario metadata (with componentName from the DB), group errors by
795
+ * the component they belong to.
796
+ *
797
+ * For component scenarios: use the `componentName` field directly.
798
+ * For app-level scenarios (no componentName): derive the entity name
799
+ * using `scenarioEntityName()` — the same canonical function used by
800
+ * recapture detection and entity change status. This ensures the keys
801
+ * match what `computeAudit` checks against glossary entry names.
802
+ *
803
+ * This replaces the fragile "parse component name from scenario name"
804
+ * approach which fails for app-level scenarios like "Full Page with Library".
805
+ */
806
+ export function aggregateClientErrorsByComponent(clientErrors, scenarioMetadata) {
807
+ const result = {};
808
+ // Build a lookup from scenario name → component/entity name.
809
+ // Uses scenarioEntityName() for consistency with the rest of the system
810
+ // (recapture detection, entity change status, journal filtering).
811
+ const scenarioToComponent = new Map();
812
+ for (const meta of scenarioMetadata) {
813
+ const entityName = scenarioEntityName({
814
+ componentName: meta.componentName,
815
+ pageFilePath: meta.pageFilePath,
816
+ url: meta.url,
817
+ });
818
+ if (entityName) {
819
+ scenarioToComponent.set(meta.name, entityName);
820
+ }
821
+ }
822
+ for (const [, data] of Object.entries(clientErrors)) {
823
+ if (data.errors.length === 0)
824
+ continue;
825
+ // First try: look up via scenario metadata (authoritative)
826
+ let componentName = scenarioToComponent.get(data.scenarioName);
827
+ // Fallback: parse from scenario name convention "ComponentName - Variant"
828
+ if (!componentName) {
829
+ const dashIndex = data.scenarioName.indexOf(' - ');
830
+ componentName =
831
+ dashIndex >= 0
832
+ ? data.scenarioName.slice(0, dashIndex)
833
+ : data.scenarioName;
834
+ }
835
+ if (componentName) {
836
+ if (!result[componentName]) {
837
+ result[componentName] = [];
838
+ }
839
+ result[componentName].push(...data.errors);
840
+ }
841
+ }
842
+ return result;
843
+ }
122
844
  //# sourceMappingURL=editorAudit.js.map