@qpqjs/cli 0.0.0-stage → 0.2.0

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 (549) hide show
  1. package/README.md +92 -2
  2. package/docker/cdk-deployer/Dockerfile +13 -0
  3. package/docker/dev-server/Dockerfile +47 -0
  4. package/lib/commonjs/bin/qpq.d.ts +2 -0
  5. package/lib/commonjs/bin/qpq.js +6 -0
  6. package/lib/commonjs/bin/qpq.js.map +1 -0
  7. package/lib/commonjs/bin/qpqCdkApp.d.ts +1 -0
  8. package/lib/commonjs/bin/qpqCdkApp.js +8 -0
  9. package/lib/commonjs/bin/qpqCdkApp.js.map +1 -0
  10. package/lib/commonjs/cli/commandMenu.d.ts +2 -0
  11. package/lib/commonjs/cli/commandMenu.js +81 -0
  12. package/lib/commonjs/cli/commandMenu.js.map +1 -0
  13. package/lib/commonjs/cli/commandRegistry.d.ts +10 -0
  14. package/lib/commonjs/cli/commandRegistry.js +177 -0
  15. package/lib/commonjs/cli/commandRegistry.js.map +1 -0
  16. package/lib/commonjs/cli/index.d.ts +1 -0
  17. package/lib/commonjs/cli/index.js +18 -0
  18. package/lib/commonjs/cli/index.js.map +1 -0
  19. package/lib/commonjs/cli/runCli.d.ts +1 -0
  20. package/lib/commonjs/cli/runCli.js +86 -0
  21. package/lib/commonjs/cli/runCli.js.map +1 -0
  22. package/lib/commonjs/commands/checkCircular.d.ts +1 -0
  23. package/lib/commonjs/commands/checkCircular.js +70 -0
  24. package/lib/commonjs/commands/checkCircular.js.map +1 -0
  25. package/lib/commonjs/commands/clearResources.d.ts +1 -0
  26. package/lib/commonjs/commands/clearResources.js +36 -0
  27. package/lib/commonjs/commands/clearResources.js.map +1 -0
  28. package/lib/commonjs/commands/go.d.ts +1 -0
  29. package/lib/commonjs/commands/go.js +30 -0
  30. package/lib/commonjs/commands/go.js.map +1 -0
  31. package/lib/commonjs/commands/goDev.d.ts +1 -0
  32. package/lib/commonjs/commands/goDev.js +46 -0
  33. package/lib/commonjs/commands/goDev.js.map +1 -0
  34. package/lib/commonjs/commands/goDevApi.d.ts +1 -0
  35. package/lib/commonjs/commands/goDevApi.js +158 -0
  36. package/lib/commonjs/commands/goDevApi.js.map +1 -0
  37. package/lib/commonjs/commands/goDevWeb.d.ts +4 -0
  38. package/lib/commonjs/commands/goDevWeb.js +144 -0
  39. package/lib/commonjs/commands/goDevWeb.js.map +1 -0
  40. package/lib/commonjs/commands/goDocker.d.ts +1 -0
  41. package/lib/commonjs/commands/goDocker.js +43 -0
  42. package/lib/commonjs/commands/goDocker.js.map +1 -0
  43. package/lib/commonjs/commands/hooks.d.ts +1 -0
  44. package/lib/commonjs/commands/hooks.js +39 -0
  45. package/lib/commonjs/commands/hooks.js.map +1 -0
  46. package/lib/commonjs/commands/migrate.d.ts +1 -0
  47. package/lib/commonjs/commands/migrate.js +70 -0
  48. package/lib/commonjs/commands/migrate.js.map +1 -0
  49. package/lib/commonjs/commands/prep.d.ts +1 -0
  50. package/lib/commonjs/commands/prep.js +28 -0
  51. package/lib/commonjs/commands/prep.js.map +1 -0
  52. package/lib/commonjs/commands/publish.d.ts +4 -0
  53. package/lib/commonjs/commands/publish.js +54 -0
  54. package/lib/commonjs/commands/publish.js.map +1 -0
  55. package/lib/commonjs/commands/scriptBuild.d.ts +1 -0
  56. package/lib/commonjs/commands/scriptBuild.js +46 -0
  57. package/lib/commonjs/commands/scriptBuild.js.map +1 -0
  58. package/lib/commonjs/commands/scriptBuilderLayer.d.ts +1 -0
  59. package/lib/commonjs/commands/scriptBuilderLayer.js +48 -0
  60. package/lib/commonjs/commands/scriptBuilderLayer.js.map +1 -0
  61. package/lib/commonjs/commands/scriptNew.d.ts +1 -0
  62. package/lib/commonjs/commands/scriptNew.js +35 -0
  63. package/lib/commonjs/commands/scriptNew.js.map +1 -0
  64. package/lib/commonjs/commands/setup.d.ts +1 -0
  65. package/lib/commonjs/commands/setup.js +102 -0
  66. package/lib/commonjs/commands/setup.js.map +1 -0
  67. package/lib/commonjs/commands/synth.d.ts +1 -0
  68. package/lib/commonjs/commands/synth.js +89 -0
  69. package/lib/commonjs/commands/synth.js.map +1 -0
  70. package/lib/commonjs/commands/teardown.d.ts +1 -0
  71. package/lib/commonjs/commands/teardown.js +33 -0
  72. package/lib/commonjs/commands/teardown.js.map +1 -0
  73. package/lib/commonjs/index.d.ts +1 -0
  74. package/lib/commonjs/index.js +18 -0
  75. package/lib/commonjs/index.js.map +1 -0
  76. package/lib/commonjs/lib/args.d.ts +3 -0
  77. package/lib/commonjs/lib/args.js +31 -0
  78. package/lib/commonjs/lib/args.js.map +1 -0
  79. package/lib/commonjs/lib/circularImports.d.ts +3 -0
  80. package/lib/commonjs/lib/circularImports.js +79 -0
  81. package/lib/commonjs/lib/circularImports.js.map +1 -0
  82. package/lib/commonjs/lib/clearResourcesPlan.d.ts +15 -0
  83. package/lib/commonjs/lib/clearResourcesPlan.js +79 -0
  84. package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -0
  85. package/lib/commonjs/lib/deployPrompts.d.ts +26 -0
  86. package/lib/commonjs/lib/deployPrompts.js +118 -0
  87. package/lib/commonjs/lib/deployPrompts.js.map +1 -0
  88. package/lib/commonjs/lib/devServerEntry.d.ts +22 -0
  89. package/lib/commonjs/lib/devServerEntry.js +135 -0
  90. package/lib/commonjs/lib/devServerEntry.js.map +1 -0
  91. package/lib/commonjs/lib/devServerPorts.d.ts +13 -0
  92. package/lib/commonjs/lib/devServerPorts.js +36 -0
  93. package/lib/commonjs/lib/devServerPorts.js.map +1 -0
  94. package/lib/commonjs/lib/discovery.d.ts +10 -0
  95. package/lib/commonjs/lib/discovery.js +56 -0
  96. package/lib/commonjs/lib/discovery.js.map +1 -0
  97. package/lib/commonjs/lib/getDefaultHookJobs.d.ts +2 -0
  98. package/lib/commonjs/lib/getDefaultHookJobs.js +11 -0
  99. package/lib/commonjs/lib/getDefaultHookJobs.js.map +1 -0
  100. package/lib/commonjs/lib/getDeployTargetLabel.d.ts +2 -0
  101. package/lib/commonjs/lib/getDeployTargetLabel.js +12 -0
  102. package/lib/commonjs/lib/getDeployTargetLabel.js.map +1 -0
  103. package/lib/commonjs/lib/goDockerMode.d.ts +6 -0
  104. package/lib/commonjs/lib/goDockerMode.js +23 -0
  105. package/lib/commonjs/lib/goDockerMode.js.map +1 -0
  106. package/lib/commonjs/lib/hooks.d.ts +9 -0
  107. package/lib/commonjs/lib/hooks.js +178 -0
  108. package/lib/commonjs/lib/hooks.js.map +1 -0
  109. package/lib/commonjs/lib/keepOtherDevServersFlag.d.ts +1 -0
  110. package/lib/commonjs/lib/keepOtherDevServersFlag.js +11 -0
  111. package/lib/commonjs/lib/keepOtherDevServersFlag.js.map +1 -0
  112. package/lib/commonjs/lib/killChildWithEscalation.d.ts +10 -0
  113. package/lib/commonjs/lib/killChildWithEscalation.js +33 -0
  114. package/lib/commonjs/lib/killChildWithEscalation.js.map +1 -0
  115. package/lib/commonjs/lib/killStaleListeners.d.ts +17 -0
  116. package/lib/commonjs/lib/killStaleListeners.js +220 -0
  117. package/lib/commonjs/lib/killStaleListeners.js.map +1 -0
  118. package/lib/commonjs/lib/packageRoot.d.ts +1 -0
  119. package/lib/commonjs/lib/packageRoot.js +21 -0
  120. package/lib/commonjs/lib/packageRoot.js.map +1 -0
  121. package/lib/commonjs/lib/prompts.d.ts +15 -0
  122. package/lib/commonjs/lib/prompts.js +78 -0
  123. package/lib/commonjs/lib/prompts.js.map +1 -0
  124. package/lib/commonjs/lib/qpqConfigs.d.ts +4 -0
  125. package/lib/commonjs/lib/qpqConfigs.js +27 -0
  126. package/lib/commonjs/lib/qpqConfigs.js.map +1 -0
  127. package/lib/commonjs/lib/resolveAppSelection.d.ts +6 -0
  128. package/lib/commonjs/lib/resolveAppSelection.js +58 -0
  129. package/lib/commonjs/lib/resolveAppSelection.js.map +1 -0
  130. package/lib/commonjs/lib/resolveDeployment.d.ts +14 -0
  131. package/lib/commonjs/lib/resolveDeployment.js +58 -0
  132. package/lib/commonjs/lib/resolveDeployment.js.map +1 -0
  133. package/lib/commonjs/lib/runCommand.d.ts +14 -0
  134. package/lib/commonjs/lib/runCommand.js +103 -0
  135. package/lib/commonjs/lib/runCommand.js.map +1 -0
  136. package/lib/commonjs/lib/runTasks.d.ts +15 -0
  137. package/lib/commonjs/lib/runTasks.js +123 -0
  138. package/lib/commonjs/lib/runTasks.js.map +1 -0
  139. package/lib/commonjs/lib/setupStep.d.ts +16 -0
  140. package/lib/commonjs/lib/setupStep.js +3 -0
  141. package/lib/commonjs/lib/setupStep.js.map +1 -0
  142. package/lib/commonjs/lib/timing.d.ts +2 -0
  143. package/lib/commonjs/lib/timing.js +11 -0
  144. package/lib/commonjs/lib/timing.js.map +1 -0
  145. package/lib/commonjs/lib/typeWatcher.d.ts +2 -0
  146. package/lib/commonjs/lib/typeWatcher.js +59 -0
  147. package/lib/commonjs/lib/typeWatcher.js.map +1 -0
  148. package/lib/commonjs/lib/userScriptBuilderLayer.d.ts +23 -0
  149. package/lib/commonjs/lib/userScriptBuilderLayer.js +74 -0
  150. package/lib/commonjs/lib/userScriptBuilderLayer.js.map +1 -0
  151. package/lib/commonjs/lib/userScriptTemplate.d.ts +6 -0
  152. package/lib/commonjs/lib/userScriptTemplate.js +47 -0
  153. package/lib/commonjs/lib/userScriptTemplate.js.map +1 -0
  154. package/lib/commonjs/lib/views.d.ts +2 -0
  155. package/lib/commonjs/lib/views.js +31 -0
  156. package/lib/commonjs/lib/views.js.map +1 -0
  157. package/lib/commonjs/lib/webAddressingEnv.d.ts +7 -0
  158. package/lib/commonjs/lib/webAddressingEnv.js +16 -0
  159. package/lib/commonjs/lib/webAddressingEnv.js.map +1 -0
  160. package/lib/commonjs/platforms/aws/awsCredentials.d.ts +1 -0
  161. package/lib/commonjs/platforms/aws/awsCredentials.js +28 -0
  162. package/lib/commonjs/platforms/aws/awsCredentials.js.map +1 -0
  163. package/lib/commonjs/platforms/aws/cdkApp.d.ts +3 -0
  164. package/lib/commonjs/platforms/aws/cdkApp.js +31 -0
  165. package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -0
  166. package/lib/commonjs/platforms/aws/clearResources.d.ts +2 -0
  167. package/lib/commonjs/platforms/aws/clearResources.js +167 -0
  168. package/lib/commonjs/platforms/aws/clearResources.js.map +1 -0
  169. package/lib/commonjs/platforms/aws/go.d.ts +2 -0
  170. package/lib/commonjs/platforms/aws/go.js +131 -0
  171. package/lib/commonjs/platforms/aws/go.js.map +1 -0
  172. package/lib/commonjs/platforms/aws/goDocker.d.ts +3 -0
  173. package/lib/commonjs/platforms/aws/goDocker.js +457 -0
  174. package/lib/commonjs/platforms/aws/goDocker.js.map +1 -0
  175. package/lib/commonjs/platforms/aws/goDockerManifest.d.ts +44 -0
  176. package/lib/commonjs/platforms/aws/goDockerManifest.js +38 -0
  177. package/lib/commonjs/platforms/aws/goDockerManifest.js.map +1 -0
  178. package/lib/commonjs/platforms/aws/index.d.ts +2 -0
  179. package/lib/commonjs/platforms/aws/index.js +23 -0
  180. package/lib/commonjs/platforms/aws/index.js.map +1 -0
  181. package/lib/commonjs/platforms/aws/prepareDeployment.d.ts +3 -0
  182. package/lib/commonjs/platforms/aws/prepareDeployment.js +10 -0
  183. package/lib/commonjs/platforms/aws/prepareDeployment.js.map +1 -0
  184. package/lib/commonjs/platforms/aws/publish.d.ts +4 -0
  185. package/lib/commonjs/platforms/aws/publish.js +66 -0
  186. package/lib/commonjs/platforms/aws/publish.js.map +1 -0
  187. package/lib/commonjs/platforms/aws/remote.d.ts +11 -0
  188. package/lib/commonjs/platforms/aws/remote.js +105 -0
  189. package/lib/commonjs/platforms/aws/remote.js.map +1 -0
  190. package/lib/commonjs/platforms/aws/setup/awsSetupContext.d.ts +12 -0
  191. package/lib/commonjs/platforms/aws/setup/awsSetupContext.js +20 -0
  192. package/lib/commonjs/platforms/aws/setup/awsSetupContext.js.map +1 -0
  193. package/lib/commonjs/platforms/aws/setup/awsSetupSteps.d.ts +8 -0
  194. package/lib/commonjs/platforms/aws/setup/awsSetupSteps.js +44 -0
  195. package/lib/commonjs/platforms/aws/setup/awsSetupSteps.js.map +1 -0
  196. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.d.ts +4 -0
  197. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js +77 -0
  198. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js.map +1 -0
  199. package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.d.ts +5 -0
  200. package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.js +38 -0
  201. package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.js.map +1 -0
  202. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.d.ts +4 -0
  203. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js +55 -0
  204. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -0
  205. package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.d.ts +4 -0
  206. package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.js +54 -0
  207. package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.js.map +1 -0
  208. package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.d.ts +4 -0
  209. package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.js +63 -0
  210. package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.js.map +1 -0
  211. package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.d.ts +4 -0
  212. package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.js +48 -0
  213. package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.js.map +1 -0
  214. package/lib/commonjs/platforms/aws/setup/buildIdentityStep.d.ts +4 -0
  215. package/lib/commonjs/platforms/aws/setup/buildIdentityStep.js +39 -0
  216. package/lib/commonjs/platforms/aws/setup/buildIdentityStep.js.map +1 -0
  217. package/lib/commonjs/platforms/aws/setup/buildStackSteps.d.ts +5 -0
  218. package/lib/commonjs/platforms/aws/setup/buildStackSteps.js +32 -0
  219. package/lib/commonjs/platforms/aws/setup/buildStackSteps.js.map +1 -0
  220. package/lib/commonjs/platforms/aws/setup/describeStackStatus.d.ts +4 -0
  221. package/lib/commonjs/platforms/aws/setup/describeStackStatus.js +32 -0
  222. package/lib/commonjs/platforms/aws/setup/describeStackStatus.js.map +1 -0
  223. package/lib/commonjs/platforms/aws/setup/index.d.ts +1 -0
  224. package/lib/commonjs/platforms/aws/setup/index.js +18 -0
  225. package/lib/commonjs/platforms/aws/setup/index.js.map +1 -0
  226. package/lib/commonjs/platforms/aws/stacks.d.ts +7 -0
  227. package/lib/commonjs/platforms/aws/stacks.js +94 -0
  228. package/lib/commonjs/platforms/aws/stacks.js.map +1 -0
  229. package/lib/commonjs/platforms/aws/teardown.d.ts +2 -0
  230. package/lib/commonjs/platforms/aws/teardown.js +59 -0
  231. package/lib/commonjs/platforms/aws/teardown.js.map +1 -0
  232. package/lib/commonjs/platforms/aws/viewsSync.d.ts +3 -0
  233. package/lib/commonjs/platforms/aws/viewsSync.js +77 -0
  234. package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -0
  235. package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.d.ts +10 -0
  236. package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.js +3 -0
  237. package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.js.map +1 -0
  238. package/lib/commonjs/platforms/docker/getContainerPorts.d.ts +4 -0
  239. package/lib/commonjs/platforms/docker/getContainerPorts.js +12 -0
  240. package/lib/commonjs/platforms/docker/getContainerPorts.js.map +1 -0
  241. package/lib/commonjs/platforms/docker/getDefaultPortMappings.d.ts +3 -0
  242. package/lib/commonjs/platforms/docker/getDefaultPortMappings.js +10 -0
  243. package/lib/commonjs/platforms/docker/getDefaultPortMappings.js.map +1 -0
  244. package/lib/commonjs/platforms/docker/getDockerPlatformSettings.d.ts +14 -0
  245. package/lib/commonjs/platforms/docker/getDockerPlatformSettings.js +39 -0
  246. package/lib/commonjs/platforms/docker/getDockerPlatformSettings.js.map +1 -0
  247. package/lib/commonjs/platforms/docker/getImageName.d.ts +6 -0
  248. package/lib/commonjs/platforms/docker/getImageName.js +10 -0
  249. package/lib/commonjs/platforms/docker/getImageName.js.map +1 -0
  250. package/lib/commonjs/platforms/docker/go.d.ts +2 -0
  251. package/lib/commonjs/platforms/docker/go.js +261 -0
  252. package/lib/commonjs/platforms/docker/go.js.map +1 -0
  253. package/lib/commonjs/platforms/docker/index.d.ts +2 -0
  254. package/lib/commonjs/platforms/docker/index.js +43 -0
  255. package/lib/commonjs/platforms/docker/index.js.map +1 -0
  256. package/lib/commonjs/platforms/docker/parseMounts.d.ts +7 -0
  257. package/lib/commonjs/platforms/docker/parseMounts.js +27 -0
  258. package/lib/commonjs/platforms/docker/parseMounts.js.map +1 -0
  259. package/lib/commonjs/platforms/docker/parsePortMappings.d.ts +8 -0
  260. package/lib/commonjs/platforms/docker/parsePortMappings.js +26 -0
  261. package/lib/commonjs/platforms/docker/parsePortMappings.js.map +1 -0
  262. package/lib/commonjs/platforms/docker/resolvePortMappings.d.ts +8 -0
  263. package/lib/commonjs/platforms/docker/resolvePortMappings.js +23 -0
  264. package/lib/commonjs/platforms/docker/resolvePortMappings.js.map +1 -0
  265. package/lib/commonjs/platforms/docker/writeComposeFile.d.ts +20 -0
  266. package/lib/commonjs/platforms/docker/writeComposeFile.js +44 -0
  267. package/lib/commonjs/platforms/docker/writeComposeFile.js.map +1 -0
  268. package/lib/commonjs/platforms/index.d.ts +3 -0
  269. package/lib/commonjs/platforms/index.js +35 -0
  270. package/lib/commonjs/platforms/index.js.map +1 -0
  271. package/lib/commonjs/platforms/types.d.ts +21 -0
  272. package/lib/commonjs/platforms/types.js +9 -0
  273. package/lib/commonjs/platforms/types.js.map +1 -0
  274. package/lib/esm/bin/qpq.d.ts +2 -0
  275. package/lib/esm/bin/qpq.js +4 -0
  276. package/lib/esm/bin/qpq.js.map +1 -0
  277. package/lib/esm/bin/qpqCdkApp.d.ts +1 -0
  278. package/lib/esm/bin/qpqCdkApp.js +6 -0
  279. package/lib/esm/bin/qpqCdkApp.js.map +1 -0
  280. package/lib/esm/cli/commandMenu.d.ts +2 -0
  281. package/lib/esm/cli/commandMenu.js +67 -0
  282. package/lib/esm/cli/commandMenu.js.map +1 -0
  283. package/lib/esm/cli/commandRegistry.d.ts +10 -0
  284. package/lib/esm/cli/commandRegistry.js +161 -0
  285. package/lib/esm/cli/commandRegistry.js.map +1 -0
  286. package/lib/esm/cli/index.d.ts +1 -0
  287. package/lib/esm/cli/index.js +2 -0
  288. package/lib/esm/cli/index.js.map +1 -0
  289. package/lib/esm/cli/runCli.d.ts +1 -0
  290. package/lib/esm/cli/runCli.js +73 -0
  291. package/lib/esm/cli/runCli.js.map +1 -0
  292. package/lib/esm/commands/checkCircular.d.ts +1 -0
  293. package/lib/esm/commands/checkCircular.js +55 -0
  294. package/lib/esm/commands/checkCircular.js.map +1 -0
  295. package/lib/esm/commands/clearResources.d.ts +1 -0
  296. package/lib/esm/commands/clearResources.js +23 -0
  297. package/lib/esm/commands/clearResources.js.map +1 -0
  298. package/lib/esm/commands/go.d.ts +1 -0
  299. package/lib/esm/commands/go.js +16 -0
  300. package/lib/esm/commands/go.js.map +1 -0
  301. package/lib/esm/commands/goDev.d.ts +1 -0
  302. package/lib/esm/commands/goDev.js +33 -0
  303. package/lib/esm/commands/goDev.js.map +1 -0
  304. package/lib/esm/commands/goDevApi.d.ts +1 -0
  305. package/lib/esm/commands/goDevApi.js +142 -0
  306. package/lib/esm/commands/goDevApi.js.map +1 -0
  307. package/lib/esm/commands/goDevWeb.d.ts +4 -0
  308. package/lib/esm/commands/goDevWeb.js +129 -0
  309. package/lib/esm/commands/goDevWeb.js.map +1 -0
  310. package/lib/esm/commands/goDocker.d.ts +1 -0
  311. package/lib/esm/commands/goDocker.js +29 -0
  312. package/lib/esm/commands/goDocker.js.map +1 -0
  313. package/lib/esm/commands/hooks.d.ts +1 -0
  314. package/lib/esm/commands/hooks.js +26 -0
  315. package/lib/esm/commands/hooks.js.map +1 -0
  316. package/lib/esm/commands/migrate.d.ts +1 -0
  317. package/lib/esm/commands/migrate.js +57 -0
  318. package/lib/esm/commands/migrate.js.map +1 -0
  319. package/lib/esm/commands/prep.d.ts +1 -0
  320. package/lib/esm/commands/prep.js +15 -0
  321. package/lib/esm/commands/prep.js.map +1 -0
  322. package/lib/esm/commands/publish.d.ts +4 -0
  323. package/lib/esm/commands/publish.js +38 -0
  324. package/lib/esm/commands/publish.js.map +1 -0
  325. package/lib/esm/commands/scriptBuild.d.ts +1 -0
  326. package/lib/esm/commands/scriptBuild.js +29 -0
  327. package/lib/esm/commands/scriptBuild.js.map +1 -0
  328. package/lib/esm/commands/scriptBuilderLayer.d.ts +1 -0
  329. package/lib/esm/commands/scriptBuilderLayer.js +34 -0
  330. package/lib/esm/commands/scriptBuilderLayer.js.map +1 -0
  331. package/lib/esm/commands/scriptNew.d.ts +1 -0
  332. package/lib/esm/commands/scriptNew.js +19 -0
  333. package/lib/esm/commands/scriptNew.js.map +1 -0
  334. package/lib/esm/commands/setup.d.ts +1 -0
  335. package/lib/esm/commands/setup.js +88 -0
  336. package/lib/esm/commands/setup.js.map +1 -0
  337. package/lib/esm/commands/synth.d.ts +1 -0
  338. package/lib/esm/commands/synth.js +73 -0
  339. package/lib/esm/commands/synth.js.map +1 -0
  340. package/lib/esm/commands/teardown.d.ts +1 -0
  341. package/lib/esm/commands/teardown.js +20 -0
  342. package/lib/esm/commands/teardown.js.map +1 -0
  343. package/lib/esm/index.d.ts +1 -0
  344. package/lib/esm/index.js +2 -0
  345. package/lib/esm/index.js.map +1 -0
  346. package/lib/esm/lib/args.d.ts +3 -0
  347. package/lib/esm/lib/args.js +25 -0
  348. package/lib/esm/lib/args.js.map +1 -0
  349. package/lib/esm/lib/circularImports.d.ts +3 -0
  350. package/lib/esm/lib/circularImports.js +61 -0
  351. package/lib/esm/lib/circularImports.js.map +1 -0
  352. package/lib/esm/lib/clearResourcesPlan.d.ts +15 -0
  353. package/lib/esm/lib/clearResourcesPlan.js +65 -0
  354. package/lib/esm/lib/clearResourcesPlan.js.map +1 -0
  355. package/lib/esm/lib/deployPrompts.d.ts +26 -0
  356. package/lib/esm/lib/deployPrompts.js +103 -0
  357. package/lib/esm/lib/deployPrompts.js.map +1 -0
  358. package/lib/esm/lib/devServerEntry.d.ts +22 -0
  359. package/lib/esm/lib/devServerEntry.js +127 -0
  360. package/lib/esm/lib/devServerEntry.js.map +1 -0
  361. package/lib/esm/lib/devServerPorts.d.ts +13 -0
  362. package/lib/esm/lib/devServerPorts.js +27 -0
  363. package/lib/esm/lib/devServerPorts.js.map +1 -0
  364. package/lib/esm/lib/discovery.d.ts +10 -0
  365. package/lib/esm/lib/discovery.js +40 -0
  366. package/lib/esm/lib/discovery.js.map +1 -0
  367. package/lib/esm/lib/getDefaultHookJobs.d.ts +2 -0
  368. package/lib/esm/lib/getDefaultHookJobs.js +4 -0
  369. package/lib/esm/lib/getDefaultHookJobs.js.map +1 -0
  370. package/lib/esm/lib/getDeployTargetLabel.d.ts +2 -0
  371. package/lib/esm/lib/getDeployTargetLabel.js +8 -0
  372. package/lib/esm/lib/getDeployTargetLabel.js.map +1 -0
  373. package/lib/esm/lib/goDockerMode.d.ts +6 -0
  374. package/lib/esm/lib/goDockerMode.js +19 -0
  375. package/lib/esm/lib/goDockerMode.js.map +1 -0
  376. package/lib/esm/lib/hooks.d.ts +9 -0
  377. package/lib/esm/lib/hooks.js +154 -0
  378. package/lib/esm/lib/hooks.js.map +1 -0
  379. package/lib/esm/lib/keepOtherDevServersFlag.d.ts +1 -0
  380. package/lib/esm/lib/keepOtherDevServersFlag.js +8 -0
  381. package/lib/esm/lib/keepOtherDevServersFlag.js.map +1 -0
  382. package/lib/esm/lib/killChildWithEscalation.d.ts +10 -0
  383. package/lib/esm/lib/killChildWithEscalation.js +29 -0
  384. package/lib/esm/lib/killChildWithEscalation.js.map +1 -0
  385. package/lib/esm/lib/killStaleListeners.d.ts +17 -0
  386. package/lib/esm/lib/killStaleListeners.js +210 -0
  387. package/lib/esm/lib/killStaleListeners.js.map +1 -0
  388. package/lib/esm/lib/packageRoot.d.ts +1 -0
  389. package/lib/esm/lib/packageRoot.js +14 -0
  390. package/lib/esm/lib/packageRoot.js.map +1 -0
  391. package/lib/esm/lib/prompts.d.ts +15 -0
  392. package/lib/esm/lib/prompts.js +28 -0
  393. package/lib/esm/lib/prompts.js.map +1 -0
  394. package/lib/esm/lib/qpqConfigs.d.ts +4 -0
  395. package/lib/esm/lib/qpqConfigs.js +21 -0
  396. package/lib/esm/lib/qpqConfigs.js.map +1 -0
  397. package/lib/esm/lib/resolveAppSelection.d.ts +6 -0
  398. package/lib/esm/lib/resolveAppSelection.js +45 -0
  399. package/lib/esm/lib/resolveAppSelection.js.map +1 -0
  400. package/lib/esm/lib/resolveDeployment.d.ts +14 -0
  401. package/lib/esm/lib/resolveDeployment.js +45 -0
  402. package/lib/esm/lib/resolveDeployment.js.map +1 -0
  403. package/lib/esm/lib/runCommand.d.ts +14 -0
  404. package/lib/esm/lib/runCommand.js +92 -0
  405. package/lib/esm/lib/runCommand.js.map +1 -0
  406. package/lib/esm/lib/runTasks.d.ts +15 -0
  407. package/lib/esm/lib/runTasks.js +108 -0
  408. package/lib/esm/lib/runTasks.js.map +1 -0
  409. package/lib/esm/lib/setupStep.d.ts +16 -0
  410. package/lib/esm/lib/setupStep.js +2 -0
  411. package/lib/esm/lib/setupStep.js.map +1 -0
  412. package/lib/esm/lib/timing.d.ts +2 -0
  413. package/lib/esm/lib/timing.js +6 -0
  414. package/lib/esm/lib/timing.js.map +1 -0
  415. package/lib/esm/lib/typeWatcher.d.ts +2 -0
  416. package/lib/esm/lib/typeWatcher.js +51 -0
  417. package/lib/esm/lib/typeWatcher.js.map +1 -0
  418. package/lib/esm/lib/userScriptBuilderLayer.d.ts +23 -0
  419. package/lib/esm/lib/userScriptBuilderLayer.js +65 -0
  420. package/lib/esm/lib/userScriptBuilderLayer.js.map +1 -0
  421. package/lib/esm/lib/userScriptTemplate.d.ts +6 -0
  422. package/lib/esm/lib/userScriptTemplate.js +39 -0
  423. package/lib/esm/lib/userScriptTemplate.js.map +1 -0
  424. package/lib/esm/lib/views.d.ts +2 -0
  425. package/lib/esm/lib/views.js +14 -0
  426. package/lib/esm/lib/views.js.map +1 -0
  427. package/lib/esm/lib/webAddressingEnv.d.ts +7 -0
  428. package/lib/esm/lib/webAddressingEnv.js +11 -0
  429. package/lib/esm/lib/webAddressingEnv.js.map +1 -0
  430. package/lib/esm/platforms/aws/awsCredentials.d.ts +1 -0
  431. package/lib/esm/platforms/aws/awsCredentials.js +15 -0
  432. package/lib/esm/platforms/aws/awsCredentials.js.map +1 -0
  433. package/lib/esm/platforms/aws/cdkApp.d.ts +3 -0
  434. package/lib/esm/platforms/aws/cdkApp.js +22 -0
  435. package/lib/esm/platforms/aws/cdkApp.js.map +1 -0
  436. package/lib/esm/platforms/aws/clearResources.d.ts +2 -0
  437. package/lib/esm/platforms/aws/clearResources.js +151 -0
  438. package/lib/esm/platforms/aws/clearResources.js.map +1 -0
  439. package/lib/esm/platforms/aws/go.d.ts +2 -0
  440. package/lib/esm/platforms/aws/go.js +115 -0
  441. package/lib/esm/platforms/aws/go.js.map +1 -0
  442. package/lib/esm/platforms/aws/goDocker.d.ts +3 -0
  443. package/lib/esm/platforms/aws/goDocker.js +441 -0
  444. package/lib/esm/platforms/aws/goDocker.js.map +1 -0
  445. package/lib/esm/platforms/aws/goDockerManifest.d.ts +44 -0
  446. package/lib/esm/platforms/aws/goDockerManifest.js +26 -0
  447. package/lib/esm/platforms/aws/goDockerManifest.js.map +1 -0
  448. package/lib/esm/platforms/aws/index.d.ts +2 -0
  449. package/lib/esm/platforms/aws/index.js +20 -0
  450. package/lib/esm/platforms/aws/index.js.map +1 -0
  451. package/lib/esm/platforms/aws/prepareDeployment.d.ts +3 -0
  452. package/lib/esm/platforms/aws/prepareDeployment.js +6 -0
  453. package/lib/esm/platforms/aws/prepareDeployment.js.map +1 -0
  454. package/lib/esm/platforms/aws/publish.d.ts +4 -0
  455. package/lib/esm/platforms/aws/publish.js +50 -0
  456. package/lib/esm/platforms/aws/publish.js.map +1 -0
  457. package/lib/esm/platforms/aws/remote.d.ts +11 -0
  458. package/lib/esm/platforms/aws/remote.js +89 -0
  459. package/lib/esm/platforms/aws/remote.js.map +1 -0
  460. package/lib/esm/platforms/aws/setup/awsSetupContext.d.ts +12 -0
  461. package/lib/esm/platforms/aws/setup/awsSetupContext.js +16 -0
  462. package/lib/esm/platforms/aws/setup/awsSetupContext.js.map +1 -0
  463. package/lib/esm/platforms/aws/setup/awsSetupSteps.d.ts +8 -0
  464. package/lib/esm/platforms/aws/setup/awsSetupSteps.js +31 -0
  465. package/lib/esm/platforms/aws/setup/awsSetupSteps.js.map +1 -0
  466. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.d.ts +4 -0
  467. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js +62 -0
  468. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js.map +1 -0
  469. package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.d.ts +5 -0
  470. package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.js +24 -0
  471. package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.js.map +1 -0
  472. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.d.ts +4 -0
  473. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js +40 -0
  474. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -0
  475. package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.d.ts +4 -0
  476. package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.js +40 -0
  477. package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.js.map +1 -0
  478. package/lib/esm/platforms/aws/setup/buildHostedZonesStep.d.ts +4 -0
  479. package/lib/esm/platforms/aws/setup/buildHostedZonesStep.js +49 -0
  480. package/lib/esm/platforms/aws/setup/buildHostedZonesStep.js.map +1 -0
  481. package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.d.ts +4 -0
  482. package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.js +34 -0
  483. package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.js.map +1 -0
  484. package/lib/esm/platforms/aws/setup/buildIdentityStep.d.ts +4 -0
  485. package/lib/esm/platforms/aws/setup/buildIdentityStep.js +26 -0
  486. package/lib/esm/platforms/aws/setup/buildIdentityStep.js.map +1 -0
  487. package/lib/esm/platforms/aws/setup/buildStackSteps.d.ts +5 -0
  488. package/lib/esm/platforms/aws/setup/buildStackSteps.js +17 -0
  489. package/lib/esm/platforms/aws/setup/buildStackSteps.js.map +1 -0
  490. package/lib/esm/platforms/aws/setup/describeStackStatus.d.ts +4 -0
  491. package/lib/esm/platforms/aws/setup/describeStackStatus.js +17 -0
  492. package/lib/esm/platforms/aws/setup/describeStackStatus.js.map +1 -0
  493. package/lib/esm/platforms/aws/setup/index.d.ts +1 -0
  494. package/lib/esm/platforms/aws/setup/index.js +2 -0
  495. package/lib/esm/platforms/aws/setup/index.js.map +1 -0
  496. package/lib/esm/platforms/aws/stacks.d.ts +7 -0
  497. package/lib/esm/platforms/aws/stacks.js +72 -0
  498. package/lib/esm/platforms/aws/stacks.js.map +1 -0
  499. package/lib/esm/platforms/aws/teardown.d.ts +2 -0
  500. package/lib/esm/platforms/aws/teardown.js +46 -0
  501. package/lib/esm/platforms/aws/teardown.js.map +1 -0
  502. package/lib/esm/platforms/aws/viewsSync.d.ts +3 -0
  503. package/lib/esm/platforms/aws/viewsSync.js +60 -0
  504. package/lib/esm/platforms/aws/viewsSync.js.map +1 -0
  505. package/lib/esm/platforms/docker/QpqDockerPlatformSettings.d.ts +10 -0
  506. package/lib/esm/platforms/docker/QpqDockerPlatformSettings.js +2 -0
  507. package/lib/esm/platforms/docker/QpqDockerPlatformSettings.js.map +1 -0
  508. package/lib/esm/platforms/docker/getContainerPorts.d.ts +4 -0
  509. package/lib/esm/platforms/docker/getContainerPorts.js +8 -0
  510. package/lib/esm/platforms/docker/getContainerPorts.js.map +1 -0
  511. package/lib/esm/platforms/docker/getDefaultPortMappings.d.ts +3 -0
  512. package/lib/esm/platforms/docker/getDefaultPortMappings.js +6 -0
  513. package/lib/esm/platforms/docker/getDefaultPortMappings.js.map +1 -0
  514. package/lib/esm/platforms/docker/getDockerPlatformSettings.d.ts +14 -0
  515. package/lib/esm/platforms/docker/getDockerPlatformSettings.js +34 -0
  516. package/lib/esm/platforms/docker/getDockerPlatformSettings.js.map +1 -0
  517. package/lib/esm/platforms/docker/getImageName.d.ts +6 -0
  518. package/lib/esm/platforms/docker/getImageName.js +6 -0
  519. package/lib/esm/platforms/docker/getImageName.js.map +1 -0
  520. package/lib/esm/platforms/docker/go.d.ts +2 -0
  521. package/lib/esm/platforms/docker/go.js +242 -0
  522. package/lib/esm/platforms/docker/go.js.map +1 -0
  523. package/lib/esm/platforms/docker/index.d.ts +2 -0
  524. package/lib/esm/platforms/docker/index.js +31 -0
  525. package/lib/esm/platforms/docker/index.js.map +1 -0
  526. package/lib/esm/platforms/docker/parseMounts.d.ts +7 -0
  527. package/lib/esm/platforms/docker/parseMounts.js +23 -0
  528. package/lib/esm/platforms/docker/parseMounts.js.map +1 -0
  529. package/lib/esm/platforms/docker/parsePortMappings.d.ts +8 -0
  530. package/lib/esm/platforms/docker/parsePortMappings.js +21 -0
  531. package/lib/esm/platforms/docker/parsePortMappings.js.map +1 -0
  532. package/lib/esm/platforms/docker/resolvePortMappings.d.ts +8 -0
  533. package/lib/esm/platforms/docker/resolvePortMappings.js +18 -0
  534. package/lib/esm/platforms/docker/resolvePortMappings.js.map +1 -0
  535. package/lib/esm/platforms/docker/writeComposeFile.d.ts +20 -0
  536. package/lib/esm/platforms/docker/writeComposeFile.js +37 -0
  537. package/lib/esm/platforms/docker/writeComposeFile.js.map +1 -0
  538. package/lib/esm/platforms/index.d.ts +3 -0
  539. package/lib/esm/platforms/index.js +17 -0
  540. package/lib/esm/platforms/index.js.map +1 -0
  541. package/lib/esm/platforms/types.d.ts +21 -0
  542. package/lib/esm/platforms/types.js +6 -0
  543. package/lib/esm/platforms/types.js.map +1 -0
  544. package/package.json +71 -3
  545. package/templates/user-script/README.md +28 -0
  546. package/templates/user-script/gitignore +2 -0
  547. package/templates/user-script/package.json +16 -0
  548. package/templates/user-script/src/main.ts +15 -0
  549. package/templates/user-script/tsconfig.json +12 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/lib/hooks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,2CAA2F;AAC3F,6CAA+E;AAC/E,yCAA6D;AAoB7D,0EAA0E;AAC1E,2EAA2E;AAC3E,8CAA8C;AACvC,MAAM,UAAU,GAAG,CAAO,OAAe,EAAE,IAAY,EAAoB,EAAE;;IAClF,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,2BAAe,EAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IAC5E,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,OAAO,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,CAAA,MAAA,WAAW,CAAC,OAAO,0CAAG,UAAU,CAAC,CAAA,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,WAAW,UAAU,SAAS,OAAO,GAAG,CAAC,CAAC;IACtD,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAA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AAI,mCAAI,WAAW,CAAC,GAAG;YAC3C,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,IAAI,EAAE,0BAA0B,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC;YAC1H,GAAG,EAAE,GAAG,EAAE,CAAC,IAAA,+BAAkB,EAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,IAAA,4BAAe,GAAE,EAAE,CAAC;SAC7I,CAAC,CAAA;KAAA,CAAC,CAAC;IAEJ,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,KAAK,CAAC,MAAM,gBAAgB,IAAI,4BAA4B,CAAC,CAAC;IACtG,OAAO,IAAA,6BAAkB,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC,CAAA,CAAC;AAEF,qHAAqH;AAC9G,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,IAAY,EAA0B,EAAE,CAAC,kBAAkB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAAlI,QAAA,qBAAqB,yBAA6G;AAE/I;;;GAGG;AACI,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,IAAY,EAA0B,EAAE,CAC3G,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AADjD,QAAA,qBAAqB,yBAC4B","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { getAppDirectory, getAppsDirectory, getAvailableApps, getRoot } from './discovery';\nimport { nextPrefixColor, runCommand, runCommandPrefixed } from './runCommand';\nimport { runDependencyTasks, TaskFailure } from './runTasks';\n\ninterface HookPackageJson {\n name?: string;\n scripts?: Record<string, string>;\n workspaces?: string[];\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\n// A directory whose package.json can carry qpq:<hook> scripts: either an app\n// (apps/<app>/package.json, which need not be an npm workspace) or any package\n// matched by the consumer root's `workspaces` globs.\ninterface HookPackage {\n dir: string;\n label: string; // app name or package name, for display\n pkg: HookPackageJson;\n}\n\n// App lifecycle hooks: apps/<app>/package.json scripts named `qpq:<hook>`\n// (e.g. qpq:postinstall, qpq:prebuild). The CLI invokes them when present;\n// apps without the hook are skipped silently.\nexport const runAppHook = async (appName: string, hook: string): Promise<boolean> => {\n const packageJsonPath = path.join(getAppDirectory(appName), 'package.json');\n if (!fs.existsSync(packageJsonPath)) {\n return false;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const scriptName = `qpq:${hook}`;\n if (!packageJson.scripts?.[scriptName]) {\n return false;\n }\n\n console.log(`Running ${scriptName} for [${appName}]`);\n await runCommand('npm', ['run', scriptName], { cwd: getAppDirectory(appName) });\n return true;\n};\n\nconst isDirectory = (candidate: string): boolean => fs.existsSync(candidate) && fs.statSync(candidate).isDirectory();\n\nconst listSubdirectories = (dir: string): string[] => {\n if (!isDirectory(dir)) {\n return [];\n }\n return fs\n .readdirSync(dir)\n .map((name) => path.join(dir, name))\n .filter(isDirectory);\n};\n\n// Expand one `workspaces` glob. Only literal segments and bare `*` are\n// supported, which covers the patterns qpq repos use (e.g.\n// \"apps/*/services/*/models\"); anything fancier (\"**\", braces) matches nothing.\nconst expandWorkspacePattern = (root: string, pattern: string): string[] => {\n let dirs = [root];\n for (const segment of pattern.split('/')) {\n if (segment === '*') {\n dirs = dirs.flatMap(listSubdirectories);\n } else {\n dirs = dirs.map((dir) => path.join(dir, segment)).filter(isDirectory);\n }\n }\n return dirs;\n};\n\nconst readPackageJson = (dir: string): HookPackageJson | undefined => {\n const packageJsonPath = path.join(dir, 'package.json');\n if (!fs.existsSync(packageJsonPath)) {\n return undefined;\n }\n return JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')) as HookPackageJson;\n};\n\n// Every directory that can carry hooks: app dirs plus all workspace packages,\n// deduped (an app dir could itself be a workspace).\nconst getHookPackages = (): HookPackage[] => {\n const root = getRoot();\n const rootPkg = readPackageJson(root);\n\n const appDirs = getAvailableApps().map((appName) => ({ dir: getAppDirectory(appName), fallbackLabel: appName }));\n const workspaceDirs = (rootPkg?.workspaces ?? [])\n .flatMap((pattern) => expandWorkspacePattern(root, pattern))\n .map((dir) => ({ dir, fallbackLabel: path.relative(root, dir) }));\n\n const packages: HookPackage[] = [];\n const seen = new Set<string>();\n for (const { dir, fallbackLabel } of [...appDirs, ...workspaceDirs]) {\n const resolved = path.resolve(dir);\n if (seen.has(resolved)) {\n continue;\n }\n seen.add(resolved);\n\n const pkg = readPackageJson(dir);\n if (pkg) {\n packages.push({ dir, label: pkg.name ?? fallbackLabel, pkg });\n }\n }\n\n return packages;\n};\n\n// The script a hook resolves to in one package: `qpq:<hook>` when defined,\n// otherwise the plain `<hook>` script. Empty-string scripts count as absent.\nconst resolveHookScript = (pkg: HookPackageJson, hook: string): string | undefined => {\n if (pkg.scripts?.[`qpq:${hook}`]) {\n return `qpq:${hook}`;\n }\n if (pkg.scripts?.[hook]) {\n return hook;\n }\n return undefined;\n};\n\nconst getDeclaredDependencyNames = (pkg: HookPackageJson): string[] =>\n Object.keys({ ...pkg.dependencies, ...pkg.devDependencies, ...pkg.peerDependencies });\n\n// True for a package inside apps/<some other app>/. Packages outside apps/\n// are shared, so they never count as another app's.\nconst isOtherAppPackage = (dir: string, appName: string): boolean => {\n const relative = path.relative(getAppsDirectory(), path.resolve(dir));\n if (relative === '' || relative.startsWith('..') || path.isAbsolute(relative)) {\n return false;\n }\n return relative.split(path.sep)[0] !== appName;\n};\n\n// The app's own packages and the shared ones, plus every package they depend\n// on wherever it lives, so a cross-app dependency still gets built.\nconst getAppHookPackages = (appName: string): HookPackage[] => {\n const allPackages = getHookPackages();\n const byName = new Map<string, HookPackage>();\n for (const hookPackage of allPackages) {\n if (hookPackage.pkg.name) {\n byName.set(hookPackage.pkg.name, hookPackage);\n }\n }\n\n const selected = new Set(allPackages.filter((hookPackage) => !isOtherAppPackage(hookPackage.dir, appName)));\n const pending = [...selected];\n for (let current = pending.pop(); current; current = pending.pop()) {\n for (const depName of getDeclaredDependencyNames(current.pkg)) {\n const dep = byName.get(depName);\n if (dep && !selected.has(dep)) {\n selected.add(dep);\n pending.push(dep);\n }\n }\n }\n\n return allPackages.filter((hookPackage) => selected.has(hookPackage));\n};\n\n// Run the hook's script in each of `candidates` that defines it (qpq:<hook>\n// preferred over a plain <hook> script), in dependency order (declared deps\n// resolved by package name), with up to `jobs` running concurrently. Packages\n// whose dependencies aren't part of this run don't wait on them.\nconst runHookForPackages = async (candidates: HookPackage[], hook: string, jobs: number): Promise<TaskFailure[]> => {\n const hookPackages = candidates\n .map((candidate) => ({ ...candidate, scriptName: resolveHookScript(candidate.pkg, hook) }))\n .filter((candidate): candidate is HookPackage & { scriptName: string } => candidate.scriptName !== undefined);\n\n if (hookPackages.length === 0) {\n console.log(`No app or workspace package defines a \"qpq:${hook}\" or \"${hook}\" script, nothing to run.`);\n return [];\n }\n\n // Dependency edges only count between packages that are part of this run:\n // a dep that doesn't define the hook has nothing to wait for.\n const runSetNames = new Set(hookPackages.map((hookPackage) => hookPackage.pkg.name).filter(Boolean));\n\n const tasks = hookPackages.map((hookPackage) => ({\n id: hookPackage.pkg.name ?? hookPackage.dir,\n label: hookPackage.label,\n deps: getDeclaredDependencyNames(hookPackage.pkg).filter((name) => runSetNames.has(name) && name !== hookPackage.pkg.name),\n run: () => runCommandPrefixed(hookPackage.label, 'npm', ['run', hookPackage.scriptName], { cwd: hookPackage.dir, color: nextPrefixColor() }),\n }));\n\n console.log(`Running ${hook} hooks in ${tasks.length} package(s) (${jobs} jobs, dependency ordered)`);\n return runDependencyTasks(tasks, jobs);\n};\n\n/** Runs a hook in every app and workspace package that defines it. Returns the failures; callers decide fatality. */\nexport const runHookForAllPackages = (hook: string, jobs: number): Promise<TaskFailure[]> => runHookForPackages(getHookPackages(), hook, jobs);\n\n/**\n * Runs a hook in one app's packages, the shared packages outside apps/, and anything those depend on.\n * Other apps' packages are skipped. Returns the failures; callers decide fatality.\n */\nexport const runHookForAppPackages = (hook: string, appName: string, jobs: number): Promise<TaskFailure[]> =>\n runHookForPackages(getAppHookPackages(appName), hook, jobs);\n"]}
@@ -0,0 +1 @@
1
+ export declare const KEEP_OTHER_DEV_SERVERS_FLAG = "--keep-other-dev-servers";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KEEP_OTHER_DEV_SERVERS_FLAG = void 0;
4
+ // Opt out of the pre-start sweep that kills anything already holding the dev
5
+ // ports, including a dev server belonging to a different checkout of the same
6
+ // repo. Off by default, so the existing behaviour is unchanged.
7
+ //
8
+ // One flag rather than one per command: `go:dev` hands the same argv to both
9
+ // `go:dev:api` and `go:dev:web`, so declaring it once covers all three.
10
+ exports.KEEP_OTHER_DEV_SERVERS_FLAG = '--keep-other-dev-servers';
11
+ //# sourceMappingURL=keepOtherDevServersFlag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keepOtherDevServersFlag.js","sourceRoot":"","sources":["../../../src/lib/keepOtherDevServersFlag.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,gEAAgE;AAChE,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AAC3D,QAAA,2BAA2B,GAAG,0BAA0B,CAAC","sourcesContent":["// Opt out of the pre-start sweep that kills anything already holding the dev\n// ports, including a dev server belonging to a different checkout of the same\n// repo. Off by default, so the existing behaviour is unchanged.\n//\n// One flag rather than one per command: `go:dev` hands the same argv to both\n// `go:dev:api` and `go:dev:web`, so declaring it once covers all three.\nexport const KEEP_OTHER_DEV_SERVERS_FLAG = '--keep-other-dev-servers';\n"]}
@@ -0,0 +1,10 @@
1
+ import { ChildProcess } from 'child_process';
2
+ /**
3
+ * SIGTERM the child, resolve once it has actually exited, and SIGKILL it if it
4
+ * has not gone within the grace window.
5
+ *
6
+ * Resolves rather than rejects on escalation: the caller's next move is the
7
+ * same either way (start the replacement), and a rejection would only give
8
+ * every call site a catch to write.
9
+ */
10
+ export declare const killChildWithEscalation: (child: ChildProcess, graceMs?: number) => Promise<void>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.killChildWithEscalation = void 0;
4
+ // Above the dev server's 5s worst-case shutdown budget, below docker's 10s
5
+ // default stop grace, so a container stop still exits cleanly rather than
6
+ // being SIGKILLed by docker mid-escalation.
7
+ const DEFAULT_KILL_GRACE_MS = 6000;
8
+ /**
9
+ * SIGTERM the child, resolve once it has actually exited, and SIGKILL it if it
10
+ * has not gone within the grace window.
11
+ *
12
+ * Resolves rather than rejects on escalation: the caller's next move is the
13
+ * same either way (start the replacement), and a rejection would only give
14
+ * every call site a catch to write.
15
+ */
16
+ const killChildWithEscalation = (child, graceMs = DEFAULT_KILL_GRACE_MS) => {
17
+ if (child.exitCode !== null || child.signalCode !== null) {
18
+ return Promise.resolve();
19
+ }
20
+ return new Promise((resolve) => {
21
+ const timer = setTimeout(() => {
22
+ console.warn(`Dev server did not exit within ${graceMs}ms — sending SIGKILL.`);
23
+ child.kill('SIGKILL');
24
+ }, graceMs);
25
+ child.once('exit', () => {
26
+ clearTimeout(timer);
27
+ resolve();
28
+ });
29
+ child.kill('SIGTERM');
30
+ });
31
+ };
32
+ exports.killChildWithEscalation = killChildWithEscalation;
33
+ //# sourceMappingURL=killChildWithEscalation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"killChildWithEscalation.js","sourceRoot":"","sources":["../../../src/lib/killChildWithEscalation.ts"],"names":[],"mappings":";;;AAWA,2EAA2E;AAC3E,0EAA0E;AAC1E,4CAA4C;AAC5C,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;;;;;GAOG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAAmB,EAAE,OAAO,GAAG,qBAAqB,EAAiB,EAAE;IAC7G,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QACzD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,OAAO,CAAC,IAAI,CAAC,kCAAkC,OAAO,uBAAuB,CAAC,CAAC;YAC/E,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;YACtB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAlBW,QAAA,uBAAuB,2BAkBlC","sourcesContent":["// Stopping the dev server child, with a hard backstop.\n//\n// The dev server now runs an ordered shutdown on SIGTERM (drain in-flight\n// work, then checkpoint the stores) instead of dying instantly. That is the\n// point - it is what stops a save-triggered restart eating a queue message\n// mid-story - but it means a bare `child.kill()` followed by waiting for exit\n// can now wait forever if a teardown wedges. Without escalation this would\n// trade a data-loss bug for a hung-restart bug, and the next launch would find\n// its ports still held.\nimport { ChildProcess } from 'child_process';\n\n// Above the dev server's 5s worst-case shutdown budget, below docker's 10s\n// default stop grace, so a container stop still exits cleanly rather than\n// being SIGKILLed by docker mid-escalation.\nconst DEFAULT_KILL_GRACE_MS = 6000;\n\n/**\n * SIGTERM the child, resolve once it has actually exited, and SIGKILL it if it\n * has not gone within the grace window.\n *\n * Resolves rather than rejects on escalation: the caller's next move is the\n * same either way (start the replacement), and a rejection would only give\n * every call site a catch to write.\n */\nexport const killChildWithEscalation = (child: ChildProcess, graceMs = DEFAULT_KILL_GRACE_MS): Promise<void> => {\n if (child.exitCode !== null || child.signalCode !== null) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve) => {\n const timer = setTimeout(() => {\n console.warn(`Dev server did not exit within ${graceMs}ms — sending SIGKILL.`);\n child.kill('SIGKILL');\n }, graceMs);\n\n child.once('exit', () => {\n clearTimeout(timer);\n resolve();\n });\n\n child.kill('SIGTERM');\n });\n};\n"]}
@@ -0,0 +1,17 @@
1
+ export declare const isQpqCliCommand: (command: string) => boolean;
2
+ export declare const killOtherQpqDevProcesses: (root: string) => void;
3
+ /**
4
+ * Say what is holding these ports, without touching it.
5
+ *
6
+ * The other half of --keep-other-dev-servers: sparing a sibling checkout's dev
7
+ * server means this one cannot bind, and an unexplained EADDRINUSE is a worse
8
+ * experience than the silent kill it replaces. Naming the pid and the command
9
+ * turns "it just died" into something you can act on.
10
+ *
11
+ * Worded as a prediction, not a fact, because it IS one: this runs before the
12
+ * bundle step, so by the time anything binds - seconds later - the holder may
13
+ * well have gone. Stating "port in use" and then starting cleanly reads like
14
+ * the warning was wrong.
15
+ */
16
+ export declare const reportPortHolders: (ports: number[]) => void;
17
+ export declare const killStaleListeners: (ports: number[], isOurs: (command: string) => boolean) => void;
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.killStaleListeners = exports.reportPortHolders = exports.killOtherQpqDevProcesses = exports.isQpqCliCommand = void 0;
7
+ // Pre-start sweep shared by the dev-server commands: a previous run whose
8
+ // wrapper died without killing its listener (closed terminal, SIGKILL) leaves
9
+ // an orphaned process holding a dev port, and the next launch dies with
10
+ // EADDRINUSE. Before starting, kill any listener on the given ports whose
11
+ // command line matches `isOurs`. Anything else on the ports is left alone
12
+ // and reported — it's not ours.
13
+ const child_process_1 = require("child_process");
14
+ const fs_1 = __importDefault(require("fs"));
15
+ const path_1 = __importDefault(require("path"));
16
+ // Matches any invocation of the qpq CLI itself, regardless of how it was
17
+ // launched: `node node_modules/.bin/qpq ...` (the npm-script shim, which has
18
+ // no .js extension), a direct `node .../lib/commonjs/bin/qpq.js` call, a
19
+ // global `qpq` shebang script, etc. Checks each whitespace-separated token's
20
+ // basename (extension stripped) rather than a fixed substring like
21
+ // 'bin/qpq.js', which only matches the last of those forms.
22
+ const isQpqCliCommand = (command) => command
23
+ .trim()
24
+ .split(/\s+/)
25
+ .some((token) => {
26
+ const base = path_1.default.basename(token);
27
+ const withoutExt = base.endsWith('.js') ? base.slice(0, -3) : base;
28
+ return withoutExt === 'qpq';
29
+ });
30
+ exports.isQpqCliCommand = isQpqCliCommand;
31
+ // SIGTERM only requests termination — the caller (about to bind this same
32
+ // process's ports itself) needs it actually gone first. A stale dev server
33
+ // can be mid-startup when killed (still resolving config, not yet bound to
34
+ // every port it eventually binds) and keep running for a bit past the
35
+ // signal, going on to bind a LATER port — waiting for just the one port that
36
+ // matched isn't enough; wait for the whole pid to disappear so it can't bind
37
+ // anything else afterward. Poll synchronously (this whole sweep runs before
38
+ // anything async starts) via `kill(pid, 0)` — reliable and fast here because
39
+ // these are unrelated, previously-orphaned processes, not children of this
40
+ // one (a real child can sit as a zombie answering `kill(pid, 0)` until this
41
+ // process's own event loop reaps it, which a tight sync loop would starve;
42
+ // doesn't apply to a process we didn't spawn).
43
+ //
44
+ // The default covers the dev server's graceful shutdown (drain in-flight work,
45
+ // then checkpoint the stores) with room to spare — it used to be 3s, which was
46
+ // fine when the server died instantly and is not now. Returns whether the pid
47
+ // actually went, because a caller about to bind these ports has to escalate
48
+ // rather than hope: giving up while the old server still holds 8080 is exactly
49
+ // the EADDRINUSE this file exists to prevent.
50
+ const waitForPidGone = (pid, timeoutMs = 8000) => {
51
+ const deadline = Date.now() + timeoutMs;
52
+ while (Date.now() < deadline) {
53
+ try {
54
+ process.kill(pid, 0);
55
+ }
56
+ catch (_a) {
57
+ return true; // throws once the pid no longer exists
58
+ }
59
+ (0, child_process_1.execSync)('sleep 0.05');
60
+ }
61
+ return false;
62
+ };
63
+ // Last resort for a process that ignored, or wedged during, its graceful stop.
64
+ const killPidHard = (pid) => {
65
+ console.warn(`Process ${pid} did not exit gracefully — sending SIGKILL.`);
66
+ try {
67
+ process.kill(pid, 'SIGKILL');
68
+ }
69
+ catch (_a) {
70
+ return; // raced us and exited after all
71
+ }
72
+ waitForPidGone(pid, 2000);
73
+ };
74
+ // realpath'd: lsof reports the canonical path (e.g. /private/tmp on macOS,
75
+ // where /tmp is a symlink), so comparing against a caller-supplied root
76
+ // verbatim would false-negative whenever any component of the repo path is
77
+ // itself a symlink (a symlinked home directory, an NFS mount, etc).
78
+ const getProcessCwd = (pid) => {
79
+ try {
80
+ const line = (0, child_process_1.execSync)(`lsof -a -p ${pid} -d cwd -Fn`, { stdio: ['ignore', 'pipe', 'ignore'] })
81
+ .toString()
82
+ .split('\n')
83
+ .find((l) => l.startsWith('n'));
84
+ return line ? fs_1.default.realpathSync(line.slice(1)) : null;
85
+ }
86
+ catch (_a) {
87
+ return null; // pid gone, or we don't have permission to inspect it
88
+ }
89
+ };
90
+ // The sweep below must never target this process's own wrappers: launched as
91
+ // `npx qpq go:dev:api` (or via any shell whose -c string names qpq), the
92
+ // ancestor chain (`sh -c "npx ... qpq ..."`, `npm exec qpq ...`) matches
93
+ // isQpqCliCommand and shares our cwd, so excluding just process.pid isn't
94
+ // enough — SIGINTing an ancestor tears down our own tree. Walk ppid to the
95
+ // top and exclude the whole chain.
96
+ const getOwnAncestorPids = () => {
97
+ const ancestors = new Set();
98
+ let pid = process.pid;
99
+ while (pid > 1 && !ancestors.has(pid)) {
100
+ ancestors.add(pid);
101
+ try {
102
+ pid = Number((0, child_process_1.execSync)(`ps -o ppid= -p ${pid}`, { stdio: ['ignore', 'pipe', 'ignore'] })
103
+ .toString()
104
+ .trim());
105
+ }
106
+ catch (_a) {
107
+ break;
108
+ }
109
+ }
110
+ return ancestors;
111
+ };
112
+ // killStaleListeners only sees processes currently BOUND to one of the given
113
+ // ports — it can't catch a still-running `qpq go:dev*` watcher whose spawned
114
+ // dev-server child already died (a crash, or us killing just the child):
115
+ // the watcher itself holds no port at that moment, so it's invisible to a
116
+ // port scan, yet it's still alive and can spawn a fresh child — and bind a
117
+ // port — moments later, racing whatever we're about to start. Close that gap
118
+ // by finding any OTHER qpq CLI process rooted in the same repo checkout
119
+ // (matched by cwd, not by port or command-line args, which vary by how it
120
+ // was invoked) and killing it outright, regardless of what it currently has
121
+ // bound. SIGINT (not SIGTERM) so goDevApiCommand/goDevWebCommand's own
122
+ // handler runs and tears down its child cleanly rather than orphaning it.
123
+ const killOtherQpqDevProcesses = (root) => {
124
+ const resolvedRoot = fs_1.default.realpathSync(root);
125
+ const ownPids = getOwnAncestorPids();
126
+ let lines = [];
127
+ try {
128
+ lines = (0, child_process_1.execSync)('ps -axo pid=,command=', { stdio: ['ignore', 'pipe', 'ignore'] })
129
+ .toString()
130
+ .split('\n');
131
+ }
132
+ catch (_a) {
133
+ return;
134
+ }
135
+ for (const line of lines) {
136
+ const trimmed = line.trim();
137
+ if (!trimmed)
138
+ continue;
139
+ const spaceIndex = trimmed.indexOf(' ');
140
+ if (spaceIndex === -1)
141
+ continue;
142
+ const pid = Number(trimmed.slice(0, spaceIndex));
143
+ const command = trimmed.slice(spaceIndex + 1).trim();
144
+ if (!pid || ownPids.has(pid) || !(0, exports.isQpqCliCommand)(command))
145
+ continue;
146
+ if (getProcessCwd(pid) !== resolvedRoot)
147
+ continue;
148
+ console.log(`Killing other qpq dev process for this repo (pid ${pid}): ${command}`);
149
+ process.kill(pid, 'SIGINT');
150
+ if (!waitForPidGone(pid)) {
151
+ killPidHard(pid);
152
+ }
153
+ }
154
+ };
155
+ exports.killOtherQpqDevProcesses = killOtherQpqDevProcesses;
156
+ // Whatever is currently listening on a port, as pid + command line. Empty when
157
+ // the port is free, or when lsof is unavailable.
158
+ const getPortListeners = (port) => {
159
+ let pids = [];
160
+ try {
161
+ pids = (0, child_process_1.execSync)(`lsof -t -iTCP:${port} -sTCP:LISTEN`, {
162
+ stdio: ['ignore', 'pipe', 'ignore'],
163
+ })
164
+ .toString()
165
+ .split('\n')
166
+ .map((line) => Number(line.trim()))
167
+ .filter(Boolean);
168
+ }
169
+ catch (_a) {
170
+ return []; // lsof exits non-zero when nothing is listening
171
+ }
172
+ return pids.flatMap((pid) => {
173
+ try {
174
+ return [{ pid, command: (0, child_process_1.execSync)(`ps -p ${pid} -o command=`).toString().trim() }];
175
+ }
176
+ catch (_a) {
177
+ return []; // already gone
178
+ }
179
+ });
180
+ };
181
+ /**
182
+ * Say what is holding these ports, without touching it.
183
+ *
184
+ * The other half of --keep-other-dev-servers: sparing a sibling checkout's dev
185
+ * server means this one cannot bind, and an unexplained EADDRINUSE is a worse
186
+ * experience than the silent kill it replaces. Naming the pid and the command
187
+ * turns "it just died" into something you can act on.
188
+ *
189
+ * Worded as a prediction, not a fact, because it IS one: this runs before the
190
+ * bundle step, so by the time anything binds - seconds later - the holder may
191
+ * well have gone. Stating "port in use" and then starting cleanly reads like
192
+ * the warning was wrong.
193
+ */
194
+ const reportPortHolders = (ports) => {
195
+ for (const port of ports) {
196
+ for (const { pid, command } of getPortListeners(port)) {
197
+ console.warn(`Port ${port} is currently held by pid ${pid}: ${command}`);
198
+ console.warn(` Starting anyway. If it still holds port ${port} once this server binds, startup will fail with EADDRINUSE.`);
199
+ }
200
+ }
201
+ };
202
+ exports.reportPortHolders = reportPortHolders;
203
+ const killStaleListeners = (ports, isOurs) => {
204
+ for (const port of ports) {
205
+ for (const { pid, command } of getPortListeners(port)) {
206
+ if (isOurs(command)) {
207
+ console.log(`Killing stale dev server on port ${port} (pid ${pid})`);
208
+ process.kill(pid);
209
+ if (!waitForPidGone(pid)) {
210
+ killPidHard(pid);
211
+ }
212
+ }
213
+ else {
214
+ console.warn(`Port ${port} is in use by an unrelated process (pid ${pid}: ${command}) — not killing it.`);
215
+ }
216
+ }
217
+ }
218
+ };
219
+ exports.killStaleListeners = killStaleListeners;
220
+ //# sourceMappingURL=killStaleListeners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"killStaleListeners.js","sourceRoot":"","sources":["../../../src/lib/killStaleListeners.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,wEAAwE;AACxE,0EAA0E;AAC1E,0EAA0E;AAC1E,gCAAgC;AAChC,iDAAyC;AACzC,4CAAoB;AACpB,gDAAwB;AAExB,yEAAyE;AACzE,6EAA6E;AAC7E,yEAAyE;AACzE,6EAA6E;AAC7E,mEAAmE;AACnE,4DAA4D;AACrD,MAAM,eAAe,GAAG,CAAC,OAAe,EAAW,EAAE,CAC1D,OAAO;KACJ,IAAI,EAAE;KACN,KAAK,CAAC,KAAK,CAAC;KACZ,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACd,MAAM,IAAI,GAAG,cAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,OAAO,UAAU,KAAK,KAAK,CAAC;AAC9B,CAAC,CAAC,CAAC;AARM,QAAA,eAAe,mBAQrB;AAEP,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,sEAAsE;AACtE,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3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A6B,GAAG,KAAK,OAAO,EAAE,CAAC,CAAC;YACzE,OAAO,CAAC,IAAI,CAAC,6CAA6C,IAAI,6DAA6D,CAAC,CAAC;QAC/H,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B;AAEK,MAAM,kBAAkB,GAAG,CAAC,KAAe,EAAE,MAAoC,EAAQ,EAAE;IAChG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBACpB,OAAO,CAAC,GAAG,CAAC,oCAAoC,IAAI,SAAS,GAAG,GAAG,CAAC,CAAC;gBACrE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAClB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;oBACzB,WAAW,CAAC,GAAG,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,2CAA2C,GAAG,KAAK,OAAO,qBAAqB,CAAC,CAAC;YAC5G,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAdW,QAAA,kBAAkB,sBAc7B","sourcesContent":["// Pre-start sweep shared by the dev-server commands: a previous run whose\n// wrapper died without killing its listener (closed terminal, SIGKILL) leaves\n// an orphaned process holding a dev port, and the next launch dies with\n// EADDRINUSE. Before starting, kill any listener on the given ports whose\n// command line matches `isOurs`. Anything else on the ports is left alone\n// and reported — it's not ours.\nimport { execSync } from 'child_process';\nimport fs from 'fs';\nimport path from 'path';\n\n// Matches any invocation of the qpq CLI itself, regardless of how it was\n// launched: `node node_modules/.bin/qpq ...` (the npm-script shim, which has\n// no .js extension), a direct `node .../lib/commonjs/bin/qpq.js` call, a\n// global `qpq` shebang script, etc. Checks each whitespace-separated token's\n// basename (extension stripped) rather than a fixed substring like\n// 'bin/qpq.js', which only matches the last of those forms.\nexport const isQpqCliCommand = (command: string): boolean =>\n command\n .trim()\n .split(/\\s+/)\n .some((token) => {\n const base = path.basename(token);\n const withoutExt = base.endsWith('.js') ? base.slice(0, -3) : base;\n return withoutExt === 'qpq';\n });\n\n// SIGTERM only requests termination — the caller (about to bind this same\n// process's ports itself) needs it actually gone first. A stale dev server\n// can be mid-startup when killed (still resolving config, not yet bound to\n// every port it eventually binds) and keep running for a bit past the\n// signal, going on to bind a LATER port — waiting for just the one port that\n// matched isn't enough; wait for the whole pid to disappear so it can't bind\n// anything else afterward. Poll synchronously (this whole sweep runs before\n// anything async starts) via `kill(pid, 0)` — reliable and fast here because\n// these are unrelated, previously-orphaned processes, not children of this\n// one (a real child can sit as a zombie answering `kill(pid, 0)` until this\n// process's own event loop reaps it, which a tight sync loop would starve;\n// doesn't apply to a process we didn't spawn).\n//\n// The default covers the dev server's graceful shutdown (drain in-flight work,\n// then checkpoint the stores) with room to spare — it used to be 3s, which was\n// fine when the server died instantly and is not now. Returns whether the pid\n// actually went, because a caller about to bind these ports has to escalate\n// rather than hope: giving up while the old server still holds 8080 is exactly\n// the EADDRINUSE this file exists to prevent.\nconst waitForPidGone = (pid: number, timeoutMs = 8000): boolean => {\n const deadline = Date.now() + timeoutMs;\n while (Date.now() < deadline) {\n try {\n process.kill(pid, 0);\n } catch {\n return true; // throws once the pid no longer exists\n }\n execSync('sleep 0.05');\n }\n\n return false;\n};\n\n// Last resort for a process that ignored, or wedged during, its graceful stop.\nconst killPidHard = (pid: number): void => {\n console.warn(`Process ${pid} did not exit gracefully — sending SIGKILL.`);\n try {\n process.kill(pid, 'SIGKILL');\n } catch {\n return; // raced us and exited after all\n }\n waitForPidGone(pid, 2000);\n};\n\n// realpath'd: lsof reports the canonical path (e.g. /private/tmp on macOS,\n// where /tmp is a symlink), so comparing against a caller-supplied root\n// verbatim would false-negative whenever any component of the repo path is\n// itself a symlink (a symlinked home directory, an NFS mount, etc).\nconst getProcessCwd = (pid: number): string | null => {\n try {\n const line = execSync(`lsof -a -p ${pid} -d cwd -Fn`, { stdio: ['ignore', 'pipe', 'ignore'] })\n .toString()\n .split('\\n')\n .find((l) => l.startsWith('n'));\n return line ? fs.realpathSync(line.slice(1)) : null;\n } catch {\n return null; // pid gone, or we don't have permission to inspect it\n }\n};\n\n// The sweep below must never target this process's own wrappers: launched as\n// `npx qpq go:dev:api` (or via any shell whose -c string names qpq), the\n// ancestor chain (`sh -c \"npx ... qpq ...\"`, `npm exec qpq ...`) matches\n// isQpqCliCommand and shares our cwd, so excluding just process.pid isn't\n// enough — SIGINTing an ancestor tears down our own tree. Walk ppid to the\n// top and exclude the whole chain.\nconst getOwnAncestorPids = (): Set<number> => {\n const ancestors = new Set<number>();\n let pid = process.pid;\n while (pid > 1 && !ancestors.has(pid)) {\n ancestors.add(pid);\n try {\n pid = Number(\n execSync(`ps -o ppid= -p ${pid}`, { stdio: ['ignore', 'pipe', 'ignore'] })\n .toString()\n .trim(),\n );\n } catch {\n break;\n }\n }\n return ancestors;\n};\n\n// killStaleListeners only sees processes currently BOUND to one of the given\n// ports — it can't catch a still-running `qpq go:dev*` watcher whose spawned\n// dev-server child already died (a crash, or us killing just the child):\n// the watcher itself holds no port at that moment, so it's invisible to a\n// port scan, yet it's still alive and can spawn a fresh child — and bind a\n// port — moments later, racing whatever we're about to start. Close that gap\n// by finding any OTHER qpq CLI process rooted in the same repo checkout\n// (matched by cwd, not by port or command-line args, which vary by how it\n// was invoked) and killing it outright, regardless of what it currently has\n// bound. SIGINT (not SIGTERM) so goDevApiCommand/goDevWebCommand's own\n// handler runs and tears down its child cleanly rather than orphaning it.\nexport const killOtherQpqDevProcesses = (root: string): void => {\n const resolvedRoot = fs.realpathSync(root);\n const ownPids = getOwnAncestorPids();\n\n let lines: string[] = [];\n try {\n lines = execSync('ps -axo pid=,command=', { stdio: ['ignore', 'pipe', 'ignore'] })\n .toString()\n .split('\\n');\n } catch {\n return;\n }\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n\n const spaceIndex = trimmed.indexOf(' ');\n if (spaceIndex === -1) continue;\n\n const pid = Number(trimmed.slice(0, spaceIndex));\n const command = trimmed.slice(spaceIndex + 1).trim();\n\n if (!pid || ownPids.has(pid) || !isQpqCliCommand(command)) continue;\n if (getProcessCwd(pid) !== resolvedRoot) continue;\n\n console.log(`Killing other qpq dev process for this repo (pid ${pid}): ${command}`);\n process.kill(pid, 'SIGINT');\n if (!waitForPidGone(pid)) {\n killPidHard(pid);\n }\n }\n};\n\n// Whatever is currently listening on a port, as pid + command line. Empty when\n// the port is free, or when lsof is unavailable.\nconst getPortListeners = (port: number): { pid: number; command: string }[] => {\n let pids: number[] = [];\n try {\n pids = execSync(`lsof -t -iTCP:${port} -sTCP:LISTEN`, {\n stdio: ['ignore', 'pipe', 'ignore'],\n })\n .toString()\n .split('\\n')\n .map((line) => Number(line.trim()))\n .filter(Boolean);\n } catch {\n return []; // lsof exits non-zero when nothing is listening\n }\n\n return pids.flatMap((pid) => {\n try {\n return [{ pid, command: execSync(`ps -p ${pid} -o command=`).toString().trim() }];\n } catch {\n return []; // already gone\n }\n });\n};\n\n/**\n * Say what is holding these ports, without touching it.\n *\n * The other half of --keep-other-dev-servers: sparing a sibling checkout's dev\n * server means this one cannot bind, and an unexplained EADDRINUSE is a worse\n * experience than the silent kill it replaces. Naming the pid and the command\n * turns \"it just died\" into something you can act on.\n *\n * Worded as a prediction, not a fact, because it IS one: this runs before the\n * bundle step, so by the time anything binds - seconds later - the holder may\n * well have gone. Stating \"port in use\" and then starting cleanly reads like\n * the warning was wrong.\n */\nexport const reportPortHolders = (ports: number[]): void => {\n for (const port of ports) {\n for (const { pid, command } of getPortListeners(port)) {\n console.warn(`Port ${port} is currently held by pid ${pid}: ${command}`);\n console.warn(` Starting anyway. If it still holds port ${port} once this server binds, startup will fail with EADDRINUSE.`);\n }\n }\n};\n\nexport const killStaleListeners = (ports: number[], isOurs: (command: string) => boolean): void => {\n for (const port of ports) {\n for (const { pid, command } of getPortListeners(port)) {\n if (isOurs(command)) {\n console.log(`Killing stale dev server on port ${port} (pid ${pid})`);\n process.kill(pid);\n if (!waitForPidGone(pid)) {\n killPidHard(pid);\n }\n } else {\n console.warn(`Port ${port} is in use by an unrelated process (pid ${pid}: ${command}) — not killing it.`);\n }\n }\n }\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare const getOwnPackageRoot: () => string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getOwnPackageRoot = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ // This package's root (works from src under ts-node and from lib/commonjs).
10
+ const getOwnPackageRoot = () => {
11
+ let dir = __dirname;
12
+ while (!fs_1.default.existsSync(path_1.default.join(dir, 'package.json'))) {
13
+ const parent = path_1.default.dirname(dir);
14
+ if (parent === dir)
15
+ throw new Error('Could not locate the @qpqjs/cli package root');
16
+ dir = parent;
17
+ }
18
+ return dir;
19
+ };
20
+ exports.getOwnPackageRoot = getOwnPackageRoot;
21
+ //# sourceMappingURL=packageRoot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageRoot.js","sourceRoot":"","sources":["../../../src/lib/packageRoot.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,4EAA4E;AACrE,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,OAAO,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QACpF,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n// This package's root (works from src under ts-node and from lib/commonjs).\nexport const getOwnPackageRoot = (): string => {\n let dir = __dirname;\n while (!fs.existsSync(path.join(dir, 'package.json'))) {\n const parent = path.dirname(dir);\n if (parent === dir) throw new Error('Could not locate the @qpqjs/cli package root');\n dir = parent;\n }\n return dir;\n};\n"]}
@@ -0,0 +1,15 @@
1
+ export declare const promptSelect: (message: string, choices: string[], defaultChoice?: string) => Promise<string>;
2
+ export declare const promptSelectDetailed: <T>(message: string, choices: {
3
+ name: string;
4
+ value: T;
5
+ short?: string;
6
+ description?: string;
7
+ }[]) => Promise<T>;
8
+ export declare const promptYesNo: (message: string) => Promise<boolean>;
9
+ export declare const promptText: (message: string) => Promise<string>;
10
+ export declare const promptCheckbox: <T>(message: string, choices: {
11
+ name: string;
12
+ value: T;
13
+ checked?: boolean;
14
+ description?: string;
15
+ }[]) => Promise<T[]>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.promptCheckbox = exports.promptText = exports.promptYesNo = exports.promptSelectDetailed = exports.promptSelect = void 0;
46
+ // Present a single-choice list prompt and return the selected value.
47
+ // @inquirer/prompts is imported lazily so commands only pay for it when
48
+ // actually prompting.
49
+ const promptSelect = (message, choices, defaultChoice) => __awaiter(void 0, void 0, void 0, function* () {
50
+ const { select } = yield Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
51
+ return select({ message, choices, default: defaultChoice });
52
+ });
53
+ exports.promptSelect = promptSelect;
54
+ // A single-choice list prompt over labelled values; a choice's optional
55
+ // `short` replaces its name in the answer line once picked, and its optional
56
+ // `description` renders under the list while it is highlighted.
57
+ const promptSelectDetailed = (message, choices) => __awaiter(void 0, void 0, void 0, function* () {
58
+ const { select } = yield Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
59
+ return select({ message, choices });
60
+ });
61
+ exports.promptSelectDetailed = promptSelectDetailed;
62
+ // A yes/no list prompt, returning true for "Yes".
63
+ const promptYesNo = (message) => __awaiter(void 0, void 0, void 0, function* () { return (yield (0, exports.promptSelect)(message, ['No', 'Yes'])) === 'Yes'; });
64
+ exports.promptYesNo = promptYesNo;
65
+ // A free-text prompt — used where a y/n is too easy to fat-finger (destructive
66
+ // confirmations that require typing the target name back).
67
+ const promptText = (message) => __awaiter(void 0, void 0, void 0, function* () {
68
+ const { input } = yield Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
69
+ return input({ message });
70
+ });
71
+ exports.promptText = promptText;
72
+ // A multi-select checkbox prompt over labelled values; `checked` preselects a choice.
73
+ const promptCheckbox = (message, choices) => __awaiter(void 0, void 0, void 0, function* () {
74
+ const { checkbox } = yield Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
75
+ return checkbox({ message, choices });
76
+ });
77
+ exports.promptCheckbox = promptCheckbox;
78
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/lib/prompts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAqE;AACrE,wEAAwE;AACxE,sBAAsB;AACf,MAAM,YAAY,GAAG,CAAO,OAAe,EAAE,OAAiB,EAAE,aAAsB,EAAmB,EAAE;IAChH,MAAM,EAAE,MAAM,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACrD,OAAO,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;AAC9D,CAAC,CAAA,CAAC;AAHW,QAAA,YAAY,gBAGvB;AAEF,wEAAwE;AACxE,6EAA6E;AAC7E,gEAAgE;AACzD,MAAM,oBAAoB,GAAG,CAClC,OAAe,EACf,OAA2E,EAC/D,EAAE;IACd,MAAM,EAAE,MAAM,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACrD,OAAO,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACtC,CAAC,CAAA,CAAC;AANW,QAAA,oBAAoB,wBAM/B;AAEF,kDAAkD;AAC3C,MAAM,WAAW,GAAG,CAAO,OAAe,EAAoB,EAAE,kDAAC,OAAA,CAAC,MAAM,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAA,GAAA,CAAC;AAAlH,QAAA,WAAW,eAAuG;AAE/H,+EAA+E;AAC/E,2DAA2D;AACpD,MAAM,UAAU,GAAG,CAAO,OAAe,EAAmB,EAAE;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACpD,OAAO,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5B,CAAC,CAAA,CAAC;AAHW,QAAA,UAAU,cAGrB;AAEF,sFAAsF;AAC/E,MAAM,cAAc,GAAG,CAC5B,OAAe,EACf,OAA8E,EAChE,EAAE;IAChB,MAAM,EAAE,QAAQ,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACvD,OAAO,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACxC,CAAC,CAAA,CAAC;AANW,QAAA,cAAc,kBAMzB","sourcesContent":["// Present a single-choice list prompt and return the selected value.\n// @inquirer/prompts is imported lazily so commands only pay for it when\n// actually prompting.\nexport const promptSelect = async (message: string, choices: string[], defaultChoice?: string): Promise<string> => {\n const { select } = await import('@inquirer/prompts');\n return select({ message, choices, default: defaultChoice });\n};\n\n// A single-choice list prompt over labelled values; a choice's optional\n// `short` replaces its name in the answer line once picked, and its optional\n// `description` renders under the list while it is highlighted.\nexport const promptSelectDetailed = async <T>(\n message: string,\n choices: { name: string; value: T; short?: string; description?: string }[],\n): Promise<T> => {\n const { select } = await import('@inquirer/prompts');\n return select({ message, choices });\n};\n\n// A yes/no list prompt, returning true for \"Yes\".\nexport const promptYesNo = async (message: string): Promise<boolean> => (await promptSelect(message, ['No', 'Yes'])) === 'Yes';\n\n// A free-text prompt — used where a y/n is too easy to fat-finger (destructive\n// confirmations that require typing the target name back).\nexport const promptText = async (message: string): Promise<string> => {\n const { input } = await import('@inquirer/prompts');\n return input({ message });\n};\n\n// A multi-select checkbox prompt over labelled values; `checked` preselects a choice.\nexport const promptCheckbox = async <T>(\n message: string,\n choices: { name: string; value: T; checked?: boolean; description?: string }[],\n): Promise<T[]> => {\n const { checkbox } = await import('@inquirer/prompts');\n return checkbox({ message, choices });\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import { type QPQConfig } from '@qpqjs/core';
2
+ export declare const loadServiceQpqConfig: (appName: string, service: string) => QPQConfig;
3
+ export declare const getAppPrefix: (appName: string) => string;
4
+ export declare const getServiceNamesWithFederation: (appName: string, serviceNames: string[]) => string[];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getServiceNamesWithFederation = exports.getAppPrefix = exports.loadServiceQpqConfig = void 0;
4
+ const core_1 = require("@qpqjs/core");
5
+ const deploy_aws_1 = require("@qpqjs/deploy-aws");
6
+ const discovery_1 = require("./discovery");
7
+ // Loads a service's live infrastructure.ts (qpq runs with ts-node hooks
8
+ // registered, so requiring TS works and `@scope/*` imports resolve through
9
+ // workspace symlinks).
10
+ const loadServiceQpqConfig = (appName, service) => (0, deploy_aws_1.getWorkspaceServiceQpqConfig)((0, discovery_1.getRoot)(), appName, service);
11
+ exports.loadServiceQpqConfig = loadServiceQpqConfig;
12
+ const getAppPrefix = (appName) => {
13
+ const services = (0, discovery_1.getServiceNames)(appName);
14
+ if (services.length === 0)
15
+ throw new Error(`No services found for app ${appName}`);
16
+ return core_1.qpqCoreUtils.getApplicationName((0, exports.loadServiceQpqConfig)(appName, services[0]));
17
+ };
18
+ exports.getAppPrefix = getAppPrefix;
19
+ // The subset of the given services that opt into module-federation publishing,
20
+ // i.e. declare defineFederatedModuleStore(...). Federation is a config setting,
21
+ // not a directory convention (unlike views/ backends), so detecting it means
22
+ // loading each service's config — which is why this lives here and not in the
23
+ // directory-only discovery module. Used by the deploy drivers to decide which
24
+ // backends to publish federated remotes for after a deploy.
25
+ const getServiceNamesWithFederation = (appName, serviceNames) => serviceNames.filter((service) => !!core_1.qpqCoreUtils.getFederatedModuleStore((0, exports.loadServiceQpqConfig)(appName, service)));
26
+ exports.getServiceNamesWithFederation = getServiceNamesWithFederation;
27
+ //# sourceMappingURL=qpqConfigs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qpqConfigs.js","sourceRoot":"","sources":["../../../src/lib/qpqConfigs.ts"],"names":[],"mappings":";;;AAAA,sCAA2D;AAC3D,kDAAiE;AAEjE,2CAAuD;AAEvD,wEAAwE;AACxE,2EAA2E;AAC3E,uBAAuB;AAChB,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAa,EAAE,CAAC,IAAA,yCAA4B,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAAlI,QAAA,oBAAoB,wBAA8G;AAExI,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,MAAM,QAAQ,GAAG,IAAA,2BAAe,EAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,EAAE,CAAC,CAAC;IACnF,OAAO,mBAAY,CAAC,kBAAkB,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEF,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,4DAA4D;AACrD,MAAM,6BAA6B,GAAG,CAAC,OAAe,EAAE,YAAsB,EAAY,EAAE,CACjG,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAY,CAAC,uBAAuB,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AADtG,QAAA,6BAA6B,iCACyE","sourcesContent":["import { type QPQConfig, qpqCoreUtils } from '@qpqjs/core';\nimport { getWorkspaceServiceQpqConfig } from '@qpqjs/deploy-aws';\n\nimport { getRoot, getServiceNames } from './discovery';\n\n// Loads a service's live infrastructure.ts (qpq runs with ts-node hooks\n// registered, so requiring TS works and `@scope/*` imports resolve through\n// workspace symlinks).\nexport const loadServiceQpqConfig = (appName: string, service: string): QPQConfig => getWorkspaceServiceQpqConfig(getRoot(), appName, service);\n\nexport const getAppPrefix = (appName: string): string => {\n const services = getServiceNames(appName);\n if (services.length === 0) throw new Error(`No services found for app ${appName}`);\n return qpqCoreUtils.getApplicationName(loadServiceQpqConfig(appName, services[0]));\n};\n\n// The subset of the given services that opt into module-federation publishing,\n// i.e. declare defineFederatedModuleStore(...). Federation is a config setting,\n// not a directory convention (unlike views/ backends), so detecting it means\n// loading each service's config — which is why this lives here and not in the\n// directory-only discovery module. Used by the deploy drivers to decide which\n// backends to publish federated remotes for after a deploy.\nexport const getServiceNamesWithFederation = (appName: string, serviceNames: string[]): string[] =>\n serviceNames.filter((service) => !!qpqCoreUtils.getFederatedModuleStore(loadServiceQpqConfig(appName, service)));\n"]}
@@ -0,0 +1,6 @@
1
+ export type ResolveAppOptions = {
2
+ argv: string[];
3
+ envVar?: string;
4
+ allowAll?: boolean;
5
+ };
6
+ export declare const resolveAppSelection: (options: ResolveAppOptions) => Promise<string>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.resolveAppSelection = void 0;
13
+ // One app-selection contract for every app-facing command (prep / synth / go /
14
+ // go:dev / go:dev:api / go:dev:web / publish). Resolution order:
15
+ // 1. --app <name> / --app=<name> on argv
16
+ // 2. npm_config_app (npm run x --app foo, no --)
17
+ // 3. an env var the command already honours (QPQ_DEV_APP / DEPLOY_APP_NAME)
18
+ // 4. exactly one app under apps/ -> auto-select
19
+ // 5. interactive prompt (TTY only)
20
+ // 6. otherwise: print the valid app list and exit non-zero
21
+ // An unknown name (from any source) also prints the list and exits non-zero.
22
+ // Commands that can meaningfully run for every app may pass allowAll to accept
23
+ // `--app all` (returned as the literal 'all').
24
+ const args_1 = require("./args");
25
+ const discovery_1 = require("./discovery");
26
+ const prompts_1 = require("./prompts");
27
+ const exitWithAppList = (requested, availableApps) => {
28
+ if (requested)
29
+ console.error(`Unknown app '${requested}'.`);
30
+ console.error(`Valid apps: ${availableApps.join(', ')}`);
31
+ console.error(`Pass one with --app <name> (e.g. qpq <command> --app ${availableApps[0]}).`);
32
+ process.exit(1);
33
+ };
34
+ const resolveAppSelection = (options) => __awaiter(void 0, void 0, void 0, function* () {
35
+ const availableApps = (0, discovery_1.getAvailableApps)();
36
+ if (availableApps.length === 0) {
37
+ console.error('No apps found under apps/.');
38
+ process.exit(1);
39
+ }
40
+ const requested = (0, args_1.getArgValue)(options.argv, '--app') || process.env.npm_config_app || (options.envVar ? process.env[options.envVar] : undefined);
41
+ if (requested) {
42
+ if (options.allowAll && requested === 'all')
43
+ return 'all';
44
+ if (!availableApps.includes(requested))
45
+ exitWithAppList(requested, availableApps);
46
+ return requested;
47
+ }
48
+ if (availableApps.length === 1) {
49
+ console.log(`Using app: ${availableApps[0]}`);
50
+ return availableApps[0];
51
+ }
52
+ if (process.stdin.isTTY) {
53
+ return (0, prompts_1.promptSelect)('Select app', options.allowAll ? [...availableApps, 'all'] : availableApps);
54
+ }
55
+ return exitWithAppList(undefined, availableApps);
56
+ });
57
+ exports.resolveAppSelection = resolveAppSelection;
58
+ //# sourceMappingURL=resolveAppSelection.js.map