@tamyla/clodo-framework 3.1.21 → 3.1.23

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 (150) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +283 -1
  3. package/dist/{bin → cli}/clodo-service.js +47 -15
  4. package/dist/cli/commands/assess.js +183 -0
  5. package/dist/{bin → cli}/commands/create.js +5 -5
  6. package/dist/{bin → cli}/commands/deploy.js +122 -90
  7. package/dist/{bin → cli}/commands/diagnose.js +5 -5
  8. package/dist/cli/commands/helpers/deployment-ui.js +138 -0
  9. package/dist/cli/commands/helpers/deployment-verification.js +250 -0
  10. package/dist/cli/commands/helpers/error-recovery.js +80 -0
  11. package/dist/cli/commands/helpers/resource-detection.js +113 -0
  12. package/dist/{bin → cli}/commands/helpers.js +0 -28
  13. package/dist/cli/commands/init-config.js +57 -0
  14. package/dist/{bin → cli}/commands/update.js +5 -5
  15. package/dist/{bin → cli}/commands/validate.js +5 -5
  16. package/dist/cli/security-cli.js +118 -0
  17. package/dist/config/FeatureManager.js +6 -0
  18. package/dist/config/clodo-create.example.json +26 -0
  19. package/dist/config/clodo-deploy.example.json +41 -0
  20. package/dist/config/clodo-update.example.json +46 -0
  21. package/dist/config/clodo-validate.example.json +41 -0
  22. package/dist/config/customers/template/development.env.template +37 -0
  23. package/dist/config/customers/template/production.env.template +39 -0
  24. package/dist/config/customers/template/staging.env.template +37 -0
  25. package/dist/config/customers.js +28 -26
  26. package/dist/config/domain-examples/README.md +464 -0
  27. package/dist/config/domain-examples/environment-mapped.json +168 -0
  28. package/dist/config/domain-examples/multi-domain.json +144 -0
  29. package/dist/config/domain-examples/single-domain.json +50 -0
  30. package/dist/config/examples +12 -0
  31. package/dist/config/features.js +61 -0
  32. package/dist/config/staging-deployment.json +60 -0
  33. package/dist/config/validation-config.json +347 -0
  34. package/dist/deployment/wrangler-deployer.js +1 -1
  35. package/dist/{bin → lib}/deployment/modules/DeploymentOrchestrator.js +2 -2
  36. package/dist/{bin → lib}/deployment/modules/EnvironmentManager.js +2 -2
  37. package/dist/lib/deployment/orchestration/EnterpriseOrchestrator.js +21 -0
  38. package/dist/lib/shared/cache/configuration-cache.js +82 -0
  39. package/dist/{bin → lib}/shared/cloudflare/domain-discovery.js +1 -1
  40. package/dist/{bin → lib}/shared/cloudflare/domain-manager.js +1 -1
  41. package/dist/{bin → lib}/shared/cloudflare/index.js +1 -1
  42. package/dist/{bin → lib}/shared/cloudflare/ops.js +10 -8
  43. package/dist/{bin → lib}/shared/config/ConfigurationManager.js +23 -1
  44. package/dist/{bin → lib}/shared/config/command-config-manager.js +19 -3
  45. package/dist/{bin → lib}/shared/config/index.js +1 -1
  46. package/dist/{bin → lib}/shared/deployment/credential-collector.js +30 -7
  47. package/dist/lib/shared/deployment/index.js +10 -0
  48. package/dist/lib/shared/deployment/rollback-manager.js +7 -0
  49. package/dist/lib/shared/deployment/utilities/d1-error-recovery.js +177 -0
  50. package/dist/{bin → lib}/shared/deployment/validator.js +40 -10
  51. package/dist/lib/shared/deployment/workflows/deployment-summary.js +214 -0
  52. package/dist/lib/shared/deployment/workflows/interactive-confirmation.js +188 -0
  53. package/dist/lib/shared/deployment/workflows/interactive-database-workflow.js +234 -0
  54. package/dist/lib/shared/deployment/workflows/interactive-domain-info-gatherer.js +240 -0
  55. package/dist/lib/shared/deployment/workflows/interactive-secret-workflow.js +228 -0
  56. package/dist/lib/shared/deployment/workflows/interactive-testing-workflow.js +235 -0
  57. package/dist/lib/shared/deployment/workflows/interactive-validation.js +218 -0
  58. package/dist/lib/shared/error-handling/error-classifier.js +46 -0
  59. package/dist/{bin → lib}/shared/monitoring/health-checker.js +129 -1
  60. package/dist/{bin → lib}/shared/monitoring/memory-manager.js +17 -6
  61. package/dist/{bin → lib}/shared/routing/domain-router.js +1 -1
  62. package/dist/lib/shared/utils/deployment-validator.js +97 -0
  63. package/dist/{bin → lib}/shared/utils/formatters.js +10 -0
  64. package/dist/{bin → lib}/shared/utils/index.js +13 -1
  65. package/dist/{bin → lib}/shared/utils/interactive-prompts.js +34 -18
  66. package/dist/{bin → lib}/shared/utils/progress-manager.js +2 -2
  67. package/dist/lib/shared/utils/progress-spinner.js +53 -0
  68. package/dist/lib/shared/utils/sensitive-redactor.js +91 -0
  69. package/dist/{bin → lib}/shared/validation/ValidationRegistry.js +1 -1
  70. package/dist/migration/MigrationAdapters.js +50 -4
  71. package/dist/orchestration/cross-domain-coordinator.js +5 -5
  72. package/dist/orchestration/multi-domain-orchestrator.js +63 -22
  73. package/dist/security/index.js +2 -2
  74. package/dist/security/patterns/insecure-patterns.js +1 -1
  75. package/dist/service-management/ConfirmationEngine.js +1 -1
  76. package/dist/service-management/ErrorTracker.js +1 -1
  77. package/dist/service-management/InputCollector.js +1 -1
  78. package/dist/service-management/ServiceCreator.js +11 -255
  79. package/dist/service-management/ServiceOrchestrator.js +0 -2
  80. package/dist/service-management/generators/testing/UnitTestsGenerator.js +4 -4
  81. package/dist/service-management/index.js +1 -1
  82. package/dist/utils/cloudflare/ops.js +1 -1
  83. package/dist/utils/constants.js +102 -0
  84. package/dist/utils/deployment/wrangler-config-manager.js +215 -48
  85. package/dist/utils/file-manager.js +1 -1
  86. package/dist/utils/formatters.js +1 -1
  87. package/dist/utils/framework-config.js +2 -2
  88. package/dist/utils/interactive-prompts.js +10 -59
  89. package/dist/utils/logger.js +1 -1
  90. package/dist/version/VersionDetector.js +99 -9
  91. package/dist/worker/integration.js +1 -1
  92. package/package.json +10 -10
  93. package/dist/bin/clodo-service-old.js +0 -868
  94. package/dist/bin/clodo-service-test.js +0 -10
  95. package/dist/bin/commands/assess.js +0 -91
  96. package/dist/bin/database/enterprise-db-manager.js +0 -457
  97. package/dist/bin/deployment/enterprise-deploy.js +0 -877
  98. package/dist/bin/deployment/master-deploy.js +0 -1376
  99. package/dist/bin/deployment/modular-enterprise-deploy.js +0 -466
  100. package/dist/bin/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
  101. package/dist/bin/deployment/test-interactive-utils.js +0 -66
  102. package/dist/bin/portfolio/portfolio-manager.js +0 -487
  103. package/dist/bin/security/security-cli.js +0 -108
  104. package/dist/bin/service-management/create-service.js +0 -122
  105. package/dist/bin/service-management/init-service.js +0 -79
  106. package/dist/bin/shared/deployment/index.js +0 -10
  107. package/dist/bin/shared/deployment/rollback-manager.js +0 -523
  108. package/dist/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
  109. package/dist/service-management/ServiceInitializer.js +0 -453
  110. /package/dist/{bin → lib}/database/deployment-db-manager.js +0 -0
  111. /package/dist/{bin → lib}/database/wrangler-d1-manager.js +0 -0
  112. /package/dist/{bin → lib}/deployment/modules/DeploymentConfiguration.js +0 -0
  113. /package/dist/{bin → lib}/deployment/modules/MonitoringIntegration.js +0 -0
  114. /package/dist/{bin → lib}/deployment/modules/ValidationManager.js +0 -0
  115. /package/dist/{bin → lib}/deployment/orchestration/BaseDeploymentOrchestrator.js +0 -0
  116. /package/dist/{bin → lib}/deployment/orchestration/PortfolioOrchestrator.js +0 -0
  117. /package/dist/{bin → lib}/deployment/orchestration/SingleServiceOrchestrator.js +0 -0
  118. /package/dist/{bin → lib}/deployment/orchestration/UnifiedDeploymentOrchestrator.js +0 -0
  119. /package/dist/{bin → lib}/shared/config/cache.js +0 -0
  120. /package/dist/{bin → lib}/shared/config/cloudflare-service-validator.js +0 -0
  121. /package/dist/{bin → lib}/shared/config/manager.js +0 -0
  122. /package/dist/{bin → lib}/shared/config/manifest-loader.js +0 -0
  123. /package/dist/{bin → lib}/shared/database/connection-manager.js +0 -0
  124. /package/dist/{bin → lib}/shared/database/index.js +0 -0
  125. /package/dist/{bin → lib}/shared/database/orchestrator.js +0 -0
  126. /package/dist/{bin → lib}/shared/deployment/auditor.js +0 -0
  127. /package/dist/{bin → lib}/shared/index.js +0 -0
  128. /package/dist/{bin → lib}/shared/logging/Logger.js +0 -0
  129. /package/dist/{bin → lib}/shared/monitoring/index.js +0 -0
  130. /package/dist/{bin → lib}/shared/monitoring/production-monitor.js +0 -0
  131. /package/dist/{bin → lib}/shared/production-tester/api-tester.js +0 -0
  132. /package/dist/{bin → lib}/shared/production-tester/auth-tester.js +0 -0
  133. /package/dist/{bin → lib}/shared/production-tester/core.js +0 -0
  134. /package/dist/{bin → lib}/shared/production-tester/database-tester.js +0 -0
  135. /package/dist/{bin → lib}/shared/production-tester/index.js +0 -0
  136. /package/dist/{bin → lib}/shared/production-tester/load-tester.js +0 -0
  137. /package/dist/{bin → lib}/shared/production-tester/performance-tester.js +0 -0
  138. /package/dist/{bin → lib}/shared/security/api-token-manager.js +0 -0
  139. /package/dist/{bin → lib}/shared/security/index.js +0 -0
  140. /package/dist/{bin → lib}/shared/security/secret-generator.js +0 -0
  141. /package/dist/{bin → lib}/shared/security/secure-token-manager.js +0 -0
  142. /package/dist/{bin → lib}/shared/utils/ErrorHandler.js +0 -0
  143. /package/dist/{bin → lib}/shared/utils/cli-options.js +0 -0
  144. /package/dist/{bin → lib}/shared/utils/config-loader.js +0 -0
  145. /package/dist/{bin → lib}/shared/utils/error-recovery.js +0 -0
  146. /package/dist/{bin → lib}/shared/utils/file-manager.js +0 -0
  147. /package/dist/{bin → lib}/shared/utils/graceful-shutdown-manager.js +0 -0
  148. /package/dist/{bin → lib}/shared/utils/interactive-utils.js +0 -0
  149. /package/dist/{bin → lib}/shared/utils/output-formatter.js +0 -0
  150. /package/dist/{bin → lib}/shared/utils/rate-limiter.js +0 -0
@@ -0,0 +1,144 @@
1
+ {
2
+ "domains": {
3
+ "api.example.com": {
4
+ "environment": "production",
5
+ "serviceName": "api-service",
6
+ "serviceType": "data-service",
7
+ "cloudflareToken": "CLOUDFLARE_API_TOKEN_PLACEHOLDER",
8
+ "cloudflareAccountId": "1234567890abcdef1234567890abcdef",
9
+ "cloudflareZoneId": "0987654321fedcba0987654321fedcba",
10
+ "displayName": "Production API Service",
11
+ "description": "Production API service with high availability",
12
+ "deploymentStrategy": "blue-green",
13
+ "healthCheck": {
14
+ "enabled": true,
15
+ "path": "/health",
16
+ "interval": 30,
17
+ "timeout": 10
18
+ },
19
+ "routing": {
20
+ "rules": [
21
+ {
22
+ "pattern": "/api/v1/*",
23
+ "target": "api-v1-worker",
24
+ "methods": ["GET", "POST", "PUT", "DELETE"]
25
+ },
26
+ {
27
+ "pattern": "/api/v2/*",
28
+ "target": "api-v2-worker",
29
+ "methods": ["GET", "POST", "PUT", "DELETE"]
30
+ }
31
+ ]
32
+ },
33
+ "security": {
34
+ "cors": {
35
+ "enabled": true,
36
+ "origins": ["https://app.example.com", "https://admin.example.com"],
37
+ "methods": ["GET", "POST", "PUT", "DELETE"],
38
+ "headers": ["Content-Type", "Authorization", "X-API-Key"]
39
+ },
40
+ "rateLimit": {
41
+ "enabled": true,
42
+ "requests": 5000,
43
+ "window": 60
44
+ }
45
+ }
46
+ },
47
+ "admin.example.com": {
48
+ "environment": "production",
49
+ "serviceName": "admin-service",
50
+ "serviceType": "web-service",
51
+ "cloudflareToken": "CLOUDFLARE_API_TOKEN_PLACEHOLDER",
52
+ "cloudflareAccountId": "1234567890abcdef1234567890abcdef",
53
+ "cloudflareZoneId": "0987654321fedcba0987654321fedcba",
54
+ "displayName": "Admin Dashboard Service",
55
+ "description": "Administrative dashboard with restricted access",
56
+ "deploymentStrategy": "rolling",
57
+ "healthCheck": {
58
+ "enabled": true,
59
+ "path": "/admin/health",
60
+ "interval": 60,
61
+ "timeout": 15
62
+ },
63
+ "routing": {
64
+ "rules": [
65
+ {
66
+ "pattern": "/admin/*",
67
+ "target": "admin-worker",
68
+ "methods": ["GET", "POST", "PUT", "DELETE"],
69
+ "auth": {
70
+ "required": true,
71
+ "type": "jwt"
72
+ }
73
+ }
74
+ ]
75
+ },
76
+ "security": {
77
+ "cors": {
78
+ "enabled": false
79
+ },
80
+ "rateLimit": {
81
+ "enabled": true,
82
+ "requests": 100,
83
+ "window": 60
84
+ },
85
+ "waf": {
86
+ "enabled": true,
87
+ "rules": ["sql-injection", "xss", "csrf"]
88
+ }
89
+ }
90
+ },
91
+ "cdn.example.com": {
92
+ "environment": "production",
93
+ "serviceName": "cdn-service",
94
+ "serviceType": "static-site",
95
+ "cloudflareToken": "CLOUDFLARE_API_TOKEN_PLACEHOLDER",
96
+ "cloudflareAccountId": "1234567890abcdef1234567890abcdef",
97
+ "cloudflareZoneId": "0987654321fedcba0987654321fedcba",
98
+ "displayName": "CDN Static Assets",
99
+ "description": "Content delivery network for static assets",
100
+ "deploymentStrategy": "instant",
101
+ "healthCheck": {
102
+ "enabled": false
103
+ },
104
+ "routing": {
105
+ "rules": [
106
+ {
107
+ "pattern": "/*",
108
+ "target": "cdn-worker",
109
+ "methods": ["GET", "HEAD"],
110
+ "cache": {
111
+ "enabled": true,
112
+ "ttl": 3600,
113
+ "purgeOnDeploy": true
114
+ }
115
+ }
116
+ ]
117
+ },
118
+ "security": {
119
+ "cors": {
120
+ "enabled": true,
121
+ "origins": ["*"],
122
+ "methods": ["GET", "HEAD"],
123
+ "headers": ["Cache-Control", "ETag"]
124
+ },
125
+ "rateLimit": {
126
+ "enabled": false
127
+ }
128
+ }
129
+ }
130
+ },
131
+ "global": {
132
+ "customer": "example-company",
133
+ "organization": "Example Corp",
134
+ "contact": "devops@example.com",
135
+ "version": "1.0.0",
136
+ "lastUpdated": "2025-10-28",
137
+ "multiDomain": {
138
+ "enabled": true,
139
+ "parallelDeployments": 2,
140
+ "rollbackOnFailure": true,
141
+ "healthCheckTimeout": 300
142
+ }
143
+ }
144
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "domains": {
3
+ "api.example.com": {
4
+ "environment": "production",
5
+ "serviceName": "api-service",
6
+ "serviceType": "data-service",
7
+ "cloudflareToken": "CLOUDFLARE_API_TOKEN_PLACEHOLDER",
8
+ "cloudflareAccountId": "1234567890abcdef1234567890abcdef",
9
+ "cloudflareZoneId": "0987654321fedcba0987654321fedcba",
10
+ "displayName": "Example API Service",
11
+ "description": "Single domain configuration for production API service",
12
+ "deploymentStrategy": "rolling",
13
+ "healthCheck": {
14
+ "enabled": true,
15
+ "path": "/health",
16
+ "interval": 30,
17
+ "timeout": 10
18
+ },
19
+ "routing": {
20
+ "rules": [
21
+ {
22
+ "pattern": "/api/*",
23
+ "target": "api-worker",
24
+ "methods": ["GET", "POST", "PUT", "DELETE"]
25
+ }
26
+ ]
27
+ },
28
+ "security": {
29
+ "cors": {
30
+ "enabled": true,
31
+ "origins": ["https://app.example.com"],
32
+ "methods": ["GET", "POST", "PUT", "DELETE"],
33
+ "headers": ["Content-Type", "Authorization"]
34
+ },
35
+ "rateLimit": {
36
+ "enabled": true,
37
+ "requests": 1000,
38
+ "window": 60
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "global": {
44
+ "customer": "example-company",
45
+ "organization": "Example Corp",
46
+ "contact": "devops@example.com",
47
+ "version": "1.0.0",
48
+ "lastUpdated": "2025-10-28"
49
+ }
50
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "customer": "mycompany",
3
+ "environment": "production",
4
+ "serviceName": "my-api-service",
5
+ "serviceType": "data-service",
6
+ "domainName": "api.mycompany.com",
7
+ "cloudflareToken": "CLOUDFLARE_API_TOKEN_PLACEHOLDER",
8
+ "cloudflareAccountId": "1234567890abcdef1234567890abcdef",
9
+ "cloudflareZoneId": "0987654321fedcba0987654321fedcba",
10
+ "displayName": "My Company API Service",
11
+ "description": "Production API service for customer data management"
12
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Feature Flag Manager
3
+ * Simple stub for missing features.js
4
+ */
5
+
6
+ export class FeatureFlagManager {
7
+ constructor() {
8
+ this.features = new Map();
9
+ }
10
+ isEnabled(feature) {
11
+ return this.features.get(feature) || false;
12
+ }
13
+ enable(feature) {
14
+ this.features.set(feature, true);
15
+ }
16
+ disable(feature) {
17
+ this.features.set(feature, false);
18
+ }
19
+ withFeature(feature, enhancedFn, legacyFn = null) {
20
+ if (this.isEnabled(feature)) {
21
+ return enhancedFn();
22
+ } else if (legacyFn) {
23
+ return legacyFn();
24
+ } else {
25
+ // If no legacy function provided, just call enhanced anyway
26
+ return enhancedFn();
27
+ }
28
+ }
29
+ getAllFeatures() {
30
+ const result = {};
31
+ for (const [key, value] of this.features) {
32
+ result[key] = {
33
+ enabled: value
34
+ };
35
+ }
36
+ return result;
37
+ }
38
+ }
39
+
40
+ // Default instance
41
+ export const featureManager = new FeatureFlagManager();
42
+
43
+ // Feature constants
44
+ export const FEATURES = {
45
+ ENHANCED_SCHEMA: 'enhanced_schema',
46
+ ENHANCED_VALIDATION: 'enhanced_validation',
47
+ ENABLE_COMPREHENSIVE_VALIDATION: 'enhanced_validation',
48
+ ENABLE_SQL_CACHING: 'sql_caching',
49
+ ENABLE_SCHEMA_CACHING: 'schema_caching',
50
+ ENABLE_ADVANCED_QUERIES: 'advanced_queries',
51
+ ENABLE_SECURITY_CONTROLS: 'security_controls',
52
+ ENABLE_QUERY_CACHING: 'query_caching',
53
+ ENABLE_ADVANCED_PAGINATION: 'advanced_pagination',
54
+ ENABLE_CACHE_METRICS: 'cache_metrics',
55
+ ENABLE_DEBUG_LOGGING: 'debug_logging',
56
+ ENABLE_ENHANCED_SCHEMA: 'enhanced_schema',
57
+ ENABLE_HOOK_METRICS: 'hook_metrics',
58
+ ENABLE_HOOK_TIMEOUT: 'hook_timeout',
59
+ ENABLE_ENHANCED_HOOKS: 'enhanced_hooks',
60
+ ENABLE_PARALLEL_EXECUTION: 'parallel_execution'
61
+ };
@@ -0,0 +1,60 @@
1
+ {
2
+ "// Comment": "Staging deployment configuration for clodo-framework",
3
+ "// Instructions": "This config deploys to staging environment using environment-mapped domain configuration",
4
+ "// Domain": "Uses staging.example.com domain from environment-mapped.json",
5
+ "// Environment": "Staging environment with moderate security and monitoring",
6
+
7
+ "domain": "staging.example.com",
8
+ "environment": "staging",
9
+ "cloudflareToken": "${CLOUDFLARE_API_TOKEN}",
10
+ "cloudflareAccountId": "${CLOUDFLARE_ACCOUNT_ID}",
11
+ "cloudflareZoneId": "${CLOUDFLARE_ZONE_ID}",
12
+
13
+ "deployment": {
14
+ "strategy": "rolling",
15
+ "replicas": 2,
16
+ "maxConcurrency": 50,
17
+ "timeout": 60000,
18
+ "healthCheckInterval": 10000,
19
+ "rollbackOnFailure": true
20
+ },
21
+
22
+ "routing": {
23
+ "enableLoadBalancing": true,
24
+ "loadBalancingPolicy": "round-robin",
25
+ "corsEnabled": true,
26
+ "corsOrigins": ["https://staging.example.com", "https://app-staging.example.com"]
27
+ },
28
+
29
+ "monitoring": {
30
+ "enableMetrics": true,
31
+ "metricsEndpoint": "https://metrics-staging.example.com",
32
+ "alertOnFailure": true,
33
+ "alertEmail": "staging-alerts@example.com"
34
+ },
35
+
36
+ "security": {
37
+ "enableSSL": true,
38
+ "minTLSVersion": "1.2",
39
+ "enableWAF": true,
40
+ "rateLimit": 500,
41
+ "rateLimitWindow": 60,
42
+ "wafRules": ["sql-injection", "xss"]
43
+ },
44
+
45
+ "healthCheck": {
46
+ "enabled": true,
47
+ "endpoint": "/health",
48
+ "interval": 30000,
49
+ "timeout": 10000,
50
+ "healthyThreshold": 2,
51
+ "unhealthyThreshold": 3
52
+ },
53
+
54
+ "logging": {
55
+ "level": "info",
56
+ "includeRequestId": true,
57
+ "includeTimestamp": true,
58
+ "maskSensitiveData": true
59
+ }
60
+ }
@@ -0,0 +1,347 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Clodo Framework Enhanced Configuration",
4
+ "description": "Comprehensive configuration for flexible service deployment and validation",
5
+
6
+ "commands": {
7
+ "required": {
8
+ "npx": "npx",
9
+ "node": "node",
10
+ "npm": "npm",
11
+ "wrangler": "npx wrangler"
12
+ },
13
+ "cloudflare": {
14
+ "whoami": "npx wrangler whoami",
15
+ "auth_login": "npx wrangler auth login",
16
+ "deployments_list": "npx wrangler deployments list",
17
+ "list_workers": "npx wrangler dev --help",
18
+ "deploy": "npx wrangler deploy",
19
+ "list_zones": "echo 'Zone listing not available via wrangler CLI'",
20
+ "worker_status": "npx wrangler status"
21
+ },
22
+ "system": {
23
+ "powershell_web_request": "powershell -Command \"try { Invoke-WebRequest -Uri '{url}' -TimeoutSec 10 -UseBasicParsing | Out-Null } catch { exit 1 }\"",
24
+ "curl_test": "curl -s --connect-timeout 10 {url} -o /dev/null"
25
+ }
26
+ },
27
+
28
+ "timing": {
29
+ "deploymentTimeout": 300000,
30
+ "discoveryTimeout": 30000,
31
+ "healthCheckTimeout": 10000,
32
+ "productionTestTimeout": 30000,
33
+ "shutdownTimeout": 30000,
34
+ "forceShutdownTimeout": 5000,
35
+ "retryDelay": 1000,
36
+ "retryAttempts": 3,
37
+ "cacheTTL": 3600000,
38
+ "maxAge": 86400000,
39
+ "rateLimitWindow": 60000,
40
+ "circuitBreakerTimeout": 60000,
41
+ "circuitBreakerThreshold": 5,
42
+ "deploymentInterval": 5000,
43
+ "endpointValidationTimeout": 5000,
44
+ "maxConcurrentDeployments": 3
45
+ },
46
+
47
+ "networking": {
48
+ "endpoints": {
49
+ "cloudflare": "https://api.cloudflare.com",
50
+ "npm": "https://registry.npmjs.org",
51
+ "healthCheck": "https://httpbin.org/status/200"
52
+ },
53
+ "development": {
54
+ "defaultPorts": {
55
+ "frontend": 3000,
56
+ "api": 8787,
57
+ "worker": 8787,
58
+ "preview": 8788
59
+ },
60
+ "allowedOrigins": ["http://localhost:3000", "http://localhost:8787"],
61
+ "corsDefaults": ["*"]
62
+ },
63
+ "rateLimiting": {
64
+ "defaultRequests": 100,
65
+ "defaultWindow": 60000,
66
+ "burstLimit": 200,
67
+ "strictMode": false
68
+ }
69
+ },
70
+
71
+ "caching": {
72
+ "maxCacheSize": 52428800,
73
+ "compressionThreshold": 1024,
74
+ "cleanupInterval": 3600000,
75
+ "enableCompression": true,
76
+ "maxEntries": 1000
77
+ },
78
+
79
+ "environments": {
80
+ "development": {
81
+ "domainTemplate": "dev-{service}.{domain}",
82
+ "workerSuffix": "-dev",
83
+ "databaseSuffix": "-dev",
84
+ "logLevel": "debug",
85
+ "enableMetrics": true,
86
+ "strictValidation": false,
87
+ "routing": {
88
+ "_comment": "Development routing configuration - typically uses workers.dev subdomain",
89
+ "defaultPathPrefix": "/dev-api",
90
+ "wildcardPattern": "/*",
91
+ "generateFallbackRoute": true
92
+ }
93
+ },
94
+ "staging": {
95
+ "domainTemplate": "staging-{service}.{domain}",
96
+ "workerSuffix": "-staging",
97
+ "databaseSuffix": "-staging",
98
+ "logLevel": "info",
99
+ "enableMetrics": true,
100
+ "strictValidation": true,
101
+ "routing": {
102
+ "_comment": "Staging routing configuration - nested under [env.staging] in wrangler.toml",
103
+ "defaultPathPrefix": "/staging-api",
104
+ "wildcardPattern": "/*",
105
+ "generateFallbackRoute": true
106
+ }
107
+ },
108
+ "production": {
109
+ "domainTemplate": "{service}.{domain}",
110
+ "workerSuffix": "",
111
+ "databaseSuffix": "",
112
+ "logLevel": "warn",
113
+ "enableMetrics": true,
114
+ "strictValidation": true,
115
+ "routing": {
116
+ "_comment": "Production routing configuration - top-level [[routes]] in wrangler.toml",
117
+ "defaultPathPrefix": "/api",
118
+ "wildcardPattern": "/*",
119
+ "generateFallbackRoute": true,
120
+ "nestedInToml": false
121
+ }
122
+ }
123
+ },
124
+
125
+ "serviceDefaults": {
126
+ "compatibility_date": "2024-01-01",
127
+ "node_compat": true,
128
+ "minify": true,
129
+ "sourcemap": false
130
+ },
131
+
132
+ "staticSite": {
133
+ "defaults": {
134
+ "publicDir": "public",
135
+ "indexFile": "index.html",
136
+ "errorFile": "404.html",
137
+ "cacheControl": "public, max-age=31536000, immutable",
138
+ "textTypes": ["html", "css", "js", "json", "xml", "txt"],
139
+ "binaryTypes": ["png", "jpg", "jpeg", "gif", "svg", "ico", "webp", "woff", "woff2"]
140
+ },
141
+ "siteConfig": {
142
+ "bucket": "./public",
143
+ "include": ["**/*"],
144
+ "exclude": [
145
+ "node_modules/**",
146
+ ".git/**",
147
+ ".DS_Store",
148
+ "*.log",
149
+ "wrangler.toml",
150
+ "package.json",
151
+ "package-lock.json"
152
+ ]
153
+ },
154
+ "routing": {
155
+ "spaFallback": true,
156
+ "spaFallbackPath": "/index.html",
157
+ "cleanUrls": true,
158
+ "trailingSlash": false
159
+ },
160
+ "optimization": {
161
+ "compressText": true,
162
+ "etagGeneration": true,
163
+ "corsEnabled": true,
164
+ "corsOrigins": ["*"]
165
+ }
166
+ },
167
+
168
+ "validation": {
169
+ "requiredFiles": [
170
+ "package.json",
171
+ "wrangler.toml"
172
+ ],
173
+ "optionalFiles": [
174
+ "README.md",
175
+ "LICENSE",
176
+ ".gitignore"
177
+ ],
178
+ "requiredFields": {
179
+ "package.json": ["name", "version", "type", "main"],
180
+ "wrangler.toml": ["name", "main", "compatibility_date"]
181
+ },
182
+ "serviceTypes": [
183
+ "data-service",
184
+ "auth-service",
185
+ "content-service",
186
+ "api-gateway",
187
+ "static-site",
188
+ "generic"
189
+ ]
190
+ },
191
+
192
+ "security": {
193
+ "requiredEnvironmentVars": [
194
+ "CLOUDFLARE_API_TOKEN"
195
+ ],
196
+ "optionalEnvironmentVars": [
197
+ "CLOUDFLARE_ACCOUNT_ID",
198
+ "CLOUDFLARE_ZONE_ID",
199
+ "ENVIRONMENT",
200
+ "LOG_LEVEL",
201
+ "CORS_ORIGINS",
202
+ "RATE_LIMIT_REQUESTS",
203
+ "RATE_LIMIT_WINDOW_MS",
204
+ "ENABLE_METRICS",
205
+ "METRICS_ENDPOINT"
206
+ ],
207
+ "secretsConfig": {
208
+ "encryptionEnabled": true,
209
+ "rotationInterval": 7776000000,
210
+ "backupCount": 5,
211
+ "distributionDelay": 5000
212
+ }
213
+ },
214
+
215
+ "monitoring": {
216
+ "healthCheck": {
217
+ "endpoints": ["/health", "/ping"],
218
+ "expectedStatus": [200, 204],
219
+ "timeout": 5000,
220
+ "interval": 30000
221
+ },
222
+ "metrics": {
223
+ "enabledByDefault": true,
224
+ "collectionInterval": 60000,
225
+ "retentionPeriod": 2592000000,
226
+ "aggregationWindow": 300000
227
+ },
228
+ "logging": {
229
+ "levels": ["debug", "info", "warn", "error"],
230
+ "defaultLevel": "info",
231
+ "enableConsole": true,
232
+ "enableFile": false,
233
+ "maxFileSize": 10485760
234
+ }
235
+ },
236
+
237
+ "deployment": {
238
+ "strategies": ["blue-green", "rolling", "canary"],
239
+ "defaultStrategy": "blue-green",
240
+ "validation": {
241
+ "runTests": true,
242
+ "requireHealthCheck": true,
243
+ "allowSkipValidation": false
244
+ },
245
+ "rollback": {
246
+ "enableAutoRollback": true,
247
+ "healthCheckThreshold": 3,
248
+ "timeoutThreshold": 30000
249
+ }
250
+ },
251
+
252
+ "testing": {
253
+ "production": {
254
+ "enabled": true,
255
+ "lightweight": true,
256
+ "skipHeavyTests": true,
257
+ "generateReports": false,
258
+ "testTimeout": 30000
259
+ },
260
+ "integration": {
261
+ "enabled": false,
262
+ "requiresRealEnvironment": true,
263
+ "cleanupAfterTests": true
264
+ }
265
+ },
266
+
267
+ "database": {
268
+ "namingConvention": {
269
+ "development": "{service}-dev",
270
+ "staging": "{service}-staging",
271
+ "production": "{service}"
272
+ },
273
+ "migration": {
274
+ "autoRun": false,
275
+ "backupBeforeMigration": true,
276
+ "rollbackOnFailure": true
277
+ },
278
+ "connection": {
279
+ "timeout": 30000,
280
+ "retryAttempts": 3,
281
+ "poolSize": 10
282
+ }
283
+ },
284
+
285
+ "templates": {
286
+ "directory": "templates",
287
+ "defaultType": "generic",
288
+ "variablePrefix": "{{",
289
+ "variableSuffix": "}}",
290
+ "commonVariables": {
291
+ "CURRENT_DATE": "auto-generated",
292
+ "CURRENT_YEAR": "auto-generated",
293
+ "FRAMEWORK_VERSION": "auto-generated"
294
+ },
295
+ "defaults": {
296
+ "DOMAIN_NAME": "example.com",
297
+ "WORKERS_DEV_DOMAIN": "workers.dev",
298
+ "DEFAULT_REGION": "auto",
299
+ "DEFAULT_TIMEZONE": "UTC"
300
+ },
301
+ "companyDefaults": {
302
+ "NOTE": "Override these in customer-specific config files",
303
+ "COMPANY_DOMAIN": "example.com",
304
+ "WORKERS_SUBDOMAIN": "company-name"
305
+ }
306
+ },
307
+
308
+ "routing": {
309
+ "_comment": "Routing configuration for automatic route generation from domain config",
310
+ "defaults": {
311
+ "_comment": "Default options for route generation - applied to all environments unless overridden",
312
+ "includeComments": true,
313
+ "includeZoneId": true,
314
+ "targetEnvironment": "all",
315
+ "orderStrategy": "most-specific-first"
316
+ },
317
+ "domains": {
318
+ "_comment": "Domain-specific routing rules and patterns",
319
+ "skipPatterns": [],
320
+ "_skipPatternsNote": "Add domain patterns to skip route generation (e.g., ['internal.example.com'])",
321
+ "complexTLDs": [".co.uk", ".com.au", ".org.uk", ".gov.uk", ".co.nz", ".com.br"],
322
+ "_complexTLDsNote": "Multi-part TLDs that should be treated as single domain extension",
323
+ "subdomainMinParts": 3,
324
+ "_subdomainMinPartsNote": "Minimum parts to consider a domain as subdomain (e.g., api.example.com = 3 parts)",
325
+ "ignoreSubdomains": ["www"],
326
+ "_ignoreSubdomainsNote": "Subdomain prefixes to ignore when generating routes"
327
+ },
328
+ "validation": {
329
+ "_comment": "Validation patterns for route generation",
330
+ "zoneIdPattern": "^[a-f0-9]{32}$",
331
+ "_zoneIdNote": "Cloudflare Zone ID must be 32 hexadecimal characters",
332
+ "domainPattern": "^[a-z0-9.-]+$",
333
+ "_domainNote": "Valid domain characters: lowercase letters, numbers, dots, hyphens",
334
+ "strictMode": true,
335
+ "_strictModeNote": "When true, reject invalid domains; when false, log warnings only"
336
+ },
337
+ "comments": {
338
+ "_comment": "TOML comment templates - use {{placeholder}} for dynamic values",
339
+ "enabled": true,
340
+ "templates": {
341
+ "production": "# Production environment routes\n# Domain: {{domain}}",
342
+ "staging": "# Staging environment routes\n# Domain: {{domain}}",
343
+ "development": "# Development environment\n# Uses {{WORKERS_DEV_DOMAIN}} subdomain"
344
+ }
345
+ }
346
+ }
347
+ }
@@ -2,7 +2,7 @@ import { spawn } from 'child_process';
2
2
  import { execSync } from 'child_process';
3
3
  import fs from 'fs';
4
4
  import path from 'path';
5
- import { WranglerD1Manager } from "../../dist/bin/database/wrangler-d1-manager.js";
5
+ import { WranglerD1Manager } from '../lib/database/wrangler-d1-manager.js';
6
6
 
7
7
  /**
8
8
  * WranglerDeployer - Executes actual Cloudflare Workers deployments using wrangler CLI