@catladder/cli 3.47.1 → 4.0.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 (481) hide show
  1. package/README.md +23 -5
  2. package/dist/bundles/catenv/index.js +3 -3
  3. package/dist/bundles/cli/index.js +34 -30
  4. package/dist/cli/src/adapters/baseContext.d.ts +22 -0
  5. package/dist/cli/src/adapters/baseContext.js +40 -0
  6. package/dist/cli/src/adapters/baseContext.js.map +1 -0
  7. package/dist/cli/src/adapters/programmatic.d.ts +26 -0
  8. package/dist/cli/src/adapters/programmatic.js +67 -0
  9. package/dist/cli/src/adapters/programmatic.js.map +1 -0
  10. package/dist/cli/src/adapters/terminal.d.ts +28 -0
  11. package/dist/cli/src/adapters/terminal.js +201 -0
  12. package/dist/cli/src/adapters/terminal.js.map +1 -0
  13. package/dist/cli/src/apps/catenv/catenv.d.ts +1 -0
  14. package/dist/cli/src/apps/catenv/catenv.js +1 -1
  15. package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
  16. package/dist/cli/src/apps/catenv/printVariables.js +0 -10
  17. package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
  18. package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -5
  19. package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js +6 -21
  20. package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
  21. package/dist/cli/src/apps/cli/commands/project/setup/index.d.ts +2 -2
  22. package/dist/cli/src/apps/cli/commands/project/setup/index.js.map +1 -1
  23. package/dist/cli/src/apps/cli/commands/project/setup/logSection.d.ts +2 -2
  24. package/dist/cli/src/apps/cli/commands/project/setup/logSection.js.map +1 -1
  25. package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -2
  26. package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
  27. package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.d.ts +2 -2
  28. package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.js.map +1 -1
  29. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.d.ts +2 -2
  30. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  31. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
  32. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  33. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
  34. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  35. package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.d.ts +2 -2
  36. package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js.map +1 -1
  37. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.d.ts +9 -1
  38. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +15 -14
  39. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
  40. package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.d.ts +2 -1
  41. package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js +4 -6
  42. package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -1
  43. package/dist/cli/src/catenv.js +14 -16
  44. package/dist/cli/src/catenv.js.map +1 -1
  45. package/dist/cli/src/cli.js +186 -2
  46. package/dist/cli/src/cli.js.map +1 -1
  47. package/dist/cli/src/commands/cloudSQL/commandRestoreDb.d.ts +46 -0
  48. package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js +111 -0
  49. package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js.map +1 -0
  50. package/dist/cli/src/commands/fun/commandDadjoke.d.ts +1 -0
  51. package/dist/cli/src/commands/fun/commandDadjoke.js +30 -0
  52. package/dist/cli/src/commands/fun/commandDadjoke.js.map +1 -0
  53. package/dist/cli/src/commands/fun/commandStarwars.d.ts +1 -0
  54. package/dist/cli/src/commands/fun/commandStarwars.js +19 -0
  55. package/dist/cli/src/commands/fun/commandStarwars.js.map +1 -0
  56. package/dist/cli/src/commands/general/commandKubeCurrentContext.d.ts +1 -0
  57. package/dist/cli/src/commands/general/commandKubeCurrentContext.js +17 -0
  58. package/dist/cli/src/commands/general/commandKubeCurrentContext.js.map +1 -0
  59. package/dist/cli/src/commands/general/commandKubeGetShell.d.ts +12 -0
  60. package/dist/cli/src/commands/general/commandKubeGetShell.js +36 -0
  61. package/dist/cli/src/commands/general/commandKubeGetShell.js.map +1 -0
  62. package/dist/cli/src/commands/general/commandKubeListNamespaces.d.ts +1 -0
  63. package/dist/cli/src/commands/general/commandKubeListNamespaces.js +20 -0
  64. package/dist/cli/src/commands/general/commandKubeListNamespaces.js.map +1 -0
  65. package/dist/cli/src/commands/general/commandKubeListPods.d.ts +7 -0
  66. package/dist/cli/src/commands/general/commandKubeListPods.js +26 -0
  67. package/dist/cli/src/commands/general/commandKubeListPods.js.map +1 -0
  68. package/dist/cli/src/commands/general/commandKubeListSecrets.d.ts +7 -0
  69. package/dist/cli/src/commands/general/commandKubeListSecrets.js +26 -0
  70. package/dist/cli/src/commands/general/commandKubeListSecrets.js.map +1 -0
  71. package/dist/cli/src/commands/general/commandKubePortForward.d.ts +20 -0
  72. package/dist/cli/src/commands/general/commandKubePortForward.js +46 -0
  73. package/dist/cli/src/commands/general/commandKubePortForward.js.map +1 -0
  74. package/dist/cli/src/commands/general/commandKubeStopPortforward.d.ts +7 -0
  75. package/dist/cli/src/commands/general/commandKubeStopPortforward.js +24 -0
  76. package/dist/cli/src/commands/general/commandKubeStopPortforward.js.map +1 -0
  77. package/dist/cli/src/commands/index.d.ts +37 -0
  78. package/dist/cli/src/commands/index.js +283 -0
  79. package/dist/cli/src/commands/index.js.map +1 -0
  80. package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.d.ts +16 -0
  81. package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.js +89 -0
  82. package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.js.map +1 -0
  83. package/dist/cli/src/commands/mongodb/commandMongoGetShell.d.ts +16 -0
  84. package/dist/cli/src/commands/mongodb/commandMongoGetShell.js +36 -0
  85. package/dist/cli/src/commands/mongodb/commandMongoGetShell.js.map +1 -0
  86. package/dist/cli/src/commands/mongodb/commandMongoPortForward.d.ts +21 -0
  87. package/dist/cli/src/commands/mongodb/commandMongoPortForward.js +65 -0
  88. package/dist/cli/src/commands/mongodb/commandMongoPortForward.js.map +1 -0
  89. package/dist/cli/src/commands/project/commandCloudSqlProxy.d.ts +13 -0
  90. package/dist/cli/src/commands/project/commandCloudSqlProxy.js +127 -0
  91. package/dist/cli/src/commands/project/commandCloudSqlProxy.js.map +1 -0
  92. package/dist/cli/src/commands/project/commandConfigSecrets.d.ts +9 -0
  93. package/dist/cli/src/commands/project/commandConfigSecrets.js +36 -0
  94. package/dist/cli/src/commands/project/commandConfigSecrets.js.map +1 -0
  95. package/dist/cli/src/commands/project/commandDeletePods.d.ts +13 -0
  96. package/dist/cli/src/commands/project/commandDeletePods.js +49 -0
  97. package/dist/cli/src/commands/project/commandDeletePods.js.map +1 -0
  98. package/dist/cli/src/commands/project/commandDeleteProject.d.ts +8 -0
  99. package/dist/cli/src/commands/project/commandDeleteProject.js +41 -0
  100. package/dist/cli/src/commands/project/commandDeleteProject.js.map +1 -0
  101. package/dist/cli/src/commands/project/commandEnvVars.d.ts +8 -0
  102. package/dist/cli/src/commands/project/commandEnvVars.js +32 -0
  103. package/dist/cli/src/commands/project/commandEnvVars.js.map +1 -0
  104. package/dist/cli/src/commands/project/commandGetMyTotalWorktime.d.ts +1 -0
  105. package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js +19 -0
  106. package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js.map +1 -0
  107. package/dist/cli/src/commands/project/commandGetShell.d.ts +13 -0
  108. package/dist/cli/src/commands/project/commandGetShell.js +41 -0
  109. package/dist/cli/src/commands/project/commandGetShell.js.map +1 -0
  110. package/dist/cli/src/commands/project/commandGitlabCi.d.ts +14 -0
  111. package/dist/cli/src/commands/project/commandGitlabCi.js +109 -0
  112. package/dist/cli/src/commands/project/commandGitlabCi.js.map +1 -0
  113. package/dist/cli/src/commands/project/commandListPods.d.ts +8 -0
  114. package/dist/cli/src/commands/project/commandListPods.js +31 -0
  115. package/dist/cli/src/commands/project/commandListPods.js.map +1 -0
  116. package/dist/cli/src/commands/project/commandNamespace.d.ts +8 -0
  117. package/dist/cli/src/commands/project/commandNamespace.js +26 -0
  118. package/dist/cli/src/commands/project/commandNamespace.js.map +1 -0
  119. package/dist/cli/src/commands/project/commandOpenEnv.d.ts +8 -0
  120. package/dist/cli/src/commands/project/commandOpenEnv.js +40 -0
  121. package/dist/cli/src/commands/project/commandOpenEnv.js.map +1 -0
  122. package/dist/cli/src/commands/project/commandOpenGit.d.ts +1 -0
  123. package/dist/cli/src/commands/project/commandOpenGit.js +17 -0
  124. package/dist/cli/src/commands/project/commandOpenGit.js.map +1 -0
  125. package/dist/cli/src/commands/project/commandOpenLogs.d.ts +8 -0
  126. package/dist/cli/src/commands/project/commandOpenLogs.js +32 -0
  127. package/dist/cli/src/commands/project/commandOpenLogs.js.map +1 -0
  128. package/dist/cli/src/commands/project/commandPauseProject.d.ts +8 -0
  129. package/dist/cli/src/commands/project/commandPauseProject.js +41 -0
  130. package/dist/cli/src/commands/project/commandPauseProject.js.map +1 -0
  131. package/dist/cli/src/commands/project/commandPortForward.d.ts +25 -0
  132. package/dist/cli/src/commands/project/commandPortForward.js +95 -0
  133. package/dist/cli/src/commands/project/commandPortForward.js.map +1 -0
  134. package/dist/cli/src/commands/project/commandProjectRestoreDb.d.ts +19 -0
  135. package/dist/cli/src/commands/project/commandProjectRestoreDb.js +159 -0
  136. package/dist/cli/src/commands/project/commandProjectRestoreDb.js.map +1 -0
  137. package/dist/cli/src/commands/project/commandRenewToken.d.ts +1 -0
  138. package/dist/cli/src/commands/project/commandRenewToken.js +17 -0
  139. package/dist/cli/src/commands/project/commandRenewToken.js.map +1 -0
  140. package/dist/cli/src/commands/project/commandSecretsClearBackups.d.ts +7 -0
  141. package/dist/cli/src/commands/project/commandSecretsClearBackups.js +24 -0
  142. package/dist/cli/src/commands/project/commandSecretsClearBackups.js.map +1 -0
  143. package/dist/cli/src/commands/project/commandSecurityEvaluate.d.ts +1 -0
  144. package/dist/cli/src/commands/project/commandSecurityEvaluate.js +26 -0
  145. package/dist/cli/src/commands/project/commandSecurityEvaluate.js.map +1 -0
  146. package/dist/cli/src/commands/project/commandSetup.d.ts +8 -0
  147. package/dist/cli/src/commands/project/commandSetup.js +25 -0
  148. package/dist/cli/src/commands/project/commandSetup.js.map +1 -0
  149. package/dist/cli/src/commands/project/commandTriggerCronjob.d.ts +25 -0
  150. package/dist/cli/src/commands/project/commandTriggerCronjob.js +95 -0
  151. package/dist/cli/src/commands/project/commandTriggerCronjob.js.map +1 -0
  152. package/dist/cli/src/commands/security/commandSecurityAuditCiJob.d.ts +27 -0
  153. package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js +83 -0
  154. package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js.map +1 -0
  155. package/dist/cli/src/commands/security/commandSecurityAuditCreate.d.ts +22 -0
  156. package/dist/cli/src/commands/security/commandSecurityAuditCreate.js +60 -0
  157. package/dist/cli/src/commands/security/commandSecurityAuditCreate.js.map +1 -0
  158. package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.d.ts +7 -0
  159. package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js +35 -0
  160. package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js.map +1 -0
  161. package/dist/cli/src/completion.d.ts +24 -0
  162. package/dist/cli/src/completion.js +240 -0
  163. package/dist/cli/src/completion.js.map +1 -0
  164. package/dist/cli/src/config/getProjectConfig.d.ts +4 -4
  165. package/dist/cli/src/config/getProjectConfig.js +8 -8
  166. package/dist/cli/src/config/getProjectConfig.js.map +1 -1
  167. package/dist/cli/src/core/defineCommand.d.ts +27 -0
  168. package/dist/cli/src/core/defineCommand.js +35 -0
  169. package/dist/cli/src/core/defineCommand.js.map +1 -0
  170. package/dist/cli/src/core/index.d.ts +5 -0
  171. package/dist/cli/src/core/index.js +52 -0
  172. package/dist/cli/src/core/index.js.map +1 -0
  173. package/dist/cli/src/core/registry.d.ts +5 -0
  174. package/dist/cli/src/core/registry.js +26 -0
  175. package/dist/cli/src/core/registry.js.map +1 -0
  176. package/dist/cli/src/core/runner.d.ts +19 -0
  177. package/dist/cli/src/core/runner.js +29 -0
  178. package/dist/cli/src/core/runner.js.map +1 -0
  179. package/dist/cli/src/core/types.d.ts +105 -0
  180. package/dist/cli/src/core/types.js +17 -0
  181. package/dist/cli/src/core/types.js.map +1 -0
  182. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.d.ts +2 -2
  183. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
  184. package/dist/cli/src/gcloud/openDashboard.d.ts +2 -2
  185. package/dist/cli/src/gcloud/openDashboard.js +1 -1
  186. package/dist/cli/src/gcloud/openDashboard.js.map +1 -1
  187. package/dist/cli/src/gcloud/serviceAccounts.d.ts +2 -2
  188. package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
  189. package/dist/cli/src/kubernetes/openKubernetesDashboards.d.ts +3 -3
  190. package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
  191. package/dist/cli/src/security/auditDocument.js.map +1 -0
  192. package/dist/cli/src/security/createSecurityAuditMergeRequest.js.map +1 -0
  193. package/dist/cli/src/security/evaluateSecurityAudit.js.map +1 -0
  194. package/dist/cli/src/utils/gitlab.d.ts +9 -9
  195. package/dist/cli/src/utils/gitlab.js +45 -54
  196. package/dist/cli/src/utils/gitlab.js.map +1 -1
  197. package/dist/cli/src/utils/log.d.ts +2 -2
  198. package/dist/pipeline/src/build/base/createBuildJobDefinition.js +1 -1
  199. package/dist/pipeline/src/build/base/createBuildJobDefinition.js.map +1 -1
  200. package/dist/pipeline/src/build/custom/buildJob.js +1 -1
  201. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  202. package/dist/pipeline/src/build/index.d.ts +2 -2
  203. package/dist/pipeline/src/build/index.js.map +1 -1
  204. package/dist/pipeline/src/build/node/buildJob.d.ts +3 -3
  205. package/dist/pipeline/src/build/node/buildJob.js +13 -12
  206. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  207. package/dist/pipeline/src/build/node/cache.d.ts +3 -3
  208. package/dist/pipeline/src/build/node/cache.js +12 -9
  209. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  210. package/dist/pipeline/src/build/node/index.d.ts +3 -3
  211. package/dist/pipeline/src/build/node/index.js +8 -6
  212. package/dist/pipeline/src/build/node/index.js.map +1 -1
  213. package/dist/pipeline/src/build/node/meteor.d.ts +1 -1
  214. package/dist/pipeline/src/build/node/meteor.js +9 -8
  215. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  216. package/dist/pipeline/src/build/node/testJob.d.ts +1 -1
  217. package/dist/pipeline/src/build/node/testJob.js +5 -5
  218. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  219. package/dist/pipeline/src/build/node/yarn.d.ts +2 -2
  220. package/dist/pipeline/src/build/node/yarn.js +10 -8
  221. package/dist/pipeline/src/build/node/yarn.js.map +1 -1
  222. package/dist/pipeline/src/build/types.d.ts +3 -3
  223. package/dist/pipeline/src/constants.js +1 -1
  224. package/dist/pipeline/src/context/createComponentContext.js +3 -3
  225. package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
  226. package/dist/pipeline/src/context/createWorkspaceContext.js +1 -1
  227. package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -1
  228. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
  229. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
  230. package/dist/pipeline/src/deploy/custom/deployJob.d.ts +1 -1
  231. package/dist/pipeline/src/deploy/custom/deployJob.js +2 -2
  232. package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
  233. package/dist/pipeline/src/deploy/index.d.ts +1 -1
  234. package/dist/pipeline/src/deploy/types/index.d.ts +2 -2
  235. package/dist/pipeline/src/pipeline/createAllJobs.js +4 -4
  236. package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
  237. package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +1 -1
  238. package/dist/pipeline/src/pipeline/createJobsForComponent.js +2 -3
  239. package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
  240. package/dist/pipeline/src/pipeline/createJobsForWorkspace.d.ts +1 -1
  241. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +2 -2
  242. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -1
  243. package/dist/pipeline/src/types/config.d.ts +3 -3
  244. package/dist/pipeline/src/types/context.d.ts +3 -3
  245. package/dist/tsconfig.tsbuildinfo +1 -1
  246. package/package.json +3 -4
  247. package/scripts/bundle +0 -2
  248. package/src/adapters/baseContext.ts +68 -0
  249. package/src/adapters/programmatic.ts +88 -0
  250. package/src/adapters/terminal.ts +202 -0
  251. package/src/apps/catenv/catenv.ts +4 -2
  252. package/src/apps/catenv/printVariables.ts +0 -8
  253. package/src/apps/cli/commands/project/commandConfigSecrets.ts +8 -33
  254. package/src/apps/cli/commands/project/setup/index.ts +2 -2
  255. package/src/apps/cli/commands/project/setup/logSection.ts +2 -2
  256. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +2 -2
  257. package/src/apps/cli/commands/project/setup/setupAgents.ts +11 -11
  258. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
  259. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -5
  260. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +2 -2
  261. package/src/apps/cli/commands/project/setup/setupTopic.ts +2 -2
  262. package/src/apps/cli/commands/project/utils/ensureCluster.ts +19 -12
  263. package/src/apps/cli/utils/getGoogleAuthUserNumber.ts +5 -4
  264. package/src/catenv.ts +24 -18
  265. package/src/cli.ts +213 -2
  266. package/src/commands/cloudSQL/commandRestoreDb.ts +105 -0
  267. package/src/commands/fun/commandDadjoke.ts +18 -0
  268. package/src/commands/fun/commandStarwars.ts +14 -0
  269. package/src/commands/general/commandKubeCurrentContext.ts +12 -0
  270. package/src/commands/general/commandKubeGetShell.ts +32 -0
  271. package/src/commands/general/commandKubeListNamespaces.ts +15 -0
  272. package/src/commands/general/commandKubeListPods.ts +21 -0
  273. package/src/commands/general/commandKubeListSecrets.ts +21 -0
  274. package/src/commands/general/commandKubePortForward.ts +35 -0
  275. package/src/commands/general/commandKubeStopPortforward.ts +15 -0
  276. package/src/commands/index.ts +51 -0
  277. package/src/commands/mongodb/commandMongoDestroyMember.ts +133 -0
  278. package/src/commands/mongodb/commandMongoGetShell.ts +36 -0
  279. package/src/commands/mongodb/commandMongoPortForward.ts +56 -0
  280. package/src/commands/project/commandCloudSqlProxy.ts +189 -0
  281. package/src/commands/project/commandConfigSecrets.ts +31 -0
  282. package/src/commands/project/commandDeletePods.ts +53 -0
  283. package/src/commands/project/commandDeleteProject.ts +33 -0
  284. package/src/commands/project/commandEnvVars.ts +24 -0
  285. package/src/commands/project/commandGetMyTotalWorktime.ts +14 -0
  286. package/src/commands/project/commandGetShell.ts +39 -0
  287. package/src/commands/project/commandGitlabCi.ts +122 -0
  288. package/src/commands/project/commandListPods.ts +30 -0
  289. package/src/commands/project/commandNamespace.ts +21 -0
  290. package/src/commands/project/commandOpenEnv.ts +27 -0
  291. package/src/commands/project/commandOpenGit.ts +12 -0
  292. package/src/commands/project/commandOpenLogs.ts +27 -0
  293. package/src/commands/project/commandPauseProject.ts +33 -0
  294. package/src/commands/project/commandPortForward.ts +74 -0
  295. package/src/commands/project/commandProjectRestoreDb.ts +201 -0
  296. package/src/commands/project/commandRenewToken.ts +12 -0
  297. package/src/commands/project/commandSecretsClearBackups.ts +19 -0
  298. package/src/commands/project/commandSecurityEvaluate.ts +22 -0
  299. package/src/commands/project/commandSetup.ts +21 -0
  300. package/src/commands/project/commandTriggerCronjob.ts +99 -0
  301. package/src/commands/security/commandSecurityAuditCiJob.ts +91 -0
  302. package/src/commands/security/commandSecurityAuditCreate.ts +58 -0
  303. package/src/commands/security/commandSecurityAuditEvaluate.ts +30 -0
  304. package/src/completion.ts +272 -0
  305. package/src/config/getProjectConfig.ts +9 -9
  306. package/src/core/defineCommand.ts +32 -0
  307. package/src/core/index.ts +23 -0
  308. package/src/core/registry.ts +22 -0
  309. package/src/core/runner.ts +31 -0
  310. package/src/core/types.ts +142 -0
  311. package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
  312. package/src/gcloud/openDashboard.ts +3 -3
  313. package/src/gcloud/serviceAccounts.ts +2 -2
  314. package/src/kubernetes/openKubernetesDashboards.ts +3 -3
  315. package/src/utils/gitlab.ts +46 -58
  316. package/src/utils/log.ts +2 -2
  317. package/bin/catci +0 -3
  318. package/bin/catci-dev +0 -3
  319. package/dist/bundles/catci/index.js +0 -41
  320. package/dist/cli/src/apps/catci/catci.d.ts +0 -1
  321. package/dist/cli/src/apps/catci/catci.js +0 -33
  322. package/dist/cli/src/apps/catci/catci.js.map +0 -1
  323. package/dist/cli/src/apps/catci/commands/security/auditDocument.js.map +0 -1
  324. package/dist/cli/src/apps/catci/commands/security/commands.d.ts +0 -2
  325. package/dist/cli/src/apps/catci/commands/security/commands.js +0 -118
  326. package/dist/cli/src/apps/catci/commands/security/commands.js.map +0 -1
  327. package/dist/cli/src/apps/catci/commands/security/createSecurityAuditMergeRequest.js.map +0 -1
  328. package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +0 -1
  329. package/dist/cli/src/apps/cli/cli.d.ts +0 -2
  330. package/dist/cli/src/apps/cli/cli.js +0 -38
  331. package/dist/cli/src/apps/cli/cli.js.map +0 -1
  332. package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +0 -3
  333. package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js +0 -130
  334. package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +0 -1
  335. package/dist/cli/src/apps/cli/commands/cloudSQL/index.d.ts +0 -3
  336. package/dist/cli/src/apps/cli/commands/cloudSQL/index.js +0 -14
  337. package/dist/cli/src/apps/cli/commands/cloudSQL/index.js.map +0 -1
  338. package/dist/cli/src/apps/cli/commands/general/index.d.ts +0 -4
  339. package/dist/cli/src/apps/cli/commands/general/index.js +0 -83
  340. package/dist/cli/src/apps/cli/commands/general/index.js.map +0 -1
  341. package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.d.ts +0 -3
  342. package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js +0 -13
  343. package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js.map +0 -1
  344. package/dist/cli/src/apps/cli/commands/general/portForward.d.ts +0 -3
  345. package/dist/cli/src/apps/cli/commands/general/portForward.js +0 -47
  346. package/dist/cli/src/apps/cli/commands/general/portForward.js.map +0 -1
  347. package/dist/cli/src/apps/cli/commands/mongodb/index.d.ts +0 -3
  348. package/dist/cli/src/apps/cli/commands/mongodb/index.js +0 -18
  349. package/dist/cli/src/apps/cli/commands/mongodb/index.js.map +0 -1
  350. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +0 -3
  351. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js +0 -96
  352. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +0 -1
  353. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +0 -3
  354. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js +0 -38
  355. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js.map +0 -1
  356. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +0 -3
  357. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js +0 -64
  358. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js.map +0 -1
  359. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.d.ts +0 -3
  360. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +0 -152
  361. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +0 -1
  362. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.d.ts +0 -3
  363. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +0 -120
  364. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +0 -1
  365. package/dist/cli/src/apps/cli/commands/project/commandDeletePods.d.ts +0 -3
  366. package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js +0 -54
  367. package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js.map +0 -1
  368. package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.d.ts +0 -3
  369. package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js +0 -33
  370. package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js.map +0 -1
  371. package/dist/cli/src/apps/cli/commands/project/commandEnvVars.d.ts +0 -3
  372. package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js +0 -17
  373. package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js.map +0 -1
  374. package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +0 -3
  375. package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js +0 -11
  376. package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +0 -1
  377. package/dist/cli/src/apps/cli/commands/project/commandGetShell.d.ts +0 -3
  378. package/dist/cli/src/apps/cli/commands/project/commandGetShell.js +0 -37
  379. package/dist/cli/src/apps/cli/commands/project/commandGetShell.js.map +0 -1
  380. package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.d.ts +0 -3
  381. package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js +0 -88
  382. package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js.map +0 -1
  383. package/dist/cli/src/apps/cli/commands/project/commandListPods.d.ts +0 -3
  384. package/dist/cli/src/apps/cli/commands/project/commandListPods.js +0 -22
  385. package/dist/cli/src/apps/cli/commands/project/commandListPods.js.map +0 -1
  386. package/dist/cli/src/apps/cli/commands/project/commandNamespace.d.ts +0 -3
  387. package/dist/cli/src/apps/cli/commands/project/commandNamespace.js +0 -12
  388. package/dist/cli/src/apps/cli/commands/project/commandNamespace.js.map +0 -1
  389. package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.d.ts +0 -3
  390. package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js +0 -26
  391. package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js.map +0 -1
  392. package/dist/cli/src/apps/cli/commands/project/commandOpenGit.d.ts +0 -3
  393. package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js +0 -9
  394. package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js.map +0 -1
  395. package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.d.ts +0 -3
  396. package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js +0 -18
  397. package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js.map +0 -1
  398. package/dist/cli/src/apps/cli/commands/project/commandPauseProject.d.ts +0 -3
  399. package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js +0 -33
  400. package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js.map +0 -1
  401. package/dist/cli/src/apps/cli/commands/project/commandPortForward.d.ts +0 -3
  402. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +0 -97
  403. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +0 -1
  404. package/dist/cli/src/apps/cli/commands/project/commandRenewToken.d.ts +0 -3
  405. package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js +0 -9
  406. package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js.map +0 -1
  407. package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.d.ts +0 -5
  408. package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js +0 -25
  409. package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js.map +0 -1
  410. package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.d.ts +0 -3
  411. package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js +0 -20
  412. package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js.map +0 -1
  413. package/dist/cli/src/apps/cli/commands/project/commandSetup.d.ts +0 -3
  414. package/dist/cli/src/apps/cli/commands/project/commandSetup.js +0 -12
  415. package/dist/cli/src/apps/cli/commands/project/commandSetup.js.map +0 -1
  416. package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.d.ts +0 -3
  417. package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js +0 -63
  418. package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js.map +0 -1
  419. package/dist/cli/src/apps/cli/commands/project/index.d.ts +0 -3
  420. package/dist/cli/src/apps/cli/commands/project/index.js +0 -54
  421. package/dist/cli/src/apps/cli/commands/project/index.js.map +0 -1
  422. package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.d.ts +0 -2
  423. package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js +0 -16
  424. package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js.map +0 -1
  425. package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +0 -3
  426. package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js +0 -37
  427. package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js.map +0 -1
  428. package/dist/cli/src/apps/cli/verify/index.d.ts +0 -2
  429. package/dist/cli/src/apps/cli/verify/index.js +0 -17
  430. package/dist/cli/src/apps/cli/verify/index.js.map +0 -1
  431. package/dist/cli/src/catci.d.ts +0 -1
  432. package/dist/cli/src/catci.js +0 -7
  433. package/dist/cli/src/catci.js.map +0 -1
  434. package/src/apps/catci/catci.ts +0 -26
  435. package/src/apps/catci/commands/security/commands.ts +0 -161
  436. package/src/apps/cli/cli.ts +0 -43
  437. package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +0 -136
  438. package/src/apps/cli/commands/cloudSQL/index.ts +0 -7
  439. package/src/apps/cli/commands/general/index.ts +0 -90
  440. package/src/apps/cli/commands/general/namespaceAutoCompletion.ts +0 -7
  441. package/src/apps/cli/commands/general/portForward.ts +0 -48
  442. package/src/apps/cli/commands/mongodb/index.ts +0 -10
  443. package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +0 -132
  444. package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +0 -42
  445. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +0 -64
  446. package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +0 -206
  447. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +0 -194
  448. package/src/apps/cli/commands/project/commandDeletePods.ts +0 -48
  449. package/src/apps/cli/commands/project/commandDeleteProject.ts +0 -33
  450. package/src/apps/cli/commands/project/commandEnvVars.ts +0 -18
  451. package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +0 -14
  452. package/src/apps/cli/commands/project/commandGetShell.ts +0 -36
  453. package/src/apps/cli/commands/project/commandGitlabCi.ts +0 -115
  454. package/src/apps/cli/commands/project/commandListPods.ts +0 -20
  455. package/src/apps/cli/commands/project/commandNamespace.ts +0 -14
  456. package/src/apps/cli/commands/project/commandOpenEnv.ts +0 -22
  457. package/src/apps/cli/commands/project/commandOpenGit.ts +0 -12
  458. package/src/apps/cli/commands/project/commandOpenLogs.ts +0 -21
  459. package/src/apps/cli/commands/project/commandPauseProject.ts +0 -33
  460. package/src/apps/cli/commands/project/commandPortForward.ts +0 -91
  461. package/src/apps/cli/commands/project/commandRenewToken.ts +0 -12
  462. package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +0 -26
  463. package/src/apps/cli/commands/project/commandSecurityEvaluate.ts +0 -26
  464. package/src/apps/cli/commands/project/commandSetup.ts +0 -14
  465. package/src/apps/cli/commands/project/commandTriggerCronjob.ts +0 -62
  466. package/src/apps/cli/commands/project/index.ts +0 -56
  467. package/src/apps/cli/commands/project/utils/showProjectBanner.ts +0 -11
  468. package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +0 -32
  469. package/src/apps/cli/verify/index.ts +0 -14
  470. package/src/catci.ts +0 -3
  471. /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.d.ts +0 -0
  472. /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.js +0 -0
  473. /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.d.ts +0 -0
  474. /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.js +0 -0
  475. /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.d.ts +0 -0
  476. /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.js +0 -0
  477. /package/dist/cli/src/{apps/catci/commands/security → security}/topics.json +0 -0
  478. /package/src/{apps/catci/commands/security → security}/auditDocument.ts +0 -0
  479. /package/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.ts +0 -0
  480. /package/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.ts +0 -0
  481. /package/src/{apps/catci/commands/security → security}/topics.json +0 -0
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.47.1",
56
+ "version": "4.0.0",
57
57
  "scripts": {
58
58
  "lint": "eslint \"src/**/*.ts\"",
59
59
  "lint:fix": "eslint \"src/**/*.ts\" --fix",
@@ -66,7 +66,6 @@
66
66
  "build:watch": "tsc-watch --onSuccess \"yarn dev:own-catenv\""
67
67
  },
68
68
  "bin": {
69
- "catci": "./bin/catci",
70
69
  "catenv": "./bin/catenv",
71
70
  "catladder": "./bin/catladder"
72
71
  },
@@ -80,6 +79,7 @@
80
79
  "@babel/core": "^7.29.0",
81
80
  "@babel/plugin-syntax-typescript": "^7.28.6",
82
81
  "@gitbeaker/rest": "^39.28.0",
82
+ "@inquirer/prompts": "^8.4.3",
83
83
  "@kubernetes/client-node": "^0.16.2",
84
84
  "@tsconfig/node14": "^1.0.1",
85
85
  "@types/common-tags": "^1.8.4",
@@ -90,13 +90,13 @@
90
90
  "@types/request": "^2.48.12",
91
91
  "@types/tmp": "^0.2.3",
92
92
  "@types/update-notifier": "^2.5.0",
93
- "@types/vorpal": "^1.12.0",
94
93
  "@types/websocket": "^0.0.40",
95
94
  "@types/yargs": "^17.0.33",
96
95
  "babel-plugin-transform-inline-environment-variables": "^0.4.4",
97
96
  "child-process-promise": "^2.2.1",
98
97
  "clipboardy": "^2.0.0",
99
98
  "command-exists-promise": "^2.0.2",
99
+ "commander": "^14.0.3",
100
100
  "common-tags": "^1.8.2",
101
101
  "connection-string-parser": "^1.0.4",
102
102
  "date-fns": "^3.6.0",
@@ -111,7 +111,6 @@
111
111
  "tsc-alias": "^1.8.16",
112
112
  "tsc-watch": "^7.2.0",
113
113
  "typescript": "^5.4.5",
114
- "vorpal": "^1.12.0",
115
114
  "yaml": "^2.5.0"
116
115
  },
117
116
  "dependencies": {
package/scripts/bundle CHANGED
@@ -2,5 +2,3 @@
2
2
  ncc build dist/cli/src/catenv.js -o dist/bundles/catenv -e 'tsx/cjs/api' $( ((SHOULD_MINIFY == 1)) && printf %s '-m')
3
3
 
4
4
  ncc build dist/cli/src/cli.js -o dist/bundles/cli -e 'tsx/cjs/api' $( ((SHOULD_MINIFY == 1)) && printf %s '-m')
5
-
6
- ncc build dist/cli/src/catci.js -o dist/bundles/catci -e 'tsx/cjs/api' $( ((SHOULD_MINIFY == 1)) && printf %s '-m')
@@ -0,0 +1,68 @@
1
+ import type {
2
+ CommandContext,
3
+ CommandDef,
4
+ InputDef,
5
+ InputResultType,
6
+ InputsSchema,
7
+ OptionalInput,
8
+ } from "../core/types";
9
+
10
+ /**
11
+ * Base class for CommandContext implementations.
12
+ * Handles caching, the `get()` method, and `promptDirect` delegation.
13
+ * Subclasses only implement the adapter-specific resolution logic.
14
+ */
15
+ export abstract class BaseContext<TInputs extends InputsSchema>
16
+ implements CommandContext<TInputs>
17
+ {
18
+ private cache = new Map<string, Promise<any>>();
19
+
20
+ constructor(protected readonly command: CommandDef<TInputs>) {}
21
+
22
+ abstract log(message: string): void;
23
+ abstract confirm(message: string): Promise<boolean>;
24
+
25
+ /**
26
+ * Resolve a single input value. Called once per input (result is cached).
27
+ * Implementations check pre-supplied values, prompt interactively, use defaults, or throw.
28
+ */
29
+ protected abstract resolveInput<P extends InputDef>(
30
+ name: string,
31
+ spec: P,
32
+ ): Promise<InputResultType<P>>;
33
+
34
+ get<K extends keyof TInputs & string>(
35
+ name: K,
36
+ ): Promise<OptionalInput<TInputs[K]>> {
37
+ if (!this.cache.has(name)) {
38
+ const spec = this.command.inputs[name];
39
+ if (!spec) {
40
+ return Promise.reject(
41
+ new Error(
42
+ `Input "${name}" is not declared in command "${this.command.name}"`,
43
+ ),
44
+ );
45
+ }
46
+ // For optional inputs (required: false), catch MissingInputError
47
+ // and return undefined instead of prompting
48
+ if (spec.required === false) {
49
+ this.cache.set(
50
+ name,
51
+ this.resolveInput(name, spec).catch((err) => {
52
+ if (err?.name === "MissingInputError") return undefined;
53
+ throw err;
54
+ }),
55
+ );
56
+ } else {
57
+ this.cache.set(name, this.resolveInput(name, spec));
58
+ }
59
+ }
60
+ return this.cache.get(name)!;
61
+ }
62
+
63
+ async promptDirect<P extends InputDef>(
64
+ spec: P & { name: string },
65
+ ): Promise<InputResultType<P>> {
66
+ return this.resolveInput(spec.name, spec);
67
+ }
68
+ }
@@ -0,0 +1,88 @@
1
+ import type {
2
+ CommandDef,
3
+ IO,
4
+ InputDef,
5
+ InputResultType,
6
+ InputsSchema,
7
+ } from "../core/types";
8
+ import { MissingInputError } from "../core/types";
9
+ import { BaseContext } from "./baseContext";
10
+
11
+ export interface ProgrammaticOptions {
12
+ /** Pre-supplied values keyed by input name */
13
+ inputs?: Record<string, unknown>;
14
+ /** Called on every log message. Defaults to no-op. */
15
+ onLog?: (message: string) => void;
16
+ }
17
+
18
+ class ProgrammaticContext<
19
+ TInputs extends InputsSchema,
20
+ > extends BaseContext<TInputs> {
21
+ private inputs: Record<string, unknown>;
22
+ private onLog?: (message: string) => void;
23
+
24
+ constructor(command: CommandDef<TInputs>, options: ProgrammaticOptions) {
25
+ super(command);
26
+ this.inputs = options.inputs ?? {};
27
+ this.onLog = options.onLog;
28
+ }
29
+
30
+ log(message: string): void {
31
+ this.onLog?.(message);
32
+ }
33
+
34
+ async confirm(): Promise<boolean> {
35
+ return true; // programmatic mode always confirms
36
+ }
37
+
38
+ protected async resolveInput<P extends InputDef>(
39
+ name: string,
40
+ spec: P,
41
+ ): Promise<InputResultType<P>> {
42
+ if (name in this.inputs && this.inputs[name] !== undefined) {
43
+ return this.inputs[name] as InputResultType<P>;
44
+ }
45
+ if ("default" in spec && spec.default !== undefined) {
46
+ return spec.default as InputResultType<P>;
47
+ }
48
+ throw new MissingInputError(name, spec.message);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Create a CommandContext that resolves inputs from pre-supplied values.
54
+ * Used for non-interactive CLI mode and programmatic invocation.
55
+ */
56
+ export function createProgrammaticContext<TInputs extends InputsSchema>(
57
+ command: CommandDef<TInputs>,
58
+ options: ProgrammaticOptions = {},
59
+ ): ProgrammaticContext<TInputs> {
60
+ return new ProgrammaticContext(command, options);
61
+ }
62
+
63
+ /**
64
+ * Create a bare IO instance for helper functions that only need log + promptDirect.
65
+ */
66
+ export function createProgrammaticIO(options: ProgrammaticOptions = {}): IO {
67
+ const { inputs = {}, onLog } = options;
68
+
69
+ return {
70
+ log(message: string): void {
71
+ onLog?.(message);
72
+ },
73
+ async confirm(): Promise<boolean> {
74
+ return true;
75
+ },
76
+ async promptDirect<P extends InputDef>(
77
+ spec: P & { name: string },
78
+ ): Promise<InputResultType<P>> {
79
+ if (spec.name in inputs && inputs[spec.name] !== undefined) {
80
+ return inputs[spec.name] as InputResultType<P>;
81
+ }
82
+ if ("default" in spec && spec.default !== undefined) {
83
+ return spec.default as InputResultType<P>;
84
+ }
85
+ throw new MissingInputError(spec.name, spec.message);
86
+ },
87
+ };
88
+ }
@@ -0,0 +1,202 @@
1
+ import type {
2
+ CommandDef,
3
+ IO,
4
+ InputDef,
5
+ InputResultType,
6
+ InputsSchema,
7
+ PromptChoice,
8
+ } from "../core/types";
9
+ import { MissingInputError } from "../core/types";
10
+ import { BaseContext } from "./baseContext";
11
+
12
+ /**
13
+ * Resolve choices from a choices function.
14
+ */
15
+ async function resolveChoices(
16
+ choices: (ctx: any) => PromptChoice[] | Promise<PromptChoice[]>,
17
+ ctx: any,
18
+ ): Promise<{ name: string; value: string }[]> {
19
+ const raw = await choices(ctx);
20
+ return raw.map((c) => (typeof c === "string" ? { name: c, value: c } : c));
21
+ }
22
+
23
+ /**
24
+ * Prompt the user interactively using @inquirer/prompts.
25
+ * The UI is determined by the value type + presence of choices.
26
+ */
27
+ async function promptInteractive<P extends InputDef>(
28
+ spec: P & { name: string },
29
+ ctx: any,
30
+ ): Promise<InputResultType<P>> {
31
+ const inquirer = await import("@inquirer/prompts");
32
+
33
+ switch (spec.type) {
34
+ case "string": {
35
+ if (spec.choices) {
36
+ const choices = await resolveChoices(spec.choices, ctx);
37
+ return inquirer.select({
38
+ message: spec.message,
39
+ choices,
40
+ }) as Promise<InputResultType<P>>;
41
+ }
42
+ return inquirer.input({
43
+ message: spec.message,
44
+ default: spec.default,
45
+ }) as Promise<InputResultType<P>>;
46
+ }
47
+ case "string[]": {
48
+ if (spec.choices) {
49
+ const choices = await resolveChoices(spec.choices, ctx);
50
+ return inquirer.checkbox({
51
+ message: spec.message,
52
+ choices,
53
+ }) as Promise<InputResultType<P>>;
54
+ }
55
+ const raw = await inquirer.input({ message: spec.message });
56
+ return (
57
+ raw ? raw.split(",").map((s: string) => s.trim()) : []
58
+ ) as InputResultType<P>;
59
+ }
60
+ case "number":
61
+ return inquirer.number({
62
+ message: spec.message,
63
+ default: spec.default,
64
+ }) as Promise<InputResultType<P>>;
65
+ case "boolean":
66
+ return inquirer.confirm({
67
+ message: spec.message,
68
+ default: spec.default,
69
+ }) as Promise<InputResultType<P>>;
70
+ default:
71
+ throw new Error(`Unsupported input type: ${(spec as InputDef).type}`);
72
+ }
73
+ }
74
+
75
+ export interface TerminalOptions {
76
+ /** Pre-supplied values from CLI flags/positional args, keyed by input name */
77
+ cliOptions?: Record<string, unknown>;
78
+ /** Pre-supplied values from --inputs JSON flag */
79
+ jsonInputs?: Record<string, unknown>;
80
+ /** Whether interactive prompts are allowed (default: auto-detect from TTY) */
81
+ interactive?: boolean;
82
+ /** If true, all confirm() calls return true without prompting (--yes flag) */
83
+ yes?: boolean;
84
+ }
85
+
86
+ class TerminalContext<
87
+ TInputs extends InputsSchema,
88
+ > extends BaseContext<TInputs> {
89
+ constructor(
90
+ command: CommandDef<TInputs>,
91
+ private options: TerminalOptions,
92
+ ) {
93
+ super(command);
94
+ }
95
+
96
+ log(message: string): void {
97
+ console.log(message);
98
+ }
99
+
100
+ async confirm(message: string): Promise<boolean> {
101
+ if (this.options.yes) return true;
102
+ const isInteractive =
103
+ this.options.interactive ?? process.stdin.isTTY === true;
104
+ if (!isInteractive) return true;
105
+ const inquirer = await import("@inquirer/prompts");
106
+ return inquirer.confirm({ message });
107
+ }
108
+
109
+ protected async resolveInput<P extends InputDef>(
110
+ name: string,
111
+ spec: P,
112
+ ): Promise<InputResultType<P>> {
113
+ const { cliOptions = {}, jsonInputs = {}, interactive } = this.options;
114
+ const isInteractive = interactive ?? process.stdin.isTTY === true;
115
+
116
+ // Helper: validate a pre-supplied value against choices if they exist
117
+ const validateAgainstChoices = async (value: unknown): Promise<void> => {
118
+ if (!("choices" in spec) || !spec.choices) return;
119
+ const choices = await resolveChoices(spec.choices, this);
120
+ const validValues = choices.map((c) => c.value);
121
+ if (Array.isArray(value)) {
122
+ const invalid = (value as string[]).filter(
123
+ (v) => !validValues.includes(v),
124
+ );
125
+ if (invalid.length > 0) {
126
+ throw new Error(
127
+ `Invalid value(s) for "${name}": ${invalid.join(", ")}. Valid choices: ${validValues.join(", ")}`,
128
+ );
129
+ }
130
+ } else if (!validValues.includes(value as string)) {
131
+ throw new Error(
132
+ `Invalid value for "${name}": "${value}". Valid choices: ${validValues.join(", ")}`,
133
+ );
134
+ }
135
+ };
136
+
137
+ // 1. CLI flag or positional arg
138
+ if (name in cliOptions && cliOptions[name] !== undefined) {
139
+ await validateAgainstChoices(cliOptions[name]);
140
+ return cliOptions[name] as InputResultType<P>;
141
+ }
142
+
143
+ // 2. JSON inputs
144
+ if (name in jsonInputs && jsonInputs[name] !== undefined) {
145
+ await validateAgainstChoices(jsonInputs[name]);
146
+ return jsonInputs[name] as InputResultType<P>;
147
+ }
148
+
149
+ // 3. Interactive prompt
150
+ if (isInteractive) {
151
+ return promptInteractive({ ...spec, name }, this);
152
+ }
153
+
154
+ // 4. Default
155
+ if ("default" in spec && spec.default !== undefined) {
156
+ return spec.default as InputResultType<P>;
157
+ }
158
+
159
+ // 5. Throw
160
+ throw new MissingInputError(name, spec.message);
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Create a CommandContext for terminal usage.
166
+ */
167
+ export function createTerminalContext<TInputs extends InputsSchema>(
168
+ command: CommandDef<TInputs>,
169
+ options: TerminalOptions = {},
170
+ ): TerminalContext<TInputs> {
171
+ return new TerminalContext(command, options);
172
+ }
173
+
174
+ /**
175
+ * Create a bare IO instance for terminal helper functions.
176
+ */
177
+ export function createTerminalIO(options: TerminalOptions = {}): IO {
178
+ return {
179
+ log(message: string): void {
180
+ console.log(message);
181
+ },
182
+ async confirm(message: string): Promise<boolean> {
183
+ if (options.yes) return true;
184
+ const isInteractive = options.interactive ?? process.stdin.isTTY === true;
185
+ if (!isInteractive) return true;
186
+ const inquirer = await import("@inquirer/prompts");
187
+ return inquirer.confirm({ message });
188
+ },
189
+ async promptDirect<P extends InputDef>(
190
+ spec: P & { name: string },
191
+ ): Promise<InputResultType<P>> {
192
+ const isInteractive = options.interactive ?? process.stdin.isTTY === true;
193
+ if (isInteractive) {
194
+ return promptInteractive(spec, null);
195
+ }
196
+ if ("default" in spec && spec.default !== undefined) {
197
+ return spec.default as InputResultType<P>;
198
+ }
199
+ throw new MissingInputError(spec.name, spec.message);
200
+ },
201
+ };
202
+ }
@@ -11,6 +11,7 @@ import {
11
11
 
12
12
  type Options = {
13
13
  verbose?: boolean;
14
+ printVariables?: boolean;
14
15
  };
15
16
  export default async (choice?: Choice, options?: Options) => {
16
17
  const config = await getProjectConfig();
@@ -28,7 +29,8 @@ export default async (choice?: Choice, options?: Options) => {
28
29
  writeDotEnvFiles(context, choice),
29
30
 
30
31
  writeDTsFiles(context, choice),
31
-
32
- printVariables(context, choice),
32
+ options?.printVariables
33
+ ? printVariables(context, choice)
34
+ : Promise.resolve(),
33
35
  ]);
34
36
  };
@@ -14,10 +14,6 @@ const getAllVariablesToPrint = async (config: Config, choice?: Choice) => {
14
14
  );
15
15
 
16
16
  if (currentComponent) {
17
- // don't print vars if dotenv is enabled
18
- if (config.components[currentComponent].dotEnv ?? true) {
19
- return {};
20
- }
21
17
  return await getEnvVarsResolved(null, env, currentComponent);
22
18
  } else {
23
19
  // when in a monorep and not in a subapp, merge all env vars.
@@ -25,10 +21,6 @@ const getAllVariablesToPrint = async (config: Config, choice?: Choice) => {
25
21
  // so we also add prefixed variants
26
22
  return await Object.keys(config.components).reduce(
27
23
  async (acc, componentName) => {
28
- // don't print vars if dotenv is enabled
29
- if (config.components[componentName].dotEnv ?? true) {
30
- return await acc;
31
- }
32
24
  const subappvars = await getEnvVarsResolved(null, env, componentName);
33
25
  delete subappvars["_ALL_ENV_VAR_KEYS"];
34
26
  return {
@@ -1,8 +1,7 @@
1
1
  import { getSecretVarName } from "@catladder/pipeline";
2
2
  import { stripIndents } from "common-tags";
3
3
  import { difference } from "lodash";
4
- import type { CommandInstance } from "vorpal";
5
- import type Vorpal from "vorpal";
4
+ import type { IO } from "../../../../core/types";
6
5
  import {
7
6
  getAllComponentsWithAllEnvsHierarchical,
8
7
  getEnvironment,
@@ -14,7 +13,6 @@ import {
14
13
  import { editAsFile } from "../../../../utils/editAsFile";
15
14
  import { upsertAllVariables } from "../../../../utils/gitlab";
16
15
  import { delay } from "../../../../utils/promise";
17
- import { allEnvsAndAllComponents } from "./utils/autocompletions";
18
16
 
19
17
  type Vars = {
20
18
  [env: string]: {
@@ -62,7 +60,7 @@ const getSecretEnvVarKeysToConfigure = async (
62
60
  .map((k) => k.key);
63
61
  };
64
62
  const getEnvVarsToEdit = async (
65
- instance: CommandInstance,
63
+ instance: IO,
66
64
  env: string,
67
65
  componentName: string,
68
66
  ) => {
@@ -92,7 +90,7 @@ const getEnvVarsToEdit = async (
92
90
  );
93
91
  };
94
92
  const doItFor = async (
95
- instance: CommandInstance,
93
+ instance: IO,
96
94
  envAndComponents: {
97
95
  [componentName: string]: string[];
98
96
  },
@@ -161,12 +159,7 @@ const doItFor = async (
161
159
  }
162
160
 
163
161
  await delay(1000);
164
- const { shouldContinue } = await instance.prompt({
165
- default: true,
166
- message: "Try again? 🤔",
167
- name: "shouldContinue",
168
- type: "confirm",
169
- });
162
+ const shouldContinue = await instance.confirm("Try again? 🤔");
170
163
 
171
164
  if (!shouldContinue) {
172
165
  throw new Error("abort");
@@ -197,40 +190,22 @@ const doItFor = async (
197
190
  instance.log("");
198
191
  };
199
192
 
200
- export const projectConfigSecrets = async (
201
- vorpal: CommandInstance,
202
- envComponent?: string,
203
- ) => {
193
+ export const projectConfigSecrets = async (io: IO, envComponent?: string) => {
204
194
  if (!envComponent) {
205
195
  const allEnvAndcomponents = await getAllComponentsWithAllEnvsHierarchical();
206
- await doItFor(vorpal, allEnvAndcomponents);
196
+ await doItFor(io, allEnvAndcomponents);
207
197
  } else {
208
198
  const { env, componentName } = parseChoice(envComponent);
209
199
 
210
200
  // componentName can be null. in this case, iterate over all components
211
201
  if (!componentName) {
212
202
  const components = await getProjectComponents();
213
- await doItFor(
214
- vorpal,
215
- Object.fromEntries(components.map((c) => [c, [env]])),
216
- );
203
+ await doItFor(io, Object.fromEntries(components.map((c) => [c, [env]])));
217
204
  }
218
205
  if (componentName) {
219
- await doItFor(vorpal, {
206
+ await doItFor(io, {
220
207
  [componentName]: [env],
221
208
  });
222
209
  }
223
210
  }
224
211
  };
225
-
226
- export default async (vorpal: Vorpal) => {
227
- vorpal
228
- .command(
229
- "project-config-secrets [envComponent]",
230
- "setup/update secrets stored in pass",
231
- )
232
- .autocomplete(await allEnvsAndAllComponents())
233
- .action(async function ({ envComponent }) {
234
- return await projectConfigSecrets(this, envComponent);
235
- });
236
- };
@@ -1,4 +1,4 @@
1
- import type { CommandInstance } from "vorpal";
1
+ import type { IO } from "../../../../../core/types";
2
2
  import { getAllPipelineContexts } from "../../../../../config/getProjectConfig";
3
3
  import { setupAccessTokens } from "./setupAccessTokens";
4
4
  import { setupContext } from "./setupContext";
@@ -7,7 +7,7 @@ import { setupAgents } from "./setupAgents";
7
7
  import { logSection } from "./logSection";
8
8
 
9
9
  export const setupProject = async (
10
- instance: CommandInstance,
10
+ instance: IO,
11
11
  onlyComponents?: string | string[],
12
12
  ) => {
13
13
  const allContext = await getAllPipelineContexts(onlyComponents);
@@ -1,7 +1,7 @@
1
- import type { CommandInstance } from "vorpal";
1
+ import type { IO } from "../../../../../core/types";
2
2
 
3
3
  export const logSection = async (
4
- instance: CommandInstance,
4
+ instance: IO,
5
5
  title: string,
6
6
  work: () => Promise<void>,
7
7
  ) => {
@@ -1,10 +1,10 @@
1
- import type { CommandInstance } from "vorpal";
1
+ import type { IO } from "../../../../../core/types";
2
2
  import { add, format } from "date-fns";
3
3
  import { doGitlabRequest, getProjectInfo } from "../../../../../utils/gitlab";
4
4
 
5
5
  const TOKEN_NAME = "semantic-release";
6
6
 
7
- export const setupAccessTokens = async (instance: CommandInstance) => {
7
+ export const setupAccessTokens = async (instance: IO) => {
8
8
  const { id: projectId } = await getProjectInfo(instance);
9
9
 
10
10
  const projectTokens = await doGitlabRequest(
@@ -1,4 +1,4 @@
1
- import type { CommandInstance } from "vorpal";
1
+ import type { IO } from "../../../../../core/types";
2
2
  import { doGitlabRequest, getProjectInfo } from "../../../../../utils/gitlab";
3
3
  import { getProjectConfig } from "../../../../../config/getProjectConfig";
4
4
  import { getGitRemoteHostAndPath } from "../../../../../git/gitProjectInformation";
@@ -60,14 +60,14 @@ type WebhookData = {
60
60
  };
61
61
 
62
62
  const listTriggerTokens = async (
63
- instance: CommandInstance,
63
+ instance: IO,
64
64
  projectId: string,
65
65
  ): Promise<TriggerToken[]> => {
66
66
  return await doGitlabRequest(instance, `projects/${projectId}/triggers`);
67
67
  };
68
68
 
69
69
  const deleteTriggerToken = async (
70
- instance: CommandInstance,
70
+ instance: IO,
71
71
  projectId: string,
72
72
  triggerId: number,
73
73
  ): Promise<void> => {
@@ -80,7 +80,7 @@ const deleteTriggerToken = async (
80
80
  };
81
81
 
82
82
  const createTriggerToken = async (
83
- instance: CommandInstance,
83
+ instance: IO,
84
84
  projectId: string,
85
85
  description: string,
86
86
  ): Promise<TriggerToken> => {
@@ -93,14 +93,14 @@ const createTriggerToken = async (
93
93
  };
94
94
 
95
95
  const listWebhooks = async (
96
- instance: CommandInstance,
96
+ instance: IO,
97
97
  projectId: string,
98
98
  ): Promise<Webhook[]> => {
99
99
  return await doGitlabRequest(instance, `projects/${projectId}/hooks`);
100
100
  };
101
101
 
102
102
  const createWebhook = async (
103
- instance: CommandInstance,
103
+ instance: IO,
104
104
  projectId: string,
105
105
  webhookData: WebhookData,
106
106
  ): Promise<Webhook> => {
@@ -113,7 +113,7 @@ const createWebhook = async (
113
113
  };
114
114
 
115
115
  const updateWebhook = async (
116
- instance: CommandInstance,
116
+ instance: IO,
117
117
  projectId: string,
118
118
  hookId: number,
119
119
  webhookData: WebhookData,
@@ -127,7 +127,7 @@ const updateWebhook = async (
127
127
  };
128
128
 
129
129
  const setupAgentWebhook = async (
130
- instance: CommandInstance,
130
+ instance: IO,
131
131
  projectId: string,
132
132
  agentName: string,
133
133
  triggerToken: string,
@@ -231,7 +231,7 @@ const setupAgentWebhook = async (
231
231
  };
232
232
 
233
233
  const setupAgentTriggerToken = async (
234
- instance: CommandInstance,
234
+ instance: IO,
235
235
  projectId: string,
236
236
  agentName: string,
237
237
  ): Promise<TriggerToken> => {
@@ -266,7 +266,7 @@ const setupAgentTriggerToken = async (
266
266
  };
267
267
 
268
268
  const setupAgent = async (
269
- instance: CommandInstance,
269
+ instance: IO,
270
270
  agentName: string,
271
271
  agentConfig: AgentConfig,
272
272
  ) => {
@@ -287,7 +287,7 @@ const setupAgent = async (
287
287
  instance.log(`✅ Agent ${agentName} setup complete!`);
288
288
  };
289
289
 
290
- export const setupAgents = async (instance: CommandInstance) => {
290
+ export const setupAgents = async (instance: IO) => {
291
291
  const config = await getProjectConfig();
292
292
 
293
293
  instance.log("");