cf 0.7.0 → 0.8.0

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 (174) hide show
  1. package/dist/_meta/agent-context.json +1 -1
  2. package/dist/_meta/commands.json +9 -112
  3. package/dist/{abuse-reports-BsF9JZPW.mjs → abuse-reports-C6GFnuYE.mjs} +1 -1
  4. package/dist/{account-D8mYiWxQ.mjs → account-DxzpnGA8.mjs} +1 -1
  5. package/dist/{accounts-CJci1Oez.mjs → accounts-6RFDuFLF.mjs} +1 -1
  6. package/dist/{acm-CmCd985Q.mjs → acm-Bndi5Jqo.mjs} +1 -1
  7. package/dist/{addressing-R7p6TRBe.mjs → addressing-C8HB4n_n.mjs} +1 -1
  8. package/dist/ai-B4La9Oqk.mjs +8 -0
  9. package/dist/{ai-audit-B0vJNOZG.mjs → ai-audit-B9kKFhoY.mjs} +1 -1
  10. package/dist/{ai-gateway-D3vJR3My.mjs → ai-gateway-Bx9MzNxL.mjs} +1 -1
  11. package/dist/{ai-search-CNg7W7U4.mjs → ai-search-BgIOIgXd.mjs} +1 -1
  12. package/dist/{alerting-_sdM0B0S.mjs → alerting-DVI-v6mE.mjs} +1 -1
  13. package/dist/{analytics-BFBJhDrP.mjs → analytics-B98epmDb.mjs} +1 -1
  14. package/dist/{analytics_engine-CWhFvyeK.mjs → analytics_engine-DwDePA2c.mjs} +1 -1
  15. package/dist/{api-gateway-D4AIEtUq.mjs → api-gateway-DW2GX64w.mjs} +1 -1
  16. package/dist/{argo-Bjk6nFfs.mjs → argo-DKEx-B66.mjs} +1 -1
  17. package/dist/{artifacts-Ba4b3iOa.mjs → artifacts-BEU8fBqt.mjs} +1 -1
  18. package/dist/{audit-logs-BE0T5All.mjs → audit-logs-DZiEPYL0.mjs} +1 -1
  19. package/dist/{auth-D_zyQbDR.mjs → auth-009DISzb.mjs} +1 -1
  20. package/dist/{auth-CZ0E51rF.mjs → auth-B1CY5zpC.mjs} +2 -2
  21. package/dist/{billing-Dz6Zj8Eq.mjs → billing-10B4_1qb.mjs} +1 -1
  22. package/dist/{bot-management-pFwIbFi-.mjs → bot-management-D51WzJBO.mjs} +1 -1
  23. package/dist/{botnet-feed-BY9uGChY.mjs → botnet-feed-Dw-leAwX.mjs} +1 -1
  24. package/dist/{brand-protection-DkPAk2Cz.mjs → brand-protection-BTYkTsER.mjs} +1 -1
  25. package/dist/{browser-extension-D9P6Yv8i.mjs → browser-extension-BFa5Ky8u.mjs} +1 -1
  26. package/dist/{browser-run-DhHtz4y3.mjs → browser-run-BMA8Z_hI.mjs} +1 -1
  27. package/dist/build-C1FOoThn.mjs +70 -0
  28. package/dist/{cache-DVhkiIGK.mjs → cache-DrX4gWvg.mjs} +1 -1
  29. package/dist/{calls-95zjvIcO.mjs → calls-m4WyL1Rb.mjs} +1 -1
  30. package/dist/{certificate-authorities-BowBqbVq.mjs → certificate-authorities-BA-S8NE-.mjs} +1 -1
  31. package/dist/{cf-BLT7uKJF.mjs → cf-BhDnTcDR.mjs} +7 -7
  32. package/dist/chunk-2SIGYDH3-_JSHaszR.mjs +473 -0
  33. package/dist/{chunk-6IEM75FG-BEjRFMGh.mjs → chunk-Q72B4Q5Z-B-N_eqrM.mjs} +1 -1
  34. package/dist/{client-certificates-D6mE4vJu.mjs → client-certificates-5h-fXoNq.mjs} +1 -1
  35. package/dist/{cloud-connector-DmwsjeFN.mjs → cloud-connector-ywFQuqtV.mjs} +1 -1
  36. package/dist/{cloudforce-one-CG3TT7IN.mjs → cloudforce-one-CPx4C-r3.mjs} +1 -1
  37. package/dist/{completions-DMc_PlIw.mjs → completions-CCRu-jvY.mjs} +1 -1
  38. package/dist/{connectivity-DJkE3crz.mjs → connectivity-y-Gav-Ge.mjs} +1 -1
  39. package/dist/{connector-interrupts-DTgQ7onV.mjs → connector-interrupts-Bs-jfuh8.mjs} +1 -1
  40. package/dist/{connector-telemetry-events-D0rTHDou.mjs → connector-telemetry-events-Bc6f3xpx.mjs} +1 -1
  41. package/dist/{connector-telemetry-snapshots--0QmD3z6.mjs → connector-telemetry-snapshots-Bl54XZ3h.mjs} +1 -1
  42. package/dist/{connectors-zWaZTi2A.mjs → connectors-BnQq_R19.mjs} +1 -1
  43. package/dist/{content-scanning-CGvGf04y.mjs → content-scanning-Bxk-WkSL.mjs} +1 -1
  44. package/dist/{ct-alerting-ebSPSWNC.mjs → ct-alerting-BSn2Jqou.mjs} +1 -1
  45. package/dist/{custom-certificates-CWUrPYLP.mjs → custom-certificates-BBqr4S9W.mjs} +1 -1
  46. package/dist/{custom-csrs-CRtdrF9R.mjs → custom-csrs-CXeBzLUy.mjs} +1 -1
  47. package/dist/{custom-hostnames-CVQSksqq.mjs → custom-hostnames-CfCOedoN.mjs} +1 -1
  48. package/dist/{custom-nameservers-BRwbIdsX.mjs → custom-nameservers-RPXeu7f_.mjs} +1 -1
  49. package/dist/{custom-pages-Ci8sTQX7.mjs → custom-pages-xGG1xo88.mjs} +1 -1
  50. package/dist/{d1-78Ym1P6D.mjs → d1-CRIOfBsJ.mjs} +1 -1
  51. package/dist/{data-security-zmFoMwRU.mjs → data-security-D5Sw5rwj.mjs} +1 -1
  52. package/dist/{dcv-delegation-Dd4FZ2IG.mjs → dcv-delegation-BBnlgr6F.mjs} +1 -1
  53. package/dist/deploy-D0_KIUpW.mjs +2 -0
  54. package/dist/deploy-input-CdWrpzPA.mjs +1178 -0
  55. package/dist/{dev-DSslyDXx.mjs → dev-Bz87BeKt.mjs} +1 -1
  56. package/dist/{diagnostics-B8Ev5m_o.mjs → diagnostics-C1qryRf4.mjs} +1 -1
  57. package/dist/{dispatch-namespaces-Dm5vGeEP.mjs → dispatch-namespaces-DbosPgPV.mjs} +1 -1
  58. package/dist/{dist-BH-4NQOV.mjs → dist-C-6VkMPZ.mjs} +35 -35
  59. package/dist/dist-CnaLMpVH.mjs +18 -0
  60. package/dist/{dns-D7VAaCyO.mjs → dns-ByufYrJH.mjs} +1 -1
  61. package/dist/{dns-firewall-ByLCsf0q.mjs → dns-firewall-CiokCKRr.mjs} +1 -1
  62. package/dist/{durable-objects-BIpvyu9m.mjs → durable-objects-DjF-WAD3.mjs} +1 -1
  63. package/dist/{email-auth-Cx--s8W4.mjs → email-auth-B4BIYMb-.mjs} +1 -1
  64. package/dist/{email-routing-CiDbivcN.mjs → email-routing-BbbtpVyS.mjs} +1 -1
  65. package/dist/{email-security-BYeAuSc6.mjs → email-security-DuBVypAO.mjs} +1 -1
  66. package/dist/{email-sending-Dg2rSmHH.mjs → email-sending-5g-k05Lv.mjs} +1 -1
  67. package/dist/{filters-DZ8YnQ90.mjs → filters-CzJmLFcS.mjs} +1 -1
  68. package/dist/{firewall-DEd1hs_I.mjs → firewall-CjmeWA2M.mjs} +1 -1
  69. package/dist/{flagship-DVw7xGoP.mjs → flagship-BfyVrWP-.mjs} +1 -1
  70. package/dist/{fraud-BbGS3FZs.mjs → fraud-reRvxNg-.mjs} +1 -1
  71. package/dist/{google-tag-gateway-CBnRGYQR.mjs → google-tag-gateway-CGwzMZU1.mjs} +1 -1
  72. package/dist/{healthchecks-Da9N3ix4.mjs → healthchecks-BhCsPWcG.mjs} +1 -1
  73. package/dist/{hostnames-mimZu2tB.mjs → hostnames-JpgQW4kn.mjs} +1 -1
  74. package/dist/{hyperdrive-BNdvxOos.mjs → hyperdrive-iwYttuwV.mjs} +1 -1
  75. package/dist/{iam-DGQ-OgRl.mjs → iam-ffI98_4v.mjs} +1 -1
  76. package/dist/{images-CI6Iy9ho.mjs → images-Bgb9DGlr.mjs} +1 -1
  77. package/dist/index.mjs +1 -1
  78. package/dist/{intel-BDB-aRtU.mjs → intel-DVRjKpyU.mjs} +1 -1
  79. package/dist/{ips-B9UuPvsY.mjs → ips-BtLRO19r.mjs} +1 -1
  80. package/dist/{keyless-certificates-Ua9uJgPt.mjs → keyless-certificates-13w8KOcC.mjs} +1 -1
  81. package/dist/{kv-BHerx4dZ.mjs → kv-CvQyF_NB.mjs} +1 -1
  82. package/dist/{leaked-credential-checks-B8Vunj9h.mjs → leaked-credential-checks-DvY8VReW.mjs} +1 -1
  83. package/dist/{load-balancers-DSjS5WKw.mjs → load-balancers-6lgExyS7.mjs} +1 -1
  84. package/dist/{logexplorer-DBIfTlRP.mjs → logexplorer-DBfrK1hn.mjs} +1 -1
  85. package/dist/{logo-matches-C00iGpzW.mjs → logo-matches-XS2RaxQu.mjs} +1 -1
  86. package/dist/{logos-CJLhx1go.mjs → logos-COtlpbRq.mjs} +1 -1
  87. package/dist/{logpush-Cr1U-eK-.mjs → logpush-CIpiK3Xl.mjs} +1 -1
  88. package/dist/{logs-DMvtchc6.mjs → logs-0KjIf_3g.mjs} +1 -1
  89. package/dist/{magic-cloud-networking-FQfO8QWH.mjs → magic-cloud-networking-q_d9-he-.mjs} +1 -1
  90. package/dist/{magic-network-monitoring-CDd70fJQ.mjs → magic-network-monitoring-DLNCrUsn.mjs} +1 -1
  91. package/dist/{magic-transit-DiKiPUax.mjs → magic-transit-sIwSlzoK.mjs} +1 -1
  92. package/dist/{managed-transforms-fPVUTrAv.mjs → managed-transforms-BKRjmzJS.mjs} +1 -1
  93. package/dist/{matches-B0yHbQ2I.mjs → matches-DZLS60M2.mjs} +1 -1
  94. package/dist/{moq-UgBawOXe.mjs → moq-Dbb9QhC1.mjs} +1 -1
  95. package/dist/{mtls-certificates-xKUbC5EL.mjs → mtls-certificates-BpIqoWpc.mjs} +1 -1
  96. package/dist/{network-interconnects-BJzOE2ny.mjs → network-interconnects-DZwGJFYT.mjs} +1 -1
  97. package/dist/{oauth-DBJ5GSFk.mjs → oauth-DC9g9uK_.mjs} +1 -1
  98. package/dist/{observability-B-1y36QS.mjs → observability-CVLjPAir.mjs} +1 -1
  99. package/dist/{open-YWOUIZ5Y-CFRcYALi.mjs → open-PBXRGS4R-D5C2-7de.mjs} +1 -1
  100. package/dist/{organization-Dq3PClZ7.mjs → organization-BGF8N1QQ.mjs} +1 -1
  101. package/dist/{organizations-AhsQkHyX.mjs → organizations-BInE8nlx.mjs} +1 -1
  102. package/dist/{origin-ca-certificates-CRgF0UyU.mjs → origin-ca-certificates-wPzWcEa0.mjs} +1 -1
  103. package/dist/{origin-post-quantum-encryption-BXTx7DPa.mjs → origin-post-quantum-encryption-t1Cl9hiy.mjs} +1 -1
  104. package/dist/{origin-tls-client-auth-BDw5q-6G.mjs → origin-tls-client-auth-Cvr9D8eq.mjs} +1 -1
  105. package/dist/{page-rules-DqYQ23eg.mjs → page-rules-CMo73oVb.mjs} +1 -1
  106. package/dist/{page-shield-DKdlZOLO.mjs → page-shield-Z23iqabu.mjs} +1 -1
  107. package/dist/{pages-BsXF11Kv.mjs → pages-ByaZvYjA.mjs} +1 -1
  108. package/dist/{pay-per-crawl-BGAwuAP3.mjs → pay-per-crawl-BXTenh_d.mjs} +1 -1
  109. package/dist/{pipelines-D_QhSnGW.mjs → pipelines-7KWm5BYN.mjs} +1 -1
  110. package/dist/{progress-O88q63Bk.mjs → progress-BLQ2xXwD.mjs} +1 -1
  111. package/dist/{prompt-DTAWiEm2.mjs → prompt-DcfYBioA.mjs} +1 -1
  112. package/dist/{queries-CAE95-OH.mjs → queries-Cgx1lQbn.mjs} +1 -1
  113. package/dist/{queues-BBz35Mqd.mjs → queues-jnugmCYI.mjs} +1 -1
  114. package/dist/{r2-Zp99S5xF.mjs → r2-Dllx7F7a.mjs} +1 -1
  115. package/dist/{r2-data-catalog-BeVLZwrE.mjs → r2-data-catalog-CaAAPwKp.mjs} +1 -1
  116. package/dist/{radar-Cij-XVQJ.mjs → radar-DLSHX2_1.mjs} +1 -1
  117. package/dist/{rate-limits-DSdToIWv.mjs → rate-limits-DlVTd6QY.mjs} +1 -1
  118. package/dist/{raw-fetch-DgezeshQ.mjs → raw-fetch-CeW1mW_u.mjs} +1 -1
  119. package/dist/{realtime-kit-9rJcapfM.mjs → realtime-kit-ct8Fu2kO.mjs} +1 -1
  120. package/dist/{registrar-CXViZlah.mjs → registrar-CKTB7QTM.mjs} +1 -1
  121. package/dist/{registrar-sandbox-CvQyjXLJ.mjs → registrar-sandbox-1-nNk6Uy.mjs} +1 -1
  122. package/dist/{request-tracers-DATfBnE9.mjs → request-tracers-DO6lno0x.mjs} +1 -1
  123. package/dist/{resource-sharing-Cmhn6ghR.mjs → resource-sharing-DYhXJw44.mjs} +1 -1
  124. package/dist/{resource-tagging-BTn05AOj.mjs → resource-tagging-CcKWMF9l.mjs} +1 -1
  125. package/dist/{rules-ens3OHme.mjs → rules-DQKR3qb7.mjs} +1 -1
  126. package/dist/{rulesets-bkreZRao.mjs → rulesets-B9fZb_JY.mjs} +1 -1
  127. package/dist/{rum-CpgXFcwl.mjs → rum-BaJio_GD.mjs} +1 -1
  128. package/dist/{schema-validation-Ca6o94ts.mjs → schema-validation-Cqv8KT1B.mjs} +1 -1
  129. package/dist/{scim-C4oT8TMc.mjs → scim-DkYH1dep.mjs} +1 -1
  130. package/dist/{secrets-store-CWEuiDNo.mjs → secrets-store-CMR_pA1t.mjs} +1 -1
  131. package/dist/{security-center-BOvm7xy6.mjs → security-center-DCHfgCq6.mjs} +1 -1
  132. package/dist/{security-txt-BCAUBctN.mjs → security-txt-D19uTyaf.mjs} +1 -1
  133. package/dist/{session-B1ARgLG7.mjs → session-CQpgz61H.mjs} +1 -1
  134. package/dist/{share-DhmVspmL.mjs → share-CfJbt0WU.mjs} +1 -1
  135. package/dist/shared-D0xvDsDl.mjs +2 -0
  136. package/dist/{smart-shield-DZm4fn6z.mjs → smart-shield-BG5WOmi1.mjs} +1 -1
  137. package/dist/{snippets-oQ0u26-z.mjs → snippets-CYiSdx7R.mjs} +1 -1
  138. package/dist/{spawn-ChG5Xi9Z.mjs → spawn-j3dn7A69.mjs} +1 -1
  139. package/dist/{spectrum-Cnkee5Ww.mjs → spectrum-Qvq3yJax.mjs} +1 -1
  140. package/dist/{speed-DqNnvLBD.mjs → speed-vpoB9msm.mjs} +1 -1
  141. package/dist/{src-By-zTCHz.mjs → src-Bn0FyQIp.mjs} +5 -5
  142. package/dist/{ssl-tS3CYZsZ.mjs → ssl-Qw8eVAiS.mjs} +1 -1
  143. package/dist/{state-OsdDJvdj.mjs → state-C2cBU9iK.mjs} +1 -1
  144. package/dist/{stream-Bud9Os5V.mjs → stream-BNbkY3zI.mjs} +1 -1
  145. package/dist/{submit-BtP8she2.mjs → submit-pQNW7uWj.mjs} +1 -1
  146. package/dist/{tenant-CMwHa-tU.mjs → tenant-xkvdAutS.mjs} +1 -1
  147. package/dist/{token-validation-BYC7HTok.mjs → token-validation-5F2AbQCz.mjs} +1 -1
  148. package/dist/triggers-CYdZhJYr.mjs +2 -0
  149. package/dist/{turnstile-CP4nScaL.mjs → turnstile-BSIaunXn.mjs} +1 -1
  150. package/dist/{ui-BNoF0KpD.mjs → ui-CTo5OG9r.mjs} +1 -1
  151. package/dist/{url-info-Chs9h7Y-.mjs → url-info-Q7m7AVih.mjs} +1 -1
  152. package/dist/{url-normalization-XYxW5Gj0.mjs → url-normalization-Bs2m5jlD.mjs} +1 -1
  153. package/dist/{url-scanner-D4pYNlO-.mjs → url-scanner-CYmT3C99.mjs} +1 -1
  154. package/dist/{user-DtefniLc.mjs → user-Bay_0p3C.mjs} +1 -1
  155. package/dist/{vectorize-BeAY2g-7.mjs → vectorize-cP2OuB5N.mjs} +1 -1
  156. package/dist/{versions-dMW3bLVv.mjs → versions-D7F26fhH.mjs} +1 -1
  157. package/dist/{waiting-rooms-K78HeeTg.mjs → waiting-rooms-B5HR1-37.mjs} +1 -1
  158. package/dist/{web3-Dhw79l4S.mjs → web3-DqCXM4sx.mjs} +1 -1
  159. package/dist/{workers-l3zMNOU6.mjs → workers-Cu-A8AZc.mjs} +1 -1
  160. package/dist/{workers-builds-CuOAB3u4.mjs → workers-builds-CmCg27M-.mjs} +1 -1
  161. package/dist/{workflows-rb7RYBKP.mjs → workflows-DavS4SEh.mjs} +1 -1
  162. package/dist/{zaraz-CHecMYuo.mjs → zaraz-CKcVy5Xa.mjs} +1 -1
  163. package/dist/{zero-trust-DAZoa-Aj.mjs → zero-trust-BKVqb2yq.mjs} +1 -1
  164. package/dist/{zone-BnnqJwW-.mjs → zone-BOcuY4sU.mjs} +1 -1
  165. package/dist/{zones-DpI2YikF.mjs → zones-BR-9WaY7.mjs} +1 -1
  166. package/package.json +5 -4
  167. package/dist/ai-BzJg0RIX.mjs +0 -3
  168. package/dist/build-CWuStmDi.mjs +0 -2
  169. package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +0 -397
  170. package/dist/deploy-CVvkZFjR.mjs +0 -2
  171. package/dist/lib-Og5sB51C.mjs +0 -68
  172. package/dist/shared-Bod3-Exx.mjs +0 -990
  173. /package/dist/{schema-DCF4yEp_.mjs → schema-DAW-B7wT.mjs} +0 -0
  174. /package/dist/{tools-Dru4l8yh.mjs → tools-BpNGzfj2.mjs} +0 -0
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./prompt-DTAWiEm2.mjs";import{t as c}from"./cli-types-CFw6Xygp.mjs";import{n as l,t as u}from"./raw-fetch-DgezeshQ.mjs";function d(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`artifactsNamespacesGet <namespace>`,describe:`Returns an Artifacts namespace summary.`,builder:d,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsNamespacesGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}`,pathParams:{namespace:String(s.namespace??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.artifacts.namespaces.artifactsNamespacesGet({account_id:l,namespace:s.namespace})),{successLabel:`Loaded`})}};function p(e){return e.option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`artifactsNamespacesList`,describe:`Lists Artifacts namespaces for an account.`,builder:p,handler:async s=>{let c={limit:s.limit,cursor:s.cursor};if(s.dryRun){i({command:`cf artifacts namespaces artifactsNamespacesList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.artifacts.namespaces.artifactsNamespacesList({account_id:u,...c})),{successLabel:`Loaded`})}};function h(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const g={command:`artifactsReposBlobGet <hash>`,describe:`Returns raw bytes for an immutable Git blob object. Blob responses are cacheable forever by hash.`,builder:h,handler:async r=>{if(r.dryRun){i({command:`cf artifacts namespaces artifactsReposBlobGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${r.namespace==null?`<namespace>`:encodeURIComponent(String(r.namespace))}/repos/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/blob/${r.hash==null?`<hash>`:encodeURIComponent(String(r.hash))}`,pathParams:{namespace:String(r.namespace??``),name:String(r.name??``),hash:String(r.hash??``)},bodyKind:`none`});return}await n(r);let s=r.local?o:await t();r.accountId=s;let c=await a(`Loading`,async()=>u(`/accounts/${s}/artifacts/namespaces/${encodeURIComponent(String(r.namespace))}/repos/${encodeURIComponent(String(r.name))}/blob/${encodeURIComponent(String(r.hash))}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}));l(r.text===!0?c.toString(`utf-8`):c)}};function _(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`artifactsReposCommitGet <hash>`,describe:`Returns decoded metadata for an immutable Git commit object. Commit responses are cacheable forever by hash.`,builder:_,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposCommitGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/commit/${s.hash==null?`<hash>`:encodeURIComponent(String(s.hash))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``),hash:String(s.hash??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.artifacts.namespaces.artifactsReposCommitGet({account_id:l,namespace:s.namespace,name:s.name,hash:s.hash})),{successLabel:`Loaded`})}};function y(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`artifactsReposCreate <namespace>`,describe:`Creates a Git-compatible Artifacts repository in a namespace.`,builder:y,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposCreate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos`,pathParams:{namespace:String(s.namespace??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Creating`,async()=>c.artifacts.namespaces.artifactsReposCreate({account_id:l,namespace:s.namespace})),{successLabel:`Created`})}};function x(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`artifactsReposDelete <name>`,describe:`Deletes a repository and schedules cleanup of its backing data.`,builder:x,handler:async c=>{if(c.dryRun){i({command:`cf artifacts namespaces artifactsReposDelete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${c.namespace==null?`<namespace>`:encodeURIComponent(String(c.namespace))}/repos/${c.name==null?`<name>`:encodeURIComponent(String(c.name))}`,pathParams:{namespace:String(c.namespace??``),name:String(c.name??``)},bodyKind:`none`});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,!await s({force:!!c.force})){process.stderr.write(`Aborted.
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./prompt-DcfYBioA.mjs";import{t as c}from"./cli-types-CFw6Xygp.mjs";import{n as l,t as u}from"./raw-fetch-CeW1mW_u.mjs";function d(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`artifactsNamespacesGet <namespace>`,describe:`Returns an Artifacts namespace summary.`,builder:d,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsNamespacesGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}`,pathParams:{namespace:String(s.namespace??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.artifacts.namespaces.artifactsNamespacesGet({account_id:l,namespace:s.namespace})),{successLabel:`Loaded`})}};function p(e){return e.option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`artifactsNamespacesList`,describe:`Lists Artifacts namespaces for an account.`,builder:p,handler:async s=>{let c={limit:s.limit,cursor:s.cursor};if(s.dryRun){i({command:`cf artifacts namespaces artifactsNamespacesList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.artifacts.namespaces.artifactsNamespacesList({account_id:u,...c})),{successLabel:`Loaded`})}};function h(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const g={command:`artifactsReposBlobGet <hash>`,describe:`Returns raw bytes for an immutable Git blob object. Blob responses are cacheable forever by hash.`,builder:h,handler:async r=>{if(r.dryRun){i({command:`cf artifacts namespaces artifactsReposBlobGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${r.namespace==null?`<namespace>`:encodeURIComponent(String(r.namespace))}/repos/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/blob/${r.hash==null?`<hash>`:encodeURIComponent(String(r.hash))}`,pathParams:{namespace:String(r.namespace??``),name:String(r.name??``),hash:String(r.hash??``)},bodyKind:`none`});return}await n(r);let s=r.local?o:await t();r.accountId=s;let c=await a(`Loading`,async()=>u(`/accounts/${s}/artifacts/namespaces/${encodeURIComponent(String(r.namespace))}/repos/${encodeURIComponent(String(r.name))}/blob/${encodeURIComponent(String(r.hash))}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}));l(r.text===!0?c.toString(`utf-8`):c)}};function _(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`artifactsReposCommitGet <hash>`,describe:`Returns decoded metadata for an immutable Git commit object. Commit responses are cacheable forever by hash.`,builder:_,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposCommitGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/commit/${s.hash==null?`<hash>`:encodeURIComponent(String(s.hash))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``),hash:String(s.hash??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.artifacts.namespaces.artifactsReposCommitGet({account_id:l,namespace:s.namespace,name:s.name,hash:s.hash})),{successLabel:`Loaded`})}};function y(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`artifactsReposCreate <namespace>`,describe:`Creates a Git-compatible Artifacts repository in a namespace.`,builder:y,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposCreate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos`,pathParams:{namespace:String(s.namespace??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Creating`,async()=>c.artifacts.namespaces.artifactsReposCreate({account_id:l,namespace:s.namespace})),{successLabel:`Created`})}};function x(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`artifactsReposDelete <name>`,describe:`Deletes a repository and schedules cleanup of its backing data.`,builder:x,handler:async c=>{if(c.dryRun){i({command:`cf artifacts namespaces artifactsReposDelete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${c.namespace==null?`<namespace>`:encodeURIComponent(String(c.namespace))}/repos/${c.name==null?`<name>`:encodeURIComponent(String(c.name))}`,pathParams:{namespace:String(c.namespace??``),name:String(c.name??``)},bodyKind:`none`});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,!await s({force:!!c.force})){process.stderr.write(`Aborted.
3
3
  `);return}r(await a(`Deleting`,async()=>l.artifacts.namespaces.artifactsReposDelete({account_id:u,namespace:c.namespace,name:c.name})),{successLabel:`Deleted`})}};function C(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or commit hash.`,demandOption:!0}).option(`path`,{type:`string`,description:`File path.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const w={command:`artifactsReposFileGet <name>`,describe:`Returns raw bytes for a file resolved by ref and path.`,builder:C,handler:async r=>{let s={ref:r.ref,path:r.path};if(r.dryRun){i({command:`cf artifacts namespaces artifactsReposFileGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${r.namespace==null?`<namespace>`:encodeURIComponent(String(r.namespace))}/repos/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/file`,pathParams:{namespace:String(r.namespace??``),name:String(r.name??``)},query:s,bodyKind:`none`});return}await n(r);let c=r.local?o:await t();r.accountId=c;let d=new URLSearchParams(Object.entries(s).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),f=await a(`Loading`,async()=>u(`/accounts/${c}/artifacts/namespaces/${encodeURIComponent(String(r.namespace))}/repos/${encodeURIComponent(String(r.name))}/file${d?`?`+d:``}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}));l(r.text===!0?f.toString(`utf-8`):f)}};function T(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`artifactsReposFork <name>`,describe:`Forks a source repository into a new repository.`,builder:T,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposFork`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/fork`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Creating`,async()=>c.artifacts.namespaces.artifactsReposFork({account_id:l,namespace:s.namespace,name:s.name})),{successLabel:`Created`})}};function D(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`artifactsReposGet <name>`,describe:`Returns repository metadata.`,builder:D,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.artifacts.namespaces.artifactsReposGet({account_id:l,namespace:s.namespace,name:s.name})),{successLabel:`Loaded`})}};function k(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`artifactsReposImport <name>`,describe:`Imports an HTTPS Git repository into an Artifacts repository.`,builder:k,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposImport`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/import`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Creating`,async()=>c.artifacts.namespaces.artifactsReposImport({account_id:l,namespace:s.namespace,name:s.name})),{successLabel:`Created`})}};function j(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`search`,{type:`string`,description:`Search`}).option(`sort`,{type:`string`,description:`Sort`,choices:[`created_at`,`updated_at`,`last_push_at`,`name`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`artifactsReposList <namespace>`,describe:`Lists repositories in a namespace.`,builder:c(j),handler:async s=>{let c={limit:s.limit,cursor:s.cursor,search:s.search,sort:s.sort,direction:s.direction};if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos`,pathParams:{namespace:String(s.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.artifacts.namespaces.artifactsReposList({account_id:u,namespace:s.namespace,...c})),{successLabel:`Loaded`})}};function N(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or commit hash. Defaults to HEAD.`}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`artifactsReposLogGet <name>`,describe:`Returns commit metadata walking backwards from a ref, branch, tag, or HEAD.`,builder:N,handler:async s=>{let c={ref:s.ref,limit:s.limit,offset:s.offset};if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposLogGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/log`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.artifacts.namespaces.artifactsReposLogGet({account_id:u,namespace:s.namespace,name:s.name,...c})),{successLabel:`Loaded`})}};function F(e){return e.positional(`path`,{type:`string`,description:`File path. May contain slashes.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or 40-character commit hash.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const I={command:`artifactsReposRawGet <path>`,describe:`Returns file bytes resolved by ref and path, with a sniffed content type and browser-safe response headers.`,builder:F,handler:async r=>{if(r.dryRun){i({command:`cf artifacts namespaces artifactsReposRawGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${r.namespace==null?`<namespace>`:encodeURIComponent(String(r.namespace))}/repos/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/raw/${r.ref==null?`<ref>`:encodeURIComponent(String(r.ref))}/${r.path==null?`<path>`:encodeURIComponent(String(r.path))}`,pathParams:{namespace:String(r.namespace??``),name:String(r.name??``),ref:String(r.ref??``),path:String(r.path??``)},bodyKind:`none`});return}await n(r);let s=r.local?o:await t();r.accountId=s;let c=await a(`Loading`,async()=>u(`/accounts/${s}/artifacts/namespaces/${encodeURIComponent(String(r.namespace))}/repos/${encodeURIComponent(String(r.name))}/raw/${encodeURIComponent(String(r.ref))}/${encodeURIComponent(String(r.path))}`,{method:`GET`,localEndpoint:r.local?r.localEndpoint:void 0}));l(r.text===!0?c.toString(`utf-8`):c)}};function L(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`artifactsReposTreeGet <hash>`,describe:`Returns decoded entries for an immutable Git tree object. Tree responses are cacheable forever by hash.`,builder:L,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsReposTreeGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/tree/${s.hash==null?`<hash>`:encodeURIComponent(String(s.hash))}`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``),hash:String(s.hash??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.artifacts.namespaces.artifactsReposTreeGet({account_id:l,namespace:s.namespace,name:s.name,hash:s.hash})),{successLabel:`Loaded`})}};function z(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`state`,{type:`string`,description:`State`,choices:[`active`,`expired`,`revoked`,`all`]}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`artifactsRepoTokensList <name>`,describe:`Lists tokens for a repository.`,builder:c(z),handler:async s=>{let c={state:s.state,page:s.page,per_page:s[`per-page`]};if(s.dryRun){i({command:`cf artifacts namespaces artifactsRepoTokensList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/repos/${s.name==null?`<name>`:encodeURIComponent(String(s.name))}/tokens`,pathParams:{namespace:String(s.namespace??``),name:String(s.name??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.artifacts.namespaces.artifactsRepoTokensList({account_id:u,namespace:s.namespace,name:s.name,...c})),{successLabel:`Loaded`})}};function V(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`artifactsTokensCreate <namespace>`,describe:`Creates a scoped Git token for a repository.`,builder:V,handler:async s=>{if(s.dryRun){i({command:`cf artifacts namespaces artifactsTokensCreate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${s.namespace==null?`<namespace>`:encodeURIComponent(String(s.namespace))}/tokens`,pathParams:{namespace:String(s.namespace??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Creating`,async()=>c.artifacts.namespaces.artifactsTokensCreate({account_id:l,namespace:s.namespace})),{successLabel:`Created`})}};function U(e){return e.positional(`id`,{type:`string`,description:`Token ID. Must match /^[0-9a-z]{16}$/.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const W={command:`artifactsTokensRevoke <id>`,describe:`Revokes an Artifacts repository token.`,builder:U,handler:async c=>{if(c.dryRun){i({command:`cf artifacts namespaces artifactsTokensRevoke`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/artifacts/namespaces/${c.namespace==null?`<namespace>`:encodeURIComponent(String(c.namespace))}/tokens/${c.id==null?`<id>`:encodeURIComponent(String(c.id))}`,pathParams:{namespace:String(c.namespace??``),id:String(c.id??``)},bodyKind:`none`});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,!await s({force:!!c.force})){process.stderr.write(`Aborted.
4
4
  `);return}r(await a(`Deleting`,async()=>l.artifacts.namespaces.artifactsTokensRevoke({account_id:u,namespace:c.namespace,id:c.id})),{successLabel:`Deleted`})}},G={command:`namespaces`,describe:`Operations for namespaces`,builder:e=>e.command(f).command(m).command(B).command(g).command(v).command(b).command(S).command(w).command(E).command(O).command(A).command(M).command(P).command(I).command(R).command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},K={command:`artifacts`,describe:`artifacts`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{K as default};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./cli-types-CFw6Xygp.mjs";function c(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Gets a list of audit logs for an account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:s(c),handler:async s=>{let c={id:s.id,export:s.export,"action.type":s[`action-type`],"actor.ip":s[`actor-ip`],"actor.email":s[`actor-email`],since:s.since,before:s.before,"zone.name":s[`zone-name`],direction:s.direction,per_page:s[`per-page`],page:s.page,hide_user_logs:s[`hide-user-logs`]};if(s.dryRun){i({command:`cf audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/audit_logs`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.auditLogs.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`audit-logs`,describe:`Immutable audit trail of actions taken by account members — who changed what and when`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./cli-types-CFw6Xygp.mjs";function c(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Gets a list of audit logs for an account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:s(c),handler:async s=>{let c={id:s.id,export:s.export,"action.type":s[`action-type`],"actor.ip":s[`actor-ip`],"actor.email":s[`actor-email`],since:s.since,before:s.before,"zone.name":s[`zone-name`],direction:s.direction,per_page:s[`per-page`],page:s.page,hide_user_logs:s[`hide-user-logs`]};if(s.dryRun){i({command:`cf audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/audit_logs`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.auditLogs.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`audit-logs`,describe:`Immutable audit trail of actions taken by account members — who changed what and when`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{o as e,p as t}from"./chunk-2SIGYDH3-qXx_zE6v.mjs";import{a as n}from"./theme-DbNbIY4d.mjs";import{n as r,r as i,t as a}from"./ui-BNoF0KpD.mjs";import{a as o,c as s,d as c,i as l,n as u,o as d,r as f,s as p,t as m,u as h}from"./oauth-DBJ5GSFk.mjs";import{r as g,t as _}from"./auth-CZ0E51rF.mjs";import{t as v}from"./output-B6fBFRqe.mjs";import y from"node:path";function b(e,t,n){if(!e.profile)return;let r=n?` ${n}`:``;throw Error(`The --profile flag cannot be used with \`cf auth ${t}\`.${r}`)}function x(){if(e({allowGlobalAuthKey:!1})!==void 0)throw Error(`Cannot manage auth profiles while CLOUDFLARE_API_TOKEN is set. Unset CLOUDFLARE_API_TOKEN and try again.`)}const S={command:`create <name>`,describe:`Create or re-authenticate a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name for the auth profile`,demandOption:!0}).option(`browser`,{type:`boolean`,description:`Open a browser to complete login (use --no-browser to print the URL instead)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async e=>{b(e,`create`,"Pass the profile name as the command argument: `cf auth create <name>`."),x(),t(e.name);let i=l().configs.exists(e.name);await p({browser:e.browser,scopes:e.scopes,profile:e.name}),console.log(r(i?`Profile "${e.name}" re-authenticated.`:`Profile "${e.name}" created.`)),console.log(a(`Run ${n.code(`cf auth activate ${e.name}`)} to use this profile in a directory.`))}},C={command:`delete <name>`,describe:`Delete a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to delete`,demandOption:!0}),handler:async e=>{b(e,`delete`),x(),t(e.name);let i=l();if(!i.configs.exists(e.name))throw Error(`Profile "${e.name}" does not exist.`);let o=i.bindings.removeAllBindingsForProfile(e.name);if(o.length>0){console.log(r(`Removed directory bindings:`));for(let e of o)console.log(` ${e}`)}await s(e.name),i.configs.delete(e.name),console.log(r(`Profile "${e.name}" deleted.`));let c=i.bindings.getProfileForDirectory(process.cwd());c?console.log(r(`Active profile for this directory: ${c}.`)):i.configs.exists(`default`)?console.log(r(`This directory now uses the default profile.`)):console.log(a(`No active profile for this directory. Run ${n.code(`cf auth login`)} to set up the default profile, or ${n.code(`cf auth create <name>`)} to create a named profile.`))}},w={command:`activate <name> [dir]`,describe:`Bind a named auth profile to a directory`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to activate`,demandOption:!0}).positional(`dir`,{type:`string`,description:`Directory to bind the profile to (defaults to current directory)`}),handler:e=>{b(e,`activate`,"Pass the profile name as the command argument: `cf auth activate <name>`."),x(),t(e.name);let n=l();if(!n.configs.exists(e.name))throw Error(`Profile "${e.name}" does not exist. Run \`cf auth create ${e.name}\` first.`);let i=e.dir??process.cwd();n.bindings.activate(e.name,i),console.log(r(`Profile "${e.name}" activated for "${y.resolve(i)}".`))}},T={command:`deactivate [dir]`,describe:`Remove the auth profile binding from a directory`,builder:e=>e.positional(`dir`,{type:`string`,description:`Directory to unbind (defaults to current directory). Must be the exact directory the profile was bound to.`}),handler:e=>{b(e,`deactivate`),x();let t=l(),i=e.dir??process.cwd(),{removedProfile:o,newResolution:s}=t.bindings.deactivate(i);console.log(r(`Profile "${o}" deactivated from "${y.resolve(i)}".`)),s.profile===void 0?console.log(a(`Run ${n.code(`cf auth login`)} to set up the default profile, or ${n.code(`cf auth create <name>`)} to create a named profile.`)):s.profile===`default`?console.log(r(`This directory now uses the default profile.`)):console.log(r(`Now using: ${s.profile} (${s.source}).`))}},E={command:`list`,describe:`List all auth profiles`,handler:e=>{b(e,`list`);let t=l(),n=t.bindings.read(),r={};for(let[e,t]of Object.entries(n))(r[t]??=[]).push(e);v(t.configs.list().map(e=>({name:e,boundDirectories:r[e]??[]})))}},D={command:`login`,describe:`Authenticate with Cloudflare`,builder:e=>e.option(`force`,{type:`boolean`,alias:`f`,description:`Force re-authentication even if already logged in`,default:!1}).option(`browser`,{type:`boolean`,description:`Open a browser to complete login (use --no-browser to print the URL instead)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async e=>{b(e,`login`,"Run `cf auth create <name>` to authenticate a named profile.");let t=u();if(t!==`default`&&console.log(i(`This directory has profile "${t}" active. \`cf auth login\` updates the default profile, not "${t}".\nTo re-authenticate "${t}", run \`cf auth create ${t}\`.`)),c(`default`),!e.force&&d()){if(await o()){let e=h();console.log(r(`You are already logged in.`)),console.log(`${n.info(`Config file:`)} ${n.muted(f())}`),e?.expiration_time&&console.log(`${n.info(`Token expires:`)} ${new Date(e.expiration_time).toLocaleString()}`),console.log(a(`Run ${n.code(`cf auth login --force`)} to re-authenticate, or ${n.code(`cf auth logout`)} to log out.`));return}console.log(i(`Existing tokens are invalid or expired. Starting fresh login...
2
+ import{o as e,p as t}from"./chunk-2SIGYDH3-_JSHaszR.mjs";import{a as n}from"./theme-DbNbIY4d.mjs";import{n as r,r as i,t as a}from"./ui-CTo5OG9r.mjs";import{a as o,c as s,d as c,i as l,n as u,o as d,r as f,s as p,t as m,u as h}from"./oauth-DC9g9uK_.mjs";import{r as g,t as _}from"./auth-B1CY5zpC.mjs";import{t as v}from"./output-B6fBFRqe.mjs";import y from"node:path";function b(e,t,n){if(!e.profile)return;let r=n?` ${n}`:``;throw Error(`The --profile flag cannot be used with \`cf auth ${t}\`.${r}`)}function x(){if(e({allowGlobalAuthKey:!1})!==void 0)throw Error(`Cannot manage auth profiles while CLOUDFLARE_API_TOKEN is set. Unset CLOUDFLARE_API_TOKEN and try again.`)}const S={command:`create <name>`,describe:`Create or re-authenticate a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name for the auth profile`,demandOption:!0}).option(`browser`,{type:`boolean`,description:`Open a browser to complete login (use --no-browser to print the URL instead)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async e=>{b(e,`create`,"Pass the profile name as the command argument: `cf auth create <name>`."),x(),t(e.name);let i=l().configs.exists(e.name);await p({browser:e.browser,scopes:e.scopes,profile:e.name}),console.log(r(i?`Profile "${e.name}" re-authenticated.`:`Profile "${e.name}" created.`)),console.log(a(`Run ${n.code(`cf auth activate ${e.name}`)} to use this profile in a directory.`))}},C={command:`delete <name>`,describe:`Delete a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to delete`,demandOption:!0}),handler:async e=>{b(e,`delete`),x(),t(e.name);let i=l();if(!i.configs.exists(e.name))throw Error(`Profile "${e.name}" does not exist.`);let o=i.bindings.removeAllBindingsForProfile(e.name);if(o.length>0){console.log(r(`Removed directory bindings:`));for(let e of o)console.log(` ${e}`)}await s(e.name),i.configs.delete(e.name),console.log(r(`Profile "${e.name}" deleted.`));let c=i.bindings.getProfileForDirectory(process.cwd());c?console.log(r(`Active profile for this directory: ${c}.`)):i.configs.exists(`default`)?console.log(r(`This directory now uses the default profile.`)):console.log(a(`No active profile for this directory. Run ${n.code(`cf auth login`)} to set up the default profile, or ${n.code(`cf auth create <name>`)} to create a named profile.`))}},w={command:`activate <name> [dir]`,describe:`Bind a named auth profile to a directory`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to activate`,demandOption:!0}).positional(`dir`,{type:`string`,description:`Directory to bind the profile to (defaults to current directory)`}),handler:e=>{b(e,`activate`,"Pass the profile name as the command argument: `cf auth activate <name>`."),x(),t(e.name);let n=l();if(!n.configs.exists(e.name))throw Error(`Profile "${e.name}" does not exist. Run \`cf auth create ${e.name}\` first.`);let i=e.dir??process.cwd();n.bindings.activate(e.name,i),console.log(r(`Profile "${e.name}" activated for "${y.resolve(i)}".`))}},T={command:`deactivate [dir]`,describe:`Remove the auth profile binding from a directory`,builder:e=>e.positional(`dir`,{type:`string`,description:`Directory to unbind (defaults to current directory). Must be the exact directory the profile was bound to.`}),handler:e=>{b(e,`deactivate`),x();let t=l(),i=e.dir??process.cwd(),{removedProfile:o,newResolution:s}=t.bindings.deactivate(i);console.log(r(`Profile "${o}" deactivated from "${y.resolve(i)}".`)),s.profile===void 0?console.log(a(`Run ${n.code(`cf auth login`)} to set up the default profile, or ${n.code(`cf auth create <name>`)} to create a named profile.`)):s.profile===`default`?console.log(r(`This directory now uses the default profile.`)):console.log(r(`Now using: ${s.profile} (${s.source}).`))}},E={command:`list`,describe:`List all auth profiles`,handler:e=>{b(e,`list`);let t=l(),n=t.bindings.read(),r={};for(let[e,t]of Object.entries(n))(r[t]??=[]).push(e);v(t.configs.list().map(e=>({name:e,boundDirectories:r[e]??[]})))}},D={command:`login`,describe:`Authenticate with Cloudflare`,builder:e=>e.option(`force`,{type:`boolean`,alias:`f`,description:`Force re-authentication even if already logged in`,default:!1}).option(`browser`,{type:`boolean`,description:`Open a browser to complete login (use --no-browser to print the URL instead)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async e=>{b(e,`login`,"Run `cf auth create <name>` to authenticate a named profile.");let t=u();if(t!==`default`&&console.log(i(`This directory has profile "${t}" active. \`cf auth login\` updates the default profile, not "${t}".\nTo re-authenticate "${t}", run \`cf auth create ${t}\`.`)),c(`default`),!e.force&&d()){if(await o()){let e=h();console.log(r(`You are already logged in.`)),console.log(`${n.info(`Config file:`)} ${n.muted(f())}`),e?.expiration_time&&console.log(`${n.info(`Token expires:`)} ${new Date(e.expiration_time).toLocaleString()}`),console.log(a(`Run ${n.code(`cf auth login --force`)} to re-authenticate, or ${n.code(`cf auth logout`)} to log out.`));return}console.log(i(`Existing tokens are invalid or expired. Starting fresh login...
3
3
  `))}else e.force&&d()&&console.log(r(`Re-authenticating...
4
4
  `));if(console.log(r(`Starting OAuth login flow...
5
5
  `)),!await p({browser:e.browser,scopes:e.scopes,profile:`default`})){console.log(i(`CLOUDFLARE_API_TOKEN is set and takes precedence. Unset it to log in via OAuth.`));return}let s=h();console.log(`${n.info(`Config file:`)} ${n.muted(f())}`),s?.scopes&&console.log(`${n.info(`Scopes:`)} ${s.scopes.join(`, `)}`),s?.expiration_time&&console.log(`${n.info(`Token expires:`)} ${new Date(s.expiration_time).toLocaleString()}`)}},O={command:`logout`,describe:`Log out and remove stored credentials`,handler:async e=>{b(e,`logout`,"Run `cf auth delete <name>` to remove a named profile.");let t=u();t!==`default`&&console.log(i(`This directory has profile "${t}" active. \`cf auth logout\` removes the default profile's token, not "${t}".\nTo delete "${t}", run \`cf auth delete ${t}\`.`)),c(`default`);let o=d(),l=!!process.env.CLOUDFLARE_API_TOKEN;if(!o){l?(console.log(r(`No cf OAuth credentials found, but CLOUDFLARE_API_TOKEN environment variable is set.`)),console.log(r(`Unset it with: unset CLOUDFLARE_API_TOKEN`))):(console.log(r(`You are not currently logged in.`)),console.log(a(`Run ${n.code(`cf auth login`)} to authenticate.`)));return}console.log(r(`Logging out...`)),await s(`default`),console.log(`${n.info(`Removed:`)} OAuth tokens from ${n.muted(f())}`),l&&(console.log(``),console.log(i(`CLOUDFLARE_API_TOKEN environment variable is still set.`)),console.log(r(`You will remain authenticated via the env var. Unset it with: unset CLOUDFLARE_API_TOKEN`)))}},k={command:`whoami`,describe:`Show current user and authentication status`,builder:e=>e,handler:async e=>{let t=process.env.CLOUDFLARE_API_TOKEN,n=h(),r;r=t?`CLOUDFLARE_API_TOKEN environment variable`:n?.oauth_token?`OAuth token from ${f()}`:`none`;let i;try{i=await g()}catch{v({authenticated:!1,error:`Not logged in`});return}let a=_({apiToken:i}),o,s=[],[c,l]=await Promise.allSettled([a.user.get(),m()]);if(c.status===`fulfilled`){let e=c.value;e&&`email`in e&&typeof e.email==`string`&&(o=e.email)}else process.env.DEBUG&&console.error(`User lookup error:`,c.reason);l.status===`fulfilled`?s=l.value:process.env.DEBUG&&console.error(`Account lookup error:`,l.reason);let u=c.status===`fulfilled`||l.status===`fulfilled`,d={authenticated:!0,authSource:r,tokenValid:u,...o&&{email:o},accounts:s};n?.oauth_token&&(d.scopes=n.scopes,d.expiresAt=n.expiration_time),v(d)}},A={command:`auth`,describe:`Manage authentication and profiles`,builder:e=>e.command(D).command(O).command(k).command(S).command(C).command(w).command(T).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{A as default};
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{i as e}from"./session-B1ARgLG7.mjs";import{n as t,r as n,t as r}from"./sdk-pQ5kaGUX.mjs";import{O as i,o as a}from"./chunk-2SIGYDH3-qXx_zE6v.mjs";import{T as o,a as s,f as c,m as l}from"./oauth-DBJ5GSFk.mjs";import{execSync as u}from"child_process";import d from"os";function f(e){try{let t=u(`ps -p ${e} -o pid=,ppid=,command=`,{encoding:`utf8`,timeout:5e3}).trim();if(!t)return null;let[n,r,...i]=t.split(/\s+/),a=n?parseInt(n,10):NaN,o=r?parseInt(r,10):NaN;return isNaN(a)||isNaN(o)?null:{pid:a,ppid:o,command:i.join(` `)||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function p(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=f(r);if(!e||e.ppid===0||e.ppid===1)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function m(e){try{let t=u(`wmic process where (ProcessId=${e}) get ProcessId,ParentProcessId,CommandLine /format:csv`,{encoding:`utf8`,timeout:1e4});if(!t)return null;let n=t.split(`
3
- `).filter(e=>e.trim()&&!e.startsWith(`Node`)).pop()?.split(`,`);if(!n||n.length<4)return null;let[r,i,a,o]=n,s=o?parseInt(o.trim(),10):NaN,c=a?parseInt(a.trim(),10):NaN;return isNaN(s)||isNaN(c)?null:{pid:s,ppid:c,command:i?.trim()||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function h(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=m(r);if(!e||e.ppid===0||e.ppid===4)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function g(e=process.pid){if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(`PID must be a positive integer`);return d.platform()===`win32`?h(e):p(e)}const _=[{id:`opencode`,name:`OpenCode`,type:`agent`,envVars:[{any:[`OPENCODE`,`OPENCODE_BIN_PATH`,`OPENCODE_SERVER`,`OPENCODE_APP_INFO`,`OPENCODE_MODES`]}]},{id:`jules`,name:`Jules`,type:`agent`,envVars:[{all:[[`HOME`,`/home/jules`],[`USER`,`swebot`]]}]},{id:`claude-code`,name:`Claude Code`,type:`agent`,envVars:[`CLAUDECODE`]},{id:`cursor-agent`,name:`Cursor Agent`,type:`agent`,envVars:[{all:[`CURSOR_TRACE_ID`,[`PAGER`,`head -n 10000 | cat`]]}]},{id:`cursor`,name:`Cursor`,type:`interactive`,envVars:[`CURSOR_TRACE_ID`]},{id:`gemini-agent`,name:`Gemini Agent`,type:`agent`,processChecks:[`gemini`]},{id:`codex`,name:`OpenAI Codex`,type:`agent`,processChecks:[`codex`]},{id:`replit`,name:`Replit`,type:`agent`,envVars:[`REPL_ID`]},{id:`aider`,name:`Aider`,type:`agent`,envVars:[`AIDER_API_KEY`],processChecks:[`aider`]},{id:`bolt-agent`,name:`Bolt.new Agent`,type:`agent`,envVars:[{all:[[`SHELL`,`/bin/jsh`],`npm_config_yes`]}]},{id:`bolt`,name:`Bolt.new`,type:`interactive`,envVars:[{all:[[`SHELL`,`/bin/jsh`]],none:[`npm_config_yes`]}]},{id:`zed-agent`,name:`Zed Agent`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`zed`],[`PAGER`,`cat`]]}]},{id:`zed`,name:`Zed`,type:`interactive`,envVars:[{all:[[`TERM_PROGRAM`,`zed`]],none:[[`PAGER`,`cat`]]}]},{id:`replit-assistant`,name:`Replit Assistant`,type:`agent`,envVars:[{all:[`REPL_ID`,[`REPLIT_MODE`,`assistant`]]}]},{id:`replit`,name:`Replit`,type:`interactive`,envVars:[{all:[`REPL_ID`],none:[[`REPLIT_MODE`,`assistant`]]}]},{id:`windsurf`,name:`Windsurf`,type:`agent`,envVars:[`CODEIUM_EDITOR_APP_ROOT`]},{id:`crush`,name:`Crush`,type:`agent`,processChecks:[`crush`]},{id:`vscode-copilot-agent`,name:`GitHub Copilot in VS Code`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`vscode`],[`GIT_PAGER`,`cat`]]}]},{id:`warp`,name:`Warp Terminal`,type:`hybrid`,envVars:[{all:[[`TERM_PROGRAM`,`WarpTerminal`]]}]},{id:`octofriend`,name:`Octofriend`,type:`agent`,processChecks:[`octofriend`]}];function v(e,t=process.env){let[n,r]=typeof e==`string`?[e,void 0]:e,i=t[n];return!!(i&&(!r||i===r))}function y(e,t){try{let n=t??g();for(let t of n)if(t.command?.includes(e))return!0}catch{}return!1}function b(e,t=process.env){if(typeof e==`string`||Array.isArray(e))return v(e,t);let{any:n,all:r,none:i}=e,a=!n?.length||n.some(e=>v(e,t)),o=!r?.length||r.every(e=>v(e,t)),s=!i?.length||!i.some(e=>v(e,t));return a&&o&&s}function x(e){return e.customDetectors?.some(e=>{try{return e()}catch{return!1}})??!1}function S(e){return{isAgentic:!0,id:e.id,name:e.name,type:e.type}}function C(e=process.env,t){for(let t of _)if(t.envVars?.some(t=>b(t,e)))return S(t);let n=t,r=()=>{if(n===void 0)try{n=g()}catch{n=[]}return n};for(let e of _)if(e.processChecks?.some(e=>y(e,r())))return S(e);for(let e of _)if(x(e))return S(e);return{isAgentic:!1,id:null,name:null,type:null}}function w(){return c?`ci`:l()?`interactive`:`non-interactive`}function T(){let t=C(),n=t.isAgentic&&t.id!==null?{"X-CF-CLI-Agent":t.id}:{};return{"User-Agent":e,"X-CF-CLI-Mode":w(),...n}}const E=3e4,D=t.Default;function O(e){return e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream||e instanceof URLSearchParams}function k(e){return Object.keys(e).some(e=>e.toLowerCase()===`content-type`)}async function A(e){let t=e.headers.get(`content-type`)??``;try{return t.includes(`application/json`)?await e.json():await e.text()}catch{return null}}function j(e,t,n){if(!(n==null||n===``)){if(Array.isArray(n)){for(let r of n)j(e,t,r);return}e.append(t,String(n))}}function M(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))j(t,n,r);return t.toString()}function N(e,t,n){let r=new URL(t.endsWith(`/`)?t:`${t}/`),i=new URL(e.startsWith(`/`)?e.slice(1):e,r);if(i.origin!==r.origin)throw Error(`Refusing to send an authenticated request to ${i.origin} (expected ${r.origin})`);let a=M(n??{});return a&&(i.search=a),i.toString()}const P=new WeakMap;async function F(e,t,r,i={}){let a=N(r,P.get(e)??D,i.query),o={...i.headers},s;i.body!==void 0&&(O(i.body)||typeof i.body==`string`&&k(o)?s=i.body:(o[`Content-Type`]??=`application/json`,s=JSON.stringify(i.body)));let c;try{c=await e.fetch(a,{method:t,headers:o,body:s,signal:i.signal},{timeoutInSeconds:i.timeout?i.timeout/1e3:void 0,abortSignal:i.signal})}catch(e){throw i.signal?.aborted?Error(`Request aborted`):e instanceof Error&&e.name===`AbortError`?Error(`Request timed out after ${i.timeout??E}ms`):e instanceof Error?Error(`Request failed: ${e.message}`):e}if(!c.ok)throw new n({statusCode:c.status,body:await A(c),rawResponse:{status:c.status,statusText:c.statusText,url:c.url||a,headers:c.headers,redirected:c.redirected,type:c.type}});if(c.status===204)return null;let l=await c.text();if(l===``)return null;if(!(c.headers.get(`content-type`)??``).includes(`application/json`))return l;let u=JSON.parse(l);if(u.success===!1)throw new n({message:`API error: ${u.errors?.map(e=>e.message).filter(Boolean).join(`, `)||`unknown error`}`,statusCode:c.status,body:u});return`result`in u?u.result:u}function I(e){let t=e.baseURL??D,n=new r({baseUrl:t,auth:async()=>({headers:{Authorization:`Bearer ${e.apiToken}`}}),headers:e.defaultHeaders,timeoutInSeconds:(e.timeout??E)/1e3,maxRetries:0,fetch:e.fetch??globalThis.fetch});return P.set(n,t),n}async function L(){let e=a({allowGlobalAuthKey:!1});if(e&&`apiToken`in e)return e.apiToken;let t=await s();if(t)return t;throw Error(`No authentication token found.
2
+ import{i as e}from"./session-CQpgz61H.mjs";import{n as t,r as n,t as r}from"./sdk-pQ5kaGUX.mjs";import{O as i,o as a}from"./chunk-2SIGYDH3-_JSHaszR.mjs";import{T as o,a as s,f as c,m as l}from"./oauth-DC9g9uK_.mjs";import{execSync as u}from"child_process";import d from"os";function f(e){try{let t=u(`ps -p ${e} -o pid=,ppid=,command=`,{encoding:`utf8`,timeout:5e3}).trim();if(!t)return null;let[n,r,...i]=t.split(/\s+/),a=n?parseInt(n,10):NaN,o=r?parseInt(r,10):NaN;return isNaN(a)||isNaN(o)?null:{pid:a,ppid:o,command:i.join(` `)||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function p(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=f(r);if(!e||e.ppid===0||e.ppid===1)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function m(e){try{let t=u(`wmic process where (ProcessId=${e}) get ProcessId,ParentProcessId,CommandLine /format:csv`,{encoding:`utf8`,timeout:1e4});if(!t)return null;let n=t.split(`
3
+ `).filter(e=>e.trim()&&!e.startsWith(`Node`)).pop()?.split(`,`);if(!n||n.length<4)return null;let[r,i,a,o]=n,s=o?parseInt(o.trim(),10):NaN,c=a?parseInt(a.trim(),10):NaN;return isNaN(s)||isNaN(c)?null:{pid:s,ppid:c,command:i?.trim()||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function h(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=m(r);if(!e||e.ppid===0||e.ppid===4)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function g(e=process.pid){if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(`PID must be a positive integer`);return d.platform()===`win32`?h(e):p(e)}const _=[{id:`opencode`,name:`OpenCode`,type:`agent`,envVars:[{any:[`OPENCODE`,`OPENCODE_BIN_PATH`,`OPENCODE_SERVER`,`OPENCODE_APP_INFO`,`OPENCODE_MODES`]}]},{id:`jules`,name:`Jules`,type:`agent`,envVars:[{all:[[`HOME`,`/home/jules`],[`USER`,`swebot`]]}]},{id:`claude-code`,name:`Claude Code`,type:`agent`,envVars:[`CLAUDECODE`]},{id:`cursor-agent`,name:`Cursor Agent`,type:`agent`,envVars:[{all:[`CURSOR_TRACE_ID`,[`PAGER`,`head -n 10000 | cat`]]}]},{id:`cursor`,name:`Cursor`,type:`interactive`,envVars:[`CURSOR_TRACE_ID`]},{id:`gemini-agent`,name:`Gemini Agent`,type:`agent`,processChecks:[`gemini`]},{id:`codex`,name:`OpenAI Codex`,type:`agent`,processChecks:[`codex`]},{id:`replit`,name:`Replit`,type:`agent`,envVars:[`REPL_ID`]},{id:`aider`,name:`Aider`,type:`agent`,envVars:[`AIDER_API_KEY`],processChecks:[`aider`]},{id:`bolt-agent`,name:`Bolt.new Agent`,type:`agent`,envVars:[{all:[[`SHELL`,`/bin/jsh`],`npm_config_yes`]}]},{id:`bolt`,name:`Bolt.new`,type:`interactive`,envVars:[{all:[[`SHELL`,`/bin/jsh`]],none:[`npm_config_yes`]}]},{id:`zed-agent`,name:`Zed Agent`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`zed`],[`PAGER`,`cat`]]}]},{id:`zed`,name:`Zed`,type:`interactive`,envVars:[{all:[[`TERM_PROGRAM`,`zed`]],none:[[`PAGER`,`cat`]]}]},{id:`replit-assistant`,name:`Replit Assistant`,type:`agent`,envVars:[{all:[`REPL_ID`,[`REPLIT_MODE`,`assistant`]]}]},{id:`replit`,name:`Replit`,type:`interactive`,envVars:[{all:[`REPL_ID`],none:[[`REPLIT_MODE`,`assistant`]]}]},{id:`windsurf`,name:`Windsurf`,type:`agent`,envVars:[`CODEIUM_EDITOR_APP_ROOT`]},{id:`crush`,name:`Crush`,type:`agent`,processChecks:[`crush`]},{id:`vscode-copilot-agent`,name:`GitHub Copilot in VS Code`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`vscode`],[`GIT_PAGER`,`cat`]]}]},{id:`warp`,name:`Warp Terminal`,type:`hybrid`,envVars:[{all:[[`TERM_PROGRAM`,`WarpTerminal`]]}]},{id:`octofriend`,name:`Octofriend`,type:`agent`,processChecks:[`octofriend`]}];function v(e,t=process.env){let[n,r]=typeof e==`string`?[e,void 0]:e,i=t[n];return!!(i&&(!r||i===r))}function y(e,t){try{let n=t??g();for(let t of n)if(t.command?.includes(e))return!0}catch{}return!1}function b(e,t=process.env){if(typeof e==`string`||Array.isArray(e))return v(e,t);let{any:n,all:r,none:i}=e,a=!n?.length||n.some(e=>v(e,t)),o=!r?.length||r.every(e=>v(e,t)),s=!i?.length||!i.some(e=>v(e,t));return a&&o&&s}function x(e){return e.customDetectors?.some(e=>{try{return e()}catch{return!1}})??!1}function S(e){return{isAgentic:!0,id:e.id,name:e.name,type:e.type}}function C(e=process.env,t){for(let t of _)if(t.envVars?.some(t=>b(t,e)))return S(t);let n=t,r=()=>{if(n===void 0)try{n=g()}catch{n=[]}return n};for(let e of _)if(e.processChecks?.some(e=>y(e,r())))return S(e);for(let e of _)if(x(e))return S(e);return{isAgentic:!1,id:null,name:null,type:null}}function w(){return c?`ci`:l()?`interactive`:`non-interactive`}function T(){let t=C(),n=t.isAgentic&&t.id!==null?{"X-CF-CLI-Agent":t.id}:{};return{"User-Agent":e,"X-CF-CLI-Mode":w(),...n}}const E=3e4,D=t.Default;function O(e){return e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream||e instanceof URLSearchParams}function k(e){return Object.keys(e).some(e=>e.toLowerCase()===`content-type`)}async function A(e){let t=e.headers.get(`content-type`)??``;try{return t.includes(`application/json`)?await e.json():await e.text()}catch{return null}}function j(e,t,n){if(!(n==null||n===``)){if(Array.isArray(n)){for(let r of n)j(e,t,r);return}e.append(t,String(n))}}function M(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))j(t,n,r);return t.toString()}function N(e,t,n){let r=new URL(t.endsWith(`/`)?t:`${t}/`),i=new URL(e.startsWith(`/`)?e.slice(1):e,r);if(i.origin!==r.origin)throw Error(`Refusing to send an authenticated request to ${i.origin} (expected ${r.origin})`);let a=M(n??{});return a&&(i.search=a),i.toString()}const P=new WeakMap;async function F(e,t,r,i={}){let a=N(r,P.get(e)??D,i.query),o={...i.headers},s;i.body!==void 0&&(O(i.body)||typeof i.body==`string`&&k(o)?s=i.body:(o[`Content-Type`]??=`application/json`,s=JSON.stringify(i.body)));let c;try{c=await e.fetch(a,{method:t,headers:o,body:s,signal:i.signal},{timeoutInSeconds:i.timeout?i.timeout/1e3:void 0,abortSignal:i.signal})}catch(e){throw i.signal?.aborted?Error(`Request aborted`):e instanceof Error&&e.name===`AbortError`?Error(`Request timed out after ${i.timeout??E}ms`):e instanceof Error?Error(`Request failed: ${e.message}`):e}if(!c.ok)throw new n({statusCode:c.status,body:await A(c),rawResponse:{status:c.status,statusText:c.statusText,url:c.url||a,headers:c.headers,redirected:c.redirected,type:c.type}});if(c.status===204)return null;let l=c.headers.get(`content-type`)??``;if(!l.includes(`application/json`)&&i.preserveNonJsonBytes)return Buffer.from(await c.arrayBuffer());let u=await c.text();if(u===``)return null;if(!l.includes(`application/json`))return u;let d=JSON.parse(u);if(d.success===!1)throw new n({message:`API error: ${d.errors?.map(e=>e.message).filter(Boolean).join(`, `)||`unknown error`}`,statusCode:c.status,body:d});return`result`in d?d.result:d}function I(e){let t=e.baseURL??D,n=new r({baseUrl:t,auth:async()=>({headers:{Authorization:`Bearer ${e.apiToken}`}}),headers:e.defaultHeaders,timeoutInSeconds:(e.timeout??E)/1e3,maxRetries:0,fetch:e.fetch??globalThis.fetch});return P.set(n,t),n}async function L(){let e=a({allowGlobalAuthKey:!1});if(e&&`apiToken`in e)return e.apiToken;let t=await s();if(t)return t;throw Error(`No authentication token found.
4
4
 
5
5
  Please set one of the following:
6
6
  1. Set the CLOUDFLARE_API_TOKEN environment variable
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`get`,describe:`Gets the current billing profile for the account.`,builder:u,handler:async s=>{if(s.dryRun){i({command:`cf billing profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billing/profile`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.billing.profiles.get({account_id:l})),{successLabel:`Loaded`})}},f={command:`profiles`,describe:`Billing profile with payment method, address, and invoice preferences`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.option(`from`,{type:`string`,description:"Start date for the usage query (ISO 8601). Required if `to` is set. When omitted along with `to`, defaults to the start of the current month. Filters by charge period (when consumption happened), not billing period. The maximum date range is 31 days."}).option(`to`,{type:`string`,description:"End date for the usage query (ISO 8601). Required if `from` is set. When omitted along with `from`, defaults to today. Filters by charge period (when consumption happened), not billing period. The maximum date range is 31 days."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get-account-usage-v2`,describe:"Returns cost and usage data for a single Cloudflare account, aligned with the [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) Cost and Usage dataset specification. Each record represents one billable metric for one account on one day. This includes all metered usage, including usage that falls within free-tier allowances and may result in zero cost. **Note:** Cost and pricing fields are not yet populated and will be absent from responses until billing integration is complete. When `from` and `to` are omitted, defaults to the start of the current month through today. The maximum date range is 31 days.",builder:p,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage get-account-usage-v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable/usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.getAccountUsageV2({account_id:u,...c})),{successLabel:`Loaded`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get_info_v1`,describe:`Returns high-level usage information for the account, including coverage, and subscription metadata.`,builder:h,handler:async s=>{if(s.dryRun){i({command:`cf billing usage get_info_v1`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable-usage/info`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.billing.usage.getInfoV1({account_id:l})),{successLabel:`Loaded`})}};function _(e){return e.option(`from`,{type:`string`,description:`Start date for the usage query (ISO 8601). The provided time range must include the subscription billing cycle anchor day, otherwise no usage data is returned. Use the info endpoint to retrieve the subscription anchor day.`}).option(`to`,{type:`string`,description:`End date for the usage query (ISO 8601).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get_v1`,describe:`Returns billable usage data for the account. When no query parameters are provided, returns usage for the current billing period.`,builder:_,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage get_v1`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable-usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.getV1({account_id:u,...c})),{successLabel:`Loaded`})}};function y(e){return e.option(`filter-by-metric-ids`,{type:`string`,array:!0,description:"Restrict results to rows whose `x_BillableMetricId` matches one of these billable metric ids (e.g. `workers_standard_requests`). Values must be unique."}).option(`filter-by-product-family-ids`,{type:`string`,array:!0,description:`Restrict results to billable metrics belonging to these product families. Values must be unique UUIDs.`}).option(`time-period-from`,{type:`string`,description:"Start of the range (ISO 8601). Required if `To` is set."}).option(`time-period-to`,{type:`string`,description:"End of the range (ISO 8601). Required if `From` is set. Must be after `From` and no more than 31 days after it."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Filter criteria for a usage query. Every field is optional; an empty object is equivalent to omitting the body entirely. Unknown fields are rejected.`})}const b={command:`query`,describe:"Returns cost and usage data for a single Cloudflare account, aligned with the [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) Cost and Usage dataset specification. This is the filterable counterpart to `GET` on the same path. It is a read-only operation and requires only the `#billing:read` permission; `POST` is used so that filter criteria can be supplied in a request body rather than in the query string. Each record represents one billable metric for one account on one day. This includes all metered usage, including usage that falls within free-tier allowances and may result in zero cost. **Note:** Cost and pricing fields are not yet populated and will be absent from responses until billing integration is complete. The request body is optional. When it is omitted, or when `TimePeriod` is omitted, the range defaults to the start of the current month through today. The maximum date range is 31 days. Filters are combined with AND. Filter values that do not match a known billable metric or product family simply match no usage, and the response is an empty result set.",builder:y,handler:async u=>{if(u.dryRun){i({command:`cf billing usage query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable/usage`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({FilterBy:{MetricIds:u[`filter-by-metric-ids`],ProductFamilyIds:u[`filter-by-product-family-ids`]},TimePeriod:{From:l(u[`time-period-from`],`time-period-from`,`text`),To:l(u[`time-period-to`],`time-period-to`,`text`)}}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Loading`,async()=>d.billing.usage.query({...e,account_id:f})),{successLabel:`Loaded`});return}let p=c({FilterBy:{MetricIds:u[`filter-by-metric-ids`],ProductFamilyIds:u[`filter-by-product-family-ids`]},TimePeriod:{From:l(u[`time-period-from`],`time-period-from`,`text`),To:l(u[`time-period-to`],`time-period-to`,`text`)}});r(await a(`Loading`,async()=>d.billing.usage.query({...p,account_id:f})),{successLabel:`Loaded`})}},x={command:`usage`,describe:`Operations for usage`,builder:e=>e.command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`billing`,describe:`Account billing profiles and usage data for Cloudflare subscriptions and add-on services`,builder:e=>e.command(f).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{S as default};
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`get`,describe:`Gets the current billing profile for the account.`,builder:u,handler:async s=>{if(s.dryRun){i({command:`cf billing profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billing/profile`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.billing.profiles.get({account_id:l})),{successLabel:`Loaded`})}},f={command:`profiles`,describe:`Billing profile with payment method, address, and invoice preferences`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.option(`from`,{type:`string`,description:"Start date for the usage query (ISO 8601). Required if `to` is set. When omitted along with `to`, defaults to the start of the current month. Filters by charge period (when consumption happened), not billing period. The maximum date range is 31 days."}).option(`to`,{type:`string`,description:"End date for the usage query (ISO 8601). Required if `from` is set. When omitted along with `from`, defaults to today. Filters by charge period (when consumption happened), not billing period. The maximum date range is 31 days."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get-account-usage-v2`,describe:"Returns cost and usage data for a single Cloudflare account, aligned with the [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) Cost and Usage dataset specification. Each record represents one billable metric for one account on one day. This includes all metered usage, including usage that falls within free-tier allowances and may result in zero cost. **Note:** Cost and pricing fields are not yet populated and will be absent from responses until billing integration is complete. When `from` and `to` are omitted, defaults to the start of the current month through today. The maximum date range is 31 days.",builder:p,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage get-account-usage-v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable/usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.getAccountUsageV2({account_id:u,...c})),{successLabel:`Loaded`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get_info_v1`,describe:`Returns high-level usage information for the account, including coverage, and subscription metadata.`,builder:h,handler:async s=>{if(s.dryRun){i({command:`cf billing usage get_info_v1`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable-usage/info`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.billing.usage.getInfoV1({account_id:l})),{successLabel:`Loaded`})}};function _(e){return e.option(`from`,{type:`string`,description:`Start date for the usage query (ISO 8601). The provided time range must include the subscription billing cycle anchor day, otherwise no usage data is returned. Use the info endpoint to retrieve the subscription anchor day.`}).option(`to`,{type:`string`,description:`End date for the usage query (ISO 8601).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get_v1`,describe:`Returns billable usage data for the account. When no query parameters are provided, returns usage for the current billing period.`,builder:_,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage get_v1`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable-usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.getV1({account_id:u,...c})),{successLabel:`Loaded`})}};function y(e){return e.option(`filter-by-metric-ids`,{type:`string`,array:!0,description:"Restrict results to rows whose `x_BillableMetricId` matches one of these billable metric ids (e.g. `workers_standard_requests`). Values must be unique."}).option(`filter-by-product-family-ids`,{type:`string`,array:!0,description:`Restrict results to billable metrics belonging to these product families. Values must be unique UUIDs.`}).option(`time-period-from`,{type:`string`,description:"Start of the range (ISO 8601). Required if `To` is set."}).option(`time-period-to`,{type:`string`,description:"End of the range (ISO 8601). Required if `From` is set. Must be after `From` and no more than 31 days after it."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Filter criteria for a usage query. Every field is optional; an empty object is equivalent to omitting the body entirely. Unknown fields are rejected.`})}const b={command:`query`,describe:"Returns cost and usage data for a single Cloudflare account, aligned with the [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) Cost and Usage dataset specification. This is the filterable counterpart to `GET` on the same path. It is a read-only operation and requires only the `#billing:read` permission; `POST` is used so that filter criteria can be supplied in a request body rather than in the query string. Each record represents one billable metric for one account on one day. This includes all metered usage, including usage that falls within free-tier allowances and may result in zero cost. **Note:** Cost and pricing fields are not yet populated and will be absent from responses until billing integration is complete. The request body is optional. When it is omitted, or when `TimePeriod` is omitted, the range defaults to the start of the current month through today. The maximum date range is 31 days. Filters are combined with AND. Filter values that do not match a known billable metric or product family simply match no usage, and the response is an empty result set.",builder:y,handler:async u=>{if(u.dryRun){i({command:`cf billing usage query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable/usage`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({FilterBy:{MetricIds:u[`filter-by-metric-ids`],ProductFamilyIds:u[`filter-by-product-family-ids`]},TimePeriod:{From:l(u[`time-period-from`],`time-period-from`,`text`),To:l(u[`time-period-to`],`time-period-to`,`text`)}}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Loading`,async()=>d.billing.usage.query({...e,account_id:f})),{successLabel:`Loaded`});return}let p=c({FilterBy:{MetricIds:u[`filter-by-metric-ids`],ProductFamilyIds:u[`filter-by-product-family-ids`]},TimePeriod:{From:l(u[`time-period-from`],`time-period-from`,`text`),To:l(u[`time-period-to`],`time-period-to`,`text`)}});r(await a(`Loading`,async()=>d.billing.usage.query({...p,account_id:f})),{successLabel:`Loaded`})}},x={command:`usage`,describe:`Operations for usage`,builder:e=>e.command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`billing`,describe:`Account billing profiles and usage data for Cloudflare subscriptions and add-on services`,builder:e=>e.command(f).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{S as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{D as e}from"./oauth-DBJ5GSFk.mjs";import{n as t}from"./auth-CZ0E51rF.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-O88q63Bk.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{n as c,r as l}from"./prompt-DTAWiEm2.mjs";function u(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`expression`,{type:`string`,description:`Wirefilter expression describing the traffic being reported.`}).option(`first-request-seen-at`,{type:`string`,description:`The first_request_seen_at field`}).option(`last-request-seen-at`,{type:`string`,description:`The last_request_seen_at field`}).option(`requests`,{type:`number`,description:`The requests field`}).option(`subtype`,{type:`string`,description:`The subtype field`}).option(`type`,{type:`string`,description:`Type of feedback report.`,choices:[`false_positive`,`false_negative`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:"Submit a feedback report for the specified zone. Use `type` to indicate whether the report is a false positive (good traffic flagged as bot) or a false negative (bot traffic missed). Furthermore, you can also use `expression` as a wirefilter to identify the affected traffic sample. See more accepted API fields and expression types at https://developers.cloudflare.com/bots/concepts/feedback-loop/#api-fields and https://developers.cloudflare.com/bots/concepts/feedback-loop/#expression-fields, respectively.",builder:u,handler:async u=>{if(u.dryRun){r({command:`cf bot-management feedback create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?o({description:s(u.description,`description`,`text`),expression:s(u.expression,`expression`,`text`),first_request_seen_at:s(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:s(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:s(u.subtype,`subtype`,`text`),type:s(u.type,`type`,`text`)}):a(u.body)});return}let d=await t(u),f=await e({zone:u.zone},d,{quiet:u.quiet});if(u.zoneId=f,u.body){let e=a(u.body);n(await i(`Creating`,async()=>d.botManagement.feedback.create({body:e,zone_id:f})),{successLabel:`Created`});return}if(u.description===void 0&&(u.description=await l(`description`,`The description field`)),u.expression===void 0&&(u.expression=await l(`expression`,`Wirefilter expression describing the traffic being reported.`)),u[`first-request-seen-at`]===void 0&&(u[`first-request-seen-at`]=await l(`first-request-seen-at`,`The first_request_seen_at field`)),u[`last-request-seen-at`]===void 0&&(u[`last-request-seen-at`]=await l(`last-request-seen-at`,`The last_request_seen_at field`)),u.requests===void 0)throw Error(`--requests is required (or pass --body with this field set).`);u.type===void 0&&(u.type=await c(`type`,`Type of feedback report.`,[`false_positive`,`false_negative`]));let p=o({description:s(u.description,`description`,`text`),expression:s(u.expression,`expression`,`text`),first_request_seen_at:s(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:s(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:s(u.subtype,`subtype`,`text`),type:s(u.type,`type`,`text`)});n(await i(`Creating`,async()=>d.botManagement.feedback.create({body:p,zone_id:f})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`list`,describe:`Returns all feedback reports previously submitted for the specified zone. Feedback reports help improve detection by sharing samples of traffic that were misclassified as bots or humans.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf bot-management feedback list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.botManagement.feedback.list({zone_id:s})),{successLabel:`Loaded`})}},m={command:`feedback`,describe:`Feedback operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve a zone's Bot Management Config`,builder:h,handler:async a=>{if(a.dryRun){r({command:`cf bot-management get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.botManagement.get({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.option(`ai-bots-protection`,{type:`string`,description:`Enable rule to block AI Scrapers and Crawlers.`,choices:[`block`,`disabled`,`only_on_ad_pages`]}).option(`cf-robots-variant`,{type:`string`,description:`Specifies the Robots Access Control License variant to use.`,choices:[`off`,`policy_only`]}).option(`content-bots-protection`,{type:`string`,description:`Enable rule to block content bots. When enabled, blocks automated traffic with low bot scores, excluding safe verified bot categories. Exceptions should be managed via skip rules.`,choices:[`block`,`disabled`]}).option(`crawler-protection`,{type:`string`,description:`Enable rule to punish AI Scrapers and Crawlers via a link maze.`,choices:[`enabled`,`disabled`]}).option(`enable-js`,{type:`boolean`,description:`Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).`}).option(`is-robots-txt-managed`,{type:`boolean`,description:`Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.`}).option(`fight-mode`,{type:`boolean`,description:`Whether to enable Bot Fight Mode.`}).option(`stale-zone-configuration-optimize-wordpress`,{type:`boolean`,description:`Indicates that the zone's wordpress optimization for SBFM is turned on.`}).option(`stale-zone-configuration-sbfm-definitely-automated`,{type:`string`,description:`Indicates that the zone's definitely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-likely-automated`,{type:`string`,description:`Indicates that the zone's likely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-static-resource-protection`,{type:`string`,description:`Indicates that the zone's static resource protection is turned on.`}).option(`stale-zone-configuration-sbfm-verified-bots`,{type:`string`,description:`Indicates that the zone's verified bot requests are being blocked.`}).option(`stale-zone-configuration-suppress-session-score`,{type:`boolean`,description:`Indicates that the zone's session score tracking is disabled.`}).option(`stale-zone-configuration-fight-mode`,{type:`boolean`,description:`Indicates that the zone's Bot Fight Mode is turned on.`}).option(`optimize-wordpress`,{type:`boolean`,description:`Whether to optimize Super Bot Fight Mode protections for Wordpress.`}).option(`sbfm-definitely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on definitely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`sbfm-static-resource-protection`,{type:`boolean`,description:`Super Bot Fight Mode (SBFM) to enable static resource protection.
2
+ import{D as e}from"./oauth-DC9g9uK_.mjs";import{n as t}from"./auth-B1CY5zpC.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-BLQ2xXwD.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{n as c,r as l}from"./prompt-DcfYBioA.mjs";function u(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`expression`,{type:`string`,description:`Wirefilter expression describing the traffic being reported.`}).option(`first-request-seen-at`,{type:`string`,description:`The first_request_seen_at field`}).option(`last-request-seen-at`,{type:`string`,description:`The last_request_seen_at field`}).option(`requests`,{type:`number`,description:`The requests field`}).option(`subtype`,{type:`string`,description:`The subtype field`}).option(`type`,{type:`string`,description:`Type of feedback report.`,choices:[`false_positive`,`false_negative`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:"Submit a feedback report for the specified zone. Use `type` to indicate whether the report is a false positive (good traffic flagged as bot) or a false negative (bot traffic missed). Furthermore, you can also use `expression` as a wirefilter to identify the affected traffic sample. See more accepted API fields and expression types at https://developers.cloudflare.com/bots/concepts/feedback-loop/#api-fields and https://developers.cloudflare.com/bots/concepts/feedback-loop/#expression-fields, respectively.",builder:u,handler:async u=>{if(u.dryRun){r({command:`cf bot-management feedback create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?o({description:s(u.description,`description`,`text`),expression:s(u.expression,`expression`,`text`),first_request_seen_at:s(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:s(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:s(u.subtype,`subtype`,`text`),type:s(u.type,`type`,`text`)}):a(u.body)});return}let d=await t(u),f=await e({zone:u.zone},d,{quiet:u.quiet});if(u.zoneId=f,u.body){let e=a(u.body);n(await i(`Creating`,async()=>d.botManagement.feedback.create({body:e,zone_id:f})),{successLabel:`Created`});return}if(u.description===void 0&&(u.description=await l(`description`,`The description field`)),u.expression===void 0&&(u.expression=await l(`expression`,`Wirefilter expression describing the traffic being reported.`)),u[`first-request-seen-at`]===void 0&&(u[`first-request-seen-at`]=await l(`first-request-seen-at`,`The first_request_seen_at field`)),u[`last-request-seen-at`]===void 0&&(u[`last-request-seen-at`]=await l(`last-request-seen-at`,`The last_request_seen_at field`)),u.requests===void 0)throw Error(`--requests is required (or pass --body with this field set).`);u.type===void 0&&(u.type=await c(`type`,`Type of feedback report.`,[`false_positive`,`false_negative`]));let p=o({description:s(u.description,`description`,`text`),expression:s(u.expression,`expression`,`text`),first_request_seen_at:s(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:s(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:s(u.subtype,`subtype`,`text`),type:s(u.type,`type`,`text`)});n(await i(`Creating`,async()=>d.botManagement.feedback.create({body:p,zone_id:f})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`list`,describe:`Returns all feedback reports previously submitted for the specified zone. Feedback reports help improve detection by sharing samples of traffic that were misclassified as bots or humans.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf bot-management feedback list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.botManagement.feedback.list({zone_id:s})),{successLabel:`Loaded`})}},m={command:`feedback`,describe:`Feedback operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve a zone's Bot Management Config`,builder:h,handler:async a=>{if(a.dryRun){r({command:`cf bot-management get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.botManagement.get({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.option(`ai-bots-protection`,{type:`string`,description:`Enable rule to block AI Scrapers and Crawlers.`,choices:[`block`,`disabled`,`only_on_ad_pages`]}).option(`cf-robots-variant`,{type:`string`,description:`Specifies the Robots Access Control License variant to use.`,choices:[`off`,`policy_only`]}).option(`content-bots-protection`,{type:`string`,description:`Enable rule to block content bots. When enabled, blocks automated traffic with low bot scores, excluding safe verified bot categories. Exceptions should be managed via skip rules.`,choices:[`block`,`disabled`]}).option(`crawler-protection`,{type:`string`,description:`Enable rule to punish AI Scrapers and Crawlers via a link maze.`,choices:[`enabled`,`disabled`]}).option(`enable-js`,{type:`boolean`,description:`Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).`}).option(`is-robots-txt-managed`,{type:`boolean`,description:`Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.`}).option(`fight-mode`,{type:`boolean`,description:`Whether to enable Bot Fight Mode.`}).option(`stale-zone-configuration-optimize-wordpress`,{type:`boolean`,description:`Indicates that the zone's wordpress optimization for SBFM is turned on.`}).option(`stale-zone-configuration-sbfm-definitely-automated`,{type:`string`,description:`Indicates that the zone's definitely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-likely-automated`,{type:`string`,description:`Indicates that the zone's likely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-static-resource-protection`,{type:`string`,description:`Indicates that the zone's static resource protection is turned on.`}).option(`stale-zone-configuration-sbfm-verified-bots`,{type:`string`,description:`Indicates that the zone's verified bot requests are being blocked.`}).option(`stale-zone-configuration-suppress-session-score`,{type:`boolean`,description:`Indicates that the zone's session score tracking is disabled.`}).option(`stale-zone-configuration-fight-mode`,{type:`boolean`,description:`Indicates that the zone's Bot Fight Mode is turned on.`}).option(`optimize-wordpress`,{type:`boolean`,description:`Whether to optimize Super Bot Fight Mode protections for Wordpress.`}).option(`sbfm-definitely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on definitely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`sbfm-static-resource-protection`,{type:`boolean`,description:`Super Bot Fight Mode (SBFM) to enable static resource protection.
3
3
  Enable if static resources on your application need bot protection.
4
4
  Note: Static resource protection can also result in legitimate traffic being blocked.
5
5
  `}).option(`sbfm-verified-bots`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on verified bots requests.`,choices:[`allow`,`block`]}).option(`sbfm-likely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on likely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`auto-update-model`,{type:`boolean`,description:`Automatically update to the newest bot detection models created by Cloudflare as they are released. [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes)`}).option(`bm-cookie-enabled`,{type:`boolean`,description:`Indicates that the bot management cookie can be placed on end user devices accessing the site. Defaults to true`}).option(`suppress-session-score`,{type:`boolean`,description:`Whether to disable tracking the highest bot score for a session in the Bot Management cookie.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`update`,describe:'Updates the Bot Management configuration for a zone. This API is used to update: - **Bot Fight Mode** - **Super Bot Fight Mode** - **Bot Management for Enterprise** See [Bot Plans](https://developers.cloudflare.com/bots/plans/) for more information on the different plans \\ If you recently upgraded or downgraded your plan, refer to the following examples to clean up old configurations. Copy and paste the example body to remove old zone configurations based on your current plan. #### Clean up configuration for Bot Fight Mode plan ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "suppress_session_score": false } ``` #### Clean up configuration for SBFM Pro plan ```json { "sbfm_likely_automated": "allow", "fight_mode": false } ``` #### Clean up configuration for SBFM Biz plan ```json { "fight_mode": false } ``` #### Clean up configuration for BM Enterprise Subscription plan It is strongly recommended that you ensure you have [custom rules](https://developers.cloudflare.com/waf/custom-rules/) in place to protect your zone before disabling the SBFM rules. Without these protections, your zone is vulnerable to attacks. ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "fight_mode": false } ```',builder:_,handler:async c=>{if(c.dryRun){r({command:`cf bot-management update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({ai_bots_protection:s(c[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:s(c[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:s(c[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:s(c[`crawler-protection`],`crawler-protection`,`text`),enable_js:c[`enable-js`],is_robots_txt_managed:c[`is-robots-txt-managed`],fight_mode:c[`fight-mode`],stale_zone_configuration:{optimize_wordpress:c[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:s(c[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:s(c[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:s(c[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:s(c[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:c[`stale-zone-configuration-suppress-session-score`],fight_mode:c[`stale-zone-configuration-fight-mode`]},optimize_wordpress:c[`optimize-wordpress`],sbfm_definitely_automated:s(c[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:c[`sbfm-static-resource-protection`],sbfm_verified_bots:s(c[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:s(c[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:c[`auto-update-model`],bm_cookie_enabled:c[`bm-cookie-enabled`],suppress_session_score:c[`suppress-session-score`]}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.botManagement.update({body:e,zone_id:u})),{successLabel:`Updated`});return}let d=o({ai_bots_protection:s(c[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:s(c[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:s(c[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:s(c[`crawler-protection`],`crawler-protection`,`text`),enable_js:c[`enable-js`],is_robots_txt_managed:c[`is-robots-txt-managed`],fight_mode:c[`fight-mode`],stale_zone_configuration:{optimize_wordpress:c[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:s(c[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:s(c[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:s(c[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:s(c[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:c[`stale-zone-configuration-suppress-session-score`],fight_mode:c[`stale-zone-configuration-fight-mode`]},optimize_wordpress:c[`optimize-wordpress`],sbfm_definitely_automated:s(c[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:c[`sbfm-static-resource-protection`],sbfm_verified_bots:s(c[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:s(c[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:c[`auto-update-model`],bm_cookie_enabled:c[`bm-cookie-enabled`],suppress_session_score:c[`suppress-session-score`]});n(await i(`Updating`,async()=>l.botManagement.update({body:d,zone_id:u})),{successLabel:`Updated`})}},y={command:`bot-management`,describe:`Bot detection and mitigation settings — configure bot scores, JavaScript detections, and challenge behavior`,builder:e=>e.command(g).command(v).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./prompt-DTAWiEm2.mjs";import{t as c}from"./cli-types-CFw6Xygp.mjs";function l(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`date`,{type:`string`,description:`Date`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`day-report <asn-id>`,describe:`Gets all the data the botnet tracking database has for a given ASN registered to user account for given date. If no date is given, it will return results for the previous day.`,builder:c(l),handler:async s=>{let c={date:s.date};if(s.dryRun){i({command:`cf botnet-feed asn day-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/asn/${s[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(s[`asn-id`]))}/day_report`,pathParams:{"asn-id":String(s[`asn-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.botnetFeed.asn.dayReport({account_id:u,asn_id:s[`asn-id`],...c})),{successLabel:`Loaded`})}};function d(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`full-report <asn-id>`,describe:`Gets all the data the botnet threat feed tracking database has for a given ASN registered to user account.`,builder:c(d),handler:async s=>{if(s.dryRun){i({command:`cf botnet-feed asn full-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/asn/${s[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(s[`asn-id`]))}/full_report`,pathParams:{"asn-id":String(s[`asn-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.botnetFeed.asn.fullReport({account_id:l,asn_id:s[`asn-id`]})),{successLabel:`Loaded`})}},p={command:`asn`,describe:`ASN-level botnet activity data showing networks with known C2 infrastructure`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <asn-id>`,describe:`Delete an ASN from botnet threat feed for a given user.`,builder:c(m),handler:async c=>{if(c.dryRun){i({command:`cf botnet-feed configs asn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/configs/asn/${c[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(c[`asn-id`]))}`,pathParams:{"asn-id":String(c[`asn-id`]??``)},bodyKind:`none`});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,!await s({force:!!c.force})){process.stderr.write(`Aborted.
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./prompt-DcfYBioA.mjs";import{t as c}from"./cli-types-CFw6Xygp.mjs";function l(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`date`,{type:`string`,description:`Date`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`day-report <asn-id>`,describe:`Gets all the data the botnet tracking database has for a given ASN registered to user account for given date. If no date is given, it will return results for the previous day.`,builder:c(l),handler:async s=>{let c={date:s.date};if(s.dryRun){i({command:`cf botnet-feed asn day-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/asn/${s[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(s[`asn-id`]))}/day_report`,pathParams:{"asn-id":String(s[`asn-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.botnetFeed.asn.dayReport({account_id:u,asn_id:s[`asn-id`],...c})),{successLabel:`Loaded`})}};function d(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`full-report <asn-id>`,describe:`Gets all the data the botnet threat feed tracking database has for a given ASN registered to user account.`,builder:c(d),handler:async s=>{if(s.dryRun){i({command:`cf botnet-feed asn full-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/asn/${s[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(s[`asn-id`]))}/full_report`,pathParams:{"asn-id":String(s[`asn-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.botnetFeed.asn.fullReport({account_id:l,asn_id:s[`asn-id`]})),{successLabel:`Loaded`})}},p={command:`asn`,describe:`ASN-level botnet activity data showing networks with known C2 infrastructure`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <asn-id>`,describe:`Delete an ASN from botnet threat feed for a given user.`,builder:c(m),handler:async c=>{if(c.dryRun){i({command:`cf botnet-feed configs asn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/configs/asn/${c[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(c[`asn-id`]))}`,pathParams:{"asn-id":String(c[`asn-id`]??``)},bodyKind:`none`});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,!await s({force:!!c.force})){process.stderr.write(`Aborted.
3
3
  `);return}r(await a(`Deleting`,async()=>l.botnetFeed.configs.asn.delete({account_id:u,asn_id:c[`asn-id`]})),{successLabel:`Deleted`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API.`,builder:g,handler:async s=>{if(s.dryRun){i({command:`cf botnet-feed configs asn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/configs/asn`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.botnetFeed.configs.asn.get({account_id:l})),{successLabel:`Loaded`})}},v={command:`asn`,describe:`Botnet feed subscription configuration and notification preferences`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`configs`,describe:`Operations for configs`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`botnet-feed`,describe:`Botnet threat intelligence feeds — IP and ASN-level data on known command-and-control infrastructure`,builder:e=>e.command(p).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DTAWiEm2.mjs";import{t as f}from"./cli-types-CFw6Xygp.mjs";function p(e){return e.option(`show-historic`,{type:`string`,description:`Include scanned images without domain metadata (historic data). Default: false (only show images with domain)`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score threshold for matches (0-1, default: 0)`,default:0}).option(`top-k`,{type:`number`,description:`Number of closest matches to return (1-100, default: 10)`,default:10}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`submit`,describe:`Submit an image and find the n closest matches from the scanned images index without creating any match records. Returns similarity scores and metadata for each match.`,builder:p,handler:async d=>{let f={showHistoric:d[`show-historic`],download:d.download};if(d.dryRun){i({command:`cf brand-protection submit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/search`,pathParams:{},query:f,bodyKind:`json`,body:d.body===void 0?c({image_data:l(d[`image-data`],`image-data`,`text`),score_threshold:d[`score-threshold`],top_k:d[`top-k`]}):s(d.body)});return}let p=await n(d),m=d.local?o:await t();if(d.accountId=m,d.body){let e=s(d.body);new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r(await a(`Creating`,async()=>p.brandProtection.submit({...e,account_id:m,...f})),{successLabel:`Created`});return}d[`image-data`]===void 0&&(d[`image-data`]=await u(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`));let h=c({image_data:l(d[`image-data`],`image-data`,`text`),score_threshold:d[`score-threshold`],top_k:d[`top-k`]});new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r(await a(`Creating`,async()=>p.brandProtection.submit({...h,account_id:m,...f})),{successLabel:`Created`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`url-info`,describe:`Get the total number of saved brand protection queries (domain + logo) for an account`,builder:h,handler:async s=>{if(s.dryRun){i({command:`cf brand-protection url-info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/total-queries`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.brandProtection.urlInfo({account_id:l})),{successLabel:`Loaded`})}};function _(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`download`,{type:`string`,description:`Download`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'matchedAt', 'domain', 'similarityScore', or 'registrar'`,choices:[`matchedAt`,`domain`,`similarityScore`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get paginated list of logo matches for a specific brand protection logo query`,builder:f(_),handler:async s=>{let c={offset:s.offset,limit:s.limit,query_id:s[`query-id`],download:s.download,orderBy:s[`order-by`],order:s.order};if(s.dryRun){i({command:`cf brand-protection v2 logo-matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/matches`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.logoMatches.get({account_id:u,...c})),{successLabel:`Loaded`})}},y={command:`logo-matches`,describe:`Detected visual logo matches found on potentially infringing websites`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`search-lookback`,{type:`boolean`,description:`If true, search historic scanned images for matches above the similarity threshold`,default:!0}).option(`similarity-threshold`,{type:`number`,description:`Minimum similarity score (0-1) required for visual matches`}).option(`tag`,{type:`string`,description:`Unique identifier for the logo query`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new saved brand protection logo query for visual similarity matching`,builder:b,handler:async d=>{if(d.dryRun){i({command:`cf brand-protection v2 logos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({image_data:l(d[`image-data`],`image-data`,`text`),search_lookback:d[`search-lookback`],similarity_threshold:d[`similarity-threshold`],tag:l(d.tag,`tag`,`text`)}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.brandProtection.v2.logos.create({...e,account_id:p})),{successLabel:`Created`});return}if(d[`image-data`]===void 0&&(d[`image-data`]=await u(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`)),d[`similarity-threshold`]===void 0)throw Error(`--similarity-threshold is required (or pass --body with this field set).`);d.tag===void 0&&(d.tag=await u(`tag`,`Unique identifier for the logo query`));let m=c({image_data:l(d[`image-data`],`image-data`,`text`),search_lookback:d[`search-lookback`],similarity_threshold:d[`similarity-threshold`],tag:l(d.tag,`tag`,`text`)});r(await a(`Creating`,async()=>f.brandProtection.v2.logos.create({...m,account_id:p})),{successLabel:`Created`})}};function S(e){return e.positional(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <query-id>`,describe:`Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist.`,builder:S,handler:async s=>{if(s.dryRun){i({command:`cf brand-protection v2 logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries/${s[`query-id`]==null?`<query-id>`:encodeURIComponent(String(s[`query-id`]))}`,pathParams:{"query-id":String(s[`query-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DcfYBioA.mjs";import{t as f}from"./cli-types-CFw6Xygp.mjs";function p(e){return e.option(`show-historic`,{type:`string`,description:`Include scanned images without domain metadata (historic data). Default: false (only show images with domain)`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score threshold for matches (0-1, default: 0)`,default:0}).option(`top-k`,{type:`number`,description:`Number of closest matches to return (1-100, default: 10)`,default:10}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`submit`,describe:`Submit an image and find the n closest matches from the scanned images index without creating any match records. Returns similarity scores and metadata for each match.`,builder:p,handler:async d=>{let f={showHistoric:d[`show-historic`],download:d.download};if(d.dryRun){i({command:`cf brand-protection submit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/search`,pathParams:{},query:f,bodyKind:`json`,body:d.body===void 0?c({image_data:l(d[`image-data`],`image-data`,`text`),score_threshold:d[`score-threshold`],top_k:d[`top-k`]}):s(d.body)});return}let p=await n(d),m=d.local?o:await t();if(d.accountId=m,d.body){let e=s(d.body);new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r(await a(`Creating`,async()=>p.brandProtection.submit({...e,account_id:m,...f})),{successLabel:`Created`});return}d[`image-data`]===void 0&&(d[`image-data`]=await u(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`));let h=c({image_data:l(d[`image-data`],`image-data`,`text`),score_threshold:d[`score-threshold`],top_k:d[`top-k`]});new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r(await a(`Creating`,async()=>p.brandProtection.submit({...h,account_id:m,...f})),{successLabel:`Created`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`url-info`,describe:`Get the total number of saved brand protection queries (domain + logo) for an account`,builder:h,handler:async s=>{if(s.dryRun){i({command:`cf brand-protection url-info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/total-queries`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.brandProtection.urlInfo({account_id:l})),{successLabel:`Loaded`})}};function _(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`download`,{type:`string`,description:`Download`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'matchedAt', 'domain', 'similarityScore', or 'registrar'`,choices:[`matchedAt`,`domain`,`similarityScore`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get paginated list of logo matches for a specific brand protection logo query`,builder:f(_),handler:async s=>{let c={offset:s.offset,limit:s.limit,query_id:s[`query-id`],download:s.download,orderBy:s[`order-by`],order:s.order};if(s.dryRun){i({command:`cf brand-protection v2 logo-matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/matches`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.logoMatches.get({account_id:u,...c})),{successLabel:`Loaded`})}},y={command:`logo-matches`,describe:`Detected visual logo matches found on potentially infringing websites`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`search-lookback`,{type:`boolean`,description:`If true, search historic scanned images for matches above the similarity threshold`,default:!0}).option(`similarity-threshold`,{type:`number`,description:`Minimum similarity score (0-1) required for visual matches`}).option(`tag`,{type:`string`,description:`Unique identifier for the logo query`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new saved brand protection logo query for visual similarity matching`,builder:b,handler:async d=>{if(d.dryRun){i({command:`cf brand-protection v2 logos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({image_data:l(d[`image-data`],`image-data`,`text`),search_lookback:d[`search-lookback`],similarity_threshold:d[`similarity-threshold`],tag:l(d.tag,`tag`,`text`)}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.brandProtection.v2.logos.create({...e,account_id:p})),{successLabel:`Created`});return}if(d[`image-data`]===void 0&&(d[`image-data`]=await u(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`)),d[`similarity-threshold`]===void 0)throw Error(`--similarity-threshold is required (or pass --body with this field set).`);d.tag===void 0&&(d.tag=await u(`tag`,`Unique identifier for the logo query`));let m=c({image_data:l(d[`image-data`],`image-data`,`text`),search_lookback:d[`search-lookback`],similarity_threshold:d[`similarity-threshold`],tag:l(d.tag,`tag`,`text`)});r(await a(`Creating`,async()=>f.brandProtection.v2.logos.create({...m,account_id:p})),{successLabel:`Created`})}};function S(e){return e.positional(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <query-id>`,describe:`Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist.`,builder:S,handler:async s=>{if(s.dryRun){i({command:`cf brand-protection v2 logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries/${s[`query-id`]==null?`<query-id>`:encodeURIComponent(String(s[`query-id`]))}`,pathParams:{"query-id":String(s[`query-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
3
3
  `);return}r(await a(`Deleting`,async()=>c.brandProtection.v2.logos.delete({account_id:l,query_id:s[`query-id`]})),{successLabel:`Deleted`})}};function w(e){return e.option(`id`,{type:`string`,description:`Optional query ID to retrieve a specific logo query`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Get all saved brand protection logo queries for an account. Optionally specify id to get a single query. Set download=true to include base64-encoded image data.`,builder:w,handler:async s=>{let c={id:s.id,download:s.download};if(s.dryRun){i({command:`cf brand-protection v2 logos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.logos.get({account_id:u,...c})),{successLabel:`Loaded`})}},E={command:`logos`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID or comma-separated list of Query IDs. When multiple IDs are provided, matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and dismissed state.`,demandOption:!0}).option(`include-domain-id`,{type:`string`,description:`Include domain ID`}).option(`include-dismissed`,{type:`string`,description:`Include dismissed`}).option(`domain-search`,{type:`string`,description:`Filter matches by domain name (substring match)`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'domain', 'first_seen', or 'registrar'`,choices:[`domain`,`first_seen`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get`,describe:`Get paginated list of domain matches for one or more brand protection queries. When multiple query_ids are provided (comma-separated), matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and individual dismissed state.`,builder:f(D),handler:async s=>{let c={offset:s.offset,limit:s.limit,query_id:s[`query-id`],include_domain_id:s[`include-domain-id`],include_dismissed:s[`include-dismissed`],domain_search:s[`domain-search`],orderBy:s[`order-by`],order:s.order};if(s.dryRun){i({command:`cf brand-protection v2 matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/matches`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.matches.get({account_id:u,...c})),{successLabel:`Loaded`})}},k={command:`matches`,describe:`Detected brand abuse matches from monitoring queries with evidence downloads`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`id`,{type:`string`,description:`ID`}).option(`page`,{type:`number`,description:`Optional page number for paginated list requests. Defaults to 1 when only per_page is supplied. Omit page and per_page to preserve the legacy full-list response.`}).option(`per-page`,{type:`number`,description:`Optional number of queries per page for paginated list requests. Defaults to 100 when only page is supplied. Maximum 100. Omit page and per_page to preserve the legacy full-list response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get`,describe:`Get all saved brand protection queries for an account`,builder:A,handler:async s=>{let c={id:s.id,page:s.page,per_page:s[`per-page`]};if(s.dryRun){i({command:`cf brand-protection v2 queries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.queries.get({account_id:u,...c})),{successLabel:`Loaded`})}},M={command:`queries`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`v2`,describe:`Operations for v2`,builder:e=>e.command(y).command(E).command(k).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`brand-protection`,describe:`Monitor the Internet for phishing sites, lookalike domains, and unauthorized use of your brand assets`,builder:e=>e.command(m).command(g).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DTAWiEm2.mjs";function f(e){return e.option(`config-min-extension-version`,{type:`string`,description:`Minimum required browser extension version.`}).option(`config-mode`,{type:`string`,description:`The config.mode field`,choices:[`proxy`],default:`proxy`}).option(`config-proxy-url`,{type:`string`,description:`PAC script URL for proxy configuration.`}).option(`config-team-domain`,{type:`string`,description:`Team domain for the browser extension.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`create`,describe:`Creates the browser extension configuration for an account.`,builder:f,handler:async d=>{if(d.dryRun){i({command:`cf browser-extension config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.browserExtension.config.create({...e,account_id:p})),{successLabel:`Created`});return}d[`config-proxy-url`]===void 0&&(d[`config-proxy-url`]=await u(`config-proxy-url`,`PAC script URL for proxy configuration.`)),d[`config-team-domain`]===void 0&&(d[`config-team-domain`]=await u(`config-team-domain`,`Team domain for the browser extension.`));let m=c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}});r(await a(`Creating`,async()=>f.browserExtension.config.create({...m,account_id:p})),{successLabel:`Created`})}};function m(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete`,describe:`Deletes the browser extension configuration for an account. The shard mapping is preserved and not deleted.`,builder:m,handler:async s=>{if(s.dryRun){i({command:`cf browser-extension config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DcfYBioA.mjs";function f(e){return e.option(`config-min-extension-version`,{type:`string`,description:`Minimum required browser extension version.`}).option(`config-mode`,{type:`string`,description:`The config.mode field`,choices:[`proxy`],default:`proxy`}).option(`config-proxy-url`,{type:`string`,description:`PAC script URL for proxy configuration.`}).option(`config-team-domain`,{type:`string`,description:`Team domain for the browser extension.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`create`,describe:`Creates the browser extension configuration for an account.`,builder:f,handler:async d=>{if(d.dryRun){i({command:`cf browser-extension config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.browserExtension.config.create({...e,account_id:p})),{successLabel:`Created`});return}d[`config-proxy-url`]===void 0&&(d[`config-proxy-url`]=await u(`config-proxy-url`,`PAC script URL for proxy configuration.`)),d[`config-team-domain`]===void 0&&(d[`config-team-domain`]=await u(`config-team-domain`,`Team domain for the browser extension.`));let m=c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}});r(await a(`Creating`,async()=>f.browserExtension.config.create({...m,account_id:p})),{successLabel:`Created`})}};function m(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete`,describe:`Deletes the browser extension configuration for an account. The shard mapping is preserved and not deleted.`,builder:m,handler:async s=>{if(s.dryRun){i({command:`cf browser-extension config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
3
3
  `);return}r(await a(`Deleting`,async()=>c.browserExtension.config.delete({account_id:l})),{successLabel:`Deleted`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Returns the browser extension configuration for an account.`,builder:g,handler:async s=>{if(s.dryRun){i({command:`cf browser-extension config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.browserExtension.config.get({account_id:l})),{successLabel:`Loaded`})}};function v(e){return e.option(`config-min-extension-version`,{type:`string`,description:`Minimum required browser extension version.`}).option(`config-mode`,{type:`string`,description:`The config.mode field`,choices:[`proxy`]}).option(`config-proxy-url`,{type:`string`,description:`PAC script URL for proxy configuration.`}).option(`config-team-domain`,{type:`string`,description:`Team domain for the browser extension.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`update`,describe:`Replaces the browser extension configuration for an account. The configuration must already exist. The shard mapping is immutable.`,builder:v,handler:async d=>{if(d.dryRun){i({command:`cf browser-extension config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Updating`,async()=>f.browserExtension.config.update({...e,account_id:p})),{successLabel:`Updated`});return}d[`config-proxy-url`]===void 0&&(d[`config-proxy-url`]=await u(`config-proxy-url`,`PAC script URL for proxy configuration.`)),d[`config-team-domain`]===void 0&&(d[`config-team-domain`]=await u(`config-team-domain`,`Team domain for the browser extension.`));let m=c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}});r(await a(`Updating`,async()=>f.browserExtension.config.update({...m,account_id:p})),{successLabel:`Updated`})}},b={command:`config`,describe:`Operations for config`,builder:e=>e.command(p).command(h).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},x={command:`browser-extension`,describe:`browser-extension`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{x as default};