@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,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SSH Deploy Helper
|
|
4
|
+
*
|
|
5
|
+
* Utility for deploying secrets to remote servers via SSH.
|
|
6
|
+
* Used by the `factiii secrets deploy` command to write .env files
|
|
7
|
+
* directly from the dev laptop to staging/prod servers.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.SSHDeploy = void 0;
|
|
44
|
+
const child_process_1 = require("child_process");
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const os = __importStar(require("os"));
|
|
48
|
+
/**
|
|
49
|
+
* SSH Deploy - handles secure deployment of secrets to remote servers
|
|
50
|
+
*/
|
|
51
|
+
class SSHDeploy {
|
|
52
|
+
host;
|
|
53
|
+
user;
|
|
54
|
+
privateKey;
|
|
55
|
+
repoName;
|
|
56
|
+
keyPath = null;
|
|
57
|
+
constructor(config) {
|
|
58
|
+
this.host = config.host;
|
|
59
|
+
this.user = config.user;
|
|
60
|
+
this.privateKey = config.privateKey;
|
|
61
|
+
this.repoName = config.repoName;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Write SSH key to temp file and return path
|
|
65
|
+
*/
|
|
66
|
+
setupSSHKey() {
|
|
67
|
+
const keyPath = path.join(os.tmpdir(), `factiii-deploy-key-${Date.now()}`);
|
|
68
|
+
// Ensure key ends with newline (SSH requirement)
|
|
69
|
+
let key = this.privateKey;
|
|
70
|
+
if (!key.endsWith('\n')) {
|
|
71
|
+
key += '\n';
|
|
72
|
+
}
|
|
73
|
+
fs.writeFileSync(keyPath, key, { mode: 0o600 });
|
|
74
|
+
this.keyPath = keyPath;
|
|
75
|
+
return keyPath;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Clean up temporary SSH key file
|
|
79
|
+
*/
|
|
80
|
+
cleanupSSHKey() {
|
|
81
|
+
if (this.keyPath && fs.existsSync(this.keyPath)) {
|
|
82
|
+
try {
|
|
83
|
+
fs.unlinkSync(this.keyPath);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// ignore cleanup errors
|
|
87
|
+
}
|
|
88
|
+
this.keyPath = null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Execute SSH command
|
|
93
|
+
*/
|
|
94
|
+
sshExec(command) {
|
|
95
|
+
const keyPath = this.keyPath ?? this.setupSSHKey();
|
|
96
|
+
// Build SSH command with strict options
|
|
97
|
+
const sshCmd = [
|
|
98
|
+
'ssh',
|
|
99
|
+
'-i', `"${keyPath}"`,
|
|
100
|
+
'-o', 'StrictHostKeyChecking=no',
|
|
101
|
+
'-o', 'UserKnownHostsFile=/dev/null',
|
|
102
|
+
'-o', 'BatchMode=yes',
|
|
103
|
+
'-o', 'ConnectTimeout=30',
|
|
104
|
+
`"${this.user}@${this.host}"`,
|
|
105
|
+
`"${command.replace(/"/g, '\\"')}"`,
|
|
106
|
+
].join(' ');
|
|
107
|
+
try {
|
|
108
|
+
return (0, child_process_1.execSync)(sshCmd, {
|
|
109
|
+
encoding: 'utf8',
|
|
110
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
catch (e) {
|
|
114
|
+
const error = e;
|
|
115
|
+
throw new Error(`SSH command failed: ${error.stderr || error.message}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Test SSH connection to server
|
|
120
|
+
*/
|
|
121
|
+
async testConnection() {
|
|
122
|
+
try {
|
|
123
|
+
this.setupSSHKey();
|
|
124
|
+
this.sshExec('echo "Connection test"');
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
this.cleanupSSHKey();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Convert environment variables to .env file format
|
|
136
|
+
*/
|
|
137
|
+
envToFileContent(envVars) {
|
|
138
|
+
const lines = [];
|
|
139
|
+
lines.push('# Environment variables - deployed by factiii secrets');
|
|
140
|
+
lines.push(`# Last updated: ${new Date().toISOString()}`);
|
|
141
|
+
lines.push('');
|
|
142
|
+
for (const [key, value] of Object.entries(envVars)) {
|
|
143
|
+
// Quote values that contain spaces, special chars, or are multi-line
|
|
144
|
+
const needsQuotes = /[\s"'$`\\]/.test(value) || value.includes('\n');
|
|
145
|
+
if (needsQuotes) {
|
|
146
|
+
// Use double quotes and escape inner double quotes and backslashes
|
|
147
|
+
const escaped = value
|
|
148
|
+
.replace(/\\/g, '\\\\')
|
|
149
|
+
.replace(/"/g, '\\"')
|
|
150
|
+
.replace(/\n/g, '\\n');
|
|
151
|
+
lines.push(`${key}="${escaped}"`);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
lines.push(`${key}=${value}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return lines.join('\n') + '\n';
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Write .env file to server
|
|
161
|
+
*/
|
|
162
|
+
async writeEnvFile(stage, envVars) {
|
|
163
|
+
try {
|
|
164
|
+
this.setupSSHKey();
|
|
165
|
+
const envContent = this.envToFileContent(envVars);
|
|
166
|
+
const envFileName = `.env.${stage}`;
|
|
167
|
+
const factiiiDir = `\\$HOME/.factiii/${this.repoName}`;
|
|
168
|
+
const envFilePath = `${factiiiDir}/${envFileName}`;
|
|
169
|
+
// Create directory if it doesn't exist, then write the file
|
|
170
|
+
// Use heredoc to safely pass content with special characters
|
|
171
|
+
const escapedContent = envContent
|
|
172
|
+
.replace(/\\/g, '\\\\')
|
|
173
|
+
.replace(/'/g, "'\\''");
|
|
174
|
+
const command = `mkdir -p ${factiiiDir} && cat > ${envFilePath} << 'FACTIII_ENV_EOF'
|
|
175
|
+
${envContent}FACTIII_ENV_EOF
|
|
176
|
+
chmod 600 ${envFilePath}`;
|
|
177
|
+
this.sshExec(command);
|
|
178
|
+
const keyCount = Object.keys(envVars).length;
|
|
179
|
+
return {
|
|
180
|
+
success: true,
|
|
181
|
+
message: `Wrote ${keyCount} environment variables to ${envFilePath} on ${this.host}`,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
catch (e) {
|
|
185
|
+
return {
|
|
186
|
+
success: false,
|
|
187
|
+
error: e instanceof Error ? e.message : String(e),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
this.cleanupSSHKey();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Restart container on server
|
|
196
|
+
*/
|
|
197
|
+
async restartContainer(containerName) {
|
|
198
|
+
try {
|
|
199
|
+
this.setupSSHKey();
|
|
200
|
+
const command = `docker restart ${containerName}`;
|
|
201
|
+
this.sshExec(command);
|
|
202
|
+
return {
|
|
203
|
+
success: true,
|
|
204
|
+
message: `Restarted container ${containerName}`,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
catch (e) {
|
|
208
|
+
return {
|
|
209
|
+
success: false,
|
|
210
|
+
error: e instanceof Error ? e.message : String(e),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
this.cleanupSSHKey();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Check if env file exists on server
|
|
219
|
+
*/
|
|
220
|
+
async checkEnvFileExists(stage) {
|
|
221
|
+
try {
|
|
222
|
+
this.setupSSHKey();
|
|
223
|
+
const envFileName = `.env.${stage}`;
|
|
224
|
+
const factiiiDir = `\\$HOME/.factiii/${this.repoName}`;
|
|
225
|
+
const envFilePath = `${factiiiDir}/${envFileName}`;
|
|
226
|
+
const command = `test -f ${envFilePath} && echo "exists" || echo "missing"`;
|
|
227
|
+
const result = this.sshExec(command).trim();
|
|
228
|
+
return result === 'exists';
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
finally {
|
|
234
|
+
this.cleanupSSHKey();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Get last modified time of env file on server
|
|
239
|
+
*/
|
|
240
|
+
async getEnvFileInfo(stage) {
|
|
241
|
+
try {
|
|
242
|
+
this.setupSSHKey();
|
|
243
|
+
const envFileName = `.env.${stage}`;
|
|
244
|
+
const factiiiDir = `\\$HOME/.factiii/${this.repoName}`;
|
|
245
|
+
const envFilePath = `${factiiiDir}/${envFileName}`;
|
|
246
|
+
// Cross-platform: macOS uses `stat -f %m`, Linux uses `stat -c %Y`
|
|
247
|
+
const command = `stat -f %m ${envFilePath} 2>/dev/null || stat -c %Y ${envFilePath} 2>/dev/null || echo "missing"`;
|
|
248
|
+
const result = this.sshExec(command).trim();
|
|
249
|
+
if (result === 'missing') {
|
|
250
|
+
return { exists: false };
|
|
251
|
+
}
|
|
252
|
+
const timestamp = parseInt(result, 10);
|
|
253
|
+
return {
|
|
254
|
+
exists: true,
|
|
255
|
+
modified: new Date(timestamp * 1000),
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return { exists: false };
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
this.cleanupSSHKey();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
exports.SSHDeploy = SSHDeploy;
|
|
267
|
+
exports.default = SSHDeploy;
|
|
268
|
+
//# sourceMappingURL=ssh-deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-deploy.js","sourceRoot":"","sources":["../../src/utils/ssh-deploy.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAAyC;AACzC,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAezB;;GAEG;AACH,MAAa,SAAS;IACV,IAAI,CAAS;IACb,IAAI,CAAS;IACb,UAAU,CAAS;IACnB,QAAQ,CAAS;IACjB,OAAO,GAAkB,IAAI,CAAC;IAEtC,YAAY,MAAuB;QAC/B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,MAAM,CA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,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;CACJ;AA1OD,8BA0OC;AAED,kBAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { EnvironmentConfig, FactiiiConfig, Stage } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Find the SSH key path for a given stage.
|
|
4
|
+
* Only returns stage-specific deploy keys — no generic key fallback.
|
|
5
|
+
*
|
|
6
|
+
* @param stage - The deployment stage (staging, prod, mac)
|
|
7
|
+
* @returns Absolute path to SSH key, or null if none found
|
|
8
|
+
*/
|
|
9
|
+
export declare function findSshKeyForStage(stage: string): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Get the EnvironmentConfig for a given stage from factiii.yml config.
|
|
12
|
+
* Returns the first environment matching the stage.
|
|
13
|
+
*
|
|
14
|
+
* @param stage - The deployment stage (staging, prod)
|
|
15
|
+
* @param config - Parsed factiii.yml config
|
|
16
|
+
* @returns EnvironmentConfig with domain and ssh_user, or null
|
|
17
|
+
*/
|
|
18
|
+
export declare function getEnvConfigForStage(stage: Stage, config: FactiiiConfig): EnvironmentConfig | null;
|
|
19
|
+
/**
|
|
20
|
+
* Execute a Factiii CLI command on a remote server via direct SSH.
|
|
21
|
+
* Used by scan.ts, fix.ts, and deployStage() when canReach returns via: 'ssh'.
|
|
22
|
+
*
|
|
23
|
+
* @param stage - Target stage (staging, prod)
|
|
24
|
+
* @param config - Parsed factiii.yml config
|
|
25
|
+
* @param command - The factiii CLI command to run (e.g., 'scan --staging', 'fix --prod')
|
|
26
|
+
* @returns Object with success, stdout, and stderr
|
|
27
|
+
*/
|
|
28
|
+
export declare function sshRemoteFactiiiCommand(stage: Stage, config: FactiiiConfig, command: string): {
|
|
29
|
+
success: boolean;
|
|
30
|
+
stdout: string;
|
|
31
|
+
stderr: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Execute a command on a remote server via SSH
|
|
35
|
+
* @param envConfig - Environment config with host and ssh_user
|
|
36
|
+
* @param command - Command to execute
|
|
37
|
+
* @returns Command output
|
|
38
|
+
*/
|
|
39
|
+
export declare function sshExec(envConfig: EnvironmentConfig, command: string): Promise<string>;
|
|
40
|
+
//# sourceMappingURL=ssh-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-helper.d.ts","sourceRoot":"","sources":["../../src/utils/ssh-helper.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAajF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY/D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,aAAa,GACpB,iBAAiB,GAAG,IAAI,CAc1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,GACd;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAuEtD;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAC3B,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAkDjB"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.findSshKeyForStage = findSshKeyForStage;
|
|
37
|
+
exports.getEnvConfigForStage = getEnvConfigForStage;
|
|
38
|
+
exports.sshRemoteFactiiiCommand = sshRemoteFactiiiCommand;
|
|
39
|
+
exports.sshExec = sshExec;
|
|
40
|
+
/**
|
|
41
|
+
* SSH Helper Utility
|
|
42
|
+
*
|
|
43
|
+
* Shared SSH execution logic for pipeline and server plugins.
|
|
44
|
+
* Provides a consistent way to execute commands on remote servers.
|
|
45
|
+
*
|
|
46
|
+
* Supports environment-specific deploy keys only:
|
|
47
|
+
* - ~/.ssh/staging_deploy_key, ~/.ssh/prod_deploy_key, ~/.ssh/mac_deploy_key
|
|
48
|
+
* - Generated by: npx factiii secrets write-ssh-keys
|
|
49
|
+
*/
|
|
50
|
+
const child_process_1 = require("child_process");
|
|
51
|
+
const os = __importStar(require("os"));
|
|
52
|
+
const path = __importStar(require("path"));
|
|
53
|
+
const fs = __importStar(require("fs"));
|
|
54
|
+
const config_helpers_js_1 = require("./config-helpers.js");
|
|
55
|
+
/**
|
|
56
|
+
* Map of stage names to their environment-specific SSH key filenames.
|
|
57
|
+
* These keys are extracted from Ansible Vault by `npx factiii secrets write-ssh-keys`.
|
|
58
|
+
*/
|
|
59
|
+
const STAGE_KEY_MAP = {
|
|
60
|
+
staging: ['staging_deploy_key'],
|
|
61
|
+
prod: ['prod_deploy_key'],
|
|
62
|
+
mac: ['mac_deploy_key'],
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Find the SSH key path for a given stage.
|
|
66
|
+
* Only returns stage-specific deploy keys — no generic key fallback.
|
|
67
|
+
*
|
|
68
|
+
* @param stage - The deployment stage (staging, prod, mac)
|
|
69
|
+
* @returns Absolute path to SSH key, or null if none found
|
|
70
|
+
*/
|
|
71
|
+
function findSshKeyForStage(stage) {
|
|
72
|
+
const sshDir = path.join(os.homedir(), '.ssh');
|
|
73
|
+
const stageKeys = STAGE_KEY_MAP[stage] ?? [];
|
|
74
|
+
for (const keyName of stageKeys) {
|
|
75
|
+
const keyPath = path.join(sshDir, keyName);
|
|
76
|
+
if (fs.existsSync(keyPath)) {
|
|
77
|
+
return keyPath;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get the EnvironmentConfig for a given stage from factiii.yml config.
|
|
84
|
+
* Returns the first environment matching the stage.
|
|
85
|
+
*
|
|
86
|
+
* @param stage - The deployment stage (staging, prod)
|
|
87
|
+
* @param config - Parsed factiii.yml config
|
|
88
|
+
* @returns EnvironmentConfig with domain and ssh_user, or null
|
|
89
|
+
*/
|
|
90
|
+
function getEnvConfigForStage(stage, config) {
|
|
91
|
+
const environments = (0, config_helpers_js_1.extractEnvironments)(config);
|
|
92
|
+
for (const [envName, envConfig] of Object.entries(environments)) {
|
|
93
|
+
try {
|
|
94
|
+
if ((0, config_helpers_js_1.getStageFromEnvironment)(envName) === stage) {
|
|
95
|
+
return envConfig;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Execute a Factiii CLI command on a remote server via direct SSH.
|
|
106
|
+
* Used by scan.ts, fix.ts, and deployStage() when canReach returns via: 'ssh'.
|
|
107
|
+
*
|
|
108
|
+
* @param stage - Target stage (staging, prod)
|
|
109
|
+
* @param config - Parsed factiii.yml config
|
|
110
|
+
* @param command - The factiii CLI command to run (e.g., 'scan --staging', 'fix --prod')
|
|
111
|
+
* @returns Object with success, stdout, and stderr
|
|
112
|
+
*/
|
|
113
|
+
function sshRemoteFactiiiCommand(stage, config, command) {
|
|
114
|
+
const envConfig = getEnvConfigForStage(stage, config);
|
|
115
|
+
if (!envConfig) {
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
stdout: '',
|
|
119
|
+
stderr: 'No environment config found for stage: ' + stage,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const host = envConfig.domain;
|
|
123
|
+
const user = envConfig.ssh_user ?? 'root';
|
|
124
|
+
const keyPath = findSshKeyForStage(stage);
|
|
125
|
+
if (!keyPath) {
|
|
126
|
+
return {
|
|
127
|
+
success: false,
|
|
128
|
+
stdout: '',
|
|
129
|
+
stderr: 'No SSH key found at ' + path.join(os.homedir(), '.ssh', stage + '_deploy_key') + '. Run: npx factiii secrets write-ssh-keys',
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (!host) {
|
|
133
|
+
return {
|
|
134
|
+
success: false,
|
|
135
|
+
stdout: '',
|
|
136
|
+
stderr: 'No domain configured for stage: ' + stage + '. Check factiii.yml environments.',
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Build the remote command
|
|
140
|
+
// Run inside the factiii repo directory on the server
|
|
141
|
+
// $HOME is expanded by the remote shell, supporting non-root users
|
|
142
|
+
const repoName = config.name || 'app';
|
|
143
|
+
const remoteCommand = 'export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH" && export FACTIII_ON_SERVER=true && cd $HOME/.factiii/' + repoName + ' && npx factiii ' + command;
|
|
144
|
+
console.log(' SSH: ' + user + '@' + host + ' → npx factiii ' + command);
|
|
145
|
+
console.log(' Connecting to ' + host + '... (timeout: 10min)');
|
|
146
|
+
const startTime = Date.now();
|
|
147
|
+
const result = (0, child_process_1.spawnSync)('ssh', [
|
|
148
|
+
'-i', keyPath,
|
|
149
|
+
'-o', 'StrictHostKeyChecking=no',
|
|
150
|
+
'-o', 'ConnectTimeout=10',
|
|
151
|
+
'-o', 'ServerAliveInterval=60',
|
|
152
|
+
'-o', 'ServerAliveCountMax=5',
|
|
153
|
+
user + '@' + host,
|
|
154
|
+
remoteCommand,
|
|
155
|
+
], {
|
|
156
|
+
encoding: 'utf8',
|
|
157
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
158
|
+
timeout: 600000, // 10 minute timeout for long-running operations
|
|
159
|
+
});
|
|
160
|
+
const elapsed = Math.floor((Date.now() - startTime) / 1000);
|
|
161
|
+
console.log(' SSH completed in ' + elapsed + 's');
|
|
162
|
+
// Print output in real-time style
|
|
163
|
+
if (result.stdout) {
|
|
164
|
+
process.stdout.write(result.stdout);
|
|
165
|
+
}
|
|
166
|
+
if (result.stderr) {
|
|
167
|
+
process.stderr.write(result.stderr);
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
success: result.status === 0,
|
|
171
|
+
stdout: result.stdout ?? '',
|
|
172
|
+
stderr: result.stderr ?? '',
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Execute a command on a remote server via SSH
|
|
177
|
+
* @param envConfig - Environment config with host and ssh_user
|
|
178
|
+
* @param command - Command to execute
|
|
179
|
+
* @returns Command output
|
|
180
|
+
*/
|
|
181
|
+
async function sshExec(envConfig, command) {
|
|
182
|
+
// ============================================================
|
|
183
|
+
// CRITICAL: Detect if we're already on the server
|
|
184
|
+
// ============================================================
|
|
185
|
+
// When GITHUB_ACTIONS=true or FACTIII_ON_SERVER=true, we're executing
|
|
186
|
+
// on the server itself. Run commands locally instead of trying to SSH.
|
|
187
|
+
// ============================================================
|
|
188
|
+
if (process.env.GITHUB_ACTIONS === 'true' || process.env.FACTIII_ON_SERVER === 'true') {
|
|
189
|
+
// We're already on the server - run command locally
|
|
190
|
+
const result = (0, child_process_1.execSync)(command, { encoding: 'utf8', stdio: 'pipe' });
|
|
191
|
+
return result.trim();
|
|
192
|
+
}
|
|
193
|
+
// Running from dev machine - SSH to server
|
|
194
|
+
const host = envConfig.domain;
|
|
195
|
+
const user = envConfig.ssh_user ?? 'ubuntu';
|
|
196
|
+
// Only use environment-specific deploy keys (no generic key fallback)
|
|
197
|
+
const keyPaths = [
|
|
198
|
+
path.join(os.homedir(), '.ssh', 'staging_deploy_key'),
|
|
199
|
+
path.join(os.homedir(), '.ssh', 'prod_deploy_key'),
|
|
200
|
+
path.join(os.homedir(), '.ssh', 'mac_deploy_key'),
|
|
201
|
+
];
|
|
202
|
+
let keyPath = null;
|
|
203
|
+
for (const kp of keyPaths) {
|
|
204
|
+
if (fs.existsSync(kp)) {
|
|
205
|
+
keyPath = kp;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (!keyPath) {
|
|
210
|
+
throw new Error('No SSH key found. Add a deploy key to ~/.ssh/ or run: npx factiii secrets write-ssh-keys');
|
|
211
|
+
}
|
|
212
|
+
const result = (0, child_process_1.execSync)('ssh -i ' + keyPath +
|
|
213
|
+
' -o StrictHostKeyChecking=no' +
|
|
214
|
+
' -o ConnectTimeout=10' +
|
|
215
|
+
' -o ServerAliveInterval=60' +
|
|
216
|
+
' -o ServerAliveCountMax=5' +
|
|
217
|
+
' ' + user + '@' + host +
|
|
218
|
+
' "' + command.replace(/"/g, '\\"') + '"', { encoding: 'utf8', stdio: 'pipe' });
|
|
219
|
+
return result.trim();
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=ssh-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-helper.js","sourceRoot":"","sources":["../../src/utils/ssh-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,gDAYC;AAUD,oDAiBC;AAWD,0DA2EC;AAQD,0BAqDC;AA7ND;;;;;;;;;GASG;AACH,iDAAoD;AACpD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAGzB,2DAAmF;AAEnF;;;GAGG;AACH,MAAM,aAAa,GAA6B;IAC9C,OAAO,EAAE,CAAC,oBAAoB,CAAC;IAC/B,IAAI,EAAE,CAAC,iBAAiB,CAAC;IACzB,GAAG,EAAE,CAAC,gBAAgB,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IAE/C,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7C,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC3C,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,IAAI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gBAAgB,CAAC;KAClD,CAAC;IAEF,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC1B,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;YACtB,OAAO,GAAG,EAAE,CAAC;YACb,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,wBAAQ,EACrB,SAAS,GAAG,OAAO;QACnB,8BAA8B;QAC9B,uBAAuB;QACvB,4BAA4B;QAC5B,2BAA2B;QAC3B,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI;QACvB,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,EACzC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CACpC,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates template files for environment configuration.
|
|
5
|
+
*/
|
|
6
|
+
import type { FactiiiConfig } from '../types/index.js';
|
|
7
|
+
interface EnvVars {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
}
|
|
10
|
+
interface TemplateCreationError {
|
|
11
|
+
file: string;
|
|
12
|
+
error: string;
|
|
13
|
+
}
|
|
14
|
+
interface TemplateCreationResult {
|
|
15
|
+
created: string[];
|
|
16
|
+
skipped: string[];
|
|
17
|
+
errors: TemplateCreationError[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate .env.example template file content
|
|
21
|
+
* @param config - Parsed factiii.yml configuration
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateEnvExampleTemplate(config: FactiiiConfig): string;
|
|
24
|
+
/**
|
|
25
|
+
* Generate .env template file content for staging/prod
|
|
26
|
+
* Copies structure from .env.example with placeholder values
|
|
27
|
+
* @param environment - 'staging' or 'prod'
|
|
28
|
+
* @param devEnv - Parsed .env.example key-value pairs
|
|
29
|
+
*/
|
|
30
|
+
export declare function generateEnvTemplate(environment: string, devEnv: EnvVars): string;
|
|
31
|
+
/**
|
|
32
|
+
* Create .env template files if they don't exist
|
|
33
|
+
* @param rootDir - Repository root directory
|
|
34
|
+
* @param config - Parsed factiii.yml configuration
|
|
35
|
+
*/
|
|
36
|
+
export declare function createEnvTemplates(rootDir: string, config: FactiiiConfig): TemplateCreationResult;
|
|
37
|
+
/**
|
|
38
|
+
* Generate secrets checklist for display
|
|
39
|
+
*/
|
|
40
|
+
export declare function generateSecretsChecklist(): string;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=template-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-generator.d.ts","sourceRoot":"","sources":["../../src/utils/template-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,UAAU,OAAO;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA+CxE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CA8BhF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,aAAa,GACpB,sBAAsB,CAgExB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAuBjD"}
|