hereya-cli 0.46.0 → 0.47.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 +109 -37
- package/dist/commands/add/index.d.ts +1 -0
- package/dist/commands/add/index.js +12 -5
- package/dist/commands/env/set/index.js +4 -2
- package/dist/commands/flow/down/index.d.ts +14 -0
- package/dist/commands/flow/down/index.js +110 -0
- package/dist/commands/flow/up/index.d.ts +14 -0
- package/dist/commands/flow/up/index.js +99 -0
- package/dist/commands/remove/index.d.ts +1 -0
- package/dist/commands/remove/index.js +12 -5
- package/dist/lib/env/index.js +3 -1
- package/dist/lib/git-utils.d.ts +29 -0
- package/dist/lib/git-utils.js +62 -0
- package/oclif.manifest.json +167 -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.47.0 linux-x64 node-v22.17.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -40,6 +40,8 @@ USAGE
|
|
|
40
40
|
* [`hereya down`](#hereya-down)
|
|
41
41
|
* [`hereya env [NAME]`](#hereya-env-name)
|
|
42
42
|
* [`hereya env set [NAME]`](#hereya-env-set-name)
|
|
43
|
+
* [`hereya flow down`](#hereya-flow-down)
|
|
44
|
+
* [`hereya flow up`](#hereya-flow-up)
|
|
43
45
|
* [`hereya help [COMMAND]`](#hereya-help-command)
|
|
44
46
|
* [`hereya import PACKAGE`](#hereya-import-package)
|
|
45
47
|
* [`hereya init PROJECT`](#hereya-init-project)
|
|
@@ -66,7 +68,7 @@ Add a package to the project.
|
|
|
66
68
|
|
|
67
69
|
```
|
|
68
70
|
USAGE
|
|
69
|
-
$ hereya add PACKAGE [--chdir <value>] [--debug] [-p <value>...]
|
|
71
|
+
$ hereya add PACKAGE [--chdir <value>] [--debug] [-p <value>...] [-w <value>]
|
|
70
72
|
|
|
71
73
|
ARGUMENTS
|
|
72
74
|
PACKAGE The package to add, specified as a GitHub repository in the format owner/repository.
|
|
@@ -78,6 +80,7 @@ ARGUMENTS
|
|
|
78
80
|
FLAGS
|
|
79
81
|
-p, --parameter=<value>... [default: ] parameter for the package, in the form of 'key=value'. Can be specified
|
|
80
82
|
multiple times.
|
|
83
|
+
-w, --workspace=<value> name of the workspace to add the package to (defaults to current workspace)
|
|
81
84
|
--chdir=<value> Directory where the command will be executed.
|
|
82
85
|
If not specified, it defaults to the current working directory.
|
|
83
86
|
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
@@ -91,7 +94,7 @@ EXAMPLES
|
|
|
91
94
|
$ hereya add cloudy/docker_postgres
|
|
92
95
|
```
|
|
93
96
|
|
|
94
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
97
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/add/index.ts)_
|
|
95
98
|
|
|
96
99
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
97
100
|
|
|
@@ -116,7 +119,7 @@ EXAMPLES
|
|
|
116
119
|
$ hereya bootstrap local
|
|
117
120
|
```
|
|
118
121
|
|
|
119
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
122
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/bootstrap/index.ts)_
|
|
120
123
|
|
|
121
124
|
## `hereya config export-backend [FILE]`
|
|
122
125
|
|
|
@@ -138,7 +141,7 @@ EXAMPLES
|
|
|
138
141
|
$ hereya config export-backend ./path/to/export.json
|
|
139
142
|
```
|
|
140
143
|
|
|
141
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
144
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/export-backend/index.ts)_
|
|
142
145
|
|
|
143
146
|
## `hereya config get-backend`
|
|
144
147
|
|
|
@@ -155,7 +158,7 @@ EXAMPLES
|
|
|
155
158
|
$ hereya config get-backend
|
|
156
159
|
```
|
|
157
160
|
|
|
158
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
161
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/get-backend/index.ts)_
|
|
159
162
|
|
|
160
163
|
## `hereya config import-backend FILE`
|
|
161
164
|
|
|
@@ -175,7 +178,7 @@ EXAMPLES
|
|
|
175
178
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
176
179
|
```
|
|
177
180
|
|
|
178
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
181
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/import-backend/index.ts)_
|
|
179
182
|
|
|
180
183
|
## `hereya config use-backend TYPE`
|
|
181
184
|
|
|
@@ -197,7 +200,7 @@ EXAMPLES
|
|
|
197
200
|
$ hereya config use-backend local
|
|
198
201
|
```
|
|
199
202
|
|
|
200
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
203
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/use-backend/index.ts)_
|
|
201
204
|
|
|
202
205
|
## `hereya delete-state`
|
|
203
206
|
|
|
@@ -223,7 +226,7 @@ EXAMPLES
|
|
|
223
226
|
$ hereya delete-state --workspace staging
|
|
224
227
|
```
|
|
225
228
|
|
|
226
|
-
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
229
|
+
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/delete-state/index.ts)_
|
|
227
230
|
|
|
228
231
|
## `hereya deploy`
|
|
229
232
|
|
|
@@ -248,7 +251,7 @@ EXAMPLES
|
|
|
248
251
|
$ hereya deploy
|
|
249
252
|
```
|
|
250
253
|
|
|
251
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
254
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/deploy/index.ts)_
|
|
252
255
|
|
|
253
256
|
## `hereya down`
|
|
254
257
|
|
|
@@ -275,7 +278,7 @@ EXAMPLES
|
|
|
275
278
|
$ hereya down
|
|
276
279
|
```
|
|
277
280
|
|
|
278
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
281
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/down/index.ts)_
|
|
279
282
|
|
|
280
283
|
## `hereya env [NAME]`
|
|
281
284
|
|
|
@@ -306,7 +309,7 @@ EXAMPLES
|
|
|
306
309
|
$ hereya env -w dev -l
|
|
307
310
|
```
|
|
308
311
|
|
|
309
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
312
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/env/index.ts)_
|
|
310
313
|
|
|
311
314
|
## `hereya env set [NAME]`
|
|
312
315
|
|
|
@@ -333,7 +336,75 @@ EXAMPLES
|
|
|
333
336
|
$ hereya env set FOO -v bar -w dev
|
|
334
337
|
```
|
|
335
338
|
|
|
336
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
339
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/env/set/index.ts)_
|
|
340
|
+
|
|
341
|
+
## `hereya flow down`
|
|
342
|
+
|
|
343
|
+
Create a git branch-based workspace and destroy all packages
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
USAGE
|
|
347
|
+
$ hereya flow down [--chdir <value>] [--debug] [--deploy] [--pin] [--profile <value>] [-s <value>...]
|
|
348
|
+
|
|
349
|
+
FLAGS
|
|
350
|
+
-s, --select=<value>... [default: ] select the packages to destroy
|
|
351
|
+
--chdir=<value> Directory where the command will be executed.
|
|
352
|
+
If not specified, it defaults to the current working directory.
|
|
353
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
354
|
+
environment variable.
|
|
355
|
+
--debug enable debug mode
|
|
356
|
+
--deploy destroy deployment companion packages
|
|
357
|
+
--pin append git commit SHA to workspace name for commit-specific isolation
|
|
358
|
+
--profile=<value> profile to use for the workspace (will be appended to workspace name)
|
|
359
|
+
|
|
360
|
+
DESCRIPTION
|
|
361
|
+
Create a git branch-based workspace and destroy all packages
|
|
362
|
+
|
|
363
|
+
EXAMPLES
|
|
364
|
+
$ hereya flow down
|
|
365
|
+
|
|
366
|
+
$ hereya flow down --debug
|
|
367
|
+
|
|
368
|
+
$ hereya flow down --profile staging
|
|
369
|
+
|
|
370
|
+
$ hereya flow down --pin
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/flow/down/index.ts)_
|
|
374
|
+
|
|
375
|
+
## `hereya flow up`
|
|
376
|
+
|
|
377
|
+
Create a git branch-based workspace and provision all packages
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
USAGE
|
|
381
|
+
$ hereya flow up [--chdir <value>] [--debug] [--deploy] [--pin] [--profile <value>] [-s <value>...]
|
|
382
|
+
|
|
383
|
+
FLAGS
|
|
384
|
+
-s, --select=<value>... [default: ] select the packages to provision
|
|
385
|
+
--chdir=<value> Directory where the command will be executed.
|
|
386
|
+
If not specified, it defaults to the current working directory.
|
|
387
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
388
|
+
environment variable.
|
|
389
|
+
--debug enable debug mode
|
|
390
|
+
--deploy provision deployment companion packages
|
|
391
|
+
--pin append git commit SHA to workspace name for commit-specific isolation
|
|
392
|
+
--profile=<value> profile to use for the workspace (will be appended to workspace name)
|
|
393
|
+
|
|
394
|
+
DESCRIPTION
|
|
395
|
+
Create a git branch-based workspace and provision all packages
|
|
396
|
+
|
|
397
|
+
EXAMPLES
|
|
398
|
+
$ hereya flow up
|
|
399
|
+
|
|
400
|
+
$ hereya flow up --debug
|
|
401
|
+
|
|
402
|
+
$ hereya flow up --profile staging
|
|
403
|
+
|
|
404
|
+
$ hereya flow up --pin
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/flow/up/index.ts)_
|
|
337
408
|
|
|
338
409
|
## `hereya help [COMMAND]`
|
|
339
410
|
|
|
@@ -390,7 +461,7 @@ EXAMPLES
|
|
|
390
461
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
391
462
|
```
|
|
392
463
|
|
|
393
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
464
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/import/index.ts)_
|
|
394
465
|
|
|
395
466
|
## `hereya init PROJECT`
|
|
396
467
|
|
|
@@ -416,7 +487,7 @@ EXAMPLES
|
|
|
416
487
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
417
488
|
```
|
|
418
489
|
|
|
419
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
490
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/init/index.ts)_
|
|
420
491
|
|
|
421
492
|
## `hereya login [URL]`
|
|
422
493
|
|
|
@@ -445,7 +516,7 @@ EXAMPLES
|
|
|
445
516
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
446
517
|
```
|
|
447
518
|
|
|
448
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
519
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/login/index.ts)_
|
|
449
520
|
|
|
450
521
|
## `hereya logout`
|
|
451
522
|
|
|
@@ -462,7 +533,7 @@ EXAMPLES
|
|
|
462
533
|
$ hereya logout
|
|
463
534
|
```
|
|
464
535
|
|
|
465
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
536
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/logout/index.ts)_
|
|
466
537
|
|
|
467
538
|
## `hereya remove PACKAGE`
|
|
468
539
|
|
|
@@ -470,17 +541,18 @@ Remove a package from the project.
|
|
|
470
541
|
|
|
471
542
|
```
|
|
472
543
|
USAGE
|
|
473
|
-
$ hereya remove PACKAGE [--chdir <value>] [--debug]
|
|
544
|
+
$ hereya remove PACKAGE [--chdir <value>] [--debug] [-w <value>]
|
|
474
545
|
|
|
475
546
|
ARGUMENTS
|
|
476
547
|
PACKAGE Remove a previously added package.
|
|
477
548
|
|
|
478
549
|
FLAGS
|
|
479
|
-
--
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
550
|
+
-w, --workspace=<value> name of the workspace to remove the package from (defaults to current workspace)
|
|
551
|
+
--chdir=<value> Directory where the command will be executed.
|
|
552
|
+
If not specified, it defaults to the current working directory.
|
|
553
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
554
|
+
environment variable.
|
|
555
|
+
--debug enable debug mode
|
|
484
556
|
|
|
485
557
|
DESCRIPTION
|
|
486
558
|
Remove a package from the project.
|
|
@@ -489,7 +561,7 @@ EXAMPLES
|
|
|
489
561
|
$ hereya remove cloudy/docker_postgres
|
|
490
562
|
```
|
|
491
563
|
|
|
492
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
564
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/remove/index.ts)_
|
|
493
565
|
|
|
494
566
|
## `hereya run CMD`
|
|
495
567
|
|
|
@@ -515,7 +587,7 @@ EXAMPLES
|
|
|
515
587
|
$ hereya run -w uat -- node index.js
|
|
516
588
|
```
|
|
517
589
|
|
|
518
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
590
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/run/index.ts)_
|
|
519
591
|
|
|
520
592
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
521
593
|
|
|
@@ -540,7 +612,7 @@ EXAMPLES
|
|
|
540
612
|
$ hereya unbootstrap local
|
|
541
613
|
```
|
|
542
614
|
|
|
543
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
615
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/unbootstrap/index.ts)_
|
|
544
616
|
|
|
545
617
|
## `hereya undeploy`
|
|
546
618
|
|
|
@@ -565,7 +637,7 @@ EXAMPLES
|
|
|
565
637
|
$ hereya undeploy
|
|
566
638
|
```
|
|
567
639
|
|
|
568
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
640
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/undeploy/index.ts)_
|
|
569
641
|
|
|
570
642
|
## `hereya up`
|
|
571
643
|
|
|
@@ -592,7 +664,7 @@ EXAMPLES
|
|
|
592
664
|
$ hereya up
|
|
593
665
|
```
|
|
594
666
|
|
|
595
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
667
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/up/index.ts)_
|
|
596
668
|
|
|
597
669
|
## `hereya workspace create NAME`
|
|
598
670
|
|
|
@@ -616,7 +688,7 @@ EXAMPLES
|
|
|
616
688
|
$ hereya workspace create dev
|
|
617
689
|
```
|
|
618
690
|
|
|
619
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
691
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/create/index.ts)_
|
|
620
692
|
|
|
621
693
|
## `hereya workspace delete NAME`
|
|
622
694
|
|
|
@@ -636,7 +708,7 @@ EXAMPLES
|
|
|
636
708
|
$ hereya workspace delete dev
|
|
637
709
|
```
|
|
638
710
|
|
|
639
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
711
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/delete/index.ts)_
|
|
640
712
|
|
|
641
713
|
## `hereya workspace env [NAME]`
|
|
642
714
|
|
|
@@ -662,7 +734,7 @@ EXAMPLES
|
|
|
662
734
|
$ hereya workspace env myEnv -w dev
|
|
663
735
|
```
|
|
664
736
|
|
|
665
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
737
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/env/index.ts)_
|
|
666
738
|
|
|
667
739
|
## `hereya workspace env set`
|
|
668
740
|
|
|
@@ -686,7 +758,7 @@ EXAMPLES
|
|
|
686
758
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
687
759
|
```
|
|
688
760
|
|
|
689
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
761
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/env/set/index.ts)_
|
|
690
762
|
|
|
691
763
|
## `hereya workspace env unset`
|
|
692
764
|
|
|
@@ -707,7 +779,7 @@ EXAMPLES
|
|
|
707
779
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
708
780
|
```
|
|
709
781
|
|
|
710
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
782
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/env/unset/index.ts)_
|
|
711
783
|
|
|
712
784
|
## `hereya workspace install PACKAGE`
|
|
713
785
|
|
|
@@ -734,7 +806,7 @@ EXAMPLES
|
|
|
734
806
|
$ hereya workspace install hereya/aws-cognito
|
|
735
807
|
```
|
|
736
808
|
|
|
737
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
809
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/install/index.ts)_
|
|
738
810
|
|
|
739
811
|
## `hereya workspace list`
|
|
740
812
|
|
|
@@ -751,7 +823,7 @@ EXAMPLES
|
|
|
751
823
|
$ hereya workspace list
|
|
752
824
|
```
|
|
753
825
|
|
|
754
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
826
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/list/index.ts)_
|
|
755
827
|
|
|
756
828
|
## `hereya workspace set-profile PROFILE`
|
|
757
829
|
|
|
@@ -774,7 +846,7 @@ EXAMPLES
|
|
|
774
846
|
$ hereya workspace set-profile prod-profile -w production
|
|
775
847
|
```
|
|
776
848
|
|
|
777
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
849
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/set-profile/index.ts)_
|
|
778
850
|
|
|
779
851
|
## `hereya workspace uninstall PACKAGE`
|
|
780
852
|
|
|
@@ -801,5 +873,5 @@ EXAMPLES
|
|
|
801
873
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
802
874
|
```
|
|
803
875
|
|
|
804
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
876
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/uninstall/index.ts)_
|
|
805
877
|
<!-- commandsstop -->
|
|
@@ -9,6 +9,7 @@ export default class Add extends Command {
|
|
|
9
9
|
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
parameter: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
};
|
|
13
14
|
run(): Promise<void>;
|
|
14
15
|
}
|
|
@@ -42,6 +42,11 @@ export default class Add extends Command {
|
|
|
42
42
|
description: "parameter for the package, in the form of 'key=value'. Can be specified multiple times.",
|
|
43
43
|
multiple: true,
|
|
44
44
|
}),
|
|
45
|
+
workspace: Flags.string({
|
|
46
|
+
char: 'w',
|
|
47
|
+
description: 'name of the workspace to add the package to (defaults to current workspace)',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
45
50
|
};
|
|
46
51
|
async run() {
|
|
47
52
|
const { args, flags } = await this.parse(Add);
|
|
@@ -66,6 +71,8 @@ export default class Add extends Command {
|
|
|
66
71
|
throw new Error("Project not initialized. Run 'hereya init' first.");
|
|
67
72
|
}
|
|
68
73
|
ctx.configOutput = loadConfigOutput;
|
|
74
|
+
// Use workspace from flag if provided, otherwise use config workspace
|
|
75
|
+
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
69
76
|
task.output = `Loaded project config`;
|
|
70
77
|
await delay(500);
|
|
71
78
|
},
|
|
@@ -76,7 +83,7 @@ export default class Add extends Command {
|
|
|
76
83
|
const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
|
|
77
84
|
const parameterManager = getParameterManager();
|
|
78
85
|
const backend = await getBackend();
|
|
79
|
-
const profile = await getProfileFromWorkspace(backend, ctx.
|
|
86
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
80
87
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
81
88
|
package: ctx.package,
|
|
82
89
|
profile,
|
|
@@ -105,7 +112,7 @@ export default class Add extends Command {
|
|
|
105
112
|
project: ctx.configOutput.config.project,
|
|
106
113
|
projectRootDir,
|
|
107
114
|
skipDeploy: true,
|
|
108
|
-
workspace: ctx.
|
|
115
|
+
workspace: ctx.workspace,
|
|
109
116
|
});
|
|
110
117
|
if (!provisionOutput.success) {
|
|
111
118
|
throw new Error(provisionOutput.reason);
|
|
@@ -122,7 +129,7 @@ export default class Add extends Command {
|
|
|
122
129
|
env,
|
|
123
130
|
infra: metadata.originalInfra ?? metadata.infra,
|
|
124
131
|
projectRootDir,
|
|
125
|
-
workspace: ctx.
|
|
132
|
+
workspace: ctx.workspace,
|
|
126
133
|
});
|
|
127
134
|
await delay(500);
|
|
128
135
|
},
|
|
@@ -145,13 +152,13 @@ export default class Add extends Command {
|
|
|
145
152
|
const backend = await getBackend();
|
|
146
153
|
const configManager = getConfigManager();
|
|
147
154
|
const { config: newConfig } = await configManager.loadConfig({ projectRootDir });
|
|
148
|
-
await backend.saveState(newConfig);
|
|
155
|
+
await backend.saveState(newConfig, ctx.workspace);
|
|
149
156
|
const parameterManager = getParameterManager();
|
|
150
157
|
const { filePath, saved } = await parameterManager.savePackageParameters({
|
|
151
158
|
package: ctx.package,
|
|
152
159
|
parameters: ctx.parametersOutput.parameters,
|
|
153
160
|
projectRootDir,
|
|
154
|
-
workspace: ctx.
|
|
161
|
+
workspace: ctx.workspace,
|
|
155
162
|
});
|
|
156
163
|
await delay(500);
|
|
157
164
|
if (saved) {
|
|
@@ -3,6 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { getConfigManager } from '../../../lib/config/index.js';
|
|
4
4
|
import { getEnvManager } from '../../../lib/env/index.js';
|
|
5
5
|
import { getAnyPath } from '../../../lib/filesystem.js';
|
|
6
|
+
import { stripOrgPrefix } from '../../../lib/org-utils.js';
|
|
6
7
|
import { load, save } from '../../../lib/yaml-utils.js';
|
|
7
8
|
export default class EnvSet extends Command {
|
|
8
9
|
static args = {
|
|
@@ -43,8 +44,9 @@ export default class EnvSet extends Command {
|
|
|
43
44
|
}
|
|
44
45
|
const envManager = getEnvManager();
|
|
45
46
|
const envDir = await envManager.getStaticEnvDir(projectRootDir);
|
|
46
|
-
const
|
|
47
|
-
|
|
47
|
+
const workspaceName = flags.workspace ? stripOrgPrefix(flags.workspace) : null;
|
|
48
|
+
const candidates = workspaceName
|
|
49
|
+
? [path.join(envDir, `env.${workspaceName}.yaml`), path.join(envDir, `env.${workspaceName}.yml`)]
|
|
48
50
|
: [path.join(envDir, `env.yaml`), path.join(envDir, `env.yml`)];
|
|
49
51
|
const envFile = await getAnyPath(...candidates);
|
|
50
52
|
const { data: env } = await load(envFile);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class FlowDown extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
deploy: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
pin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
select: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
|
+
import { gitUtils } from '../../../lib/git-utils.js';
|
|
4
|
+
import { setDebug } from '../../../lib/log.js';
|
|
5
|
+
import DeleteState from '../../delete-state/index.js';
|
|
6
|
+
import Down from '../../down/index.js';
|
|
7
|
+
import WorkspaceCreate from '../../workspace/create/index.js';
|
|
8
|
+
import WorkspaceDelete from '../../workspace/delete/index.js';
|
|
9
|
+
export default class FlowDown extends Command {
|
|
10
|
+
static description = 'Create a git branch-based workspace and destroy all packages';
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> <%= command.id %>',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --debug',
|
|
14
|
+
'<%= config.bin %> <%= command.id %> --profile staging',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --pin',
|
|
16
|
+
];
|
|
17
|
+
static flags = {
|
|
18
|
+
chdir: Flags.string({
|
|
19
|
+
description: `
|
|
20
|
+
Directory where the command will be executed.
|
|
21
|
+
If not specified, it defaults to the current working directory.
|
|
22
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.
|
|
23
|
+
`,
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
debug: Flags.boolean({
|
|
27
|
+
default: false,
|
|
28
|
+
description: 'enable debug mode',
|
|
29
|
+
}),
|
|
30
|
+
deploy: Flags.boolean({
|
|
31
|
+
description: 'destroy deployment companion packages',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
pin: Flags.boolean({
|
|
35
|
+
description: 'append git commit SHA to workspace name for commit-specific isolation',
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
profile: Flags.string({
|
|
39
|
+
description: 'profile to use for the workspace (will be appended to workspace name)',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
select: Flags.string({
|
|
43
|
+
char: 's',
|
|
44
|
+
default: [],
|
|
45
|
+
description: 'select the packages to destroy',
|
|
46
|
+
multiple: true,
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
async run() {
|
|
50
|
+
const { flags } = await this.parse(FlowDown);
|
|
51
|
+
setDebug(flags.debug);
|
|
52
|
+
const projectRootDir = flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR;
|
|
53
|
+
// Load project config
|
|
54
|
+
const configManager = getConfigManager();
|
|
55
|
+
const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
|
|
56
|
+
if (!loadConfigOutput.found) {
|
|
57
|
+
this.error("Project not initialized. Run 'hereya init' first.");
|
|
58
|
+
}
|
|
59
|
+
// Get current git branch
|
|
60
|
+
const gitBranch = await gitUtils.getCurrentGitBranch(projectRootDir);
|
|
61
|
+
// Sanitize branch name
|
|
62
|
+
const sanitizedBranch = gitUtils.sanitizeBranchName(gitBranch);
|
|
63
|
+
if (!sanitizedBranch) {
|
|
64
|
+
this.error('Branch name contains only special characters and cannot be used for workspace name');
|
|
65
|
+
}
|
|
66
|
+
// Get commit SHA if pin flag is set
|
|
67
|
+
const commitSHA = flags.pin ? await gitUtils.getShortCommitSHA(projectRootDir) : null;
|
|
68
|
+
// Build workspace name parts
|
|
69
|
+
const parts = [loadConfigOutput.config.project, sanitizedBranch];
|
|
70
|
+
if (flags.profile)
|
|
71
|
+
parts.push(flags.profile);
|
|
72
|
+
if (commitSHA)
|
|
73
|
+
parts.push(commitSHA);
|
|
74
|
+
const workspaceName = parts.join('---');
|
|
75
|
+
// Create workspace with mirror
|
|
76
|
+
const createArgs = [workspaceName, '--mirror', loadConfigOutput.config.workspace];
|
|
77
|
+
if (projectRootDir) {
|
|
78
|
+
createArgs.push('--chdir', projectRootDir);
|
|
79
|
+
}
|
|
80
|
+
if (flags.debug) {
|
|
81
|
+
createArgs.push('--debug');
|
|
82
|
+
}
|
|
83
|
+
if (flags.profile) {
|
|
84
|
+
createArgs.push('--profile', flags.profile);
|
|
85
|
+
}
|
|
86
|
+
await WorkspaceCreate.run(createArgs);
|
|
87
|
+
// Run down command with the new workspace and all flags
|
|
88
|
+
const downArgs = ['--workspace', workspaceName];
|
|
89
|
+
// Pass through all flags
|
|
90
|
+
if (flags.chdir)
|
|
91
|
+
downArgs.push('--chdir', flags.chdir);
|
|
92
|
+
if (flags.debug)
|
|
93
|
+
downArgs.push('--debug');
|
|
94
|
+
if (flags.deploy)
|
|
95
|
+
downArgs.push('--deploy');
|
|
96
|
+
for (const pkg of flags.select) {
|
|
97
|
+
downArgs.push('--select', pkg);
|
|
98
|
+
}
|
|
99
|
+
await Down.run(downArgs);
|
|
100
|
+
// Delete state
|
|
101
|
+
const deleteStateArgs = ['--workspace', workspaceName];
|
|
102
|
+
if (projectRootDir) {
|
|
103
|
+
deleteStateArgs.push('--chdir', projectRootDir);
|
|
104
|
+
}
|
|
105
|
+
await DeleteState.run(deleteStateArgs);
|
|
106
|
+
// Delete workspace
|
|
107
|
+
const deleteWorkspaceArgs = [workspaceName];
|
|
108
|
+
await WorkspaceDelete.run(deleteWorkspaceArgs);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class FlowUp extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
deploy: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
pin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
select: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
|
+
import { gitUtils } from '../../../lib/git-utils.js';
|
|
4
|
+
import { setDebug } from '../../../lib/log.js';
|
|
5
|
+
import Up from '../../up/index.js';
|
|
6
|
+
import WorkspaceCreate from '../../workspace/create/index.js';
|
|
7
|
+
export default class FlowUp extends Command {
|
|
8
|
+
static description = 'Create a git branch-based workspace and provision all packages';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> <%= command.id %>',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> --debug',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --profile staging',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --pin',
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
chdir: Flags.string({
|
|
17
|
+
description: `
|
|
18
|
+
Directory where the command will be executed.
|
|
19
|
+
If not specified, it defaults to the current working directory.
|
|
20
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.
|
|
21
|
+
`,
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
debug: Flags.boolean({
|
|
25
|
+
default: false,
|
|
26
|
+
description: 'enable debug mode',
|
|
27
|
+
}),
|
|
28
|
+
deploy: Flags.boolean({
|
|
29
|
+
description: 'provision deployment companion packages',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
pin: Flags.boolean({
|
|
33
|
+
description: 'append git commit SHA to workspace name for commit-specific isolation',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
profile: Flags.string({
|
|
37
|
+
description: 'profile to use for the workspace (will be appended to workspace name)',
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
select: Flags.string({
|
|
41
|
+
char: 's',
|
|
42
|
+
default: [],
|
|
43
|
+
description: 'select the packages to provision',
|
|
44
|
+
multiple: true,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
async run() {
|
|
48
|
+
const { flags } = await this.parse(FlowUp);
|
|
49
|
+
setDebug(flags.debug);
|
|
50
|
+
const projectRootDir = flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR;
|
|
51
|
+
// Load project config
|
|
52
|
+
const configManager = getConfigManager();
|
|
53
|
+
const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
|
|
54
|
+
if (!loadConfigOutput.found) {
|
|
55
|
+
this.error("Project not initialized. Run 'hereya init' first.");
|
|
56
|
+
}
|
|
57
|
+
// Get current git branch
|
|
58
|
+
const gitBranch = await gitUtils.getCurrentGitBranch(projectRootDir);
|
|
59
|
+
// Sanitize branch name
|
|
60
|
+
const sanitizedBranch = gitUtils.sanitizeBranchName(gitBranch);
|
|
61
|
+
if (!sanitizedBranch) {
|
|
62
|
+
this.error('Branch name contains only special characters and cannot be used for workspace name');
|
|
63
|
+
}
|
|
64
|
+
// Get commit SHA if pin flag is set
|
|
65
|
+
const commitSHA = flags.pin ? await gitUtils.getShortCommitSHA(projectRootDir) : null;
|
|
66
|
+
// Build workspace name parts
|
|
67
|
+
const parts = [loadConfigOutput.config.project, sanitizedBranch];
|
|
68
|
+
if (flags.profile)
|
|
69
|
+
parts.push(flags.profile);
|
|
70
|
+
if (commitSHA)
|
|
71
|
+
parts.push(commitSHA);
|
|
72
|
+
const workspaceName = parts.join('---');
|
|
73
|
+
// Create workspace with mirror
|
|
74
|
+
const createArgs = [workspaceName, '--mirror', loadConfigOutput.config.workspace];
|
|
75
|
+
if (projectRootDir) {
|
|
76
|
+
createArgs.push('--chdir', projectRootDir);
|
|
77
|
+
}
|
|
78
|
+
if (flags.debug) {
|
|
79
|
+
createArgs.push('--debug');
|
|
80
|
+
}
|
|
81
|
+
if (flags.profile) {
|
|
82
|
+
createArgs.push('--profile', flags.profile);
|
|
83
|
+
}
|
|
84
|
+
await WorkspaceCreate.run(createArgs);
|
|
85
|
+
// Run up command with the new workspace and all flags
|
|
86
|
+
const upArgs = ['--workspace', workspaceName];
|
|
87
|
+
// Pass through all flags
|
|
88
|
+
if (flags.chdir)
|
|
89
|
+
upArgs.push('--chdir', flags.chdir);
|
|
90
|
+
if (flags.debug)
|
|
91
|
+
upArgs.push('--debug');
|
|
92
|
+
if (flags.deploy)
|
|
93
|
+
upArgs.push('--deploy');
|
|
94
|
+
for (const pkg of flags.select) {
|
|
95
|
+
upArgs.push('--select', pkg);
|
|
96
|
+
}
|
|
97
|
+
await Up.run(upArgs);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -8,6 +8,7 @@ export default class Remove extends Command {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
};
|
|
12
13
|
run(): Promise<void>;
|
|
13
14
|
}
|
|
@@ -30,6 +30,11 @@ export default class Remove extends Command {
|
|
|
30
30
|
default: false,
|
|
31
31
|
description: 'enable debug mode',
|
|
32
32
|
}),
|
|
33
|
+
workspace: Flags.string({
|
|
34
|
+
char: 'w',
|
|
35
|
+
description: 'name of the workspace to remove the package from (defaults to current workspace)',
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
33
38
|
};
|
|
34
39
|
async run() {
|
|
35
40
|
const { args, flags } = await this.parse(Remove);
|
|
@@ -53,6 +58,8 @@ export default class Remove extends Command {
|
|
|
53
58
|
throw new Error("Project not initialized. Run 'hereya init' first.");
|
|
54
59
|
}
|
|
55
60
|
ctx.configOutput = loadConfigOutput;
|
|
61
|
+
// Use workspace from flag if provided, otherwise use config workspace
|
|
62
|
+
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
56
63
|
const { config } = loadConfigOutput;
|
|
57
64
|
if (!(ctx.package in (config.packages ?? {})) && !(ctx.package in (config.deploy ?? {}))) {
|
|
58
65
|
throw new Error(`Package ${ctx.package} not found in the project.`);
|
|
@@ -65,7 +72,7 @@ export default class Remove extends Command {
|
|
|
65
72
|
async task(ctx) {
|
|
66
73
|
const parameterManager = getParameterManager();
|
|
67
74
|
const backend = await getBackend();
|
|
68
|
-
const profile = await getProfileFromWorkspace(backend, ctx.
|
|
75
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
69
76
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
70
77
|
package: ctx.package,
|
|
71
78
|
profile,
|
|
@@ -93,7 +100,7 @@ export default class Remove extends Command {
|
|
|
93
100
|
project: ctx.configOutput.config.project,
|
|
94
101
|
projectRootDir,
|
|
95
102
|
skipDeploy: true,
|
|
96
|
-
workspace: ctx.
|
|
103
|
+
workspace: ctx.workspace,
|
|
97
104
|
});
|
|
98
105
|
if (!destroyOutput.success) {
|
|
99
106
|
throw new Error(destroyOutput.reason);
|
|
@@ -109,7 +116,7 @@ export default class Remove extends Command {
|
|
|
109
116
|
env: ctx.destroyOutput.env,
|
|
110
117
|
infra: ctx.destroyOutput.metadata.infra,
|
|
111
118
|
projectRootDir,
|
|
112
|
-
workspace: ctx.
|
|
119
|
+
workspace: ctx.workspace,
|
|
113
120
|
});
|
|
114
121
|
await delay(500);
|
|
115
122
|
},
|
|
@@ -128,11 +135,11 @@ export default class Remove extends Command {
|
|
|
128
135
|
title: 'Removing package from hereya manifest',
|
|
129
136
|
},
|
|
130
137
|
{
|
|
131
|
-
async task() {
|
|
138
|
+
async task(ctx) {
|
|
132
139
|
const backend = await getBackend();
|
|
133
140
|
const configManager = getConfigManager();
|
|
134
141
|
const { config: newConfig } = await configManager.loadConfig({ projectRootDir });
|
|
135
|
-
await backend.saveState(newConfig);
|
|
142
|
+
await backend.saveState(newConfig, ctx.workspace);
|
|
136
143
|
await delay(500);
|
|
137
144
|
},
|
|
138
145
|
title: 'Saving state',
|
package/dist/lib/env/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { getExecutor } from '../../executor/index.js';
|
|
4
4
|
import { getAnyPath } from '../filesystem.js';
|
|
5
|
+
import { stripOrgPrefix } from '../org-utils.js';
|
|
5
6
|
import { load, parseYaml, save } from '../yaml-utils.js';
|
|
6
7
|
export class EnvManager {
|
|
7
8
|
async addProjectEnv(input) {
|
|
@@ -92,7 +93,8 @@ export class EnvManager {
|
|
|
92
93
|
return null;
|
|
93
94
|
}
|
|
94
95
|
async getEnvPath(input) {
|
|
95
|
-
|
|
96
|
+
const workspaceName = stripOrgPrefix(input.workspace);
|
|
97
|
+
return getAnyPath(path.join(input.projectRootDir ?? process.cwd(), '.hereya', `env.${workspaceName}.yaml`), path.join(input.projectRootDir ?? process.cwd(), '.hereya', `env.${workspaceName}.yml`));
|
|
96
98
|
}
|
|
97
99
|
async getUserEnvPaths(profile, projectRootDir) {
|
|
98
100
|
const paths = await Promise.all([
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const gitUtils: {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the current git branch name.
|
|
4
|
+
* @param cwd The working directory to execute git command in
|
|
5
|
+
* @returns The current branch name
|
|
6
|
+
* @throws Error if not in a git repository or git command fails
|
|
7
|
+
*/
|
|
8
|
+
getCurrentGitBranch(cwd?: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Gets the short commit SHA of the current HEAD.
|
|
11
|
+
* @param cwd The working directory to execute git command in
|
|
12
|
+
* @returns The short commit SHA (7 characters by default)
|
|
13
|
+
* @throws Error if not in a git repository or git command fails
|
|
14
|
+
*/
|
|
15
|
+
getShortCommitSHA(cwd?: string): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if the current directory is a git repository.
|
|
18
|
+
* @param cwd The working directory to check
|
|
19
|
+
* @returns true if in a git repository, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
isGitRepository(cwd?: string): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Sanitizes a git branch name for use in workspace names.
|
|
24
|
+
* Keeps only alphanumeric characters, hyphens (-), and underscores (_).
|
|
25
|
+
* @param branch The branch name to sanitize
|
|
26
|
+
* @returns The sanitized branch name
|
|
27
|
+
*/
|
|
28
|
+
sanitizeBranchName(branch: string): string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { runShell } from './shell.js';
|
|
2
|
+
export const gitUtils = {
|
|
3
|
+
/**
|
|
4
|
+
* Gets the current git branch name.
|
|
5
|
+
* @param cwd The working directory to execute git command in
|
|
6
|
+
* @returns The current branch name
|
|
7
|
+
* @throws Error if not in a git repository or git command fails
|
|
8
|
+
*/
|
|
9
|
+
async getCurrentGitBranch(cwd) {
|
|
10
|
+
try {
|
|
11
|
+
const { stdout } = await runShell('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { directory: cwd });
|
|
12
|
+
return stdout.trim();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (error.message.includes('not a git repository') || error.message.includes('exit code "128"')) {
|
|
16
|
+
throw new Error('Not in a git repository. The flow commands require git integration.');
|
|
17
|
+
}
|
|
18
|
+
throw new Error(`Failed to get current git branch: ${error.message}`);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Gets the short commit SHA of the current HEAD.
|
|
23
|
+
* @param cwd The working directory to execute git command in
|
|
24
|
+
* @returns The short commit SHA (7 characters by default)
|
|
25
|
+
* @throws Error if not in a git repository or git command fails
|
|
26
|
+
*/
|
|
27
|
+
async getShortCommitSHA(cwd) {
|
|
28
|
+
try {
|
|
29
|
+
const { stdout } = await runShell('git', ['rev-parse', '--short', 'HEAD'], { directory: cwd });
|
|
30
|
+
return stdout.trim();
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error.message.includes('not a git repository') || error.message.includes('exit code "128"')) {
|
|
34
|
+
throw new Error('Not in a git repository. The flow commands require git integration.');
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Failed to get commit SHA: ${error.message}`);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Checks if the current directory is a git repository.
|
|
41
|
+
* @param cwd The working directory to check
|
|
42
|
+
* @returns true if in a git repository, false otherwise
|
|
43
|
+
*/
|
|
44
|
+
async isGitRepository(cwd) {
|
|
45
|
+
try {
|
|
46
|
+
await runShell('git', ['rev-parse', '--git-dir'], { directory: cwd });
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Sanitizes a git branch name for use in workspace names.
|
|
55
|
+
* Keeps only alphanumeric characters, hyphens (-), and underscores (_).
|
|
56
|
+
* @param branch The branch name to sanitize
|
|
57
|
+
* @returns The sanitized branch name
|
|
58
|
+
*/
|
|
59
|
+
sanitizeBranchName(branch) {
|
|
60
|
+
return branch.replaceAll(/[^a-zA-Z0-9_-]/g, '');
|
|
61
|
+
}
|
|
62
|
+
};
|
package/oclif.manifest.json
CHANGED
|
@@ -36,6 +36,15 @@
|
|
|
36
36
|
"hasDynamicHelp": false,
|
|
37
37
|
"multiple": true,
|
|
38
38
|
"type": "option"
|
|
39
|
+
},
|
|
40
|
+
"workspace": {
|
|
41
|
+
"char": "w",
|
|
42
|
+
"description": "name of the workspace to add the package to (defaults to current workspace)",
|
|
43
|
+
"name": "workspace",
|
|
44
|
+
"required": false,
|
|
45
|
+
"hasDynamicHelp": false,
|
|
46
|
+
"multiple": false,
|
|
47
|
+
"type": "option"
|
|
39
48
|
}
|
|
40
49
|
},
|
|
41
50
|
"hasDynamicHelp": false,
|
|
@@ -525,6 +534,15 @@
|
|
|
525
534
|
"name": "debug",
|
|
526
535
|
"allowNo": false,
|
|
527
536
|
"type": "boolean"
|
|
537
|
+
},
|
|
538
|
+
"workspace": {
|
|
539
|
+
"char": "w",
|
|
540
|
+
"description": "name of the workspace to remove the package from (defaults to current workspace)",
|
|
541
|
+
"name": "workspace",
|
|
542
|
+
"required": false,
|
|
543
|
+
"hasDynamicHelp": false,
|
|
544
|
+
"multiple": false,
|
|
545
|
+
"type": "option"
|
|
528
546
|
}
|
|
529
547
|
},
|
|
530
548
|
"hasDynamicHelp": false,
|
|
@@ -921,6 +939,154 @@
|
|
|
921
939
|
"index.js"
|
|
922
940
|
]
|
|
923
941
|
},
|
|
942
|
+
"flow:down": {
|
|
943
|
+
"aliases": [],
|
|
944
|
+
"args": {},
|
|
945
|
+
"description": "Create a git branch-based workspace and destroy all packages",
|
|
946
|
+
"examples": [
|
|
947
|
+
"<%= config.bin %> <%= command.id %>",
|
|
948
|
+
"<%= config.bin %> <%= command.id %> --debug",
|
|
949
|
+
"<%= config.bin %> <%= command.id %> --profile staging",
|
|
950
|
+
"<%= config.bin %> <%= command.id %> --pin"
|
|
951
|
+
],
|
|
952
|
+
"flags": {
|
|
953
|
+
"chdir": {
|
|
954
|
+
"description": "\n Directory where the command will be executed.\n If not specified, it defaults to the current working directory.\n Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.\n ",
|
|
955
|
+
"name": "chdir",
|
|
956
|
+
"required": false,
|
|
957
|
+
"hasDynamicHelp": false,
|
|
958
|
+
"multiple": false,
|
|
959
|
+
"type": "option"
|
|
960
|
+
},
|
|
961
|
+
"debug": {
|
|
962
|
+
"description": "enable debug mode",
|
|
963
|
+
"name": "debug",
|
|
964
|
+
"allowNo": false,
|
|
965
|
+
"type": "boolean"
|
|
966
|
+
},
|
|
967
|
+
"deploy": {
|
|
968
|
+
"description": "destroy deployment companion packages",
|
|
969
|
+
"name": "deploy",
|
|
970
|
+
"required": false,
|
|
971
|
+
"allowNo": false,
|
|
972
|
+
"type": "boolean"
|
|
973
|
+
},
|
|
974
|
+
"pin": {
|
|
975
|
+
"description": "append git commit SHA to workspace name for commit-specific isolation",
|
|
976
|
+
"name": "pin",
|
|
977
|
+
"required": false,
|
|
978
|
+
"allowNo": false,
|
|
979
|
+
"type": "boolean"
|
|
980
|
+
},
|
|
981
|
+
"profile": {
|
|
982
|
+
"description": "profile to use for the workspace (will be appended to workspace name)",
|
|
983
|
+
"name": "profile",
|
|
984
|
+
"required": false,
|
|
985
|
+
"hasDynamicHelp": false,
|
|
986
|
+
"multiple": false,
|
|
987
|
+
"type": "option"
|
|
988
|
+
},
|
|
989
|
+
"select": {
|
|
990
|
+
"char": "s",
|
|
991
|
+
"description": "select the packages to destroy",
|
|
992
|
+
"name": "select",
|
|
993
|
+
"default": [],
|
|
994
|
+
"hasDynamicHelp": false,
|
|
995
|
+
"multiple": true,
|
|
996
|
+
"type": "option"
|
|
997
|
+
}
|
|
998
|
+
},
|
|
999
|
+
"hasDynamicHelp": false,
|
|
1000
|
+
"hiddenAliases": [],
|
|
1001
|
+
"id": "flow:down",
|
|
1002
|
+
"pluginAlias": "hereya-cli",
|
|
1003
|
+
"pluginName": "hereya-cli",
|
|
1004
|
+
"pluginType": "core",
|
|
1005
|
+
"strict": true,
|
|
1006
|
+
"enableJsonFlag": false,
|
|
1007
|
+
"isESM": true,
|
|
1008
|
+
"relativePath": [
|
|
1009
|
+
"dist",
|
|
1010
|
+
"commands",
|
|
1011
|
+
"flow",
|
|
1012
|
+
"down",
|
|
1013
|
+
"index.js"
|
|
1014
|
+
]
|
|
1015
|
+
},
|
|
1016
|
+
"flow:up": {
|
|
1017
|
+
"aliases": [],
|
|
1018
|
+
"args": {},
|
|
1019
|
+
"description": "Create a git branch-based workspace and provision all packages",
|
|
1020
|
+
"examples": [
|
|
1021
|
+
"<%= config.bin %> <%= command.id %>",
|
|
1022
|
+
"<%= config.bin %> <%= command.id %> --debug",
|
|
1023
|
+
"<%= config.bin %> <%= command.id %> --profile staging",
|
|
1024
|
+
"<%= config.bin %> <%= command.id %> --pin"
|
|
1025
|
+
],
|
|
1026
|
+
"flags": {
|
|
1027
|
+
"chdir": {
|
|
1028
|
+
"description": "\n Directory where the command will be executed.\n If not specified, it defaults to the current working directory.\n Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.\n ",
|
|
1029
|
+
"name": "chdir",
|
|
1030
|
+
"required": false,
|
|
1031
|
+
"hasDynamicHelp": false,
|
|
1032
|
+
"multiple": false,
|
|
1033
|
+
"type": "option"
|
|
1034
|
+
},
|
|
1035
|
+
"debug": {
|
|
1036
|
+
"description": "enable debug mode",
|
|
1037
|
+
"name": "debug",
|
|
1038
|
+
"allowNo": false,
|
|
1039
|
+
"type": "boolean"
|
|
1040
|
+
},
|
|
1041
|
+
"deploy": {
|
|
1042
|
+
"description": "provision deployment companion packages",
|
|
1043
|
+
"name": "deploy",
|
|
1044
|
+
"required": false,
|
|
1045
|
+
"allowNo": false,
|
|
1046
|
+
"type": "boolean"
|
|
1047
|
+
},
|
|
1048
|
+
"pin": {
|
|
1049
|
+
"description": "append git commit SHA to workspace name for commit-specific isolation",
|
|
1050
|
+
"name": "pin",
|
|
1051
|
+
"required": false,
|
|
1052
|
+
"allowNo": false,
|
|
1053
|
+
"type": "boolean"
|
|
1054
|
+
},
|
|
1055
|
+
"profile": {
|
|
1056
|
+
"description": "profile to use for the workspace (will be appended to workspace name)",
|
|
1057
|
+
"name": "profile",
|
|
1058
|
+
"required": false,
|
|
1059
|
+
"hasDynamicHelp": false,
|
|
1060
|
+
"multiple": false,
|
|
1061
|
+
"type": "option"
|
|
1062
|
+
},
|
|
1063
|
+
"select": {
|
|
1064
|
+
"char": "s",
|
|
1065
|
+
"description": "select the packages to provision",
|
|
1066
|
+
"name": "select",
|
|
1067
|
+
"default": [],
|
|
1068
|
+
"hasDynamicHelp": false,
|
|
1069
|
+
"multiple": true,
|
|
1070
|
+
"type": "option"
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
"hasDynamicHelp": false,
|
|
1074
|
+
"hiddenAliases": [],
|
|
1075
|
+
"id": "flow:up",
|
|
1076
|
+
"pluginAlias": "hereya-cli",
|
|
1077
|
+
"pluginName": "hereya-cli",
|
|
1078
|
+
"pluginType": "core",
|
|
1079
|
+
"strict": true,
|
|
1080
|
+
"enableJsonFlag": false,
|
|
1081
|
+
"isESM": true,
|
|
1082
|
+
"relativePath": [
|
|
1083
|
+
"dist",
|
|
1084
|
+
"commands",
|
|
1085
|
+
"flow",
|
|
1086
|
+
"up",
|
|
1087
|
+
"index.js"
|
|
1088
|
+
]
|
|
1089
|
+
},
|
|
924
1090
|
"workspace:create": {
|
|
925
1091
|
"aliases": [],
|
|
926
1092
|
"args": {
|
|
@@ -1360,5 +1526,5 @@
|
|
|
1360
1526
|
]
|
|
1361
1527
|
}
|
|
1362
1528
|
},
|
|
1363
|
-
"version": "0.
|
|
1529
|
+
"version": "0.47.0"
|
|
1364
1530
|
}
|