@factiii/stack 0.1.2
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 +420 -0
- package/bin/factiii +229 -0
- package/dist/cli/check-config.d.ts +9 -0
- package/dist/cli/check-config.d.ts.map +1 -0
- package/dist/cli/check-config.js +19 -0
- package/dist/cli/check-config.js.map +1 -0
- package/dist/cli/deploy-secrets.d.ts +16 -0
- package/dist/cli/deploy-secrets.d.ts.map +1 -0
- package/dist/cli/deploy-secrets.js +227 -0
- package/dist/cli/deploy-secrets.js.map +1 -0
- package/dist/cli/deploy.d.ts +30 -0
- package/dist/cli/deploy.d.ts.map +1 -0
- package/dist/cli/deploy.js +306 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/deployer.d.ts +13 -0
- package/dist/cli/deployer.d.ts.map +1 -0
- package/dist/cli/deployer.js +21 -0
- package/dist/cli/deployer.js.map +1 -0
- package/dist/cli/dev-sync.d.ts +30 -0
- package/dist/cli/dev-sync.d.ts.map +1 -0
- package/dist/cli/dev-sync.js +500 -0
- package/dist/cli/dev-sync.js.map +1 -0
- package/dist/cli/execute-plugin-command.d.ts +25 -0
- package/dist/cli/execute-plugin-command.d.ts.map +1 -0
- package/dist/cli/execute-plugin-command.js +237 -0
- package/dist/cli/execute-plugin-command.js.map +1 -0
- package/dist/cli/fix.d.ts +22 -0
- package/dist/cli/fix.d.ts.map +1 -0
- package/dist/cli/fix.js +267 -0
- package/dist/cli/fix.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +31 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +9 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +190 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/plugin-commands.d.ts +22 -0
- package/dist/cli/plugin-commands.d.ts.map +1 -0
- package/dist/cli/plugin-commands.js +121 -0
- package/dist/cli/plugin-commands.js.map +1 -0
- package/dist/cli/scan.d.ts +66 -0
- package/dist/cli/scan.d.ts.map +1 -0
- package/dist/cli/scan.js +511 -0
- package/dist/cli/scan.js.map +1 -0
- package/dist/cli/secrets.d.ts +19 -0
- package/dist/cli/secrets.d.ts.map +1 -0
- package/dist/cli/secrets.js +318 -0
- package/dist/cli/secrets.js.map +1 -0
- package/dist/cli/undeploy.d.ts +9 -0
- package/dist/cli/undeploy.d.ts.map +1 -0
- package/dist/cli/undeploy.js +95 -0
- package/dist/cli/undeploy.js.map +1 -0
- package/dist/cli/upgrade.d.ts +9 -0
- package/dist/cli/upgrade.d.ts.map +1 -0
- package/dist/cli/upgrade.js +24 -0
- package/dist/cli/upgrade.js.map +1 -0
- package/dist/cli/validate.d.ts +9 -0
- package/dist/cli/validate.d.ts.map +1 -0
- package/dist/cli/validate.js +20 -0
- package/dist/cli/validate.js.map +1 -0
- package/dist/generators/generate-factiii-auto.d.ts +31 -0
- package/dist/generators/generate-factiii-auto.d.ts.map +1 -0
- package/dist/generators/generate-factiii-auto.js +251 -0
- package/dist/generators/generate-factiii-auto.js.map +1 -0
- package/dist/generators/generate-factiii-yml.d.ts +23 -0
- package/dist/generators/generate-factiii-yml.d.ts.map +1 -0
- package/dist/generators/generate-factiii-yml.js +228 -0
- package/dist/generators/generate-factiii-yml.js.map +1 -0
- package/dist/generators/index.d.ts +8 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +14 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/addons/server-mode/index.d.ts +57 -0
- package/dist/plugins/addons/server-mode/index.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/index.js +136 -0
- package/dist/plugins/addons/server-mode/index.js.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.d.ts +17 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.js +461 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.js.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.d.ts +12 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.js +246 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.js.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.d.ts +14 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.js +113 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.js.map +1 -0
- package/dist/plugins/approved.json +13 -0
- package/dist/plugins/frameworks/prisma-trpc/index.d.ts +65 -0
- package/dist/plugins/frameworks/prisma-trpc/index.d.ts.map +1 -0
- package/dist/plugins/frameworks/prisma-trpc/index.js +668 -0
- package/dist/plugins/frameworks/prisma-trpc/index.js.map +1 -0
- package/dist/plugins/index.d.ts +101 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +411 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/interfaces/addon.d.ts +43 -0
- package/dist/plugins/interfaces/addon.d.ts.map +1 -0
- package/dist/plugins/interfaces/addon.js +53 -0
- package/dist/plugins/interfaces/addon.js.map +1 -0
- package/dist/plugins/interfaces/framework.d.ts +43 -0
- package/dist/plugins/interfaces/framework.d.ts.map +1 -0
- package/dist/plugins/interfaces/framework.js +53 -0
- package/dist/plugins/interfaces/framework.js.map +1 -0
- package/dist/plugins/interfaces/index.d.ts +10 -0
- package/dist/plugins/interfaces/index.d.ts.map +1 -0
- package/dist/plugins/interfaces/index.js +17 -0
- package/dist/plugins/interfaces/index.js.map +1 -0
- package/dist/plugins/interfaces/pipeline.d.ts +78 -0
- package/dist/plugins/interfaces/pipeline.d.ts.map +1 -0
- package/dist/plugins/interfaces/pipeline.js +82 -0
- package/dist/plugins/interfaces/pipeline.js.map +1 -0
- package/dist/plugins/interfaces/server.d.ts +65 -0
- package/dist/plugins/interfaces/server.d.ts.map +1 -0
- package/dist/plugins/interfaces/server.js +72 -0
- package/dist/plugins/interfaces/server.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/ec2.d.ts +9 -0
- package/dist/plugins/pipelines/aws/configs/ec2.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/ec2.js +34 -0
- package/dist/plugins/pipelines/aws/configs/ec2.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.d.ts +13 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.js +86 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/index.d.ts +14 -0
- package/dist/plugins/pipelines/aws/configs/index.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/index.js +21 -0
- package/dist/plugins/pipelines/aws/configs/index.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/types.d.ts +36 -0
- package/dist/plugins/pipelines/aws/configs/types.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/types.js +9 -0
- package/dist/plugins/pipelines/aws/configs/types.js.map +1 -0
- package/dist/plugins/pipelines/aws/dev.d.ts +10 -0
- package/dist/plugins/pipelines/aws/dev.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/dev.js +70 -0
- package/dist/plugins/pipelines/aws/dev.js.map +1 -0
- package/dist/plugins/pipelines/aws/index.d.ts +118 -0
- package/dist/plugins/pipelines/aws/index.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/index.js +346 -0
- package/dist/plugins/pipelines/aws/index.js.map +1 -0
- package/dist/plugins/pipelines/aws/prod.d.ts +19 -0
- package/dist/plugins/pipelines/aws/prod.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/prod.js +362 -0
- package/dist/plugins/pipelines/aws/prod.js.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.d.ts +7 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.js +31 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.js.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/config.d.ts +7 -0
- package/dist/plugins/pipelines/aws/scanfix/config.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/config.js +134 -0
- package/dist/plugins/pipelines/aws/scanfix/config.js.map +1 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.d.ts +65 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.js +221 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.js.map +1 -0
- package/dist/plugins/pipelines/factiii/index.d.ts +195 -0
- package/dist/plugins/pipelines/factiii/index.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/index.js +862 -0
- package/dist/plugins/pipelines/factiii/index.js.map +1 -0
- package/dist/plugins/pipelines/factiii/prod.d.ts +17 -0
- package/dist/plugins/pipelines/factiii/prod.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/prod.js +282 -0
- package/dist/plugins/pipelines/factiii/prod.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.js +80 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.js +43 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.js +237 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.js +169 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.js.map +1 -0
- package/dist/plugins/pipelines/factiii/staging.d.ts +25 -0
- package/dist/plugins/pipelines/factiii/staging.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/staging.js +223 -0
- package/dist/plugins/pipelines/factiii/staging.js.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/detection.d.ts +36 -0
- package/dist/plugins/pipelines/factiii/utils/detection.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/detection.js +140 -0
- package/dist/plugins/pipelines/factiii/utils/detection.js.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.d.ts +16 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.js +129 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.js.map +1 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-cicd-prod.yml +112 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-cicd-staging.yml +112 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-command.yml +130 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-deploy.yml +198 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-dev-sync.yml +179 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-fix.yml +176 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-scan.yml +176 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-undeploy.yml +95 -0
- package/dist/plugins/servers/amazon-linux/index.d.ts +93 -0
- package/dist/plugins/servers/amazon-linux/index.d.ts.map +1 -0
- package/dist/plugins/servers/amazon-linux/index.js +217 -0
- package/dist/plugins/servers/amazon-linux/index.js.map +1 -0
- package/dist/plugins/servers/mac/dev.d.ts +10 -0
- package/dist/plugins/servers/mac/dev.d.ts.map +1 -0
- package/dist/plugins/servers/mac/dev.js +71 -0
- package/dist/plugins/servers/mac/dev.js.map +1 -0
- package/dist/plugins/servers/mac/index.d.ts +101 -0
- package/dist/plugins/servers/mac/index.d.ts.map +1 -0
- package/dist/plugins/servers/mac/index.js +257 -0
- package/dist/plugins/servers/mac/index.js.map +1 -0
- package/dist/plugins/servers/mac/scanfix/config.d.ts +7 -0
- package/dist/plugins/servers/mac/scanfix/config.d.ts.map +1 -0
- package/dist/plugins/servers/mac/scanfix/config.js +168 -0
- package/dist/plugins/servers/mac/scanfix/config.js.map +1 -0
- package/dist/plugins/servers/mac/scanfix/containers.d.ts +7 -0
- package/dist/plugins/servers/mac/scanfix/containers.d.ts.map +1 -0
- package/dist/plugins/servers/mac/scanfix/containers.js +167 -0
- package/dist/plugins/servers/mac/scanfix/containers.js.map +1 -0
- package/dist/plugins/servers/mac/scanfix/system.d.ts +7 -0
- package/dist/plugins/servers/mac/scanfix/system.d.ts.map +1 -0
- package/dist/plugins/servers/mac/scanfix/system.js +144 -0
- package/dist/plugins/servers/mac/scanfix/system.js.map +1 -0
- package/dist/plugins/servers/mac/staging.d.ts +21 -0
- package/dist/plugins/servers/mac/staging.d.ts.map +1 -0
- package/dist/plugins/servers/mac/staging.js +708 -0
- package/dist/plugins/servers/mac/staging.js.map +1 -0
- package/dist/plugins/servers/ubuntu/index.d.ts +93 -0
- package/dist/plugins/servers/ubuntu/index.d.ts.map +1 -0
- package/dist/plugins/servers/ubuntu/index.js +224 -0
- package/dist/plugins/servers/ubuntu/index.js.map +1 -0
- package/dist/plugins/servers/windows/index.d.ts +90 -0
- package/dist/plugins/servers/windows/index.d.ts.map +1 -0
- package/dist/plugins/servers/windows/index.js +205 -0
- package/dist/plugins/servers/windows/index.js.map +1 -0
- package/dist/scanfix/commands/index.d.ts +27 -0
- package/dist/scanfix/commands/index.d.ts.map +1 -0
- package/dist/scanfix/commands/index.js +97 -0
- package/dist/scanfix/commands/index.js.map +1 -0
- package/dist/scanfix/commands/mac.d.ts +11 -0
- package/dist/scanfix/commands/mac.d.ts.map +1 -0
- package/dist/scanfix/commands/mac.js +31 -0
- package/dist/scanfix/commands/mac.js.map +1 -0
- package/dist/scanfix/commands/ubuntu.d.ts +11 -0
- package/dist/scanfix/commands/ubuntu.d.ts.map +1 -0
- package/dist/scanfix/commands/ubuntu.js +30 -0
- package/dist/scanfix/commands/ubuntu.js.map +1 -0
- package/dist/scanfix/fixes/certbot.d.ts +25 -0
- package/dist/scanfix/fixes/certbot.d.ts.map +1 -0
- package/dist/scanfix/fixes/certbot.js +136 -0
- package/dist/scanfix/fixes/certbot.js.map +1 -0
- package/dist/scanfix/fixes/docker.d.ts +29 -0
- package/dist/scanfix/fixes/docker.d.ts.map +1 -0
- package/dist/scanfix/fixes/docker.js +149 -0
- package/dist/scanfix/fixes/docker.js.map +1 -0
- package/dist/scanfix/fixes/git.d.ts +20 -0
- package/dist/scanfix/fixes/git.d.ts.map +1 -0
- package/dist/scanfix/fixes/git.js +71 -0
- package/dist/scanfix/fixes/git.js.map +1 -0
- package/dist/scanfix/fixes/index.d.ts +11 -0
- package/dist/scanfix/fixes/index.d.ts.map +1 -0
- package/dist/scanfix/fixes/index.js +27 -0
- package/dist/scanfix/fixes/index.js.map +1 -0
- package/dist/scanfix/fixes/node.d.ts +20 -0
- package/dist/scanfix/fixes/node.d.ts.map +1 -0
- package/dist/scanfix/fixes/node.js +71 -0
- package/dist/scanfix/fixes/node.js.map +1 -0
- package/dist/scanfix/fixes/pnpm.d.ts +20 -0
- package/dist/scanfix/fixes/pnpm.d.ts.map +1 -0
- package/dist/scanfix/fixes/pnpm.js +122 -0
- package/dist/scanfix/fixes/pnpm.js.map +1 -0
- package/dist/scanfix/index.d.ts +23 -0
- package/dist/scanfix/index.d.ts.map +1 -0
- package/dist/scanfix/index.js +44 -0
- package/dist/scanfix/index.js.map +1 -0
- package/dist/scanfix/platform.d.ts +20 -0
- package/dist/scanfix/platform.d.ts.map +1 -0
- package/dist/scanfix/platform.js +48 -0
- package/dist/scanfix/platform.js.map +1 -0
- package/dist/scanfix/ssl-cert-helper.d.ts +27 -0
- package/dist/scanfix/ssl-cert-helper.d.ts.map +1 -0
- package/dist/scanfix/ssl-cert-helper.js +117 -0
- package/dist/scanfix/ssl-cert-helper.js.map +1 -0
- package/dist/scanfix/types.d.ts +27 -0
- package/dist/scanfix/types.d.ts.map +1 -0
- package/dist/scanfix/types.js +8 -0
- package/dist/scanfix/types.js.map +1 -0
- package/dist/scripts/check-existing-secrets.d.ts +6 -0
- package/dist/scripts/check-existing-secrets.d.ts.map +1 -0
- package/dist/scripts/check-existing-secrets.js +86 -0
- package/dist/scripts/check-existing-secrets.js.map +1 -0
- package/dist/scripts/generate-all.d.ts +40 -0
- package/dist/scripts/generate-all.d.ts.map +1 -0
- package/dist/scripts/generate-all.js +373 -0
- package/dist/scripts/generate-all.js.map +1 -0
- package/dist/scripts/get-repo-name.d.ts +6 -0
- package/dist/scripts/get-repo-name.d.ts.map +1 -0
- package/dist/scripts/get-repo-name.js +54 -0
- package/dist/scripts/get-repo-name.js.map +1 -0
- package/dist/scripts/index.d.ts +7 -0
- package/dist/scripts/index.d.ts.map +1 -0
- package/dist/scripts/index.js +14 -0
- package/dist/scripts/index.js.map +1 -0
- package/dist/scripts/validate-env-files.d.ts +6 -0
- package/dist/scripts/validate-env-files.d.ts.map +1 -0
- package/dist/scripts/validate-env-files.js +126 -0
- package/dist/scripts/validate-env-files.js.map +1 -0
- package/dist/scripts/validate-example-values.d.ts +8 -0
- package/dist/scripts/validate-example-values.d.ts.map +1 -0
- package/dist/scripts/validate-example-values.js +88 -0
- package/dist/scripts/validate-example-values.js.map +1 -0
- package/dist/scripts/validate-factiii-yml.d.ts +6 -0
- package/dist/scripts/validate-factiii-yml.d.ts.map +1 -0
- package/dist/scripts/validate-factiii-yml.js +71 -0
- package/dist/scripts/validate-factiii-yml.js.map +1 -0
- package/dist/types/cli.d.ts +138 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/cli.js +8 -0
- package/dist/types/cli.js.map +1 -0
- package/dist/types/config.d.ts +113 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +8 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/plugin.d.ts +352 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +8 -0
- package/dist/types/plugin.js.map +1 -0
- package/dist/utils/ansible-vault-secrets.d.ts +95 -0
- package/dist/utils/ansible-vault-secrets.d.ts.map +1 -0
- package/dist/utils/ansible-vault-secrets.js +406 -0
- package/dist/utils/ansible-vault-secrets.js.map +1 -0
- package/dist/utils/config-helpers.d.ts +72 -0
- package/dist/utils/config-helpers.d.ts.map +1 -0
- package/dist/utils/config-helpers.js +171 -0
- package/dist/utils/config-helpers.js.map +1 -0
- package/dist/utils/config-schema.d.ts +17 -0
- package/dist/utils/config-schema.d.ts.map +1 -0
- package/dist/utils/config-schema.js +100 -0
- package/dist/utils/config-schema.js.map +1 -0
- package/dist/utils/config-validator.d.ts +29 -0
- package/dist/utils/config-validator.d.ts.map +1 -0
- package/dist/utils/config-validator.js +146 -0
- package/dist/utils/config-validator.js.map +1 -0
- package/dist/utils/deployment-report.d.ts +100 -0
- package/dist/utils/deployment-report.d.ts.map +1 -0
- package/dist/utils/deployment-report.js +225 -0
- package/dist/utils/deployment-report.js.map +1 -0
- package/dist/utils/dns-validator.d.ts +19 -0
- package/dist/utils/dns-validator.d.ts.map +1 -0
- package/dist/utils/dns-validator.js +94 -0
- package/dist/utils/dns-validator.js.map +1 -0
- package/dist/utils/env-validator.d.ts +108 -0
- package/dist/utils/env-validator.d.ts.map +1 -0
- package/dist/utils/env-validator.js +342 -0
- package/dist/utils/env-validator.js.map +1 -0
- package/dist/utils/github-workflow-monitor.d.ts +49 -0
- package/dist/utils/github-workflow-monitor.d.ts.map +1 -0
- package/dist/utils/github-workflow-monitor.js +145 -0
- package/dist/utils/github-workflow-monitor.js.map +1 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +48 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/secret-prompts.d.ts +67 -0
- package/dist/utils/secret-prompts.d.ts.map +1 -0
- package/dist/utils/secret-prompts.js +369 -0
- package/dist/utils/secret-prompts.js.map +1 -0
- package/dist/utils/server-check.d.ts +43 -0
- package/dist/utils/server-check.d.ts.map +1 -0
- package/dist/utils/server-check.js +397 -0
- package/dist/utils/server-check.js.map +1 -0
- package/dist/utils/ssh-deploy.d.ts +70 -0
- package/dist/utils/ssh-deploy.d.ts.map +1 -0
- package/dist/utils/ssh-deploy.js +268 -0
- package/dist/utils/ssh-deploy.js.map +1 -0
- package/dist/utils/ssh-helper.d.ts +40 -0
- package/dist/utils/ssh-helper.d.ts.map +1 -0
- package/dist/utils/ssh-helper.js +221 -0
- package/dist/utils/ssh-helper.js.map +1 -0
- package/dist/utils/template-generator.d.ts +42 -0
- package/dist/utils/template-generator.d.ts.map +1 -0
- package/dist/utils/template-generator.js +223 -0
- package/dist/utils/template-generator.js.map +1 -0
- package/dist/utils/version-check.d.ts +69 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +211 -0
- package/dist/utils/version-check.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GitHub Workflow Monitor
|
|
4
|
+
*
|
|
5
|
+
* Utility for triggering GitHub Actions workflows and monitoring their progress.
|
|
6
|
+
* Uses GitHub CLI (gh) for authentication and API access.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
class GitHubWorkflowMonitor {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.checkGhCli();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check if GitHub CLI is installed and authenticated
|
|
16
|
+
*/
|
|
17
|
+
checkGhCli() {
|
|
18
|
+
try {
|
|
19
|
+
(0, child_process_1.execSync)('which gh', { stdio: 'pipe' });
|
|
20
|
+
// Check if authenticated
|
|
21
|
+
const authStatus = (0, child_process_1.execSync)('gh auth status', {
|
|
22
|
+
stdio: 'pipe',
|
|
23
|
+
encoding: 'utf8',
|
|
24
|
+
});
|
|
25
|
+
if (!authStatus.includes('Logged in')) {
|
|
26
|
+
throw new Error('GitHub CLI not authenticated. Run: gh auth login');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
throw new Error('GitHub CLI not available. Install with: brew install gh');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Trigger a workflow and return the run ID
|
|
35
|
+
*
|
|
36
|
+
* @param workflowFile - The workflow file name (e.g., 'factiii-scan-staging.yml')
|
|
37
|
+
* @param environment - Optional environment name (only used for workflows that accept inputs)
|
|
38
|
+
*/
|
|
39
|
+
async triggerWorkflow(workflowFile, environment) {
|
|
40
|
+
try {
|
|
41
|
+
console.log(`Triggering GitHub Actions workflow...`);
|
|
42
|
+
// Build command - add environment input for workflows that accept it
|
|
43
|
+
let command = `gh workflow run "${workflowFile}"`;
|
|
44
|
+
// Add environment input for workflows that accept it (deploy, fix, scan)
|
|
45
|
+
if (environment && (workflowFile.includes('deploy') || workflowFile.includes('fix') || workflowFile.includes('scan'))) {
|
|
46
|
+
command += ` -f environment="${environment}"`;
|
|
47
|
+
}
|
|
48
|
+
// Trigger the workflow
|
|
49
|
+
(0, child_process_1.execSync)(command, {
|
|
50
|
+
encoding: 'utf8',
|
|
51
|
+
stdio: 'pipe',
|
|
52
|
+
});
|
|
53
|
+
// Wait a moment for the run to be created
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
55
|
+
// Get the latest run ID for this workflow
|
|
56
|
+
const runs = (0, child_process_1.execSync)(`gh run list --workflow="${workflowFile}" --limit=1 --json databaseId,status,conclusion`, { encoding: 'utf8', stdio: 'pipe' });
|
|
57
|
+
const runData = JSON.parse(runs);
|
|
58
|
+
if (runData.length === 0) {
|
|
59
|
+
throw new Error('Failed to find triggered workflow run');
|
|
60
|
+
}
|
|
61
|
+
const firstRun = runData[0];
|
|
62
|
+
if (!firstRun) {
|
|
63
|
+
throw new Error('Failed to find triggered workflow run');
|
|
64
|
+
}
|
|
65
|
+
return firstRun.databaseId;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw new Error(`Failed to trigger workflow: ${error instanceof Error ? error.message : String(error)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Stream logs from a workflow run
|
|
73
|
+
*/
|
|
74
|
+
async streamLogs(runId) {
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
console.log(`Monitoring deployment progress...\n`);
|
|
77
|
+
// Use gh run watch to stream logs
|
|
78
|
+
const watch = (0, child_process_1.spawn)('gh', ['run', 'watch', runId.toString()], {
|
|
79
|
+
stdio: 'inherit',
|
|
80
|
+
});
|
|
81
|
+
watch.on('close', (code) => {
|
|
82
|
+
if (code === 0) {
|
|
83
|
+
resolve({ success: true });
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
resolve({ success: false, exitCode: code ?? undefined });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
watch.on('error', (error) => {
|
|
90
|
+
reject(new Error(`Failed to watch workflow: ${error.message}`));
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get the status of a workflow run
|
|
96
|
+
*/
|
|
97
|
+
async getRunStatus(runId) {
|
|
98
|
+
try {
|
|
99
|
+
const result = (0, child_process_1.execSync)(`gh run view ${runId} --json status,conclusion,url`, {
|
|
100
|
+
encoding: 'utf8',
|
|
101
|
+
stdio: 'pipe',
|
|
102
|
+
});
|
|
103
|
+
return JSON.parse(result);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw new Error(`Failed to get run status: ${error instanceof Error ? error.message : String(error)}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Trigger a workflow and wait for completion with live logs
|
|
111
|
+
*/
|
|
112
|
+
async triggerAndWatch(workflowFile, environment) {
|
|
113
|
+
try {
|
|
114
|
+
// Trigger the workflow
|
|
115
|
+
const runId = await this.triggerWorkflow(workflowFile, environment);
|
|
116
|
+
// Stream logs (just for display - gh run watch exits 0 regardless of workflow result)
|
|
117
|
+
await this.streamLogs(runId);
|
|
118
|
+
// Get final status - THIS determines actual success based on workflow conclusion
|
|
119
|
+
const status = await this.getRunStatus(runId);
|
|
120
|
+
const isSuccess = status.conclusion === 'success';
|
|
121
|
+
console.log('');
|
|
122
|
+
if (isSuccess) {
|
|
123
|
+
console.log(`[OK] Deployment successful!`);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log(`[ERROR] Deployment failed! (${status.conclusion})`);
|
|
127
|
+
}
|
|
128
|
+
console.log(` View full logs: ${status.url}`);
|
|
129
|
+
return {
|
|
130
|
+
success: isSuccess,
|
|
131
|
+
url: status.url,
|
|
132
|
+
runId,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.error(`\n[ERROR] ${error instanceof Error ? error.message : String(error)}`);
|
|
137
|
+
return {
|
|
138
|
+
success: false,
|
|
139
|
+
error: error instanceof Error ? error.message : String(error),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.default = GitHubWorkflowMonitor;
|
|
145
|
+
//# sourceMappingURL=github-workflow-monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-workflow-monitor.js","sourceRoot":"","sources":["../../src/utils/github-workflow-monitor.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities Index
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all utility modules.
|
|
5
|
+
*/
|
|
6
|
+
export * from './ssh-helper.js';
|
|
7
|
+
export * from './config-schema.js';
|
|
8
|
+
export * from './env-validator.js';
|
|
9
|
+
export * from './dns-validator.js';
|
|
10
|
+
export * from './ansible-vault-secrets.js';
|
|
11
|
+
export { getFactiiiVersion, parseVersion, isCompatible, isBreakingUpgrade, readFactiiiAutoVersion, checkVersionCompatibility, displayVersionWarning, } from './version-check.js';
|
|
12
|
+
export * from './template-generator.js';
|
|
13
|
+
export * from './secret-prompts.js';
|
|
14
|
+
export * from './server-check.js';
|
|
15
|
+
export * from './config-validator.js';
|
|
16
|
+
export * from './deployment-report.js';
|
|
17
|
+
export { default as GitHubWorkflowMonitor } from './github-workflow-monitor.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Utilities Index
|
|
4
|
+
*
|
|
5
|
+
* Re-exports all utility modules.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.GitHubWorkflowMonitor = exports.displayVersionWarning = exports.checkVersionCompatibility = exports.readFactiiiAutoVersion = exports.isBreakingUpgrade = exports.isCompatible = exports.parseVersion = exports.getFactiiiVersion = void 0;
|
|
26
|
+
__exportStar(require("./ssh-helper.js"), exports);
|
|
27
|
+
__exportStar(require("./config-schema.js"), exports);
|
|
28
|
+
__exportStar(require("./env-validator.js"), exports);
|
|
29
|
+
__exportStar(require("./dns-validator.js"), exports);
|
|
30
|
+
__exportStar(require("./ansible-vault-secrets.js"), exports);
|
|
31
|
+
// Re-export version-check without conflicting compareVersions
|
|
32
|
+
var version_check_js_1 = require("./version-check.js");
|
|
33
|
+
Object.defineProperty(exports, "getFactiiiVersion", { enumerable: true, get: function () { return version_check_js_1.getFactiiiVersion; } });
|
|
34
|
+
Object.defineProperty(exports, "parseVersion", { enumerable: true, get: function () { return version_check_js_1.parseVersion; } });
|
|
35
|
+
Object.defineProperty(exports, "isCompatible", { enumerable: true, get: function () { return version_check_js_1.isCompatible; } });
|
|
36
|
+
Object.defineProperty(exports, "isBreakingUpgrade", { enumerable: true, get: function () { return version_check_js_1.isBreakingUpgrade; } });
|
|
37
|
+
Object.defineProperty(exports, "readFactiiiAutoVersion", { enumerable: true, get: function () { return version_check_js_1.readFactiiiAutoVersion; } });
|
|
38
|
+
Object.defineProperty(exports, "checkVersionCompatibility", { enumerable: true, get: function () { return version_check_js_1.checkVersionCompatibility; } });
|
|
39
|
+
Object.defineProperty(exports, "displayVersionWarning", { enumerable: true, get: function () { return version_check_js_1.displayVersionWarning; } });
|
|
40
|
+
__exportStar(require("./template-generator.js"), exports);
|
|
41
|
+
__exportStar(require("./secret-prompts.js"), exports);
|
|
42
|
+
__exportStar(require("./server-check.js"), exports);
|
|
43
|
+
__exportStar(require("./config-validator.js"), exports);
|
|
44
|
+
__exportStar(require("./deployment-report.js"), exports);
|
|
45
|
+
var github_workflow_monitor_js_1 = require("./github-workflow-monitor.js");
|
|
46
|
+
Object.defineProperty(exports, "GitHubWorkflowMonitor", { enumerable: true, get: function () { return __importDefault(github_workflow_monitor_js_1).default; } });
|
|
47
|
+
// ssl-cert-helper moved to src/scanfix/ssl-cert-helper.ts
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;AAEH,kDAAgC;AAChC,qDAAmC;AACnC,qDAAmC;AACnC,qDAAmC;AACnC,6DAA2C;AAC3C,8DAA8D;AAC9D,uDAQ4B;AAP1B,qHAAA,iBAAiB,OAAA;AACjB,gHAAA,YAAY,OAAA;AACZ,gHAAA,YAAY,OAAA;AACZ,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,6HAAA,yBAAyB,OAAA;AACzB,yHAAA,qBAAqB,OAAA;AAEvB,0DAAwC;AACxC,sDAAoC;AACpC,oDAAkC;AAClC,wDAAsC;AACtC,yDAAuC;AACvC,2EAAgF;AAAvE,oJAAA,OAAO,OAAyB;AACzC,0DAA0D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret Prompts
|
|
3
|
+
*
|
|
4
|
+
* Interactive prompts for collecting secrets from the user.
|
|
5
|
+
*/
|
|
6
|
+
import type { FactiiiConfig } from '../types/index.js';
|
|
7
|
+
interface ValidationResult {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
}
|
|
12
|
+
interface SecretMetadata {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
helpText: string;
|
|
16
|
+
validation: (value: string) => ValidationResult;
|
|
17
|
+
}
|
|
18
|
+
interface MultiSelectChoice {
|
|
19
|
+
name: string;
|
|
20
|
+
checked: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get secret metadata
|
|
24
|
+
*/
|
|
25
|
+
export declare function getSecretMetadata(secretName: string): SecretMetadata;
|
|
26
|
+
/**
|
|
27
|
+
* Format help text for a secret
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatSecretHelp(secretName: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Validate secret format
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateSecretFormat(secretName: string, value: string): ValidationResult;
|
|
34
|
+
/**
|
|
35
|
+
* Prompt for single-line input
|
|
36
|
+
*/
|
|
37
|
+
export declare function promptSingleLine(prompt: string): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Prompt for multi-line input (for SSH keys)
|
|
40
|
+
*/
|
|
41
|
+
export declare function promptMultiLine(prompt: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Prompt for a secret with validation
|
|
44
|
+
* @param secretName - Name of the secret
|
|
45
|
+
* @param _config - Factiii configuration (optional)
|
|
46
|
+
* @returns Secret value
|
|
47
|
+
*/
|
|
48
|
+
export declare function promptForSecret(secretName: string, _config?: FactiiiConfig): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Prompt for confirmation (yes/no)
|
|
51
|
+
*/
|
|
52
|
+
export declare function confirm(message: string, defaultYes?: boolean): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Multi-select prompt (simplified version)
|
|
55
|
+
* In a real implementation, you'd use a library like 'inquirer'
|
|
56
|
+
* For now, this is a basic implementation
|
|
57
|
+
*/
|
|
58
|
+
export declare function multiSelect(message: string, choices: MultiSelectChoice[]): Promise<string[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Prompt for an environment secret (simpler than SSH keys)
|
|
61
|
+
* @param name - Name of the environment variable
|
|
62
|
+
* @param stage - Stage (staging or prod)
|
|
63
|
+
* @returns Secret value
|
|
64
|
+
*/
|
|
65
|
+
export declare function promptForEnvSecret(name: string, stage: 'staging' | 'prod'): Promise<string>;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=secret-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-prompts.d.ts","sourceRoot":"","sources":["../../src/utils/secret-prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,UAAU,gBAAgB;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,gBAAgB,CAAC;CACjD;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAkGD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAcpE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,gBAAgB,CAGlB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYhE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkC/D;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,aAAmC,GAC3C,OAAO,CAAC,MAAM,CAAC,CA4CjB;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,OAAc,GACzB,OAAO,CAAC,OAAO,CAAC,CA0BlB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,iBAAiB,EAAE,GAC3B,OAAO,CAAC,MAAM,EAAE,CAAC,CAmCnB;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,GAAG,MAAM,GACxB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Secret Prompts
|
|
4
|
+
*
|
|
5
|
+
* Interactive prompts for collecting secrets from the user.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.getSecretMetadata = getSecretMetadata;
|
|
42
|
+
exports.formatSecretHelp = formatSecretHelp;
|
|
43
|
+
exports.validateSecretFormat = validateSecretFormat;
|
|
44
|
+
exports.promptSingleLine = promptSingleLine;
|
|
45
|
+
exports.promptMultiLine = promptMultiLine;
|
|
46
|
+
exports.promptForSecret = promptForSecret;
|
|
47
|
+
exports.confirm = confirm;
|
|
48
|
+
exports.multiSelect = multiSelect;
|
|
49
|
+
exports.promptForEnvSecret = promptForEnvSecret;
|
|
50
|
+
const readline = __importStar(require("readline"));
|
|
51
|
+
/**
|
|
52
|
+
* Secret metadata with help text and validation
|
|
53
|
+
*
|
|
54
|
+
* Simplified secrets (per architecture):
|
|
55
|
+
* - {ENV}_SSH: SSH private key for each environment
|
|
56
|
+
* - AWS_SECRET_ACCESS_KEY: Only truly secret AWS value
|
|
57
|
+
*
|
|
58
|
+
* Not secrets (in factiii.yml):
|
|
59
|
+
* - HOST: environments.{env}.host
|
|
60
|
+
* - AWS_ACCESS_KEY_ID: aws.access_key_id
|
|
61
|
+
* - AWS_REGION: aws.region
|
|
62
|
+
*/
|
|
63
|
+
const SECRET_METADATA = {
|
|
64
|
+
STAGING_SSH: {
|
|
65
|
+
type: 'ssh_key',
|
|
66
|
+
description: 'SSH private key for accessing staging server',
|
|
67
|
+
helpText: `
|
|
68
|
+
Step 1: Generate a new SSH key pair:
|
|
69
|
+
ssh-keygen -t ed25519 -C "staging-deploy" -f ~/.ssh/staging_deploy
|
|
70
|
+
|
|
71
|
+
Step 2: Add PUBLIC key to your staging server:
|
|
72
|
+
ssh-copy-id -i ~/.ssh/staging_deploy.pub ubuntu@YOUR_HOST
|
|
73
|
+
|
|
74
|
+
(HOST is configured in factiii.yml → environments.staging.host)
|
|
75
|
+
|
|
76
|
+
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
77
|
+
cat ~/.ssh/staging_deploy`,
|
|
78
|
+
validation: (value) => {
|
|
79
|
+
if (!value || value.trim().length === 0) {
|
|
80
|
+
return { valid: false, error: 'SSH key cannot be empty' };
|
|
81
|
+
}
|
|
82
|
+
if (!value.includes('BEGIN') || !value.includes('PRIVATE KEY')) {
|
|
83
|
+
return {
|
|
84
|
+
valid: false,
|
|
85
|
+
error: 'Invalid SSH key format (missing BEGIN/PRIVATE KEY markers)',
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return { valid: true };
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
PROD_SSH: {
|
|
92
|
+
type: 'ssh_key',
|
|
93
|
+
description: 'SSH private key for accessing production server',
|
|
94
|
+
helpText: `
|
|
95
|
+
Step 1: Generate a new SSH key pair:
|
|
96
|
+
ssh-keygen -t ed25519 -C "production-deploy" -f ~/.ssh/prod_deploy
|
|
97
|
+
|
|
98
|
+
Step 2: Add PUBLIC key to your production server:
|
|
99
|
+
ssh-copy-id -i ~/.ssh/prod_deploy.pub ubuntu@YOUR_HOST
|
|
100
|
+
|
|
101
|
+
(HOST is configured in factiii.yml → environments.production.host)
|
|
102
|
+
|
|
103
|
+
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
104
|
+
cat ~/.ssh/prod_deploy`,
|
|
105
|
+
validation: (value) => {
|
|
106
|
+
if (!value || value.trim().length === 0) {
|
|
107
|
+
return { valid: false, error: 'SSH key cannot be empty' };
|
|
108
|
+
}
|
|
109
|
+
if (!value.includes('BEGIN') || !value.includes('PRIVATE KEY')) {
|
|
110
|
+
return {
|
|
111
|
+
valid: false,
|
|
112
|
+
error: 'Invalid SSH key format (missing BEGIN/PRIVATE KEY markers)',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return { valid: true };
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
AWS_SECRET_ACCESS_KEY: {
|
|
119
|
+
type: 'aws_secret',
|
|
120
|
+
description: 'AWS Secret Access Key (the only secret AWS value)',
|
|
121
|
+
helpText: `
|
|
122
|
+
Get from AWS Console: IAM → Users → Security credentials
|
|
123
|
+
|
|
124
|
+
This is shown only once when you create the key.
|
|
125
|
+
If lost, you must create a new key pair.
|
|
126
|
+
|
|
127
|
+
Note: AWS_ACCESS_KEY_ID and AWS_REGION go in factiii.yml (not secrets)
|
|
128
|
+
|
|
129
|
+
Enter AWS Secret Access Key:`,
|
|
130
|
+
validation: (value) => {
|
|
131
|
+
if (!value || value.trim().length === 0) {
|
|
132
|
+
return { valid: false, error: 'AWS Secret Access Key cannot be empty' };
|
|
133
|
+
}
|
|
134
|
+
if (value.length !== 40) {
|
|
135
|
+
return {
|
|
136
|
+
valid: false,
|
|
137
|
+
error: 'AWS Secret Access Key should be 40 characters long',
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return { valid: true };
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Get secret metadata
|
|
146
|
+
*/
|
|
147
|
+
function getSecretMetadata(secretName) {
|
|
148
|
+
return (SECRET_METADATA[secretName] ?? {
|
|
149
|
+
type: 'generic',
|
|
150
|
+
description: `GitHub secret: ${secretName}`,
|
|
151
|
+
helpText: `\n Enter value for ${secretName}:`,
|
|
152
|
+
validation: (value) => {
|
|
153
|
+
if (!value || value.trim().length === 0) {
|
|
154
|
+
return { valid: false, error: 'Value cannot be empty' };
|
|
155
|
+
}
|
|
156
|
+
return { valid: true };
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Format help text for a secret
|
|
162
|
+
*/
|
|
163
|
+
function formatSecretHelp(secretName) {
|
|
164
|
+
const metadata = getSecretMetadata(secretName);
|
|
165
|
+
return `\n${secretName}\n\n ${metadata.description}${metadata.helpText}`;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Validate secret format
|
|
169
|
+
*/
|
|
170
|
+
function validateSecretFormat(secretName, value) {
|
|
171
|
+
const metadata = getSecretMetadata(secretName);
|
|
172
|
+
return metadata.validation(value);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Prompt for single-line input
|
|
176
|
+
*/
|
|
177
|
+
function promptSingleLine(prompt) {
|
|
178
|
+
return new Promise((resolve) => {
|
|
179
|
+
const rl = readline.createInterface({
|
|
180
|
+
input: process.stdin,
|
|
181
|
+
output: process.stdout,
|
|
182
|
+
});
|
|
183
|
+
rl.question(prompt, (answer) => {
|
|
184
|
+
rl.close();
|
|
185
|
+
resolve(answer.trim());
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Prompt for multi-line input (for SSH keys)
|
|
191
|
+
*/
|
|
192
|
+
function promptMultiLine(prompt) {
|
|
193
|
+
return new Promise((resolve) => {
|
|
194
|
+
console.log(prompt);
|
|
195
|
+
const lines = [];
|
|
196
|
+
const rl = readline.createInterface({
|
|
197
|
+
input: process.stdin,
|
|
198
|
+
output: process.stdout,
|
|
199
|
+
terminal: false,
|
|
200
|
+
});
|
|
201
|
+
// Set stdin to raw mode to detect blank lines
|
|
202
|
+
if (process.stdin.isTTY) {
|
|
203
|
+
process.stdin.setRawMode(false);
|
|
204
|
+
}
|
|
205
|
+
rl.on('line', (line) => {
|
|
206
|
+
// Empty line signals end of input
|
|
207
|
+
if (line.trim() === '' && lines.length > 0) {
|
|
208
|
+
rl.close();
|
|
209
|
+
resolve(lines.join('\n'));
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
lines.push(line);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
rl.on('close', () => {
|
|
216
|
+
if (lines.length > 0) {
|
|
217
|
+
resolve(lines.join('\n'));
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
resolve('');
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Prompt for a secret with validation
|
|
227
|
+
* @param secretName - Name of the secret
|
|
228
|
+
* @param _config - Factiii configuration (optional)
|
|
229
|
+
* @returns Secret value
|
|
230
|
+
*/
|
|
231
|
+
async function promptForSecret(secretName, _config = {}) {
|
|
232
|
+
const metadata = getSecretMetadata(secretName);
|
|
233
|
+
// Show help text
|
|
234
|
+
console.log(formatSecretHelp(secretName));
|
|
235
|
+
let value = '';
|
|
236
|
+
let isValid = false;
|
|
237
|
+
let attempts = 0;
|
|
238
|
+
const maxAttempts = 3;
|
|
239
|
+
while (!isValid && attempts < maxAttempts) {
|
|
240
|
+
attempts++;
|
|
241
|
+
// Prompt based on type
|
|
242
|
+
if (metadata.type === 'ssh_key') {
|
|
243
|
+
value = await promptMultiLine('');
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
value = await promptSingleLine(' > ');
|
|
247
|
+
}
|
|
248
|
+
// Validate
|
|
249
|
+
const validation = validateSecretFormat(secretName, value);
|
|
250
|
+
if (validation.valid) {
|
|
251
|
+
isValid = true;
|
|
252
|
+
// Use default value if provided
|
|
253
|
+
if (validation.defaultValue && (!value || value.trim().length === 0)) {
|
|
254
|
+
value = validation.defaultValue;
|
|
255
|
+
console.log(` Using default: ${value}`);
|
|
256
|
+
}
|
|
257
|
+
console.log(' [OK] Valid input\n');
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
console.error(` [ERROR] ${validation.error}`);
|
|
261
|
+
if (attempts < maxAttempts) {
|
|
262
|
+
console.log(` Please try again (${attempts}/${maxAttempts})...\n`);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
console.error(' Maximum attempts reached. Exiting.\n');
|
|
266
|
+
process.exit(1);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return value;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Prompt for confirmation (yes/no)
|
|
274
|
+
*/
|
|
275
|
+
async function confirm(message, defaultYes = true) {
|
|
276
|
+
const rl = readline.createInterface({
|
|
277
|
+
input: process.stdin,
|
|
278
|
+
output: process.stdout,
|
|
279
|
+
});
|
|
280
|
+
return new Promise((resolve) => {
|
|
281
|
+
const prompt = defaultYes ? `${message} (Y/n) ` : `${message} (y/N) `;
|
|
282
|
+
rl.question(prompt, (answer) => {
|
|
283
|
+
rl.close();
|
|
284
|
+
const normalized = answer.trim().toLowerCase();
|
|
285
|
+
if (normalized === '') {
|
|
286
|
+
resolve(defaultYes);
|
|
287
|
+
}
|
|
288
|
+
else if (normalized === 'y' || normalized === 'yes') {
|
|
289
|
+
resolve(true);
|
|
290
|
+
}
|
|
291
|
+
else if (normalized === 'n' || normalized === 'no') {
|
|
292
|
+
resolve(false);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
// Invalid input, use default
|
|
296
|
+
resolve(defaultYes);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Multi-select prompt (simplified version)
|
|
303
|
+
* In a real implementation, you'd use a library like 'inquirer'
|
|
304
|
+
* For now, this is a basic implementation
|
|
305
|
+
*/
|
|
306
|
+
async function multiSelect(message, choices) {
|
|
307
|
+
console.log(`\n${message}`);
|
|
308
|
+
console.log(' (Enter numbers separated by spaces, or "all" for all missing)\n');
|
|
309
|
+
// Display choices with numbers
|
|
310
|
+
choices.forEach((choice, index) => {
|
|
311
|
+
const status = choice.checked ? '[!] missing' : '[OK] exists';
|
|
312
|
+
console.log(` ${index + 1}. ${choice.name} (${status})`);
|
|
313
|
+
});
|
|
314
|
+
const answer = await promptSingleLine('\n Select: ');
|
|
315
|
+
// Handle "all" or "missing"
|
|
316
|
+
if (answer.toLowerCase() === 'all') {
|
|
317
|
+
return choices.map((c) => c.name);
|
|
318
|
+
}
|
|
319
|
+
if (answer.toLowerCase() === 'missing') {
|
|
320
|
+
return choices.filter((c) => c.checked).map((c) => c.name);
|
|
321
|
+
}
|
|
322
|
+
// Parse numbers
|
|
323
|
+
const selected = [];
|
|
324
|
+
const numbers = answer.split(/[\s,]+/).map((n) => parseInt(n.trim()));
|
|
325
|
+
for (const num of numbers) {
|
|
326
|
+
if (num > 0 && num <= choices.length) {
|
|
327
|
+
const choice = choices[num - 1];
|
|
328
|
+
if (choice) {
|
|
329
|
+
selected.push(choice.name);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return selected;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Prompt for an environment secret (simpler than SSH keys)
|
|
337
|
+
* @param name - Name of the environment variable
|
|
338
|
+
* @param stage - Stage (staging or prod)
|
|
339
|
+
* @returns Secret value
|
|
340
|
+
*/
|
|
341
|
+
async function promptForEnvSecret(name, stage) {
|
|
342
|
+
console.log(`\nSetting ${name} for ${stage}`);
|
|
343
|
+
console.log(` Enter the value for this environment variable.`);
|
|
344
|
+
console.log(` (This will be stored in Ansible Vault and deployed to the server)\n`);
|
|
345
|
+
let value = '';
|
|
346
|
+
let isValid = false;
|
|
347
|
+
let attempts = 0;
|
|
348
|
+
const maxAttempts = 3;
|
|
349
|
+
while (!isValid && attempts < maxAttempts) {
|
|
350
|
+
attempts++;
|
|
351
|
+
value = await promptSingleLine(' > ');
|
|
352
|
+
if (value && value.trim().length > 0) {
|
|
353
|
+
isValid = true;
|
|
354
|
+
console.log(' [OK] Value set\n');
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
console.error(' [ERROR] Value cannot be empty');
|
|
358
|
+
if (attempts < maxAttempts) {
|
|
359
|
+
console.log(` Please try again (${attempts}/${maxAttempts})...\n`);
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
console.error(' Maximum attempts reached. Exiting.\n');
|
|
363
|
+
process.exit(1);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return value;
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=secret-prompts.js.map
|