hereya-cli 0.38.0 → 0.39.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.38.0 linux-x64 node-v22.16.0
23
+ hereya-cli/0.39.0 linux-x64 node-v22.16.0
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -88,7 +88,7 @@ EXAMPLES
88
88
  $ hereya add cloudy/docker_postgres
89
89
  ```
90
90
 
91
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/add/index.ts)_
91
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/add/index.ts)_
92
92
 
93
93
  ## `hereya bootstrap INFRASTRUCTURETYPE`
94
94
 
@@ -113,7 +113,7 @@ EXAMPLES
113
113
  $ hereya bootstrap local
114
114
  ```
115
115
 
116
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/bootstrap/index.ts)_
116
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/bootstrap/index.ts)_
117
117
 
118
118
  ## `hereya config export-backend [FILE]`
119
119
 
@@ -135,7 +135,7 @@ EXAMPLES
135
135
  $ hereya config export-backend ./path/to/export.json
136
136
  ```
137
137
 
138
- _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/config/export-backend/index.ts)_
138
+ _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/config/export-backend/index.ts)_
139
139
 
140
140
  ## `hereya config get-backend`
141
141
 
@@ -152,7 +152,7 @@ EXAMPLES
152
152
  $ hereya config get-backend
153
153
  ```
154
154
 
155
- _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/config/get-backend/index.ts)_
155
+ _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/config/get-backend/index.ts)_
156
156
 
157
157
  ## `hereya config import-backend FILE`
158
158
 
@@ -172,7 +172,7 @@ EXAMPLES
172
172
  $ hereya config import-backend ./path/to/cloud-backend.json
173
173
  ```
174
174
 
175
- _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/config/import-backend/index.ts)_
175
+ _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/config/import-backend/index.ts)_
176
176
 
177
177
  ## `hereya config use-backend TYPE`
178
178
 
@@ -194,7 +194,7 @@ EXAMPLES
194
194
  $ hereya config use-backend local
195
195
  ```
196
196
 
197
- _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/config/use-backend/index.ts)_
197
+ _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/config/use-backend/index.ts)_
198
198
 
199
199
  ## `hereya deploy`
200
200
 
@@ -219,7 +219,7 @@ EXAMPLES
219
219
  $ hereya deploy
220
220
  ```
221
221
 
222
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/deploy/index.ts)_
222
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/deploy/index.ts)_
223
223
 
224
224
  ## `hereya down`
225
225
 
@@ -246,7 +246,7 @@ EXAMPLES
246
246
  $ hereya down
247
247
  ```
248
248
 
249
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/down/index.ts)_
249
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/down/index.ts)_
250
250
 
251
251
  ## `hereya env [NAME]`
252
252
 
@@ -277,7 +277,7 @@ EXAMPLES
277
277
  $ hereya env -w dev -l
278
278
  ```
279
279
 
280
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/env/index.ts)_
280
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/env/index.ts)_
281
281
 
282
282
  ## `hereya env set [NAME]`
283
283
 
@@ -304,7 +304,7 @@ EXAMPLES
304
304
  $ hereya env set FOO -v bar -w dev
305
305
  ```
306
306
 
307
- _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/env/set/index.ts)_
307
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/env/set/index.ts)_
308
308
 
309
309
  ## `hereya help [COMMAND]`
310
310
 
@@ -350,31 +350,36 @@ EXAMPLES
350
350
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
351
351
  ```
352
352
 
353
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/init/index.ts)_
353
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/init/index.ts)_
354
354
 
355
355
  ## `hereya login [URL]`
356
356
 
357
- Login to the Hereya Cloud backend
357
+ Login to Hereya Cloud
358
358
 
359
359
  ```
360
360
  USAGE
361
- $ hereya login [URL]
361
+ $ hereya login [URL] [-t <value>]
362
362
 
363
363
  ARGUMENTS
364
- URL [default: https://cloud.hereya.dev] URL of the Hereya Cloud backend
364
+ URL [default: https://cloud.hereya.dev] URL of the Hereya Cloud instance
365
+
366
+ FLAGS
367
+ -t, --token=<value> Token to use for login
365
368
 
366
369
  DESCRIPTION
367
- Login to the Hereya Cloud backend
370
+ Login to Hereya Cloud
368
371
 
369
372
  EXAMPLES
370
373
  $ hereya login
371
374
 
372
375
  $ hereya login https://cloud.hereya.dev
373
376
 
374
- $ hereya login http://localhost:5173
377
+ $ hereya login --token=your-token
378
+
379
+ $ hereya login --token=your-token https://cloud.hereya.dev
375
380
  ```
376
381
 
377
- _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/login/index.ts)_
382
+ _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/login/index.ts)_
378
383
 
379
384
  ## `hereya logout`
380
385
 
@@ -391,7 +396,7 @@ EXAMPLES
391
396
  $ hereya logout
392
397
  ```
393
398
 
394
- _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/logout/index.ts)_
399
+ _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/logout/index.ts)_
395
400
 
396
401
  ## `hereya remove PACKAGE`
397
402
 
@@ -418,7 +423,7 @@ EXAMPLES
418
423
  $ hereya remove cloudy/docker_postgres
419
424
  ```
420
425
 
421
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/remove/index.ts)_
426
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/remove/index.ts)_
422
427
 
423
428
  ## `hereya run CMD`
424
429
 
@@ -444,7 +449,7 @@ EXAMPLES
444
449
  $ hereya run -w uat -- node index.js
445
450
  ```
446
451
 
447
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/run/index.ts)_
452
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/run/index.ts)_
448
453
 
449
454
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
450
455
 
@@ -469,7 +474,7 @@ EXAMPLES
469
474
  $ hereya unbootstrap local
470
475
  ```
471
476
 
472
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/unbootstrap/index.ts)_
477
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/unbootstrap/index.ts)_
473
478
 
474
479
  ## `hereya undeploy`
475
480
 
@@ -494,7 +499,7 @@ EXAMPLES
494
499
  $ hereya undeploy
495
500
  ```
496
501
 
497
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/undeploy/index.ts)_
502
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/undeploy/index.ts)_
498
503
 
499
504
  ## `hereya up`
500
505
 
@@ -521,7 +526,7 @@ EXAMPLES
521
526
  $ hereya up
522
527
  ```
523
528
 
524
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/up/index.ts)_
529
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/up/index.ts)_
525
530
 
526
531
  ## `hereya workspace create NAME`
527
532
 
@@ -544,7 +549,7 @@ EXAMPLES
544
549
  $ hereya workspace create dev
545
550
  ```
546
551
 
547
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/create/index.ts)_
552
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/create/index.ts)_
548
553
 
549
554
  ## `hereya workspace delete NAME`
550
555
 
@@ -564,7 +569,7 @@ EXAMPLES
564
569
  $ hereya workspace delete dev
565
570
  ```
566
571
 
567
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/delete/index.ts)_
572
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/delete/index.ts)_
568
573
 
569
574
  ## `hereya workspace env [NAME]`
570
575
 
@@ -590,7 +595,7 @@ EXAMPLES
590
595
  $ hereya workspace env myEnv -w dev
591
596
  ```
592
597
 
593
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/env/index.ts)_
598
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/env/index.ts)_
594
599
 
595
600
  ## `hereya workspace env set`
596
601
 
@@ -614,7 +619,7 @@ EXAMPLES
614
619
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
615
620
  ```
616
621
 
617
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/env/set/index.ts)_
622
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/env/set/index.ts)_
618
623
 
619
624
  ## `hereya workspace env unset`
620
625
 
@@ -635,7 +640,7 @@ EXAMPLES
635
640
  $ hereya workspace env unset -w my-workspace -n myVar
636
641
  ```
637
642
 
638
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/env/unset/index.ts)_
643
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/env/unset/index.ts)_
639
644
 
640
645
  ## `hereya workspace install PACKAGE`
641
646
 
@@ -662,7 +667,7 @@ EXAMPLES
662
667
  $ hereya workspace install hereya/aws-cognito
663
668
  ```
664
669
 
665
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/install/index.ts)_
670
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/install/index.ts)_
666
671
 
667
672
  ## `hereya workspace list`
668
673
 
@@ -679,7 +684,7 @@ EXAMPLES
679
684
  $ hereya workspace list
680
685
  ```
681
686
 
682
- _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/list/index.ts)_
687
+ _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/list/index.ts)_
683
688
 
684
689
  ## `hereya workspace uninstall PACKAGE`
685
690
 
@@ -706,5 +711,5 @@ EXAMPLES
706
711
  $ hereya workspace uninstall hereya/aws-cognito
707
712
  ```
708
713
 
709
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.38.0/src/commands/workspace/uninstall/index.ts)_
714
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.39.0/src/commands/workspace/uninstall/index.ts)_
710
715
  <!-- commandsstop -->
@@ -22,3 +22,12 @@ export declare function refreshToken(url: string, refreshToken: string): Promise
22
22
  error: string;
23
23
  success: false;
24
24
  }>;
25
+ export declare function loginWithToken(url: string, token: string): Promise<{
26
+ accessToken: string;
27
+ clientId: string;
28
+ refreshToken: string;
29
+ success: true;
30
+ } | {
31
+ error: string;
32
+ success: false;
33
+ }>;
@@ -167,3 +167,32 @@ export async function refreshToken(url, refreshToken) {
167
167
  success: true,
168
168
  };
169
169
  }
170
+ export async function loginWithToken(url, token) {
171
+ // First register the device to get a clientId
172
+ const registerResult = await registerDevice(url);
173
+ if (!registerResult.success) {
174
+ return registerResult;
175
+ }
176
+ const formData = new FormData();
177
+ formData.append('clientId', registerResult.clientId);
178
+ const response = await fetch(`${url}/auth/cli/login-token`, {
179
+ body: formData,
180
+ headers: {
181
+ Authorization: `Bearer ${token}`,
182
+ },
183
+ method: 'POST',
184
+ });
185
+ if (!response.ok) {
186
+ return {
187
+ error: `Failed to login with token: ${JSON.stringify(await response.json())}`,
188
+ success: false,
189
+ };
190
+ }
191
+ const result = (await response.json());
192
+ return {
193
+ accessToken: result.data.accessToken,
194
+ clientId: registerResult.clientId,
195
+ refreshToken: result.data.refreshToken,
196
+ success: true,
197
+ };
198
+ }
@@ -5,5 +5,8 @@ export default class Login extends Command {
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
+ static flags: {
9
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
8
11
  run(): Promise<void>;
9
12
  }
@@ -1,32 +1,46 @@
1
- import { Args, Command } from '@oclif/core';
2
- import { loginToCloudBackend } from '../../backend/cloud/login.js';
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { loginToCloudBackend, loginWithToken } from '../../backend/cloud/login.js';
3
3
  import { saveCloudCredentials } from '../../backend/config.js';
4
4
  export default class Login extends Command {
5
5
  static args = {
6
6
  url: Args.string({
7
7
  default: 'https://cloud.hereya.dev',
8
- description: 'URL of the Hereya Cloud backend',
8
+ description: 'URL of the Hereya Cloud instance',
9
9
  required: false,
10
10
  }),
11
11
  };
12
- static description = 'Login to the Hereya Cloud backend';
12
+ static description = 'Login to Hereya Cloud';
13
13
  static examples = [
14
- '<%= config.bin %> <%= command.id %>',
15
- '<%= config.bin %> <%= command.id %> https://cloud.hereya.dev',
16
- '<%= config.bin %> <%= command.id %> http://localhost:5173',
14
+ '$ hereya login',
15
+ '$ hereya login https://cloud.hereya.dev',
16
+ '$ hereya login --token=your-token',
17
+ '$ hereya login --token=your-token https://cloud.hereya.dev',
17
18
  ];
19
+ static flags = {
20
+ token: Flags.string({
21
+ char: 't',
22
+ description: 'Token to use for login',
23
+ required: false,
24
+ }),
25
+ };
18
26
  async run() {
19
- const { args } = await this.parse(Login);
20
- const result = await loginToCloudBackend(args.url);
21
- if (!result.success) {
22
- this.error(result.error);
27
+ const { args, flags } = await this.parse(Login);
28
+ const url = args.url ?? 'https://cloud.hereya.dev';
29
+ try {
30
+ const result = flags.token ? await loginWithToken(url, flags.token) : await loginToCloudBackend(url);
31
+ if (!result.success) {
32
+ this.error(result.error);
33
+ }
34
+ await saveCloudCredentials({
35
+ accessToken: result.accessToken,
36
+ clientId: result.clientId,
37
+ refreshToken: result.refreshToken,
38
+ url: args.url,
39
+ });
40
+ this.log(`Logged in to ${url}`);
41
+ }
42
+ catch (error) {
43
+ this.error(error instanceof Error ? error.message : String(error));
23
44
  }
24
- await saveCloudCredentials({
25
- accessToken: result.accessToken,
26
- clientId: result.clientId,
27
- refreshToken: result.refreshToken,
28
- url: args.url,
29
- });
30
- this.log(`Logged in to ${args.url}`);
31
45
  }
32
46
  }
@@ -318,18 +318,29 @@
318
318
  "args": {
319
319
  "url": {
320
320
  "default": "https://cloud.hereya.dev",
321
- "description": "URL of the Hereya Cloud backend",
321
+ "description": "URL of the Hereya Cloud instance",
322
322
  "name": "url",
323
323
  "required": false
324
324
  }
325
325
  },
326
- "description": "Login to the Hereya Cloud backend",
326
+ "description": "Login to Hereya Cloud",
327
327
  "examples": [
328
- "<%= config.bin %> <%= command.id %>",
329
- "<%= config.bin %> <%= command.id %> https://cloud.hereya.dev",
330
- "<%= config.bin %> <%= command.id %> http://localhost:5173"
328
+ "$ hereya login",
329
+ "$ hereya login https://cloud.hereya.dev",
330
+ "$ hereya login --token=your-token",
331
+ "$ hereya login --token=your-token https://cloud.hereya.dev"
331
332
  ],
332
- "flags": {},
333
+ "flags": {
334
+ "token": {
335
+ "char": "t",
336
+ "description": "Token to use for login",
337
+ "name": "token",
338
+ "required": false,
339
+ "hasDynamicHelp": false,
340
+ "multiple": false,
341
+ "type": "option"
342
+ }
343
+ },
333
344
  "hasDynamicHelp": false,
334
345
  "hiddenAliases": [],
335
346
  "id": "login",
@@ -978,6 +989,31 @@
978
989
  "index.js"
979
990
  ]
980
991
  },
992
+ "workspace:list": {
993
+ "aliases": [],
994
+ "args": {},
995
+ "description": "List workspaces.",
996
+ "examples": [
997
+ "<%= config.bin %> <%= command.id %>"
998
+ ],
999
+ "flags": {},
1000
+ "hasDynamicHelp": false,
1001
+ "hiddenAliases": [],
1002
+ "id": "workspace:list",
1003
+ "pluginAlias": "hereya-cli",
1004
+ "pluginName": "hereya-cli",
1005
+ "pluginType": "core",
1006
+ "strict": true,
1007
+ "enableJsonFlag": false,
1008
+ "isESM": true,
1009
+ "relativePath": [
1010
+ "dist",
1011
+ "commands",
1012
+ "workspace",
1013
+ "list",
1014
+ "index.js"
1015
+ ]
1016
+ },
981
1017
  "workspace:uninstall": {
982
1018
  "aliases": [],
983
1019
  "args": {
@@ -1042,31 +1078,6 @@
1042
1078
  "index.js"
1043
1079
  ]
1044
1080
  },
1045
- "workspace:list": {
1046
- "aliases": [],
1047
- "args": {},
1048
- "description": "List workspaces.",
1049
- "examples": [
1050
- "<%= config.bin %> <%= command.id %>"
1051
- ],
1052
- "flags": {},
1053
- "hasDynamicHelp": false,
1054
- "hiddenAliases": [],
1055
- "id": "workspace:list",
1056
- "pluginAlias": "hereya-cli",
1057
- "pluginName": "hereya-cli",
1058
- "pluginType": "core",
1059
- "strict": true,
1060
- "enableJsonFlag": false,
1061
- "isESM": true,
1062
- "relativePath": [
1063
- "dist",
1064
- "commands",
1065
- "workspace",
1066
- "list",
1067
- "index.js"
1068
- ]
1069
- },
1070
1081
  "workspace:env:set": {
1071
1082
  "aliases": [],
1072
1083
  "args": {},
@@ -1183,5 +1194,5 @@
1183
1194
  ]
1184
1195
  }
1185
1196
  },
1186
- "version": "0.38.0"
1197
+ "version": "0.39.0"
1187
1198
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hereya-cli",
3
3
  "description": "Infrastructure as Package",
4
- "version": "0.38.0",
4
+ "version": "0.39.0",
5
5
  "author": "Hereya Developers",
6
6
  "bin": {
7
7
  "hereya": "./bin/run.js"