hereya-cli 0.86.1 → 0.86.3
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 +64 -64
- package/dist/commands/deploy/index.js +14 -36
- package/dist/commands/undeploy/index.js +14 -36
- package/dist/executor/context.js +12 -15
- package/dist/lib/active-cloud.d.ts +31 -0
- package/dist/lib/active-cloud.js +55 -0
- package/dist/lib/ephemeral-token.d.ts +9 -2
- package/dist/lib/ephemeral-token.js +56 -3
- package/dist/lib/hereya-token.js +10 -11
- package/dist/lib/package/index.d.ts +0 -12
- package/dist/lib/package/index.js +2 -20
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g hereya-cli
|
|
|
21
21
|
$ hereya COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ hereya (--version)
|
|
24
|
-
hereya-cli/0.86.
|
|
24
|
+
hereya-cli/0.86.3 linux-x64 node-v24.14.1
|
|
25
25
|
$ hereya --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ hereya COMMAND
|
|
@@ -127,7 +127,7 @@ EXAMPLES
|
|
|
127
127
|
$ hereya add cloudy/docker_postgres
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
130
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/add/index.ts)_
|
|
131
131
|
|
|
132
132
|
## `hereya app deploy NAME`
|
|
133
133
|
|
|
@@ -165,7 +165,7 @@ EXAMPLES
|
|
|
165
165
|
$ hereya app deploy my-org/my-app -w prod -p organizationId=org-123
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
_See code: [src/commands/app/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
168
|
+
_See code: [src/commands/app/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/app/deploy/index.ts)_
|
|
169
169
|
|
|
170
170
|
## `hereya app deployments NAME`
|
|
171
171
|
|
|
@@ -189,7 +189,7 @@ EXAMPLES
|
|
|
189
189
|
$ hereya app deployments my-org/my-app
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
_See code: [src/commands/app/deployments/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
192
|
+
_See code: [src/commands/app/deployments/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/app/deployments/index.ts)_
|
|
193
193
|
|
|
194
194
|
## `hereya app destroy NAME`
|
|
195
195
|
|
|
@@ -221,7 +221,7 @@ EXAMPLES
|
|
|
221
221
|
$ hereya app destroy my-org/my-app -w my-workspace
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
_See code: [src/commands/app/destroy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
224
|
+
_See code: [src/commands/app/destroy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/app/destroy/index.ts)_
|
|
225
225
|
|
|
226
226
|
## `hereya app env NAME [KEY]`
|
|
227
227
|
|
|
@@ -250,7 +250,7 @@ EXAMPLES
|
|
|
250
250
|
$ hereya app env my-org/my-app -w my-workspace DATABASE_URL
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
_See code: [src/commands/app/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
253
|
+
_See code: [src/commands/app/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/app/env/index.ts)_
|
|
254
254
|
|
|
255
255
|
## `hereya app list`
|
|
256
256
|
|
|
@@ -271,7 +271,7 @@ EXAMPLES
|
|
|
271
271
|
$ hereya app list
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
-
_See code: [src/commands/app/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
274
|
+
_See code: [src/commands/app/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/app/list/index.ts)_
|
|
275
275
|
|
|
276
276
|
## `hereya app new DIRNAME`
|
|
277
277
|
|
|
@@ -297,7 +297,7 @@ EXAMPLES
|
|
|
297
297
|
$ hereya app new ./my-app -n my-org/my-app --description "An ai-app-builder app"
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
-
_See code: [src/commands/app/new/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
300
|
+
_See code: [src/commands/app/new/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/app/new/index.ts)_
|
|
301
301
|
|
|
302
302
|
## `hereya app status NAME`
|
|
303
303
|
|
|
@@ -323,7 +323,7 @@ EXAMPLES
|
|
|
323
323
|
$ hereya app status my-org/my-app -w my-workspace
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
_See code: [src/commands/app/status/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
326
|
+
_See code: [src/commands/app/status/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/app/status/index.ts)_
|
|
327
327
|
|
|
328
328
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
329
329
|
|
|
@@ -348,7 +348,7 @@ EXAMPLES
|
|
|
348
348
|
$ hereya bootstrap local
|
|
349
349
|
```
|
|
350
350
|
|
|
351
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
351
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/bootstrap/index.ts)_
|
|
352
352
|
|
|
353
353
|
## `hereya clone PROJECT`
|
|
354
354
|
|
|
@@ -373,7 +373,7 @@ EXAMPLES
|
|
|
373
373
|
$ hereya clone myProject --chdir=./myProject
|
|
374
374
|
```
|
|
375
375
|
|
|
376
|
-
_See code: [src/commands/clone/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
376
|
+
_See code: [src/commands/clone/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/clone/index.ts)_
|
|
377
377
|
|
|
378
378
|
## `hereya config export-backend [FILE]`
|
|
379
379
|
|
|
@@ -395,7 +395,7 @@ EXAMPLES
|
|
|
395
395
|
$ hereya config export-backend ./path/to/export.json
|
|
396
396
|
```
|
|
397
397
|
|
|
398
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
398
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/config/export-backend/index.ts)_
|
|
399
399
|
|
|
400
400
|
## `hereya config get-backend`
|
|
401
401
|
|
|
@@ -412,7 +412,7 @@ EXAMPLES
|
|
|
412
412
|
$ hereya config get-backend
|
|
413
413
|
```
|
|
414
414
|
|
|
415
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
415
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/config/get-backend/index.ts)_
|
|
416
416
|
|
|
417
417
|
## `hereya config import-backend FILE`
|
|
418
418
|
|
|
@@ -432,7 +432,7 @@ EXAMPLES
|
|
|
432
432
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
433
433
|
```
|
|
434
434
|
|
|
435
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
435
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/config/import-backend/index.ts)_
|
|
436
436
|
|
|
437
437
|
## `hereya config use-backend TYPE`
|
|
438
438
|
|
|
@@ -454,7 +454,7 @@ EXAMPLES
|
|
|
454
454
|
$ hereya config use-backend local
|
|
455
455
|
```
|
|
456
456
|
|
|
457
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
457
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/config/use-backend/index.ts)_
|
|
458
458
|
|
|
459
459
|
## `hereya delete-state`
|
|
460
460
|
|
|
@@ -480,7 +480,7 @@ EXAMPLES
|
|
|
480
480
|
$ hereya delete-state --workspace staging
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
483
|
+
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/delete-state/index.ts)_
|
|
484
484
|
|
|
485
485
|
## `hereya deploy`
|
|
486
486
|
|
|
@@ -509,7 +509,7 @@ EXAMPLES
|
|
|
509
509
|
$ hereya deploy
|
|
510
510
|
```
|
|
511
511
|
|
|
512
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
512
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/deploy/index.ts)_
|
|
513
513
|
|
|
514
514
|
## `hereya devenv config`
|
|
515
515
|
|
|
@@ -529,7 +529,7 @@ EXAMPLES
|
|
|
529
529
|
$ hereya devenv config -w my-workspace
|
|
530
530
|
```
|
|
531
531
|
|
|
532
|
-
_See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
532
|
+
_See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/devenv/config/index.ts)_
|
|
533
533
|
|
|
534
534
|
## `hereya devenv install`
|
|
535
535
|
|
|
@@ -554,7 +554,7 @@ EXAMPLES
|
|
|
554
554
|
$ hereya devenv install -w my-workspace -p instanceType=t3.large
|
|
555
555
|
```
|
|
556
556
|
|
|
557
|
-
_See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
557
|
+
_See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/devenv/install/index.ts)_
|
|
558
558
|
|
|
559
559
|
## `hereya devenv project init PROJECT`
|
|
560
560
|
|
|
@@ -586,7 +586,7 @@ EXAMPLES
|
|
|
586
586
|
$ hereya devenv project init my-app -w my-workspace -t acme/node-starter -p region=us-east-1
|
|
587
587
|
```
|
|
588
588
|
|
|
589
|
-
_See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
589
|
+
_See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/devenv/project/init/index.ts)_
|
|
590
590
|
|
|
591
591
|
## `hereya devenv project uninit PROJECT`
|
|
592
592
|
|
|
@@ -612,7 +612,7 @@ EXAMPLES
|
|
|
612
612
|
$ hereya devenv project uninit my-app -w my-workspace --force
|
|
613
613
|
```
|
|
614
614
|
|
|
615
|
-
_See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
615
|
+
_See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/devenv/project/uninit/index.ts)_
|
|
616
616
|
|
|
617
617
|
## `hereya devenv ssh`
|
|
618
618
|
|
|
@@ -632,7 +632,7 @@ EXAMPLES
|
|
|
632
632
|
$ hereya devenv ssh -w my-workspace
|
|
633
633
|
```
|
|
634
634
|
|
|
635
|
-
_See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
635
|
+
_See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/devenv/ssh/index.ts)_
|
|
636
636
|
|
|
637
637
|
## `hereya devenv uninstall`
|
|
638
638
|
|
|
@@ -653,7 +653,7 @@ EXAMPLES
|
|
|
653
653
|
$ hereya devenv uninstall -w my-workspace
|
|
654
654
|
```
|
|
655
655
|
|
|
656
|
-
_See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
656
|
+
_See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/devenv/uninstall/index.ts)_
|
|
657
657
|
|
|
658
658
|
## `hereya doc PACKAGE`
|
|
659
659
|
|
|
@@ -686,7 +686,7 @@ EXAMPLES
|
|
|
686
686
|
$ hereya doc my-package --no-doc
|
|
687
687
|
```
|
|
688
688
|
|
|
689
|
-
_See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
689
|
+
_See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/doc/index.ts)_
|
|
690
690
|
|
|
691
691
|
## `hereya docker run IMAGE`
|
|
692
692
|
|
|
@@ -717,7 +717,7 @@ EXAMPLES
|
|
|
717
717
|
$ hereya docker run myapp:latest -- --rm -v ./data:/data
|
|
718
718
|
```
|
|
719
719
|
|
|
720
|
-
_See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
720
|
+
_See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/docker/run/index.ts)_
|
|
721
721
|
|
|
722
722
|
## `hereya down`
|
|
723
723
|
|
|
@@ -744,7 +744,7 @@ EXAMPLES
|
|
|
744
744
|
$ hereya down
|
|
745
745
|
```
|
|
746
746
|
|
|
747
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
747
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/down/index.ts)_
|
|
748
748
|
|
|
749
749
|
## `hereya env [NAME]`
|
|
750
750
|
|
|
@@ -775,7 +775,7 @@ EXAMPLES
|
|
|
775
775
|
$ hereya env -w dev -l
|
|
776
776
|
```
|
|
777
777
|
|
|
778
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
778
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/env/index.ts)_
|
|
779
779
|
|
|
780
780
|
## `hereya env set [NAME]`
|
|
781
781
|
|
|
@@ -802,7 +802,7 @@ EXAMPLES
|
|
|
802
802
|
$ hereya env set FOO -v bar -w dev
|
|
803
803
|
```
|
|
804
804
|
|
|
805
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
805
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/env/set/index.ts)_
|
|
806
806
|
|
|
807
807
|
## `hereya executor start`
|
|
808
808
|
|
|
@@ -835,7 +835,7 @@ EXAMPLES
|
|
|
835
835
|
HEREYA_TOKEN=<token> HEREYA_CLOUD_URL=https://my-cloud.example.com hereya executor start -w my-workspace
|
|
836
836
|
```
|
|
837
837
|
|
|
838
|
-
_See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
838
|
+
_See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/executor/start/index.ts)_
|
|
839
839
|
|
|
840
840
|
## `hereya flow add PACKAGE`
|
|
841
841
|
|
|
@@ -873,7 +873,7 @@ EXAMPLES
|
|
|
873
873
|
$ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
|
|
874
874
|
```
|
|
875
875
|
|
|
876
|
-
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
876
|
+
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/add/index.ts)_
|
|
877
877
|
|
|
878
878
|
## `hereya flow docker run IMAGE`
|
|
879
879
|
|
|
@@ -903,7 +903,7 @@ EXAMPLES
|
|
|
903
903
|
$ hereya flow docker run --pin myapp:latest -- --rm
|
|
904
904
|
```
|
|
905
905
|
|
|
906
|
-
_See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
906
|
+
_See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/docker/run/index.ts)_
|
|
907
907
|
|
|
908
908
|
## `hereya flow down`
|
|
909
909
|
|
|
@@ -937,7 +937,7 @@ EXAMPLES
|
|
|
937
937
|
$ hereya flow down --pin
|
|
938
938
|
```
|
|
939
939
|
|
|
940
|
-
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
940
|
+
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/down/index.ts)_
|
|
941
941
|
|
|
942
942
|
## `hereya flow env [NAME]`
|
|
943
943
|
|
|
@@ -971,7 +971,7 @@ EXAMPLES
|
|
|
971
971
|
$ hereya flow env -l
|
|
972
972
|
```
|
|
973
973
|
|
|
974
|
-
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
974
|
+
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/env/index.ts)_
|
|
975
975
|
|
|
976
976
|
## `hereya flow provid PACKAGE`
|
|
977
977
|
|
|
@@ -1000,7 +1000,7 @@ EXAMPLES
|
|
|
1000
1000
|
$ hereya flow provid hereya/postgres --pin
|
|
1001
1001
|
```
|
|
1002
1002
|
|
|
1003
|
-
_See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1003
|
+
_See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/provid/index.ts)_
|
|
1004
1004
|
|
|
1005
1005
|
## `hereya flow remove PACKAGE`
|
|
1006
1006
|
|
|
@@ -1030,7 +1030,7 @@ EXAMPLES
|
|
|
1030
1030
|
$ hereya flow remove cloudy/docker_postgres --profile staging
|
|
1031
1031
|
```
|
|
1032
1032
|
|
|
1033
|
-
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1033
|
+
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/remove/index.ts)_
|
|
1034
1034
|
|
|
1035
1035
|
## `hereya flow run CMD`
|
|
1036
1036
|
|
|
@@ -1059,7 +1059,7 @@ EXAMPLES
|
|
|
1059
1059
|
$ hereya flow run --pin -- npm test
|
|
1060
1060
|
```
|
|
1061
1061
|
|
|
1062
|
-
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1062
|
+
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/run/index.ts)_
|
|
1063
1063
|
|
|
1064
1064
|
## `hereya flow up`
|
|
1065
1065
|
|
|
@@ -1093,7 +1093,7 @@ EXAMPLES
|
|
|
1093
1093
|
$ hereya flow up --pin
|
|
1094
1094
|
```
|
|
1095
1095
|
|
|
1096
|
-
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1096
|
+
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/flow/up/index.ts)_
|
|
1097
1097
|
|
|
1098
1098
|
## `hereya help [COMMAND]`
|
|
1099
1099
|
|
|
@@ -1150,7 +1150,7 @@ EXAMPLES
|
|
|
1150
1150
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
1151
1151
|
```
|
|
1152
1152
|
|
|
1153
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1153
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/import/index.ts)_
|
|
1154
1154
|
|
|
1155
1155
|
## `hereya init PROJECT`
|
|
1156
1156
|
|
|
@@ -1188,7 +1188,7 @@ EXAMPLES
|
|
|
1188
1188
|
$ hereya init myProject -w=dev -t=acme/node-starter -d=prod -p region=us-east-1
|
|
1189
1189
|
```
|
|
1190
1190
|
|
|
1191
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1191
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/init/index.ts)_
|
|
1192
1192
|
|
|
1193
1193
|
## `hereya list`
|
|
1194
1194
|
|
|
@@ -1205,7 +1205,7 @@ EXAMPLES
|
|
|
1205
1205
|
$ hereya list
|
|
1206
1206
|
```
|
|
1207
1207
|
|
|
1208
|
-
_See code: [src/commands/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1208
|
+
_See code: [src/commands/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/list/index.ts)_
|
|
1209
1209
|
|
|
1210
1210
|
## `hereya login [URL]`
|
|
1211
1211
|
|
|
@@ -1234,7 +1234,7 @@ EXAMPLES
|
|
|
1234
1234
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
1235
1235
|
```
|
|
1236
1236
|
|
|
1237
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1237
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/login/index.ts)_
|
|
1238
1238
|
|
|
1239
1239
|
## `hereya logout`
|
|
1240
1240
|
|
|
@@ -1251,7 +1251,7 @@ EXAMPLES
|
|
|
1251
1251
|
$ hereya logout
|
|
1252
1252
|
```
|
|
1253
1253
|
|
|
1254
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1254
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/logout/index.ts)_
|
|
1255
1255
|
|
|
1256
1256
|
## `hereya provid PACKAGE`
|
|
1257
1257
|
|
|
@@ -1279,7 +1279,7 @@ EXAMPLES
|
|
|
1279
1279
|
$ hereya provid hereya/postgres --workspace staging
|
|
1280
1280
|
```
|
|
1281
1281
|
|
|
1282
|
-
_See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1282
|
+
_See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/provid/index.ts)_
|
|
1283
1283
|
|
|
1284
1284
|
## `hereya publish`
|
|
1285
1285
|
|
|
@@ -1304,7 +1304,7 @@ EXAMPLES
|
|
|
1304
1304
|
$ hereya publish --chdir=/path/to/package
|
|
1305
1305
|
```
|
|
1306
1306
|
|
|
1307
|
-
_See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1307
|
+
_See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/publish/index.ts)_
|
|
1308
1308
|
|
|
1309
1309
|
## `hereya remove PACKAGE`
|
|
1310
1310
|
|
|
@@ -1332,7 +1332,7 @@ EXAMPLES
|
|
|
1332
1332
|
$ hereya remove cloudy/docker_postgres
|
|
1333
1333
|
```
|
|
1334
1334
|
|
|
1335
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1335
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/remove/index.ts)_
|
|
1336
1336
|
|
|
1337
1337
|
## `hereya run CMD`
|
|
1338
1338
|
|
|
@@ -1361,7 +1361,7 @@ EXAMPLES
|
|
|
1361
1361
|
$ hereya run -w uat -- node index.js
|
|
1362
1362
|
```
|
|
1363
1363
|
|
|
1364
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1364
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/run/index.ts)_
|
|
1365
1365
|
|
|
1366
1366
|
## `hereya search QUERY`
|
|
1367
1367
|
|
|
@@ -1394,7 +1394,7 @@ EXAMPLES
|
|
|
1394
1394
|
$ hereya search database --json
|
|
1395
1395
|
```
|
|
1396
1396
|
|
|
1397
|
-
_See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1397
|
+
_See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/search/index.ts)_
|
|
1398
1398
|
|
|
1399
1399
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
1400
1400
|
|
|
@@ -1419,7 +1419,7 @@ EXAMPLES
|
|
|
1419
1419
|
$ hereya unbootstrap local
|
|
1420
1420
|
```
|
|
1421
1421
|
|
|
1422
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1422
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/unbootstrap/index.ts)_
|
|
1423
1423
|
|
|
1424
1424
|
## `hereya undeploy`
|
|
1425
1425
|
|
|
@@ -1448,7 +1448,7 @@ EXAMPLES
|
|
|
1448
1448
|
$ hereya undeploy
|
|
1449
1449
|
```
|
|
1450
1450
|
|
|
1451
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1451
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/undeploy/index.ts)_
|
|
1452
1452
|
|
|
1453
1453
|
## `hereya uninit PROJECT`
|
|
1454
1454
|
|
|
@@ -1476,7 +1476,7 @@ EXAMPLES
|
|
|
1476
1476
|
$ hereya uninit myProject -w dev -p prodWorkspace=prod
|
|
1477
1477
|
```
|
|
1478
1478
|
|
|
1479
|
-
_See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1479
|
+
_See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/uninit/index.ts)_
|
|
1480
1480
|
|
|
1481
1481
|
## `hereya up`
|
|
1482
1482
|
|
|
@@ -1506,7 +1506,7 @@ EXAMPLES
|
|
|
1506
1506
|
$ hereya up
|
|
1507
1507
|
```
|
|
1508
1508
|
|
|
1509
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1509
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/up/index.ts)_
|
|
1510
1510
|
|
|
1511
1511
|
## `hereya update [VERSION]`
|
|
1512
1512
|
|
|
@@ -1528,7 +1528,7 @@ EXAMPLES
|
|
|
1528
1528
|
$ hereya update 0.75.0
|
|
1529
1529
|
```
|
|
1530
1530
|
|
|
1531
|
-
_See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1531
|
+
_See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/update/index.ts)_
|
|
1532
1532
|
|
|
1533
1533
|
## `hereya workspace create NAME`
|
|
1534
1534
|
|
|
@@ -1553,7 +1553,7 @@ EXAMPLES
|
|
|
1553
1553
|
$ hereya workspace create dev
|
|
1554
1554
|
```
|
|
1555
1555
|
|
|
1556
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1556
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/create/index.ts)_
|
|
1557
1557
|
|
|
1558
1558
|
## `hereya workspace delete NAME`
|
|
1559
1559
|
|
|
@@ -1573,7 +1573,7 @@ EXAMPLES
|
|
|
1573
1573
|
$ hereya workspace delete dev
|
|
1574
1574
|
```
|
|
1575
1575
|
|
|
1576
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1576
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/delete/index.ts)_
|
|
1577
1577
|
|
|
1578
1578
|
## `hereya workspace env [NAME]`
|
|
1579
1579
|
|
|
@@ -1599,7 +1599,7 @@ EXAMPLES
|
|
|
1599
1599
|
$ hereya workspace env myEnv -w dev
|
|
1600
1600
|
```
|
|
1601
1601
|
|
|
1602
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1602
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/env/index.ts)_
|
|
1603
1603
|
|
|
1604
1604
|
## `hereya workspace env set`
|
|
1605
1605
|
|
|
@@ -1623,7 +1623,7 @@ EXAMPLES
|
|
|
1623
1623
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
1624
1624
|
```
|
|
1625
1625
|
|
|
1626
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1626
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/env/set/index.ts)_
|
|
1627
1627
|
|
|
1628
1628
|
## `hereya workspace env unset`
|
|
1629
1629
|
|
|
@@ -1644,7 +1644,7 @@ EXAMPLES
|
|
|
1644
1644
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
1645
1645
|
```
|
|
1646
1646
|
|
|
1647
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1647
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/env/unset/index.ts)_
|
|
1648
1648
|
|
|
1649
1649
|
## `hereya workspace executor install`
|
|
1650
1650
|
|
|
@@ -1666,7 +1666,7 @@ DESCRIPTION
|
|
|
1666
1666
|
Install a remote executor into a workspace
|
|
1667
1667
|
```
|
|
1668
1668
|
|
|
1669
|
-
_See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1669
|
+
_See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/executor/install/index.ts)_
|
|
1670
1670
|
|
|
1671
1671
|
## `hereya workspace executor token`
|
|
1672
1672
|
|
|
@@ -1686,7 +1686,7 @@ DESCRIPTION
|
|
|
1686
1686
|
Generate a workspace-scoped executor token for the remote executor
|
|
1687
1687
|
```
|
|
1688
1688
|
|
|
1689
|
-
_See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1689
|
+
_See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/executor/token/index.ts)_
|
|
1690
1690
|
|
|
1691
1691
|
## `hereya workspace executor uninstall`
|
|
1692
1692
|
|
|
@@ -1707,7 +1707,7 @@ DESCRIPTION
|
|
|
1707
1707
|
Uninstall the remote executor from a workspace
|
|
1708
1708
|
```
|
|
1709
1709
|
|
|
1710
|
-
_See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1710
|
+
_See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/executor/uninstall/index.ts)_
|
|
1711
1711
|
|
|
1712
1712
|
## `hereya workspace install PACKAGE`
|
|
1713
1713
|
|
|
@@ -1734,7 +1734,7 @@ EXAMPLES
|
|
|
1734
1734
|
$ hereya workspace install hereya/aws-cognito
|
|
1735
1735
|
```
|
|
1736
1736
|
|
|
1737
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1737
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/install/index.ts)_
|
|
1738
1738
|
|
|
1739
1739
|
## `hereya workspace list`
|
|
1740
1740
|
|
|
@@ -1758,7 +1758,7 @@ EXAMPLES
|
|
|
1758
1758
|
$ hereya workspace list --org personal
|
|
1759
1759
|
```
|
|
1760
1760
|
|
|
1761
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1761
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/list/index.ts)_
|
|
1762
1762
|
|
|
1763
1763
|
## `hereya workspace set-profile PROFILE`
|
|
1764
1764
|
|
|
@@ -1782,7 +1782,7 @@ EXAMPLES
|
|
|
1782
1782
|
$ hereya workspace set-profile prod-profile -w production
|
|
1783
1783
|
```
|
|
1784
1784
|
|
|
1785
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1785
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/set-profile/index.ts)_
|
|
1786
1786
|
|
|
1787
1787
|
## `hereya workspace uninstall PACKAGE`
|
|
1788
1788
|
|
|
@@ -1809,5 +1809,5 @@ EXAMPLES
|
|
|
1809
1809
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
1810
1810
|
```
|
|
1811
1811
|
|
|
1812
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.
|
|
1812
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.86.3/src/commands/workspace/uninstall/index.ts)_
|
|
1813
1813
|
<!-- commandsstop -->
|
|
@@ -2,12 +2,12 @@ import { Command, Flags } from '@oclif/core';
|
|
|
2
2
|
import { getRendererClass, Listr, ListrLogger, ListrLogLevels } from 'listr2';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { CloudBackend } from '../../backend/cloud/cloud-backend.js';
|
|
5
|
-
import { getCloudCredentials, loadBackendConfig } from '../../backend/config.js';
|
|
6
5
|
import { getBackend } from '../../backend/index.js';
|
|
7
6
|
import { getExecutor } from '../../executor/index.js';
|
|
7
|
+
import { getActiveCloudAuth } from '../../lib/active-cloud.js';
|
|
8
8
|
import { getConfigManager } from '../../lib/config/index.js';
|
|
9
9
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { withEphemeralToken } from '../../lib/ephemeral-token.js';
|
|
11
11
|
import { gitUtils } from '../../lib/git-utils.js';
|
|
12
12
|
import { getDefaultLogger, getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
13
13
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
@@ -65,41 +65,19 @@ export default class Deploy extends Command {
|
|
|
65
65
|
this.error(cleanCheck.reason);
|
|
66
66
|
}
|
|
67
67
|
myLogger.log(ListrLogLevels.STARTED, `Deploying to ${input.workspace} via remote executor (branch: ${input.gitBranch})`);
|
|
68
|
-
// 2.
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const resolvedWorkspaceName = resolveWorkspaceName(input.workspace, input.project);
|
|
74
|
-
let cloudBackend;
|
|
75
|
-
if (ephemeral) {
|
|
76
|
-
const url = ephemeral.cloudUrl
|
|
77
|
-
?? process.env.HEREYA_CLOUD_URL
|
|
78
|
-
?? (await loadBackendConfig()).cloud?.url
|
|
79
|
-
?? 'https://cloud.hereya.dev';
|
|
80
|
-
cloudBackend = new CloudBackend({
|
|
81
|
-
accessToken: ephemeral.token,
|
|
82
|
-
clientId: '',
|
|
83
|
-
refreshToken: '',
|
|
84
|
-
url,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
const backendConfig = await loadBackendConfig();
|
|
89
|
-
if (!backendConfig.cloud) {
|
|
90
|
-
this.error('Remote deployment requires cloud backend. Run `hereya login` first.');
|
|
91
|
-
}
|
|
92
|
-
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
93
|
-
if (!credentials) {
|
|
94
|
-
this.error('Cloud credentials not found. Run `hereya login` first.');
|
|
95
|
-
}
|
|
96
|
-
cloudBackend = new CloudBackend({
|
|
97
|
-
accessToken: credentials.accessToken,
|
|
98
|
-
clientId: backendConfig.cloud.clientId,
|
|
99
|
-
refreshToken: credentials.refreshToken,
|
|
100
|
-
url: backendConfig.cloud.url,
|
|
101
|
-
});
|
|
68
|
+
// 2. Resolve cloud auth (ephemeral --token first, then persisted creds)
|
|
69
|
+
// and build a CloudBackend for job submission + polling.
|
|
70
|
+
const auth = await getActiveCloudAuth();
|
|
71
|
+
if (!auth) {
|
|
72
|
+
this.error('Remote deployment requires cloud backend. Run `hereya login` or pass `--token <token>`.');
|
|
102
73
|
}
|
|
74
|
+
const resolvedWorkspaceName = resolveWorkspaceName(input.workspace, input.project);
|
|
75
|
+
const cloudBackend = new CloudBackend({
|
|
76
|
+
accessToken: auth.accessToken,
|
|
77
|
+
clientId: auth.clientId ?? '',
|
|
78
|
+
refreshToken: auth.refreshToken ?? '',
|
|
79
|
+
url: auth.cloudUrl,
|
|
80
|
+
});
|
|
103
81
|
// 3. Submit deploy job
|
|
104
82
|
const submitResult = await cloudBackend.submitExecutorJob({
|
|
105
83
|
payload: {
|
|
@@ -2,12 +2,12 @@ import { Command, Flags } from '@oclif/core';
|
|
|
2
2
|
import { getRendererClass, Listr, ListrLogger, ListrLogLevels } from 'listr2';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { CloudBackend } from '../../backend/cloud/cloud-backend.js';
|
|
5
|
-
import { getCloudCredentials, loadBackendConfig } from '../../backend/config.js';
|
|
6
5
|
import { getBackend } from '../../backend/index.js';
|
|
7
6
|
import { getExecutor } from '../../executor/index.js';
|
|
7
|
+
import { getActiveCloudAuth } from '../../lib/active-cloud.js';
|
|
8
8
|
import { getConfigManager } from '../../lib/config/index.js';
|
|
9
9
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { withEphemeralToken } from '../../lib/ephemeral-token.js';
|
|
11
11
|
import { gitUtils } from '../../lib/git-utils.js';
|
|
12
12
|
import { getDefaultLogger, getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
13
13
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
@@ -338,41 +338,19 @@ See ${getLogPath()} for more details`);
|
|
|
338
338
|
this.error(cleanCheck.reason);
|
|
339
339
|
}
|
|
340
340
|
myLogger.log(ListrLogLevels.STARTED, `Undeploying ${input.workspace} via remote executor (branch: ${input.gitBranch})`);
|
|
341
|
-
// 2.
|
|
342
|
-
//
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
const resolvedWorkspaceName = resolveWorkspaceName(input.workspace, input.project);
|
|
347
|
-
let cloudBackend;
|
|
348
|
-
if (ephemeral) {
|
|
349
|
-
const url = ephemeral.cloudUrl
|
|
350
|
-
?? process.env.HEREYA_CLOUD_URL
|
|
351
|
-
?? (await loadBackendConfig()).cloud?.url
|
|
352
|
-
?? 'https://cloud.hereya.dev';
|
|
353
|
-
cloudBackend = new CloudBackend({
|
|
354
|
-
accessToken: ephemeral.token,
|
|
355
|
-
clientId: '',
|
|
356
|
-
refreshToken: '',
|
|
357
|
-
url,
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
const backendConfig = await loadBackendConfig();
|
|
362
|
-
if (!backendConfig.cloud) {
|
|
363
|
-
this.error('Remote undeployment requires cloud backend. Run `hereya login` first.');
|
|
364
|
-
}
|
|
365
|
-
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
366
|
-
if (!credentials) {
|
|
367
|
-
this.error('Cloud credentials not found. Run `hereya login` first.');
|
|
368
|
-
}
|
|
369
|
-
cloudBackend = new CloudBackend({
|
|
370
|
-
accessToken: credentials.accessToken,
|
|
371
|
-
clientId: backendConfig.cloud.clientId,
|
|
372
|
-
refreshToken: credentials.refreshToken,
|
|
373
|
-
url: backendConfig.cloud.url,
|
|
374
|
-
});
|
|
341
|
+
// 2. Resolve cloud auth (ephemeral --token first, then persisted creds)
|
|
342
|
+
// and build a CloudBackend for job submission + polling.
|
|
343
|
+
const auth = await getActiveCloudAuth();
|
|
344
|
+
if (!auth) {
|
|
345
|
+
this.error('Remote undeployment requires cloud backend. Run `hereya login` or pass `--token <token>`.');
|
|
375
346
|
}
|
|
347
|
+
const resolvedWorkspaceName = resolveWorkspaceName(input.workspace, input.project);
|
|
348
|
+
const cloudBackend = new CloudBackend({
|
|
349
|
+
accessToken: auth.accessToken,
|
|
350
|
+
clientId: auth.clientId ?? '',
|
|
351
|
+
refreshToken: auth.refreshToken ?? '',
|
|
352
|
+
url: auth.cloudUrl,
|
|
353
|
+
});
|
|
376
354
|
// 3. Submit undeploy job
|
|
377
355
|
const submitResult = await cloudBackend.submitExecutorJob({
|
|
378
356
|
payload: {
|
package/dist/executor/context.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getBackend } from '../backend/index.js';
|
|
2
|
+
import { getActiveCloudAuth } from '../lib/active-cloud.js';
|
|
3
3
|
import { resolveWorkspaceName } from '../lib/workspace-utils.js';
|
|
4
4
|
import { getExecutor } from './index.js';
|
|
5
5
|
export async function getExecutorForWorkspace(workspaceName, project) {
|
|
6
6
|
if (!workspaceName) {
|
|
7
7
|
return getExecutor();
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
// Honors both `hereya login` (persisted on disk) and an in-scope
|
|
10
|
+
// ephemeral `--token`. Without this, `--token` invocations silently
|
|
11
|
+
// fell through to the local executor regardless of whether the
|
|
12
|
+
// workspace actually has a remote executor.
|
|
13
|
+
const auth = await getActiveCloudAuth();
|
|
14
|
+
if (!auth) {
|
|
14
15
|
return getExecutor();
|
|
15
16
|
}
|
|
16
17
|
const resolvedName = resolveWorkspaceName(workspaceName, project);
|
|
@@ -23,16 +24,12 @@ export async function getExecutorForWorkspace(workspaceName, project) {
|
|
|
23
24
|
if (!workspace.hasExecutor) {
|
|
24
25
|
return getExecutor();
|
|
25
26
|
}
|
|
26
|
-
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
27
|
-
if (!credentials) {
|
|
28
|
-
return getExecutor();
|
|
29
|
-
}
|
|
30
27
|
return getExecutor({
|
|
31
28
|
cloudConfig: {
|
|
32
|
-
accessToken:
|
|
33
|
-
clientId:
|
|
34
|
-
refreshToken:
|
|
35
|
-
url:
|
|
29
|
+
accessToken: auth.accessToken,
|
|
30
|
+
clientId: auth.clientId ?? '',
|
|
31
|
+
refreshToken: auth.refreshToken ?? '',
|
|
32
|
+
url: auth.cloudUrl,
|
|
36
33
|
},
|
|
37
34
|
workspace: resolvedName,
|
|
38
35
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The active cloud auth credentials for this CLI invocation.
|
|
3
|
+
*
|
|
4
|
+
* Either sourced from an ephemeral `--token` (in which case `clientId` and
|
|
5
|
+
* `refreshToken` are `null` because there is no persisted client identity
|
|
6
|
+
* and the token cannot be refreshed) or from the persisted `backend.yaml`
|
|
7
|
+
* + keychain credentials.
|
|
8
|
+
*/
|
|
9
|
+
export interface ActiveCloudAuth {
|
|
10
|
+
accessToken: string;
|
|
11
|
+
clientId: null | string;
|
|
12
|
+
cloudUrl: string;
|
|
13
|
+
refreshToken: null | string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the active cloud auth, preferring an in-scope ephemeral `--token`
|
|
17
|
+
* over the persisted `backend.yaml` + keychain credentials. Returns `null`
|
|
18
|
+
* when neither is available.
|
|
19
|
+
*
|
|
20
|
+
* **This is the single source of truth for "are we authenticated to
|
|
21
|
+
* hereya-cloud right now?"** — every code path that previously read from
|
|
22
|
+
* `loadBackendConfig()` + `getCloudCredentials()` directly (and therefore
|
|
23
|
+
* silently ignored an ephemeral `--token`) should call this instead.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getActiveCloudAuth(): Promise<ActiveCloudAuth | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the cloud backend is "active" — either via `hereya login` or via
|
|
28
|
+
* an in-scope ephemeral `--token`. Used to decide whether to consult the
|
|
29
|
+
* cloud package registry, the remote executor, etc.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isCloudBackendActive(): Promise<boolean>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getCloudCredentials, loadBackendConfig } from '../backend/config.js';
|
|
2
|
+
import { BackendType } from '../backend/index.js';
|
|
3
|
+
import { getEphemeralToken } from './ephemeral-token.js';
|
|
4
|
+
const DEFAULT_CLOUD_URL = 'https://cloud.hereya.dev';
|
|
5
|
+
/**
|
|
6
|
+
* Returns the active cloud auth, preferring an in-scope ephemeral `--token`
|
|
7
|
+
* over the persisted `backend.yaml` + keychain credentials. Returns `null`
|
|
8
|
+
* when neither is available.
|
|
9
|
+
*
|
|
10
|
+
* **This is the single source of truth for "are we authenticated to
|
|
11
|
+
* hereya-cloud right now?"** — every code path that previously read from
|
|
12
|
+
* `loadBackendConfig()` + `getCloudCredentials()` directly (and therefore
|
|
13
|
+
* silently ignored an ephemeral `--token`) should call this instead.
|
|
14
|
+
*/
|
|
15
|
+
export async function getActiveCloudAuth() {
|
|
16
|
+
const ephemeral = getEphemeralToken();
|
|
17
|
+
if (ephemeral) {
|
|
18
|
+
const cloudUrl = ephemeral.cloudUrl
|
|
19
|
+
?? process.env.HEREYA_CLOUD_URL
|
|
20
|
+
?? (await loadBackendConfig()).cloud?.url
|
|
21
|
+
?? DEFAULT_CLOUD_URL;
|
|
22
|
+
return {
|
|
23
|
+
accessToken: ephemeral.token,
|
|
24
|
+
clientId: null,
|
|
25
|
+
cloudUrl,
|
|
26
|
+
refreshToken: null,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const config = await loadBackendConfig();
|
|
30
|
+
if (config.current !== BackendType.Cloud || !config.cloud) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const credentials = await getCloudCredentials(config.cloud.clientId);
|
|
34
|
+
if (!credentials) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
accessToken: credentials.accessToken,
|
|
39
|
+
clientId: config.cloud.clientId,
|
|
40
|
+
cloudUrl: config.cloud.url,
|
|
41
|
+
refreshToken: credentials.refreshToken,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether the cloud backend is "active" — either via `hereya login` or via
|
|
46
|
+
* an in-scope ephemeral `--token`. Used to decide whether to consult the
|
|
47
|
+
* cloud package registry, the remote executor, etc.
|
|
48
|
+
*/
|
|
49
|
+
export async function isCloudBackendActive() {
|
|
50
|
+
if (getEphemeralToken()) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
const config = await loadBackendConfig();
|
|
54
|
+
return config.current === BackendType.Cloud;
|
|
55
|
+
}
|
|
@@ -16,17 +16,24 @@ export interface EphemeralTokenContext {
|
|
|
16
16
|
/**
|
|
17
17
|
* Returns the active ephemeral token context, or `undefined` if no
|
|
18
18
|
* `withEphemeralToken` scope is currently in flight.
|
|
19
|
+
*
|
|
20
|
+
* Falls back to the `HEREYA_EPHEMERAL_TOKEN` env var when no async-local-
|
|
21
|
+
* storage context is set — that's how subprocesses (the credential helper
|
|
22
|
+
* grandchild, etc.) inherit the ephemeral context across process
|
|
23
|
+
* boundaries. The env var is set automatically by `withEphemeralToken`.
|
|
19
24
|
*/
|
|
20
25
|
export declare function getEphemeralToken(): EphemeralTokenContext | undefined;
|
|
21
26
|
/**
|
|
22
27
|
* Run `fn` inside an ephemeral-token scope. While `fn` is executing,
|
|
23
|
-
* `getEphemeralToken()` returns the supplied token (and optional cloudUrl)
|
|
28
|
+
* `getEphemeralToken()` returns the supplied token (and optional cloudUrl),
|
|
29
|
+
* and `process.env.HEREYA_EPHEMERAL_TOKEN` is set so subprocesses inherit
|
|
30
|
+
* the same ephemeral context.
|
|
24
31
|
*
|
|
25
32
|
* Critical guarantees:
|
|
26
33
|
* - The token is held in-memory only. It is NEVER passed to the secret
|
|
27
34
|
* manager or written to disk.
|
|
28
35
|
* - After `fn` returns or throws, `getEphemeralToken()` returns `undefined`
|
|
29
|
-
* again.
|
|
36
|
+
* again and `HEREYA_EPHEMERAL_TOKEN` is restored to its prior value.
|
|
30
37
|
* - The cached backend in `src/backend/index.ts` is cleared before and after
|
|
31
38
|
* the scope so that a stale, persisted-credential-backed CloudBackend is
|
|
32
39
|
* never used while the scope is active, and the scope's in-memory backend
|
|
@@ -1,22 +1,52 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import { clearBackend } from '../backend/index.js';
|
|
3
3
|
const storage = new AsyncLocalStorage();
|
|
4
|
+
/**
|
|
5
|
+
* Env-var names used to propagate the ephemeral token to **subprocesses**
|
|
6
|
+
* (e.g. the `git` invocation that triggers the `hereya credential-helper`
|
|
7
|
+
* grandchild). Async-local-storage doesn't cross process boundaries, so we
|
|
8
|
+
* also stash the token in the environment for the duration of the scope.
|
|
9
|
+
*
|
|
10
|
+
* These are deliberately named differently from `HEREYA_TOKEN` because the
|
|
11
|
+
* existing `HEREYA_TOKEN` semantics call `loginWithToken()` (exchange +
|
|
12
|
+
* keychain persist), which is exactly what ephemeral mode must NOT do.
|
|
13
|
+
*/
|
|
14
|
+
const EPHEMERAL_TOKEN_ENV = 'HEREYA_EPHEMERAL_TOKEN';
|
|
15
|
+
const EPHEMERAL_CLOUD_URL_ENV = 'HEREYA_EPHEMERAL_CLOUD_URL';
|
|
4
16
|
/**
|
|
5
17
|
* Returns the active ephemeral token context, or `undefined` if no
|
|
6
18
|
* `withEphemeralToken` scope is currently in flight.
|
|
19
|
+
*
|
|
20
|
+
* Falls back to the `HEREYA_EPHEMERAL_TOKEN` env var when no async-local-
|
|
21
|
+
* storage context is set — that's how subprocesses (the credential helper
|
|
22
|
+
* grandchild, etc.) inherit the ephemeral context across process
|
|
23
|
+
* boundaries. The env var is set automatically by `withEphemeralToken`.
|
|
7
24
|
*/
|
|
8
25
|
export function getEphemeralToken() {
|
|
9
|
-
|
|
26
|
+
const fromAsyncStorage = storage.getStore();
|
|
27
|
+
if (fromAsyncStorage) {
|
|
28
|
+
return fromAsyncStorage;
|
|
29
|
+
}
|
|
30
|
+
const fromEnv = process.env[EPHEMERAL_TOKEN_ENV];
|
|
31
|
+
if (fromEnv) {
|
|
32
|
+
return {
|
|
33
|
+
cloudUrl: process.env[EPHEMERAL_CLOUD_URL_ENV] || undefined,
|
|
34
|
+
token: fromEnv,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
10
38
|
}
|
|
11
39
|
/**
|
|
12
40
|
* Run `fn` inside an ephemeral-token scope. While `fn` is executing,
|
|
13
|
-
* `getEphemeralToken()` returns the supplied token (and optional cloudUrl)
|
|
41
|
+
* `getEphemeralToken()` returns the supplied token (and optional cloudUrl),
|
|
42
|
+
* and `process.env.HEREYA_EPHEMERAL_TOKEN` is set so subprocesses inherit
|
|
43
|
+
* the same ephemeral context.
|
|
14
44
|
*
|
|
15
45
|
* Critical guarantees:
|
|
16
46
|
* - The token is held in-memory only. It is NEVER passed to the secret
|
|
17
47
|
* manager or written to disk.
|
|
18
48
|
* - After `fn` returns or throws, `getEphemeralToken()` returns `undefined`
|
|
19
|
-
* again.
|
|
49
|
+
* again and `HEREYA_EPHEMERAL_TOKEN` is restored to its prior value.
|
|
20
50
|
* - The cached backend in `src/backend/index.ts` is cleared before and after
|
|
21
51
|
* the scope so that a stale, persisted-credential-backed CloudBackend is
|
|
22
52
|
* never used while the scope is active, and the scope's in-memory backend
|
|
@@ -26,10 +56,33 @@ export function getEphemeralToken() {
|
|
|
26
56
|
export async function withEphemeralToken(token, fn, options) {
|
|
27
57
|
// Drop any cached backend so the next getBackend() call sees the ephemeral context.
|
|
28
58
|
clearBackend();
|
|
59
|
+
// Snapshot existing env-var values so we can restore them on exit.
|
|
60
|
+
const priorTokenEnv = process.env[EPHEMERAL_TOKEN_ENV];
|
|
61
|
+
const priorCloudUrlEnv = process.env[EPHEMERAL_CLOUD_URL_ENV];
|
|
62
|
+
process.env[EPHEMERAL_TOKEN_ENV] = token;
|
|
63
|
+
if (options?.cloudUrl) {
|
|
64
|
+
process.env[EPHEMERAL_CLOUD_URL_ENV] = options.cloudUrl;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
delete process.env[EPHEMERAL_CLOUD_URL_ENV];
|
|
68
|
+
}
|
|
29
69
|
try {
|
|
30
70
|
return await storage.run({ cloudUrl: options?.cloudUrl, token }, fn);
|
|
31
71
|
}
|
|
32
72
|
finally {
|
|
73
|
+
// Restore prior env-var state (no leakage between sibling invocations).
|
|
74
|
+
if (priorTokenEnv === undefined) {
|
|
75
|
+
delete process.env[EPHEMERAL_TOKEN_ENV];
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
process.env[EPHEMERAL_TOKEN_ENV] = priorTokenEnv;
|
|
79
|
+
}
|
|
80
|
+
if (priorCloudUrlEnv === undefined) {
|
|
81
|
+
delete process.env[EPHEMERAL_CLOUD_URL_ENV];
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
process.env[EPHEMERAL_CLOUD_URL_ENV] = priorCloudUrlEnv;
|
|
85
|
+
}
|
|
33
86
|
// Drop the in-memory backend bound to the ephemeral token before yielding control.
|
|
34
87
|
clearBackend();
|
|
35
88
|
}
|
package/dist/lib/hereya-token.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getActiveCloudAuth } from './active-cloud.js';
|
|
2
2
|
export const hereyaTokenUtils = {
|
|
3
3
|
async generateHereyaToken(description) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
if (!credentials) {
|
|
4
|
+
// Honors both `hereya login` (persisted) and an in-scope ephemeral
|
|
5
|
+
// `--token`. Note: workspace-scoped CLI tokens (kind:"cli") are
|
|
6
|
+
// intentionally rejected by the cloud's /api/personal-tokens route —
|
|
7
|
+
// only user-level tokens can mint long-lived personal tokens.
|
|
8
|
+
const auth = await getActiveCloudAuth();
|
|
9
|
+
if (!auth) {
|
|
11
10
|
return null;
|
|
12
11
|
}
|
|
13
12
|
const formData = new FormData();
|
|
14
13
|
formData.append('description', description);
|
|
15
14
|
formData.append('expiresInDays', '365');
|
|
16
|
-
const response = await fetch(`${
|
|
15
|
+
const response = await fetch(`${auth.cloudUrl}/api/personal-tokens`, {
|
|
17
16
|
body: formData,
|
|
18
17
|
headers: {
|
|
19
|
-
Authorization: `Bearer ${
|
|
18
|
+
Authorization: `Bearer ${auth.accessToken}`,
|
|
20
19
|
},
|
|
21
20
|
method: 'POST',
|
|
22
21
|
});
|
|
@@ -24,6 +23,6 @@ export const hereyaTokenUtils = {
|
|
|
24
23
|
return null;
|
|
25
24
|
}
|
|
26
25
|
const result = await response.json();
|
|
27
|
-
return { cloudUrl:
|
|
26
|
+
return { cloudUrl: auth.cloudUrl, token: result.data.token };
|
|
28
27
|
},
|
|
29
28
|
};
|
|
@@ -8,18 +8,6 @@ import { LocalPackageManager } from './local.js';
|
|
|
8
8
|
export declare const githubPackageManager: PackageManager;
|
|
9
9
|
export declare const localPackageManager: LocalPackageManager;
|
|
10
10
|
export declare function getPackageManager(protocol: string, logger?: Logger): Promise<PackageManager>;
|
|
11
|
-
/**
|
|
12
|
-
* Whether the cloud package registry should be consulted on this invocation.
|
|
13
|
-
*
|
|
14
|
-
* Returns true when either:
|
|
15
|
-
* - the persisted backend type (from `~/.hereya/backend.yaml`) is `Cloud`, or
|
|
16
|
-
* - an ephemeral `--token` is in scope (set via `withEphemeralToken`).
|
|
17
|
-
*
|
|
18
|
-
* The ephemeral-token branch is what makes `--token` work for fresh users who
|
|
19
|
-
* have never run `hereya login` — without it, the on-disk backend type stays
|
|
20
|
-
* `Local` and cloud-only packages fail to resolve.
|
|
21
|
-
*/
|
|
22
|
-
export declare function isCloudBackendActive(): Promise<boolean>;
|
|
23
11
|
export declare function resolvePackage(input: ResolvePackageInput): Promise<ResolvePackageOutput>;
|
|
24
12
|
export declare function getPackageCanonicalName(packageName: string): string;
|
|
25
13
|
export declare function downloadPackage(pkgUrl: string, destPath: string): Promise<string>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as yaml from 'yaml';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
import { BackendType, getBackend } from '../../backend/index.js';
|
|
3
|
+
import { getBackend } from '../../backend/index.js';
|
|
5
4
|
import { IacType } from '../../iac/common.js';
|
|
6
5
|
import { InfrastructureType } from '../../infrastructure/common.js';
|
|
7
|
-
import {
|
|
6
|
+
import { isCloudBackendActive } from '../active-cloud.js';
|
|
8
7
|
import { CloudPackageManager } from './cloud.js';
|
|
9
8
|
import { GitHubPackageManager } from './github.js';
|
|
10
9
|
import { LocalPackageManager } from './local.js';
|
|
@@ -21,23 +20,6 @@ export async function getPackageManager(protocol, logger) {
|
|
|
21
20
|
// Default to GitHub
|
|
22
21
|
return githubPackageManager;
|
|
23
22
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Whether the cloud package registry should be consulted on this invocation.
|
|
26
|
-
*
|
|
27
|
-
* Returns true when either:
|
|
28
|
-
* - the persisted backend type (from `~/.hereya/backend.yaml`) is `Cloud`, or
|
|
29
|
-
* - an ephemeral `--token` is in scope (set via `withEphemeralToken`).
|
|
30
|
-
*
|
|
31
|
-
* The ephemeral-token branch is what makes `--token` work for fresh users who
|
|
32
|
-
* have never run `hereya login` — without it, the on-disk backend type stays
|
|
33
|
-
* `Local` and cloud-only packages fail to resolve.
|
|
34
|
-
*/
|
|
35
|
-
export async function isCloudBackendActive() {
|
|
36
|
-
if (getEphemeralToken()) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
return (await getCurrentBackendType()) === BackendType.Cloud;
|
|
40
|
-
}
|
|
41
23
|
export async function resolvePackage(input) {
|
|
42
24
|
// Parse package spec to extract name and version
|
|
43
25
|
const { packageName, version } = parsePackageSpec(input.package);
|
package/oclif.manifest.json
CHANGED