@agileguy/cf-cli 1.1.0 → 1.1.2

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.
Files changed (3) hide show
  1. package/README.md +1106 -2
  2. package/dist/index.js +2 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,2 +1,1106 @@
1
- # cf-cli
2
- A fully-featured Cloudflare CLI wrapping the entire Cloudflare REST API
1
+ # @agileguy/cf-cli
2
+
3
+ A fully-featured Cloudflare CLI wrapping the entire Cloudflare REST API. Zero dependencies, single binary, 50+ resource groups, 2100+ tests.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # npm
9
+ npm install -g @agileguy/cf-cli
10
+
11
+ # bun
12
+ bun install -g @agileguy/cf-cli
13
+ ```
14
+
15
+ After installation the `cf` command is available globally.
16
+
17
+ ## Authentication
18
+
19
+ Set up credentials using environment variables or config profiles.
20
+
21
+ ### Environment Variables (quickest)
22
+
23
+ ```bash
24
+ # API Token (recommended)
25
+ export CF_API_TOKEN="your-api-token"
26
+
27
+ # Or Global API Key + Email
28
+ export CF_API_KEY="your-global-api-key"
29
+ export CF_API_EMAIL="you@example.com"
30
+ ```
31
+
32
+ ### Config Profiles (persistent)
33
+
34
+ ```bash
35
+ # Create a profile
36
+ cf config set --name default --token your-api-token
37
+
38
+ # Create additional profiles
39
+ cf config set --name staging --token staging-token
40
+
41
+ # Switch default profile
42
+ cf config use --name staging
43
+
44
+ # Use a profile for a single command
45
+ cf zones list --profile staging
46
+ ```
47
+
48
+ ### Resolution Order
49
+
50
+ 1. `--profile` flag
51
+ 2. `CF_PROFILE` environment variable
52
+ 3. `CF_API_TOKEN` environment variable
53
+ 4. `CF_API_KEY` + `CF_API_EMAIL` environment variables
54
+ 5. `default` profile from config file
55
+
56
+ ## Global Flags
57
+
58
+ | Flag | Description |
59
+ |------|-------------|
60
+ | `--profile <name>` | Use a specific auth profile |
61
+ | `--output <format>` | Output format: `table`, `json`, `csv`, `yaml` (default: `table`) |
62
+ | `--raw` | Show raw API response JSON |
63
+ | `--verbose` | Show debug output (HTTP requests, timing) |
64
+ | `--quiet` | Suppress non-essential output |
65
+ | `--no-color` | Disable colored output (also respects `NO_COLOR` env) |
66
+ | `--yes` | Auto-confirm destructive operations |
67
+ | `--help` | Show help |
68
+ | `--version` | Show version |
69
+
70
+ ## Commands
71
+
72
+ ### Zones
73
+
74
+ ```bash
75
+ cf zones list
76
+ cf zones get --zone example.com
77
+ cf zones create --name example.com
78
+ cf zones delete --zone example.com [--yes]
79
+
80
+ # Zone Settings
81
+ cf zones settings list --zone example.com
82
+ cf zones settings get --zone example.com --setting ssl
83
+ cf zones settings update --zone example.com --setting always_use_https --value on
84
+
85
+ # Zone Analytics
86
+ cf zones analytics dashboard --zone example.com [--from 2024-01-01] [--to 2024-01-31]
87
+ cf zones analytics colo --zone example.com
88
+ cf zones analytics dns --zone example.com
89
+ ```
90
+
91
+ ### DNS
92
+
93
+ ```bash
94
+ cf dns list --zone example.com
95
+ cf dns get --zone example.com --id <record-id>
96
+ cf dns create --zone example.com --type A --name www --content 1.2.3.4 [--proxied] [--ttl 300]
97
+ cf dns update --zone example.com --id <id> --type A --name www --content 5.6.7.8
98
+ cf dns patch --zone example.com --id <id> --content 5.6.7.8
99
+ cf dns delete --zone example.com --id <id> [--yes]
100
+ cf dns export --zone example.com
101
+ cf dns import --zone example.com --file records.bind
102
+ ```
103
+
104
+ ### Workers
105
+
106
+ ```bash
107
+ # Scripts
108
+ cf workers list
109
+ cf workers get --name my-worker
110
+ cf workers deploy --name my-worker --file worker.js
111
+ cf workers delete --name my-worker [--yes]
112
+
113
+ # Routes
114
+ cf workers routes list --zone example.com
115
+ cf workers routes create --zone example.com --pattern "example.com/*" --script my-worker
116
+ cf workers routes delete --zone example.com --id <route-id> [--yes]
117
+
118
+ # Cron Triggers
119
+ cf workers cron get --name my-worker
120
+ cf workers cron update --name my-worker --cron "*/5 * * * *"
121
+
122
+ # Custom Domains
123
+ cf workers domains list
124
+ cf workers domains create --name my-worker --zone example.com --hostname api.example.com
125
+ cf workers domains delete --id <domain-id> [--yes]
126
+
127
+ # Versions
128
+ cf workers versions list --name my-worker
129
+ cf workers versions get --name my-worker --id <version-id>
130
+
131
+ # Workers for Platforms
132
+ cf workers platforms namespaces list
133
+ cf workers platforms namespaces create --name my-ns
134
+ cf workers platforms scripts list --namespace <ns-id>
135
+
136
+ # Tail (real-time logs)
137
+ cf workers tail --name my-worker
138
+ ```
139
+
140
+ ### KV (Workers KV)
141
+
142
+ ```bash
143
+ # Namespaces
144
+ cf kv namespaces list
145
+ cf kv namespaces create --title MY_KV
146
+ cf kv namespaces rename --id <ns-id> --title NEW_NAME
147
+ cf kv namespaces delete --id <ns-id> [--yes]
148
+
149
+ # Keys
150
+ cf kv list --namespace <ns-id>
151
+ cf kv get --namespace <ns-id> --key my-key
152
+ cf kv put --namespace <ns-id> --key my-key --value "hello" [--ttl 3600]
153
+ cf kv delete --namespace <ns-id> --key my-key [--yes]
154
+ cf kv bulk-write --namespace <ns-id> --file entries.json
155
+ cf kv bulk-delete --namespace <ns-id> --file keys.json [--yes]
156
+ ```
157
+
158
+ ### Durable Objects
159
+
160
+ ```bash
161
+ cf durable-objects list
162
+ cf durable-objects objects list --namespace <ns-id>
163
+ ```
164
+
165
+ ### R2 Storage
166
+
167
+ ```bash
168
+ # Buckets
169
+ cf r2 buckets list
170
+ cf r2 buckets get --name my-bucket
171
+ cf r2 buckets create --name my-bucket [--location WNAM]
172
+ cf r2 buckets delete --name my-bucket [--yes]
173
+
174
+ # CORS
175
+ cf r2 cors get --bucket my-bucket
176
+ cf r2 cors set --bucket my-bucket --file cors.json
177
+ cf r2 cors delete --bucket my-bucket [--yes]
178
+
179
+ # Lifecycle Rules
180
+ cf r2 lifecycle get --bucket my-bucket
181
+ cf r2 lifecycle set --bucket my-bucket --file lifecycle.json
182
+
183
+ # Custom Domains
184
+ cf r2 custom-domains list --bucket my-bucket
185
+ cf r2 custom-domains create --bucket my-bucket --zone example.com --hostname cdn.example.com
186
+ cf r2 custom-domains delete --bucket my-bucket --hostname cdn.example.com [--yes]
187
+
188
+ # Event Notifications
189
+ cf r2 event-notifications get --bucket my-bucket
190
+ cf r2 event-notifications create --bucket my-bucket --queue <queue-id> --event-type object-create
191
+
192
+ # Metrics
193
+ cf r2 metrics get --bucket my-bucket
194
+ ```
195
+
196
+ ### D1 Databases
197
+
198
+ ```bash
199
+ cf d1 list
200
+ cf d1 get --id <db-id>
201
+ cf d1 create --name my-database
202
+ cf d1 delete --id <db-id> [--yes]
203
+ cf d1 query --id <db-id> --sql "SELECT * FROM users"
204
+ cf d1 export --id <db-id> --output-file dump.sql
205
+ cf d1 import --id <db-id> --file schema.sql
206
+ ```
207
+
208
+ ### Pages
209
+
210
+ ```bash
211
+ # Projects
212
+ cf pages list
213
+ cf pages get --name my-site
214
+ cf pages create --name my-site --production-branch main
215
+ cf pages delete --name my-site [--yes]
216
+
217
+ # Deployments
218
+ cf pages deployments list --project my-site
219
+ cf pages deployments get --project my-site --id <deploy-id>
220
+ cf pages deployments delete --project my-site --id <deploy-id> [--yes]
221
+ cf pages deployments retry --project my-site --id <deploy-id>
222
+ cf pages deployments rollback --project my-site --id <deploy-id>
223
+
224
+ # Domains
225
+ cf pages domains list --project my-site
226
+ cf pages domains create --project my-site --name www.example.com
227
+ cf pages domains delete --project my-site --name www.example.com [--yes]
228
+ ```
229
+
230
+ ### Queues
231
+
232
+ ```bash
233
+ cf queues list
234
+ cf queues get --id <queue-id>
235
+ cf queues create --name my-queue
236
+ cf queues delete --id <queue-id> [--yes]
237
+
238
+ # Consumers
239
+ cf queues consumers list --queue <queue-id>
240
+ cf queues consumers create --queue <queue-id> --service my-worker
241
+ cf queues consumers delete --queue <queue-id> --consumer <consumer-id> [--yes]
242
+
243
+ # Messages
244
+ cf queues send --queue <queue-id> --body '{"hello":"world"}'
245
+ ```
246
+
247
+ ### Hyperdrive
248
+
249
+ ```bash
250
+ cf hyperdrive list
251
+ cf hyperdrive get --id <hd-id>
252
+ cf hyperdrive create --name my-hd --connection-string "postgres://user:pass@host:5432/db"
253
+ cf hyperdrive update --id <hd-id> --name new-name
254
+ cf hyperdrive delete --id <hd-id> [--yes]
255
+ ```
256
+
257
+ ### Pipelines
258
+
259
+ ```bash
260
+ cf pipelines list
261
+ cf pipelines get --id <pipeline-id>
262
+ cf pipelines create --file pipeline-config.json
263
+ cf pipelines delete --id <pipeline-id> [--yes]
264
+ ```
265
+
266
+ ### Secrets Store
267
+
268
+ ```bash
269
+ # Stores
270
+ cf secrets-store stores list
271
+ cf secrets-store stores get --id <store-id>
272
+ cf secrets-store stores create --name my-store
273
+ cf secrets-store stores delete --id <store-id> [--yes]
274
+
275
+ # Secrets
276
+ cf secrets-store secrets list --store <store-id>
277
+ cf secrets-store secrets get --store <store-id> --name MY_SECRET
278
+ cf secrets-store secrets set --store <store-id> --name MY_SECRET --value "secret-value"
279
+ cf secrets-store secrets delete --store <store-id> --name MY_SECRET [--yes]
280
+ ```
281
+
282
+ ### Rulesets
283
+
284
+ ```bash
285
+ cf rulesets list --zone example.com
286
+ cf rulesets get --zone example.com --id <ruleset-id>
287
+ cf rulesets create --zone example.com --file ruleset.json
288
+ cf rulesets delete --zone example.com --id <ruleset-id> [--yes]
289
+
290
+ # Rules
291
+ cf rulesets rules list --zone example.com --ruleset <id>
292
+ cf rulesets rules create --zone example.com --ruleset <id> --file rule.json
293
+ cf rulesets rules update --zone example.com --ruleset <id> --rule <rule-id> --file rule.json
294
+ cf rulesets rules delete --zone example.com --ruleset <id> --rule <rule-id> [--yes]
295
+
296
+ # Versions
297
+ cf rulesets versions list --zone example.com --ruleset <id>
298
+ cf rulesets versions get --zone example.com --ruleset <id> --version <v>
299
+
300
+ # Phase Entrypoints
301
+ cf rulesets phases get --zone example.com --phase http_request_firewall_custom
302
+ ```
303
+
304
+ ### Firewall (Legacy)
305
+
306
+ ```bash
307
+ # IP Access Rules
308
+ cf firewall ip-rules list --zone example.com
309
+ cf firewall ip-rules create --zone example.com --mode block --ip 1.2.3.4 --notes "Bad actor"
310
+ cf firewall ip-rules delete --zone example.com --id <id> [--yes]
311
+
312
+ # User-Agent Rules
313
+ cf firewall ua-rules list --zone example.com
314
+ cf firewall ua-rules create --zone example.com --file ua-rule.json
315
+ cf firewall ua-rules delete --zone example.com --id <id> [--yes]
316
+
317
+ # Zone Lockdowns
318
+ cf firewall zone-lockdowns list --zone example.com
319
+ cf firewall zone-lockdowns create --zone example.com --file lockdown.json
320
+ cf firewall zone-lockdowns delete --zone example.com --id <id> [--yes]
321
+ ```
322
+
323
+ ### Page Shield
324
+
325
+ ```bash
326
+ cf page-shield settings get --zone example.com
327
+ cf page-shield settings update --zone example.com --enabled true
328
+ cf page-shield scripts list --zone example.com
329
+ cf page-shield connections list --zone example.com
330
+ cf page-shield policies list --zone example.com
331
+ cf page-shield policies create --zone example.com --file policy.json
332
+ cf page-shield policies delete --zone example.com --id <id> [--yes]
333
+ ```
334
+
335
+ ### Turnstile
336
+
337
+ ```bash
338
+ cf turnstile list
339
+ cf turnstile get --sitekey <key>
340
+ cf turnstile create --name my-widget --domains example.com --mode managed
341
+ cf turnstile update --sitekey <key> --name new-name
342
+ cf turnstile delete --sitekey <key> [--yes]
343
+ cf turnstile rotate-secret --sitekey <key>
344
+ ```
345
+
346
+ ### API Gateway
347
+
348
+ ```bash
349
+ cf api-gateway settings get --zone example.com
350
+ cf api-gateway settings update --zone example.com --enabled true
351
+ cf api-gateway schemas list --zone example.com
352
+ cf api-gateway schemas upload --zone example.com --file openapi.json
353
+ cf api-gateway schemas delete --zone example.com --id <id> [--yes]
354
+ ```
355
+
356
+ ### Rate Limits (Legacy)
357
+
358
+ ```bash
359
+ cf rate-limits list --zone example.com
360
+ cf rate-limits get --zone example.com --id <id>
361
+ cf rate-limits create --zone example.com --file rate-limit.json
362
+ cf rate-limits update --zone example.com --id <id> --file rate-limit.json
363
+ cf rate-limits delete --zone example.com --id <id> [--yes]
364
+ ```
365
+
366
+ ### Tunnels (Cloudflare Tunnel)
367
+
368
+ ```bash
369
+ cf tunnels list
370
+ cf tunnels get --id <tunnel-id>
371
+ cf tunnels create --name my-tunnel
372
+ cf tunnels delete --id <tunnel-id> [--yes]
373
+ cf tunnels token --id <tunnel-id>
374
+
375
+ # Config
376
+ cf tunnels config get --id <tunnel-id>
377
+ cf tunnels config update --id <tunnel-id> --file config.json
378
+
379
+ # Connections
380
+ cf tunnels connections list --id <tunnel-id>
381
+ cf tunnels connections delete --id <tunnel-id> --connection <conn-id> [--yes]
382
+ ```
383
+
384
+ ### Zero Trust - Devices
385
+
386
+ ```bash
387
+ cf devices list
388
+ cf devices get --id <device-id>
389
+ cf devices revoke --id <device-id> [--yes]
390
+
391
+ # Registrations
392
+ cf devices registrations list
393
+ cf devices registrations get --id <reg-id>
394
+ cf devices registrations delete --id <reg-id> [--yes]
395
+
396
+ # Posture Rules
397
+ cf devices posture rules list
398
+ cf devices posture rules get --id <rule-id>
399
+ cf devices posture rules create --file posture-rule.json
400
+ cf devices posture rules update --id <rule-id> --file posture-rule.json
401
+ cf devices posture rules delete --id <rule-id> [--yes]
402
+ ```
403
+
404
+ ### WARP
405
+
406
+ ```bash
407
+ cf warp settings get
408
+ cf warp settings update --file settings.json
409
+ cf warp split-tunnels list
410
+ cf warp split-tunnels add --address 10.0.0.0/8 --description "Internal network"
411
+ cf warp split-tunnels delete --address 10.0.0.0/8 [--yes]
412
+ cf warp fleet-status
413
+ ```
414
+
415
+ ### Zero Trust - Access
416
+
417
+ ```bash
418
+ # Applications (zone or account scoped)
419
+ cf access apps list --zone example.com
420
+ cf access apps get --zone example.com --id <app-id>
421
+ cf access apps create --zone example.com --file app.json
422
+ cf access apps update --zone example.com --id <app-id> --file app.json
423
+ cf access apps delete --zone example.com --id <app-id> [--yes]
424
+
425
+ # Policies
426
+ cf access policies list --zone example.com --app <app-id>
427
+ cf access policies create --zone example.com --app <app-id> --file policy.json
428
+
429
+ # Service Tokens
430
+ cf access service-tokens list
431
+ cf access service-tokens create --name my-token
432
+ cf access service-tokens delete --id <token-id> [--yes]
433
+
434
+ # Groups
435
+ cf access groups list
436
+ cf access groups create --file group.json
437
+
438
+ # Users & Sessions
439
+ cf access users list
440
+ cf access users sessions list --id <user-id>
441
+
442
+ # Certificates
443
+ cf access certificates list --zone example.com
444
+ cf access certificates create --zone example.com --file cert.json
445
+
446
+ # Identity Providers
447
+ cf access idps list
448
+ cf access idps create --file idp.json
449
+ ```
450
+
451
+ ### Zero Trust - Gateway
452
+
453
+ ```bash
454
+ # DNS Policies
455
+ cf gateway dns list
456
+ cf gateway dns create --file dns-policy.json
457
+ cf gateway dns delete --id <id> [--yes]
458
+
459
+ # HTTP Policies
460
+ cf gateway http list
461
+ cf gateway http create --file http-policy.json
462
+ cf gateway http delete --id <id> [--yes]
463
+
464
+ # Network Policies
465
+ cf gateway network list
466
+ cf gateway network create --file network-policy.json
467
+ cf gateway network delete --id <id> [--yes]
468
+
469
+ # DLP Profiles
470
+ cf gateway dlp list
471
+ cf gateway dlp get --id <profile-id>
472
+ cf gateway dlp create --file dlp-profile.json
473
+ ```
474
+
475
+ ### SSL/TLS
476
+
477
+ ```bash
478
+ cf ssl analyze --zone example.com
479
+ cf ssl universal get --zone example.com
480
+ cf ssl universal update --zone example.com --enabled true
481
+ cf ssl verification list --zone example.com
482
+ cf ssl advanced list --zone example.com
483
+ cf ssl advanced create --zone example.com --file cert-pack.json
484
+ cf ssl custom list --zone example.com
485
+ cf ssl custom create --zone example.com --file custom-cert.json
486
+ cf ssl client list --zone example.com
487
+ cf ssl keyless list --zone example.com
488
+ cf ssl origin-ca list
489
+ cf ssl origin-ca create --file origin-ca.json
490
+ cf ssl mtls list --zone example.com
491
+ cf ssl dcv-delegation get --zone example.com
492
+ cf ssl recommendations get --zone example.com
493
+ cf ssl post-quantum get --zone example.com
494
+ ```
495
+
496
+ ### Load Balancers
497
+
498
+ ```bash
499
+ cf lb list --zone example.com
500
+ cf lb get --zone example.com --id <lb-id>
501
+ cf lb create --zone example.com --file lb.json
502
+ cf lb update --zone example.com --id <lb-id> --file lb.json
503
+ cf lb delete --zone example.com --id <lb-id> [--yes]
504
+
505
+ # Pools
506
+ cf lb pools list
507
+ cf lb pools get --id <pool-id>
508
+ cf lb pools create --file pool.json
509
+ cf lb pools health --id <pool-id>
510
+ cf lb pools preview --file pool.json
511
+
512
+ # Monitors
513
+ cf lb monitors list
514
+ cf lb monitors get --id <monitor-id>
515
+ cf lb monitors create --file monitor.json
516
+ cf lb monitors preview --file monitor.json
517
+
518
+ # Regions
519
+ cf lb regions list
520
+ ```
521
+
522
+ ### Healthchecks
523
+
524
+ ```bash
525
+ cf healthchecks list --zone example.com
526
+ cf healthchecks get --zone example.com --id <hc-id>
527
+ cf healthchecks create --zone example.com --file healthcheck.json
528
+ cf healthchecks update --zone example.com --id <hc-id> --file healthcheck.json
529
+ cf healthchecks delete --zone example.com --id <hc-id> [--yes]
530
+ cf healthchecks preview --zone example.com --file healthcheck.json
531
+ ```
532
+
533
+ ### Cache
534
+
535
+ ```bash
536
+ # Purge
537
+ cf cache purge --zone example.com --everything [--yes]
538
+ cf cache purge --zone example.com --urls "https://example.com/page1,https://example.com/page2"
539
+ cf cache purge --zone example.com --tags "tag1,tag2"
540
+ cf cache purge --zone example.com --prefixes "/api/,/static/"
541
+
542
+ # Cache Reserve
543
+ cf cache-reserve get --zone example.com
544
+ cf cache-reserve update --zone example.com --enabled true
545
+
546
+ # Tiered Cache
547
+ cf tiered-cache get --zone example.com
548
+ cf tiered-cache update --zone example.com --value smart
549
+
550
+ # Argo Smart Routing
551
+ cf argo get --zone example.com
552
+ cf argo update --zone example.com --enabled true
553
+ ```
554
+
555
+ ### Waiting Rooms
556
+
557
+ ```bash
558
+ cf waiting-rooms list --zone example.com
559
+ cf waiting-rooms get --zone example.com --id <wr-id>
560
+ cf waiting-rooms create --zone example.com --file waiting-room.json
561
+ cf waiting-rooms delete --zone example.com --id <wr-id> [--yes]
562
+ cf waiting-rooms status --zone example.com --id <wr-id>
563
+
564
+ # Events
565
+ cf waiting-rooms events list --zone example.com --room <wr-id>
566
+ cf waiting-rooms events create --zone example.com --room <wr-id> --file event.json
567
+
568
+ # Rules
569
+ cf waiting-rooms rules upsert --zone example.com --room <wr-id> --file rules.json
570
+ ```
571
+
572
+ ### Observatory (Speed)
573
+
574
+ ```bash
575
+ cf observatory pages list --zone example.com
576
+ cf observatory tests list --zone example.com --url "https://example.com"
577
+ cf observatory tests create --zone example.com --url "https://example.com"
578
+ cf observatory tests get --zone example.com --id <test-id>
579
+ cf observatory tests delete --zone example.com --url "https://example.com" [--yes]
580
+ cf observatory schedule get --zone example.com --url "https://example.com"
581
+ cf observatory schedule create --zone example.com --url "https://example.com" --region us-east
582
+ cf observatory schedule delete --zone example.com --url "https://example.com" [--yes]
583
+ ```
584
+
585
+ ### Stream
586
+
587
+ ```bash
588
+ # Videos
589
+ cf stream list
590
+ cf stream get --id <video-id>
591
+ cf stream upload --file video.mp4
592
+ cf stream delete --id <video-id> [--yes]
593
+ cf stream download --id <video-id>
594
+
595
+ # Live Inputs
596
+ cf stream live list
597
+ cf stream live get --id <input-id>
598
+ cf stream live create --file live-input.json
599
+ cf stream live delete --id <input-id> [--yes]
600
+
601
+ # Captions
602
+ cf stream captions list --video <video-id>
603
+ cf stream captions upload --video <video-id> --language en --file captions.vtt
604
+
605
+ # Audio Tracks
606
+ cf stream audio list --video <video-id>
607
+
608
+ # Signing Keys, Watermarks, Webhooks
609
+ cf stream signing-keys list
610
+ cf stream signing-keys create
611
+ cf stream watermarks list
612
+ cf stream watermarks create --file watermark.json
613
+ cf stream webhooks get
614
+ cf stream webhooks update --url https://example.com/webhook
615
+ ```
616
+
617
+ ### Images
618
+
619
+ ```bash
620
+ cf images list
621
+ cf images get --id <image-id>
622
+ cf images create --file image.png
623
+ cf images update --id <image-id> --name new-name
624
+ cf images delete --id <image-id> [--yes]
625
+ cf images direct-upload
626
+ cf images stats
627
+
628
+ # Variants
629
+ cf images variants list
630
+ cf images variants create --file variant.json
631
+ cf images variants delete --id <variant-id> [--yes]
632
+
633
+ # Signing Keys
634
+ cf images signing-keys list
635
+ ```
636
+
637
+ ### Calls / WebRTC
638
+
639
+ ```bash
640
+ cf calls apps list
641
+ cf calls apps get --id <app-id>
642
+ cf calls apps create --name my-app
643
+ cf calls apps delete --id <app-id> [--yes]
644
+
645
+ cf calls turn-keys list
646
+ cf calls turn-keys create --name my-key
647
+ cf calls turn-keys delete --id <key-id> [--yes]
648
+ ```
649
+
650
+ ### Workers AI
651
+
652
+ ```bash
653
+ cf ai run --model @cf/meta/llama-3-8b-instruct --prompt "Hello world"
654
+ cf ai run --model @cf/meta/llama-3-8b-instruct --file input.json
655
+ cf ai models list [--task text-generation]
656
+ cf ai models get --model @cf/meta/llama-3-8b-instruct
657
+
658
+ # Fine-tuning
659
+ cf ai fine-tuning list
660
+ cf ai fine-tuning get --id <ft-id>
661
+ cf ai fine-tuning create --file finetune-config.json
662
+ cf ai fine-tuning delete --id <ft-id> [--yes]
663
+ ```
664
+
665
+ ### AI Gateway
666
+
667
+ ```bash
668
+ cf ai-gateway list
669
+ cf ai-gateway get --id <gw-id>
670
+ cf ai-gateway create --file gateway.json
671
+ cf ai-gateway update --id <gw-id> --file gateway.json
672
+ cf ai-gateway delete --id <gw-id> [--yes]
673
+
674
+ cf ai-gateway logs list --gateway <gw-id>
675
+ cf ai-gateway datasets list --gateway <gw-id>
676
+ cf ai-gateway evaluations list --gateway <gw-id>
677
+ ```
678
+
679
+ ### Vectorize
680
+
681
+ ```bash
682
+ cf vectorize list
683
+ cf vectorize get --name my-index
684
+ cf vectorize create --name my-index --dimensions 768 --metric cosine
685
+ cf vectorize delete --name my-index [--yes]
686
+
687
+ # Vectors
688
+ cf vectorize insert --name my-index --file vectors.ndjson
689
+ cf vectorize upsert --name my-index --file vectors.ndjson
690
+ cf vectorize query --name my-index --file query.json
691
+ cf vectorize vectors get --name my-index --ids "id1,id2"
692
+ cf vectorize vectors delete --name my-index --ids "id1,id2" [--yes]
693
+
694
+ # Metadata Indexes
695
+ cf vectorize metadata-index list --name my-index
696
+ cf vectorize metadata-index create --name my-index --property-name category --type string
697
+ cf vectorize metadata-index delete --name my-index --property-name category [--yes]
698
+ ```
699
+
700
+ ### Magic Transit
701
+
702
+ ```bash
703
+ # GRE Tunnels
704
+ cf magic-transit gre-tunnels list
705
+ cf magic-transit gre-tunnels get --id <id>
706
+ cf magic-transit gre-tunnels create --file tunnel.json
707
+ cf magic-transit gre-tunnels update --id <id> --file tunnel.json
708
+ cf magic-transit gre-tunnels delete --id <id> [--yes]
709
+
710
+ # IPsec Tunnels
711
+ cf magic-transit ipsec-tunnels list
712
+ cf magic-transit ipsec-tunnels get --id <id>
713
+ cf magic-transit ipsec-tunnels create --file tunnel.json
714
+ cf magic-transit ipsec-tunnels delete --id <id> [--yes]
715
+ cf magic-transit ipsec-tunnels psk --id <id>
716
+
717
+ # Sites (with LANs and WANs)
718
+ cf magic-transit sites list
719
+ cf magic-transit sites get --id <id>
720
+ cf magic-transit sites create --file site.json
721
+ cf magic-transit sites delete --id <id> [--yes]
722
+
723
+ # Routes
724
+ cf magic-transit routes list
725
+ cf magic-transit routes create --file route.json
726
+ cf magic-transit routes delete --id <id> [--yes]
727
+
728
+ # ACLs
729
+ cf magic-transit acls list
730
+ cf magic-transit acls create --file acl.json
731
+ cf magic-transit acls delete --id <id> [--yes]
732
+
733
+ # PCAPs
734
+ cf magic-transit pcaps list
735
+ cf magic-transit pcaps get --id <id>
736
+ cf magic-transit pcaps create --file pcap-request.json
737
+ cf magic-transit pcaps download --id <id> --output-file capture.pcap
738
+ ```
739
+
740
+ ### Magic Network Monitoring
741
+
742
+ ```bash
743
+ cf mnm config get
744
+ cf mnm config update --file config.json
745
+ cf mnm rules list
746
+ cf mnm rules get --id <id>
747
+ cf mnm rules create --file rule.json
748
+ cf mnm rules update --id <id> --file rule.json
749
+ cf mnm rules delete --id <id> [--yes]
750
+ ```
751
+
752
+ ### Addressing
753
+
754
+ ```bash
755
+ # Address Maps
756
+ cf addressing address-maps list
757
+ cf addressing address-maps get --id <id>
758
+ cf addressing address-maps create --file address-map.json
759
+ cf addressing address-maps delete --id <id> [--yes]
760
+
761
+ # Prefixes
762
+ cf addressing prefixes list
763
+ cf addressing prefixes get --id <id>
764
+ cf addressing prefixes create --file prefix.json
765
+ cf addressing prefixes delete --id <id> [--yes]
766
+ cf addressing prefixes bgp get --prefix <id>
767
+ cf addressing prefixes bgp update --prefix <id> --on-demand true
768
+ cf addressing prefixes delegations list --prefix <id>
769
+ cf addressing prefixes delegations create --prefix <id> --file delegation.json
770
+ cf addressing prefixes delegations delete --prefix <id> --id <delegation-id> [--yes]
771
+
772
+ # Regional Hostnames
773
+ cf addressing regional-hostnames list --zone example.com
774
+ cf addressing regional-hostnames get --zone example.com --hostname api.example.com
775
+ cf addressing regional-hostnames create --zone example.com --hostname api.example.com --region-key us
776
+ cf addressing regional-hostnames delete --zone example.com --hostname api.example.com [--yes]
777
+ ```
778
+
779
+ ### Spectrum
780
+
781
+ ```bash
782
+ cf spectrum apps list --zone example.com
783
+ cf spectrum apps get --zone example.com --id <id>
784
+ cf spectrum apps create --zone example.com --file app.json
785
+ cf spectrum apps update --zone example.com --id <id> --file app.json
786
+ cf spectrum apps delete --zone example.com --id <id> [--yes]
787
+
788
+ cf spectrum analytics summary --zone example.com
789
+ cf spectrum analytics bytes --zone example.com
790
+ ```
791
+
792
+ ### Radar
793
+
794
+ ```bash
795
+ cf radar http --metric requests [--from 2024-01-01] [--to 2024-01-31]
796
+ cf radar dns
797
+ cf radar bgp
798
+ cf radar attacks
799
+ cf radar bots
800
+ cf radar email
801
+ cf radar as --asn 13335
802
+ cf radar locations
803
+ cf radar datasets
804
+ cf radar annotations [--from 2024-01-01]
805
+ ```
806
+
807
+ ### Threat Intelligence
808
+
809
+ ```bash
810
+ cf intel domain --domain example.com
811
+ cf intel ip --ip 1.2.3.4
812
+ cf intel asn --asn 13335
813
+ cf intel dns --domain example.com
814
+ cf intel whois --domain example.com
815
+ cf intel ip-lists
816
+ cf intel attack-surface --domain example.com
817
+ ```
818
+
819
+ ### URL Scanner
820
+
821
+ ```bash
822
+ cf url-scanner scan --url https://example.com
823
+ cf url-scanner search --query example.com
824
+ cf url-scanner get --id <scan-uuid>
825
+ cf url-scanner har --id <scan-uuid>
826
+ cf url-scanner dom --id <scan-uuid>
827
+ cf url-scanner screenshot --id <scan-uuid> --output-file screenshot.png
828
+ cf url-scanner bulk --file urls.json
829
+ ```
830
+
831
+ ### Cloudforce One
832
+
833
+ ```bash
834
+ cf cf1 requests list
835
+ cf cf1 requests get --id <req-id>
836
+ cf cf1 requests create --file request.json
837
+ cf cf1 threat-events
838
+ cf cf1 pirs
839
+ cf cf1 scans
840
+ ```
841
+
842
+ ### Logpush
843
+
844
+ ```bash
845
+ # Zone-scoped
846
+ cf logpush jobs list --zone example.com
847
+ cf logpush jobs get --zone example.com --id <job-id>
848
+ cf logpush jobs create --zone example.com --file job.json
849
+ cf logpush jobs update --zone example.com --id <job-id> --file job.json
850
+ cf logpush jobs delete --zone example.com --id <job-id> [--yes]
851
+ cf logpush jobs enable --zone example.com --id <job-id>
852
+ cf logpush jobs disable --zone example.com --id <job-id>
853
+
854
+ # Account-scoped
855
+ cf logpush jobs list --account-id <id>
856
+
857
+ cf logpush datasets --zone example.com
858
+ cf logpush instant --zone example.com --file instant-config.json
859
+ cf logpush ownership --zone example.com
860
+ ```
861
+
862
+ ### Web Analytics (RUM)
863
+
864
+ ```bash
865
+ cf web-analytics sites list
866
+ cf web-analytics sites get --id <site-tag>
867
+ cf web-analytics sites create --host example.com
868
+ cf web-analytics sites update --id <site-tag> --host new.example.com
869
+ cf web-analytics sites delete --id <site-tag> [--yes]
870
+
871
+ cf web-analytics rules list --site <site-tag>
872
+ cf web-analytics rules create --site <site-tag> --file rule.json
873
+ cf web-analytics rules delete --site <site-tag> --id <rule-id> [--yes]
874
+ ```
875
+
876
+ ### Zaraz
877
+
878
+ ```bash
879
+ cf zaraz config-get --zone example.com
880
+ cf zaraz config-update --zone example.com --file config.json
881
+ cf zaraz publish --zone example.com
882
+ cf zaraz workflow --zone example.com
883
+ cf zaraz export --zone example.com
884
+ cf zaraz history-list --zone example.com
885
+ cf zaraz history-get --zone example.com --id <id>
886
+ ```
887
+
888
+ ### Email Routing
889
+
890
+ ```bash
891
+ # Settings
892
+ cf email-routing settings get --zone example.com
893
+ cf email-routing settings enable --zone example.com
894
+ cf email-routing settings disable --zone example.com [--yes]
895
+ cf email-routing dns --zone example.com
896
+
897
+ # Addresses (account-scoped)
898
+ cf email-routing addresses list
899
+ cf email-routing addresses get --id <addr-id>
900
+ cf email-routing addresses create --email user@example.com
901
+ cf email-routing addresses delete --id <addr-id> [--yes]
902
+
903
+ # Rules
904
+ cf email-routing rules list --zone example.com
905
+ cf email-routing rules get --zone example.com --id <rule-id>
906
+ cf email-routing rules create --zone example.com --file rule.json
907
+ cf email-routing rules update --zone example.com --id <rule-id> --file rule.json
908
+ cf email-routing rules delete --zone example.com --id <rule-id> [--yes]
909
+ cf email-routing rules catch-all get --zone example.com
910
+ cf email-routing rules catch-all update --zone example.com --file catchall.json
911
+ ```
912
+
913
+ ### Alerts and Notifications
914
+
915
+ ```bash
916
+ cf alerts list
917
+ cf alerts get --id <policy-id>
918
+ cf alerts create --file alert-policy.json
919
+ cf alerts update --id <policy-id> --file alert-policy.json
920
+ cf alerts delete --id <policy-id> [--yes]
921
+ cf alerts history [--from 2024-01-01] [--to 2024-01-31]
922
+ cf alerts available
923
+
924
+ # Webhooks
925
+ cf alerts destinations webhooks list
926
+ cf alerts destinations webhooks create --name my-webhook --url https://example.com/hook
927
+ cf alerts destinations webhooks update --id <id> --url https://new-url.com/hook
928
+ cf alerts destinations webhooks delete --id <id> [--yes]
929
+
930
+ # PagerDuty
931
+ cf alerts destinations pagerduty list
932
+ cf alerts destinations pagerduty connect
933
+ cf alerts destinations pagerduty delete --id <id> [--yes]
934
+
935
+ # Silences
936
+ cf alerts silences list
937
+ cf alerts silences create --file silence.json
938
+ cf alerts silences delete --id <id> [--yes]
939
+ ```
940
+
941
+ ### Rules Lists
942
+
943
+ ```bash
944
+ cf rules-lists list
945
+ cf rules-lists get --id <list-id>
946
+ cf rules-lists create --name my-list --kind ip [--description "Block list"]
947
+ cf rules-lists update --id <list-id> --description "Updated description"
948
+ cf rules-lists delete --id <list-id> [--yes]
949
+
950
+ # Items
951
+ cf rules-lists items list --list <list-id>
952
+ cf rules-lists items add --list <list-id> --file items.json
953
+ cf rules-lists items replace --list <list-id> --file items.json
954
+ cf rules-lists items delete --list <list-id> --ids "id1,id2,id3" [--yes]
955
+ ```
956
+
957
+ ### Snippets
958
+
959
+ ```bash
960
+ cf snippets list --zone example.com
961
+ cf snippets get --zone example.com --name my-snippet
962
+ cf snippets create --zone example.com --name my-snippet --file snippet.js
963
+ cf snippets update --zone example.com --name my-snippet --file snippet.js
964
+ cf snippets delete --zone example.com --name my-snippet [--yes]
965
+
966
+ cf snippets rules list --zone example.com
967
+ cf snippets rules upsert --zone example.com --file rules.json
968
+ ```
969
+
970
+ ### Registrar
971
+
972
+ ```bash
973
+ cf registrar list
974
+ cf registrar get --domain example.com
975
+ cf registrar update --domain example.com [--auto-renew] [--locked] [--privacy]
976
+ cf registrar transfer-in --domain example.com
977
+ ```
978
+
979
+ ### Accounts
980
+
981
+ ```bash
982
+ cf accounts list
983
+ cf accounts get --id <account-id>
984
+
985
+ # Members
986
+ cf accounts members list --account-id <id>
987
+ cf accounts members get --account-id <id> --id <member-id>
988
+ cf accounts members add --account-id <id> --email user@example.com --roles role1,role2
989
+ cf accounts members update --account-id <id> --id <member-id> --roles role1,role2
990
+ cf accounts members remove --account-id <id> --id <member-id> [--yes]
991
+
992
+ # Roles
993
+ cf accounts roles list --account-id <id>
994
+ cf accounts roles get --account-id <id> --id <role-id>
995
+
996
+ # Subscriptions
997
+ cf accounts subscriptions list --account-id <id>
998
+ cf accounts subscriptions get --account-id <id> --id <sub-id>
999
+ ```
1000
+
1001
+ ### User
1002
+
1003
+ ```bash
1004
+ cf user get
1005
+ cf user token verify
1006
+
1007
+ # Billing
1008
+ cf user billing profile
1009
+ cf user billing history [--page 1] [--per-page 20]
1010
+
1011
+ # API Tokens
1012
+ cf user tokens list
1013
+ cf user tokens get --id <token-id>
1014
+ cf user tokens create --name my-token --file token-policy.json
1015
+ cf user tokens update --id <token-id> [--name new-name] [--status disabled]
1016
+ cf user tokens delete --id <token-id> [--yes]
1017
+ cf user tokens verify
1018
+ cf user tokens roll --id <token-id>
1019
+ ```
1020
+
1021
+ ### Audit Logs
1022
+
1023
+ ```bash
1024
+ cf audit-logs list --account-id <id> \
1025
+ [--user-email user@example.com] \
1026
+ [--action-type create] \
1027
+ [--resource-type zone] \
1028
+ [--from 2024-01-01] [--to 2024-01-31] \
1029
+ [--direction desc] [--per-page 50]
1030
+ ```
1031
+
1032
+ ### Page Rules (Legacy)
1033
+
1034
+ ```bash
1035
+ cf page-rules list --zone example.com
1036
+ cf page-rules get --zone example.com --id <rule-id>
1037
+ cf page-rules create --zone example.com --file pagerule.json
1038
+ cf page-rules update --zone example.com --id <rule-id> --file pagerule.json
1039
+ cf page-rules delete --zone example.com --id <rule-id> [--yes]
1040
+ ```
1041
+
1042
+ ### CLI Configuration
1043
+
1044
+ ```bash
1045
+ cf config set --name default --token your-api-token
1046
+ cf config get --name default
1047
+ cf config list
1048
+ cf config delete --name staging [--yes]
1049
+ cf config use --name production
1050
+ ```
1051
+
1052
+ ### Shell Completions
1053
+
1054
+ ```bash
1055
+ cf completion bash >> ~/.bashrc
1056
+ cf completion zsh >> ~/.zshrc
1057
+ cf completion fish > ~/.config/fish/completions/cf.fish
1058
+ ```
1059
+
1060
+ ## Output Formats
1061
+
1062
+ All list and detail commands support multiple output formats:
1063
+
1064
+ ```bash
1065
+ cf zones list # Table (default)
1066
+ cf zones list --output json # JSON
1067
+ cf zones list --output csv # CSV
1068
+ cf zones list --output yaml # YAML
1069
+ cf zones list --raw # Raw API response
1070
+ ```
1071
+
1072
+ ## Features
1073
+
1074
+ - **Complete API coverage**: 50+ resource groups covering the entire Cloudflare REST API
1075
+ - **Zero dependencies**: Single bundled binary, no external packages
1076
+ - **Multiple auth methods**: API tokens, global API keys, config profiles
1077
+ - **Multi-format output**: Table, JSON, CSV, YAML with `NO_COLOR` spec compliance
1078
+ - **Smart resolution**: Zone names auto-resolve to IDs (`--zone example.com` works everywhere)
1079
+ - **Account auto-detection**: Account ID resolves from flag, config, or API auto-detect
1080
+ - **Confirmation prompts**: All destructive operations require confirmation (bypass with `--yes`)
1081
+ - **Rate limit handling**: Automatic retry with exponential backoff on 429 responses
1082
+ - **Auto-pagination**: Large result sets are automatically paginated
1083
+ - **Shell completions**: bash, zsh, and fish completion scripts
1084
+
1085
+ ## Development
1086
+
1087
+ ```bash
1088
+ # Install dependencies
1089
+ bun install
1090
+
1091
+ # Run tests
1092
+ bun test
1093
+
1094
+ # Type check
1095
+ bun run typecheck
1096
+
1097
+ # Build
1098
+ bun run build
1099
+
1100
+ # Run from source
1101
+ bun run src/index.ts zones list
1102
+ ```
1103
+
1104
+ ## License
1105
+
1106
+ MIT
package/dist/index.js CHANGED
@@ -237,7 +237,7 @@ ${jr}`)}}var jr=`Usage: cf cache <command>
237
237
  Commands:
238
238
  purge Purge cached content
239
239
 
240
- Run 'cf cache <command> --help' for more information.`;var Br=p(()=>{f();Or()});async function Hr(s,e){let{flags:n}=d(s),o=a(n,"profile"),t=a(n,"token"),r=a(n,"apiKey"),m=a(n,"email"),c=a(n,"accountId"),l=a(n,"zoneId"),w=a(n,"output");if(!o)throw new i("--profile <name> is required.");if(!/^[a-zA-Z0-9][a-zA-Z0-9-]*$/.test(o))throw new i(`Invalid profile name: "${o}". Profile names must start with a letter or digit and contain only alphanumeric characters and hyphens.`);if(new Set(["__proto__","constructor","prototype"]).has(o))throw new i(`Invalid profile name: "${o}". That name is reserved.`);let k;if(t)k="token";else if(r&&m)k="key";else if(r&&!m)throw new i("--email is required when using --api-key.");else{let B=M().profiles[o];if(B)k=B.auth_method;else throw new i("New profile requires either --token or --api-key + --email.")}if(w)Fe(w);let _=M(),I=_.profiles[o],P={auth_method:k,token:t??I?.token,api_key:r??I?.api_key,email:m??I?.email,account_id:c??I?.account_id,zone_id:l??I?.zone_id};_=qe(_,o,P),K(_),e.output.success(`Profile "${o}" saved.`)}var Vr=p(()=>{f();H();x()});async function Wr(s,e){let{flags:n}=d(s),o=a(n,"profile"),t=M(),r=o??t.default_profile,m=Q(t,r);if(!m)throw new i(`Profile "${r}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);let c=m.token?`***${m.token.slice(-4)}`:"-",l=m.api_key?`***${m.api_key.slice(-4)}`:"-";e.output.detail({Profile:r,"Auth Method":m.auth_method,Token:c,"API Key":l,Email:m.email??"-","Account ID":m.account_id??"-","Zone ID":m.zone_id??"-","Is Default":r===t.default_profile})}var Kr=p(()=>{H();f()});async function Qr(s,e){let n=M(),o=Object.entries(n.profiles).map(([r,m])=>({name:r,auth_method:m.auth_method,email:m.email??"-",account_id:m.account_id??"-",is_default:r===n.default_profile?"Yes":""}));if(o.length===0){e.output.info("No profiles configured. Run: cf config set --profile <name> --token <token>");return}let t=[{key:"name",header:"Profile",width:20},{key:"auth_method",header:"Auth",width:8},{key:"email",header:"Email",width:30},{key:"account_id",header:"Account ID",width:34},{key:"is_default",header:"Default",width:8}];e.output.table(o,t)}var Yr=p(()=>{H()});async function Xr(s,e){let{flags:n}=d(s),o=a(n,"profile");if(!o)throw new i("--profile <name> is required.");let t=M();if(!t.profiles[o])throw new i(`Profile "${o}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);if(!await C(`Delete profile "${o}"?`,e.flags)){e.output.info("Aborted.");return}let m=Ae(t,o),c=m;if(o===t.default_profile){let l=Object.keys(m.profiles);c={...m,default_profile:l[0]??"default"}}K(c),e.output.success(`Profile "${o}" deleted.`)}var Fr=p(()=>{f();H();U()});async function xr(s,e){let{positional:n}=d(s),o=n[0];if(!o)throw new i("Usage: cf config use <profile-name>");let t=M();if(!t.profiles[o])throw new i(`Profile "${o}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);t.default_profile=o,K(t),e.output.success(`Default profile set to "${o}".`)}var ei=p(()=>{f();H()});var ni={};z(ni,{run:()=>TA});async function TA(s,e){let[n,...o]=s;switch(n){case"set":return Hr(o,e);case"get":case"show":return Wr(o,e);case"list":case"ls":return Qr(o,e);case"delete":case"rm":case"remove":return Xr(o,e);case"use":case"switch":return xr(o,e);case void 0:case"--help":case"-h":e.output.raw(oi);return;default:throw new i(`Unknown config command: "${n}"
240
+ Run 'cf cache <command> --help' for more information.`;var Br=p(()=>{f();Or()});async function Hr(s,e){let{flags:n}=d(s),o=a(n,"name")??a(n,"profile"),t=a(n,"token"),r=a(n,"apiKey"),m=a(n,"email"),c=a(n,"accountId"),l=a(n,"zoneId"),w=a(n,"output");if(!o)throw new i("--name <profile> is required. Example: cf config set --name default --token <token>");if(!/^[a-zA-Z0-9][a-zA-Z0-9-]*$/.test(o))throw new i(`Invalid profile name: "${o}". Profile names must start with a letter or digit and contain only alphanumeric characters and hyphens.`);if(new Set(["__proto__","constructor","prototype"]).has(o))throw new i(`Invalid profile name: "${o}". That name is reserved.`);let k;if(t)k="token";else if(r&&m)k="key";else if(r&&!m)throw new i("--email is required when using --api-key.");else{let B=M().profiles[o];if(B)k=B.auth_method;else throw new i("New profile requires either --token or --api-key + --email.")}if(w)Fe(w);let _=M(),I=_.profiles[o],P={auth_method:k,token:t??I?.token,api_key:r??I?.api_key,email:m??I?.email,account_id:c??I?.account_id,zone_id:l??I?.zone_id};_=qe(_,o,P),K(_),e.output.success(`Profile "${o}" saved.`)}var Vr=p(()=>{f();H();x()});async function Wr(s,e){let{flags:n}=d(s),o=a(n,"profile"),t=M(),r=o??t.default_profile,m=Q(t,r);if(!m)throw new i(`Profile "${r}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);let c=m.token?`***${m.token.slice(-4)}`:"-",l=m.api_key?`***${m.api_key.slice(-4)}`:"-";e.output.detail({Profile:r,"Auth Method":m.auth_method,Token:c,"API Key":l,Email:m.email??"-","Account ID":m.account_id??"-","Zone ID":m.zone_id??"-","Is Default":r===t.default_profile})}var Kr=p(()=>{H();f()});async function Qr(s,e){let n=M(),o=Object.entries(n.profiles).map(([r,m])=>({name:r,auth_method:m.auth_method,email:m.email??"-",account_id:m.account_id??"-",is_default:r===n.default_profile?"Yes":""}));if(o.length===0){e.output.info("No profiles configured. Run: cf config set --profile <name> --token <token>");return}let t=[{key:"name",header:"Profile",width:20},{key:"auth_method",header:"Auth",width:8},{key:"email",header:"Email",width:30},{key:"account_id",header:"Account ID",width:34},{key:"is_default",header:"Default",width:8}];e.output.table(o,t)}var Yr=p(()=>{H()});async function Xr(s,e){let{flags:n}=d(s),o=a(n,"profile");if(!o)throw new i("--profile <name> is required.");let t=M();if(!t.profiles[o])throw new i(`Profile "${o}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);if(!await C(`Delete profile "${o}"?`,e.flags)){e.output.info("Aborted.");return}let m=Ae(t,o),c=m;if(o===t.default_profile){let l=Object.keys(m.profiles);c={...m,default_profile:l[0]??"default"}}K(c),e.output.success(`Profile "${o}" deleted.`)}var Fr=p(()=>{f();H();U()});async function xr(s,e){let{positional:n}=d(s),o=n[0];if(!o)throw new i("Usage: cf config use <profile-name>");let t=M();if(!t.profiles[o])throw new i(`Profile "${o}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);t.default_profile=o,K(t),e.output.success(`Default profile set to "${o}".`)}var ei=p(()=>{f();H()});var ni={};z(ni,{run:()=>TA});async function TA(s,e){let[n,...o]=s;switch(n){case"set":return Hr(o,e);case"get":case"show":return Wr(o,e);case"list":case"ls":return Qr(o,e);case"delete":case"rm":case"remove":return Xr(o,e);case"use":case"switch":return xr(o,e);case void 0:case"--help":case"-h":e.output.raw(oi);return;default:throw new i(`Unknown config command: "${n}"
241
241
 
242
242
  ${oi}`)}}var oi=`Usage: cf config <command>
243
243
 
@@ -2474,7 +2474,7 @@ Commands:
2474
2474
  update Update a page rule
2475
2475
  delete Delete a page rule
2476
2476
 
2477
- Run 'cf page-rules <command> --help' for more information.`;var fS=p(()=>{f();nS();rS();sS();mS();cS()});H();f();function Le(s,e){let n=e??M();if(s){let l=Q(n,s);if(!l)throw new J(`Profile "${s}" not found. Available profiles: ${Object.keys(n.profiles).join(", ")||"(none)"}`);return we(l,s)}let o=process.env.CF_PROFILE;if(o){let l=Q(n,o);if(!l)throw new J(`Profile "${o}" (from CF_PROFILE) not found. Available profiles: ${Object.keys(n.profiles).join(", ")||"(none)"}`);return we(l,o)}let t=process.env.CF_API_TOKEN;if(t)return{method:"token",token:t};let r=process.env.CF_API_KEY,m=process.env.CF_API_EMAIL;if(r&&m)return{method:"key",apiKey:r,email:m};if(r&&!m)throw new J("CF_API_KEY is set but CF_API_EMAIL is missing. Both are required for API key auth.");let c=Q(n);if(c)return we(c,n.default_profile);throw new J(`No authentication credentials found.
2477
+ Run 'cf page-rules <command> --help' for more information.`;var fS=p(()=>{f();nS();rS();sS();mS();cS()});H();f();function Le(s,e){let n=e??M();if(s){let l=Q(n,s);if(!l)throw new J(`Profile "${s}" not found. Available profiles: ${Object.keys(n.profiles).join(", ")||"(none)"}`);return we(l,s)}let o=process.env.CF_PROFILE;if(o){let l=Q(n,o);if(!l)throw new J(`Profile "${o}" (from CF_PROFILE) not found. Available profiles: ${Object.keys(n.profiles).join(", ")||"(none)"}`);return we(l,o)}let t=process.env.CF_API_TOKEN??process.env.CLOUDFLARE_API_TOKEN;if(t)return{method:"token",token:t};let r=process.env.CF_API_KEY,m=process.env.CF_API_EMAIL;if(r&&m)return{method:"key",apiKey:r,email:m};if(r&&!m)throw new J("CF_API_KEY is set but CF_API_EMAIL is missing. Both are required for API key auth.");let c=Q(n);if(c)return we(c,n.default_profile);throw new J(`No authentication credentials found.
2478
2478
  Set up credentials using one of:
2479
2479
  - cf config set-profile (interactive)
2480
2480
  - CF_API_TOKEN environment variable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agileguy/cf-cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A fully-featured Cloudflare CLI wrapping the entire REST API",
5
5
  "bin": {
6
6
  "cf": "./dist/index.js"