@codeyam/codeyam-cli 0.1.0-staging.a77070e → 0.1.0-staging.aa28063

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 (349) hide show
  1. package/analyzer-template/.build-info.json +8 -8
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +4 -4
  4. package/analyzer-template/packages/ai/src/lib/astScopes/methodSemantics.ts +135 -0
  5. package/analyzer-template/packages/ai/src/lib/astScopes/nodeToSource.ts +19 -0
  6. package/analyzer-template/packages/ai/src/lib/astScopes/paths.ts +11 -4
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +36 -9
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.ts +10 -3
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +16 -6
  10. package/analyzer-template/packages/analyze/index.ts +4 -1
  11. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +28 -2
  12. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +5 -36
  13. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +10 -6
  14. package/analyzer-template/packages/analyze/src/lib/files/analyze/gatherEntityMap.ts +9 -12
  15. package/analyzer-template/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.ts +21 -0
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.ts +82 -10
  17. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +4 -0
  18. package/analyzer-template/packages/analyze/src/lib/files/analyzeInitial.ts +4 -0
  19. package/analyzer-template/packages/analyze/src/lib/files/analyzeNextRoute.ts +8 -3
  20. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +239 -58
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +1684 -1462
  22. package/analyzer-template/packages/aws/package.json +6 -6
  23. package/analyzer-template/packages/database/package.json +2 -2
  24. package/analyzer-template/packages/database/src/lib/loadAnalysis.ts +25 -15
  25. package/analyzer-template/packages/database/src/lib/loadEntity.ts +19 -8
  26. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.d.ts.map +1 -1
  27. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js +7 -1
  28. package/analyzer-template/packages/github/dist/database/src/lib/loadAnalysis.js.map +1 -1
  29. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts +4 -1
  30. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.d.ts.map +1 -1
  31. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js +5 -5
  32. package/analyzer-template/packages/github/dist/database/src/lib/loadEntity.js.map +1 -1
  33. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts +3 -1
  34. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  35. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +22 -1
  36. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  37. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +27 -0
  38. package/analyzer-template/project/analyzeFileEntities.ts +26 -0
  39. package/analyzer-template/project/runMultiScenarioServer.ts +26 -3
  40. package/background/src/lib/virtualized/project/analyzeFileEntities.js +22 -0
  41. package/background/src/lib/virtualized/project/analyzeFileEntities.js.map +1 -1
  42. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +23 -3
  43. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  44. package/codeyam-cli/src/cli.js +15 -0
  45. package/codeyam-cli/src/cli.js.map +1 -1
  46. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js +47 -0
  47. package/codeyam-cli/src/commands/__tests__/editor.analyzeImportsArgs.test.js.map +1 -0
  48. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js +71 -0
  49. package/codeyam-cli/src/commands/__tests__/editor.auditNoAutoAnalysis.test.js.map +1 -0
  50. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js +30 -0
  51. package/codeyam-cli/src/commands/__tests__/editor.designSystem.test.js.map +1 -0
  52. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js +55 -0
  53. package/codeyam-cli/src/commands/__tests__/editor.statePersistence.test.js.map +1 -0
  54. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +9 -9
  55. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +39 -3
  56. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  57. package/codeyam-cli/src/commands/editor.js +2080 -459
  58. package/codeyam-cli/src/commands/editor.js.map +1 -1
  59. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js +23 -0
  60. package/codeyam-cli/src/commands/editorAnalyzeImportsArgs.js.map +1 -0
  61. package/codeyam-cli/src/commands/init.js +20 -0
  62. package/codeyam-cli/src/commands/init.js.map +1 -1
  63. package/codeyam-cli/src/data/designSystems.js +27 -0
  64. package/codeyam-cli/src/data/designSystems.js.map +1 -0
  65. package/codeyam-cli/src/data/techStacks.js +1 -1
  66. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +44 -0
  67. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -1
  68. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +2426 -786
  69. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -1
  70. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js +66 -0
  71. package/codeyam-cli/src/utils/__tests__/editorEntityHelpers.test.js.map +1 -1
  72. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js +67 -0
  73. package/codeyam-cli/src/utils/__tests__/editorGuardMiddleware.test.js.map +1 -0
  74. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +11 -3
  75. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -1
  76. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +98 -1
  77. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -1
  78. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js +1108 -0
  79. package/codeyam-cli/src/utils/__tests__/editorRoadmap.test.js.map +1 -0
  80. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +120 -0
  81. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -1
  82. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +160 -1
  83. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -1
  84. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +134 -1
  85. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -1
  86. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +246 -1
  87. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -1
  88. package/codeyam-cli/src/utils/__tests__/envFile.test.js +125 -0
  89. package/codeyam-cli/src/utils/__tests__/envFile.test.js.map +1 -0
  90. package/codeyam-cli/src/utils/__tests__/handoffContext.test.js +500 -0
  91. package/codeyam-cli/src/utils/__tests__/handoffContext.test.js.map +1 -0
  92. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +16 -1
  93. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -1
  94. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js +302 -0
  95. package/codeyam-cli/src/utils/__tests__/manualEntityAnalysis.test.js.map +1 -0
  96. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js +127 -0
  97. package/codeyam-cli/src/utils/__tests__/registerScenarioResult.test.js.map +1 -0
  98. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js +84 -0
  99. package/codeyam-cli/src/utils/__tests__/screenshotHash.test.js.map +1 -0
  100. package/codeyam-cli/src/utils/__tests__/testRunner.test.js +216 -0
  101. package/codeyam-cli/src/utils/__tests__/testRunner.test.js.map +1 -0
  102. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +6 -0
  103. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -1
  104. package/codeyam-cli/src/utils/analysisRunner.js +36 -7
  105. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  106. package/codeyam-cli/src/utils/analyzer.js +11 -1
  107. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  108. package/codeyam-cli/src/utils/designSystemShowcase.js +810 -0
  109. package/codeyam-cli/src/utils/designSystemShowcase.js.map +1 -0
  110. package/codeyam-cli/src/utils/editorApi.js +16 -0
  111. package/codeyam-cli/src/utils/editorApi.js.map +1 -1
  112. package/codeyam-cli/src/utils/editorAudit.js +385 -32
  113. package/codeyam-cli/src/utils/editorAudit.js.map +1 -1
  114. package/codeyam-cli/src/utils/editorGuard.js +36 -0
  115. package/codeyam-cli/src/utils/editorGuard.js.map +1 -0
  116. package/codeyam-cli/src/utils/editorPreview.js +5 -3
  117. package/codeyam-cli/src/utils/editorPreview.js.map +1 -1
  118. package/codeyam-cli/src/utils/editorRecapture.js +109 -0
  119. package/codeyam-cli/src/utils/editorRecapture.js.map +1 -0
  120. package/codeyam-cli/src/utils/editorRoadmap.js +574 -0
  121. package/codeyam-cli/src/utils/editorRoadmap.js.map +1 -0
  122. package/codeyam-cli/src/utils/editorScenarioSwitch.js +27 -12
  123. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -1
  124. package/codeyam-cli/src/utils/editorScenarios.js +108 -5
  125. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -1
  126. package/codeyam-cli/src/utils/editorSeedAdapter.js +69 -16
  127. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -1
  128. package/codeyam-cli/src/utils/entityChangeStatus.js +30 -2
  129. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -1
  130. package/codeyam-cli/src/utils/entityChangeStatus.server.js +31 -0
  131. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -1
  132. package/codeyam-cli/src/utils/envFile.js +90 -0
  133. package/codeyam-cli/src/utils/envFile.js.map +1 -0
  134. package/codeyam-cli/src/utils/handoffContext.js +257 -0
  135. package/codeyam-cli/src/utils/handoffContext.js.map +1 -0
  136. package/codeyam-cli/src/utils/install-skills.js +36 -6
  137. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  138. package/codeyam-cli/src/utils/manualEntityAnalysis.js +196 -0
  139. package/codeyam-cli/src/utils/manualEntityAnalysis.js.map +1 -0
  140. package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js +159 -0
  141. package/codeyam-cli/src/utils/queue/__tests__/job.interactiveStart.test.js.map +1 -0
  142. package/codeyam-cli/src/utils/queue/job.js +35 -6
  143. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  144. package/codeyam-cli/src/utils/registerScenarioResult.js +52 -0
  145. package/codeyam-cli/src/utils/registerScenarioResult.js.map +1 -0
  146. package/codeyam-cli/src/utils/scenariosManifest.js +30 -2
  147. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -1
  148. package/codeyam-cli/src/utils/screenshotHash.js +26 -0
  149. package/codeyam-cli/src/utils/screenshotHash.js.map +1 -0
  150. package/codeyam-cli/src/utils/simulationGateMiddleware.js +9 -0
  151. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -1
  152. package/codeyam-cli/src/utils/techStackConfig.js +38 -0
  153. package/codeyam-cli/src/utils/techStackConfig.js.map +1 -0
  154. package/codeyam-cli/src/utils/techStackConfig.test.js +85 -0
  155. package/codeyam-cli/src/utils/techStackConfig.test.js.map +1 -0
  156. package/codeyam-cli/src/utils/testResultCache.js +53 -0
  157. package/codeyam-cli/src/utils/testResultCache.js.map +1 -0
  158. package/codeyam-cli/src/utils/testResultCache.server.js +81 -0
  159. package/codeyam-cli/src/utils/testResultCache.server.js.map +1 -0
  160. package/codeyam-cli/src/utils/testResultCache.server.test.js +187 -0
  161. package/codeyam-cli/src/utils/testResultCache.server.test.js.map +1 -0
  162. package/codeyam-cli/src/utils/testResultCache.test.js +230 -0
  163. package/codeyam-cli/src/utils/testResultCache.test.js.map +1 -0
  164. package/codeyam-cli/src/utils/testRunner.js +193 -1
  165. package/codeyam-cli/src/utils/testRunner.js.map +1 -1
  166. package/codeyam-cli/src/utils/webappDetection.js +4 -2
  167. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  168. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js +99 -0
  169. package/codeyam-cli/src/webserver/__tests__/api.interactive-switch-scenario.test.js.map +1 -0
  170. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js +95 -1
  171. package/codeyam-cli/src/webserver/__tests__/buildPtyEnv.test.js.map +1 -1
  172. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +28 -1
  173. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -1
  174. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +145 -11
  175. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -1
  176. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +105 -7
  177. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -1
  178. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js +135 -0
  179. package/codeyam-cli/src/webserver/__tests__/stripClaudeCommand.test.js.map +1 -0
  180. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +15 -0
  181. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -1
  182. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  183. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js +34 -0
  184. package/codeyam-cli/src/webserver/app/routes/api.interactive-switch-scenario.js.map +1 -0
  185. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CLe80MMu.js → CopyButton-DTBZZfSk.js} +1 -1
  186. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-Crt_KN_U.js → EntityItem-BxclONWq.js} +1 -1
  187. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CD7lGABo.js → EntityTypeIcon-BsnEOJZ_.js} +1 -1
  188. package/codeyam-cli/src/webserver/build/client/assets/{InlineSpinner-CgTNOhnu.js → InlineSpinner-ByaELMbv.js} +1 -1
  189. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CKeQT5Ty.js → InteractivePreview-6WjVfhxX.js} +2 -2
  190. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-D3s1MFkb.js → LibraryFunctionPreview-ChX-Hp7W.js} +1 -1
  191. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CM5zg40N.js → LogViewer-C-9zQdXg.js} +1 -1
  192. package/codeyam-cli/src/webserver/build/client/assets/MiniClaudeChat-Bs2_Oua4.js +36 -0
  193. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-C2PLkej3.js → ReportIssueModal-DQsceHVv.js} +1 -1
  194. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-DanvyBPb.js → SafeScreenshot-DThcm_9M.js} +1 -1
  195. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-DUMfcNVK.js → ScenarioViewer-Cl4oOA3A.js} +1 -1
  196. package/codeyam-cli/src/webserver/build/client/assets/Spinner-CIil5-gb.js +34 -0
  197. package/codeyam-cli/src/webserver/build/client/assets/{ViewportInspectBar-BA_Ry-rs.js → ViewportInspectBar-BqkA9zyZ.js} +1 -1
  198. package/codeyam-cli/src/webserver/build/client/assets/{_index-BAWd-Xjf.js → _index-DnOgyseQ.js} +1 -1
  199. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-BOARiB-g.js → activity.(_tab)-DqM9hbNE.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/client/assets/{addon-web-links-CHx25PAe.js → addon-web-links-C58dYPwR.js} +1 -1
  201. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Bg3e7q4S.js → agent-transcripts-B8NCeOrm.js} +1 -1
  202. package/codeyam-cli/src/webserver/build/client/assets/api.editor-database-verify-l0sNRNKZ.js +1 -0
  203. package/codeyam-cli/src/webserver/build/client/assets/api.editor-github-verify-l0sNRNKZ.js +1 -0
  204. package/codeyam-cli/src/webserver/build/client/assets/api.editor-handoff-l0sNRNKZ.js +1 -0
  205. package/codeyam-cli/src/webserver/build/client/assets/api.editor-hosting-verify-l0sNRNKZ.js +1 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/api.editor-recapture-stale-l0sNRNKZ.js +1 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/api.editor-roadmap-l0sNRNKZ.js +1 -0
  208. package/codeyam-cli/src/webserver/build/client/assets/api.editor-save-scenario-data-l0sNRNKZ.js +1 -0
  209. package/codeyam-cli/src/webserver/build/client/assets/api.editor-schema-l0sNRNKZ.js +1 -0
  210. package/codeyam-cli/src/webserver/build/client/assets/api.editor-verify-routes-l0sNRNKZ.js +1 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/api.interactive-switch-scenario-l0sNRNKZ.js +1 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/{book-open-CL-lMgHh.js → book-open-BFSIqZgO.js} +1 -1
  213. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-GmAjGS9-.js → chevron-down-B9fDzFVh.js} +1 -1
  214. package/codeyam-cli/src/webserver/build/client/assets/chunk-UVKPFVEO-Bmq2apuh.js +43 -0
  215. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-DFcQkN5j.js → circle-check-DLPObLUx.js} +1 -1
  216. package/codeyam-cli/src/webserver/build/client/assets/{copy-C6iF61Xs.js → copy-DXEmO0TD.js} +1 -1
  217. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-4ImjHTVC.js → createLucideIcon-BwyFiRot.js} +1 -1
  218. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-Coe5NhbS.js +1 -0
  219. package/codeyam-cli/src/webserver/build/client/assets/{cy-logo-cli-CCKUIm0S.svg → cy-logo-cli-DoA97ML3.svg} +2 -2
  220. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-C8y4mmyv.js → dev.empty-iRhRIFlp.js} +1 -1
  221. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-BZPBzV73.js +1 -0
  222. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-DOXe0Qx7.js +161 -0
  223. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-C6fEYHrh.js +41 -0
  224. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-Blfy9UlN.js → entity._sha._-pc-vc6wO.js} +13 -12
  225. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.dev-KTQuL0aj.js → entity._sha.scenarios._scenarioId.dev-C8AyYgYT.js} +1 -1
  226. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha.scenarios._scenarioId.fullscreen-C6eeL24i.js → entity._sha.scenarios._scenarioId.fullscreen-DziaVQX1.js} +1 -1
  227. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-DQM8E7L4.js → entity._sha_.create-scenario-BTcpgIpC.js} +1 -1
  228. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CAoXLsQr.js → entity._sha_.edit._scenarioId-D_O_ajfZ.js} +1 -1
  229. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-SuW9syRS.js → entry.client-j1Vi0bco.js} +6 -6
  230. package/codeyam-cli/src/webserver/build/client/assets/{files-D-xGrg29.js → files-kuny2Q_s.js} +1 -1
  231. package/codeyam-cli/src/webserver/build/client/assets/{git-Bq_fbXP5.js → git-DgCZPMie.js} +1 -1
  232. package/codeyam-cli/src/webserver/build/client/assets/globals-L-aUIeux.css +1 -0
  233. package/codeyam-cli/src/webserver/build/client/assets/{index-Bp1l4hSv.js → index-BliGSSpl.js} +1 -1
  234. package/codeyam-cli/src/webserver/build/client/assets/{index-DE3jI_dv.js → index-SqjQKTdH.js} +1 -1
  235. package/codeyam-cli/src/webserver/build/client/assets/{index-CWV9XZiG.js → index-vyrZD2g4.js} +1 -1
  236. package/codeyam-cli/src/webserver/build/client/assets/{labs-B_IX45ih.js → labs-c3yLxSEp.js} +1 -1
  237. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-De-7qQ2u.js → loader-circle-D-q28GLF.js} +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/manifest-30c44d84.js +1 -0
  239. package/codeyam-cli/src/webserver/build/client/assets/{memory-Cx2xEx7s.js → memory-CEWIUC4t.js} +1 -1
  240. package/codeyam-cli/src/webserver/build/client/assets/{pause-CFxEKL1u.js → pause-BP6fitdh.js} +1 -1
  241. package/codeyam-cli/src/webserver/build/client/assets/{root-DB3O9_9j.js → root-CLedrjXQ.js} +26 -13
  242. package/codeyam-cli/src/webserver/build/client/assets/{search-BdBb5aqc.js → search-BooqacKS.js} +1 -1
  243. package/codeyam-cli/src/webserver/build/client/assets/{settings-DdE-Untf.js → settings-BM0nbryO.js} +1 -1
  244. package/codeyam-cli/src/webserver/build/client/assets/{simulations-DSCdE99u.js → simulations-ovy6FjRY.js} +1 -1
  245. package/codeyam-cli/src/webserver/build/client/assets/{terminal-CrplD4b1.js → terminal-DHemCJIs.js} +1 -1
  246. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-DqJ0j69l.js → triangle-alert-D87ekDl8.js} +1 -1
  247. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-DhXHbEjP.js → useCustomSizes-Dk0Tciqg.js} +1 -1
  248. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C8QvIe05.js +2 -0
  249. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-Cy5Qg_UR.js → useReportContext-jkCytuYz.js} +1 -1
  250. package/codeyam-cli/src/webserver/build/client/assets/{useToast-5HR2j9ZE.js → useToast-BgqkixU9.js} +1 -1
  251. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-CuR5TvUx.js +16 -0
  252. package/codeyam-cli/src/webserver/build/server/assets/{index-DxB0pOSt.js → index-D4MWAsqb.js} +1 -1
  253. package/codeyam-cli/src/webserver/build/server/assets/init-JObA4lXD.js +14 -0
  254. package/codeyam-cli/src/webserver/build/server/assets/server-build-i8OXK4oL.js +765 -0
  255. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  256. package/codeyam-cli/src/webserver/build-info.json +5 -5
  257. package/codeyam-cli/src/webserver/editorProxy.js +132 -7
  258. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -1
  259. package/codeyam-cli/src/webserver/idleDetector.js +27 -3
  260. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -1
  261. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +17 -0
  262. package/codeyam-cli/src/webserver/server.js +119 -14
  263. package/codeyam-cli/src/webserver/server.js.map +1 -1
  264. package/codeyam-cli/src/webserver/terminalServer.js +235 -37
  265. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -1
  266. package/codeyam-cli/templates/__tests__/editor-step-hook.prompt-capture.test.ts +118 -0
  267. package/codeyam-cli/templates/codeyam-editor-claude.md +2 -0
  268. package/codeyam-cli/templates/codeyam-editor-codex.md +61 -0
  269. package/codeyam-cli/templates/codeyam-editor-gemini.md +59 -0
  270. package/codeyam-cli/templates/codeyam-editor-reference.md +9 -7
  271. package/codeyam-cli/templates/design-systems/clean-dashboard-design-system.md +255 -0
  272. package/codeyam-cli/templates/design-systems/editorial-design-system.md +267 -0
  273. package/codeyam-cli/templates/design-systems/mono-brutalist-design-system.md +256 -0
  274. package/codeyam-cli/templates/design-systems/neo-brutalist-design-system.md +294 -0
  275. package/codeyam-cli/templates/editor-step-hook.py +93 -46
  276. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +204 -5
  277. package/codeyam-cli/templates/expo-react-native/__tests__/.gitkeep +0 -0
  278. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +6 -3
  279. package/codeyam-cli/templates/expo-react-native/app/index.tsx +36 -0
  280. package/codeyam-cli/templates/expo-react-native/app.json +11 -0
  281. package/codeyam-cli/templates/expo-react-native/babel.config.js +1 -0
  282. package/codeyam-cli/templates/expo-react-native/gitignore +2 -0
  283. package/codeyam-cli/templates/expo-react-native/global.css +7 -0
  284. package/codeyam-cli/templates/expo-react-native/lib/theme.ts +73 -0
  285. package/codeyam-cli/templates/expo-react-native/package.json +32 -16
  286. package/codeyam-cli/templates/expo-react-native/patches/expo-modules-autolinking+3.0.24.patch +29 -0
  287. package/codeyam-cli/templates/isolation-route/expo-router.tsx.template +54 -0
  288. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +1 -0
  289. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +47 -34
  290. package/codeyam-cli/templates/seed-adapters/supabase.ts +271 -78
  291. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +34 -1
  292. package/package.json +1 -1
  293. package/packages/ai/src/lib/astScopes/methodSemantics.js +99 -0
  294. package/packages/ai/src/lib/astScopes/methodSemantics.js.map +1 -1
  295. package/packages/ai/src/lib/astScopes/nodeToSource.js +16 -0
  296. package/packages/ai/src/lib/astScopes/nodeToSource.js.map +1 -1
  297. package/packages/ai/src/lib/astScopes/paths.js +12 -3
  298. package/packages/ai/src/lib/astScopes/paths.js.map +1 -1
  299. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +27 -10
  300. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  301. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js +9 -2
  302. package/packages/ai/src/lib/dataStructure/equivalencyManagers/ParentScopeManager.js.map +1 -1
  303. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +14 -4
  304. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  305. package/packages/analyze/index.js +1 -1
  306. package/packages/analyze/index.js.map +1 -1
  307. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +16 -2
  308. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  309. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -26
  310. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  311. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +3 -2
  312. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  313. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js +9 -7
  314. package/packages/analyze/src/lib/files/analyze/gatherEntityMap.js.map +1 -1
  315. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js +14 -0
  316. package/packages/analyze/src/lib/files/analyze/trackEntityCircularDependencies.js.map +1 -1
  317. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js +44 -11
  318. package/packages/analyze/src/lib/files/analyze/validateDependencyAnalyses.js.map +1 -1
  319. package/packages/analyze/src/lib/files/analyzeChange.js +1 -0
  320. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  321. package/packages/analyze/src/lib/files/analyzeInitial.js +1 -0
  322. package/packages/analyze/src/lib/files/analyzeInitial.js.map +1 -1
  323. package/packages/analyze/src/lib/files/analyzeNextRoute.js +5 -1
  324. package/packages/analyze/src/lib/files/analyzeNextRoute.js.map +1 -1
  325. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +120 -28
  326. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  327. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +1368 -1193
  328. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  329. package/packages/database/src/lib/loadAnalysis.js +7 -1
  330. package/packages/database/src/lib/loadAnalysis.js.map +1 -1
  331. package/packages/database/src/lib/loadEntity.js +5 -5
  332. package/packages/database/src/lib/loadEntity.js.map +1 -1
  333. package/packages/utils/src/lib/fs/rsyncCopy.js +22 -1
  334. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  335. package/codeyam-cli/src/webserver/build/client/assets/Spinner-D0LgAaSa.js +0 -34
  336. package/codeyam-cli/src/webserver/build/client/assets/chunk-JZWAC4HX-BAdwhyCx.js +0 -43
  337. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-DcX-ZS3p.js +0 -1
  338. package/codeyam-cli/src/webserver/build/client/assets/editor._tab-Gbk_i5Js.js +0 -1
  339. package/codeyam-cli/src/webserver/build/client/assets/editor.entity.(_sha)-Bnx7yUP0.js +0 -58
  340. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-oepecPae.js +0 -41
  341. package/codeyam-cli/src/webserver/build/client/assets/globals-fAqOD9ex.css +0 -1
  342. package/codeyam-cli/src/webserver/build/client/assets/manifest-3157d6b8.js +0 -1
  343. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-BNd5hYuW.js +0 -2
  344. package/codeyam-cli/src/webserver/build/server/assets/analysisRunner-BMmkgAkg.js +0 -13
  345. package/codeyam-cli/src/webserver/build/server/assets/init-DLYLaqqP.js +0 -10
  346. package/codeyam-cli/src/webserver/build/server/assets/server-build-CcyitQLQ.js +0 -551
  347. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +0 -33
  348. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +0 -12
  349. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +0 -12
@@ -0,0 +1,125 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import os from 'os';
4
+ import { readEnvVar, writeEnvVar, parseGitHubRepo } from "../envFile.js";
5
+ let tmpDir;
6
+ beforeEach(() => {
7
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'envfile-test-'));
8
+ });
9
+ afterEach(() => {
10
+ fs.rmSync(tmpDir, { recursive: true, force: true });
11
+ });
12
+ // ── readEnvVar ────────────────────────────────────────────────────────
13
+ describe('readEnvVar', () => {
14
+ it('reads a simple key=value from .env.local', () => {
15
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'VERCEL_TOKEN=tok_abc123\n');
16
+ expect(readEnvVar(tmpDir, 'VERCEL_TOKEN')).toBe('tok_abc123');
17
+ });
18
+ it('reads from .env when .env.local does not exist', () => {
19
+ fs.writeFileSync(path.join(tmpDir, '.env'), 'MY_KEY=from_env\n');
20
+ expect(readEnvVar(tmpDir, 'MY_KEY')).toBe('from_env');
21
+ });
22
+ it('prefers .env.local over .env', () => {
23
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'KEY=local\n');
24
+ fs.writeFileSync(path.join(tmpDir, '.env'), 'KEY=base\n');
25
+ expect(readEnvVar(tmpDir, 'KEY')).toBe('local');
26
+ });
27
+ it('strips double quotes from values', () => {
28
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'KEY="quoted_val"\n');
29
+ expect(readEnvVar(tmpDir, 'KEY')).toBe('quoted_val');
30
+ });
31
+ it('strips single quotes from values', () => {
32
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), "KEY='single'\n");
33
+ expect(readEnvVar(tmpDir, 'KEY')).toBe('single');
34
+ });
35
+ it('skips comments', () => {
36
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), '# This is a comment\nKEY=val\n');
37
+ expect(readEnvVar(tmpDir, 'KEY')).toBe('val');
38
+ });
39
+ it('skips blank lines', () => {
40
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), '\n\nKEY=val\n');
41
+ expect(readEnvVar(tmpDir, 'KEY')).toBe('val');
42
+ });
43
+ it('returns null when key is not found', () => {
44
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'OTHER=val\n');
45
+ expect(readEnvVar(tmpDir, 'MISSING')).toBeNull();
46
+ });
47
+ it('returns null when no env files exist', () => {
48
+ expect(readEnvVar(tmpDir, 'KEY')).toBeNull();
49
+ });
50
+ it('returns null for empty values', () => {
51
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'KEY=\n');
52
+ expect(readEnvVar(tmpDir, 'KEY')).toBeNull();
53
+ });
54
+ it('handles values with equals signs', () => {
55
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'DATABASE_URL=postgres://user:pass@host/db?ssl=true\n');
56
+ expect(readEnvVar(tmpDir, 'DATABASE_URL')).toBe('postgres://user:pass@host/db?ssl=true');
57
+ });
58
+ it('reads from .env.development.local', () => {
59
+ fs.writeFileSync(path.join(tmpDir, '.env.development.local'), 'KEY=dev_local\n');
60
+ expect(readEnvVar(tmpDir, 'KEY')).toBe('dev_local');
61
+ });
62
+ });
63
+ // ── writeEnvVar ───────────────────────────────────────────────────────
64
+ describe('writeEnvVar', () => {
65
+ it('creates .env.local if it does not exist', () => {
66
+ writeEnvVar(tmpDir, 'NEW_KEY', 'new_value');
67
+ const content = fs.readFileSync(path.join(tmpDir, '.env.local'), 'utf-8');
68
+ expect(content).toContain('NEW_KEY=new_value');
69
+ });
70
+ it('appends to existing .env.local', () => {
71
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'EXISTING=val\n');
72
+ writeEnvVar(tmpDir, 'NEW_KEY', 'new_val');
73
+ const content = fs.readFileSync(path.join(tmpDir, '.env.local'), 'utf-8');
74
+ expect(content).toContain('EXISTING=val');
75
+ expect(content).toContain('NEW_KEY=new_val');
76
+ });
77
+ it('updates existing key in .env.local', () => {
78
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), 'KEY=old_val\n');
79
+ writeEnvVar(tmpDir, 'KEY', 'new_val');
80
+ const content = fs.readFileSync(path.join(tmpDir, '.env.local'), 'utf-8');
81
+ expect(content).toContain('KEY=new_val');
82
+ expect(content).not.toContain('old_val');
83
+ });
84
+ it('does not modify comments when updating', () => {
85
+ fs.writeFileSync(path.join(tmpDir, '.env.local'), '# Comment\nKEY=old\n');
86
+ writeEnvVar(tmpDir, 'KEY', 'new');
87
+ const content = fs.readFileSync(path.join(tmpDir, '.env.local'), 'utf-8');
88
+ expect(content).toContain('# Comment');
89
+ expect(content).toContain('KEY=new');
90
+ });
91
+ it('roundtrips with readEnvVar', () => {
92
+ writeEnvVar(tmpDir, 'TOKEN', 'secret_123');
93
+ expect(readEnvVar(tmpDir, 'TOKEN')).toBe('secret_123');
94
+ });
95
+ });
96
+ // ── parseGitHubRepo ───────────────────────────────────────────────────
97
+ describe('parseGitHubRepo', () => {
98
+ it('parses HTTPS URL', () => {
99
+ const result = parseGitHubRepo('https://github.com/codeyam-ai/codeyam.git');
100
+ expect(result).toEqual({ owner: 'codeyam-ai', repo: 'codeyam' });
101
+ });
102
+ it('parses HTTPS URL without .git', () => {
103
+ const result = parseGitHubRepo('https://github.com/jaredcosulich/testapp');
104
+ expect(result).toEqual({ owner: 'jaredcosulich', repo: 'testapp' });
105
+ });
106
+ it('parses SSH URL', () => {
107
+ const result = parseGitHubRepo('git@github.com:codeyam-ai/codeyam.git');
108
+ expect(result).toEqual({ owner: 'codeyam-ai', repo: 'codeyam' });
109
+ });
110
+ it('parses SSH URL without .git', () => {
111
+ const result = parseGitHubRepo('git@github.com:owner/repo');
112
+ expect(result).toEqual({ owner: 'owner', repo: 'repo' });
113
+ });
114
+ it('returns null for non-GitHub URLs', () => {
115
+ expect(parseGitHubRepo('https://gitlab.com/owner/repo.git')).toBeNull();
116
+ });
117
+ it('returns null for invalid URLs', () => {
118
+ expect(parseGitHubRepo('not-a-url')).toBeNull();
119
+ });
120
+ it('handles repos with hyphens and underscores', () => {
121
+ const result = parseGitHubRepo('https://github.com/my-org/my_project-name.git');
122
+ expect(result).toEqual({ owner: 'my-org', repo: 'my_project-name' });
123
+ });
124
+ });
125
+ //# sourceMappingURL=envFile.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envFile.test.js","sourceRoot":"","sources":["../../../../../src/utils/__tests__/envFile.test.ts"],"names":[],"mappings":"AAAA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AAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,500 @@
1
+ import fs from 'fs';
2
+ import os from 'os';
3
+ import path from 'path';
4
+ import { execSync } from 'child_process';
5
+ import { captureStepSnapshot, updateHandoffProgress, generateHandoffContext, formatHandoffContextAsMarkdown, } from "../handoffContext.js";
6
+ jest.mock('child_process', () => ({
7
+ execSync: jest.fn(),
8
+ }));
9
+ const mockedExecSync = execSync;
10
+ function createTempDir() {
11
+ return fs.mkdtempSync(path.join(os.tmpdir(), 'handoff-test-'));
12
+ }
13
+ function setupCodeyamDir(root) {
14
+ const codeyamDir = path.join(root, '.codeyam');
15
+ fs.mkdirSync(codeyamDir, { recursive: true });
16
+ return codeyamDir;
17
+ }
18
+ describe('captureStepSnapshot', () => {
19
+ let root;
20
+ beforeEach(() => {
21
+ root = createTempDir();
22
+ setupCodeyamDir(root);
23
+ mockedExecSync.mockReturnValue('');
24
+ });
25
+ afterEach(() => {
26
+ fs.rmSync(root, { recursive: true, force: true });
27
+ jest.restoreAllMocks();
28
+ });
29
+ it('returns correct structure with all zero counts for an empty project', () => {
30
+ const snapshot = captureStepSnapshot(root, 3);
31
+ expect(snapshot.step).toBe(3);
32
+ expect(snapshot.label).toBe('Prototype');
33
+ expect(snapshot.scenarioCount).toBe(0);
34
+ expect(snapshot.glossaryComponentCount).toBe(0);
35
+ expect(snapshot.glossaryFunctionCount).toBe(0);
36
+ expect(snapshot.uncommittedFileCount).toBe(0);
37
+ expect(snapshot.journalEntryCount).toBe(0);
38
+ expect(typeof snapshot.timestamp).toBe('string');
39
+ });
40
+ it('returns correct step label from STEP_LABELS', () => {
41
+ expect(captureStepSnapshot(root, 1).label).toBe('Plan');
42
+ expect(captureStepSnapshot(root, 8).label).toBe('Glossary');
43
+ expect(captureStepSnapshot(root, 18).label).toBe('Push');
44
+ });
45
+ it('returns "Unknown" label for invalid step numbers', () => {
46
+ expect(captureStepSnapshot(root, 99).label).toBe('Unknown');
47
+ });
48
+ it('counts glossary components vs functions correctly', () => {
49
+ const glossaryPath = path.join(root, '.codeyam', 'glossary.json');
50
+ const glossary = [
51
+ { name: 'TaskCard', filePath: 'app/components/TaskCard.tsx' },
52
+ { name: 'EmptyState', filePath: 'app/components/EmptyState.tsx' },
53
+ {
54
+ name: 'formatDate',
55
+ filePath: 'app/lib/utils.ts',
56
+ testFile: 'app/lib/__tests__/utils.test.ts',
57
+ },
58
+ {
59
+ name: 'sortTasks',
60
+ filePath: 'app/lib/tasks.ts',
61
+ testFile: 'app/lib/__tests__/tasks.test.ts',
62
+ },
63
+ {
64
+ name: 'filterTasks',
65
+ filePath: 'app/lib/tasks.ts',
66
+ testFile: 'app/lib/__tests__/tasks.test.ts',
67
+ },
68
+ ];
69
+ fs.writeFileSync(glossaryPath, JSON.stringify(glossary));
70
+ const snapshot = captureStepSnapshot(root, 7);
71
+ expect(snapshot.glossaryComponentCount).toBe(2);
72
+ expect(snapshot.glossaryFunctionCount).toBe(3);
73
+ });
74
+ it('handles malformed glossary.json gracefully', () => {
75
+ const glossaryPath = path.join(root, '.codeyam', 'glossary.json');
76
+ fs.writeFileSync(glossaryPath, 'not valid json');
77
+ const snapshot = captureStepSnapshot(root, 7);
78
+ expect(snapshot.glossaryComponentCount).toBe(0);
79
+ expect(snapshot.glossaryFunctionCount).toBe(0);
80
+ });
81
+ it('handles object-wrapped glossary format', () => {
82
+ const glossaryPath = path.join(root, '.codeyam', 'glossary.json');
83
+ // LLMs sometimes write glossary as { components: [...] } instead of an array
84
+ const glossary = {
85
+ components: [
86
+ { name: 'TaskCard', filePath: 'app/components/TaskCard.tsx' },
87
+ ],
88
+ };
89
+ fs.writeFileSync(glossaryPath, JSON.stringify(glossary));
90
+ const snapshot = captureStepSnapshot(root, 7);
91
+ // Should handle gracefully — either extract the array or return 0
92
+ expect(snapshot.glossaryComponentCount).toBe(0);
93
+ expect(snapshot.glossaryFunctionCount).toBe(0);
94
+ });
95
+ it('counts scenario files from editor-scenarios directory', () => {
96
+ const scenariosDir = path.join(root, '.codeyam', 'editor-scenarios');
97
+ fs.mkdirSync(scenariosDir, { recursive: true });
98
+ fs.writeFileSync(path.join(scenariosDir, 'abc123.json'), JSON.stringify({ name: 'Default' }));
99
+ fs.writeFileSync(path.join(scenariosDir, 'def456.json'), JSON.stringify({ name: 'Empty' }));
100
+ fs.writeFileSync(path.join(scenariosDir, 'ghi789.json'), JSON.stringify({ name: 'Rich' }));
101
+ // seed files should not be counted
102
+ fs.writeFileSync(path.join(scenariosDir, 'abc123.seed.json'), JSON.stringify({}));
103
+ const snapshot = captureStepSnapshot(root, 10);
104
+ expect(snapshot.scenarioCount).toBe(3);
105
+ });
106
+ it('counts uncommitted files from git status, excluding .codeyam/', () => {
107
+ mockedExecSync.mockReturnValue([
108
+ ' M app/components/TaskCard.tsx',
109
+ '?? app/components/NewComponent.tsx',
110
+ ' M .codeyam/config.json',
111
+ ' M .codeyam/glossary.json',
112
+ 'A app/lib/utils.ts',
113
+ ].join('\n'));
114
+ const snapshot = captureStepSnapshot(root, 7);
115
+ // Should exclude the 2 .codeyam/ files
116
+ expect(snapshot.uncommittedFileCount).toBe(3);
117
+ });
118
+ it('handles git status failure gracefully', () => {
119
+ mockedExecSync.mockImplementation(() => {
120
+ throw new Error('Not a git repository');
121
+ });
122
+ const snapshot = captureStepSnapshot(root, 7);
123
+ expect(snapshot.uncommittedFileCount).toBe(0);
124
+ });
125
+ it('counts journal entries from journal directory', () => {
126
+ const journalDir = path.join(root, '.codeyam', 'journal');
127
+ fs.mkdirSync(journalDir, { recursive: true });
128
+ fs.writeFileSync(path.join(journalDir, 'entry-001.json'), JSON.stringify({ title: 'Initial setup' }));
129
+ fs.writeFileSync(path.join(journalDir, 'entry-002.json'), JSON.stringify({ title: 'Added components' }));
130
+ // Non-json files should not be counted
131
+ fs.writeFileSync(path.join(journalDir, 'index.md'), '# Journal');
132
+ const snapshot = captureStepSnapshot(root, 13);
133
+ expect(snapshot.journalEntryCount).toBe(2);
134
+ });
135
+ it('returns a valid ISO timestamp', () => {
136
+ const snapshot = captureStepSnapshot(root, 1);
137
+ const parsed = new Date(snapshot.timestamp);
138
+ expect(parsed.toISOString()).toBe(snapshot.timestamp);
139
+ });
140
+ });
141
+ describe('updateHandoffProgress', () => {
142
+ let root;
143
+ beforeEach(() => {
144
+ root = createTempDir();
145
+ setupCodeyamDir(root);
146
+ mockedExecSync.mockReturnValue('');
147
+ });
148
+ afterEach(() => {
149
+ fs.rmSync(root, { recursive: true, force: true });
150
+ jest.restoreAllMocks();
151
+ });
152
+ it('creates handoff object in config if it does not exist', () => {
153
+ const configPath = path.join(root, '.codeyam', 'config.json');
154
+ fs.writeFileSync(configPath, JSON.stringify({ provider: 'claude', projectSlug: 'test' }));
155
+ updateHandoffProgress(root, 3);
156
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
157
+ expect(config.handoff).toBeDefined();
158
+ expect(config.handoff.lastStep).toBe(3);
159
+ expect(config.handoff.lastProvider).toBe('claude');
160
+ expect(config.handoff.stepHistory).toHaveLength(1);
161
+ expect(config.handoff.stepHistory[0].step).toBe(3);
162
+ expect(config.handoff.stepHistory[0].label).toBe('Prototype');
163
+ });
164
+ it('appends snapshot to existing stepHistory array', () => {
165
+ const configPath = path.join(root, '.codeyam', 'config.json');
166
+ const existingHistory = [
167
+ {
168
+ step: 1,
169
+ label: 'Plan',
170
+ timestamp: '2026-03-30T10:00:00.000Z',
171
+ scenarioCount: 0,
172
+ glossaryComponentCount: 0,
173
+ glossaryFunctionCount: 0,
174
+ uncommittedFileCount: 0,
175
+ journalEntryCount: 0,
176
+ },
177
+ {
178
+ step: 2,
179
+ label: 'Prepare',
180
+ timestamp: '2026-03-30T10:05:00.000Z',
181
+ scenarioCount: 0,
182
+ glossaryComponentCount: 0,
183
+ glossaryFunctionCount: 0,
184
+ uncommittedFileCount: 5,
185
+ journalEntryCount: 0,
186
+ },
187
+ ];
188
+ fs.writeFileSync(configPath, JSON.stringify({
189
+ provider: 'claude',
190
+ handoff: {
191
+ stepHistory: existingHistory,
192
+ lastStep: 2,
193
+ lastProvider: 'claude',
194
+ },
195
+ }));
196
+ updateHandoffProgress(root, 3);
197
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
198
+ expect(config.handoff.stepHistory).toHaveLength(3);
199
+ expect(config.handoff.stepHistory[2].step).toBe(3);
200
+ expect(config.handoff.lastStep).toBe(3);
201
+ });
202
+ it('creates stepHistory array if missing from existing handoff', () => {
203
+ const configPath = path.join(root, '.codeyam', 'config.json');
204
+ fs.writeFileSync(configPath, JSON.stringify({
205
+ provider: 'gemini',
206
+ handoff: {
207
+ summary: 'Previous work',
208
+ lastStep: 5,
209
+ lastProvider: 'claude',
210
+ },
211
+ }));
212
+ updateHandoffProgress(root, 6);
213
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
214
+ expect(config.handoff.stepHistory).toHaveLength(1);
215
+ expect(config.handoff.stepHistory[0].step).toBe(6);
216
+ });
217
+ it('updates lastProvider, lastStep, lastUpdated alongside step history', () => {
218
+ const configPath = path.join(root, '.codeyam', 'config.json');
219
+ fs.writeFileSync(configPath, JSON.stringify({ provider: 'gemini', projectSlug: 'test' }));
220
+ updateHandoffProgress(root, 7);
221
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
222
+ expect(config.handoff.lastProvider).toBe('gemini');
223
+ expect(config.handoff.lastStep).toBe(7);
224
+ expect(typeof config.handoff.lastUpdated).toBe('string');
225
+ // Verify it's a valid ISO timestamp
226
+ expect(new Date(config.handoff.lastUpdated).toISOString()).toBe(config.handoff.lastUpdated);
227
+ });
228
+ it('preserves existing summary field when updating progress', () => {
229
+ const configPath = path.join(root, '.codeyam', 'config.json');
230
+ fs.writeFileSync(configPath, JSON.stringify({
231
+ provider: 'claude',
232
+ handoff: {
233
+ summary: 'Built the TaskCard',
234
+ lastStep: 5,
235
+ lastProvider: 'claude',
236
+ },
237
+ }));
238
+ updateHandoffProgress(root, 6);
239
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
240
+ expect(config.handoff.summary).toBe('Built the TaskCard');
241
+ expect(config.handoff.lastStep).toBe(6);
242
+ });
243
+ it('handles missing config.json gracefully (non-fatal)', () => {
244
+ // No config.json written — should not throw
245
+ expect(() => updateHandoffProgress(root, 3)).not.toThrow();
246
+ });
247
+ it('defaults provider to claude when not specified in config', () => {
248
+ const configPath = path.join(root, '.codeyam', 'config.json');
249
+ fs.writeFileSync(configPath, JSON.stringify({ projectSlug: 'test' }));
250
+ updateHandoffProgress(root, 1);
251
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
252
+ expect(config.handoff.lastProvider).toBe('claude');
253
+ });
254
+ });
255
+ describe('generateHandoffContext', () => {
256
+ let root;
257
+ beforeEach(() => {
258
+ root = createTempDir();
259
+ setupCodeyamDir(root);
260
+ mockedExecSync.mockReturnValue('');
261
+ });
262
+ afterEach(() => {
263
+ fs.rmSync(root, { recursive: true, force: true });
264
+ jest.restoreAllMocks();
265
+ });
266
+ it('includes step history from handoff in the context', () => {
267
+ const stepHistory = [
268
+ {
269
+ step: 1,
270
+ label: 'Plan',
271
+ timestamp: '2026-03-30T10:00:00.000Z',
272
+ scenarioCount: 0,
273
+ glossaryComponentCount: 0,
274
+ glossaryFunctionCount: 0,
275
+ uncommittedFileCount: 0,
276
+ journalEntryCount: 0,
277
+ },
278
+ {
279
+ step: 3,
280
+ label: 'Prototype',
281
+ timestamp: '2026-03-30T10:15:00.000Z',
282
+ scenarioCount: 0,
283
+ glossaryComponentCount: 3,
284
+ glossaryFunctionCount: 2,
285
+ uncommittedFileCount: 12,
286
+ journalEntryCount: 0,
287
+ },
288
+ ];
289
+ const context = generateHandoffContext({
290
+ projectRoot: root,
291
+ previousProvider: 'claude',
292
+ newProvider: 'gemini',
293
+ handoff: { summary: 'Built stuff', lastStep: 3, stepHistory },
294
+ });
295
+ expect(context.previousProvider).toBe('claude');
296
+ expect(context.newProvider).toBe('gemini');
297
+ expect(context.stepHistory).toEqual(stepHistory);
298
+ expect(context.lastStep).toBe(3);
299
+ expect(context.lastStepLabel).toBe('Prototype');
300
+ });
301
+ it('includes uncommitted files from git status', () => {
302
+ mockedExecSync.mockReturnValue([
303
+ ' M app/components/Card.tsx',
304
+ '?? app/components/New.tsx',
305
+ ' M .codeyam/config.json',
306
+ ].join('\n'));
307
+ const context = generateHandoffContext({
308
+ projectRoot: root,
309
+ previousProvider: 'claude',
310
+ newProvider: 'codex',
311
+ handoff: null,
312
+ });
313
+ expect(context.uncommittedChanges.files).toHaveLength(2);
314
+ expect(context.uncommittedChanges.files[0].path).toBe('app/components/Card.tsx');
315
+ expect(context.uncommittedChanges.files[0].status).toBe('modified');
316
+ expect(context.uncommittedChanges.files[1].path).toBe('app/components/New.tsx');
317
+ expect(context.uncommittedChanges.files[1].status).toBe('untracked');
318
+ });
319
+ it('includes existing handoff summary if present', () => {
320
+ const context = generateHandoffContext({
321
+ projectRoot: root,
322
+ previousProvider: 'claude',
323
+ newProvider: 'gemini',
324
+ handoff: { summary: 'Built the TaskCard and registered scenarios' },
325
+ });
326
+ expect(context.handoffSummary).toBe('Built the TaskCard and registered scenarios');
327
+ });
328
+ it('handles null handoff gracefully', () => {
329
+ const context = generateHandoffContext({
330
+ projectRoot: root,
331
+ previousProvider: 'claude',
332
+ newProvider: 'gemini',
333
+ handoff: null,
334
+ });
335
+ expect(context.stepHistory).toEqual([]);
336
+ expect(context.handoffSummary).toBeNull();
337
+ expect(context.lastStep).toBeNull();
338
+ expect(context.lastStepLabel).toBeNull();
339
+ });
340
+ it('handles no uncommitted changes', () => {
341
+ mockedExecSync.mockReturnValue('');
342
+ const context = generateHandoffContext({
343
+ projectRoot: root,
344
+ previousProvider: 'gemini',
345
+ newProvider: 'claude',
346
+ handoff: { lastStep: 5 },
347
+ });
348
+ expect(context.uncommittedChanges.files).toHaveLength(0);
349
+ expect(context.uncommittedChanges.summary).toBe('0 files changed');
350
+ });
351
+ it('generates correct summary string for multiple changes', () => {
352
+ mockedExecSync.mockReturnValue([
353
+ ' M file1.tsx',
354
+ ' M file2.tsx',
355
+ '?? file3.tsx',
356
+ 'A file4.tsx',
357
+ ' D file5.tsx',
358
+ ].join('\n'));
359
+ const context = generateHandoffContext({
360
+ projectRoot: root,
361
+ previousProvider: 'claude',
362
+ newProvider: 'gemini',
363
+ handoff: null,
364
+ });
365
+ expect(context.uncommittedChanges.summary).toBe('5 files changed');
366
+ });
367
+ it('sets generatedAt to a valid ISO timestamp', () => {
368
+ const context = generateHandoffContext({
369
+ projectRoot: root,
370
+ previousProvider: 'claude',
371
+ newProvider: 'gemini',
372
+ handoff: null,
373
+ });
374
+ expect(new Date(context.generatedAt).toISOString()).toBe(context.generatedAt);
375
+ });
376
+ });
377
+ describe('formatHandoffContextAsMarkdown', () => {
378
+ function makeContext(overrides = {}) {
379
+ return {
380
+ previousProvider: 'claude',
381
+ newProvider: 'gemini',
382
+ lastStep: 8,
383
+ lastStepLabel: 'Glossary',
384
+ handoffSummary: null,
385
+ stepHistory: [],
386
+ uncommittedChanges: { summary: '0 files changed', files: [] },
387
+ generatedAt: '2026-03-31T12:00:00.000Z',
388
+ ...overrides,
389
+ };
390
+ }
391
+ it('includes provider names and step info in the header', () => {
392
+ const md = formatHandoffContextAsMarkdown(makeContext());
393
+ expect(md).toContain('Claude');
394
+ expect(md).toContain('Gemini');
395
+ expect(md).toContain('Step 8');
396
+ expect(md).toContain('Glossary');
397
+ });
398
+ it('generates a progress timeline table from step history', () => {
399
+ const stepHistory = [
400
+ {
401
+ step: 1,
402
+ label: 'Plan',
403
+ timestamp: '2026-03-30T10:00:00.000Z',
404
+ scenarioCount: 0,
405
+ glossaryComponentCount: 0,
406
+ glossaryFunctionCount: 0,
407
+ uncommittedFileCount: 0,
408
+ journalEntryCount: 0,
409
+ },
410
+ {
411
+ step: 3,
412
+ label: 'Prototype',
413
+ timestamp: '2026-03-30T10:15:00.000Z',
414
+ scenarioCount: 0,
415
+ glossaryComponentCount: 3,
416
+ glossaryFunctionCount: 2,
417
+ uncommittedFileCount: 12,
418
+ journalEntryCount: 0,
419
+ },
420
+ {
421
+ step: 7,
422
+ label: 'Extract',
423
+ timestamp: '2026-03-30T11:00:00.000Z',
424
+ scenarioCount: 4,
425
+ glossaryComponentCount: 6,
426
+ glossaryFunctionCount: 5,
427
+ uncommittedFileCount: 22,
428
+ journalEntryCount: 0,
429
+ },
430
+ ];
431
+ const md = formatHandoffContextAsMarkdown(makeContext({ stepHistory, lastStep: 7, lastStepLabel: 'Extract' }));
432
+ expect(md).toContain('Progress Timeline');
433
+ expect(md).toContain('| Step | Label | Scenarios | Components | Functions | Files Changed |');
434
+ expect(md).toContain('| 1 | Plan | 0 | 0 | 0 | 0 |');
435
+ expect(md).toContain('| 3 | Prototype | 0 | 3 | 2 | 12 |');
436
+ expect(md).toContain('| 7 | Extract | 4 | 6 | 5 | 22 |');
437
+ });
438
+ it('includes previous provider notes when present', () => {
439
+ const md = formatHandoffContextAsMarkdown(makeContext({
440
+ handoffSummary: 'Built the TaskCard component with 3 scenarios',
441
+ }));
442
+ expect(md).toContain("Previous Provider's Notes");
443
+ expect(md).toContain('Built the TaskCard component with 3 scenarios');
444
+ });
445
+ it('omits notes section when no summary is present', () => {
446
+ const md = formatHandoffContextAsMarkdown(makeContext({ handoffSummary: null }));
447
+ expect(md).not.toContain("Previous Provider's Notes");
448
+ });
449
+ it('lists uncommitted files with their status', () => {
450
+ const files = [
451
+ { path: 'app/components/TaskCard.tsx', status: 'modified' },
452
+ { path: 'app/components/NewFile.tsx', status: 'added' },
453
+ { path: 'app/lib/old.ts', status: 'deleted' },
454
+ ];
455
+ const md = formatHandoffContextAsMarkdown(makeContext({
456
+ uncommittedChanges: { summary: '3 files changed', files },
457
+ }));
458
+ expect(md).toContain('Uncommitted Changes');
459
+ expect(md).toContain('`app/components/TaskCard.tsx`');
460
+ expect(md).toContain('modified');
461
+ expect(md).toContain('`app/components/NewFile.tsx`');
462
+ expect(md).toContain('added');
463
+ });
464
+ it('truncates file list at 30 entries with a summary', () => {
465
+ const files = Array.from({ length: 40 }, (_, i) => ({
466
+ path: `app/file${i}.tsx`,
467
+ status: 'modified',
468
+ }));
469
+ const md = formatHandoffContextAsMarkdown(makeContext({
470
+ uncommittedChanges: { summary: '40 files changed', files },
471
+ }));
472
+ // Should show first 30 files
473
+ expect(md).toContain('`app/file0.tsx`');
474
+ expect(md).toContain('`app/file29.tsx`');
475
+ // Should NOT show file30+
476
+ expect(md).not.toContain('`app/file30.tsx`');
477
+ // Should have a "... and N more" message
478
+ expect(md).toContain('... and 10 more');
479
+ });
480
+ it('omits uncommitted changes section when no files changed', () => {
481
+ const md = formatHandoffContextAsMarkdown(makeContext({
482
+ uncommittedChanges: { summary: '0 files changed', files: [] },
483
+ }));
484
+ expect(md).not.toContain('Uncommitted Changes');
485
+ });
486
+ it('omits progress timeline section when step history is empty', () => {
487
+ const md = formatHandoffContextAsMarkdown(makeContext({ stepHistory: [] }));
488
+ expect(md).not.toContain('Progress Timeline');
489
+ });
490
+ it('includes continuation instructions referencing the correct step', () => {
491
+ const md = formatHandoffContextAsMarkdown(makeContext({
492
+ lastStep: 8,
493
+ lastStepLabel: 'Glossary',
494
+ }));
495
+ expect(md).toContain('Instructions');
496
+ expect(md).toContain('Step 8');
497
+ expect(md).toContain('Glossary');
498
+ });
499
+ });
500
+ //# sourceMappingURL=handoffContext.test.js.map