hereya-cli 0.60.0 → 0.61.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
@@ -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.60.0 linux-x64 node-v24.13.0
23
+ hereya-cli/0.61.0 linux-x64 node-v24.13.0
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -52,6 +52,7 @@ USAGE
52
52
  * [`hereya init PROJECT`](#hereya-init-project)
53
53
  * [`hereya login [URL]`](#hereya-login-url)
54
54
  * [`hereya logout`](#hereya-logout)
55
+ * [`hereya provid PACKAGE`](#hereya-provid-package)
55
56
  * [`hereya publish`](#hereya-publish)
56
57
  * [`hereya remove PACKAGE`](#hereya-remove-package)
57
58
  * [`hereya run CMD`](#hereya-run-cmd)
@@ -101,7 +102,7 @@ EXAMPLES
101
102
  $ hereya add cloudy/docker_postgres
102
103
  ```
103
104
 
104
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/add/index.ts)_
105
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/add/index.ts)_
105
106
 
106
107
  ## `hereya bootstrap INFRASTRUCTURETYPE`
107
108
 
@@ -126,7 +127,7 @@ EXAMPLES
126
127
  $ hereya bootstrap local
127
128
  ```
128
129
 
129
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/bootstrap/index.ts)_
130
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/bootstrap/index.ts)_
130
131
 
131
132
  ## `hereya config export-backend [FILE]`
132
133
 
@@ -148,7 +149,7 @@ EXAMPLES
148
149
  $ hereya config export-backend ./path/to/export.json
149
150
  ```
150
151
 
151
- _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/config/export-backend/index.ts)_
152
+ _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/config/export-backend/index.ts)_
152
153
 
153
154
  ## `hereya config get-backend`
154
155
 
@@ -165,7 +166,7 @@ EXAMPLES
165
166
  $ hereya config get-backend
166
167
  ```
167
168
 
168
- _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/config/get-backend/index.ts)_
169
+ _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/config/get-backend/index.ts)_
169
170
 
170
171
  ## `hereya config import-backend FILE`
171
172
 
@@ -185,7 +186,7 @@ EXAMPLES
185
186
  $ hereya config import-backend ./path/to/cloud-backend.json
186
187
  ```
187
188
 
188
- _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/config/import-backend/index.ts)_
189
+ _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/config/import-backend/index.ts)_
189
190
 
190
191
  ## `hereya config use-backend TYPE`
191
192
 
@@ -207,7 +208,7 @@ EXAMPLES
207
208
  $ hereya config use-backend local
208
209
  ```
209
210
 
210
- _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/config/use-backend/index.ts)_
211
+ _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/config/use-backend/index.ts)_
211
212
 
212
213
  ## `hereya delete-state`
213
214
 
@@ -233,7 +234,7 @@ EXAMPLES
233
234
  $ hereya delete-state --workspace staging
234
235
  ```
235
236
 
236
- _See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/delete-state/index.ts)_
237
+ _See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/delete-state/index.ts)_
237
238
 
238
239
  ## `hereya deploy`
239
240
 
@@ -258,7 +259,7 @@ EXAMPLES
258
259
  $ hereya deploy
259
260
  ```
260
261
 
261
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/deploy/index.ts)_
262
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/deploy/index.ts)_
262
263
 
263
264
  ## `hereya doc PACKAGE`
264
265
 
@@ -291,7 +292,7 @@ EXAMPLES
291
292
  $ hereya doc my-package --no-doc
292
293
  ```
293
294
 
294
- _See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/doc/index.ts)_
295
+ _See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/doc/index.ts)_
295
296
 
296
297
  ## `hereya down`
297
298
 
@@ -318,7 +319,7 @@ EXAMPLES
318
319
  $ hereya down
319
320
  ```
320
321
 
321
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/down/index.ts)_
322
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/down/index.ts)_
322
323
 
323
324
  ## `hereya env [NAME]`
324
325
 
@@ -349,7 +350,7 @@ EXAMPLES
349
350
  $ hereya env -w dev -l
350
351
  ```
351
352
 
352
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/env/index.ts)_
353
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/env/index.ts)_
353
354
 
354
355
  ## `hereya env set [NAME]`
355
356
 
@@ -376,7 +377,7 @@ EXAMPLES
376
377
  $ hereya env set FOO -v bar -w dev
377
378
  ```
378
379
 
379
- _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/env/set/index.ts)_
380
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/env/set/index.ts)_
380
381
 
381
382
  ## `hereya flow add PACKAGE`
382
383
 
@@ -414,7 +415,7 @@ EXAMPLES
414
415
  $ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
415
416
  ```
416
417
 
417
- _See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/flow/add/index.ts)_
418
+ _See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/flow/add/index.ts)_
418
419
 
419
420
  ## `hereya flow down`
420
421
 
@@ -448,7 +449,7 @@ EXAMPLES
448
449
  $ hereya flow down --pin
449
450
  ```
450
451
 
451
- _See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/flow/down/index.ts)_
452
+ _See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/flow/down/index.ts)_
452
453
 
453
454
  ## `hereya flow env [NAME]`
454
455
 
@@ -482,7 +483,7 @@ EXAMPLES
482
483
  $ hereya flow env -l
483
484
  ```
484
485
 
485
- _See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/flow/env/index.ts)_
486
+ _See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/flow/env/index.ts)_
486
487
 
487
488
  ## `hereya flow remove PACKAGE`
488
489
 
@@ -512,7 +513,7 @@ EXAMPLES
512
513
  $ hereya flow remove cloudy/docker_postgres --profile staging
513
514
  ```
514
515
 
515
- _See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/flow/remove/index.ts)_
516
+ _See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/flow/remove/index.ts)_
516
517
 
517
518
  ## `hereya flow run CMD`
518
519
 
@@ -541,7 +542,7 @@ EXAMPLES
541
542
  $ hereya flow run --pin -- npm test
542
543
  ```
543
544
 
544
- _See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/flow/run/index.ts)_
545
+ _See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/flow/run/index.ts)_
545
546
 
546
547
  ## `hereya flow up`
547
548
 
@@ -575,7 +576,7 @@ EXAMPLES
575
576
  $ hereya flow up --pin
576
577
  ```
577
578
 
578
- _See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/flow/up/index.ts)_
579
+ _See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/flow/up/index.ts)_
579
580
 
580
581
  ## `hereya help [COMMAND]`
581
582
 
@@ -632,7 +633,7 @@ EXAMPLES
632
633
  $ hereya import org/my-package -f state.tfstate -w my-workspace
633
634
  ```
634
635
 
635
- _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/import/index.ts)_
636
+ _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/import/index.ts)_
636
637
 
637
638
  ## `hereya init PROJECT`
638
639
 
@@ -658,7 +659,7 @@ EXAMPLES
658
659
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
659
660
  ```
660
661
 
661
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/init/index.ts)_
662
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/init/index.ts)_
662
663
 
663
664
  ## `hereya login [URL]`
664
665
 
@@ -687,7 +688,7 @@ EXAMPLES
687
688
  $ hereya login --token=your-token https://cloud.hereya.dev
688
689
  ```
689
690
 
690
- _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/login/index.ts)_
691
+ _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/login/index.ts)_
691
692
 
692
693
  ## `hereya logout`
693
694
 
@@ -704,7 +705,35 @@ EXAMPLES
704
705
  $ hereya logout
705
706
  ```
706
707
 
707
- _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/logout/index.ts)_
708
+ _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/logout/index.ts)_
709
+
710
+ ## `hereya provid PACKAGE`
711
+
712
+ Display the provisioning ID for a package
713
+
714
+ ```
715
+ USAGE
716
+ $ hereya provid PACKAGE [-C <value>] [-w <value>]
717
+
718
+ ARGUMENTS
719
+ PACKAGE Package name (e.g., hereya/postgres)
720
+
721
+ FLAGS
722
+ -C, --chdir=<value> Project root directory
723
+ -w, --workspace=<value> Name of the workspace
724
+
725
+ DESCRIPTION
726
+ Display the provisioning ID for a package
727
+
728
+ EXAMPLES
729
+ $ hereya provid hereya/postgres
730
+
731
+ $ hereya provid hereya/postgres -w dev
732
+
733
+ $ hereya provid hereya/postgres --workspace staging
734
+ ```
735
+
736
+ _See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/provid/index.ts)_
708
737
 
709
738
  ## `hereya publish`
710
739
 
@@ -727,7 +756,7 @@ EXAMPLES
727
756
  $ hereya publish --chdir=/path/to/package
728
757
  ```
729
758
 
730
- _See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/publish/index.ts)_
759
+ _See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/publish/index.ts)_
731
760
 
732
761
  ## `hereya remove PACKAGE`
733
762
 
@@ -755,7 +784,7 @@ EXAMPLES
755
784
  $ hereya remove cloudy/docker_postgres
756
785
  ```
757
786
 
758
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/remove/index.ts)_
787
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/remove/index.ts)_
759
788
 
760
789
  ## `hereya run CMD`
761
790
 
@@ -781,7 +810,7 @@ EXAMPLES
781
810
  $ hereya run -w uat -- node index.js
782
811
  ```
783
812
 
784
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/run/index.ts)_
813
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/run/index.ts)_
785
814
 
786
815
  ## `hereya search QUERY`
787
816
 
@@ -812,7 +841,7 @@ EXAMPLES
812
841
  $ hereya search database --json
813
842
  ```
814
843
 
815
- _See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/search/index.ts)_
844
+ _See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/search/index.ts)_
816
845
 
817
846
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
818
847
 
@@ -837,7 +866,7 @@ EXAMPLES
837
866
  $ hereya unbootstrap local
838
867
  ```
839
868
 
840
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/unbootstrap/index.ts)_
869
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/unbootstrap/index.ts)_
841
870
 
842
871
  ## `hereya undeploy`
843
872
 
@@ -862,7 +891,7 @@ EXAMPLES
862
891
  $ hereya undeploy
863
892
  ```
864
893
 
865
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/undeploy/index.ts)_
894
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/undeploy/index.ts)_
866
895
 
867
896
  ## `hereya up`
868
897
 
@@ -889,7 +918,7 @@ EXAMPLES
889
918
  $ hereya up
890
919
  ```
891
920
 
892
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/up/index.ts)_
921
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/up/index.ts)_
893
922
 
894
923
  ## `hereya workspace create NAME`
895
924
 
@@ -914,7 +943,7 @@ EXAMPLES
914
943
  $ hereya workspace create dev
915
944
  ```
916
945
 
917
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/create/index.ts)_
946
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/create/index.ts)_
918
947
 
919
948
  ## `hereya workspace delete NAME`
920
949
 
@@ -934,7 +963,7 @@ EXAMPLES
934
963
  $ hereya workspace delete dev
935
964
  ```
936
965
 
937
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/delete/index.ts)_
966
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/delete/index.ts)_
938
967
 
939
968
  ## `hereya workspace env [NAME]`
940
969
 
@@ -960,7 +989,7 @@ EXAMPLES
960
989
  $ hereya workspace env myEnv -w dev
961
990
  ```
962
991
 
963
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/env/index.ts)_
992
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/env/index.ts)_
964
993
 
965
994
  ## `hereya workspace env set`
966
995
 
@@ -984,7 +1013,7 @@ EXAMPLES
984
1013
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
985
1014
  ```
986
1015
 
987
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/env/set/index.ts)_
1016
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/env/set/index.ts)_
988
1017
 
989
1018
  ## `hereya workspace env unset`
990
1019
 
@@ -1005,7 +1034,7 @@ EXAMPLES
1005
1034
  $ hereya workspace env unset -w my-workspace -n myVar
1006
1035
  ```
1007
1036
 
1008
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/env/unset/index.ts)_
1037
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/env/unset/index.ts)_
1009
1038
 
1010
1039
  ## `hereya workspace install PACKAGE`
1011
1040
 
@@ -1032,7 +1061,7 @@ EXAMPLES
1032
1061
  $ hereya workspace install hereya/aws-cognito
1033
1062
  ```
1034
1063
 
1035
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/install/index.ts)_
1064
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/install/index.ts)_
1036
1065
 
1037
1066
  ## `hereya workspace list`
1038
1067
 
@@ -1049,7 +1078,7 @@ EXAMPLES
1049
1078
  $ hereya workspace list
1050
1079
  ```
1051
1080
 
1052
- _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/list/index.ts)_
1081
+ _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/list/index.ts)_
1053
1082
 
1054
1083
  ## `hereya workspace set-profile PROFILE`
1055
1084
 
@@ -1073,7 +1102,7 @@ EXAMPLES
1073
1102
  $ hereya workspace set-profile prod-profile -w production
1074
1103
  ```
1075
1104
 
1076
- _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/set-profile/index.ts)_
1105
+ _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/set-profile/index.ts)_
1077
1106
 
1078
1107
  ## `hereya workspace uninstall PACKAGE`
1079
1108
 
@@ -1100,5 +1129,5 @@ EXAMPLES
1100
1129
  $ hereya workspace uninstall hereya/aws-cognito
1101
1130
  ```
1102
1131
 
1103
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.60.0/src/commands/workspace/uninstall/index.ts)_
1132
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.61.0/src/commands/workspace/uninstall/index.ts)_
1104
1133
  <!-- commandsstop -->
@@ -0,0 +1,14 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Provid 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
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ private findPackageVersion;
14
+ }
@@ -0,0 +1,104 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import fs from 'node:fs/promises';
3
+ import { getBackend } from '../../backend/index.js';
4
+ import { getPackageDownloadPath } from '../../infrastructure/common.js';
5
+ import { getProvisioningLogicalId } from '../../infrastructure/index.js';
6
+ import { getConfigManager } from '../../lib/config/index.js';
7
+ import { getPackageCanonicalName } from '../../lib/package/index.js';
8
+ export default class Provid extends Command {
9
+ static args = {
10
+ package: Args.string({
11
+ description: 'Package name (e.g., hereya/postgres)',
12
+ required: true,
13
+ }),
14
+ };
15
+ static description = 'Display the provisioning ID for a package';
16
+ static examples = [
17
+ '<%= config.bin %> <%= command.id %> hereya/postgres',
18
+ '<%= config.bin %> <%= command.id %> hereya/postgres -w dev',
19
+ '<%= config.bin %> <%= command.id %> hereya/postgres --workspace staging',
20
+ ];
21
+ static flags = {
22
+ chdir: Flags.string({
23
+ char: 'C',
24
+ description: 'Project root directory',
25
+ required: false,
26
+ }),
27
+ workspace: Flags.string({
28
+ char: 'w',
29
+ description: 'Name of the workspace',
30
+ required: false,
31
+ }),
32
+ };
33
+ async run() {
34
+ const { args, flags } = await this.parse(Provid);
35
+ const projectRootDir = flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR;
36
+ const configManager = getConfigManager();
37
+ const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
38
+ if (!loadConfigOutput.found) {
39
+ this.warn(`Project not initialized. Run 'hereya init' first.`);
40
+ return;
41
+ }
42
+ const { config } = loadConfigOutput;
43
+ let { workspace } = flags;
44
+ if (!workspace) {
45
+ workspace = config.workspace;
46
+ }
47
+ if (!workspace) {
48
+ this.error('You must specify a workspace with --workspace or set a default workspace in hereya.yaml');
49
+ }
50
+ const { project } = config;
51
+ const packageName = args.package;
52
+ const packageCanonicalName = getPackageCanonicalName(packageName);
53
+ const logicalId = getProvisioningLogicalId({ pkg: packageName, project, workspace });
54
+ const backend = await getBackend();
55
+ const provisioningIdResult = await backend.getProvisioningId({
56
+ logicalId,
57
+ packageCanonicalName,
58
+ project,
59
+ workspace,
60
+ });
61
+ if (!provisioningIdResult.success) {
62
+ this.error(provisioningIdResult.reason);
63
+ }
64
+ // Get version from config (packages, deploy, or onDeploy sections)
65
+ const version = this.findPackageVersion(config, packageName);
66
+ const packagePath = await getPackageDownloadPath({ id: provisioningIdResult.id, version });
67
+ this.log(`Package: ${packageName}`);
68
+ this.log(`Workspace: ${workspace}`);
69
+ this.log(`Project: ${project}`);
70
+ this.log(`Logical ID: ${logicalId}`);
71
+ this.log(`Provisioning ID: ${provisioningIdResult.id}`);
72
+ // Check if the package path exists locally
73
+ const pathExists = await fs.stat(packagePath).then(() => true).catch(() => false);
74
+ if (pathExists) {
75
+ this.log(`Package Path: ${packagePath}`);
76
+ }
77
+ else {
78
+ this.log(`Package Path: not found locally (provisioning may not have happened yet or occurred on a different computer)`);
79
+ }
80
+ }
81
+ findPackageVersion(config, packageName) {
82
+ // Check direct packages entry
83
+ if (config.packages?.[packageName]?.version) {
84
+ return config.packages[packageName].version;
85
+ }
86
+ // Check direct deploy entry
87
+ if (config.deploy?.[packageName]?.version) {
88
+ return config.deploy[packageName].version;
89
+ }
90
+ // Check onDeploy sections in packages
91
+ for (const pkg of Object.values(config.packages ?? {})) {
92
+ if (pkg.onDeploy?.pkg === packageName && pkg.onDeploy?.version) {
93
+ return pkg.onDeploy.version;
94
+ }
95
+ }
96
+ // Check onDeploy sections in deploy
97
+ for (const pkg of Object.values(config.deploy ?? {})) {
98
+ if (pkg.onDeploy?.pkg === packageName && pkg.onDeploy?.version) {
99
+ return pkg.onDeploy.version;
100
+ }
101
+ }
102
+ return undefined;
103
+ }
104
+ }
@@ -17,9 +17,10 @@ export type ApplyInput = {
17
17
  };
18
18
  id: string;
19
19
  infraConfig?: {
20
- terraformStateBucketName: string;
20
+ localStatePath?: string;
21
+ terraformStateBucketName?: string;
21
22
  terraformStateBucketRegion?: string;
22
- terraformStateLockTableName: string;
23
+ terraformStateLockTableName?: string;
23
24
  };
24
25
  logger?: Logger;
25
26
  parameters?: {
@@ -40,10 +41,11 @@ export type DestroyInput = ApplyInput;
40
41
  export type DestroyOutput = ApplyOutput;
41
42
  export type GetStateLocationInput = {
42
43
  id: string;
43
- infraConfig: {
44
- terraformStateBucketName: string;
44
+ infraConfig?: {
45
+ localStatePath?: string;
46
+ terraformStateBucketName?: string;
45
47
  terraformStateBucketRegion?: string;
46
- terraformStateLockTableName: string;
48
+ terraformStateLockTableName?: string;
47
49
  };
48
50
  };
49
51
  export type GetStateLocationOutput = {
@@ -51,6 +53,9 @@ export type GetStateLocationOutput = {
51
53
  key: string;
52
54
  region: string;
53
55
  success: true;
56
+ } | {
57
+ localPath: string;
58
+ success: true;
54
59
  } | {
55
60
  reason: string;
56
61
  success: false;
@@ -8,10 +8,24 @@ import { mapObject } from '../lib/object-utils.js';
8
8
  import { runShell } from '../lib/shell.js';
9
9
  export class Terraform {
10
10
  async apply(input) {
11
- if (input.infraConfig &&
11
+ if (input.infraConfig?.localStatePath) {
12
+ // Local backend
13
+ await fs.promises.mkdir(input.infraConfig.localStatePath, { recursive: true });
14
+ const backendConfig = `
15
+ terraform {
16
+ backend "local" {
17
+ path = "${path.join(input.infraConfig.localStatePath, 'terraform.tfstate')}"
18
+ }
19
+ }
20
+ `;
21
+ const backendFile = path.join(input.pkgPath, 'hereya_terraform_backend.tf');
22
+ await fs.promises.writeFile(backendFile, backendConfig);
23
+ }
24
+ else if (input.infraConfig &&
12
25
  input.infraConfig.terraformStateBucketName &&
13
26
  input.infraConfig.terraformStateLockTableName &&
14
27
  input.infraConfig.terraformStateBucketRegion) {
28
+ // S3 backend
15
29
  const backendConfig = `
16
30
  terraform {
17
31
  backend "s3" {
@@ -72,6 +86,38 @@ export class Terraform {
72
86
  }
73
87
  async destroy(input) {
74
88
  const terraform = await this.getTerraformBinary(input.logger);
89
+ // Write backend configuration
90
+ if (input.infraConfig?.localStatePath) {
91
+ // Local backend
92
+ await fs.promises.mkdir(input.infraConfig.localStatePath, { recursive: true });
93
+ const backendConfig = `
94
+ terraform {
95
+ backend "local" {
96
+ path = "${path.join(input.infraConfig.localStatePath, 'terraform.tfstate')}"
97
+ }
98
+ }
99
+ `;
100
+ const backendFile = path.join(input.pkgPath, 'hereya_terraform_backend.tf');
101
+ await fs.promises.writeFile(backendFile, backendConfig);
102
+ }
103
+ else if (input.infraConfig &&
104
+ input.infraConfig.terraformStateBucketName &&
105
+ input.infraConfig.terraformStateLockTableName &&
106
+ input.infraConfig.terraformStateBucketRegion) {
107
+ // S3 backend
108
+ const backendConfig = `
109
+ terraform {
110
+ backend "s3" {
111
+ bucket = "${input.infraConfig.terraformStateBucketName}"
112
+ key = "${input.id}/terraform.tfstate"
113
+ region = "${input.infraConfig.terraformStateBucketRegion}"
114
+ dynamodb_table = "${input.infraConfig.terraformStateLockTableName}"
115
+ }
116
+ }
117
+ `;
118
+ const backendFile = path.join(input.pkgPath, 'hereya_terraform_backend.tf');
119
+ await fs.promises.writeFile(backendFile, backendConfig);
120
+ }
75
121
  try {
76
122
  await runShell(terraform, ['init'], {
77
123
  directory: input.pkgPath,
@@ -177,11 +223,23 @@ export class Terraform {
177
223
  return true;
178
224
  }
179
225
  async getStateLocation(input) {
226
+ if (input.infraConfig?.localStatePath) {
227
+ return {
228
+ localPath: path.join(input.infraConfig.localStatePath, 'terraform.tfstate'),
229
+ success: true,
230
+ };
231
+ }
232
+ if (input.infraConfig?.terraformStateBucketName) {
233
+ return {
234
+ bucket: input.infraConfig.terraformStateBucketName,
235
+ key: `${input.id}/terraform.tfstate`,
236
+ region: input.infraConfig.terraformStateBucketRegion ?? '',
237
+ success: true,
238
+ };
239
+ }
180
240
  return {
181
- bucket: input.infraConfig.terraformStateBucketName,
182
- key: `${input.id}/terraform.tfstate`,
183
- region: input.infraConfig.terraformStateBucketRegion ?? '',
184
- success: true,
241
+ reason: 'No state location configuration provided',
242
+ success: false,
185
243
  };
186
244
  }
187
245
  async getEnv(pkgPath, logger) {
@@ -248,6 +248,9 @@ export class AwsInfrastructure {
248
248
  if (!stateLocation$.success) {
249
249
  return { reason: stateLocation$.reason, success: false };
250
250
  }
251
+ if (!('bucket' in stateLocation$)) {
252
+ return { reason: 'Expected S3 state location for AWS infrastructure', success: false };
253
+ }
251
254
  const { bucket, key } = stateLocation$;
252
255
  const s3Client = new S3Client({});
253
256
  await s3Client.send(new PutObjectCommand({
@@ -1,4 +1,6 @@
1
1
  import * as fs from 'node:fs/promises';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
2
4
  import { getIac } from '../iac/index.js';
3
5
  import { downloadPackage } from '../lib/package/index.js';
4
6
  import { getPackageDownloadPath, } from './common.js';
@@ -25,6 +27,9 @@ export class LocalInfrastructure {
25
27
  const output = await iac.destroy({
26
28
  env: input.env ?? {},
27
29
  id: input.id,
30
+ infraConfig: {
31
+ localStatePath: path.join(os.homedir(), '.hereya', 'tf', 'states', input.id),
32
+ },
28
33
  logger: input.logger,
29
34
  parameters: input.parameters,
30
35
  pkgPath: downloadPath,
@@ -47,6 +52,9 @@ export class LocalInfrastructure {
47
52
  const output = await iac.apply({
48
53
  env: input.env ?? {},
49
54
  id: input.id,
55
+ infraConfig: {
56
+ localStatePath: path.join(os.homedir(), '.hereya', 'tf', 'states', input.id),
57
+ },
50
58
  logger: input.logger,
51
59
  parameters: input.parameters,
52
60
  pkgPath: downloadPath,
@@ -145,7 +145,10 @@ async function resolveWithStandardManager(protocol, input, packageName, version)
145
145
  return { found: false, reason: 'Package has dependencies but is not a deploy package' };
146
146
  }
147
147
  if (input.isDeploying && metadata.onDeploy) {
148
- return resolvePackage({ ...input, package: metadata.onDeploy.pkg });
148
+ const onDeployPackage = metadata.onDeploy.version
149
+ ? `${metadata.onDeploy.pkg}@${metadata.onDeploy.version}`
150
+ : metadata.onDeploy.pkg;
151
+ return resolvePackage({ ...input, package: onDeployPackage });
149
152
  }
150
153
  return {
151
154
  canonicalName: getPackageCanonicalName(packageName),
@@ -206,7 +209,10 @@ async function resolveCloudPackage(packageInfo, cloudManager, input) {
206
209
  return { found: false, reason: 'Package has dependencies but is not a deploy package' };
207
210
  }
208
211
  if (input.isDeploying && metadata.onDeploy) {
209
- return resolvePackage({ ...input, package: metadata.onDeploy.pkg });
212
+ const onDeployPackage = metadata.onDeploy.version
213
+ ? `${metadata.onDeploy.pkg}@${metadata.onDeploy.version}`
214
+ : metadata.onDeploy.pkg;
215
+ return resolvePackage({ ...input, package: onDeployPackage });
210
216
  }
211
217
  // Build packageUri with repository and commit
212
218
  const packageUri = packageInfo.registryPackage.commit
@@ -193,6 +193,63 @@
193
193
  "index.js"
194
194
  ]
195
195
  },
196
+ "doc": {
197
+ "aliases": [],
198
+ "args": {
199
+ "package": {
200
+ "description": "Package name with optional version (e.g., my-package or my-package@1.0.0)",
201
+ "name": "package",
202
+ "required": true
203
+ }
204
+ },
205
+ "description": "Display documentation for a package from the registry",
206
+ "examples": [
207
+ "<%= config.bin %> <%= command.id %> my-package",
208
+ "<%= config.bin %> <%= command.id %> my-package@1.0.0",
209
+ "<%= config.bin %> <%= command.id %> my-package --json",
210
+ "<%= config.bin %> <%= command.id %> my-package --no-doc"
211
+ ],
212
+ "flags": {
213
+ "chdir": {
214
+ "char": "C",
215
+ "description": "directory to run command in",
216
+ "helpGroup": "global",
217
+ "name": "chdir",
218
+ "default": ".",
219
+ "hasDynamicHelp": false,
220
+ "multiple": false,
221
+ "type": "option"
222
+ },
223
+ "json": {
224
+ "char": "j",
225
+ "description": "Output in JSON format",
226
+ "name": "json",
227
+ "allowNo": false,
228
+ "type": "boolean"
229
+ },
230
+ "no-doc": {
231
+ "description": "Show only metadata without the full documentation",
232
+ "name": "no-doc",
233
+ "allowNo": false,
234
+ "type": "boolean"
235
+ }
236
+ },
237
+ "hasDynamicHelp": false,
238
+ "hiddenAliases": [],
239
+ "id": "doc",
240
+ "pluginAlias": "hereya-cli",
241
+ "pluginName": "hereya-cli",
242
+ "pluginType": "core",
243
+ "strict": true,
244
+ "enableJsonFlag": false,
245
+ "isESM": true,
246
+ "relativePath": [
247
+ "dist",
248
+ "commands",
249
+ "doc",
250
+ "index.js"
251
+ ]
252
+ },
196
253
  "down": {
197
254
  "aliases": [],
198
255
  "args": {},
@@ -257,63 +314,6 @@
257
314
  "index.js"
258
315
  ]
259
316
  },
260
- "doc": {
261
- "aliases": [],
262
- "args": {
263
- "package": {
264
- "description": "Package name with optional version (e.g., my-package or my-package@1.0.0)",
265
- "name": "package",
266
- "required": true
267
- }
268
- },
269
- "description": "Display documentation for a package from the registry",
270
- "examples": [
271
- "<%= config.bin %> <%= command.id %> my-package",
272
- "<%= config.bin %> <%= command.id %> my-package@1.0.0",
273
- "<%= config.bin %> <%= command.id %> my-package --json",
274
- "<%= config.bin %> <%= command.id %> my-package --no-doc"
275
- ],
276
- "flags": {
277
- "chdir": {
278
- "char": "C",
279
- "description": "directory to run command in",
280
- "helpGroup": "global",
281
- "name": "chdir",
282
- "default": ".",
283
- "hasDynamicHelp": false,
284
- "multiple": false,
285
- "type": "option"
286
- },
287
- "json": {
288
- "char": "j",
289
- "description": "Output in JSON format",
290
- "name": "json",
291
- "allowNo": false,
292
- "type": "boolean"
293
- },
294
- "no-doc": {
295
- "description": "Show only metadata without the full documentation",
296
- "name": "no-doc",
297
- "allowNo": false,
298
- "type": "boolean"
299
- }
300
- },
301
- "hasDynamicHelp": false,
302
- "hiddenAliases": [],
303
- "id": "doc",
304
- "pluginAlias": "hereya-cli",
305
- "pluginName": "hereya-cli",
306
- "pluginType": "core",
307
- "strict": true,
308
- "enableJsonFlag": false,
309
- "isESM": true,
310
- "relativePath": [
311
- "dist",
312
- "commands",
313
- "doc",
314
- "index.js"
315
- ]
316
- },
317
317
  "env": {
318
318
  "aliases": [],
319
319
  "args": {
@@ -564,6 +564,57 @@
564
564
  "index.js"
565
565
  ]
566
566
  },
567
+ "provid": {
568
+ "aliases": [],
569
+ "args": {
570
+ "package": {
571
+ "description": "Package name (e.g., hereya/postgres)",
572
+ "name": "package",
573
+ "required": true
574
+ }
575
+ },
576
+ "description": "Display the provisioning ID for a package",
577
+ "examples": [
578
+ "<%= config.bin %> <%= command.id %> hereya/postgres",
579
+ "<%= config.bin %> <%= command.id %> hereya/postgres -w dev",
580
+ "<%= config.bin %> <%= command.id %> hereya/postgres --workspace staging"
581
+ ],
582
+ "flags": {
583
+ "chdir": {
584
+ "char": "C",
585
+ "description": "Project root directory",
586
+ "name": "chdir",
587
+ "required": false,
588
+ "hasDynamicHelp": false,
589
+ "multiple": false,
590
+ "type": "option"
591
+ },
592
+ "workspace": {
593
+ "char": "w",
594
+ "description": "Name of the workspace",
595
+ "name": "workspace",
596
+ "required": false,
597
+ "hasDynamicHelp": false,
598
+ "multiple": false,
599
+ "type": "option"
600
+ }
601
+ },
602
+ "hasDynamicHelp": false,
603
+ "hiddenAliases": [],
604
+ "id": "provid",
605
+ "pluginAlias": "hereya-cli",
606
+ "pluginName": "hereya-cli",
607
+ "pluginType": "core",
608
+ "strict": true,
609
+ "enableJsonFlag": false,
610
+ "isESM": true,
611
+ "relativePath": [
612
+ "dist",
613
+ "commands",
614
+ "provid",
615
+ "index.js"
616
+ ]
617
+ },
567
618
  "publish": {
568
619
  "aliases": [],
569
620
  "args": {},
@@ -1936,5 +1987,5 @@
1936
1987
  ]
1937
1988
  }
1938
1989
  },
1939
- "version": "0.60.0"
1990
+ "version": "0.61.0"
1940
1991
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hereya-cli",
3
3
  "description": "Infrastructure as Package",
4
- "version": "0.60.0",
4
+ "version": "0.61.0",
5
5
  "author": "Hereya Developers",
6
6
  "bin": {
7
7
  "hereya": "./bin/run.js"