hereya-cli 0.52.0 → 0.54.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.52.0 linux-x64 node-v22.17.1
23
+ hereya-cli/0.54.0 linux-x64 node-v22.17.1
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -98,7 +98,7 @@ EXAMPLES
98
98
  $ hereya add cloudy/docker_postgres
99
99
  ```
100
100
 
101
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/add/index.ts)_
101
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/add/index.ts)_
102
102
 
103
103
  ## `hereya bootstrap INFRASTRUCTURETYPE`
104
104
 
@@ -123,7 +123,7 @@ EXAMPLES
123
123
  $ hereya bootstrap local
124
124
  ```
125
125
 
126
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/bootstrap/index.ts)_
126
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/bootstrap/index.ts)_
127
127
 
128
128
  ## `hereya config export-backend [FILE]`
129
129
 
@@ -145,7 +145,7 @@ EXAMPLES
145
145
  $ hereya config export-backend ./path/to/export.json
146
146
  ```
147
147
 
148
- _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.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.54.0/src/commands/config/export-backend/index.ts)_
149
149
 
150
150
  ## `hereya config get-backend`
151
151
 
@@ -162,7 +162,7 @@ EXAMPLES
162
162
  $ hereya config get-backend
163
163
  ```
164
164
 
165
- _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.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.54.0/src/commands/config/get-backend/index.ts)_
166
166
 
167
167
  ## `hereya config import-backend FILE`
168
168
 
@@ -182,7 +182,7 @@ EXAMPLES
182
182
  $ hereya config import-backend ./path/to/cloud-backend.json
183
183
  ```
184
184
 
185
- _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.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.54.0/src/commands/config/import-backend/index.ts)_
186
186
 
187
187
  ## `hereya config use-backend TYPE`
188
188
 
@@ -204,7 +204,7 @@ EXAMPLES
204
204
  $ hereya config use-backend local
205
205
  ```
206
206
 
207
- _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.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.54.0/src/commands/config/use-backend/index.ts)_
208
208
 
209
209
  ## `hereya delete-state`
210
210
 
@@ -230,7 +230,7 @@ EXAMPLES
230
230
  $ hereya delete-state --workspace staging
231
231
  ```
232
232
 
233
- _See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/delete-state/index.ts)_
233
+ _See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/delete-state/index.ts)_
234
234
 
235
235
  ## `hereya deploy`
236
236
 
@@ -255,7 +255,7 @@ EXAMPLES
255
255
  $ hereya deploy
256
256
  ```
257
257
 
258
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/deploy/index.ts)_
258
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/deploy/index.ts)_
259
259
 
260
260
  ## `hereya down`
261
261
 
@@ -282,7 +282,7 @@ EXAMPLES
282
282
  $ hereya down
283
283
  ```
284
284
 
285
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/down/index.ts)_
285
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/down/index.ts)_
286
286
 
287
287
  ## `hereya env [NAME]`
288
288
 
@@ -313,7 +313,7 @@ EXAMPLES
313
313
  $ hereya env -w dev -l
314
314
  ```
315
315
 
316
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/env/index.ts)_
316
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/env/index.ts)_
317
317
 
318
318
  ## `hereya env set [NAME]`
319
319
 
@@ -340,7 +340,7 @@ EXAMPLES
340
340
  $ hereya env set FOO -v bar -w dev
341
341
  ```
342
342
 
343
- _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/env/set/index.ts)_
343
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/env/set/index.ts)_
344
344
 
345
345
  ## `hereya flow add PACKAGE`
346
346
 
@@ -378,7 +378,7 @@ EXAMPLES
378
378
  $ hereya flow add cloudy/docker_postgres -p DB_NAME=mydb -p DB_USER=admin
379
379
  ```
380
380
 
381
- _See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/flow/add/index.ts)_
381
+ _See code: [src/commands/flow/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/flow/add/index.ts)_
382
382
 
383
383
  ## `hereya flow down`
384
384
 
@@ -412,7 +412,7 @@ EXAMPLES
412
412
  $ hereya flow down --pin
413
413
  ```
414
414
 
415
- _See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/flow/down/index.ts)_
415
+ _See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/flow/down/index.ts)_
416
416
 
417
417
  ## `hereya flow env [NAME]`
418
418
 
@@ -446,7 +446,7 @@ EXAMPLES
446
446
  $ hereya flow env -l
447
447
  ```
448
448
 
449
- _See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/flow/env/index.ts)_
449
+ _See code: [src/commands/flow/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/flow/env/index.ts)_
450
450
 
451
451
  ## `hereya flow remove PACKAGE`
452
452
 
@@ -476,7 +476,7 @@ EXAMPLES
476
476
  $ hereya flow remove cloudy/docker_postgres --profile staging
477
477
  ```
478
478
 
479
- _See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/flow/remove/index.ts)_
479
+ _See code: [src/commands/flow/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/flow/remove/index.ts)_
480
480
 
481
481
  ## `hereya flow run CMD`
482
482
 
@@ -505,7 +505,7 @@ EXAMPLES
505
505
  $ hereya flow run --pin -- npm test
506
506
  ```
507
507
 
508
- _See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/flow/run/index.ts)_
508
+ _See code: [src/commands/flow/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/flow/run/index.ts)_
509
509
 
510
510
  ## `hereya flow up`
511
511
 
@@ -539,7 +539,7 @@ EXAMPLES
539
539
  $ hereya flow up --pin
540
540
  ```
541
541
 
542
- _See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/flow/up/index.ts)_
542
+ _See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/flow/up/index.ts)_
543
543
 
544
544
  ## `hereya help [COMMAND]`
545
545
 
@@ -596,7 +596,7 @@ EXAMPLES
596
596
  $ hereya import org/my-package -f state.tfstate -w my-workspace
597
597
  ```
598
598
 
599
- _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/import/index.ts)_
599
+ _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/import/index.ts)_
600
600
 
601
601
  ## `hereya init PROJECT`
602
602
 
@@ -622,7 +622,7 @@ EXAMPLES
622
622
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
623
623
  ```
624
624
 
625
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/init/index.ts)_
625
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/init/index.ts)_
626
626
 
627
627
  ## `hereya login [URL]`
628
628
 
@@ -651,7 +651,7 @@ EXAMPLES
651
651
  $ hereya login --token=your-token https://cloud.hereya.dev
652
652
  ```
653
653
 
654
- _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/login/index.ts)_
654
+ _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/login/index.ts)_
655
655
 
656
656
  ## `hereya logout`
657
657
 
@@ -668,7 +668,7 @@ EXAMPLES
668
668
  $ hereya logout
669
669
  ```
670
670
 
671
- _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/logout/index.ts)_
671
+ _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/logout/index.ts)_
672
672
 
673
673
  ## `hereya remove PACKAGE`
674
674
 
@@ -696,7 +696,7 @@ EXAMPLES
696
696
  $ hereya remove cloudy/docker_postgres
697
697
  ```
698
698
 
699
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/remove/index.ts)_
699
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/remove/index.ts)_
700
700
 
701
701
  ## `hereya run CMD`
702
702
 
@@ -722,7 +722,7 @@ EXAMPLES
722
722
  $ hereya run -w uat -- node index.js
723
723
  ```
724
724
 
725
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/run/index.ts)_
725
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/run/index.ts)_
726
726
 
727
727
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
728
728
 
@@ -747,7 +747,7 @@ EXAMPLES
747
747
  $ hereya unbootstrap local
748
748
  ```
749
749
 
750
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/unbootstrap/index.ts)_
750
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/unbootstrap/index.ts)_
751
751
 
752
752
  ## `hereya undeploy`
753
753
 
@@ -772,7 +772,7 @@ EXAMPLES
772
772
  $ hereya undeploy
773
773
  ```
774
774
 
775
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/undeploy/index.ts)_
775
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/undeploy/index.ts)_
776
776
 
777
777
  ## `hereya up`
778
778
 
@@ -799,7 +799,7 @@ EXAMPLES
799
799
  $ hereya up
800
800
  ```
801
801
 
802
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/up/index.ts)_
802
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/up/index.ts)_
803
803
 
804
804
  ## `hereya workspace create NAME`
805
805
 
@@ -824,7 +824,7 @@ EXAMPLES
824
824
  $ hereya workspace create dev
825
825
  ```
826
826
 
827
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/create/index.ts)_
827
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/create/index.ts)_
828
828
 
829
829
  ## `hereya workspace delete NAME`
830
830
 
@@ -844,7 +844,7 @@ EXAMPLES
844
844
  $ hereya workspace delete dev
845
845
  ```
846
846
 
847
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/delete/index.ts)_
847
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/delete/index.ts)_
848
848
 
849
849
  ## `hereya workspace env [NAME]`
850
850
 
@@ -870,7 +870,7 @@ EXAMPLES
870
870
  $ hereya workspace env myEnv -w dev
871
871
  ```
872
872
 
873
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/env/index.ts)_
873
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/env/index.ts)_
874
874
 
875
875
  ## `hereya workspace env set`
876
876
 
@@ -894,7 +894,7 @@ EXAMPLES
894
894
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
895
895
  ```
896
896
 
897
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/env/set/index.ts)_
897
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/env/set/index.ts)_
898
898
 
899
899
  ## `hereya workspace env unset`
900
900
 
@@ -915,7 +915,7 @@ EXAMPLES
915
915
  $ hereya workspace env unset -w my-workspace -n myVar
916
916
  ```
917
917
 
918
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/env/unset/index.ts)_
918
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/env/unset/index.ts)_
919
919
 
920
920
  ## `hereya workspace install PACKAGE`
921
921
 
@@ -942,7 +942,7 @@ EXAMPLES
942
942
  $ hereya workspace install hereya/aws-cognito
943
943
  ```
944
944
 
945
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/install/index.ts)_
945
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/install/index.ts)_
946
946
 
947
947
  ## `hereya workspace list`
948
948
 
@@ -959,7 +959,7 @@ EXAMPLES
959
959
  $ hereya workspace list
960
960
  ```
961
961
 
962
- _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/list/index.ts)_
962
+ _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/list/index.ts)_
963
963
 
964
964
  ## `hereya workspace set-profile PROFILE`
965
965
 
@@ -983,7 +983,7 @@ EXAMPLES
983
983
  $ hereya workspace set-profile prod-profile -w production
984
984
  ```
985
985
 
986
- _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/set-profile/index.ts)_
986
+ _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/set-profile/index.ts)_
987
987
 
988
988
  ## `hereya workspace uninstall PACKAGE`
989
989
 
@@ -1010,5 +1010,5 @@ EXAMPLES
1010
1010
  $ hereya workspace uninstall hereya/aws-cognito
1011
1011
  ```
1012
1012
 
1013
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.52.0/src/commands/workspace/uninstall/index.ts)_
1013
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.54.0/src/commands/workspace/uninstall/index.ts)_
1014
1014
  <!-- commandsstop -->
@@ -20,6 +20,6 @@ export declare class FileBackend implements Backend {
20
20
  saveState(config: Config, workspace?: string): Promise<void>;
21
21
  setEnvVar(input: SetEnvVarInput): Promise<SetEnvVarOutput>;
22
22
  unsetEnvVar(input: UnsetEnvVarInput): Promise<UnsetEnvVarOutput>;
23
- updateWorkspace(_: UpdateWorkspaceInput): Promise<UpdateWorkspaceOutput>;
23
+ updateWorkspace(input: UpdateWorkspaceInput): Promise<UpdateWorkspaceOutput>;
24
24
  private saveWorkspace;
25
25
  }
@@ -89,6 +89,7 @@ export class FileBackend {
89
89
  isDeploy: input.isDeploy,
90
90
  mirrorOf: input.mirrorOf,
91
91
  name: input.name,
92
+ profile: input.profile,
92
93
  };
93
94
  try {
94
95
  await this.saveWorkspace(workspace, input.name);
@@ -439,11 +440,57 @@ export class FileBackend {
439
440
  success: true,
440
441
  };
441
442
  }
442
- async updateWorkspace(_) {
443
- return {
444
- reason: 'Profile feature is not supported in file backend',
445
- success: false,
443
+ async updateWorkspace(input) {
444
+ // Load existing workspace
445
+ const workspace$ = await this.getWorkspace(input.name);
446
+ if (!workspace$.found) {
447
+ return {
448
+ reason: `Workspace ${input.name} not found`,
449
+ success: false,
450
+ };
451
+ }
452
+ if (workspace$.hasError) {
453
+ return {
454
+ reason: workspace$.error,
455
+ success: false,
456
+ };
457
+ }
458
+ // Update fields if provided
459
+ const updatedWorkspace = {
460
+ ...workspace$.workspace,
446
461
  };
462
+ // Update profile if provided (null means clear it)
463
+ if (input.profile !== undefined) {
464
+ if (input.profile === null || input.profile === '') {
465
+ delete updatedWorkspace.profile;
466
+ }
467
+ else {
468
+ updatedWorkspace.profile = input.profile;
469
+ }
470
+ }
471
+ // Update isDeploy if provided
472
+ if (input.isDeploy !== undefined) {
473
+ if (input.isDeploy === null) {
474
+ delete updatedWorkspace.isDeploy;
475
+ }
476
+ else {
477
+ updatedWorkspace.isDeploy = input.isDeploy;
478
+ }
479
+ }
480
+ try {
481
+ // Save updated workspace
482
+ await this.saveWorkspace(updatedWorkspace, input.name);
483
+ return {
484
+ success: true,
485
+ workspace: updatedWorkspace,
486
+ };
487
+ }
488
+ catch (error) {
489
+ return {
490
+ reason: `Failed to update workspace: ${error.message}`,
491
+ success: false,
492
+ };
493
+ }
447
494
  }
448
495
  async saveWorkspace(data, name) {
449
496
  const paths = [['state', 'workspaces', `${name}.yaml`].join('/'), ['state', 'workspaces', `${name}.yml`].join('/')];
@@ -76,7 +76,7 @@ export default class Add extends Command {
76
76
  ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
77
77
  // Validate that the workspace is a development workspace
78
78
  const backend = await getBackend();
79
- const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'add');
79
+ const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'add', loadConfigOutput.config.project);
80
80
  if (!validation.isValid) {
81
81
  throw new Error(validation.message);
82
82
  }
@@ -36,9 +36,15 @@ export default class Deploy extends Command {
36
36
  const { flags } = await this.parse(Deploy);
37
37
  setDebug(flags.debug);
38
38
  const projectRootDir = path.resolve(flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR || process.cwd());
39
+ // Load config first to get project name
40
+ const configManager = getConfigManager();
41
+ const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
42
+ if (!loadConfigOutput.found) {
43
+ this.error("Project not initialized. Run 'hereya init' first.");
44
+ }
39
45
  // Validate that the workspace is a deployment workspace
40
46
  const backend = await getBackend();
41
- const validation = await validateDeploymentWorkspace(flags.workspace, backend, 'deploy');
47
+ const validation = await validateDeploymentWorkspace(flags.workspace, backend, 'deploy', loadConfigOutput.config.project);
42
48
  if (!validation.isValid) {
43
49
  this.error(validation.message);
44
50
  }
@@ -46,11 +52,7 @@ export default class Deploy extends Command {
46
52
  const task = new Listr([
47
53
  {
48
54
  async task(ctx) {
49
- const configManager = getConfigManager();
50
- const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
51
- if (!loadConfigOutput.found) {
52
- throw new Error("Project not initialized. Run 'hereya init' first.");
53
- }
55
+ // Config already loaded above for validation
54
56
  ctx.configOutput = loadConfigOutput;
55
57
  ctx.deployPackages = Object.keys(loadConfigOutput.config.deploy ?? {});
56
58
  ctx.packages = Object.keys(loadConfigOutput.config.packages ?? {});
@@ -61,7 +61,7 @@ export default class Down extends Command {
61
61
  ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
62
62
  // Validate that the workspace is a development workspace
63
63
  const backend = await getBackend();
64
- const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'down');
64
+ const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'down', loadConfigOutput.config.project);
65
65
  if (!validation.isValid) {
66
66
  throw new Error(validation.message);
67
67
  }
@@ -9,6 +9,7 @@ import { arrayOfStringToObject } from '../../lib/object-utils.js';
9
9
  import { getParameterManager } from '../../lib/parameter/index.js';
10
10
  import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
11
11
  import { delay } from '../../lib/shell.js';
12
+ import { validateDevelopmentWorkspace } from '../../lib/workspace-validation.js';
12
13
  export default class Import extends Command {
13
14
  static args = {
14
15
  package: Args.string({
@@ -80,6 +81,12 @@ export default class Import extends Command {
80
81
  }
81
82
  ctx.configOutput = loadConfigOutput;
82
83
  ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
84
+ // Validate that the workspace is a development workspace
85
+ const backend = await getBackend();
86
+ const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'import', loadConfigOutput.config.project);
87
+ if (!validation.isValid) {
88
+ throw new Error(validation.message);
89
+ }
83
90
  task.output = `Loaded project config`;
84
91
  await delay(500);
85
92
  },
@@ -63,7 +63,7 @@ export default class Remove extends Command {
63
63
  ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
64
64
  // Validate that the workspace is a development workspace
65
65
  const backend = await getBackend();
66
- const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'remove');
66
+ const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'remove', loadConfigOutput.config.project);
67
67
  if (!validation.isValid) {
68
68
  throw new Error(validation.message);
69
69
  }
@@ -45,7 +45,7 @@ export default class Run extends Command {
45
45
  }
46
46
  const backend = await getBackend();
47
47
  // Validate that the workspace is a development workspace
48
- const validation = await validateDevelopmentWorkspace(workspace, backend, 'run');
48
+ const validation = await validateDevelopmentWorkspace(workspace, backend, 'run', config.project);
49
49
  if (!validation.isValid) {
50
50
  this.error(validation.message);
51
51
  }
@@ -36,9 +36,15 @@ export default class Undeploy extends Command {
36
36
  const { flags } = await this.parse(Undeploy);
37
37
  setDebug(flags.debug);
38
38
  const projectRootDir = path.resolve(flags.chdir || process.env.HEREYA_PROJECT_ROOT_DIR || process.cwd());
39
+ // Load config first to get project name
40
+ const configManager = getConfigManager();
41
+ const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
42
+ if (!loadConfigOutput.found) {
43
+ this.error("Project not initialized. Run 'hereya init' first.");
44
+ }
39
45
  // Validate that the workspace is a deployment workspace
40
46
  const backend = await getBackend();
41
- const validation = await validateDeploymentWorkspace(flags.workspace, backend, 'undeploy');
47
+ const validation = await validateDeploymentWorkspace(flags.workspace, backend, 'undeploy', loadConfigOutput.config.project);
42
48
  if (!validation.isValid) {
43
49
  this.error(validation.message);
44
50
  }
@@ -49,11 +55,7 @@ export default class Undeploy extends Command {
49
55
  return task.newListr([
50
56
  {
51
57
  async task(ctx) {
52
- const configManager = getConfigManager();
53
- const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
54
- if (!loadConfigOutput.found) {
55
- throw new Error("Project not initialized. Run 'hereya init' first.");
56
- }
58
+ // Config already loaded above for validation
57
59
  ctx.configOutput = loadConfigOutput;
58
60
  ctx.workspace = flags.workspace;
59
61
  await delay(500);
@@ -61,7 +61,7 @@ export default class Up extends Command {
61
61
  ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
62
62
  // Validate that the workspace is a development workspace
63
63
  const backend = await getBackend();
64
- const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'up');
64
+ const validation = await validateDevelopmentWorkspace(ctx.workspace, backend, 'up', loadConfigOutput.config.project);
65
65
  if (!validation.isValid) {
66
66
  throw new Error(validation.message);
67
67
  }
@@ -6,12 +6,12 @@ export interface WorkspaceValidationResult {
6
6
  /**
7
7
  * Validates that a workspace exists and is marked as a deployment workspace (isDeploy=true)
8
8
  */
9
- export declare function validateDeploymentWorkspace(workspaceName: string, backend: Backend, commandName: string): Promise<WorkspaceValidationResult>;
9
+ export declare function validateDeploymentWorkspace(workspaceName: string, backend: Backend, commandName: string, project?: string): Promise<WorkspaceValidationResult>;
10
10
  /**
11
11
  * Validates that a workspace exists and is NOT marked as a deployment workspace (isDeploy=false or undefined)
12
12
  */
13
- export declare function validateDevelopmentWorkspace(workspaceName: string, backend: Backend, commandName: string): Promise<WorkspaceValidationResult>;
13
+ export declare function validateDevelopmentWorkspace(workspaceName: string, backend: Backend, commandName: string, project?: string): Promise<WorkspaceValidationResult>;
14
14
  /**
15
15
  * Validates that flow commands are not used with deployment workspaces
16
16
  */
17
- export declare function validateFlowCommand(workspaceName: string | undefined, backend: Backend): Promise<WorkspaceValidationResult>;
17
+ export declare function validateFlowCommand(workspaceName: string | undefined, backend: Backend, project?: string): Promise<WorkspaceValidationResult>;
@@ -1,12 +1,15 @@
1
+ import { resolveWorkspaceName } from './workspace-utils.js';
1
2
  /**
2
3
  * Validates that a workspace exists and is marked as a deployment workspace (isDeploy=true)
3
4
  */
4
- export async function validateDeploymentWorkspace(workspaceName, backend, commandName) {
5
- const result = await backend.getWorkspace(workspaceName);
5
+ export async function validateDeploymentWorkspace(workspaceName, backend, commandName, project) {
6
+ // Always use resolved workspace name
7
+ const resolvedWorkspaceName = project ? resolveWorkspaceName(workspaceName, project) : workspaceName;
8
+ const result = await backend.getWorkspace(resolvedWorkspaceName);
6
9
  if (!result.found) {
7
10
  return {
8
11
  isValid: false,
9
- message: `Workspace '${workspaceName}' not found. Create a deployment workspace with:\n$ hereya workspace:create ${workspaceName} --deployment`,
12
+ message: `Workspace '${resolvedWorkspaceName}' not found. Create a deployment workspace with:\n$ hereya workspace:create ${resolvedWorkspaceName} --deployment`,
10
13
  };
11
14
  }
12
15
  if (result.hasError) {
@@ -37,12 +40,14 @@ Then run: $ hereya ${commandName} -w prod-deployment`,
37
40
  /**
38
41
  * Validates that a workspace exists and is NOT marked as a deployment workspace (isDeploy=false or undefined)
39
42
  */
40
- export async function validateDevelopmentWorkspace(workspaceName, backend, commandName) {
41
- const result = await backend.getWorkspace(workspaceName);
43
+ export async function validateDevelopmentWorkspace(workspaceName, backend, commandName, project) {
44
+ // Always use resolved workspace name
45
+ const resolvedWorkspaceName = project ? resolveWorkspaceName(workspaceName, project) : workspaceName;
46
+ const result = await backend.getWorkspace(resolvedWorkspaceName);
42
47
  if (!result.found) {
43
48
  return {
44
49
  isValid: false,
45
- message: `Workspace '${workspaceName}' not found. Create a workspace with:\n$ hereya workspace:create ${workspaceName}`,
50
+ message: `Workspace '${resolvedWorkspaceName}' not found. Create a workspace with:\n$ hereya workspace:create ${resolvedWorkspaceName}`,
46
51
  };
47
52
  }
48
53
  if (result.hasError) {
@@ -70,12 +75,14 @@ To work with packages in development:
70
75
  /**
71
76
  * Validates that flow commands are not used with deployment workspaces
72
77
  */
73
- export async function validateFlowCommand(workspaceName, backend) {
78
+ export async function validateFlowCommand(workspaceName, backend, project) {
74
79
  if (!workspaceName) {
75
80
  // If no workspace specified, flow commands will create their own
76
81
  return { isValid: true };
77
82
  }
78
- const result = await backend.getWorkspace(workspaceName);
83
+ // Always use resolved workspace name
84
+ const resolvedWorkspaceName = project ? resolveWorkspaceName(workspaceName, project) : workspaceName;
85
+ const result = await backend.getWorkspace(resolvedWorkspaceName);
79
86
  if (!result.found) {
80
87
  // Workspace doesn't exist, flow command will create it
81
88
  return { isValid: true };
@@ -1,44 +1,5 @@
1
1
  {
2
2
  "commands": {
3
- "bootstrap": {
4
- "aliases": [],
5
- "args": {
6
- "infrastructureType": {
7
- "description": "infrastructure to bootstrap. Options are local, aws",
8
- "name": "infrastructureType",
9
- "required": true
10
- }
11
- },
12
- "description": "Install necessary resources for hereya operations in an infrastructure.",
13
- "examples": [
14
- "<%= config.bin %> <%= command.id %> aws",
15
- "<%= config.bin %> <%= command.id %> local"
16
- ],
17
- "flags": {
18
- "force": {
19
- "char": "f",
20
- "description": "redeploy hereya resources if already deployed",
21
- "name": "force",
22
- "allowNo": false,
23
- "type": "boolean"
24
- }
25
- },
26
- "hasDynamicHelp": false,
27
- "hiddenAliases": [],
28
- "id": "bootstrap",
29
- "pluginAlias": "hereya-cli",
30
- "pluginName": "hereya-cli",
31
- "pluginType": "core",
32
- "strict": true,
33
- "enableJsonFlag": false,
34
- "isESM": true,
35
- "relativePath": [
36
- "dist",
37
- "commands",
38
- "bootstrap",
39
- "index.js"
40
- ]
41
- },
42
3
  "add": {
43
4
  "aliases": [],
44
5
  "args": {
@@ -102,6 +63,45 @@
102
63
  "index.js"
103
64
  ]
104
65
  },
66
+ "bootstrap": {
67
+ "aliases": [],
68
+ "args": {
69
+ "infrastructureType": {
70
+ "description": "infrastructure to bootstrap. Options are local, aws",
71
+ "name": "infrastructureType",
72
+ "required": true
73
+ }
74
+ },
75
+ "description": "Install necessary resources for hereya operations in an infrastructure.",
76
+ "examples": [
77
+ "<%= config.bin %> <%= command.id %> aws",
78
+ "<%= config.bin %> <%= command.id %> local"
79
+ ],
80
+ "flags": {
81
+ "force": {
82
+ "char": "f",
83
+ "description": "redeploy hereya resources if already deployed",
84
+ "name": "force",
85
+ "allowNo": false,
86
+ "type": "boolean"
87
+ }
88
+ },
89
+ "hasDynamicHelp": false,
90
+ "hiddenAliases": [],
91
+ "id": "bootstrap",
92
+ "pluginAlias": "hereya-cli",
93
+ "pluginName": "hereya-cli",
94
+ "pluginType": "core",
95
+ "strict": true,
96
+ "enableJsonFlag": false,
97
+ "isESM": true,
98
+ "relativePath": [
99
+ "dist",
100
+ "commands",
101
+ "bootstrap",
102
+ "index.js"
103
+ ]
104
+ },
105
105
  "delete-state": {
106
106
  "aliases": [],
107
107
  "args": {},
@@ -193,42 +193,47 @@
193
193
  "index.js"
194
194
  ]
195
195
  },
196
- "env": {
196
+ "down": {
197
197
  "aliases": [],
198
- "args": {
199
- "name": {
200
- "description": "name of the env to display",
201
- "name": "name",
202
- "required": false
203
- }
204
- },
205
- "description": "Print project environment variables.",
198
+ "args": {},
199
+ "description": "Destroy all packages in the project.",
206
200
  "examples": [
207
- "<%= config.bin %> <%= command.id %>",
208
- "<%= config.bin %> <%= command.id %> myEnv",
209
- "<%= config.bin %> <%= command.id %> -w dev",
210
- "<%= config.bin %> <%= command.id %> -w dev -l"
201
+ "<%= config.bin %> <%= command.id %>"
211
202
  ],
212
203
  "flags": {
213
204
  "chdir": {
214
- "description": "project root directory",
205
+ "description": "\n Directory where the command will be executed.\n If not specified, it defaults to the current working directory.\n Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.\n ",
215
206
  "name": "chdir",
216
207
  "required": false,
217
208
  "hasDynamicHelp": false,
218
209
  "multiple": false,
219
210
  "type": "option"
220
211
  },
221
- "list": {
222
- "char": "l",
223
- "description": "list only the env vars without values",
224
- "name": "list",
212
+ "debug": {
213
+ "description": "enable debug mode",
214
+ "name": "debug",
215
+ "allowNo": false,
216
+ "type": "boolean"
217
+ },
218
+ "deploy": {
219
+ "description": "destroy deployment companion packages",
220
+ "name": "deploy",
225
221
  "required": false,
226
222
  "allowNo": false,
227
223
  "type": "boolean"
228
224
  },
225
+ "select": {
226
+ "char": "s",
227
+ "description": "select the packages to destroy",
228
+ "name": "select",
229
+ "default": [],
230
+ "hasDynamicHelp": false,
231
+ "multiple": true,
232
+ "type": "option"
233
+ },
229
234
  "workspace": {
230
235
  "char": "w",
231
- "description": "name of the workspace to print the env vars for",
236
+ "description": "name of the workspace to destroy the packages for",
232
237
  "name": "workspace",
233
238
  "required": false,
234
239
  "hasDynamicHelp": false,
@@ -238,7 +243,7 @@
238
243
  },
239
244
  "hasDynamicHelp": false,
240
245
  "hiddenAliases": [],
241
- "id": "env",
246
+ "id": "down",
242
247
  "pluginAlias": "hereya-cli",
243
248
  "pluginName": "hereya-cli",
244
249
  "pluginType": "core",
@@ -248,51 +253,46 @@
248
253
  "relativePath": [
249
254
  "dist",
250
255
  "commands",
251
- "env",
256
+ "down",
252
257
  "index.js"
253
258
  ]
254
259
  },
255
- "down": {
260
+ "env": {
256
261
  "aliases": [],
257
- "args": {},
258
- "description": "Destroy all packages in the project.",
262
+ "args": {
263
+ "name": {
264
+ "description": "name of the env to display",
265
+ "name": "name",
266
+ "required": false
267
+ }
268
+ },
269
+ "description": "Print project environment variables.",
259
270
  "examples": [
260
- "<%= config.bin %> <%= command.id %>"
271
+ "<%= config.bin %> <%= command.id %>",
272
+ "<%= config.bin %> <%= command.id %> myEnv",
273
+ "<%= config.bin %> <%= command.id %> -w dev",
274
+ "<%= config.bin %> <%= command.id %> -w dev -l"
261
275
  ],
262
276
  "flags": {
263
277
  "chdir": {
264
- "description": "\n Directory where the command will be executed.\n If not specified, it defaults to the current working directory.\n Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.\n ",
278
+ "description": "project root directory",
265
279
  "name": "chdir",
266
280
  "required": false,
267
281
  "hasDynamicHelp": false,
268
282
  "multiple": false,
269
283
  "type": "option"
270
284
  },
271
- "debug": {
272
- "description": "enable debug mode",
273
- "name": "debug",
274
- "allowNo": false,
275
- "type": "boolean"
276
- },
277
- "deploy": {
278
- "description": "destroy deployment companion packages",
279
- "name": "deploy",
285
+ "list": {
286
+ "char": "l",
287
+ "description": "list only the env vars without values",
288
+ "name": "list",
280
289
  "required": false,
281
290
  "allowNo": false,
282
291
  "type": "boolean"
283
292
  },
284
- "select": {
285
- "char": "s",
286
- "description": "select the packages to destroy",
287
- "name": "select",
288
- "default": [],
289
- "hasDynamicHelp": false,
290
- "multiple": true,
291
- "type": "option"
292
- },
293
293
  "workspace": {
294
294
  "char": "w",
295
- "description": "name of the workspace to destroy the packages for",
295
+ "description": "name of the workspace to print the env vars for",
296
296
  "name": "workspace",
297
297
  "required": false,
298
298
  "hasDynamicHelp": false,
@@ -302,7 +302,7 @@
302
302
  },
303
303
  "hasDynamicHelp": false,
304
304
  "hiddenAliases": [],
305
- "id": "down",
305
+ "id": "env",
306
306
  "pluginAlias": "hereya-cli",
307
307
  "pluginName": "hereya-cli",
308
308
  "pluginType": "core",
@@ -312,7 +312,7 @@
312
312
  "relativePath": [
313
313
  "dist",
314
314
  "commands",
315
- "down",
315
+ "env",
316
316
  "index.js"
317
317
  ]
318
318
  },
@@ -1786,5 +1786,5 @@
1786
1786
  ]
1787
1787
  }
1788
1788
  },
1789
- "version": "0.52.0"
1789
+ "version": "0.54.0"
1790
1790
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hereya-cli",
3
3
  "description": "Infrastructure as Package",
4
- "version": "0.52.0",
4
+ "version": "0.54.0",
5
5
  "author": "Hereya Developers",
6
6
  "bin": {
7
7
  "hereya": "./bin/run.js"