@factiii/stack 0.1.201 → 0.1.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +403 -403
  3. package/bin/stack +334 -334
  4. package/dist/cli/dev-sync.js +16 -16
  5. package/dist/plugins/addons/auth/index.js +7 -7
  6. package/dist/plugins/addons/vercel/index.js +9 -9
  7. package/dist/plugins/addons/vercel/scanfix/config.js +10 -10
  8. package/dist/plugins/addons/vercel/scanfix/token.js +15 -15
  9. package/dist/plugins/approved.json +13 -13
  10. package/dist/plugins/pipelines/aws/index.js +12 -12
  11. package/dist/plugins/pipelines/aws/policies/bootstrap-policy.json +135 -135
  12. package/dist/plugins/pipelines/aws/prod.js +1 -1
  13. package/dist/plugins/pipelines/factiii/index.d.ts.map +1 -1
  14. package/dist/plugins/pipelines/factiii/index.js +2 -14
  15. package/dist/plugins/pipelines/factiii/index.js.map +1 -1
  16. package/dist/plugins/pipelines/factiii/prod.js +21 -21
  17. package/dist/plugins/pipelines/factiii/scanfix/port-convention.d.ts.map +1 -1
  18. package/dist/plugins/pipelines/factiii/scanfix/port-convention.js +2 -4
  19. package/dist/plugins/pipelines/factiii/scanfix/port-convention.js.map +1 -1
  20. package/dist/plugins/pipelines/factiii/staging.js +23 -23
  21. package/dist/plugins/pipelines/factiii/workflows/stack-ci.yml +75 -75
  22. package/dist/plugins/pipelines/factiii/workflows/stack-cicd-prod.yml +73 -73
  23. package/dist/plugins/servers/amazon-linux/index.js +16 -16
  24. package/dist/plugins/servers/mac/index.js +12 -12
  25. package/dist/plugins/servers/mac/staging.js +2 -2
  26. package/dist/plugins/servers/ubuntu/index.js +23 -23
  27. package/dist/plugins/servers/windows/index.js +15 -15
  28. package/dist/scanfix/commands/mac.d.ts.map +1 -1
  29. package/dist/scanfix/commands/mac.js +5 -4
  30. package/dist/scanfix/commands/mac.js.map +1 -1
  31. package/dist/scanfix/fixes/certbot.d.ts.map +1 -1
  32. package/dist/scanfix/fixes/certbot.js +4 -18
  33. package/dist/scanfix/fixes/certbot.js.map +1 -1
  34. package/dist/scanfix/fixes/docker.d.ts.map +1 -1
  35. package/dist/scanfix/fixes/docker.js +5 -14
  36. package/dist/scanfix/fixes/docker.js.map +1 -1
  37. package/dist/scanfix/ssl-cert-helper.d.ts.map +1 -1
  38. package/dist/scanfix/ssl-cert-helper.js +18 -4
  39. package/dist/scanfix/ssl-cert-helper.js.map +1 -1
  40. package/dist/scripts/generate-all.js +73 -73
  41. package/dist/utils/deployment-report.js +2 -2
  42. package/dist/utils/secret-prompts.js +34 -34
  43. package/dist/utils/ssh-helper.d.ts.map +1 -1
  44. package/dist/utils/ssh-helper.js +61 -101
  45. package/dist/utils/ssh-helper.js.map +1 -1
  46. package/dist/utils/template-generator.js +74 -74
  47. package/package.json +100 -114
  48. package/dist/plugins/pipelines/factiii/scanfix/docker.d.ts +0 -20
  49. package/dist/plugins/pipelines/factiii/scanfix/docker.d.ts.map +0 -1
  50. package/dist/plugins/pipelines/factiii/scanfix/docker.js +0 -131
  51. package/dist/plugins/pipelines/factiii/scanfix/docker.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ssl-cert-helper.js","sourceRoot":"","sources":["../../src/scanfix/ssl-cert-helper.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBH,4CA0EC;AAOD,wCAUC;AA5GD,iDAAyC;AACzC,uCAAyB;AASzB;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,MAAc,EAAE,WAAmB,CAAC;IACnE,MAAM,QAAQ,GAAG,wBAAwB,GAAG,MAAM,GAAG,gBAAgB,CAAC;IAEtE,kEAAkE;IAClE,IAAI,WAAW,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE1C,mEAAmE;IACnE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,IAAI,CAAC;YAC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AG,EAAE,GAAG,EAAE,CAAC,CAC5D,CAAC;gBACF,OAAO;oBACL,MAAM,EAAE,IAAI;oBACZ,KAAK,EAAE,KAAK;oBACZ,aAAa,EAAE,eAAe;oBAC9B,KAAK,EAAE,0BAA0B,GAAG,eAAe,GAAG,OAAO;iBAC9D,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,sBAAsB;QACxB,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,sCAAsC,EAAE,CAAC;IACvF,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc;IAC5B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,6DAA6D,EAAE;YACrF,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,eAAe,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -271,31 +271,31 @@ function generateNginx(allConfigs) {
271
271
  return 0;
272
272
  }
273
273
  // Generate nginx config
274
- let nginxConf = `# Auto-generated nginx configuration
275
- # Generated by: npx stack (generate-all)
276
- # Do not edit directly - modify stack.yml files and run: npx stack deploy
277
-
278
- events {
279
- worker_connections 1024;
280
- }
281
-
282
- http {
283
- include /etc/nginx/mime.types;
284
- default_type application/octet-stream;
285
-
286
- sendfile on;
287
- keepalive_timeout 65;
288
- client_max_body_size 100M;
289
-
290
- # Logging
291
- access_log /var/log/nginx/access.log;
292
- error_log /var/log/nginx/error.log;
293
-
294
- # Gzip
295
- gzip on;
296
- gzip_vary on;
297
- gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
298
-
274
+ let nginxConf = `# Auto-generated nginx configuration
275
+ # Generated by: npx stack (generate-all)
276
+ # Do not edit directly - modify stack.yml files and run: npx stack deploy
277
+
278
+ events {
279
+ worker_connections 1024;
280
+ }
281
+
282
+ http {
283
+ include /etc/nginx/mime.types;
284
+ default_type application/octet-stream;
285
+
286
+ sendfile on;
287
+ keepalive_timeout 65;
288
+ client_max_body_size 100M;
289
+
290
+ # Logging
291
+ access_log /var/log/nginx/access.log;
292
+ error_log /var/log/nginx/error.log;
293
+
294
+ # Gzip
295
+ gzip on;
296
+ gzip_vary on;
297
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
298
+
299
299
  `;
300
300
  // ============================================================
301
301
  // CRITICAL: HTTPS Certificate Paths
@@ -308,54 +308,54 @@ http {
308
308
  for (const { domain, service, port } of routes) {
309
309
  // Always generate HTTPS-capable config
310
310
  // Certificates must exist before nginx can start (obtained via: npx stack fix --staging/--prod)
311
- nginxConf += `
312
- # ${service} - ${domain}
313
-
314
- # HTTP - ACME challenge + redirect to HTTPS
315
- server {
316
- listen 80;
317
- server_name ${domain};
318
-
319
- # Allow certbot ACME challenge (for renewals)
320
- location /.well-known/acme-challenge/ {
321
- root /var/www/certbot;
322
- }
323
-
324
- # Redirect all other traffic to HTTPS
325
- location / {
326
- return 301 https://$server_name$request_uri;
327
- }
328
- }
329
-
330
- # HTTPS - main server block
331
- server {
332
- listen 443 ssl;
333
- http2 on;
334
- server_name ${domain};
335
-
336
- # SSL certificate paths (Let's Encrypt)
337
- ssl_certificate /etc/letsencrypt/live/${domain}/fullchain.pem;
338
- ssl_certificate_key /etc/letsencrypt/live/${domain}/privkey.pem;
339
-
340
- # SSL security settings
341
- ssl_protocols TLSv1.2 TLSv1.3;
342
- ssl_prefer_server_ciphers on;
343
- ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
344
- ssl_session_cache shared:SSL:10m;
345
- ssl_session_timeout 10m;
346
-
347
- location / {
348
- proxy_pass http://${service}:${port};
349
- proxy_http_version 1.1;
350
- proxy_set_header Upgrade $http_upgrade;
351
- proxy_set_header Connection 'upgrade';
352
- proxy_set_header Host $host;
353
- proxy_cache_bypass $http_upgrade;
354
- proxy_set_header X-Real-IP $remote_addr;
355
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
356
- proxy_set_header X-Forwarded-Proto $scheme;
357
- }
358
- }
311
+ nginxConf += `
312
+ # ${service} - ${domain}
313
+
314
+ # HTTP - ACME challenge + redirect to HTTPS
315
+ server {
316
+ listen 80;
317
+ server_name ${domain};
318
+
319
+ # Allow certbot ACME challenge (for renewals)
320
+ location /.well-known/acme-challenge/ {
321
+ root /var/www/certbot;
322
+ }
323
+
324
+ # Redirect all other traffic to HTTPS
325
+ location / {
326
+ return 301 https://$server_name$request_uri;
327
+ }
328
+ }
329
+
330
+ # HTTPS - main server block
331
+ server {
332
+ listen 443 ssl;
333
+ http2 on;
334
+ server_name ${domain};
335
+
336
+ # SSL certificate paths (Let's Encrypt)
337
+ ssl_certificate /etc/letsencrypt/live/${domain}/fullchain.pem;
338
+ ssl_certificate_key /etc/letsencrypt/live/${domain}/privkey.pem;
339
+
340
+ # SSL security settings
341
+ ssl_protocols TLSv1.2 TLSv1.3;
342
+ ssl_prefer_server_ciphers on;
343
+ ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
344
+ ssl_session_cache shared:SSL:10m;
345
+ ssl_session_timeout 10m;
346
+
347
+ location / {
348
+ proxy_pass http://${service}:${port};
349
+ proxy_http_version 1.1;
350
+ proxy_set_header Upgrade $http_upgrade;
351
+ proxy_set_header Connection 'upgrade';
352
+ proxy_set_header Host $host;
353
+ proxy_cache_bypass $http_upgrade;
354
+ proxy_set_header X-Real-IP $remote_addr;
355
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
356
+ proxy_set_header X-Forwarded-Proto $scheme;
357
+ }
358
+ }
359
359
  `;
360
360
  }
361
361
  nginxConf += `}\n`;
@@ -154,8 +154,8 @@ function formatDeploymentReport(data) {
154
154
  function formatWorkflowSummary(data) {
155
155
  const report = formatDeploymentReport(data);
156
156
  // Workflow summaries support markdown, so we can enhance it
157
- return `\`\`\`
158
- ${report}
157
+ return `\`\`\`
158
+ ${report}
159
159
  \`\`\``;
160
160
  }
161
161
  /**
@@ -64,16 +64,16 @@ const SECRET_METADATA = {
64
64
  STAGING_SSH: {
65
65
  type: 'ssh_key',
66
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 stack.yml → environments.staging.host)
75
-
76
- Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
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 stack.yml → environments.staging.host)
75
+
76
+ Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
77
77
  cat ~/.ssh/staging_deploy`,
78
78
  validation: (value) => {
79
79
  if (!value || value.trim().length === 0) {
@@ -91,16 +91,16 @@ const SECRET_METADATA = {
91
91
  PROD_SSH: {
92
92
  type: 'ssh_key',
93
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 stack.yml → environments.production.host)
102
-
103
- Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
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 stack.yml → environments.production.host)
102
+
103
+ Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
104
104
  cat ~/.ssh/prod_deploy`,
105
105
  validation: (value) => {
106
106
  if (!value || value.trim().length === 0) {
@@ -118,14 +118,14 @@ const SECRET_METADATA = {
118
118
  AWS_SECRET_ACCESS_KEY: {
119
119
  type: 'aws_secret',
120
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 stack.yml (not secrets)
128
-
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 stack.yml (not secrets)
128
+
129
129
  Enter AWS Secret Access Key:`,
130
130
  validation: (value) => {
131
131
  if (!value || value.trim().length === 0) {
@@ -143,12 +143,12 @@ const SECRET_METADATA = {
143
143
  VERCEL_TOKEN: {
144
144
  type: 'api_token',
145
145
  description: 'Vercel API Token for deployments',
146
- helpText: `
147
- Get your token from: https://vercel.com/account/tokens
148
- Create a new token with:
149
- - Scope: Full Account (or specific team)
150
- - Expiration: No Expiration (or custom)
151
-
146
+ helpText: `
147
+ Get your token from: https://vercel.com/account/tokens
148
+ Create a new token with:
149
+ - Scope: Full Account (or specific team)
150
+ - Expiration: No Expiration (or custom)
151
+
152
152
  Enter Vercel API Token:`,
153
153
  validation: (value) => {
154
154
  if (!value || value.trim().length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"ssh-helper.d.ts","sourceRoot":"","sources":["../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KAAK,EAAE,MAAM,mBAAmB,CAAC;AAKjF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAU5E;AA+BD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAS9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA4BlF;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,aAAa,GACpB,iBAAiB,GAAG,IAAI,CAc1B;AA+aD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAo0B/D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAC3B,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,KAAK,EACb,MAAM,CAAC,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAqMjB"}
@@ -764,107 +764,67 @@ async function sshRemoteFactiiiCommand(stage, config, command, rootDir) {
764
764
  const localGithubToken = process.env.GITHUB_TOKEN || '';
765
765
  const tokenExport = localGithubToken ? 'export GITHUB_TOKEN="' + localGithubToken + '" && ' : '';
766
766
  // Auto-bootstrap: install dependencies and clone repo if missing on server
767
- // Platform-aware: Mac uses Homebrew, Ubuntu uses apt-get
768
- const serverType = envConfig.server ?? 'ubuntu';
769
- const isMacServer = serverType === 'mac';
770
- const bootstrapCmd = isMacServer
771
- ? (
772
- // ── macOS bootstrap (Homebrew) ──
773
- // Install Homebrew if missing
774
- 'export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" && ' +
775
- 'if ! command -v brew &>/dev/null; then ' +
776
- 'echo " Installing Homebrew..." && ' +
777
- '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && ' +
778
- 'eval "$(/opt/homebrew/bin/brew shellenv 2>/dev/null || /usr/local/bin/brew shellenv 2>/dev/null)"; ' +
779
- 'fi && ' +
780
- // Install git if missing (usually pre-installed via Xcode CLI tools)
781
- 'if ! command -v git &>/dev/null; then ' +
782
- 'echo " Installing git..." && ' +
783
- 'brew install git; ' +
784
- 'fi && ' +
785
- // Install Node.js if missing
786
- 'if ! command -v node &>/dev/null; then ' +
787
- 'echo " Installing Node.js..." && ' +
788
- 'brew install node; ' +
789
- 'fi && ' +
790
- // Install Docker (Colima) if missing
791
- 'if ! command -v docker &>/dev/null; then ' +
792
- 'echo " Installing Docker via Colima..." && ' +
793
- 'brew install docker docker-compose colima && ' +
794
- 'colima start --memory 4 --cpu 2; ' +
795
- 'fi && ' +
796
- // Ensure Docker daemon is running (Colima or Docker Desktop)
797
- 'if ! docker info &>/dev/null; then ' +
798
- 'echo " Starting Docker..." && ' +
799
- 'if command -v colima &>/dev/null; then ' +
800
- 'colima start --memory 4 --cpu 2 2>/dev/null; ' +
801
- 'elif [ -d "/Applications/Docker.app" ]; then ' +
802
- 'nohup /Applications/Docker.app/Contents/MacOS/Docker --unattended > /dev/null 2>&1 & ' +
803
- 'for i in $(seq 1 30); do sleep 1; if docker info &>/dev/null; then break; fi; done; ' +
804
- 'fi; ' +
805
- 'fi && ')
806
- : (
807
- // ── Ubuntu/Linux bootstrap (apt-get) ──
808
- // Install git if missing
809
- 'if ! command -v git &>/dev/null; then ' +
810
- 'echo " Installing git..." && ' +
811
- 'sudo apt-get update -qq && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq git; ' +
812
- 'fi && ' +
813
- // Install Node.js if missing
814
- 'if ! command -v node &>/dev/null; then ' +
815
- 'echo " Installing Node.js 20.x..." && ' +
816
- 'curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && ' +
817
- 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq nodejs; ' +
818
- 'fi && ' +
819
- // Install Docker if missing
820
- 'if ! command -v docker &>/dev/null; then ' +
821
- 'echo " Installing Docker..." && ' +
822
- 'sudo apt-get update -qq && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker.io docker-compose-v2 && ' +
823
- 'sudo usermod -aG docker $USER && ' +
824
- 'sudo systemctl enable docker && sudo systemctl start docker; ' +
825
- 'fi && ') +
826
- // Clone repo if missing (check .git dir to catch empty/broken clones)
827
- 'if [ ! -d "' + projectDir + '/.git" ]; then ' +
828
- 'echo " Cloning project..." && ' +
829
- 'mkdir -p $HOME/.factiii && ' +
830
- // Remove broken/partial clone directory if it exists without .git
831
- 'if [ -d "' + projectDir + '" ]; then echo " Removing broken clone..." && rm -rf "' + projectDir + '"; fi && ' +
832
- // Add github.com to known_hosts to avoid interactive prompt
833
- 'mkdir -p ~/.ssh && ssh-keyscan -t ed25519,rsa github.com >> ~/.ssh/known_hosts 2>/dev/null && ' +
834
- // Generate a GitHub deploy key on the server if none exists
835
- 'if [ ! -f ~/.ssh/github_deploy_key ]; then ' +
836
- 'echo " Generating GitHub deploy key on server..." && ' +
837
- 'ssh-keygen -t ed25519 -f ~/.ssh/github_deploy_key -N "" -C "server-deploy" -q && ' +
838
- 'chmod 600 ~/.ssh/github_deploy_key; ' +
839
- 'fi && ' +
840
- // Configure SSH to use the deploy key for github.com
841
- 'if ! grep -q "Host github.com" ~/.ssh/config 2>/dev/null; then ' +
842
- 'printf "\\nHost github.com\\n IdentityFile ~/.ssh/github_deploy_key\\n IdentitiesOnly yes\\n" >> ~/.ssh/config && ' +
843
- 'chmod 600 ~/.ssh/config; ' +
844
- 'fi && ' +
845
- (githubRepo
846
- ? 'cd $HOME/.factiii && ' +
847
- // Try HTTPS with token first (works for private repos when GITHUB_TOKEN is set)
848
- 'if [ -n "$GITHUB_TOKEN" ]; then ' +
849
- 'GIT_TERMINAL_PROMPT=0 git clone https://x-access-token:$GITHUB_TOKEN@github.com/' + githubRepo + '.git ' + repoName + '; ' +
850
- // Then try SSH (works if server has a GitHub deploy key in repo settings)
851
- 'elif GIT_TERMINAL_PROMPT=0 git clone git@github.com:' + githubRepo + '.git ' + repoName + ' 2>/dev/null; then ' +
852
- 'true; ' +
853
- // All clone methods failed — show deploy key and instructions
854
- 'else ' +
855
- 'echo "" && ' +
856
- 'echo " [!] Cannot clone private repo — server needs GitHub access" && ' +
857
- 'echo "" && ' +
858
- 'echo " Add this deploy key to your GitHub repo:" && ' +
859
- 'echo " GitHub → ' + githubRepo + ' → Settings → Deploy keys → Add" && ' +
860
- 'echo "" && ' +
861
- 'cat ~/.ssh/github_deploy_key.pub && ' +
862
- 'echo "" && ' +
863
- 'echo " Then re-run: npx stack fix --prod" && ' +
864
- 'exit 1; ' +
865
- 'fi; '
866
- : 'echo " [!] No github_repo configured — cannot auto-clone" && exit 1; ') +
867
- 'fi && ';
767
+ const bootstrapCmd =
768
+ // Install git if missing
769
+ 'if ! command -v git &>/dev/null; then ' +
770
+ 'echo " Installing git..." && ' +
771
+ 'sudo apt-get update -qq && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq git; ' +
772
+ 'fi && ' +
773
+ // Install Node.js if missing
774
+ 'if ! command -v node &>/dev/null; then ' +
775
+ 'echo " Installing Node.js 20.x..." && ' +
776
+ 'curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && ' +
777
+ 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq nodejs; ' +
778
+ 'fi && ' +
779
+ // Install Docker if missing
780
+ 'if ! command -v docker &>/dev/null; then ' +
781
+ 'echo " Installing Docker..." && ' +
782
+ 'sudo apt-get update -qq && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker.io docker-compose-v2 && ' +
783
+ 'sudo usermod -aG docker $USER && ' +
784
+ 'sudo systemctl enable docker && sudo systemctl start docker; ' +
785
+ 'fi && ' +
786
+ // Clone repo if missing (check .git dir to catch empty/broken clones)
787
+ 'if [ ! -d "' + projectDir + '/.git" ]; then ' +
788
+ 'echo " Cloning project..." && ' +
789
+ 'mkdir -p $HOME/.factiii && ' +
790
+ // Remove broken/partial clone directory if it exists without .git
791
+ 'if [ -d "' + projectDir + '" ]; then echo " Removing broken clone..." && rm -rf "' + projectDir + '"; fi && ' +
792
+ // Add github.com to known_hosts to avoid interactive prompt
793
+ 'mkdir -p ~/.ssh && ssh-keyscan -t ed25519,rsa github.com >> ~/.ssh/known_hosts 2>/dev/null && ' +
794
+ // Generate a GitHub deploy key on the server if none exists
795
+ 'if [ ! -f ~/.ssh/github_deploy_key ]; then ' +
796
+ 'echo " Generating GitHub deploy key on server..." && ' +
797
+ 'ssh-keygen -t ed25519 -f ~/.ssh/github_deploy_key -N "" -C "server-deploy" -q && ' +
798
+ 'chmod 600 ~/.ssh/github_deploy_key; ' +
799
+ 'fi && ' +
800
+ // Configure SSH to use the deploy key for github.com
801
+ 'if ! grep -q "Host github.com" ~/.ssh/config 2>/dev/null; then ' +
802
+ 'printf "\\nHost github.com\\n IdentityFile ~/.ssh/github_deploy_key\\n IdentitiesOnly yes\\n" >> ~/.ssh/config && ' +
803
+ 'chmod 600 ~/.ssh/config; ' +
804
+ 'fi && ' +
805
+ (githubRepo
806
+ ? 'cd $HOME/.factiii && ' +
807
+ // Try HTTPS with token first (works for private repos when GITHUB_TOKEN is set)
808
+ 'if [ -n "$GITHUB_TOKEN" ]; then ' +
809
+ 'GIT_TERMINAL_PROMPT=0 git clone https://x-access-token:$GITHUB_TOKEN@github.com/' + githubRepo + '.git ' + repoName + '; ' +
810
+ // Then try SSH (works if server has a GitHub deploy key in repo settings)
811
+ 'elif GIT_TERMINAL_PROMPT=0 git clone git@github.com:' + githubRepo + '.git ' + repoName + ' 2>/dev/null; then ' +
812
+ 'true; ' +
813
+ // All clone methods failed — show deploy key and instructions
814
+ 'else ' +
815
+ 'echo "" && ' +
816
+ 'echo " [!] Cannot clone private repo server needs GitHub access" && ' +
817
+ 'echo "" && ' +
818
+ 'echo " Add this deploy key to your GitHub repo:" && ' +
819
+ 'echo " GitHub ' + githubRepo + ' → Settings → Deploy keys → Add" && ' +
820
+ 'echo "" && ' +
821
+ 'cat ~/.ssh/github_deploy_key.pub && ' +
822
+ 'echo "" && ' +
823
+ 'echo " Then re-run: npx stack fix --prod" && ' +
824
+ 'exit 1; ' +
825
+ 'fi; '
826
+ : 'echo " [!] No github_repo configured cannot auto-clone" && exit 1; ') +
827
+ 'fi && ';
868
828
  const projectCheckCmd = bootstrapCmd;
869
829
  // Step 2: Still no key — prompt for it (EC2: .pem file, others: password)
870
830
  if (!resolvedKeyPath) {