@catladder/cli 3.48.0 → 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.
- package/README.md +23 -5
- package/dist/bundles/catenv/index.js +3 -3
- package/dist/bundles/cli/index.js +34 -30
- package/dist/cli/src/adapters/baseContext.d.ts +22 -0
- package/dist/cli/src/adapters/baseContext.js +40 -0
- package/dist/cli/src/adapters/baseContext.js.map +1 -0
- package/dist/cli/src/adapters/programmatic.d.ts +26 -0
- package/dist/cli/src/adapters/programmatic.js +67 -0
- package/dist/cli/src/adapters/programmatic.js.map +1 -0
- package/dist/cli/src/adapters/terminal.d.ts +28 -0
- package/dist/cli/src/adapters/terminal.js +201 -0
- package/dist/cli/src/adapters/terminal.js.map +1 -0
- package/dist/cli/src/apps/catenv/catenv.d.ts +1 -0
- package/dist/cli/src/apps/catenv/catenv.js +1 -1
- package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/cli/src/apps/catenv/printVariables.js +0 -10
- package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -5
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js +6 -21
- package/dist/cli/src/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/index.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/index.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/logSection.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/logSection.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupAgents.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.d.ts +2 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.d.ts +9 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +15 -14
- package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.d.ts +2 -1
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js +4 -6
- package/dist/cli/src/apps/cli/utils/getGoogleAuthUserNumber.js.map +1 -1
- package/dist/cli/src/catenv.js +14 -16
- package/dist/cli/src/catenv.js.map +1 -1
- package/dist/cli/src/cli.js +186 -2
- package/dist/cli/src/cli.js.map +1 -1
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.d.ts +46 -0
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js +111 -0
- package/dist/cli/src/commands/cloudSQL/commandRestoreDb.js.map +1 -0
- package/dist/cli/src/commands/fun/commandDadjoke.d.ts +1 -0
- package/dist/cli/src/commands/fun/commandDadjoke.js +30 -0
- package/dist/cli/src/commands/fun/commandDadjoke.js.map +1 -0
- package/dist/cli/src/commands/fun/commandStarwars.d.ts +1 -0
- package/dist/cli/src/commands/fun/commandStarwars.js +19 -0
- package/dist/cli/src/commands/fun/commandStarwars.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeCurrentContext.d.ts +1 -0
- package/dist/cli/src/commands/general/commandKubeCurrentContext.js +17 -0
- package/dist/cli/src/commands/general/commandKubeCurrentContext.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeGetShell.d.ts +12 -0
- package/dist/cli/src/commands/general/commandKubeGetShell.js +36 -0
- package/dist/cli/src/commands/general/commandKubeGetShell.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeListNamespaces.d.ts +1 -0
- package/dist/cli/src/commands/general/commandKubeListNamespaces.js +20 -0
- package/dist/cli/src/commands/general/commandKubeListNamespaces.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeListPods.d.ts +7 -0
- package/dist/cli/src/commands/general/commandKubeListPods.js +26 -0
- package/dist/cli/src/commands/general/commandKubeListPods.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeListSecrets.d.ts +7 -0
- package/dist/cli/src/commands/general/commandKubeListSecrets.js +26 -0
- package/dist/cli/src/commands/general/commandKubeListSecrets.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubePortForward.d.ts +20 -0
- package/dist/cli/src/commands/general/commandKubePortForward.js +46 -0
- package/dist/cli/src/commands/general/commandKubePortForward.js.map +1 -0
- package/dist/cli/src/commands/general/commandKubeStopPortforward.d.ts +7 -0
- package/dist/cli/src/commands/general/commandKubeStopPortforward.js +24 -0
- package/dist/cli/src/commands/general/commandKubeStopPortforward.js.map +1 -0
- package/dist/cli/src/commands/index.d.ts +37 -0
- package/dist/cli/src/commands/index.js +283 -0
- package/dist/cli/src/commands/index.js.map +1 -0
- package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.d.ts +16 -0
- package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.js +89 -0
- package/dist/cli/src/commands/mongodb/commandMongoDestroyMember.js.map +1 -0
- package/dist/cli/src/commands/mongodb/commandMongoGetShell.d.ts +16 -0
- package/dist/cli/src/commands/mongodb/commandMongoGetShell.js +36 -0
- package/dist/cli/src/commands/mongodb/commandMongoGetShell.js.map +1 -0
- package/dist/cli/src/commands/mongodb/commandMongoPortForward.d.ts +21 -0
- package/dist/cli/src/commands/mongodb/commandMongoPortForward.js +65 -0
- package/dist/cli/src/commands/mongodb/commandMongoPortForward.js.map +1 -0
- package/dist/cli/src/commands/project/commandCloudSqlProxy.d.ts +13 -0
- package/dist/cli/src/commands/project/commandCloudSqlProxy.js +127 -0
- package/dist/cli/src/commands/project/commandCloudSqlProxy.js.map +1 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.d.ts +9 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.js +36 -0
- package/dist/cli/src/commands/project/commandConfigSecrets.js.map +1 -0
- package/dist/cli/src/commands/project/commandDeletePods.d.ts +13 -0
- package/dist/cli/src/commands/project/commandDeletePods.js +49 -0
- package/dist/cli/src/commands/project/commandDeletePods.js.map +1 -0
- package/dist/cli/src/commands/project/commandDeleteProject.d.ts +8 -0
- package/dist/cli/src/commands/project/commandDeleteProject.js +41 -0
- package/dist/cli/src/commands/project/commandDeleteProject.js.map +1 -0
- package/dist/cli/src/commands/project/commandEnvVars.d.ts +8 -0
- package/dist/cli/src/commands/project/commandEnvVars.js +32 -0
- package/dist/cli/src/commands/project/commandEnvVars.js.map +1 -0
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.d.ts +1 -0
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js +19 -0
- package/dist/cli/src/commands/project/commandGetMyTotalWorktime.js.map +1 -0
- package/dist/cli/src/commands/project/commandGetShell.d.ts +13 -0
- package/dist/cli/src/commands/project/commandGetShell.js +41 -0
- package/dist/cli/src/commands/project/commandGetShell.js.map +1 -0
- package/dist/cli/src/commands/project/commandGitlabCi.d.ts +14 -0
- package/dist/cli/src/commands/project/commandGitlabCi.js +109 -0
- package/dist/cli/src/commands/project/commandGitlabCi.js.map +1 -0
- package/dist/cli/src/commands/project/commandListPods.d.ts +8 -0
- package/dist/cli/src/commands/project/commandListPods.js +31 -0
- package/dist/cli/src/commands/project/commandListPods.js.map +1 -0
- package/dist/cli/src/commands/project/commandNamespace.d.ts +8 -0
- package/dist/cli/src/commands/project/commandNamespace.js +26 -0
- package/dist/cli/src/commands/project/commandNamespace.js.map +1 -0
- package/dist/cli/src/commands/project/commandOpenEnv.d.ts +8 -0
- package/dist/cli/src/commands/project/commandOpenEnv.js +40 -0
- package/dist/cli/src/commands/project/commandOpenEnv.js.map +1 -0
- package/dist/cli/src/commands/project/commandOpenGit.d.ts +1 -0
- package/dist/cli/src/commands/project/commandOpenGit.js +17 -0
- package/dist/cli/src/commands/project/commandOpenGit.js.map +1 -0
- package/dist/cli/src/commands/project/commandOpenLogs.d.ts +8 -0
- package/dist/cli/src/commands/project/commandOpenLogs.js +32 -0
- package/dist/cli/src/commands/project/commandOpenLogs.js.map +1 -0
- package/dist/cli/src/commands/project/commandPauseProject.d.ts +8 -0
- package/dist/cli/src/commands/project/commandPauseProject.js +41 -0
- package/dist/cli/src/commands/project/commandPauseProject.js.map +1 -0
- package/dist/cli/src/commands/project/commandPortForward.d.ts +25 -0
- package/dist/cli/src/commands/project/commandPortForward.js +95 -0
- package/dist/cli/src/commands/project/commandPortForward.js.map +1 -0
- package/dist/cli/src/commands/project/commandProjectRestoreDb.d.ts +19 -0
- package/dist/cli/src/commands/project/commandProjectRestoreDb.js +159 -0
- package/dist/cli/src/commands/project/commandProjectRestoreDb.js.map +1 -0
- package/dist/cli/src/commands/project/commandRenewToken.d.ts +1 -0
- package/dist/cli/src/commands/project/commandRenewToken.js +17 -0
- package/dist/cli/src/commands/project/commandRenewToken.js.map +1 -0
- package/dist/cli/src/commands/project/commandSecretsClearBackups.d.ts +7 -0
- package/dist/cli/src/commands/project/commandSecretsClearBackups.js +24 -0
- package/dist/cli/src/commands/project/commandSecretsClearBackups.js.map +1 -0
- package/dist/cli/src/commands/project/commandSecurityEvaluate.d.ts +1 -0
- package/dist/cli/src/commands/project/commandSecurityEvaluate.js +26 -0
- package/dist/cli/src/commands/project/commandSecurityEvaluate.js.map +1 -0
- package/dist/cli/src/commands/project/commandSetup.d.ts +8 -0
- package/dist/cli/src/commands/project/commandSetup.js +25 -0
- package/dist/cli/src/commands/project/commandSetup.js.map +1 -0
- package/dist/cli/src/commands/project/commandTriggerCronjob.d.ts +25 -0
- package/dist/cli/src/commands/project/commandTriggerCronjob.js +95 -0
- package/dist/cli/src/commands/project/commandTriggerCronjob.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.d.ts +27 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js +83 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCiJob.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.d.ts +22 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.js +60 -0
- package/dist/cli/src/commands/security/commandSecurityAuditCreate.js.map +1 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.d.ts +7 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js +35 -0
- package/dist/cli/src/commands/security/commandSecurityAuditEvaluate.js.map +1 -0
- package/dist/cli/src/completion.d.ts +24 -0
- package/dist/cli/src/completion.js +240 -0
- package/dist/cli/src/completion.js.map +1 -0
- package/dist/cli/src/config/getProjectConfig.d.ts +4 -4
- package/dist/cli/src/config/getProjectConfig.js +8 -8
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/cli/src/core/defineCommand.d.ts +27 -0
- package/dist/cli/src/core/defineCommand.js +35 -0
- package/dist/cli/src/core/defineCommand.js.map +1 -0
- package/dist/cli/src/core/index.d.ts +5 -0
- package/dist/cli/src/core/index.js +52 -0
- package/dist/cli/src/core/index.js.map +1 -0
- package/dist/cli/src/core/registry.d.ts +5 -0
- package/dist/cli/src/core/registry.js +26 -0
- package/dist/cli/src/core/registry.js.map +1 -0
- package/dist/cli/src/core/runner.d.ts +19 -0
- package/dist/cli/src/core/runner.js +29 -0
- package/dist/cli/src/core/runner.js.map +1 -0
- package/dist/cli/src/core/types.d.ts +105 -0
- package/dist/cli/src/core/types.js +17 -0
- package/dist/cli/src/core/types.js.map +1 -0
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.d.ts +2 -2
- package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
- package/dist/cli/src/gcloud/openDashboard.d.ts +2 -2
- package/dist/cli/src/gcloud/openDashboard.js +1 -1
- package/dist/cli/src/gcloud/openDashboard.js.map +1 -1
- package/dist/cli/src/gcloud/serviceAccounts.d.ts +2 -2
- package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
- package/dist/cli/src/kubernetes/openKubernetesDashboards.d.ts +3 -3
- package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
- package/dist/cli/src/security/auditDocument.js.map +1 -0
- package/dist/cli/src/security/createSecurityAuditMergeRequest.js.map +1 -0
- package/dist/cli/src/security/evaluateSecurityAudit.js.map +1 -0
- package/dist/cli/src/utils/gitlab.d.ts +9 -9
- package/dist/cli/src/utils/gitlab.js +45 -54
- package/dist/cli/src/utils/gitlab.js.map +1 -1
- package/dist/cli/src/utils/log.d.ts +2 -2
- package/dist/pipeline/src/build/index.d.ts +2 -2
- package/dist/pipeline/src/build/index.js.map +1 -1
- package/dist/pipeline/src/build/node/buildJob.d.ts +3 -3
- package/dist/pipeline/src/build/node/buildJob.js +13 -12
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.d.ts +3 -3
- package/dist/pipeline/src/build/node/cache.js +12 -9
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/index.d.ts +3 -3
- package/dist/pipeline/src/build/node/index.js +8 -6
- package/dist/pipeline/src/build/node/index.js.map +1 -1
- package/dist/pipeline/src/build/node/meteor.d.ts +1 -1
- package/dist/pipeline/src/build/node/meteor.js +8 -7
- package/dist/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.d.ts +1 -1
- package/dist/pipeline/src/build/node/testJob.js +5 -5
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/node/yarn.d.ts +2 -2
- package/dist/pipeline/src/build/node/yarn.js +10 -8
- package/dist/pipeline/src/build/node/yarn.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +1 -1
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/context/createComponentContext.js +3 -3
- package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
- package/dist/pipeline/src/context/createWorkspaceContext.js +1 -1
- package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.d.ts +1 -1
- package/dist/pipeline/src/deploy/custom/deployJob.js +2 -2
- package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/index.d.ts +1 -1
- package/dist/pipeline/src/deploy/types/index.d.ts +2 -2
- package/dist/pipeline/src/pipeline/createAllJobs.js +4 -4
- package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createJobsForComponent.js +2 -3
- package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.d.ts +1 -1
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +2 -2
- package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +3 -3
- package/dist/pipeline/src/types/context.d.ts +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/scripts/bundle +0 -2
- package/src/adapters/baseContext.ts +68 -0
- package/src/adapters/programmatic.ts +88 -0
- package/src/adapters/terminal.ts +202 -0
- package/src/apps/catenv/catenv.ts +4 -2
- package/src/apps/catenv/printVariables.ts +0 -8
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +8 -33
- package/src/apps/cli/commands/project/setup/index.ts +2 -2
- package/src/apps/cli/commands/project/setup/logSection.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupAgents.ts +11 -11
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupContext.ts +2 -5
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +2 -2
- package/src/apps/cli/commands/project/setup/setupTopic.ts +2 -2
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +19 -12
- package/src/apps/cli/utils/getGoogleAuthUserNumber.ts +5 -4
- package/src/catenv.ts +24 -18
- package/src/cli.ts +213 -2
- package/src/commands/cloudSQL/commandRestoreDb.ts +105 -0
- package/src/commands/fun/commandDadjoke.ts +18 -0
- package/src/commands/fun/commandStarwars.ts +14 -0
- package/src/commands/general/commandKubeCurrentContext.ts +12 -0
- package/src/commands/general/commandKubeGetShell.ts +32 -0
- package/src/commands/general/commandKubeListNamespaces.ts +15 -0
- package/src/commands/general/commandKubeListPods.ts +21 -0
- package/src/commands/general/commandKubeListSecrets.ts +21 -0
- package/src/commands/general/commandKubePortForward.ts +35 -0
- package/src/commands/general/commandKubeStopPortforward.ts +15 -0
- package/src/commands/index.ts +51 -0
- package/src/commands/mongodb/commandMongoDestroyMember.ts +133 -0
- package/src/commands/mongodb/commandMongoGetShell.ts +36 -0
- package/src/commands/mongodb/commandMongoPortForward.ts +56 -0
- package/src/commands/project/commandCloudSqlProxy.ts +189 -0
- package/src/commands/project/commandConfigSecrets.ts +31 -0
- package/src/commands/project/commandDeletePods.ts +53 -0
- package/src/commands/project/commandDeleteProject.ts +33 -0
- package/src/commands/project/commandEnvVars.ts +24 -0
- package/src/commands/project/commandGetMyTotalWorktime.ts +14 -0
- package/src/commands/project/commandGetShell.ts +39 -0
- package/src/commands/project/commandGitlabCi.ts +122 -0
- package/src/commands/project/commandListPods.ts +30 -0
- package/src/commands/project/commandNamespace.ts +21 -0
- package/src/commands/project/commandOpenEnv.ts +27 -0
- package/src/commands/project/commandOpenGit.ts +12 -0
- package/src/commands/project/commandOpenLogs.ts +27 -0
- package/src/commands/project/commandPauseProject.ts +33 -0
- package/src/commands/project/commandPortForward.ts +74 -0
- package/src/commands/project/commandProjectRestoreDb.ts +201 -0
- package/src/commands/project/commandRenewToken.ts +12 -0
- package/src/commands/project/commandSecretsClearBackups.ts +19 -0
- package/src/commands/project/commandSecurityEvaluate.ts +22 -0
- package/src/commands/project/commandSetup.ts +21 -0
- package/src/commands/project/commandTriggerCronjob.ts +99 -0
- package/src/commands/security/commandSecurityAuditCiJob.ts +91 -0
- package/src/commands/security/commandSecurityAuditCreate.ts +58 -0
- package/src/commands/security/commandSecurityAuditEvaluate.ts +30 -0
- package/src/completion.ts +272 -0
- package/src/config/getProjectConfig.ts +9 -9
- package/src/core/defineCommand.ts +32 -0
- package/src/core/index.ts +23 -0
- package/src/core/registry.ts +22 -0
- package/src/core/runner.ts +31 -0
- package/src/core/types.ts +142 -0
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
- package/src/gcloud/openDashboard.ts +3 -3
- package/src/gcloud/serviceAccounts.ts +2 -2
- package/src/kubernetes/openKubernetesDashboards.ts +3 -3
- package/src/utils/gitlab.ts +46 -58
- package/src/utils/log.ts +2 -2
- package/bin/catci +0 -3
- package/bin/catci-dev +0 -3
- package/dist/bundles/catci/index.js +0 -41
- package/dist/cli/src/apps/catci/catci.d.ts +0 -1
- package/dist/cli/src/apps/catci/catci.js +0 -33
- package/dist/cli/src/apps/catci/catci.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/auditDocument.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/commands.d.ts +0 -2
- package/dist/cli/src/apps/catci/commands/security/commands.js +0 -118
- package/dist/cli/src/apps/catci/commands/security/commands.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/createSecurityAuditMergeRequest.js.map +0 -1
- package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +0 -1
- package/dist/cli/src/apps/cli/cli.d.ts +0 -2
- package/dist/cli/src/apps/cli/cli.js +0 -38
- package/dist/cli/src/apps/cli/cli.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js +0 -130
- package/dist/cli/src/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/cloudSQL/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/cloudSQL/index.js +0 -14
- package/dist/cli/src/apps/cli/commands/cloudSQL/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/general/index.d.ts +0 -4
- package/dist/cli/src/apps/cli/commands/general/index.js +0 -83
- package/dist/cli/src/apps/cli/commands/general/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js +0 -13
- package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/general/portForward.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/general/portForward.js +0 -47
- package/dist/cli/src/apps/cli/commands/general/portForward.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/index.js +0 -18
- package/dist/cli/src/apps/cli/commands/mongodb/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js +0 -96
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js +0 -38
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js +0 -64
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +0 -152
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +0 -120
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandDeletePods.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js +0 -54
- package/dist/cli/src/apps/cli/commands/project/commandDeletePods.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js +0 -33
- package/dist/cli/src/apps/cli/commands/project/commandDeleteProject.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandEnvVars.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js +0 -17
- package/dist/cli/src/apps/cli/commands/project/commandEnvVars.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js +0 -11
- package/dist/cli/src/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandGetShell.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandGetShell.js +0 -37
- package/dist/cli/src/apps/cli/commands/project/commandGetShell.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js +0 -88
- package/dist/cli/src/apps/cli/commands/project/commandGitlabCi.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandListPods.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandListPods.js +0 -22
- package/dist/cli/src/apps/cli/commands/project/commandListPods.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandNamespace.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandNamespace.js +0 -12
- package/dist/cli/src/apps/cli/commands/project/commandNamespace.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js +0 -26
- package/dist/cli/src/apps/cli/commands/project/commandOpenEnv.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenGit.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js +0 -9
- package/dist/cli/src/apps/cli/commands/project/commandOpenGit.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js +0 -18
- package/dist/cli/src/apps/cli/commands/project/commandOpenLogs.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandPauseProject.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js +0 -33
- package/dist/cli/src/apps/cli/commands/project/commandPauseProject.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +0 -97
- package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandRenewToken.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js +0 -9
- package/dist/cli/src/apps/cli/commands/project/commandRenewToken.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.d.ts +0 -5
- package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js +0 -25
- package/dist/cli/src/apps/cli/commands/project/commandSecretsClearBackups.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js +0 -20
- package/dist/cli/src/apps/cli/commands/project/commandSecurityEvaluate.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandSetup.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandSetup.js +0 -12
- package/dist/cli/src/apps/cli/commands/project/commandSetup.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js +0 -63
- package/dist/cli/src/apps/cli/commands/project/commandTriggerCronjob.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/project/index.js +0 -54
- package/dist/cli/src/apps/cli/commands/project/index.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.d.ts +0 -2
- package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js +0 -16
- package/dist/cli/src/apps/cli/commands/project/utils/showProjectBanner.js.map +0 -1
- package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +0 -3
- package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js +0 -37
- package/dist/cli/src/apps/cli/commands/theStuffThatReallyMatters/index.js.map +0 -1
- package/dist/cli/src/apps/cli/verify/index.d.ts +0 -2
- package/dist/cli/src/apps/cli/verify/index.js +0 -17
- package/dist/cli/src/apps/cli/verify/index.js.map +0 -1
- package/dist/cli/src/catci.d.ts +0 -1
- package/dist/cli/src/catci.js +0 -7
- package/dist/cli/src/catci.js.map +0 -1
- package/src/apps/catci/catci.ts +0 -26
- package/src/apps/catci/commands/security/commands.ts +0 -161
- package/src/apps/cli/cli.ts +0 -43
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +0 -136
- package/src/apps/cli/commands/cloudSQL/index.ts +0 -7
- package/src/apps/cli/commands/general/index.ts +0 -90
- package/src/apps/cli/commands/general/namespaceAutoCompletion.ts +0 -7
- package/src/apps/cli/commands/general/portForward.ts +0 -48
- package/src/apps/cli/commands/mongodb/index.ts +0 -10
- package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +0 -132
- package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +0 -42
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +0 -64
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +0 -206
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +0 -194
- package/src/apps/cli/commands/project/commandDeletePods.ts +0 -48
- package/src/apps/cli/commands/project/commandDeleteProject.ts +0 -33
- package/src/apps/cli/commands/project/commandEnvVars.ts +0 -18
- package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +0 -14
- package/src/apps/cli/commands/project/commandGetShell.ts +0 -36
- package/src/apps/cli/commands/project/commandGitlabCi.ts +0 -115
- package/src/apps/cli/commands/project/commandListPods.ts +0 -20
- package/src/apps/cli/commands/project/commandNamespace.ts +0 -14
- package/src/apps/cli/commands/project/commandOpenEnv.ts +0 -22
- package/src/apps/cli/commands/project/commandOpenGit.ts +0 -12
- package/src/apps/cli/commands/project/commandOpenLogs.ts +0 -21
- package/src/apps/cli/commands/project/commandPauseProject.ts +0 -33
- package/src/apps/cli/commands/project/commandPortForward.ts +0 -91
- package/src/apps/cli/commands/project/commandRenewToken.ts +0 -12
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +0 -26
- package/src/apps/cli/commands/project/commandSecurityEvaluate.ts +0 -26
- package/src/apps/cli/commands/project/commandSetup.ts +0 -14
- package/src/apps/cli/commands/project/commandTriggerCronjob.ts +0 -62
- package/src/apps/cli/commands/project/index.ts +0 -56
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +0 -11
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +0 -32
- package/src/apps/cli/verify/index.ts +0 -14
- package/src/catci.ts +0 -3
- /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/auditDocument.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.d.ts +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.js +0 -0
- /package/dist/cli/src/{apps/catci/commands/security → security}/topics.json +0 -0
- /package/src/{apps/catci/commands/security → security}/auditDocument.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/createSecurityAuditMergeRequest.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/evaluateSecurityAudit.ts +0 -0
- /package/src/{apps/catci/commands/security → security}/topics.json +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isOfDeployType,
|
|
6
6
|
} from "@catladder/pipeline";
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { IO } from "../../../../../core/types";
|
|
9
9
|
import { upsertGcloudArtifactsRegistry } from "../../../../../gcloud/artifactsRegistry";
|
|
10
10
|
import { getCloudRunDomainSuffix } from "../../../../../gcloud/cloudRun/getCloudRunDomainSuffix";
|
|
11
11
|
import { enableGCloudServices } from "../../../../../gcloud/enableServices";
|
|
@@ -13,7 +13,7 @@ import { upsertGcloudServiceAccountAndSaveSecret } from "../../../../../gcloud/s
|
|
|
13
13
|
import { upsertAllVariables } from "../../../../../utils/gitlab";
|
|
14
14
|
|
|
15
15
|
export const setupCloudRun = async (
|
|
16
|
-
instance:
|
|
16
|
+
instance: IO,
|
|
17
17
|
context: ComponentContext,
|
|
18
18
|
) => {
|
|
19
19
|
if (!isOfDeployType(context.deploy?.config, "google-cloudrun")) {
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import type { ComponentContext } from "@catladder/pipeline";
|
|
2
2
|
import { isOfDeployType } from "@catladder/pipeline";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IO } from "../../../../../core/types";
|
|
4
4
|
import { setupCloudRun } from "./setupCloudRun";
|
|
5
5
|
|
|
6
6
|
import { setupKubernetes } from "./setupKubernetes";
|
|
7
7
|
import { logSection } from "./logSection";
|
|
8
8
|
|
|
9
|
-
export const setupContext = async (
|
|
10
|
-
instance: CommandInstance,
|
|
11
|
-
context: ComponentContext,
|
|
12
|
-
) => {
|
|
9
|
+
export const setupContext = async (instance: IO, context: ComponentContext) => {
|
|
13
10
|
await logSection(
|
|
14
11
|
instance,
|
|
15
12
|
"setting up " + context.env + ":" + context.name,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getFullKubernetesClusterName,
|
|
4
4
|
isOfDeployType,
|
|
5
5
|
} from "@catladder/pipeline";
|
|
6
|
-
import type {
|
|
6
|
+
import type { IO } from "../../../../../core/types";
|
|
7
7
|
import { exec } from "child-process-promise";
|
|
8
8
|
import { connectToCluster } from "../../../../../utils/cluster";
|
|
9
9
|
import {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import ensureNamespace from "../utils/ensureNamespace";
|
|
15
15
|
|
|
16
16
|
export const setupKubernetes = async (
|
|
17
|
-
instance:
|
|
17
|
+
instance: IO,
|
|
18
18
|
context: ComponentContext,
|
|
19
19
|
) => {
|
|
20
20
|
const deployConfig = context.deploy?.config;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IO } from "../../../../../core/types";
|
|
2
2
|
import { doGitlabRequest, getProjectInfo } from "../../../../../utils/gitlab";
|
|
3
3
|
|
|
4
4
|
const catladderTopic = "catladder";
|
|
5
5
|
|
|
6
|
-
export const setupTopic = async (instance:
|
|
6
|
+
export const setupTopic = async (instance: IO) => {
|
|
7
7
|
const { id: projectId } = await getProjectInfo(instance);
|
|
8
8
|
|
|
9
9
|
const { topics } = await doGitlabRequest(instance, `projects/${projectId}`);
|
|
@@ -10,7 +10,19 @@ import {
|
|
|
10
10
|
connectToCluster,
|
|
11
11
|
getCurrentConnectedClusterName,
|
|
12
12
|
} from "../../../../../utils/cluster";
|
|
13
|
-
|
|
13
|
+
import type { IO } from "../../../../../core/types";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Ensures the user is connected to the correct Kubernetes cluster for the given envComponent.
|
|
17
|
+
* If already connected, does nothing. If not, prompts for confirmation to switch (in interactive mode).
|
|
18
|
+
*
|
|
19
|
+
* Accepts an IO instance for logging and prompting.
|
|
20
|
+
* Also works with Vorpal's CommandInstance via .call(this, envComponent) for backward compatibility.
|
|
21
|
+
*/
|
|
22
|
+
export async function ensureCluster(
|
|
23
|
+
io: IO,
|
|
24
|
+
envComponent: string,
|
|
25
|
+
): Promise<void> {
|
|
14
26
|
const { env, componentName } = parseChoice(envComponent);
|
|
15
27
|
const context = await getPipelineContextByChoice(env, componentName);
|
|
16
28
|
if (!isOfDeployType(context.deploy?.config, "kubernetes")) {
|
|
@@ -20,21 +32,16 @@ export default async function (envComponent: string) {
|
|
|
20
32
|
const connectedClusterName = await getCurrentConnectedClusterName();
|
|
21
33
|
|
|
22
34
|
if (cluster !== connectedClusterName) {
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
io.log(`you are currently connected to cluster '${connectedClusterName}'`);
|
|
36
|
+
io.log(`but the project requires cluster '${cluster}'`);
|
|
37
|
+
const shouldContinue = await io.confirm(
|
|
38
|
+
`Do you want to connect to '${cluster}'?`,
|
|
25
39
|
);
|
|
26
|
-
this.log(`but the project requires cluster '${cluster}'`);
|
|
27
|
-
const { shouldContinue } = await this.prompt({
|
|
28
|
-
type: "confirm",
|
|
29
|
-
name: "shouldContinue",
|
|
30
|
-
default: true,
|
|
31
|
-
message: `Do you want to connect to '${cluster}'?`,
|
|
32
|
-
});
|
|
33
40
|
if (!shouldContinue) {
|
|
34
|
-
|
|
41
|
+
io.log("abort");
|
|
35
42
|
} else {
|
|
36
43
|
await connectToCluster(cluster);
|
|
37
|
-
|
|
44
|
+
io.log(`connected to cluster '${cluster}'`);
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IO } from "../../../core/types";
|
|
1
2
|
import {
|
|
2
3
|
getPreference,
|
|
3
4
|
hasPreference,
|
|
@@ -5,16 +6,16 @@ import {
|
|
|
5
6
|
} from "../../../utils/preferences";
|
|
6
7
|
|
|
7
8
|
const KEY = "googleAuthUserNumber";
|
|
8
|
-
export const getGoogleAuthUserNumber = async
|
|
9
|
+
export const getGoogleAuthUserNumber = async (io: IO) => {
|
|
9
10
|
if (!(await hasPreference(KEY))) {
|
|
10
|
-
|
|
11
|
+
io.log(
|
|
11
12
|
"Please type in your google auth user number (0 if you have only one google account or maybe 1 if you have multiple)",
|
|
12
13
|
);
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const authUserNumber = await io.promptDirect({
|
|
15
16
|
type: "number",
|
|
16
17
|
name: "authUserNumber",
|
|
17
|
-
default:
|
|
18
|
+
default: 0,
|
|
18
19
|
message: "Auth user ",
|
|
19
20
|
});
|
|
20
21
|
await setPreference(KEY, authUserNumber);
|
package/src/catenv.ts
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
1
2
|
import catenv from "./apps/catenv/catenv";
|
|
2
|
-
|
|
3
3
|
import { parseChoice } from "./config/parseChoice";
|
|
4
|
+
import packageInfos from "./packageInfos";
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const program = new Command();
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
program
|
|
9
|
+
.name("catenv")
|
|
10
|
+
.description("Environment variable and pipeline generation via direnv")
|
|
11
|
+
.version(packageInfos.version)
|
|
12
|
+
.argument("[envComponent]", "env or env:component")
|
|
13
|
+
.option("-v, --verbose", "verbose output")
|
|
14
|
+
.option("-p, --print-variables", "print variables")
|
|
15
|
+
.action(
|
|
16
|
+
(
|
|
17
|
+
envComponent: string | undefined,
|
|
18
|
+
opts: { verbose?: boolean; printVariables?: boolean },
|
|
19
|
+
) => {
|
|
20
|
+
catenv(envComponent ? parseChoice(envComponent) : null, {
|
|
21
|
+
verbose: opts.verbose ?? false,
|
|
22
|
+
printVariables: opts.printVariables ?? false,
|
|
23
|
+
}).then(() => {
|
|
24
|
+
// we have to exit manually, because we have some file watches
|
|
25
|
+
process.exit();
|
|
26
|
+
});
|
|
27
|
+
},
|
|
13
28
|
);
|
|
14
|
-
process.exit(0);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const verbose = args.some((arg) => arg === "-v" || arg === "--verbose");
|
|
18
|
-
// choise arg is deprecated and will be removed in the future
|
|
19
|
-
const choiceArg = args.find((arg) => arg !== "-v" && arg !== "--verbose");
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
// we have to exit manually, because we have some file watches
|
|
23
|
-
process.exit();
|
|
24
|
-
});
|
|
30
|
+
program.parse();
|
package/src/cli.ts
CHANGED
|
@@ -1,3 +1,214 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import packageInfos from "./packageInfos";
|
|
3
|
+
import { stopAllPortForwards } from "./utils/portForwards";
|
|
4
|
+
import { createTerminalContext } from "./adapters/terminal";
|
|
5
|
+
import type { CommandDef } from "./core/types";
|
|
6
|
+
import {
|
|
7
|
+
getCompletions,
|
|
8
|
+
generateZshCompletionScript,
|
|
9
|
+
installCompletions,
|
|
10
|
+
uninstallCompletions,
|
|
11
|
+
} from "./completion";
|
|
2
12
|
|
|
3
|
-
|
|
13
|
+
// Import all commands
|
|
14
|
+
import * as commands from "./commands";
|
|
15
|
+
|
|
16
|
+
const program = new Command();
|
|
17
|
+
|
|
18
|
+
program
|
|
19
|
+
.name("catladder")
|
|
20
|
+
.description("Panter CLI tool for cloud CI/CD and DevOps")
|
|
21
|
+
.version(packageInfos.version)
|
|
22
|
+
.option("-y, --yes", "skip all confirmation prompts");
|
|
23
|
+
|
|
24
|
+
// Collect all command defs for completion
|
|
25
|
+
const allCommandDefs: CommandDef[] = [];
|
|
26
|
+
|
|
27
|
+
// Cache for intermediate subcommand groups (e.g., "project", "project cloudsql")
|
|
28
|
+
const subcommandCache = new Map<string, Command>();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get or create a chain of nested subcommands.
|
|
32
|
+
* E.g., for ["project", "cloudsql"], ensures program.command("project").command("cloudsql") exists.
|
|
33
|
+
*/
|
|
34
|
+
function getOrCreateParent(parts: string[]): Command {
|
|
35
|
+
if (parts.length === 0) return program;
|
|
36
|
+
|
|
37
|
+
const key = parts.join(" ");
|
|
38
|
+
if (subcommandCache.has(key)) return subcommandCache.get(key)!;
|
|
39
|
+
|
|
40
|
+
const parent = getOrCreateParent(parts.slice(0, -1));
|
|
41
|
+
const cmd = parent.command(parts[parts.length - 1]);
|
|
42
|
+
subcommandCache.set(key, cmd);
|
|
43
|
+
return cmd;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Register a CommandDef with Commander.js.
|
|
48
|
+
* - Command name can contain spaces for nesting (e.g., "project cloudsql proxy")
|
|
49
|
+
* - Inputs with `positional: true` become Commander positional args
|
|
50
|
+
* - Other inputs become optional --flags
|
|
51
|
+
* - --inputs accepts JSON for programmatic use
|
|
52
|
+
*/
|
|
53
|
+
function registerCommand(def: CommandDef): void {
|
|
54
|
+
allCommandDefs.push(def);
|
|
55
|
+
|
|
56
|
+
// Separate positional inputs from flag inputs
|
|
57
|
+
const positionalInputs: [string, (typeof def.inputs)[string]][] = [];
|
|
58
|
+
const flagInputs: [string, (typeof def.inputs)[string]][] = [];
|
|
59
|
+
|
|
60
|
+
for (const [name, inputDef] of Object.entries(def.inputs)) {
|
|
61
|
+
if (inputDef.positional) {
|
|
62
|
+
positionalInputs.push([name, inputDef]);
|
|
63
|
+
} else {
|
|
64
|
+
flagInputs.push([name, inputDef]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Split name into parent groups + leaf command
|
|
69
|
+
const nameParts = def.name.split(" ");
|
|
70
|
+
const parentParts = nameParts.slice(0, -1);
|
|
71
|
+
const leafName = nameParts[nameParts.length - 1];
|
|
72
|
+
|
|
73
|
+
// Build leaf command string with positional args
|
|
74
|
+
let cmdStr = leafName;
|
|
75
|
+
for (const [name] of positionalInputs) {
|
|
76
|
+
cmdStr += ` [${name}]`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const parent = getOrCreateParent(parentParts);
|
|
80
|
+
const cmd = parent.command(cmdStr).description(def.description);
|
|
81
|
+
|
|
82
|
+
// Add --flag for each non-positional input
|
|
83
|
+
for (const [name, inputDef] of flagInputs) {
|
|
84
|
+
const flagName = name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
85
|
+
const desc = inputDef.message.replace(/\s*🤔\s*$/, "").trim();
|
|
86
|
+
if (inputDef.type === "boolean") {
|
|
87
|
+
cmd.option(`--${flagName}`, desc);
|
|
88
|
+
cmd.option(`--no-${flagName}`, `negate: ${desc}`);
|
|
89
|
+
} else {
|
|
90
|
+
cmd.option(`--${flagName} <value>`, desc);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Add --inputs for JSON input
|
|
95
|
+
cmd.option("--inputs <json>", "JSON object with input values");
|
|
96
|
+
|
|
97
|
+
cmd.action(async (...rawArgs: any[]) => {
|
|
98
|
+
// Commander passes positional args first, then options object, then the Command
|
|
99
|
+
const opts = rawArgs[rawArgs.length - 2];
|
|
100
|
+
|
|
101
|
+
// Parse positional args into cliOptions
|
|
102
|
+
const cliOptions: Record<string, unknown> = {};
|
|
103
|
+
positionalInputs.forEach(([name], i) => {
|
|
104
|
+
if (rawArgs[i] !== undefined) {
|
|
105
|
+
cliOptions[name] = rawArgs[i];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Parse CLI flag overrides
|
|
110
|
+
for (const [name, inputDef] of flagInputs) {
|
|
111
|
+
const flagName = name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
112
|
+
const camelName = flagName.replace(/-([a-z])/g, (_, c) =>
|
|
113
|
+
c.toUpperCase(),
|
|
114
|
+
);
|
|
115
|
+
if (opts[camelName] !== undefined) {
|
|
116
|
+
let value = opts[camelName];
|
|
117
|
+
if (inputDef.type === "number" && typeof value === "string") {
|
|
118
|
+
value = Number(value);
|
|
119
|
+
}
|
|
120
|
+
cliOptions[name] = value;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Parse --inputs JSON
|
|
125
|
+
let jsonInputs: Record<string, unknown> = {};
|
|
126
|
+
if (opts.inputs) {
|
|
127
|
+
try {
|
|
128
|
+
jsonInputs = JSON.parse(opts.inputs);
|
|
129
|
+
} catch {
|
|
130
|
+
console.error("Error: --inputs must be valid JSON");
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const ctx = createTerminalContext(def, {
|
|
136
|
+
cliOptions,
|
|
137
|
+
jsonInputs,
|
|
138
|
+
yes: program.opts().yes,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
await def.execute(ctx);
|
|
143
|
+
} catch (err: any) {
|
|
144
|
+
if (err.name === "MissingInputError") {
|
|
145
|
+
console.error(`\n${err.message}\n`);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
throw err;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Register all commands
|
|
154
|
+
for (const cmd of Object.values(commands)) {
|
|
155
|
+
if (cmd && typeof cmd === "object" && "name" in cmd && "execute" in cmd) {
|
|
156
|
+
registerCommand(cmd as CommandDef);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Hidden __complete command for shell completion
|
|
161
|
+
program
|
|
162
|
+
.command("__complete", { hidden: true })
|
|
163
|
+
.argument("[words]", "words typed so far")
|
|
164
|
+
.argument("[cursor]", "word at cursor")
|
|
165
|
+
.action(async (wordsStr: string | undefined, cursor: string | undefined) => {
|
|
166
|
+
const words = wordsStr ? wordsStr.split(" ").filter(Boolean) : [];
|
|
167
|
+
const cursorWord = cursor ?? "";
|
|
168
|
+
try {
|
|
169
|
+
const completions = await getCompletions(
|
|
170
|
+
allCommandDefs,
|
|
171
|
+
words,
|
|
172
|
+
cursorWord,
|
|
173
|
+
);
|
|
174
|
+
for (const c of completions) {
|
|
175
|
+
console.log(c);
|
|
176
|
+
}
|
|
177
|
+
} catch {
|
|
178
|
+
// Silently fail -- completion should never break the shell
|
|
179
|
+
}
|
|
180
|
+
process.exit(0);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// completion commands
|
|
184
|
+
const completionCmd = program
|
|
185
|
+
.command("completion")
|
|
186
|
+
.description("shell completion setup");
|
|
187
|
+
|
|
188
|
+
completionCmd
|
|
189
|
+
.command("zsh")
|
|
190
|
+
.description("output zsh completion script")
|
|
191
|
+
.action(() => {
|
|
192
|
+
console.log(generateZshCompletionScript());
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
completionCmd
|
|
196
|
+
.command("install")
|
|
197
|
+
.description("install shell completions into your .zshrc")
|
|
198
|
+
.action(async () => {
|
|
199
|
+
await installCompletions();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
completionCmd
|
|
203
|
+
.command("uninstall")
|
|
204
|
+
.description("remove shell completions from your .zshrc")
|
|
205
|
+
.action(async () => {
|
|
206
|
+
await uninstallCompletions();
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Cleanup on exit
|
|
210
|
+
process.on("exit", () => {
|
|
211
|
+
stopAllPortForwards();
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
program.parse();
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { spawnCopyDb } from "../../gcloud/cloudSql/copyDb";
|
|
3
|
+
import type { CloudSqlBackgroundProxy } from "../../gcloud/cloudSql/startProxy";
|
|
4
|
+
import { startCloudSqlProxyInBackground } from "../../gcloud/cloudSql/startProxy";
|
|
5
|
+
|
|
6
|
+
export const commandRestoreDb = defineCommand({
|
|
7
|
+
name: "cloudsql restore-db",
|
|
8
|
+
description: "restore a db from one source to another target",
|
|
9
|
+
group: "cloudSQL",
|
|
10
|
+
inputs: {
|
|
11
|
+
source: {
|
|
12
|
+
type: "string",
|
|
13
|
+
message: "Source instance (connection string or 'local')? 🤔 ",
|
|
14
|
+
},
|
|
15
|
+
sourceLocalPort: {
|
|
16
|
+
type: "number",
|
|
17
|
+
message: "Local Port for source? 🤔 ",
|
|
18
|
+
default: 5432,
|
|
19
|
+
},
|
|
20
|
+
sourceUsername: {
|
|
21
|
+
type: "string",
|
|
22
|
+
message: "Source Username? 🤔 ",
|
|
23
|
+
default: "postgres",
|
|
24
|
+
},
|
|
25
|
+
sourcePassword: { type: "string", message: "Source Password? 🤔 " },
|
|
26
|
+
sourceDbName: { type: "string", message: "Source DB name? 🤔 " },
|
|
27
|
+
target: {
|
|
28
|
+
type: "string",
|
|
29
|
+
message: "Target INSTANCE (connection string or 'local')? 🤔 ",
|
|
30
|
+
},
|
|
31
|
+
targetLocalPort: {
|
|
32
|
+
type: "number",
|
|
33
|
+
message: "Local Port for target? 🤔 ",
|
|
34
|
+
default: 5432,
|
|
35
|
+
},
|
|
36
|
+
targetUsername: {
|
|
37
|
+
type: "string",
|
|
38
|
+
message: "Target Username? 🤔 ",
|
|
39
|
+
default: "postgres",
|
|
40
|
+
},
|
|
41
|
+
targetPassword: { type: "string", message: "Target Password? 🤔 " },
|
|
42
|
+
targetDbName: { type: "string", message: "Target DB name? 🤔 " },
|
|
43
|
+
},
|
|
44
|
+
execute: async (ctx) => {
|
|
45
|
+
const source = await ctx.get("source");
|
|
46
|
+
|
|
47
|
+
let sourceProxy: CloudSqlBackgroundProxy;
|
|
48
|
+
let targetProxy: CloudSqlBackgroundProxy;
|
|
49
|
+
let sourcePort: number;
|
|
50
|
+
let targetPort: number;
|
|
51
|
+
|
|
52
|
+
if (source === "local") {
|
|
53
|
+
sourcePort = await ctx.get("sourceLocalPort");
|
|
54
|
+
} else {
|
|
55
|
+
sourcePort = 54399;
|
|
56
|
+
sourceProxy = await startCloudSqlProxyInBackground({
|
|
57
|
+
instanceName: source,
|
|
58
|
+
localPort: sourcePort,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const sourceUsername = await ctx.get("sourceUsername");
|
|
63
|
+
const sourcePassword = await ctx.get("sourcePassword");
|
|
64
|
+
const sourceDbName = await ctx.get("sourceDbName");
|
|
65
|
+
|
|
66
|
+
const target = await ctx.get("target");
|
|
67
|
+
|
|
68
|
+
if (target === "local") {
|
|
69
|
+
targetPort = await ctx.get("targetLocalPort");
|
|
70
|
+
} else {
|
|
71
|
+
targetPort = 54499;
|
|
72
|
+
targetProxy = await startCloudSqlProxyInBackground({
|
|
73
|
+
instanceName: target,
|
|
74
|
+
localPort: targetPort,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const targetUsername = await ctx.get("targetUsername");
|
|
79
|
+
const targetPassword = await ctx.get("targetPassword");
|
|
80
|
+
const targetDbName = await ctx.get("targetDbName");
|
|
81
|
+
|
|
82
|
+
const shouldContinue = await ctx.confirm(
|
|
83
|
+
`This will drop ${target}/${targetDbName} and replace it with ${source}/${sourceDbName}. Continue? 🤔 `,
|
|
84
|
+
);
|
|
85
|
+
if (!shouldContinue) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
await spawnCopyDb({
|
|
91
|
+
targetPassword,
|
|
92
|
+
targetPort,
|
|
93
|
+
targetUsername,
|
|
94
|
+
sourceUsername,
|
|
95
|
+
sourcePassword,
|
|
96
|
+
sourcePort,
|
|
97
|
+
sourceDbName,
|
|
98
|
+
targetDbName,
|
|
99
|
+
});
|
|
100
|
+
} finally {
|
|
101
|
+
sourceProxy?.stop();
|
|
102
|
+
targetProxy?.stop();
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fetch from "node-fetch";
|
|
2
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
3
|
+
|
|
4
|
+
export const commandDadjoke = defineCommand({
|
|
5
|
+
name: "fun dadjoke",
|
|
6
|
+
description: "something for jonas.",
|
|
7
|
+
group: "fun",
|
|
8
|
+
inputs: {},
|
|
9
|
+
execute: async (ctx) => {
|
|
10
|
+
const result = await fetch("https://icanhazdadjoke.com/", {
|
|
11
|
+
headers: { Accept: "text/plain" },
|
|
12
|
+
});
|
|
13
|
+
const text = await result.text();
|
|
14
|
+
ctx.log("");
|
|
15
|
+
ctx.log(text);
|
|
16
|
+
ctx.log("");
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { spawn } from "child-process-promise";
|
|
2
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
3
|
+
|
|
4
|
+
export const commandStarwars = defineCommand({
|
|
5
|
+
name: "fun starwars",
|
|
6
|
+
description: "Long time ago... in a galaxy far far away...",
|
|
7
|
+
group: "fun",
|
|
8
|
+
inputs: {},
|
|
9
|
+
execute: async () => {
|
|
10
|
+
await spawn("nc", ["towel.blinkenlights.nl", "23"], {
|
|
11
|
+
stdio: ["pipe", "inherit", "pipe"],
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getCurrentContext } from "../../utils/cluster";
|
|
3
|
+
|
|
4
|
+
export const commandKubeCurrentContext = defineCommand({
|
|
5
|
+
name: "kube current-context",
|
|
6
|
+
description: "show current kubernetes context",
|
|
7
|
+
group: "general",
|
|
8
|
+
inputs: {},
|
|
9
|
+
execute: async (ctx) => {
|
|
10
|
+
ctx.log(await getCurrentContext());
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getk8sApi } from "../../k8sApi";
|
|
3
|
+
|
|
4
|
+
import { getShell } from "../../utils/shell";
|
|
5
|
+
|
|
6
|
+
export const commandKubeGetShell = defineCommand({
|
|
7
|
+
name: "kube get-shell",
|
|
8
|
+
description: "get a shell to a pod in the environment",
|
|
9
|
+
group: "general",
|
|
10
|
+
inputs: {
|
|
11
|
+
namespace: {
|
|
12
|
+
type: "string",
|
|
13
|
+
message: "kubernetes namespace",
|
|
14
|
+
positional: true,
|
|
15
|
+
},
|
|
16
|
+
podName: {
|
|
17
|
+
type: "string",
|
|
18
|
+
message: "Which pod? 🤔",
|
|
19
|
+
choices: async (ctx) => {
|
|
20
|
+
const namespace = await ctx.get("namespace");
|
|
21
|
+
const k8sApi = getk8sApi();
|
|
22
|
+
const res = await k8sApi.listNamespacedPod(namespace);
|
|
23
|
+
return res.body.items.map((i: any) => i.metadata.name);
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
execute: async (ctx) => {
|
|
28
|
+
const namespace = await ctx.get("namespace");
|
|
29
|
+
const podName = await ctx.get("podName");
|
|
30
|
+
await getShell(namespace, podName);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getk8sApi } from "../../k8sApi";
|
|
3
|
+
|
|
4
|
+
export const commandKubeListNamespaces = defineCommand({
|
|
5
|
+
name: "kube list-namespaces",
|
|
6
|
+
description: "list all namespaces",
|
|
7
|
+
group: "general",
|
|
8
|
+
inputs: {},
|
|
9
|
+
execute: async (ctx) => {
|
|
10
|
+
const k8sApi = getk8sApi();
|
|
11
|
+
const res = await k8sApi.listNamespace();
|
|
12
|
+
const namespaces = res.body.items.map((n: any) => n.metadata.name);
|
|
13
|
+
ctx.log(namespaces.join("\n"));
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getk8sApi } from "../../k8sApi";
|
|
3
|
+
|
|
4
|
+
export const commandKubeListPods = defineCommand({
|
|
5
|
+
name: "kube list-pods",
|
|
6
|
+
description: "list all pods of namespace",
|
|
7
|
+
group: "general",
|
|
8
|
+
inputs: {
|
|
9
|
+
namespace: {
|
|
10
|
+
type: "string",
|
|
11
|
+
message: "kubernetes namespace",
|
|
12
|
+
positional: true,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
execute: async (ctx) => {
|
|
16
|
+
const namespace = await ctx.get("namespace");
|
|
17
|
+
const k8sApi = getk8sApi();
|
|
18
|
+
const res = await k8sApi.listNamespacedPod(namespace);
|
|
19
|
+
ctx.log(res.body.items.map((n: any) => n.metadata.name).join("\n"));
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineCommand } from "../../core/defineCommand";
|
|
2
|
+
import { getk8sApi } from "../../k8sApi";
|
|
3
|
+
|
|
4
|
+
export const commandKubeListSecrets = defineCommand({
|
|
5
|
+
name: "kube list-secrets",
|
|
6
|
+
description: "show secrets",
|
|
7
|
+
group: "general",
|
|
8
|
+
inputs: {
|
|
9
|
+
namespace: {
|
|
10
|
+
type: "string",
|
|
11
|
+
message: "kubernetes namespace",
|
|
12
|
+
positional: true,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
execute: async (ctx) => {
|
|
16
|
+
const namespace = await ctx.get("namespace");
|
|
17
|
+
const k8sApi = getk8sApi();
|
|
18
|
+
const res = await k8sApi.listNamespacedSecret(namespace);
|
|
19
|
+
ctx.log(res.body.items.map((n: any) => n.metadata.name).join("\n"));
|
|
20
|
+
},
|
|
21
|
+
});
|