hereya-cli 0.47.0 → 0.48.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 +62 -32
- package/dist/commands/flow/run/index.d.ts +15 -0
- package/dist/commands/flow/run/index.js +66 -0
- package/oclif.manifest.json +58 -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.48.0 linux-x64 node-v22.17.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -41,6 +41,7 @@ USAGE
|
|
|
41
41
|
* [`hereya env [NAME]`](#hereya-env-name)
|
|
42
42
|
* [`hereya env set [NAME]`](#hereya-env-set-name)
|
|
43
43
|
* [`hereya flow down`](#hereya-flow-down)
|
|
44
|
+
* [`hereya flow run CMD`](#hereya-flow-run-cmd)
|
|
44
45
|
* [`hereya flow up`](#hereya-flow-up)
|
|
45
46
|
* [`hereya help [COMMAND]`](#hereya-help-command)
|
|
46
47
|
* [`hereya import PACKAGE`](#hereya-import-package)
|
|
@@ -94,7 +95,7 @@ EXAMPLES
|
|
|
94
95
|
$ hereya add cloudy/docker_postgres
|
|
95
96
|
```
|
|
96
97
|
|
|
97
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
98
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/add/index.ts)_
|
|
98
99
|
|
|
99
100
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
100
101
|
|
|
@@ -119,7 +120,7 @@ EXAMPLES
|
|
|
119
120
|
$ hereya bootstrap local
|
|
120
121
|
```
|
|
121
122
|
|
|
122
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
123
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/bootstrap/index.ts)_
|
|
123
124
|
|
|
124
125
|
## `hereya config export-backend [FILE]`
|
|
125
126
|
|
|
@@ -141,7 +142,7 @@ EXAMPLES
|
|
|
141
142
|
$ hereya config export-backend ./path/to/export.json
|
|
142
143
|
```
|
|
143
144
|
|
|
144
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
145
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/config/export-backend/index.ts)_
|
|
145
146
|
|
|
146
147
|
## `hereya config get-backend`
|
|
147
148
|
|
|
@@ -158,7 +159,7 @@ EXAMPLES
|
|
|
158
159
|
$ hereya config get-backend
|
|
159
160
|
```
|
|
160
161
|
|
|
161
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
162
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/config/get-backend/index.ts)_
|
|
162
163
|
|
|
163
164
|
## `hereya config import-backend FILE`
|
|
164
165
|
|
|
@@ -178,7 +179,7 @@ EXAMPLES
|
|
|
178
179
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
179
180
|
```
|
|
180
181
|
|
|
181
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
182
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/config/import-backend/index.ts)_
|
|
182
183
|
|
|
183
184
|
## `hereya config use-backend TYPE`
|
|
184
185
|
|
|
@@ -200,7 +201,7 @@ EXAMPLES
|
|
|
200
201
|
$ hereya config use-backend local
|
|
201
202
|
```
|
|
202
203
|
|
|
203
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
204
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/config/use-backend/index.ts)_
|
|
204
205
|
|
|
205
206
|
## `hereya delete-state`
|
|
206
207
|
|
|
@@ -226,7 +227,7 @@ EXAMPLES
|
|
|
226
227
|
$ hereya delete-state --workspace staging
|
|
227
228
|
```
|
|
228
229
|
|
|
229
|
-
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
230
|
+
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/delete-state/index.ts)_
|
|
230
231
|
|
|
231
232
|
## `hereya deploy`
|
|
232
233
|
|
|
@@ -251,7 +252,7 @@ EXAMPLES
|
|
|
251
252
|
$ hereya deploy
|
|
252
253
|
```
|
|
253
254
|
|
|
254
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
255
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/deploy/index.ts)_
|
|
255
256
|
|
|
256
257
|
## `hereya down`
|
|
257
258
|
|
|
@@ -278,7 +279,7 @@ EXAMPLES
|
|
|
278
279
|
$ hereya down
|
|
279
280
|
```
|
|
280
281
|
|
|
281
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
282
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/down/index.ts)_
|
|
282
283
|
|
|
283
284
|
## `hereya env [NAME]`
|
|
284
285
|
|
|
@@ -309,7 +310,7 @@ EXAMPLES
|
|
|
309
310
|
$ hereya env -w dev -l
|
|
310
311
|
```
|
|
311
312
|
|
|
312
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
313
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/env/index.ts)_
|
|
313
314
|
|
|
314
315
|
## `hereya env set [NAME]`
|
|
315
316
|
|
|
@@ -336,7 +337,7 @@ EXAMPLES
|
|
|
336
337
|
$ hereya env set FOO -v bar -w dev
|
|
337
338
|
```
|
|
338
339
|
|
|
339
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
340
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/env/set/index.ts)_
|
|
340
341
|
|
|
341
342
|
## `hereya flow down`
|
|
342
343
|
|
|
@@ -370,7 +371,36 @@ EXAMPLES
|
|
|
370
371
|
$ hereya flow down --pin
|
|
371
372
|
```
|
|
372
373
|
|
|
373
|
-
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
374
|
+
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/flow/down/index.ts)_
|
|
375
|
+
|
|
376
|
+
## `hereya flow run CMD`
|
|
377
|
+
|
|
378
|
+
Run a command with hereya env vars in a git branch-based workspace
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
USAGE
|
|
382
|
+
$ hereya flow run CMD... [--chdir <value>] [--pin] [--profile <value>]
|
|
383
|
+
|
|
384
|
+
ARGUMENTS
|
|
385
|
+
CMD... command to run
|
|
386
|
+
|
|
387
|
+
FLAGS
|
|
388
|
+
--chdir=<value> directory to run command in
|
|
389
|
+
--pin append git commit SHA to workspace name for commit-specific isolation
|
|
390
|
+
--profile=<value> profile to use for the workspace (will be appended to workspace name)
|
|
391
|
+
|
|
392
|
+
DESCRIPTION
|
|
393
|
+
Run a command with hereya env vars in a git branch-based workspace
|
|
394
|
+
|
|
395
|
+
EXAMPLES
|
|
396
|
+
$ hereya flow run -- npm run dev
|
|
397
|
+
|
|
398
|
+
$ hereya flow run --profile staging -- node index.js
|
|
399
|
+
|
|
400
|
+
$ hereya flow run --pin -- npm test
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
_See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/flow/run/index.ts)_
|
|
374
404
|
|
|
375
405
|
## `hereya flow up`
|
|
376
406
|
|
|
@@ -404,7 +434,7 @@ EXAMPLES
|
|
|
404
434
|
$ hereya flow up --pin
|
|
405
435
|
```
|
|
406
436
|
|
|
407
|
-
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
437
|
+
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/flow/up/index.ts)_
|
|
408
438
|
|
|
409
439
|
## `hereya help [COMMAND]`
|
|
410
440
|
|
|
@@ -461,7 +491,7 @@ EXAMPLES
|
|
|
461
491
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
462
492
|
```
|
|
463
493
|
|
|
464
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
494
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/import/index.ts)_
|
|
465
495
|
|
|
466
496
|
## `hereya init PROJECT`
|
|
467
497
|
|
|
@@ -487,7 +517,7 @@ EXAMPLES
|
|
|
487
517
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
488
518
|
```
|
|
489
519
|
|
|
490
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
520
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/init/index.ts)_
|
|
491
521
|
|
|
492
522
|
## `hereya login [URL]`
|
|
493
523
|
|
|
@@ -516,7 +546,7 @@ EXAMPLES
|
|
|
516
546
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
517
547
|
```
|
|
518
548
|
|
|
519
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
549
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/login/index.ts)_
|
|
520
550
|
|
|
521
551
|
## `hereya logout`
|
|
522
552
|
|
|
@@ -533,7 +563,7 @@ EXAMPLES
|
|
|
533
563
|
$ hereya logout
|
|
534
564
|
```
|
|
535
565
|
|
|
536
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
566
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/logout/index.ts)_
|
|
537
567
|
|
|
538
568
|
## `hereya remove PACKAGE`
|
|
539
569
|
|
|
@@ -561,7 +591,7 @@ EXAMPLES
|
|
|
561
591
|
$ hereya remove cloudy/docker_postgres
|
|
562
592
|
```
|
|
563
593
|
|
|
564
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
594
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/remove/index.ts)_
|
|
565
595
|
|
|
566
596
|
## `hereya run CMD`
|
|
567
597
|
|
|
@@ -587,7 +617,7 @@ EXAMPLES
|
|
|
587
617
|
$ hereya run -w uat -- node index.js
|
|
588
618
|
```
|
|
589
619
|
|
|
590
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
620
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/run/index.ts)_
|
|
591
621
|
|
|
592
622
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
593
623
|
|
|
@@ -612,7 +642,7 @@ EXAMPLES
|
|
|
612
642
|
$ hereya unbootstrap local
|
|
613
643
|
```
|
|
614
644
|
|
|
615
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
645
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/unbootstrap/index.ts)_
|
|
616
646
|
|
|
617
647
|
## `hereya undeploy`
|
|
618
648
|
|
|
@@ -637,7 +667,7 @@ EXAMPLES
|
|
|
637
667
|
$ hereya undeploy
|
|
638
668
|
```
|
|
639
669
|
|
|
640
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
670
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/undeploy/index.ts)_
|
|
641
671
|
|
|
642
672
|
## `hereya up`
|
|
643
673
|
|
|
@@ -664,7 +694,7 @@ EXAMPLES
|
|
|
664
694
|
$ hereya up
|
|
665
695
|
```
|
|
666
696
|
|
|
667
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
697
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/up/index.ts)_
|
|
668
698
|
|
|
669
699
|
## `hereya workspace create NAME`
|
|
670
700
|
|
|
@@ -688,7 +718,7 @@ EXAMPLES
|
|
|
688
718
|
$ hereya workspace create dev
|
|
689
719
|
```
|
|
690
720
|
|
|
691
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
721
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/create/index.ts)_
|
|
692
722
|
|
|
693
723
|
## `hereya workspace delete NAME`
|
|
694
724
|
|
|
@@ -708,7 +738,7 @@ EXAMPLES
|
|
|
708
738
|
$ hereya workspace delete dev
|
|
709
739
|
```
|
|
710
740
|
|
|
711
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
741
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/delete/index.ts)_
|
|
712
742
|
|
|
713
743
|
## `hereya workspace env [NAME]`
|
|
714
744
|
|
|
@@ -734,7 +764,7 @@ EXAMPLES
|
|
|
734
764
|
$ hereya workspace env myEnv -w dev
|
|
735
765
|
```
|
|
736
766
|
|
|
737
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
767
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/env/index.ts)_
|
|
738
768
|
|
|
739
769
|
## `hereya workspace env set`
|
|
740
770
|
|
|
@@ -758,7 +788,7 @@ EXAMPLES
|
|
|
758
788
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
759
789
|
```
|
|
760
790
|
|
|
761
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
791
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/env/set/index.ts)_
|
|
762
792
|
|
|
763
793
|
## `hereya workspace env unset`
|
|
764
794
|
|
|
@@ -779,7 +809,7 @@ EXAMPLES
|
|
|
779
809
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
780
810
|
```
|
|
781
811
|
|
|
782
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
812
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/env/unset/index.ts)_
|
|
783
813
|
|
|
784
814
|
## `hereya workspace install PACKAGE`
|
|
785
815
|
|
|
@@ -806,7 +836,7 @@ EXAMPLES
|
|
|
806
836
|
$ hereya workspace install hereya/aws-cognito
|
|
807
837
|
```
|
|
808
838
|
|
|
809
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
839
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/install/index.ts)_
|
|
810
840
|
|
|
811
841
|
## `hereya workspace list`
|
|
812
842
|
|
|
@@ -823,7 +853,7 @@ EXAMPLES
|
|
|
823
853
|
$ hereya workspace list
|
|
824
854
|
```
|
|
825
855
|
|
|
826
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
856
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/list/index.ts)_
|
|
827
857
|
|
|
828
858
|
## `hereya workspace set-profile PROFILE`
|
|
829
859
|
|
|
@@ -846,7 +876,7 @@ EXAMPLES
|
|
|
846
876
|
$ hereya workspace set-profile prod-profile -w production
|
|
847
877
|
```
|
|
848
878
|
|
|
849
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
879
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/set-profile/index.ts)_
|
|
850
880
|
|
|
851
881
|
## `hereya workspace uninstall PACKAGE`
|
|
852
882
|
|
|
@@ -873,5 +903,5 @@ EXAMPLES
|
|
|
873
903
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
874
904
|
```
|
|
875
905
|
|
|
876
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
906
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/workspace/uninstall/index.ts)_
|
|
877
907
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class FlowRun extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
cmd: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
pin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
static strict: boolean;
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getConfigManager } from '../../../lib/config/index.js';
|
|
3
|
+
import { gitUtils } from '../../../lib/git-utils.js';
|
|
4
|
+
import Run from '../../run/index.js';
|
|
5
|
+
export default class FlowRun extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
cmd: Args.string({ description: 'command to run', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static description = 'Run a command with hereya env vars in a git branch-based workspace';
|
|
10
|
+
static examples = [
|
|
11
|
+
'<%= config.bin %> <%= command.id %> -- npm run dev',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --profile staging -- node index.js',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --pin -- npm test',
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
chdir: Flags.string({
|
|
17
|
+
description: 'directory to run command in',
|
|
18
|
+
required: false,
|
|
19
|
+
}),
|
|
20
|
+
pin: Flags.boolean({
|
|
21
|
+
description: 'append git commit SHA to workspace name for commit-specific isolation',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
profile: Flags.string({
|
|
25
|
+
description: 'profile to use for the workspace (will be appended to workspace name)',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
static strict = false;
|
|
30
|
+
async run() {
|
|
31
|
+
const { argv, flags } = await this.parse(FlowRun);
|
|
32
|
+
const projectRootDir = flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR;
|
|
33
|
+
// Load project config
|
|
34
|
+
const configManager = getConfigManager();
|
|
35
|
+
const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
|
|
36
|
+
if (!loadConfigOutput.found) {
|
|
37
|
+
this.error("Project not initialized. Run 'hereya init' first.");
|
|
38
|
+
}
|
|
39
|
+
// Get current git branch
|
|
40
|
+
const gitBranch = await gitUtils.getCurrentGitBranch(projectRootDir);
|
|
41
|
+
// Sanitize branch name
|
|
42
|
+
const sanitizedBranch = gitUtils.sanitizeBranchName(gitBranch);
|
|
43
|
+
if (!sanitizedBranch) {
|
|
44
|
+
this.error('Branch name contains only special characters and cannot be used for workspace name');
|
|
45
|
+
}
|
|
46
|
+
// Get commit SHA if pin flag is set
|
|
47
|
+
const commitSHA = flags.pin ? await gitUtils.getShortCommitSHA(projectRootDir) : null;
|
|
48
|
+
// Build workspace name parts
|
|
49
|
+
const parts = [loadConfigOutput.config.project, sanitizedBranch];
|
|
50
|
+
if (flags.profile)
|
|
51
|
+
parts.push(flags.profile);
|
|
52
|
+
if (commitSHA)
|
|
53
|
+
parts.push(commitSHA);
|
|
54
|
+
const workspaceName = parts.join('---');
|
|
55
|
+
// Build args for run command
|
|
56
|
+
const runArgs = ['--workspace', workspaceName];
|
|
57
|
+
// Pass through chdir flag
|
|
58
|
+
if (flags.chdir)
|
|
59
|
+
runArgs.push('--chdir', flags.chdir);
|
|
60
|
+
// Add the command and its arguments
|
|
61
|
+
// argv contains all the arguments after the double dash
|
|
62
|
+
const allCmdArgs = argv;
|
|
63
|
+
runArgs.push('--', ...allCmdArgs);
|
|
64
|
+
await Run.run(runArgs);
|
|
65
|
+
}
|
|
66
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1013,6 +1013,63 @@
|
|
|
1013
1013
|
"index.js"
|
|
1014
1014
|
]
|
|
1015
1015
|
},
|
|
1016
|
+
"flow:run": {
|
|
1017
|
+
"aliases": [],
|
|
1018
|
+
"args": {
|
|
1019
|
+
"cmd": {
|
|
1020
|
+
"description": "command to run",
|
|
1021
|
+
"name": "cmd",
|
|
1022
|
+
"required": true
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
"description": "Run a command with hereya env vars in a git branch-based workspace",
|
|
1026
|
+
"examples": [
|
|
1027
|
+
"<%= config.bin %> <%= command.id %> -- npm run dev",
|
|
1028
|
+
"<%= config.bin %> <%= command.id %> --profile staging -- node index.js",
|
|
1029
|
+
"<%= config.bin %> <%= command.id %> --pin -- npm test"
|
|
1030
|
+
],
|
|
1031
|
+
"flags": {
|
|
1032
|
+
"chdir": {
|
|
1033
|
+
"description": "directory to run command in",
|
|
1034
|
+
"name": "chdir",
|
|
1035
|
+
"required": false,
|
|
1036
|
+
"hasDynamicHelp": false,
|
|
1037
|
+
"multiple": false,
|
|
1038
|
+
"type": "option"
|
|
1039
|
+
},
|
|
1040
|
+
"pin": {
|
|
1041
|
+
"description": "append git commit SHA to workspace name for commit-specific isolation",
|
|
1042
|
+
"name": "pin",
|
|
1043
|
+
"required": false,
|
|
1044
|
+
"allowNo": false,
|
|
1045
|
+
"type": "boolean"
|
|
1046
|
+
},
|
|
1047
|
+
"profile": {
|
|
1048
|
+
"description": "profile to use for the workspace (will be appended to workspace name)",
|
|
1049
|
+
"name": "profile",
|
|
1050
|
+
"required": false,
|
|
1051
|
+
"hasDynamicHelp": false,
|
|
1052
|
+
"multiple": false,
|
|
1053
|
+
"type": "option"
|
|
1054
|
+
}
|
|
1055
|
+
},
|
|
1056
|
+
"hasDynamicHelp": false,
|
|
1057
|
+
"hiddenAliases": [],
|
|
1058
|
+
"id": "flow:run",
|
|
1059
|
+
"pluginAlias": "hereya-cli",
|
|
1060
|
+
"pluginName": "hereya-cli",
|
|
1061
|
+
"pluginType": "core",
|
|
1062
|
+
"strict": false,
|
|
1063
|
+
"enableJsonFlag": false,
|
|
1064
|
+
"isESM": true,
|
|
1065
|
+
"relativePath": [
|
|
1066
|
+
"dist",
|
|
1067
|
+
"commands",
|
|
1068
|
+
"flow",
|
|
1069
|
+
"run",
|
|
1070
|
+
"index.js"
|
|
1071
|
+
]
|
|
1072
|
+
},
|
|
1016
1073
|
"flow:up": {
|
|
1017
1074
|
"aliases": [],
|
|
1018
1075
|
"args": {},
|
|
@@ -1526,5 +1583,5 @@
|
|
|
1526
1583
|
]
|
|
1527
1584
|
}
|
|
1528
1585
|
},
|
|
1529
|
-
"version": "0.
|
|
1586
|
+
"version": "0.48.0"
|
|
1530
1587
|
}
|