hereya-cli 0.42.1 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -30
- package/dist/backend/cloud/cloud-backend.d.ts +2 -1
- package/dist/backend/cloud/cloud-backend.js +47 -14
- package/dist/backend/common.d.ts +16 -0
- package/dist/backend/common.js +1 -0
- package/dist/backend/file.d.ts +2 -1
- package/dist/backend/file.js +6 -0
- package/dist/commands/workspace/create/index.d.ts +1 -0
- package/dist/commands/workspace/create/index.js +2 -0
- package/dist/commands/workspace/list/index.js +48 -3
- package/dist/commands/workspace/set-profile/index.d.ts +12 -0
- package/dist/commands/workspace/set-profile/index.js +24 -0
- package/oclif.manifest.json +50 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g hereya-cli
|
|
|
20
20
|
$ hereya COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ hereya (--version)
|
|
23
|
-
hereya-cli/0.
|
|
23
|
+
hereya-cli/0.43.0 linux-x64 node-v22.17.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -56,6 +56,7 @@ USAGE
|
|
|
56
56
|
* [`hereya workspace env unset`](#hereya-workspace-env-unset)
|
|
57
57
|
* [`hereya workspace install PACKAGE`](#hereya-workspace-install-package)
|
|
58
58
|
* [`hereya workspace list`](#hereya-workspace-list)
|
|
59
|
+
* [`hereya workspace set-profile PROFILE`](#hereya-workspace-set-profile-profile)
|
|
59
60
|
* [`hereya workspace uninstall PACKAGE`](#hereya-workspace-uninstall-package)
|
|
60
61
|
|
|
61
62
|
## `hereya add PACKAGE`
|
|
@@ -89,7 +90,7 @@ EXAMPLES
|
|
|
89
90
|
$ hereya add cloudy/docker_postgres
|
|
90
91
|
```
|
|
91
92
|
|
|
92
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
93
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/add/index.ts)_
|
|
93
94
|
|
|
94
95
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
95
96
|
|
|
@@ -114,7 +115,7 @@ EXAMPLES
|
|
|
114
115
|
$ hereya bootstrap local
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
118
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/bootstrap/index.ts)_
|
|
118
119
|
|
|
119
120
|
## `hereya config export-backend [FILE]`
|
|
120
121
|
|
|
@@ -136,7 +137,7 @@ EXAMPLES
|
|
|
136
137
|
$ hereya config export-backend ./path/to/export.json
|
|
137
138
|
```
|
|
138
139
|
|
|
139
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
140
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/config/export-backend/index.ts)_
|
|
140
141
|
|
|
141
142
|
## `hereya config get-backend`
|
|
142
143
|
|
|
@@ -153,7 +154,7 @@ EXAMPLES
|
|
|
153
154
|
$ hereya config get-backend
|
|
154
155
|
```
|
|
155
156
|
|
|
156
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
157
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/config/get-backend/index.ts)_
|
|
157
158
|
|
|
158
159
|
## `hereya config import-backend FILE`
|
|
159
160
|
|
|
@@ -173,7 +174,7 @@ EXAMPLES
|
|
|
173
174
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
174
175
|
```
|
|
175
176
|
|
|
176
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
177
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/config/import-backend/index.ts)_
|
|
177
178
|
|
|
178
179
|
## `hereya config use-backend TYPE`
|
|
179
180
|
|
|
@@ -195,7 +196,7 @@ EXAMPLES
|
|
|
195
196
|
$ hereya config use-backend local
|
|
196
197
|
```
|
|
197
198
|
|
|
198
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
199
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/config/use-backend/index.ts)_
|
|
199
200
|
|
|
200
201
|
## `hereya deploy`
|
|
201
202
|
|
|
@@ -220,7 +221,7 @@ EXAMPLES
|
|
|
220
221
|
$ hereya deploy
|
|
221
222
|
```
|
|
222
223
|
|
|
223
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
224
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/deploy/index.ts)_
|
|
224
225
|
|
|
225
226
|
## `hereya down`
|
|
226
227
|
|
|
@@ -247,7 +248,7 @@ EXAMPLES
|
|
|
247
248
|
$ hereya down
|
|
248
249
|
```
|
|
249
250
|
|
|
250
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
251
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/down/index.ts)_
|
|
251
252
|
|
|
252
253
|
## `hereya env [NAME]`
|
|
253
254
|
|
|
@@ -278,7 +279,7 @@ EXAMPLES
|
|
|
278
279
|
$ hereya env -w dev -l
|
|
279
280
|
```
|
|
280
281
|
|
|
281
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
282
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/env/index.ts)_
|
|
282
283
|
|
|
283
284
|
## `hereya env set [NAME]`
|
|
284
285
|
|
|
@@ -305,7 +306,7 @@ EXAMPLES
|
|
|
305
306
|
$ hereya env set FOO -v bar -w dev
|
|
306
307
|
```
|
|
307
308
|
|
|
308
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
309
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/env/set/index.ts)_
|
|
309
310
|
|
|
310
311
|
## `hereya help [COMMAND]`
|
|
311
312
|
|
|
@@ -362,7 +363,7 @@ EXAMPLES
|
|
|
362
363
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
363
364
|
```
|
|
364
365
|
|
|
365
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
366
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/import/index.ts)_
|
|
366
367
|
|
|
367
368
|
## `hereya init PROJECT`
|
|
368
369
|
|
|
@@ -388,7 +389,7 @@ EXAMPLES
|
|
|
388
389
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
389
390
|
```
|
|
390
391
|
|
|
391
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
392
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/init/index.ts)_
|
|
392
393
|
|
|
393
394
|
## `hereya login [URL]`
|
|
394
395
|
|
|
@@ -417,7 +418,7 @@ EXAMPLES
|
|
|
417
418
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
418
419
|
```
|
|
419
420
|
|
|
420
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
421
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/login/index.ts)_
|
|
421
422
|
|
|
422
423
|
## `hereya logout`
|
|
423
424
|
|
|
@@ -434,7 +435,7 @@ EXAMPLES
|
|
|
434
435
|
$ hereya logout
|
|
435
436
|
```
|
|
436
437
|
|
|
437
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
438
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/logout/index.ts)_
|
|
438
439
|
|
|
439
440
|
## `hereya remove PACKAGE`
|
|
440
441
|
|
|
@@ -461,7 +462,7 @@ EXAMPLES
|
|
|
461
462
|
$ hereya remove cloudy/docker_postgres
|
|
462
463
|
```
|
|
463
464
|
|
|
464
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
465
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/remove/index.ts)_
|
|
465
466
|
|
|
466
467
|
## `hereya run CMD`
|
|
467
468
|
|
|
@@ -487,7 +488,7 @@ EXAMPLES
|
|
|
487
488
|
$ hereya run -w uat -- node index.js
|
|
488
489
|
```
|
|
489
490
|
|
|
490
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
491
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/run/index.ts)_
|
|
491
492
|
|
|
492
493
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
493
494
|
|
|
@@ -512,7 +513,7 @@ EXAMPLES
|
|
|
512
513
|
$ hereya unbootstrap local
|
|
513
514
|
```
|
|
514
515
|
|
|
515
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
516
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/unbootstrap/index.ts)_
|
|
516
517
|
|
|
517
518
|
## `hereya undeploy`
|
|
518
519
|
|
|
@@ -537,7 +538,7 @@ EXAMPLES
|
|
|
537
538
|
$ hereya undeploy
|
|
538
539
|
```
|
|
539
540
|
|
|
540
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
541
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/undeploy/index.ts)_
|
|
541
542
|
|
|
542
543
|
## `hereya up`
|
|
543
544
|
|
|
@@ -564,7 +565,7 @@ EXAMPLES
|
|
|
564
565
|
$ hereya up
|
|
565
566
|
```
|
|
566
567
|
|
|
567
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
568
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/up/index.ts)_
|
|
568
569
|
|
|
569
570
|
## `hereya workspace create NAME`
|
|
570
571
|
|
|
@@ -572,13 +573,14 @@ Create a new workspace if it does not exist.
|
|
|
572
573
|
|
|
573
574
|
```
|
|
574
575
|
USAGE
|
|
575
|
-
$ hereya workspace create NAME [--mirror <value>]
|
|
576
|
+
$ hereya workspace create NAME [--mirror <value>] [--profile <value>]
|
|
576
577
|
|
|
577
578
|
ARGUMENTS
|
|
578
579
|
NAME name of the workspace to create
|
|
579
580
|
|
|
580
581
|
FLAGS
|
|
581
|
-
--mirror=<value>
|
|
582
|
+
--mirror=<value> workspace to mirror
|
|
583
|
+
--profile=<value> workspace profile to set (cloud backend only)
|
|
582
584
|
|
|
583
585
|
DESCRIPTION
|
|
584
586
|
Create a new workspace if it does not exist.
|
|
@@ -587,7 +589,7 @@ EXAMPLES
|
|
|
587
589
|
$ hereya workspace create dev
|
|
588
590
|
```
|
|
589
591
|
|
|
590
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
592
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/create/index.ts)_
|
|
591
593
|
|
|
592
594
|
## `hereya workspace delete NAME`
|
|
593
595
|
|
|
@@ -607,7 +609,7 @@ EXAMPLES
|
|
|
607
609
|
$ hereya workspace delete dev
|
|
608
610
|
```
|
|
609
611
|
|
|
610
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
612
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/delete/index.ts)_
|
|
611
613
|
|
|
612
614
|
## `hereya workspace env [NAME]`
|
|
613
615
|
|
|
@@ -633,7 +635,7 @@ EXAMPLES
|
|
|
633
635
|
$ hereya workspace env myEnv -w dev
|
|
634
636
|
```
|
|
635
637
|
|
|
636
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
638
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/env/index.ts)_
|
|
637
639
|
|
|
638
640
|
## `hereya workspace env set`
|
|
639
641
|
|
|
@@ -657,7 +659,7 @@ EXAMPLES
|
|
|
657
659
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
658
660
|
```
|
|
659
661
|
|
|
660
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
662
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/env/set/index.ts)_
|
|
661
663
|
|
|
662
664
|
## `hereya workspace env unset`
|
|
663
665
|
|
|
@@ -678,7 +680,7 @@ EXAMPLES
|
|
|
678
680
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
679
681
|
```
|
|
680
682
|
|
|
681
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
683
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/env/unset/index.ts)_
|
|
682
684
|
|
|
683
685
|
## `hereya workspace install PACKAGE`
|
|
684
686
|
|
|
@@ -705,7 +707,7 @@ EXAMPLES
|
|
|
705
707
|
$ hereya workspace install hereya/aws-cognito
|
|
706
708
|
```
|
|
707
709
|
|
|
708
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
710
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/install/index.ts)_
|
|
709
711
|
|
|
710
712
|
## `hereya workspace list`
|
|
711
713
|
|
|
@@ -722,7 +724,30 @@ EXAMPLES
|
|
|
722
724
|
$ hereya workspace list
|
|
723
725
|
```
|
|
724
726
|
|
|
725
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
727
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/list/index.ts)_
|
|
728
|
+
|
|
729
|
+
## `hereya workspace set-profile PROFILE`
|
|
730
|
+
|
|
731
|
+
Set AWS profile for a workspace (cloud backend only).
|
|
732
|
+
|
|
733
|
+
```
|
|
734
|
+
USAGE
|
|
735
|
+
$ hereya workspace set-profile PROFILE -w <value>
|
|
736
|
+
|
|
737
|
+
ARGUMENTS
|
|
738
|
+
PROFILE AWS profile name to set for the workspace
|
|
739
|
+
|
|
740
|
+
FLAGS
|
|
741
|
+
-w, --workspace=<value> (required) workspace name
|
|
742
|
+
|
|
743
|
+
DESCRIPTION
|
|
744
|
+
Set AWS profile for a workspace (cloud backend only).
|
|
745
|
+
|
|
746
|
+
EXAMPLES
|
|
747
|
+
$ hereya workspace set-profile prod-profile -w production
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/set-profile/index.ts)_
|
|
726
751
|
|
|
727
752
|
## `hereya workspace uninstall PACKAGE`
|
|
728
753
|
|
|
@@ -749,5 +774,5 @@ EXAMPLES
|
|
|
749
774
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
750
775
|
```
|
|
751
776
|
|
|
752
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
777
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.43.0/src/commands/workspace/uninstall/index.ts)_
|
|
753
778
|
<!-- commandsstop -->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '../../lib/config/common.js';
|
|
2
|
-
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput } from '../common.js';
|
|
2
|
+
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from '../common.js';
|
|
3
3
|
interface CloudBackendConfig {
|
|
4
4
|
accessToken: string;
|
|
5
5
|
clientId: string;
|
|
@@ -24,6 +24,7 @@ export declare class CloudBackend implements Backend {
|
|
|
24
24
|
saveState(config: Config, workspace?: string): Promise<void>;
|
|
25
25
|
setEnvVar(input: SetEnvVarInput): Promise<SetEnvVarOutput>;
|
|
26
26
|
unsetEnvVar(input: UnsetEnvVarInput): Promise<UnsetEnvVarOutput>;
|
|
27
|
+
updateWorkspace(input: UpdateWorkspaceInput): Promise<UpdateWorkspaceOutput>;
|
|
27
28
|
private convertWorkspace;
|
|
28
29
|
}
|
|
29
30
|
export {};
|
|
@@ -37,6 +37,9 @@ export class CloudBackend {
|
|
|
37
37
|
if (input.mirrorOf) {
|
|
38
38
|
formData.append('mirrorOf', input.mirrorOf);
|
|
39
39
|
}
|
|
40
|
+
if (input.profile) {
|
|
41
|
+
formData.append('profile', input.profile);
|
|
42
|
+
}
|
|
40
43
|
const response = await fetch(`${this.config.url}/api/workspaces`, {
|
|
41
44
|
body: formData,
|
|
42
45
|
headers: {
|
|
@@ -54,10 +57,7 @@ export class CloudBackend {
|
|
|
54
57
|
return {
|
|
55
58
|
isNew: true,
|
|
56
59
|
success: true,
|
|
57
|
-
workspace:
|
|
58
|
-
id: result.workspace.id,
|
|
59
|
-
name: result.workspace.name,
|
|
60
|
-
},
|
|
60
|
+
workspace: this.convertWorkspace(result.workspace),
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
async deleteWorkspace(input) {
|
|
@@ -360,22 +360,54 @@ export class CloudBackend {
|
|
|
360
360
|
success: true,
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
+
async updateWorkspace(input) {
|
|
364
|
+
const formData = new FormData();
|
|
365
|
+
if (input.profile !== undefined) {
|
|
366
|
+
formData.append('profile', input.profile === null ? '' : input.profile);
|
|
367
|
+
}
|
|
368
|
+
const response = await fetch(`${this.config.url}/api/workspaces/${encodeURIComponent(input.name)}`, {
|
|
369
|
+
body: formData,
|
|
370
|
+
headers: {
|
|
371
|
+
'Authorization': `Bearer ${this.config.accessToken}`,
|
|
372
|
+
},
|
|
373
|
+
method: 'PATCH',
|
|
374
|
+
});
|
|
375
|
+
if (!response.ok) {
|
|
376
|
+
return {
|
|
377
|
+
reason: JSON.stringify(await response.json()),
|
|
378
|
+
success: false,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
const result = await response.json();
|
|
382
|
+
return {
|
|
383
|
+
success: true,
|
|
384
|
+
workspace: this.convertWorkspace(result.workspace),
|
|
385
|
+
};
|
|
386
|
+
}
|
|
363
387
|
convertWorkspace(workspace) {
|
|
364
388
|
const env = {};
|
|
365
|
-
|
|
366
|
-
for (const
|
|
367
|
-
env
|
|
389
|
+
if (workspace.packages) {
|
|
390
|
+
for (const pkg of workspace.packages) {
|
|
391
|
+
if (pkg.env) {
|
|
392
|
+
for (const e of pkg.env) {
|
|
393
|
+
env[e.key] = `${e.infrastructure}:${e.value}`;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
368
396
|
}
|
|
369
397
|
}
|
|
370
|
-
|
|
371
|
-
|
|
398
|
+
if (workspace.env) {
|
|
399
|
+
for (const e of workspace.env) {
|
|
400
|
+
env[e.key] = `${e.infrastructure}:${e.value}`;
|
|
401
|
+
}
|
|
372
402
|
}
|
|
373
403
|
const packages = {};
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
404
|
+
if (workspace.packages) {
|
|
405
|
+
for (const pkg of workspace.packages) {
|
|
406
|
+
packages[pkg.name] = {
|
|
407
|
+
parameters: pkg.parameters,
|
|
408
|
+
version: pkg.version,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
379
411
|
}
|
|
380
412
|
return {
|
|
381
413
|
env,
|
|
@@ -383,6 +415,7 @@ export class CloudBackend {
|
|
|
383
415
|
mirrorOf: workspace.mirrorOf?.name,
|
|
384
416
|
name: workspace.name,
|
|
385
417
|
packages,
|
|
418
|
+
profile: workspace.profile === null ? undefined : workspace.profile,
|
|
386
419
|
};
|
|
387
420
|
}
|
|
388
421
|
}
|
package/dist/backend/common.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface Backend {
|
|
|
17
17
|
saveState(config: Config, workspace?: string): Promise<void>;
|
|
18
18
|
setEnvVar(input: SetEnvVarInput): Promise<SetEnvVarOutput>;
|
|
19
19
|
unsetEnvVar(input: UnsetEnvVarInput): Promise<UnsetEnvVarOutput>;
|
|
20
|
+
updateWorkspace(input: UpdateWorkspaceInput): Promise<UpdateWorkspaceOutput>;
|
|
20
21
|
}
|
|
21
22
|
export declare const WorkspaceSchema: z.ZodObject<{
|
|
22
23
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -33,6 +34,7 @@ export declare const WorkspaceSchema: z.ZodObject<{
|
|
|
33
34
|
version: string;
|
|
34
35
|
parameters?: Record<string, any> | undefined;
|
|
35
36
|
}>>>;
|
|
37
|
+
profile: z.ZodOptional<z.ZodString>;
|
|
36
38
|
}, "strip", z.ZodTypeAny, {
|
|
37
39
|
name: string;
|
|
38
40
|
id: string;
|
|
@@ -42,6 +44,7 @@ export declare const WorkspaceSchema: z.ZodObject<{
|
|
|
42
44
|
parameters?: Record<string, any> | undefined;
|
|
43
45
|
}> | undefined;
|
|
44
46
|
mirrorOf?: string | undefined;
|
|
47
|
+
profile?: string | undefined;
|
|
45
48
|
}, {
|
|
46
49
|
name: string;
|
|
47
50
|
id: string;
|
|
@@ -51,6 +54,7 @@ export declare const WorkspaceSchema: z.ZodObject<{
|
|
|
51
54
|
parameters?: Record<string, any> | undefined;
|
|
52
55
|
}> | undefined;
|
|
53
56
|
mirrorOf?: string | undefined;
|
|
57
|
+
profile?: string | undefined;
|
|
54
58
|
}>;
|
|
55
59
|
export type Workspace = z.infer<typeof WorkspaceSchema>;
|
|
56
60
|
export type AddPackageToWorkspaceInput = {
|
|
@@ -90,6 +94,7 @@ export interface InitProjectOutput {
|
|
|
90
94
|
export interface CreateWorkspaceInput {
|
|
91
95
|
mirrorOf?: string;
|
|
92
96
|
name: string;
|
|
97
|
+
profile?: string;
|
|
93
98
|
}
|
|
94
99
|
export type CreateWorkspaceOutput = {
|
|
95
100
|
isNew: boolean;
|
|
@@ -194,3 +199,14 @@ export type UnsetEnvVarInput = {
|
|
|
194
199
|
workspace: string;
|
|
195
200
|
};
|
|
196
201
|
export type UnsetEnvVarOutput = SetEnvVarOutput;
|
|
202
|
+
export type UpdateWorkspaceInput = {
|
|
203
|
+
name: string;
|
|
204
|
+
profile?: null | string;
|
|
205
|
+
};
|
|
206
|
+
export type UpdateWorkspaceOutput = {
|
|
207
|
+
reason: string;
|
|
208
|
+
success: false;
|
|
209
|
+
} | {
|
|
210
|
+
success: true;
|
|
211
|
+
workspace: Workspace;
|
|
212
|
+
};
|
package/dist/backend/common.js
CHANGED
package/dist/backend/file.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '../lib/config/common.js';
|
|
2
|
-
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput } from './common.js';
|
|
2
|
+
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from './common.js';
|
|
3
3
|
import { FileStorage } from './file-storage/common.js';
|
|
4
4
|
export declare class FileBackend implements Backend {
|
|
5
5
|
private readonly fileStorage;
|
|
@@ -19,5 +19,6 @@ export declare class FileBackend implements Backend {
|
|
|
19
19
|
saveState(config: Config, workspace?: string): Promise<void>;
|
|
20
20
|
setEnvVar(input: SetEnvVarInput): Promise<SetEnvVarOutput>;
|
|
21
21
|
unsetEnvVar(input: UnsetEnvVarInput): Promise<UnsetEnvVarOutput>;
|
|
22
|
+
updateWorkspace(_: UpdateWorkspaceInput): Promise<UpdateWorkspaceOutput>;
|
|
22
23
|
private saveWorkspace;
|
|
23
24
|
}
|
package/dist/backend/file.js
CHANGED
|
@@ -427,6 +427,12 @@ export class FileBackend {
|
|
|
427
427
|
success: true,
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
|
+
async updateWorkspace(_) {
|
|
431
|
+
return {
|
|
432
|
+
reason: 'Profile feature is not supported in file backend',
|
|
433
|
+
success: false,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
430
436
|
async saveWorkspace(data, name) {
|
|
431
437
|
const paths = [['state', 'workspaces', `${name}.yaml`].join('/'), ['state', 'workspaces', `${name}.yml`].join('/')];
|
|
432
438
|
await this.fileStorage.saveFileContent({ content: stringify(data), paths });
|
|
@@ -7,6 +7,7 @@ export default class WorkspaceCreate extends Command {
|
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
9
|
mirror: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
};
|
|
11
12
|
run(): Promise<void>;
|
|
12
13
|
}
|
|
@@ -8,6 +8,7 @@ export default class WorkspaceCreate extends Command {
|
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %> dev'];
|
|
9
9
|
static flags = {
|
|
10
10
|
mirror: Flags.string({ description: 'workspace to mirror', required: false }),
|
|
11
|
+
profile: Flags.string({ description: 'workspace profile to set (cloud backend only)', required: false }),
|
|
11
12
|
};
|
|
12
13
|
async run() {
|
|
13
14
|
const { args, flags } = await this.parse(WorkspaceCreate);
|
|
@@ -15,6 +16,7 @@ export default class WorkspaceCreate extends Command {
|
|
|
15
16
|
const createWorkspaceOutput = await backend.createWorkspace({
|
|
16
17
|
mirrorOf: flags.mirror,
|
|
17
18
|
name: args.name,
|
|
19
|
+
profile: flags.profile,
|
|
18
20
|
});
|
|
19
21
|
if (!createWorkspaceOutput.success) {
|
|
20
22
|
this.error(`Failed to create workspace: ${createWorkspaceOutput.reason}`);
|
|
@@ -5,8 +5,53 @@ export default class WorkspaceList extends Command {
|
|
|
5
5
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
6
6
|
async run() {
|
|
7
7
|
await this.parse(WorkspaceList);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
try {
|
|
9
|
+
const backend = await getBackend();
|
|
10
|
+
const workspaceNames = await backend.listWorkspaces();
|
|
11
|
+
// If no workspaces, show a message
|
|
12
|
+
if (workspaceNames.length === 0) {
|
|
13
|
+
this.log('No workspaces found.');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// Fetch details for each workspace
|
|
17
|
+
const workspaceDetails = await Promise.all(workspaceNames.map(async (name) => {
|
|
18
|
+
try {
|
|
19
|
+
const result = await backend.getWorkspace(name);
|
|
20
|
+
if (result.found && !result.hasError) {
|
|
21
|
+
return {
|
|
22
|
+
mirrorOf: result.workspace.mirrorOf || '-',
|
|
23
|
+
name,
|
|
24
|
+
profile: result.workspace.profile || '-',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
mirrorOf: '-',
|
|
29
|
+
name,
|
|
30
|
+
profile: '-',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return {
|
|
35
|
+
mirrorOf: '-',
|
|
36
|
+
name,
|
|
37
|
+
profile: '-',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
// Calculate column widths for alignment
|
|
42
|
+
const nameWidth = Math.max(4, ...workspaceDetails.map(w => w.name.length)); // min 4 for "Name"
|
|
43
|
+
const profileWidth = Math.max(7, ...workspaceDetails.map(w => w.profile.length)); // min 7 for "Profile"
|
|
44
|
+
const mirrorWidth = Math.max(9, ...workspaceDetails.map(w => w.mirrorOf.length)); // min 9 for "Mirror Of"
|
|
45
|
+
// Display header
|
|
46
|
+
this.log(`${'Name'.padEnd(nameWidth)} ${'Profile'.padEnd(profileWidth)} ${'Mirror Of'.padEnd(mirrorWidth)}`);
|
|
47
|
+
this.log('-'.repeat(nameWidth + profileWidth + mirrorWidth + 4));
|
|
48
|
+
// Display rows
|
|
49
|
+
for (const workspace of workspaceDetails) {
|
|
50
|
+
this.log(`${workspace.name.padEnd(nameWidth)} ${workspace.profile.padEnd(profileWidth)} ${workspace.mirrorOf.padEnd(mirrorWidth)}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.error(`Failed to list workspaces: ${error}`);
|
|
55
|
+
}
|
|
11
56
|
}
|
|
12
57
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class WorkspaceSetProfile extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
profile: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getBackend } from '../../../backend/index.js';
|
|
3
|
+
export default class WorkspaceSetProfile extends Command {
|
|
4
|
+
static args = {
|
|
5
|
+
profile: Args.string({ description: 'AWS profile name to set for the workspace', required: true }),
|
|
6
|
+
};
|
|
7
|
+
static description = 'Set AWS profile for a workspace (cloud backend only).';
|
|
8
|
+
static examples = ['<%= config.bin %> <%= command.id %> prod-profile -w production'];
|
|
9
|
+
static flags = {
|
|
10
|
+
workspace: Flags.string({ char: 'w', description: 'workspace name', required: true }),
|
|
11
|
+
};
|
|
12
|
+
async run() {
|
|
13
|
+
const { args, flags } = await this.parse(WorkspaceSetProfile);
|
|
14
|
+
const backend = await getBackend();
|
|
15
|
+
const updateResult = await backend.updateWorkspace({
|
|
16
|
+
name: flags.workspace,
|
|
17
|
+
profile: args.profile,
|
|
18
|
+
});
|
|
19
|
+
if (!updateResult.success) {
|
|
20
|
+
this.error(`Failed to set profile: ${updateResult.reason}`);
|
|
21
|
+
}
|
|
22
|
+
this.log(`Profile '${args.profile}' set for workspace '${flags.workspace}' successfully!`);
|
|
23
|
+
}
|
|
24
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -899,6 +899,14 @@
|
|
|
899
899
|
"hasDynamicHelp": false,
|
|
900
900
|
"multiple": false,
|
|
901
901
|
"type": "option"
|
|
902
|
+
},
|
|
903
|
+
"profile": {
|
|
904
|
+
"description": "workspace profile to set (cloud backend only)",
|
|
905
|
+
"name": "profile",
|
|
906
|
+
"required": false,
|
|
907
|
+
"hasDynamicHelp": false,
|
|
908
|
+
"multiple": false,
|
|
909
|
+
"type": "option"
|
|
902
910
|
}
|
|
903
911
|
},
|
|
904
912
|
"hasDynamicHelp": false,
|
|
@@ -1088,6 +1096,47 @@
|
|
|
1088
1096
|
"index.js"
|
|
1089
1097
|
]
|
|
1090
1098
|
},
|
|
1099
|
+
"workspace:set-profile": {
|
|
1100
|
+
"aliases": [],
|
|
1101
|
+
"args": {
|
|
1102
|
+
"profile": {
|
|
1103
|
+
"description": "AWS profile name to set for the workspace",
|
|
1104
|
+
"name": "profile",
|
|
1105
|
+
"required": true
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
"description": "Set AWS profile for a workspace (cloud backend only).",
|
|
1109
|
+
"examples": [
|
|
1110
|
+
"<%= config.bin %> <%= command.id %> prod-profile -w production"
|
|
1111
|
+
],
|
|
1112
|
+
"flags": {
|
|
1113
|
+
"workspace": {
|
|
1114
|
+
"char": "w",
|
|
1115
|
+
"description": "workspace name",
|
|
1116
|
+
"name": "workspace",
|
|
1117
|
+
"required": true,
|
|
1118
|
+
"hasDynamicHelp": false,
|
|
1119
|
+
"multiple": false,
|
|
1120
|
+
"type": "option"
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
"hasDynamicHelp": false,
|
|
1124
|
+
"hiddenAliases": [],
|
|
1125
|
+
"id": "workspace:set-profile",
|
|
1126
|
+
"pluginAlias": "hereya-cli",
|
|
1127
|
+
"pluginName": "hereya-cli",
|
|
1128
|
+
"pluginType": "core",
|
|
1129
|
+
"strict": true,
|
|
1130
|
+
"enableJsonFlag": false,
|
|
1131
|
+
"isESM": true,
|
|
1132
|
+
"relativePath": [
|
|
1133
|
+
"dist",
|
|
1134
|
+
"commands",
|
|
1135
|
+
"workspace",
|
|
1136
|
+
"set-profile",
|
|
1137
|
+
"index.js"
|
|
1138
|
+
]
|
|
1139
|
+
},
|
|
1091
1140
|
"workspace:uninstall": {
|
|
1092
1141
|
"aliases": [],
|
|
1093
1142
|
"args": {
|
|
@@ -1268,5 +1317,5 @@
|
|
|
1268
1317
|
]
|
|
1269
1318
|
}
|
|
1270
1319
|
},
|
|
1271
|
-
"version": "0.
|
|
1320
|
+
"version": "0.43.0"
|
|
1272
1321
|
}
|