@tamyla/clodo-framework 3.1.21 → 3.1.22

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 (169) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +53 -0
  3. package/dist/bin/clodo-service.js +47 -15
  4. package/dist/bin/commands/deploy.js +115 -83
  5. package/dist/bin/commands/helpers/deployment-ui.js +138 -0
  6. package/dist/bin/commands/helpers/deployment-verification.js +251 -0
  7. package/dist/bin/commands/helpers/error-recovery.js +80 -0
  8. package/dist/bin/commands/helpers/resource-detection.js +113 -0
  9. package/dist/bin/commands/validate.js +1 -1
  10. package/dist/bin/security/security-cli.js +1 -1
  11. package/dist/bin/shared/cache/configuration-cache.js +82 -0
  12. package/dist/bin/shared/cloudflare/domain-manager.js +1 -1
  13. package/dist/bin/shared/cloudflare/index.js +1 -1
  14. package/dist/bin/shared/cloudflare/ops.js +6 -4
  15. package/dist/bin/shared/config/ConfigurationManager.js +23 -1
  16. package/dist/bin/shared/config/command-config-manager.js +19 -3
  17. package/dist/bin/shared/config/index.js +1 -1
  18. package/dist/bin/shared/deployment/credential-collector.js +30 -7
  19. package/dist/bin/shared/deployment/index.js +2 -2
  20. package/dist/bin/shared/deployment/rollback-manager.js +4 -520
  21. package/dist/bin/shared/deployment/utilities/d1-error-recovery.js +177 -0
  22. package/dist/bin/shared/deployment/validator.js +40 -10
  23. package/dist/bin/shared/deployment/workflows/deployment-summary.js +214 -0
  24. package/dist/bin/shared/deployment/workflows/interactive-confirmation.js +188 -0
  25. package/dist/bin/shared/deployment/workflows/interactive-database-workflow.js +234 -0
  26. package/dist/bin/shared/deployment/workflows/interactive-domain-info-gatherer.js +240 -0
  27. package/dist/bin/shared/deployment/workflows/interactive-secret-workflow.js +228 -0
  28. package/dist/bin/shared/deployment/workflows/interactive-testing-workflow.js +235 -0
  29. package/dist/bin/shared/deployment/workflows/interactive-validation.js +218 -0
  30. package/dist/bin/shared/error-handling/error-classifier.js +46 -0
  31. package/dist/bin/shared/monitoring/health-checker.js +129 -1
  32. package/dist/bin/shared/monitoring/memory-manager.js +17 -6
  33. package/dist/bin/shared/routing/domain-router.js +1 -1
  34. package/dist/bin/shared/utils/deployment-validator.js +97 -0
  35. package/dist/bin/shared/utils/formatters.js +10 -0
  36. package/dist/bin/shared/utils/index.js +13 -1
  37. package/dist/bin/shared/utils/interactive-prompts.js +34 -18
  38. package/dist/bin/shared/utils/progress-manager.js +2 -2
  39. package/dist/bin/shared/utils/progress-spinner.js +53 -0
  40. package/dist/bin/shared/utils/sensitive-redactor.js +91 -0
  41. package/dist/bin/shared/validation/ValidationRegistry.js +1 -1
  42. package/dist/security/index.js +1 -1
  43. package/dist/security/patterns/insecure-patterns.js +1 -1
  44. package/dist/utils/constants.js +102 -0
  45. package/dist/utils/deployment/wrangler-config-manager.js +215 -48
  46. package/dist/utils/framework-config.js +2 -2
  47. package/dist/utils/interactive-prompts.js +10 -59
  48. package/package.json +16 -8
  49. package/dist/bin/clodo-service-old.js +0 -868
  50. package/dist/bin/clodo-service-test.js +0 -10
  51. package/dist/bin/commands/assess.js +0 -91
  52. package/dist/bin/commands/create.js +0 -77
  53. package/dist/bin/commands/diagnose.js +0 -83
  54. package/dist/bin/commands/helpers.js +0 -138
  55. package/dist/bin/commands/update.js +0 -75
  56. package/dist/bin/database/deployment-db-manager.js +0 -423
  57. package/dist/bin/database/enterprise-db-manager.js +0 -457
  58. package/dist/bin/database/wrangler-d1-manager.js +0 -685
  59. package/dist/bin/deployment/enterprise-deploy.js +0 -877
  60. package/dist/bin/deployment/master-deploy.js +0 -1376
  61. package/dist/bin/deployment/modular-enterprise-deploy.js +0 -466
  62. package/dist/bin/deployment/modules/DeploymentConfiguration.js +0 -395
  63. package/dist/bin/deployment/modules/DeploymentOrchestrator.js +0 -492
  64. package/dist/bin/deployment/modules/EnvironmentManager.js +0 -517
  65. package/dist/bin/deployment/modules/MonitoringIntegration.js +0 -560
  66. package/dist/bin/deployment/modules/ValidationManager.js +0 -342
  67. package/dist/bin/deployment/orchestration/BaseDeploymentOrchestrator.js +0 -426
  68. package/dist/bin/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
  69. package/dist/bin/deployment/orchestration/PortfolioOrchestrator.js +0 -273
  70. package/dist/bin/deployment/orchestration/SingleServiceOrchestrator.js +0 -231
  71. package/dist/bin/deployment/orchestration/UnifiedDeploymentOrchestrator.js +0 -662
  72. package/dist/bin/deployment/test-interactive-utils.js +0 -66
  73. package/dist/bin/portfolio/portfolio-manager.js +0 -487
  74. package/dist/bin/service-management/create-service.js +0 -122
  75. package/dist/bin/service-management/init-service.js +0 -79
  76. package/dist/config/customers.js +0 -623
  77. package/dist/config/domains.js +0 -186
  78. package/dist/config/index.js +0 -6
  79. package/dist/database/database-orchestrator.js +0 -795
  80. package/dist/database/index.js +0 -4
  81. package/dist/deployment/index.js +0 -11
  82. package/dist/deployment/orchestration/BaseDeploymentOrchestrator.js +0 -426
  83. package/dist/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
  84. package/dist/deployment/orchestration/PortfolioOrchestrator.js +0 -273
  85. package/dist/deployment/orchestration/SingleServiceOrchestrator.js +0 -231
  86. package/dist/deployment/orchestration/UnifiedDeploymentOrchestrator.js +0 -662
  87. package/dist/deployment/orchestration/index.js +0 -17
  88. package/dist/deployment/rollback-manager.js +0 -36
  89. package/dist/deployment/wrangler-deployer.js +0 -640
  90. package/dist/handlers/GenericRouteHandler.js +0 -532
  91. package/dist/migration/MigrationAdapters.js +0 -562
  92. package/dist/modules/ModuleManager.js +0 -668
  93. package/dist/modules/security.js +0 -96
  94. package/dist/orchestration/cross-domain-coordinator.js +0 -1083
  95. package/dist/orchestration/index.js +0 -5
  96. package/dist/orchestration/modules/DeploymentCoordinator.js +0 -368
  97. package/dist/orchestration/modules/DomainResolver.js +0 -198
  98. package/dist/orchestration/modules/StateManager.js +0 -332
  99. package/dist/orchestration/multi-domain-orchestrator.js +0 -724
  100. package/dist/routing/EnhancedRouter.js +0 -158
  101. package/dist/schema/SchemaManager.js +0 -778
  102. package/dist/service-management/ConfirmationEngine.js +0 -412
  103. package/dist/service-management/ErrorTracker.js +0 -299
  104. package/dist/service-management/GenerationEngine.js +0 -447
  105. package/dist/service-management/InputCollector.js +0 -619
  106. package/dist/service-management/ServiceCreator.js +0 -265
  107. package/dist/service-management/ServiceInitializer.js +0 -453
  108. package/dist/service-management/ServiceOrchestrator.js +0 -633
  109. package/dist/service-management/generators/BaseGenerator.js +0 -233
  110. package/dist/service-management/generators/GeneratorRegistry.js +0 -254
  111. package/dist/service-management/generators/cicd/CiWorkflowGenerator.js +0 -87
  112. package/dist/service-management/generators/cicd/DeployWorkflowGenerator.js +0 -106
  113. package/dist/service-management/generators/code/ServiceHandlersGenerator.js +0 -235
  114. package/dist/service-management/generators/code/ServiceMiddlewareGenerator.js +0 -116
  115. package/dist/service-management/generators/code/ServiceUtilsGenerator.js +0 -246
  116. package/dist/service-management/generators/code/WorkerIndexGenerator.js +0 -143
  117. package/dist/service-management/generators/config/DevelopmentEnvGenerator.js +0 -101
  118. package/dist/service-management/generators/config/DomainsConfigGenerator.js +0 -175
  119. package/dist/service-management/generators/config/EnvExampleGenerator.js +0 -178
  120. package/dist/service-management/generators/config/ProductionEnvGenerator.js +0 -97
  121. package/dist/service-management/generators/config/StagingEnvGenerator.js +0 -97
  122. package/dist/service-management/generators/config/WranglerTomlGenerator.js +0 -238
  123. package/dist/service-management/generators/core/PackageJsonGenerator.js +0 -243
  124. package/dist/service-management/generators/core/SiteConfigGenerator.js +0 -115
  125. package/dist/service-management/generators/documentation/ApiDocsGenerator.js +0 -331
  126. package/dist/service-management/generators/documentation/ConfigurationDocsGenerator.js +0 -294
  127. package/dist/service-management/generators/documentation/DeploymentDocsGenerator.js +0 -244
  128. package/dist/service-management/generators/documentation/ReadmeGenerator.js +0 -196
  129. package/dist/service-management/generators/schemas/ServiceSchemaGenerator.js +0 -190
  130. package/dist/service-management/generators/scripts/DeployScriptGenerator.js +0 -123
  131. package/dist/service-management/generators/scripts/HealthCheckScriptGenerator.js +0 -101
  132. package/dist/service-management/generators/scripts/SetupScriptGenerator.js +0 -88
  133. package/dist/service-management/generators/service-types/StaticSiteGenerator.js +0 -342
  134. package/dist/service-management/generators/testing/EslintConfigGenerator.js +0 -85
  135. package/dist/service-management/generators/testing/IntegrationTestsGenerator.js +0 -237
  136. package/dist/service-management/generators/testing/JestConfigGenerator.js +0 -72
  137. package/dist/service-management/generators/testing/UnitTestsGenerator.js +0 -277
  138. package/dist/service-management/generators/tooling/DockerComposeGenerator.js +0 -71
  139. package/dist/service-management/generators/tooling/GitignoreGenerator.js +0 -143
  140. package/dist/service-management/generators/utils/FileWriter.js +0 -179
  141. package/dist/service-management/generators/utils/PathResolver.js +0 -157
  142. package/dist/service-management/generators/utils/ServiceManifestGenerator.js +0 -111
  143. package/dist/service-management/generators/utils/TemplateEngine.js +0 -185
  144. package/dist/service-management/generators/utils/index.js +0 -18
  145. package/dist/service-management/handlers/ConfirmationHandler.js +0 -71
  146. package/dist/service-management/handlers/GenerationHandler.js +0 -80
  147. package/dist/service-management/handlers/InputHandler.js +0 -59
  148. package/dist/service-management/handlers/ValidationHandler.js +0 -203
  149. package/dist/service-management/index.js +0 -14
  150. package/dist/service-management/routing/DomainRouteMapper.js +0 -311
  151. package/dist/service-management/routing/RouteGenerator.js +0 -266
  152. package/dist/service-management/routing/WranglerRoutesBuilder.js +0 -273
  153. package/dist/service-management/routing/index.js +0 -14
  154. package/dist/service-management/services/DirectoryStructureService.js +0 -56
  155. package/dist/service-management/services/GenerationCoordinator.js +0 -208
  156. package/dist/service-management/services/GeneratorRegistry.js +0 -174
  157. package/dist/services/GenericDataService.js +0 -501
  158. package/dist/ui-structures/concepts/second-order-acquisition-strategy.md +0 -286
  159. package/dist/ui-structures/concepts/service-lifecycle-management.md +0 -150
  160. package/dist/ui-structures/concepts/service-manifest-guide.md +0 -309
  161. package/dist/ui-structures/concepts/three-tier-categorization-strategy.md +0 -231
  162. package/dist/ui-structures/creation/automated-generation-ui.json +0 -246
  163. package/dist/ui-structures/creation/core-inputs-ui.json +0 -217
  164. package/dist/ui-structures/creation/smart-confirmable-ui.json +0 -451
  165. package/dist/ui-structures/reference/absolutely-required-inputs.json +0 -315
  166. package/dist/ui-structures/reference/service-manifest-template.json +0 -342
  167. package/dist/version/VersionDetector.js +0 -723
  168. package/dist/worker/index.js +0 -4
  169. package/dist/worker/integration.js +0 -351
@@ -1,331 +0,0 @@
1
- import { BaseGenerator } from '../BaseGenerator.js';
2
- import { join } from 'path';
3
- import { writeFileSync, mkdirSync } from 'fs';
4
-
5
- /**
6
- * API Documentation Generator
7
- * Generates comprehensive API documentation with service-type specific endpoints
8
- */
9
- export class ApiDocsGenerator extends BaseGenerator {
10
- /**
11
- * Generate API documentation
12
- * @param {Object} context - Generation context
13
- * @returns {Promise<string>} Path to generated API docs file
14
- */
15
- async generate(context) {
16
- const {
17
- coreInputs,
18
- confirmedValues,
19
- servicePath
20
- } = this.extractContext(context);
21
- if (!this.shouldGenerate(context)) {
22
- return null;
23
- }
24
-
25
- // Ensure docs directory exists
26
- const docsDir = join(servicePath, 'docs');
27
- mkdirSync(docsDir, {
28
- recursive: true
29
- });
30
- const apiDocsContent = this._generateApiDocsContent(coreInputs, confirmedValues);
31
- const filePath = join(servicePath, 'docs', 'API.md');
32
- writeFileSync(filePath, apiDocsContent, 'utf8');
33
- return filePath;
34
- }
35
-
36
- /**
37
- * Generate API documentation content
38
- * @private
39
- */
40
- _generateApiDocsContent(coreInputs, confirmedValues) {
41
- return `# ${confirmedValues.displayName} API Documentation
42
-
43
- ## Overview
44
-
45
- ${confirmedValues.description}
46
-
47
- **Base URL**: ${confirmedValues.productionUrl}
48
- **API Base Path**: ${confirmedValues.apiBasePath}
49
- **Version**: ${confirmedValues.version}
50
-
51
- ## Authentication
52
-
53
- ${confirmedValues.features.authentication ? 'This service requires authentication. Include your API key in the request headers:\n\n' + '```\nAuthorization: Bearer YOUR_API_KEY\n```' : 'This service does not require authentication.'}
54
-
55
- ## Endpoints
56
-
57
- ### Health Check
58
-
59
- **GET** ${confirmedValues.healthCheckPath}
60
-
61
- Check the health status of the service.
62
-
63
- **Response:**
64
- \`\`\`json
65
- {
66
- "status": "healthy",
67
- "timestamp": "2024-01-01T00:00:00.000Z",
68
- "service": "${coreInputs.serviceName}",
69
- "version": "${confirmedValues.version}",
70
- "environment": "${coreInputs.environment}",
71
- "checks": [
72
- {
73
- "name": "database",
74
- "status": "healthy"
75
- },
76
- {
77
- "name": "configuration",
78
- "status": "healthy"
79
- }
80
- ]
81
- }
82
- \`\`\`
83
-
84
- ### API Endpoints
85
-
86
- **Base Path**: ${confirmedValues.apiBasePath}
87
-
88
- ${this._generateApiEndpointsForType(coreInputs.serviceType, coreInputs, confirmedValues)}
89
-
90
- ## Error Responses
91
-
92
- All error responses follow this format:
93
-
94
- \`\`\`json
95
- {
96
- "success": false,
97
- "error": "Error message",
98
- "timestamp": "2024-01-01T00:00:00.000Z"
99
- }
100
- \`\`\`
101
-
102
- ### Common HTTP Status Codes
103
-
104
- - **200**: Success
105
- - **400**: Bad Request
106
- - **401**: Unauthorized
107
- - **403**: Forbidden
108
- - **404**: Not Found
109
- - **500**: Internal Server Error
110
-
111
- ## Rate Limiting
112
-
113
- ${confirmedValues.features.rateLimiting ? 'This service implements rate limiting. Please respect the following limits:\n\n' + '- 1000 requests per hour for authenticated users\n' + '- 100 requests per hour for anonymous users' : 'This service does not implement rate limiting.'}
114
-
115
- ## Data Formats
116
-
117
- All requests and responses use JSON format.
118
-
119
- ### Request Headers
120
-
121
- \`\`\`
122
- Content-Type: application/json
123
- Authorization: Bearer YOUR_API_KEY (if required)
124
- \`\`\`
125
-
126
- ### Response Headers
127
-
128
- \`\`\`
129
- Content-Type: application/json
130
- X-Service: ${coreInputs.serviceName}
131
- X-Version: ${confirmedValues.version}
132
- X-Response-Time: 150
133
- \`\`\`
134
- `;
135
- }
136
-
137
- /**
138
- * Generate service-type specific API endpoints documentation
139
- * @private
140
- */
141
- _generateApiEndpointsForType(serviceType, coreInputs, confirmedValues) {
142
- const endpoints = {
143
- 'data-service': `
144
- #### List Items
145
- **GET** /items
146
-
147
- Retrieve a paginated list of items.
148
-
149
- **Query Parameters:**
150
- - \`limit\` (optional): Number of items per page (default: 20, max: 100)
151
- - \`offset\` (optional): Number of items to skip (default: 0)
152
- - \`search\` (optional): Search query string
153
- - \`filters\` (optional): JSON object with filter criteria
154
-
155
- **Response:**
156
- \`\`\`json
157
- {
158
- "success": true,
159
- "data": [...],
160
- "pagination": {
161
- "limit": 20,
162
- "offset": 0,
163
- "total": 150,
164
- "hasMore": true
165
- }
166
- }
167
- \`\`\`
168
-
169
- #### Create Item
170
- **POST** /items
171
-
172
- Create a new item.
173
-
174
- **Request Body:**
175
- \`\`\`json
176
- {
177
- "name": "Item Name",
178
- "description": "Item description",
179
- "data": {}
180
- }
181
- \`\`\`
182
-
183
- #### Get Item
184
- **GET** /items/{id}
185
-
186
- Retrieve a specific item by ID.
187
-
188
- #### Update Item
189
- **PUT** /items/{id}
190
-
191
- Update an existing item.
192
-
193
- #### Delete Item
194
- **DELETE** /items/{id}
195
-
196
- Delete an item.
197
- `,
198
- 'auth-service': `
199
- #### Register User
200
- **POST** /auth/register
201
-
202
- Register a new user account.
203
-
204
- **Request Body:**
205
- \`\`\`json
206
- {
207
- "email": "user@example.com",
208
- "username": "username",
209
- "password": "password"
210
- }
211
- \`\`\`
212
-
213
- #### Login
214
- **POST** /auth/login
215
-
216
- Authenticate a user and receive access tokens.
217
-
218
- **Request Body:**
219
- \`\`\`json
220
- {
221
- "email": "user@example.com",
222
- "password": "password"
223
- }
224
- \`\`\`
225
-
226
- #### Get Profile
227
- **GET** /auth/profile
228
-
229
- Get the current user's profile information.
230
-
231
- #### Update Profile
232
- **PUT** /auth/profile
233
-
234
- Update the current user's profile.
235
-
236
- #### Logout
237
- **POST** /auth/logout
238
-
239
- Invalidate the current user's session.
240
- `,
241
- 'content-service': `
242
- #### List Content
243
- **GET** /content
244
-
245
- Retrieve a list of content items.
246
-
247
- #### Create Content
248
- **POST** /content
249
-
250
- Create new content.
251
-
252
- **Request Body:**
253
- \`\`\`json
254
- {
255
- "title": "Content Title",
256
- "content": "Content body",
257
- "contentType": "article",
258
- "tags": ["tag1", "tag2"]
259
- }
260
- \`\`\`
261
-
262
- #### Get Content
263
- **GET** /content/{id}
264
-
265
- Retrieve specific content by ID.
266
-
267
- #### Update Content
268
- **PUT** /content/{id}
269
-
270
- Update existing content.
271
-
272
- #### Delete Content
273
- **DELETE** /content/{id}
274
-
275
- Delete content.
276
-
277
- #### Upload Media
278
- **POST** /media/upload
279
-
280
- Upload media files.
281
- `,
282
- 'api-gateway': `
283
- #### Route Request
284
- **ANY** /*
285
-
286
- All requests are routed through the API gateway.
287
-
288
- **Headers:**
289
- - \`X-Target-Service\`: Target service name
290
- - \`X-Target-Path\`: Path on target service
291
-
292
- #### Get Routes
293
- **GET** /routes
294
-
295
- List all configured routes.
296
-
297
- #### Health Status
298
- **GET** /status
299
-
300
- Get gateway health and route status.
301
- `,
302
- 'generic': `
303
- #### Service Info
304
- **GET** /info
305
-
306
- Get service information and capabilities.
307
-
308
- **Response:**
309
- \`\`\`json
310
- {
311
- "success": true,
312
- "data": {
313
- "name": "${coreInputs.serviceName}",
314
- "type": "${coreInputs.serviceType}",
315
- "version": "${confirmedValues.version}",
316
- "features": ${JSON.stringify(Object.keys(confirmedValues.features).filter(key => confirmedValues.features[key]), null, 4)}
317
- }
318
- }
319
- \`\`\`
320
- `
321
- };
322
- return endpoints[serviceType] || endpoints.generic;
323
- }
324
-
325
- /**
326
- * Determine if generator should run
327
- */
328
- shouldGenerate(context) {
329
- return true; // Always generate API documentation
330
- }
331
- }
@@ -1,294 +0,0 @@
1
- import { BaseGenerator } from '../BaseGenerator.js';
2
- import { join } from 'path';
3
- import { writeFileSync, mkdirSync } from 'fs';
4
-
5
- /**
6
- * Configuration Documentation Generator
7
- * Generates comprehensive configuration guide covering all config layers
8
- */
9
- export class ConfigurationDocsGenerator extends BaseGenerator {
10
- /**
11
- * Generate configuration documentation
12
- * @param {Object} context - Generation context
13
- * @returns {Promise<string>} Path to generated configuration docs file
14
- */
15
- async generate(context) {
16
- const {
17
- coreInputs,
18
- confirmedValues,
19
- servicePath
20
- } = this.extractContext(context);
21
- if (!this.shouldGenerate(context)) {
22
- return null;
23
- }
24
-
25
- // Ensure docs directory exists
26
- const docsDir = join(servicePath, 'docs');
27
- mkdirSync(docsDir, {
28
- recursive: true
29
- });
30
- const configDocsContent = this._generateConfigDocsContent(coreInputs, confirmedValues);
31
- const filePath = join(servicePath, 'docs', 'CONFIGURATION.md');
32
- writeFileSync(filePath, configDocsContent, 'utf8');
33
- return filePath;
34
- }
35
-
36
- /**
37
- * Generate configuration documentation content
38
- * @private
39
- */
40
- _generateConfigDocsContent(coreInputs, confirmedValues) {
41
- return `# ${confirmedValues.displayName} - Configuration Guide
42
-
43
- ## Overview
44
-
45
- ${confirmedValues.displayName} is configured using multiple layers of configuration files and environment variables.
46
-
47
- ## Configuration Hierarchy
48
-
49
- 1. **Environment Variables** (.env) - Runtime secrets and environment-specific values
50
- 2. **Service Configuration** (src/config/domains.js) - Service-specific settings
51
- 3. **Worker Configuration** (wrangler.toml) - Cloudflare Workers deployment settings
52
- 4. **Package Configuration** (package.json) - Node.js package settings
53
-
54
- ## Environment Variables
55
-
56
- ### Required Variables
57
-
58
- \`\`\`bash
59
- # Cloudflare Configuration
60
- CLOUDFLARE_ACCOUNT_ID=${coreInputs.cloudflareAccountId}
61
- CLOUDFLARE_ZONE_ID=${coreInputs.cloudflareZoneId}
62
- CLOUDFLARE_API_TOKEN=your_api_token
63
-
64
- # Service Configuration
65
- SERVICE_NAME=${coreInputs.serviceName}
66
- SERVICE_TYPE=${coreInputs.serviceType}
67
- DOMAIN_NAME=${coreInputs.domainName}
68
- ENVIRONMENT=${coreInputs.environment}
69
- \`\`\`
70
-
71
- ### Optional Variables
72
-
73
- \`\`\`bash
74
- # URLs (override defaults)
75
- PRODUCTION_URL=${confirmedValues.productionUrl}
76
- STAGING_URL=${confirmedValues.stagingUrl}
77
- DEVELOPMENT_URL=${confirmedValues.developmentUrl}
78
- DOCUMENTATION_URL=${confirmedValues.documentationUrl}
79
-
80
- # API Configuration
81
- API_BASE_PATH=${confirmedValues.apiBasePath}
82
- HEALTH_CHECK_PATH=${confirmedValues.healthCheckPath}
83
-
84
- # Database
85
- DATABASE_NAME=${confirmedValues.databaseName}
86
-
87
- # Logging and Monitoring
88
- LOG_LEVEL=info
89
- METRICS_ENABLED=true
90
- ERROR_REPORTING_ENABLED=true
91
-
92
- # Custom Variables
93
- CUSTOM_VAR=value
94
- \`\`\`
95
-
96
- ## Service Configuration (domains.js)
97
-
98
- Located at \`src/config/domains.js\`, this file contains service-specific configuration:
99
-
100
- \`\`\`javascript
101
- export const domains = {
102
- '${coreInputs.serviceName}': {
103
- name: '${coreInputs.serviceName}',
104
- displayName: '${confirmedValues.displayName}',
105
- description: '${confirmedValues.description}',
106
- accountId: process.env.CLOUDFLARE_ACCOUNT_ID,
107
- zoneId: process.env.CLOUDFLARE_ZONE_ID,
108
- domains: {
109
- production: '${confirmedValues.productionUrl}',
110
- staging: '${confirmedValues.stagingUrl}',
111
- development: '${confirmedValues.developmentUrl}'
112
- },
113
- services: [
114
- '${coreInputs.serviceName}'
115
- ],
116
- databases: [
117
- {
118
- name: '${confirmedValues.databaseName}',
119
- type: 'd1',
120
- binding: 'DB'
121
- }
122
- ],
123
- features: ${JSON.stringify(confirmedValues.features, null, 4)},
124
- metadata: {
125
- version: '${confirmedValues.version}',
126
- author: '${confirmedValues.author}',
127
- generatedAt: '${new Date().toISOString()}',
128
- frameworkVersion: '3.0.0',
129
- serviceType: '${coreInputs.serviceType}',
130
- environment: '${coreInputs.environment}'
131
- }
132
- }
133
- };
134
- \`\`\`
135
-
136
- ## Worker Configuration (wrangler.toml)
137
-
138
- Cloudflare Workers configuration with environment-specific settings:
139
-
140
- \`\`\`toml
141
- name = "${confirmedValues.workerName}"
142
- main = "src/worker/index.js"
143
- compatibility_date = "${new Date().toISOString().split('T')[0]}"
144
- compatibility_flags = ["nodejs_compat"]
145
-
146
- # Environment configurations
147
- [env.development]
148
- name = "${confirmedValues.workerName}-dev"
149
-
150
- [env.staging]
151
- name = "${confirmedValues.workerName}-staging"
152
-
153
- [env.production]
154
- name = "${confirmedValues.workerName}"
155
-
156
- # Database bindings
157
- [[d1_databases]]
158
- binding = "DB"
159
- database_name = "${confirmedValues.databaseName}"
160
-
161
- # Environment variables
162
- [vars]
163
- SERVICE_NAME = "${coreInputs.serviceName}"
164
- SERVICE_TYPE = "${coreInputs.serviceType}"
165
- DOMAIN_NAME = "${coreInputs.domainName}"
166
- ENVIRONMENT = "${coreInputs.environment}"
167
- API_BASE_PATH = "${confirmedValues.apiBasePath}"
168
- HEALTH_CHECK_PATH = "${confirmedValues.healthCheckPath}"
169
-
170
- # Domain-specific variables
171
- PRODUCTION_URL = "${confirmedValues.productionUrl}"
172
- STAGING_URL = "${confirmedValues.stagingUrl}"
173
- DEVELOPMENT_URL = "${confirmedValues.developmentUrl}"
174
-
175
- # Feature flags
176
- ${Object.entries(confirmedValues.features).filter(([, enabled]) => enabled).map(([feature, enabled]) => `FEATURE_${feature.toUpperCase()} = ${enabled}`).join('\n')}
177
-
178
- # Custom environment variables (configure as needed)
179
- # CUSTOM_VAR = "value"
180
- \`\`\`
181
-
182
- ## Feature Flags
183
-
184
- The service supports the following feature flags:
185
-
186
- ${Object.entries(confirmedValues.features).map(([feature, enabled]) => `- **${feature}**: ${enabled ? '✅ Enabled' : '❌ Disabled'}`).join('\n')}
187
-
188
- ### Feature Descriptions
189
-
190
- - **logging**: Request/response logging
191
- - **monitoring**: Performance monitoring and metrics
192
- - **errorReporting**: Error tracking and reporting
193
- - **metrics**: Application metrics collection
194
- - **healthChecks**: Health check endpoints
195
- ${confirmedValues.features.database ? '- **database**: Database operations and connectivity\n' : ''}
196
- ${confirmedValues.features.authentication ? '- **authentication**: User authentication\n' : ''}
197
- ${confirmedValues.features.authorization ? '- **authorization**: Access control and permissions\n' : ''}
198
- ${confirmedValues.features.search ? '- **search**: Search functionality\n' : ''}
199
- ${confirmedValues.features.filtering ? '- **filtering**: Data filtering capabilities\n' : ''}
200
- ${confirmedValues.features.pagination ? '- **pagination**: Paginated responses\n' : ''}
201
- ${confirmedValues.features.caching ? '- **caching**: Response caching\n' : ''}
202
- ${confirmedValues.features.backup ? '- **backup**: Data backup functionality\n' : ''}
203
-
204
- ## Environment-Specific Configuration
205
-
206
- ### Development
207
- - Full debugging enabled
208
- - Local database connections
209
- - Hot reload enabled
210
- - Less strict validation
211
-
212
- ### Staging
213
- - Production-like settings
214
- - Separate database
215
- - Full feature set enabled
216
- - Error reporting enabled
217
-
218
- ### Production
219
- - Optimized settings
220
- - Production database
221
- - Security hardening
222
- - Full monitoring enabled
223
-
224
- ## Configuration Validation
225
-
226
- The service validates configuration on startup:
227
-
228
- 1. **Environment Variables**: Required variables present and valid
229
- 2. **Service Configuration**: domains.js structure and values
230
- 3. **Worker Configuration**: wrangler.toml syntax and bindings
231
- 4. **Feature Compatibility**: Feature flags compatible with service type
232
-
233
- ## Runtime Configuration
234
-
235
- Some configuration can be changed at runtime:
236
-
237
- - Environment variables (require restart)
238
- - Feature flags (may require restart)
239
- - Database connections (handled automatically)
240
- - Logging levels (immediate effect)
241
-
242
- ## Security Considerations
243
-
244
- - Never commit secrets to version control
245
- - Use Cloudflare Workers secrets for sensitive data
246
- - Rotate API tokens regularly
247
- - Limit feature access based on environment
248
- - Validate all input data
249
- - Use HTTPS for all production endpoints
250
-
251
- ## Troubleshooting Configuration Issues
252
-
253
- ### Common Problems
254
-
255
- 1. **Missing environment variables**
256
- - Check .env file exists and is loaded
257
- - Verify variable names match expectations
258
-
259
- 2. **Invalid Cloudflare credentials**
260
- - Check account ID format (32 hex characters)
261
- - Verify API token permissions
262
- - Confirm zone ID is correct
263
-
264
- 3. **Database connection issues**
265
- - Verify D1 database exists
266
- - Check database ID in wrangler.toml
267
- - Confirm database binding name
268
-
269
- 4. **Feature flag conflicts**
270
- - Some features require others to be enabled
271
- - Check service type compatibility
272
-
273
- ### Debugging Configuration
274
-
275
- \`\`\`bash
276
- # Check environment variables
277
- node -e "console.log(process.env)"
278
-
279
- # Validate service configuration
280
- node -e "import('./src/config/domains.js').then(config => console.log(JSON.stringify(config, null, 2)))"
281
-
282
- # Test wrangler configuration
283
- wrangler dev --dry-run
284
- \`\`\`
285
- `;
286
- }
287
-
288
- /**
289
- * Determine if generator should run
290
- */
291
- shouldGenerate(context) {
292
- return true; // Always generate configuration documentation
293
- }
294
- }