@quonfig/cli 0.0.20 → 0.0.22
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 +123 -59
- package/dist/codegen/fetch-workspace-snapshot.d.ts +18 -0
- package/dist/codegen/fetch-workspace-snapshot.js +52 -0
- package/dist/codegen/local-config-reader.js +6 -1
- package/dist/commands/create.js +3 -1
- package/dist/commands/delete.d.ts +13 -0
- package/dist/commands/delete.js +114 -0
- package/dist/commands/generate.d.ts +1 -0
- package/dist/commands/generate.js +33 -4
- package/dist/commands/login.js +36 -20
- package/dist/commands/override.d.ts +11 -5
- package/dist/commands/override.js +244 -148
- package/dist/quonfig.js +2 -1
- package/dist/util/coerce.js +21 -1
- package/dist/util/config-value-dto.js +3 -1
- package/dist/util/domain-urls.d.ts +1 -0
- package/dist/util/domain-urls.js +7 -0
- package/dist/util/resolve-workspace.js +69 -3
- package/dist/util/token-storage.d.ts +4 -2
- package/dist/util/token-storage.js +27 -0
- package/oclif.manifest.json +121 -20
- package/package.json +1 -1
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.
|
|
17
|
+
@quonfig/cli/0.0.22 linux-x64 node-v24.4.1
|
|
18
18
|
$ qfg --help [COMMAND]
|
|
19
19
|
USAGE
|
|
20
20
|
$ qfg COMMAND
|
|
@@ -27,6 +27,7 @@ USAGE
|
|
|
27
27
|
<!-- commands -->
|
|
28
28
|
* [`qfg config-schema`](#qfg-config-schema)
|
|
29
29
|
* [`qfg create NAME`](#qfg-create-name)
|
|
30
|
+
* [`qfg delete NAME`](#qfg-delete-name)
|
|
30
31
|
* [`qfg flag info [NAME]`](#qfg-flag-info-name)
|
|
31
32
|
* [`qfg flag list`](#qfg-flag-list)
|
|
32
33
|
* [`qfg flag show [NAME]`](#qfg-flag-show-name)
|
|
@@ -45,7 +46,7 @@ USAGE
|
|
|
45
46
|
* [`qfg migrate doctor`](#qfg-migrate-doctor)
|
|
46
47
|
* [`qfg migrate my-code`](#qfg-migrate-my-code)
|
|
47
48
|
* [`qfg migrate status`](#qfg-migrate-status)
|
|
48
|
-
* [`qfg override [NAME]`](#qfg-override-name)
|
|
49
|
+
* [`qfg override [NAME] [VALUE]`](#qfg-override-name-value)
|
|
49
50
|
* [`qfg pull`](#qfg-pull)
|
|
50
51
|
* [`qfg push`](#qfg-push)
|
|
51
52
|
* [`qfg schema NAME`](#qfg-schema-name)
|
|
@@ -91,7 +92,7 @@ EXAMPLES
|
|
|
91
92
|
$ qfg config-schema --json-schema # full JSON Schema document (copy into your editor)
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
_See code: [src/commands/config-schema.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
95
|
+
_See code: [src/commands/config-schema.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/config-schema.ts)_
|
|
95
96
|
|
|
96
97
|
## `qfg create NAME`
|
|
97
98
|
|
|
@@ -99,9 +100,9 @@ Create a new feature flag, config value, or other item.
|
|
|
99
100
|
|
|
100
101
|
```
|
|
101
102
|
USAGE
|
|
102
|
-
$ qfg create NAME --type boolean-flag|boolean|string|double|int|string-list|json|log_level
|
|
103
|
-
[--interactive] [--no-color] [--verbose] [-w <value>] [--confidential] [--env-var <value>] [--value
|
|
104
|
-
[--secret] [--secret-key-name <value>]
|
|
103
|
+
$ qfg create NAME --type boolean-flag|boolean|string|double|int|string-list|json|duration|log_level
|
|
104
|
+
[--json] [--interactive] [--no-color] [--verbose] [-w <value>] [--confidential] [--env-var <value>] [--value
|
|
105
|
+
<value>] [--secret] [--secret-key-name <value>]
|
|
105
106
|
|
|
106
107
|
ARGUMENTS
|
|
107
108
|
NAME name for your new item (e.g. my.new.flag)
|
|
@@ -113,7 +114,7 @@ FLAGS
|
|
|
113
114
|
--secret-key-name=<value> [default: quonfig.secrets.encryption.key] name of the secret key to use for
|
|
114
115
|
encryption/decryption
|
|
115
116
|
--type=<option> (required)
|
|
116
|
-
<options: boolean-flag|boolean|string|double|int|string-list|json|log_level>
|
|
117
|
+
<options: boolean-flag|boolean|string|double|int|string-list|json|duration|log_level>
|
|
117
118
|
--value=<value> default value for your new item
|
|
118
119
|
|
|
119
120
|
GLOBAL FLAGS
|
|
@@ -134,6 +135,7 @@ DESCRIPTION
|
|
|
134
135
|
string-list A comma-separated list of strings
|
|
135
136
|
json An arbitrary JSON blob
|
|
136
137
|
boolean A plain boolean (not a feature flag)
|
|
138
|
+
duration An ISO 8601 duration string, e.g. PT30S, PT5M, PT1H30M (SDK returns milliseconds)
|
|
137
139
|
log_level A dynamic log level (value must be one of TRACE/DEBUG/INFO/WARN/ERROR/FATAL)
|
|
138
140
|
|
|
139
141
|
This sets the global default value. Override per-environment with:
|
|
@@ -166,6 +168,8 @@ EXAMPLES
|
|
|
166
168
|
|
|
167
169
|
$ qfg create my.new.string --type json --value="{\"key\": \"value\"}"
|
|
168
170
|
|
|
171
|
+
$ qfg create my.timeout --type duration --value PT90S
|
|
172
|
+
|
|
169
173
|
$ qfg create log-level.my-app --type log_level --value WARN
|
|
170
174
|
|
|
171
175
|
# After creating a flag, set a 20% rollout in production:
|
|
@@ -173,7 +177,53 @@ EXAMPLES
|
|
|
173
177
|
$ qfg set-rollout my.new.flag --environment production --true-percent 20
|
|
174
178
|
```
|
|
175
179
|
|
|
176
|
-
_See code: [src/commands/create.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
180
|
+
_See code: [src/commands/create.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/create.ts)_
|
|
181
|
+
|
|
182
|
+
## `qfg delete NAME`
|
|
183
|
+
|
|
184
|
+
Delete a flag, config, or log-level from the workspace.
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
USAGE
|
|
188
|
+
$ qfg delete NAME [--json] [--interactive] [--no-color] [--verbose] [-w <value>] [--yes]
|
|
189
|
+
|
|
190
|
+
ARGUMENTS
|
|
191
|
+
NAME flag/config/log-level key to delete
|
|
192
|
+
|
|
193
|
+
FLAGS
|
|
194
|
+
--yes skip confirmation prompt
|
|
195
|
+
|
|
196
|
+
GLOBAL FLAGS
|
|
197
|
+
-w, --workspace=<value> Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)
|
|
198
|
+
--[no-]interactive Force interactive mode
|
|
199
|
+
--json Format output as json.
|
|
200
|
+
--no-color Do not colorize output
|
|
201
|
+
--verbose Verbose output
|
|
202
|
+
|
|
203
|
+
DESCRIPTION
|
|
204
|
+
Delete a flag, config, or log-level from the workspace.
|
|
205
|
+
|
|
206
|
+
DESTRUCTIVE — removes the underlying JSON file from the workspace git repo
|
|
207
|
+
and commits with the actor's identity. The commit history preserves the
|
|
208
|
+
prior content; this is a hard-delete on the file but a soft-delete on
|
|
209
|
+
history.
|
|
210
|
+
|
|
211
|
+
Confirmation is required:
|
|
212
|
+
--yes skip the prompt (for scripts and CI)
|
|
213
|
+
interactive (default) you'll be asked to type the key name back
|
|
214
|
+
|
|
215
|
+
Examples
|
|
216
|
+
qfg delete my.flag --yes
|
|
217
|
+
qfg delete my.flag # interactive: type the key back to confirm
|
|
218
|
+
qfg delete my.config --yes
|
|
219
|
+
|
|
220
|
+
EXAMPLES
|
|
221
|
+
$ qfg delete my.flag --yes
|
|
222
|
+
|
|
223
|
+
$ qfg delete my.config --yes
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
_See code: [src/commands/delete.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/delete.ts)_
|
|
177
227
|
|
|
178
228
|
## `qfg flag info [NAME]`
|
|
179
229
|
|
|
@@ -312,11 +362,14 @@ Generate type definitions for your Quonfig configuration
|
|
|
312
362
|
```
|
|
313
363
|
USAGE
|
|
314
364
|
$ qfg generate [--json] [--interactive] [--no-color] [--verbose] [--dir <value>] [-o <value>] [--targets
|
|
315
|
-
<value>]
|
|
365
|
+
<value>] [-w <value>]
|
|
316
366
|
|
|
317
367
|
FLAGS
|
|
318
368
|
-o, --output-directory=<value> Override the output directory for generated files
|
|
319
|
-
|
|
369
|
+
-w, --workspace=<value> Workspace slug or UUID for the remote-fetch path (defaults to QUONFIG_WORKSPACE env
|
|
370
|
+
var or active profile). Only used when --dir is omitted.
|
|
371
|
+
--dir=<value> Path to local QUONFIG_DIR (defaults to QUONFIG_DIR env var). When omitted, fetches the
|
|
372
|
+
workspace from the server using your active credentials.
|
|
320
373
|
--targets=<value> [default: react-ts] Determines for language/framework to generate code for (node-ts,
|
|
321
374
|
react-ts)
|
|
322
375
|
|
|
@@ -373,7 +426,7 @@ EXAMPLES
|
|
|
373
426
|
$ qfg generate --targets node-ts -o ./dist # combine with targets
|
|
374
427
|
```
|
|
375
428
|
|
|
376
|
-
_See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
429
|
+
_See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/generate.ts)_
|
|
377
430
|
|
|
378
431
|
## `qfg generate-new-hex-key`
|
|
379
432
|
|
|
@@ -396,7 +449,7 @@ EXAMPLES
|
|
|
396
449
|
$ qfg generate-new-hex-key
|
|
397
450
|
```
|
|
398
451
|
|
|
399
|
-
_See code: [src/commands/generate-new-hex-key.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
452
|
+
_See code: [src/commands/generate-new-hex-key.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/generate-new-hex-key.ts)_
|
|
400
453
|
|
|
401
454
|
## `qfg get [NAME]`
|
|
402
455
|
|
|
@@ -428,7 +481,7 @@ EXAMPLES
|
|
|
428
481
|
$ qfg get my.config.name --environment=production
|
|
429
482
|
```
|
|
430
483
|
|
|
431
|
-
_See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
484
|
+
_See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/get.ts)_
|
|
432
485
|
|
|
433
486
|
## `qfg info [NAME]`
|
|
434
487
|
|
|
@@ -476,7 +529,7 @@ EXAMPLES
|
|
|
476
529
|
$ qfg info my.config.name --exclude-evaluations # skip 24h stats
|
|
477
530
|
```
|
|
478
531
|
|
|
479
|
-
_See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
532
|
+
_See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/info.ts)_
|
|
480
533
|
|
|
481
534
|
## `qfg init [DIRECTORY]`
|
|
482
535
|
|
|
@@ -516,7 +569,7 @@ EXAMPLES
|
|
|
516
569
|
$ qfg init --dry-run
|
|
517
570
|
```
|
|
518
571
|
|
|
519
|
-
_See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
572
|
+
_See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/init.ts)_
|
|
520
573
|
|
|
521
574
|
## `qfg interactive`
|
|
522
575
|
|
|
@@ -546,7 +599,7 @@ EXAMPLES
|
|
|
546
599
|
$ qfg
|
|
547
600
|
```
|
|
548
601
|
|
|
549
|
-
_See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
602
|
+
_See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/interactive.ts)_
|
|
550
603
|
|
|
551
604
|
## `qfg list`
|
|
552
605
|
|
|
@@ -586,7 +639,7 @@ EXAMPLES
|
|
|
586
639
|
$ qfg list --feature-flags
|
|
587
640
|
```
|
|
588
641
|
|
|
589
|
-
_See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
642
|
+
_See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/list.ts)_
|
|
590
643
|
|
|
591
644
|
## `qfg log-level NAME`
|
|
592
645
|
|
|
@@ -651,7 +704,7 @@ EXAMPLES
|
|
|
651
704
|
$ qfg log-level log-level.my-app --target=Chatty --value=INFO --environment=production
|
|
652
705
|
```
|
|
653
706
|
|
|
654
|
-
_See code: [src/commands/log-level.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
707
|
+
_See code: [src/commands/log-level.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/log-level.ts)_
|
|
655
708
|
|
|
656
709
|
## `qfg login`
|
|
657
710
|
|
|
@@ -676,7 +729,7 @@ EXAMPLES
|
|
|
676
729
|
$ qfg login --profile myprofile
|
|
677
730
|
```
|
|
678
731
|
|
|
679
|
-
_See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
732
|
+
_See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/login.ts)_
|
|
680
733
|
|
|
681
734
|
## `qfg logout`
|
|
682
735
|
|
|
@@ -699,7 +752,7 @@ EXAMPLES
|
|
|
699
752
|
$ qfg logout
|
|
700
753
|
```
|
|
701
754
|
|
|
702
|
-
_See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
755
|
+
_See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/logout.ts)_
|
|
703
756
|
|
|
704
757
|
## `qfg mcp`
|
|
705
758
|
|
|
@@ -732,7 +785,7 @@ EXAMPLES
|
|
|
732
785
|
$ qfg mcp --url http://local-app.quonfig-staging.com:3003/api/v1/mcp
|
|
733
786
|
```
|
|
734
787
|
|
|
735
|
-
_See code: [src/commands/mcp.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
788
|
+
_See code: [src/commands/mcp.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/mcp.ts)_
|
|
736
789
|
|
|
737
790
|
## `qfg migrate`
|
|
738
791
|
|
|
@@ -786,7 +839,7 @@ EXAMPLES
|
|
|
786
839
|
$ qfg migrate --from launch --api-key $LAUNCH_API_KEY --dir ./quonfig-config --staging
|
|
787
840
|
```
|
|
788
841
|
|
|
789
|
-
_See code: [src/commands/migrate.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
842
|
+
_See code: [src/commands/migrate.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate.ts)_
|
|
790
843
|
|
|
791
844
|
## `qfg migrate doctor`
|
|
792
845
|
|
|
@@ -824,7 +877,7 @@ EXAMPLES
|
|
|
824
877
|
$ qfg migrate doctor --json
|
|
825
878
|
```
|
|
826
879
|
|
|
827
|
-
_See code: [src/commands/migrate/doctor.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
880
|
+
_See code: [src/commands/migrate/doctor.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate/doctor.ts)_
|
|
828
881
|
|
|
829
882
|
## `qfg migrate my-code`
|
|
830
883
|
|
|
@@ -856,7 +909,7 @@ EXAMPLES
|
|
|
856
909
|
$ qfg migrate my-code --dry-run
|
|
857
910
|
```
|
|
858
911
|
|
|
859
|
-
_See code: [src/commands/migrate/my-code.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
912
|
+
_See code: [src/commands/migrate/my-code.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate/my-code.ts)_
|
|
860
913
|
|
|
861
914
|
## `qfg migrate status`
|
|
862
915
|
|
|
@@ -887,24 +940,25 @@ EXAMPLES
|
|
|
887
940
|
$ qfg migrate status --json
|
|
888
941
|
```
|
|
889
942
|
|
|
890
|
-
_See code: [src/commands/migrate/status.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
943
|
+
_See code: [src/commands/migrate/status.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate/status.ts)_
|
|
891
944
|
|
|
892
|
-
## `qfg override [NAME]`
|
|
945
|
+
## `qfg override [NAME] [VALUE]`
|
|
893
946
|
|
|
894
|
-
Override
|
|
947
|
+
Override a flag value for your dev user.
|
|
895
948
|
|
|
896
949
|
```
|
|
897
950
|
USAGE
|
|
898
|
-
$ qfg override [NAME] [--json] [--interactive] [--no-color] [--verbose] [-w <value>] [--
|
|
899
|
-
[--
|
|
951
|
+
$ qfg override [NAME] [VALUE] [--json] [--interactive] [--no-color] [--verbose] [-w <value>] [--clear]
|
|
952
|
+
[--env <value>] [--remove]
|
|
900
953
|
|
|
901
954
|
ARGUMENTS
|
|
902
|
-
NAME
|
|
955
|
+
NAME flag/config key to override
|
|
956
|
+
VALUE new value (type inferred: bool/int/double/json/string)
|
|
903
957
|
|
|
904
958
|
FLAGS
|
|
905
|
-
--
|
|
906
|
-
--
|
|
907
|
-
--
|
|
959
|
+
--clear remove ALL of your overrides in this env
|
|
960
|
+
--env=<value> environment to operate in (default: $QUONFIG_ENVIRONMENT)
|
|
961
|
+
--remove remove your override on this key
|
|
908
962
|
|
|
909
963
|
GLOBAL FLAGS
|
|
910
964
|
-w, --workspace=<value> Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)
|
|
@@ -914,24 +968,34 @@ GLOBAL FLAGS
|
|
|
914
968
|
--verbose Verbose output
|
|
915
969
|
|
|
916
970
|
DESCRIPTION
|
|
917
|
-
Override
|
|
971
|
+
Override a flag value for your dev user.
|
|
972
|
+
|
|
973
|
+
Writes a top-priority rule keyed on the dev-only quonfig-user.email property,
|
|
974
|
+
so the override only fires for SDK clients that set quonfig-user.email in
|
|
975
|
+
their context. Production SDKs typically don't set this property, which makes
|
|
976
|
+
overrides effectively inert in production.
|
|
918
977
|
|
|
919
|
-
|
|
920
|
-
you
|
|
921
|
-
qfg
|
|
922
|
-
qfg
|
|
978
|
+
Examples
|
|
979
|
+
qfg override # list flags where you have an override
|
|
980
|
+
qfg override my.flag true # set bool override
|
|
981
|
+
qfg override my.flag 42 # set int override
|
|
982
|
+
qfg override my.flag '{"a":1}' # set json override
|
|
983
|
+
qfg override my.flag --remove # remove your override on my.flag
|
|
984
|
+
qfg override --clear # remove ALL of your overrides in this env
|
|
923
985
|
|
|
924
986
|
EXAMPLES
|
|
925
|
-
$ qfg override
|
|
987
|
+
$ qfg override
|
|
988
|
+
|
|
989
|
+
$ qfg override my.flag true
|
|
926
990
|
|
|
927
|
-
$ qfg override my.flag
|
|
991
|
+
$ qfg override my.flag --remove
|
|
928
992
|
|
|
929
|
-
$ qfg override
|
|
993
|
+
$ qfg override --clear
|
|
930
994
|
|
|
931
|
-
$ qfg override my.
|
|
995
|
+
$ qfg override my.flag true --env=staging
|
|
932
996
|
```
|
|
933
997
|
|
|
934
|
-
_See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
998
|
+
_See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/override.ts)_
|
|
935
999
|
|
|
936
1000
|
## `qfg pull`
|
|
937
1001
|
|
|
@@ -975,7 +1039,7 @@ EXAMPLES
|
|
|
975
1039
|
$ qfg pull # uses QUONFIG_DIR env var
|
|
976
1040
|
```
|
|
977
1041
|
|
|
978
|
-
_See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1042
|
+
_See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/pull.ts)_
|
|
979
1043
|
|
|
980
1044
|
## `qfg push`
|
|
981
1045
|
|
|
@@ -1023,7 +1087,7 @@ EXAMPLES
|
|
|
1023
1087
|
$ qfg push --dir ./our-config --yes
|
|
1024
1088
|
```
|
|
1025
1089
|
|
|
1026
|
-
_See code: [src/commands/push.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1090
|
+
_See code: [src/commands/push.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/push.ts)_
|
|
1027
1091
|
|
|
1028
1092
|
## `qfg schema NAME`
|
|
1029
1093
|
|
|
@@ -1061,7 +1125,7 @@ EXAMPLES
|
|
|
1061
1125
|
$ qfg schema my-schema --set-json-schema=@schemas/my-schema.json --protected
|
|
1062
1126
|
```
|
|
1063
1127
|
|
|
1064
|
-
_See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1128
|
+
_See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/schema.ts)_
|
|
1065
1129
|
|
|
1066
1130
|
## `qfg sdk-key`
|
|
1067
1131
|
|
|
@@ -1088,7 +1152,7 @@ EXAMPLES
|
|
|
1088
1152
|
$ qfg sdk-key revoke <key-id>
|
|
1089
1153
|
```
|
|
1090
1154
|
|
|
1091
|
-
_See code: [src/commands/sdk-key.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1155
|
+
_See code: [src/commands/sdk-key.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key.ts)_
|
|
1092
1156
|
|
|
1093
1157
|
## `qfg sdk-key create`
|
|
1094
1158
|
|
|
@@ -1120,7 +1184,7 @@ EXAMPLES
|
|
|
1120
1184
|
$ qfg sdk-key create --environment staging --type browser
|
|
1121
1185
|
```
|
|
1122
1186
|
|
|
1123
|
-
_See code: [src/commands/sdk-key/create.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1187
|
+
_See code: [src/commands/sdk-key/create.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key/create.ts)_
|
|
1124
1188
|
|
|
1125
1189
|
## `qfg sdk-key list`
|
|
1126
1190
|
|
|
@@ -1149,7 +1213,7 @@ EXAMPLES
|
|
|
1149
1213
|
$ qfg sdk-key list --environment production
|
|
1150
1214
|
```
|
|
1151
1215
|
|
|
1152
|
-
_See code: [src/commands/sdk-key/list.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1216
|
+
_See code: [src/commands/sdk-key/list.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key/list.ts)_
|
|
1153
1217
|
|
|
1154
1218
|
## `qfg sdk-key revoke KEYID`
|
|
1155
1219
|
|
|
@@ -1176,7 +1240,7 @@ EXAMPLES
|
|
|
1176
1240
|
$ qfg sdk-key revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890
|
|
1177
1241
|
```
|
|
1178
1242
|
|
|
1179
|
-
_See code: [src/commands/sdk-key/revoke.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1243
|
+
_See code: [src/commands/sdk-key/revoke.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key/revoke.ts)_
|
|
1180
1244
|
|
|
1181
1245
|
## `qfg set-default [NAME]`
|
|
1182
1246
|
|
|
@@ -1247,7 +1311,7 @@ EXAMPLES
|
|
|
1247
1311
|
$ qfg pull && qfg config-schema
|
|
1248
1312
|
```
|
|
1249
1313
|
|
|
1250
|
-
_See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1314
|
+
_See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/set-default.ts)_
|
|
1251
1315
|
|
|
1252
1316
|
## `qfg set-rollout [NAME]`
|
|
1253
1317
|
|
|
@@ -1324,7 +1388,7 @@ EXAMPLES
|
|
|
1324
1388
|
$ qfg set-rollout my.variant.flag --environment production --weights "a:33,b:33,c:34" --hash-by user.id
|
|
1325
1389
|
```
|
|
1326
1390
|
|
|
1327
|
-
_See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1391
|
+
_See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/set-rollout.ts)_
|
|
1328
1392
|
|
|
1329
1393
|
## `qfg sync`
|
|
1330
1394
|
|
|
@@ -1356,7 +1420,7 @@ EXAMPLES
|
|
|
1356
1420
|
$ qfg sync --watch --dir ./our-config --interval 30
|
|
1357
1421
|
```
|
|
1358
1422
|
|
|
1359
|
-
_See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1423
|
+
_See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sync.ts)_
|
|
1360
1424
|
|
|
1361
1425
|
## `qfg toggle [NAME]`
|
|
1362
1426
|
|
|
@@ -1458,7 +1522,7 @@ EXAMPLES
|
|
|
1458
1522
|
$ qfg verify --json
|
|
1459
1523
|
```
|
|
1460
1524
|
|
|
1461
|
-
_See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1525
|
+
_See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/verify.ts)_
|
|
1462
1526
|
|
|
1463
1527
|
## `qfg whoami`
|
|
1464
1528
|
|
|
@@ -1481,7 +1545,7 @@ EXAMPLES
|
|
|
1481
1545
|
$ qfg whoami
|
|
1482
1546
|
```
|
|
1483
1547
|
|
|
1484
|
-
_See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1548
|
+
_See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/whoami.ts)_
|
|
1485
1549
|
|
|
1486
1550
|
## `qfg workspace`
|
|
1487
1551
|
|
|
@@ -1504,7 +1568,7 @@ EXAMPLES
|
|
|
1504
1568
|
$ qfg workspace
|
|
1505
1569
|
```
|
|
1506
1570
|
|
|
1507
|
-
_See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1571
|
+
_See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace.ts)_
|
|
1508
1572
|
|
|
1509
1573
|
## `qfg workspace bootstrap`
|
|
1510
1574
|
|
|
@@ -1537,7 +1601,7 @@ EXAMPLES
|
|
|
1537
1601
|
$ qfg workspace bootstrap --dir ./our-config --skip-validate
|
|
1538
1602
|
```
|
|
1539
1603
|
|
|
1540
|
-
_See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1604
|
+
_See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace/bootstrap.ts)_
|
|
1541
1605
|
|
|
1542
1606
|
## `qfg workspace create SLUG`
|
|
1543
1607
|
|
|
@@ -1571,7 +1635,7 @@ EXAMPLES
|
|
|
1571
1635
|
$ qfg workspace create my-team --org 11111111-1111-1111-1111-111111111111
|
|
1572
1636
|
```
|
|
1573
1637
|
|
|
1574
|
-
_See code: [src/commands/workspace/create.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1638
|
+
_See code: [src/commands/workspace/create.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace/create.ts)_
|
|
1575
1639
|
|
|
1576
1640
|
## `qfg workspace switch [SLUG]`
|
|
1577
1641
|
|
|
@@ -1599,7 +1663,7 @@ EXAMPLES
|
|
|
1599
1663
|
$ qfg workspace switch my-workspace-slug
|
|
1600
1664
|
```
|
|
1601
1665
|
|
|
1602
|
-
_See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.0.
|
|
1666
|
+
_See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace/switch.ts)_
|
|
1603
1667
|
<!-- commandsstop -->
|
|
1604
1668
|
|
|
1605
1669
|
## Local Development
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BaseCommand } from '../index.js';
|
|
2
|
+
export interface WorkspaceSnapshot {
|
|
3
|
+
cleanup: () => Promise<void>;
|
|
4
|
+
dir: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Clone the active workspace into a fresh OS tmp directory and return its path
|
|
8
|
+
* along with a cleanup callback. Used by `qfg generate` so codegen works
|
|
9
|
+
* without requiring `qfg pull` first or a long-lived `--dir` checkout.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors `qfg pull`'s auth/clone path: resolves workspace from
|
|
12
|
+
* QUONFIG_API_KEY/QUONFIG_WORKSPACE or active OAuth profile, mints a Gitea
|
|
13
|
+
* read token (refreshing on 401), then `git clone`s into the tmp dir. The
|
|
14
|
+
* caller is responsible for calling `cleanup()` in a `finally` block.
|
|
15
|
+
*/
|
|
16
|
+
export declare function fetchWorkspaceSnapshot(command: BaseCommand, options?: {
|
|
17
|
+
workspace?: string;
|
|
18
|
+
}): Promise<WorkspaceSnapshot>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as os from 'node:os';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { mintAndStoreGiteaReadToken } from '../util/gitea-api.js';
|
|
5
|
+
import { isGiteaTokenExpired, loadGiteaToken } from '../util/gitea-token-storage.js';
|
|
6
|
+
import { gitClone } from '../util/git-ops.js';
|
|
7
|
+
import { resolveWorkspaceUuid } from '../util/resolve-workspace.js';
|
|
8
|
+
const looksLike401 = (err) => {
|
|
9
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
10
|
+
return msg.includes('401') || msg.toLowerCase().includes('authentication failed');
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Clone the active workspace into a fresh OS tmp directory and return its path
|
|
14
|
+
* along with a cleanup callback. Used by `qfg generate` so codegen works
|
|
15
|
+
* without requiring `qfg pull` first or a long-lived `--dir` checkout.
|
|
16
|
+
*
|
|
17
|
+
* Mirrors `qfg pull`'s auth/clone path: resolves workspace from
|
|
18
|
+
* QUONFIG_API_KEY/QUONFIG_WORKSPACE or active OAuth profile, mints a Gitea
|
|
19
|
+
* read token (refreshing on 401), then `git clone`s into the tmp dir. The
|
|
20
|
+
* caller is responsible for calling `cleanup()` in a `finally` block.
|
|
21
|
+
*/
|
|
22
|
+
export async function fetchWorkspaceSnapshot(command, options = {}) {
|
|
23
|
+
const workspaceId = await resolveWorkspaceUuid(command, options.workspace);
|
|
24
|
+
let entry = await loadGiteaToken(workspaceId);
|
|
25
|
+
if (!entry || isGiteaTokenExpired(entry)) {
|
|
26
|
+
command.verboseLog('fetchWorkspaceSnapshot', 'Minting new Gitea read token...');
|
|
27
|
+
entry = await mintAndStoreGiteaReadToken(workspaceId);
|
|
28
|
+
}
|
|
29
|
+
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'qfg-codegen-'));
|
|
30
|
+
const cleanup = () => fs.promises.rm(tmpDir, { force: true, recursive: true });
|
|
31
|
+
try {
|
|
32
|
+
command.verboseLog('fetchWorkspaceSnapshot', `Cloning workspace ${workspaceId} into ${tmpDir}...`);
|
|
33
|
+
try {
|
|
34
|
+
await gitClone(entry.repoUrl, tmpDir);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (looksLike401(error)) {
|
|
38
|
+
command.verboseLog('fetchWorkspaceSnapshot', 'Got 401 on clone, refreshing Gitea token...');
|
|
39
|
+
const fresh = await mintAndStoreGiteaReadToken(workspaceId);
|
|
40
|
+
await gitClone(fresh.repoUrl, tmpDir);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
await cleanup();
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
return { cleanup, dir: tmpDir };
|
|
52
|
+
}
|
|
@@ -10,7 +10,12 @@ function mapGitValue(gitValue) {
|
|
|
10
10
|
return { value: { int: value } };
|
|
11
11
|
}
|
|
12
12
|
case 'json': {
|
|
13
|
-
|
|
13
|
+
// Git-native value may be a parsed JS value (canonical, what `qfg
|
|
14
|
+
// pull` and our-config produce) or a pre-stringified JSON string
|
|
15
|
+
// (legacy). Downstream codegen JSON.parses this string, so emit a
|
|
16
|
+
// string either way.
|
|
17
|
+
const jsonString = typeof value === 'string' ? value : JSON.stringify(value);
|
|
18
|
+
return { value: { json: { json: jsonString } } };
|
|
14
19
|
}
|
|
15
20
|
case 'log_level': {
|
|
16
21
|
return { value: { logLevel: value } };
|
package/dist/commands/create.js
CHANGED
|
@@ -22,6 +22,7 @@ Use --type to specify the kind of item:
|
|
|
22
22
|
string-list A comma-separated list of strings
|
|
23
23
|
json An arbitrary JSON blob
|
|
24
24
|
boolean A plain boolean (not a feature flag)
|
|
25
|
+
duration An ISO 8601 duration string, e.g. PT30S, PT5M, PT1H30M (SDK returns milliseconds)
|
|
25
26
|
log_level A dynamic log level (value must be one of ${LOG_LEVELS.join('/')})
|
|
26
27
|
|
|
27
28
|
This sets the global default value. Override per-environment with:
|
|
@@ -47,6 +48,7 @@ Log levels:
|
|
|
47
48
|
'<%= config.bin %> <%= command.id %> my.new.string --type string --value="hello world" --secret',
|
|
48
49
|
'<%= config.bin %> <%= command.id %> my.new.string --type string --env-var=MY_ENV_VAR_NAME',
|
|
49
50
|
'<%= config.bin %> <%= command.id %> my.new.string --type json --value="{\\"key\\": \\"value\\"}"',
|
|
51
|
+
'<%= config.bin %> <%= command.id %> my.timeout --type duration --value PT90S',
|
|
50
52
|
'<%= config.bin %> <%= command.id %> log-level.my-app --type log_level --value WARN',
|
|
51
53
|
'# After creating a flag, set a 20% rollout in production:',
|
|
52
54
|
'<%= config.bin %> set-rollout my.new.flag --environment production --true-percent 20',
|
|
@@ -55,7 +57,7 @@ Log levels:
|
|
|
55
57
|
confidential: Flags.boolean({ default: false, description: 'mark the value as confidential' }),
|
|
56
58
|
'env-var': Flags.string({ description: 'environment variable to get value from' }),
|
|
57
59
|
type: Flags.string({
|
|
58
|
-
options: ['boolean-flag', 'boolean', 'string', 'double', 'int', 'string-list', 'json', 'log_level'],
|
|
60
|
+
options: ['boolean-flag', 'boolean', 'string', 'double', 'int', 'string-list', 'json', 'duration', 'log_level'],
|
|
59
61
|
required: true,
|
|
60
62
|
}),
|
|
61
63
|
value: Flags.string({ description: 'default value for your new item', required: false }),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { APICommand } from '../index.js';
|
|
2
|
+
import type { JsonObj } from '../result.js';
|
|
3
|
+
export default class Delete extends APICommand {
|
|
4
|
+
static args: {
|
|
5
|
+
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
yes: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<JsonObj | void>;
|
|
13
|
+
}
|