@tamyla/clodo-framework 2.0.19 → 2.0.20
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 +174 -97
- package/bin/clodo-service.js +31 -55
- package/package.json +4 -5
- package/bin/shared/config/customer-cli.js +0 -182
- package/dist/shared/config/customer-cli.js +0 -175
package/CHANGELOG.md
CHANGED
|
@@ -1,105 +1,182 @@
|
|
|
1
|
-
## [2.0.
|
|
1
|
+
## [2.0.20](https://github.com/tamylaa/clodo-framework/compare/v2.0.19...v2.0.20) (2025-10-13)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
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
|
-
|
|
10
|
-
## [2.0.18](https://github.com/tamylaa/clodo-framework/compare/v2.0.17...v2.0.18) (2025-10-12)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Bug Fixes
|
|
14
|
-
|
|
15
|
-
* **deployment:** Critical deployment fixes - migrations, worker deployment, status tracking ([23c07e9](https://github.com/tamylaa/clodo-framework/commit/23c07e9a68fa4eb52ccd0df9421eff7d91919cb1)), closes [#2](https://github.com/tamylaa/clodo-framework/issues/2) [#3](https://github.com/tamylaa/clodo-framework/issues/3) [#4](https://github.com/tamylaa/clodo-framework/issues/4)
|
|
16
|
-
|
|
17
|
-
## [2.0.17](https://github.com/tamylaa/clodo-framework/compare/v2.0.16...v2.0.17) (2025-10-12)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Bug Fixes
|
|
21
|
-
|
|
22
|
-
* use ConfigurationValidator as static class, not instance ([12caaeb](https://github.com/tamylaa/clodo-framework/commit/12caaeba17426239f98dacd2fdb36ac45a7a496b))
|
|
23
|
-
|
|
24
|
-
## [2.0.16](https://github.com/tamylaa/clodo-framework/compare/v2.0.15...v2.0.16) (2025-10-12)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
### Bug Fixes
|
|
28
|
-
|
|
29
|
-
* comprehensive readline state management and stdin restoration ([a0716fe](https://github.com/tamylaa/clodo-framework/commit/a0716fef9a5db8211b851ab7861bf2419f31e7fa))
|
|
30
|
-
|
|
31
|
-
## [2.0.15](https://github.com/tamylaa/clodo-framework/compare/v2.0.14...v2.0.15) (2025-10-12)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Bug Fixes
|
|
35
|
-
|
|
36
|
-
* improve customer selection UX with number support ([2e10d56](https://github.com/tamylaa/clodo-framework/commit/2e10d562061c478ecc238e1185e2514af453d00e))
|
|
37
|
-
|
|
38
|
-
## [2.0.14](https://github.com/tamylaa/clodo-framework/compare/v2.0.13...v2.0.14) (2025-10-12)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Bug Fixes
|
|
42
|
-
|
|
43
|
-
* add missing readdirSync import in config-persistence.js ([767efc4](https://github.com/tamylaa/clodo-framework/commit/767efc4aa839c7afa592fe3a1df21b62870bdf23))
|
|
44
|
-
* remove require() calls in ESM modules ([a1783f9](https://github.com/tamylaa/clodo-framework/commit/a1783f9c75c59ae8ce9daacbc223ad80b17d61bc))
|
|
45
|
-
|
|
46
|
-
## [2.0.13](https://github.com/tamylaa/clodo-framework/compare/v2.0.12...v2.0.13) (2025-10-12)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Bug Fixes
|
|
50
|
-
|
|
51
|
-
* comprehensive deployment and architectural integration fixes ([2a9db26](https://github.com/tamylaa/clodo-framework/commit/2a9db264c0d60f1669597885105cc1fdc0cc2e87))
|
|
52
|
-
|
|
53
|
-
## [2.0.12](https://github.com/tamylaa/clodo-framework/compare/v2.0.11...v2.0.12) (2025-10-12)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Bug Fixes
|
|
57
|
-
|
|
58
|
-
* correct zone details property access in auto-discovery ([bfca8af](https://github.com/tamylaa/clodo-framework/commit/bfca8af21a28e96e3fa8809d38de997982723d5a))
|
|
59
|
-
|
|
60
|
-
## [2.0.11](https://github.com/tamylaa/clodo-framework/compare/v2.0.10...v2.0.11) (2025-10-12)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
### Bug Fixes
|
|
64
|
-
|
|
65
|
-
* correct domain selection parsing in auto-discovery ([ea80443](https://github.com/tamylaa/clodo-framework/commit/ea80443bf9968d592f066e7d5d13ee47d6fde889))
|
|
66
|
-
|
|
67
|
-
## [2.0.10](https://github.com/tamylaa/clodo-framework/compare/v2.0.9...v2.0.10) (2025-10-12)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
### Bug Fixes
|
|
71
|
-
|
|
72
|
-
* move interactive-prompts to src/ to fix published package imports ([94fc31c](https://github.com/tamylaa/clodo-framework/commit/94fc31c0afa91c52f2073b3ab9f766693c5f68e0))
|
|
73
|
-
|
|
74
|
-
## [2.0.9](https://github.com/tamylaa/clodo-framework/compare/v2.0.8...v2.0.9) (2025-10-12)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### Bug Fixes
|
|
78
|
-
|
|
79
|
-
* re-release v2.0.8 features that were missing from npm package ([33cf712](https://github.com/tamylaa/clodo-framework/commit/33cf71267c07610e04bd8c752db4385c6f5ca603))
|
|
80
|
-
|
|
81
|
-
## [2.0.8](https://github.com/tamylaa/clodo-framework/compare/v2.0.7...v2.0.8) (2025-10-12)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Bug Fixes
|
|
85
|
-
|
|
86
|
-
* clean up skipped security validation test with proper TODO ([722afbe](https://github.com/tamylaa/clodo-framework/commit/722afbe056be6f8ccb623acbbd3ab9ac4ce75caa))
|
|
87
|
-
* Enhanced customer config, CloudflareAPI utility, and code consolidation ([447ed9b](https://github.com/tamylaa/clodo-framework/commit/447ed9b5d8a2bb806386fc334e2e8bf4efeff43b))
|
|
88
|
-
* implement missing deployment phase methods in MultiDomainOrchestrator ([b0cb1e8](https://github.com/tamylaa/clodo-framework/commit/b0cb1e828679df61d9ebde2551599f47ddeb20d2))
|
|
89
|
-
* integrate CloudflareAPI auto-discovery and cleanup duplicates ([8166d18](https://github.com/tamylaa/clodo-framework/commit/8166d189bbe1e5b78db8f24d56221f0e18e72021))
|
|
90
|
-
* resolve ESLint no-undef errors in cloudflare index.js ([1a2bb7f](https://github.com/tamylaa/clodo-framework/commit/1a2bb7fa175bab142f3d5be451cb44ef1b9d8747))
|
|
91
|
-
|
|
92
|
-
## [2.0.8](https://github.com/tamylaa/clodo-framework/compare/v2.0.7...v2.0.8) (2025-10-12)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Bug Fixes
|
|
96
|
-
|
|
97
|
-
* clean up skipped security validation test with proper TODO ([722afbe](https://github.com/tamylaa/clodo-framework/commit/722afbe056be6f8ccb623acbbd3ab9ac4ce75caa))
|
|
98
|
-
* Enhanced customer config, CloudflareAPI utility, and code consolidation ([447ed9b](https://github.com/tamylaa/clodo-framework/commit/447ed9b5d8a2bb806386fc334e2e8bf4efeff43b))
|
|
99
|
-
* implement missing deployment phase methods in MultiDomainOrchestrator ([b0cb1e8](https://github.com/tamylaa/clodo-framework/commit/b0cb1e828679df61d9ebde2551599f47ddeb20d2))
|
|
100
|
-
* integrate CloudflareAPI auto-discovery and cleanup duplicates ([8166d18](https://github.com/tamylaa/clodo-framework/commit/8166d189bbe1e5b78db8f24d56221f0e18e72021))
|
|
101
|
-
* resolve ESLint no-undef errors in cloudflare index.js ([1a2bb7f](https://github.com/tamylaa/clodo-framework/commit/1a2bb7fa175bab142f3d5be451cb44ef1b9d8747))
|
|
6
|
+
* Complete consolidation cleanup - fix all bin file imports ([4132a2c](https://github.com/tamylaa/clodo-framework/commit/4132a2c0878df84ccc0bd78c6964657810d1f4dc))
|
|
102
7
|
|
|
8
|
+
## [2.0.19](https://github.com/tamylaa/clodo-framework/compare/v2.0.18...v2.0.19) (2025-10-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Add comprehensive deployment configuration implementation status ([025fe82](https://github.com/tamylaa/clodo-framework/commit/025fe821a76ba9ac8cb87d14f2a116a5e8e58c43))
|
|
14
|
+
* Consolidate configuration management and organize documentation ([e3a3d44](https://github.com/tamylaa/clodo-framework/commit/e3a3d448a74b214d75ae669f3a17e3a6ddb36ac4))
|
|
15
|
+
* Resolve ESLint errors in security and config modules ([1080cdb](https://github.com/tamylaa/clodo-framework/commit/1080cdbb69b3ae29158b6af705d8fd376c95da7b))
|
|
16
|
+
* Complete consolidation cleanup - fix all bin file imports ([4132a2c](https://github.com/tamylaa/clodo-framework/commit/4132a2c))
|
|
17
|
+
|
|
18
|
+
### BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
**This release includes breaking changes due to configuration consolidation. Please review the migration guide below.**
|
|
21
|
+
|
|
22
|
+
#### Removed Package Exports:
|
|
23
|
+
- `@tamyla/clodo-framework/config/customer-loader` → **Use** `@tamyla/clodo-framework/utils/config` instead
|
|
24
|
+
- `@tamyla/clodo-framework/config/cli` → **Deprecated** (no direct replacement)
|
|
25
|
+
|
|
26
|
+
#### Removed CLI Commands:
|
|
27
|
+
- `clodo-customer-config` → **Use** `clodo-service deploy` instead
|
|
28
|
+
|
|
29
|
+
#### Migration Guide:
|
|
30
|
+
|
|
31
|
+
**For External Package Users:**
|
|
32
|
+
```javascript
|
|
33
|
+
// OLD (v2.0.18 and earlier - BROKEN in v2.0.19+)
|
|
34
|
+
import { CustomerConfigLoader } from '@tamyla/clodo-framework/config/customer-loader';
|
|
35
|
+
const loader = new CustomerConfigLoader();
|
|
36
|
+
const config = loader.loadConfig('customer', 'production');
|
|
37
|
+
|
|
38
|
+
// NEW (v2.0.19+)
|
|
39
|
+
import { UnifiedConfigManager } from '@tamyla/clodo-framework/utils/config';
|
|
40
|
+
const manager = new UnifiedConfigManager();
|
|
41
|
+
const config = manager.loadCustomerConfig('customer', 'production');
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Method Mappings:**
|
|
45
|
+
- `CustomerConfigLoader.loadConfig(customer, env)` → `UnifiedConfigManager.loadCustomerConfig(customer, env)`
|
|
46
|
+
- `CustomerConfigLoader.parseToStandardFormat(config)` → `UnifiedConfigManager.parseToStandardFormat(config)`
|
|
47
|
+
- `ConfigPersistenceManager.configExists(customer, env)` → `UnifiedConfigManager.configExists(customer, env)`
|
|
48
|
+
- `ConfigPersistenceManager.displayCustomerConfig(customer, env)` → `UnifiedConfigManager.displayCustomerConfig(customer, env)`
|
|
49
|
+
- `ConfigPersistenceManager.getConfiguredCustomers()` → `UnifiedConfigManager.listCustomers()`
|
|
50
|
+
- `ConfigPersistenceManager.saveDeploymentConfig(customer, env, config)` → `UnifiedConfigManager.saveCustomerConfig(customer, env, config)`
|
|
51
|
+
|
|
52
|
+
**For CLI Users:**
|
|
53
|
+
```bash
|
|
54
|
+
# OLD (v2.0.18 and earlier)
|
|
55
|
+
clodo-customer-config create my-customer
|
|
56
|
+
|
|
57
|
+
# NEW (v2.0.19+)
|
|
58
|
+
clodo-service deploy
|
|
59
|
+
# Then select customer interactively
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### What Was Consolidated:
|
|
63
|
+
- **Deleted files** (backed up in `backups/pre-consolidation-cleanup_2025-10-12_21-05-59/`):
|
|
64
|
+
- `src/config/customer-config-loader.js` (1,849 bytes)
|
|
65
|
+
- `src/config/CustomerConfigCLI.js` (14,892 bytes)
|
|
66
|
+
- `src/utils/deployment/ConfigurationManager.js` (9,235 bytes)
|
|
67
|
+
- `src/utils/deployment/ConfigMutator.js` (8,342 bytes)
|
|
68
|
+
- `src/utils/deployment/DeploymentManager.js` (6,819 bytes)
|
|
69
|
+
- `src/utils/deployment/config-persistence.js` (6,656 bytes)
|
|
70
|
+
- `bin/shared/config/customer-cli.js` (deprecated CLI wrapper)
|
|
71
|
+
|
|
72
|
+
- **New consolidated files**:
|
|
73
|
+
- `src/utils/config/unified-config-manager.js` (493 lines) - All customer config operations
|
|
74
|
+
- `src/utils/config/wrangler-config-manager.js` (392 lines) - All wrangler.toml operations
|
|
75
|
+
|
|
76
|
+
#### Why This Change?
|
|
77
|
+
- **Reduced Complexity**: 47,793 bytes of duplicate code consolidated into 885 lines
|
|
78
|
+
- **Better Maintainability**: Single source of truth for config operations
|
|
79
|
+
- **Improved Testing**: Consolidated logic = easier to test
|
|
80
|
+
- **Clearer Architecture**: Documented 3-layer config system (wrangler.toml → customer .env → domains.js)
|
|
81
|
+
|
|
82
|
+
#### Documentation:
|
|
83
|
+
- See `docs/DOMAIN_CONFIGURATION_ARCHITECTURE.md` for complete architecture guide (28 pages)
|
|
84
|
+
- See `docs/CONSOLIDATION_IMPACT_ANALYSIS.md` for detailed impact analysis
|
|
85
|
+
- See `docs/DEPLOYMENT_CONFIGURATION_STATUS.md` for implementation proof
|
|
86
|
+
|
|
87
|
+
## [2.0.18](https://github.com/tamylaa/clodo-framework/compare/v2.0.17...v2.0.18) (2025-10-12)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Bug Fixes
|
|
91
|
+
|
|
92
|
+
* **deployment:** Critical deployment fixes - migrations, worker deployment, status tracking ([23c07e9](https://github.com/tamylaa/clodo-framework/commit/23c07e9a68fa4eb52ccd0df9421eff7d91919cb1)), closes [#2](https://github.com/tamylaa/clodo-framework/issues/2) [#3](https://github.com/tamylaa/clodo-framework/issues/3) [#4](https://github.com/tamylaa/clodo-framework/issues/4)
|
|
93
|
+
|
|
94
|
+
## [2.0.17](https://github.com/tamylaa/clodo-framework/compare/v2.0.16...v2.0.17) (2025-10-12)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Bug Fixes
|
|
98
|
+
|
|
99
|
+
* use ConfigurationValidator as static class, not instance ([12caaeb](https://github.com/tamylaa/clodo-framework/commit/12caaeba17426239f98dacd2fdb36ac45a7a496b))
|
|
100
|
+
|
|
101
|
+
## [2.0.16](https://github.com/tamylaa/clodo-framework/compare/v2.0.15...v2.0.16) (2025-10-12)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Bug Fixes
|
|
105
|
+
|
|
106
|
+
* comprehensive readline state management and stdin restoration ([a0716fe](https://github.com/tamylaa/clodo-framework/commit/a0716fef9a5db8211b851ab7861bf2419f31e7fa))
|
|
107
|
+
|
|
108
|
+
## [2.0.15](https://github.com/tamylaa/clodo-framework/compare/v2.0.14...v2.0.15) (2025-10-12)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Bug Fixes
|
|
112
|
+
|
|
113
|
+
* improve customer selection UX with number support ([2e10d56](https://github.com/tamylaa/clodo-framework/commit/2e10d562061c478ecc238e1185e2514af453d00e))
|
|
114
|
+
|
|
115
|
+
## [2.0.14](https://github.com/tamylaa/clodo-framework/compare/v2.0.13...v2.0.14) (2025-10-12)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Bug Fixes
|
|
119
|
+
|
|
120
|
+
* add missing readdirSync import in config-persistence.js ([767efc4](https://github.com/tamylaa/clodo-framework/commit/767efc4aa839c7afa592fe3a1df21b62870bdf23))
|
|
121
|
+
* remove require() calls in ESM modules ([a1783f9](https://github.com/tamylaa/clodo-framework/commit/a1783f9c75c59ae8ce9daacbc223ad80b17d61bc))
|
|
122
|
+
|
|
123
|
+
## [2.0.13](https://github.com/tamylaa/clodo-framework/compare/v2.0.12...v2.0.13) (2025-10-12)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Bug Fixes
|
|
127
|
+
|
|
128
|
+
* comprehensive deployment and architectural integration fixes ([2a9db26](https://github.com/tamylaa/clodo-framework/commit/2a9db264c0d60f1669597885105cc1fdc0cc2e87))
|
|
129
|
+
|
|
130
|
+
## [2.0.12](https://github.com/tamylaa/clodo-framework/compare/v2.0.11...v2.0.12) (2025-10-12)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### Bug Fixes
|
|
134
|
+
|
|
135
|
+
* correct zone details property access in auto-discovery ([bfca8af](https://github.com/tamylaa/clodo-framework/commit/bfca8af21a28e96e3fa8809d38de997982723d5a))
|
|
136
|
+
|
|
137
|
+
## [2.0.11](https://github.com/tamylaa/clodo-framework/compare/v2.0.10...v2.0.11) (2025-10-12)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Bug Fixes
|
|
141
|
+
|
|
142
|
+
* correct domain selection parsing in auto-discovery ([ea80443](https://github.com/tamylaa/clodo-framework/commit/ea80443bf9968d592f066e7d5d13ee47d6fde889))
|
|
143
|
+
|
|
144
|
+
## [2.0.10](https://github.com/tamylaa/clodo-framework/compare/v2.0.9...v2.0.10) (2025-10-12)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Bug Fixes
|
|
148
|
+
|
|
149
|
+
* move interactive-prompts to src/ to fix published package imports ([94fc31c](https://github.com/tamylaa/clodo-framework/commit/94fc31c0afa91c52f2073b3ab9f766693c5f68e0))
|
|
150
|
+
|
|
151
|
+
## [2.0.9](https://github.com/tamylaa/clodo-framework/compare/v2.0.8...v2.0.9) (2025-10-12)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Bug Fixes
|
|
155
|
+
|
|
156
|
+
* re-release v2.0.8 features that were missing from npm package ([33cf712](https://github.com/tamylaa/clodo-framework/commit/33cf71267c07610e04bd8c752db4385c6f5ca603))
|
|
157
|
+
|
|
158
|
+
## [2.0.8](https://github.com/tamylaa/clodo-framework/compare/v2.0.7...v2.0.8) (2025-10-12)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### Bug Fixes
|
|
162
|
+
|
|
163
|
+
* clean up skipped security validation test with proper TODO ([722afbe](https://github.com/tamylaa/clodo-framework/commit/722afbe056be6f8ccb623acbbd3ab9ac4ce75caa))
|
|
164
|
+
* Enhanced customer config, CloudflareAPI utility, and code consolidation ([447ed9b](https://github.com/tamylaa/clodo-framework/commit/447ed9b5d8a2bb806386fc334e2e8bf4efeff43b))
|
|
165
|
+
* implement missing deployment phase methods in MultiDomainOrchestrator ([b0cb1e8](https://github.com/tamylaa/clodo-framework/commit/b0cb1e828679df61d9ebde2551599f47ddeb20d2))
|
|
166
|
+
* integrate CloudflareAPI auto-discovery and cleanup duplicates ([8166d18](https://github.com/tamylaa/clodo-framework/commit/8166d189bbe1e5b78db8f24d56221f0e18e72021))
|
|
167
|
+
* resolve ESLint no-undef errors in cloudflare index.js ([1a2bb7f](https://github.com/tamylaa/clodo-framework/commit/1a2bb7fa175bab142f3d5be451cb44ef1b9d8747))
|
|
168
|
+
|
|
169
|
+
## [2.0.8](https://github.com/tamylaa/clodo-framework/compare/v2.0.7...v2.0.8) (2025-10-12)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### Bug Fixes
|
|
173
|
+
|
|
174
|
+
* clean up skipped security validation test with proper TODO ([722afbe](https://github.com/tamylaa/clodo-framework/commit/722afbe056be6f8ccb623acbbd3ab9ac4ce75caa))
|
|
175
|
+
* Enhanced customer config, CloudflareAPI utility, and code consolidation ([447ed9b](https://github.com/tamylaa/clodo-framework/commit/447ed9b5d8a2bb806386fc334e2e8bf4efeff43b))
|
|
176
|
+
* implement missing deployment phase methods in MultiDomainOrchestrator ([b0cb1e8](https://github.com/tamylaa/clodo-framework/commit/b0cb1e828679df61d9ebde2551599f47ddeb20d2))
|
|
177
|
+
* integrate CloudflareAPI auto-discovery and cleanup duplicates ([8166d18](https://github.com/tamylaa/clodo-framework/commit/8166d189bbe1e5b78db8f24d56221f0e18e72021))
|
|
178
|
+
* resolve ESLint no-undef errors in cloudflare index.js ([1a2bb7f](https://github.com/tamylaa/clodo-framework/commit/1a2bb7fa175bab142f3d5be451cb44ef1b9d8747))
|
|
179
|
+
|
|
103
180
|
## [2.0.7](https://github.com/tamylaa/clodo-framework/compare/v2.0.6...v2.0.7) (2025-10-12)
|
|
104
181
|
|
|
105
182
|
|
package/bin/clodo-service.js
CHANGED
|
@@ -428,17 +428,15 @@ program
|
|
|
428
428
|
try {
|
|
429
429
|
// Use existing reusable components
|
|
430
430
|
const { InputCollector } = await import('../dist/service-management/InputCollector.js');
|
|
431
|
-
const {
|
|
431
|
+
const { UnifiedConfigManager } = await import('../dist/utils/config/unified-config-manager.js');
|
|
432
432
|
const { ConfirmationHandler } = await import('../dist/service-management/handlers/ConfirmationHandler.js');
|
|
433
433
|
const { MultiDomainOrchestrator } = await import('../dist/orchestration/multi-domain-orchestrator.js');
|
|
434
|
-
const { ConfigPersistenceManager } = await import('../dist/utils/deployment/config-persistence.js');
|
|
435
434
|
|
|
436
435
|
console.log(chalk.cyan('\n🚀 Clodo Framework Deployment'));
|
|
437
436
|
console.log(chalk.white('Using Three-Tier Input Architecture\n'));
|
|
438
437
|
|
|
439
438
|
const isInteractive = options.interactive && !options.nonInteractive;
|
|
440
|
-
const
|
|
441
|
-
const configPersistence = new ConfigPersistenceManager();
|
|
439
|
+
const configManager = new UnifiedConfigManager();
|
|
442
440
|
const inputCollector = new InputCollector({ interactive: isInteractive });
|
|
443
441
|
const confirmationHandler = new ConfirmationHandler({ interactive: isInteractive });
|
|
444
442
|
|
|
@@ -446,74 +444,50 @@ program
|
|
|
446
444
|
let source = 'interactive';
|
|
447
445
|
|
|
448
446
|
try {
|
|
449
|
-
// Try
|
|
447
|
+
// Try UnifiedConfigManager to load existing config
|
|
450
448
|
let storedConfig = null;
|
|
451
449
|
|
|
452
450
|
if (options.customer && options.env) {
|
|
453
|
-
// Check
|
|
454
|
-
if (
|
|
451
|
+
// Check UnifiedConfigManager for existing config
|
|
452
|
+
if (configManager.configExists(options.customer, options.env)) {
|
|
455
453
|
console.log(chalk.green(`✅ Found existing configuration for ${options.customer}/${options.env}\n`));
|
|
456
|
-
|
|
454
|
+
configManager.displayCustomerConfig(options.customer, options.env);
|
|
457
455
|
|
|
458
456
|
if (!isInteractive) {
|
|
459
457
|
// Non-interactive: auto-load the config
|
|
460
|
-
|
|
461
|
-
storedConfig
|
|
462
|
-
|
|
463
|
-
|
|
458
|
+
storedConfig = configManager.loadCustomerConfig(options.customer, options.env);
|
|
459
|
+
if (storedConfig) {
|
|
460
|
+
coreInputs = storedConfig;
|
|
461
|
+
source = 'stored-config';
|
|
462
|
+
}
|
|
464
463
|
} else {
|
|
465
464
|
// Interactive: ask if they want to use it
|
|
466
465
|
const useExisting = await inputCollector.question('\n 💡 Use existing configuration? (Y/n): ');
|
|
467
466
|
|
|
468
467
|
if (useExisting.toLowerCase() !== 'n') {
|
|
469
|
-
|
|
470
|
-
storedConfig
|
|
471
|
-
|
|
472
|
-
|
|
468
|
+
storedConfig = configManager.loadCustomerConfig(options.customer, options.env);
|
|
469
|
+
if (storedConfig) {
|
|
470
|
+
coreInputs = storedConfig;
|
|
471
|
+
source = 'stored-config';
|
|
472
|
+
}
|
|
473
473
|
} else {
|
|
474
474
|
console.log(chalk.white('\n 📝 Collecting new configuration...\n'));
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
} else {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
if (storedConfig) {
|
|
482
|
-
source = 'stored-config';
|
|
483
|
-
console.log(chalk.cyan('📋 Found Existing Configuration (legacy)\n'));
|
|
484
|
-
configLoader.displayConfig(storedConfig.parsed);
|
|
485
|
-
|
|
486
|
-
if (!isInteractive) {
|
|
487
|
-
// Non-interactive: use stored config as-is
|
|
488
|
-
coreInputs = storedConfig.parsed;
|
|
489
|
-
console.log(chalk.green('\n✅ Using stored configuration (non-interactive mode)\n'));
|
|
490
|
-
} else {
|
|
491
|
-
// Interactive: ask to confirm or re-collect
|
|
492
|
-
const useStored = await inputCollector.question('\nUse this configuration? (Y/n): ');
|
|
493
|
-
|
|
494
|
-
if (useStored.toLowerCase() !== 'n') {
|
|
495
|
-
coreInputs = storedConfig.parsed;
|
|
496
|
-
console.log(chalk.green('\n✅ Using stored configuration\n'));
|
|
497
|
-
} else {
|
|
498
|
-
console.log(chalk.white('\nCollecting new configuration...\n'));
|
|
499
|
-
source = 'interactive';
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
} else {
|
|
503
|
-
console.log(chalk.yellow(`⚠️ No configuration found for ${options.customer}/${options.env}`));
|
|
504
|
-
console.log(chalk.white('Collecting inputs interactively...\n'));
|
|
505
|
-
}
|
|
478
|
+
console.log(chalk.yellow(`⚠️ No configuration found for ${options.customer}/${options.env}`));
|
|
479
|
+
console.log(chalk.white('Collecting inputs interactively...\n'));
|
|
506
480
|
}
|
|
507
481
|
|
|
508
|
-
// Use stored config if we found it
|
|
482
|
+
// Use stored config if we found it and haven't collected inputs yet
|
|
509
483
|
if (storedConfig && !coreInputs.cloudflareAccountId) {
|
|
510
|
-
coreInputs = storedConfig
|
|
484
|
+
coreInputs = storedConfig;
|
|
511
485
|
source = 'stored-config';
|
|
512
486
|
console.log(chalk.green('\n✅ Using stored configuration\n'));
|
|
513
487
|
}
|
|
514
488
|
} else if (!options.customer) {
|
|
515
489
|
// Show available customers to help user
|
|
516
|
-
const customers =
|
|
490
|
+
const customers = configManager.listCustomers();
|
|
517
491
|
if (customers.length > 0) {
|
|
518
492
|
console.log(chalk.cyan('💡 Configured customers:'));
|
|
519
493
|
customers.forEach((customer, index) => {
|
|
@@ -530,7 +504,7 @@ program
|
|
|
530
504
|
// Collect basic info with smart customer selection
|
|
531
505
|
let customer = options.customer;
|
|
532
506
|
if (!customer) {
|
|
533
|
-
const customers =
|
|
507
|
+
const customers = configManager.listCustomers();
|
|
534
508
|
if (customers.length > 0) {
|
|
535
509
|
const selection = await inputCollector.question('Select customer (enter number or name): ');
|
|
536
510
|
|
|
@@ -650,13 +624,15 @@ program
|
|
|
650
624
|
try {
|
|
651
625
|
console.log(chalk.cyan('\n💾 Saving deployment configuration...'));
|
|
652
626
|
|
|
653
|
-
const configFile = await
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
627
|
+
const configFile = await configManager.saveCustomerConfig(
|
|
628
|
+
coreInputs.customer,
|
|
629
|
+
coreInputs.environment,
|
|
630
|
+
{
|
|
631
|
+
coreInputs,
|
|
632
|
+
confirmations,
|
|
633
|
+
result
|
|
634
|
+
}
|
|
635
|
+
);
|
|
660
636
|
|
|
661
637
|
console.log(chalk.green(' ✅ Configuration saved successfully!'));
|
|
662
638
|
console.log(chalk.gray(` 📄 File: ${configFile}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamyla/clodo-framework",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20",
|
|
4
4
|
"description": "Reusable framework for Clodo-style software architecture on Cloudflare Workers + D1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"./handlers": "./dist/handlers/GenericRouteHandler.js",
|
|
21
21
|
"./config": "./dist/config/index.js",
|
|
22
22
|
"./config/discovery": "./dist/config/discovery/domain-discovery.js",
|
|
23
|
-
"./config/
|
|
23
|
+
"./config/customers": "./dist/config/customers.js",
|
|
24
|
+
"./utils/config": "./dist/utils/config/unified-config-manager.js",
|
|
24
25
|
"./worker": "./dist/worker/index.js",
|
|
25
26
|
"./utils": "./dist/utils/index.js",
|
|
26
27
|
"./utils/deployment": "./dist/utils/deployment/index.js",
|
|
@@ -38,15 +39,13 @@
|
|
|
38
39
|
"./service-management": "./dist/service-management/index.js",
|
|
39
40
|
"./service-management/create": "./dist/service-management/ServiceCreator.js",
|
|
40
41
|
"./service-management/init": "./dist/service-management/ServiceInitializer.js",
|
|
41
|
-
"./config/cli": "./dist/config/CustomerConfigCLI.js",
|
|
42
42
|
"./modules/security": "./dist/modules/security.js"
|
|
43
43
|
},
|
|
44
44
|
"bin": {
|
|
45
45
|
"clodo-service": "./bin/clodo-service.js",
|
|
46
46
|
"clodo-create-service": "./bin/service-management/create-service.js",
|
|
47
47
|
"clodo-init-service": "./bin/service-management/init-service.js",
|
|
48
|
-
"clodo-security": "./bin/security/security-cli.js"
|
|
49
|
-
"clodo-customer-config": "./bin/shared/config/customer-cli.js"
|
|
48
|
+
"clodo-security": "./bin/security/security-cli.js"
|
|
50
49
|
},
|
|
51
50
|
"publishConfig": {
|
|
52
51
|
"access": "public"
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Customer Configuration Management CLI
|
|
5
|
-
* Manages multi-environment, multi-customer configuration structure
|
|
6
|
-
* Integrates with Clodo Framework domain and feature flag systems
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { CustomerConfigCLI } from '../../../dist/config/CustomerConfigCLI.js';
|
|
10
|
-
import { resolve } from 'path';
|
|
11
|
-
|
|
12
|
-
// Parse command line arguments
|
|
13
|
-
const argv = process.argv.slice(2);
|
|
14
|
-
let configDir = null;
|
|
15
|
-
let command = null;
|
|
16
|
-
let args = [];
|
|
17
|
-
|
|
18
|
-
// Extract --config-dir parameter if present
|
|
19
|
-
for (let i = 0; i < argv.length; i++) {
|
|
20
|
-
if (argv[i] === '--config-dir' && i + 1 < argv.length) {
|
|
21
|
-
configDir = resolve(argv[i + 1]);
|
|
22
|
-
i++; // Skip the next argument (the path)
|
|
23
|
-
} else if (!command) {
|
|
24
|
-
command = argv[i];
|
|
25
|
-
} else {
|
|
26
|
-
args.push(argv[i]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Default to current working directory if not specified
|
|
31
|
-
if (!configDir) {
|
|
32
|
-
configDir = resolve(process.cwd(), 'config');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function main() {
|
|
36
|
-
const cli = new CustomerConfigCLI({ configDir });
|
|
37
|
-
await cli.initialize();
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
switch (command) {
|
|
41
|
-
case 'create-customer':
|
|
42
|
-
const [customerName, domain] = args;
|
|
43
|
-
const result = await cli.createCustomer(customerName, domain);
|
|
44
|
-
if (result.success) {
|
|
45
|
-
console.log(`\n🎉 Customer ${customerName} configuration created successfully!`);
|
|
46
|
-
console.log(`\n📋 Customer Details:`);
|
|
47
|
-
console.log(` Name: ${result.customer.name}`);
|
|
48
|
-
console.log(` Domain: ${result.customer.domain || 'Not specified'}`);
|
|
49
|
-
console.log(` Config Path: ${result.customer.configPath}`);
|
|
50
|
-
console.log(` Environments: ${result.customer.environments.join(', ')}`);
|
|
51
|
-
console.log(`\n📋 Next steps:`);
|
|
52
|
-
console.log(`1. Review generated configs in: config/customers/${customerName}/`);
|
|
53
|
-
console.log(`2. Update domain-specific URLs if needed`);
|
|
54
|
-
console.log(`3. Generate production secrets: npm run security:generate-key ${customerName}`);
|
|
55
|
-
console.log(`4. Set production secrets: wrangler secret put KEY_NAME --env production`);
|
|
56
|
-
} else {
|
|
57
|
-
console.error(`❌ Failed to create customer: ${result.error}`);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
|
|
62
|
-
case 'validate':
|
|
63
|
-
const validateResult = await cli.validateConfigurations();
|
|
64
|
-
if (validateResult.valid) {
|
|
65
|
-
console.log('✅ All customer configurations are valid');
|
|
66
|
-
} else {
|
|
67
|
-
console.log('❌ Configuration validation failed');
|
|
68
|
-
validateResult.errors.forEach(error => console.log(` - ${error}`));
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
break;
|
|
72
|
-
|
|
73
|
-
case 'show':
|
|
74
|
-
const [customerNameShow, environment] = args;
|
|
75
|
-
const showResult = cli.showConfiguration(customerNameShow, environment);
|
|
76
|
-
if (showResult.success) {
|
|
77
|
-
console.log(`🔍 Effective configuration: ${customerNameShow}/${environment}\n`);
|
|
78
|
-
if (showResult.config.variables?.base) {
|
|
79
|
-
console.log('📋 Base variables:');
|
|
80
|
-
Object.entries(showResult.config.variables.base).slice(0, 10).forEach(([key, value]) => {
|
|
81
|
-
console.log(` ${key}=${value}`);
|
|
82
|
-
});
|
|
83
|
-
if (Object.keys(showResult.config.variables.base).length > 10) {
|
|
84
|
-
console.log(' ...');
|
|
85
|
-
}
|
|
86
|
-
console.log('');
|
|
87
|
-
}
|
|
88
|
-
if (showResult.config.variables?.customer) {
|
|
89
|
-
console.log(`📋 Customer ${environment} variables:`);
|
|
90
|
-
Object.entries(showResult.config.variables.customer).slice(0, 15).forEach(([key, value]) => {
|
|
91
|
-
console.log(` ${key}=${value}`);
|
|
92
|
-
});
|
|
93
|
-
if (Object.keys(showResult.config.variables.customer).length > 15) {
|
|
94
|
-
console.log(' ...');
|
|
95
|
-
}
|
|
96
|
-
console.log('');
|
|
97
|
-
}
|
|
98
|
-
if (showResult.config.features && Object.keys(showResult.config.features).length > 0) {
|
|
99
|
-
console.log('🚩 Customer features:');
|
|
100
|
-
Object.entries(showResult.config.features).forEach(([feature, enabled]) => {
|
|
101
|
-
console.log(` ${feature}: ${enabled ? '✅' : '❌'}`);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
} else {
|
|
105
|
-
console.error(`❌ Failed to show configuration: ${showResult.error}`);
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
break;
|
|
109
|
-
|
|
110
|
-
case 'deploy-command':
|
|
111
|
-
const [customerNameDeploy, environmentDeploy] = args;
|
|
112
|
-
const deployResult = cli.getDeployCommand(customerNameDeploy, environmentDeploy);
|
|
113
|
-
if (deployResult.success) {
|
|
114
|
-
console.log(`📋 Deploy command for ${customerNameDeploy}/${environmentDeploy}:`);
|
|
115
|
-
console.log(` ${deployResult.command}`);
|
|
116
|
-
console.log(`\n💡 Ensure customer config is loaded: ${deployResult.configPath}`);
|
|
117
|
-
} else {
|
|
118
|
-
console.error(`❌ Failed to get deploy command: ${deployResult.error}`);
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
break;
|
|
122
|
-
|
|
123
|
-
case 'list':
|
|
124
|
-
const listResult = cli.listCustomers();
|
|
125
|
-
if (listResult.success && listResult.customers.length > 0) {
|
|
126
|
-
console.log('📋 Configured customers:\n');
|
|
127
|
-
listResult.customers.forEach(customer => {
|
|
128
|
-
console.log(`🏢 ${customer.name}`);
|
|
129
|
-
console.log(` Domain: ${customer.customerDomain || customer.domain || 'Not configured'}`);
|
|
130
|
-
console.log(` Account ID: ${customer.accountId ? `${customer.accountId.substring(0, 8)}...${customer.accountId.substring(24)}` : 'Not configured'}`);
|
|
131
|
-
console.log(` Zone ID: ${customer.zoneId ? `${customer.zoneId.substring(0, 8)}...` : 'Not configured'}`);
|
|
132
|
-
if (customer.databaseId) {
|
|
133
|
-
console.log(` Database: ${customer.databaseName || 'Unnamed'} (${customer.databaseId.substring(0, 8)}...)`);
|
|
134
|
-
}
|
|
135
|
-
console.log(` Secrets: ${customer.hasSecrets ? '✅ Managed via wrangler secret commands' : '❌ Not configured'}`);
|
|
136
|
-
console.log(` Environments: ${customer.environments.join(', ')}`);
|
|
137
|
-
console.log(` Config Path: config/customers/${customer.name}/`);
|
|
138
|
-
console.log('');
|
|
139
|
-
});
|
|
140
|
-
} else if (listResult.success) {
|
|
141
|
-
console.log('📋 No customers configured');
|
|
142
|
-
console.log('\n💡 Tip: Run "clodo-customer-config create-customer <name>" to create your first customer');
|
|
143
|
-
} else {
|
|
144
|
-
console.error(`❌ Failed to list customers: ${listResult.error}`);
|
|
145
|
-
process.exit(1);
|
|
146
|
-
}
|
|
147
|
-
break;
|
|
148
|
-
|
|
149
|
-
default:
|
|
150
|
-
console.log('Customer Configuration Management Tool\n');
|
|
151
|
-
console.log('Usage:');
|
|
152
|
-
console.log(' clodo-customer-config [--config-dir <path>] <command> [args]\n');
|
|
153
|
-
console.log('Options:');
|
|
154
|
-
console.log(' --config-dir <path> - Path to config directory (default: ./config)\n');
|
|
155
|
-
console.log('Available commands:');
|
|
156
|
-
console.log(' create-customer <name> [domain] - Create new customer config from template');
|
|
157
|
-
console.log(' validate - Validate configuration structure');
|
|
158
|
-
console.log(' show <customer> <environment> - Show effective configuration');
|
|
159
|
-
console.log(' deploy-command <customer> <env> - Get deployment command');
|
|
160
|
-
console.log(' list - List all configured customers');
|
|
161
|
-
console.log('\nExamples:');
|
|
162
|
-
console.log(' clodo-customer-config create-customer acmecorp acmecorp.com');
|
|
163
|
-
console.log(' clodo-customer-config validate');
|
|
164
|
-
console.log(' clodo-customer-config show acmecorp production');
|
|
165
|
-
console.log(' clodo-customer-config list');
|
|
166
|
-
console.log(' clodo-customer-config --config-dir /path/to/service/config validate');
|
|
167
|
-
console.log('\nIntegration:');
|
|
168
|
-
console.log(' This tool integrates with Clodo Framework domain and feature flag systems.');
|
|
169
|
-
console.log(' Customer configurations are automatically registered as domains.');
|
|
170
|
-
console.log(' When run from a service directory, it uses ./config by default.');
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
} catch (error) {
|
|
174
|
-
console.error(`❌ Error: ${error.message}`);
|
|
175
|
-
process.exit(1);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
main().catch(error => {
|
|
180
|
-
console.error(`❌ Unexpected error: ${error.message}`);
|
|
181
|
-
process.exit(1);
|
|
182
|
-
});
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Customer Configuration Management CLI
|
|
5
|
-
* Manages multi-environment, multi-customer configuration structure
|
|
6
|
-
* Integrates with Clodo Framework domain and feature flag systems
|
|
7
|
-
*/
|
|
8
|
-
import { CustomerConfigCLI } from '../../../dist/config/CustomerConfigCLI.js';
|
|
9
|
-
import { resolve } from 'path';
|
|
10
|
-
|
|
11
|
-
// Parse command line arguments
|
|
12
|
-
const argv = process.argv.slice(2);
|
|
13
|
-
let configDir = null;
|
|
14
|
-
let command = null;
|
|
15
|
-
let args = [];
|
|
16
|
-
|
|
17
|
-
// Extract --config-dir parameter if present
|
|
18
|
-
for (let i = 0; i < argv.length; i++) {
|
|
19
|
-
if (argv[i] === '--config-dir' && i + 1 < argv.length) {
|
|
20
|
-
configDir = resolve(argv[i + 1]);
|
|
21
|
-
i++; // Skip the next argument (the path)
|
|
22
|
-
} else if (!command) {
|
|
23
|
-
command = argv[i];
|
|
24
|
-
} else {
|
|
25
|
-
args.push(argv[i]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Default to current working directory if not specified
|
|
30
|
-
if (!configDir) {
|
|
31
|
-
configDir = resolve(process.cwd(), 'config');
|
|
32
|
-
}
|
|
33
|
-
async function main() {
|
|
34
|
-
const cli = new CustomerConfigCLI({
|
|
35
|
-
configDir
|
|
36
|
-
});
|
|
37
|
-
await cli.initialize();
|
|
38
|
-
try {
|
|
39
|
-
switch (command) {
|
|
40
|
-
case 'create-customer':
|
|
41
|
-
const [customerName, domain] = args;
|
|
42
|
-
const result = await cli.createCustomer(customerName, domain);
|
|
43
|
-
if (result.success) {
|
|
44
|
-
console.log(`\n🎉 Customer ${customerName} configuration created successfully!`);
|
|
45
|
-
console.log(`\n📋 Customer Details:`);
|
|
46
|
-
console.log(` Name: ${result.customer.name}`);
|
|
47
|
-
console.log(` Domain: ${result.customer.domain || 'Not specified'}`);
|
|
48
|
-
console.log(` Config Path: ${result.customer.configPath}`);
|
|
49
|
-
console.log(` Environments: ${result.customer.environments.join(', ')}`);
|
|
50
|
-
console.log(`\n📋 Next steps:`);
|
|
51
|
-
console.log(`1. Review generated configs in: config/customers/${customerName}/`);
|
|
52
|
-
console.log(`2. Update domain-specific URLs if needed`);
|
|
53
|
-
console.log(`3. Generate production secrets: npm run security:generate-key ${customerName}`);
|
|
54
|
-
console.log(`4. Set production secrets: wrangler secret put KEY_NAME --env production`);
|
|
55
|
-
} else {
|
|
56
|
-
console.error(`❌ Failed to create customer: ${result.error}`);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
break;
|
|
60
|
-
case 'validate':
|
|
61
|
-
const validateResult = await cli.validateConfigurations();
|
|
62
|
-
if (validateResult.valid) {
|
|
63
|
-
console.log('✅ All customer configurations are valid');
|
|
64
|
-
} else {
|
|
65
|
-
console.log('❌ Configuration validation failed');
|
|
66
|
-
validateResult.errors.forEach(error => console.log(` - ${error}`));
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
break;
|
|
70
|
-
case 'show':
|
|
71
|
-
const [customerNameShow, environment] = args;
|
|
72
|
-
const showResult = cli.showConfiguration(customerNameShow, environment);
|
|
73
|
-
if (showResult.success) {
|
|
74
|
-
console.log(`🔍 Effective configuration: ${customerNameShow}/${environment}\n`);
|
|
75
|
-
if (showResult.config.variables?.base) {
|
|
76
|
-
console.log('📋 Base variables:');
|
|
77
|
-
Object.entries(showResult.config.variables.base).slice(0, 10).forEach(([key, value]) => {
|
|
78
|
-
console.log(` ${key}=${value}`);
|
|
79
|
-
});
|
|
80
|
-
if (Object.keys(showResult.config.variables.base).length > 10) {
|
|
81
|
-
console.log(' ...');
|
|
82
|
-
}
|
|
83
|
-
console.log('');
|
|
84
|
-
}
|
|
85
|
-
if (showResult.config.variables?.customer) {
|
|
86
|
-
console.log(`📋 Customer ${environment} variables:`);
|
|
87
|
-
Object.entries(showResult.config.variables.customer).slice(0, 15).forEach(([key, value]) => {
|
|
88
|
-
console.log(` ${key}=${value}`);
|
|
89
|
-
});
|
|
90
|
-
if (Object.keys(showResult.config.variables.customer).length > 15) {
|
|
91
|
-
console.log(' ...');
|
|
92
|
-
}
|
|
93
|
-
console.log('');
|
|
94
|
-
}
|
|
95
|
-
if (showResult.config.features && Object.keys(showResult.config.features).length > 0) {
|
|
96
|
-
console.log('🚩 Customer features:');
|
|
97
|
-
Object.entries(showResult.config.features).forEach(([feature, enabled]) => {
|
|
98
|
-
console.log(` ${feature}: ${enabled ? '✅' : '❌'}`);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
console.error(`❌ Failed to show configuration: ${showResult.error}`);
|
|
103
|
-
process.exit(1);
|
|
104
|
-
}
|
|
105
|
-
break;
|
|
106
|
-
case 'deploy-command':
|
|
107
|
-
const [customerNameDeploy, environmentDeploy] = args;
|
|
108
|
-
const deployResult = cli.getDeployCommand(customerNameDeploy, environmentDeploy);
|
|
109
|
-
if (deployResult.success) {
|
|
110
|
-
console.log(`📋 Deploy command for ${customerNameDeploy}/${environmentDeploy}:`);
|
|
111
|
-
console.log(` ${deployResult.command}`);
|
|
112
|
-
console.log(`\n💡 Ensure customer config is loaded: ${deployResult.configPath}`);
|
|
113
|
-
} else {
|
|
114
|
-
console.error(`❌ Failed to get deploy command: ${deployResult.error}`);
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
|
-
break;
|
|
118
|
-
case 'list':
|
|
119
|
-
const listResult = cli.listCustomers();
|
|
120
|
-
if (listResult.success && listResult.customers.length > 0) {
|
|
121
|
-
console.log('📋 Configured customers:\n');
|
|
122
|
-
listResult.customers.forEach(customer => {
|
|
123
|
-
console.log(`🏢 ${customer.name}`);
|
|
124
|
-
console.log(` Domain: ${customer.customerDomain || customer.domain || 'Not configured'}`);
|
|
125
|
-
console.log(` Account ID: ${customer.accountId ? `${customer.accountId.substring(0, 8)}...${customer.accountId.substring(24)}` : 'Not configured'}`);
|
|
126
|
-
console.log(` Zone ID: ${customer.zoneId ? `${customer.zoneId.substring(0, 8)}...` : 'Not configured'}`);
|
|
127
|
-
if (customer.databaseId) {
|
|
128
|
-
console.log(` Database: ${customer.databaseName || 'Unnamed'} (${customer.databaseId.substring(0, 8)}...)`);
|
|
129
|
-
}
|
|
130
|
-
console.log(` Secrets: ${customer.hasSecrets ? '✅ Managed via wrangler secret commands' : '❌ Not configured'}`);
|
|
131
|
-
console.log(` Environments: ${customer.environments.join(', ')}`);
|
|
132
|
-
console.log(` Config Path: config/customers/${customer.name}/`);
|
|
133
|
-
console.log('');
|
|
134
|
-
});
|
|
135
|
-
} else if (listResult.success) {
|
|
136
|
-
console.log('📋 No customers configured');
|
|
137
|
-
console.log('\n💡 Tip: Run "clodo-customer-config create-customer <name>" to create your first customer');
|
|
138
|
-
} else {
|
|
139
|
-
console.error(`❌ Failed to list customers: ${listResult.error}`);
|
|
140
|
-
process.exit(1);
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
default:
|
|
144
|
-
console.log('Customer Configuration Management Tool\n');
|
|
145
|
-
console.log('Usage:');
|
|
146
|
-
console.log(' clodo-customer-config [--config-dir <path>] <command> [args]\n');
|
|
147
|
-
console.log('Options:');
|
|
148
|
-
console.log(' --config-dir <path> - Path to config directory (default: ./config)\n');
|
|
149
|
-
console.log('Available commands:');
|
|
150
|
-
console.log(' create-customer <name> [domain] - Create new customer config from template');
|
|
151
|
-
console.log(' validate - Validate configuration structure');
|
|
152
|
-
console.log(' show <customer> <environment> - Show effective configuration');
|
|
153
|
-
console.log(' deploy-command <customer> <env> - Get deployment command');
|
|
154
|
-
console.log(' list - List all configured customers');
|
|
155
|
-
console.log('\nExamples:');
|
|
156
|
-
console.log(' clodo-customer-config create-customer acmecorp acmecorp.com');
|
|
157
|
-
console.log(' clodo-customer-config validate');
|
|
158
|
-
console.log(' clodo-customer-config show acmecorp production');
|
|
159
|
-
console.log(' clodo-customer-config list');
|
|
160
|
-
console.log(' clodo-customer-config --config-dir /path/to/service/config validate');
|
|
161
|
-
console.log('\nIntegration:');
|
|
162
|
-
console.log(' This tool integrates with Clodo Framework domain and feature flag systems.');
|
|
163
|
-
console.log(' Customer configurations are automatically registered as domains.');
|
|
164
|
-
console.log(' When run from a service directory, it uses ./config by default.');
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
} catch (error) {
|
|
168
|
-
console.error(`❌ Error: ${error.message}`);
|
|
169
|
-
process.exit(1);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
main().catch(error => {
|
|
173
|
-
console.error(`❌ Unexpected error: ${error.message}`);
|
|
174
|
-
process.exit(1);
|
|
175
|
-
});
|