@tamyla/clodo-framework 3.1.24 → 3.1.25
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 +7 -0
- package/dist/cli/clodo-simple.js +111 -0
- package/dist/cli/commands/assess.js +5 -5
- package/dist/cli/commands/create.js +22 -31
- package/dist/cli/commands/deploy.js +22 -357
- package/dist/cli/commands/diagnose.js +5 -5
- package/dist/cli/commands/helpers/deployment-verification.js +2 -2
- package/dist/cli/commands/helpers/error-recovery.js +1 -1
- package/dist/cli/commands/helpers/resource-detection.js +1 -1
- package/dist/cli/commands/init-config.js +1 -1
- package/dist/cli/commands/update.js +5 -5
- package/dist/cli/commands/validate.js +24 -48
- package/dist/cli/security-cli.js +1 -1
- package/dist/deployment/wrangler-deployer.js +1 -1
- package/dist/index.js +5 -2
- package/dist/lib/deployment/modules/DeploymentOrchestrator.js +2 -2
- package/dist/lib/deployment/modules/EnvironmentManager.js +2 -2
- package/dist/lib/shared/cloudflare/domain-manager.js +1 -1
- package/dist/lib/shared/cloudflare/ops.js +4 -4
- package/dist/lib/shared/config/command-config-manager.js +1 -1
- package/dist/lib/shared/config/index.js +1 -1
- package/dist/lib/shared/deployment/credential-collector.js +1 -1
- package/dist/lib/shared/deployment/index.js +2 -2
- package/dist/lib/shared/deployment/rollback-manager.js +1 -1
- package/dist/lib/shared/deployment/utilities/d1-error-recovery.js +1 -1
- package/dist/lib/shared/deployment/validator.js +1 -1
- package/dist/lib/shared/deployment/workflows/interactive-database-workflow.js +1 -1
- package/dist/lib/shared/monitoring/health-checker.js +2 -2
- package/dist/lib/shared/routing/domain-router.js +1 -1
- package/dist/lib/shared/validation/ValidationRegistry.js +1 -1
- package/dist/orchestration/cross-domain-coordinator.js +5 -5
- package/dist/orchestration/multi-domain-orchestrator.js +51 -0
- package/dist/security/index.js +2 -2
- package/dist/service-management/ConfirmationEngine.js +1 -1
- package/dist/service-management/ErrorTracker.js +1 -1
- package/dist/service-management/InputCollector.js +1 -1
- package/dist/service-management/ServiceOrchestrator.js +77 -0
- package/dist/service-management/generators/testing/UnitTestsGenerator.js +4 -4
- package/dist/simple-api.js +94 -0
- package/dist/utils/cloudflare/ops.js +1 -1
- package/dist/utils/file-manager.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/worker/integration.js +1 -1
- package/package.json +2 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { ServiceOrchestrator } from '
|
|
4
|
-
import { StandardOptions } from '
|
|
5
|
-
import { ServiceConfigManager } from '
|
|
3
|
+
import { ServiceOrchestrator } from '../../src/service-management/ServiceOrchestrator.js';
|
|
4
|
+
import { StandardOptions } from '../../lib/shared/utils/cli-options.js';
|
|
5
|
+
import { ServiceConfigManager } from '../../lib/shared/utils/service-config-manager.js';
|
|
6
6
|
export function registerDiagnoseCommand(program) {
|
|
7
7
|
const command = program.command('diagnose [service-path]').description('Diagnose and report issues with an existing service').option('--deep-scan', 'Perform deep analysis including dependencies and deployment readiness').option('--export-report <file>', 'Export diagnostic report to file').option('--fix-suggestions', 'Include suggested fixes for issues').option('--show-config-sources', 'Display all configuration sources and merged result');
|
|
8
8
|
|
|
9
9
|
// Add standard options (--verbose, --quiet, --json, --no-color, --config-file)
|
|
10
10
|
StandardOptions.define(command).action(async (servicePath, options) => {
|
|
11
11
|
try {
|
|
12
|
-
const output = new (await import('
|
|
12
|
+
const output = new (await import('../../lib/shared/utils/output-formatter.js')).OutputFormatter(options);
|
|
13
13
|
const configManager = new ServiceConfigManager({
|
|
14
14
|
verbose: options.verbose,
|
|
15
15
|
quiet: options.quiet,
|
|
@@ -75,7 +75,7 @@ export function registerDiagnoseCommand(program) {
|
|
|
75
75
|
process.exit(1);
|
|
76
76
|
}
|
|
77
77
|
} catch (error) {
|
|
78
|
-
const output = new (await import('
|
|
78
|
+
const output = new (await import('../../lib/shared/utils/output-formatter.js')).OutputFormatter(options || {});
|
|
79
79
|
output.error(`Diagnosis failed: ${error.message}`);
|
|
80
80
|
process.exit(1);
|
|
81
81
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides UI-specific deployment verification by delegating to shared infrastructure
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { verifyWorkerDeployment, healthCheckWithBackoff, checkHealth } from '
|
|
6
|
+
import { verifyWorkerDeployment, healthCheckWithBackoff, checkHealth } from '../../../lib/shared/monitoring/health-checker.js';
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import readline from 'readline';
|
|
9
9
|
|
|
@@ -157,7 +157,7 @@ async function discoverUrlFromCloudflare(cloudflareSettings, options = {}) {
|
|
|
157
157
|
try {
|
|
158
158
|
const {
|
|
159
159
|
CloudflareAPI
|
|
160
|
-
} = await import('
|
|
160
|
+
} = await import('../../../utils/cloudflare/api.js');
|
|
161
161
|
const api = new CloudflareAPI(cloudflareSettings.token);
|
|
162
162
|
|
|
163
163
|
// Get worker routes for the zone
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides interactive error recovery by delegating to shared error classification
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { classifyError, getRecoverySuggestions } from '
|
|
6
|
+
import { classifyError, getRecoverySuggestions } from '../../../lib/shared/error-handling/error-classifier.js';
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import readline from 'readline';
|
|
9
9
|
|
|
@@ -22,7 +22,7 @@ export async function detectExistingResources(serviceName, manifest, credentials
|
|
|
22
22
|
// Import CloudflareAPI to check existing resources
|
|
23
23
|
const {
|
|
24
24
|
CloudflareAPI
|
|
25
|
-
} = await import('
|
|
25
|
+
} = await import('../../../src/utils/cloudflare/api.js');
|
|
26
26
|
const cfApi = new CloudflareAPI(credentials.token);
|
|
27
27
|
|
|
28
28
|
// Check if worker already exists
|
|
@@ -12,7 +12,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
12
12
|
const __dirname = dirname(__filename);
|
|
13
13
|
|
|
14
14
|
// Path to framework's bundled config
|
|
15
|
-
const FRAMEWORK_CONFIG_PATH = join(__dirname, '
|
|
15
|
+
const FRAMEWORK_CONFIG_PATH = join(__dirname, '../../config/validation-config.json');
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Register the init-config command with the CLI
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import path from 'path';
|
|
7
|
-
import { ServiceOrchestrator } from '
|
|
8
|
-
import { StandardOptions } from '
|
|
9
|
-
import { ServiceConfigManager } from '
|
|
7
|
+
import { ServiceOrchestrator } from '../../src/service-management/ServiceOrchestrator.js';
|
|
8
|
+
import { StandardOptions } from '../../lib/shared/utils/cli-options.js';
|
|
9
|
+
import { ServiceConfigManager } from '../../lib/shared/utils/service-config-manager.js';
|
|
10
10
|
export function registerUpdateCommand(program) {
|
|
11
11
|
const command = program.command('update [service-path]').description('Update an existing service configuration').option('-i, --interactive', 'Run in interactive mode to select what to update').option('--domain-name <domain>', 'Update domain name').option('--cloudflare-token <token>', 'Update Cloudflare API token').option('--cloudflare-account-id <id>', 'Update Cloudflare account ID').option('--cloudflare-zone-id <id>', 'Update Cloudflare zone ID').option('--environment <env>', 'Update target environment: development, staging, production').option('--add-feature <feature>', 'Add a feature flag').option('--remove-feature <feature>', 'Remove a feature flag').option('--regenerate-configs', 'Regenerate all configuration files').option('--fix-errors', 'Attempt to fix common configuration errors').option('--preview', 'Show what would be changed without applying').option('--show-config-sources', 'Display all configuration sources and merged result').option('--force', 'Skip confirmation prompts');
|
|
12
12
|
|
|
13
13
|
// Add standard options (--verbose, --quiet, --json, --no-color, --config-file)
|
|
14
14
|
StandardOptions.define(command).action(async (servicePath, options) => {
|
|
15
15
|
try {
|
|
16
|
-
const output = new (await import('
|
|
16
|
+
const output = new (await import('../../lib/shared/utils/output-formatter.js')).OutputFormatter(options);
|
|
17
17
|
const configManager = new ServiceConfigManager({
|
|
18
18
|
verbose: options.verbose,
|
|
19
19
|
quiet: options.quiet,
|
|
@@ -87,7 +87,7 @@ export function registerUpdateCommand(program) {
|
|
|
87
87
|
}
|
|
88
88
|
output.success('Service update completed successfully!');
|
|
89
89
|
} catch (error) {
|
|
90
|
-
const output = new (await import('
|
|
90
|
+
const output = new (await import('../../lib/shared/utils/output-formatter.js')).OutputFormatter(options || {});
|
|
91
91
|
output.error(`Service update failed: ${error.message}`);
|
|
92
92
|
if (error.details) {
|
|
93
93
|
output.warning(`Details: ${error.details}`);
|
|
@@ -1,63 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validate Command - Validate an existing service configuration
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
import chalk from 'chalk';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { StandardOptions } from '../lib/shared/utils/cli-options.js';
|
|
9
|
-
import { ServiceConfigManager } from '../lib/shared/utils/service-config-manager.js';
|
|
2
|
+
import { Clodo } from '../../src/simple-api.js';
|
|
3
|
+
import { StandardOptions } from '../../lib/shared/utils/cli-options.js';
|
|
10
4
|
export function registerValidateCommand(program) {
|
|
11
|
-
const command = program.command('validate <service-path>').description('Validate an existing service configuration').option('--
|
|
5
|
+
const command = program.command('validate <service-path>').description('Validate an existing service configuration').option('--export-report <file>', 'Export validation report to JSON file');
|
|
12
6
|
|
|
13
7
|
// Add standard options (--verbose, --quiet, --json, --no-color, --config-file)
|
|
14
8
|
StandardOptions.define(command).action(async (servicePath, options) => {
|
|
15
9
|
try {
|
|
16
|
-
const output = new (await import('
|
|
17
|
-
const configManager = new ServiceConfigManager({
|
|
18
|
-
verbose: options.verbose,
|
|
19
|
-
quiet: options.quiet,
|
|
20
|
-
json: options.json,
|
|
21
|
-
showSources: options.showConfigSources
|
|
22
|
-
});
|
|
23
|
-
const orchestrator = new ServiceOrchestrator();
|
|
24
|
-
|
|
25
|
-
// Validate service path with better error handling
|
|
26
|
-
try {
|
|
27
|
-
servicePath = await configManager.validateServicePath(servicePath, orchestrator);
|
|
28
|
-
} catch (error) {
|
|
29
|
-
output.error(error.message);
|
|
30
|
-
if (error.suggestions) {
|
|
31
|
-
output.info('Suggestions:');
|
|
32
|
-
output.list(error.suggestions);
|
|
33
|
-
}
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
10
|
+
const output = new (await import('../../lib/shared/utils/output-formatter.js')).OutputFormatter(options);
|
|
36
11
|
|
|
37
|
-
//
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
exportReport:
|
|
12
|
+
// Use simple API for validation
|
|
13
|
+
const result = await Clodo.validate({
|
|
14
|
+
servicePath: servicePath || '.',
|
|
15
|
+
exportReport: options.exportReport
|
|
41
16
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
17
|
+
if (result.success) {
|
|
18
|
+
output.success(result.message);
|
|
19
|
+
if (result.issues && result.issues.length > 0) {
|
|
20
|
+
output.warning(`Found ${result.issues.length} issues:`);
|
|
21
|
+
result.issues.forEach(issue => {
|
|
22
|
+
output.info(` - ${issue}`);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
49
25
|
} else {
|
|
50
|
-
output.error(
|
|
51
|
-
|
|
26
|
+
output.error(result.message);
|
|
27
|
+
if (result.issues && result.issues.length > 0) {
|
|
28
|
+
output.info('Issues found:');
|
|
29
|
+
result.issues.forEach(issue => {
|
|
30
|
+
output.info(` - ${issue}`);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
52
33
|
process.exit(1);
|
|
53
34
|
}
|
|
54
|
-
|
|
55
|
-
// Report export success if requested
|
|
56
|
-
if (mergedOptions.exportReport) {
|
|
57
|
-
output.success(`📄 Report exported to: ${mergedOptions.exportReport}`);
|
|
58
|
-
}
|
|
59
35
|
} catch (error) {
|
|
60
|
-
const output = new (await import('
|
|
36
|
+
const output = new (await import('../../lib/shared/utils/output-formatter.js')).OutputFormatter(options || {});
|
|
61
37
|
output.error(`Validation failed: ${error.message}`);
|
|
62
38
|
process.exit(1);
|
|
63
39
|
}
|
package/dist/cli/security-cli.js
CHANGED
|
@@ -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 '
|
|
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
|
package/dist/index.js
CHANGED
|
@@ -6,10 +6,13 @@ export * from './worker/index.js';
|
|
|
6
6
|
export * from './utils/index.js';
|
|
7
7
|
export * from './orchestration/index.js';
|
|
8
8
|
|
|
9
|
+
// Simple API - Recommended for most users
|
|
10
|
+
export { default as Clodo, createService, deploy, validate, initialize, getInfo } from './simple-api.js';
|
|
11
|
+
|
|
9
12
|
// Core framework classes and utilities
|
|
10
13
|
export { FeatureFlagManager } from './config/features.js';
|
|
11
14
|
export { createDomainConfigSchema, validateDomainConfig, createDefaultDomainConfig } from './utils/domain-config.js';
|
|
12
|
-
export { initializeService
|
|
15
|
+
export { initializeService } from './worker/integration.js';
|
|
13
16
|
|
|
14
17
|
// Core data and schema components
|
|
15
18
|
export * from './services/GenericDataService.js';
|
|
@@ -25,7 +28,7 @@ export { WranglerDeployer } from './deployment/wrangler-deployer.js';
|
|
|
25
28
|
export * from './security/index.js';
|
|
26
29
|
|
|
27
30
|
// Service management components
|
|
28
|
-
export { ServiceCreator
|
|
31
|
+
export { ServiceCreator } from './service-management/ServiceCreator.js';
|
|
29
32
|
export { ServiceOrchestrator } from './service-management/ServiceOrchestrator.js';
|
|
30
33
|
export { InputHandler } from './service-management/handlers/InputHandler.js';
|
|
31
34
|
export { ConfirmationHandler } from './service-management/handlers/ConfirmationHandler.js';
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import { readFileSync, writeFileSync } from 'fs';
|
|
8
8
|
import { deploySecret, runMigrations, checkHealth } from '../../shared/cloudflare/ops.js';
|
|
9
|
-
import { WranglerDeployer } from '
|
|
10
|
-
import { DeploymentDatabaseManager } from '
|
|
9
|
+
import { WranglerDeployer } from '../../deployment/wrangler-deployer.js';
|
|
10
|
+
import { DeploymentDatabaseManager } from '../../database/deployment-db-manager.js';
|
|
11
11
|
import { DeploymentConfiguration } from './DeploymentConfiguration.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Handles environment configuration, domain mapping, deployment mode selection, and cross-domain coordination
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { MultiDomainOrchestrator } from '
|
|
7
|
-
import { CrossDomainCoordinator } from '
|
|
6
|
+
import { MultiDomainOrchestrator } from '../../../src/orchestration/multi-domain-orchestrator.js';
|
|
7
|
+
import { CrossDomainCoordinator } from '../../../src/orchestration/cross-domain-coordinator.js';
|
|
8
8
|
import { DomainDiscovery } from '../../shared/cloudflare/domain-discovery.js';
|
|
9
9
|
import { askChoice, askUser, askYesNo, DeploymentInteractiveUtils } from '../../shared/utils/interactive-utils.js';
|
|
10
10
|
export class EnvironmentManager {
|
|
@@ -15,7 +15,7 @@ import { promisify } from 'util';
|
|
|
15
15
|
import { exec } from 'child_process';
|
|
16
16
|
import { askChoice, askYesNo } from '../utils/interactive-prompts.js';
|
|
17
17
|
import { DomainDiscovery } from './domain-discovery.js';
|
|
18
|
-
import { MultiDomainOrchestrator } from '
|
|
18
|
+
import { MultiDomainOrchestrator } from '../../../src/orchestration/multi-domain-orchestrator.js';
|
|
19
19
|
import { getCommandConfig } from '../config/command-config-manager.js';
|
|
20
20
|
import { CloudflareTokenManager } from '../security/api-token-manager.js';
|
|
21
21
|
const execAsync = promisify(exec);
|
|
@@ -242,7 +242,7 @@ export async function listDatabases(options = {}) {
|
|
|
242
242
|
if (apiToken && accountId) {
|
|
243
243
|
const {
|
|
244
244
|
CloudflareAPI
|
|
245
|
-
} = await import('
|
|
245
|
+
} = await import('../../../src/utils/cloudflare/api.js');
|
|
246
246
|
const cf = new CloudflareAPI(apiToken);
|
|
247
247
|
return await cf.listD1Databases(accountId);
|
|
248
248
|
}
|
|
@@ -267,7 +267,7 @@ export async function databaseExists(databaseName, options = {}) {
|
|
|
267
267
|
if (apiToken && accountId) {
|
|
268
268
|
const {
|
|
269
269
|
CloudflareAPI
|
|
270
|
-
} = await import('
|
|
270
|
+
} = await import('../../../src/utils/cloudflare/api.js');
|
|
271
271
|
const cf = new CloudflareAPI(apiToken);
|
|
272
272
|
return await cf.d1DatabaseExists(accountId, databaseName);
|
|
273
273
|
}
|
|
@@ -290,7 +290,7 @@ export async function createDatabase(name, options = {}) {
|
|
|
290
290
|
if (apiToken && accountId) {
|
|
291
291
|
const {
|
|
292
292
|
CloudflareAPI
|
|
293
|
-
} = await import('
|
|
293
|
+
} = await import('../../../src/utils/cloudflare/api.js');
|
|
294
294
|
const cf = new CloudflareAPI(apiToken);
|
|
295
295
|
const result = await cf.createD1Database(accountId, name);
|
|
296
296
|
return result.uuid; // Return UUID to match CLI behavior
|
|
@@ -405,7 +405,7 @@ export async function getDatabaseId(databaseName, options = {}) {
|
|
|
405
405
|
if (apiToken && accountId) {
|
|
406
406
|
const {
|
|
407
407
|
CloudflareAPI
|
|
408
|
-
} = await import('
|
|
408
|
+
} = await import('../../../src/utils/cloudflare/api.js');
|
|
409
409
|
const cf = new CloudflareAPI(apiToken);
|
|
410
410
|
const db = await cf.getD1Database(accountId, databaseName);
|
|
411
411
|
return db?.uuid || null;
|
|
@@ -14,7 +14,7 @@ import { fileURLToPath } from 'url';
|
|
|
14
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
15
|
const __dirname = dirname(__filename);
|
|
16
16
|
// Navigate up to framework root, then to config directory
|
|
17
|
-
const FRAMEWORK_CONFIG_PATH = join(__dirname, '
|
|
17
|
+
const FRAMEWORK_CONFIG_PATH = join(__dirname, '../../../config/validation-config.json');
|
|
18
18
|
export class CommandConfigManager {
|
|
19
19
|
constructor(configPath = null) {
|
|
20
20
|
this.configPath = configPath || join(process.cwd(), 'validation-config.json');
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export { ConfigCache } from './cache.js';
|
|
8
8
|
export { ConfigManager } from './manager.js';
|
|
9
9
|
export { CommandConfigManager } from './command-config-manager.js';
|
|
10
|
-
export { CustomerConfigurationManager } from '
|
|
10
|
+
export { CustomerConfigurationManager } from '../../../config/customers.js';
|
|
11
11
|
|
|
12
12
|
// Phase 3.2 consolidated configuration management
|
|
13
13
|
export { ConfigurationManager, configManager, isFeatureEnabled, getEnabledFeatures, withFeature, FEATURES, COMMON_FEATURES } from './ConfigurationManager.js';
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import chalk from 'chalk';
|
|
12
12
|
import { askUser, askPassword, askChoice, closePrompts } from '../utils/interactive-prompts.js';
|
|
13
13
|
import { ApiTokenManager } from '../security/api-token-manager.js';
|
|
14
|
-
import { CloudflareAPI } from '
|
|
14
|
+
import { CloudflareAPI } from '../../../src/utils/cloudflare/api.js';
|
|
15
15
|
export class DeploymentCredentialCollector {
|
|
16
16
|
constructor(options = {}) {
|
|
17
17
|
this.servicePath = options.servicePath || '.';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export { DeploymentValidator } from './validator.js';
|
|
7
|
-
export { MultiDomainOrchestrator } from '
|
|
8
|
-
export { CrossDomainCoordinator } from '
|
|
7
|
+
export { MultiDomainOrchestrator } from '../../orchestration/multi-domain-orchestrator.js';
|
|
8
|
+
export { CrossDomainCoordinator } from '../../orchestration/cross-domain-coordinator.js';
|
|
9
9
|
export { DeploymentAuditor } from './auditor.js';
|
|
10
10
|
export { RollbackManager } from './rollback-manager.js';
|
|
@@ -42,7 +42,7 @@ export class D1ErrorRecoveryManager {
|
|
|
42
42
|
// Import WranglerDeployer for D1 error handling
|
|
43
43
|
const {
|
|
44
44
|
WranglerDeployer
|
|
45
|
-
} = await import('
|
|
45
|
+
} = await import('../../../src/deployment/wrangler-deployer.js');
|
|
46
46
|
deployer = new WranglerDeployer({
|
|
47
47
|
cwd: config.cwd || process.cwd(),
|
|
48
48
|
environment: config.environment
|
|
@@ -18,7 +18,7 @@ import { getCommandConfig } from '../config/command-config-manager.js';
|
|
|
18
18
|
const __filename = fileURLToPath(import.meta.url);
|
|
19
19
|
const __dirname = dirname(__filename);
|
|
20
20
|
// Navigate up to framework root, then to config directory
|
|
21
|
-
const FRAMEWORK_CONFIG_PATH = join(__dirname, '
|
|
21
|
+
const FRAMEWORK_CONFIG_PATH = join(__dirname, '../../../config/validation-config.json');
|
|
22
22
|
const execAsync = promisify(exec);
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module interactive-database-workflow
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { askUser, askYesNo, askChoice } from '
|
|
10
|
+
import { askUser, askYesNo, askChoice } from '../../utils/interactive-prompts.js';
|
|
11
11
|
import { databaseExists, createDatabase, deleteDatabase } from '../../cloudflare/ops.js';
|
|
12
12
|
import { exec } from 'child_process';
|
|
13
13
|
import { promisify } from 'util';
|
|
@@ -14,7 +14,7 @@ const execAsync = promisify(exec);
|
|
|
14
14
|
// Load framework configuration
|
|
15
15
|
const {
|
|
16
16
|
frameworkConfig
|
|
17
|
-
} = await import('
|
|
17
|
+
} = await import('../../../src/utils/framework-config.js');
|
|
18
18
|
const timing = frameworkConfig.getTiming();
|
|
19
19
|
function makeHttpRequest(url, method = 'GET', timeout = 5000) {
|
|
20
20
|
return new Promise((resolve, reject) => {
|
|
@@ -546,7 +546,7 @@ export async function verifyWorkerDeployment(workerName, credentials, options =
|
|
|
546
546
|
}
|
|
547
547
|
const {
|
|
548
548
|
CloudflareAPI
|
|
549
|
-
} = await import('
|
|
549
|
+
} = await import('../../../src/utils/cloudflare/api.js');
|
|
550
550
|
const cfApi = new CloudflareAPI(credentials.token);
|
|
551
551
|
|
|
552
552
|
// List all workers to find ours
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { existsSync, readFileSync } from 'fs';
|
|
16
16
|
import { resolve } from 'path';
|
|
17
|
-
import { MultiDomainOrchestrator } from '
|
|
17
|
+
import { MultiDomainOrchestrator } from '../../../src/orchestration/multi-domain-orchestrator.js';
|
|
18
18
|
export class DomainRouter {
|
|
19
19
|
constructor(options = {}) {
|
|
20
20
|
this.configPath = options.configPath || './config/domains.json';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Import validators from src/utils (source of truth)
|
|
10
10
|
*/
|
|
11
|
-
import { validateServiceName, validateDomainName, validateCloudflareToken, validateCloudflareId, validateServiceType, validateEnvironment } from '
|
|
11
|
+
import { validateServiceName, validateDomainName, validateCloudflareToken, validateCloudflareId, validateServiceType, validateEnvironment } from '../../../src/utils/validation.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Validation Registry - Single source of truth for all validators
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
|
|
20
20
|
import { access } from 'fs/promises';
|
|
21
21
|
import { MultiDomainOrchestrator } from './multi-domain-orchestrator.js';
|
|
22
|
-
import { DeploymentValidator } from '
|
|
23
|
-
import { RollbackManager } from '
|
|
24
|
-
import { DomainDiscovery } from '
|
|
22
|
+
import { DeploymentValidator } from '../../lib/shared/deployment/validator.js';
|
|
23
|
+
import { RollbackManager } from '../../lib/shared/deployment/rollback-manager.js';
|
|
24
|
+
import { DomainDiscovery } from '../../lib/shared/cloudflare/domain-discovery.js';
|
|
25
25
|
import { DatabaseOrchestrator } from '../database/database-orchestrator.js';
|
|
26
26
|
import { EnhancedSecretManager } from '../utils/deployment/secret-generator.js';
|
|
27
|
-
import { ProductionTester } from '
|
|
28
|
-
import { DeploymentAuditor } from '
|
|
27
|
+
import { ProductionTester } from '../../lib/shared/production-tester/index.js';
|
|
28
|
+
import { DeploymentAuditor } from '../../lib/shared/deployment/auditor.js';
|
|
29
29
|
import { ConfigurationCacheManager } from '../utils/deployment/config-cache.js';
|
|
30
30
|
export class CrossDomainCoordinator {
|
|
31
31
|
constructor(options = {}) {
|
|
@@ -761,5 +761,56 @@ export class MultiDomainOrchestrator {
|
|
|
761
761
|
getPortfolioStats() {
|
|
762
762
|
return this.stateManager.getPortfolioSummary();
|
|
763
763
|
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Simple API: Deploy a service with minimal configuration
|
|
767
|
+
* @param {Object} options - Simple deployment options
|
|
768
|
+
* @param {string} options.servicePath - Path to service directory
|
|
769
|
+
* @param {string} options.environment - Target environment
|
|
770
|
+
* @param {string} options.domain - Specific domain to deploy to
|
|
771
|
+
* @param {boolean} options.dryRun - Simulate deployment
|
|
772
|
+
* @param {Object} options.credentials - Cloudflare credentials
|
|
773
|
+
* @returns {Promise<Object>} Deployment result
|
|
774
|
+
*/
|
|
775
|
+
static async deploy(options = {}) {
|
|
776
|
+
const {
|
|
777
|
+
servicePath = '.',
|
|
778
|
+
environment = 'production',
|
|
779
|
+
domain,
|
|
780
|
+
dryRun = false,
|
|
781
|
+
credentials = {}
|
|
782
|
+
} = options;
|
|
783
|
+
|
|
784
|
+
// Create orchestrator with simplified options
|
|
785
|
+
const orchestrator = new MultiDomainOrchestrator({
|
|
786
|
+
environment,
|
|
787
|
+
dryRun,
|
|
788
|
+
servicePath,
|
|
789
|
+
cloudflareToken: credentials.token,
|
|
790
|
+
cloudflareAccountId: credentials.accountId,
|
|
791
|
+
cloudflareZoneId: credentials.zoneId,
|
|
792
|
+
domains: domain ? [domain] : []
|
|
793
|
+
});
|
|
794
|
+
try {
|
|
795
|
+
// Initialize the orchestrator
|
|
796
|
+
await orchestrator.initialize();
|
|
797
|
+
|
|
798
|
+
// Deploy based on configuration
|
|
799
|
+
let result;
|
|
800
|
+
if (domain) {
|
|
801
|
+
result = await orchestrator.deploySingleDomain(domain);
|
|
802
|
+
} else {
|
|
803
|
+
result = await orchestrator.deployPortfolio();
|
|
804
|
+
}
|
|
805
|
+
return {
|
|
806
|
+
success: true,
|
|
807
|
+
environment,
|
|
808
|
+
deployedDomains: result.deployedDomains || [domain],
|
|
809
|
+
message: `Service deployed to ${environment} successfully`
|
|
810
|
+
};
|
|
811
|
+
} catch (error) {
|
|
812
|
+
throw new Error(`Deployment failed: ${error.message}`);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
764
815
|
}
|
|
765
816
|
export default MultiDomainOrchestrator;
|
package/dist/security/index.js
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
import { ConfigurationValidator } from './ConfigurationValidator.js';
|
|
7
7
|
// DeploymentManager removed - replaced by MultiDomainOrchestrator + WranglerConfigManager
|
|
8
8
|
import { SecretGenerator } from './SecretGenerator.js';
|
|
9
|
-
import { ErrorHandler } from '
|
|
9
|
+
import { ErrorHandler } from '../../lib/shared/utils/index.js';
|
|
10
10
|
// InteractiveDeploymentConfigurator removed - replaced by InputCollector
|
|
11
11
|
|
|
12
12
|
export { ConfigurationValidator } from './ConfigurationValidator.js';
|
|
13
13
|
// export { DeploymentManager } - DEPRECATED: Use MultiDomainOrchestrator instead
|
|
14
14
|
export { SecretGenerator } from './SecretGenerator.js';
|
|
15
|
-
export { ErrorHandler } from '
|
|
15
|
+
export { ErrorHandler } from '../../lib/shared/utils/index.js';
|
|
16
16
|
// export { InteractiveDeploymentConfigurator } - DEPRECATED: Use InputCollector instead
|
|
17
17
|
|
|
18
18
|
// Re-export patterns and rules for advanced usage
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
import { createInterface } from 'readline';
|
|
35
35
|
import chalk from 'chalk';
|
|
36
36
|
import { validateServiceName, validateDomainName } from '../utils/validation.js';
|
|
37
|
-
import { NameFormatters, UrlFormatters, ResourceFormatters } from '
|
|
37
|
+
import { NameFormatters, UrlFormatters, ResourceFormatters } from '../../lib/shared/utils/formatters.js';
|
|
38
38
|
export class ConfirmationEngine {
|
|
39
39
|
constructor(options = {}) {
|
|
40
40
|
this.interactive = options.interactive !== false;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import fs from 'fs/promises';
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import chalk from 'chalk';
|
|
11
|
-
import { logger } from '
|
|
11
|
+
import { logger } from '../../lib/shared/logging/Logger.js';
|
|
12
12
|
export class ErrorTracker {
|
|
13
13
|
constructor() {
|
|
14
14
|
this.errors = [];
|
|
@@ -15,7 +15,7 @@ import { createInterface } from 'readline';
|
|
|
15
15
|
import chalk from 'chalk';
|
|
16
16
|
import { validateServiceName, validateDomainName } from '../utils/validation.js';
|
|
17
17
|
import { uiStructuresLoader } from '../utils/ui-structures-loader.js';
|
|
18
|
-
import { NameFormatters, UrlFormatters, ResourceFormatters } from '
|
|
18
|
+
import { NameFormatters, UrlFormatters, ResourceFormatters } from '../../lib/shared/utils/formatters.js';
|
|
19
19
|
|
|
20
20
|
// Assessment capabilities moved to @tamyla/clodo-orchestration (professional edition)
|
|
21
21
|
|