@quonfig/cli 0.0.6 → 0.0.8

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
@@ -14,7 +14,7 @@ $ npm install -g @quonfig/cli
14
14
  $ qfg COMMAND
15
15
  running command...
16
16
  $ qfg (--version)
17
- @quonfig/cli/0.0.6 linux-x64 node-v24.4.1
17
+ @quonfig/cli/0.0.8 linux-x64 node-v24.4.1
18
18
  $ qfg --help [COMMAND]
19
19
  USAGE
20
20
  $ qfg COMMAND
@@ -27,7 +27,6 @@ USAGE
27
27
  <!-- commands -->
28
28
  * [`qfg config-schema`](#qfg-config-schema)
29
29
  * [`qfg create NAME`](#qfg-create-name)
30
- * [`qfg download`](#qfg-download)
31
30
  * [`qfg generate`](#qfg-generate)
32
31
  * [`qfg generate-new-hex-key`](#qfg-generate-new-hex-key)
33
32
  * [`qfg get [NAME]`](#qfg-get-name)
@@ -41,7 +40,10 @@ USAGE
41
40
  * [`qfg override [NAME]`](#qfg-override-name)
42
41
  * [`qfg pull`](#qfg-pull)
43
42
  * [`qfg schema NAME`](#qfg-schema-name)
44
- * [`qfg serve DATA-FILE`](#qfg-serve-data-file)
43
+ * [`qfg sdk-key`](#qfg-sdk-key)
44
+ * [`qfg sdk-key create`](#qfg-sdk-key-create)
45
+ * [`qfg sdk-key list`](#qfg-sdk-key-list)
46
+ * [`qfg sdk-key revoke KEYID`](#qfg-sdk-key-revoke-keyid)
45
47
  * [`qfg set-default [NAME]`](#qfg-set-default-name)
46
48
  * [`qfg set-rollout [NAME]`](#qfg-set-rollout-name)
47
49
  * [`qfg sync`](#qfg-sync)
@@ -78,7 +80,7 @@ EXAMPLES
78
80
  $ qfg config-schema --json-schema # full JSON Schema document (copy into your editor)
79
81
  ```
80
82
 
81
- _See code: [src/commands/config-schema.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/config-schema.ts)_
83
+ _See code: [src/commands/config-schema.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/config-schema.ts)_
82
84
 
83
85
  ## `qfg create NAME`
84
86
 
@@ -150,40 +152,7 @@ EXAMPLES
150
152
  $ qfg set-rollout my.new.flag --environment production --true-percent 20
151
153
  ```
152
154
 
153
- _See code: [src/commands/create.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/create.ts)_
154
-
155
- ## `qfg download`
156
-
157
- Download a Datafile for a given environment
158
-
159
- ```
160
- USAGE
161
- $ qfg download [--json] [--interactive] [--no-color] [--verbose] [-w <value>] [--environment <value>]
162
- [--sdk-key <value>]
163
-
164
- FLAGS
165
- --environment=<value> environment to download
166
- --sdk-key=<value> SDK key for authentication (uses legacy download endpoint)
167
-
168
- GLOBAL FLAGS
169
- -w, --workspace=<value> Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)
170
- --[no-]interactive Force interactive mode
171
- --json Format output as json.
172
- --no-color Do not colorize output
173
- --verbose Verbose output
174
-
175
- DESCRIPTION
176
- Download a Datafile for a given environment
177
-
178
- You can serve a datafile using the `serve` command.
179
-
180
- EXAMPLES
181
- $ qfg download --environment=test
182
-
183
- $ qfg download --environment=test --sdk-key=YOUR_SDK_KEY
184
- ```
185
-
186
- _See code: [src/commands/download.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/download.ts)_
155
+ _See code: [src/commands/create.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/create.ts)_
187
156
 
188
157
  ## `qfg generate`
189
158
 
@@ -191,20 +160,20 @@ Generate type definitions for your Quonfig configuration
191
160
 
192
161
  ```
193
162
  USAGE
194
- $ qfg generate [--json] [--interactive] [--no-color] [--verbose] [-w <value>] [-o <value>] [--targets
163
+ $ qfg generate [--json] [--interactive] [--no-color] [--verbose] [--dir <value>] [-o <value>] [--targets
195
164
  <value>]
196
165
 
197
166
  FLAGS
198
167
  -o, --output-directory=<value> Override the output directory for generated files
168
+ --dir=<value> Path to local QUONFIG_DIR (defaults to QUONFIG_DIR env var)
199
169
  --targets=<value> [default: react-ts] Determines for language/framework to generate code for (node-ts,
200
170
  react-ts)
201
171
 
202
172
  GLOBAL FLAGS
203
- -w, --workspace=<value> Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)
204
- --[no-]interactive Force interactive mode
205
- --json Format output as json.
206
- --no-color Do not colorize output
207
- --verbose Verbose output
173
+ --[no-]interactive Force interactive mode
174
+ --json Format output as json.
175
+ --no-color Do not colorize output
176
+ --verbose Verbose output
208
177
 
209
178
  DESCRIPTION
210
179
  Generate type definitions for your Quonfig configuration
@@ -253,7 +222,7 @@ EXAMPLES
253
222
  $ qfg generate --targets node-ts -o ./dist # combine with targets
254
223
  ```
255
224
 
256
- _See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/generate.ts)_
225
+ _See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/generate.ts)_
257
226
 
258
227
  ## `qfg generate-new-hex-key`
259
228
 
@@ -276,7 +245,7 @@ EXAMPLES
276
245
  $ qfg generate-new-hex-key
277
246
  ```
278
247
 
279
- _See code: [src/commands/generate-new-hex-key.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/generate-new-hex-key.ts)_
248
+ _See code: [src/commands/generate-new-hex-key.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/generate-new-hex-key.ts)_
280
249
 
281
250
  ## `qfg get [NAME]`
282
251
 
@@ -308,7 +277,7 @@ EXAMPLES
308
277
  $ qfg get my.config.name --environment=production
309
278
  ```
310
279
 
311
- _See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/get.ts)_
280
+ _See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/get.ts)_
312
281
 
313
282
  ## `qfg info [NAME]`
314
283
 
@@ -352,7 +321,7 @@ EXAMPLES
352
321
  $ qfg info my.config.name --exclude-evaluations # skip 24h stats
353
322
  ```
354
323
 
355
- _See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/info.ts)_
324
+ _See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/info.ts)_
356
325
 
357
326
  ## `qfg init [DIRECTORY]`
358
327
 
@@ -390,7 +359,7 @@ EXAMPLES
390
359
  $ qfg init --dry-run
391
360
  ```
392
361
 
393
- _See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/init.ts)_
362
+ _See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/init.ts)_
394
363
 
395
364
  ## `qfg interactive`
396
365
 
@@ -408,7 +377,7 @@ EXAMPLES
408
377
  $ qfg
409
378
  ```
410
379
 
411
- _See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/interactive.ts)_
380
+ _See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/interactive.ts)_
412
381
 
413
382
  ## `qfg list`
414
383
 
@@ -445,7 +414,7 @@ EXAMPLES
445
414
  $ qfg list --feature-flags
446
415
  ```
447
416
 
448
- _See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/list.ts)_
417
+ _See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/list.ts)_
449
418
 
450
419
  ## `qfg login`
451
420
 
@@ -470,7 +439,7 @@ EXAMPLES
470
439
  $ qfg login --profile myprofile
471
440
  ```
472
441
 
473
- _See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/login.ts)_
442
+ _See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/login.ts)_
474
443
 
475
444
  ## `qfg logout`
476
445
 
@@ -493,7 +462,7 @@ EXAMPLES
493
462
  $ qfg logout
494
463
  ```
495
464
 
496
- _See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/logout.ts)_
465
+ _See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/logout.ts)_
497
466
 
498
467
  ## `qfg mcp`
499
468
 
@@ -526,7 +495,7 @@ EXAMPLES
526
495
  $ qfg mcp --url http://local-app.quonfig-staging.com:3003/api/v1/mcp
527
496
  ```
528
497
 
529
- _See code: [src/commands/mcp.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/mcp.ts)_
498
+ _See code: [src/commands/mcp.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/mcp.ts)_
530
499
 
531
500
  ## `qfg override [NAME]`
532
501
 
@@ -565,7 +534,7 @@ EXAMPLES
565
534
  $ qfg override my.double.config --value=3.14159
566
535
  ```
567
536
 
568
- _See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/override.ts)_
537
+ _See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/override.ts)_
569
538
 
570
539
  ## `qfg pull`
571
540
 
@@ -609,7 +578,7 @@ EXAMPLES
609
578
  $ qfg pull # uses QUONFIG_DIR env var
610
579
  ```
611
580
 
612
- _See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/pull.ts)_
581
+ _See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/pull.ts)_
613
582
 
614
583
  ## `qfg schema NAME`
615
584
 
@@ -647,21 +616,15 @@ EXAMPLES
647
616
  $ qfg schema my-schema --set-json-schema=@schemas/my-schema.json --protected
648
617
  ```
649
618
 
650
- _See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/schema.ts)_
619
+ _See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/schema.ts)_
651
620
 
652
- ## `qfg serve DATA-FILE`
621
+ ## `qfg sdk-key`
653
622
 
654
- Serve a datafile on a local port
623
+ Manage SDK keys for your workspace
655
624
 
656
625
  ```
657
626
  USAGE
658
- $ qfg serve DATA-FILE [--json] [--interactive] [--no-color] [--verbose] [--port <value>]
659
-
660
- ARGUMENTS
661
- DATA-FILE file to read
662
-
663
- FLAGS
664
- --port=<value> [default: 3099] port to serve on
627
+ $ qfg sdk-key [--json] [--interactive] [--no-color] [--verbose]
665
628
 
666
629
  GLOBAL FLAGS
667
630
  --[no-]interactive Force interactive mode
@@ -670,20 +633,105 @@ GLOBAL FLAGS
670
633
  --verbose Verbose output
671
634
 
672
635
  DESCRIPTION
673
- Serve a datafile on a local port
636
+ Manage SDK keys for your workspace
637
+
638
+ EXAMPLES
639
+ $ qfg sdk-key list
640
+
641
+ $ qfg sdk-key create --environment production --type server
642
+
643
+ $ qfg sdk-key revoke <key-id>
644
+ ```
645
+
646
+ _See code: [src/commands/sdk-key.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/sdk-key.ts)_
647
+
648
+ ## `qfg sdk-key create`
674
649
 
675
- You can download a datafile using the `download` command.
650
+ Create a new SDK key
676
651
 
677
- You'll need to update your JavaScript (or React) client to point to this server.
652
+ ```
653
+ USAGE
654
+ $ qfg sdk-key create [--json] [--interactive] [--no-color] [--verbose] [-w <value>] [-e <value>] [-t
655
+ server|browser]
678
656
 
679
- e.g. `endpoints: ["http://localhost:3099"],`
657
+ FLAGS
658
+ -e, --environment=<value> Environment name (e.g. production, staging)
659
+ -t, --type=<option> Key type: server (backend) or browser (frontend)
660
+ <options: server|browser>
680
661
 
662
+ GLOBAL FLAGS
663
+ -w, --workspace=<value> Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)
664
+ --[no-]interactive Force interactive mode
665
+ --json Format output as json.
666
+ --no-color Do not colorize output
667
+ --verbose Verbose output
668
+
669
+ DESCRIPTION
670
+ Create a new SDK key
671
+
672
+ EXAMPLES
673
+ $ qfg sdk-key create --environment production --type server
674
+
675
+ $ qfg sdk-key create --environment staging --type browser
676
+ ```
677
+
678
+ _See code: [src/commands/sdk-key/create.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/sdk-key/create.ts)_
679
+
680
+ ## `qfg sdk-key list`
681
+
682
+ List SDK keys for your workspace
683
+
684
+ ```
685
+ USAGE
686
+ $ qfg sdk-key list [--json] [--interactive] [--no-color] [--verbose] [-w <value>] [-e <value>]
687
+
688
+ FLAGS
689
+ -e, --environment=<value> Filter by environment name
690
+
691
+ GLOBAL FLAGS
692
+ -w, --workspace=<value> Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)
693
+ --[no-]interactive Force interactive mode
694
+ --json Format output as json.
695
+ --no-color Do not colorize output
696
+ --verbose Verbose output
697
+
698
+ DESCRIPTION
699
+ List SDK keys for your workspace
700
+
701
+ EXAMPLES
702
+ $ qfg sdk-key list
703
+
704
+ $ qfg sdk-key list --environment production
705
+ ```
706
+
707
+ _See code: [src/commands/sdk-key/list.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/sdk-key/list.ts)_
708
+
709
+ ## `qfg sdk-key revoke KEYID`
710
+
711
+ Revoke an SDK key by its ID
712
+
713
+ ```
714
+ USAGE
715
+ $ qfg sdk-key revoke KEYID [--json] [--interactive] [--no-color] [--verbose] [-w <value>]
716
+
717
+ ARGUMENTS
718
+ KEYID ID of the SDK key to revoke
719
+
720
+ GLOBAL FLAGS
721
+ -w, --workspace=<value> Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)
722
+ --[no-]interactive Force interactive mode
723
+ --json Format output as json.
724
+ --no-color Do not colorize output
725
+ --verbose Verbose output
726
+
727
+ DESCRIPTION
728
+ Revoke an SDK key by its ID
681
729
 
682
730
  EXAMPLES
683
- $ qfg serve ./quonfig.test.588.config.json --port=3099
731
+ $ qfg sdk-key revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890
684
732
  ```
685
733
 
686
- _See code: [src/commands/serve.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/serve.ts)_
734
+ _See code: [src/commands/sdk-key/revoke.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/sdk-key/revoke.ts)_
687
735
 
688
736
  ## `qfg set-default [NAME]`
689
737
 
@@ -747,7 +795,7 @@ EXAMPLES
747
795
  $ qfg set-rollout my.flag.name --environment production --true-percent 20
748
796
  ```
749
797
 
750
- _See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/set-default.ts)_
798
+ _See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/set-default.ts)_
751
799
 
752
800
  ## `qfg set-rollout [NAME]`
753
801
 
@@ -824,7 +872,7 @@ EXAMPLES
824
872
  $ qfg set-rollout my.variant.flag --environment production --weights "a:33,b:33,c:34" --hash-by user.id
825
873
  ```
826
874
 
827
- _See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/set-rollout.ts)_
875
+ _See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/set-rollout.ts)_
828
876
 
829
877
  ## `qfg sync`
830
878
 
@@ -856,7 +904,7 @@ EXAMPLES
856
904
  $ qfg sync --watch --dir ./our-config --interval 30
857
905
  ```
858
906
 
859
- _See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/sync.ts)_
907
+ _See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/sync.ts)_
860
908
 
861
909
  ## `qfg verify [PATH]`
862
910
 
@@ -889,7 +937,7 @@ EXAMPLES
889
937
  $ qfg verify --json
890
938
  ```
891
939
 
892
- _See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/verify.ts)_
940
+ _See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/verify.ts)_
893
941
 
894
942
  ## `qfg whoami`
895
943
 
@@ -912,7 +960,7 @@ EXAMPLES
912
960
  $ qfg whoami
913
961
  ```
914
962
 
915
- _See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/whoami.ts)_
963
+ _See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/whoami.ts)_
916
964
 
917
965
  ## `qfg workspace`
918
966
 
@@ -935,7 +983,7 @@ EXAMPLES
935
983
  $ qfg workspace
936
984
  ```
937
985
 
938
- _See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/workspace.ts)_
986
+ _See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/workspace.ts)_
939
987
 
940
988
  ## `qfg workspace bootstrap`
941
989
 
@@ -968,7 +1016,7 @@ EXAMPLES
968
1016
  $ qfg workspace bootstrap --dir ./our-config --skip-validate
969
1017
  ```
970
1018
 
971
- _See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/workspace/bootstrap.ts)_
1019
+ _See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/workspace/bootstrap.ts)_
972
1020
 
973
1021
  ## `qfg workspace switch`
974
1022
 
@@ -991,7 +1039,7 @@ EXAMPLES
991
1039
  $ qfg workspace switch
992
1040
  ```
993
1041
 
994
- _See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.0.6/src/commands/workspace/switch.ts)_
1042
+ _See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.0.8/src/commands/workspace/switch.ts)_
995
1043
  <!-- commandsstop -->
996
1044
 
997
1045
  ## Local Development
@@ -0,0 +1,6 @@
1
+ import type { ConfigFile } from './types.js';
2
+ export declare class LocalConfigReader {
3
+ private dir;
4
+ constructor(dir: string);
5
+ read(): Promise<ConfigFile>;
6
+ }
@@ -0,0 +1,113 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ function mapGitValue(gitValue) {
4
+ const { type, value } = gitValue;
5
+ switch (type) {
6
+ case 'bool': {
7
+ return { value: { bool: value } };
8
+ }
9
+ case 'int': {
10
+ return { value: { int: value } };
11
+ }
12
+ case 'json': {
13
+ return { value: { json: { json: value } } };
14
+ }
15
+ case 'log_level': {
16
+ return { value: { logLevel: value } };
17
+ }
18
+ case 'string_list': {
19
+ return { value: { string: JSON.stringify(value) } };
20
+ }
21
+ case 'string':
22
+ default: {
23
+ return { value: { string: value } };
24
+ }
25
+ }
26
+ }
27
+ function buildRows(gitConfig) {
28
+ const allRules = [
29
+ ...(gitConfig.default?.rules ?? []),
30
+ ...(gitConfig.environments ?? []).flatMap((env) => env.rules),
31
+ ];
32
+ return allRules.map((rule) => ({
33
+ values: [mapGitValue(rule.value)],
34
+ }));
35
+ }
36
+ function mapConfigType(gitType) {
37
+ return gitType === 'feature_flag' ? 'FEATURE_FLAG' : 'CONFIG';
38
+ }
39
+ function mapValueType(gitValueType) {
40
+ return gitValueType.toUpperCase();
41
+ }
42
+ async function readJsonFiles(dir) {
43
+ try {
44
+ const entries = await fs.promises.readdir(dir);
45
+ const jsonFiles = entries.filter((f) => f.endsWith('.json'));
46
+ return Promise.all(jsonFiles.map(async (file) => {
47
+ const filePath = path.join(dir, file);
48
+ const content = await fs.promises.readFile(filePath, 'utf8');
49
+ return { filePath, data: JSON.parse(content) };
50
+ }));
51
+ }
52
+ catch (error) {
53
+ if (error.code === 'ENOENT') {
54
+ return [];
55
+ }
56
+ throw error;
57
+ }
58
+ }
59
+ export class LocalConfigReader {
60
+ dir;
61
+ constructor(dir) {
62
+ this.dir = dir;
63
+ }
64
+ async read() {
65
+ // Validate dir exists
66
+ try {
67
+ await fs.promises.access(this.dir, fs.constants.F_OK);
68
+ }
69
+ catch {
70
+ throw new Error(`Directory not found: ${this.dir}. Run \`qfg pull --dir ${this.dir}\` to clone it.`);
71
+ }
72
+ // Validate it's a quonfig workspace
73
+ const quonfigJsonPath = path.join(this.dir, 'quonfig.json');
74
+ try {
75
+ await fs.promises.access(quonfigJsonPath, fs.constants.F_OK);
76
+ }
77
+ catch {
78
+ throw new Error(`${this.dir} does not look like a Quonfig workspace. Is this the right directory?`);
79
+ }
80
+ // Read configs and feature-flags
81
+ const [configFiles, flagFiles] = await Promise.all([
82
+ readJsonFiles(path.join(this.dir, 'configs')),
83
+ readJsonFiles(path.join(this.dir, 'feature-flags')),
84
+ ]);
85
+ const configs = [];
86
+ for (const { filePath, data } of [...configFiles, ...flagFiles]) {
87
+ const gitConfig = data;
88
+ if (!gitConfig.key || !gitConfig.type || !gitConfig.valueType) {
89
+ console.warn(`Skipping malformed config file: ${filePath}`);
90
+ continue;
91
+ }
92
+ const rows = buildRows(gitConfig);
93
+ configs.push({
94
+ configType: mapConfigType(gitConfig.type),
95
+ key: gitConfig.key,
96
+ rows,
97
+ schemaKey: gitConfig.schemaKey,
98
+ sendToClientSdk: gitConfig.sendToClientSdk,
99
+ valueType: mapValueType(gitConfig.valueType),
100
+ });
101
+ }
102
+ // Read schemas
103
+ const schemaFiles = await readJsonFiles(path.join(this.dir, 'schemas'));
104
+ const schemas = schemaFiles.map(({ filePath, data }) => ({
105
+ path: filePath,
106
+ schema: data,
107
+ }));
108
+ if (configs.length === 0) {
109
+ console.warn('No configs or feature-flags found in workspace. Generated types will be empty.');
110
+ }
111
+ return { configs, schemas };
112
+ }
113
+ }
@@ -105,6 +105,9 @@ Or edit the JSON config file directly for complex targeting rules:
105
105
  configValue = confidentialValueResult.value;
106
106
  }
107
107
  }
108
+ else if (valueInput.error) {
109
+ return this.err(valueInput.message, valueInput.json);
110
+ }
108
111
  else {
109
112
  return;
110
113
  }
@@ -1,9 +1,10 @@
1
1
  import type { JsonObj } from '../result.js';
2
- import { APICommand } from '../index.js';
3
- export default class Generate extends APICommand {
2
+ import { BaseCommand } from '../index.js';
3
+ export default class Generate extends BaseCommand {
4
4
  static description: string;
5
5
  static examples: string[];
6
6
  static flags: {
7
+ dir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
7
8
  'output-directory': import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
8
9
  targets: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
10
  };
@@ -4,9 +4,9 @@ import * as path from 'node:path';
4
4
  import { z } from 'zod';
5
5
  import { NodeTypeScriptGenerator } from '../codegen/code-generators/node-typescript-generator.js';
6
6
  import { ReactTypeScriptGenerator } from '../codegen/code-generators/react-typescript-generator.js';
7
- import { ConfigDownloader } from '../codegen/config-downloader.js';
7
+ import { LocalConfigReader } from '../codegen/local-config-reader.js';
8
8
  import { SupportedLanguage } from '../codegen/types.js';
9
- import { APICommand } from '../index.js';
9
+ import { BaseCommand } from '../index.js';
10
10
  import { createFileManager } from '../util/file-manager.js';
11
11
  // base types
12
12
  const nodeOrReactLanguageSpecificSchema = z.object({
@@ -66,7 +66,7 @@ const DEFAULT_CONFIG = {
66
66
  },
67
67
  },
68
68
  };
69
- export default class Generate extends APICommand {
69
+ export default class Generate extends BaseCommand {
70
70
  /* eslint-disable no-irregular-whitespace */
71
71
  static description = `You can use the default type-generation configuration, or by provide your own via a quonfig.config.json file:
72
72
 
@@ -108,6 +108,10 @@ Example quonfig.config.json:
108
108
  '<%= config.bin %> <%= command.id %> --targets node-ts -o ./dist # combine with targets',
109
109
  ];
110
110
  static flags = {
111
+ dir: Flags.string({
112
+ description: 'Path to local QUONFIG_DIR (defaults to QUONFIG_DIR env var)',
113
+ env: 'QUONFIG_DIR',
114
+ }),
111
115
  'output-directory': Flags.string({
112
116
  char: 'o',
113
117
  description: 'Override the output directory for generated files',
@@ -121,18 +125,22 @@ Example quonfig.config.json:
121
125
  async run() {
122
126
  const { flags } = await this.parse(Generate);
123
127
  this.verboseLog('=== GENERATE COMMAND START ===');
124
- this.verboseLog(`Base API URL: ${process.env.QUONFIG_API_URL || 'Default'}`);
125
128
  try {
129
+ // Resolve workspace directory
130
+ const dir = flags.dir;
131
+ if (!dir) {
132
+ this.error('No directory specified. Run `qfg pull` first or pass --dir <path>.');
133
+ }
126
134
  // Look for and read local quonfig.config.json file
127
135
  const localConfig = await this.readLocalConfig(flags['output-directory']);
128
- // Use tarets flag override, otherwise fall back to local config
136
+ // Use targets flag override, otherwise fall back to local config
129
137
  const targets = flags.targets.split(',') || Object.keys(localConfig);
130
138
  this.verboseLog(`Language(s): ${targets.join(', ')}`);
131
- // Download the configuration using the APICommand's client
132
- const downloader = new ConfigDownloader(this);
133
- this.verboseLog('Downloading config...');
134
- const configFile = await downloader.downloadConfig();
135
- this.verboseLog('Config download complete.');
139
+ // Read configuration from local directory
140
+ const reader = new LocalConfigReader(dir);
141
+ this.verboseLog(`Reading config from ${dir}...`);
142
+ const configFile = await reader.read();
143
+ this.verboseLog(`Config read complete. Found ${configFile.configs.length} configs.`);
136
144
  const fileCreationPromises = [];
137
145
  for (const target of targets) {
138
146
  // Resolve the language input
@@ -56,7 +56,7 @@ export default class Get extends APICommand {
56
56
  }
57
57
  const request = await this.apiClient.post('/api/v1/evaluations/evaluate', {
58
58
  workspaceId: this.workspaceId,
59
- environmentId: environment.id,
59
+ environmentName: environment.name,
60
60
  context: {},
61
61
  });
62
62
  if (!request.ok) {
@@ -133,8 +133,11 @@ export default class Login extends BaseCommand {
133
133
  else if (orgId) {
134
134
  this.log(`Organization: ${orgId}`);
135
135
  }
136
- if (multipleWorkspacesAvailable) {
137
- this.log(`\nTo switch workspaces: qfg workspace switch`);
136
+ if (multipleWorkspacesAvailable && workspaceSlug) {
137
+ this.log(`\nYou have multiple workspaces. To pin this project to ${workspaceSlug},`);
138
+ this.log(`add this to your project's .env file:`);
139
+ this.log(` QUONFIG_WORKSPACE=${workspaceSlug}`);
140
+ this.log(`\nTo switch your default workspace: qfg workspace switch`);
138
141
  }
139
142
  return {
140
143
  email: userEmail,
@@ -0,0 +1,11 @@
1
+ import type { JsonObj } from '../../result.js';
2
+ import { APICommand } from '../../index.js';
3
+ export default class SdkKeyCreate extends APICommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ environment: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
8
+ type: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
+ };
10
+ run(): Promise<JsonObj | void>;
11
+ }