@expressots/cli 3.0.0 → 4.0.0-preview.3

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 (194) hide show
  1. package/README.md +41 -95
  2. package/bin/cicd/cli.d.ts +6 -0
  3. package/bin/cicd/cli.js +128 -0
  4. package/bin/cicd/form.d.ts +29 -0
  5. package/bin/cicd/form.js +346 -0
  6. package/bin/cicd/generators/azure-devops.d.ts +2 -0
  7. package/bin/cicd/generators/azure-devops.js +370 -0
  8. package/bin/cicd/generators/bitbucket.d.ts +2 -0
  9. package/bin/cicd/generators/bitbucket.js +217 -0
  10. package/bin/cicd/generators/circleci.d.ts +2 -0
  11. package/bin/cicd/generators/circleci.js +274 -0
  12. package/bin/cicd/generators/github-actions.d.ts +14 -0
  13. package/bin/cicd/generators/github-actions.js +426 -0
  14. package/bin/cicd/generators/gitlab-ci.d.ts +2 -0
  15. package/bin/cicd/generators/gitlab-ci.js +237 -0
  16. package/bin/cicd/generators/index.d.ts +6 -0
  17. package/bin/cicd/generators/index.js +15 -0
  18. package/bin/cicd/generators/jenkins.d.ts +2 -0
  19. package/bin/cicd/generators/jenkins.js +248 -0
  20. package/bin/cicd/generators/template-loader.d.ts +17 -0
  21. package/bin/cicd/generators/template-loader.js +128 -0
  22. package/bin/cicd/index.d.ts +1 -0
  23. package/bin/cicd/index.js +5 -0
  24. package/bin/cli.d.ts +1 -5
  25. package/bin/cli.js +72 -7
  26. package/bin/commands/project.commands.d.ts +19 -6
  27. package/bin/commands/project.commands.js +602 -66
  28. package/bin/config/index.d.ts +5 -0
  29. package/bin/config/index.js +10 -0
  30. package/bin/config/manager.d.ts +98 -0
  31. package/bin/config/manager.js +222 -0
  32. package/bin/containerize/analyzers/bootstrap-analyzer.d.ts +46 -0
  33. package/bin/containerize/analyzers/bootstrap-analyzer.js +187 -0
  34. package/bin/containerize/analyzers/project-analyzer.d.ts +20 -0
  35. package/bin/containerize/analyzers/project-analyzer.js +150 -0
  36. package/bin/containerize/cli.d.ts +4 -0
  37. package/bin/containerize/cli.js +113 -0
  38. package/bin/containerize/form.d.ts +15 -0
  39. package/bin/containerize/form.js +152 -0
  40. package/bin/containerize/generators/ci-generator.d.ts +31 -0
  41. package/bin/containerize/generators/ci-generator.js +940 -0
  42. package/bin/containerize/generators/docker-compose-generator.d.ts +8 -0
  43. package/bin/containerize/generators/docker-compose-generator.js +187 -0
  44. package/bin/containerize/generators/dockerfile-generator.d.ts +8 -0
  45. package/bin/containerize/generators/dockerfile-generator.js +657 -0
  46. package/bin/containerize/generators/kubernetes-generator.d.ts +8 -0
  47. package/bin/containerize/generators/kubernetes-generator.js +134 -0
  48. package/bin/containerize/generators/template-loader.d.ts +36 -0
  49. package/bin/containerize/generators/template-loader.js +129 -0
  50. package/bin/containerize/index.d.ts +4 -0
  51. package/bin/containerize/index.js +13 -0
  52. package/bin/containerize/presets/preset-registry.d.ts +20 -0
  53. package/bin/containerize/presets/preset-registry.js +102 -0
  54. package/bin/costs/cli.d.ts +5 -0
  55. package/bin/costs/cli.js +185 -0
  56. package/bin/costs/form.d.ts +44 -0
  57. package/bin/costs/form.js +412 -0
  58. package/bin/costs/index.d.ts +4 -0
  59. package/bin/costs/index.js +25 -0
  60. package/bin/costs/pricing-manager.d.ts +84 -0
  61. package/bin/costs/pricing-manager.js +342 -0
  62. package/bin/costs/providers/index.d.ts +32 -0
  63. package/bin/costs/providers/index.js +153 -0
  64. package/bin/costs/sources/api-source.d.ts +10 -0
  65. package/bin/costs/sources/api-source.js +32 -0
  66. package/bin/costs/sources/index.d.ts +6 -0
  67. package/bin/costs/sources/index.js +15 -0
  68. package/bin/costs/sources/local-json-source.d.ts +23 -0
  69. package/bin/costs/sources/local-json-source.js +59 -0
  70. package/bin/costs/sources/remote-json-source.d.ts +11 -0
  71. package/bin/costs/sources/remote-json-source.js +53 -0
  72. package/bin/costs/types.d.ts +53 -0
  73. package/bin/costs/types.js +5 -0
  74. package/bin/dev/cli.d.ts +4 -0
  75. package/bin/dev/cli.js +136 -0
  76. package/bin/dev/form.d.ts +36 -0
  77. package/bin/dev/form.js +254 -0
  78. package/bin/dev/index.d.ts +1 -0
  79. package/bin/dev/index.js +5 -0
  80. package/bin/generate/cli.d.ts +1 -1
  81. package/bin/generate/cli.js +29 -2
  82. package/bin/generate/form.d.ts +5 -1
  83. package/bin/generate/form.js +3 -3
  84. package/bin/generate/templates/nonopinionated/config.tpl +12 -0
  85. package/bin/generate/templates/nonopinionated/event.tpl +10 -0
  86. package/bin/generate/templates/nonopinionated/guard.tpl +18 -0
  87. package/bin/generate/templates/nonopinionated/handler.tpl +12 -0
  88. package/bin/generate/templates/nonopinionated/interceptor.tpl +27 -0
  89. package/bin/generate/templates/opinionated/config.tpl +47 -0
  90. package/bin/generate/templates/opinionated/entity.tpl +1 -8
  91. package/bin/generate/templates/opinionated/event.tpl +15 -0
  92. package/bin/generate/templates/opinionated/guard.tpl +41 -0
  93. package/bin/generate/templates/opinionated/handler.tpl +23 -0
  94. package/bin/generate/templates/opinionated/interceptor.tpl +50 -0
  95. package/bin/generate/utils/command-utils.d.ts +20 -5
  96. package/bin/generate/utils/command-utils.js +145 -48
  97. package/bin/generate/utils/nonopininated-cmd.d.ts +10 -1
  98. package/bin/generate/utils/nonopininated-cmd.js +100 -1
  99. package/bin/generate/utils/opinionated-cmd.d.ts +10 -1
  100. package/bin/generate/utils/opinionated-cmd.js +128 -16
  101. package/bin/generate/utils/string-utils.d.ts +6 -0
  102. package/bin/generate/utils/string-utils.js +13 -1
  103. package/bin/help/cli.d.ts +1 -1
  104. package/bin/help/command-help-registry.d.ts +23 -0
  105. package/bin/help/command-help-registry.js +303 -0
  106. package/bin/help/command-help.d.ts +36 -0
  107. package/bin/help/command-help.js +56 -0
  108. package/bin/help/form.js +127 -22
  109. package/bin/help/main-help.d.ts +8 -0
  110. package/bin/help/main-help.js +126 -0
  111. package/bin/help/render.d.ts +32 -0
  112. package/bin/help/render.js +46 -0
  113. package/bin/info/cli.d.ts +1 -1
  114. package/bin/info/form.d.ts +1 -1
  115. package/bin/info/form.js +11 -11
  116. package/bin/migrate/analyzers/platform-detector.d.ts +14 -0
  117. package/bin/migrate/analyzers/platform-detector.js +116 -0
  118. package/bin/migrate/cli.d.ts +6 -0
  119. package/bin/migrate/cli.js +98 -0
  120. package/bin/migrate/form.d.ts +25 -0
  121. package/bin/migrate/form.js +348 -0
  122. package/bin/migrate/generators/compose-to-k8s.d.ts +2 -0
  123. package/bin/migrate/generators/compose-to-k8s.js +324 -0
  124. package/bin/migrate/generators/compose-to-railway.d.ts +2 -0
  125. package/bin/migrate/generators/compose-to-railway.js +138 -0
  126. package/bin/migrate/generators/compose-to-render.d.ts +2 -0
  127. package/bin/migrate/generators/compose-to-render.js +148 -0
  128. package/bin/migrate/generators/generic-migration.d.ts +9 -0
  129. package/bin/migrate/generators/generic-migration.js +221 -0
  130. package/bin/migrate/generators/heroku-to-fly.d.ts +2 -0
  131. package/bin/migrate/generators/heroku-to-fly.js +291 -0
  132. package/bin/migrate/generators/heroku-to-railway.d.ts +2 -0
  133. package/bin/migrate/generators/heroku-to-railway.js +283 -0
  134. package/bin/migrate/generators/heroku-to-render.d.ts +2 -0
  135. package/bin/migrate/generators/heroku-to-render.js +148 -0
  136. package/bin/migrate/generators/index.d.ts +7 -0
  137. package/bin/migrate/generators/index.js +17 -0
  138. package/bin/migrate/generators/template-loader.d.ts +21 -0
  139. package/bin/migrate/generators/template-loader.js +59 -0
  140. package/bin/migrate/index.d.ts +1 -0
  141. package/bin/migrate/index.js +5 -0
  142. package/bin/new/cli.d.ts +5 -1
  143. package/bin/new/cli.js +77 -14
  144. package/bin/new/form.d.ts +27 -4
  145. package/bin/new/form.js +605 -75
  146. package/bin/profile/analyzers/dockerfile-analyzer.d.ts +27 -0
  147. package/bin/profile/analyzers/dockerfile-analyzer.js +122 -0
  148. package/bin/profile/analyzers/image-analyzer.d.ts +19 -0
  149. package/bin/profile/analyzers/image-analyzer.js +85 -0
  150. package/bin/profile/cli.d.ts +4 -0
  151. package/bin/profile/cli.js +94 -0
  152. package/bin/profile/form.d.ts +56 -0
  153. package/bin/profile/form.js +401 -0
  154. package/bin/profile/index.d.ts +1 -0
  155. package/bin/profile/index.js +5 -0
  156. package/bin/profile/optimizers/index.d.ts +19 -0
  157. package/bin/profile/optimizers/index.js +137 -0
  158. package/bin/providers/add/form.d.ts +1 -1
  159. package/bin/providers/add/form.js +27 -6
  160. package/bin/providers/create/form.js +53 -3
  161. package/bin/scripts/form.js +27 -5
  162. package/bin/studio/cli.d.ts +15 -0
  163. package/bin/studio/cli.js +172 -0
  164. package/bin/studio/index.d.ts +5 -0
  165. package/bin/studio/index.js +9 -0
  166. package/bin/templates/cache.d.ts +54 -0
  167. package/bin/templates/cache.js +180 -0
  168. package/bin/templates/cli.d.ts +8 -0
  169. package/bin/templates/cli.js +294 -0
  170. package/bin/templates/fetcher.d.ts +49 -0
  171. package/bin/templates/fetcher.js +208 -0
  172. package/bin/templates/index.d.ts +11 -0
  173. package/bin/templates/index.js +37 -0
  174. package/bin/templates/manager.d.ts +116 -0
  175. package/bin/templates/manager.js +323 -0
  176. package/bin/templates/renderer.d.ts +49 -0
  177. package/bin/templates/renderer.js +204 -0
  178. package/bin/templates/types.d.ts +51 -0
  179. package/bin/templates/types.js +5 -0
  180. package/bin/utils/add-module-to-container.d.ts +14 -3
  181. package/bin/utils/add-module-to-container.js +327 -98
  182. package/bin/utils/cli-ui.d.ts +49 -3
  183. package/bin/utils/cli-ui.js +133 -13
  184. package/bin/utils/index.d.ts +4 -0
  185. package/bin/utils/index.js +4 -0
  186. package/bin/utils/input-validation.d.ts +50 -0
  187. package/bin/utils/input-validation.js +143 -0
  188. package/bin/utils/package-manager-commands.d.ts +24 -0
  189. package/bin/utils/package-manager-commands.js +50 -0
  190. package/bin/utils/safe-spawn.d.ts +35 -0
  191. package/bin/utils/safe-spawn.js +51 -0
  192. package/bin/utils/update-tsconfig-paths.d.ts +35 -0
  193. package/bin/utils/update-tsconfig-paths.js +326 -0
  194. package/package.json +165 -156
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateKubernetesConfigs = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const chalk_1 = __importDefault(require("chalk"));
10
+ const template_loader_1 = require("./template-loader");
11
+ const cli_ui_1 = require("../../utils/cli-ui");
12
+ async function generateKubernetesConfigs(options, analysis) {
13
+ const cwd = process.cwd();
14
+ const k8sDir = path_1.default.join(cwd, "k8s");
15
+ if (!fs_1.default.existsSync(k8sDir)) {
16
+ fs_1.default.mkdirSync(k8sDir, { recursive: true });
17
+ }
18
+ (0, cli_ui_1.printSection)(`📝 Generating Kubernetes configurations`);
19
+ const vars = {
20
+ port: analysis?.port || 3000,
21
+ memory: analysis?.estimatedMemory || "256Mi",
22
+ cpu: analysis?.estimatedCpu || "250m",
23
+ replicas: 3,
24
+ appName: "expressots-app",
25
+ namespace: "default",
26
+ healthCheckPath: analysis?.healthCheckPaths?.[0] || "/health",
27
+ };
28
+ // Generate deployment
29
+ const deploymentResult = await (0, template_loader_1.loadKubernetesTemplate)("deployment", vars, () => generateDeployment(options, analysis));
30
+ (0, template_loader_1.logTemplateSource)("k8s/deployment", deploymentResult.source);
31
+ fs_1.default.writeFileSync(path_1.default.join(k8sDir, "deployment.yaml"), deploymentResult.content, "utf-8");
32
+ (0, cli_ui_1.printBullet)(chalk_1.default.green(`✓ Created k8s/deployment.yaml`));
33
+ // Generate service
34
+ const serviceResult = await (0, template_loader_1.loadKubernetesTemplate)("service", vars, () => generateService(options, analysis));
35
+ (0, template_loader_1.logTemplateSource)("k8s/service", serviceResult.source);
36
+ fs_1.default.writeFileSync(path_1.default.join(k8sDir, "service.yaml"), serviceResult.content, "utf-8");
37
+ (0, cli_ui_1.printBullet)(chalk_1.default.green(`✓ Created k8s/service.yaml`));
38
+ // Generate config map
39
+ const configMapResult = await (0, template_loader_1.loadKubernetesTemplate)("configmap", vars, () => generateConfigMap(options, analysis));
40
+ (0, template_loader_1.logTemplateSource)("k8s/configmap", configMapResult.source);
41
+ fs_1.default.writeFileSync(path_1.default.join(k8sDir, "configmap.yaml"), configMapResult.content, "utf-8");
42
+ (0, cli_ui_1.printBullet)(chalk_1.default.green(`✓ Created k8s/configmap.yaml`));
43
+ }
44
+ exports.generateKubernetesConfigs = generateKubernetesConfigs;
45
+ function generateDeployment(options, analysis) {
46
+ const port = analysis?.port || 3000;
47
+ const memory = analysis?.estimatedMemory || "256Mi";
48
+ const cpu = analysis?.estimatedCpu || "250m";
49
+ return `# Kubernetes Deployment
50
+ # Generated by ExpressoTS CLI
51
+
52
+ apiVersion: apps/v1
53
+ kind: Deployment
54
+ metadata:
55
+ name: expressots-app
56
+ labels:
57
+ app: expressots-app
58
+ spec:
59
+ replicas: 3
60
+ selector:
61
+ matchLabels:
62
+ app: expressots-app
63
+ template:
64
+ metadata:
65
+ labels:
66
+ app: expressots-app
67
+ spec:
68
+ containers:
69
+ - name: app
70
+ image: your-registry/expressots-app:latest
71
+ ports:
72
+ - containerPort: ${port}
73
+ name: http
74
+ env:
75
+ - name: NODE_ENV
76
+ value: "production"
77
+ - name: PORT
78
+ value: "${port}"
79
+ envFrom:
80
+ - configMapRef:
81
+ name: app-config
82
+ resources:
83
+ requests:
84
+ memory: "${memory}"
85
+ cpu: "${cpu}"
86
+ limits:
87
+ memory: "${memory === "256Mi" ? "512Mi" : memory}"
88
+ cpu: "${cpu === "250m" ? "500m" : cpu}"
89
+ livenessProbe:
90
+ httpGet:
91
+ path: /health
92
+ port: ${port}
93
+ initialDelaySeconds: 30
94
+ periodSeconds: 10
95
+ readinessProbe:
96
+ httpGet:
97
+ path: /health
98
+ port: ${port}
99
+ initialDelaySeconds: 5
100
+ periodSeconds: 5
101
+ `;
102
+ }
103
+ function generateService(options, analysis) {
104
+ const port = analysis?.port || 3000;
105
+ return `# Kubernetes Service
106
+ # Generated by ExpressoTS CLI
107
+
108
+ apiVersion: v1
109
+ kind: Service
110
+ metadata:
111
+ name: expressots-app
112
+ spec:
113
+ type: LoadBalancer
114
+ selector:
115
+ app: expressots-app
116
+ ports:
117
+ - protocol: TCP
118
+ port: 80
119
+ targetPort: ${port}
120
+ `;
121
+ }
122
+ function generateConfigMap(options, analysis) {
123
+ return `# Kubernetes ConfigMap
124
+ # Generated by ExpressoTS CLI
125
+
126
+ apiVersion: v1
127
+ kind: ConfigMap
128
+ metadata:
129
+ name: app-config
130
+ data:
131
+ NODE_ENV: "production"
132
+ # Add your configuration here
133
+ `;
134
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Template loader for containerize generators
3
+ * Handles remote template fetching with fallback to embedded templates
4
+ */
5
+ import type { ProjectAnalysis } from "../analyzers/project-analyzer";
6
+ export interface DockerTemplateVars {
7
+ nodeVersion: string;
8
+ packageManager: string;
9
+ entryPoint: string;
10
+ port: number;
11
+ hasLocalDeps: boolean;
12
+ healthCheckEndpoint: string;
13
+ projectName: string;
14
+ installCommand: string;
15
+ buildCommand: string;
16
+ }
17
+ export interface TemplateResult {
18
+ content: string;
19
+ source: "remote" | "embedded";
20
+ }
21
+ /**
22
+ * Load Docker template with fallback
23
+ */
24
+ export declare function loadDockerTemplate(templateType: string, variables: DockerTemplateVars, embeddedGenerator: () => string): Promise<TemplateResult>;
25
+ /**
26
+ * Load Kubernetes template with fallback
27
+ */
28
+ export declare function loadKubernetesTemplate(templateType: string, variables: Record<string, unknown>, embeddedGenerator: () => string): Promise<TemplateResult>;
29
+ /**
30
+ * Build Docker template variables from analysis
31
+ */
32
+ export declare function buildDockerVars(analysis: ProjectAnalysis | undefined, entryPoint: string, packageManager?: string): DockerTemplateVars;
33
+ /**
34
+ * Log template source for debugging
35
+ */
36
+ export declare function logTemplateSource(templateName: string, source: "remote" | "embedded"): void;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ /**
3
+ * Template loader for containerize generators
4
+ * Handles remote template fetching with fallback to embedded templates
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.logTemplateSource = exports.buildDockerVars = exports.loadKubernetesTemplate = exports.loadDockerTemplate = void 0;
8
+ const templates_1 = require("../../templates");
9
+ /**
10
+ * Load Docker template with fallback
11
+ */
12
+ async function loadDockerTemplate(templateType, variables, embeddedGenerator) {
13
+ const manager = (0, templates_1.getTemplateManager)();
14
+ try {
15
+ // Try to fetch from remote template repository
16
+ const result = await manager.fetchDockerTemplate(templateType);
17
+ if (result.data) {
18
+ // Template found, render with variables
19
+ const renderOptions = {
20
+ variables: {
21
+ ...variables,
22
+ },
23
+ conditionals: {
24
+ hasLocalDeps: variables.hasLocalDeps,
25
+ useNpmCi: !variables.hasLocalDeps,
26
+ },
27
+ };
28
+ const rendered = manager.render(result.data, renderOptions);
29
+ return { content: rendered, source: "remote" };
30
+ }
31
+ }
32
+ catch {
33
+ // Remote fetch failed, fall back to embedded
34
+ }
35
+ // Fall back to embedded template generator
36
+ return {
37
+ content: embeddedGenerator(),
38
+ source: "embedded",
39
+ };
40
+ }
41
+ exports.loadDockerTemplate = loadDockerTemplate;
42
+ /**
43
+ * Load Kubernetes template with fallback
44
+ */
45
+ async function loadKubernetesTemplate(templateType, variables, embeddedGenerator) {
46
+ const manager = (0, templates_1.getTemplateManager)();
47
+ try {
48
+ // Try to fetch from remote template repository
49
+ const result = await manager.fetchKubernetesTemplate(templateType);
50
+ if (result.data) {
51
+ // Template found, render with variables
52
+ const renderOptions = {
53
+ variables: variables,
54
+ };
55
+ const rendered = manager.render(result.data, renderOptions);
56
+ return { content: rendered, source: "remote" };
57
+ }
58
+ }
59
+ catch {
60
+ // Remote fetch failed, fall back to embedded
61
+ }
62
+ // Fall back to embedded template generator
63
+ return {
64
+ content: embeddedGenerator(),
65
+ source: "embedded",
66
+ };
67
+ }
68
+ exports.loadKubernetesTemplate = loadKubernetesTemplate;
69
+ /**
70
+ * Build Docker template variables from analysis
71
+ */
72
+ function buildDockerVars(analysis, entryPoint, packageManager = "npm") {
73
+ return {
74
+ nodeVersion: analysis?.nodeVersion || "20",
75
+ packageManager,
76
+ entryPoint,
77
+ port: analysis?.port || 3000,
78
+ hasLocalDeps: analysis?.hasLocalDependencies || false,
79
+ healthCheckEndpoint: analysis?.healthCheckPaths?.[0] || "/health",
80
+ projectName: "expressots-app",
81
+ installCommand: getInstallCommand(packageManager, analysis?.hasLocalDependencies),
82
+ buildCommand: getBuildCommand(packageManager),
83
+ };
84
+ }
85
+ exports.buildDockerVars = buildDockerVars;
86
+ /**
87
+ * Get install command for package manager
88
+ */
89
+ function getInstallCommand(packageManager, hasLocalDeps) {
90
+ if (hasLocalDeps) {
91
+ // Use npm install when local deps exist (npm ci doesn't work well with local deps)
92
+ return packageManager === "pnpm"
93
+ ? "pnpm install"
94
+ : packageManager === "yarn"
95
+ ? "yarn install"
96
+ : "npm install";
97
+ }
98
+ switch (packageManager) {
99
+ case "pnpm":
100
+ return "pnpm install --frozen-lockfile";
101
+ case "yarn":
102
+ return "yarn install --frozen-lockfile";
103
+ default:
104
+ return "npm ci";
105
+ }
106
+ }
107
+ /**
108
+ * Get build command for package manager
109
+ */
110
+ function getBuildCommand(packageManager) {
111
+ switch (packageManager) {
112
+ case "pnpm":
113
+ return "pnpm build";
114
+ case "yarn":
115
+ return "yarn build";
116
+ default:
117
+ return "npm run build";
118
+ }
119
+ }
120
+ /**
121
+ * Log template source for debugging
122
+ */
123
+ function logTemplateSource(templateName, source) {
124
+ if (process.env.EXPRESSOTS_DEBUG) {
125
+ const sourceLabel = source === "remote" ? "remote template" : "embedded template";
126
+ console.log(` [DEBUG] ${templateName}: Using ${sourceLabel}`);
127
+ }
128
+ }
129
+ exports.logTemplateSource = logTemplateSource;
@@ -0,0 +1,4 @@
1
+ export { containerize } from "./cli";
2
+ export { containerizeProject } from "./form";
3
+ export { analyzeBootstrapConfig, shouldCopyEnvFiles, getEnvFileForEnvironment, type BootstrapConfig, type EnvFileMapping, } from "./analyzers/bootstrap-analyzer";
4
+ export { analyzeProject, type ProjectAnalysis, } from "./analyzers/project-analyzer";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.analyzeProject = exports.getEnvFileForEnvironment = exports.shouldCopyEnvFiles = exports.analyzeBootstrapConfig = exports.containerizeProject = exports.containerize = void 0;
4
+ var cli_1 = require("./cli");
5
+ Object.defineProperty(exports, "containerize", { enumerable: true, get: function () { return cli_1.containerize; } });
6
+ var form_1 = require("./form");
7
+ Object.defineProperty(exports, "containerizeProject", { enumerable: true, get: function () { return form_1.containerizeProject; } });
8
+ var bootstrap_analyzer_1 = require("./analyzers/bootstrap-analyzer");
9
+ Object.defineProperty(exports, "analyzeBootstrapConfig", { enumerable: true, get: function () { return bootstrap_analyzer_1.analyzeBootstrapConfig; } });
10
+ Object.defineProperty(exports, "shouldCopyEnvFiles", { enumerable: true, get: function () { return bootstrap_analyzer_1.shouldCopyEnvFiles; } });
11
+ Object.defineProperty(exports, "getEnvFileForEnvironment", { enumerable: true, get: function () { return bootstrap_analyzer_1.getEnvFileForEnvironment; } });
12
+ var project_analyzer_1 = require("./analyzers/project-analyzer");
13
+ Object.defineProperty(exports, "analyzeProject", { enumerable: true, get: function () { return project_analyzer_1.analyzeProject; } });
@@ -0,0 +1,20 @@
1
+ export interface PresetConfig {
2
+ name: string;
3
+ description: string;
4
+ baseImage?: string;
5
+ multiStage?: boolean;
6
+ security?: {
7
+ enabled: boolean;
8
+ nonRootUser?: boolean;
9
+ };
10
+ healthCheck?: {
11
+ enabled: boolean;
12
+ interval?: string;
13
+ };
14
+ optimization?: {
15
+ layerCaching?: boolean;
16
+ minimalDependencies?: boolean;
17
+ };
18
+ }
19
+ export declare function getPresetConfig(presetName: string): PresetConfig;
20
+ export declare function listPresets(): PresetConfig[];
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listPresets = exports.getPresetConfig = void 0;
4
+ const presets = {
5
+ standard: {
6
+ name: "Standard",
7
+ description: "Balanced configuration for most applications",
8
+ multiStage: true,
9
+ security: {
10
+ enabled: false,
11
+ },
12
+ healthCheck: {
13
+ enabled: false,
14
+ },
15
+ },
16
+ minimal: {
17
+ name: "Minimal",
18
+ description: "Smallest possible image size (<100MB)",
19
+ baseImage: "node:22-alpine",
20
+ multiStage: true,
21
+ security: {
22
+ enabled: false,
23
+ },
24
+ healthCheck: {
25
+ enabled: false,
26
+ },
27
+ optimization: {
28
+ layerCaching: true,
29
+ minimalDependencies: true,
30
+ },
31
+ },
32
+ secure: {
33
+ name: "Secure",
34
+ description: "Security-hardened configuration",
35
+ baseImage: "node:22-alpine",
36
+ multiStage: true,
37
+ security: {
38
+ enabled: true,
39
+ nonRootUser: true,
40
+ },
41
+ healthCheck: {
42
+ enabled: true,
43
+ interval: "30s",
44
+ },
45
+ optimization: {
46
+ layerCaching: true,
47
+ },
48
+ },
49
+ "fast-startup": {
50
+ name: "Fast Startup",
51
+ description: "Optimized for quick cold starts",
52
+ baseImage: "node:22-alpine",
53
+ multiStage: true,
54
+ security: {
55
+ enabled: false,
56
+ },
57
+ healthCheck: {
58
+ enabled: true,
59
+ },
60
+ optimization: {
61
+ layerCaching: true,
62
+ minimalDependencies: true,
63
+ },
64
+ },
65
+ dev: {
66
+ name: "Development",
67
+ description: "Development environment with hot reload",
68
+ baseImage: "node:22",
69
+ multiStage: false,
70
+ security: {
71
+ enabled: false,
72
+ },
73
+ healthCheck: {
74
+ enabled: false,
75
+ },
76
+ },
77
+ "multi-arch": {
78
+ name: "Multi-Architecture",
79
+ description: "Supports both ARM64 and x86_64",
80
+ baseImage: "node:22-alpine",
81
+ multiStage: true,
82
+ security: {
83
+ enabled: true,
84
+ },
85
+ healthCheck: {
86
+ enabled: true,
87
+ },
88
+ },
89
+ };
90
+ function getPresetConfig(presetName) {
91
+ const preset = presets[presetName];
92
+ if (!preset) {
93
+ console.warn(`Warning: Preset "${presetName}" not found. Using "standard" preset.`);
94
+ return presets.standard;
95
+ }
96
+ return preset;
97
+ }
98
+ exports.getPresetConfig = getPresetConfig;
99
+ function listPresets() {
100
+ return Object.values(presets);
101
+ }
102
+ exports.listPresets = listPresets;
@@ -0,0 +1,5 @@
1
+ import { CommandModule } from "yargs";
2
+ type CommandModuleArgs = Record<string, never>;
3
+ export type CloudProvider = "aws" | "gcp" | "azure" | "railway" | "render" | "fly" | "digitalocean" | "heroku";
4
+ declare const costsCommand: () => CommandModule<CommandModuleArgs, any>;
5
+ export { costsCommand };
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.costsCommand = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const form_1 = require("./form");
9
+ const pricing_manager_1 = require("./pricing-manager");
10
+ const cli_ui_1 = require("../utils/cli-ui");
11
+ const costsCommand = () => {
12
+ return {
13
+ command: "costs <action>",
14
+ describe: "Estimate and compare cloud deployment costs.",
15
+ aliases: ["cost", "pricing"],
16
+ builder: (yargs) => {
17
+ yargs.positional("action", {
18
+ choices: [
19
+ "estimate",
20
+ "compare",
21
+ "optimize",
22
+ "pricing",
23
+ "update",
24
+ "info",
25
+ ],
26
+ describe: "Action to perform",
27
+ type: "string",
28
+ demandOption: true,
29
+ });
30
+ yargs.option("provider", {
31
+ choices: [
32
+ "aws",
33
+ "gcp",
34
+ "azure",
35
+ "railway",
36
+ "render",
37
+ "fly",
38
+ "digitalocean",
39
+ "heroku",
40
+ ],
41
+ describe: "Cloud provider",
42
+ type: "string",
43
+ alias: "p",
44
+ });
45
+ yargs.option("service", {
46
+ choices: [
47
+ "ecs",
48
+ "eks",
49
+ "lambda",
50
+ "cloudrun",
51
+ "gke",
52
+ "aci",
53
+ "aks",
54
+ "web-service",
55
+ ],
56
+ describe: "Specific service type",
57
+ type: "string",
58
+ alias: "s",
59
+ });
60
+ yargs.option("instances", {
61
+ describe: "Number of instances/replicas",
62
+ type: "number",
63
+ alias: "i",
64
+ default: 1,
65
+ });
66
+ yargs.option("cpu", {
67
+ describe: "CPU cores/vCPUs per instance",
68
+ type: "number",
69
+ alias: "c",
70
+ default: 1,
71
+ });
72
+ yargs.option("memory", {
73
+ describe: "Memory in GB per instance",
74
+ type: "number",
75
+ alias: "m",
76
+ default: 1,
77
+ });
78
+ yargs.option("storage", {
79
+ describe: "Storage in GB",
80
+ type: "number",
81
+ default: 10,
82
+ });
83
+ yargs.option("bandwidth", {
84
+ describe: "Expected bandwidth in GB/month",
85
+ type: "number",
86
+ default: 100,
87
+ });
88
+ yargs.option("region", {
89
+ describe: "Cloud region",
90
+ type: "string",
91
+ alias: "r",
92
+ default: "us-east-1",
93
+ });
94
+ yargs.option("hours", {
95
+ describe: "Expected running hours per month",
96
+ type: "number",
97
+ default: 720, // 24 * 30
98
+ });
99
+ yargs.option("format", {
100
+ choices: ["text", "json", "markdown"],
101
+ describe: "Output format",
102
+ type: "string",
103
+ default: "text",
104
+ });
105
+ yargs.option("output", {
106
+ describe: "Output file",
107
+ type: "string",
108
+ alias: "o",
109
+ });
110
+ return yargs;
111
+ },
112
+ handler: async (argv) => {
113
+ const { action, provider, service, instances, cpu, memory, storage, bandwidth, region, hours, format, output, } = argv;
114
+ const options = {
115
+ provider: provider,
116
+ service,
117
+ instances,
118
+ cpu,
119
+ memory,
120
+ storage,
121
+ bandwidth,
122
+ region,
123
+ hours,
124
+ format: format,
125
+ output,
126
+ };
127
+ switch (action) {
128
+ case "estimate":
129
+ await (0, form_1.estimateCosts)(options);
130
+ break;
131
+ case "compare":
132
+ await (0, form_1.compareCosts)(options);
133
+ break;
134
+ case "optimize":
135
+ await (0, form_1.optimizeCosts)(options);
136
+ break;
137
+ case "pricing":
138
+ await (0, form_1.showPricing)(options);
139
+ break;
140
+ case "update":
141
+ await updatePricingData();
142
+ break;
143
+ case "info":
144
+ await showPricingInfo();
145
+ break;
146
+ default:
147
+ (0, cli_ui_1.printError)(`Unknown action: ${action}`, "costs");
148
+ process.exit(1);
149
+ }
150
+ },
151
+ };
152
+ };
153
+ exports.costsCommand = costsCommand;
154
+ /**
155
+ * Update pricing data from remote sources
156
+ */
157
+ async function updatePricingData() {
158
+ (0, cli_ui_1.printSection)("🔄 Updating Pricing Data...");
159
+ const manager = (0, pricing_manager_1.getPricingManager)();
160
+ manager.clearCache();
161
+ const success = await manager.updateCache();
162
+ if (success) {
163
+ const source = manager.getLastSource();
164
+ console.log(chalk_1.default.green(`✓ Pricing data updated`));
165
+ console.log(chalk_1.default.gray(` Source: ${source}`));
166
+ }
167
+ else {
168
+ console.log(chalk_1.default.red("✗ Failed to update pricing data"));
169
+ console.log(chalk_1.default.gray(" Check your network connection and try again."));
170
+ }
171
+ console.log();
172
+ }
173
+ /**
174
+ * Show pricing system info
175
+ */
176
+ async function showPricingInfo() {
177
+ const manager = (0, pricing_manager_1.getPricingManager)();
178
+ await manager.printStatus();
179
+ const providers = await manager.getAvailableProviders();
180
+ if (providers.length > 0) {
181
+ console.log(chalk_1.default.bold("\nAvailable Providers:"));
182
+ console.log(` ${providers.join(", ")}`);
183
+ }
184
+ console.log();
185
+ }
@@ -0,0 +1,44 @@
1
+ import type { CloudProvider } from "./cli";
2
+ export interface CostOptions {
3
+ provider?: CloudProvider;
4
+ service?: string;
5
+ instances: number;
6
+ cpu: number;
7
+ memory: number;
8
+ storage: number;
9
+ bandwidth: number;
10
+ region: string;
11
+ hours: number;
12
+ format: "text" | "json" | "markdown";
13
+ output?: string;
14
+ }
15
+ export interface CostEstimate {
16
+ provider: string;
17
+ service: string;
18
+ monthlyCost: number;
19
+ breakdown: CostBreakdown;
20
+ currency: string;
21
+ }
22
+ export interface CostBreakdown {
23
+ compute: number;
24
+ memory?: number;
25
+ storage: number;
26
+ bandwidth: number;
27
+ other: number;
28
+ }
29
+ /**
30
+ * Estimate costs for a specific provider
31
+ */
32
+ export declare function estimateCosts(options: CostOptions): Promise<void>;
33
+ /**
34
+ * Compare costs across all providers
35
+ */
36
+ export declare function compareCosts(options: CostOptions): Promise<void>;
37
+ /**
38
+ * Suggest cost optimizations
39
+ */
40
+ export declare function optimizeCosts(options: CostOptions): Promise<void>;
41
+ /**
42
+ * Show pricing information for a provider
43
+ */
44
+ export declare function showPricing(options: CostOptions): Promise<void>;