nvoi 0.1.7 → 0.2.0
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -5
- data/Gemfile.lock +17 -8
- data/Rakefile +1 -1
- data/lib/nvoi/cli/config/command.rb +46 -41
- data/lib/nvoi/cli/credentials/edit/command.rb +20 -20
- data/lib/nvoi/cli/credentials/show/command.rb +1 -1
- data/lib/nvoi/cli/db/command.rb +10 -10
- data/lib/nvoi/cli/delete/command.rb +2 -2
- data/lib/nvoi/cli/deploy/command.rb +29 -13
- data/lib/nvoi/cli/deploy/steps/build_image.rb +48 -6
- data/lib/nvoi/cli/deploy/steps/configure_tunnel.rb +2 -2
- data/lib/nvoi/cli/deploy/steps/deploy_service.rb +3 -13
- data/lib/nvoi/cli/deploy/steps/provision_server.rb +1 -1
- data/lib/nvoi/cli/deploy/steps/provision_volume.rb +1 -1
- data/lib/nvoi/cli/exec/command.rb +3 -3
- data/lib/nvoi/cli/logs/command.rb +2 -2
- data/lib/nvoi/cli/onboard/command.rb +176 -622
- data/lib/nvoi/cli/onboard/steps/app.rb +108 -0
- data/lib/nvoi/cli/onboard/steps/app_name.rb +26 -0
- data/lib/nvoi/cli/onboard/steps/compute.rb +139 -0
- data/lib/nvoi/cli/onboard/steps/database.rb +97 -0
- data/lib/nvoi/cli/onboard/steps/domain.rb +48 -0
- data/lib/nvoi/cli/onboard/steps/env.rb +67 -0
- data/lib/nvoi/cli/onboard/ui.rb +84 -0
- data/lib/nvoi/cli/unlock/command.rb +2 -2
- data/lib/nvoi/cli.rb +0 -32
- data/lib/nvoi/configuration/app_service.rb +54 -0
- data/lib/nvoi/configuration/application.rb +44 -0
- data/lib/nvoi/configuration/builder.rb +417 -0
- data/lib/nvoi/configuration/database.rb +56 -0
- data/lib/nvoi/configuration/deploy.rb +15 -0
- data/lib/nvoi/{objects/service_spec.rb → configuration/deployment.rb} +4 -3
- data/lib/nvoi/{objects/config_override.rb → configuration/override.rb} +4 -4
- data/lib/nvoi/configuration/providers.rb +78 -0
- data/lib/nvoi/configuration/result.rb +43 -0
- data/lib/nvoi/configuration/root.rb +234 -0
- data/lib/nvoi/configuration/server.rb +39 -0
- data/lib/nvoi/configuration/service.rb +62 -0
- data/lib/nvoi/external/cloud/aws.rb +12 -12
- data/lib/nvoi/external/cloud/hetzner.rb +7 -7
- data/lib/nvoi/external/cloud/scaleway.rb +7 -7
- data/lib/nvoi/external/cloud/types.rb +42 -0
- data/lib/nvoi/external/containerd.rb +1 -48
- data/lib/nvoi/external/database/mysql.rb +1 -1
- data/lib/nvoi/external/database/postgres.rb +1 -1
- data/lib/nvoi/external/database/provider.rb +1 -1
- data/lib/nvoi/external/database/sqlite.rb +1 -1
- data/lib/nvoi/external/database/types.rb +55 -0
- data/lib/nvoi/external/dns/cloudflare.rb +6 -6
- data/lib/nvoi/external/dns/types.rb +24 -0
- data/lib/nvoi/external/ssh.rb +0 -12
- data/lib/nvoi/external/ssh_tunnel.rb +100 -0
- data/lib/nvoi/utils/config_loader.rb +12 -12
- data/lib/nvoi/utils/credential_store.rb +4 -4
- data/lib/nvoi/utils/env_resolver.rb +3 -3
- data/lib/nvoi/utils/namer.rb +2 -2
- data/lib/nvoi/utils/presence.rb +23 -0
- data/lib/nvoi/version.rb +1 -1
- data/lib/nvoi.rb +2 -17
- metadata +96 -57
- data/.claude/todo/refactor/00-overview.md +0 -171
- data/.claude/todo/refactor/01-objects.md +0 -96
- data/.claude/todo/refactor/02-utils.md +0 -143
- data/.claude/todo/refactor/03-external-cloud.md +0 -164
- data/.claude/todo/refactor/04-external-dns.md +0 -104
- data/.claude/todo/refactor/05-external.md +0 -133
- data/.claude/todo/refactor/06-cli.md +0 -123
- data/.claude/todo/refactor/07-cli-deploy-command.md +0 -177
- data/.claude/todo/refactor/08-cli-deploy-steps.md +0 -201
- data/.claude/todo/refactor/09-cli-delete-command.md +0 -169
- data/.claude/todo/refactor/10-cli-exec-command.md +0 -157
- data/.claude/todo/refactor/11-cli-credentials-command.md +0 -190
- data/.claude/todo/refactor/12-cli-db-command.md +0 -128
- data/.claude/todo/refactor/_target.md +0 -79
- data/.claude/todo/refactor-execution/00-entrypoint.md +0 -49
- data/.claude/todo/refactor-execution/01-objects.md +0 -42
- data/.claude/todo/refactor-execution/02-utils.md +0 -41
- data/.claude/todo/refactor-execution/03-external-cloud.md +0 -38
- data/.claude/todo/refactor-execution/04-external-dns.md +0 -35
- data/.claude/todo/refactor-execution/05-external-other.md +0 -46
- data/.claude/todo/refactor-execution/06-cli-deploy.md +0 -45
- data/.claude/todo/refactor-execution/07-cli-delete.md +0 -43
- data/.claude/todo/refactor-execution/08-cli-exec.md +0 -30
- data/.claude/todo/refactor-execution/09-cli-credentials.md +0 -34
- data/.claude/todo/refactor-execution/10-cli-db.md +0 -31
- data/.claude/todo/refactor-execution/11-cli-router.md +0 -44
- data/.claude/todo/refactor-execution/12-cleanup.md +0 -120
- data/.claude/todo/refactor-execution/_monitoring-strategy.md +0 -126
- data/.claude/todo/scaleway.impl.md +0 -644
- data/.claude/todo/scaleway.reference.md +0 -520
- data/.claude/todos.md +0 -550
- data/ingest +0 -0
- data/lib/nvoi/config_api/actions/app.rb +0 -53
- data/lib/nvoi/config_api/actions/compute_provider.rb +0 -55
- data/lib/nvoi/config_api/actions/database.rb +0 -70
- data/lib/nvoi/config_api/actions/domain_provider.rb +0 -40
- data/lib/nvoi/config_api/actions/env.rb +0 -32
- data/lib/nvoi/config_api/actions/init.rb +0 -67
- data/lib/nvoi/config_api/actions/secret.rb +0 -32
- data/lib/nvoi/config_api/actions/server.rb +0 -66
- data/lib/nvoi/config_api/actions/service.rb +0 -52
- data/lib/nvoi/config_api/actions/volume.rb +0 -40
- data/lib/nvoi/config_api/base.rb +0 -38
- data/lib/nvoi/config_api/result.rb +0 -26
- data/lib/nvoi/config_api.rb +0 -93
- data/lib/nvoi/objects/configuration.rb +0 -483
- data/lib/nvoi/objects/database.rb +0 -56
- data/lib/nvoi/objects/dns.rb +0 -14
- data/lib/nvoi/objects/firewall.rb +0 -11
- data/lib/nvoi/objects/network.rb +0 -11
- data/lib/nvoi/objects/server.rb +0 -14
- data/lib/nvoi/objects/tunnel.rb +0 -14
- data/lib/nvoi/objects/volume.rb +0 -17
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nvoi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- NVOI
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-12-
|
|
11
|
+
date: 2025-12-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: zeitwerk
|
|
@@ -38,6 +38,76 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '1.3'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: pastel
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0.8'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0.8'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: tty-prompt
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0.23'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0.23'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: tty-box
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0.7'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0.7'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: tty-spinner
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0.9'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0.9'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: tty-table
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0.12'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0.12'
|
|
41
111
|
- !ruby/object:Gem::Dependency
|
|
42
112
|
name: aws-sdk-ec2
|
|
43
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -173,37 +243,6 @@ executables:
|
|
|
173
243
|
extensions: []
|
|
174
244
|
extra_rdoc_files: []
|
|
175
245
|
files:
|
|
176
|
-
- ".claude/todo/refactor-execution/00-entrypoint.md"
|
|
177
|
-
- ".claude/todo/refactor-execution/01-objects.md"
|
|
178
|
-
- ".claude/todo/refactor-execution/02-utils.md"
|
|
179
|
-
- ".claude/todo/refactor-execution/03-external-cloud.md"
|
|
180
|
-
- ".claude/todo/refactor-execution/04-external-dns.md"
|
|
181
|
-
- ".claude/todo/refactor-execution/05-external-other.md"
|
|
182
|
-
- ".claude/todo/refactor-execution/06-cli-deploy.md"
|
|
183
|
-
- ".claude/todo/refactor-execution/07-cli-delete.md"
|
|
184
|
-
- ".claude/todo/refactor-execution/08-cli-exec.md"
|
|
185
|
-
- ".claude/todo/refactor-execution/09-cli-credentials.md"
|
|
186
|
-
- ".claude/todo/refactor-execution/10-cli-db.md"
|
|
187
|
-
- ".claude/todo/refactor-execution/11-cli-router.md"
|
|
188
|
-
- ".claude/todo/refactor-execution/12-cleanup.md"
|
|
189
|
-
- ".claude/todo/refactor-execution/_monitoring-strategy.md"
|
|
190
|
-
- ".claude/todo/refactor/00-overview.md"
|
|
191
|
-
- ".claude/todo/refactor/01-objects.md"
|
|
192
|
-
- ".claude/todo/refactor/02-utils.md"
|
|
193
|
-
- ".claude/todo/refactor/03-external-cloud.md"
|
|
194
|
-
- ".claude/todo/refactor/04-external-dns.md"
|
|
195
|
-
- ".claude/todo/refactor/05-external.md"
|
|
196
|
-
- ".claude/todo/refactor/06-cli.md"
|
|
197
|
-
- ".claude/todo/refactor/07-cli-deploy-command.md"
|
|
198
|
-
- ".claude/todo/refactor/08-cli-deploy-steps.md"
|
|
199
|
-
- ".claude/todo/refactor/09-cli-delete-command.md"
|
|
200
|
-
- ".claude/todo/refactor/10-cli-exec-command.md"
|
|
201
|
-
- ".claude/todo/refactor/11-cli-credentials-command.md"
|
|
202
|
-
- ".claude/todo/refactor/12-cli-db-command.md"
|
|
203
|
-
- ".claude/todo/refactor/_target.md"
|
|
204
|
-
- ".claude/todo/scaleway.impl.md"
|
|
205
|
-
- ".claude/todo/scaleway.reference.md"
|
|
206
|
-
- ".claude/todos.md"
|
|
207
246
|
- ".rubocop.yml"
|
|
208
247
|
- Gemfile
|
|
209
248
|
- Gemfile.lock
|
|
@@ -327,7 +366,6 @@ files:
|
|
|
327
366
|
- examples/rails-single/vendor/.keep
|
|
328
367
|
- examples/rails-single/yarn.lock
|
|
329
368
|
- exe/nvoi
|
|
330
|
-
- ingest
|
|
331
369
|
- lib/nvoi.rb
|
|
332
370
|
- lib/nvoi/cli.rb
|
|
333
371
|
- lib/nvoi/cli/config/command.rb
|
|
@@ -354,20 +392,26 @@ files:
|
|
|
354
392
|
- lib/nvoi/cli/exec/command.rb
|
|
355
393
|
- lib/nvoi/cli/logs/command.rb
|
|
356
394
|
- lib/nvoi/cli/onboard/command.rb
|
|
395
|
+
- lib/nvoi/cli/onboard/steps/app.rb
|
|
396
|
+
- lib/nvoi/cli/onboard/steps/app_name.rb
|
|
397
|
+
- lib/nvoi/cli/onboard/steps/compute.rb
|
|
398
|
+
- lib/nvoi/cli/onboard/steps/database.rb
|
|
399
|
+
- lib/nvoi/cli/onboard/steps/domain.rb
|
|
400
|
+
- lib/nvoi/cli/onboard/steps/env.rb
|
|
401
|
+
- lib/nvoi/cli/onboard/ui.rb
|
|
357
402
|
- lib/nvoi/cli/unlock/command.rb
|
|
358
|
-
- lib/nvoi/
|
|
359
|
-
- lib/nvoi/
|
|
360
|
-
- lib/nvoi/
|
|
361
|
-
- lib/nvoi/
|
|
362
|
-
- lib/nvoi/
|
|
363
|
-
- lib/nvoi/
|
|
364
|
-
- lib/nvoi/
|
|
365
|
-
- lib/nvoi/
|
|
366
|
-
- lib/nvoi/
|
|
367
|
-
- lib/nvoi/
|
|
368
|
-
- lib/nvoi/
|
|
369
|
-
- lib/nvoi/
|
|
370
|
-
- lib/nvoi/config_api/result.rb
|
|
403
|
+
- lib/nvoi/configuration/app_service.rb
|
|
404
|
+
- lib/nvoi/configuration/application.rb
|
|
405
|
+
- lib/nvoi/configuration/builder.rb
|
|
406
|
+
- lib/nvoi/configuration/database.rb
|
|
407
|
+
- lib/nvoi/configuration/deploy.rb
|
|
408
|
+
- lib/nvoi/configuration/deployment.rb
|
|
409
|
+
- lib/nvoi/configuration/override.rb
|
|
410
|
+
- lib/nvoi/configuration/providers.rb
|
|
411
|
+
- lib/nvoi/configuration/result.rb
|
|
412
|
+
- lib/nvoi/configuration/root.rb
|
|
413
|
+
- lib/nvoi/configuration/server.rb
|
|
414
|
+
- lib/nvoi/configuration/service.rb
|
|
371
415
|
- lib/nvoi/errors.rb
|
|
372
416
|
- lib/nvoi/external/cloud.rb
|
|
373
417
|
- lib/nvoi/external/cloud/aws.rb
|
|
@@ -375,25 +419,19 @@ files:
|
|
|
375
419
|
- lib/nvoi/external/cloud/factory.rb
|
|
376
420
|
- lib/nvoi/external/cloud/hetzner.rb
|
|
377
421
|
- lib/nvoi/external/cloud/scaleway.rb
|
|
422
|
+
- lib/nvoi/external/cloud/types.rb
|
|
378
423
|
- lib/nvoi/external/containerd.rb
|
|
379
424
|
- lib/nvoi/external/database.rb
|
|
380
425
|
- lib/nvoi/external/database/mysql.rb
|
|
381
426
|
- lib/nvoi/external/database/postgres.rb
|
|
382
427
|
- lib/nvoi/external/database/provider.rb
|
|
383
428
|
- lib/nvoi/external/database/sqlite.rb
|
|
429
|
+
- lib/nvoi/external/database/types.rb
|
|
384
430
|
- lib/nvoi/external/dns/cloudflare.rb
|
|
431
|
+
- lib/nvoi/external/dns/types.rb
|
|
385
432
|
- lib/nvoi/external/kubectl.rb
|
|
386
433
|
- lib/nvoi/external/ssh.rb
|
|
387
|
-
- lib/nvoi/
|
|
388
|
-
- lib/nvoi/objects/configuration.rb
|
|
389
|
-
- lib/nvoi/objects/database.rb
|
|
390
|
-
- lib/nvoi/objects/dns.rb
|
|
391
|
-
- lib/nvoi/objects/firewall.rb
|
|
392
|
-
- lib/nvoi/objects/network.rb
|
|
393
|
-
- lib/nvoi/objects/server.rb
|
|
394
|
-
- lib/nvoi/objects/service_spec.rb
|
|
395
|
-
- lib/nvoi/objects/tunnel.rb
|
|
396
|
-
- lib/nvoi/objects/volume.rb
|
|
434
|
+
- lib/nvoi/external/ssh_tunnel.rb
|
|
397
435
|
- lib/nvoi/utils/config_loader.rb
|
|
398
436
|
- lib/nvoi/utils/constants.rb
|
|
399
437
|
- lib/nvoi/utils/credential_store.rb
|
|
@@ -401,6 +439,7 @@ files:
|
|
|
401
439
|
- lib/nvoi/utils/env_resolver.rb
|
|
402
440
|
- lib/nvoi/utils/logger.rb
|
|
403
441
|
- lib/nvoi/utils/namer.rb
|
|
442
|
+
- lib/nvoi/utils/presence.rb
|
|
404
443
|
- lib/nvoi/utils/retry.rb
|
|
405
444
|
- lib/nvoi/utils/templates.rb
|
|
406
445
|
- lib/nvoi/version.rb
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
# Refactor Overview
|
|
2
|
-
|
|
3
|
-
## Target Structure
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
lib/nvoi/
|
|
7
|
-
├── cli.rb # Thor routing only (~50 lines)
|
|
8
|
-
│
|
|
9
|
-
├── cli/
|
|
10
|
-
│ ├── deploy/
|
|
11
|
-
│ │ ├── command.rb
|
|
12
|
-
│ │ └── steps/
|
|
13
|
-
│ │ ├── provision_network.rb
|
|
14
|
-
│ │ ├── provision_server.rb
|
|
15
|
-
│ │ ├── provision_volume.rb
|
|
16
|
-
│ │ ├── setup_k3s.rb
|
|
17
|
-
│ │ ├── configure_tunnel.rb
|
|
18
|
-
│ │ ├── build_image.rb
|
|
19
|
-
│ │ ├── deploy_service.rb
|
|
20
|
-
│ │ └── cleanup_images.rb
|
|
21
|
-
│ │
|
|
22
|
-
│ ├── delete/
|
|
23
|
-
│ │ ├── command.rb
|
|
24
|
-
│ │ └── steps/
|
|
25
|
-
│ │ ├── teardown_tunnel.rb
|
|
26
|
-
│ │ ├── teardown_dns.rb
|
|
27
|
-
│ │ ├── detach_volumes.rb
|
|
28
|
-
│ │ ├── teardown_server.rb
|
|
29
|
-
│ │ ├── teardown_volume.rb
|
|
30
|
-
│ │ ├── teardown_firewall.rb
|
|
31
|
-
│ │ └── teardown_network.rb
|
|
32
|
-
│ │
|
|
33
|
-
│ ├── exec/
|
|
34
|
-
│ │ └── command.rb
|
|
35
|
-
│ │
|
|
36
|
-
│ └── credentials/
|
|
37
|
-
│ ├── edit/
|
|
38
|
-
│ │ └── command.rb
|
|
39
|
-
│ └── show/
|
|
40
|
-
│ └── command.rb
|
|
41
|
-
│
|
|
42
|
-
├── external/
|
|
43
|
-
│ ├── cloud/
|
|
44
|
-
│ │ ├── base.rb
|
|
45
|
-
│ │ ├── hetzner.rb
|
|
46
|
-
│ │ ├── aws.rb
|
|
47
|
-
│ │ ├── scaleway.rb
|
|
48
|
-
│ │ └── factory.rb
|
|
49
|
-
│ ├── dns/
|
|
50
|
-
│ │ └── cloudflare.rb
|
|
51
|
-
│ ├── ssh.rb
|
|
52
|
-
│ ├── kubectl.rb
|
|
53
|
-
│ └── containerd.rb
|
|
54
|
-
│
|
|
55
|
-
├── objects/
|
|
56
|
-
│ ├── server.rb
|
|
57
|
-
│ ├── network.rb
|
|
58
|
-
│ ├── firewall.rb
|
|
59
|
-
│ ├── volume.rb
|
|
60
|
-
│ ├── tunnel.rb
|
|
61
|
-
│ ├── dns.rb
|
|
62
|
-
│ ├── service_spec.rb
|
|
63
|
-
│ └── config.rb
|
|
64
|
-
│
|
|
65
|
-
└── utils/
|
|
66
|
-
├── namer.rb
|
|
67
|
-
├── env_resolver.rb
|
|
68
|
-
├── config_loader.rb
|
|
69
|
-
├── crypto.rb
|
|
70
|
-
├── templates.rb
|
|
71
|
-
├── logger.rb
|
|
72
|
-
├── constants.rb
|
|
73
|
-
├── errors.rb
|
|
74
|
-
└── retry.rb
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Refactor Order
|
|
80
|
-
|
|
81
|
-
| # | File | Description | Depends On |
|
|
82
|
-
| --- | -------------------------- | ------------------------- | --------------- |
|
|
83
|
-
| 01 | objects.md | Domain entities (Structs) | Nothing |
|
|
84
|
-
| 02 | utils.md | Shared helpers | Objects |
|
|
85
|
-
| 03 | external-cloud.md | Cloud provider adapters | Objects, Utils |
|
|
86
|
-
| 04 | external-dns.md | Cloudflare adapter | Objects, Utils |
|
|
87
|
-
| 05 | external.md | SSH, kubectl, containerd | Objects, Utils |
|
|
88
|
-
| 06 | cli.md | Thor router | Commands |
|
|
89
|
-
| 07 | cli-deploy-command.md | Deploy orchestration | External, Utils |
|
|
90
|
-
| 08 | cli-deploy-steps.md | Deploy step details | External, Utils |
|
|
91
|
-
| 09 | cli-delete-command.md | Delete orchestration | External, Utils |
|
|
92
|
-
| 10 | cli-exec-command.md | Exec command | External, Utils |
|
|
93
|
-
| 11 | cli-credentials-command.md | Credentials commands | Utils |
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Line Count Summary
|
|
98
|
-
|
|
99
|
-
### Current State (~4200 lines)
|
|
100
|
-
|
|
101
|
-
| Category | Lines |
|
|
102
|
-
| --------------------------------- | ----- |
|
|
103
|
-
| Config types + loading | ~550 |
|
|
104
|
-
| Credentials | ~330 |
|
|
105
|
-
| Providers | ~1380 |
|
|
106
|
-
| Cloudflare | ~350 |
|
|
107
|
-
| Remote (SSH, Docker, Volume) | ~430 |
|
|
108
|
-
| K8s (templates, renderer) | ~75 |
|
|
109
|
-
| Steps | ~750 |
|
|
110
|
-
| Deployer | ~580 |
|
|
111
|
-
| Service (CLI entry) | ~460 |
|
|
112
|
-
| Utils (logger, constants, errors) | ~200 |
|
|
113
|
-
| CLI | ~190 |
|
|
114
|
-
|
|
115
|
-
### Target State (~3800 lines)
|
|
116
|
-
|
|
117
|
-
| Category | Lines | Change |
|
|
118
|
-
| ---------------- | ----- | ---------------- |
|
|
119
|
-
| objects/ | ~400 | consolidated |
|
|
120
|
-
| utils/ | ~600 | merged |
|
|
121
|
-
| external/ | ~1000 | merged providers |
|
|
122
|
-
| cli/deploy/ | ~1200 | flattened |
|
|
123
|
-
| cli/delete/ | ~300 | separated |
|
|
124
|
-
| cli/exec/ | ~150 | simplified |
|
|
125
|
-
| cli/credentials/ | ~100 | simplified |
|
|
126
|
-
| cli.rb | ~50 | routing only |
|
|
127
|
-
|
|
128
|
-
**Net reduction: ~400 lines (10%)**
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## DRY Wins
|
|
133
|
-
|
|
134
|
-
1. **Hostname builder** - 3 duplications → 1 in `utils/namer.rb`
|
|
135
|
-
2. **Provider + Client merge** - 4 files → 3 files
|
|
136
|
-
3. **TunnelManager absorption** - eliminated wrapper
|
|
137
|
-
4. **Config loader + SSH key merge** - 2 files → 1 file
|
|
138
|
-
5. **Crypto + Manager merge** - 2 files → 1 file
|
|
139
|
-
6. **Templates + Binding merge** - 2 files → 1 file
|
|
140
|
-
7. **Thin wrapper removal** - `ApplicationDeployer`, `Editor` → gone
|
|
141
|
-
8. **Struct consolidation** - scattered → `objects/`
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Migration Strategy
|
|
146
|
-
|
|
147
|
-
### Phase 1: Foundation (01-02)
|
|
148
|
-
|
|
149
|
-
Create `objects/` and `utils/`. No breaking changes yet.
|
|
150
|
-
Other code keeps working, just uses new locations.
|
|
151
|
-
|
|
152
|
-
### Phase 2: External Adapters (03-05)
|
|
153
|
-
|
|
154
|
-
Move and merge providers. Update imports.
|
|
155
|
-
Still backward compatible with old namespaces via aliases if needed.
|
|
156
|
-
|
|
157
|
-
### Phase 3: Commands (07-11)
|
|
158
|
-
|
|
159
|
-
Create new command structure.
|
|
160
|
-
Old `service/*.rb` files still work during transition.
|
|
161
|
-
|
|
162
|
-
### Phase 4: Router (06)
|
|
163
|
-
|
|
164
|
-
Switch `cli.rb` to new commands.
|
|
165
|
-
Delete old files.
|
|
166
|
-
|
|
167
|
-
### Phase 5: Cleanup
|
|
168
|
-
|
|
169
|
-
- Remove empty directories
|
|
170
|
-
- Remove old requires from `lib/nvoi.rb`
|
|
171
|
-
- Update tests
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# 01 - Objects (Domain Entities)
|
|
2
|
-
|
|
3
|
-
## Priority: FIRST
|
|
4
|
-
|
|
5
|
-
Objects have no dependencies. Everything else depends on them.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Current State
|
|
10
|
-
|
|
11
|
-
Scattered across multiple files:
|
|
12
|
-
|
|
13
|
-
| Object | Current Location | Lines |
|
|
14
|
-
| ------------------------------------------------------------- | ---------------------- | ----- |
|
|
15
|
-
| `Server`, `Network`, `Firewall`, `Volume` | `providers/base.rb` | ~20 |
|
|
16
|
-
| `ServerCreateOptions`, `VolumeCreateOptions` | `providers/base.rb` | ~5 |
|
|
17
|
-
| `Tunnel`, `Zone`, `DNSRecord` | `cloudflare/client.rb` | ~10 |
|
|
18
|
-
| `TunnelInfo` | `deployer/types.rb` | ~3 |
|
|
19
|
-
| `ServiceSpec` | `config/types.rb` | ~20 |
|
|
20
|
-
| `MountOptions`, `ContainerRunOptions`, `WaitForHealthOptions` | `remote/*.rb` | ~10 |
|
|
21
|
-
| Config types (15+ classes) | `config/types.rb` | ~290 |
|
|
22
|
-
|
|
23
|
-
**Total: ~360 lines scattered across 5 files**
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Target Structure
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
lib/nvoi/objects/
|
|
31
|
-
├── server.rb # Server, ServerCreateOptions
|
|
32
|
-
├── network.rb # Network
|
|
33
|
-
├── firewall.rb # Firewall
|
|
34
|
-
├── volume.rb # Volume, VolumeCreateOptions, MountOptions
|
|
35
|
-
├── tunnel.rb # Tunnel, TunnelInfo
|
|
36
|
-
├── dns.rb # Zone, DNSRecord
|
|
37
|
-
├── service_spec.rb # ServiceSpec (K8s deployment spec)
|
|
38
|
-
└── config.rb # All config types consolidated
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## DRY Opportunities
|
|
44
|
-
|
|
45
|
-
### 1. Config Types Consolidation
|
|
46
|
-
|
|
47
|
-
Current `config/types.rb` has 15+ classes. Keep them but in `objects/config.rb`.
|
|
48
|
-
|
|
49
|
-
### 2. Struct vs Class
|
|
50
|
-
|
|
51
|
-
Many objects are simple Structs. Keep them as Structs:
|
|
52
|
-
|
|
53
|
-
```ruby
|
|
54
|
-
# objects/server.rb
|
|
55
|
-
module Nvoi
|
|
56
|
-
module Objects
|
|
57
|
-
Server = Struct.new(:id, :name, :status, :public_ipv4, keyword_init: true)
|
|
58
|
-
ServerCreateOptions = Struct.new(:name, :type, :image, :location, :user_data, :network_id, :firewall_id, keyword_init: true)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 3. TunnelInfo Duplication
|
|
64
|
-
|
|
65
|
-
`TunnelInfo` in `deployer/types.rb` is basically `Tunnel` + extra fields. Merge:
|
|
66
|
-
|
|
67
|
-
```ruby
|
|
68
|
-
# objects/tunnel.rb
|
|
69
|
-
module Nvoi
|
|
70
|
-
module Objects
|
|
71
|
-
Tunnel = Struct.new(:id, :name, :token, keyword_init: true)
|
|
72
|
-
TunnelInfo = Struct.new(:service_name, :hostname, :tunnel_id, :tunnel_token, :port, keyword_init: true)
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Migration Steps
|
|
80
|
-
|
|
81
|
-
1. Create `lib/nvoi/objects/` directory
|
|
82
|
-
2. Extract Structs from `providers/base.rb` → `objects/server.rb`, `objects/network.rb`, etc.
|
|
83
|
-
3. Extract Structs from `cloudflare/client.rb` → `objects/tunnel.rb`, `objects/dns.rb`
|
|
84
|
-
4. Move `deployer/types.rb` → `objects/tunnel.rb` (merge TunnelInfo)
|
|
85
|
-
5. Move `config/types.rb` → `objects/config.rb`
|
|
86
|
-
6. Extract `MountOptions` from `remote/volume_manager.rb` → `objects/volume.rb`
|
|
87
|
-
7. Update all requires in `lib/nvoi.rb`
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## Estimated Effort
|
|
92
|
-
|
|
93
|
-
- **Lines to move:** ~360
|
|
94
|
-
- **Files created:** 8
|
|
95
|
-
- **Files deleted:** 1 (`deployer/types.rb`)
|
|
96
|
-
- **Files modified:** 4 (remove struct definitions)
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# 02 - Utils (Shared Helpers)
|
|
2
|
-
|
|
3
|
-
## Priority: SECOND
|
|
4
|
-
|
|
5
|
-
Utils depend only on Objects. Everything else uses them.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Current State
|
|
10
|
-
|
|
11
|
-
| Utility | Current Location | Lines | Purpose |
|
|
12
|
-
| ----------------- | ------------------------ | ----- | ---------------------------------- |
|
|
13
|
-
| `ResourceNamer` | `config/naming.rb` | 197 | Generate consistent resource names |
|
|
14
|
-
| `EnvResolver` | `config/env_resolver.rb` | 64 | Merge env vars from config |
|
|
15
|
-
| `SSHKeyLoader` | `config/ssh_keys.rb` | ~80 | Load SSH keys from config |
|
|
16
|
-
| `ConfigLoader` | `config/loader.rb` | 103 | Load and parse config file |
|
|
17
|
-
| `Crypto` | `credentials/crypto.rb` | ~100 | AES encryption/decryption |
|
|
18
|
-
| `Manager` | `credentials/manager.rb` | ~150 | Credential file management |
|
|
19
|
-
| `Templates` | `k8s/templates.rb` | ~30 | ERB template loading |
|
|
20
|
-
| `TemplateBinding` | `k8s/renderer.rb` | ~20 | ERB binding helper |
|
|
21
|
-
| `Logger` | `logger.rb` | 73 | Colored console output |
|
|
22
|
-
| `Constants` | `constants.rb` | 60 | Magic numbers |
|
|
23
|
-
| `Errors` | `errors.rb` | 70 | Error class hierarchy |
|
|
24
|
-
| `Retry` | `deployer/retry.rb` | ~30 | Retry logic |
|
|
25
|
-
|
|
26
|
-
**Total: ~980 lines across 12 files**
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Target Structure
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
lib/nvoi/utils/
|
|
34
|
-
├── namer.rb # ResourceNamer
|
|
35
|
-
├── env_resolver.rb # EnvResolver
|
|
36
|
-
├── config_loader.rb # ConfigLoader + SSHKeyLoader (merge)
|
|
37
|
-
├── crypto.rb # Crypto + Manager (merge)
|
|
38
|
-
├── templates.rb # Templates + TemplateBinding
|
|
39
|
-
├── logger.rb # Logger
|
|
40
|
-
├── constants.rb # Constants
|
|
41
|
-
├── errors.rb # All error classes
|
|
42
|
-
└── retry.rb # Retry logic
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## DRY Opportunities
|
|
48
|
-
|
|
49
|
-
### 1. Merge ConfigLoader + SSHKeyLoader
|
|
50
|
-
|
|
51
|
-
Both deal with config initialization. Single file:
|
|
52
|
-
|
|
53
|
-
```ruby
|
|
54
|
-
# utils/config_loader.rb
|
|
55
|
-
module Nvoi
|
|
56
|
-
module Utils
|
|
57
|
-
class ConfigLoader
|
|
58
|
-
def load(path)
|
|
59
|
-
# decrypt, parse YAML, load SSH keys, validate
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### 2. Merge Crypto + Manager
|
|
67
|
-
|
|
68
|
-
`Manager` is just `Crypto` + file I/O. Combine:
|
|
69
|
-
|
|
70
|
-
```ruby
|
|
71
|
-
# utils/crypto.rb
|
|
72
|
-
module Nvoi
|
|
73
|
-
module Utils
|
|
74
|
-
class Crypto
|
|
75
|
-
def encrypt(plaintext) ... end
|
|
76
|
-
def decrypt(ciphertext) ... end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
class CredentialStore
|
|
80
|
-
def initialize(crypto) ... end
|
|
81
|
-
def read ... end
|
|
82
|
-
def write(content) ... end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 3. Merge Templates + TemplateBinding
|
|
89
|
-
|
|
90
|
-
Both in k8s/ but are generic ERB utilities:
|
|
91
|
-
|
|
92
|
-
```ruby
|
|
93
|
-
# utils/templates.rb
|
|
94
|
-
module Nvoi
|
|
95
|
-
module Utils
|
|
96
|
-
class TemplateRenderer
|
|
97
|
-
def render(name, data) ... end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### 4. Hostname Builder Duplication
|
|
104
|
-
|
|
105
|
-
`build_hostname(subdomain, domain)` appears in:
|
|
106
|
-
|
|
107
|
-
- `steps/tunnel_configurator.rb`
|
|
108
|
-
- `service/delete.rb`
|
|
109
|
-
- `deployer/service_deployer.rb`
|
|
110
|
-
|
|
111
|
-
Extract to namer:
|
|
112
|
-
|
|
113
|
-
```ruby
|
|
114
|
-
# utils/namer.rb
|
|
115
|
-
def hostname(subdomain, domain)
|
|
116
|
-
subdomain.nil? || subdomain.empty? || subdomain == "@" ? domain : "#{subdomain}.#{domain}"
|
|
117
|
-
end
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Migration Steps
|
|
123
|
-
|
|
124
|
-
1. Create `lib/nvoi/utils/` directory
|
|
125
|
-
2. Move `logger.rb` → `utils/logger.rb` (no changes)
|
|
126
|
-
3. Move `constants.rb` → `utils/constants.rb` (no changes)
|
|
127
|
-
4. Move `errors.rb` → `utils/errors.rb` (no changes)
|
|
128
|
-
5. Merge `config/naming.rb` → `utils/namer.rb` + add `hostname` method
|
|
129
|
-
6. Merge `config/env_resolver.rb` → `utils/env_resolver.rb`
|
|
130
|
-
7. Merge `config/loader.rb` + `config/ssh_keys.rb` → `utils/config_loader.rb`
|
|
131
|
-
8. Merge `credentials/crypto.rb` + `credentials/manager.rb` → `utils/crypto.rb`
|
|
132
|
-
9. Merge `k8s/templates.rb` + `k8s/renderer.rb` → `utils/templates.rb`
|
|
133
|
-
10. Move `deployer/retry.rb` → `utils/retry.rb`
|
|
134
|
-
11. Update all requires
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## Estimated Effort
|
|
139
|
-
|
|
140
|
-
- **Lines to consolidate:** ~980
|
|
141
|
-
- **Files created:** 9
|
|
142
|
-
- **Files deleted:** 12 (all current locations)
|
|
143
|
-
- **DRY savings:** ~50 lines (hostname duplication, merged classes)
|