@salte-common/terraflow 0.1.0-alpha.1

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 (131) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +278 -0
  3. package/RELEASE_SUMMARY.md +53 -0
  4. package/STANDARDS_COMPLIANCE.md +85 -0
  5. package/bin/terraflow.js +3 -0
  6. package/bin/tf.js +3 -0
  7. package/dist/commands/apply.d.ts +7 -0
  8. package/dist/commands/apply.js +12 -0
  9. package/dist/commands/base.d.ts +7 -0
  10. package/dist/commands/base.js +12 -0
  11. package/dist/commands/config.d.ts +25 -0
  12. package/dist/commands/config.js +354 -0
  13. package/dist/commands/destroy.d.ts +7 -0
  14. package/dist/commands/destroy.js +12 -0
  15. package/dist/commands/init.d.ts +68 -0
  16. package/dist/commands/init.js +131 -0
  17. package/dist/commands/plan.d.ts +7 -0
  18. package/dist/commands/plan.js +12 -0
  19. package/dist/core/backend-state.d.ts +25 -0
  20. package/dist/core/backend-state.js +77 -0
  21. package/dist/core/config.d.ts +83 -0
  22. package/dist/core/config.js +295 -0
  23. package/dist/core/context.d.ts +52 -0
  24. package/dist/core/context.js +192 -0
  25. package/dist/core/environment.d.ts +62 -0
  26. package/dist/core/environment.js +205 -0
  27. package/dist/core/errors.d.ts +22 -0
  28. package/dist/core/errors.js +36 -0
  29. package/dist/core/plugin-loader.d.ts +21 -0
  30. package/dist/core/plugin-loader.js +136 -0
  31. package/dist/core/terraform.d.ts +45 -0
  32. package/dist/core/terraform.js +247 -0
  33. package/dist/core/validator.d.ts +103 -0
  34. package/dist/core/validator.js +304 -0
  35. package/dist/index.d.ts +7 -0
  36. package/dist/index.js +184 -0
  37. package/dist/plugins/auth/aws-assume-role.d.ts +10 -0
  38. package/dist/plugins/auth/aws-assume-role.js +110 -0
  39. package/dist/plugins/auth/azure-service-principal.d.ts +10 -0
  40. package/dist/plugins/auth/azure-service-principal.js +99 -0
  41. package/dist/plugins/auth/gcp-service-account.d.ts +10 -0
  42. package/dist/plugins/auth/gcp-service-account.js +105 -0
  43. package/dist/plugins/backends/azurerm.d.ts +10 -0
  44. package/dist/plugins/backends/azurerm.js +117 -0
  45. package/dist/plugins/backends/gcs.d.ts +10 -0
  46. package/dist/plugins/backends/gcs.js +75 -0
  47. package/dist/plugins/backends/local.d.ts +11 -0
  48. package/dist/plugins/backends/local.js +37 -0
  49. package/dist/plugins/backends/s3.d.ts +10 -0
  50. package/dist/plugins/backends/s3.js +185 -0
  51. package/dist/plugins/secrets/aws-secrets.d.ts +12 -0
  52. package/dist/plugins/secrets/aws-secrets.js +125 -0
  53. package/dist/plugins/secrets/azure-keyvault.d.ts +12 -0
  54. package/dist/plugins/secrets/azure-keyvault.js +178 -0
  55. package/dist/plugins/secrets/env.d.ts +24 -0
  56. package/dist/plugins/secrets/env.js +62 -0
  57. package/dist/plugins/secrets/gcp-secret-manager.d.ts +12 -0
  58. package/dist/plugins/secrets/gcp-secret-manager.js +157 -0
  59. package/dist/templates/application/go/go.mod.template +4 -0
  60. package/dist/templates/application/go/main.template +8 -0
  61. package/dist/templates/application/go/test.template +11 -0
  62. package/dist/templates/application/javascript/main.template +14 -0
  63. package/dist/templates/application/javascript/test.template +8 -0
  64. package/dist/templates/application/python/main.template +13 -0
  65. package/dist/templates/application/python/requirements.txt.template +3 -0
  66. package/dist/templates/application/python/test.template +8 -0
  67. package/dist/templates/application/typescript/main.template +14 -0
  68. package/dist/templates/application/typescript/test.template +8 -0
  69. package/dist/templates/application/typescript/tsconfig.json.template +20 -0
  70. package/dist/templates/config/README.md.template +82 -0
  71. package/dist/templates/config/env.example.template +22 -0
  72. package/dist/templates/config/gitignore.template +40 -0
  73. package/dist/templates/config/tfwconfig.yml.template +69 -0
  74. package/dist/templates/templates/application/go/go.mod.template +4 -0
  75. package/dist/templates/templates/application/go/main.template +8 -0
  76. package/dist/templates/templates/application/go/test.template +11 -0
  77. package/dist/templates/templates/application/javascript/main.template +14 -0
  78. package/dist/templates/templates/application/javascript/test.template +8 -0
  79. package/dist/templates/templates/application/python/main.template +13 -0
  80. package/dist/templates/templates/application/python/requirements.txt.template +3 -0
  81. package/dist/templates/templates/application/python/test.template +8 -0
  82. package/dist/templates/templates/application/typescript/main.template +14 -0
  83. package/dist/templates/templates/application/typescript/test.template +8 -0
  84. package/dist/templates/templates/application/typescript/tsconfig.json.template +20 -0
  85. package/dist/templates/templates/config/README.md.template +82 -0
  86. package/dist/templates/templates/config/env.example.template +22 -0
  87. package/dist/templates/templates/config/gitignore.template +40 -0
  88. package/dist/templates/templates/config/tfwconfig.yml.template +69 -0
  89. package/dist/templates/templates/terraform/aws/_init.tf.template +24 -0
  90. package/dist/templates/templates/terraform/aws/inputs.tf.template +11 -0
  91. package/dist/templates/templates/terraform/azure/_init.tf.template +19 -0
  92. package/dist/templates/templates/terraform/azure/inputs.tf.template +11 -0
  93. package/dist/templates/templates/terraform/gcp/_init.tf.template +20 -0
  94. package/dist/templates/templates/terraform/gcp/inputs.tf.template +16 -0
  95. package/dist/templates/templates/terraform/locals.tf.template +9 -0
  96. package/dist/templates/templates/terraform/main.tf.template +8 -0
  97. package/dist/templates/templates/terraform/modules/inputs.tf.template +5 -0
  98. package/dist/templates/templates/terraform/modules/main.tf.template +2 -0
  99. package/dist/templates/templates/terraform/modules/outputs.tf.template +2 -0
  100. package/dist/templates/templates/terraform/outputs.tf.template +6 -0
  101. package/dist/templates/terraform/aws/_init.tf.template +24 -0
  102. package/dist/templates/terraform/aws/inputs.tf.template +11 -0
  103. package/dist/templates/terraform/azure/_init.tf.template +19 -0
  104. package/dist/templates/terraform/azure/inputs.tf.template +11 -0
  105. package/dist/templates/terraform/gcp/_init.tf.template +20 -0
  106. package/dist/templates/terraform/gcp/inputs.tf.template +16 -0
  107. package/dist/templates/terraform/locals.tf.template +9 -0
  108. package/dist/templates/terraform/main.tf.template +8 -0
  109. package/dist/templates/terraform/modules/inputs.tf.template +5 -0
  110. package/dist/templates/terraform/modules/main.tf.template +2 -0
  111. package/dist/templates/terraform/modules/outputs.tf.template +2 -0
  112. package/dist/templates/terraform/outputs.tf.template +6 -0
  113. package/dist/types/config.d.ts +92 -0
  114. package/dist/types/config.js +6 -0
  115. package/dist/types/context.d.ts +59 -0
  116. package/dist/types/context.js +6 -0
  117. package/dist/types/index.d.ts +7 -0
  118. package/dist/types/index.js +23 -0
  119. package/dist/types/plugins.d.ts +77 -0
  120. package/dist/types/plugins.js +6 -0
  121. package/dist/utils/cloud.d.ts +43 -0
  122. package/dist/utils/cloud.js +150 -0
  123. package/dist/utils/git.d.ts +88 -0
  124. package/dist/utils/git.js +258 -0
  125. package/dist/utils/logger.d.ts +67 -0
  126. package/dist/utils/logger.js +121 -0
  127. package/dist/utils/scaffolding.d.ts +92 -0
  128. package/dist/utils/scaffolding.js +338 -0
  129. package/dist/utils/templates.d.ts +25 -0
  130. package/dist/utils/templates.js +70 -0
  131. package/package.json +60 -0
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ /**
3
+ * Git operations utility
4
+ * Provides git-related functionality for workspace derivation
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.GitUtils = void 0;
11
+ const child_process_1 = require("child_process");
12
+ const fs_1 = __importDefault(require("fs"));
13
+ const path_1 = __importDefault(require("path"));
14
+ /**
15
+ * Git utilities for workspace derivation and VCS information
16
+ */
17
+ class GitUtils {
18
+ /**
19
+ * Check if current directory is in a git repository
20
+ * @param cwd - Working directory to check
21
+ * @returns True if in a git repository
22
+ */
23
+ static isGitRepository(cwd = process.cwd()) {
24
+ const gitDir = path_1.default.join(cwd, '.git');
25
+ return fs_1.default.existsSync(gitDir) && fs_1.default.statSync(gitDir).isDirectory();
26
+ }
27
+ /**
28
+ * Get current git branch name
29
+ * @param cwd - Working directory
30
+ * @returns Branch name or undefined if not in git repo or not on a branch
31
+ */
32
+ static async getBranch(cwd = process.cwd()) {
33
+ if (!GitUtils.isGitRepository(cwd)) {
34
+ return undefined;
35
+ }
36
+ try {
37
+ const result = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', {
38
+ cwd,
39
+ encoding: 'utf8',
40
+ stdio: ['pipe', 'pipe', 'pipe'],
41
+ });
42
+ const branch = result.trim();
43
+ return branch && branch !== 'HEAD' ? branch : undefined;
44
+ }
45
+ catch {
46
+ return undefined;
47
+ }
48
+ }
49
+ /**
50
+ * Get current git tag if HEAD is on a tag
51
+ * @param cwd - Working directory
52
+ * @returns Tag name or undefined if not on a tag
53
+ */
54
+ static async getTag(cwd = process.cwd()) {
55
+ if (!GitUtils.isGitRepository(cwd)) {
56
+ return undefined;
57
+ }
58
+ try {
59
+ const result = (0, child_process_1.execSync)('git describe --exact-match --tags HEAD 2>/dev/null', {
60
+ cwd,
61
+ encoding: 'utf8',
62
+ stdio: ['pipe', 'pipe', 'pipe'],
63
+ });
64
+ const tag = result.trim();
65
+ return tag || undefined;
66
+ }
67
+ catch {
68
+ return undefined;
69
+ }
70
+ }
71
+ /**
72
+ * Get git commit SHA (full)
73
+ * @param cwd - Working directory
74
+ * @returns Full commit SHA or undefined
75
+ */
76
+ static async getCommitSha(cwd = process.cwd()) {
77
+ if (!GitUtils.isGitRepository(cwd)) {
78
+ return undefined;
79
+ }
80
+ try {
81
+ const result = (0, child_process_1.execSync)('git rev-parse HEAD', {
82
+ cwd,
83
+ encoding: 'utf8',
84
+ stdio: ['pipe', 'pipe', 'pipe'],
85
+ });
86
+ return result.trim() || undefined;
87
+ }
88
+ catch {
89
+ return undefined;
90
+ }
91
+ }
92
+ /**
93
+ * Get short git commit SHA (7 characters)
94
+ * @param cwd - Working directory
95
+ * @returns Short commit SHA or undefined
96
+ */
97
+ static async getShortSha(cwd = process.cwd()) {
98
+ if (!GitUtils.isGitRepository(cwd)) {
99
+ return undefined;
100
+ }
101
+ try {
102
+ const result = (0, child_process_1.execSync)('git rev-parse --short HEAD', {
103
+ cwd,
104
+ encoding: 'utf8',
105
+ stdio: ['pipe', 'pipe', 'pipe'],
106
+ });
107
+ return result.trim() || undefined;
108
+ }
109
+ catch {
110
+ return undefined;
111
+ }
112
+ }
113
+ /**
114
+ * Check if git working directory is clean (no uncommitted changes)
115
+ * @param cwd - Working directory
116
+ * @returns True if working directory is clean
117
+ */
118
+ static async isClean(cwd = process.cwd()) {
119
+ if (!GitUtils.isGitRepository(cwd)) {
120
+ return true; // Not a git repo, consider it "clean"
121
+ }
122
+ try {
123
+ (0, child_process_1.execSync)('git diff-index --quiet HEAD --', {
124
+ cwd,
125
+ stdio: ['pipe', 'pipe', 'pipe'],
126
+ });
127
+ return true;
128
+ }
129
+ catch {
130
+ return false;
131
+ }
132
+ }
133
+ /**
134
+ * Get GitHub repository name from git remote (format: owner/repo)
135
+ * @param cwd - Working directory
136
+ * @returns Repository name in format "owner/repo" or undefined
137
+ */
138
+ static async getGithubRepository(cwd = process.cwd()) {
139
+ if (!GitUtils.isGitRepository(cwd)) {
140
+ return undefined;
141
+ }
142
+ try {
143
+ const result = (0, child_process_1.execSync)('git remote get-url origin', {
144
+ cwd,
145
+ encoding: 'utf8',
146
+ stdio: ['pipe', 'pipe', 'pipe'],
147
+ });
148
+ const url = result.trim();
149
+ return GitUtils.parseGithubUrl(url);
150
+ }
151
+ catch {
152
+ return undefined;
153
+ }
154
+ }
155
+ /**
156
+ * Get GitLab project path from git remote
157
+ * @param cwd - Working directory
158
+ * @returns GitLab project path or undefined
159
+ */
160
+ static async getGitlabProjectPath(cwd = process.cwd()) {
161
+ if (!GitUtils.isGitRepository(cwd)) {
162
+ return undefined;
163
+ }
164
+ try {
165
+ const result = (0, child_process_1.execSync)('git remote get-url origin', {
166
+ cwd,
167
+ encoding: 'utf8',
168
+ stdio: ['pipe', 'pipe', 'pipe'],
169
+ });
170
+ const url = result.trim();
171
+ return GitUtils.parseGitlabUrl(url);
172
+ }
173
+ catch {
174
+ return undefined;
175
+ }
176
+ }
177
+ /**
178
+ * Parse GitHub URL to extract owner/repo
179
+ * Supports https://, git@, and git:// formats
180
+ * @param url - Git remote URL
181
+ * @returns Repository name in format "owner/repo" or undefined
182
+ */
183
+ static parseGithubUrl(url) {
184
+ // Match patterns:
185
+ // https://github.com/owner/repo.git
186
+ // https://github.com/owner/repo
187
+ // git@github.com:owner/repo.git
188
+ // git@github.com:owner/repo
189
+ // git://github.com/owner/repo.git
190
+ const patterns = [
191
+ /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?$/,
192
+ /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?\/?$/,
193
+ ];
194
+ for (const pattern of patterns) {
195
+ const match = url.match(pattern);
196
+ if (match) {
197
+ return `${match[1]}/${match[2]}`;
198
+ }
199
+ }
200
+ return undefined;
201
+ }
202
+ /**
203
+ * Parse GitLab URL to extract project path
204
+ * Supports https:// and git@ formats
205
+ * @param url - Git remote URL
206
+ * @returns GitLab project path or undefined
207
+ */
208
+ static parseGitlabUrl(url) {
209
+ // Match patterns:
210
+ // https://gitlab.com/group/subgroup/project.git
211
+ // https://gitlab.com/group/subgroup/project
212
+ // git@gitlab.com:group/subgroup/project.git
213
+ // git@gitlab.com:group/subgroup/project
214
+ const patterns = [/gitlab\.com[/:](.+?)(?:\.git)?$/, /gitlab\.com[/:](.+?)(?:\.git)?\/?$/];
215
+ for (const pattern of patterns) {
216
+ const match = url.match(pattern);
217
+ if (match) {
218
+ return match[1];
219
+ }
220
+ }
221
+ return undefined;
222
+ }
223
+ /**
224
+ * Check if a branch name is ephemeral (has a prefix like "feature/")
225
+ * Uses regex: /^[^/]+\//
226
+ * @param branchName - Branch name to check
227
+ * @returns True if branch is ephemeral
228
+ */
229
+ static isEphemeralBranch(branchName) {
230
+ return /^[^/]+\//.test(branchName);
231
+ }
232
+ /**
233
+ * Sanitize workspace name according to spec
234
+ * - Remove refs/heads/ or refs/tags/ prefix
235
+ * - Replace invalid characters (/ and spaces) with hyphens
236
+ * - Result must match /^[a-zA-Z0-9_-]+$/
237
+ * @param name - Workspace name to sanitize
238
+ * @returns Sanitized workspace name
239
+ */
240
+ static sanitizeWorkspaceName(name) {
241
+ // Remove refs/heads/ or refs/tags/ prefix
242
+ let sanitized = name.replace(/^refs\/(heads|tags)\//, '');
243
+ // Replace invalid characters (/, spaces, dots) with hyphens
244
+ sanitized = sanitized.replace(/[/\s.]+/g, '-');
245
+ // Remove any remaining invalid characters (keep only alphanumeric, underscore, hyphen)
246
+ sanitized = sanitized.replace(/[^a-zA-Z0-9_-]/g, '');
247
+ // Remove leading/trailing hyphens
248
+ sanitized = sanitized.replace(/^-+|-+$/g, '');
249
+ // Ensure it matches the required pattern
250
+ if (!/^[a-zA-Z0-9_-]+$/.test(sanitized)) {
251
+ // Fallback to safe default if sanitization fails
252
+ sanitized = 'default';
253
+ }
254
+ return sanitized || 'default';
255
+ }
256
+ }
257
+ exports.GitUtils = GitUtils;
258
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Logging utilities
3
+ * Provides structured logging for Terraflow CLI
4
+ */
5
+ export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
6
+ /**
7
+ * Logger class for Terraflow CLI
8
+ * Supports different log levels and colored output
9
+ */
10
+ export declare class Logger {
11
+ private static level;
12
+ private static colorEnabled;
13
+ /**
14
+ * Set the log level
15
+ * @param level - Log level to use
16
+ */
17
+ static setLevel(level: LogLevel): void;
18
+ /**
19
+ * Enable or disable colored output
20
+ * @param enabled - Whether to enable colors
21
+ */
22
+ static setColor(enabled: boolean): void;
23
+ /**
24
+ * Check if a message should be logged at the current level
25
+ * @param messageLevel - Level of the message
26
+ * @returns Whether the message should be logged
27
+ */
28
+ private static shouldLog;
29
+ /**
30
+ * Format a message with color if enabled
31
+ * @param message - Message to format
32
+ * @param colorName - Color name (red, yellow, blue, green, gray)
33
+ * @returns Formatted message
34
+ */
35
+ private static format;
36
+ /**
37
+ * Log an error message
38
+ * @param message - Error message
39
+ * @param args - Additional arguments
40
+ */
41
+ static error(message: string, ...args: unknown[]): void;
42
+ /**
43
+ * Log a warning message
44
+ * @param message - Warning message
45
+ * @param args - Additional arguments
46
+ */
47
+ static warn(message: string, ...args: unknown[]): void;
48
+ /**
49
+ * Log an info message
50
+ * @param message - Info message
51
+ * @param args - Additional arguments
52
+ */
53
+ static info(message: string, ...args: unknown[]): void;
54
+ /**
55
+ * Log a debug message
56
+ * @param message - Debug message
57
+ * @param args - Additional arguments
58
+ */
59
+ static debug(message: string, ...args: unknown[]): void;
60
+ /**
61
+ * Log a success message (info level with green color)
62
+ * @param message - Success message
63
+ * @param args - Additional arguments
64
+ */
65
+ static success(message: string, ...args: unknown[]): void;
66
+ }
67
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ /**
3
+ * Logging utilities
4
+ * Provides structured logging for Terraflow CLI
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Logger = void 0;
8
+ /**
9
+ * ANSI color codes for terminal output
10
+ */
11
+ const Colors = {
12
+ reset: '\x1b[0m',
13
+ red: '\x1b[31m',
14
+ yellow: '\x1b[33m',
15
+ blue: '\x1b[34m',
16
+ green: '\x1b[32m',
17
+ gray: '\x1b[90m',
18
+ };
19
+ /**
20
+ * Logger class for Terraflow CLI
21
+ * Supports different log levels and colored output
22
+ */
23
+ class Logger {
24
+ static level = 'info';
25
+ static colorEnabled = true;
26
+ /**
27
+ * Set the log level
28
+ * @param level - Log level to use
29
+ */
30
+ static setLevel(level) {
31
+ Logger.level = level;
32
+ }
33
+ /**
34
+ * Enable or disable colored output
35
+ * @param enabled - Whether to enable colors
36
+ */
37
+ static setColor(enabled) {
38
+ Logger.colorEnabled = enabled;
39
+ }
40
+ /**
41
+ * Check if a message should be logged at the current level
42
+ * @param messageLevel - Level of the message
43
+ * @returns Whether the message should be logged
44
+ */
45
+ static shouldLog(messageLevel) {
46
+ const levels = ['error', 'warn', 'info', 'debug'];
47
+ const currentIndex = levels.indexOf(Logger.level);
48
+ const messageIndex = levels.indexOf(messageLevel);
49
+ return messageIndex <= currentIndex;
50
+ }
51
+ /**
52
+ * Format a message with color if enabled
53
+ * @param message - Message to format
54
+ * @param colorName - Color name (red, yellow, blue, green, gray)
55
+ * @returns Formatted message
56
+ */
57
+ static format(message, colorName) {
58
+ if (!Logger.colorEnabled) {
59
+ return message;
60
+ }
61
+ const color = Colors[colorName];
62
+ return `${color}${message}${Colors.reset}`;
63
+ }
64
+ /**
65
+ * Log an error message
66
+ * @param message - Error message
67
+ * @param args - Additional arguments
68
+ */
69
+ static error(message, ...args) {
70
+ if (Logger.shouldLog('error')) {
71
+ const formatted = Logger.format(message, 'red');
72
+ console.error(formatted, ...args);
73
+ }
74
+ }
75
+ /**
76
+ * Log a warning message
77
+ * @param message - Warning message
78
+ * @param args - Additional arguments
79
+ */
80
+ static warn(message, ...args) {
81
+ if (Logger.shouldLog('warn')) {
82
+ const formatted = Logger.format(message, 'yellow');
83
+ console.warn(formatted, ...args);
84
+ }
85
+ }
86
+ /**
87
+ * Log an info message
88
+ * @param message - Info message
89
+ * @param args - Additional arguments
90
+ */
91
+ static info(message, ...args) {
92
+ if (Logger.shouldLog('info')) {
93
+ const formatted = Logger.format(message, 'blue');
94
+ console.info(formatted, ...args);
95
+ }
96
+ }
97
+ /**
98
+ * Log a debug message
99
+ * @param message - Debug message
100
+ * @param args - Additional arguments
101
+ */
102
+ static debug(message, ...args) {
103
+ if (Logger.shouldLog('debug')) {
104
+ const formatted = Logger.format(message, 'gray');
105
+ console.debug(formatted, ...args);
106
+ }
107
+ }
108
+ /**
109
+ * Log a success message (info level with green color)
110
+ * @param message - Success message
111
+ * @param args - Additional arguments
112
+ */
113
+ static success(message, ...args) {
114
+ if (Logger.shouldLog('info')) {
115
+ const formatted = Logger.format(message, 'green');
116
+ console.info(formatted, ...args);
117
+ }
118
+ }
119
+ }
120
+ exports.Logger = Logger;
121
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Scaffolding utilities for project initialization
3
+ * Handles template processing and file generation
4
+ */
5
+ /**
6
+ * Template processing functions
7
+ */
8
+ /**
9
+ * Load a template file from the templates directory
10
+ * @param templatePath - Path to template file relative to templates directory
11
+ * @returns Template content as string
12
+ */
13
+ export declare function loadTemplate(templatePath: string): string;
14
+ /**
15
+ * Process a template string by replacing variable placeholders
16
+ * @param template - Template content with placeholders
17
+ * @param variables - Object mapping variable names to values
18
+ * @returns Processed template with variables replaced
19
+ */
20
+ export declare function processTemplate(template: string, variables: Record<string, string>): string;
21
+ /**
22
+ * File generation functions
23
+ */
24
+ /**
25
+ * Generate Terraform files for the project
26
+ * @param projectDir - Root directory of the project
27
+ * @param provider - Cloud provider (aws, azure, gcp)
28
+ * @param projectName - Name of the project
29
+ */
30
+ export declare function generateTerraformFiles(projectDir: string, provider: string, projectName: string): Promise<void>;
31
+ /**
32
+ * Generate application files for the project
33
+ * @param projectDir - Root directory of the project
34
+ * @param language - Programming language (javascript, typescript, python, go)
35
+ * @param projectName - Name of the project
36
+ */
37
+ export declare function generateApplicationFiles(projectDir: string, language: string, projectName: string): Promise<void>;
38
+ /**
39
+ * Generate configuration files for the project
40
+ * @param projectDir - Root directory of the project
41
+ * @param provider - Cloud provider (aws, azure, gcp)
42
+ * @param language - Programming language (javascript, typescript, python, go)
43
+ * @param projectName - Name of the project
44
+ */
45
+ export declare function generateConfigFiles(projectDir: string, provider: string, language: string, projectName: string): Promise<void>;
46
+ /**
47
+ * Project structure creation
48
+ */
49
+ /**
50
+ * Create the complete project directory structure
51
+ * @param projectDir - Root directory of the project
52
+ */
53
+ export declare function createProjectStructure(projectDir: string): Promise<void>;
54
+ /**
55
+ * Validation helpers
56
+ */
57
+ /**
58
+ * Validate project name format
59
+ * @param name - Project name to validate
60
+ * @returns true if valid, false otherwise
61
+ */
62
+ export declare function validateProjectName(name: string): boolean;
63
+ /**
64
+ * Validate cloud provider
65
+ * @param provider - Provider name to validate
66
+ * @returns true if valid, false otherwise
67
+ */
68
+ export declare function validateProvider(provider: string): boolean;
69
+ /**
70
+ * Validate programming language
71
+ * @param language - Language name to validate
72
+ * @returns true if valid, false otherwise
73
+ */
74
+ export declare function validateLanguage(language: string): boolean;
75
+ /**
76
+ * Check if a directory is empty
77
+ * @param dir - Directory path to check
78
+ * @returns true if directory is empty or doesn't exist, false otherwise
79
+ */
80
+ export declare function isDirectoryEmpty(dir: string): Promise<boolean>;
81
+ /**
82
+ * Template variable builder
83
+ */
84
+ /**
85
+ * Build template variables object from project parameters
86
+ * @param projectName - Name of the project
87
+ * @param provider - Cloud provider (aws, azure, gcp)
88
+ * @param language - Programming language (javascript, typescript, python, go)
89
+ * @returns Object with all template variable mappings
90
+ */
91
+ export declare function buildTemplateVariables(projectName: string, provider: string, _language: string): Record<string, string>;
92
+ //# sourceMappingURL=scaffolding.d.ts.map