@quonfig/cli 0.2.2 → 0.2.3
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 +50 -50
- package/dist/commands/override.js +19 -1
- package/dist/commands/set-default.js +15 -3
- package/dist/init/schema.js +4 -1
- package/dist/util/coerce.d.ts +1 -1
- package/dist/util/coerce.js +10 -19
- package/dist/verify/validate.js +41 -5
- package/dist/verify/value-grammar.d.ts +13 -0
- package/dist/verify/value-grammar.js +63 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @quonfig/cli
|
|
|
17
17
|
$ qfg COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ qfg (--version)
|
|
20
|
-
@quonfig/cli/0.2.
|
|
20
|
+
@quonfig/cli/0.2.3 linux-x64 node-v24.4.1
|
|
21
21
|
$ qfg --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ qfg COMMAND
|
|
@@ -201,7 +201,7 @@ EXAMPLES
|
|
|
201
201
|
$ qfg activity restore my.flag --yes
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
_See code: [src/commands/activity.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
204
|
+
_See code: [src/commands/activity.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/activity.ts)_
|
|
205
205
|
|
|
206
206
|
## `qfg activity deleted`
|
|
207
207
|
|
|
@@ -230,7 +230,7 @@ EXAMPLES
|
|
|
230
230
|
$ qfg activity deleted --json
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
_See code: [src/commands/activity/deleted.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
233
|
+
_See code: [src/commands/activity/deleted.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/activity/deleted.ts)_
|
|
234
234
|
|
|
235
235
|
## `qfg activity feed`
|
|
236
236
|
|
|
@@ -265,7 +265,7 @@ EXAMPLES
|
|
|
265
265
|
$ qfg activity feed --json
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
-
_See code: [src/commands/activity/feed.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
268
|
+
_See code: [src/commands/activity/feed.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/activity/feed.ts)_
|
|
269
269
|
|
|
270
270
|
## `qfg activity history [NAME]`
|
|
271
271
|
|
|
@@ -299,7 +299,7 @@ EXAMPLES
|
|
|
299
299
|
$ qfg activity history request.timeout --json
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
_See code: [src/commands/activity/history.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
302
|
+
_See code: [src/commands/activity/history.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/activity/history.ts)_
|
|
303
303
|
|
|
304
304
|
## `qfg activity restore [NAME]`
|
|
305
305
|
|
|
@@ -338,7 +338,7 @@ EXAMPLES
|
|
|
338
338
|
$ qfg activity restore request.timeout --type config --yes
|
|
339
339
|
```
|
|
340
340
|
|
|
341
|
-
_See code: [src/commands/activity/restore.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
341
|
+
_See code: [src/commands/activity/restore.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/activity/restore.ts)_
|
|
342
342
|
|
|
343
343
|
## `qfg audit-log [NAME]`
|
|
344
344
|
|
|
@@ -366,7 +366,7 @@ EXAMPLES
|
|
|
366
366
|
$ qfg audit-log my.flag
|
|
367
367
|
```
|
|
368
368
|
|
|
369
|
-
_See code: [src/commands/audit-log.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
369
|
+
_See code: [src/commands/audit-log.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/audit-log.ts)_
|
|
370
370
|
|
|
371
371
|
## `qfg cleanup`
|
|
372
372
|
|
|
@@ -407,7 +407,7 @@ EXAMPLES
|
|
|
407
407
|
$ qfg cleanup status my.flag.key
|
|
408
408
|
```
|
|
409
409
|
|
|
410
|
-
_See code: [src/commands/cleanup.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
410
|
+
_See code: [src/commands/cleanup.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/cleanup.ts)_
|
|
411
411
|
|
|
412
412
|
## `qfg cleanup list`
|
|
413
413
|
|
|
@@ -453,7 +453,7 @@ EXAMPLES
|
|
|
453
453
|
$ qfg cleanup list --json
|
|
454
454
|
```
|
|
455
455
|
|
|
456
|
-
_See code: [src/commands/cleanup/list.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
456
|
+
_See code: [src/commands/cleanup/list.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/cleanup/list.ts)_
|
|
457
457
|
|
|
458
458
|
## `qfg cleanup remove [NAME]`
|
|
459
459
|
|
|
@@ -498,7 +498,7 @@ EXAMPLES
|
|
|
498
498
|
$ qfg cleanup remove my.flag.key --json
|
|
499
499
|
```
|
|
500
500
|
|
|
501
|
-
_See code: [src/commands/cleanup/remove.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
501
|
+
_See code: [src/commands/cleanup/remove.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/cleanup/remove.ts)_
|
|
502
502
|
|
|
503
503
|
## `qfg cleanup status [NAME]`
|
|
504
504
|
|
|
@@ -538,7 +538,7 @@ EXAMPLES
|
|
|
538
538
|
$ qfg cleanup status my.flag.key --json
|
|
539
539
|
```
|
|
540
540
|
|
|
541
|
-
_See code: [src/commands/cleanup/status.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
541
|
+
_See code: [src/commands/cleanup/status.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/cleanup/status.ts)_
|
|
542
542
|
|
|
543
543
|
## `qfg cleanup verify [NAME]`
|
|
544
544
|
|
|
@@ -584,7 +584,7 @@ EXAMPLES
|
|
|
584
584
|
$ qfg cleanup verify my.flag.key && qfg delete my.flag.key
|
|
585
585
|
```
|
|
586
586
|
|
|
587
|
-
_See code: [src/commands/cleanup/verify.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
587
|
+
_See code: [src/commands/cleanup/verify.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/cleanup/verify.ts)_
|
|
588
588
|
|
|
589
589
|
## `qfg config-schema`
|
|
590
590
|
|
|
@@ -613,7 +613,7 @@ EXAMPLES
|
|
|
613
613
|
$ qfg config-schema --json-schema # full JSON Schema document (copy into your editor)
|
|
614
614
|
```
|
|
615
615
|
|
|
616
|
-
_See code: [src/commands/config-schema.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
616
|
+
_See code: [src/commands/config-schema.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/config-schema.ts)_
|
|
617
617
|
|
|
618
618
|
## `qfg create NAME`
|
|
619
619
|
|
|
@@ -700,7 +700,7 @@ EXAMPLES
|
|
|
700
700
|
$ qfg set-rollout my.new.flag --environment production --true-percent 20
|
|
701
701
|
```
|
|
702
702
|
|
|
703
|
-
_See code: [src/commands/create.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
703
|
+
_See code: [src/commands/create.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/create.ts)_
|
|
704
704
|
|
|
705
705
|
## `qfg delete NAME`
|
|
706
706
|
|
|
@@ -746,7 +746,7 @@ EXAMPLES
|
|
|
746
746
|
$ qfg delete my.config --yes
|
|
747
747
|
```
|
|
748
748
|
|
|
749
|
-
_See code: [src/commands/delete.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
749
|
+
_See code: [src/commands/delete.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/delete.ts)_
|
|
750
750
|
|
|
751
751
|
## `qfg flag info [NAME]`
|
|
752
752
|
|
|
@@ -950,7 +950,7 @@ EXAMPLES
|
|
|
950
950
|
$ qfg generate --targets node-ts -o ./dist # combine with targets
|
|
951
951
|
```
|
|
952
952
|
|
|
953
|
-
_See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
953
|
+
_See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/generate.ts)_
|
|
954
954
|
|
|
955
955
|
## `qfg generate-new-hex-key`
|
|
956
956
|
|
|
@@ -973,7 +973,7 @@ EXAMPLES
|
|
|
973
973
|
$ qfg generate-new-hex-key
|
|
974
974
|
```
|
|
975
975
|
|
|
976
|
-
_See code: [src/commands/generate-new-hex-key.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
976
|
+
_See code: [src/commands/generate-new-hex-key.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/generate-new-hex-key.ts)_
|
|
977
977
|
|
|
978
978
|
## `qfg get [NAME]`
|
|
979
979
|
|
|
@@ -1005,7 +1005,7 @@ EXAMPLES
|
|
|
1005
1005
|
$ qfg get my.config.name --environment=production
|
|
1006
1006
|
```
|
|
1007
1007
|
|
|
1008
|
-
_See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1008
|
+
_See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/get.ts)_
|
|
1009
1009
|
|
|
1010
1010
|
## `qfg history NAME`
|
|
1011
1011
|
|
|
@@ -1031,7 +1031,7 @@ EXAMPLES
|
|
|
1031
1031
|
$ qfg history my.flag
|
|
1032
1032
|
```
|
|
1033
1033
|
|
|
1034
|
-
_See code: [src/commands/history.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1034
|
+
_See code: [src/commands/history.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/history.ts)_
|
|
1035
1035
|
|
|
1036
1036
|
## `qfg info [NAME]`
|
|
1037
1037
|
|
|
@@ -1079,7 +1079,7 @@ EXAMPLES
|
|
|
1079
1079
|
$ qfg info my.config.name --exclude-evaluations # skip 24h stats
|
|
1080
1080
|
```
|
|
1081
1081
|
|
|
1082
|
-
_See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1082
|
+
_See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/info.ts)_
|
|
1083
1083
|
|
|
1084
1084
|
## `qfg init [DIRECTORY]`
|
|
1085
1085
|
|
|
@@ -1119,7 +1119,7 @@ EXAMPLES
|
|
|
1119
1119
|
$ qfg init --dry-run
|
|
1120
1120
|
```
|
|
1121
1121
|
|
|
1122
|
-
_See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1122
|
+
_See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/init.ts)_
|
|
1123
1123
|
|
|
1124
1124
|
## `qfg interactive`
|
|
1125
1125
|
|
|
@@ -1149,7 +1149,7 @@ EXAMPLES
|
|
|
1149
1149
|
$ qfg
|
|
1150
1150
|
```
|
|
1151
1151
|
|
|
1152
|
-
_See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1152
|
+
_See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/interactive.ts)_
|
|
1153
1153
|
|
|
1154
1154
|
## `qfg list`
|
|
1155
1155
|
|
|
@@ -1189,7 +1189,7 @@ EXAMPLES
|
|
|
1189
1189
|
$ qfg list --feature-flags
|
|
1190
1190
|
```
|
|
1191
1191
|
|
|
1192
|
-
_See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1192
|
+
_See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/list.ts)_
|
|
1193
1193
|
|
|
1194
1194
|
## `qfg log`
|
|
1195
1195
|
|
|
@@ -1214,7 +1214,7 @@ EXAMPLES
|
|
|
1214
1214
|
$ qfg log --limit 5
|
|
1215
1215
|
```
|
|
1216
1216
|
|
|
1217
|
-
_See code: [src/commands/log.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1217
|
+
_See code: [src/commands/log.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/log.ts)_
|
|
1218
1218
|
|
|
1219
1219
|
## `qfg log-level NAME`
|
|
1220
1220
|
|
|
@@ -1279,7 +1279,7 @@ EXAMPLES
|
|
|
1279
1279
|
$ qfg log-level log-level.my-app --target=Chatty --value=INFO --environment=production
|
|
1280
1280
|
```
|
|
1281
1281
|
|
|
1282
|
-
_See code: [src/commands/log-level.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1282
|
+
_See code: [src/commands/log-level.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/log-level.ts)_
|
|
1283
1283
|
|
|
1284
1284
|
## `qfg login`
|
|
1285
1285
|
|
|
@@ -1304,7 +1304,7 @@ EXAMPLES
|
|
|
1304
1304
|
$ qfg login --profile myprofile
|
|
1305
1305
|
```
|
|
1306
1306
|
|
|
1307
|
-
_See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1307
|
+
_See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/login.ts)_
|
|
1308
1308
|
|
|
1309
1309
|
## `qfg logout`
|
|
1310
1310
|
|
|
@@ -1327,7 +1327,7 @@ EXAMPLES
|
|
|
1327
1327
|
$ qfg logout
|
|
1328
1328
|
```
|
|
1329
1329
|
|
|
1330
|
-
_See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1330
|
+
_See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/logout.ts)_
|
|
1331
1331
|
|
|
1332
1332
|
## `qfg migrate`
|
|
1333
1333
|
|
|
@@ -1392,7 +1392,7 @@ EXAMPLES
|
|
|
1392
1392
|
$ qfg migrate --from launch --source-api-key $LAUNCH_API_KEY --dir ./quonfig-repo --staging
|
|
1393
1393
|
```
|
|
1394
1394
|
|
|
1395
|
-
_See code: [src/commands/migrate.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1395
|
+
_See code: [src/commands/migrate.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/migrate.ts)_
|
|
1396
1396
|
|
|
1397
1397
|
## `qfg migrate doctor`
|
|
1398
1398
|
|
|
@@ -1430,7 +1430,7 @@ EXAMPLES
|
|
|
1430
1430
|
$ qfg migrate doctor --json
|
|
1431
1431
|
```
|
|
1432
1432
|
|
|
1433
|
-
_See code: [src/commands/migrate/doctor.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1433
|
+
_See code: [src/commands/migrate/doctor.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/migrate/doctor.ts)_
|
|
1434
1434
|
|
|
1435
1435
|
## `qfg migrate my-code`
|
|
1436
1436
|
|
|
@@ -1462,7 +1462,7 @@ EXAMPLES
|
|
|
1462
1462
|
$ qfg migrate my-code --dry-run
|
|
1463
1463
|
```
|
|
1464
1464
|
|
|
1465
|
-
_See code: [src/commands/migrate/my-code.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1465
|
+
_See code: [src/commands/migrate/my-code.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/migrate/my-code.ts)_
|
|
1466
1466
|
|
|
1467
1467
|
## `qfg migrate status`
|
|
1468
1468
|
|
|
@@ -1493,7 +1493,7 @@ EXAMPLES
|
|
|
1493
1493
|
$ qfg migrate status --json
|
|
1494
1494
|
```
|
|
1495
1495
|
|
|
1496
|
-
_See code: [src/commands/migrate/status.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1496
|
+
_See code: [src/commands/migrate/status.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/migrate/status.ts)_
|
|
1497
1497
|
|
|
1498
1498
|
## `qfg override [NAME] [VALUE]`
|
|
1499
1499
|
|
|
@@ -1548,7 +1548,7 @@ EXAMPLES
|
|
|
1548
1548
|
$ qfg override my.flag true --env=staging
|
|
1549
1549
|
```
|
|
1550
1550
|
|
|
1551
|
-
_See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1551
|
+
_See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/override.ts)_
|
|
1552
1552
|
|
|
1553
1553
|
## `qfg pull`
|
|
1554
1554
|
|
|
@@ -1595,7 +1595,7 @@ EXAMPLES
|
|
|
1595
1595
|
$ qfg pull # uses QUONFIG_DIR env var
|
|
1596
1596
|
```
|
|
1597
1597
|
|
|
1598
|
-
_See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1598
|
+
_See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/pull.ts)_
|
|
1599
1599
|
|
|
1600
1600
|
## `qfg push`
|
|
1601
1601
|
|
|
@@ -1644,7 +1644,7 @@ EXAMPLES
|
|
|
1644
1644
|
$ qfg push --dir ./our-config --yes
|
|
1645
1645
|
```
|
|
1646
1646
|
|
|
1647
|
-
_See code: [src/commands/push.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1647
|
+
_See code: [src/commands/push.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/push.ts)_
|
|
1648
1648
|
|
|
1649
1649
|
## `qfg run [COMMAND]`
|
|
1650
1650
|
|
|
@@ -1695,7 +1695,7 @@ EXAMPLES
|
|
|
1695
1695
|
$ qfg run --env DATABASE_URL=db.url --preserve-env --environment=staging -- npm test
|
|
1696
1696
|
```
|
|
1697
1697
|
|
|
1698
|
-
_See code: [src/commands/run.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1698
|
+
_See code: [src/commands/run.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/run.ts)_
|
|
1699
1699
|
|
|
1700
1700
|
## `qfg schema NAME`
|
|
1701
1701
|
|
|
@@ -1733,7 +1733,7 @@ EXAMPLES
|
|
|
1733
1733
|
$ qfg schema my-schema --set-json-schema=@schemas/my-schema.json --protected
|
|
1734
1734
|
```
|
|
1735
1735
|
|
|
1736
|
-
_See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1736
|
+
_See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/schema.ts)_
|
|
1737
1737
|
|
|
1738
1738
|
## `qfg sdk-key`
|
|
1739
1739
|
|
|
@@ -1760,7 +1760,7 @@ EXAMPLES
|
|
|
1760
1760
|
$ qfg sdk-key revoke <key-id>
|
|
1761
1761
|
```
|
|
1762
1762
|
|
|
1763
|
-
_See code: [src/commands/sdk-key.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1763
|
+
_See code: [src/commands/sdk-key.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/sdk-key.ts)_
|
|
1764
1764
|
|
|
1765
1765
|
## `qfg sdk-key create`
|
|
1766
1766
|
|
|
@@ -1792,7 +1792,7 @@ EXAMPLES
|
|
|
1792
1792
|
$ qfg sdk-key create --environment staging --type browser
|
|
1793
1793
|
```
|
|
1794
1794
|
|
|
1795
|
-
_See code: [src/commands/sdk-key/create.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1795
|
+
_See code: [src/commands/sdk-key/create.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/sdk-key/create.ts)_
|
|
1796
1796
|
|
|
1797
1797
|
## `qfg sdk-key list`
|
|
1798
1798
|
|
|
@@ -1821,7 +1821,7 @@ EXAMPLES
|
|
|
1821
1821
|
$ qfg sdk-key list --environment production
|
|
1822
1822
|
```
|
|
1823
1823
|
|
|
1824
|
-
_See code: [src/commands/sdk-key/list.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1824
|
+
_See code: [src/commands/sdk-key/list.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/sdk-key/list.ts)_
|
|
1825
1825
|
|
|
1826
1826
|
## `qfg sdk-key revoke KEYID`
|
|
1827
1827
|
|
|
@@ -1848,7 +1848,7 @@ EXAMPLES
|
|
|
1848
1848
|
$ qfg sdk-key revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890
|
|
1849
1849
|
```
|
|
1850
1850
|
|
|
1851
|
-
_See code: [src/commands/sdk-key/revoke.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1851
|
+
_See code: [src/commands/sdk-key/revoke.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/sdk-key/revoke.ts)_
|
|
1852
1852
|
|
|
1853
1853
|
## `qfg serve`
|
|
1854
1854
|
|
|
@@ -1906,7 +1906,7 @@ EXAMPLES
|
|
|
1906
1906
|
$ qfg serve --port 6581 --frontend-sdk-key PUBLIC_KEY
|
|
1907
1907
|
```
|
|
1908
1908
|
|
|
1909
|
-
_See code: [src/commands/serve.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1909
|
+
_See code: [src/commands/serve.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/serve.ts)_
|
|
1910
1910
|
|
|
1911
1911
|
## `qfg set-default [NAME]`
|
|
1912
1912
|
|
|
@@ -1982,7 +1982,7 @@ EXAMPLES
|
|
|
1982
1982
|
$ qfg pull && qfg config-schema
|
|
1983
1983
|
```
|
|
1984
1984
|
|
|
1985
|
-
_See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
1985
|
+
_See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/set-default.ts)_
|
|
1986
1986
|
|
|
1987
1987
|
## `qfg set-rollout [NAME]`
|
|
1988
1988
|
|
|
@@ -2073,7 +2073,7 @@ EXAMPLES
|
|
|
2073
2073
|
$ qfg set-rollout my.variant.flag --environment production --weights "a:33,b:33,c:34" --hash-by user.id
|
|
2074
2074
|
```
|
|
2075
2075
|
|
|
2076
|
-
_See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2076
|
+
_See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/set-rollout.ts)_
|
|
2077
2077
|
|
|
2078
2078
|
## `qfg sync`
|
|
2079
2079
|
|
|
@@ -2105,7 +2105,7 @@ EXAMPLES
|
|
|
2105
2105
|
$ qfg sync --watch --dir ./our-config --interval 30
|
|
2106
2106
|
```
|
|
2107
2107
|
|
|
2108
|
-
_See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2108
|
+
_See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/sync.ts)_
|
|
2109
2109
|
|
|
2110
2110
|
## `qfg toggle [NAME]`
|
|
2111
2111
|
|
|
@@ -2212,7 +2212,7 @@ EXAMPLES
|
|
|
2212
2212
|
$ qfg verify --json
|
|
2213
2213
|
```
|
|
2214
2214
|
|
|
2215
|
-
_See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2215
|
+
_See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/verify.ts)_
|
|
2216
2216
|
|
|
2217
2217
|
## `qfg whoami`
|
|
2218
2218
|
|
|
@@ -2235,7 +2235,7 @@ EXAMPLES
|
|
|
2235
2235
|
$ qfg whoami
|
|
2236
2236
|
```
|
|
2237
2237
|
|
|
2238
|
-
_See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2238
|
+
_See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/whoami.ts)_
|
|
2239
2239
|
|
|
2240
2240
|
## `qfg workspace`
|
|
2241
2241
|
|
|
@@ -2258,7 +2258,7 @@ EXAMPLES
|
|
|
2258
2258
|
$ qfg workspace
|
|
2259
2259
|
```
|
|
2260
2260
|
|
|
2261
|
-
_See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2261
|
+
_See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/workspace.ts)_
|
|
2262
2262
|
|
|
2263
2263
|
## `qfg workspace bootstrap`
|
|
2264
2264
|
|
|
@@ -2291,7 +2291,7 @@ EXAMPLES
|
|
|
2291
2291
|
$ qfg workspace bootstrap --dir ./our-config --skip-validate
|
|
2292
2292
|
```
|
|
2293
2293
|
|
|
2294
|
-
_See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2294
|
+
_See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/workspace/bootstrap.ts)_
|
|
2295
2295
|
|
|
2296
2296
|
## `qfg workspace create SLUG`
|
|
2297
2297
|
|
|
@@ -2325,7 +2325,7 @@ EXAMPLES
|
|
|
2325
2325
|
$ qfg workspace create my-team --org 11111111-1111-1111-1111-111111111111
|
|
2326
2326
|
```
|
|
2327
2327
|
|
|
2328
|
-
_See code: [src/commands/workspace/create.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2328
|
+
_See code: [src/commands/workspace/create.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/workspace/create.ts)_
|
|
2329
2329
|
|
|
2330
2330
|
## `qfg workspace switch [SLUG]`
|
|
2331
2331
|
|
|
@@ -2353,7 +2353,7 @@ EXAMPLES
|
|
|
2353
2353
|
$ qfg workspace switch acme/production
|
|
2354
2354
|
```
|
|
2355
2355
|
|
|
2356
|
-
_See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.2.
|
|
2356
|
+
_See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.2.3/src/commands/workspace/switch.ts)_
|
|
2357
2357
|
<!-- commandsstop -->
|
|
2358
2358
|
|
|
2359
2359
|
## Local Development
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import { APICommand } from '../index.js';
|
|
3
|
+
import { DURATION_FORMAT_HINT, isValidIsoDuration } from '../util/coerce.js';
|
|
3
4
|
import { checkmark } from '../util/color.js';
|
|
4
5
|
import { loadTokens } from '../util/token-storage.js';
|
|
5
6
|
const OVERRIDE_PROP = 'quonfig-user.email';
|
|
@@ -40,6 +41,20 @@ function inferValue(raw) {
|
|
|
40
41
|
}
|
|
41
42
|
return { type: 'string', value: raw };
|
|
42
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Type the override from the flag's declared valueType where inference cannot
|
|
46
|
+
* (qfg-2agi.3): a duration flag gets {type: 'duration'} and the value must
|
|
47
|
+
* match the shared grammar. No conversions. Every other valueType keeps
|
|
48
|
+
* inferValue. Returns an error string for invalid input.
|
|
49
|
+
*/
|
|
50
|
+
function typeOverrideValue(raw, valueType) {
|
|
51
|
+
if (valueType?.toLowerCase() === 'duration') {
|
|
52
|
+
return isValidIsoDuration(raw)
|
|
53
|
+
? { type: 'duration', value: raw }
|
|
54
|
+
: `Invalid value for duration: ${raw}. ${DURATION_FORMAT_HINT}`;
|
|
55
|
+
}
|
|
56
|
+
return inferValue(raw);
|
|
57
|
+
}
|
|
43
58
|
/**
|
|
44
59
|
* Find the existing override rule for a user in a specific env. Returns the
|
|
45
60
|
* value the user is currently overridden to, or undefined.
|
|
@@ -254,11 +269,14 @@ Examples
|
|
|
254
269
|
return removed ? this.ok(`${checkmark} Removed override on ${opts.key} in env=${opts.env}.`) : undefined;
|
|
255
270
|
}
|
|
256
271
|
async runSet(opts) {
|
|
257
|
-
const value = inferValue(opts.rawValue);
|
|
258
272
|
const flag = await this.fetchFlag(opts.key);
|
|
259
273
|
if (!flag) {
|
|
260
274
|
return this.err(`Flag ${opts.key} not found.`);
|
|
261
275
|
}
|
|
276
|
+
const value = typeOverrideValue(opts.rawValue, flag.valueType);
|
|
277
|
+
if (typeof value === 'string') {
|
|
278
|
+
return this.err(value);
|
|
279
|
+
}
|
|
262
280
|
const existing = findExistingOverride(flag, opts.env, opts.userEmail);
|
|
263
281
|
if (existing && valuesEqual(existing, value)) {
|
|
264
282
|
return this.ok(`${opts.key} is already set to ${JSON.stringify(value.value)} (${value.type}) for ${opts.userEmail} in env=${opts.env}.`);
|
|
@@ -5,6 +5,7 @@ import getConfirmation, { confirmFlag } from '../ui/get-confirmation.js';
|
|
|
5
5
|
import getEnvironment from '../ui/get-environment.js';
|
|
6
6
|
import getString from '../ui/get-string.js';
|
|
7
7
|
import autocomplete from '../util/autocomplete.js';
|
|
8
|
+
import { DURATION_FORMAT_HINT, isValidIsoDuration, parseDoubleValue, parseIntValue } from '../util/coerce.js';
|
|
8
9
|
import { checkmark } from '../util/color.js';
|
|
9
10
|
import { mapConfigValueToDto } from '../util/config-value-dto.js';
|
|
10
11
|
import { makeConfidentialValue } from '../util/encryption.js';
|
|
@@ -250,14 +251,18 @@ To see all current values and rules for a flag:
|
|
|
250
251
|
break;
|
|
251
252
|
}
|
|
252
253
|
case 'int': {
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
// Shared strict grammar with qfg create (qfg-2agi.23).
|
|
255
|
+
variantValue = parseIntValue(value);
|
|
256
|
+
if (variantValue === undefined) {
|
|
255
257
|
return this.err(`Invalid default value for int: ${value}`);
|
|
256
258
|
}
|
|
257
259
|
break;
|
|
258
260
|
}
|
|
259
261
|
case 'double': {
|
|
260
|
-
variantValue =
|
|
262
|
+
variantValue = parseDoubleValue(value);
|
|
263
|
+
if (variantValue === undefined) {
|
|
264
|
+
return this.err(`Invalid default value for double: ${value}`);
|
|
265
|
+
}
|
|
261
266
|
break;
|
|
262
267
|
}
|
|
263
268
|
case 'json': {
|
|
@@ -273,6 +278,13 @@ To see all current values and rules for a flag:
|
|
|
273
278
|
variantValue = value;
|
|
274
279
|
break;
|
|
275
280
|
}
|
|
281
|
+
case 'duration': {
|
|
282
|
+
// Stored verbatim as the ISO 8601 string; no conversions (qfg-2agi.3).
|
|
283
|
+
if (!isValidIsoDuration(value)) {
|
|
284
|
+
return this.err(`Invalid value for duration: ${value}. ${DURATION_FORMAT_HINT}`);
|
|
285
|
+
}
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
276
288
|
// No default
|
|
277
289
|
}
|
|
278
290
|
configValue = {
|
package/dist/init/schema.js
CHANGED
|
@@ -70,7 +70,10 @@ const durationValue = {
|
|
|
70
70
|
type: 'object',
|
|
71
71
|
properties: {
|
|
72
72
|
type: { const: 'duration' },
|
|
73
|
-
value: {
|
|
73
|
+
value: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: 'ISO 8601 duration (e.g. "PT30S", "PT5M", "PT1H30M", "P1DT6H"): optional days, then T and hours/minutes/seconds; only seconds may have a fraction',
|
|
76
|
+
},
|
|
74
77
|
},
|
|
75
78
|
required: ['type', 'value'],
|
|
76
79
|
additionalProperties: false,
|
package/dist/util/coerce.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ConfigValue } from '@quonfig/node';
|
|
2
2
|
import { ConfigValueType } from '@quonfig/node';
|
|
3
|
+
export { DURATION_FORMAT_HINT, isValidIsoDuration, parseDoubleValue, parseIntValue } from '../verify/value-grammar.js';
|
|
3
4
|
type ConfigValueWithConfigValueType = [ConfigValue, ConfigValueType];
|
|
4
5
|
export declare const TYPE_MAPPING: Record<string, ConfigValueType>;
|
|
5
6
|
export declare const coerceIntoType: (type: string, value: string) => ConfigValueWithConfigValueType | undefined;
|
|
6
7
|
export declare const coerceBool: (value: string) => boolean;
|
|
7
|
-
export {};
|
package/dist/util/coerce.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { ConfigValueType, durationToMilliseconds } from '@quonfig/node';
|
|
2
|
+
import { DURATION_FORMAT_HINT, isValidIsoDuration, parseDoubleValue, parseIntValue } from '../verify/value-grammar.js';
|
|
2
3
|
const TRUE_VALUES = new Set(['true', '1', 't']);
|
|
3
4
|
const BOOLEAN_VALUES = new Set([...TRUE_VALUES, 'false', '0', 'f']);
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
const ISO_DURATION_PATTERN = /^P(?:\d+(?:\.\d+)?D)?(?:T(?:\d+(?:\.\d+)?H)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?S)?)?$/;
|
|
8
|
-
const isValidIsoDuration = (value) => {
|
|
9
|
-
if (!ISO_DURATION_PATTERN.test(value))
|
|
10
|
-
return false;
|
|
11
|
-
// Reject "P", "PT" — pattern allows them but they have no components.
|
|
12
|
-
return value !== 'P' && value !== 'PT';
|
|
13
|
-
};
|
|
5
|
+
// The duration and int/double grammars live in verify/value-grammar.ts so the
|
|
6
|
+
// standalone pre-receive hook build can use the same definition.
|
|
7
|
+
export { DURATION_FORMAT_HINT, isValidIsoDuration, parseDoubleValue, parseIntValue } from '../verify/value-grammar.js';
|
|
14
8
|
export const TYPE_MAPPING = {
|
|
15
9
|
bool: ConfigValueType.Bool,
|
|
16
10
|
boolean: ConfigValueType.Bool,
|
|
@@ -27,18 +21,15 @@ export const coerceIntoType = (type, value) => {
|
|
|
27
21
|
return [{ string: value }, TYPE_MAPPING[type]];
|
|
28
22
|
}
|
|
29
23
|
case 'int': {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const int = Number(bigInt);
|
|
33
|
-
return [{ int }, TYPE_MAPPING[type]];
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
24
|
+
const int = parseIntValue(value);
|
|
25
|
+
if (int === undefined) {
|
|
36
26
|
throw new TypeError(`Invalid default value for int: ${value}`);
|
|
37
27
|
}
|
|
28
|
+
return [{ int }, TYPE_MAPPING[type]];
|
|
38
29
|
}
|
|
39
30
|
case 'double': {
|
|
40
|
-
const double =
|
|
41
|
-
if (
|
|
31
|
+
const double = parseDoubleValue(value);
|
|
32
|
+
if (double === undefined) {
|
|
42
33
|
throw new TypeError(`Invalid default value for double: ${value}`);
|
|
43
34
|
}
|
|
44
35
|
return [{ double }, TYPE_MAPPING[type]];
|
|
@@ -65,7 +56,7 @@ export const coerceIntoType = (type, value) => {
|
|
|
65
56
|
// durationToMilliseconds() returns 0 on no-match instead of throwing, so
|
|
66
57
|
// we anchor-check the format ourselves before delegating.
|
|
67
58
|
if (!isValidIsoDuration(value)) {
|
|
68
|
-
throw new TypeError(`Invalid default value for duration: ${value}.
|
|
59
|
+
throw new TypeError(`Invalid default value for duration: ${value}. ${DURATION_FORMAT_HINT}`);
|
|
69
60
|
}
|
|
70
61
|
const millis = durationToMilliseconds(value);
|
|
71
62
|
return [{ duration: { definition: value, millis } }, ConfigValueType.Duration];
|
package/dist/verify/validate.js
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
import { z } from 'zod';
|
|
29
29
|
import { findMapKeyOrderWarnings, navigate, scanOrderedJson } from './map-key-order.js';
|
|
30
30
|
import { compileSchema, validateAgainstSchema } from './schema-validator.js';
|
|
31
|
+
import { DURATION_FORMAT_HINT, isValidIsoDuration, parseDoubleValue, parseIntValue } from './value-grammar.js';
|
|
31
32
|
// Inlined to keep this directory self-contained for the standalone bun-compile
|
|
32
33
|
// build that runs as the qfg-verify pre-receive hook in app-gitea — that build
|
|
33
34
|
// only copies cli/src/verify/, so any out-of-tree imports break it. Source of
|
|
@@ -69,8 +70,26 @@ const OperatorSchema = z.enum(OPERATORS);
|
|
|
69
70
|
const LogLevelSchema = z.enum(LOG_LEVELS);
|
|
70
71
|
const BoolValueSchema = z.object({ type: z.literal('bool'), value: z.boolean() });
|
|
71
72
|
const StringValueSchema = z.object({ type: z.literal('string'), value: z.string() });
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
// Value grammars (qfg-e87r.30): the same definitions qfg create / set-default /
|
|
74
|
+
// override use (value-grammar.ts). Issues carry params.valueGrammar so the
|
|
75
|
+
// reporter can add the config key (formatSchemaIssue).
|
|
76
|
+
const grammarIssue = (ctx, message) => ctx.addIssue({ code: 'custom', message, params: { valueGrammar: true } });
|
|
77
|
+
const IntValueSchema = z.object({
|
|
78
|
+
type: z.literal('int'),
|
|
79
|
+
value: z.union([z.number(), z.string()]).superRefine((value, ctx) => {
|
|
80
|
+
const ok = typeof value === 'number' ? Number.isSafeInteger(value) : parseIntValue(value) !== undefined;
|
|
81
|
+
if (!ok)
|
|
82
|
+
grammarIssue(ctx, `invalid int ${JSON.stringify(value)}. Expected a whole number (optional -, ASCII digits) within +/-(2^53-1).`);
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
85
|
+
const DoubleValueSchema = z.object({
|
|
86
|
+
type: z.literal('double'),
|
|
87
|
+
value: z.union([z.number(), z.string()]).superRefine((value, ctx) => {
|
|
88
|
+
const ok = typeof value === 'number' ? Number.isFinite(value) : parseDoubleValue(value) !== undefined;
|
|
89
|
+
if (!ok)
|
|
90
|
+
grammarIssue(ctx, `invalid double ${JSON.stringify(value)}. Expected a finite decimal number with an optional exponent, such as 2.5, .5 or -1.5e3.`);
|
|
91
|
+
}),
|
|
92
|
+
});
|
|
74
93
|
const JsonValueSchema = z.object({
|
|
75
94
|
type: z.literal('json'),
|
|
76
95
|
value: z.any().refine((v) => typeof v !== 'string', {
|
|
@@ -78,7 +97,13 @@ const JsonValueSchema = z.object({
|
|
|
78
97
|
}),
|
|
79
98
|
});
|
|
80
99
|
const StringListValueSchema = z.object({ type: z.literal('string_list'), value: z.array(z.string()) });
|
|
81
|
-
const DurationValueSchema = z.object({
|
|
100
|
+
const DurationValueSchema = z.object({
|
|
101
|
+
type: z.literal('duration'),
|
|
102
|
+
value: z.string().superRefine((value, ctx) => {
|
|
103
|
+
if (!isValidIsoDuration(value))
|
|
104
|
+
grammarIssue(ctx, `invalid duration ${JSON.stringify(value)}. ${DURATION_FORMAT_HINT}`);
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
82
107
|
const LogLevelValueSchema = z.object({ type: z.literal('log_level'), value: LogLevelSchema });
|
|
83
108
|
const SchemaValueSchema = z.object({
|
|
84
109
|
type: z.literal('schema'),
|
|
@@ -157,6 +182,17 @@ const StoredConfigSchema = z
|
|
|
157
182
|
})
|
|
158
183
|
.passthrough(); // Allow extra fields (tags, schemaUsageMode, etc.)
|
|
159
184
|
const SchemaDocumentSchema = z.object({}).passthrough();
|
|
185
|
+
/**
|
|
186
|
+
* `Schema: <path> - <message>`. A value-grammar issue (duration / int /
|
|
187
|
+
* double) also names the config key, so the hook's error says which config
|
|
188
|
+
* holds the bad value, not just which file (qfg-e87r.30).
|
|
189
|
+
*/
|
|
190
|
+
function formatSchemaIssue(issue, parsed) {
|
|
191
|
+
const base = `Schema: ${issue.path.join('.')} - ${issue.message}`;
|
|
192
|
+
const isGrammar = issue.code === 'custom' && issue.params?.valueGrammar;
|
|
193
|
+
const key = typeof parsed === 'object' && parsed !== null ? parsed.key : undefined;
|
|
194
|
+
return isGrammar && typeof key === 'string' ? `${base} (config "${key}")` : base;
|
|
195
|
+
}
|
|
160
196
|
/** Maps config directory names to their expected config type. */
|
|
161
197
|
const DIR_TO_TYPE = {
|
|
162
198
|
configs: 'config',
|
|
@@ -469,7 +505,7 @@ export function validateWorkspace(workspaceDir, options = {}) {
|
|
|
469
505
|
for (const issue of result.error.issues) {
|
|
470
506
|
issues.push({
|
|
471
507
|
file: relPath,
|
|
472
|
-
message:
|
|
508
|
+
message: formatSchemaIssue(issue, parsed),
|
|
473
509
|
severity: 'error',
|
|
474
510
|
});
|
|
475
511
|
}
|
|
@@ -777,7 +813,7 @@ export function validateFileMap(files, options = {}) {
|
|
|
777
813
|
for (const issue of result.error.issues) {
|
|
778
814
|
issues.push({
|
|
779
815
|
file: relPath,
|
|
780
|
-
message:
|
|
816
|
+
message: formatSchemaIssue(issue, parsed),
|
|
781
817
|
severity: 'error',
|
|
782
818
|
});
|
|
783
819
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE value grammar for durations (qfg-2agi.3) and int/double input
|
|
3
|
+
* (qfg-2agi.23), shared by qfg create, set-default, override and verify
|
|
4
|
+
* (qfg-e87r.30). util/coerce.ts re-exports it.
|
|
5
|
+
*
|
|
6
|
+
* SELF-CONTAINED ON PURPOSE: no imports. It lives under src/verify/ because the
|
|
7
|
+
* standalone qfg-verify pre-receive hook (app-gitea Dockerfile) is built from
|
|
8
|
+
* this directory alone.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DURATION_FORMAT_HINT = "Expected an ISO 8601 duration such as PT30S, PT5M, PT1H30M or P1DT6H (days, hours, minutes, seconds; a fraction only on seconds; at most P36500D).";
|
|
11
|
+
export declare const isValidIsoDuration: (value: string) => boolean;
|
|
12
|
+
export declare const parseIntValue: (value: string) => number | undefined;
|
|
13
|
+
export declare const parseDoubleValue: (value: string) => number | undefined;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE value grammar for durations (qfg-2agi.3) and int/double input
|
|
3
|
+
* (qfg-2agi.23), shared by qfg create, set-default, override and verify
|
|
4
|
+
* (qfg-e87r.30). util/coerce.ts re-exports it.
|
|
5
|
+
*
|
|
6
|
+
* SELF-CONTAINED ON PURPOSE: no imports. It lives under src/verify/ because the
|
|
7
|
+
* standalone qfg-verify pre-receive hook (app-gitea Dockerfile) is built from
|
|
8
|
+
* this directory alone.
|
|
9
|
+
*/
|
|
10
|
+
// The ONE duration grammar (qfg-2agi.29), shared by qfg create, set-default,
|
|
11
|
+
// override and verify. Fixture of record: integration-test-data
|
|
12
|
+
// tests/duration/grammar.yaml (test/util/duration-grammar.test.ts holds this
|
|
13
|
+
// function to it).
|
|
14
|
+
//
|
|
15
|
+
// ^P(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?$
|
|
16
|
+
//
|
|
17
|
+
// plus: at least one component, no dangling T, a fraction only on S with at
|
|
18
|
+
// most 9 digits, total magnitude <= P36500D. [0-9] (not \d) and the whole
|
|
19
|
+
// string anchored so ports to other regex engines stay strict.
|
|
20
|
+
// JS \d is already ASCII-only; [0-9] is kept so a copy into Python/.NET is safe.
|
|
21
|
+
/* eslint-disable unicorn/better-regex */
|
|
22
|
+
const ISO_DURATION_PATTERN = /^P(?:(?<d>[0-9]+)D)?(?:T(?:(?<h>[0-9]+)H)?(?:(?<m>[0-9]+)M)?(?:(?<s>[0-9]+)(?:\.(?<f>[0-9]{1,9}))?S)?)?$/;
|
|
23
|
+
/* eslint-enable unicorn/better-regex */
|
|
24
|
+
export const DURATION_FORMAT_HINT = 'Expected an ISO 8601 duration such as PT30S, PT5M, PT1H30M or P1DT6H (days, hours, minutes, seconds; a fraction only on seconds; at most P36500D).';
|
|
25
|
+
const NANOS_PER_SECOND = 1000000000n;
|
|
26
|
+
const MAX_DURATION_NANOS = 36500n * 86400n * NANOS_PER_SECOND;
|
|
27
|
+
export const isValidIsoDuration = (value) => {
|
|
28
|
+
const match = ISO_DURATION_PATTERN.exec(value);
|
|
29
|
+
if (!match?.groups)
|
|
30
|
+
return false;
|
|
31
|
+
const { d, f, h, m, s } = match.groups;
|
|
32
|
+
// At least one component; a T must be followed by at least one of H/M/S.
|
|
33
|
+
if (d === undefined && h === undefined && m === undefined && s === undefined)
|
|
34
|
+
return false;
|
|
35
|
+
if (value.includes('T') && h === undefined && m === undefined && s === undefined)
|
|
36
|
+
return false;
|
|
37
|
+
// Exact integer arithmetic: huge digit strings cannot overflow past the cap.
|
|
38
|
+
const nanos = (BigInt(d ?? 0) * 86400n + BigInt(h ?? 0) * 3600n + BigInt(m ?? 0) * 60n + BigInt(s ?? 0)) * NANOS_PER_SECOND +
|
|
39
|
+
BigInt((f ?? '').padEnd(9, '0'));
|
|
40
|
+
return nanos <= MAX_DURATION_NANOS;
|
|
41
|
+
};
|
|
42
|
+
// The ONE int/double input grammar (qfg-2agi.23), shared by qfg create and
|
|
43
|
+
// set-default. Strict whole-string matches with ASCII digits only: no
|
|
44
|
+
// surrounding whitespace, no hex, no trailing junk ('12abc'), no NaN/Infinity.
|
|
45
|
+
// An int must stay within +/-(2^53-1) because it is written as a JSON number
|
|
46
|
+
// and anything larger silently loses precision. Returns undefined when the
|
|
47
|
+
// input is not valid.
|
|
48
|
+
/* eslint-disable unicorn/better-regex */
|
|
49
|
+
const INT_PATTERN = /^-?[0-9]+$/;
|
|
50
|
+
const DOUBLE_PATTERN = /^-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?$/;
|
|
51
|
+
/* eslint-enable unicorn/better-regex */
|
|
52
|
+
export const parseIntValue = (value) => {
|
|
53
|
+
if (!INT_PATTERN.test(value))
|
|
54
|
+
return undefined;
|
|
55
|
+
const int = Number(value);
|
|
56
|
+
return Number.isSafeInteger(int) ? int : undefined;
|
|
57
|
+
};
|
|
58
|
+
export const parseDoubleValue = (value) => {
|
|
59
|
+
if (!DOUBLE_PATTERN.test(value))
|
|
60
|
+
return undefined;
|
|
61
|
+
const double = Number(value);
|
|
62
|
+
return Number.isFinite(double) ? double : undefined;
|
|
63
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.2.
|
|
1
|
+
declare const _default: "0.2.3";
|
|
2
2
|
export default _default;
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// AUTO-GENERATED from package.json by scripts/generate-version.mjs — do not edit.
|
|
2
|
-
export default '0.2.
|
|
2
|
+
export default '0.2.3';
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageManager": "yarn@4.11.0+sha512.4e54aeace9141df2f0177c266b05ec50dc044638157dae128c471ba65994ac802122d7ab35bcd9e81641228b7dcf24867d28e750e0bcae8a05277d600008ad54",
|
|
3
3
|
"name": "@quonfig/cli",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/quonfig/cli/issues"
|
|
7
7
|
},
|