@quonfig/cli 0.0.21 → 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 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.21 linux-x64 node-v24.4.1
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)
@@ -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.21/src/commands/config-schema.ts)_
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
 
@@ -176,7 +177,53 @@ EXAMPLES
176
177
  $ qfg set-rollout my.new.flag --environment production --true-percent 20
177
178
  ```
178
179
 
179
- _See code: [src/commands/create.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/create.ts)_
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)_
180
227
 
181
228
  ## `qfg flag info [NAME]`
182
229
 
@@ -379,7 +426,7 @@ EXAMPLES
379
426
  $ qfg generate --targets node-ts -o ./dist # combine with targets
380
427
  ```
381
428
 
382
- _See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/generate.ts)_
429
+ _See code: [src/commands/generate.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/generate.ts)_
383
430
 
384
431
  ## `qfg generate-new-hex-key`
385
432
 
@@ -402,7 +449,7 @@ EXAMPLES
402
449
  $ qfg generate-new-hex-key
403
450
  ```
404
451
 
405
- _See code: [src/commands/generate-new-hex-key.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/generate-new-hex-key.ts)_
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)_
406
453
 
407
454
  ## `qfg get [NAME]`
408
455
 
@@ -434,7 +481,7 @@ EXAMPLES
434
481
  $ qfg get my.config.name --environment=production
435
482
  ```
436
483
 
437
- _See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/get.ts)_
484
+ _See code: [src/commands/get.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/get.ts)_
438
485
 
439
486
  ## `qfg info [NAME]`
440
487
 
@@ -482,7 +529,7 @@ EXAMPLES
482
529
  $ qfg info my.config.name --exclude-evaluations # skip 24h stats
483
530
  ```
484
531
 
485
- _See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/info.ts)_
532
+ _See code: [src/commands/info.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/info.ts)_
486
533
 
487
534
  ## `qfg init [DIRECTORY]`
488
535
 
@@ -522,7 +569,7 @@ EXAMPLES
522
569
  $ qfg init --dry-run
523
570
  ```
524
571
 
525
- _See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/init.ts)_
572
+ _See code: [src/commands/init.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/init.ts)_
526
573
 
527
574
  ## `qfg interactive`
528
575
 
@@ -552,7 +599,7 @@ EXAMPLES
552
599
  $ qfg
553
600
  ```
554
601
 
555
- _See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/interactive.ts)_
602
+ _See code: [src/commands/interactive.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/interactive.ts)_
556
603
 
557
604
  ## `qfg list`
558
605
 
@@ -592,7 +639,7 @@ EXAMPLES
592
639
  $ qfg list --feature-flags
593
640
  ```
594
641
 
595
- _See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/list.ts)_
642
+ _See code: [src/commands/list.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/list.ts)_
596
643
 
597
644
  ## `qfg log-level NAME`
598
645
 
@@ -657,7 +704,7 @@ EXAMPLES
657
704
  $ qfg log-level log-level.my-app --target=Chatty --value=INFO --environment=production
658
705
  ```
659
706
 
660
- _See code: [src/commands/log-level.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/log-level.ts)_
707
+ _See code: [src/commands/log-level.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/log-level.ts)_
661
708
 
662
709
  ## `qfg login`
663
710
 
@@ -682,7 +729,7 @@ EXAMPLES
682
729
  $ qfg login --profile myprofile
683
730
  ```
684
731
 
685
- _See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/login.ts)_
732
+ _See code: [src/commands/login.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/login.ts)_
686
733
 
687
734
  ## `qfg logout`
688
735
 
@@ -705,7 +752,7 @@ EXAMPLES
705
752
  $ qfg logout
706
753
  ```
707
754
 
708
- _See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/logout.ts)_
755
+ _See code: [src/commands/logout.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/logout.ts)_
709
756
 
710
757
  ## `qfg mcp`
711
758
 
@@ -738,7 +785,7 @@ EXAMPLES
738
785
  $ qfg mcp --url http://local-app.quonfig-staging.com:3003/api/v1/mcp
739
786
  ```
740
787
 
741
- _See code: [src/commands/mcp.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/mcp.ts)_
788
+ _See code: [src/commands/mcp.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/mcp.ts)_
742
789
 
743
790
  ## `qfg migrate`
744
791
 
@@ -792,7 +839,7 @@ EXAMPLES
792
839
  $ qfg migrate --from launch --api-key $LAUNCH_API_KEY --dir ./quonfig-config --staging
793
840
  ```
794
841
 
795
- _See code: [src/commands/migrate.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/migrate.ts)_
842
+ _See code: [src/commands/migrate.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate.ts)_
796
843
 
797
844
  ## `qfg migrate doctor`
798
845
 
@@ -830,7 +877,7 @@ EXAMPLES
830
877
  $ qfg migrate doctor --json
831
878
  ```
832
879
 
833
- _See code: [src/commands/migrate/doctor.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/migrate/doctor.ts)_
880
+ _See code: [src/commands/migrate/doctor.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate/doctor.ts)_
834
881
 
835
882
  ## `qfg migrate my-code`
836
883
 
@@ -862,7 +909,7 @@ EXAMPLES
862
909
  $ qfg migrate my-code --dry-run
863
910
  ```
864
911
 
865
- _See code: [src/commands/migrate/my-code.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/migrate/my-code.ts)_
912
+ _See code: [src/commands/migrate/my-code.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate/my-code.ts)_
866
913
 
867
914
  ## `qfg migrate status`
868
915
 
@@ -893,7 +940,7 @@ EXAMPLES
893
940
  $ qfg migrate status --json
894
941
  ```
895
942
 
896
- _See code: [src/commands/migrate/status.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/migrate/status.ts)_
943
+ _See code: [src/commands/migrate/status.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/migrate/status.ts)_
897
944
 
898
945
  ## `qfg override [NAME] [VALUE]`
899
946
 
@@ -948,7 +995,7 @@ EXAMPLES
948
995
  $ qfg override my.flag true --env=staging
949
996
  ```
950
997
 
951
- _See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/override.ts)_
998
+ _See code: [src/commands/override.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/override.ts)_
952
999
 
953
1000
  ## `qfg pull`
954
1001
 
@@ -992,7 +1039,7 @@ EXAMPLES
992
1039
  $ qfg pull # uses QUONFIG_DIR env var
993
1040
  ```
994
1041
 
995
- _See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/pull.ts)_
1042
+ _See code: [src/commands/pull.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/pull.ts)_
996
1043
 
997
1044
  ## `qfg push`
998
1045
 
@@ -1040,7 +1087,7 @@ EXAMPLES
1040
1087
  $ qfg push --dir ./our-config --yes
1041
1088
  ```
1042
1089
 
1043
- _See code: [src/commands/push.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/push.ts)_
1090
+ _See code: [src/commands/push.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/push.ts)_
1044
1091
 
1045
1092
  ## `qfg schema NAME`
1046
1093
 
@@ -1078,7 +1125,7 @@ EXAMPLES
1078
1125
  $ qfg schema my-schema --set-json-schema=@schemas/my-schema.json --protected
1079
1126
  ```
1080
1127
 
1081
- _See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/schema.ts)_
1128
+ _See code: [src/commands/schema.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/schema.ts)_
1082
1129
 
1083
1130
  ## `qfg sdk-key`
1084
1131
 
@@ -1105,7 +1152,7 @@ EXAMPLES
1105
1152
  $ qfg sdk-key revoke <key-id>
1106
1153
  ```
1107
1154
 
1108
- _See code: [src/commands/sdk-key.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/sdk-key.ts)_
1155
+ _See code: [src/commands/sdk-key.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key.ts)_
1109
1156
 
1110
1157
  ## `qfg sdk-key create`
1111
1158
 
@@ -1137,7 +1184,7 @@ EXAMPLES
1137
1184
  $ qfg sdk-key create --environment staging --type browser
1138
1185
  ```
1139
1186
 
1140
- _See code: [src/commands/sdk-key/create.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/sdk-key/create.ts)_
1187
+ _See code: [src/commands/sdk-key/create.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key/create.ts)_
1141
1188
 
1142
1189
  ## `qfg sdk-key list`
1143
1190
 
@@ -1166,7 +1213,7 @@ EXAMPLES
1166
1213
  $ qfg sdk-key list --environment production
1167
1214
  ```
1168
1215
 
1169
- _See code: [src/commands/sdk-key/list.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/sdk-key/list.ts)_
1216
+ _See code: [src/commands/sdk-key/list.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key/list.ts)_
1170
1217
 
1171
1218
  ## `qfg sdk-key revoke KEYID`
1172
1219
 
@@ -1193,7 +1240,7 @@ EXAMPLES
1193
1240
  $ qfg sdk-key revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890
1194
1241
  ```
1195
1242
 
1196
- _See code: [src/commands/sdk-key/revoke.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/sdk-key/revoke.ts)_
1243
+ _See code: [src/commands/sdk-key/revoke.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sdk-key/revoke.ts)_
1197
1244
 
1198
1245
  ## `qfg set-default [NAME]`
1199
1246
 
@@ -1264,7 +1311,7 @@ EXAMPLES
1264
1311
  $ qfg pull && qfg config-schema
1265
1312
  ```
1266
1313
 
1267
- _See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/set-default.ts)_
1314
+ _See code: [src/commands/set-default.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/set-default.ts)_
1268
1315
 
1269
1316
  ## `qfg set-rollout [NAME]`
1270
1317
 
@@ -1341,7 +1388,7 @@ EXAMPLES
1341
1388
  $ qfg set-rollout my.variant.flag --environment production --weights "a:33,b:33,c:34" --hash-by user.id
1342
1389
  ```
1343
1390
 
1344
- _See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/set-rollout.ts)_
1391
+ _See code: [src/commands/set-rollout.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/set-rollout.ts)_
1345
1392
 
1346
1393
  ## `qfg sync`
1347
1394
 
@@ -1373,7 +1420,7 @@ EXAMPLES
1373
1420
  $ qfg sync --watch --dir ./our-config --interval 30
1374
1421
  ```
1375
1422
 
1376
- _See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/sync.ts)_
1423
+ _See code: [src/commands/sync.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/sync.ts)_
1377
1424
 
1378
1425
  ## `qfg toggle [NAME]`
1379
1426
 
@@ -1475,7 +1522,7 @@ EXAMPLES
1475
1522
  $ qfg verify --json
1476
1523
  ```
1477
1524
 
1478
- _See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/verify.ts)_
1525
+ _See code: [src/commands/verify.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/verify.ts)_
1479
1526
 
1480
1527
  ## `qfg whoami`
1481
1528
 
@@ -1498,7 +1545,7 @@ EXAMPLES
1498
1545
  $ qfg whoami
1499
1546
  ```
1500
1547
 
1501
- _See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/whoami.ts)_
1548
+ _See code: [src/commands/whoami.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/whoami.ts)_
1502
1549
 
1503
1550
  ## `qfg workspace`
1504
1551
 
@@ -1521,7 +1568,7 @@ EXAMPLES
1521
1568
  $ qfg workspace
1522
1569
  ```
1523
1570
 
1524
- _See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/workspace.ts)_
1571
+ _See code: [src/commands/workspace.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace.ts)_
1525
1572
 
1526
1573
  ## `qfg workspace bootstrap`
1527
1574
 
@@ -1554,7 +1601,7 @@ EXAMPLES
1554
1601
  $ qfg workspace bootstrap --dir ./our-config --skip-validate
1555
1602
  ```
1556
1603
 
1557
- _See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/workspace/bootstrap.ts)_
1604
+ _See code: [src/commands/workspace/bootstrap.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace/bootstrap.ts)_
1558
1605
 
1559
1606
  ## `qfg workspace create SLUG`
1560
1607
 
@@ -1588,7 +1635,7 @@ EXAMPLES
1588
1635
  $ qfg workspace create my-team --org 11111111-1111-1111-1111-111111111111
1589
1636
  ```
1590
1637
 
1591
- _See code: [src/commands/workspace/create.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/workspace/create.ts)_
1638
+ _See code: [src/commands/workspace/create.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace/create.ts)_
1592
1639
 
1593
1640
  ## `qfg workspace switch [SLUG]`
1594
1641
 
@@ -1616,7 +1663,7 @@ EXAMPLES
1616
1663
  $ qfg workspace switch my-workspace-slug
1617
1664
  ```
1618
1665
 
1619
- _See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.0.21/src/commands/workspace/switch.ts)_
1666
+ _See code: [src/commands/workspace/switch.ts](https://github.com/quonfig/cli/blob/v0.0.22/src/commands/workspace/switch.ts)_
1620
1667
  <!-- commandsstop -->
1621
1668
 
1622
1669
  ## Local Development
@@ -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
+ }
@@ -0,0 +1,114 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { APICommand } from '../index.js';
3
+ import { confirmTypedSlug } from '../push/confirm.js';
4
+ import isInteractive from '../util/is-interactive.js';
5
+ import { checkmark } from '../util/color.js';
6
+ import { loadTokens } from '../util/token-storage.js';
7
+ const DELETE_ROUTES = {
8
+ config: { endpoint: '/api/v1/configs/delete', keyField: 'configKey' },
9
+ feature_flag: { endpoint: '/api/v1/flags/delete', keyField: 'flagKey' },
10
+ log_level: { endpoint: '/api/v1/logLevels/delete', keyField: 'logLevelKey' },
11
+ };
12
+ /**
13
+ * Parse the fresh SHA out of a 409 conflict message of the form
14
+ * "<path> was modified (expected <oldSha>, got <newSha>)"
15
+ */
16
+ function parseFreshShaFromConflict(message) {
17
+ if (!message)
18
+ return undefined;
19
+ const match = message.match(/got\s+([\w.-]+)\)/);
20
+ return match?.[1];
21
+ }
22
+ export default class Delete extends APICommand {
23
+ static args = {
24
+ name: Args.string({ description: 'flag/config/log-level key to delete', required: true }),
25
+ };
26
+ static description = `Delete a flag, config, or log-level from the workspace.
27
+
28
+ DESTRUCTIVE — removes the underlying JSON file from the workspace git repo
29
+ and commits with the actor's identity. The commit history preserves the
30
+ prior content; this is a hard-delete on the file but a soft-delete on
31
+ history.
32
+
33
+ Confirmation is required:
34
+ --yes skip the prompt (for scripts and CI)
35
+ interactive (default) you'll be asked to type the key name back
36
+
37
+ Examples
38
+ qfg delete my.flag --yes
39
+ qfg delete my.flag # interactive: type the key back to confirm
40
+ qfg delete my.config --yes`;
41
+ static examples = [
42
+ '<%= config.bin %> <%= command.id %> my.flag --yes',
43
+ '<%= config.bin %> <%= command.id %> my.config --yes',
44
+ ];
45
+ static flags = {
46
+ yes: Flags.boolean({ default: false, description: 'skip confirmation prompt' }),
47
+ };
48
+ async run() {
49
+ const { args, flags } = await this.parse(Delete);
50
+ const tokens = await loadTokens();
51
+ if (!tokens?.accessToken) {
52
+ return this.err('Not logged in. Run `qfg login` first.');
53
+ }
54
+ const key = args.name;
55
+ const metaRes = await this.apiClient.post('/api/v1/metadata/list', { workspaceId: this.workspaceId });
56
+ if (!metaRes.ok) {
57
+ return this.err(`Failed to look up ${key}: ${metaRes.status} ${JSON.stringify(metaRes.error)}`);
58
+ }
59
+ const items = metaRes.json?.configs ?? [];
60
+ const item = items.find((i) => i.key === key);
61
+ if (!item) {
62
+ return this.err(`${key} not found in this workspace.`);
63
+ }
64
+ const route = DELETE_ROUTES[item.type];
65
+ if (!route) {
66
+ return this.err(`Cannot delete ${key}: unsupported type "${item.type}". Supported: flag, config, log-level.`);
67
+ }
68
+ if (!flags.yes) {
69
+ if (!isInteractive(flags)) {
70
+ return this.err(`Refusing to delete ${key} without confirmation. Pass --yes or run interactively.`);
71
+ }
72
+ this.log(`About to delete ${item.type.replaceAll('_', ' ')}: ${key}`);
73
+ this.log('This rewrites the workspace repo and is destructive.');
74
+ const confirmed = await confirmTypedSlug(key, `Type "${key}" to confirm: `);
75
+ if (!confirmed) {
76
+ return this.err(`Aborted: ${key} was not typed back exactly. No changes made.`);
77
+ }
78
+ }
79
+ let expectedCommitSha = item.version;
80
+ let attempt = 0;
81
+ while (attempt < 2) {
82
+ attempt += 1;
83
+ const payload = {
84
+ workspaceId: this.workspaceId,
85
+ [route.keyField]: key,
86
+ ...(expectedCommitSha ? { expectedCommitSha } : {}),
87
+ };
88
+ this.verboseLog(`RPC ${route.endpoint}`, payload);
89
+ // eslint-disable-next-line no-await-in-loop
90
+ const res = await this.apiClient.post(route.endpoint, payload);
91
+ if (res.ok) {
92
+ const commitSha = res.json?.commitSha;
93
+ const shaSuffix = commitSha ? ` (commit ${commitSha})` : '';
94
+ return this.ok(`${checkmark} Deleted ${item.type.replaceAll('_', ' ')}: ${key}${shaSuffix}`, {
95
+ key,
96
+ type: item.type,
97
+ ...(commitSha ? { commitSha } : {}),
98
+ });
99
+ }
100
+ if (res.status === 404) {
101
+ return this.err(`${key} not found on the server (it may have been deleted by someone else).`);
102
+ }
103
+ if (res.status === 409 && attempt === 1) {
104
+ const fresh = parseFreshShaFromConflict(res.error?.message);
105
+ if (fresh) {
106
+ this.verboseLog(`Stale SHA — retrying delete with fresh SHA ${fresh}`);
107
+ expectedCommitSha = fresh;
108
+ continue;
109
+ }
110
+ }
111
+ return this.err(`Failed to delete ${key}: ${res.status} ${JSON.stringify(res.error)}`);
112
+ }
113
+ }
114
+ }
package/dist/quonfig.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Quonfig } from '@quonfig/node';
2
+ import { getDeliveryUrl } from './util/domain-urls.js';
2
3
  let quonfig;
3
4
  const DEFAULT_CONTEXT_USER_ID_NAMESPACE = 'prefab-api-key';
4
5
  const DEFAULT_CONTEXT_USER_ID = 'user-id';
@@ -14,7 +15,7 @@ export const initQuonfig = async (_ctx, flagsOrDatafile) => {
14
15
  }
15
16
  sdkKey = flagsOrDatafile['sdk-key'];
16
17
  }
17
- const apiUrl = process.env.QUONFIG_API_URL || 'https://api.quonfig.com';
18
+ const apiUrl = getDeliveryUrl();
18
19
  quonfig = new Quonfig({
19
20
  sdkKey,
20
21
  collectEvaluationSummaries: false,
@@ -1,3 +1,4 @@
1
1
  export declare const getDomain: () => string;
2
2
  export declare const getApiUrl: (domain?: string) => string;
3
3
  export declare const getAppUrl: (domain?: string) => string;
4
+ export declare const getDeliveryUrl: (domain?: string) => string;
@@ -16,3 +16,10 @@ export const getAppUrl = (domain) => {
16
16
  const actualDomain = domain || getDomain();
17
17
  return `https://app.${actualDomain}`;
18
18
  };
19
+ export const getDeliveryUrl = (domain) => {
20
+ if (process.env.QUONFIG_API_URL) {
21
+ return process.env.QUONFIG_API_URL;
22
+ }
23
+ const actualDomain = domain || getDomain();
24
+ return `https://primary.${actualDomain}`;
25
+ };
@@ -202,6 +202,93 @@
202
202
  "create.js"
203
203
  ]
204
204
  },
205
+ "delete": {
206
+ "aliases": [],
207
+ "args": {
208
+ "name": {
209
+ "description": "flag/config/log-level key to delete",
210
+ "name": "name",
211
+ "required": true
212
+ }
213
+ },
214
+ "description": "Delete a flag, config, or log-level from the workspace.\n\nDESTRUCTIVE — removes the underlying JSON file from the workspace git repo\nand commits with the actor's identity. The commit history preserves the\nprior content; this is a hard-delete on the file but a soft-delete on\nhistory.\n\nConfirmation is required:\n --yes skip the prompt (for scripts and CI)\n interactive (default) you'll be asked to type the key name back\n\nExamples\n qfg delete my.flag --yes\n qfg delete my.flag # interactive: type the key back to confirm\n qfg delete my.config --yes",
215
+ "examples": [
216
+ "<%= config.bin %> <%= command.id %> my.flag --yes",
217
+ "<%= config.bin %> <%= command.id %> my.config --yes"
218
+ ],
219
+ "flags": {
220
+ "json": {
221
+ "description": "Format output as json.",
222
+ "helpGroup": "GLOBAL",
223
+ "name": "json",
224
+ "allowNo": false,
225
+ "type": "boolean"
226
+ },
227
+ "interactive": {
228
+ "description": "Force interactive mode",
229
+ "helpGroup": "GLOBAL",
230
+ "name": "interactive",
231
+ "allowNo": true,
232
+ "type": "boolean"
233
+ },
234
+ "no-color": {
235
+ "description": "Do not colorize output",
236
+ "env": "NO_COLOR",
237
+ "helpGroup": "GLOBAL",
238
+ "name": "no-color",
239
+ "allowNo": false,
240
+ "type": "boolean"
241
+ },
242
+ "verbose": {
243
+ "description": "Verbose output",
244
+ "helpGroup": "GLOBAL",
245
+ "name": "verbose",
246
+ "allowNo": false,
247
+ "type": "boolean"
248
+ },
249
+ "workspace": {
250
+ "char": "w",
251
+ "description": "Workspace slug to use (overrides QUONFIG_WORKSPACE env var and saved default)",
252
+ "helpGroup": "GLOBAL",
253
+ "name": "workspace",
254
+ "required": false,
255
+ "hasDynamicHelp": false,
256
+ "multiple": false,
257
+ "type": "option"
258
+ },
259
+ "profile": {
260
+ "char": "p",
261
+ "description": "Deprecated: use --workspace instead",
262
+ "helpGroup": "GLOBAL",
263
+ "hidden": true,
264
+ "name": "profile",
265
+ "required": false,
266
+ "hasDynamicHelp": false,
267
+ "multiple": false,
268
+ "type": "option"
269
+ },
270
+ "yes": {
271
+ "description": "skip confirmation prompt",
272
+ "name": "yes",
273
+ "allowNo": false,
274
+ "type": "boolean"
275
+ }
276
+ },
277
+ "hasDynamicHelp": false,
278
+ "hiddenAliases": [],
279
+ "id": "delete",
280
+ "pluginAlias": "@quonfig/cli",
281
+ "pluginName": "@quonfig/cli",
282
+ "pluginType": "core",
283
+ "strict": true,
284
+ "enableJsonFlag": true,
285
+ "isESM": true,
286
+ "relativePath": [
287
+ "dist",
288
+ "commands",
289
+ "delete.js"
290
+ ]
291
+ },
205
292
  "generate-new-hex-key": {
206
293
  "aliases": [],
207
294
  "args": {},
@@ -2896,5 +2983,5 @@
2896
2983
  ]
2897
2984
  }
2898
2985
  },
2899
- "version": "0.0.21"
2986
+ "version": "0.0.22"
2900
2987
  }
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.0.21",
4
+ "version": "0.0.22",
5
5
  "bugs": {
6
6
  "url": "https://github.com/quonfig/cli/issues"
7
7
  },