hereya-cli 0.88.0 → 0.89.1

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
@@ -21,7 +21,7 @@ $ npm install -g hereya-cli
21
21
  $ hereya COMMAND
22
22
  running command...
23
23
  $ hereya (--version)
24
- hereya-cli/0.88.0 linux-x64 node-v24.14.1
24
+ hereya-cli/0.89.1 linux-x64 node-v24.14.1
25
25
  $ hereya --help [COMMAND]
26
26
  USAGE
27
27
  $ hereya COMMAND
@@ -68,6 +68,7 @@ USAGE
68
68
  * [`hereya flow up`](#hereya-flow-up)
69
69
  * [`hereya help [COMMAND]`](#hereya-help-command)
70
70
  * [`hereya import PACKAGE`](#hereya-import-package)
71
+ * [`hereya import-repo PROJECT`](#hereya-import-repo-project)
71
72
  * [`hereya init PROJECT`](#hereya-init-project)
72
73
  * [`hereya list`](#hereya-list)
73
74
  * [`hereya login [URL]`](#hereya-login-url)
@@ -127,7 +128,7 @@ EXAMPLES
127
128
  $ hereya add cloudy/docker_postgres
128
129
  ```
129
130
 
130
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/add/index.ts)_
131
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/add/index.ts)_
131
132
 
132
133
  ## `hereya app deploy NAME`
133
134
 
@@ -161,7 +162,7 @@ EXAMPLES
161
162
  $ hereya app deploy my-org/my-app -w prod -p organizationId=org-123
162
163
  ```
163
164
 
164
- _See code: [src/commands/app/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/app/deploy/index.ts)_
165
+ _See code: [src/commands/app/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/app/deploy/index.ts)_
165
166
 
166
167
  ## `hereya app deployments NAME`
167
168
 
@@ -181,7 +182,7 @@ EXAMPLES
181
182
  $ hereya app deployments my-org/my-app
182
183
  ```
183
184
 
184
- _See code: [src/commands/app/deployments/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/app/deployments/index.ts)_
185
+ _See code: [src/commands/app/deployments/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/app/deployments/index.ts)_
185
186
 
186
187
  ## `hereya app destroy NAME`
187
188
 
@@ -210,7 +211,7 @@ EXAMPLES
210
211
  $ hereya app destroy my-org/my-app -w my-workspace
211
212
  ```
212
213
 
213
- _See code: [src/commands/app/destroy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/app/destroy/index.ts)_
214
+ _See code: [src/commands/app/destroy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/app/destroy/index.ts)_
214
215
 
215
216
  ## `hereya app env NAME [KEY]`
216
217
 
@@ -236,7 +237,7 @@ EXAMPLES
236
237
  $ hereya app env my-org/my-app -w my-workspace DATABASE_URL
237
238
  ```
238
239
 
239
- _See code: [src/commands/app/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/app/env/index.ts)_
240
+ _See code: [src/commands/app/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/app/env/index.ts)_
240
241
 
241
242
  ## `hereya app list`
242
243
 
@@ -253,7 +254,7 @@ EXAMPLES
253
254
  $ hereya app list
254
255
  ```
255
256
 
256
- _See code: [src/commands/app/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/app/list/index.ts)_
257
+ _See code: [src/commands/app/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/app/list/index.ts)_
257
258
 
258
259
  ## `hereya app new DIRNAME`
259
260
 
@@ -279,7 +280,7 @@ EXAMPLES
279
280
  $ hereya app new ./my-app -n my-org/my-app --description "An ai-app-builder app"
280
281
  ```
281
282
 
282
- _See code: [src/commands/app/new/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/app/new/index.ts)_
283
+ _See code: [src/commands/app/new/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/app/new/index.ts)_
283
284
 
284
285
  ## `hereya app status NAME`
285
286
 
@@ -302,7 +303,7 @@ EXAMPLES
302
303
  $ hereya app status my-org/my-app -w my-workspace
303
304
  ```
304
305
 
305
- _See code: [src/commands/app/status/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/app/status/index.ts)_
306
+ _See code: [src/commands/app/status/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/app/status/index.ts)_
306
307
 
307
308
  ## `hereya bootstrap INFRASTRUCTURETYPE`
308
309
 
@@ -327,7 +328,7 @@ EXAMPLES
327
328
  $ hereya bootstrap local
328
329
  ```
329
330
 
330
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/bootstrap/index.ts)_
331
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/bootstrap/index.ts)_
331
332
 
332
333
  ## `hereya clone PROJECT`
333
334
 
@@ -352,7 +353,7 @@ EXAMPLES
352
353
  $ hereya clone myProject --chdir=./myProject
353
354
  ```
354
355
 
355
- _See code: [src/commands/clone/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/clone/index.ts)_
356
+ _See code: [src/commands/clone/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/clone/index.ts)_
356
357
 
357
358
  ## `hereya config export-backend [FILE]`
358
359
 
@@ -374,7 +375,7 @@ EXAMPLES
374
375
  $ hereya config export-backend ./path/to/export.json
375
376
  ```
376
377
 
377
- _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/config/export-backend/index.ts)_
378
+ _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/config/export-backend/index.ts)_
378
379
 
379
380
  ## `hereya config get-backend`
380
381
 
@@ -391,7 +392,7 @@ EXAMPLES
391
392
  $ hereya config get-backend
392
393
  ```
393
394
 
394
- _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/config/get-backend/index.ts)_
395
+ _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/config/get-backend/index.ts)_
395
396
 
396
397
  ## `hereya config import-backend FILE`
397
398
 
@@ -411,7 +412,7 @@ EXAMPLES
411
412
  $ hereya config import-backend ./path/to/cloud-backend.json
412
413
  ```
413
414
 
414
- _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/config/import-backend/index.ts)_
415
+ _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/config/import-backend/index.ts)_
415
416
 
416
417
  ## `hereya config use-backend TYPE`
417
418
 
@@ -433,7 +434,7 @@ EXAMPLES
433
434
  $ hereya config use-backend local
434
435
  ```
435
436
 
436
- _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/config/use-backend/index.ts)_
437
+ _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/config/use-backend/index.ts)_
437
438
 
438
439
  ## `hereya delete-state`
439
440
 
@@ -459,7 +460,7 @@ EXAMPLES
459
460
  $ hereya delete-state --workspace staging
460
461
  ```
461
462
 
462
- _See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/delete-state/index.ts)_
463
+ _See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/delete-state/index.ts)_
463
464
 
464
465
  ## `hereya deploy`
465
466
 
@@ -485,7 +486,7 @@ EXAMPLES
485
486
  $ hereya deploy
486
487
  ```
487
488
 
488
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/deploy/index.ts)_
489
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/deploy/index.ts)_
489
490
 
490
491
  ## `hereya devenv config`
491
492
 
@@ -505,7 +506,7 @@ EXAMPLES
505
506
  $ hereya devenv config -w my-workspace
506
507
  ```
507
508
 
508
- _See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/devenv/config/index.ts)_
509
+ _See code: [src/commands/devenv/config/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/devenv/config/index.ts)_
509
510
 
510
511
  ## `hereya devenv install`
511
512
 
@@ -530,7 +531,7 @@ EXAMPLES
530
531
  $ hereya devenv install -w my-workspace -p instanceType=t3.large
531
532
  ```
532
533
 
533
- _See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/devenv/install/index.ts)_
534
+ _See code: [src/commands/devenv/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/devenv/install/index.ts)_
534
535
 
535
536
  ## `hereya devenv project init PROJECT`
536
537
 
@@ -562,7 +563,7 @@ EXAMPLES
562
563
  $ hereya devenv project init my-app -w my-workspace -t acme/node-starter -p region=us-east-1
563
564
  ```
564
565
 
565
- _See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/devenv/project/init/index.ts)_
566
+ _See code: [src/commands/devenv/project/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/devenv/project/init/index.ts)_
566
567
 
567
568
  ## `hereya devenv project uninit PROJECT`
568
569
 
@@ -588,7 +589,7 @@ EXAMPLES
588
589
  $ hereya devenv project uninit my-app -w my-workspace --force
589
590
  ```
590
591
 
591
- _See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/devenv/project/uninit/index.ts)_
592
+ _See code: [src/commands/devenv/project/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/devenv/project/uninit/index.ts)_
592
593
 
593
594
  ## `hereya devenv ssh`
594
595
 
@@ -608,7 +609,7 @@ EXAMPLES
608
609
  $ hereya devenv ssh -w my-workspace
609
610
  ```
610
611
 
611
- _See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/devenv/ssh/index.ts)_
612
+ _See code: [src/commands/devenv/ssh/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/devenv/ssh/index.ts)_
612
613
 
613
614
  ## `hereya devenv uninstall`
614
615
 
@@ -629,7 +630,7 @@ EXAMPLES
629
630
  $ hereya devenv uninstall -w my-workspace
630
631
  ```
631
632
 
632
- _See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/devenv/uninstall/index.ts)_
633
+ _See code: [src/commands/devenv/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/devenv/uninstall/index.ts)_
633
634
 
634
635
  ## `hereya doc PACKAGE`
635
636
 
@@ -662,7 +663,7 @@ EXAMPLES
662
663
  $ hereya doc my-package --no-doc
663
664
  ```
664
665
 
665
- _See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/doc/index.ts)_
666
+ _See code: [src/commands/doc/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/doc/index.ts)_
666
667
 
667
668
  ## `hereya docker run IMAGE`
668
669
 
@@ -693,7 +694,7 @@ EXAMPLES
693
694
  $ hereya docker run myapp:latest -- --rm -v ./data:/data
694
695
  ```
695
696
 
696
- _See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/docker/run/index.ts)_
697
+ _See code: [src/commands/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/docker/run/index.ts)_
697
698
 
698
699
  ## `hereya down`
699
700
 
@@ -720,7 +721,7 @@ EXAMPLES
720
721
  $ hereya down
721
722
  ```
722
723
 
723
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/down/index.ts)_
724
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/down/index.ts)_
724
725
 
725
726
  ## `hereya env [NAME]`
726
727
 
@@ -751,7 +752,7 @@ EXAMPLES
751
752
  $ hereya env -w dev -l
752
753
  ```
753
754
 
754
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/env/index.ts)_
755
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/env/index.ts)_
755
756
 
756
757
  ## `hereya env set [NAME]`
757
758
 
@@ -778,7 +779,7 @@ EXAMPLES
778
779
  $ hereya env set FOO -v bar -w dev
779
780
  ```
780
781
 
781
- _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/env/set/index.ts)_
782
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/env/set/index.ts)_
782
783
 
783
784
  ## `hereya executor start`
784
785
 
@@ -811,7 +812,7 @@ EXAMPLES
811
812
  HEREYA_TOKEN=<token> HEREYA_CLOUD_URL=https://my-cloud.example.com hereya executor start -w my-workspace
812
813
  ```
813
814
 
814
- _See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/executor/start/index.ts)_
815
+ _See code: [src/commands/executor/start/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/executor/start/index.ts)_
815
816
 
816
817
  ## `hereya flow add PACKAGE`
817
818
 
@@ -849,7 +850,7 @@ EXAMPLES
849
850
  $ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
850
851
  ```
851
852
 
852
- _See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/add/index.ts)_
853
+ _See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/add/index.ts)_
853
854
 
854
855
  ## `hereya flow docker run IMAGE`
855
856
 
@@ -879,7 +880,7 @@ EXAMPLES
879
880
  $ hereya flow docker run --pin myapp:latest -- --rm
880
881
  ```
881
882
 
882
- _See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/docker/run/index.ts)_
883
+ _See code: [src/commands/flow/docker/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/docker/run/index.ts)_
883
884
 
884
885
  ## `hereya flow down`
885
886
 
@@ -913,7 +914,7 @@ EXAMPLES
913
914
  $ hereya flow down --pin
914
915
  ```
915
916
 
916
- _See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/down/index.ts)_
917
+ _See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/down/index.ts)_
917
918
 
918
919
  ## `hereya flow env [NAME]`
919
920
 
@@ -947,7 +948,7 @@ EXAMPLES
947
948
  $ hereya flow env -l
948
949
  ```
949
950
 
950
- _See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/env/index.ts)_
951
+ _See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/env/index.ts)_
951
952
 
952
953
  ## `hereya flow provid PACKAGE`
953
954
 
@@ -976,7 +977,7 @@ EXAMPLES
976
977
  $ hereya flow provid hereya/postgres --pin
977
978
  ```
978
979
 
979
- _See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/provid/index.ts)_
980
+ _See code: [src/commands/flow/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/provid/index.ts)_
980
981
 
981
982
  ## `hereya flow remove PACKAGE`
982
983
 
@@ -1006,7 +1007,7 @@ EXAMPLES
1006
1007
  $ hereya flow remove cloudy/docker_postgres --profile staging
1007
1008
  ```
1008
1009
 
1009
- _See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/remove/index.ts)_
1010
+ _See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/remove/index.ts)_
1010
1011
 
1011
1012
  ## `hereya flow run CMD`
1012
1013
 
@@ -1035,7 +1036,7 @@ EXAMPLES
1035
1036
  $ hereya flow run --pin -- npm test
1036
1037
  ```
1037
1038
 
1038
- _See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/run/index.ts)_
1039
+ _See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/run/index.ts)_
1039
1040
 
1040
1041
  ## `hereya flow up`
1041
1042
 
@@ -1069,7 +1070,7 @@ EXAMPLES
1069
1070
  $ hereya flow up --pin
1070
1071
  ```
1071
1072
 
1072
- _See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/flow/up/index.ts)_
1073
+ _See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/flow/up/index.ts)_
1073
1074
 
1074
1075
  ## `hereya help [COMMAND]`
1075
1076
 
@@ -1126,7 +1127,37 @@ EXAMPLES
1126
1127
  $ hereya import org/my-package -f state.tfstate -w my-workspace
1127
1128
  ```
1128
1129
 
1129
- _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/import/index.ts)_
1130
+ _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/import/index.ts)_
1131
+
1132
+ ## `hereya import-repo PROJECT`
1133
+
1134
+ Register an existing GitHub repository as a hereya project so it can be deployed via the remote executor.
1135
+
1136
+ ```
1137
+ USAGE
1138
+ $ hereya import-repo PROJECT -r <value> -w <value> [--chdir <value>] [--clone]
1139
+
1140
+ ARGUMENTS
1141
+ PROJECT project name
1142
+
1143
+ FLAGS
1144
+ -r, --repo-url=<value> (required) GitHub HTTPS clone URL (e.g. https://github.com/owner/repo.git)
1145
+ -w, --workspace=<value> (required) workspace to set as default
1146
+ --chdir=<value> directory to clone into (only meaningful with --clone)
1147
+ --clone also clone the repository locally and write hereya.yaml after the import
1148
+
1149
+ DESCRIPTION
1150
+ Register an existing GitHub repository as a hereya project so it can be deployed via the remote executor.
1151
+
1152
+ EXAMPLES
1153
+ $ hereya import-repo myProject -w=dev -r=https://github.com/acme/api.git
1154
+
1155
+ $ hereya import-repo myProject -w=dev -r=https://github.com/acme/api --clone
1156
+
1157
+ $ hereya import-repo myProject -w=dev -r=https://github.com/acme/api --clone --chdir=./api
1158
+ ```
1159
+
1160
+ _See code: [src/commands/import-repo/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/import-repo/index.ts)_
1130
1161
 
1131
1162
  ## `hereya init PROJECT`
1132
1163
 
@@ -1160,7 +1191,7 @@ EXAMPLES
1160
1191
  $ hereya init myProject -w=dev -t=acme/node-starter -d=prod -p region=us-east-1
1161
1192
  ```
1162
1193
 
1163
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/init/index.ts)_
1194
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/init/index.ts)_
1164
1195
 
1165
1196
  ## `hereya list`
1166
1197
 
@@ -1177,7 +1208,7 @@ EXAMPLES
1177
1208
  $ hereya list
1178
1209
  ```
1179
1210
 
1180
- _See code: [src/commands/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/list/index.ts)_
1211
+ _See code: [src/commands/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/list/index.ts)_
1181
1212
 
1182
1213
  ## `hereya login [URL]`
1183
1214
 
@@ -1206,7 +1237,7 @@ EXAMPLES
1206
1237
  $ hereya login --token=your-token https://cloud.hereya.dev
1207
1238
  ```
1208
1239
 
1209
- _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/login/index.ts)_
1240
+ _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/login/index.ts)_
1210
1241
 
1211
1242
  ## `hereya logout`
1212
1243
 
@@ -1223,7 +1254,7 @@ EXAMPLES
1223
1254
  $ hereya logout
1224
1255
  ```
1225
1256
 
1226
- _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/logout/index.ts)_
1257
+ _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/logout/index.ts)_
1227
1258
 
1228
1259
  ## `hereya provid PACKAGE`
1229
1260
 
@@ -1251,7 +1282,7 @@ EXAMPLES
1251
1282
  $ hereya provid hereya/postgres --workspace staging
1252
1283
  ```
1253
1284
 
1254
- _See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/provid/index.ts)_
1285
+ _See code: [src/commands/provid/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/provid/index.ts)_
1255
1286
 
1256
1287
  ## `hereya publish`
1257
1288
 
@@ -1274,7 +1305,7 @@ EXAMPLES
1274
1305
  $ hereya publish --chdir=/path/to/package
1275
1306
  ```
1276
1307
 
1277
- _See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/publish/index.ts)_
1308
+ _See code: [src/commands/publish/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/publish/index.ts)_
1278
1309
 
1279
1310
  ## `hereya remove PACKAGE`
1280
1311
 
@@ -1302,7 +1333,7 @@ EXAMPLES
1302
1333
  $ hereya remove cloudy/docker_postgres
1303
1334
  ```
1304
1335
 
1305
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/remove/index.ts)_
1336
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/remove/index.ts)_
1306
1337
 
1307
1338
  ## `hereya run CMD`
1308
1339
 
@@ -1328,7 +1359,7 @@ EXAMPLES
1328
1359
  $ hereya run -w uat -- node index.js
1329
1360
  ```
1330
1361
 
1331
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/run/index.ts)_
1362
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/run/index.ts)_
1332
1363
 
1333
1364
  ## `hereya search QUERY`
1334
1365
 
@@ -1359,7 +1390,7 @@ EXAMPLES
1359
1390
  $ hereya search database --json
1360
1391
  ```
1361
1392
 
1362
- _See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/search/index.ts)_
1393
+ _See code: [src/commands/search/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/search/index.ts)_
1363
1394
 
1364
1395
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
1365
1396
 
@@ -1384,7 +1415,7 @@ EXAMPLES
1384
1415
  $ hereya unbootstrap local
1385
1416
  ```
1386
1417
 
1387
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/unbootstrap/index.ts)_
1418
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/unbootstrap/index.ts)_
1388
1419
 
1389
1420
  ## `hereya undeploy`
1390
1421
 
@@ -1410,7 +1441,7 @@ EXAMPLES
1410
1441
  $ hereya undeploy
1411
1442
  ```
1412
1443
 
1413
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/undeploy/index.ts)_
1444
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/undeploy/index.ts)_
1414
1445
 
1415
1446
  ## `hereya uninit PROJECT`
1416
1447
 
@@ -1438,7 +1469,7 @@ EXAMPLES
1438
1469
  $ hereya uninit myProject -w dev -p prodWorkspace=prod
1439
1470
  ```
1440
1471
 
1441
- _See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/uninit/index.ts)_
1472
+ _See code: [src/commands/uninit/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/uninit/index.ts)_
1442
1473
 
1443
1474
  ## `hereya up`
1444
1475
 
@@ -1465,7 +1496,7 @@ EXAMPLES
1465
1496
  $ hereya up
1466
1497
  ```
1467
1498
 
1468
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/up/index.ts)_
1499
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/up/index.ts)_
1469
1500
 
1470
1501
  ## `hereya update [VERSION]`
1471
1502
 
@@ -1487,7 +1518,7 @@ EXAMPLES
1487
1518
  $ hereya update 0.75.0
1488
1519
  ```
1489
1520
 
1490
- _See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/update/index.ts)_
1521
+ _See code: [src/commands/update/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/update/index.ts)_
1491
1522
 
1492
1523
  ## `hereya workspace create NAME`
1493
1524
 
@@ -1512,7 +1543,7 @@ EXAMPLES
1512
1543
  $ hereya workspace create dev
1513
1544
  ```
1514
1545
 
1515
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/create/index.ts)_
1546
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/create/index.ts)_
1516
1547
 
1517
1548
  ## `hereya workspace delete NAME`
1518
1549
 
@@ -1532,7 +1563,7 @@ EXAMPLES
1532
1563
  $ hereya workspace delete dev
1533
1564
  ```
1534
1565
 
1535
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/delete/index.ts)_
1566
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/delete/index.ts)_
1536
1567
 
1537
1568
  ## `hereya workspace env [NAME]`
1538
1569
 
@@ -1558,7 +1589,7 @@ EXAMPLES
1558
1589
  $ hereya workspace env myEnv -w dev
1559
1590
  ```
1560
1591
 
1561
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/env/index.ts)_
1592
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/env/index.ts)_
1562
1593
 
1563
1594
  ## `hereya workspace env set`
1564
1595
 
@@ -1582,7 +1613,7 @@ EXAMPLES
1582
1613
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
1583
1614
  ```
1584
1615
 
1585
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/env/set/index.ts)_
1616
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/env/set/index.ts)_
1586
1617
 
1587
1618
  ## `hereya workspace env unset`
1588
1619
 
@@ -1603,7 +1634,7 @@ EXAMPLES
1603
1634
  $ hereya workspace env unset -w my-workspace -n myVar
1604
1635
  ```
1605
1636
 
1606
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/env/unset/index.ts)_
1637
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/env/unset/index.ts)_
1607
1638
 
1608
1639
  ## `hereya workspace executor install`
1609
1640
 
@@ -1622,7 +1653,7 @@ DESCRIPTION
1622
1653
  Install a remote executor into a workspace
1623
1654
  ```
1624
1655
 
1625
- _See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/executor/install/index.ts)_
1656
+ _See code: [src/commands/workspace/executor/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/executor/install/index.ts)_
1626
1657
 
1627
1658
  ## `hereya workspace executor token`
1628
1659
 
@@ -1639,7 +1670,7 @@ DESCRIPTION
1639
1670
  Generate a workspace-scoped executor token for the remote executor
1640
1671
  ```
1641
1672
 
1642
- _See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/executor/token/index.ts)_
1673
+ _See code: [src/commands/workspace/executor/token/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/executor/token/index.ts)_
1643
1674
 
1644
1675
  ## `hereya workspace executor uninstall`
1645
1676
 
@@ -1657,7 +1688,7 @@ DESCRIPTION
1657
1688
  Uninstall the remote executor from a workspace
1658
1689
  ```
1659
1690
 
1660
- _See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/executor/uninstall/index.ts)_
1691
+ _See code: [src/commands/workspace/executor/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/executor/uninstall/index.ts)_
1661
1692
 
1662
1693
  ## `hereya workspace install PACKAGE`
1663
1694
 
@@ -1684,7 +1715,7 @@ EXAMPLES
1684
1715
  $ hereya workspace install hereya/aws-cognito
1685
1716
  ```
1686
1717
 
1687
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/install/index.ts)_
1718
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/install/index.ts)_
1688
1719
 
1689
1720
  ## `hereya workspace list`
1690
1721
 
@@ -1708,7 +1739,7 @@ EXAMPLES
1708
1739
  $ hereya workspace list --org personal
1709
1740
  ```
1710
1741
 
1711
- _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/list/index.ts)_
1742
+ _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/list/index.ts)_
1712
1743
 
1713
1744
  ## `hereya workspace set-profile PROFILE`
1714
1745
 
@@ -1732,7 +1763,7 @@ EXAMPLES
1732
1763
  $ hereya workspace set-profile prod-profile -w production
1733
1764
  ```
1734
1765
 
1735
- _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/set-profile/index.ts)_
1766
+ _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/set-profile/index.ts)_
1736
1767
 
1737
1768
  ## `hereya workspace uninstall PACKAGE`
1738
1769
 
@@ -1759,5 +1790,5 @@ EXAMPLES
1759
1790
  $ hereya workspace uninstall hereya/aws-cognito
1760
1791
  ```
1761
1792
 
1762
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.88.0/src/commands/workspace/uninstall/index.ts)_
1793
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.89.1/src/commands/workspace/uninstall/index.ts)_
1763
1794
  <!-- commandsstop -->
@@ -1,6 +1,6 @@
1
1
  import { Config } from '../../lib/config/common.js';
2
2
  import { IParameterSpec } from '../../lib/package/index.js';
3
- import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteStateInput, DeleteStateOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetPackageOutput, GetProjectMetadataInput, GetProjectMetadataOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, ListPackageVersionsOutput, ListProjectsOutput, ListWorkspacesInput, PublishPackageInput, PublishPackageOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SaveProjectMetadataInput, SaveProjectMetadataOutput, SearchPackagesInput, SearchPackagesOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from '../common.js';
3
+ import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteStateInput, DeleteStateOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetPackageOutput, GetProjectMetadataInput, GetProjectMetadataOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, ImportProjectInput, ImportProjectOutput, InitProjectInput, InitProjectOutput, ListPackageVersionsOutput, ListProjectsOutput, ListWorkspacesInput, PublishPackageInput, PublishPackageOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SaveProjectMetadataInput, SaveProjectMetadataOutput, SearchPackagesInput, SearchPackagesOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from '../common.js';
4
4
  interface CloudBackendConfig {
5
5
  accessToken: string;
6
6
  clientId: string;
@@ -158,6 +158,7 @@ export declare class CloudBackend implements Backend {
158
158
  getWorkspace(name: string): Promise<GetWorkspaceOutput>;
159
159
  getWorkspaceEnv(input: GetWorkspaceEnvInput): Promise<GetWorkspaceEnvOutput>;
160
160
  importBackend(input: ImportBackendInput): Promise<ImportBackendOutput>;
161
+ importProject(input: ImportProjectInput): Promise<ImportProjectOutput>;
161
162
  init(input: InitProjectInput): Promise<InitProjectOutput>;
162
163
  listAppDeployments(name: string): Promise<{
163
164
  deployments: AppDeploymentSummary[];
@@ -488,6 +488,42 @@ export class CloudBackend {
488
488
  success: true,
489
489
  };
490
490
  }
491
+ async importProject(input) {
492
+ const response = await fetch(`${this.config.url}/api/projects/${encodeURIComponent(input.project)}/import`, {
493
+ body: JSON.stringify({ repoUrl: input.repoUrl, workspace: input.workspace }),
494
+ headers: {
495
+ 'Authorization': `Bearer ${this.config.accessToken}`,
496
+ 'Content-Type': 'application/json',
497
+ },
498
+ method: 'POST',
499
+ });
500
+ const result = await this.safeResponseJson(response);
501
+ if (!response.ok) {
502
+ const reason = typeof result?.error === 'string'
503
+ ? result.error
504
+ : (result?.errors && typeof result.errors === 'object'
505
+ ? JSON.stringify(result.errors)
506
+ : JSON.stringify(result));
507
+ return {
508
+ ...(typeof result?.code === 'string' ? { code: result.code } : {}),
509
+ reason,
510
+ success: false,
511
+ };
512
+ }
513
+ if (!result?.success || !result?.project) {
514
+ return {
515
+ reason: typeof result?.error === 'string' ? result.error : 'Unexpected response from server',
516
+ success: false,
517
+ };
518
+ }
519
+ return {
520
+ project: {
521
+ defaultWorkspace: result.project.defaultWorkspace,
522
+ name: result.project.name,
523
+ },
524
+ success: true,
525
+ };
526
+ }
491
527
  async init(input) {
492
528
  const formData = new FormData();
493
529
  formData.append('name', input.project);
@@ -15,6 +15,7 @@ export interface Backend {
15
15
  getWorkspace(workspace: string): Promise<GetWorkspaceOutput>;
16
16
  getWorkspaceEnv(input: GetWorkspaceEnvInput): Promise<GetWorkspaceEnvOutput>;
17
17
  importBackend(input: ImportBackendInput): Promise<ImportBackendOutput>;
18
+ importProject?(input: ImportProjectInput): Promise<ImportProjectOutput>;
18
19
  init(options: InitProjectInput): Promise<InitProjectOutput>;
19
20
  listPackageVersions?(name: string): Promise<ListPackageVersionsOutput>;
20
21
  listProjects?(): Promise<ListProjectsOutput>;
@@ -363,6 +364,22 @@ export type SaveProjectMetadataOutput = {
363
364
  } | {
364
365
  success: true;
365
366
  };
367
+ export interface ImportProjectInput {
368
+ project: string;
369
+ repoUrl: string;
370
+ workspace: string;
371
+ }
372
+ export type ImportProjectOutput = {
373
+ code?: string;
374
+ reason: string;
375
+ success: false;
376
+ } | {
377
+ project: {
378
+ defaultWorkspace: string;
379
+ name: string;
380
+ };
381
+ success: true;
382
+ };
366
383
  export type ProjectSummary = {
367
384
  defaultWorkspace: string;
368
385
  name: string;
@@ -36,7 +36,7 @@ export default class Clone extends Command {
36
36
  }
37
37
  const metadata$ = await backend.getProjectMetadata({ project: args.project });
38
38
  if (!metadata$.found) {
39
- throw new Error(`Project metadata not found for ${args.project}. Was it initialized with a template?`);
39
+ throw new Error(`Project metadata not found for ${args.project}. Was it initialized or imported?`);
40
40
  }
41
41
  ctx.metadata = metadata$.metadata;
42
42
  ctx.defaultWorkspace = metadata$.defaultWorkspace;
@@ -59,7 +59,7 @@ export default class Clone extends Command {
59
59
  workspace: ctx.defaultWorkspace,
60
60
  });
61
61
  if (!ctx.resolvedGitEnv.hereyaGitRemoteUrl) {
62
- throw new Error('Project metadata does not contain hereyaGitRemoteUrl. Was it initialized with a template?');
62
+ throw new Error(`Project metadata does not contain hereyaGitRemoteUrl for ${args.project}. Was it initialized or imported?`);
63
63
  }
64
64
  },
65
65
  title: 'Resolving git credentials',
@@ -0,0 +1,15 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class ImportRepo extends Command {
3
+ static args: {
4
+ project: 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
+ clone: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ 'repo-url': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ workspace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,111 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { Listr, ListrLogger, ListrLogLevels } from 'listr2';
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { getBackend } from '../../backend/index.js';
6
+ import { cloneAndConfigureProjectTasks } from '../../lib/clone-and-configure.js';
7
+ import { getLogPath } from '../../lib/log.js';
8
+ export default class ImportRepo extends Command {
9
+ static args = {
10
+ project: Args.string({ description: 'project name', required: true }),
11
+ };
12
+ static description = 'Register an existing GitHub repository as a hereya project so it can be deployed via the remote executor.';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> myProject -w=dev -r=https://github.com/acme/api.git',
15
+ '<%= config.bin %> <%= command.id %> myProject -w=dev -r=https://github.com/acme/api --clone',
16
+ '<%= config.bin %> <%= command.id %> myProject -w=dev -r=https://github.com/acme/api --clone --chdir=./api',
17
+ ];
18
+ static flags = {
19
+ chdir: Flags.string({
20
+ description: 'directory to clone into (only meaningful with --clone)',
21
+ required: false,
22
+ }),
23
+ clone: Flags.boolean({
24
+ default: false,
25
+ description: 'also clone the repository locally and write hereya.yaml after the import',
26
+ }),
27
+ 'repo-url': Flags.string({
28
+ char: 'r',
29
+ description: 'GitHub HTTPS clone URL (e.g. https://github.com/owner/repo.git)',
30
+ required: true,
31
+ }),
32
+ workspace: Flags.string({
33
+ char: 'w',
34
+ description: 'workspace to set as default',
35
+ required: true,
36
+ }),
37
+ };
38
+ async run() {
39
+ const { args, flags } = await this.parse(ImportRepo);
40
+ const targetDir = flags.chdir
41
+ || path.join(process.cwd(), args.project.replaceAll('/', '-'));
42
+ if (flags.clone && fs.existsSync(targetDir)) {
43
+ this.error(`Directory ${targetDir} already exists.`);
44
+ }
45
+ const backend = await getBackend();
46
+ if (!backend.importProject) {
47
+ this.error('hereya import-repo requires the cloud backend. Run `hereya login` first.');
48
+ }
49
+ if (!flags.clone) {
50
+ const importOutput = await backend.importProject({
51
+ project: args.project,
52
+ repoUrl: flags['repo-url'],
53
+ workspace: flags.workspace,
54
+ });
55
+ if (!importOutput.success) {
56
+ const codeSuffix = importOutput.code ? ` [${importOutput.code}]` : '';
57
+ this.error(`${importOutput.reason}${codeSuffix}`);
58
+ }
59
+ this.log(`Project ${args.project} imported.`);
60
+ this.log(`Run 'hereya clone ${args.project}' to fetch the source locally, then 'hereya deploy -w <deploy-workspace>' to deploy.`);
61
+ return;
62
+ }
63
+ const task = new Listr([
64
+ {
65
+ async task(ctx) {
66
+ const importResult = await backend.importProject({
67
+ project: args.project,
68
+ repoUrl: flags['repo-url'],
69
+ workspace: flags.workspace,
70
+ });
71
+ if (!importResult.success) {
72
+ const codeSuffix = importResult.code ? ` [${importResult.code}]` : '';
73
+ throw new Error(`${importResult.reason}${codeSuffix}`);
74
+ }
75
+ ctx.importOutput = importResult;
76
+ },
77
+ title: 'Importing project',
78
+ },
79
+ {
80
+ async task(ctx) {
81
+ if (!backend.getProjectMetadata) {
82
+ throw new Error('hereya import-repo --clone requires the cloud backend. Run `hereya login` first.');
83
+ }
84
+ const metadata$ = await backend.getProjectMetadata({ project: args.project });
85
+ if (!metadata$.found) {
86
+ throw new Error(`Project metadata not found for ${args.project} after import.`);
87
+ }
88
+ ctx.metadata = metadata$.metadata;
89
+ },
90
+ title: 'Fetching project metadata',
91
+ },
92
+ ...cloneAndConfigureProjectTasks({
93
+ getEnv: (ctx) => ctx.metadata.env || {},
94
+ getProject: () => args.project,
95
+ getWorkspace: () => flags.workspace,
96
+ hereyaBinPath: process.argv[1],
97
+ missingRemoteUrlError: `Project metadata does not contain hereyaGitRemoteUrl for ${args.project}. Did the import populate the workspace github-app config?`,
98
+ targetDir,
99
+ }),
100
+ ], { concurrent: false });
101
+ try {
102
+ await task.run();
103
+ const myLogger = new ListrLogger({ useIcons: false });
104
+ myLogger.log(ListrLogLevels.COMPLETED, `Project ${args.project} imported and cloned successfully`);
105
+ myLogger.log(ListrLogLevels.COMPLETED, `Project directory: ${targetDir}`);
106
+ }
107
+ catch (error) {
108
+ this.error(`${error.message}\n\nSee ${getLogPath()} for more details`);
109
+ }
110
+ }
111
+ }
@@ -4,8 +4,8 @@ import fs from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { getBackend } from '../../backend/index.js';
6
6
  import { getExecutorForWorkspace } from '../../executor/context.js';
7
+ import { cloneAndConfigureProjectTasks } from '../../lib/clone-and-configure.js';
7
8
  import { getConfigManager } from '../../lib/config/index.js';
8
- import { gitUtils } from '../../lib/git-utils.js';
9
9
  import { hereyaTokenUtils } from '../../lib/hereya-token.js';
10
10
  import { getLogger, getLogPath } from '../../lib/log.js';
11
11
  import { arrayOfStringToObject } from '../../lib/object-utils.js';
@@ -115,57 +115,14 @@ export default class Init extends Command {
115
115
  },
116
116
  title: 'Saving template metadata',
117
117
  },
118
- {
119
- async task(ctx) {
120
- const gitEnvToResolve = {};
121
- for (const [key, value] of Object.entries(ctx.prefixedEnv)) {
122
- if (key.startsWith('hereyaGit'))
123
- gitEnvToResolve[key] = value;
124
- }
125
- const executor$ = await getExecutorForWorkspace(flags.workspace);
126
- if (!executor$.success)
127
- throw new Error(executor$.reason);
128
- ctx.resolvedGitEnv = await executor$.executor.resolveEnvValues({
129
- env: gitEnvToResolve,
130
- project: args.project,
131
- workspace: flags.workspace,
132
- });
133
- if (!ctx.resolvedGitEnv.hereyaGitRemoteUrl) {
134
- throw new Error('Template did not provide hereyaGitRemoteUrl. Templates must export hereyaGitRemoteUrl.');
135
- }
136
- },
137
- title: 'Resolving git credentials',
138
- },
139
- {
140
- async task(ctx) {
141
- const cloneResult = await gitUtils.cloneWithCredentialHelper({
142
- gitUrl: ctx.resolvedGitEnv.hereyaGitRemoteUrl,
143
- hereyaBinPath: process.argv[1],
144
- password: ctx.resolvedGitEnv.hereyaGitPassword,
145
- targetDir,
146
- username: ctx.resolvedGitEnv.hereyaGitUsername,
147
- });
148
- if (!cloneResult.success)
149
- throw new Error(cloneResult.reason);
150
- },
151
- title: 'Cloning project repository',
152
- },
153
- {
154
- async task(ctx) {
155
- const configManager = getConfigManager();
156
- const existing = await configManager.loadConfig({ projectRootDir: targetDir });
157
- const config = {
158
- ...(existing.found ? existing.config : {}),
159
- project: ctx.initOutput.project.name,
160
- workspace: ctx.initOutput.workspace.name,
161
- };
162
- await configManager.saveConfig({ config, projectRootDir: targetDir });
163
- await gitUtils.setupCredentialHelper({ hereyaBinPath: process.argv[1], projectDir: targetDir });
164
- const backend = await getBackend();
165
- await backend.saveState(config, flags.workspace);
166
- },
167
- title: 'Setting up project',
168
- },
118
+ ...cloneAndConfigureProjectTasks({
119
+ getEnv: (ctx) => ctx.prefixedEnv,
120
+ getProject: (ctx) => ctx.initOutput.project.name,
121
+ getWorkspace: () => flags.workspace,
122
+ hereyaBinPath: process.argv[1],
123
+ missingRemoteUrlError: 'Template did not provide hereyaGitRemoteUrl. Templates must export hereyaGitRemoteUrl.',
124
+ targetDir,
125
+ }),
169
126
  ], { concurrent: false });
170
127
  try {
171
128
  await task.run();
@@ -0,0 +1,43 @@
1
+ import { ListrTask } from 'listr2';
2
+ export interface CloneAndConfigureCtx {
3
+ resolvedGitEnv: Record<string, string>;
4
+ }
5
+ export interface CloneAndConfigureProjectInput<Ctx extends CloneAndConfigureCtx = CloneAndConfigureCtx> {
6
+ /**
7
+ * Returns the env map that should be inspected for `hereyaGit*` markers.
8
+ * Called when the "Resolving git credentials" task runs, so callers can
9
+ * read up-to-date values from the Listr context (e.g. `ctx.prefixedEnv`)
10
+ * after earlier tasks have populated it.
11
+ */
12
+ getEnv(ctx: Ctx): Promise<Record<string, string>> | Record<string, string>;
13
+ /**
14
+ * Project name to use for env resolution / config persistence / state save.
15
+ * Can be a value or a callback that reads it from ctx (useful when the
16
+ * canonical name comes from a previous task, e.g. `ctx.initOutput.project.name`).
17
+ */
18
+ getProject(ctx: Ctx): Promise<string> | string;
19
+ /**
20
+ * Workspace name to use for env resolution / config persistence / state save.
21
+ */
22
+ getWorkspace(ctx: Ctx): Promise<string> | string;
23
+ hereyaBinPath: string;
24
+ /**
25
+ * Optional override for the error thrown when `hereyaGitRemoteUrl` is missing
26
+ * from the resolved git env. Lets call sites surface a flow-specific message
27
+ * (e.g. "Template did not provide hereyaGitRemoteUrl").
28
+ */
29
+ missingRemoteUrlError?: string;
30
+ targetDir: string;
31
+ }
32
+ /**
33
+ * Returns Listr tasks that:
34
+ * 1. Filter `hereyaGit*` env vars (from a caller-supplied env map) and resolve
35
+ * them via the workspace executor (this exercises the github-app marker path).
36
+ * 2. Clone the repository using the resolved git credentials and the hereya
37
+ * credential helper.
38
+ * 3. Persist the local hereya.yaml, set up the credential helper for the
39
+ * cloned repo, and save the project state on the cloud backend.
40
+ *
41
+ * Used by both `hereya init` (template flow) and `hereya import-repo --clone`.
42
+ */
43
+ export declare function cloneAndConfigureProjectTasks<Ctx extends CloneAndConfigureCtx = CloneAndConfigureCtx>(input: CloneAndConfigureProjectInput<Ctx>): ListrTask<Ctx>[];
@@ -0,0 +1,77 @@
1
+ import { getBackend } from '../backend/index.js';
2
+ import { getExecutorForWorkspace } from '../executor/context.js';
3
+ import { getConfigManager } from './config/index.js';
4
+ import { gitUtils } from './git-utils.js';
5
+ /**
6
+ * Returns Listr tasks that:
7
+ * 1. Filter `hereyaGit*` env vars (from a caller-supplied env map) and resolve
8
+ * them via the workspace executor (this exercises the github-app marker path).
9
+ * 2. Clone the repository using the resolved git credentials and the hereya
10
+ * credential helper.
11
+ * 3. Persist the local hereya.yaml, set up the credential helper for the
12
+ * cloned repo, and save the project state on the cloud backend.
13
+ *
14
+ * Used by both `hereya init` (template flow) and `hereya import-repo --clone`.
15
+ */
16
+ export function cloneAndConfigureProjectTasks(input) {
17
+ const { getEnv, getProject, getWorkspace, hereyaBinPath, missingRemoteUrlError, targetDir } = input;
18
+ return [
19
+ {
20
+ async task(ctx) {
21
+ const env = await getEnv(ctx);
22
+ const project = await getProject(ctx);
23
+ const workspace = await getWorkspace(ctx);
24
+ const gitEnvToResolve = {};
25
+ for (const [key, value] of Object.entries(env || {})) {
26
+ if (key.startsWith('hereyaGit'))
27
+ gitEnvToResolve[key] = value;
28
+ }
29
+ const executor$ = await getExecutorForWorkspace(workspace);
30
+ if (!executor$.success)
31
+ throw new Error(executor$.reason);
32
+ ctx.resolvedGitEnv = await executor$.executor.resolveEnvValues({
33
+ env: gitEnvToResolve,
34
+ project,
35
+ workspace,
36
+ });
37
+ if (!ctx.resolvedGitEnv.hereyaGitRemoteUrl) {
38
+ throw new Error(missingRemoteUrlError
39
+ ?? 'Project metadata does not contain hereyaGitRemoteUrl.');
40
+ }
41
+ },
42
+ title: 'Resolving git credentials',
43
+ },
44
+ {
45
+ async task(ctx) {
46
+ const cloneResult = await gitUtils.cloneWithCredentialHelper({
47
+ gitUrl: ctx.resolvedGitEnv.hereyaGitRemoteUrl,
48
+ hereyaBinPath,
49
+ password: ctx.resolvedGitEnv.hereyaGitPassword,
50
+ targetDir,
51
+ username: ctx.resolvedGitEnv.hereyaGitUsername,
52
+ });
53
+ if (!cloneResult.success)
54
+ throw new Error(cloneResult.reason);
55
+ },
56
+ title: 'Cloning project repository',
57
+ },
58
+ {
59
+ async task(ctx) {
60
+ const project = await getProject(ctx);
61
+ const workspace = await getWorkspace(ctx);
62
+ const configManager = getConfigManager();
63
+ const existing = await configManager.loadConfig({ projectRootDir: targetDir });
64
+ const config = {
65
+ ...(existing.found ? existing.config : {}),
66
+ project,
67
+ workspace,
68
+ };
69
+ await configManager.saveConfig({ config, projectRootDir: targetDir });
70
+ await gitUtils.setupCredentialHelper({ hereyaBinPath, projectDir: targetDir });
71
+ const backend = await getBackend();
72
+ await backend.saveState(config, workspace);
73
+ },
74
+ title: 'Setting up project',
75
+ },
76
+ ];
77
+ }
@@ -521,6 +521,71 @@
521
521
  "index.js"
522
522
  ]
523
523
  },
524
+ "import-repo": {
525
+ "aliases": [],
526
+ "args": {
527
+ "project": {
528
+ "description": "project name",
529
+ "name": "project",
530
+ "required": true
531
+ }
532
+ },
533
+ "description": "Register an existing GitHub repository as a hereya project so it can be deployed via the remote executor.",
534
+ "examples": [
535
+ "<%= config.bin %> <%= command.id %> myProject -w=dev -r=https://github.com/acme/api.git",
536
+ "<%= config.bin %> <%= command.id %> myProject -w=dev -r=https://github.com/acme/api --clone",
537
+ "<%= config.bin %> <%= command.id %> myProject -w=dev -r=https://github.com/acme/api --clone --chdir=./api"
538
+ ],
539
+ "flags": {
540
+ "chdir": {
541
+ "description": "directory to clone into (only meaningful with --clone)",
542
+ "name": "chdir",
543
+ "required": false,
544
+ "hasDynamicHelp": false,
545
+ "multiple": false,
546
+ "type": "option"
547
+ },
548
+ "clone": {
549
+ "description": "also clone the repository locally and write hereya.yaml after the import",
550
+ "name": "clone",
551
+ "allowNo": false,
552
+ "type": "boolean"
553
+ },
554
+ "repo-url": {
555
+ "char": "r",
556
+ "description": "GitHub HTTPS clone URL (e.g. https://github.com/owner/repo.git)",
557
+ "name": "repo-url",
558
+ "required": true,
559
+ "hasDynamicHelp": false,
560
+ "multiple": false,
561
+ "type": "option"
562
+ },
563
+ "workspace": {
564
+ "char": "w",
565
+ "description": "workspace to set as default",
566
+ "name": "workspace",
567
+ "required": true,
568
+ "hasDynamicHelp": false,
569
+ "multiple": false,
570
+ "type": "option"
571
+ }
572
+ },
573
+ "hasDynamicHelp": false,
574
+ "hiddenAliases": [],
575
+ "id": "import-repo",
576
+ "pluginAlias": "hereya-cli",
577
+ "pluginName": "hereya-cli",
578
+ "pluginType": "core",
579
+ "strict": true,
580
+ "enableJsonFlag": false,
581
+ "isESM": true,
582
+ "relativePath": [
583
+ "dist",
584
+ "commands",
585
+ "import-repo",
586
+ "index.js"
587
+ ]
588
+ },
524
589
  "init": {
525
590
  "aliases": [],
526
591
  "args": {
@@ -3212,5 +3277,5 @@
3212
3277
  ]
3213
3278
  }
3214
3279
  },
3215
- "version": "0.88.0"
3280
+ "version": "0.89.1"
3216
3281
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hereya-cli",
3
3
  "description": "Infrastructure as Package",
4
- "version": "0.88.0",
4
+ "version": "0.89.1",
5
5
  "author": "Hereya Developers",
6
6
  "bin": {
7
7
  "hereya": "./bin/run.js"