@codeyam/codeyam-cli 0.1.0-staging.b8a55ba → 0.1.0-staging.d0ad4ae

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 (340) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/common/execAsync.ts +1 -1
  3. package/analyzer-template/log.txt +3 -3
  4. package/analyzer-template/package.json +7 -4
  5. package/analyzer-template/packages/ai/package.json +1 -1
  6. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +14 -1
  7. package/analyzer-template/packages/ai/src/lib/checkAllAttributes.ts +29 -10
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +120 -19
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
  10. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +91 -35
  11. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +110 -74
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +11 -0
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
  14. package/analyzer-template/packages/ai/src/lib/deepEqual.ts +30 -0
  15. package/analyzer-template/packages/ai/src/lib/findMatchingAttribute.ts +24 -17
  16. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +214 -39
  17. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +54 -1
  18. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +72 -6
  19. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +12 -5
  20. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +39 -23
  21. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +32 -0
  22. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +14 -0
  23. package/analyzer-template/packages/analyze/src/lib/asts/nodes/index.ts +1 -0
  24. package/analyzer-template/packages/analyze/src/lib/asts/nodes/isAsyncFunction.ts +67 -0
  25. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +73 -69
  26. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +6 -0
  27. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +3 -0
  28. package/analyzer-template/packages/analyze/src/lib/files/analyzeChange.ts +22 -6
  29. package/analyzer-template/packages/analyze/src/lib/files/analyzeEntity.ts +9 -5
  30. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +49 -11
  31. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.ts +102 -0
  32. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +399 -52
  33. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.ts +128 -2
  34. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +114 -70
  35. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +34 -129
  36. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +155 -79
  37. package/analyzer-template/packages/aws/codebuild/index.ts +1 -0
  38. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts +11 -1
  39. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.d.ts.map +1 -1
  40. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js +29 -18
  41. package/analyzer-template/packages/aws/dist/src/lib/codebuild/waitForBuild.js.map +1 -1
  42. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts +2 -2
  43. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.d.ts.map +1 -1
  44. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js +2 -2
  45. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  46. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts +8 -18
  47. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.d.ts.map +1 -1
  48. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js +17 -61
  49. package/analyzer-template/packages/aws/dist/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  50. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.d.ts.map +1 -1
  51. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js +8 -1
  52. package/analyzer-template/packages/aws/dist/src/lib/s3/uploadFileToS3.js.map +1 -1
  53. package/analyzer-template/packages/aws/package.json +1 -1
  54. package/analyzer-template/packages/aws/src/lib/codebuild/waitForBuild.ts +43 -19
  55. package/analyzer-template/packages/aws/src/lib/ecs/ecsDefineContainer.ts +3 -3
  56. package/analyzer-template/packages/aws/src/lib/ecs/ecsTaskFactory.ts +17 -69
  57. package/analyzer-template/packages/aws/src/lib/s3/uploadFileToS3.ts +8 -1
  58. package/analyzer-template/packages/generate/index.ts +3 -0
  59. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.ts +17 -1
  60. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +193 -0
  61. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.ts +73 -0
  62. package/analyzer-template/packages/generate/src/lib/scenarioComponentForServer.ts +114 -0
  63. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts +1 -0
  64. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/entitiesTable.d.ts.map +1 -1
  65. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -0
  66. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  67. package/analyzer-template/packages/github/dist/generate/index.d.ts +3 -0
  68. package/analyzer-template/packages/github/dist/generate/index.d.ts.map +1 -1
  69. package/analyzer-template/packages/github/dist/generate/index.js +3 -0
  70. package/analyzer-template/packages/github/dist/generate/index.js.map +1 -1
  71. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.d.ts.map +1 -1
  72. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  73. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  74. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts +9 -0
  75. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -0
  76. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  77. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  78. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts +20 -0
  79. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.d.ts.map +1 -0
  80. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  81. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  82. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts +8 -0
  83. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.d.ts.map +1 -0
  84. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js +89 -0
  85. package/analyzer-template/packages/github/dist/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  86. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.d.ts.map +1 -1
  87. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js +10 -0
  88. package/analyzer-template/packages/github/dist/github/src/lib/loadOrCreateCommit.js.map +1 -1
  89. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.d.ts.map +1 -1
  90. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js +3 -0
  91. package/analyzer-template/packages/github/dist/github/src/lib/syncPrimaryBranch.js.map +1 -1
  92. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts +2 -0
  93. package/analyzer-template/packages/github/dist/types/src/types/Entity.d.ts.map +1 -1
  94. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +6 -0
  95. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  96. package/analyzer-template/packages/github/src/lib/loadOrCreateCommit.ts +14 -0
  97. package/analyzer-template/packages/github/src/lib/syncPrimaryBranch.ts +2 -0
  98. package/analyzer-template/packages/process/index.ts +2 -0
  99. package/analyzer-template/packages/process/package.json +12 -0
  100. package/analyzer-template/packages/process/tsconfig.json +8 -0
  101. package/analyzer-template/packages/types/src/types/Entity.ts +2 -0
  102. package/analyzer-template/packages/types/src/types/Scenario.ts +6 -0
  103. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts +2 -0
  104. package/analyzer-template/packages/utils/dist/types/src/types/Entity.d.ts.map +1 -1
  105. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +6 -0
  106. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  107. package/analyzer-template/playwright/capture.ts +37 -18
  108. package/analyzer-template/playwright/waitForServer.ts +21 -6
  109. package/analyzer-template/project/constructMockCode.ts +781 -140
  110. package/analyzer-template/project/orchestrateCapture/KyselyAnalysisLoader.ts +3 -6
  111. package/analyzer-template/project/orchestrateCapture.ts +10 -3
  112. package/analyzer-template/project/reconcileMockDataKeys.ts +28 -100
  113. package/analyzer-template/project/runAnalysis.ts +5 -0
  114. package/analyzer-template/project/serverOnlyModules.ts +127 -2
  115. package/analyzer-template/project/start.ts +5 -3
  116. package/analyzer-template/project/startScenarioCapture.ts +6 -0
  117. package/analyzer-template/project/writeMockDataTsx.ts +50 -22
  118. package/analyzer-template/project/writeScenarioClientWrapper.ts +21 -0
  119. package/analyzer-template/project/writeScenarioComponents.ts +162 -100
  120. package/analyzer-template/project/writeScenarioFiles.ts +26 -0
  121. package/analyzer-template/project/writeSimpleRoot.ts +11 -35
  122. package/analyzer-template/scripts/comboWorkerLoop.cjs +1 -0
  123. package/analyzer-template/scripts/defaultCmd.sh +9 -0
  124. package/background/src/lib/local/createLocalAnalyzer.js +1 -29
  125. package/background/src/lib/local/createLocalAnalyzer.js.map +1 -1
  126. package/background/src/lib/local/execAsync.js +1 -1
  127. package/background/src/lib/local/execAsync.js.map +1 -1
  128. package/background/src/lib/virtualized/common/execAsync.js +1 -1
  129. package/background/src/lib/virtualized/common/execAsync.js.map +1 -1
  130. package/background/src/lib/virtualized/project/constructMockCode.js +718 -127
  131. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  132. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js +3 -2
  133. package/background/src/lib/virtualized/project/orchestrateCapture/KyselyAnalysisLoader.js.map +1 -1
  134. package/background/src/lib/virtualized/project/orchestrateCapture.js +7 -4
  135. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  136. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +25 -61
  137. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  138. package/background/src/lib/virtualized/project/runAnalysis.js +4 -0
  139. package/background/src/lib/virtualized/project/runAnalysis.js.map +1 -1
  140. package/background/src/lib/virtualized/project/serverOnlyModules.js +106 -3
  141. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
  142. package/background/src/lib/virtualized/project/start.js +5 -3
  143. package/background/src/lib/virtualized/project/start.js.map +1 -1
  144. package/background/src/lib/virtualized/project/startScenarioCapture.js +7 -0
  145. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  146. package/background/src/lib/virtualized/project/writeMockDataTsx.js +52 -23
  147. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  148. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js +15 -0
  149. package/background/src/lib/virtualized/project/writeScenarioClientWrapper.js.map +1 -0
  150. package/background/src/lib/virtualized/project/writeScenarioComponents.js +136 -83
  151. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  152. package/background/src/lib/virtualized/project/writeScenarioFiles.js +19 -0
  153. package/background/src/lib/virtualized/project/writeScenarioFiles.js.map +1 -1
  154. package/background/src/lib/virtualized/project/writeSimpleRoot.js +11 -34
  155. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  156. package/codeyam-cli/src/cli.js +5 -1
  157. package/codeyam-cli/src/cli.js.map +1 -1
  158. package/codeyam-cli/src/commands/analyze.js +1 -1
  159. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  160. package/codeyam-cli/src/commands/baseline.js +177 -0
  161. package/codeyam-cli/src/commands/baseline.js.map +1 -0
  162. package/codeyam-cli/src/commands/status.js +23 -1
  163. package/codeyam-cli/src/commands/status.js.map +1 -1
  164. package/codeyam-cli/src/commands/test-startup.js +1 -1
  165. package/codeyam-cli/src/commands/test-startup.js.map +1 -1
  166. package/codeyam-cli/src/commands/wipe.js +108 -0
  167. package/codeyam-cli/src/commands/wipe.js.map +1 -0
  168. package/codeyam-cli/src/utils/database.js +91 -5
  169. package/codeyam-cli/src/utils/database.js.map +1 -1
  170. package/codeyam-cli/src/utils/git.js +79 -0
  171. package/codeyam-cli/src/utils/git.js.map +1 -0
  172. package/codeyam-cli/src/utils/queue/job.js +104 -0
  173. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  174. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  175. package/codeyam-cli/src/utils/wipe.js +128 -0
  176. package/codeyam-cli/src/utils/wipe.js.map +1 -0
  177. package/codeyam-cli/src/webserver/app/lib/database.js +66 -17
  178. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  179. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-wXL1Z2Aq.js → EntityItem-Cmysw5OP.js} +1 -1
  180. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-CzGX-miz.js → EntityTypeBadge-DLqD3qNt.js} +1 -1
  181. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CXFKsCOD.js → EntityTypeIcon-CAneekK2.js} +1 -1
  182. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-D-9pXIaY.js → InteractivePreview-Cu16OUmx.js} +2 -2
  183. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CBQPrpT0.js → LibraryFunctionPreview-CVtiBnY5.js} +1 -1
  184. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-D1CdlbrV.js → LoadingDots-B0GLXMsr.js} +1 -1
  185. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-wDPcZNKx.js → LogViewer-xgeCVgSM.js} +1 -1
  186. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-4lcOlid-.js → ReportIssueModal-DcAUIpD_.js} +1 -1
  187. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-BfmDgXxG.js → SafeScreenshot-DuDvi0jm.js} +1 -1
  188. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-BMKg0SAF.js +15 -0
  189. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-6J7zDUD5.js → TruncatedFilePath-DyFZkK0l.js} +1 -1
  190. package/codeyam-cli/src/webserver/build/client/assets/_index-DSmTpjmK.js +11 -0
  191. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-BF_aK4y6.js +32 -0
  192. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-BYimnrHg.js → chevron-down-Cx24_aWc.js} +1 -1
  193. package/codeyam-cli/src/webserver/build/client/assets/chunk-EPOLDU6W-CXRTFQ3F.js +51 -0
  194. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-CaVsIRxt.js → circle-check-BOARzkeR.js} +1 -1
  195. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-CgUsG7ib.js → createLucideIcon-BdhJEx6B.js} +1 -1
  196. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-DW_hdGUc.js → dev.empty-RJCf3Tvw.js} +1 -1
  197. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-zUEpfPsu.js → entity._sha._-D0-YwkBh.js} +12 -12
  198. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-EylcgScH.js +1 -0
  199. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-D_3ero5o.js → entity._sha_.create-scenario-DMe7kvgo.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-CfLCUi9S.js → entity._sha_.edit._scenarioId-C1H_a_Y3.js} +1 -1
  201. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-DKJyZfAY.js → entry.client-CS2cb_eZ.js} +6 -6
  202. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-DAtOlaWE.js → fileTableUtils-DMJ7zii9.js} +1 -1
  203. package/codeyam-cli/src/webserver/build/client/assets/{files-ClR0d32A.js → files-BW7Cyeyi.js} +1 -1
  204. package/codeyam-cli/src/webserver/build/client/assets/{git-D62Lxxmv.js → git-CZu4fif0.js} +2 -2
  205. package/codeyam-cli/src/webserver/build/client/assets/globals-wHVy_II5.css +1 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/{index-CzNNiTkw.js → index-B1h680n5.js} +1 -1
  207. package/codeyam-cli/src/webserver/build/client/assets/{index-BosqDOlH.js → index-lzqtyFU8.js} +1 -1
  208. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-CNp9QFCX.js → loader-circle-B7B9V-bu.js} +1 -1
  209. package/codeyam-cli/src/webserver/build/client/assets/{manifest-09d684be.js → manifest-2d191949.js} +1 -1
  210. package/codeyam-cli/src/webserver/build/client/assets/root-FHgpM6gc.js +56 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/{search-DDGjYAMJ.js → search-CxXUmBSd.js} +1 -1
  212. package/codeyam-cli/src/webserver/build/client/assets/{settings-DgTyB-Wg.js → settings-6D8k8Jp5.js} +1 -1
  213. package/codeyam-cli/src/webserver/build/client/assets/simulations-CDJZnWhN.js +1 -0
  214. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-CBc5dE1s.js → triangle-alert-B6LgvRJg.js} +1 -1
  215. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-BMIGFP-m.js → useCustomSizes-Dv18q8LD.js} +1 -1
  216. package/codeyam-cli/src/webserver/build/client/assets/{useInteractiveMode-Dk_FQqWJ.js → useInteractiveMode-0ToGk4K3.js} +1 -1
  217. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BqPPNjAl.js → useLastLogLine-aSv48UbS.js} +1 -1
  218. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-DsJbgMY9.js → useReportContext-1BX144Eg.js} +1 -1
  219. package/codeyam-cli/src/webserver/build/client/assets/{useToast-DWHcCcl1.js → useToast-mBRpZPiu.js} +1 -1
  220. package/codeyam-cli/src/webserver/build/server/assets/{index-CV6i1S1A.js → index-pU0o5t1o.js} +1 -1
  221. package/codeyam-cli/src/webserver/build/server/assets/server-build-YzfkRwdn.js +178 -0
  222. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  223. package/codeyam-cli/src/webserver/build-info.json +5 -5
  224. package/codeyam-cli/templates/codeyam-setup-skill.md +138 -3
  225. package/codeyam-cli/templates/debug-codeyam.md +7 -2
  226. package/package.json +5 -5
  227. package/packages/ai/src/lib/astScopes/processExpression.js +13 -1
  228. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  229. package/packages/ai/src/lib/checkAllAttributes.js +24 -9
  230. package/packages/ai/src/lib/checkAllAttributes.js.map +1 -1
  231. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +94 -18
  232. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  233. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
  234. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  235. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +51 -23
  236. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -1
  237. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +70 -54
  238. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  239. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +11 -0
  240. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  241. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  242. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  243. package/packages/ai/src/lib/deepEqual.js +32 -0
  244. package/packages/ai/src/lib/deepEqual.js.map +1 -0
  245. package/packages/ai/src/lib/findMatchingAttribute.js +20 -16
  246. package/packages/ai/src/lib/findMatchingAttribute.js.map +1 -1
  247. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +168 -41
  248. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
  249. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +42 -1
  250. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
  251. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +59 -3
  252. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  253. package/packages/ai/src/lib/generateChangesEntityScenarios.js +6 -6
  254. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  255. package/packages/ai/src/lib/generateEntityScenarioData.js +32 -23
  256. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  257. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +20 -1
  258. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  259. package/packages/analyze/src/lib/FileAnalyzer.js +15 -0
  260. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  261. package/packages/analyze/src/lib/asts/nodes/index.js +1 -0
  262. package/packages/analyze/src/lib/asts/nodes/index.js.map +1 -1
  263. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js +52 -0
  264. package/packages/analyze/src/lib/asts/nodes/isAsyncFunction.js.map +1 -0
  265. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +59 -50
  266. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  267. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +6 -0
  268. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  269. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +2 -0
  270. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  271. package/packages/analyze/src/lib/files/analyzeChange.js +14 -4
  272. package/packages/analyze/src/lib/files/analyzeChange.js.map +1 -1
  273. package/packages/analyze/src/lib/files/analyzeEntity.js +7 -6
  274. package/packages/analyze/src/lib/files/analyzeEntity.js.map +1 -1
  275. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +44 -10
  276. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -1
  277. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js +85 -0
  278. package/packages/analyze/src/lib/files/scenarios/enrichUnknownTypesFromSourceEquivalencies.js.map +1 -0
  279. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +314 -52
  280. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  281. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js +97 -2
  282. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarios.js.map +1 -1
  283. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +88 -52
  284. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  285. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +26 -98
  286. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  287. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +141 -75
  288. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  289. package/packages/aws/src/lib/ecs/ecsDefineContainer.js +2 -2
  290. package/packages/aws/src/lib/ecs/ecsDefineContainer.js.map +1 -1
  291. package/packages/aws/src/lib/ecs/ecsTaskFactory.js +17 -61
  292. package/packages/aws/src/lib/ecs/ecsTaskFactory.js.map +1 -1
  293. package/packages/generate/index.js +3 -0
  294. package/packages/generate/index.js.map +1 -1
  295. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js +16 -1
  296. package/packages/generate/src/lib/componentScenarioPage/componentScenarioPageNext.js.map +1 -1
  297. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +189 -0
  298. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -0
  299. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js +53 -0
  300. package/packages/generate/src/lib/componentScenarioPage/generateScenarioServerComponent.js.map +1 -0
  301. package/packages/generate/src/lib/scenarioComponentForServer.js +89 -0
  302. package/packages/generate/src/lib/scenarioComponentForServer.js.map +1 -0
  303. package/packages/github/src/lib/loadOrCreateCommit.js +10 -0
  304. package/packages/github/src/lib/loadOrCreateCommit.js.map +1 -1
  305. package/packages/github/src/lib/syncPrimaryBranch.js +3 -0
  306. package/packages/github/src/lib/syncPrimaryBranch.js.map +1 -1
  307. package/packages/process/index.js +3 -0
  308. package/packages/process/index.js.map +1 -0
  309. package/packages/process/src/GlobalProcessManager.js.map +1 -0
  310. package/{background/src/lib/process → packages/process/src}/ProcessManager.js +1 -1
  311. package/packages/process/src/ProcessManager.js.map +1 -0
  312. package/packages/process/src/index.js.map +1 -0
  313. package/packages/process/src/managedExecAsync.js.map +1 -0
  314. package/analyzer-template/process/INTEGRATION_COMPLETE.md +0 -333
  315. package/analyzer-template/process/INTEGRATION_EXAMPLE.md +0 -525
  316. package/analyzer-template/process/README.md +0 -507
  317. package/background/src/lib/process/GlobalProcessManager.js.map +0 -1
  318. package/background/src/lib/process/ProcessManager.js.map +0 -1
  319. package/background/src/lib/process/index.js.map +0 -1
  320. package/background/src/lib/process/managedExecAsync.js.map +0 -1
  321. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  322. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  323. package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js +0 -7
  324. package/codeyam-cli/scripts/fixtures/formbricks/universal-mocks/apps/web/lib/instance/service.js.map +0 -1
  325. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +0 -15
  326. package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +0 -11
  327. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-2mG6mjVb.js +0 -32
  328. package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +0 -51
  329. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +0 -1
  330. package/codeyam-cli/src/webserver/build/client/assets/globals-C6vQASxy.css +0 -1
  331. package/codeyam-cli/src/webserver/build/client/assets/root-BxJUvKau.js +0 -56
  332. package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +0 -1
  333. package/codeyam-cli/src/webserver/build/server/assets/server-build-BDlyhfrv.js +0 -175
  334. /package/analyzer-template/{process → packages/process/src}/GlobalProcessManager.ts +0 -0
  335. /package/analyzer-template/{process → packages/process/src}/ProcessManager.ts +0 -0
  336. /package/analyzer-template/{process → packages/process/src}/index.ts +0 -0
  337. /package/analyzer-template/{process → packages/process/src}/managedExecAsync.ts +0 -0
  338. /package/{background/src/lib/process → packages/process/src}/GlobalProcessManager.js +0 -0
  339. /package/{background/src/lib/process → packages/process/src}/index.js +0 -0
  340. /package/{background/src/lib/process → packages/process/src}/managedExecAsync.js +0 -0
@@ -1,525 +0,0 @@
1
- # Integration Example: Adding Process Management to CLI Entry Points
2
-
3
- This document shows concrete examples of integrating the process management system into existing CodeYam CLI entry points.
4
-
5
- ## Step 1: Add Signal Handlers to CLI Entry Points
6
-
7
- ### Example: runLocally.ts
8
-
9
- **Before:**
10
-
11
- ```typescript
12
- import yargs from 'yargs';
13
- import { hideBin } from 'yargs/helpers';
14
- import sharedRunLocally, { RunLocallyArgs } from './sharedRunLocally';
15
-
16
- yargs(hideBin(process.argv))
17
- .command('$0 <projectSlug>', 'Run the project locally', (yargs) => {
18
- // ... configuration
19
- })
20
- .parse();
21
- ```
22
-
23
- **After:**
24
-
25
- ```typescript
26
- import yargs from 'yargs';
27
- import { hideBin } from 'yargs/helpers';
28
- import sharedRunLocally, { RunLocallyArgs } from './sharedRunLocally';
29
- import { installSignalHandlers } from './lib/process';
30
-
31
- // ✅ Add this single line at the top of the file
32
- installSignalHandlers();
33
-
34
- yargs(hideBin(process.argv))
35
- .command('$0 <projectSlug>', 'Run the project locally', (yargs) => {
36
- // ... configuration
37
- })
38
- .parse();
39
- ```
40
-
41
- That's it! All processes spawned by this CLI will now be automatically cleaned up on exit/error/signal.
42
-
43
- ## Step 2: Replace execAsync Calls with managedExecAsync
44
-
45
- ### Example: Updating background/src/lib/local/createLocalAnalyzer.ts
46
-
47
- **Before:**
48
-
49
- ```typescript
50
- import execAsync from '../virtualized/common/execAsync';
51
-
52
- export default async function createLocalAnalyzer({
53
- projectSlug,
54
- commitSha,
55
- steps,
56
- }: CreateLocalAnalyzerOptions): Promise<
57
- ChildProcessWithoutNullStreams | undefined
58
- > {
59
- let process: ChildProcessWithoutNullStreams | undefined;
60
-
61
- await execAsync({
62
- command: 'node',
63
- args: ['dist/project/start.js', ...args],
64
- env: {
65
- ...process.env,
66
- PROJECT_SLUG: projectSlug,
67
- COMMIT_SHA: commitSha,
68
- },
69
- onStart: async (proc) => {
70
- process = proc;
71
- },
72
- });
73
-
74
- return process;
75
- }
76
- ```
77
-
78
- **After:**
79
-
80
- ```typescript
81
- import { managedExecAsync, ProcessType } from '../process';
82
-
83
- export default async function createLocalAnalyzer({
84
- projectSlug,
85
- commitSha,
86
- steps,
87
- }: CreateLocalAnalyzerOptions): Promise<string> {
88
- // ✅ Returns process ID instead of ChildProcess
89
- const { processId } = managedExecAsync({
90
- command: 'node',
91
- args: ['dist/project/start.js', ...args],
92
- processType: ProcessType.Analyzer,
93
- processName: `analyzer-${projectSlug}`,
94
- metadata: {
95
- projectSlug,
96
- commitSha,
97
- steps,
98
- },
99
- env: {
100
- ...process.env,
101
- PROJECT_SLUG: projectSlug,
102
- COMMIT_SHA: commitSha,
103
- },
104
- returnProcessId: true,
105
- });
106
-
107
- // ✅ Return process ID for tracking
108
- return processId;
109
- }
110
- ```
111
-
112
- ## Step 3: Update Process Tracking
113
-
114
- ### Example: Updating orchestrate.ts
115
-
116
- **Before:**
117
-
118
- ```typescript
119
- interface ProcessMap {
120
- server?: ChildProcessWithoutNullStreams;
121
- capture?: ChildProcessWithoutNullStreams;
122
- }
123
-
124
- const processMap: ProcessMap = {};
125
-
126
- // Start server
127
- await execAsync({
128
- command: 'pnpm',
129
- args: ['runLocally', projectSlug],
130
- onStart: (process) => {
131
- processMap.server = process;
132
- },
133
- });
134
-
135
- // Later: cleanup
136
- if (processMap.server) {
137
- await killProcess('server', projectSlug, processMap.server.pid);
138
- }
139
- ```
140
-
141
- **After:**
142
-
143
- ```typescript
144
- import {
145
- managedExecAsync,
146
- getGlobalProcessManager,
147
- ProcessType,
148
- } from './lib/process';
149
-
150
- const manager = getGlobalProcessManager();
151
-
152
- // ✅ Start server with automatic tracking
153
- const { processId: serverId } = managedExecAsync({
154
- command: 'pnpm',
155
- args: ['runLocally', projectSlug],
156
- processType: ProcessType.Server,
157
- processName: `server-${projectSlug}`,
158
- metadata: { projectSlug },
159
- returnProcessId: true,
160
- });
161
-
162
- // ✅ Later: cleanup is as simple as
163
- await manager.shutdown(serverId);
164
-
165
- // ✅ Or even better: let signal handlers clean up automatically!
166
- // No manual cleanup needed
167
- ```
168
-
169
- ## Step 4: Handle Parent-Child Relationships
170
-
171
- ### Example: Server + Capture Orchestration
172
-
173
- **Before:**
174
-
175
- ```typescript
176
- let serverProcess: ChildProcessWithoutNullStreams;
177
- let captureProcess: ChildProcessWithoutNullStreams;
178
-
179
- // Start server
180
- await execAsync({
181
- command: 'pnpm',
182
- args: ['runLocally', projectSlug],
183
- onStart: (proc) => {
184
- serverProcess = proc;
185
- },
186
- });
187
-
188
- // Start capture
189
- await execAsync({
190
- command: 'pnpm',
191
- args: ['captureStatic', projectSlug],
192
- onStart: (proc) => {
193
- captureProcess = proc;
194
- },
195
- });
196
-
197
- // Cleanup: must manually track and kill both
198
- if (serverProcess) await killProcess('server', projectSlug, serverProcess.pid);
199
- if (captureProcess)
200
- await killProcess('capture', projectSlug, captureProcess.pid);
201
- ```
202
-
203
- **After:**
204
-
205
- ```typescript
206
- import {
207
- managedExecAsync,
208
- getGlobalProcessManager,
209
- ProcessType,
210
- } from './lib/process';
211
-
212
- const manager = getGlobalProcessManager();
213
-
214
- // ✅ Start server
215
- const { processId: serverId } = managedExecAsync({
216
- command: 'pnpm',
217
- args: ['runLocally', projectSlug],
218
- processType: ProcessType.Server,
219
- processName: `server-${projectSlug}`,
220
- metadata: { projectSlug },
221
- returnProcessId: true,
222
- });
223
-
224
- // ✅ Start capture as child of server
225
- const { processId: captureId } = managedExecAsync({
226
- command: 'pnpm',
227
- args: ['captureStatic', projectSlug],
228
- processType: ProcessType.Capture,
229
- processName: `capture-${projectSlug}`,
230
- parentId: serverId, // ✅ Link parent-child relationship
231
- metadata: { projectSlug },
232
- returnProcessId: true,
233
- });
234
-
235
- // ✅ Cleanup: shutting down parent kills children too
236
- await manager.shutdown(serverId, { shutdownChildren: true });
237
- // Both server and capture are now killed!
238
-
239
- // ✅ Or better yet: signal handlers do this automatically
240
- ```
241
-
242
- ## Step 5: Query and Monitor Processes
243
-
244
- ### Example: Monitoring Long-Running Processes
245
-
246
- ```typescript
247
- import { getGlobalProcessManager, ProcessType } from './lib/process';
248
-
249
- const manager = getGlobalProcessManager();
250
-
251
- // ✅ Monitor all analyzers
252
- function monitorAnalyzers() {
253
- const analyzers = manager.listByType(ProcessType.Analyzer);
254
-
255
- console.log(`Running ${analyzers.length} analyzer(s):`);
256
- analyzers.forEach((proc) => {
257
- const uptime = Date.now() - proc.startedAt;
258
- console.log(` - ${proc.name} (PID ${proc.pid}): ${uptime}ms`);
259
- if (proc.metadata) {
260
- console.log(` Metadata:`, proc.metadata);
261
- }
262
- });
263
- }
264
-
265
- // ✅ Find specific process
266
- function findProjectAnalyzer(projectSlug: string) {
267
- const analyzers = manager.findByName(`analyzer-${projectSlug}`);
268
- return analyzers[0] || null;
269
- }
270
-
271
- // ✅ Wait for process to complete
272
- async function waitForAnalysis(projectSlug: string) {
273
- const manager = getGlobalProcessManager();
274
-
275
- return new Promise<void>((resolve) => {
276
- const checkInterval = setInterval(() => {
277
- const analyzer = findProjectAnalyzer(projectSlug);
278
-
279
- if (!analyzer || analyzer.state !== 'running') {
280
- clearInterval(checkInterval);
281
- resolve();
282
- }
283
- }, 1000);
284
- });
285
- }
286
- ```
287
-
288
- ## Step 6: Handle Errors and Cleanup
289
-
290
- ### Example: Graceful Error Handling
291
-
292
- **Before:**
293
-
294
- ```typescript
295
- let serverProcess: ChildProcessWithoutNullStreams;
296
-
297
- try {
298
- await execAsync({
299
- command: 'node',
300
- args: ['server.js'],
301
- onStart: (proc) => {
302
- serverProcess = proc;
303
- },
304
- });
305
- } catch (error) {
306
- console.error('Server failed:', error);
307
- // ❌ Manual cleanup needed
308
- if (serverProcess) {
309
- await killProcess('server', projectSlug, serverProcess.pid);
310
- }
311
- throw error;
312
- }
313
- ```
314
-
315
- **After:**
316
-
317
- ```typescript
318
- import { managedExecAsync, ProcessType } from './lib/process';
319
-
320
- try {
321
- const exitCode = await managedExecAsync({
322
- command: 'node',
323
- args: ['server.js'],
324
- processType: ProcessType.Server,
325
- processName: 'main-server',
326
- });
327
-
328
- if (exitCode !== 0) {
329
- throw new Error(`Server exited with code ${exitCode}`);
330
- }
331
- } catch (error) {
332
- console.error('Server failed:', error);
333
- // ✅ No manual cleanup needed - signal handlers got it!
334
- throw error;
335
- }
336
- ```
337
-
338
- ## Complete Integration Example
339
-
340
- Here's a complete before/after for `orchestrate.ts`:
341
-
342
- ### Before:
343
-
344
- ```typescript
345
- import execAsync from './lib/virtualized/common/execAsync';
346
- import killProcessAndSubprocesses from '~codeyam/utils/src/lib/killProcessAndSubprocesses.server';
347
-
348
- interface ProcessMap {
349
- server?: ChildProcessWithoutNullStreams;
350
- capture?: ChildProcessWithoutNullStreams;
351
- }
352
-
353
- async function orchestrate(projectSlug: string) {
354
- const processMap: ProcessMap = {};
355
-
356
- try {
357
- // Start server
358
- await execAsync({
359
- command: 'pnpm',
360
- args: ['runLocally', projectSlug],
361
- onStart: (proc) => {
362
- processMap.server = proc;
363
- console.log(`Server started with PID ${proc.pid}`);
364
- },
365
- });
366
-
367
- // Start capture
368
- await execAsync({
369
- command: 'pnpm',
370
- args: ['captureStatic', projectSlug],
371
- onStart: (proc) => {
372
- processMap.capture = proc;
373
- console.log(`Capture started with PID ${proc.pid}`);
374
- },
375
- });
376
- } catch (error) {
377
- console.error('Orchestration failed:', error);
378
-
379
- // Manual cleanup
380
- if (processMap.server) {
381
- await killProcessAndSubprocesses(
382
- 'server',
383
- projectSlug,
384
- processMap.server.pid,
385
- );
386
- }
387
- if (processMap.capture) {
388
- await killProcessAndSubprocesses(
389
- 'capture',
390
- projectSlug,
391
- processMap.capture.pid,
392
- );
393
- }
394
-
395
- throw error;
396
- }
397
- }
398
-
399
- // SIGINT handler
400
- process.on('SIGINT', async () => {
401
- console.log('Cleaning up...');
402
- if (processMap.server) {
403
- await killProcessAndSubprocesses(
404
- 'server',
405
- projectSlug,
406
- processMap.server.pid,
407
- );
408
- }
409
- if (processMap.capture) {
410
- await killProcessAndSubprocesses(
411
- 'capture',
412
- projectSlug,
413
- processMap.capture.pid,
414
- );
415
- }
416
- process.exit(0);
417
- });
418
- ```
419
-
420
- ### After:
421
-
422
- ```typescript
423
- import {
424
- installSignalHandlers,
425
- managedExecAsync,
426
- getGlobalProcessManager,
427
- ProcessType,
428
- } from './lib/process';
429
-
430
- // ✅ One line replaces all manual signal handling
431
- installSignalHandlers();
432
-
433
- async function orchestrate(projectSlug: string) {
434
- const manager = getGlobalProcessManager();
435
-
436
- // ✅ Start server with automatic tracking
437
- const { processId: serverId } = managedExecAsync({
438
- command: 'pnpm',
439
- args: ['runLocally', projectSlug],
440
- processType: ProcessType.Server,
441
- processName: `server-${projectSlug}`,
442
- metadata: { projectSlug },
443
- returnProcessId: true,
444
- onStdout: (data) => {
445
- const serverInfo = manager.getInfo(serverId);
446
- console.log(`[Server ${serverInfo?.pid}] ${data}`);
447
- },
448
- });
449
-
450
- // ✅ Start capture as child of server
451
- const { processId: captureId } = managedExecAsync({
452
- command: 'pnpm',
453
- args: ['captureStatic', projectSlug],
454
- processType: ProcessType.Capture,
455
- processName: `capture-${projectSlug}`,
456
- parentId: serverId,
457
- metadata: { projectSlug },
458
- returnProcessId: true,
459
- onStdout: (data) => {
460
- const captureInfo = manager.getInfo(captureId);
461
- console.log(`[Capture ${captureInfo?.pid}] ${data}`);
462
- },
463
- });
464
-
465
- // ✅ No try/catch needed for cleanup
466
- // ✅ No SIGINT handler needed
467
- // ✅ All processes automatically cleaned up on exit/error/signal
468
- }
469
- ```
470
-
471
- ## Migration Checklist
472
-
473
- For each CLI entry point:
474
-
475
- - [ ] Add `installSignalHandlers()` at the top of the file
476
- - [ ] Replace `execAsync` with `managedExecAsync`
477
- - [ ] Replace `ProcessMap` tracking with `managedExecAsync({ returnProcessId: true })`
478
- - [ ] Remove manual `killProcess` / `killProcessAndSubprocesses` calls
479
- - [ ] Remove manual SIGINT/SIGTERM handlers
480
- - [ ] Add parent-child relationships where appropriate
481
- - [ ] Add metadata for easier debugging/monitoring
482
- - [ ] Test that processes are cleaned up on Ctrl+C
483
- - [ ] Test that processes are cleaned up on uncaught errors
484
- - [ ] Update tests to use the new process management system
485
-
486
- ## Testing Your Integration
487
-
488
- 1. **Test Ctrl+C cleanup:**
489
-
490
- ```bash
491
- pnpm runLocally my-project
492
- # Press Ctrl+C
493
- # Check that all processes are killed: ps aux | grep CODEYAM
494
- ```
495
-
496
- 2. **Test error cleanup:**
497
-
498
- ```typescript
499
- // Add a deliberate error in your code
500
- throw new Error('Test error');
501
- // Check that all processes are killed
502
- ```
503
-
504
- 3. **Test normal exit:**
505
-
506
- ```bash
507
- pnpm runLocally my-project --steps analyze
508
- # Let it complete normally
509
- # Check that all processes are cleaned up
510
- ```
511
-
512
- 4. **Monitor processes:**
513
- ```typescript
514
- const manager = getGlobalProcessManager();
515
- console.log('Active processes:', manager.listAll());
516
- ```
517
-
518
- ## Tips
519
-
520
- 1. **Always use processType**: This helps with querying and debugging
521
- 2. **Use descriptive processNames**: Include project slug or other identifiers
522
- 3. **Add metadata**: Store useful context for debugging
523
- 4. **Use parent-child relationships**: Makes cleanup easier and more organized
524
- 5. **Let signal handlers do the work**: Don't write manual cleanup code
525
- 6. **Trust the tests**: 57 tests ensure the system works correctly