hereya-cli 0.94.1 → 0.95.1
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 +66 -66
- package/dist/commands/devenv/install/index.js +20 -2
- package/dist/commands/devenv/sleep/index.js +21 -2
- package/dist/commands/devenv/uninstall/index.js +105 -0
- package/dist/lib/devenv-wake.d.ts +48 -3
- package/dist/lib/devenv-wake.js +152 -14
- package/dist/lib/hereya-token.d.ts +1 -0
- package/dist/lib/hereya-token.js +6 -1
- package/oclif.manifest.json +58 -58
- 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.
|
|
24
|
+
hereya-cli/0.95.1 linux-x64 node-v24.14.1
|
|
25
25
|
$ hereya --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ hereya COMMAND
|
|
@@ -129,7 +129,7 @@ EXAMPLES
|
|
|
129
129
|
$ hereya add cloudy/docker_postgres
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
132
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/add/index.ts)_
|
|
133
133
|
|
|
134
134
|
## `hereya app deploy NAME`
|
|
135
135
|
|
|
@@ -163,7 +163,7 @@ EXAMPLES
|
|
|
163
163
|
$ hereya app deploy my-org/my-app -w prod -p organizationId=org-123
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
_See code: [src/commands/app/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
166
|
+
_See code: [src/commands/app/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/app/deploy/index.ts)_
|
|
167
167
|
|
|
168
168
|
## `hereya app deployments NAME`
|
|
169
169
|
|
|
@@ -183,7 +183,7 @@ EXAMPLES
|
|
|
183
183
|
$ hereya app deployments my-org/my-app
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
_See code: [src/commands/app/deployments/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
186
|
+
_See code: [src/commands/app/deployments/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/app/deployments/index.ts)_
|
|
187
187
|
|
|
188
188
|
## `hereya app destroy NAME`
|
|
189
189
|
|
|
@@ -212,7 +212,7 @@ EXAMPLES
|
|
|
212
212
|
$ hereya app destroy my-org/my-app -w my-workspace
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
-
_See code: [src/commands/app/destroy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
215
|
+
_See code: [src/commands/app/destroy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/app/destroy/index.ts)_
|
|
216
216
|
|
|
217
217
|
## `hereya app env NAME [KEY]`
|
|
218
218
|
|
|
@@ -238,7 +238,7 @@ EXAMPLES
|
|
|
238
238
|
$ hereya app env my-org/my-app -w my-workspace DATABASE_URL
|
|
239
239
|
```
|
|
240
240
|
|
|
241
|
-
_See code: [src/commands/app/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
241
|
+
_See code: [src/commands/app/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/app/env/index.ts)_
|
|
242
242
|
|
|
243
243
|
## `hereya app list`
|
|
244
244
|
|
|
@@ -255,7 +255,7 @@ EXAMPLES
|
|
|
255
255
|
$ hereya app list
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
_See code: [src/commands/app/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
258
|
+
_See code: [src/commands/app/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/app/list/index.ts)_
|
|
259
259
|
|
|
260
260
|
## `hereya app new DIRNAME`
|
|
261
261
|
|
|
@@ -281,7 +281,7 @@ EXAMPLES
|
|
|
281
281
|
$ hereya app new ./my-app -n my-org/my-app --description "An ai-app-builder app"
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
_See code: [src/commands/app/new/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
284
|
+
_See code: [src/commands/app/new/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/app/new/index.ts)_
|
|
285
285
|
|
|
286
286
|
## `hereya app status NAME`
|
|
287
287
|
|
|
@@ -304,7 +304,7 @@ EXAMPLES
|
|
|
304
304
|
$ hereya app status my-org/my-app -w my-workspace
|
|
305
305
|
```
|
|
306
306
|
|
|
307
|
-
_See code: [src/commands/app/status/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
307
|
+
_See code: [src/commands/app/status/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/app/status/index.ts)_
|
|
308
308
|
|
|
309
309
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
310
310
|
|
|
@@ -329,7 +329,7 @@ EXAMPLES
|
|
|
329
329
|
$ hereya bootstrap local
|
|
330
330
|
```
|
|
331
331
|
|
|
332
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
332
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/bootstrap/index.ts)_
|
|
333
333
|
|
|
334
334
|
## `hereya clone PROJECT`
|
|
335
335
|
|
|
@@ -354,7 +354,7 @@ EXAMPLES
|
|
|
354
354
|
$ hereya clone myProject --chdir=./myProject
|
|
355
355
|
```
|
|
356
356
|
|
|
357
|
-
_See code: [src/commands/clone/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
357
|
+
_See code: [src/commands/clone/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/clone/index.ts)_
|
|
358
358
|
|
|
359
359
|
## `hereya config export-backend [FILE]`
|
|
360
360
|
|
|
@@ -376,7 +376,7 @@ EXAMPLES
|
|
|
376
376
|
$ hereya config export-backend ./path/to/export.json
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
379
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/config/export-backend/index.ts)_
|
|
380
380
|
|
|
381
381
|
## `hereya config get-backend`
|
|
382
382
|
|
|
@@ -393,7 +393,7 @@ EXAMPLES
|
|
|
393
393
|
$ hereya config get-backend
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
396
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/config/get-backend/index.ts)_
|
|
397
397
|
|
|
398
398
|
## `hereya config import-backend FILE`
|
|
399
399
|
|
|
@@ -413,7 +413,7 @@ EXAMPLES
|
|
|
413
413
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
416
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/config/import-backend/index.ts)_
|
|
417
417
|
|
|
418
418
|
## `hereya config use-backend TYPE`
|
|
419
419
|
|
|
@@ -435,7 +435,7 @@ EXAMPLES
|
|
|
435
435
|
$ hereya config use-backend local
|
|
436
436
|
```
|
|
437
437
|
|
|
438
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
438
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/config/use-backend/index.ts)_
|
|
439
439
|
|
|
440
440
|
## `hereya delete-state`
|
|
441
441
|
|
|
@@ -461,7 +461,7 @@ EXAMPLES
|
|
|
461
461
|
$ hereya delete-state --workspace staging
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
464
|
+
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/delete-state/index.ts)_
|
|
465
465
|
|
|
466
466
|
## `hereya deploy`
|
|
467
467
|
|
|
@@ -487,7 +487,7 @@ EXAMPLES
|
|
|
487
487
|
$ hereya deploy
|
|
488
488
|
```
|
|
489
489
|
|
|
490
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
490
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/deploy/index.ts)_
|
|
491
491
|
|
|
492
492
|
## `hereya devenv config`
|
|
493
493
|
|
|
@@ -507,7 +507,7 @@ EXAMPLES
|
|
|
507
507
|
$ hereya devenv config -w my-workspace
|
|
508
508
|
```
|
|
509
509
|
|
|
510
|
-
_See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
510
|
+
_See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/devenv/config/index.ts)_
|
|
511
511
|
|
|
512
512
|
## `hereya devenv install`
|
|
513
513
|
|
|
@@ -534,7 +534,7 @@ EXAMPLES
|
|
|
534
534
|
$ hereya devenv install -w my-workspace -p instanceType=t3.large
|
|
535
535
|
```
|
|
536
536
|
|
|
537
|
-
_See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
537
|
+
_See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/devenv/install/index.ts)_
|
|
538
538
|
|
|
539
539
|
## `hereya devenv project init PROJECT`
|
|
540
540
|
|
|
@@ -566,7 +566,7 @@ EXAMPLES
|
|
|
566
566
|
$ hereya devenv project init my-app -w my-workspace -t acme/node-starter -p region=us-east-1
|
|
567
567
|
```
|
|
568
568
|
|
|
569
|
-
_See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
569
|
+
_See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/devenv/project/init/index.ts)_
|
|
570
570
|
|
|
571
571
|
## `hereya devenv project uninit PROJECT`
|
|
572
572
|
|
|
@@ -592,7 +592,7 @@ EXAMPLES
|
|
|
592
592
|
$ hereya devenv project uninit my-app -w my-workspace --force
|
|
593
593
|
```
|
|
594
594
|
|
|
595
|
-
_See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
595
|
+
_See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/devenv/project/uninit/index.ts)_
|
|
596
596
|
|
|
597
597
|
## `hereya devenv sleep`
|
|
598
598
|
|
|
@@ -613,7 +613,7 @@ EXAMPLES
|
|
|
613
613
|
$ hereya devenv sleep -w my-workspace
|
|
614
614
|
```
|
|
615
615
|
|
|
616
|
-
_See code: [src/commands/devenv/sleep/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
616
|
+
_See code: [src/commands/devenv/sleep/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/devenv/sleep/index.ts)_
|
|
617
617
|
|
|
618
618
|
## `hereya devenv ssh`
|
|
619
619
|
|
|
@@ -633,7 +633,7 @@ EXAMPLES
|
|
|
633
633
|
$ hereya devenv ssh -w my-workspace
|
|
634
634
|
```
|
|
635
635
|
|
|
636
|
-
_See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
636
|
+
_See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/devenv/ssh/index.ts)_
|
|
637
637
|
|
|
638
638
|
## `hereya devenv uninstall`
|
|
639
639
|
|
|
@@ -654,7 +654,7 @@ EXAMPLES
|
|
|
654
654
|
$ hereya devenv uninstall -w my-workspace
|
|
655
655
|
```
|
|
656
656
|
|
|
657
|
-
_See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
657
|
+
_See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/devenv/uninstall/index.ts)_
|
|
658
658
|
|
|
659
659
|
## `hereya doc PACKAGE`
|
|
660
660
|
|
|
@@ -687,7 +687,7 @@ EXAMPLES
|
|
|
687
687
|
$ hereya doc my-package --no-doc
|
|
688
688
|
```
|
|
689
689
|
|
|
690
|
-
_See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
690
|
+
_See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/doc/index.ts)_
|
|
691
691
|
|
|
692
692
|
## `hereya docker run IMAGE`
|
|
693
693
|
|
|
@@ -718,7 +718,7 @@ EXAMPLES
|
|
|
718
718
|
$ hereya docker run myapp:latest -- --rm -v ./data:/data
|
|
719
719
|
```
|
|
720
720
|
|
|
721
|
-
_See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
721
|
+
_See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/docker/run/index.ts)_
|
|
722
722
|
|
|
723
723
|
## `hereya down`
|
|
724
724
|
|
|
@@ -745,7 +745,7 @@ EXAMPLES
|
|
|
745
745
|
$ hereya down
|
|
746
746
|
```
|
|
747
747
|
|
|
748
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
748
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/down/index.ts)_
|
|
749
749
|
|
|
750
750
|
## `hereya env [NAME]`
|
|
751
751
|
|
|
@@ -776,7 +776,7 @@ EXAMPLES
|
|
|
776
776
|
$ hereya env -w dev -l
|
|
777
777
|
```
|
|
778
778
|
|
|
779
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
779
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/env/index.ts)_
|
|
780
780
|
|
|
781
781
|
## `hereya env set [NAME]`
|
|
782
782
|
|
|
@@ -803,7 +803,7 @@ EXAMPLES
|
|
|
803
803
|
$ hereya env set FOO -v bar -w dev
|
|
804
804
|
```
|
|
805
805
|
|
|
806
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
806
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/env/set/index.ts)_
|
|
807
807
|
|
|
808
808
|
## `hereya executor start`
|
|
809
809
|
|
|
@@ -837,7 +837,7 @@ EXAMPLES
|
|
|
837
837
|
HEREYA_TOKEN=<token> HEREYA_CLOUD_URL=https://my-cloud.example.com hereya executor start -w my-workspace
|
|
838
838
|
```
|
|
839
839
|
|
|
840
|
-
_See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
840
|
+
_See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/executor/start/index.ts)_
|
|
841
841
|
|
|
842
842
|
## `hereya flow add PACKAGE`
|
|
843
843
|
|
|
@@ -875,7 +875,7 @@ EXAMPLES
|
|
|
875
875
|
$ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
|
|
876
876
|
```
|
|
877
877
|
|
|
878
|
-
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
878
|
+
_See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/add/index.ts)_
|
|
879
879
|
|
|
880
880
|
## `hereya flow docker run IMAGE`
|
|
881
881
|
|
|
@@ -905,7 +905,7 @@ EXAMPLES
|
|
|
905
905
|
$ hereya flow docker run --pin myapp:latest -- --rm
|
|
906
906
|
```
|
|
907
907
|
|
|
908
|
-
_See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
908
|
+
_See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/docker/run/index.ts)_
|
|
909
909
|
|
|
910
910
|
## `hereya flow down`
|
|
911
911
|
|
|
@@ -939,7 +939,7 @@ EXAMPLES
|
|
|
939
939
|
$ hereya flow down --pin
|
|
940
940
|
```
|
|
941
941
|
|
|
942
|
-
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
942
|
+
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/down/index.ts)_
|
|
943
943
|
|
|
944
944
|
## `hereya flow env [NAME]`
|
|
945
945
|
|
|
@@ -973,7 +973,7 @@ EXAMPLES
|
|
|
973
973
|
$ hereya flow env -l
|
|
974
974
|
```
|
|
975
975
|
|
|
976
|
-
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
976
|
+
_See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/env/index.ts)_
|
|
977
977
|
|
|
978
978
|
## `hereya flow provid PACKAGE`
|
|
979
979
|
|
|
@@ -1002,7 +1002,7 @@ EXAMPLES
|
|
|
1002
1002
|
$ hereya flow provid hereya/postgres --pin
|
|
1003
1003
|
```
|
|
1004
1004
|
|
|
1005
|
-
_See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1005
|
+
_See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/provid/index.ts)_
|
|
1006
1006
|
|
|
1007
1007
|
## `hereya flow remove PACKAGE`
|
|
1008
1008
|
|
|
@@ -1032,7 +1032,7 @@ EXAMPLES
|
|
|
1032
1032
|
$ hereya flow remove cloudy/docker_postgres --profile staging
|
|
1033
1033
|
```
|
|
1034
1034
|
|
|
1035
|
-
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1035
|
+
_See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/remove/index.ts)_
|
|
1036
1036
|
|
|
1037
1037
|
## `hereya flow run CMD`
|
|
1038
1038
|
|
|
@@ -1061,7 +1061,7 @@ EXAMPLES
|
|
|
1061
1061
|
$ hereya flow run --pin -- npm test
|
|
1062
1062
|
```
|
|
1063
1063
|
|
|
1064
|
-
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1064
|
+
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/run/index.ts)_
|
|
1065
1065
|
|
|
1066
1066
|
## `hereya flow up`
|
|
1067
1067
|
|
|
@@ -1095,7 +1095,7 @@ EXAMPLES
|
|
|
1095
1095
|
$ hereya flow up --pin
|
|
1096
1096
|
```
|
|
1097
1097
|
|
|
1098
|
-
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1098
|
+
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/flow/up/index.ts)_
|
|
1099
1099
|
|
|
1100
1100
|
## `hereya help [COMMAND]`
|
|
1101
1101
|
|
|
@@ -1152,7 +1152,7 @@ EXAMPLES
|
|
|
1152
1152
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
1153
1153
|
```
|
|
1154
1154
|
|
|
1155
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1155
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/import/index.ts)_
|
|
1156
1156
|
|
|
1157
1157
|
## `hereya import-repo PROJECT`
|
|
1158
1158
|
|
|
@@ -1182,7 +1182,7 @@ EXAMPLES
|
|
|
1182
1182
|
$ hereya import-repo myProject -w=dev -r=https://github.com/acme/api --clone --chdir=./api
|
|
1183
1183
|
```
|
|
1184
1184
|
|
|
1185
|
-
_See code: [src/commands/import-repo/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1185
|
+
_See code: [src/commands/import-repo/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/import-repo/index.ts)_
|
|
1186
1186
|
|
|
1187
1187
|
## `hereya init PROJECT`
|
|
1188
1188
|
|
|
@@ -1216,7 +1216,7 @@ EXAMPLES
|
|
|
1216
1216
|
$ hereya init myProject -w=dev -t=acme/node-starter -d=prod -p region=us-east-1
|
|
1217
1217
|
```
|
|
1218
1218
|
|
|
1219
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1219
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/init/index.ts)_
|
|
1220
1220
|
|
|
1221
1221
|
## `hereya list`
|
|
1222
1222
|
|
|
@@ -1233,7 +1233,7 @@ EXAMPLES
|
|
|
1233
1233
|
$ hereya list
|
|
1234
1234
|
```
|
|
1235
1235
|
|
|
1236
|
-
_See code: [src/commands/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1236
|
+
_See code: [src/commands/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/list/index.ts)_
|
|
1237
1237
|
|
|
1238
1238
|
## `hereya login [URL]`
|
|
1239
1239
|
|
|
@@ -1262,7 +1262,7 @@ EXAMPLES
|
|
|
1262
1262
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
1263
1263
|
```
|
|
1264
1264
|
|
|
1265
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1265
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/login/index.ts)_
|
|
1266
1266
|
|
|
1267
1267
|
## `hereya logout`
|
|
1268
1268
|
|
|
@@ -1279,7 +1279,7 @@ EXAMPLES
|
|
|
1279
1279
|
$ hereya logout
|
|
1280
1280
|
```
|
|
1281
1281
|
|
|
1282
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1282
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/logout/index.ts)_
|
|
1283
1283
|
|
|
1284
1284
|
## `hereya provid PACKAGE`
|
|
1285
1285
|
|
|
@@ -1307,7 +1307,7 @@ EXAMPLES
|
|
|
1307
1307
|
$ hereya provid hereya/postgres --workspace staging
|
|
1308
1308
|
```
|
|
1309
1309
|
|
|
1310
|
-
_See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1310
|
+
_See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/provid/index.ts)_
|
|
1311
1311
|
|
|
1312
1312
|
## `hereya publish`
|
|
1313
1313
|
|
|
@@ -1330,7 +1330,7 @@ EXAMPLES
|
|
|
1330
1330
|
$ hereya publish --chdir=/path/to/package
|
|
1331
1331
|
```
|
|
1332
1332
|
|
|
1333
|
-
_See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1333
|
+
_See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/publish/index.ts)_
|
|
1334
1334
|
|
|
1335
1335
|
## `hereya remove PACKAGE`
|
|
1336
1336
|
|
|
@@ -1358,7 +1358,7 @@ EXAMPLES
|
|
|
1358
1358
|
$ hereya remove cloudy/docker_postgres
|
|
1359
1359
|
```
|
|
1360
1360
|
|
|
1361
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1361
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/remove/index.ts)_
|
|
1362
1362
|
|
|
1363
1363
|
## `hereya run CMD`
|
|
1364
1364
|
|
|
@@ -1384,7 +1384,7 @@ EXAMPLES
|
|
|
1384
1384
|
$ hereya run -w uat -- node index.js
|
|
1385
1385
|
```
|
|
1386
1386
|
|
|
1387
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1387
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/run/index.ts)_
|
|
1388
1388
|
|
|
1389
1389
|
## `hereya search QUERY`
|
|
1390
1390
|
|
|
@@ -1415,7 +1415,7 @@ EXAMPLES
|
|
|
1415
1415
|
$ hereya search database --json
|
|
1416
1416
|
```
|
|
1417
1417
|
|
|
1418
|
-
_See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1418
|
+
_See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/search/index.ts)_
|
|
1419
1419
|
|
|
1420
1420
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
1421
1421
|
|
|
@@ -1440,7 +1440,7 @@ EXAMPLES
|
|
|
1440
1440
|
$ hereya unbootstrap local
|
|
1441
1441
|
```
|
|
1442
1442
|
|
|
1443
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1443
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/unbootstrap/index.ts)_
|
|
1444
1444
|
|
|
1445
1445
|
## `hereya undeploy`
|
|
1446
1446
|
|
|
@@ -1466,7 +1466,7 @@ EXAMPLES
|
|
|
1466
1466
|
$ hereya undeploy
|
|
1467
1467
|
```
|
|
1468
1468
|
|
|
1469
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1469
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/undeploy/index.ts)_
|
|
1470
1470
|
|
|
1471
1471
|
## `hereya uninit PROJECT`
|
|
1472
1472
|
|
|
@@ -1494,7 +1494,7 @@ EXAMPLES
|
|
|
1494
1494
|
$ hereya uninit myProject -w dev -p prodWorkspace=prod
|
|
1495
1495
|
```
|
|
1496
1496
|
|
|
1497
|
-
_See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1497
|
+
_See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/uninit/index.ts)_
|
|
1498
1498
|
|
|
1499
1499
|
## `hereya up`
|
|
1500
1500
|
|
|
@@ -1521,7 +1521,7 @@ EXAMPLES
|
|
|
1521
1521
|
$ hereya up
|
|
1522
1522
|
```
|
|
1523
1523
|
|
|
1524
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1524
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/up/index.ts)_
|
|
1525
1525
|
|
|
1526
1526
|
## `hereya update [VERSION]`
|
|
1527
1527
|
|
|
@@ -1543,7 +1543,7 @@ EXAMPLES
|
|
|
1543
1543
|
$ hereya update 0.75.0
|
|
1544
1544
|
```
|
|
1545
1545
|
|
|
1546
|
-
_See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1546
|
+
_See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/update/index.ts)_
|
|
1547
1547
|
|
|
1548
1548
|
## `hereya workspace create NAME`
|
|
1549
1549
|
|
|
@@ -1568,7 +1568,7 @@ EXAMPLES
|
|
|
1568
1568
|
$ hereya workspace create dev
|
|
1569
1569
|
```
|
|
1570
1570
|
|
|
1571
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1571
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/create/index.ts)_
|
|
1572
1572
|
|
|
1573
1573
|
## `hereya workspace delete NAME`
|
|
1574
1574
|
|
|
@@ -1588,7 +1588,7 @@ EXAMPLES
|
|
|
1588
1588
|
$ hereya workspace delete dev
|
|
1589
1589
|
```
|
|
1590
1590
|
|
|
1591
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1591
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/delete/index.ts)_
|
|
1592
1592
|
|
|
1593
1593
|
## `hereya workspace env [NAME]`
|
|
1594
1594
|
|
|
@@ -1614,7 +1614,7 @@ EXAMPLES
|
|
|
1614
1614
|
$ hereya workspace env myEnv -w dev
|
|
1615
1615
|
```
|
|
1616
1616
|
|
|
1617
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1617
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/env/index.ts)_
|
|
1618
1618
|
|
|
1619
1619
|
## `hereya workspace env set`
|
|
1620
1620
|
|
|
@@ -1638,7 +1638,7 @@ EXAMPLES
|
|
|
1638
1638
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
1639
1639
|
```
|
|
1640
1640
|
|
|
1641
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1641
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/env/set/index.ts)_
|
|
1642
1642
|
|
|
1643
1643
|
## `hereya workspace env unset`
|
|
1644
1644
|
|
|
@@ -1659,7 +1659,7 @@ EXAMPLES
|
|
|
1659
1659
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
1660
1660
|
```
|
|
1661
1661
|
|
|
1662
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1662
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/env/unset/index.ts)_
|
|
1663
1663
|
|
|
1664
1664
|
## `hereya workspace executor install`
|
|
1665
1665
|
|
|
@@ -1686,7 +1686,7 @@ DESCRIPTION
|
|
|
1686
1686
|
- ephemeral: ASG scaled to 0 with a broker Lambda + OIDC for on-demand wake.
|
|
1687
1687
|
```
|
|
1688
1688
|
|
|
1689
|
-
_See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1689
|
+
_See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/executor/install/index.ts)_
|
|
1690
1690
|
|
|
1691
1691
|
## `hereya workspace executor token`
|
|
1692
1692
|
|
|
@@ -1703,7 +1703,7 @@ DESCRIPTION
|
|
|
1703
1703
|
Generate a workspace-scoped executor token for the remote executor
|
|
1704
1704
|
```
|
|
1705
1705
|
|
|
1706
|
-
_See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1706
|
+
_See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/executor/token/index.ts)_
|
|
1707
1707
|
|
|
1708
1708
|
## `hereya workspace executor uninstall`
|
|
1709
1709
|
|
|
@@ -1727,7 +1727,7 @@ DESCRIPTION
|
|
|
1727
1727
|
controls log output.
|
|
1728
1728
|
```
|
|
1729
1729
|
|
|
1730
|
-
_See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1730
|
+
_See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/executor/uninstall/index.ts)_
|
|
1731
1731
|
|
|
1732
1732
|
## `hereya workspace install PACKAGE`
|
|
1733
1733
|
|
|
@@ -1754,7 +1754,7 @@ EXAMPLES
|
|
|
1754
1754
|
$ hereya workspace install hereya/aws-cognito
|
|
1755
1755
|
```
|
|
1756
1756
|
|
|
1757
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1757
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/install/index.ts)_
|
|
1758
1758
|
|
|
1759
1759
|
## `hereya workspace list`
|
|
1760
1760
|
|
|
@@ -1778,7 +1778,7 @@ EXAMPLES
|
|
|
1778
1778
|
$ hereya workspace list --org personal
|
|
1779
1779
|
```
|
|
1780
1780
|
|
|
1781
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1781
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/list/index.ts)_
|
|
1782
1782
|
|
|
1783
1783
|
## `hereya workspace set-profile PROFILE`
|
|
1784
1784
|
|
|
@@ -1802,7 +1802,7 @@ EXAMPLES
|
|
|
1802
1802
|
$ hereya workspace set-profile prod-profile -w production
|
|
1803
1803
|
```
|
|
1804
1804
|
|
|
1805
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1805
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/set-profile/index.ts)_
|
|
1806
1806
|
|
|
1807
1807
|
## `hereya workspace uninstall PACKAGE`
|
|
1808
1808
|
|
|
@@ -1829,5 +1829,5 @@ EXAMPLES
|
|
|
1829
1829
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
1830
1830
|
```
|
|
1831
1831
|
|
|
1832
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
1832
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.95.1/src/commands/workspace/uninstall/index.ts)_
|
|
1833
1833
|
<!-- commandsstop -->
|
|
@@ -85,8 +85,13 @@ export default class DevenvInstall extends Command {
|
|
|
85
85
|
workspace: flags.workspace,
|
|
86
86
|
});
|
|
87
87
|
if (token) {
|
|
88
|
-
ctx.tokenParams = {
|
|
88
|
+
ctx.tokenParams = {
|
|
89
|
+
hereyaCloudUrl: token.cloudUrl,
|
|
90
|
+
hereyaToken: token.token,
|
|
91
|
+
ownerUserId: token.ownerUserId,
|
|
92
|
+
};
|
|
89
93
|
ctx.tokenOwnerEmail = token.ownerEmail;
|
|
94
|
+
ctx.tokenOwnerUserId = token.ownerUserId;
|
|
90
95
|
}
|
|
91
96
|
},
|
|
92
97
|
title: 'Generating Hereya token for dev environment',
|
|
@@ -117,9 +122,22 @@ export default class DevenvInstall extends Command {
|
|
|
117
122
|
{
|
|
118
123
|
async task(ctx) {
|
|
119
124
|
const { env, metadata } = ctx.provisionOutput;
|
|
125
|
+
// Augment provision env with the recorded owner identity so we
|
|
126
|
+
// can gate later devenv ssh / sleep / uninstall commands by
|
|
127
|
+
// comparing the caller's JWT.sub against env.devEnvOwnerUserId.
|
|
128
|
+
// These are non-sensitive plain strings — the existing infra
|
|
129
|
+
// prefix added by addPackageToWorkspace resolves cleanly back
|
|
130
|
+
// to the raw value via resolveEnvValues.
|
|
131
|
+
const augmentedEnv = { ...env };
|
|
132
|
+
if (ctx.tokenOwnerUserId) {
|
|
133
|
+
augmentedEnv.devEnvOwnerUserId = ctx.tokenOwnerUserId;
|
|
134
|
+
}
|
|
135
|
+
if (ctx.tokenOwnerEmail) {
|
|
136
|
+
augmentedEnv.devEnvOwnerEmail = ctx.tokenOwnerEmail;
|
|
137
|
+
}
|
|
120
138
|
const backend = await getBackend();
|
|
121
139
|
const output = await backend.addPackageToWorkspace({
|
|
122
|
-
env,
|
|
140
|
+
env: augmentedEnv,
|
|
123
141
|
infra: metadata.infra,
|
|
124
142
|
package: ctx.provisionOutput.pkgName,
|
|
125
143
|
parameters: ctx.parameters,
|
|
@@ -2,6 +2,7 @@ import { Command, Flags } from '@oclif/core';
|
|
|
2
2
|
import { Listr, ListrLogger, ListrLogLevels } from 'listr2';
|
|
3
3
|
import { getBackend } from '../../../backend/index.js';
|
|
4
4
|
import { getExecutorForWorkspace } from '../../../executor/context.js';
|
|
5
|
+
import { assertDevenvOwner, getCallerAccessToken } from '../../../lib/devenv-wake.js';
|
|
5
6
|
import { getLogPath, isDebug, setDebug } from '../../../lib/log.js';
|
|
6
7
|
export default class DevenvSleep extends Command {
|
|
7
8
|
static description = 'Stop the dev environment instance for a workspace (lifecycle=on-demand only).';
|
|
@@ -41,15 +42,33 @@ export default class DevenvSleep extends Command {
|
|
|
41
42
|
if (!env.devEnvWakeUrl) {
|
|
42
43
|
throw new Error(`Workspace ${flags.workspace} was not provisioned with lifecycle=on-demand; nothing to sleep.`);
|
|
43
44
|
}
|
|
45
|
+
// Resolve the caller's hereya access token. Sleep is owner-
|
|
46
|
+
// only — admins/owners don't need to sleep someone else's
|
|
47
|
+
// box (they redeploy). The wake-broker /sleep endpoint
|
|
48
|
+
// server-enforces this too.
|
|
49
|
+
const accessToken = await getCallerAccessToken();
|
|
50
|
+
// Client-side owner gate. On legacy devenvs (no
|
|
51
|
+
// `devEnvOwnerUserId`) emits a warning and proceeds.
|
|
52
|
+
if (accessToken) {
|
|
53
|
+
assertDevenvOwner(env, accessToken);
|
|
54
|
+
}
|
|
44
55
|
ctx.wakeUrl = env.devEnvWakeUrl;
|
|
45
|
-
|
|
56
|
+
// Auth-token selection mirrors `resolveDevenvSshHost` in
|
|
57
|
+
// devenv-wake.ts: prefer the access token (fresh install,
|
|
58
|
+
// dev-env-aws ≥ 0.10.0); fall back to the static
|
|
59
|
+
// `devEnvWakeToken` when the workspace is legacy
|
|
60
|
+
// (devEnvOwnerUserId absent — dev-env-aws ≤ 0.9.x).
|
|
61
|
+
ctx.authToken = env.devEnvOwnerUserId ? accessToken ?? undefined : env.devEnvWakeToken;
|
|
62
|
+
if (!ctx.authToken) {
|
|
63
|
+
throw new Error('No bearer available for /sleep. Run `hereya cloud login` to refresh credentials.');
|
|
64
|
+
}
|
|
46
65
|
},
|
|
47
66
|
title: `Loading workspace ${flags.workspace}`,
|
|
48
67
|
},
|
|
49
68
|
{
|
|
50
69
|
async task(ctx) {
|
|
51
70
|
const response = await fetch(`${ctx.wakeUrl}/sleep`, {
|
|
52
|
-
headers: { Authorization: `Bearer ${ctx.
|
|
71
|
+
headers: { Authorization: `Bearer ${ctx.authToken}` },
|
|
53
72
|
method: 'POST',
|
|
54
73
|
});
|
|
55
74
|
if (!response.ok) {
|
|
@@ -1,9 +1,64 @@
|
|
|
1
1
|
import { Command, Flags } from '@oclif/core';
|
|
2
2
|
import { Listr, ListrLogger, ListrLogLevels } from 'listr2';
|
|
3
|
+
import { getCloudCredentials, loadBackendConfig } from '../../../backend/config.js';
|
|
3
4
|
import { getBackend } from '../../../backend/index.js';
|
|
4
5
|
import { getExecutorForWorkspace } from '../../../executor/context.js';
|
|
6
|
+
import { decodeJwtPayload } from '../../../lib/devenv-wake.js';
|
|
5
7
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../../lib/log.js';
|
|
8
|
+
import { extractOrgPrefix } from '../../../lib/org-utils.js';
|
|
6
9
|
import { delay } from '../../../lib/shell.js';
|
|
10
|
+
/**
|
|
11
|
+
* Look up the calling user's role in the workspace's organisation.
|
|
12
|
+
*
|
|
13
|
+
* Returns null when no cloud backend is configured (local-only setup), when
|
|
14
|
+
* the workspace name has no org prefix, or when the cloud call fails for any
|
|
15
|
+
* reason. Callers must treat null as "couldn't determine — fall back to
|
|
16
|
+
* legacy behaviour".
|
|
17
|
+
*/
|
|
18
|
+
async function getCallerRoleInWorkspaceOrg(workspaceName) {
|
|
19
|
+
const backendConfig = await loadBackendConfig();
|
|
20
|
+
if (!backendConfig.cloud)
|
|
21
|
+
return null;
|
|
22
|
+
const { org: orgSlug } = extractOrgPrefix(workspaceName);
|
|
23
|
+
if (!orgSlug)
|
|
24
|
+
return null;
|
|
25
|
+
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
26
|
+
if (!credentials)
|
|
27
|
+
return null;
|
|
28
|
+
const url = `${backendConfig.cloud.url}/api/organizations/${encodeURIComponent(orgSlug)}/me`;
|
|
29
|
+
// The cloud accepts either an org slug or an org id at `:id`. We pass the
|
|
30
|
+
// slug we extracted from the workspace name; the cloud route resolves it
|
|
31
|
+
// server-side. See `hereya-cloud/app/routes/api/organizations/$id.me.ts`.
|
|
32
|
+
let response;
|
|
33
|
+
try {
|
|
34
|
+
response = await fetch(url, {
|
|
35
|
+
headers: { Authorization: `Bearer ${credentials.accessToken}` },
|
|
36
|
+
method: 'GET',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (!response.ok)
|
|
43
|
+
return null;
|
|
44
|
+
const body = (await response.json().catch(() => null));
|
|
45
|
+
const role = body?.role;
|
|
46
|
+
if (role === 'OWNER' || role === 'ADMIN' || role === 'DEVELOPER' || role === 'MEMBER') {
|
|
47
|
+
return role;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Workspace env values are stored prefixed (`local:foo` / `aws:foo`). Strip
|
|
53
|
+
* the prefix to recover the plain string. Used for the owner identity fields
|
|
54
|
+
* (`devEnvOwnerUserId`, `devEnvOwnerEmail`) which are plain strings — no
|
|
55
|
+
* resolver layer.
|
|
56
|
+
*/
|
|
57
|
+
function stripInfraPrefix(value) {
|
|
58
|
+
if (!value)
|
|
59
|
+
return value;
|
|
60
|
+
return value.split(':').slice(1).join(':') || value;
|
|
61
|
+
}
|
|
7
62
|
export default class DevenvUninstall extends Command {
|
|
8
63
|
static description = 'Destroy and remove the dev environment from a workspace.';
|
|
9
64
|
static examples = ['<%= config.bin %> <%= command.id %> -w my-workspace'];
|
|
@@ -48,6 +103,56 @@ export default class DevenvUninstall extends Command {
|
|
|
48
103
|
},
|
|
49
104
|
title: `Loading workspace ${flags.workspace}`,
|
|
50
105
|
},
|
|
106
|
+
{
|
|
107
|
+
async task() {
|
|
108
|
+
// Owner-or-admin gate. Fast-path resolves the caller's
|
|
109
|
+
// identity from the workspace env's `devEnvOwnerUserId`; if
|
|
110
|
+
// that's missing the workspace is legacy (Phase 2 or
|
|
111
|
+
// earlier) and we allow with a warning. If the caller is
|
|
112
|
+
// the recorded owner, allow. Otherwise consult the cloud
|
|
113
|
+
// for org role.
|
|
114
|
+
const backend = await getBackend();
|
|
115
|
+
const envOutput = await backend.getWorkspaceEnv({ workspace: flags.workspace });
|
|
116
|
+
if (!envOutput.success) {
|
|
117
|
+
// No env / can't reach — let later steps surface the
|
|
118
|
+
// canonical error rather than gating here.
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const rawEnv = envOutput.env;
|
|
122
|
+
const ownerUserId = stripInfraPrefix(rawEnv.devEnvOwnerUserId);
|
|
123
|
+
const ownerEmail = stripInfraPrefix(rawEnv.devEnvOwnerEmail);
|
|
124
|
+
if (!ownerUserId) {
|
|
125
|
+
process.stderr.write('warning: this devenv predates owner-binding; allowing uninstall without role check.\n');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const backendConfig = await loadBackendConfig();
|
|
129
|
+
if (!backendConfig.cloud) {
|
|
130
|
+
// No cloud — local-only flow, no role concept. Allow.
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
134
|
+
if (!credentials) {
|
|
135
|
+
throw new Error('No hereya cloud credentials found. Run `hereya cloud login` to authenticate.');
|
|
136
|
+
}
|
|
137
|
+
let callerSub;
|
|
138
|
+
try {
|
|
139
|
+
callerSub = decodeJwtPayload(credentials.accessToken).sub;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
throw new Error('Could not decode hereya access token. Run `hereya cloud login` to refresh credentials.');
|
|
143
|
+
}
|
|
144
|
+
if (callerSub === ownerUserId) {
|
|
145
|
+
return; // owner — allow
|
|
146
|
+
}
|
|
147
|
+
const role = await getCallerRoleInWorkspaceOrg(flags.workspace);
|
|
148
|
+
if (role === 'OWNER' || role === 'ADMIN') {
|
|
149
|
+
return; // org admin override — allow
|
|
150
|
+
}
|
|
151
|
+
const ownerLabel = ownerEmail || ownerUserId;
|
|
152
|
+
throw new Error(`This devenv is bound to ${ownerLabel}; only they or an OWNER/ADMIN of the org can uninstall it.`);
|
|
153
|
+
},
|
|
154
|
+
title: 'Verifying uninstall permissions',
|
|
155
|
+
},
|
|
51
156
|
{
|
|
52
157
|
async task(ctx) {
|
|
53
158
|
const parameters = {
|
|
@@ -1,13 +1,58 @@
|
|
|
1
|
+
interface JwtPayload {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
email?: string;
|
|
4
|
+
sub?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Decode the payload of an HS256 JWT without verifying the signature.
|
|
8
|
+
*
|
|
9
|
+
* The CLI uses this to read `sub` (caller userId) and `email` for the
|
|
10
|
+
* client-side ownership pre-check. Server-side verification still happens at
|
|
11
|
+
* the cloud (when the CLI calls cloud APIs) and at the wake broker (which
|
|
12
|
+
* delegates to /api/auth/verify-token).
|
|
13
|
+
*/
|
|
14
|
+
export declare function decodeJwtPayload(token: string): JwtPayload;
|
|
15
|
+
/**
|
|
16
|
+
* Client-side gate ensuring only the recorded on-behalf-of user can interact
|
|
17
|
+
* with a devenv (ssh, sleep). The wake broker server-side check is the
|
|
18
|
+
* authoritative gate; this is a fast UX layer that errors before any network
|
|
19
|
+
* call.
|
|
20
|
+
*
|
|
21
|
+
* Throws on mismatch. Returns silently on owner match. For legacy devenvs (no
|
|
22
|
+
* `devEnvOwnerUserId` recorded) emits a one-line warning to stderr and allows.
|
|
23
|
+
*/
|
|
24
|
+
export declare function assertDevenvOwner(env: Record<string, string>, accessToken: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the caller's hereya access token from the configured cloud backend.
|
|
27
|
+
* Returns null when no cloud backend is configured (local-only setup, never
|
|
28
|
+
* has on-demand devenvs in practice).
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCallerAccessToken(): Promise<null | string>;
|
|
1
31
|
/**
|
|
2
32
|
* Resolve the SSH host to use for a devenv workspace.
|
|
3
33
|
*
|
|
4
|
-
* - On-demand devenvs (devEnvWakeUrl
|
|
5
|
-
*
|
|
6
|
-
*
|
|
34
|
+
* - On-demand devenvs (devEnvWakeUrl set): wake the instance if it's not
|
|
35
|
+
* already running, poll the broker until it reports a public IP, probe TCP
|
|
36
|
+
* :22 until sshd accepts connections, then return the fresh IP.
|
|
7
37
|
* - Always-on devenvs (no wake URL): return the cached devEnvSshHostDns or
|
|
8
38
|
* devEnvSshHost from workspace env unchanged. No wake, no probe.
|
|
9
39
|
*
|
|
40
|
+
* Owner gating:
|
|
41
|
+
* - `assertDevenvOwner` runs first (errors immediately on non-owner — even
|
|
42
|
+
* before checking for the SSH key).
|
|
43
|
+
* - If the cloud filtered out `devEnvSshPrivateKey` for the caller, this
|
|
44
|
+
* function also throws — defence in depth in case `assertDevenvOwner`
|
|
45
|
+
* accidentally passes (e.g. legacy workspace with a stale ownerUserId set
|
|
46
|
+
* by a manual edit).
|
|
47
|
+
*
|
|
48
|
+
* Wake auth:
|
|
49
|
+
* - Fresh installs (devEnvOwnerUserId present): bearer = caller's access
|
|
50
|
+
* token. Broker authorizer verifies via `/api/auth/verify-token`.
|
|
51
|
+
* - Legacy installs (devEnvOwnerUserId absent, devEnvWakeToken present):
|
|
52
|
+
* bearer = `devEnvWakeToken`. Old broker accepts the static secret.
|
|
53
|
+
*
|
|
10
54
|
* The Listr UI ("Waking dev environment", "Waiting for SSH to accept
|
|
11
55
|
* connections") only renders on the on-demand path.
|
|
12
56
|
*/
|
|
13
57
|
export declare function resolveDevenvSshHost(env: Record<string, string>): Promise<string>;
|
|
58
|
+
export {};
|
package/dist/lib/devenv-wake.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Listr } from 'listr2';
|
|
2
|
+
import { Buffer } from 'node:buffer';
|
|
2
3
|
import { Socket } from 'node:net';
|
|
4
|
+
import { getCloudCredentials, loadBackendConfig } from '../backend/config.js';
|
|
3
5
|
// Polling cadence and overall timeout for the wake broker. Overridable via env
|
|
4
6
|
// vars purely to keep tests fast — the defaults are the production values.
|
|
5
7
|
function getWakePollIntervalMs() {
|
|
@@ -58,9 +60,87 @@ async function waitForSshReady(host, port, totalTimeoutMs, attemptIntervalMs) {
|
|
|
58
60
|
}
|
|
59
61
|
throw new Error(`SSH at ${host}:${port} did not accept connections within ${totalTimeoutMs / 1000}s`);
|
|
60
62
|
}
|
|
61
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Decode the payload of an HS256 JWT without verifying the signature.
|
|
65
|
+
*
|
|
66
|
+
* The CLI uses this to read `sub` (caller userId) and `email` for the
|
|
67
|
+
* client-side ownership pre-check. Server-side verification still happens at
|
|
68
|
+
* the cloud (when the CLI calls cloud APIs) and at the wake broker (which
|
|
69
|
+
* delegates to /api/auth/verify-token).
|
|
70
|
+
*/
|
|
71
|
+
export function decodeJwtPayload(token) {
|
|
72
|
+
const parts = token.split('.');
|
|
73
|
+
if (parts.length < 2) {
|
|
74
|
+
throw new Error('malformed access token');
|
|
75
|
+
}
|
|
76
|
+
const payloadSegment = parts[1];
|
|
77
|
+
// base64url decode — Node 20+ supports 'base64url' directly.
|
|
78
|
+
const json = Buffer.from(payloadSegment, 'base64url').toString('utf8');
|
|
79
|
+
return JSON.parse(json);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Client-side gate ensuring only the recorded on-behalf-of user can interact
|
|
83
|
+
* with a devenv (ssh, sleep). The wake broker server-side check is the
|
|
84
|
+
* authoritative gate; this is a fast UX layer that errors before any network
|
|
85
|
+
* call.
|
|
86
|
+
*
|
|
87
|
+
* Throws on mismatch. Returns silently on owner match. For legacy devenvs (no
|
|
88
|
+
* `devEnvOwnerUserId` recorded) emits a one-line warning to stderr and allows.
|
|
89
|
+
*/
|
|
90
|
+
export function assertDevenvOwner(env, accessToken) {
|
|
91
|
+
const ownerUserId = env.devEnvOwnerUserId;
|
|
92
|
+
if (!ownerUserId) {
|
|
93
|
+
if (env.devEnvWakeUrl) {
|
|
94
|
+
// Phase 2 / 0.94.x on-demand devenv: the install hit the on-behalf-of
|
|
95
|
+
// endpoint so the baked-in token is some specific user's identity, but
|
|
96
|
+
// this CLI version didn't yet record `devEnvOwnerUserId` in workspace
|
|
97
|
+
// env. The legacy warn-and-allow fallback would silently let any
|
|
98
|
+
// workspace member SSH in as the on-behalf-of user. Refuse instead.
|
|
99
|
+
throw new Error('This devenv was installed by an older CLI version and is missing its owner binding.\n' +
|
|
100
|
+
'For security, access is blocked. Ask an OWNER or ADMIN to reinstall:\n' +
|
|
101
|
+
' hereya devenv uninstall -w <workspace>\n' +
|
|
102
|
+
' hereya devenv install -w <workspace> [--on-behalf-of <email>]');
|
|
103
|
+
}
|
|
104
|
+
// True always-on legacy devenv (no wake URL): predates Phase 2 entirely.
|
|
105
|
+
// The token in the box is the installer's identity, no on-behalf-of
|
|
106
|
+
// binding to enforce. Warn + allow.
|
|
107
|
+
process.stderr.write('warning: this devenv predates owner-binding; uninstall + reinstall to enable per-user access.\n');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
let payload;
|
|
111
|
+
try {
|
|
112
|
+
payload = decodeJwtPayload(accessToken);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
throw new Error('Could not decode hereya access token. Run `hereya cloud login` to refresh credentials.');
|
|
116
|
+
}
|
|
117
|
+
if (payload.sub === ownerUserId) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const ownerLabel = env.devEnvOwnerEmail || ownerUserId;
|
|
121
|
+
const callerLabel = payload.email ? `as ${payload.email}` : 'as your account';
|
|
122
|
+
throw new Error(`This devenv is bound to ${ownerLabel}.\n` +
|
|
123
|
+
`You're signed in ${callerLabel}. Only the owner can connect.\n` +
|
|
124
|
+
`To re-target the devenv, ask an OWNER or ADMIN to run:\n` +
|
|
125
|
+
` hereya devenv uninstall -w <workspace>\n` +
|
|
126
|
+
` hereya devenv install -w <workspace> --on-behalf-of <new-email>`);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Resolve the caller's hereya access token from the configured cloud backend.
|
|
130
|
+
* Returns null when no cloud backend is configured (local-only setup, never
|
|
131
|
+
* has on-demand devenvs in practice).
|
|
132
|
+
*/
|
|
133
|
+
export async function getCallerAccessToken() {
|
|
134
|
+
const backendConfig = await loadBackendConfig();
|
|
135
|
+
if (!backendConfig.cloud) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const credentials = await getCloudCredentials(backendConfig.cloud.clientId);
|
|
139
|
+
return credentials?.accessToken ?? null;
|
|
140
|
+
}
|
|
141
|
+
async function fetchStatus(wakeUrl, authToken) {
|
|
62
142
|
const response = await fetch(`${wakeUrl}/status`, {
|
|
63
|
-
headers: { Authorization: `Bearer ${
|
|
143
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
|
64
144
|
method: 'GET',
|
|
65
145
|
});
|
|
66
146
|
if (!response.ok) {
|
|
@@ -69,9 +149,9 @@ async function fetchStatus(wakeUrl, wakeToken) {
|
|
|
69
149
|
}
|
|
70
150
|
return response.json();
|
|
71
151
|
}
|
|
72
|
-
async function postWake(wakeUrl,
|
|
152
|
+
async function postWake(wakeUrl, authToken) {
|
|
73
153
|
const response = await fetch(`${wakeUrl}/wake`, {
|
|
74
|
-
headers: { Authorization: `Bearer ${
|
|
154
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
|
75
155
|
method: 'POST',
|
|
76
156
|
});
|
|
77
157
|
if (!response.ok) {
|
|
@@ -80,7 +160,18 @@ async function postWake(wakeUrl, wakeToken) {
|
|
|
80
160
|
}
|
|
81
161
|
return response.json();
|
|
82
162
|
}
|
|
83
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Wake the on-demand devenv via the broker and probe sshd readiness.
|
|
165
|
+
*
|
|
166
|
+
* `authToken` is whichever bearer the broker accepts:
|
|
167
|
+
* - Fresh installs (dev-env-aws ≥ 0.10.0): the caller's hereya access token.
|
|
168
|
+
* The broker authorizer Lambda calls `/api/auth/verify-token` on hereya-cloud
|
|
169
|
+
* and compares the verified userId to its OWNER_USER_ID env.
|
|
170
|
+
* - Legacy installs (dev-env-aws ≤ 0.9.x): the static `devEnvWakeToken`
|
|
171
|
+
* Secrets Manager secret. Detected by `resolveDevenvSshHost` via the
|
|
172
|
+
* absence of `devEnvOwnerUserId` in workspace env.
|
|
173
|
+
*/
|
|
174
|
+
async function wakeAndProbe(wakeUrl, authToken) {
|
|
84
175
|
const pollIntervalMs = getWakePollIntervalMs();
|
|
85
176
|
const timeoutMs = getWakeTimeoutMs();
|
|
86
177
|
const sshReadyTimeoutMs = getSshReadyTimeoutMs();
|
|
@@ -88,12 +179,12 @@ async function wakeAndProbe(wakeUrl, wakeToken) {
|
|
|
88
179
|
const task = new Listr([
|
|
89
180
|
{
|
|
90
181
|
async task(ctx) {
|
|
91
|
-
const initial = await fetchStatus(wakeUrl,
|
|
182
|
+
const initial = await fetchStatus(wakeUrl, authToken);
|
|
92
183
|
if (initial.state === 'running' && initial.host) {
|
|
93
184
|
ctx.host = initial.host;
|
|
94
185
|
return;
|
|
95
186
|
}
|
|
96
|
-
await postWake(wakeUrl,
|
|
187
|
+
await postWake(wakeUrl, authToken);
|
|
97
188
|
const start = Date.now();
|
|
98
189
|
let done = false;
|
|
99
190
|
while (!done) {
|
|
@@ -103,7 +194,7 @@ async function wakeAndProbe(wakeUrl, wakeToken) {
|
|
|
103
194
|
// eslint-disable-next-line no-await-in-loop
|
|
104
195
|
await sleep(pollIntervalMs);
|
|
105
196
|
// eslint-disable-next-line no-await-in-loop
|
|
106
|
-
const status = await fetchStatus(wakeUrl,
|
|
197
|
+
const status = await fetchStatus(wakeUrl, authToken);
|
|
107
198
|
if (status.state === 'running' && status.host) {
|
|
108
199
|
ctx.host = status.host;
|
|
109
200
|
done = true;
|
|
@@ -129,20 +220,67 @@ async function wakeAndProbe(wakeUrl, wakeToken) {
|
|
|
129
220
|
/**
|
|
130
221
|
* Resolve the SSH host to use for a devenv workspace.
|
|
131
222
|
*
|
|
132
|
-
* - On-demand devenvs (devEnvWakeUrl
|
|
133
|
-
*
|
|
134
|
-
*
|
|
223
|
+
* - On-demand devenvs (devEnvWakeUrl set): wake the instance if it's not
|
|
224
|
+
* already running, poll the broker until it reports a public IP, probe TCP
|
|
225
|
+
* :22 until sshd accepts connections, then return the fresh IP.
|
|
135
226
|
* - Always-on devenvs (no wake URL): return the cached devEnvSshHostDns or
|
|
136
227
|
* devEnvSshHost from workspace env unchanged. No wake, no probe.
|
|
137
228
|
*
|
|
229
|
+
* Owner gating:
|
|
230
|
+
* - `assertDevenvOwner` runs first (errors immediately on non-owner — even
|
|
231
|
+
* before checking for the SSH key).
|
|
232
|
+
* - If the cloud filtered out `devEnvSshPrivateKey` for the caller, this
|
|
233
|
+
* function also throws — defence in depth in case `assertDevenvOwner`
|
|
234
|
+
* accidentally passes (e.g. legacy workspace with a stale ownerUserId set
|
|
235
|
+
* by a manual edit).
|
|
236
|
+
*
|
|
237
|
+
* Wake auth:
|
|
238
|
+
* - Fresh installs (devEnvOwnerUserId present): bearer = caller's access
|
|
239
|
+
* token. Broker authorizer verifies via `/api/auth/verify-token`.
|
|
240
|
+
* - Legacy installs (devEnvOwnerUserId absent, devEnvWakeToken present):
|
|
241
|
+
* bearer = `devEnvWakeToken`. Old broker accepts the static secret.
|
|
242
|
+
*
|
|
138
243
|
* The Listr UI ("Waking dev environment", "Waiting for SSH to accept
|
|
139
244
|
* connections") only renders on the on-demand path.
|
|
140
245
|
*/
|
|
141
246
|
export async function resolveDevenvSshHost(env) {
|
|
142
247
|
const wakeUrl = env.devEnvWakeUrl;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
248
|
+
if (wakeUrl) {
|
|
249
|
+
const accessToken = await getCallerAccessToken();
|
|
250
|
+
const isLegacy = !env.devEnvOwnerUserId;
|
|
251
|
+
// Fresh installs (devEnvOwnerUserId present) require a hereya access
|
|
252
|
+
// token: the broker authorizer verifies it against /api/auth/verify-token
|
|
253
|
+
// and the client-side gate compares its `sub` to the recorded owner.
|
|
254
|
+
if (!isLegacy && !accessToken) {
|
|
255
|
+
throw new Error('No hereya cloud credentials found. Run `hereya cloud login` to authenticate.');
|
|
256
|
+
}
|
|
257
|
+
// Client-side owner gate. Throws on mismatch, warns on legacy. Skipped
|
|
258
|
+
// when there's no accessToken AND the workspace is legacy — the legacy
|
|
259
|
+
// path uses the static wake token and predates owner binding entirely.
|
|
260
|
+
if (accessToken) {
|
|
261
|
+
assertDevenvOwner(env, accessToken);
|
|
262
|
+
}
|
|
263
|
+
// Defence in depth: if the cloud filtered out the SSH private key for a
|
|
264
|
+
// non-owner, the assertDevenvOwner check would also have failed in normal
|
|
265
|
+
// operation. But if a stale local cache or manual edit somehow lands us
|
|
266
|
+
// here without the key, fail with the same friendly message instead of
|
|
267
|
+
// letting ssh later die with a confusing error. Skipped on legacy
|
|
268
|
+
// workspaces where the cloud doesn't filter (no `devEnvOwnerUserId` set).
|
|
269
|
+
if (!isLegacy && !env.devEnvSshPrivateKey) {
|
|
270
|
+
const ownerLabel = env.devEnvOwnerEmail || env.devEnvOwnerUserId || 'someone else';
|
|
271
|
+
throw new Error(`This devenv is bound to ${ownerLabel}; the SSH private key was not provided to your account. ` +
|
|
272
|
+
`Only the owner can connect.`);
|
|
273
|
+
}
|
|
274
|
+
// Auth-token selection: prefer access token (fresh install). Fall back to
|
|
275
|
+
// the static wake token only when the workspace env lacks the new
|
|
276
|
+
// `devEnvOwnerUserId` AND has a legacy `devEnvWakeToken` (dev-env-aws
|
|
277
|
+
// 0.9.x). This makes pre-Phase-3 devenvs continue to work until they're
|
|
278
|
+
// reinstalled.
|
|
279
|
+
const authToken = isLegacy ? env.devEnvWakeToken : accessToken;
|
|
280
|
+
if (!authToken) {
|
|
281
|
+
throw new Error('devEnvWakeToken must be set for legacy devenvs without devEnvOwnerUserId');
|
|
282
|
+
}
|
|
283
|
+
return wakeAndProbe(wakeUrl, authToken);
|
|
146
284
|
}
|
|
147
285
|
const cachedDns = env.devEnvSshHostDns;
|
|
148
286
|
const cachedHost = env.devEnvSshHost;
|
package/dist/lib/hereya-token.js
CHANGED
|
@@ -46,7 +46,12 @@ export const hereyaTokenUtils = {
|
|
|
46
46
|
throw new Error(`Failed to generate Hereya token (HTTP ${response.status}): ${detail}`);
|
|
47
47
|
}
|
|
48
48
|
const result = (await response.json());
|
|
49
|
-
return {
|
|
49
|
+
return {
|
|
50
|
+
cloudUrl: url,
|
|
51
|
+
ownerEmail: result.ownerEmail,
|
|
52
|
+
ownerUserId: result.ownerUserId,
|
|
53
|
+
token: result.token,
|
|
54
|
+
};
|
|
50
55
|
},
|
|
51
56
|
/**
|
|
52
57
|
* Issue a plain personal Hereya token via POST /api/personal-tokens.
|
package/oclif.manifest.json
CHANGED
|
@@ -688,6 +688,30 @@
|
|
|
688
688
|
"index.js"
|
|
689
689
|
]
|
|
690
690
|
},
|
|
691
|
+
"logout": {
|
|
692
|
+
"aliases": [],
|
|
693
|
+
"args": {},
|
|
694
|
+
"description": "Logout from Hereya Cloud",
|
|
695
|
+
"examples": [
|
|
696
|
+
"<%= config.bin %> <%= command.id %>"
|
|
697
|
+
],
|
|
698
|
+
"flags": {},
|
|
699
|
+
"hasDynamicHelp": false,
|
|
700
|
+
"hiddenAliases": [],
|
|
701
|
+
"id": "logout",
|
|
702
|
+
"pluginAlias": "hereya-cli",
|
|
703
|
+
"pluginName": "hereya-cli",
|
|
704
|
+
"pluginType": "core",
|
|
705
|
+
"strict": true,
|
|
706
|
+
"enableJsonFlag": false,
|
|
707
|
+
"isESM": true,
|
|
708
|
+
"relativePath": [
|
|
709
|
+
"dist",
|
|
710
|
+
"commands",
|
|
711
|
+
"logout",
|
|
712
|
+
"index.js"
|
|
713
|
+
]
|
|
714
|
+
},
|
|
691
715
|
"login": {
|
|
692
716
|
"aliases": [],
|
|
693
717
|
"args": {
|
|
@@ -732,30 +756,6 @@
|
|
|
732
756
|
"index.js"
|
|
733
757
|
]
|
|
734
758
|
},
|
|
735
|
-
"logout": {
|
|
736
|
-
"aliases": [],
|
|
737
|
-
"args": {},
|
|
738
|
-
"description": "Logout from Hereya Cloud",
|
|
739
|
-
"examples": [
|
|
740
|
-
"<%= config.bin %> <%= command.id %>"
|
|
741
|
-
],
|
|
742
|
-
"flags": {},
|
|
743
|
-
"hasDynamicHelp": false,
|
|
744
|
-
"hiddenAliases": [],
|
|
745
|
-
"id": "logout",
|
|
746
|
-
"pluginAlias": "hereya-cli",
|
|
747
|
-
"pluginName": "hereya-cli",
|
|
748
|
-
"pluginType": "core",
|
|
749
|
-
"strict": true,
|
|
750
|
-
"enableJsonFlag": false,
|
|
751
|
-
"isESM": true,
|
|
752
|
-
"relativePath": [
|
|
753
|
-
"dist",
|
|
754
|
-
"commands",
|
|
755
|
-
"logout",
|
|
756
|
-
"index.js"
|
|
757
|
-
]
|
|
758
|
-
},
|
|
759
759
|
"provid": {
|
|
760
760
|
"aliases": [],
|
|
761
761
|
"args": {
|
|
@@ -1490,33 +1490,24 @@
|
|
|
1490
1490
|
"index.js"
|
|
1491
1491
|
]
|
|
1492
1492
|
},
|
|
1493
|
-
"app:
|
|
1493
|
+
"app:status": {
|
|
1494
1494
|
"aliases": [],
|
|
1495
1495
|
"args": {
|
|
1496
|
-
"
|
|
1497
|
-
"description": "
|
|
1498
|
-
"name": "
|
|
1496
|
+
"name": {
|
|
1497
|
+
"description": "app name in org/name format",
|
|
1498
|
+
"name": "name",
|
|
1499
1499
|
"required": true
|
|
1500
1500
|
}
|
|
1501
1501
|
},
|
|
1502
|
-
"description": "
|
|
1502
|
+
"description": "Show the deployment status of a hereya-app on a workspace.",
|
|
1503
1503
|
"examples": [
|
|
1504
|
-
"<%= config.bin %> <%= command.id %>
|
|
1505
|
-
"<%= config.bin %> <%= command.id %> ./my-app -n my-org/my-app --description \"An ai-app-builder app\""
|
|
1504
|
+
"<%= config.bin %> <%= command.id %> my-org/my-app -w my-workspace"
|
|
1506
1505
|
],
|
|
1507
1506
|
"flags": {
|
|
1508
|
-
"
|
|
1509
|
-
"
|
|
1510
|
-
"
|
|
1511
|
-
"
|
|
1512
|
-
"hasDynamicHelp": false,
|
|
1513
|
-
"multiple": false,
|
|
1514
|
-
"type": "option"
|
|
1515
|
-
},
|
|
1516
|
-
"name": {
|
|
1517
|
-
"char": "n",
|
|
1518
|
-
"description": "app name in org/name format (e.g. my-org/my-app)",
|
|
1519
|
-
"name": "name",
|
|
1507
|
+
"workspace": {
|
|
1508
|
+
"char": "w",
|
|
1509
|
+
"description": "workspace to read deployment status from",
|
|
1510
|
+
"name": "workspace",
|
|
1520
1511
|
"required": true,
|
|
1521
1512
|
"hasDynamicHelp": false,
|
|
1522
1513
|
"multiple": false,
|
|
@@ -1525,7 +1516,7 @@
|
|
|
1525
1516
|
},
|
|
1526
1517
|
"hasDynamicHelp": false,
|
|
1527
1518
|
"hiddenAliases": [],
|
|
1528
|
-
"id": "app:
|
|
1519
|
+
"id": "app:status",
|
|
1529
1520
|
"pluginAlias": "hereya-cli",
|
|
1530
1521
|
"pluginName": "hereya-cli",
|
|
1531
1522
|
"pluginType": "core",
|
|
@@ -1536,28 +1527,37 @@
|
|
|
1536
1527
|
"dist",
|
|
1537
1528
|
"commands",
|
|
1538
1529
|
"app",
|
|
1539
|
-
"
|
|
1530
|
+
"status",
|
|
1540
1531
|
"index.js"
|
|
1541
1532
|
]
|
|
1542
1533
|
},
|
|
1543
|
-
"app:
|
|
1534
|
+
"app:new": {
|
|
1544
1535
|
"aliases": [],
|
|
1545
1536
|
"args": {
|
|
1546
|
-
"
|
|
1547
|
-
"description": "app
|
|
1548
|
-
"name": "
|
|
1537
|
+
"dirname": {
|
|
1538
|
+
"description": "directory to create the app skeleton in",
|
|
1539
|
+
"name": "dirname",
|
|
1549
1540
|
"required": true
|
|
1550
1541
|
}
|
|
1551
1542
|
},
|
|
1552
|
-
"description": "
|
|
1543
|
+
"description": "Scaffold a new hereya-app directory with starter hereyarc.yaml + hereya.yaml.",
|
|
1553
1544
|
"examples": [
|
|
1554
|
-
"<%= config.bin %> <%= command.id %> my-
|
|
1545
|
+
"<%= config.bin %> <%= command.id %> ./my-app -n my-org/my-app",
|
|
1546
|
+
"<%= config.bin %> <%= command.id %> ./my-app -n my-org/my-app --description \"An ai-app-builder app\""
|
|
1555
1547
|
],
|
|
1556
1548
|
"flags": {
|
|
1557
|
-
"
|
|
1558
|
-
"
|
|
1559
|
-
"
|
|
1560
|
-
"
|
|
1549
|
+
"description": {
|
|
1550
|
+
"description": "description of the app",
|
|
1551
|
+
"name": "description",
|
|
1552
|
+
"required": false,
|
|
1553
|
+
"hasDynamicHelp": false,
|
|
1554
|
+
"multiple": false,
|
|
1555
|
+
"type": "option"
|
|
1556
|
+
},
|
|
1557
|
+
"name": {
|
|
1558
|
+
"char": "n",
|
|
1559
|
+
"description": "app name in org/name format (e.g. my-org/my-app)",
|
|
1560
|
+
"name": "name",
|
|
1561
1561
|
"required": true,
|
|
1562
1562
|
"hasDynamicHelp": false,
|
|
1563
1563
|
"multiple": false,
|
|
@@ -1566,7 +1566,7 @@
|
|
|
1566
1566
|
},
|
|
1567
1567
|
"hasDynamicHelp": false,
|
|
1568
1568
|
"hiddenAliases": [],
|
|
1569
|
-
"id": "app:
|
|
1569
|
+
"id": "app:new",
|
|
1570
1570
|
"pluginAlias": "hereya-cli",
|
|
1571
1571
|
"pluginName": "hereya-cli",
|
|
1572
1572
|
"pluginType": "core",
|
|
@@ -1577,7 +1577,7 @@
|
|
|
1577
1577
|
"dist",
|
|
1578
1578
|
"commands",
|
|
1579
1579
|
"app",
|
|
1580
|
-
"
|
|
1580
|
+
"new",
|
|
1581
1581
|
"index.js"
|
|
1582
1582
|
]
|
|
1583
1583
|
},
|
|
@@ -3369,5 +3369,5 @@
|
|
|
3369
3369
|
]
|
|
3370
3370
|
}
|
|
3371
3371
|
},
|
|
3372
|
-
"version": "0.
|
|
3372
|
+
"version": "0.95.1"
|
|
3373
3373
|
}
|