@qpqjs/cli 0.0.0-stage → 0.2.1

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,88 @@
1
+ // `qpq setup` — takes a cloud environment from empty to deployed, in order, with
2
+ // every step checked first so the menu shows what is already in place and a
3
+ // rerun on a half-set-up account is safe. The platform (from the deployment's
4
+ // entry in deploy.config.json) contributes the steps.
5
+ // --check print each step's status and exit, run nothing
6
+ // --yes run every step without the menu
7
+ // --only a,b run only the named step ids (no menu)
8
+ import { getArgValue } from '../lib/args';
9
+ import { promptCheckbox } from '../lib/prompts';
10
+ import { resolveAppSelection } from '../lib/resolveAppSelection';
11
+ import { resolveDeployment } from '../lib/resolveDeployment';
12
+ import { getPlatformDriver } from '../platforms';
13
+ const statusLabel = (result) => (result === null ? '?' : result.done ? 'done' : 'todo');
14
+ const printChecklist = (checked) => {
15
+ for (const { step, result } of checked) {
16
+ const detail = result?.detail ? ` ${result.detail}` : '';
17
+ console.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);
18
+ }
19
+ };
20
+ const checkAll = async (steps) => {
21
+ const checked = [];
22
+ for (const step of steps) {
23
+ try {
24
+ checked.push({ step, result: await step.check() });
25
+ }
26
+ catch (error) {
27
+ checked.push({ step, result: { done: false, detail: `check failed: ${error instanceof Error ? error.message : String(error)}` } });
28
+ }
29
+ }
30
+ return checked;
31
+ };
32
+ // Steps not yet done are preselected; done ones can still be picked to rerun.
33
+ const chooseSteps = async (checked) => {
34
+ const chosen = await promptCheckbox('Setup steps to run (space toggles, enter runs in order)', checked.map(({ step, result }) => ({
35
+ name: `[${statusLabel(result).padEnd(4)}] ${step.name}`,
36
+ value: step,
37
+ checked: !result?.done,
38
+ description: result?.detail,
39
+ })));
40
+ // Always run in checklist order, whatever order they were ticked in.
41
+ return checked.map(({ step }) => step).filter((step) => chosen.includes(step));
42
+ };
43
+ const selectFromArgs = (steps, argv) => {
44
+ if (argv.includes('--yes')) {
45
+ return steps;
46
+ }
47
+ const only = getArgValue(argv, '--only');
48
+ if (!only) {
49
+ return null;
50
+ }
51
+ const ids = only.split(',').map((id) => id.trim());
52
+ const unknown = ids.filter((id) => !steps.some((step) => step.id === id));
53
+ if (unknown.length > 0) {
54
+ console.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);
55
+ process.exit(1);
56
+ }
57
+ return steps.filter((step) => ids.includes(step.id));
58
+ };
59
+ export const setupCommand = async (argv) => {
60
+ const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });
61
+ const { deploymentName, deployment } = await resolveDeployment(argv, appName);
62
+ const driver = getPlatformDriver(deployment.platform);
63
+ if (!driver.setupSteps) {
64
+ console.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);
65
+ return;
66
+ }
67
+ const steps = await driver.setupSteps(appName, deploymentName);
68
+ console.log(`\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\n`);
69
+ const checked = await checkAll(steps);
70
+ printChecklist(checked);
71
+ console.log('');
72
+ if (argv.includes('--check')) {
73
+ return;
74
+ }
75
+ const toRun = selectFromArgs(steps, argv) ?? (await chooseSteps(checked));
76
+ if (toRun.length === 0) {
77
+ console.log('Nothing selected.');
78
+ return;
79
+ }
80
+ for (const step of toRun) {
81
+ console.log(`\n== ${step.name}\n`);
82
+ await step.run();
83
+ }
84
+ console.log('\nSetup complete. Final state:\n');
85
+ printChecklist(await checkAll(steps));
86
+ console.log(`\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);
87
+ };
88
+ //# source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AG,CAAC,qEAAqE,OAAO,iBAAiB,cAAc,EAAE,CAAC,CAAC;AAC7H,CAAC,CAAC","sourcesContent":["// `qpq setup` — takes a cloud environment from empty to deployed, in order, with\n// every step checked first so the menu shows what is already in place and a\n// rerun on a half-set-up account is safe. The platform (from the deployment's\n// entry in deploy.config.json) contributes the steps.\n// --check print each step's status and exit, run nothing\n// --yes run every step without the menu\n// --only a,b run only the named step ids (no menu)\nimport { getArgValue } from '../lib/args';\nimport { promptCheckbox } from '../lib/prompts';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { SetupCheckResult, SetupStep } from '../lib/setupStep';\nimport { getPlatformDriver } from '../platforms';\n\ntype CheckedStep = { step: SetupStep; result: SetupCheckResult | null };\n\nconst statusLabel = (result: SetupCheckResult | null): string => (result === null ? '?' : result.done ? 'done' : 'todo');\n\nconst printChecklist = (checked: CheckedStep[]): void => {\n for (const { step, result } of checked) {\n const detail = result?.detail ? ` ${result.detail}` : '';\n console.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);\n }\n};\n\nconst checkAll = async (steps: SetupStep[]): Promise<CheckedStep[]> => {\n const checked: CheckedStep[] = [];\n for (const step of steps) {\n try {\n checked.push({ step, result: await step.check() });\n } catch (error) {\n checked.push({ step, result: { done: false, detail: `check failed: ${error instanceof Error ? error.message : String(error)}` } });\n }\n }\n return checked;\n};\n\n// Steps not yet done are preselected; done ones can still be picked to rerun.\nconst chooseSteps = async (checked: CheckedStep[]): Promise<SetupStep[]> => {\n const chosen = await promptCheckbox(\n 'Setup steps to run (space toggles, enter runs in order)',\n checked.map(({ step, result }) => ({\n name: `[${statusLabel(result).padEnd(4)}] ${step.name}`,\n value: step,\n checked: !result?.done,\n description: result?.detail,\n })),\n );\n\n // Always run in checklist order, whatever order they were ticked in.\n return checked.map(({ step }) => step).filter((step) => chosen.includes(step));\n};\n\nconst selectFromArgs = (steps: SetupStep[], argv: string[]): SetupStep[] | null => {\n if (argv.includes('--yes')) {\n return steps;\n }\n\n const only = getArgValue(argv, '--only');\n if (!only) {\n return null;\n }\n\n const ids = only.split(',').map((id) => id.trim());\n const unknown = ids.filter((id) => !steps.some((step) => step.id === id));\n if (unknown.length > 0) {\n console.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);\n process.exit(1);\n }\n\n return steps.filter((step) => ids.includes(step.id));\n};\n\nexport const setupCommand = async (argv: string[]): Promise<void> => {\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { deploymentName, deployment } = await resolveDeployment(argv, appName);\n const driver = getPlatformDriver(deployment.platform);\n\n if (!driver.setupSteps) {\n console.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);\n return;\n }\n\n const steps = await driver.setupSteps(appName, deploymentName);\n\n console.log(`\\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\\n`);\n const checked = await checkAll(steps);\n printChecklist(checked);\n console.log('');\n\n if (argv.includes('--check')) {\n return;\n }\n\n const toRun = selectFromArgs(steps, argv) ?? (await chooseSteps(checked));\n if (toRun.length === 0) {\n console.log('Nothing selected.');\n return;\n }\n\n for (const step of toRun) {\n console.log(`\\n== ${step.name}\\n`);\n await step.run();\n }\n\n console.log('\\nSetup complete. Final state:\\n');\n printChecklist(await checkAll(steps));\n console.log(`\\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare const synthCommand: (argv: string[]) => Promise<void>;
@@ -0,0 +1,73 @@
1
+ // `qpq synth [service]` — synthesizes each backend service's QPQ config to
2
+ // dist/apps/<app>/infrastructure/<module>-config.json.
3
+ //
4
+ // Runs with ts-node hooks registered (see runCli), which transpiles each
5
+ // service's infrastructure.ts on require. Cross-package `@scope/*` imports
6
+ // resolve through the workspace node_modules symlinks to already-built dist.
7
+ import { qpqCoreUtils } from '@qpqjs/core';
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+ import { getPositionalArgs } from '../lib/args';
11
+ import { getAvailableApps, getRoot, getServiceNamesWithSubdir } from '../lib/discovery';
12
+ import { loadServiceQpqConfig } from '../lib/qpqConfigs';
13
+ import { resolveAppSelection } from '../lib/resolveAppSelection';
14
+ import { resolveDeployment } from '../lib/resolveDeployment';
15
+ const processConfig = (folderName, appName) => {
16
+ console.log(`Processing infrastructure: [${folderName}] for app [${appName}]`);
17
+ const qpqConfig = loadServiceQpqConfig(appName, folderName);
18
+ const moduleName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
19
+ const directoryPath = path.join(getRoot(), 'dist', 'apps', appName, 'infrastructure');
20
+ fs.mkdirSync(directoryPath, { recursive: true });
21
+ fs.writeFileSync(path.join(directoryPath, `${moduleName}-config.json`), JSON.stringify(qpqConfig, null, 2));
22
+ console.log(` -> ${appName}/infrastructure/${moduleName}-config.json`);
23
+ };
24
+ export const synthCommand = async (argv) => {
25
+ const [specifiedServiceName] = getPositionalArgs(argv, ['--app', '--deployment']);
26
+ const hasExplicitApp = argv.includes('--app') || argv.some((a) => a.startsWith('--app=')) || !!process.env.npm_config_app || !!process.env.DEPLOY_APP_NAME;
27
+ let appNames;
28
+ if (specifiedServiceName && !hasExplicitApp) {
29
+ // A bare service name is unambiguous — synth it in whichever app owns it.
30
+ const appWithService = getAvailableApps().find((appName) => getServiceNamesWithSubdir(appName, 'service').includes(specifiedServiceName));
31
+ if (!appWithService) {
32
+ console.error(`Service '${specifiedServiceName}' not found in any app`);
33
+ process.exit(1);
34
+ }
35
+ appNames = [appWithService];
36
+ }
37
+ else {
38
+ const selection = await resolveAppSelection({
39
+ argv,
40
+ envVar: 'DEPLOY_APP_NAME',
41
+ allowAll: true,
42
+ });
43
+ appNames = selection === 'all' ? getAvailableApps() : [selection];
44
+ }
45
+ console.log(`QPQ synthesizing apps: ${appNames.join(', ')}`);
46
+ for (const appName of appNames) {
47
+ // Service configs read the deployment env vars at require time, so the
48
+ // deployment is resolved (and primed) before any infrastructure.ts loads.
49
+ await resolveDeployment(argv, appName);
50
+ // Validate a specified service against the app's discovered services before it
51
+ // reaches loadServiceQpqConfig -> require. The bare-service-name branch above
52
+ // already checks this; the --app/env branch used to skip it, letting a typo hit
53
+ // a cryptic module-resolution error and a `../` value normalize into an arbitrary
54
+ // require target. Both paths now validate identically.
55
+ const appServices = getServiceNamesWithSubdir(appName, 'service');
56
+ if (specifiedServiceName && !appServices.includes(specifiedServiceName)) {
57
+ console.error(`Service '${specifiedServiceName}' not found in app '${appName}'`);
58
+ process.exitCode = 1;
59
+ continue;
60
+ }
61
+ const serviceNames = specifiedServiceName ? [specifiedServiceName] : appServices;
62
+ for (const folderName of serviceNames) {
63
+ try {
64
+ processConfig(folderName, appName);
65
+ }
66
+ catch (error) {
67
+ console.error(`Failed to process ${folderName} in ${appName}:`, error);
68
+ process.exitCode = 1;
69
+ }
70
+ }
71
+ }
72
+ };
73
+ //# sourceMappingURL=synth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"synth.js","sourceRoot":"","sources":["../../../src/commands/synth.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,uDAAuD;AACvD,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,6EAA6E;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,aAAa,GAAG,CAAC,U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GAAG,CAAC,CAAC;YACrB,SAAS;QACX,CAAC;QAED,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;QAEjF,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE,CAAC;YACtC,IAAI,CAAC;gBACH,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YACrC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,qBAAqB,UAAU,OAAO,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;gBACvE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["// `qpq synth [service]` — synthesizes each backend service's QPQ config to\n// dist/apps/<app>/infrastructure/<module>-config.json.\n//\n// Runs with ts-node hooks registered (see runCli), which transpiles each\n// service's infrastructure.ts on require. Cross-package `@scope/*` imports\n// resolve through the workspace node_modules symlinks to already-built dist.\nimport { qpqCoreUtils } from '@qpqjs/core';\n\nimport fs from 'fs';\nimport path from 'path';\n\nimport { getPositionalArgs } from '../lib/args';\nimport { getAvailableApps, getRoot, getServiceNamesWithSubdir } from '../lib/discovery';\nimport { loadServiceQpqConfig } from '../lib/qpqConfigs';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\n\nconst processConfig = (folderName: string, appName: string): void => {\n console.log(`Processing infrastructure: [${folderName}] for app [${appName}]`);\n const qpqConfig = loadServiceQpqConfig(appName, folderName);\n const moduleName = qpqCoreUtils.getApplicationModuleName(qpqConfig);\n\n const directoryPath = path.join(getRoot(), 'dist', 'apps', appName, 'infrastructure');\n fs.mkdirSync(directoryPath, { recursive: true });\n fs.writeFileSync(path.join(directoryPath, `${moduleName}-config.json`), JSON.stringify(qpqConfig, null, 2));\n console.log(` -> ${appName}/infrastructure/${moduleName}-config.json`);\n};\n\nexport const synthCommand = async (argv: string[]): Promise<void> => {\n const [specifiedServiceName] = getPositionalArgs(argv, ['--app', '--deployment']);\n\n const hasExplicitApp =\n argv.includes('--app') || argv.some((a) => a.startsWith('--app=')) || !!process.env.npm_config_app || !!process.env.DEPLOY_APP_NAME;\n\n let appNames: string[];\n if (specifiedServiceName && !hasExplicitApp) {\n // A bare service name is unambiguous — synth it in whichever app owns it.\n const appWithService = getAvailableApps().find((appName) => getServiceNamesWithSubdir(appName, 'service').includes(specifiedServiceName));\n if (!appWithService) {\n console.error(`Service '${specifiedServiceName}' not found in any app`);\n process.exit(1);\n }\n appNames = [appWithService];\n } else {\n const selection = await resolveAppSelection({\n argv,\n envVar: 'DEPLOY_APP_NAME',\n allowAll: true,\n });\n appNames = selection === 'all' ? getAvailableApps() : [selection];\n }\n\n console.log(`QPQ synthesizing apps: ${appNames.join(', ')}`);\n\n for (const appName of appNames) {\n // Service configs read the deployment env vars at require time, so the\n // deployment is resolved (and primed) before any infrastructure.ts loads.\n await resolveDeployment(argv, appName);\n\n // Validate a specified service against the app's discovered services before it\n // reaches loadServiceQpqConfig -> require. The bare-service-name branch above\n // already checks this; the --app/env branch used to skip it, letting a typo hit\n // a cryptic module-resolution error and a `../` value normalize into an arbitrary\n // require target. Both paths now validate identically.\n const appServices = getServiceNamesWithSubdir(appName, 'service');\n if (specifiedServiceName && !appServices.includes(specifiedServiceName)) {\n console.error(`Service '${specifiedServiceName}' not found in app '${appName}'`);\n process.exitCode = 1;\n continue;\n }\n\n const serviceNames = specifiedServiceName ? [specifiedServiceName] : appServices;\n\n for (const folderName of serviceNames) {\n try {\n processConfig(folderName, appName);\n } catch (error) {\n console.error(`Failed to process ${folderName} in ${appName}:`, error);\n process.exitCode = 1;\n }\n }\n }\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare const teardownCommand: (argv: string[]) => Promise<void>;
@@ -0,0 +1,20 @@
1
+ // `qpq teardown` — interactive destroy, the counterpart of `qpq go`. Resolves
2
+ // the app + deployment the same way, asks which services to tear down (with
3
+ // a typed confirmation — this deletes stored data), then hands off to the
4
+ // platform driver to destroy the web, api and inf stacks in that order.
5
+ import { promptTeardownPlan } from '../lib/deployPrompts';
6
+ import { resolveAppSelection } from '../lib/resolveAppSelection';
7
+ import { resolveDeployment } from '../lib/resolveDeployment';
8
+ import { getPlatformDriver } from '../platforms';
9
+ export const teardownCommand = async (argv) => {
10
+ const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });
11
+ const { deployment } = await resolveDeployment(argv, appName);
12
+ const driver = getPlatformDriver(deployment.platform);
13
+ if (!driver.teardown) {
14
+ console.error(`The '${deployment.platform}' platform has no teardown strategy.`);
15
+ process.exit(1);
16
+ }
17
+ const plan = await promptTeardownPlan(appName);
18
+ await driver.teardown(appName, plan);
19
+ };
20
+ //# sourceMappingURL=teardown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teardown.js","sourceRoot":"","sources":["../../../src/commands/teardown.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,0EAA0E;AAC1E,wEAAwE;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACrE,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEtD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,OAAO,CAAC,KAAK,CAAC,QAAQ,UAAU,CAAC,QAAQ,sCAAsC,CAAC,CAAC;QACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAE/C,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC,CAAC","sourcesContent":["// `qpq teardown` — interactive destroy, the counterpart of `qpq go`. Resolves\n// the app + deployment the same way, asks which services to tear down (with\n// a typed confirmation — this deletes stored data), then hands off to the\n// platform driver to destroy the web, api and inf stacks in that order.\nimport { promptTeardownPlan } from '../lib/deployPrompts';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { getPlatformDriver } from '../platforms';\n\nexport const teardownCommand = async (argv: string[]): Promise<void> => {\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { deployment } = await resolveDeployment(argv, appName);\n const driver = getPlatformDriver(deployment.platform);\n\n if (!driver.teardown) {\n console.error(`The '${deployment.platform}' platform has no teardown strategy.`);\n process.exit(1);\n }\n\n const plan = await promptTeardownPlan(appName);\n\n await driver.teardown(appName, plan);\n};\n"]}
@@ -0,0 +1 @@
1
+ export * from './cli';
@@ -0,0 +1,2 @@
1
+ export * from './cli';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC","sourcesContent":["export * from './cli';\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const getArgValue: (argv: string[], flag: string) => string | undefined;
2
+ export declare const hasArgFlag: (argv: string[], flag: string) => boolean;
3
+ export declare const getPositionalArgs: (argv: string[], valueFlags: string[]) => string[];
@@ -0,0 +1,25 @@
1
+ // Flag parsing over the command's argv (everything after the command name).
2
+ export const getArgValue = (argv, flag) => {
3
+ const eq = argv.find((a) => a.startsWith(`${flag}=`));
4
+ if (eq)
5
+ return eq.slice(`${flag}=`.length);
6
+ const idx = argv.indexOf(flag);
7
+ return idx >= 0 ? argv[idx + 1] : undefined;
8
+ };
9
+ // A presence-only flag: `--foo`. `--foo=false` is honoured as off, so a
10
+ // wrapper script can pass the flag through with a computed value rather than
11
+ // having to conditionally omit it.
12
+ export const hasArgFlag = (argv, flag) => {
13
+ const eq = argv.find((a) => a.startsWith(`${flag}=`));
14
+ if (eq)
15
+ return eq.slice(`${flag}=`.length) !== 'false';
16
+ return argv.includes(flag);
17
+ };
18
+ // Positional args = non-flag args, skipping values consumed by known flags.
19
+ export const getPositionalArgs = (argv, valueFlags) => argv.filter((arg, index) => {
20
+ if (arg.startsWith('--'))
21
+ return false;
22
+ const previous = argv[index - 1];
23
+ return !(previous && valueFlags.includes(previous));
24
+ });
25
+ //# sourceMappingURL=args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../../../src/lib/args.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,IAAY,EAAsB,EAAE;IAC9E,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IACtD,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC,CAAC;AAEF,wEAAwE;AACxE,6EAA6E;AAC7E,mCAAmC;AACnC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAc,EAAE,IAAY,EAAW,EAAE;IAClE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IACtD,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC;IAEvD,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAc,EAAE,UAAoB,EAAY,EAAE,CAClF,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IACzB,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC","sourcesContent":["// Flag parsing over the command's argv (everything after the command name).\nexport const getArgValue = (argv: string[], flag: string): string | undefined => {\n const eq = argv.find((a) => a.startsWith(`${flag}=`));\n if (eq) return eq.slice(`${flag}=`.length);\n const idx = argv.indexOf(flag);\n return idx >= 0 ? argv[idx + 1] : undefined;\n};\n\n// A presence-only flag: `--foo`. `--foo=false` is honoured as off, so a\n// wrapper script can pass the flag through with a computed value rather than\n// having to conditionally omit it.\nexport const hasArgFlag = (argv: string[], flag: string): boolean => {\n const eq = argv.find((a) => a.startsWith(`${flag}=`));\n if (eq) return eq.slice(`${flag}=`.length) !== 'false';\n\n return argv.includes(flag);\n};\n\n// Positional args = non-flag args, skipping values consumed by known flags.\nexport const getPositionalArgs = (argv: string[], valueFlags: string[]): string[] =>\n argv.filter((arg, index) => {\n if (arg.startsWith('--')) return false;\n const previous = argv[index - 1];\n return !(previous && valueFlags.includes(previous));\n });\n"]}
@@ -0,0 +1,3 @@
1
+ export type ImportCycle = string[];
2
+ export declare const getWorkspaceDirectories: (root: string) => string[];
3
+ export declare const findWorkspaceImportCycles: (root: string) => Promise<ImportCycle[]>;
@@ -0,0 +1,61 @@
1
+ // Source-level circular import detection over the consumer repo's npm
2
+ // workspaces, powered by madge (AST-based dependency graph + cycle detection).
3
+ // Complements the rspack CircularCheckRspackPlugin (which needs a bundle to
4
+ // run): this scans TypeScript sources directly, so it can run inside tsc-only
5
+ // flows like `npm run validate-ts` with no bundling.
6
+ //
7
+ // Scope: each workspace's src, relative imports. Cross-package cycles are
8
+ // already impossible — TypeScript project references refuse to build them — so
9
+ // every runtime-relevant cycle lives inside one package's src. Type-only
10
+ // imports are skipped (skipTypeImports): tsc erases them, so they never create
11
+ // a runtime cycle.
12
+ import fs from 'fs';
13
+ import path from 'path';
14
+ // madge ships no type definitions; declare the narrow slice we use.
15
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
16
+ const madge = require('madge');
17
+ // Expand npm workspace globs (plain path segments and `*` segments only — the
18
+ // only forms npm workspaces use in practice) into existing directories.
19
+ const expandWorkspaceGlob = (root, pattern) => {
20
+ let candidates = [root];
21
+ for (const segment of pattern.split('/')) {
22
+ if (segment === '*') {
23
+ candidates = candidates.flatMap((dir) => fs.existsSync(dir)
24
+ ? fs
25
+ .readdirSync(dir, { withFileTypes: true })
26
+ .filter((entry) => entry.isDirectory())
27
+ .map((entry) => path.join(dir, entry.name))
28
+ : []);
29
+ }
30
+ else {
31
+ candidates = candidates.map((dir) => path.join(dir, segment));
32
+ }
33
+ }
34
+ return candidates.filter((dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory());
35
+ };
36
+ export const getWorkspaceDirectories = (root) => {
37
+ const packageJson = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
38
+ const patterns = packageJson.workspaces ?? [];
39
+ return patterns.flatMap((pattern) => expandWorkspaceGlob(root, pattern));
40
+ };
41
+ export const findWorkspaceImportCycles = async (root) => {
42
+ const sourceDirs = getWorkspaceDirectories(root)
43
+ .map((dir) => path.join(dir, 'src'))
44
+ .filter((dir) => fs.existsSync(dir));
45
+ // Excludes: node_modules and built output (dist/lib), declaration files
46
+ // (type-only, can't cycle at runtime), and anything madge resolves to outside
47
+ // the repo root (linked framework packages — their cycles surface through the
48
+ // rspack CircularCheckRspackPlugin instead, this command owns the consumer
49
+ // repo). Out-of-root paths start with '..' because baseDir is the repo root.
50
+ const result = await madge(sourceDirs, {
51
+ baseDir: root,
52
+ fileExtensions: ['ts', 'tsx'],
53
+ excludeRegExp: [/node_modules/, /(^|\/)(dist|lib)\//, /\.d\.ts$/, /^\.\./],
54
+ detectiveOptions: {
55
+ ts: { skipTypeImports: true },
56
+ tsx: { skipTypeImports: true },
57
+ },
58
+ });
59
+ return result.circular();
60
+ };
61
+ //# sourceMappingURL=circularImports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circularImports.js","sourceRoot":"","sources":["../../../src/lib/circularImports.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,0EAA0E;AAC1E,+EAA+E;AAC/E,yEAAyE;AACzE,+EAA+E;AAC/E,mBAAmB;AACnB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,oEAAoE;AACpE,iEAAiE;AACjE,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAA6E,CAAC;AAI3G,8EAA8E;AAC9E,wEAAwE;AACxE,MAAM,mBAAmB,G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MAAM,QAAQ,GAAa,WAAW,CAAC,UAAU,IAAI,EAAE,CAAC;IACxD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,EAAE,IAAY,EAA0B,EAAE;IACtF,MAAM,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC;SAC7C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACnC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvC,wEAAwE;IACxE,8EAA8E;IAC9E,8EAA8E;IAC9E,2EAA2E;IAC3E,6EAA6E;IAC7E,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;QACrC,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;QAC7B,aAAa,EAAE,CAAC,cAAc,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,CAAC;QAC1E,gBAAgB,EAAE;YAChB,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;YAC7B,GAAG,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;SAC/B;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["// Source-level circular import detection over the consumer repo's npm\n// workspaces, powered by madge (AST-based dependency graph + cycle detection).\n// Complements the rspack CircularCheckRspackPlugin (which needs a bundle to\n// run): this scans TypeScript sources directly, so it can run inside tsc-only\n// flows like `npm run validate-ts` with no bundling.\n//\n// Scope: each workspace's src, relative imports. Cross-package cycles are\n// already impossible — TypeScript project references refuse to build them — so\n// every runtime-relevant cycle lives inside one package's src. Type-only\n// imports are skipped (skipTypeImports): tsc erases them, so they never create\n// a runtime cycle.\nimport fs from 'fs';\nimport path from 'path';\n\n// madge ships no type definitions; declare the narrow slice we use.\n// eslint-disable-next-line @typescript-eslint/no-require-imports\nconst madge = require('madge') as (paths: string[], config: object) => Promise<{ circular(): string[][] }>;\n\nexport type ImportCycle = string[];\n\n// Expand npm workspace globs (plain path segments and `*` segments only — the\n// only forms npm workspaces use in practice) into existing directories.\nconst expandWorkspaceGlob = (root: string, pattern: string): string[] => {\n let candidates = [root];\n\n for (const segment of pattern.split('/')) {\n if (segment === '*') {\n candidates = candidates.flatMap((dir) =>\n fs.existsSync(dir)\n ? fs\n .readdirSync(dir, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => path.join(dir, entry.name))\n : [],\n );\n } else {\n candidates = candidates.map((dir) => path.join(dir, segment));\n }\n }\n\n return candidates.filter((dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory());\n};\n\nexport const getWorkspaceDirectories = (root: string): string[] => {\n const packageJson = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));\n const patterns: string[] = packageJson.workspaces ?? [];\n return patterns.flatMap((pattern) => expandWorkspaceGlob(root, pattern));\n};\n\nexport const findWorkspaceImportCycles = async (root: string): Promise<ImportCycle[]> => {\n const sourceDirs = getWorkspaceDirectories(root)\n .map((dir) => path.join(dir, 'src'))\n .filter((dir) => fs.existsSync(dir));\n\n // Excludes: node_modules and built output (dist/lib), declaration files\n // (type-only, can't cycle at runtime), and anything madge resolves to outside\n // the repo root (linked framework packages — their cycles surface through the\n // rspack CircularCheckRspackPlugin instead, this command owns the consumer\n // repo). Out-of-root paths start with '..' because baseDir is the repo root.\n const result = await madge(sourceDirs, {\n baseDir: root,\n fileExtensions: ['ts', 'tsx'],\n excludeRegExp: [/node_modules/, /(^|\\/)(dist|lib)\\//, /\\.d\\.ts$/, /^\\.\\./],\n detectiveOptions: {\n ts: { skipTypeImports: true },\n tsx: { skipTypeImports: true },\n },\n });\n\n return result.circular();\n};\n"]}
@@ -0,0 +1,15 @@
1
+ export type ClearableResourceKind = 'storageDrive' | 'keyValueStore';
2
+ export type ClearableResource = {
3
+ service: string;
4
+ kind: ClearableResourceKind;
5
+ resourceName: string;
6
+ };
7
+ export type ClearResourcesPlan = {
8
+ kind: 'cancelled';
9
+ } | {
10
+ kind: 'resources';
11
+ appName: string;
12
+ resources: ClearableResource[];
13
+ };
14
+ export declare const getClearableResources: (appName: string) => ClearableResource[];
15
+ export declare const promptClearResourcesPlan: (appName: string) => Promise<ClearResourcesPlan>;
@@ -0,0 +1,65 @@
1
+ // The question flow for `qpq clear-resources`: enumerate every service's OWNED
2
+ // data resources (storage drives -> buckets, key value stores -> tables) from
3
+ // its live qpq config, multi-select which to empty, then type the deploy
4
+ // target back to confirm - emptying deletes stored data, so a y/n prompt
5
+ // isn't enough friction. Owned-only so a cross-module ref (e.g. a membership
6
+ // table every service declares against one owner) appears exactly once, on
7
+ // the service that owns it.
8
+ import { qpqCoreUtils } from '@qpqjs/core';
9
+ import { getServiceNames } from './discovery';
10
+ import { promptCheckbox, promptSelect, promptText } from './prompts';
11
+ import { loadServiceQpqConfig } from './qpqConfigs';
12
+ import { getDeployTargetLabel } from './getDeployTargetLabel';
13
+ // Every owned data resource across the app's services, in service order.
14
+ export const getClearableResources = (appName) => {
15
+ const resources = [];
16
+ for (const service of getServiceNames(appName)) {
17
+ const qpqConfig = loadServiceQpqConfig(appName, service);
18
+ for (const drive of qpqCoreUtils.getOwnedStorageDrives(qpqConfig)) {
19
+ resources.push({ service, kind: 'storageDrive', resourceName: drive.storageDrive });
20
+ }
21
+ for (const store of qpqCoreUtils.getOwnedKeyValueStores(qpqConfig)) {
22
+ resources.push({ service, kind: 'keyValueStore', resourceName: store.keyValueStoreName });
23
+ }
24
+ }
25
+ return resources;
26
+ };
27
+ const BY_SERVICE = 'By service — empty everything the selected services own';
28
+ const BY_RESOURCE = 'By resource — pick individual buckets/tables';
29
+ // Service mode: pick services, take every resource each one owns.
30
+ const pickByService = async (clearable) => {
31
+ const services = [...new Set(clearable.map((resource) => resource.service))];
32
+ const countFor = (service) => clearable.filter((resource) => resource.service === service).length;
33
+ const picked = await promptCheckbox('Select services to EMPTY (every bucket/table the service owns)', services.map((service) => ({ name: `${service} (${countFor(service)} resources)`, value: service })));
34
+ return clearable.filter((resource) => picked.includes(resource.service));
35
+ };
36
+ // Resource mode: pick individual buckets/tables.
37
+ const pickByResource = (clearable) => promptCheckbox('Select resources to EMPTY (all stored data will be deleted)', clearable.map((resource) => ({
38
+ name: `${resource.service} — ${resource.resourceName} (${resource.kind === 'storageDrive' ? 'bucket' : 'table'})`,
39
+ value: resource,
40
+ })));
41
+ export const promptClearResourcesPlan = async (appName) => {
42
+ const deployInfo = getDeployTargetLabel();
43
+ const clearable = getClearableResources(appName);
44
+ if (clearable.length === 0) {
45
+ console.log('No storage drives or key value stores found in this app.');
46
+ return { kind: 'cancelled' };
47
+ }
48
+ const mode = await promptSelect('How do you want to select what to empty?', [BY_SERVICE, BY_RESOURCE]);
49
+ const resources = mode === BY_SERVICE ? await pickByService(clearable) : await pickByResource(clearable);
50
+ if (resources.length === 0) {
51
+ console.log('Nothing selected. Exiting!');
52
+ return { kind: 'cancelled' };
53
+ }
54
+ console.log(`\nThis will EMPTY (delete all stored data from) ${resources.length} resource(s) in [${deployInfo}]:`);
55
+ for (const resource of resources) {
56
+ console.log(` ${resource.service} — ${resource.resourceName} (${resource.kind === 'storageDrive' ? 'bucket' : 'table'})`);
57
+ }
58
+ const confirmation = await promptText(`Type '${deployInfo}' to confirm`);
59
+ if (confirmation !== deployInfo) {
60
+ console.log('Confirmation did not match. Exiting!');
61
+ return { kind: 'cancelled' };
62
+ }
63
+ return { kind: 'resources', appName, resources };
64
+ };
65
+ //# sourceMappingURL=clearResourcesPlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clearResourcesPlan.js","sourceRoot":"","s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AAE,CAAC;IAC/B,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACnD,CAAC,CAAC","sourcesContent":["// The question flow for `qpq clear-resources`: enumerate every service's OWNED\n// data resources (storage drives -> buckets, key value stores -> tables) from\n// its live qpq config, multi-select which to empty, then type the deploy\n// target back to confirm - emptying deletes stored data, so a y/n prompt\n// isn't enough friction. Owned-only so a cross-module ref (e.g. a membership\n// table every service declares against one owner) appears exactly once, on\n// the service that owns it.\nimport { qpqCoreUtils } from '@qpqjs/core';\n\nimport { getServiceNames } from './discovery';\nimport { promptCheckbox, promptSelect, promptText } from './prompts';\nimport { loadServiceQpqConfig } from './qpqConfigs';\nimport { getDeployTargetLabel } from './getDeployTargetLabel';\n\nexport type ClearableResourceKind = 'storageDrive' | 'keyValueStore';\n\nexport type ClearableResource = {\n service: string;\n kind: ClearableResourceKind;\n // The config-level resource name (e.g. 'templateTestAssets', 'userTenantLinks');\n // the platform driver resolves it to the concrete runtime name (bucket/table).\n resourceName: string;\n};\n\nexport type ClearResourcesPlan =\n | { kind: 'cancelled' }\n // Empty (not destroy) the selected resources' stored data.\n | { kind: 'resources'; appName: string; resources: ClearableResource[] };\n\n// Every owned data resource across the app's services, in service order.\nexport const getClearableResources = (appName: string): ClearableResource[] => {\n const resources: ClearableResource[] = [];\n\n for (const service of getServiceNames(appName)) {\n const qpqConfig = loadServiceQpqConfig(appName, service);\n\n for (const drive of qpqCoreUtils.getOwnedStorageDrives(qpqConfig)) {\n resources.push({ service, kind: 'storageDrive', resourceName: drive.storageDrive });\n }\n\n for (const store of qpqCoreUtils.getOwnedKeyValueStores(qpqConfig)) {\n resources.push({ service, kind: 'keyValueStore', resourceName: store.keyValueStoreName });\n }\n }\n\n return resources;\n};\n\nconst BY_SERVICE = 'By service — empty everything the selected services own';\nconst BY_RESOURCE = 'By resource — pick individual buckets/tables';\n\n// Service mode: pick services, take every resource each one owns.\nconst pickByService = async (clearable: ClearableResource[]): Promise<ClearableResource[]> => {\n const services = [...new Set(clearable.map((resource) => resource.service))];\n\n const countFor = (service: string) => clearable.filter((resource) => resource.service === service).length;\n\n const picked = await promptCheckbox(\n 'Select services to EMPTY (every bucket/table the service owns)',\n services.map((service) => ({ name: `${service} (${countFor(service)} resources)`, value: service })),\n );\n\n return clearable.filter((resource) => picked.includes(resource.service));\n};\n\n// Resource mode: pick individual buckets/tables.\nconst pickByResource = (clearable: ClearableResource[]): Promise<ClearableResource[]> =>\n promptCheckbox(\n 'Select resources to EMPTY (all stored data will be deleted)',\n clearable.map((resource) => ({\n name: `${resource.service} — ${resource.resourceName} (${resource.kind === 'storageDrive' ? 'bucket' : 'table'})`,\n value: resource,\n })),\n );\n\nexport const promptClearResourcesPlan = async (appName: string): Promise<ClearResourcesPlan> => {\n const deployInfo = getDeployTargetLabel();\n\n const clearable = getClearableResources(appName);\n\n if (clearable.length === 0) {\n console.log('No storage drives or key value stores found in this app.');\n return { kind: 'cancelled' };\n }\n\n const mode = await promptSelect('How do you want to select what to empty?', [BY_SERVICE, BY_RESOURCE]);\n\n const resources = mode === BY_SERVICE ? await pickByService(clearable) : await pickByResource(clearable);\n\n if (resources.length === 0) {\n console.log('Nothing selected. Exiting!');\n return { kind: 'cancelled' };\n }\n\n console.log(`\\nThis will EMPTY (delete all stored data from) ${resources.length} resource(s) in [${deployInfo}]:`);\n for (const resource of resources) {\n console.log(` ${resource.service} — ${resource.resourceName} (${resource.kind === 'storageDrive' ? 'bucket' : 'table'})`);\n }\n\n const confirmation = await promptText(`Type '${deployInfo}' to confirm`);\n\n if (confirmation !== deployInfo) {\n console.log('Confirmation did not match. Exiting!');\n return { kind: 'cancelled' };\n }\n\n return { kind: 'resources', appName, resources };\n};\n"]}
@@ -0,0 +1,26 @@
1
+ export type StackType = 'all' | 'inf' | 'api' | 'web' | 'views';
2
+ export type DeployPlan = {
3
+ kind: 'cancelled';
4
+ } | {
5
+ kind: 'account';
6
+ appName: string;
7
+ } | {
8
+ kind: 'bootstrap';
9
+ appName: string;
10
+ includeDomain: boolean;
11
+ } | {
12
+ kind: 'services';
13
+ appName: string;
14
+ services: string[];
15
+ stacks: StackType;
16
+ };
17
+ export declare const buildDeployPlanFromArgs: (appName: string, argv: string[]) => DeployPlan | null;
18
+ export declare const promptDeployPlan: (appName: string) => Promise<DeployPlan>;
19
+ export type TeardownPlan = {
20
+ kind: 'cancelled';
21
+ } | {
22
+ kind: 'services';
23
+ appName: string;
24
+ services: string[];
25
+ };
26
+ export declare const promptTeardownPlan: (appName: string) => Promise<TeardownPlan>;
@@ -0,0 +1,103 @@
1
+ // The interactive question flow shared by `qpq go` (sequential AWS deploy) and
2
+ // a future dockerized variant: pick an app, confirm the target, pick services
3
+ // (or domain/bootstrap), pick stacks. buildDeployPlanFromArgs is the
4
+ // non-interactive shortcut (`qpq go all all`) that skips every prompt.
5
+ import { getPositionalArgs } from './args';
6
+ import { getDeployTargetLabel } from './getDeployTargetLabel';
7
+ import { getServiceNames } from './discovery';
8
+ import { promptSelect, promptText, promptYesNo } from './prompts';
9
+ const STACK_TYPES = ['all', 'inf', 'api', 'web', 'views'];
10
+ // Non-interactive deploy plan from positional args: `qpq go <services> [stacks]`.
11
+ // services: 'all' | comma-separated service names | 'account' | 'domain' | 'bootstrap'
12
+ // stacks: all | inf | api | web | views (defaults to 'all')
13
+ // Returns null when no positional services token is given, so callers fall back
14
+ // to the interactive promptDeployPlan. Passing args is an explicit opt-in to a
15
+ // prompt-free deploy, so the "Deploying to: [env]" confirmation is skipped too.
16
+ export const buildDeployPlanFromArgs = (appName, argv) => {
17
+ const [servicesArg, stacksArg] = getPositionalArgs(argv, ['--app', '--deployment']);
18
+ if (!servicesArg) {
19
+ return null;
20
+ }
21
+ if (servicesArg === 'account') {
22
+ return { kind: 'account', appName };
23
+ }
24
+ if (servicesArg === 'domain') {
25
+ return { kind: 'bootstrap', appName, includeDomain: true };
26
+ }
27
+ if (servicesArg === 'bootstrap') {
28
+ return { kind: 'bootstrap', appName, includeDomain: false };
29
+ }
30
+ const allServices = getServiceNames(appName);
31
+ const services = servicesArg === 'all' ? allServices : servicesArg.split(',').map((s) => s.trim()).filter(Boolean);
32
+ const unknownServices = services.filter((service) => !allServices.includes(service));
33
+ if (unknownServices.length > 0) {
34
+ console.error(`Unknown service(s): ${unknownServices.join(', ')}. Valid services: ${allServices.join(', ')}`);
35
+ process.exit(1);
36
+ }
37
+ const stacks = (stacksArg ?? 'all');
38
+ if (!STACK_TYPES.includes(stacks)) {
39
+ console.error(`Unknown stacks '${stacksArg}'. Valid stacks: ${STACK_TYPES.join(', ')}`);
40
+ process.exit(1);
41
+ }
42
+ return { kind: 'services', appName, services: [...new Set(services)], stacks };
43
+ };
44
+ export const promptDeployPlan = async (appName) => {
45
+ const deployInfo = getDeployTargetLabel();
46
+ if (!(await promptYesNo(`Deploying to: [${deployInfo}]`))) {
47
+ console.log('Exiting!');
48
+ return { kind: 'cancelled' };
49
+ }
50
+ let services = [];
51
+ do {
52
+ const allServices = getServiceNames(appName);
53
+ // Bracketed so the meta options can't be mistaken for actual services.
54
+ const allText = '[ all ]';
55
+ const accountText = '[ account ]';
56
+ const domainEnvText = '[ domain ]';
57
+ const bootstrapEnvText = '[ bootstrap environment ]';
58
+ const service = await promptSelect('Select services to deploy', [allText, ...allServices, accountText, domainEnvText, bootstrapEnvText]);
59
+ if (service === allText) {
60
+ services = allServices;
61
+ break;
62
+ }
63
+ if (service === accountText) {
64
+ return { kind: 'account', appName };
65
+ }
66
+ if (service === domainEnvText) {
67
+ return { kind: 'bootstrap', appName, includeDomain: true };
68
+ }
69
+ if (service === bootstrapEnvText) {
70
+ return { kind: 'bootstrap', appName, includeDomain: false };
71
+ }
72
+ services.push(service);
73
+ } while (await promptYesNo('Do you want to deploy another service?'));
74
+ services = [...new Set(services)];
75
+ const stacks = (await promptSelect('Stacks to deploy', ['all', 'inf', 'api', 'web', 'views']));
76
+ return { kind: 'services', appName, services, stacks };
77
+ };
78
+ // The question flow for `qpq teardown`: pick services, then type the deploy
79
+ // target back to confirm — destroying inf stacks takes user data (key value
80
+ // stores, user directories) with it, so a y/n prompt isn't enough friction.
81
+ export const promptTeardownPlan = async (appName) => {
82
+ const deployInfo = getDeployTargetLabel();
83
+ let services = [];
84
+ do {
85
+ const allServices = getServiceNames(appName);
86
+ const allText = '[ all ]';
87
+ const service = await promptSelect('Select services to tear down', [allText, ...allServices]);
88
+ if (service === allText) {
89
+ services = allServices;
90
+ break;
91
+ }
92
+ services.push(service);
93
+ } while (await promptYesNo('Do you want to tear down another service?'));
94
+ services = [...new Set(services)];
95
+ console.log(`\nThis will DESTROY the web, api and inf stacks (including all stored data) for: ${services.join(', ')}`);
96
+ const confirmation = await promptText(`Type '${deployInfo}' to confirm`);
97
+ if (confirmation !== deployInfo) {
98
+ console.log('Confirmation did not match. Exiting!');
99
+ return { kind: 'cancelled' };
100
+ }
101
+ return { kind: 'services', appName, services };
102
+ };
103
+ //# sourceMappingURL=deployPrompts.js.map