hereya-cli 0.48.0 → 0.50.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  hereya-cli
2
2
  =================
3
3
 
4
- Manage infrastructure components as packages.
4
+ The package manager for infrastructure resources.
5
5
 
6
6
 
7
7
  [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
@@ -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.48.0 linux-x64 node-v22.17.1
23
+ hereya-cli/0.50.0 linux-x64 node-v22.17.1
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -40,7 +40,10 @@ 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 add PACKAGE`](#hereya-flow-add-package)
43
44
  * [`hereya flow down`](#hereya-flow-down)
45
+ * [`hereya flow env [NAME]`](#hereya-flow-env-name)
46
+ * [`hereya flow remove PACKAGE`](#hereya-flow-remove-package)
44
47
  * [`hereya flow run CMD`](#hereya-flow-run-cmd)
45
48
  * [`hereya flow up`](#hereya-flow-up)
46
49
  * [`hereya help [COMMAND]`](#hereya-help-command)
@@ -95,7 +98,7 @@ EXAMPLES
95
98
  $ hereya add cloudy/docker_postgres
96
99
  ```
97
100
 
98
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/add/index.ts)_
101
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/add/index.ts)_
99
102
 
100
103
  ## `hereya bootstrap INFRASTRUCTURETYPE`
101
104
 
@@ -120,7 +123,7 @@ EXAMPLES
120
123
  $ hereya bootstrap local
121
124
  ```
122
125
 
123
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/bootstrap/index.ts)_
126
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/bootstrap/index.ts)_
124
127
 
125
128
  ## `hereya config export-backend [FILE]`
126
129
 
@@ -142,7 +145,7 @@ EXAMPLES
142
145
  $ hereya config export-backend ./path/to/export.json
143
146
  ```
144
147
 
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)_
148
+ _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/config/export-backend/index.ts)_
146
149
 
147
150
  ## `hereya config get-backend`
148
151
 
@@ -159,7 +162,7 @@ EXAMPLES
159
162
  $ hereya config get-backend
160
163
  ```
161
164
 
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)_
165
+ _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/config/get-backend/index.ts)_
163
166
 
164
167
  ## `hereya config import-backend FILE`
165
168
 
@@ -179,7 +182,7 @@ EXAMPLES
179
182
  $ hereya config import-backend ./path/to/cloud-backend.json
180
183
  ```
181
184
 
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)_
185
+ _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/config/import-backend/index.ts)_
183
186
 
184
187
  ## `hereya config use-backend TYPE`
185
188
 
@@ -201,7 +204,7 @@ EXAMPLES
201
204
  $ hereya config use-backend local
202
205
  ```
203
206
 
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)_
207
+ _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/config/use-backend/index.ts)_
205
208
 
206
209
  ## `hereya delete-state`
207
210
 
@@ -227,7 +230,7 @@ EXAMPLES
227
230
  $ hereya delete-state --workspace staging
228
231
  ```
229
232
 
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)_
233
+ _See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/delete-state/index.ts)_
231
234
 
232
235
  ## `hereya deploy`
233
236
 
@@ -252,7 +255,7 @@ EXAMPLES
252
255
  $ hereya deploy
253
256
  ```
254
257
 
255
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/deploy/index.ts)_
258
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/deploy/index.ts)_
256
259
 
257
260
  ## `hereya down`
258
261
 
@@ -279,7 +282,7 @@ EXAMPLES
279
282
  $ hereya down
280
283
  ```
281
284
 
282
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/down/index.ts)_
285
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/down/index.ts)_
283
286
 
284
287
  ## `hereya env [NAME]`
285
288
 
@@ -310,7 +313,7 @@ EXAMPLES
310
313
  $ hereya env -w dev -l
311
314
  ```
312
315
 
313
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/env/index.ts)_
316
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/env/index.ts)_
314
317
 
315
318
  ## `hereya env set [NAME]`
316
319
 
@@ -337,7 +340,45 @@ EXAMPLES
337
340
  $ hereya env set FOO -v bar -w dev
338
341
  ```
339
342
 
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)_
343
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/env/set/index.ts)_
344
+
345
+ ## `hereya flow add PACKAGE`
346
+
347
+ Add a package to the project in a git branch-based workspace
348
+
349
+ ```
350
+ USAGE
351
+ $ hereya flow add PACKAGE [--chdir <value>] [--debug] [-p <value>...] [--profile <value>]
352
+
353
+ ARGUMENTS
354
+ PACKAGE The package to add, specified as a GitHub repository in the format owner/repository.
355
+ To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to
356
+ $HEREYA_REGISTRY_URL/owner/repository.
357
+ For local packages, use the format local/path/to/package where path/to/package is the path to the package on
358
+ your local machine.
359
+
360
+ FLAGS
361
+ -p, --parameter=<value>... [default: ] parameter for the package, in the form of 'key=value'. Can be specified
362
+ multiple times.
363
+ --chdir=<value> Directory where the command will be executed.
364
+ If not specified, it defaults to the current working directory.
365
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
366
+ environment variable.
367
+ --debug enable debug mode
368
+ --profile=<value> profile to use for the workspace (will be appended to workspace name)
369
+
370
+ DESCRIPTION
371
+ Add a package to the project in a git branch-based workspace
372
+
373
+ EXAMPLES
374
+ $ hereya flow add cloudy/docker_postgres
375
+
376
+ $ hereya flow add cloudy/docker_postgres --profile staging
377
+
378
+ $ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
379
+ ```
380
+
381
+ _See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/flow/add/index.ts)_
341
382
 
342
383
  ## `hereya flow down`
343
384
 
@@ -371,7 +412,71 @@ EXAMPLES
371
412
  $ hereya flow down --pin
372
413
  ```
373
414
 
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)_
415
+ _See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/flow/down/index.ts)_
416
+
417
+ ## `hereya flow env [NAME]`
418
+
419
+ Print project environment variables for a git branch-based workspace
420
+
421
+ ```
422
+ USAGE
423
+ $ hereya flow env [NAME] [--chdir <value>] [-l] [--pin] [--profile <value>]
424
+
425
+ ARGUMENTS
426
+ NAME name of the env to display
427
+
428
+ FLAGS
429
+ -l, --list list only the env vars without values
430
+ --chdir=<value> project root directory
431
+ --pin append git commit SHA to workspace name for commit-specific isolation
432
+ --profile=<value> profile to use for the workspace (will be appended to workspace name)
433
+
434
+ DESCRIPTION
435
+ Print project environment variables for a git branch-based workspace
436
+
437
+ EXAMPLES
438
+ $ hereya flow env
439
+
440
+ $ hereya flow env myEnv
441
+
442
+ $ hereya flow env --profile staging
443
+
444
+ $ hereya flow env --pin
445
+
446
+ $ hereya flow env -l
447
+ ```
448
+
449
+ _See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/flow/env/index.ts)_
450
+
451
+ ## `hereya flow remove PACKAGE`
452
+
453
+ Remove a package from the project in a git branch-based workspace
454
+
455
+ ```
456
+ USAGE
457
+ $ hereya flow remove PACKAGE [--chdir <value>] [--debug] [--profile <value>]
458
+
459
+ ARGUMENTS
460
+ PACKAGE Remove a previously added package.
461
+
462
+ FLAGS
463
+ --chdir=<value> Directory where the command will be executed.
464
+ If not specified, it defaults to the current working directory.
465
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment
466
+ variable.
467
+ --debug enable debug mode
468
+ --profile=<value> profile to use for the workspace (will be appended to workspace name)
469
+
470
+ DESCRIPTION
471
+ Remove a package from the project in a git branch-based workspace
472
+
473
+ EXAMPLES
474
+ $ hereya flow remove cloudy/docker_postgres
475
+
476
+ $ hereya flow remove cloudy/docker_postgres --profile staging
477
+ ```
478
+
479
+ _See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/flow/remove/index.ts)_
375
480
 
376
481
  ## `hereya flow run CMD`
377
482
 
@@ -400,7 +505,7 @@ EXAMPLES
400
505
  $ hereya flow run --pin -- npm test
401
506
  ```
402
507
 
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)_
508
+ _See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/flow/run/index.ts)_
404
509
 
405
510
  ## `hereya flow up`
406
511
 
@@ -434,7 +539,7 @@ EXAMPLES
434
539
  $ hereya flow up --pin
435
540
  ```
436
541
 
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)_
542
+ _See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/flow/up/index.ts)_
438
543
 
439
544
  ## `hereya help [COMMAND]`
440
545
 
@@ -491,7 +596,7 @@ EXAMPLES
491
596
  $ hereya import org/my-package -f state.tfstate -w my-workspace
492
597
  ```
493
598
 
494
- _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/import/index.ts)_
599
+ _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/import/index.ts)_
495
600
 
496
601
  ## `hereya init PROJECT`
497
602
 
@@ -517,7 +622,7 @@ EXAMPLES
517
622
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
518
623
  ```
519
624
 
520
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/init/index.ts)_
625
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/init/index.ts)_
521
626
 
522
627
  ## `hereya login [URL]`
523
628
 
@@ -546,7 +651,7 @@ EXAMPLES
546
651
  $ hereya login --token=your-token https://cloud.hereya.dev
547
652
  ```
548
653
 
549
- _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/login/index.ts)_
654
+ _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/login/index.ts)_
550
655
 
551
656
  ## `hereya logout`
552
657
 
@@ -563,7 +668,7 @@ EXAMPLES
563
668
  $ hereya logout
564
669
  ```
565
670
 
566
- _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/logout/index.ts)_
671
+ _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/logout/index.ts)_
567
672
 
568
673
  ## `hereya remove PACKAGE`
569
674
 
@@ -591,7 +696,7 @@ EXAMPLES
591
696
  $ hereya remove cloudy/docker_postgres
592
697
  ```
593
698
 
594
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/remove/index.ts)_
699
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/remove/index.ts)_
595
700
 
596
701
  ## `hereya run CMD`
597
702
 
@@ -617,7 +722,7 @@ EXAMPLES
617
722
  $ hereya run -w uat -- node index.js
618
723
  ```
619
724
 
620
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/run/index.ts)_
725
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/run/index.ts)_
621
726
 
622
727
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
623
728
 
@@ -642,7 +747,7 @@ EXAMPLES
642
747
  $ hereya unbootstrap local
643
748
  ```
644
749
 
645
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/unbootstrap/index.ts)_
750
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/unbootstrap/index.ts)_
646
751
 
647
752
  ## `hereya undeploy`
648
753
 
@@ -667,7 +772,7 @@ EXAMPLES
667
772
  $ hereya undeploy
668
773
  ```
669
774
 
670
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/undeploy/index.ts)_
775
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/undeploy/index.ts)_
671
776
 
672
777
  ## `hereya up`
673
778
 
@@ -694,7 +799,7 @@ EXAMPLES
694
799
  $ hereya up
695
800
  ```
696
801
 
697
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.48.0/src/commands/up/index.ts)_
802
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/up/index.ts)_
698
803
 
699
804
  ## `hereya workspace create NAME`
700
805
 
@@ -718,7 +823,7 @@ EXAMPLES
718
823
  $ hereya workspace create dev
719
824
  ```
720
825
 
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)_
826
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/create/index.ts)_
722
827
 
723
828
  ## `hereya workspace delete NAME`
724
829
 
@@ -738,7 +843,7 @@ EXAMPLES
738
843
  $ hereya workspace delete dev
739
844
  ```
740
845
 
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)_
846
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/delete/index.ts)_
742
847
 
743
848
  ## `hereya workspace env [NAME]`
744
849
 
@@ -764,7 +869,7 @@ EXAMPLES
764
869
  $ hereya workspace env myEnv -w dev
765
870
  ```
766
871
 
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)_
872
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/env/index.ts)_
768
873
 
769
874
  ## `hereya workspace env set`
770
875
 
@@ -788,7 +893,7 @@ EXAMPLES
788
893
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
789
894
  ```
790
895
 
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)_
896
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/env/set/index.ts)_
792
897
 
793
898
  ## `hereya workspace env unset`
794
899
 
@@ -809,7 +914,7 @@ EXAMPLES
809
914
  $ hereya workspace env unset -w my-workspace -n myVar
810
915
  ```
811
916
 
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)_
917
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/env/unset/index.ts)_
813
918
 
814
919
  ## `hereya workspace install PACKAGE`
815
920
 
@@ -836,7 +941,7 @@ EXAMPLES
836
941
  $ hereya workspace install hereya/aws-cognito
837
942
  ```
838
943
 
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)_
944
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/install/index.ts)_
840
945
 
841
946
  ## `hereya workspace list`
842
947
 
@@ -853,7 +958,7 @@ EXAMPLES
853
958
  $ hereya workspace list
854
959
  ```
855
960
 
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)_
961
+ _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/list/index.ts)_
857
962
 
858
963
  ## `hereya workspace set-profile PROFILE`
859
964
 
@@ -876,7 +981,7 @@ EXAMPLES
876
981
  $ hereya workspace set-profile prod-profile -w production
877
982
  ```
878
983
 
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)_
984
+ _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/set-profile/index.ts)_
880
985
 
881
986
  ## `hereya workspace uninstall PACKAGE`
882
987
 
@@ -903,5 +1008,5 @@ EXAMPLES
903
1008
  $ hereya workspace uninstall hereya/aws-cognito
904
1009
  ```
905
1010
 
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)_
1011
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.50.0/src/commands/workspace/uninstall/index.ts)_
907
1012
  <!-- commandsstop -->
@@ -1,4 +1,4 @@
1
- import { addOrgPrefix, extractOrgPrefix } from '../../lib/org-utils.js';
1
+ import { resolveWorkspaceName } from '../../lib/workspace-utils.js';
2
2
  export class CloudBackend {
3
3
  config;
4
4
  constructor(config) {
@@ -212,13 +212,7 @@ export class CloudBackend {
212
212
  }
213
213
  async getWorkspaceEnv(input) {
214
214
  // Apply org prefix if project has one and workspace doesn't
215
- let workspaceName = input.workspace;
216
- if (input.project) {
217
- const { org: projectOrg } = extractOrgPrefix(input.project);
218
- if (projectOrg) {
219
- workspaceName = addOrgPrefix(projectOrg, input.workspace);
220
- }
221
- }
215
+ const workspaceName = resolveWorkspaceName(input.workspace, input.project);
222
216
  const workspace$ = await this.getWorkspace(workspaceName);
223
217
  if (!workspace$.found) {
224
218
  return {
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { stringify } from 'yaml';
3
- import { addOrgPrefix, extractOrgPrefix } from '../lib/org-utils.js';
3
+ import { resolveWorkspaceName } from '../lib/workspace-utils.js';
4
4
  import { parseYaml } from '../lib/yaml-utils.js';
5
5
  import { WorkspaceSchema, } from './common.js';
6
6
  export class FileBackend {
@@ -292,13 +292,7 @@ export class FileBackend {
292
292
  }
293
293
  async getWorkspaceEnv(input) {
294
294
  // Apply org prefix if project has one and workspace doesn't
295
- let workspaceName = input.workspace;
296
- if (input.project) {
297
- const { org: projectOrg } = extractOrgPrefix(input.project);
298
- if (projectOrg) {
299
- workspaceName = addOrgPrefix(projectOrg, input.workspace);
300
- }
301
- }
295
+ const workspaceName = resolveWorkspaceName(input.workspace, input.project);
302
296
  const workspace$ = await this.getWorkspace(workspaceName);
303
297
  if (!workspace$.found) {
304
298
  return {
@@ -83,7 +83,7 @@ export default class Add extends Command {
83
83
  const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
84
84
  const parameterManager = getParameterManager();
85
85
  const backend = await getBackend();
86
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
86
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
87
87
  const parametersOutput = await parameterManager.getPackageParameters({
88
88
  package: ctx.package,
89
89
  profile,
@@ -55,7 +55,7 @@ export default class Deploy extends Command {
55
55
  {
56
56
  async task(ctx) {
57
57
  const backend = await getBackend();
58
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
58
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
59
59
  const envManager = getEnvManager();
60
60
  const getProjectEnvOutput = await envManager.getProjectEnv({
61
61
  markSecret: true,
@@ -106,7 +106,7 @@ export default class Deploy extends Command {
106
106
  async task(_, task) {
107
107
  const parameterManager = getParameterManager();
108
108
  const backend = await getBackend();
109
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
109
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
110
110
  const { parameters } = await parameterManager.getPackageParameters({
111
111
  package: packageName,
112
112
  profile,
@@ -146,7 +146,7 @@ export default class Deploy extends Command {
146
146
  async task(_, task) {
147
147
  const parameterManager = getParameterManager();
148
148
  const backend = await getBackend();
149
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
149
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
150
150
  const { parameters } = await parameterManager.getPackageParameters({
151
151
  package: packageName,
152
152
  profile,
@@ -192,7 +192,7 @@ export default class Deploy extends Command {
192
192
  async task(_, task) {
193
193
  const parameterManager = getParameterManager();
194
194
  const backend = await getBackend();
195
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
195
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
196
196
  const { parameters } = await parameterManager.getPackageParameters({
197
197
  package: packageName,
198
198
  profile,
@@ -279,7 +279,7 @@ export default class Deploy extends Command {
279
279
  skip: (ctx) => ctx.deployPackages.length === 0,
280
280
  async task(ctx, task) {
281
281
  const backend = await getBackend();
282
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
282
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
283
283
  const envManager = getEnvManager();
284
284
  const getProjectEnvOutput = await envManager.getProjectEnv({
285
285
  markSecret: true,
@@ -298,7 +298,7 @@ export default class Deploy extends Command {
298
298
  async task(_, task) {
299
299
  const parameterManager = getParameterManager();
300
300
  const backend = await getBackend();
301
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
301
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
302
302
  const { parameters } = await parameterManager.getPackageParameters({
303
303
  package: packageName,
304
304
  profile,
@@ -96,7 +96,7 @@ export default class Down extends Command {
96
96
  async task(_, task) {
97
97
  const parameterManager = getParameterManager();
98
98
  const backend = await getBackend();
99
- const profile = await getProfileFromWorkspace(backend, ctx.workspace);
99
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace, ctx.configOutput.config.project);
100
100
  const { parameters } = await parameterManager.getPackageParameters({
101
101
  package: packageName,
102
102
  profile,
@@ -49,7 +49,7 @@ export default class Env extends Command {
49
49
  this.error('you must specify a workspace to print the env vars for');
50
50
  }
51
51
  const backend = await getBackend();
52
- const profile = await getProfileFromWorkspace(backend, workspace);
52
+ const profile = await getProfileFromWorkspace(backend, workspace, config.project);
53
53
  const envManager = getEnvManager();
54
54
  const getProjectEnvOutput = await envManager.getProjectEnv({
55
55
  profile,
@@ -0,0 +1,15 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class FlowAdd extends Command {
3
+ static args: {
4
+ package: 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
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ parameter: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
12
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,90 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { getConfigManager } from '../../../lib/config/index.js';
3
+ import { buildFlowWorkspaceName } from '../../../lib/flow-utils.js';
4
+ import { setDebug } from '../../../lib/log.js';
5
+ import Add from '../../add/index.js';
6
+ import WorkspaceCreate from '../../workspace/create/index.js';
7
+ export default class FlowAdd extends Command {
8
+ static args = {
9
+ package: Args.string({
10
+ description: `
11
+ The package to add, specified as a GitHub repository in the format owner/repository.
12
+ To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to $HEREYA_REGISTRY_URL/owner/repository.
13
+ For local packages, use the format local/path/to/package where path/to/package is the path to the package on your local machine.
14
+ `,
15
+ required: true,
16
+ }),
17
+ };
18
+ static description = 'Add a package to the project in a git branch-based workspace';
19
+ static examples = [
20
+ '<%= config.bin %> <%= command.id %> cloudy/docker_postgres',
21
+ '<%= config.bin %> <%= command.id %> cloudy/docker_postgres --profile staging',
22
+ '<%= config.bin %> <%= command.id %> cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin',
23
+ ];
24
+ static flags = {
25
+ chdir: Flags.string({
26
+ description: `
27
+ Directory where the command will be executed.
28
+ If not specified, it defaults to the current working directory.
29
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.
30
+ `,
31
+ required: false,
32
+ }),
33
+ debug: Flags.boolean({
34
+ default: false,
35
+ description: 'enable debug mode',
36
+ }),
37
+ parameter: Flags.string({
38
+ char: 'p',
39
+ default: [],
40
+ description: "parameter for the package, in the form of 'key=value'. Can be specified multiple times.",
41
+ multiple: true,
42
+ }),
43
+ profile: Flags.string({
44
+ description: 'profile to use for the workspace (will be appended to workspace name)',
45
+ required: false,
46
+ }),
47
+ };
48
+ async run() {
49
+ const { args, flags } = await this.parse(FlowAdd);
50
+ setDebug(flags.debug);
51
+ const projectRootDir = flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR;
52
+ // Load project config
53
+ const configManager = getConfigManager();
54
+ const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
55
+ if (!loadConfigOutput.found) {
56
+ this.error("Project not initialized. Run 'hereya init' first.");
57
+ }
58
+ // Build workspace name using flow utility (no pin support)
59
+ const workspaceName = await buildFlowWorkspaceName({
60
+ pin: false,
61
+ profile: flags.profile,
62
+ project: loadConfigOutput.config.project,
63
+ projectRootDir,
64
+ });
65
+ // Create workspace with mirror
66
+ const createArgs = [workspaceName, '--mirror', loadConfigOutput.config.workspace];
67
+ if (projectRootDir) {
68
+ createArgs.push('--chdir', projectRootDir);
69
+ }
70
+ if (flags.debug) {
71
+ createArgs.push('--debug');
72
+ }
73
+ if (flags.profile) {
74
+ createArgs.push('--profile', flags.profile);
75
+ }
76
+ await WorkspaceCreate.run(createArgs);
77
+ // Build args for add command
78
+ const addArgs = [args.package, '--workspace', workspaceName];
79
+ // Pass through all flags
80
+ if (flags.chdir)
81
+ addArgs.push('--chdir', flags.chdir);
82
+ if (flags.debug)
83
+ addArgs.push('--debug');
84
+ // Pass through parameters
85
+ for (const param of flags.parameter) {
86
+ addArgs.push('--parameter', param);
87
+ }
88
+ await Add.run(addArgs);
89
+ }
90
+ }