@tamyla/clodo-framework 2.0.18 → 2.0.19

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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [2.0.19](https://github.com/tamylaa/clodo-framework/compare/v2.0.18...v2.0.19) (2025-10-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add comprehensive deployment configuration implementation status ([025fe82](https://github.com/tamylaa/clodo-framework/commit/025fe821a76ba9ac8cb87d14f2a116a5e8e58c43))
7
+ * Consolidate configuration management and organize documentation ([e3a3d44](https://github.com/tamylaa/clodo-framework/commit/e3a3d448a74b214d75ae669f3a17e3a6ddb36ac4))
8
+ * Resolve ESLint errors in security and config modules ([1080cdb](https://github.com/tamylaa/clodo-framework/commit/1080cdbb69b3ae29158b6af705d8fd376c95da7b))
9
+
1
10
  ## [2.0.18](https://github.com/tamylaa/clodo-framework/compare/v2.0.17...v2.0.18) (2025-10-12)
2
11
 
3
12
 
@@ -1,5 +1,6 @@
1
1
  import { ConfigurationValidator } from '../security/ConfigurationValidator.js';
2
- import { DeploymentManager } from '../security/DeploymentManager.js';
2
+ // DeploymentManager removed - was simulated deployment only
3
+ // Use MultiDomainOrchestrator for real deployments
3
4
  import { SecretGenerator } from '../security/SecretGenerator.js';
4
5
  import { isValidEnvironment } from '../security/patterns/environment-rules.js';
5
6
 
@@ -17,10 +18,16 @@ export const securityModule = {
17
18
  generateSecureKey: prefix => SecretGenerator.generateSecureApiKey(32, prefix),
18
19
  generateSecureJwtSecret: length => SecretGenerator.generateSecureJwtSecret(length || 64),
19
20
  generateServiceKey: (serviceName, env, length) => SecretGenerator.generateServiceKey(serviceName, env, length),
20
- // Secure deployment
21
- deployWithSecurity: options => DeploymentManager.deployWithSecurity(options),
22
- generateSecureConfig: (customer, env) => DeploymentManager.generateSecureConfig(customer, env),
23
- validateDeploymentReadiness: (customer, env) => DeploymentManager.validateDeploymentReadiness(customer, env),
21
+ // Secure deployment (DEPRECATED)
22
+ deployWithSecurity: () => {
23
+ throw new Error('deployWithSecurity is deprecated. Use MultiDomainOrchestrator for real deployments.');
24
+ },
25
+ generateSecureConfig: () => {
26
+ throw new Error('generateSecureConfig is deprecated. Use UnifiedConfigManager for configuration.');
27
+ },
28
+ validateDeploymentReadiness: () => {
29
+ throw new Error('validateDeploymentReadiness is deprecated. Use MultiDomainOrchestrator validation.');
30
+ },
24
31
  // Pre-deployment hooks
25
32
  hooks: {
26
33
  'pre-deployment': async context => {
@@ -43,18 +50,13 @@ export const securityModule = {
43
50
  throw new Error('Deployment blocked due to critical security issues');
44
51
  }
45
52
 
46
- // Check deployment readiness
47
- const readiness = DeploymentManager.validateDeploymentReadiness(customer, environment);
48
- if (!readiness.ready) {
49
- console.error('❌ Deployment not ready:');
50
- readiness.issues.forEach(issue => console.error(` - ${issue}`));
51
- throw new Error('Deployment blocked due to readiness issues');
52
- }
53
+ // Check deployment readiness (DEPRECATED - commented out)
54
+ // Use MultiDomainOrchestrator's validation instead
55
+ console.log('⚠️ DeploymentManager readiness check skipped (deprecated)');
53
56
  console.log(`✅ Security validation passed (${issues.length} total issues, ${criticalIssues.length} critical)`);
54
57
  return {
55
58
  valid: true,
56
- issues,
57
- readiness
59
+ issues
58
60
  };
59
61
  },
60
62
  'post-deployment': async context => {
@@ -64,14 +66,14 @@ export const securityModule = {
64
66
  } = context;
65
67
  console.log(`🔍 Post-deployment security checks for ${customer}/${environment}`);
66
68
 
67
- // Perform post-deployment validation
68
- try {
69
- await DeploymentManager.performPostDeploymentChecks(customer, environment);
70
- console.log(`✅ Post-deployment checks passed`);
71
- } catch (error) {
72
- console.error(`❌ Post-deployment checks failed: ${error.message}`);
73
- throw error;
74
- }
69
+ // Perform post-deployment validation (DEPRECATED - commented out)
70
+ // DeploymentManager.performPostDeploymentChecks was simulated only
71
+ console.log('⚠️ Post-deployment checks skipped (DeploymentManager deprecated)');
72
+ console.log(`✅ Post-deployment phase complete`);
73
+ return {
74
+ success: true,
75
+ message: 'Post-deployment phase complete (DeploymentManager checks deprecated)'
76
+ };
75
77
  }
76
78
  },
77
79
  // Utility methods
@@ -12,6 +12,7 @@ import { DeploymentCoordinator } from './modules/DeploymentCoordinator.js';
12
12
  import { StateManager } from './modules/StateManager.js';
13
13
  import { DatabaseOrchestrator } from '../database/database-orchestrator.js';
14
14
  import { EnhancedSecretManager } from '../utils/deployment/secret-generator.js';
15
+ import { WranglerConfigManager } from '../utils/deployment/wrangler-config-manager.js';
15
16
  import { ConfigurationValidator } from '../security/ConfigurationValidator.js';
16
17
  import { exec } from 'child_process';
17
18
  import { promisify } from 'util';
@@ -63,6 +64,11 @@ export class MultiDomainOrchestrator {
63
64
  projectRoot: this.servicePath,
64
65
  dryRun: this.dryRun
65
66
  });
67
+ this.wranglerConfigManager = new WranglerConfigManager({
68
+ projectRoot: this.servicePath,
69
+ dryRun: this.dryRun,
70
+ verbose: options.verbose || false
71
+ });
66
72
 
67
73
  // ConfigurationValidator is a static class - don't instantiate
68
74
  // Access via ConfigurationValidator.validate() directly
@@ -274,6 +280,24 @@ export class MultiDomainOrchestrator {
274
280
  domainState.databaseId = databaseId;
275
281
  }
276
282
 
283
+ // CRITICAL: Update wrangler.toml BEFORE attempting migrations
284
+ console.log(` 📝 Configuring wrangler.toml for database...`);
285
+ try {
286
+ // Ensure environment section exists
287
+ await this.wranglerConfigManager.ensureEnvironment(this.environment);
288
+
289
+ // Add database binding (use snake_case for wrangler.toml compatibility)
290
+ await this.wranglerConfigManager.addDatabaseBinding(this.environment, {
291
+ binding: 'DB',
292
+ database_name: databaseName,
293
+ database_id: databaseId
294
+ });
295
+ console.log(` ✅ wrangler.toml updated with database configuration`);
296
+ } catch (configError) {
297
+ console.warn(` ⚠️ Failed to update wrangler.toml: ${configError.message}`);
298
+ console.warn(` 💡 You may need to manually add database configuration`);
299
+ }
300
+
277
301
  // Apply migrations using DatabaseOrchestrator's enterprise capabilities
278
302
  console.log(` 🔄 Applying database migrations...`);
279
303
  try {
@@ -377,6 +401,15 @@ export class MultiDomainOrchestrator {
377
401
  };
378
402
  }
379
403
  try {
404
+ // CRITICAL: Ensure environment section exists in wrangler.toml BEFORE deploying
405
+ console.log(` 📝 Verifying wrangler.toml configuration...`);
406
+ try {
407
+ await this.wranglerConfigManager.ensureEnvironment(this.environment);
408
+ } catch (configError) {
409
+ console.warn(` ⚠️ Could not verify wrangler.toml: ${configError.message}`);
410
+ // Continue anyway - wrangler will provide clearer error if config is wrong
411
+ }
412
+
380
413
  // Find wrangler.toml in service path
381
414
  const wranglerConfigPath = join(this.servicePath, 'wrangler.toml');
382
415
 
@@ -5,7 +5,9 @@
5
5
 
6
6
  import { ConfigurationValidator } from '../security/ConfigurationValidator.js';
7
7
  import { SecretGenerator } from '../security/SecretGenerator.js';
8
- import { DeploymentManager } from '../security/DeploymentManager.js';
8
+ // DeploymentManager removed - was simulated deployment only
9
+ // Use MultiDomainOrchestrator for real deployments
10
+
9
11
  export class SecurityCLI {
10
12
  constructor() {
11
13
  // Initialize with default settings
@@ -76,6 +78,7 @@ export class SecurityCLI {
76
78
 
77
79
  /**
78
80
  * Deploy with security validation
81
+ * @deprecated Use MultiDomainOrchestrator for real deployments
79
82
  * @param {string} customer - Customer name
80
83
  * @param {string} environment - Environment name
81
84
  * @param {Object} options - Deployment options
@@ -83,89 +86,29 @@ export class SecurityCLI {
83
86
  * @returns {Object} Deployment result
84
87
  */
85
88
  async deployWithSecurity(customer, environment, options = {}) {
86
- try {
87
- if (!customer || !environment) {
88
- throw new Error('Customer and environment are required');
89
- }
90
- const result = await DeploymentManager.deployWithSecurity({
91
- customer,
92
- environment,
93
- dryRun: options.dryRun || false
94
- });
95
- return {
96
- success: true,
97
- customer,
98
- environment,
99
- dryRun: options.dryRun,
100
- deployed: !options.dryRun,
101
- result
102
- };
103
- } catch (error) {
104
- return {
105
- success: false,
106
- customer,
107
- environment,
108
- error: error.message
109
- };
110
- }
89
+ throw new Error('deployWithSecurity is deprecated. DeploymentManager was simulated deployment only. Use MultiDomainOrchestrator for real deployments.');
111
90
  }
112
91
 
113
92
  /**
114
93
  * Generate secure configuration
94
+ * @deprecated Use UnifiedConfigManager for configuration management
115
95
  * @param {string} customer - Customer name
116
96
  * @param {string} environment - Environment name
117
97
  * @returns {Object} Configuration generation result
118
98
  */
119
99
  generateSecureConfig(customer, environment) {
120
- try {
121
- if (!customer || !environment) {
122
- throw new Error('Customer and environment are required');
123
- }
124
- const config = DeploymentManager.generateSecureConfig(customer, environment);
125
- return {
126
- success: true,
127
- customer,
128
- environment,
129
- config
130
- };
131
- } catch (error) {
132
- return {
133
- success: false,
134
- customer,
135
- environment,
136
- error: error.message
137
- };
138
- }
100
+ throw new Error('generateSecureConfig is deprecated. Use UnifiedConfigManager for configuration management.');
139
101
  }
140
102
 
141
103
  /**
142
104
  * Check deployment readiness
105
+ * @deprecated Use MultiDomainOrchestrator's validation instead
143
106
  * @param {string} customer - Customer name
144
107
  * @param {string} environment - Environment name
145
108
  * @returns {Object} Readiness check result
146
109
  */
147
110
  checkDeploymentReadiness(customer, environment) {
148
- try {
149
- if (!customer || !environment) {
150
- throw new Error('Customer and environment are required');
151
- }
152
- const result = DeploymentManager.validateDeploymentReadiness(customer, environment);
153
- return {
154
- success: true,
155
- customer,
156
- environment,
157
- ready: result.ready,
158
- issues: result.issues || []
159
- };
160
- } catch (error) {
161
- return {
162
- success: false,
163
- customer,
164
- environment,
165
- ready: false,
166
- error: error.message
167
- };
168
- }
111
+ throw new Error('checkDeploymentReadiness is deprecated. Use MultiDomainOrchestrator validation instead.');
169
112
  }
170
113
 
171
114
  /**
@@ -4,15 +4,16 @@
4
4
  */
5
5
 
6
6
  import { ConfigurationValidator } from './ConfigurationValidator.js';
7
- import { DeploymentManager } from './DeploymentManager.js';
7
+ // DeploymentManager removed - replaced by MultiDomainOrchestrator + WranglerConfigManager
8
8
  import { SecretGenerator } from './SecretGenerator.js';
9
9
  import { ErrorHandler } from '../utils/ErrorHandler.js';
10
- import { InteractiveDeploymentConfigurator } from '../config/ConfigurationManager.js';
10
+ // InteractiveDeploymentConfigurator removed - replaced by InputCollector
11
+
11
12
  export { ConfigurationValidator } from './ConfigurationValidator.js';
12
- export { DeploymentManager } from './DeploymentManager.js';
13
+ // export { DeploymentManager } - DEPRECATED: Use MultiDomainOrchestrator instead
13
14
  export { SecretGenerator } from './SecretGenerator.js';
14
15
  export { ErrorHandler } from '../utils/ErrorHandler.js';
15
- export { InteractiveDeploymentConfigurator } from '../config/ConfigurationManager.js';
16
+ // export { InteractiveDeploymentConfigurator } - DEPRECATED: Use InputCollector instead
16
17
 
17
18
  // Re-export patterns and rules for advanced usage
18
19
  export { INSECURE_PATTERNS } from './patterns/insecure-patterns.js';
@@ -25,7 +26,7 @@ export function validateSecurity(config, environment = 'production') {
25
26
 
26
27
  // Main secure deployment function
27
28
  export async function deployWithSecurity(options) {
28
- return DeploymentManager.deployWithSecurity(options);
29
+ throw new Error('deployWithSecurity is deprecated. Use MultiDomainOrchestrator instead.');
29
30
  }
30
31
 
31
32
  // Main key generation function
@@ -47,5 +48,5 @@ export function handleDeploymentError(error, context = {}) {
47
48
 
48
49
  // Main configuration function
49
50
  export async function generateConfiguration(defaults = {}) {
50
- return InteractiveDeploymentConfigurator.generateFromUserInput(defaults);
51
+ throw new Error('generateConfiguration is deprecated. Use InputCollector instead.');
51
52
  }
@@ -11,7 +11,7 @@
11
11
  import { InputHandler } from './handlers/InputHandler.js';
12
12
  import { ConfirmationHandler } from './handlers/ConfirmationHandler.js';
13
13
  import { GenerationHandler } from './handlers/GenerationHandler.js';
14
- import { ConfigMutator } from './handlers/ConfigMutator.js';
14
+ import { WranglerConfigManager } from '../utils/deployment/wrangler-config-manager.js';
15
15
  import { ValidationHandler } from './handlers/ValidationHandler.js';
16
16
 
17
17
  // Legacy imports for backward compatibility
@@ -37,7 +37,7 @@ export class ServiceOrchestrator {
37
37
  outputPath: this.outputPath,
38
38
  templatePath: this.templatePath
39
39
  });
40
- this.configMutator = new ConfigMutator();
40
+ this.wranglerConfigManager = null; // Initialized when needed with specific config path
41
41
  this.validationHandler = new ValidationHandler();
42
42
 
43
43
  // Initialize legacy components for backward compatibility
@@ -398,35 +398,30 @@ export class ServiceOrchestrator {
398
398
  }
399
399
 
400
400
  /**
401
- * Update domain configuration using ConfigMutator
401
+ * Update domain configuration
402
+ * @deprecated Use WranglerConfigManager directly for wrangler.toml updates
402
403
  */
403
404
  async updateDomainConfig(servicePath, currentConfig, updates = null) {
404
- if (!updates && this.interactive) {
405
- // Interactive mode - use confirmation handler
406
- const newDomain = await this.confirmationHandler.promptHandler.prompt(`Current domain: ${currentConfig.domainName}\nNew domain name: `);
407
- if (!newDomain || newDomain === currentConfig.domainName) {
408
- console.log(chalk.yellow('Domain unchanged'));
409
- return;
410
- }
411
- updates = {
412
- domainName: newDomain
413
- };
414
- }
415
- return await this.configMutator.updateDomainConfig(servicePath, currentConfig, updates);
405
+ console.log(chalk.yellow('⚠️ updateDomainConfig is deprecated. Use WranglerConfigManager for wrangler.toml updates.'));
406
+ throw new Error('updateDomainConfig is deprecated. Please use WranglerConfigManager directly.');
416
407
  }
417
408
 
418
409
  /**
419
- * Update Cloudflare configuration using ConfigMutator
410
+ * Update Cloudflare configuration
411
+ * @deprecated Use WranglerConfigManager directly for wrangler.toml updates
420
412
  */
421
413
  async updateCloudflareConfig(servicePath, currentConfig, updates = null) {
422
- return await this.configMutator.updateCloudflareConfig(servicePath, currentConfig, updates);
414
+ console.log(chalk.yellow('⚠️ updateCloudflareConfig is deprecated. Use WranglerConfigManager for wrangler.toml updates.'));
415
+ throw new Error('updateCloudflareConfig is deprecated. Please use WranglerConfigManager directly.');
423
416
  }
424
417
 
425
418
  /**
426
- * Update environment configuration using ConfigMutator
419
+ * Update environment configuration
420
+ * @deprecated Use WranglerConfigManager directly for wrangler.toml updates
427
421
  */
428
422
  async updateEnvironmentConfig(servicePath, currentConfig, updates = null) {
429
- return await this.configMutator.updateEnvironmentConfig(servicePath, currentConfig, updates);
423
+ console.log(chalk.yellow('⚠️ updateEnvironmentConfig is deprecated. Use WranglerConfigManager for wrangler.toml updates.'));
424
+ throw new Error('updateEnvironmentConfig is deprecated. Please use WranglerConfigManager directly.');
430
425
  }
431
426
 
432
427
  /**