@factiii/stack 0.1.35 → 0.1.37
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/LICENSE +21 -0
- package/README.md +441 -441
- package/dist/generators/generate-stack-yml.js +37 -37
- package/dist/plugins/addons/openclaw/scanfix/setup.d.ts.map +1 -1
- package/dist/plugins/addons/openclaw/scanfix/setup.js +45 -11
- package/dist/plugins/addons/openclaw/scanfix/setup.js.map +1 -1
- package/dist/plugins/pipelines/aws/index.d.ts.map +1 -1
- package/dist/plugins/pipelines/aws/index.js +19 -41
- package/dist/plugins/pipelines/aws/index.js.map +1 -1
- package/dist/plugins/pipelines/aws/prod.js +5 -5
- package/dist/plugins/servers/mac/index.js +12 -12
- package/dist/plugins/servers/mac/staging.js +2 -2
- package/dist/utils/config-helpers.d.ts +1 -1
- package/dist/utils/config-helpers.d.ts.map +1 -1
- package/dist/utils/secret-prompts.js +28 -28
- package/dist/utils/template-generator.js +71 -71
- package/package.json +95 -95
|
@@ -51,47 +51,47 @@ const env_validator_js_1 = require("./env-validator.js");
|
|
|
51
51
|
*/
|
|
52
52
|
function generateEnvExampleTemplate(config) {
|
|
53
53
|
const repoName = config.name ?? 'myapp';
|
|
54
|
-
const template = `# .env.example - Environment variable template
|
|
55
|
-
# This file defines all required environment variables across environments.
|
|
56
|
-
# Values are descriptive examples - replace with real values in .env.staging and .env.prod
|
|
57
|
-
# This file is committed to git as a template.
|
|
58
|
-
|
|
59
|
-
# === Application Settings ===
|
|
60
|
-
NODE_ENV=development
|
|
61
|
-
PORT=3000
|
|
62
|
-
|
|
63
|
-
# === Database ===
|
|
64
|
-
# PostgreSQL connection string format
|
|
65
|
-
DATABASE_URL=postgresql://EXAMPLE_user:EXAMPLE_password@localhost:5432/EXAMPLE_${repoName}-dev
|
|
66
|
-
|
|
67
|
-
# === Authentication ===
|
|
68
|
-
# 256-bit secret key for JWT signing
|
|
69
|
-
JWT_SECRET=EXAMPLE_your-256-bit-secret-key-here
|
|
70
|
-
JWT_EXPIRES_IN=7d
|
|
71
|
-
|
|
72
|
-
# === External APIs (if needed) ===
|
|
73
|
-
# OPENAI_API_KEY=EXAMPLE_sk-proj-abc123xyz789
|
|
74
|
-
# STRIPE_SECRET_KEY=EXAMPLE_sk_test_51ABC123xyz
|
|
75
|
-
# STRIPE_PUBLISHABLE_KEY=EXAMPLE_pk_test_51ABC123xyz
|
|
76
|
-
|
|
77
|
-
# === AWS Configuration (if using S3, SES, etc) ===
|
|
78
|
-
# AWS_ACCESS_KEY_ID=EXAMPLE_AKIAIOSFODNN7EXAMPLE
|
|
79
|
-
# AWS_SECRET_ACCESS_KEY=EXAMPLE_wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
80
|
-
# AWS_REGION=EXAMPLE_us-east-1
|
|
81
|
-
# AWS_BUCKET_NAME=EXAMPLE_${repoName}-assets
|
|
82
|
-
|
|
83
|
-
# === Email Configuration (if using SMTP) ===
|
|
84
|
-
# SMTP_HOST=EXAMPLE_smtp.gmail.com
|
|
85
|
-
# SMTP_PORT=587
|
|
86
|
-
# SMTP_USER=EXAMPLE_noreply@yourdomain.com
|
|
87
|
-
# SMTP_PASSWORD=EXAMPLE_your-app-password
|
|
88
|
-
|
|
89
|
-
# === Application URLs ===
|
|
90
|
-
# FRONTEND_URL=EXAMPLE_http://localhost:3000
|
|
91
|
-
# API_URL=EXAMPLE_http://localhost:3001
|
|
92
|
-
|
|
93
|
-
# === Application-specific settings ===
|
|
94
|
-
# Add your custom environment variables below
|
|
54
|
+
const template = `# .env.example - Environment variable template
|
|
55
|
+
# This file defines all required environment variables across environments.
|
|
56
|
+
# Values are descriptive examples - replace with real values in .env.staging and .env.prod
|
|
57
|
+
# This file is committed to git as a template.
|
|
58
|
+
|
|
59
|
+
# === Application Settings ===
|
|
60
|
+
NODE_ENV=development
|
|
61
|
+
PORT=3000
|
|
62
|
+
|
|
63
|
+
# === Database ===
|
|
64
|
+
# PostgreSQL connection string format
|
|
65
|
+
DATABASE_URL=postgresql://EXAMPLE_user:EXAMPLE_password@localhost:5432/EXAMPLE_${repoName}-dev
|
|
66
|
+
|
|
67
|
+
# === Authentication ===
|
|
68
|
+
# 256-bit secret key for JWT signing
|
|
69
|
+
JWT_SECRET=EXAMPLE_your-256-bit-secret-key-here
|
|
70
|
+
JWT_EXPIRES_IN=7d
|
|
71
|
+
|
|
72
|
+
# === External APIs (if needed) ===
|
|
73
|
+
# OPENAI_API_KEY=EXAMPLE_sk-proj-abc123xyz789
|
|
74
|
+
# STRIPE_SECRET_KEY=EXAMPLE_sk_test_51ABC123xyz
|
|
75
|
+
# STRIPE_PUBLISHABLE_KEY=EXAMPLE_pk_test_51ABC123xyz
|
|
76
|
+
|
|
77
|
+
# === AWS Configuration (if using S3, SES, etc) ===
|
|
78
|
+
# AWS_ACCESS_KEY_ID=EXAMPLE_AKIAIOSFODNN7EXAMPLE
|
|
79
|
+
# AWS_SECRET_ACCESS_KEY=EXAMPLE_wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
80
|
+
# AWS_REGION=EXAMPLE_us-east-1
|
|
81
|
+
# AWS_BUCKET_NAME=EXAMPLE_${repoName}-assets
|
|
82
|
+
|
|
83
|
+
# === Email Configuration (if using SMTP) ===
|
|
84
|
+
# SMTP_HOST=EXAMPLE_smtp.gmail.com
|
|
85
|
+
# SMTP_PORT=587
|
|
86
|
+
# SMTP_USER=EXAMPLE_noreply@yourdomain.com
|
|
87
|
+
# SMTP_PASSWORD=EXAMPLE_your-app-password
|
|
88
|
+
|
|
89
|
+
# === Application URLs ===
|
|
90
|
+
# FRONTEND_URL=EXAMPLE_http://localhost:3000
|
|
91
|
+
# API_URL=EXAMPLE_http://localhost:3001
|
|
92
|
+
|
|
93
|
+
# === Application-specific settings ===
|
|
94
|
+
# Add your custom environment variables below
|
|
95
95
|
`;
|
|
96
96
|
return template;
|
|
97
97
|
}
|
|
@@ -103,10 +103,10 @@ JWT_EXPIRES_IN=7d
|
|
|
103
103
|
*/
|
|
104
104
|
function generateEnvTemplate(environment, devEnv) {
|
|
105
105
|
const envUpper = environment.toUpperCase();
|
|
106
|
-
let template = `# .env.${environment} - ${envUpper} environment variables
|
|
107
|
-
# Fill in all values below. Keys must match .env.example
|
|
108
|
-
# This file should ${environment === 'prod' ? 'ALWAYS' : 'optionally'} be in .gitignore
|
|
109
|
-
|
|
106
|
+
let template = `# .env.${environment} - ${envUpper} environment variables
|
|
107
|
+
# Fill in all values below. Keys must match .env.example
|
|
108
|
+
# This file should ${environment === 'prod' ? 'ALWAYS' : 'optionally'} be in .gitignore
|
|
109
|
+
|
|
110
110
|
`;
|
|
111
111
|
// Copy keys from .env.example with placeholder values
|
|
112
112
|
for (const key of Object.keys(devEnv)) {
|
|
@@ -120,11 +120,11 @@ function generateEnvTemplate(environment, devEnv) {
|
|
|
120
120
|
template += `${key}=<FILL_IN>\n`;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
template += `
|
|
124
|
-
# Instructions:
|
|
125
|
-
# 1. Replace all <FILL_IN> values with real ${environment} values
|
|
126
|
-
# 2. Ensure all keys match .env.example
|
|
127
|
-
# 3. Run: npx stack (to validate)
|
|
123
|
+
template += `
|
|
124
|
+
# Instructions:
|
|
125
|
+
# 1. Replace all <FILL_IN> values with real ${environment} values
|
|
126
|
+
# 2. Ensure all keys match .env.example
|
|
127
|
+
# 3. Run: npx stack (to validate)
|
|
128
128
|
`;
|
|
129
129
|
return template;
|
|
130
130
|
}
|
|
@@ -197,27 +197,27 @@ function createEnvTemplates(rootDir, config) {
|
|
|
197
197
|
* Generate secrets checklist for display
|
|
198
198
|
*/
|
|
199
199
|
function generateSecretsChecklist() {
|
|
200
|
-
return `
|
|
201
|
-
REQUIRED GitHub Secrets (minimal):
|
|
202
|
-
───────────────────────────────────────────────────────
|
|
203
|
-
□ STAGING_SSH - SSH private key for staging
|
|
204
|
-
□ PROD_SSH - SSH private key for production
|
|
205
|
-
□ AWS_SECRET_ACCESS_KEY - AWS secret key (only secret AWS value)
|
|
206
|
-
|
|
207
|
-
OPTIONAL GitHub Secrets:
|
|
208
|
-
───────────────────────────────────────────────────────
|
|
209
|
-
□ STAGING_ENVS - Environment vars from .env.staging
|
|
210
|
-
□ PROD_ENVS - Environment vars from .env.prod
|
|
211
|
-
|
|
212
|
-
NOT SECRETS (in stack.yml):
|
|
213
|
-
───────────────────────────────────────────────────────
|
|
214
|
-
✓ environments.{env}.host - Server IP/hostname
|
|
215
|
-
✓ aws.access_key_id - AWS access key ID
|
|
216
|
-
✓ aws.region - AWS region (e.g., us-east-1)
|
|
217
|
-
|
|
218
|
-
NOT SECRETS (in factiiiAuto.yml):
|
|
219
|
-
───────────────────────────────────────────────────────
|
|
220
|
-
✓ ssh_user - Defaults to ubuntu
|
|
200
|
+
return `
|
|
201
|
+
REQUIRED GitHub Secrets (minimal):
|
|
202
|
+
───────────────────────────────────────────────────────
|
|
203
|
+
□ STAGING_SSH - SSH private key for staging
|
|
204
|
+
□ PROD_SSH - SSH private key for production
|
|
205
|
+
□ AWS_SECRET_ACCESS_KEY - AWS secret key (only secret AWS value)
|
|
206
|
+
|
|
207
|
+
OPTIONAL GitHub Secrets:
|
|
208
|
+
───────────────────────────────────────────────────────
|
|
209
|
+
□ STAGING_ENVS - Environment vars from .env.staging
|
|
210
|
+
□ PROD_ENVS - Environment vars from .env.prod
|
|
211
|
+
|
|
212
|
+
NOT SECRETS (in stack.yml):
|
|
213
|
+
───────────────────────────────────────────────────────
|
|
214
|
+
✓ environments.{env}.host - Server IP/hostname
|
|
215
|
+
✓ aws.access_key_id - AWS access key ID
|
|
216
|
+
✓ aws.region - AWS region (e.g., us-east-1)
|
|
217
|
+
|
|
218
|
+
NOT SECRETS (in factiiiAuto.yml):
|
|
219
|
+
───────────────────────────────────────────────────────
|
|
220
|
+
✓ ssh_user - Defaults to ubuntu
|
|
221
221
|
`.trim();
|
|
222
222
|
}
|
|
223
223
|
//# sourceMappingURL=template-generator.js.map
|
package/package.json
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@factiii/stack",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Infrastructure management package for deploying services to servers",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"stack": "./bin/stack"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"bin/",
|
|
12
|
-
"dist/"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc && npm run copy-assets",
|
|
16
|
-
"build:watch": "tsc --watch",
|
|
17
|
-
"clean": "node -e \"const fs=require('fs');if(fs.existsSync('dist'))fs.rmSync('dist',{recursive:true,force:true})\"",
|
|
18
|
-
"copy-assets": "node -e \"const fs=require('fs'),p=require('path');fs.cpSync('src/plugins/approved.json','dist/plugins/approved.json');const d='dist/plugins/pipelines/factiii/workflows';fs.mkdirSync(d,{recursive:true});for(const f of fs.readdirSync('src/plugins/pipelines/factiii/workflows').filter(f=>f.endsWith('.yml')))fs.cpSync(p.join('src/plugins/pipelines/factiii/workflows',f),p.join(d,f));const pd='dist/plugins/pipelines/aws/policies';fs.mkdirSync(pd,{recursive:true});for(const f of fs.readdirSync('src/plugins/pipelines/aws/policies').filter(f=>f.endsWith('.json')))fs.cpSync(p.join('src/plugins/pipelines/aws/policies',f),p.join(pd,f))\"",
|
|
19
|
-
"prebuild": "npm run clean",
|
|
20
|
-
"prepublish-check": "node -e \"const v=require('./package.json').version; if(v.includes('-d')){console.error('❌ Cannot publish dev version:',v); process.exit(1)}\"",
|
|
21
|
-
"prepublishOnly": "npm run prepublish-check && npm run build",
|
|
22
|
-
"test": "jest",
|
|
23
|
-
"test:watch": "jest --watch",
|
|
24
|
-
"test:coverage": "jest --coverage",
|
|
25
|
-
"typecheck": "tsc --noEmit"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"infrastructure",
|
|
29
|
-
"deployment",
|
|
30
|
-
"docker",
|
|
31
|
-
"nginx"
|
|
32
|
-
],
|
|
33
|
-
"author": "",
|
|
34
|
-
"license": "MIT",
|
|
35
|
-
"repository": {
|
|
36
|
-
"type": "git",
|
|
37
|
-
"url": "https://github.com/factiii/stack.git"
|
|
38
|
-
},
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"registry": "https://registry.npmjs.org"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@aws-sdk/client-ec2": "^3.750.0",
|
|
44
|
-
"@aws-sdk/client-ecr": "^3.750.0",
|
|
45
|
-
"@aws-sdk/client-iam": "^3.750.0",
|
|
46
|
-
"@aws-sdk/client-rds": "^3.750.0",
|
|
47
|
-
"@aws-sdk/client-s3": "^3.750.0",
|
|
48
|
-
"@aws-sdk/client-ses": "^3.750.0",
|
|
49
|
-
"@aws-sdk/client-sts": "^3.750.0",
|
|
50
|
-
"@octokit/rest": "^20.0.2",
|
|
51
|
-
"commander": "^11.1.0",
|
|
52
|
-
"js-yaml": "^4.1.1",
|
|
53
|
-
"libsodium-wrappers": "^0.7.11"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@types/jest": "^30.0.0",
|
|
57
|
-
"@types/js-yaml": "^4.0.9",
|
|
58
|
-
"@types/node": "^25.0.3",
|
|
59
|
-
"jest": "^29.7.0",
|
|
60
|
-
"ts-jest": "^29.4.6",
|
|
61
|
-
"ts-node": "^10.9.2",
|
|
62
|
-
"typescript": "^5.9.3"
|
|
63
|
-
},
|
|
64
|
-
"jest": {
|
|
65
|
-
"preset": "ts-jest",
|
|
66
|
-
"testEnvironment": "node",
|
|
67
|
-
"testMatch": [
|
|
68
|
-
"**/test/**/*.test.ts"
|
|
69
|
-
],
|
|
70
|
-
"moduleNameMapper": {
|
|
71
|
-
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
72
|
-
},
|
|
73
|
-
"collectCoverageFrom": [
|
|
74
|
-
"src/**/*.ts",
|
|
75
|
-
"!**/node_modules/**"
|
|
76
|
-
],
|
|
77
|
-
"coverageThreshold": {
|
|
78
|
-
"global": {
|
|
79
|
-
"branches": 70,
|
|
80
|
-
"functions": 70,
|
|
81
|
-
"lines": 70,
|
|
82
|
-
"statements": 70
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"engines": {
|
|
87
|
-
"node": ">=18.0.0"
|
|
88
|
-
},
|
|
89
|
-
"pnpm": {
|
|
90
|
-
"overrides": {
|
|
91
|
-
"minimatch": ">=10.2.1",
|
|
92
|
-
"diff": ">=4.0.4"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@factiii/stack",
|
|
3
|
+
"version": "0.1.37",
|
|
4
|
+
"description": "Infrastructure management package for deploying services to servers",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"stack": "./bin/stack"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"dist/"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc && npm run copy-assets",
|
|
16
|
+
"build:watch": "tsc --watch",
|
|
17
|
+
"clean": "node -e \"const fs=require('fs');if(fs.existsSync('dist'))fs.rmSync('dist',{recursive:true,force:true})\"",
|
|
18
|
+
"copy-assets": "node -e \"const fs=require('fs'),p=require('path');fs.cpSync('src/plugins/approved.json','dist/plugins/approved.json');const d='dist/plugins/pipelines/factiii/workflows';fs.mkdirSync(d,{recursive:true});for(const f of fs.readdirSync('src/plugins/pipelines/factiii/workflows').filter(f=>f.endsWith('.yml')))fs.cpSync(p.join('src/plugins/pipelines/factiii/workflows',f),p.join(d,f));const pd='dist/plugins/pipelines/aws/policies';fs.mkdirSync(pd,{recursive:true});for(const f of fs.readdirSync('src/plugins/pipelines/aws/policies').filter(f=>f.endsWith('.json')))fs.cpSync(p.join('src/plugins/pipelines/aws/policies',f),p.join(pd,f))\"",
|
|
19
|
+
"prebuild": "npm run clean",
|
|
20
|
+
"prepublish-check": "node -e \"const v=require('./package.json').version; if(v.includes('-d')){console.error('❌ Cannot publish dev version:',v); process.exit(1)}\"",
|
|
21
|
+
"prepublishOnly": "npm run prepublish-check && npm run build",
|
|
22
|
+
"test": "jest",
|
|
23
|
+
"test:watch": "jest --watch",
|
|
24
|
+
"test:coverage": "jest --coverage",
|
|
25
|
+
"typecheck": "tsc --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"infrastructure",
|
|
29
|
+
"deployment",
|
|
30
|
+
"docker",
|
|
31
|
+
"nginx"
|
|
32
|
+
],
|
|
33
|
+
"author": "",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/factiii/stack.git"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"registry": "https://registry.npmjs.org"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@aws-sdk/client-ec2": "^3.750.0",
|
|
44
|
+
"@aws-sdk/client-ecr": "^3.750.0",
|
|
45
|
+
"@aws-sdk/client-iam": "^3.750.0",
|
|
46
|
+
"@aws-sdk/client-rds": "^3.750.0",
|
|
47
|
+
"@aws-sdk/client-s3": "^3.750.0",
|
|
48
|
+
"@aws-sdk/client-ses": "^3.750.0",
|
|
49
|
+
"@aws-sdk/client-sts": "^3.750.0",
|
|
50
|
+
"@octokit/rest": "^20.0.2",
|
|
51
|
+
"commander": "^11.1.0",
|
|
52
|
+
"js-yaml": "^4.1.1",
|
|
53
|
+
"libsodium-wrappers": "^0.7.11"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/jest": "^30.0.0",
|
|
57
|
+
"@types/js-yaml": "^4.0.9",
|
|
58
|
+
"@types/node": "^25.0.3",
|
|
59
|
+
"jest": "^29.7.0",
|
|
60
|
+
"ts-jest": "^29.4.6",
|
|
61
|
+
"ts-node": "^10.9.2",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
63
|
+
},
|
|
64
|
+
"jest": {
|
|
65
|
+
"preset": "ts-jest",
|
|
66
|
+
"testEnvironment": "node",
|
|
67
|
+
"testMatch": [
|
|
68
|
+
"**/test/**/*.test.ts"
|
|
69
|
+
],
|
|
70
|
+
"moduleNameMapper": {
|
|
71
|
+
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
72
|
+
},
|
|
73
|
+
"collectCoverageFrom": [
|
|
74
|
+
"src/**/*.ts",
|
|
75
|
+
"!**/node_modules/**"
|
|
76
|
+
],
|
|
77
|
+
"coverageThreshold": {
|
|
78
|
+
"global": {
|
|
79
|
+
"branches": 70,
|
|
80
|
+
"functions": 70,
|
|
81
|
+
"lines": 70,
|
|
82
|
+
"statements": 70
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">=18.0.0"
|
|
88
|
+
},
|
|
89
|
+
"pnpm": {
|
|
90
|
+
"overrides": {
|
|
91
|
+
"minimatch": ">=10.2.1",
|
|
92
|
+
"diff": ">=4.0.4"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|