hereya-cli 0.51.0 → 0.53.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.
- package/README.md +44 -42
- package/dist/backend/cloud/cloud-backend.js +7 -0
- package/dist/backend/common.d.ts +5 -0
- package/dist/backend/common.js +1 -0
- package/dist/backend/file.js +1 -0
- package/dist/commands/add/index.js +7 -0
- package/dist/commands/deploy/index.js +14 -5
- package/dist/commands/down/index.js +7 -0
- package/dist/commands/flow/add/index.js +8 -0
- package/dist/commands/flow/down/index.js +8 -0
- package/dist/commands/flow/env/index.js +8 -0
- package/dist/commands/flow/remove/index.js +8 -0
- package/dist/commands/flow/run/index.js +8 -0
- package/dist/commands/flow/up/index.js +8 -0
- package/dist/commands/import/index.js +7 -0
- package/dist/commands/remove/index.js +7 -0
- package/dist/commands/run/index.js +6 -0
- package/dist/commands/undeploy/index.js +14 -5
- package/dist/commands/up/index.js +7 -0
- package/dist/commands/workspace/create/index.d.ts +1 -0
- package/dist/commands/workspace/create/index.js +2 -0
- package/dist/commands/workspace/list/index.js +7 -3
- package/dist/commands/workspace/set-profile/index.d.ts +1 -0
- package/dist/commands/workspace/set-profile/index.js +20 -3
- package/dist/lib/workspace-validation.d.ts +17 -0
- package/dist/lib/workspace-validation.js +109 -0
- package/oclif.manifest.json +18 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g hereya-cli
|
|
|
20
20
|
$ hereya COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ hereya (--version)
|
|
23
|
-
hereya-cli/0.
|
|
23
|
+
hereya-cli/0.53.0 linux-x64 node-v22.17.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -98,7 +98,7 @@ EXAMPLES
|
|
|
98
98
|
$ hereya add cloudy/docker_postgres
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
101
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/add/index.ts)_
|
|
102
102
|
|
|
103
103
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
104
104
|
|
|
@@ -123,7 +123,7 @@ EXAMPLES
|
|
|
123
123
|
$ hereya bootstrap local
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
126
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/bootstrap/index.ts)_
|
|
127
127
|
|
|
128
128
|
## `hereya config export-backend [FILE]`
|
|
129
129
|
|
|
@@ -145,7 +145,7 @@ EXAMPLES
|
|
|
145
145
|
$ hereya config export-backend ./path/to/export.json
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
148
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/config/export-backend/index.ts)_
|
|
149
149
|
|
|
150
150
|
## `hereya config get-backend`
|
|
151
151
|
|
|
@@ -162,7 +162,7 @@ EXAMPLES
|
|
|
162
162
|
$ hereya config get-backend
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
165
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/config/get-backend/index.ts)_
|
|
166
166
|
|
|
167
167
|
## `hereya config import-backend FILE`
|
|
168
168
|
|
|
@@ -182,7 +182,7 @@ EXAMPLES
|
|
|
182
182
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
185
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/config/import-backend/index.ts)_
|
|
186
186
|
|
|
187
187
|
## `hereya config use-backend TYPE`
|
|
188
188
|
|
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
$ hereya config use-backend local
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
207
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/config/use-backend/index.ts)_
|
|
208
208
|
|
|
209
209
|
## `hereya delete-state`
|
|
210
210
|
|
|
@@ -230,7 +230,7 @@ EXAMPLES
|
|
|
230
230
|
$ hereya delete-state --workspace staging
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
233
|
+
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/delete-state/index.ts)_
|
|
234
234
|
|
|
235
235
|
## `hereya deploy`
|
|
236
236
|
|
|
@@ -255,7 +255,7 @@ EXAMPLES
|
|
|
255
255
|
$ hereya deploy
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
258
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/deploy/index.ts)_
|
|
259
259
|
|
|
260
260
|
## `hereya down`
|
|
261
261
|
|
|
@@ -282,7 +282,7 @@ EXAMPLES
|
|
|
282
282
|
$ hereya down
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
285
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/down/index.ts)_
|
|
286
286
|
|
|
287
287
|
## `hereya env [NAME]`
|
|
288
288
|
|
|
@@ -313,7 +313,7 @@ EXAMPLES
|
|
|
313
313
|
$ hereya env -w dev -l
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
316
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/env/index.ts)_
|
|
317
317
|
|
|
318
318
|
## `hereya env set [NAME]`
|
|
319
319
|
|
|
@@ -340,7 +340,7 @@ EXAMPLES
|
|
|
340
340
|
$ hereya env set FOO -v bar -w dev
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
343
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/env/set/index.ts)_
|
|
344
344
|
|
|
345
345
|
## `hereya flow add PACKAGE`
|
|
346
346
|
|
|
@@ -378,7 +378,7 @@ EXAMPLES
|
|
|
378
378
|
$ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
|
|
379
379
|
```
|
|
380
380
|
|
|
381
|
-
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
381
|
+
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/flow/add/index.ts)_
|
|
382
382
|
|
|
383
383
|
## `hereya flow down`
|
|
384
384
|
|
|
@@ -412,7 +412,7 @@ EXAMPLES
|
|
|
412
412
|
$ hereya flow down --pin
|
|
413
413
|
```
|
|
414
414
|
|
|
415
|
-
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
415
|
+
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/flow/down/index.ts)_
|
|
416
416
|
|
|
417
417
|
## `hereya flow env [NAME]`
|
|
418
418
|
|
|
@@ -446,7 +446,7 @@ EXAMPLES
|
|
|
446
446
|
$ hereya flow env -l
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
-
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
449
|
+
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/flow/env/index.ts)_
|
|
450
450
|
|
|
451
451
|
## `hereya flow remove PACKAGE`
|
|
452
452
|
|
|
@@ -476,7 +476,7 @@ EXAMPLES
|
|
|
476
476
|
$ hereya flow remove cloudy/docker_postgres --profile staging
|
|
477
477
|
```
|
|
478
478
|
|
|
479
|
-
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
479
|
+
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/flow/remove/index.ts)_
|
|
480
480
|
|
|
481
481
|
## `hereya flow run CMD`
|
|
482
482
|
|
|
@@ -505,7 +505,7 @@ EXAMPLES
|
|
|
505
505
|
$ hereya flow run --pin -- npm test
|
|
506
506
|
```
|
|
507
507
|
|
|
508
|
-
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
508
|
+
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/flow/run/index.ts)_
|
|
509
509
|
|
|
510
510
|
## `hereya flow up`
|
|
511
511
|
|
|
@@ -539,7 +539,7 @@ EXAMPLES
|
|
|
539
539
|
$ hereya flow up --pin
|
|
540
540
|
```
|
|
541
541
|
|
|
542
|
-
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
542
|
+
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/flow/up/index.ts)_
|
|
543
543
|
|
|
544
544
|
## `hereya help [COMMAND]`
|
|
545
545
|
|
|
@@ -596,7 +596,7 @@ EXAMPLES
|
|
|
596
596
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
597
597
|
```
|
|
598
598
|
|
|
599
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
599
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/import/index.ts)_
|
|
600
600
|
|
|
601
601
|
## `hereya init PROJECT`
|
|
602
602
|
|
|
@@ -622,7 +622,7 @@ EXAMPLES
|
|
|
622
622
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
623
623
|
```
|
|
624
624
|
|
|
625
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
625
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/init/index.ts)_
|
|
626
626
|
|
|
627
627
|
## `hereya login [URL]`
|
|
628
628
|
|
|
@@ -651,7 +651,7 @@ EXAMPLES
|
|
|
651
651
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
652
652
|
```
|
|
653
653
|
|
|
654
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
654
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/login/index.ts)_
|
|
655
655
|
|
|
656
656
|
## `hereya logout`
|
|
657
657
|
|
|
@@ -668,7 +668,7 @@ EXAMPLES
|
|
|
668
668
|
$ hereya logout
|
|
669
669
|
```
|
|
670
670
|
|
|
671
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
671
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/logout/index.ts)_
|
|
672
672
|
|
|
673
673
|
## `hereya remove PACKAGE`
|
|
674
674
|
|
|
@@ -696,7 +696,7 @@ EXAMPLES
|
|
|
696
696
|
$ hereya remove cloudy/docker_postgres
|
|
697
697
|
```
|
|
698
698
|
|
|
699
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
699
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/remove/index.ts)_
|
|
700
700
|
|
|
701
701
|
## `hereya run CMD`
|
|
702
702
|
|
|
@@ -722,7 +722,7 @@ EXAMPLES
|
|
|
722
722
|
$ hereya run -w uat -- node index.js
|
|
723
723
|
```
|
|
724
724
|
|
|
725
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
725
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/run/index.ts)_
|
|
726
726
|
|
|
727
727
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
728
728
|
|
|
@@ -747,7 +747,7 @@ EXAMPLES
|
|
|
747
747
|
$ hereya unbootstrap local
|
|
748
748
|
```
|
|
749
749
|
|
|
750
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
750
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/unbootstrap/index.ts)_
|
|
751
751
|
|
|
752
752
|
## `hereya undeploy`
|
|
753
753
|
|
|
@@ -772,7 +772,7 @@ EXAMPLES
|
|
|
772
772
|
$ hereya undeploy
|
|
773
773
|
```
|
|
774
774
|
|
|
775
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
775
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/undeploy/index.ts)_
|
|
776
776
|
|
|
777
777
|
## `hereya up`
|
|
778
778
|
|
|
@@ -799,7 +799,7 @@ EXAMPLES
|
|
|
799
799
|
$ hereya up
|
|
800
800
|
```
|
|
801
801
|
|
|
802
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
802
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/up/index.ts)_
|
|
803
803
|
|
|
804
804
|
## `hereya workspace create NAME`
|
|
805
805
|
|
|
@@ -807,14 +807,15 @@ Create a new workspace if it does not exist.
|
|
|
807
807
|
|
|
808
808
|
```
|
|
809
809
|
USAGE
|
|
810
|
-
$ hereya workspace create NAME [--mirror <value>] [--profile <value>]
|
|
810
|
+
$ hereya workspace create NAME [-d] [--mirror <value>] [--profile <value>]
|
|
811
811
|
|
|
812
812
|
ARGUMENTS
|
|
813
813
|
NAME name of the workspace to create
|
|
814
814
|
|
|
815
815
|
FLAGS
|
|
816
|
-
--
|
|
817
|
-
|
|
816
|
+
-d, --deployment mark workspace as a deployment workspace
|
|
817
|
+
--mirror=<value> workspace to mirror
|
|
818
|
+
--profile=<value> workspace profile to set (cloud backend only)
|
|
818
819
|
|
|
819
820
|
DESCRIPTION
|
|
820
821
|
Create a new workspace if it does not exist.
|
|
@@ -823,7 +824,7 @@ EXAMPLES
|
|
|
823
824
|
$ hereya workspace create dev
|
|
824
825
|
```
|
|
825
826
|
|
|
826
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
827
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/create/index.ts)_
|
|
827
828
|
|
|
828
829
|
## `hereya workspace delete NAME`
|
|
829
830
|
|
|
@@ -843,7 +844,7 @@ EXAMPLES
|
|
|
843
844
|
$ hereya workspace delete dev
|
|
844
845
|
```
|
|
845
846
|
|
|
846
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
847
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/delete/index.ts)_
|
|
847
848
|
|
|
848
849
|
## `hereya workspace env [NAME]`
|
|
849
850
|
|
|
@@ -869,7 +870,7 @@ EXAMPLES
|
|
|
869
870
|
$ hereya workspace env myEnv -w dev
|
|
870
871
|
```
|
|
871
872
|
|
|
872
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
873
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/env/index.ts)_
|
|
873
874
|
|
|
874
875
|
## `hereya workspace env set`
|
|
875
876
|
|
|
@@ -893,7 +894,7 @@ EXAMPLES
|
|
|
893
894
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
894
895
|
```
|
|
895
896
|
|
|
896
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
897
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/env/set/index.ts)_
|
|
897
898
|
|
|
898
899
|
## `hereya workspace env unset`
|
|
899
900
|
|
|
@@ -914,7 +915,7 @@ EXAMPLES
|
|
|
914
915
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
915
916
|
```
|
|
916
917
|
|
|
917
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
918
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/env/unset/index.ts)_
|
|
918
919
|
|
|
919
920
|
## `hereya workspace install PACKAGE`
|
|
920
921
|
|
|
@@ -941,7 +942,7 @@ EXAMPLES
|
|
|
941
942
|
$ hereya workspace install hereya/aws-cognito
|
|
942
943
|
```
|
|
943
944
|
|
|
944
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
945
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/install/index.ts)_
|
|
945
946
|
|
|
946
947
|
## `hereya workspace list`
|
|
947
948
|
|
|
@@ -958,30 +959,31 @@ EXAMPLES
|
|
|
958
959
|
$ hereya workspace list
|
|
959
960
|
```
|
|
960
961
|
|
|
961
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
962
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/list/index.ts)_
|
|
962
963
|
|
|
963
964
|
## `hereya workspace set-profile PROFILE`
|
|
964
965
|
|
|
965
|
-
Set AWS profile for a workspace (cloud backend only).
|
|
966
|
+
Set AWS profile and deployment status for a workspace (cloud backend only).
|
|
966
967
|
|
|
967
968
|
```
|
|
968
969
|
USAGE
|
|
969
|
-
$ hereya workspace set-profile PROFILE -w <value>
|
|
970
|
+
$ hereya workspace set-profile PROFILE -w <value> [-d]
|
|
970
971
|
|
|
971
972
|
ARGUMENTS
|
|
972
973
|
PROFILE AWS profile name to set for the workspace
|
|
973
974
|
|
|
974
975
|
FLAGS
|
|
976
|
+
-d, --[no-]deployment mark workspace as a deployment workspace (use --no-deployment to unset)
|
|
975
977
|
-w, --workspace=<value> (required) workspace name
|
|
976
978
|
|
|
977
979
|
DESCRIPTION
|
|
978
|
-
Set AWS profile for a workspace (cloud backend only).
|
|
980
|
+
Set AWS profile and deployment status for a workspace (cloud backend only).
|
|
979
981
|
|
|
980
982
|
EXAMPLES
|
|
981
983
|
$ hereya workspace set-profile prod-profile -w production
|
|
982
984
|
```
|
|
983
985
|
|
|
984
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
986
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/set-profile/index.ts)_
|
|
985
987
|
|
|
986
988
|
## `hereya workspace uninstall PACKAGE`
|
|
987
989
|
|
|
@@ -1008,5 +1010,5 @@ EXAMPLES
|
|
|
1008
1010
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
1009
1011
|
```
|
|
1010
1012
|
|
|
1011
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1013
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.53.0/src/commands/workspace/uninstall/index.ts)_
|
|
1012
1014
|
<!-- commandsstop -->
|
|
@@ -40,6 +40,9 @@ export class CloudBackend {
|
|
|
40
40
|
if (input.profile) {
|
|
41
41
|
formData.append('profile', input.profile);
|
|
42
42
|
}
|
|
43
|
+
if (input.isDeploy !== undefined) {
|
|
44
|
+
formData.append('isDeploy', String(input.isDeploy));
|
|
45
|
+
}
|
|
43
46
|
const response = await fetch(`${this.config.url}/api/workspaces`, {
|
|
44
47
|
body: formData,
|
|
45
48
|
headers: {
|
|
@@ -377,6 +380,9 @@ export class CloudBackend {
|
|
|
377
380
|
if (input.profile !== undefined) {
|
|
378
381
|
formData.append('profile', input.profile === null ? '' : input.profile);
|
|
379
382
|
}
|
|
383
|
+
if (input.isDeploy !== undefined) {
|
|
384
|
+
formData.append('isDeploy', input.isDeploy === null ? '' : String(input.isDeploy));
|
|
385
|
+
}
|
|
380
386
|
const response = await fetch(`${this.config.url}/api/workspaces/${encodeURIComponent(input.name)}`, {
|
|
381
387
|
body: formData,
|
|
382
388
|
headers: {
|
|
@@ -424,6 +430,7 @@ export class CloudBackend {
|
|
|
424
430
|
return {
|
|
425
431
|
env,
|
|
426
432
|
id: workspace.id,
|
|
433
|
+
isDeploy: workspace.isDeploy,
|
|
427
434
|
mirrorOf: workspace.mirrorOf?.name,
|
|
428
435
|
name: workspace.name,
|
|
429
436
|
packages,
|
package/dist/backend/common.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface Backend {
|
|
|
23
23
|
export declare const WorkspaceSchema: z.ZodObject<{
|
|
24
24
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
25
25
|
id: z.ZodString;
|
|
26
|
+
isDeploy: z.ZodOptional<z.ZodBoolean>;
|
|
26
27
|
mirrorOf: z.ZodOptional<z.ZodString>;
|
|
27
28
|
name: z.ZodString;
|
|
28
29
|
packages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -44,6 +45,7 @@ export declare const WorkspaceSchema: z.ZodObject<{
|
|
|
44
45
|
version: string;
|
|
45
46
|
parameters?: Record<string, any> | undefined;
|
|
46
47
|
}> | undefined;
|
|
48
|
+
isDeploy?: boolean | undefined;
|
|
47
49
|
mirrorOf?: string | undefined;
|
|
48
50
|
profile?: string | undefined;
|
|
49
51
|
}, {
|
|
@@ -54,6 +56,7 @@ export declare const WorkspaceSchema: z.ZodObject<{
|
|
|
54
56
|
version: string;
|
|
55
57
|
parameters?: Record<string, any> | undefined;
|
|
56
58
|
}> | undefined;
|
|
59
|
+
isDeploy?: boolean | undefined;
|
|
57
60
|
mirrorOf?: string | undefined;
|
|
58
61
|
profile?: string | undefined;
|
|
59
62
|
}>;
|
|
@@ -93,6 +96,7 @@ export interface InitProjectOutput {
|
|
|
93
96
|
};
|
|
94
97
|
}
|
|
95
98
|
export interface CreateWorkspaceInput {
|
|
99
|
+
isDeploy?: boolean;
|
|
96
100
|
mirrorOf?: string;
|
|
97
101
|
name: string;
|
|
98
102
|
profile?: string;
|
|
@@ -212,6 +216,7 @@ export type UnsetEnvVarInput = {
|
|
|
212
216
|
};
|
|
213
217
|
export type UnsetEnvVarOutput = SetEnvVarOutput;
|
|
214
218
|
export type UpdateWorkspaceInput = {
|
|
219
|
+
isDeploy?: boolean | null;
|
|
215
220
|
name: string;
|
|
216
221
|
profile?: null | string;
|
|
217
222
|
};
|
package/dist/backend/common.js
CHANGED
package/dist/backend/file.js
CHANGED
|
@@ -10,6 +10,7 @@ import { arrayOfStringToObject } from '../../lib/object-utils.js';
|
|
|
10
10
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
11
11
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
12
12
|
import { delay } from '../../lib/shell.js';
|
|
13
|
+
import { validateDevelopmentWorkspace } from '../../lib/workspace-validation.js';
|
|
13
14
|
export default class Add extends Command {
|
|
14
15
|
static args = {
|
|
15
16
|
package: Args.string({
|
|
@@ -73,6 +74,12 @@ export default class Add extends Command {
|
|
|
73
74
|
ctx.configOutput = loadConfigOutput;
|
|
74
75
|
// Use workspace from flag if provided, otherwise use config workspace
|
|
75
76
|
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
77
|
+
// Validate that the workspace is a development workspace
|
|
78
|
+
const backend = await getBackend();
|
|
79
|
+
const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'add', loadConfigOutput.config.project);
|
|
80
|
+
if (!validation.isValid) {
|
|
81
|
+
throw new Error(validation.message);
|
|
82
|
+
}
|
|
76
83
|
task.output = `Loaded project config`;
|
|
77
84
|
await delay(500);
|
|
78
85
|
},
|
|
@@ -9,6 +9,7 @@ import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
|
9
9
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
10
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
11
11
|
import { delay } from '../../lib/shell.js';
|
|
12
|
+
import { validateDeploymentWorkspace } from '../../lib/workspace-validation.js';
|
|
12
13
|
export default class Deploy extends Command {
|
|
13
14
|
static description = 'Deploy a hereya project using the project deployment package';
|
|
14
15
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -35,15 +36,23 @@ export default class Deploy extends Command {
|
|
|
35
36
|
const { flags } = await this.parse(Deploy);
|
|
36
37
|
setDebug(flags.debug);
|
|
37
38
|
const projectRootDir = path.resolve(flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR || process.cwd());
|
|
39
|
+
// Load config first to get project name
|
|
40
|
+
const configManager = getConfigManager();
|
|
41
|
+
const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
|
|
42
|
+
if (!loadConfigOutput.found) {
|
|
43
|
+
this.error("Project not initialized. Run 'hereya init' first.");
|
|
44
|
+
}
|
|
45
|
+
// Validate that the workspace is a deployment workspace
|
|
46
|
+
const backend = await getBackend();
|
|
47
|
+
const validation = await validateDeploymentWorkspace(flags.workspace, backend, 'deploy', loadConfigOutput.config.project);
|
|
48
|
+
if (!validation.isValid) {
|
|
49
|
+
this.error(validation.message);
|
|
50
|
+
}
|
|
38
51
|
const myLogger = new ListrLogger({ useIcons: false });
|
|
39
52
|
const task = new Listr([
|
|
40
53
|
{
|
|
41
54
|
async task(ctx) {
|
|
42
|
-
|
|
43
|
-
const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
|
|
44
|
-
if (!loadConfigOutput.found) {
|
|
45
|
-
throw new Error("Project not initialized. Run 'hereya init' first.");
|
|
46
|
-
}
|
|
55
|
+
// Config already loaded above for validation
|
|
47
56
|
ctx.configOutput = loadConfigOutput;
|
|
48
57
|
ctx.deployPackages = Object.keys(loadConfigOutput.config.deploy ?? {});
|
|
49
58
|
ctx.packages = Object.keys(loadConfigOutput.config.packages ?? {});
|
|
@@ -8,6 +8,7 @@ import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
|
8
8
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
9
9
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
10
10
|
import { delay } from '../../lib/shell.js';
|
|
11
|
+
import { validateDevelopmentWorkspace } from '../../lib/workspace-validation.js';
|
|
11
12
|
export default class Down extends Command {
|
|
12
13
|
static description = 'Destroy all packages in the project.';
|
|
13
14
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -58,6 +59,12 @@ export default class Down extends Command {
|
|
|
58
59
|
}
|
|
59
60
|
ctx.configOutput = loadConfigOutput;
|
|
60
61
|
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
62
|
+
// Validate that the workspace is a development workspace
|
|
63
|
+
const backend = await getBackend();
|
|
64
|
+
const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'down', loadConfigOutput.config.project);
|
|
65
|
+
if (!validation.isValid) {
|
|
66
|
+
throw new Error(validation.message);
|
|
67
|
+
}
|
|
61
68
|
await delay(500);
|
|
62
69
|
},
|
|
63
70
|
title: 'Loading project config',
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getBackend } from '../../../backend/index.js';
|
|
2
3
|
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
4
|
import { buildFlowWorkspaceName } from '../../../lib/flow-utils.js';
|
|
4
5
|
import { setDebug } from '../../../lib/log.js';
|
|
6
|
+
import { validateFlowCommand } from '../../../lib/workspace-validation.js';
|
|
5
7
|
import Add from '../../add/index.js';
|
|
6
8
|
import WorkspaceCreate from '../../workspace/create/index.js';
|
|
7
9
|
export default class FlowAdd extends Command {
|
|
@@ -62,6 +64,12 @@ export default class FlowAdd extends Command {
|
|
|
62
64
|
project: loadConfigOutput.config.project,
|
|
63
65
|
projectRootDir,
|
|
64
66
|
});
|
|
67
|
+
// Validate that if workspace exists, it's not a deployment workspace
|
|
68
|
+
const backend = await getBackend();
|
|
69
|
+
const validation = await validateFlowCommand(workspaceName, backend);
|
|
70
|
+
if (!validation.isValid) {
|
|
71
|
+
this.error(validation.message);
|
|
72
|
+
}
|
|
65
73
|
// Import workspace resolution utility
|
|
66
74
|
const { resolveWorkspaceName } = await import('../../../lib/workspace-utils.js');
|
|
67
75
|
// Resolve mirror workspace name with org prefix
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getBackend } from '../../../backend/index.js';
|
|
2
3
|
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
4
|
import { buildFlowWorkspaceName } from '../../../lib/flow-utils.js';
|
|
4
5
|
import { setDebug } from '../../../lib/log.js';
|
|
6
|
+
import { validateFlowCommand } from '../../../lib/workspace-validation.js';
|
|
5
7
|
import DeleteState from '../../delete-state/index.js';
|
|
6
8
|
import Down from '../../down/index.js';
|
|
7
9
|
import WorkspaceCreate from '../../workspace/create/index.js';
|
|
@@ -63,6 +65,12 @@ export default class FlowDown extends Command {
|
|
|
63
65
|
project: loadConfigOutput.config.project,
|
|
64
66
|
projectRootDir,
|
|
65
67
|
});
|
|
68
|
+
// Validate that if workspace exists, it's not a deployment workspace
|
|
69
|
+
const backend = await getBackend();
|
|
70
|
+
const validation = await validateFlowCommand(workspaceName, backend);
|
|
71
|
+
if (!validation.isValid) {
|
|
72
|
+
this.error(validation.message);
|
|
73
|
+
}
|
|
66
74
|
// Import workspace resolution utility
|
|
67
75
|
const { resolveWorkspaceName } = await import('../../../lib/workspace-utils.js');
|
|
68
76
|
// Resolve mirror workspace name with org prefix
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getBackend } from '../../../backend/index.js';
|
|
2
3
|
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
4
|
import { buildFlowWorkspaceName } from '../../../lib/flow-utils.js';
|
|
5
|
+
import { validateFlowCommand } from '../../../lib/workspace-validation.js';
|
|
4
6
|
import Env from '../../env/index.js';
|
|
5
7
|
export default class FlowEnv extends Command {
|
|
6
8
|
static args = {
|
|
@@ -49,6 +51,12 @@ export default class FlowEnv extends Command {
|
|
|
49
51
|
project: loadConfigOutput.config.project,
|
|
50
52
|
projectRootDir,
|
|
51
53
|
});
|
|
54
|
+
// Validate that if workspace exists, it's not a deployment workspace
|
|
55
|
+
const backend = await getBackend();
|
|
56
|
+
const validation = await validateFlowCommand(workspaceName, backend);
|
|
57
|
+
if (!validation.isValid) {
|
|
58
|
+
this.error(validation.message);
|
|
59
|
+
}
|
|
52
60
|
// Build args for env command
|
|
53
61
|
const envArgs = ['--workspace', workspaceName];
|
|
54
62
|
// Pass through all flags
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getBackend } from '../../../backend/index.js';
|
|
2
3
|
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
4
|
import { buildFlowWorkspaceName } from '../../../lib/flow-utils.js';
|
|
4
5
|
import { setDebug } from '../../../lib/log.js';
|
|
6
|
+
import { validateFlowCommand } from '../../../lib/workspace-validation.js';
|
|
5
7
|
import Remove from '../../remove/index.js';
|
|
6
8
|
import WorkspaceCreate from '../../workspace/create/index.js';
|
|
7
9
|
export default class FlowRemove extends Command {
|
|
@@ -51,6 +53,12 @@ export default class FlowRemove extends Command {
|
|
|
51
53
|
project: loadConfigOutput.config.project,
|
|
52
54
|
projectRootDir,
|
|
53
55
|
});
|
|
56
|
+
// Validate that if workspace exists, it's not a deployment workspace
|
|
57
|
+
const backend = await getBackend();
|
|
58
|
+
const validation = await validateFlowCommand(workspaceName, backend);
|
|
59
|
+
if (!validation.isValid) {
|
|
60
|
+
this.error(validation.message);
|
|
61
|
+
}
|
|
54
62
|
// Import workspace resolution utility
|
|
55
63
|
const { resolveWorkspaceName } = await import('../../../lib/workspace-utils.js');
|
|
56
64
|
// Resolve mirror workspace name with org prefix
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getBackend } from '../../../backend/index.js';
|
|
2
3
|
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
4
|
import { buildFlowWorkspaceName } from '../../../lib/flow-utils.js';
|
|
5
|
+
import { validateFlowCommand } from '../../../lib/workspace-validation.js';
|
|
4
6
|
import Run from '../../run/index.js';
|
|
5
7
|
export default class FlowRun extends Command {
|
|
6
8
|
static args = {
|
|
@@ -43,6 +45,12 @@ export default class FlowRun extends Command {
|
|
|
43
45
|
project: loadConfigOutput.config.project,
|
|
44
46
|
projectRootDir,
|
|
45
47
|
});
|
|
48
|
+
// Validate that if workspace exists, it's not a deployment workspace
|
|
49
|
+
const backend = await getBackend();
|
|
50
|
+
const validation = await validateFlowCommand(workspaceName, backend);
|
|
51
|
+
if (!validation.isValid) {
|
|
52
|
+
this.error(validation.message);
|
|
53
|
+
}
|
|
46
54
|
// Build args for run command
|
|
47
55
|
const runArgs = ['--workspace', workspaceName];
|
|
48
56
|
// Pass through chdir flag
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getBackend } from '../../../backend/index.js';
|
|
2
3
|
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
4
|
import { buildFlowWorkspaceName } from '../../../lib/flow-utils.js';
|
|
4
5
|
import { setDebug } from '../../../lib/log.js';
|
|
6
|
+
import { validateFlowCommand } from '../../../lib/workspace-validation.js';
|
|
5
7
|
import Up from '../../up/index.js';
|
|
6
8
|
import WorkspaceCreate from '../../workspace/create/index.js';
|
|
7
9
|
export default class FlowUp extends Command {
|
|
@@ -61,6 +63,12 @@ export default class FlowUp extends Command {
|
|
|
61
63
|
project: loadConfigOutput.config.project,
|
|
62
64
|
projectRootDir,
|
|
63
65
|
});
|
|
66
|
+
// Validate that if workspace exists, it's not a deployment workspace
|
|
67
|
+
const backend = await getBackend();
|
|
68
|
+
const validation = await validateFlowCommand(workspaceName, backend);
|
|
69
|
+
if (!validation.isValid) {
|
|
70
|
+
this.error(validation.message);
|
|
71
|
+
}
|
|
64
72
|
// Import workspace resolution utility
|
|
65
73
|
const { resolveWorkspaceName } = await import('../../../lib/workspace-utils.js');
|
|
66
74
|
// Resolve mirror workspace name with org prefix
|
|
@@ -9,6 +9,7 @@ import { arrayOfStringToObject } from '../../lib/object-utils.js';
|
|
|
9
9
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
10
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
11
11
|
import { delay } from '../../lib/shell.js';
|
|
12
|
+
import { validateDevelopmentWorkspace } from '../../lib/workspace-validation.js';
|
|
12
13
|
export default class Import extends Command {
|
|
13
14
|
static args = {
|
|
14
15
|
package: Args.string({
|
|
@@ -80,6 +81,12 @@ export default class Import extends Command {
|
|
|
80
81
|
}
|
|
81
82
|
ctx.configOutput = loadConfigOutput;
|
|
82
83
|
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
84
|
+
// Validate that the workspace is a development workspace
|
|
85
|
+
const backend = await getBackend();
|
|
86
|
+
const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'import', loadConfigOutput.config.project);
|
|
87
|
+
if (!validation.isValid) {
|
|
88
|
+
throw new Error(validation.message);
|
|
89
|
+
}
|
|
83
90
|
task.output = `Loaded project config`;
|
|
84
91
|
await delay(500);
|
|
85
92
|
},
|
|
@@ -8,6 +8,7 @@ import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
|
8
8
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
9
9
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
10
10
|
import { delay } from '../../lib/shell.js';
|
|
11
|
+
import { validateDevelopmentWorkspace } from '../../lib/workspace-validation.js';
|
|
11
12
|
export default class Remove extends Command {
|
|
12
13
|
static args = {
|
|
13
14
|
package: Args.string({
|
|
@@ -60,6 +61,12 @@ export default class Remove extends Command {
|
|
|
60
61
|
ctx.configOutput = loadConfigOutput;
|
|
61
62
|
// Use workspace from flag if provided, otherwise use config workspace
|
|
62
63
|
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
64
|
+
// Validate that the workspace is a development workspace
|
|
65
|
+
const backend = await getBackend();
|
|
66
|
+
const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'remove', loadConfigOutput.config.project);
|
|
67
|
+
if (!validation.isValid) {
|
|
68
|
+
throw new Error(validation.message);
|
|
69
|
+
}
|
|
63
70
|
const { config } = loadConfigOutput;
|
|
64
71
|
if (!(ctx.package in (config.packages ?? {})) && !(ctx.package in (config.deploy ?? {}))) {
|
|
65
72
|
throw new Error(`Package ${ctx.package} not found in the project.`);
|
|
@@ -4,6 +4,7 @@ import { getConfigManager } from '../../lib/config/index.js';
|
|
|
4
4
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
5
5
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
6
6
|
import { runShell } from '../../lib/shell.js';
|
|
7
|
+
import { validateDevelopmentWorkspace } from '../../lib/workspace-validation.js';
|
|
7
8
|
export default class Run extends Command {
|
|
8
9
|
static args = {
|
|
9
10
|
cmd: Args.string({ description: 'command to run', required: true }),
|
|
@@ -43,6 +44,11 @@ export default class Run extends Command {
|
|
|
43
44
|
this.error('you must specify a workspace to run the command in');
|
|
44
45
|
}
|
|
45
46
|
const backend = await getBackend();
|
|
47
|
+
// Validate that the workspace is a development workspace
|
|
48
|
+
const validation = await validateDevelopmentWorkspace(workspace, backend, 'run', config.project);
|
|
49
|
+
if (!validation.isValid) {
|
|
50
|
+
this.error(validation.message);
|
|
51
|
+
}
|
|
46
52
|
const profile = await getProfileFromWorkspace(backend, workspace, config.project);
|
|
47
53
|
const envManager = getEnvManager();
|
|
48
54
|
const getProjectEnvOutput = await envManager.getProjectEnv({
|
|
@@ -9,6 +9,7 @@ import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
|
9
9
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
10
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
11
11
|
import { delay } from '../../lib/shell.js';
|
|
12
|
+
import { validateDeploymentWorkspace } from '../../lib/workspace-validation.js';
|
|
12
13
|
export default class Undeploy extends Command {
|
|
13
14
|
static description = 'Undeploy a hereya project by removing all resources.';
|
|
14
15
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -35,6 +36,18 @@ export default class Undeploy extends Command {
|
|
|
35
36
|
const { flags } = await this.parse(Undeploy);
|
|
36
37
|
setDebug(flags.debug);
|
|
37
38
|
const projectRootDir = path.resolve(flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR || process.cwd());
|
|
39
|
+
// Load config first to get project name
|
|
40
|
+
const configManager = getConfigManager();
|
|
41
|
+
const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
|
|
42
|
+
if (!loadConfigOutput.found) {
|
|
43
|
+
this.error("Project not initialized. Run 'hereya init' first.");
|
|
44
|
+
}
|
|
45
|
+
// Validate that the workspace is a deployment workspace
|
|
46
|
+
const backend = await getBackend();
|
|
47
|
+
const validation = await validateDeploymentWorkspace(flags.workspace, backend, 'undeploy', loadConfigOutput.config.project);
|
|
48
|
+
if (!validation.isValid) {
|
|
49
|
+
this.error(validation.message);
|
|
50
|
+
}
|
|
38
51
|
const myLogger = new ListrLogger({ useIcons: false });
|
|
39
52
|
const task = new Listr([
|
|
40
53
|
{
|
|
@@ -42,11 +55,7 @@ export default class Undeploy extends Command {
|
|
|
42
55
|
return task.newListr([
|
|
43
56
|
{
|
|
44
57
|
async task(ctx) {
|
|
45
|
-
|
|
46
|
-
const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
|
|
47
|
-
if (!loadConfigOutput.found) {
|
|
48
|
-
throw new Error("Project not initialized. Run 'hereya init' first.");
|
|
49
|
-
}
|
|
58
|
+
// Config already loaded above for validation
|
|
50
59
|
ctx.configOutput = loadConfigOutput;
|
|
51
60
|
ctx.workspace = flags.workspace;
|
|
52
61
|
await delay(500);
|
|
@@ -8,6 +8,7 @@ import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
|
8
8
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
9
9
|
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
10
10
|
import { delay } from '../../lib/shell.js';
|
|
11
|
+
import { validateDevelopmentWorkspace } from '../../lib/workspace-validation.js';
|
|
11
12
|
export default class Up extends Command {
|
|
12
13
|
static description = 'Provision all packages in the project.';
|
|
13
14
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -58,6 +59,12 @@ export default class Up extends Command {
|
|
|
58
59
|
}
|
|
59
60
|
ctx.configOutput = loadConfigOutput;
|
|
60
61
|
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
62
|
+
// Validate that the workspace is a development workspace
|
|
63
|
+
const backend = await getBackend();
|
|
64
|
+
const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'up', loadConfigOutput.config.project);
|
|
65
|
+
if (!validation.isValid) {
|
|
66
|
+
throw new Error(validation.message);
|
|
67
|
+
}
|
|
61
68
|
await delay(500);
|
|
62
69
|
},
|
|
63
70
|
title: 'Loading project config',
|
|
@@ -6,6 +6,7 @@ export default class WorkspaceCreate extends Command {
|
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
+
deployment: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
mirror: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
@@ -7,6 +7,7 @@ export default class WorkspaceCreate extends Command {
|
|
|
7
7
|
static description = 'Create a new workspace if it does not exist.';
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %> dev'];
|
|
9
9
|
static flags = {
|
|
10
|
+
deployment: Flags.boolean({ char: 'd', description: 'mark workspace as a deployment workspace', required: false }),
|
|
10
11
|
mirror: Flags.string({ description: 'workspace to mirror', required: false }),
|
|
11
12
|
profile: Flags.string({ description: 'workspace profile to set (cloud backend only)', required: false }),
|
|
12
13
|
};
|
|
@@ -14,6 +15,7 @@ export default class WorkspaceCreate extends Command {
|
|
|
14
15
|
const { args, flags } = await this.parse(WorkspaceCreate);
|
|
15
16
|
const backend = await getBackend();
|
|
16
17
|
const createWorkspaceOutput = await backend.createWorkspace({
|
|
18
|
+
isDeploy: flags.deployment,
|
|
17
19
|
mirrorOf: flags.mirror,
|
|
18
20
|
name: args.name,
|
|
19
21
|
profile: flags.profile,
|
|
@@ -19,12 +19,14 @@ export default class WorkspaceList extends Command {
|
|
|
19
19
|
const result = await backend.getWorkspace(name);
|
|
20
20
|
if (result.found && !result.hasError) {
|
|
21
21
|
return {
|
|
22
|
+
deployment: result.workspace.isDeploy ? 'Yes' : 'No',
|
|
22
23
|
mirrorOf: result.workspace.mirrorOf || '-',
|
|
23
24
|
name,
|
|
24
25
|
profile: result.workspace.profile || '-',
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
return {
|
|
29
|
+
deployment: 'No',
|
|
28
30
|
mirrorOf: '-',
|
|
29
31
|
name,
|
|
30
32
|
profile: '-',
|
|
@@ -32,6 +34,7 @@ export default class WorkspaceList extends Command {
|
|
|
32
34
|
}
|
|
33
35
|
catch {
|
|
34
36
|
return {
|
|
37
|
+
deployment: 'No',
|
|
35
38
|
mirrorOf: '-',
|
|
36
39
|
name,
|
|
37
40
|
profile: '-',
|
|
@@ -41,13 +44,14 @@ export default class WorkspaceList extends Command {
|
|
|
41
44
|
// Calculate column widths for alignment
|
|
42
45
|
const nameWidth = Math.max(4, ...workspaceDetails.map(w => w.name.length)); // min 4 for "Name"
|
|
43
46
|
const profileWidth = Math.max(7, ...workspaceDetails.map(w => w.profile.length)); // min 7 for "Profile"
|
|
47
|
+
const deploymentWidth = Math.max(10, ...workspaceDetails.map(w => w.deployment.length)); // min 10 for "Deployment"
|
|
44
48
|
const mirrorWidth = Math.max(9, ...workspaceDetails.map(w => w.mirrorOf.length)); // min 9 for "Mirror Of"
|
|
45
49
|
// Display header
|
|
46
|
-
this.log(`${'Name'.padEnd(nameWidth)} ${'Profile'.padEnd(profileWidth)} ${'Mirror Of'.padEnd(mirrorWidth)}`);
|
|
47
|
-
this.log('-'.repeat(nameWidth + profileWidth + mirrorWidth +
|
|
50
|
+
this.log(`${'Name'.padEnd(nameWidth)} ${'Profile'.padEnd(profileWidth)} ${'Deployment'.padEnd(deploymentWidth)} ${'Mirror Of'.padEnd(mirrorWidth)}`);
|
|
51
|
+
this.log('-'.repeat(nameWidth + profileWidth + deploymentWidth + mirrorWidth + 6));
|
|
48
52
|
// Display rows
|
|
49
53
|
for (const workspace of workspaceDetails) {
|
|
50
|
-
this.log(`${workspace.name.padEnd(nameWidth)} ${workspace.profile.padEnd(profileWidth)} ${workspace.mirrorOf.padEnd(mirrorWidth)}`);
|
|
54
|
+
this.log(`${workspace.name.padEnd(nameWidth)} ${workspace.profile.padEnd(profileWidth)} ${workspace.deployment.padEnd(deploymentWidth)} ${workspace.mirrorOf.padEnd(mirrorWidth)}`);
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
catch (error) {
|
|
@@ -6,6 +6,7 @@ export default class WorkspaceSetProfile extends Command {
|
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
+
deployment: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
workspace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
};
|
|
11
12
|
run(): Promise<void>;
|
|
@@ -4,21 +4,38 @@ export default class WorkspaceSetProfile extends Command {
|
|
|
4
4
|
static args = {
|
|
5
5
|
profile: Args.string({ description: 'AWS profile name to set for the workspace', required: true }),
|
|
6
6
|
};
|
|
7
|
-
static description = 'Set AWS profile for a workspace (cloud backend only).';
|
|
7
|
+
static description = 'Set AWS profile and deployment status for a workspace (cloud backend only).';
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %> prod-profile -w production'];
|
|
9
9
|
static flags = {
|
|
10
|
+
deployment: Flags.boolean({
|
|
11
|
+
allowNo: true,
|
|
12
|
+
char: 'd',
|
|
13
|
+
description: 'mark workspace as a deployment workspace (use --no-deployment to unset)',
|
|
14
|
+
required: false,
|
|
15
|
+
}),
|
|
10
16
|
workspace: Flags.string({ char: 'w', description: 'workspace name', required: true }),
|
|
11
17
|
};
|
|
12
18
|
async run() {
|
|
13
19
|
const { args, flags } = await this.parse(WorkspaceSetProfile);
|
|
14
20
|
const backend = await getBackend();
|
|
15
21
|
const updateResult = await backend.updateWorkspace({
|
|
22
|
+
isDeploy: flags.deployment,
|
|
16
23
|
name: flags.workspace,
|
|
17
24
|
profile: args.profile,
|
|
18
25
|
});
|
|
19
26
|
if (!updateResult.success) {
|
|
20
|
-
this.error(`Failed to
|
|
27
|
+
this.error(`Failed to update workspace: ${updateResult.reason}`);
|
|
21
28
|
}
|
|
22
|
-
|
|
29
|
+
const messages = [];
|
|
30
|
+
messages.push(`Profile '${args.profile}' set for workspace '${flags.workspace}'`);
|
|
31
|
+
if (flags.deployment !== undefined) {
|
|
32
|
+
if (flags.deployment) {
|
|
33
|
+
messages.push(`Workspace marked as deployment workspace`);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
messages.push(`Workspace unmarked as deployment workspace`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
this.log(messages.join('. ') + '!');
|
|
23
40
|
}
|
|
24
41
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Backend } from '../backend/common.js';
|
|
2
|
+
export interface WorkspaceValidationResult {
|
|
3
|
+
isValid: boolean;
|
|
4
|
+
message?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Validates that a workspace exists and is marked as a deployment workspace (isDeploy=true)
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateDeploymentWorkspace(workspaceName: string, backend: Backend, commandName: string, project?: string): Promise<WorkspaceValidationResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Validates that a workspace exists and is NOT marked as a deployment workspace (isDeploy=false or undefined)
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateDevelopmentWorkspace(workspaceName: string, backend: Backend, commandName: string, project?: string): Promise<WorkspaceValidationResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Validates that flow commands are not used with deployment workspaces
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateFlowCommand(workspaceName: string | undefined, backend: Backend, project?: string): Promise<WorkspaceValidationResult>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { resolveWorkspaceName } from './workspace-utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a workspace exists and is marked as a deployment workspace (isDeploy=true)
|
|
4
|
+
*/
|
|
5
|
+
export async function validateDeploymentWorkspace(workspaceName, backend, commandName, project) {
|
|
6
|
+
// Always use resolved workspace name
|
|
7
|
+
const resolvedWorkspaceName = project ? resolveWorkspaceName(workspaceName, project) : workspaceName;
|
|
8
|
+
const result = await backend.getWorkspace(resolvedWorkspaceName);
|
|
9
|
+
if (!result.found) {
|
|
10
|
+
return {
|
|
11
|
+
isValid: false,
|
|
12
|
+
message: `Workspace '${resolvedWorkspaceName}' not found. Create a deployment workspace with:\n$ hereya workspace:create ${resolvedWorkspaceName} --deployment`,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
if (result.hasError) {
|
|
16
|
+
return {
|
|
17
|
+
isValid: false,
|
|
18
|
+
message: `Error accessing workspace '${workspaceName}': ${result.error}`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const { workspace } = result;
|
|
22
|
+
if (!workspace.isDeploy) {
|
|
23
|
+
return {
|
|
24
|
+
isValid: false,
|
|
25
|
+
message: `Cannot use '${commandName}' with development workspace '${workspaceName}'.
|
|
26
|
+
|
|
27
|
+
The '${commandName}' command requires a deployment workspace. You have two options:
|
|
28
|
+
|
|
29
|
+
1. Create a deployment workspace:
|
|
30
|
+
$ hereya workspace:create prod-deployment --deployment
|
|
31
|
+
|
|
32
|
+
2. Convert existing workspace to deployment (if using cloud backend):
|
|
33
|
+
$ hereya workspace:set-profile ${workspaceName} --deployment
|
|
34
|
+
|
|
35
|
+
Then run: $ hereya ${commandName} -w prod-deployment`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return { isValid: true };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Validates that a workspace exists and is NOT marked as a deployment workspace (isDeploy=false or undefined)
|
|
42
|
+
*/
|
|
43
|
+
export async function validateDevelopmentWorkspace(workspaceName, backend, commandName, project) {
|
|
44
|
+
// Always use resolved workspace name
|
|
45
|
+
const resolvedWorkspaceName = project ? resolveWorkspaceName(workspaceName, project) : workspaceName;
|
|
46
|
+
const result = await backend.getWorkspace(resolvedWorkspaceName);
|
|
47
|
+
if (!result.found) {
|
|
48
|
+
return {
|
|
49
|
+
isValid: false,
|
|
50
|
+
message: `Workspace '${resolvedWorkspaceName}' not found. Create a workspace with:\n$ hereya workspace:create ${resolvedWorkspaceName}`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (result.hasError) {
|
|
54
|
+
return {
|
|
55
|
+
isValid: false,
|
|
56
|
+
message: `Error accessing workspace '${workspaceName}': ${result.error}`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const { workspace } = result;
|
|
60
|
+
if (workspace.isDeploy === true) {
|
|
61
|
+
return {
|
|
62
|
+
isValid: false,
|
|
63
|
+
message: `Cannot use '${commandName}' with deployment workspace '${workspaceName}'.
|
|
64
|
+
|
|
65
|
+
The '${commandName}' command is for development workspaces only. Deployment workspaces
|
|
66
|
+
should only be managed through 'deploy' and 'undeploy' commands.
|
|
67
|
+
|
|
68
|
+
To work with packages in development:
|
|
69
|
+
1. Use a development workspace: $ hereya ${commandName} <args> -w dev-workspace
|
|
70
|
+
2. Or create a new one: $ hereya workspace:create dev-workspace`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { isValid: true };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Validates that flow commands are not used with deployment workspaces
|
|
77
|
+
*/
|
|
78
|
+
export async function validateFlowCommand(workspaceName, backend, project) {
|
|
79
|
+
if (!workspaceName) {
|
|
80
|
+
// If no workspace specified, flow commands will create their own
|
|
81
|
+
return { isValid: true };
|
|
82
|
+
}
|
|
83
|
+
// Always use resolved workspace name
|
|
84
|
+
const resolvedWorkspaceName = project ? resolveWorkspaceName(workspaceName, project) : workspaceName;
|
|
85
|
+
const result = await backend.getWorkspace(resolvedWorkspaceName);
|
|
86
|
+
if (!result.found) {
|
|
87
|
+
// Workspace doesn't exist, flow command will create it
|
|
88
|
+
return { isValid: true };
|
|
89
|
+
}
|
|
90
|
+
if (result.hasError) {
|
|
91
|
+
return {
|
|
92
|
+
isValid: false,
|
|
93
|
+
message: `Error accessing workspace '${workspaceName}': ${result.error}`,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const { workspace } = result;
|
|
97
|
+
if (workspace.isDeploy === true) {
|
|
98
|
+
return {
|
|
99
|
+
isValid: false,
|
|
100
|
+
message: `Flow commands cannot be used with deployment workspaces.
|
|
101
|
+
|
|
102
|
+
Flow commands are designed for feature branch development workflows.
|
|
103
|
+
For deployment workspaces, use the standard 'deploy' and 'undeploy' commands.
|
|
104
|
+
|
|
105
|
+
Current workspace '${workspaceName}' is marked as a deployment workspace.`,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return { isValid: true };
|
|
109
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1345,6 +1345,14 @@
|
|
|
1345
1345
|
"<%= config.bin %> <%= command.id %> dev"
|
|
1346
1346
|
],
|
|
1347
1347
|
"flags": {
|
|
1348
|
+
"deployment": {
|
|
1349
|
+
"char": "d",
|
|
1350
|
+
"description": "mark workspace as a deployment workspace",
|
|
1351
|
+
"name": "deployment",
|
|
1352
|
+
"required": false,
|
|
1353
|
+
"allowNo": false,
|
|
1354
|
+
"type": "boolean"
|
|
1355
|
+
},
|
|
1348
1356
|
"mirror": {
|
|
1349
1357
|
"description": "workspace to mirror",
|
|
1350
1358
|
"name": "mirror",
|
|
@@ -1558,11 +1566,19 @@
|
|
|
1558
1566
|
"required": true
|
|
1559
1567
|
}
|
|
1560
1568
|
},
|
|
1561
|
-
"description": "Set AWS profile for a workspace (cloud backend only).",
|
|
1569
|
+
"description": "Set AWS profile and deployment status for a workspace (cloud backend only).",
|
|
1562
1570
|
"examples": [
|
|
1563
1571
|
"<%= config.bin %> <%= command.id %> prod-profile -w production"
|
|
1564
1572
|
],
|
|
1565
1573
|
"flags": {
|
|
1574
|
+
"deployment": {
|
|
1575
|
+
"char": "d",
|
|
1576
|
+
"description": "mark workspace as a deployment workspace (use --no-deployment to unset)",
|
|
1577
|
+
"name": "deployment",
|
|
1578
|
+
"required": false,
|
|
1579
|
+
"allowNo": true,
|
|
1580
|
+
"type": "boolean"
|
|
1581
|
+
},
|
|
1566
1582
|
"workspace": {
|
|
1567
1583
|
"char": "w",
|
|
1568
1584
|
"description": "workspace name",
|
|
@@ -1770,5 +1786,5 @@
|
|
|
1770
1786
|
]
|
|
1771
1787
|
}
|
|
1772
1788
|
},
|
|
1773
|
-
"version": "0.
|
|
1789
|
+
"version": "0.53.0"
|
|
1774
1790
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hereya-cli",
|
|
3
3
|
"description": "Infrastructure as Package",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.53.0",
|
|
5
5
|
"author": "Hereya Developers",
|
|
6
6
|
"bin": {
|
|
7
7
|
"hereya": "./bin/run.js"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"oclif": "^4.17.27",
|
|
53
53
|
"shx": "^0.3.4",
|
|
54
54
|
"sinon": "^19.0.2",
|
|
55
|
-
"
|
|
55
|
+
"tsx": "^4.20.3",
|
|
56
56
|
"typescript": "^5.7.3"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|