cf 0.9.0 → 0.10.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 (262) hide show
  1. package/README.md +5 -0
  2. package/dist/_meta/agent-context.json +34 -35
  3. package/dist/_meta/commands.json +6834 -10044
  4. package/dist/_meta/schemas.json +11228 -12752
  5. package/dist/{abuse-reports-DnNvw2gG.mjs → abuse-reports-CGF4zcKf.mjs} +2 -2
  6. package/dist/{access-RbqBFrSC.mjs → access-lhLJo1v2.mjs} +1 -1
  7. package/dist/{account-D7xvYqDx.mjs → account-CYRm3yoN.mjs} +1 -1
  8. package/dist/account-tags-B88TotoH.mjs +9 -0
  9. package/dist/accounts-BSIAT_iP.mjs +28 -0
  10. package/dist/{acm-Szq4CoQN.mjs → acm-VULm1djv.mjs} +1 -1
  11. package/dist/{addressing-CgTTbuCF.mjs → addressing-BHPBIkRY.mjs} +1 -1
  12. package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-KBy48G1b.mjs} +1 -1
  13. package/dist/{agent-memory-C8pT01pR.mjs → agent-memory-DDv_Gxr7.mjs} +2 -2
  14. package/dist/{ai-audit-CCygMmsh.mjs → ai-audit-BWZGvbca.mjs} +1 -1
  15. package/dist/{ai-gateway-D4tATNRV.mjs → ai-gateway-jeB-sAgP.mjs} +1 -1
  16. package/dist/ai-search-BmdskMjR.mjs +7 -0
  17. package/dist/{ai-security-AUfzagSE.mjs → ai-security-CsmfcaUx.mjs} +1 -1
  18. package/dist/{ai-Cn0BniR4.mjs → ai-viHB1tgI.mjs} +1 -1
  19. package/dist/{alerting-DbXVpGv3.mjs → alerting-Bl8OqViR.mjs} +4 -4
  20. package/dist/analytics-vOxw8Hy0.mjs +3 -0
  21. package/dist/{analytics_engine-B_bMbfxW.mjs → analytics_engine-DO4-C0wD.mjs} +1 -1
  22. package/dist/{api-security-pSJdgmtK.mjs → api-security-4FVrD4n8.mjs} +1 -1
  23. package/dist/argo-CQfCgazW.mjs +2 -0
  24. package/dist/args-DlUhyGU0.mjs +2 -0
  25. package/dist/artifacts-CVDGnr2V.mjs +4 -0
  26. package/dist/{audit-logs-BIHP5-rk.mjs → audit-logs-CzpwvQ6A.mjs} +1 -1
  27. package/dist/{auth-MeSu8lFz.mjs → auth-D0xZxAEa.mjs} +1 -1
  28. package/dist/{auth-C6MhC9EZ.mjs → auth-MQEamPN9.mjs} +2 -2
  29. package/dist/{billing-0RNCYBJM.mjs → billing-aJgapeRm.mjs} +2 -2
  30. package/dist/{bot-management-uhBRnSPl.mjs → bot-management-Y2q5d-pi.mjs} +1 -1
  31. package/dist/{botnet-feed-DEbMknrE.mjs → botnet-feed-DANJqfmE.mjs} +1 -1
  32. package/dist/{brand-protection-DY2qPL8d.mjs → brand-protection-CjpZWBjp.mjs} +1 -1
  33. package/dist/{browser-extension-DBsmLCUj.mjs → browser-extension-BtpCbh-2.mjs} +1 -1
  34. package/dist/browser-run-BFn9h2Tz.mjs +4 -0
  35. package/dist/{build-Nivzj54_.mjs → build-DcflwvqN.mjs} +1 -1
  36. package/dist/{cache-BgRIDcFJ.mjs → cache-VyWK1SjY.mjs} +1 -1
  37. package/dist/{calls-JrRne0U0.mjs → calls-BxoRYxs4.mjs} +1 -1
  38. package/dist/{certificate-authorities-BJ7W8GGQ.mjs → certificate-authorities-D7OAFxF_.mjs} +1 -1
  39. package/dist/{cf-BUKsENG5.mjs → cf-C7DU4819.mjs} +2 -2
  40. package/dist/{chunk-LQW53VED-Xakf_rUn.mjs → chunk-LQW53VED-DLrXV-hE.mjs} +2 -2
  41. package/dist/{client-certificates-6xxvcOgI.mjs → client-certificates-DDUv8K0a.mjs} +1 -1
  42. package/dist/{client-side-security-cU0Z1tql.mjs → client-side-security-D4ysjwWT.mjs} +1 -1
  43. package/dist/{cloud-connector-DFooSAcn.mjs → cloud-connector-Bhec6z2P.mjs} +1 -1
  44. package/dist/cloudforce-one-J_hn9ss9.mjs +36 -0
  45. package/dist/config.mjs +1 -1
  46. package/dist/connector-interrupts-Dycx8zFx.mjs +2 -0
  47. package/dist/{connector-telemetry-events-CTMmX2BA.mjs → connector-telemetry-events-BmxOSNtN.mjs} +1 -1
  48. package/dist/connector-telemetry-events-latest-BY2556uL.mjs +2 -0
  49. package/dist/{connector-telemetry-snapshots-5Y7m8Cw8.mjs → connector-telemetry-snapshots-CdcqfKnH.mjs} +1 -1
  50. package/dist/connector-telemetry-snapshots-latest-BHYdxUEF.mjs +2 -0
  51. package/dist/{connectors-BRCQSsos.mjs → connectors-BqxYMMtQ.mjs} +1 -1
  52. package/dist/{containers-CfKOM_f5.mjs → containers-CKW081JA.mjs} +8 -8
  53. package/dist/{content-scan-CB4xHGv1.mjs → content-scan-Dgd7A8KF.mjs} +1 -1
  54. package/dist/{csamScanner-AQo_QTlq.mjs → csamScanner-DYL37wLc.mjs} +1 -1
  55. package/dist/{ct-alerting-Bai-1Z3k.mjs → ct-alerting-CkhSbfAs.mjs} +1 -1
  56. package/dist/{custom-certificates-D6aQIGu2.mjs → custom-certificates-BzAOnEoT.mjs} +1 -1
  57. package/dist/custom-csrs-CgzG3pd3.mjs +3 -0
  58. package/dist/{custom-hostnames-BiOVGwnR.mjs → custom-hostnames-q_nsnlye.mjs} +4 -4
  59. package/dist/custom-nameservers-BUBmfhUe.mjs +3 -0
  60. package/dist/custom-pages-M7jA2Hit.mjs +3 -0
  61. package/dist/{d1-FmAh7T7l.mjs → d1-BFvMd6-S.mjs} +1 -1
  62. package/dist/{data-security-2fmzF_Me.mjs → data-security-Bji4Or_j.mjs} +2 -2
  63. package/dist/{dcv-delegation-Cmxxgi9V.mjs → dcv-delegation-BuoRQ1Yh.mjs} +1 -1
  64. package/dist/{deploy-BzFbjH6a.mjs → deploy-CZ7bgNDu.mjs} +1 -1
  65. package/dist/{deploy-input-BRMQehgs.mjs → deploy-input-CrvuoDGJ.mjs} +1 -1
  66. package/dist/{dev-CWaf-qW4.mjs → dev-V10MG-Bg.mjs} +1 -1
  67. package/dist/{diagnostics-Ca6r_972.mjs → diagnostics-BTH-8nJH.mjs} +2 -2
  68. package/dist/{directory-CGNWfVQc.mjs → directory-BlH6N6Qy.mjs} +1 -1
  69. package/dist/{dispatch-namespaces-CBo5kuf7.mjs → dispatch-namespaces-BCjH1JzB.mjs} +1 -1
  70. package/dist/{dist-COfwjT96.mjs → dist-CgrMkXFx.mjs} +1 -1
  71. package/dist/{dls-CobKlH4N.mjs → dls-BF5iN78p.mjs} +1 -1
  72. package/dist/{dns-OfJXNYkK.mjs → dns-CeCTNqRk.mjs} +11 -11
  73. package/dist/{dns-firewall-DZ2ij-nX.mjs → dns-firewall-B54MaLGm.mjs} +1 -1
  74. package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wIVDg_fl.mjs} +1 -1
  75. package/dist/{durable-objects-Cw_y37WB.mjs → durable-objects-D8FQORrL.mjs} +1 -1
  76. package/dist/{email-auth-DuJHdiwN.mjs → email-auth-DJK0Eb30.mjs} +1 -1
  77. package/dist/email-routing-NpmiKIrl.mjs +6 -0
  78. package/dist/{email-security-D-P8ln2L.mjs → email-security-BLZ7WZ9Z.mjs} +2 -2
  79. package/dist/email-sending-dn-353Nx.mjs +7 -0
  80. package/dist/fieldExtractors-ahysj57J.mjs +3 -0
  81. package/dist/firewall-CBPGJ43p.mjs +11 -0
  82. package/dist/{flagship-CPkQMist.mjs → flagship-BusjRNIb.mjs} +3 -3
  83. package/dist/{fraud-BhX0QNUl.mjs → fraud-BIhS8pLf.mjs} +1 -1
  84. package/dist/{google-tag-gateway-CDtRxao4.mjs → google-tag-gateway-TZZ3F1tV.mjs} +1 -1
  85. package/dist/{healthchecks-D2WwALvQ.mjs → healthchecks-FiXIk-KP.mjs} +2 -2
  86. package/dist/{hostnames-CGAFkYT1.mjs → hostnames-Bx0mykMR.mjs} +1 -1
  87. package/dist/{hyperdrive-zLFPWFQj.mjs → hyperdrive-C8qCabBF.mjs} +1 -1
  88. package/dist/{iam-Su_hpatD.mjs → iam-Cj63Kjc6.mjs} +1 -1
  89. package/dist/{images-D2ZflvBi.mjs → images-CBWXCDhy.mjs} +1 -1
  90. package/dist/index.mjs +1 -1
  91. package/dist/{intel-DPGzVovJ.mjs → intel-B-9Z_sJs.mjs} +2 -2
  92. package/dist/{interactive-CM2G03lr.mjs → interactive-DtsCYfrK.mjs} +1 -1
  93. package/dist/{ips-C5-NH1b0.mjs → ips-qs9eGJnI.mjs} +1 -1
  94. package/dist/{keyless-certificates-Xx-oAN3Z.mjs → keyless-certificates-THHvoXX3.mjs} +1 -1
  95. package/dist/{keys-B0FBtlOD.mjs → keys-D7N0j4-x.mjs} +1 -1
  96. package/dist/{kv-BbZ9st5o.mjs → kv-BFDUCnft.mjs} +1 -1
  97. package/dist/{leaked-credential-checks-Vonw4inx.mjs → leaked-credential-checks-DUlUCOoJ.mjs} +1 -1
  98. package/dist/load-balancers-D2zbQ8fT.mjs +6 -0
  99. package/dist/{local-eEF0NF51.mjs → local-D-aVNu6A.mjs} +1 -1
  100. package/dist/{local-runtime-BNCCOZ8s.mjs → local-runtime-Dh3keC5v.mjs} +1 -1
  101. package/dist/logexplorer-CUsfZ_bS.mjs +13 -0
  102. package/dist/{logo-matches-oHYc8Xaz.mjs → logo-matches-CJcthPHf.mjs} +1 -1
  103. package/dist/{logos-DS0krPAz.mjs → logos-BS65zN8q.mjs} +1 -1
  104. package/dist/logpush-BK34mMQs.mjs +4 -0
  105. package/dist/{logs-C07M9zn-.mjs → logs-CLAqX9h2.mjs} +1 -1
  106. package/dist/{magic-cloud-networking-ZPEK7O5I.mjs → magic-cloud-networking-h_ozrC5S.mjs} +1 -1
  107. package/dist/magic-network-monitoring-C7tAPNKP.mjs +4 -0
  108. package/dist/{magic-transit-CgPZ8iMn.mjs → magic-transit-BtsFePMx.mjs} +5 -5
  109. package/dist/{managed-transforms-2XyQ14s3.mjs → managed-transforms-Cm_KVCMB.mjs} +1 -1
  110. package/dist/{matches-CIaCrdrs.mjs → matches-InA1hwII.mjs} +1 -1
  111. package/dist/{mcp-D2afM8MD.mjs → mcp-mJ7bekNJ.mjs} +1 -1
  112. package/dist/mesh-BK4S1Ezy.mjs +4 -0
  113. package/dist/{moq-BBQVNGo1.mjs → moq-qmuVPAO0.mjs} +1 -1
  114. package/dist/{mtls-certificates-C5j0Gn65.mjs → mtls-certificates-CU4OAAXY.mjs} +1 -1
  115. package/dist/{network-CmuJqtFJ.mjs → network-D74cSy3t.mjs} +1 -1
  116. package/dist/{network-interconnects-BlajBQqs.mjs → network-interconnects-BJ0Nc48J.mjs} +1 -1
  117. package/dist/{oauth-BjHjJtnn.mjs → oauth-B0ETkNcX.mjs} +2 -2
  118. package/dist/{oauth-clients-BSthfZP-.mjs → oauth-clients-Br-smLxQ.mjs} +1 -1
  119. package/dist/{oauth-scopes-ByUp5bLU.mjs → oauth-scopes-D5bF11ju.mjs} +1 -1
  120. package/dist/observability-BWE0Gg3V.mjs +4 -0
  121. package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-R-qesf18.mjs} +1 -1
  122. package/dist/{organization-DQIfNVCT.mjs → organization-NX7yCZrq.mjs} +1 -1
  123. package/dist/{organizations-L_ycAy6r.mjs → organizations-DLhiRt8g.mjs} +1 -1
  124. package/dist/{origin-ca-certificates-opIcs3_Q.mjs → origin-ca-certificates-Ff4McZRQ.mjs} +1 -1
  125. package/dist/{origin-post-quantum-encryption-TSMXzoEL.mjs → origin-post-quantum-encryption-UuTr4_SW.mjs} +1 -1
  126. package/dist/{origin-tls-client-auth-5CtcPUR6.mjs → origin-tls-client-auth-DOJ1zlH3.mjs} +1 -1
  127. package/dist/{output-DgW1hQGX.mjs → output-DrpYYfnB.mjs} +1 -1
  128. package/dist/{page-rules-DPd1Y3IL.mjs → page-rules-BSz1gO-_.mjs} +1 -1
  129. package/dist/{pages-CskAn5mR.mjs → pages-DVDogxPs.mjs} +4 -4
  130. package/dist/{pay-per-crawl-BMa_V40s.mjs → pay-per-crawl-BrLXK7gT.mjs} +1 -1
  131. package/dist/{pipelines-BbJjj1ZQ.mjs → pipelines-BszRk4sM.mjs} +2 -2
  132. package/dist/{precursor-DgRWBN9_.mjs → precursor-BPNjQr76.mjs} +1 -1
  133. package/dist/progress-CsHIt3Tp.mjs +2 -0
  134. package/dist/{prompt-DM4z101s.mjs → prompt-DdegNPpg.mjs} +1 -1
  135. package/dist/{queries-DrqcK0ZX.mjs → queries-JL1H1Biz.mjs} +1 -1
  136. package/dist/{queues-CutvMZcc.mjs → queues-DpkYdRUE.mjs} +1 -1
  137. package/dist/{r2-sFI62vhq.mjs → r2-CKozthw_.mjs} +4 -4
  138. package/dist/{r2-data-catalog-3vzU6FE1.mjs → r2-data-catalog-Du7hN9jA.mjs} +1 -1
  139. package/dist/radar-C-92vggG.mjs +2 -0
  140. package/dist/{rate-limits-HRZ8zMSl.mjs → rate-limits-yBF3qoYD.mjs} +1 -1
  141. package/dist/{raw-fetch-25gXED6c.mjs → raw-fetch-CteyTOM2.mjs} +1 -1
  142. package/dist/realtimekit-CIP7lP-a.mjs +7 -0
  143. package/dist/{registrar-C0EsXf83.mjs → registrar-DKKN0M29.mjs} +3 -3
  144. package/dist/{registrar-sandbox-CR9Rr7jV.mjs → registrar-sandbox-DiXg8p_1.mjs} +3 -3
  145. package/dist/{registry-CJvn75Bq.mjs → registry-Bck_zFkz.mjs} +1 -1
  146. package/dist/{reporting-BB6sqe6r.mjs → reporting-fg_GKXe1.mjs} +1 -1
  147. package/dist/{request-tracers-BrsM3zXZ.mjs → request-tracers-CkMya96z.mjs} +1 -1
  148. package/dist/{resource-sharing-CusU3kiy.mjs → resource-sharing-D1pSDvtf.mjs} +1 -1
  149. package/dist/{resource-tagging-wXAcblmz.mjs → resource-tagging-z48JGHCq.mjs} +1 -1
  150. package/dist/{rules-C2BxykEe.mjs → rules-BTmNjDN-.mjs} +1 -1
  151. package/dist/rulesets-CsoSM-17.mjs +5 -0
  152. package/dist/{rum-Dyno5zj3.mjs → rum-DB4iO2q5.mjs} +1 -1
  153. package/dist/{schema-BeXPWeK9.mjs → schema-B34Q9tLF.mjs} +1 -1
  154. package/dist/{schema-flags-C1BRprT2.mjs → schema-flags-iGoOriJt.mjs} +1 -1
  155. package/dist/{scim-Bb2xHpIz.mjs → scim-CcSyfKCH.mjs} +1 -1
  156. package/dist/sdk-ZctLa5jW.mjs +3 -0
  157. package/dist/{secrets-store-BMhjbceW.mjs → secrets-store-DFmvtphu.mjs} +1 -1
  158. package/dist/security-center-DFKeHq5c.mjs +2 -0
  159. package/dist/{security-txt-Bh_2gymk.mjs → security-txt-DqnFpjMI.mjs} +1 -1
  160. package/dist/{session-Br-q_UIW.mjs → session-D6KHthHf.mjs} +1 -1
  161. package/dist/{share-DfTpOxhk.mjs → share-BuwYUzOL.mjs} +1 -1
  162. package/dist/{shared-BNjZc02w.mjs → shared-VppSAQf4.mjs} +1 -1
  163. package/dist/{smart-shield-rHn-Lckq.mjs → smart-shield-D6X8L7p8.mjs} +2 -2
  164. package/dist/{snippets-nSLwH8uJ.mjs → snippets-DIpc9pb_.mjs} +1 -1
  165. package/dist/{spawn-Bj8QRFJ5.mjs → spawn-O1RS01vr.mjs} +2 -2
  166. package/dist/{spectrum-DuhSUTZI.mjs → spectrum-b7N1ZRAm.mjs} +1 -1
  167. package/dist/{speed-Dgby_e1J.mjs → speed-cw31yFva.mjs} +1 -1
  168. package/dist/src-D_HETJNy.mjs +108 -0
  169. package/dist/{ssl-BsxTHasY.mjs → ssl-CsEhRVTO.mjs} +1 -1
  170. package/dist/{state-C1m9nwUm.mjs → state-Bb5Cbc_L.mjs} +1 -1
  171. package/dist/{stream-CkEOX5Ko.mjs → stream-DFOao6Gu.mjs} +3 -3
  172. package/dist/{submit-BjdywxTq.mjs → submit--xTzyNPy.mjs} +1 -1
  173. package/dist/{tags-CFAw_Sce.mjs → tags-efICDkah.mjs} +1 -1
  174. package/dist/{tenant-C66iOy5O.mjs → tenant-CerHuToJ.mjs} +1 -1
  175. package/dist/{tenant-custom-nameservers-CyJZ_AB0.mjs → tenant-custom-nameservers-C4otMBm2.mjs} +1 -1
  176. package/dist/{tools-D2Xxfkrc.mjs → tools-BHfBOZOU.mjs} +1 -1
  177. package/dist/{triggers-Dv22ZXM4.mjs → triggers-BEsiiKAf.mjs} +1 -1
  178. package/dist/{tunnel-BatkLdds.mjs → tunnel-DkMiNtVY.mjs} +1 -1
  179. package/dist/{tunnels-CstoXOoq.mjs → tunnels-D0J8lJoI.mjs} +1 -1
  180. package/dist/{turnstile-IoRtama4.mjs → turnstile-CFmtY5bn.mjs} +2 -2
  181. package/dist/{ui-DjQ4AQww.mjs → ui-DE8CNn6c.mjs} +1 -1
  182. package/dist/{url-info-Hjhwr2la.mjs → url-info-DBCeRWwb.mjs} +1 -1
  183. package/dist/{url-normalization-C2BP_Kl0.mjs → url-normalization-ClfFiruK.mjs} +1 -1
  184. package/dist/{url-scanner-DmYVTdAE.mjs → url-scanner-CNyvg65L.mjs} +1 -1
  185. package/dist/{user-CVHm-cnB.mjs → user-bifVEQq5.mjs} +2 -2
  186. package/dist/{values-Cmlw5wGZ.mjs → values-OxkdP1tV.mjs} +1 -1
  187. package/dist/{vectorize-BQtIqiNO.mjs → vectorize-CVKu7lEt.mjs} +1 -1
  188. package/dist/{versions-CU6Av1vh.mjs → versions-BVL-Ludh.mjs} +1 -1
  189. package/dist/waiting-rooms-CmRAl51T.mjs +11 -0
  190. package/dist/{web-assets-DmSKaxzf.mjs → web-assets-C2s9kzWf.mjs} +1 -1
  191. package/dist/{web3-DVv4jNul.mjs → web3-y_cY91V_.mjs} +1 -1
  192. package/dist/{workers-builds-DgrejrUc.mjs → workers-builds-B55-oXOa.mjs} +4 -4
  193. package/dist/{workers-D8czeT64.mjs → workers-jDcq14GH.mjs} +6 -6
  194. package/dist/{workflows-BOi5MTEN.mjs → workflows-B-kGHxFu.mjs} +2 -2
  195. package/dist/{zaraz-CGSSFJng.mjs → zaraz-27zwjLvv.mjs} +1 -1
  196. package/dist/zero-trust-DV3sIOvu.mjs +92 -0
  197. package/dist/{zone-Bx5ElO9U.mjs → zone-BJix2KQ9.mjs} +1 -1
  198. package/dist/{zones-_SnlZMiM.mjs → zones-Bkj5i92c.mjs} +1 -1
  199. package/package.json +2 -2
  200. package/dist/account-tags-CKRh1jra.mjs +0 -9
  201. package/dist/accounts-2pGhN4s8.mjs +0 -28
  202. package/dist/ai-search-2xP8FP_W.mjs +0 -7
  203. package/dist/analytics-UQrIx99t.mjs +0 -3
  204. package/dist/argo-Br60zF3y.mjs +0 -2
  205. package/dist/artifacts-D8HMRQmb.mjs +0 -4
  206. package/dist/browser-run-C5pYOwtf.mjs +0 -4
  207. package/dist/cloudforce-one-Cp4bQmrG.mjs +0 -30
  208. package/dist/connector-interrupts-BR47snkh.mjs +0 -2
  209. package/dist/custom-csrs-D0zBkQT5.mjs +0 -4
  210. package/dist/custom-nameservers-G2MWpRwY.mjs +0 -3
  211. package/dist/custom-pages-BINNZTds.mjs +0 -4
  212. package/dist/email-CGOC_evd.mjs +0 -2
  213. package/dist/email-routing-CRvIUSFm.mjs +0 -6
  214. package/dist/email-sending-BwRN8PMW.mjs +0 -7
  215. package/dist/filters-DczM8qpH.mjs +0 -4
  216. package/dist/firewall-BMiETRmM.mjs +0 -11
  217. package/dist/load-balancers-Ct5cyyF9.mjs +0 -7
  218. package/dist/logexplorer-BhsAWxCr.mjs +0 -24
  219. package/dist/logpush-CFQBi88z.mjs +0 -5
  220. package/dist/magic-network-monitoring-CY3CHSpX.mjs +0 -4
  221. package/dist/media-CnxgOViL.mjs +0 -2
  222. package/dist/mesh-DLNLi3UT.mjs +0 -4
  223. package/dist/observability-B5p3iwrq.mjs +0 -4
  224. package/dist/progress-C-oFUtvC.mjs +0 -2
  225. package/dist/radar-Cu9rsTw_.mjs +0 -2
  226. package/dist/realtimekit-msnGHBbf.mjs +0 -7
  227. package/dist/rulesets-BHvhAeG_.mjs +0 -8
  228. package/dist/sdk-m4xeaua4.mjs +0 -3
  229. package/dist/security-center-DRC4Mf3R.mjs +0 -2
  230. package/dist/src-CgAVPA4I.mjs +0 -108
  231. package/dist/waiting-rooms-ku9UsAr9.mjs +0 -11
  232. package/dist/zero-trust-BmA0VkgF.mjs +0 -102
  233. package/dist/zone-tags-izd3WWmy.mjs +0 -9
  234. /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
  235. /package/dist/{alerts-B85uj2Vx.mjs → alerts-CRmjqOZi.mjs} +0 -0
  236. /package/dist/{autorag-Do9l_LyY.mjs → autorag-BD7cu5NU.mjs} +0 -0
  237. /package/dist/{body-parser-CYD7PKFC.mjs → body-parser-C-c9gfH1.mjs} +0 -0
  238. /package/dist/{brands-DateHCdd.mjs → brands-BhALBkX2.mjs} +0 -0
  239. /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-B7bSMYLe.mjs} +0 -0
  240. /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
  241. /package/dist/{clear-CB2kgcEB.mjs → clear-BgF8No7D.mjs} +0 -0
  242. /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-BsTty22w.mjs} +0 -0
  243. /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C50W5GhA.mjs} +0 -0
  244. /package/dist/{health-buY5f5pp.mjs → health-BFNZqiAm.mjs} +0 -0
  245. /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-Bav2M9F-.mjs} +0 -0
  246. /package/dist/{internal-CwyoJUHh.mjs → internal-BTeSewwB.mjs} +0 -0
  247. /package/dist/{live-wEpA5V_n.mjs → live-Dkiyu30_.mjs} +0 -0
  248. /package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BwQqexwo-CNW_dPly.mjs} +0 -0
  249. /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-Dz-Wv1T0.mjs} +0 -0
  250. /package/dist/{ready-CBSCPiHE.mjs → ready-TKOkKeRg.mjs} +0 -0
  251. /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-3Asm6eIi.mjs} +0 -0
  252. /package/dist/{refute-u7ZPQJZy.mjs → refute-BVz9nMyd.mjs} +0 -0
  253. /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-CeBbH6Pq.mjs} +0 -0
  254. /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-ZteA-PUV.mjs} +0 -0
  255. /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-DWDSyzQ7.mjs} +0 -0
  256. /package/dist/{search-D9WDwnV4.mjs → search-DGNc37HK.mjs} +0 -0
  257. /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-B5Qpn2mn.mjs} +0 -0
  258. /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-FjUolE6A.mjs} +0 -0
  259. /package/dist/{theme-BePJemMn.mjs → theme-CeVf-5qG.mjs} +0 -0
  260. /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-NHJj1HGq.mjs} +0 -0
  261. /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CniKVHIp.mjs} +0 -0
  262. /package/dist/{verify-2yi0H93r.mjs → verify-DS1PWAJe.mjs} +0 -0
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-BjHjJtnn.mjs";import{r as t}from"./auth-C6MhC9EZ.mjs";import{t as n}from"./output-DgW1hQGX.mjs";import{n as r,t as i}from"./progress-C-oFUtvC.mjs";function a(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const o={command:`activate`,describe:`Triggeres a new activation check for a PENDING Zone. This can be triggered every 5 min for paygo/ent customers, every hour for FREE Zones.`,builder:a,handler:async a=>{if(a.dryRun){r({command:`cf zone activate`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/activation_check`,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(`Updating`,async()=>o.zone.activate({zone_id:s})),{successLabel:`Updated`})}},s={command:`zone`,describe:`zone`,builder:e=>e.command(o).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{s as default};
2
+ import{h as e}from"./oauth-B0ETkNcX.mjs";import{r as t}from"./auth-MQEamPN9.mjs";import{t as n}from"./output-DrpYYfnB.mjs";import{n as r,t as i}from"./progress-CsHIt3Tp.mjs";function a(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const o={command:`activate`,describe:`Triggeres a new activation check for a PENDING Zone. This can be triggered every 5 min for paygo/ent customers, every hour for FREE Zones.`,builder:a,handler:async a=>{if(a.dryRun){r({command:`cf zone activate`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/activation_check`,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(`Updating`,async()=>o.zone.activate({zone_id:s})),{successLabel:`Updated`})}},s={command:`zone`,describe:`zone`,builder:e=>e.command(o).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{s as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-BjHjJtnn.mjs";import{r as t}from"./auth-C6MhC9EZ.mjs";import{t as n}from"./output-DgW1hQGX.mjs";import{n as r,t as i}from"./progress-C-oFUtvC.mjs";import{n as a,t as o}from"./body-parser-CYD7PKFC.mjs";import{n as s}from"./input-validation-BBKJRoRB.mjs";import{a as c,i as l,n as u}from"./prompt-DM4z101s.mjs";import{t as d}from"./cli-types-BWdZbsFE.mjs";function f(e){return e.option(`value-enabled`,{type:`boolean`,description:`Whether the feature is enabled or not.`}).option(`value-pool-id`,{type:`string`,description:`Egress pool id which refers to a grouping of dedicated egress IPs through which Cloudflare will connect to origin.`}).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 ee={command:`edit`,describe:`Aegis provides dedicated egress IPs (from Cloudflare to your origin) for your layer 7 WAF and CDN services. The egress IPs are reserved exclusively for your account so that you can increase your origin security by only allowing traffic from a small list of IP addresses.`,builder:f,handler:async c=>{if(c.dryRun){r({command:`cf zones aegis edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/settings/aegis`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({value:{enabled:c[`value-enabled`],pool_id:s(c[`value-pool-id`],`value-pool-id`,`text`)}}):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.zones.aegis.edit({...e,zone_id:u})),{successLabel:`Updated`});return}let d=o({value:{enabled:c[`value-enabled`],pool_id:s(c[`value-pool-id`],`value-pool-id`,`text`)}});n(await i(`Updating`,async()=>l.zones.aegis.edit({...d,zone_id:u})),{successLabel:`Updated`})}};function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:`Aegis provides dedicated egress IPs (from Cloudflare to your origin) for your layer 7 WAF and CDN services. The egress IPs are reserved exclusively for your account so that you can increase your origin security by only allowing traffic from a small list of IP addresses.`,builder:p,handler:async a=>{if(a.dryRun){r({command:`cf zones aegis get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/settings/aegis`,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.zones.aegis.get({zone_id:s})),{successLabel:`Loaded`})}},h={command:`aegis`,describe:`Operations for aegis`,builder:e=>e.command(ee).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`account-id`,{type:`string`,description:`Identifier`}).option(`name`,{type:`string`,description:`The domain name. Per [RFC 1035](https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.4) the overall zone name can be up to 253 characters, with each segment ("label") not exceeding 63 characters.`}).option(`type`,{type:`string`,description:`A full zone implies that DNS is hosted with Cloudflare. A partial zone is
2
+ import{h as e}from"./oauth-B0ETkNcX.mjs";import{r as t}from"./auth-MQEamPN9.mjs";import{t as n}from"./output-DrpYYfnB.mjs";import{n as r,t as i}from"./progress-CsHIt3Tp.mjs";import{n as a,t as o}from"./body-parser-C-c9gfH1.mjs";import{n as s}from"./input-validation-Bav2M9F-.mjs";import{a as c,i as l,n as u}from"./prompt-DdegNPpg.mjs";import{t as d}from"./cli-types-BsTty22w.mjs";function f(e){return e.option(`value-enabled`,{type:`boolean`,description:`Whether the feature is enabled or not.`}).option(`value-pool-id`,{type:`string`,description:`Egress pool id which refers to a grouping of dedicated egress IPs through which Cloudflare will connect to origin.`}).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 ee={command:`edit`,describe:`Aegis provides dedicated egress IPs (from Cloudflare to your origin) for your layer 7 WAF and CDN services. The egress IPs are reserved exclusively for your account so that you can increase your origin security by only allowing traffic from a small list of IP addresses.`,builder:f,handler:async c=>{if(c.dryRun){r({command:`cf zones aegis edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/settings/aegis`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({value:{enabled:c[`value-enabled`],pool_id:s(c[`value-pool-id`],`value-pool-id`,`text`)}}):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.zones.aegis.edit({...e,zone_id:u})),{successLabel:`Updated`});return}let d=o({value:{enabled:c[`value-enabled`],pool_id:s(c[`value-pool-id`],`value-pool-id`,`text`)}});n(await i(`Updating`,async()=>l.zones.aegis.edit({...d,zone_id:u})),{successLabel:`Updated`})}};function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:`Aegis provides dedicated egress IPs (from Cloudflare to your origin) for your layer 7 WAF and CDN services. The egress IPs are reserved exclusively for your account so that you can increase your origin security by only allowing traffic from a small list of IP addresses.`,builder:p,handler:async a=>{if(a.dryRun){r({command:`cf zones aegis get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/settings/aegis`,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.zones.aegis.get({zone_id:s})),{successLabel:`Loaded`})}},h={command:`aegis`,describe:`Operations for aegis`,builder:e=>e.command(ee).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`account-id`,{type:`string`,description:`Identifier`}).option(`name`,{type:`string`,description:`The domain name. Per [RFC 1035](https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.4) the overall zone name can be up to 253 characters, with each segment ("label") not exceeding 63 characters.`}).option(`type`,{type:`string`,description:`A full zone implies that DNS is hosted with Cloudflare. A partial zone is
3
3
  typically a partner-hosted zone or a CNAME setup.
4
4
  `,choices:[`full`,`partial`,`secondary`,`internal`],default:`full`}).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 _={command:`create`,describe:`Creates a new zone (domain) in your Cloudflare account. The zone is created in a pending state and must be activated by updating your domain's nameservers to point to Cloudflare, or by completing the verification process for partial (CNAME) setups.`,builder:g,handler:async e=>{if(e.dryRun){r({command:`cf zones create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones`,pathParams:{},bodyKind:`json`,body:e.body===void 0?o({account:{id:s(e[`account-id`],`account-id`,`text`)},name:s(e.name,`name`,`text`),type:s(e.type,`type`,`text`)}):a(e.body)});return}let l=await t(e);if(e.body){let t=a(e.body);n(await i(`Creating`,async()=>l.zones.create({...t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await c(`name`,`The domain name. Per [RFC 1035](https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.4) the overall zone name can be up to 253 characters, with each segment ("label") not exceeding 63 characters.`));let u=o({account:{id:s(e[`account-id`],`account-id`,`text`)},name:s(e.name,`name`,`text`),type:s(e.type,`type`,`text`)});n(await i(`Creating`,async()=>l.zones.create({...u})),{successLabel:`Created`})}};function v(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 y={command:`delete`,describe:`Deletes an existing zone.`,builder:v,handler:async a=>{if(a.dryRun){r({command:`cf zones delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}`,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});if(a.zoneId=s,!await u({force:!!a.force})){process.stderr.write(`Aborted.
5
5
  `);return}n(await i(`Deleting`,async()=>o.zones.delete({zone_id:s})),{successLabel:`Deleted`})}};function b(e){return e.option(`paused`,{type:`boolean`,description:`Indicates whether the zone is only using Cloudflare DNS services. A
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "The Cloudflare CLI",
5
5
  "keywords": [
6
6
  "ai",
@@ -59,7 +59,7 @@
59
59
  "@cloudflare/deploy-helpers": "0.10.1",
60
60
  "@cloudflare/forge": "file:../../vendor/cloudflare-forge-0.1.0.tgz",
61
61
  "@cloudflare/forge-transformer-sdk-ts": "file:../../vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz",
62
- "@cloudflare/workers-auth": "0.6.8",
62
+ "@cloudflare/workers-auth": "0.6.9",
63
63
  "@cloudflare/workers-utils": "0.36.0",
64
64
  "@types/node": "25.3.5",
65
65
  "@types/yargs": "17.0.35",
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{a as r,r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.mjs";import{n as c,r as l,t as u}from"./body-parser-CYD7PKFC.mjs";import{n as d}from"./input-validation-BBKJRoRB.mjs";import{a as f,i as p,n as m}from"./prompt-DM4z101s.mjs";import{t as h}from"./cli-types-BWdZbsFE.mjs";function g(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
3
- verify the current resource ETag matches before applying the write. Returns
4
- 412 Precondition Failed if the resource has been modified since the ETag was
5
- obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for worker_version resource type.`,choices:[`worker_version`]}).option(`worker-id`,{type:`string`,description:`Worker ID is required only for worker_version resources`}).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}).option(`body`,{type:`string`,description:`Request body schema for deleting tags from account-level resources. Use /zones/{zone_id}/tags for zone-level resources.`})}const _={command:`delete`,describe:`Removes all tags from a specific account-level resource.`,builder:g,handler:async h=>{let g={};if(h[`if-match`]!==void 0&&(g[`If-Match`]=String(h[`if-match`])),h.dryRun){o({command:`cf account-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:h.body===void 0?u({resource_id:d(h[`resource-id`],`resource-id`,`text`),resource_type:d(h[`resource-type`],`resource-type`,`text`),worker_id:d(h[`worker-id`],`worker-id`,`text`)}):c(h.body)});return}let _=await i(h),v=h.local?e:await t();if(h.accountId=v,!await m({force:!!h.force})){process.stderr.write(`Aborted.
6
- `);return}if(h.body){let e=c(h.body);a(await s(`Deleting`,async()=>r(_,`DELETE`,`/accounts/${v}/tags`,{body:e,headers:Object.keys(g).length>0?g:void 0})),{successLabel:`Deleted`});return}h[`resource-id`]===void 0&&(h[`resource-id`]=await f(`resource-id`,`Identifies the unique resource.`)),h[`resource-type`]===void 0&&(h[`resource-type`]=await p(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`])),h[`resource-type`]===`worker_version`&&h[`worker-id`]===void 0&&(h[`worker-id`]=await f(`worker-id`,`Worker ID is required only for worker_version resources`,{question:`Enter value for --worker-id`}));let y={};h[`resource-id`]!==void 0&&l(y,[`resource_id`],d(h[`resource-id`],`resource-id`,`text`)),h[`resource-type`]!==void 0&&l(y,[`resource_type`],d(h[`resource-type`],`resource-type`,`text`)),h[`worker-id`]!==void 0&&l(y,[`worker_id`],d(h[`worker-id`],`worker-id`,`text`)),a(await s(`Deleting`,async()=>r(_,`DELETE`,`/accounts/${v}/tags`,{body:Object.keys(y).length>0?y:void 0,headers:Object.keys(g).length>0?g:void 0})),{successLabel:`Deleted`})}};function v(e){return e.option(`resource-id`,{type:`string`,description:`The ID of the resource to retrieve tags for.`,demandOption:!0}).option(`resource-type`,{type:`string`,description:`The type of the resource.`,choices:`access_application.access_group.account.account_ruleset.ai_gateway.alerting_policy.alerting_webhook.cloudflared_tunnel.d1_database.durable_object_namespace.gateway_list.gateway_rule.image.infrastructure_target.kv_namespace.load_balancer_monitor.load_balancer_pool.pages_project.queue.r2_bucket.resource_share.stream_live_input.stream_video.vectorize_index.worker.worker_version`.split(`.`),demandOption:!0}).option(`worker-id`,{type:`string`,description:`Worker identifier. Required for worker_version resources.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get`,describe:`Retrieves tags for a specific account-level resource.`,builder:h(v),handler:async r=>{let c={resource_id:r[`resource-id`],resource_type:r[`resource-type`],worker_id:r[`worker-id`]};if(r.dryRun){o({command:`cf account-tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tags`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accountTags.get({account_id:u,...c})),{successLabel:`Loaded`})}};function b(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
7
- verify the current resource ETag matches before applying the write. Returns
8
- 412 Precondition Failed if the resource has been modified since the ETag was
9
- obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for worker_version resource type.`,choices:[`worker_version`]}).option(`worker-id`,{type:`string`,description:`Worker ID is required only for worker_version resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body schema for setting tags on account-level resources.`})}const x={command:`update`,describe:`Creates or updates tags for a specific account-level resource.`,builder:b,handler:async m=>{let h={};if(m[`if-match`]!==void 0&&(h[`If-Match`]=String(m[`if-match`])),m.dryRun){o({command:`cf account-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:m.body===void 0?u({resource_id:d(m[`resource-id`],`resource-id`,`text`),resource_type:d(m[`resource-type`],`resource-type`,`text`),worker_id:d(m[`worker-id`],`worker-id`,`text`)}):c(m.body)});return}let g=await i(m),_=m.local?e:await t();if(m.accountId=_,m.body){let e=c(m.body);a(await s(`Updating`,async()=>r(g,`PUT`,`/accounts/${_}/tags`,{body:e,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`});return}m[`resource-id`]===void 0&&(m[`resource-id`]=await f(`resource-id`,`Identifies the unique resource.`)),m[`resource-type`]===void 0&&(m[`resource-type`]=await p(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`])),m[`resource-type`]===`worker_version`&&m[`worker-id`]===void 0&&(m[`worker-id`]=await f(`worker-id`,`Worker ID is required only for worker_version resources`,{question:`Enter value for --worker-id`}));let v={};m[`resource-id`]!==void 0&&l(v,[`resource_id`],d(m[`resource-id`],`resource-id`,`text`)),m[`resource-type`]!==void 0&&l(v,[`resource_type`],d(m[`resource-type`],`resource-type`,`text`)),m[`worker-id`]!==void 0&&l(v,[`worker_id`],d(m[`worker-id`],`worker-id`,`text`)),a(await s(`Updating`,async()=>r(g,`PUT`,`/accounts/${_}/tags`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`})}},S={command:`account-tags`,describe:`account-tags`,builder:e=>e.command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{S as default};
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{a as r,r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.mjs";import{n as c,t as l}from"./body-parser-CYD7PKFC.mjs";import{n as u}from"./input-validation-BBKJRoRB.mjs";import{a as d,n as f}from"./prompt-DM4z101s.mjs";import{t as p}from"./cli-types-BWdZbsFE.mjs";import{n as m,t as ee}from"./raw-fetch-25gXED6c.mjs";function te(e){return e.option(`category-id`,{type:`number`,description:`Returns the category ID.`}).option(`hostnames`,{type:`string`,array:!0,description:`Hostnames matched by the application.`}).option(`human-id`,{type:`string`,description:`Returns the human readable ID.`}).option(`ip-subnets`,{type:`string`,array:!0,description:`IP subnets matched by the application.`}).option(`name`,{type:`string`,description:`Returns the application name.`}).option(`port-protocols`,{type:`string`,array:!0,description:`Port and protocol pairs matched by the application.`}).option(`support-domains`,{type:`string`,array:!0,description:`Support domains matched by the application.`}).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 h={command:`create`,describe:`Create a custom application for an account.`,builder:te,handler:async r=>{if(r.dryRun){o({command:`cf accounts applications create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/resource-library/applications`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({category_id:r[`category-id`],hostnames:r.hostnames,human_id:u(r[`human-id`],`human-id`,`text`),ip_subnets:r[`ip-subnets`],name:u(r.name,`name`,`text`),port_protocols:r[`port-protocols`],support_domains:r[`support-domains`]}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.accounts.applications.create({...e,account_id:p})),{successLabel:`Created`});return}if(r[`category-id`]===void 0)throw Error(`--category-id is required (or pass --body with this field set).`);r[`human-id`]===void 0&&(r[`human-id`]=await d(`human-id`,`Returns the human readable ID.`)),r.name===void 0&&(r.name=await d(`name`,`Returns the application name.`));let m=l({category_id:r[`category-id`],hostnames:r.hostnames,human_id:u(r[`human-id`],`human-id`,`text`),ip_subnets:r[`ip-subnets`],name:u(r.name,`name`,`text`),port_protocols:r[`port-protocols`],support_domains:r[`support-domains`]});a(await s(`Creating`,async()=>f.accounts.applications.create({...m,account_id:p})),{successLabel:`Created`})}};function g(e){return e.positional(`id`,{type:`string`,description:`Application 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 _={command:`delete <id>`,describe:`Delete a custom application and all of its versions. Deletion is rejected when other resources reference the application.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf accounts applications delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/resource-library/applications/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>c.accounts.applications.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function v(e){return e.option(`filter`,{type:`string`,description:`Filter applications using key:value format. Supported filter keys:
4
- - name: Filter by application name (e.g., name:HR)
5
- - id: Filter by application ID (e.g., id:498)
6
- - human_id: Filter by human-readable ID (e.g., human_id:HR)
7
- - hostname: Filter by hostname or support domain (e.g., hostname:portal.example.com)
8
- - source: Filter by application source name (e.g., source:cloudflare)
9
- - ip_subnet: Filter by IP subnet using CIDR containment — returns applications where any stored subnet contains the search value (e.g., ip_subnet:10.0.1.5/32 matches apps with 10.0.0.0/16)
10
- - category_id: Filter by category ID (e.g., category_id:12).
11
- - category_name: Filter by category name (e.g., category_name:HR).
12
- - supported: Filter by supported Cloudflare product (e.g., supported:ACCESS). Values: GATEWAY, ACCESS, CASB.
13
- - review_status: Filter by the account's Gateway review status. Values: approved, unapproved, in_review, unreviewed.
14
- .`}).option(`limit`,{type:`number`,description:`Limit of number of results to return (max 250).`}).option(`offset`,{type:`number`,description:`Offset of results to return.`}).option(`order-by`,{type:`string`,description:`Order results using field:direction format. Supported fields are name, id, human_id,
15
- category_id, application_type, application_confidence_score, and gen_ai_score.
16
- Supported directions are asc and desc. Ignored when search is provided; results are
17
- ranked by relevance instead.`}).option(`search`,{type:`string`,description:`Fuzzy search across application name and hostnames. Results are ranked by relevance. Must be between 2 and 200 characters. Can be combined with filter parameters.`}).option(`fields`,{type:`string`,description:"Return only the listed properties on each application, as a comma-separated list.\nUse this to keep responses small when you only need part of each application — for\nexample populating a picker with `fields=id,name` instead of downloading every\nhostname and IP subnet.\n\nOmit this parameter to receive the full application object.\n\n`id` is always returned.\n\nSelectable properties: `id`, `name`, `human_id`, `version`, `hostnames`,\n`support_domains`, `ip_subnets`, `port_protocols`, `supported`, `gen_ai_score`,\n`application_confidence_score`, `created_at`, `updated_at`, `review_status`.\n\nUnknown or empty property names return `400`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`applications`,describe:"List the applications available to an account, both the applications Cloudflare curates and the custom applications the account has defined. Results are paginated. Use `filter` and `search` to narrow the list, `order_by` to sort it, and `fields` to reduce each result to only the properties you need. The authenticated principal must have access to the account identified by `account_id`.",builder:v,handler:async r=>{let c={filter:r.filter,limit:r.limit,offset:r.offset,order_by:r[`order-by`],search:r.search,fields:r.fields};if(r.dryRun){o({command:`cf accounts applications get applications`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/resource-library/applications`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.applications.get.applications({account_id:u,...c})),{successLabel:`Loaded`})}};function b(e){return e.positional(`id`,{type:`string`,description:`Application ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`id <id>`,describe:`Get application by ID.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf accounts applications get by id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/resource-library/applications/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.applications.get.by.id({account_id:l,id:r.id})),{successLabel:`Loaded`})}},S={command:`by`,describe:`Operations for applications.get.by`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},C={command:`get`,describe:`Operations for applications.get`,builder:e=>e.command(y).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.positional(`id`,{type:`string`,description:`Application ID.`,demandOption:!0}).option(`hostnames`,{type:`string`,array:!0,description:`Hostnames matched by the application.`}).option(`ip-subnets`,{type:`string`,array:!0,description:`IP subnets matched by the application.`}).option(`port-protocols`,{type:`string`,array:!0,description:`Port and protocol pairs matched by the application.`}).option(`support-domains`,{type:`string`,array:!0,description:`Support domains matched by the application.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Updates the network matchers for the application. Omitted matcher lists are left unchanged; send an empty array to clear a list.`})}const T={command:`update <id>`,describe:`Replace the network matchers for a custom application and create a new version.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf accounts applications update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/resource-library/applications/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({hostnames:r.hostnames,ip_subnets:r[`ip-subnets`],port_protocols:r[`port-protocols`],support_domains:r[`support-domains`]}):c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>u.accounts.applications.update({...e,account_id:d,id:r.id})),{successLabel:`Updated`});return}let f=l({hostnames:r.hostnames,ip_subnets:r[`ip-subnets`],port_protocols:r[`port-protocols`],support_domains:r[`support-domains`]});a(await s(`Updating`,async()=>u.accounts.applications.update({...f,account_id:d,id:r.id})),{successLabel:`Updated`})}},E={command:`applications`,describe:`Applications operations`,builder:e=>e.command(h).command(_).command(T).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`createSetupIntent`,describe:`Creates a Stripe setup intent for adding a payment method to an account. Returns a client secret for frontend payment method collection.`,builder:D,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing createSetupIntent`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/client-secret`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.accounts.billing.createSetupIntent({account_id:l})),{successLabel:`Created`})}};function k(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`getBadDebt`,describe:`Gets bad debt information for an account, including outstanding invoices and total debt amount.`,builder:k,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing getBadDebt`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/billing/bad-debt`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.billing.getBadDebt({account_id:l})),{successLabel:`Loaded`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`getCredits`,describe:`Gets the credit balance and eligibility for an account.`,builder:j,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing getCredits`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/billing/credits`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.billing.getCredits({account_id:l})),{successLabel:`Loaded`})}};function N(e){return e.positional(`receipt-id`,{type:`string`,description:`Receipt identifier.`,demandOption:!0}).option(`doctype`,{type:`string`,description:`The document type to generate.`}).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 P={command:`getReceiptPdf <receipt-id>`,describe:`Downloads a receipt as a PDF document.`,builder:N,handler:async r=>{let a={doctype:r.doctype};if(r.dryRun){o({command:`cf accounts billing getReceiptPdf`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/receipts/${r[`receipt-id`]==null?`<receipt-id>`:encodeURIComponent(String(r[`receipt-id`]))}/pdf`,pathParams:{"receipt-id":String(r[`receipt-id`]??``)},query:a,bodyKind:`none`});return}await i(r);let c=r.local?e:await t();r.accountId=c;let l=new URLSearchParams(Object.entries(a).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),u=await s(`Loading`,async()=>ee(`/accounts/${c}/receipts/${encodeURIComponent(String(r[`receipt-id`]))}/pdf${l?`?`+l:``}`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}));m(r.text===!0?u.toString(`utf-8`):u)}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`getUnpaidInvoices`,describe:`Gets unpaid invoice information for an account.`,builder:F,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing getUnpaidInvoices`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/billing/unpaid-invoice`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.billing.getUnpaidInvoices({account_id:l})),{successLabel:`Loaded`})}};function L(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`status`,{type:`string`,description:`Filter billing history by status.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list`,describe:`Gets the billing history for an account.`,builder:L,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],status:r.status};if(r.dryRun){o({command:`cf accounts billing history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/billing/history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.billing.history.list({account_id:u,...c})),{successLabel:`Loaded`})}},z={command:`history`,describe:`Operations for billing.history`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.option(`payment-method-id`,{type:`string`,description:`The payment method to use. If omitted, the default payment method is used.`}).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:`payBadDebt`,describe:`Pays outstanding bad debt for an account. Discovers all debt automatically and handles invoice deduplication.`,builder:B,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing payBadDebt`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pay-bad-debt`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({payment_method_id:u(r[`payment-method-id`],`payment-method-id`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.accounts.billing.payBadDebt({...e,account_id:f})),{successLabel:`Created`});return}let p=l({payment_method_id:u(r[`payment-method-id`],`payment-method-id`,`text`)});a(await s(`Creating`,async()=>d.accounts.billing.payBadDebt({...p,account_id:f})),{successLabel:`Created`})}};function H(e){return e.option(`invoice-id`,{type:`string`,description:`The identifier of the invoice to pay.`}).option(`payment-method-id`,{type:`string`,description:`The payment method to use. If omitted, the default payment method is used.`}).option(`validate-payment-method`,{type:`boolean`,description:`Whether to validate the payment method before processing.`}).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 U={command:`payInvoice`,describe:`Pays an outstanding invoice for an account. Returns a Stripe client secret when Strong Customer Authentication (SCA) is required to complete the payment.`,builder:H,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing payInvoice`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pay-invoice`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({invoice_id:u(r[`invoice-id`],`invoice-id`,`text`),payment_method_id:u(r[`payment-method-id`],`payment-method-id`,`text`),validate_payment_method:r[`validate-payment-method`]}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.accounts.billing.payInvoice({...e,account_id:f})),{successLabel:`Created`});return}let p=l({invoice_id:u(r[`invoice-id`],`invoice-id`,`text`),payment_method_id:u(r[`payment-method-id`],`payment-method-id`,`text`),validate_payment_method:r[`validate-payment-method`]});a(await s(`Creating`,async()=>d.accounts.billing.payInvoice({...p,account_id:f})),{successLabel:`Created`})}};function W(e){return e.option(`address`,{type:`string`,description:`Billing address line 1.`}).option(`address2`,{type:`string`,description:`Billing address line 2.`}).option(`bank-account-type`,{type:`string`,description:`Bank account type.`}).option(`bank-code`,{type:`string`,description:`Bank code.`}).option(`bank-country`,{type:`string`,description:`Bank country.`}).option(`bank-name`,{type:`string`,description:`Bank name for bank-based payment methods.`}).option(`bank-routing-number`,{type:`string`,description:`Bank routing number.`}).option(`cashapp-cash-tag`,{type:`string`,description:`Cash App cash tag.`}).option(`city`,{type:`string`,description:`Billing city.`}).option(`country`,{type:`string`,description:`Billing country.`}).option(`default`,{type:`boolean`,description:`Whether this is the default payment method.`}).option(`device-data`,{type:`string`,description:`Device data for fraud prevention.`}).option(`first-name`,{type:`string`,description:`Billing first name.`}).option(`last-name`,{type:`string`,description:`Billing last name.`}).option(`nick-name`,{type:`string`,description:`A nickname for the payment method.`}).option(`payment-account-email`,{type:`string`,description:`Email associated with the payment account.`}).option(`payment-email`,{type:`string`,description:`Payment email address.`}).option(`payment-gateway`,{type:`string`,description:`The payment gateway used.`}).option(`payment-nonce`,{type:`string`,description:`Payment nonce for tokenized payments.`}).option(`state`,{type:`string`,description:`Billing state.`}).option(`type`,{type:`string`,description:`The payment method type.`,choices:[`CREDIT_CARD`,`PAYPAL`,`CASHAPP`,`SEPA_DEBIT`,`LINK`,`ACH_DIRECT_DEBIT`]}).option(`zipcode`,{type:`string`,description:`Billing zip code.`}).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 G={command:`create`,describe:`Creates a new payment method for an account.`,builder:W,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing payment-methods create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/payment-methods`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({address:u(r.address,`address`,`text`),address2:u(r.address2,`address2`,`text`),bank_account_type:u(r[`bank-account-type`],`bank-account-type`,`text`),bank_code:u(r[`bank-code`],`bank-code`,`text`),bank_country:u(r[`bank-country`],`bank-country`,`text`),bank_name:u(r[`bank-name`],`bank-name`,`text`),bank_routing_number:u(r[`bank-routing-number`],`bank-routing-number`,`text`),cashapp_cash_tag:u(r[`cashapp-cash-tag`],`cashapp-cash-tag`,`text`),city:u(r.city,`city`,`text`),country:u(r.country,`country`,`text`),default:r.default,device_data:u(r[`device-data`],`device-data`,`text`),first_name:u(r[`first-name`],`first-name`,`text`),last_name:u(r[`last-name`],`last-name`,`text`),nick_name:u(r[`nick-name`],`nick-name`,`text`),payment_account_email:u(r[`payment-account-email`],`payment-account-email`,`text`),payment_email:u(r[`payment-email`],`payment-email`,`text`),payment_gateway:u(r[`payment-gateway`],`payment-gateway`,`text`),payment_nonce:u(r[`payment-nonce`],`payment-nonce`,`text`),state:u(r.state,`state`,`text`),type:u(r.type,`type`,`text`),zipcode:u(r.zipcode,`zipcode`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.accounts.billing.paymentMethods.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=l({address:u(r.address,`address`,`text`),address2:u(r.address2,`address2`,`text`),bank_account_type:u(r[`bank-account-type`],`bank-account-type`,`text`),bank_code:u(r[`bank-code`],`bank-code`,`text`),bank_country:u(r[`bank-country`],`bank-country`,`text`),bank_name:u(r[`bank-name`],`bank-name`,`text`),bank_routing_number:u(r[`bank-routing-number`],`bank-routing-number`,`text`),cashapp_cash_tag:u(r[`cashapp-cash-tag`],`cashapp-cash-tag`,`text`),city:u(r.city,`city`,`text`),country:u(r.country,`country`,`text`),default:r.default,device_data:u(r[`device-data`],`device-data`,`text`),first_name:u(r[`first-name`],`first-name`,`text`),last_name:u(r[`last-name`],`last-name`,`text`),nick_name:u(r[`nick-name`],`nick-name`,`text`),payment_account_email:u(r[`payment-account-email`],`payment-account-email`,`text`),payment_email:u(r[`payment-email`],`payment-email`,`text`),payment_gateway:u(r[`payment-gateway`],`payment-gateway`,`text`),payment_nonce:u(r[`payment-nonce`],`payment-nonce`,`text`),state:u(r.state,`state`,`text`),type:u(r.type,`type`,`text`),zipcode:u(r.zipcode,`zipcode`,`text`)});a(await s(`Creating`,async()=>d.accounts.billing.paymentMethods.create({body:p,account_id:f})),{successLabel:`Created`})}};function K(e){return e.positional(`payment-method-id`,{type:`string`,description:`Payment method identifier.`,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 q={command:`delete <payment-method-id>`,describe:`Deletes a payment method from an account.`,builder:K,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing payment-methods delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/payment-methods/${r[`payment-method-id`]==null?`<payment-method-id>`:encodeURIComponent(String(r[`payment-method-id`]))}`,pathParams:{"payment-method-id":String(r[`payment-method-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force})){process.stderr.write(`Aborted.
18
- `);return}a(await s(`Deleting`,async()=>c.accounts.billing.paymentMethods.delete({account_id:l,payment_method_id:r[`payment-method-id`]})),{successLabel:`Deleted`})}};function J(e){return e.positional(`payment-method-id`,{type:`string`,description:`Payment method identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get <payment-method-id>`,describe:`Gets a specific payment method for an account.`,builder:J,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing payment-methods get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/payment-methods/${r[`payment-method-id`]==null?`<payment-method-id>`:encodeURIComponent(String(r[`payment-method-id`]))}`,pathParams:{"payment-method-id":String(r[`payment-method-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.billing.paymentMethods.get({account_id:l,payment_method_id:r[`payment-method-id`]})),{successLabel:`Loaded`})}};function X(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`list`,describe:`Lists all payment methods for an account.`,builder:X,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf accounts billing payment-methods list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/payment-methods`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.billing.paymentMethods.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Q(e){return e.positional(`payment-method-id`,{type:`string`,description:`Payment method identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`setDefault <payment-method-id>`,describe:`Sets a payment method as the default for an account.`,builder:Q,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing payment-methods setDefault`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/payment-methods/${r[`payment-method-id`]==null?`<payment-method-id>`:encodeURIComponent(String(r[`payment-method-id`]))}/set-as-default`,pathParams:{"payment-method-id":String(r[`payment-method-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.accounts.billing.paymentMethods.setDefault({account_id:l,payment_method_id:r[`payment-method-id`]})),{successLabel:`Created`})}};function re(e){return e.positional(`payment-method-id`,{type:`string`,description:`Payment method identifier.`,demandOption:!0}).option(`address`,{type:`string`,description:`Billing address line 1.`}).option(`address2`,{type:`string`,description:`Billing address line 2.`}).option(`bank-account-type`,{type:`string`,description:`Bank account type.`}).option(`bank-code`,{type:`string`,description:`Bank code.`}).option(`bank-country`,{type:`string`,description:`Bank country.`}).option(`bank-name`,{type:`string`,description:`Bank name for bank-based payment methods.`}).option(`bank-routing-number`,{type:`string`,description:`Bank routing number.`}).option(`cashapp-cash-tag`,{type:`string`,description:`Cash App cash tag.`}).option(`city`,{type:`string`,description:`Billing city.`}).option(`country`,{type:`string`,description:`Billing country.`}).option(`default`,{type:`boolean`,description:`Whether this is the default payment method.`}).option(`device-data`,{type:`string`,description:`Device data for fraud prevention.`}).option(`first-name`,{type:`string`,description:`Billing first name.`}).option(`last-name`,{type:`string`,description:`Billing last name.`}).option(`nick-name`,{type:`string`,description:`A nickname for the payment method.`}).option(`payment-account-email`,{type:`string`,description:`Email associated with the payment account.`}).option(`payment-email`,{type:`string`,description:`Payment email address.`}).option(`payment-gateway`,{type:`string`,description:`The payment gateway used.`}).option(`payment-nonce`,{type:`string`,description:`Payment nonce for tokenized payments.`}).option(`state`,{type:`string`,description:`Billing state.`}).option(`type`,{type:`string`,description:`The payment method type.`,choices:[`CREDIT_CARD`,`PAYPAL`,`CASHAPP`,`SEPA_DEBIT`,`LINK`,`ACH_DIRECT_DEBIT`]}).option(`zipcode`,{type:`string`,description:`Billing zip code.`}).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 ie={command:`update <payment-method-id>`,describe:`Updates a payment method for an account.`,builder:re,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing payment-methods update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/payment-methods/${r[`payment-method-id`]==null?`<payment-method-id>`:encodeURIComponent(String(r[`payment-method-id`]))}`,pathParams:{"payment-method-id":String(r[`payment-method-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({address:u(r.address,`address`,`text`),address2:u(r.address2,`address2`,`text`),bank_account_type:u(r[`bank-account-type`],`bank-account-type`,`text`),bank_code:u(r[`bank-code`],`bank-code`,`text`),bank_country:u(r[`bank-country`],`bank-country`,`text`),bank_name:u(r[`bank-name`],`bank-name`,`text`),bank_routing_number:u(r[`bank-routing-number`],`bank-routing-number`,`text`),cashapp_cash_tag:u(r[`cashapp-cash-tag`],`cashapp-cash-tag`,`text`),city:u(r.city,`city`,`text`),country:u(r.country,`country`,`text`),default:r.default,device_data:u(r[`device-data`],`device-data`,`text`),first_name:u(r[`first-name`],`first-name`,`text`),last_name:u(r[`last-name`],`last-name`,`text`),nick_name:u(r[`nick-name`],`nick-name`,`text`),payment_account_email:u(r[`payment-account-email`],`payment-account-email`,`text`),payment_email:u(r[`payment-email`],`payment-email`,`text`),payment_gateway:u(r[`payment-gateway`],`payment-gateway`,`text`),payment_nonce:u(r[`payment-nonce`],`payment-nonce`,`text`),state:u(r.state,`state`,`text`),type:u(r.type,`type`,`text`),zipcode:u(r.zipcode,`zipcode`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.accounts.billing.paymentMethods.update({body:e,account_id:f,payment_method_id:r[`payment-method-id`]})),{successLabel:`Updated`});return}let p=l({address:u(r.address,`address`,`text`),address2:u(r.address2,`address2`,`text`),bank_account_type:u(r[`bank-account-type`],`bank-account-type`,`text`),bank_code:u(r[`bank-code`],`bank-code`,`text`),bank_country:u(r[`bank-country`],`bank-country`,`text`),bank_name:u(r[`bank-name`],`bank-name`,`text`),bank_routing_number:u(r[`bank-routing-number`],`bank-routing-number`,`text`),cashapp_cash_tag:u(r[`cashapp-cash-tag`],`cashapp-cash-tag`,`text`),city:u(r.city,`city`,`text`),country:u(r.country,`country`,`text`),default:r.default,device_data:u(r[`device-data`],`device-data`,`text`),first_name:u(r[`first-name`],`first-name`,`text`),last_name:u(r[`last-name`],`last-name`,`text`),nick_name:u(r[`nick-name`],`nick-name`,`text`),payment_account_email:u(r[`payment-account-email`],`payment-account-email`,`text`),payment_email:u(r[`payment-email`],`payment-email`,`text`),payment_gateway:u(r[`payment-gateway`],`payment-gateway`,`text`),payment_nonce:u(r[`payment-nonce`],`payment-nonce`,`text`),state:u(r.state,`state`,`text`),type:u(r.type,`type`,`text`),zipcode:u(r.zipcode,`zipcode`,`text`)});a(await s(`Updating`,async()=>d.accounts.billing.paymentMethods.update({body:p,account_id:f,payment_method_id:r[`payment-method-id`]})),{successLabel:`Updated`})}},ae={command:`payment-methods`,describe:`Operations for billing.payment-methods`,builder:e=>e.command(G).command(q).command(Y).command(Z).command(ne).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.option(`toggle`,{type:`boolean`,description:`Whether to enable or disable PDF invoice generation.`}).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 se={command:`togglePdfInvoices`,describe:`Toggles PDF invoice generation for an account.`,builder:oe,handler:async r=>{if(r.dryRun){o({command:`cf accounts billing togglePdfInvoices`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/invoices`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({toggle:r.toggle}):c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>u.accounts.billing.togglePdfInvoices({...e,account_id:d})),{successLabel:`Updated`});return}let f=l({toggle:r.toggle});a(await s(`Updating`,async()=>u.accounts.billing.togglePdfInvoices({...f,account_id:d})),{successLabel:`Updated`})}},ce={command:`billing`,describe:`Operations for billing`,builder:e=>e.command(O).command(A).command(M).command(P).command(I).command(V).command(U).command(se).command(z).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(e){return e.positional(`id`,{type:`string`,description:`Application category ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`id <id>`,describe:`Get application category by ID.`,builder:le,handler:async r=>{if(r.dryRun){o({command:`cf accounts categories get by id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/resource-library/categories/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.categories.get.by.id({account_id:l,id:r.id})),{successLabel:`Loaded`})}},de={command:`by`,describe:`Operations for categories.get.by`,builder:e=>e.command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fe(e){return e.option(`limit`,{type:`number`,description:`Limit of number of results to return.`}).option(`offset`,{type:`number`,description:`Offset of results to return.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pe={command:`categories`,describe:`List application categories.`,builder:fe,handler:async r=>{let c={limit:r.limit,offset:r.offset};if(r.dryRun){o({command:`cf accounts categories get categories`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/resource-library/categories`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.categories.get.categories({account_id:u,...c})),{successLabel:`Loaded`})}},me={command:`get`,describe:`Operations for categories.get`,builder:e=>e.command(pe).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},he={command:`categories`,describe:`Categories operations`,builder:e=>e.command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ge(e){return e.option(`name`,{type:`string`,description:`Account name`}).option(`unit-id`,{type:`string`,description:`Tenant unit ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Parameters for account creation`})}const _e={command:`create`,describe:`Create an account (only available for tenant admins at this time)`,builder:ge,handler:async e=>{if(e.dryRun){o({command:`cf accounts create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts`,pathParams:{},bodyKind:`json`,body:e.body===void 0?l({name:u(e.name,`name`,`text`),unit:{id:u(e[`unit-id`],`unit-id`,`text`)}}):c(e.body)});return}let t=await i(e);if(e.body){let n=c(e.body);a(await s(`Creating`,async()=>t.accounts.create({...n})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await d(`name`,`Account name`));let n=l({name:u(e.name,`name`,`text`),unit:{id:u(e[`unit-id`],`unit-id`,`text`)}});a(await s(`Creating`,async()=>t.accounts.create({...n})),{successLabel:`Created`})}};function ve(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 ye={command:`delete`,describe:`Delete a specific account (only available for tenant admins at this time). This is a permanent operation that will delete any zones or other resources under the account`,builder:ve,handler:async r=>{if(r.dryRun){o({command:`cf accounts delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
19
- `);return}a(await s(`Deleting`,async()=>c.accounts.delete({account_id:l})),{successLabel:`Deleted`})}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`get`,describe:`Get information about a specific account that you are a member of.`,builder:be,handler:async r=>{if(r.dryRun){o({command:`cf accounts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.get({account_id:l})),{successLabel:`Loaded`})}};function Se(e){return e.option(`name`,{type:`string`,description:`Name of the account.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`list`,describe:`List all accounts you have ownership or verified access to.`,builder:p(Se),handler:async e=>{let t={name:e.name,page:e.page,per_page:e[`per-page`],direction:e.direction};if(e.dryRun){o({command:`cf accounts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts`,pathParams:{},query:t,bodyKind:`none`});return}let n=await i(e);a(await s(`Loading`,async()=>n.accounts.list(t)),{successLabel:`Loaded`})}};function we(e){return e.positional(`id`,{type:`string`,description:`The ID of the audit log to fetch resource history for.`,demandOption:!0}).option(`action-time`,{type:`string`,description:"RFC3339 timestamp of the source audit log entry's action time. Used to narrow the source-entry lookup window. Provide the `action.time` value from the audit log identified by `id`.",demandOption:!0}).option(`since`,{type:`string`,description:`Limits the returned results to logs newer than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`before`,{type:`string`,description:`Limits the returned results to logs older than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`direction`,{type:`string`,description:`Sets sorting order.`,choices:[`desc`,`asc`]}).option(`limit`,{type:`number`,description:`The number limits the objects to return. The cursor attribute may be used to iterate over the next batch of objects if there are more than the limit.`}).option(`cursor`,{type:`string`,description:`The cursor is an opaque token used to paginate through large sets of records. It indicates the position from which to continue when requesting the next set of records. A valid cursor value can be obtained from the cursor object in the result_info structure of a previous response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`history <id>`,describe:"Returns the chronological change history for the resource identified by the given audit log entry. The endpoint first locates the source audit log entry by `id` (using `action_time` to narrow the lookup window), derives identifying filters from that entry, and then returns matching audit logs within the `since`/`before` window. The `result_info.history_status` field indicates the quality of the resource identification used: - `exact`: Resource was identified by the resource URI. - `approximate`: Resource was identified without the resource URI. - `unavailable`: The source audit log entry did not contain enough information to identify the resource; an empty result is returned.",builder:p(we),handler:async r=>{let c={action_time:r[`action-time`],since:r.since,before:r.before,direction:r.direction,limit:r.limit,cursor:r.cursor};if(r.dryRun){o({command:`cf accounts logs audit history`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logs/audit/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/history`,pathParams:{id:String(r.id??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.logs.audit.history({account_id:u,id:r.id,...c})),{successLabel:`Loaded`})}};function Ee(e){return e.option(`account-name`,{type:`string`,description:`Filters by the account name.`}).option(`action-result`,{type:`string`,description:`Filters by whether the action was successful or not.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-context`,{type:`string`,description:"Filters by the actor context.\n- `api`: The action was performed through the API. The specific credential type was not recorded.\n- `api_key`: The action was authenticated with a Cloudflare Global API Key.\n- `api_token`: The action was authenticated with an API token.\n- `dash`: The action was performed through the Cloudflare dashboard.\n- `oauth`: The action was authenticated with an OAuth token.\n- `origin_ca_key`: The action was authenticated with an Origin CA key."}).option(`actor-email`,{type:`string`,description:`Filters by the actor's email address.`}).option(`actor-id`,{type:`string`,description:`Filters by the actor ID. This can be either the Account ID or User ID.`}).option(`actor-ip-address`,{type:`string`,description:`The IP address where the action was initiated.`}).option(`actor-token-id`,{type:`string`,description:`Filters by the API token ID when the actor context is an api_token or oauth.`}).option(`actor-token-name`,{type:`string`,description:`Filters by the API token name when the actor context is an api_token or oauth.`}).option(`actor-type`,{type:`string`,description:`Filters by the actor type.`}).option(`audit-log-id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`raw-cf-ray-id`,{type:`string`,description:`Filters by the response CF Ray ID.`}).option(`raw-method`,{type:`string`,description:`The HTTP method for the API call.`}).option(`raw-status-code`,{type:`string`,description:`The response status code that was returned.`}).option(`raw-uri`,{type:`string`,description:`Filters by the request URI.`}).option(`resource-id`,{type:`string`,description:`Filters by the resource ID.`}).option(`resource-product`,{type:`string`,description:`Filters audit logs by the Cloudflare product associated with the changed resource.`}).option(`resource-type`,{type:`string`,description:`Filters audit logs based on the unique type of resource changed by the action.`}).option(`resource-scope`,{type:`string`,description:`Filters by the resource scope, specifying whether the resource is associated with an user, an account, a zone, or a membership.`}).option(`product-category`,{type:`string`,description:`Filters audit logs by one or more predefined product categories. Each product category expands into a curated set of resource_product values and is unioned with any explicit resource_product filter. Matched case-insensitively; unknown product categories return 400. Repeatable. Use the audit log product categories endpoint to discover the available values.`}).option(`zone-id`,{type:`string`,description:`Filters by the zone ID.`}).option(`zone-name`,{type:`string`,description:`Filters by the zone name associated with the change.`}).option(`account-name-not`,{type:`string`,description:`Filters out audit logs by the account name.`}).option(`action-result-not`,{type:`string`,description:`Filters out audit logs by whether the action was successful or not.`}).option(`action-type-not`,{type:`string`,description:`Filters out audit logs by the action type.`}).option(`actor-context-not`,{type:`string`,description:"Filters out audit logs by the actor context.\n- `api`: The action was performed through the API. The specific credential type was not recorded.\n- `api_key`: The action was authenticated with a Cloudflare Global API Key.\n- `api_token`: The action was authenticated with an API token.\n- `dash`: The action was performed through the Cloudflare dashboard.\n- `oauth`: The action was authenticated with an OAuth token.\n- `origin_ca_key`: The action was authenticated with an Origin CA key."}).option(`actor-email-not`,{type:`string`,description:`Filters out audit logs by the actor's email address.`}).option(`actor-id-not`,{type:`string`,description:`Filters out audit logs by the actor ID. This can be either the Account ID or User ID.`}).option(`actor-ip-address-not`,{type:`string`,description:`Filters out audit logs IP address where the action was initiated.`}).option(`actor-token-id-not`,{type:`string`,description:`Filters out audit logs by the API token ID when the actor context is an api_token or oauth.`}).option(`actor-token-name-not`,{type:`string`,description:`Filters out audit logs by the API token name when the actor context is an api_token or oauth.`}).option(`actor-type-not`,{type:`string`,description:`Filters out audit logs by the actor type.`}).option(`audit-log-id-not`,{type:`string`,description:`Filters out audit logs by their IDs.`}).option(`id-not`,{type:`string`,description:`Filters out audit logs by their IDs.`}).option(`raw-cf-ray-id-not`,{type:`string`,description:`Filters out audit logs by the response CF Ray ID.`}).option(`raw-method-not`,{type:`string`,description:`Filters out audit logs by the HTTP method for the API call.`}).option(`raw-status-code-not`,{type:`string`,description:`Filters out audit logs by the response status code that was returned.`}).option(`raw-uri-not`,{type:`string`,description:`Filters out audit logs by the request URI.`}).option(`resource-id-not`,{type:`string`,description:`Filters out audit logs by the resource ID.`}).option(`resource-product-not`,{type:`string`,description:`Filters out audit logs by the Cloudflare product associated with the changed resource.`}).option(`resource-type-not`,{type:`string`,description:`Filters out audit logs based on the unique type of resource changed by the action.`}).option(`resource-scope-not`,{type:`string`,description:`Filters out audit logs by the resource scope, specifying whether the resource is associated with an user, an account, a zone, or a membership.`}).option(`zone-id-not`,{type:`string`,description:`Filters out audit logs by the zone ID.`}).option(`zone-name-not`,{type:`string`,description:`Filters out audit logs by the zone name associated with the change.`}).option(`since`,{type:`string`,description:`Limits the returned results to logs newer than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`before`,{type:`string`,description:`Limits the returned results to logs older than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`direction`,{type:`string`,description:`Sets sorting order.`,choices:[`desc`,`asc`]}).option(`limit`,{type:`number`,description:`The number limits the objects to return. The cursor attribute may be used to iterate over the next batch of objects if there are more than the limit.`}).option(`cursor`,{type:`string`,description:`The cursor is an opaque token used to paginate through large sets of records. It indicates the position from which to continue when requesting the next set of records. A valid cursor value can be obtained from the cursor object in the result_info structure of a previous response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`list`,describe:`Gets a list of audit logs for an account.`,builder:p(Ee),handler:async r=>{let c={account_name:r[`account-name`],action_result:r[`action-result`],action_type:r[`action-type`],actor_context:r[`actor-context`],actor_email:r[`actor-email`],actor_id:r[`actor-id`],actor_ip_address:r[`actor-ip-address`],actor_token_id:r[`actor-token-id`],actor_token_name:r[`actor-token-name`],actor_type:r[`actor-type`],audit_log_id:r[`audit-log-id`],id:r.id,raw_cf_ray_id:r[`raw-cf-ray-id`],raw_method:r[`raw-method`],raw_status_code:r[`raw-status-code`],raw_uri:r[`raw-uri`],resource_id:r[`resource-id`],resource_product:r[`resource-product`],resource_type:r[`resource-type`],resource_scope:r[`resource-scope`],product_category:r[`product-category`],zone_id:r[`zone-id`],zone_name:r[`zone-name`],"account_name.not":r[`account-name-not`],"action_result.not":r[`action-result-not`],"action_type.not":r[`action-type-not`],"actor_context.not":r[`actor-context-not`],"actor_email.not":r[`actor-email-not`],"actor_id.not":r[`actor-id-not`],"actor_ip_address.not":r[`actor-ip-address-not`],"actor_token_id.not":r[`actor-token-id-not`],"actor_token_name.not":r[`actor-token-name-not`],"actor_type.not":r[`actor-type-not`],"audit_log_id.not":r[`audit-log-id-not`],"id.not":r[`id-not`],"raw_cf_ray_id.not":r[`raw-cf-ray-id-not`],"raw_method.not":r[`raw-method-not`],"raw_status_code.not":r[`raw-status-code-not`],"raw_uri.not":r[`raw-uri-not`],"resource_id.not":r[`resource-id-not`],"resource_product.not":r[`resource-product-not`],"resource_type.not":r[`resource-type-not`],"resource_scope.not":r[`resource-scope-not`],"zone_id.not":r[`zone-id-not`],"zone_name.not":r[`zone-name-not`],since:r.since,before:r.before,direction:r.direction,limit:r.limit,cursor:r.cursor};if(r.dryRun){o({command:`cf accounts logs audit list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logs/audit`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.logs.audit.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Oe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ke={command:`product-categories`,describe:`Lists the available audit log product categories and the resource products each one expands to. Use these values with the product_category filter on the account audit logs endpoint.`,builder:Oe,handler:async r=>{if(r.dryRun){o({command:`cf accounts logs audit product-categories`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/logs/audit/product_categories`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.logs.audit.productCategories({account_id:l})),{successLabel:`Loaded`})}},Ae={command:`audit`,describe:`Operations for logs.audit`,builder:e=>e.command(Te).command(De).command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},je={command:`logs`,describe:`Operations for logs`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.option(`email`,{type:`string`,description:`The contact email address of the user.`}).option(`roles`,{type:`string`,array:!0,description:`Array of roles associated with this member.`}).option(`status`,{type:`string`,description:`Status of the member invitation. If not provided during creation, defaults to 'pending'.
20
- Changing from 'accepted' back to 'pending' will trigger a replacement of the member resource in Terraform.
21
- `,choices:[`accepted`,`pending`]}).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 Ne={command:`create`,describe:`Add a user to the list of members for this account.`,builder:Me,handler:async r=>{if(r.dryRun){o({command:`cf accounts members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/members`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({email:u(r.email,`email`,`text`),roles:r.roles,status:u(r.status,`status`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.accounts.members.create({body:e,account_id:p})),{successLabel:`Created`});return}r.email===void 0&&(r.email=await d(`email`,`The contact email address of the user.`));let m=l({email:u(r.email,`email`,`text`),roles:r.roles,status:u(r.status,`status`,`text`)});a(await s(`Creating`,async()=>f.accounts.members.create({body:m,account_id:p})),{successLabel:`Created`})}};function Pe(e){return e.positional(`member-id`,{type:`string`,description:`Membership identifier tag.`,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 Fe={command:`delete <member-id>`,describe:`Remove a member from an account.`,builder:Pe,handler:async r=>{if(r.dryRun){o({command:`cf accounts members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/members/${r[`member-id`]==null?`<member-id>`:encodeURIComponent(String(r[`member-id`]))}`,pathParams:{"member-id":String(r[`member-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force,message:`Are you sure you want to remove this user from the account?`})){process.stderr.write(`Aborted.
22
- `);return}a(await s(`Deleting`,async()=>c.accounts.members.delete({account_id:l,member_id:r[`member-id`]})),{successLabel:`Deleted`})}};function Ie(e){return e.positional(`member-id`,{type:`string`,description:`Membership identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Le={command:`get <member-id>`,describe:`Get information about a specific member of an account.`,builder:Ie,handler:async r=>{if(r.dryRun){o({command:`cf accounts members get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/members/${r[`member-id`]==null?`<member-id>`:encodeURIComponent(String(r[`member-id`]))}`,pathParams:{"member-id":String(r[`member-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.members.get({account_id:l,member_id:r[`member-id`]})),{successLabel:`Loaded`})}};function Re(e){return e.option(`order`,{type:`string`,description:`Field to order results by.`,choices:[`user.first_name`,`user.last_name`,`user.email`,`status`]}).option(`status`,{type:`string`,description:`A member's status in the account.`,choices:[`accepted`,`pending`,`rejected`]}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`list`,describe:`List all members of an account.`,builder:p(Re),handler:async r=>{let c={order:r.order,status:r.status,page:r.page,per_page:r[`per-page`],direction:r.direction};if(r.dryRun){o({command:`cf accounts members list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/members`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.members.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Be(e){return e.positional(`member-id`,{type:`string`,description:`Membership identifier tag.`,demandOption:!0}).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 Ve={command:`update <member-id>`,describe:`Modify an account member.`,builder:Be,handler:async l=>{if(l.dryRun){o({command:`cf accounts members update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/members/${l[`member-id`]==null?`<member-id>`:encodeURIComponent(String(l[`member-id`]))}`,pathParams:{"member-id":String(l[`member-id`]??``)},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await i(l),d=l.local?e:await t();if(l.accountId=d,l.body){let e=c(l.body);a(await s(`Updating`,async()=>u.accounts.members.update({body:e,account_id:d,member_id:l[`member-id`]})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>r(u,`PUT`,`/accounts/${d}/members/${encodeURIComponent(String(l[`member-id`]))}`)),{successLabel:`Updated`})}},He={command:`members`,describe:`Operations for members`,builder:e=>e.command(Ne).command(Fe).command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ue(e){return e.option(`subscription-ids`,{type:`string`,array:!0,description:`List of subscription identifiers to cancel downgrades for.`}).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 We={command:`cancelDelayedDowngrade`,describe:`Cancels pending delayed downgrades for the specified subscriptions.`,builder:Ue,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions cancelDelayedDowngrade`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions/cancel-downgrade`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({subscription_ids:r[`subscription-ids`]}):c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>u.accounts.subscriptions.cancelDelayedDowngrade({...e,account_id:d})),{successLabel:`Created`});return}let f=l({subscription_ids:r[`subscription-ids`]});a(await s(`Creating`,async()=>u.accounts.subscriptions.cancelDelayedDowngrade({...f,account_id:d})),{successLabel:`Created`})}};function Ge(e){return e.option(`app-install-id`,{type:`string`,description:`app install id.`}).option(`frequency`,{type:`string`,description:`How often the subscription is renewed automatically.`,choices:[`weekly`,`monthly`,`quarterly`,`yearly`]}).option(`rate-plan-currency`,{type:`string`,description:`The currency applied to the rate plan subscription.`}).option(`rate-plan-externally-managed`,{type:`boolean`,description:`Whether this rate plan is managed externally from Cloudflare.`}).option(`rate-plan-id`,{type:`string`,description:`The ID of the rate plan.`}).option(`rate-plan-is-contract`,{type:`boolean`,description:`Whether a rate plan is enterprise-based (or newly adopted term contract).`}).option(`rate-plan-public-name`,{type:`string`,description:`The full name of the rate plan.`}).option(`rate-plan-scope`,{type:`string`,description:`The scope that this rate plan applies to.`}).option(`rate-plan-sets`,{type:`string`,array:!0,description:`The list of sets this rate plan applies to. Returns array of strings.`}).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 Ke={command:`create`,describe:`Creates an account subscription.`,builder:Ge,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({app:{install_id:u(r[`app-install-id`],`app-install-id`,`text`)},frequency:u(r.frequency,`frequency`,`text`),rate_plan:{currency:u(r[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:r[`rate-plan-externally-managed`],id:u(r[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:r[`rate-plan-is-contract`],public_name:u(r[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(r[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:r[`rate-plan-sets`]}}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.accounts.subscriptions.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=l({app:{install_id:u(r[`app-install-id`],`app-install-id`,`text`)},frequency:u(r.frequency,`frequency`,`text`),rate_plan:{currency:u(r[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:r[`rate-plan-externally-managed`],id:u(r[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:r[`rate-plan-is-contract`],public_name:u(r[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(r[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:r[`rate-plan-sets`]}});a(await s(`Creating`,async()=>d.accounts.subscriptions.create({body:p,account_id:f})),{successLabel:`Created`})}};function qe(e){return e.positional(`subscription-identifier`,{type:`string`,description:`Subscription identifier tag.`,demandOption:!0}).option(`other`,{type:`string`,description:`Additional cancellation details.`}).option(`reason-code`,{type:`string`,array:!0,description:`The cancellation reason codes.`}).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 Je={command:`createCancelReason <subscription-identifier>`,describe:`Records a cancellation reason for an account subscription.`,builder:qe,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions createCancelReason`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions/${r[`subscription-identifier`]==null?`<subscription-identifier>`:encodeURIComponent(String(r[`subscription-identifier`]))}/cancel-reason`,pathParams:{"subscription-identifier":String(r[`subscription-identifier`]??``)},bodyKind:`json`,body:r.body===void 0?l({other:u(r.other,`other`,`text`),reason_code:r[`reason-code`]}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.accounts.subscriptions.createCancelReason({...e,account_id:f,subscription_identifier:r[`subscription-identifier`]})),{successLabel:`Created`});return}let p=l({other:u(r.other,`other`,`text`),reason_code:r[`reason-code`]});a(await s(`Creating`,async()=>d.accounts.subscriptions.createCancelReason({...p,account_id:f,subscription_identifier:r[`subscription-identifier`]})),{successLabel:`Created`})}};function Ye(e){return e.positional(`subscription-identifier`,{type:`string`,description:`Subscription identifier tag.`,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 Xe={command:`delete <subscription-identifier>`,describe:`Deletes an account's subscription.`,builder:Ye,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions/${r[`subscription-identifier`]==null?`<subscription-identifier>`:encodeURIComponent(String(r[`subscription-identifier`]))}`,pathParams:{"subscription-identifier":String(r[`subscription-identifier`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force})){process.stderr.write(`Aborted.
23
- `);return}a(await s(`Deleting`,async()=>c.accounts.subscriptions.delete({account_id:l,subscription_identifier:r[`subscription-identifier`]})),{successLabel:`Deleted`})}};function Ze(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qe={command:`get`,describe:`Lists all of an account's subscriptions.`,builder:Ze,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.subscriptions.get({account_id:l})),{successLabel:`Loaded`})}};function $e(e){return e.positional(`subscription-identifier`,{type:`string`,description:`Subscription identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const et={command:`getByIdentifier <subscription-identifier>`,describe:`Gets an account subscription by identifier.`,builder:$e,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions getByIdentifier`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions/${r[`subscription-identifier`]==null?`<subscription-identifier>`:encodeURIComponent(String(r[`subscription-identifier`]))}`,pathParams:{"subscription-identifier":String(r[`subscription-identifier`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.subscriptions.getByIdentifier({account_id:l,subscription_identifier:r[`subscription-identifier`]})),{successLabel:`Loaded`})}};function tt(e){return e.positional(`subscription-identifier`,{type:`string`,description:`Subscription identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nt={command:`getCancelReason <subscription-identifier>`,describe:`Gets the cancellation reason for an account subscription.`,builder:tt,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions getCancelReason`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions/${r[`subscription-identifier`]==null?`<subscription-identifier>`:encodeURIComponent(String(r[`subscription-identifier`]))}/cancel-reason`,pathParams:{"subscription-identifier":String(r[`subscription-identifier`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.subscriptions.getCancelReason({account_id:l,subscription_identifier:r[`subscription-identifier`]})),{successLabel:`Loaded`})}};function rt(e){return e.positional(`subscription-identifier`,{type:`string`,description:`Subscription identifier tag.`,demandOption:!0}).option(`app-install-id`,{type:`string`,description:`app install id.`}).option(`frequency`,{type:`string`,description:`How often the subscription is renewed automatically.`,choices:[`weekly`,`monthly`,`quarterly`,`yearly`]}).option(`rate-plan-currency`,{type:`string`,description:`The currency applied to the rate plan subscription.`}).option(`rate-plan-externally-managed`,{type:`boolean`,description:`Whether this rate plan is managed externally from Cloudflare.`}).option(`rate-plan-id`,{type:`string`,description:`The ID of the rate plan.`}).option(`rate-plan-is-contract`,{type:`boolean`,description:`Whether a rate plan is enterprise-based (or newly adopted term contract).`}).option(`rate-plan-public-name`,{type:`string`,description:`The full name of the rate plan.`}).option(`rate-plan-scope`,{type:`string`,description:`The scope that this rate plan applies to.`}).option(`rate-plan-sets`,{type:`string`,array:!0,description:`The list of sets this rate plan applies to. Returns array of strings.`}).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 it={command:`update <subscription-identifier>`,describe:`Updates an account subscription.`,builder:rt,handler:async r=>{if(r.dryRun){o({command:`cf accounts subscriptions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/subscriptions/${r[`subscription-identifier`]==null?`<subscription-identifier>`:encodeURIComponent(String(r[`subscription-identifier`]))}`,pathParams:{"subscription-identifier":String(r[`subscription-identifier`]??``)},bodyKind:`json`,body:r.body===void 0?l({app:{install_id:u(r[`app-install-id`],`app-install-id`,`text`)},frequency:u(r.frequency,`frequency`,`text`),rate_plan:{currency:u(r[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:r[`rate-plan-externally-managed`],id:u(r[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:r[`rate-plan-is-contract`],public_name:u(r[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(r[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:r[`rate-plan-sets`]}}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.accounts.subscriptions.update({body:e,account_id:f,subscription_identifier:r[`subscription-identifier`]})),{successLabel:`Updated`});return}let p=l({app:{install_id:u(r[`app-install-id`],`app-install-id`,`text`)},frequency:u(r.frequency,`frequency`,`text`),rate_plan:{currency:u(r[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:r[`rate-plan-externally-managed`],id:u(r[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:r[`rate-plan-is-contract`],public_name:u(r[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(r[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:r[`rate-plan-sets`]}});a(await s(`Updating`,async()=>d.accounts.subscriptions.update({body:p,account_id:f,subscription_identifier:r[`subscription-identifier`]})),{successLabel:`Updated`})}},at={command:`subscriptions`,describe:`View and manage plan subscriptions attached to this account`,builder:e=>e.command(We).command(Ke).command(Je).command(Xe).command(Qe).command(et).command(nt).command(it).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ot(e){return e.option(`condition-request-ip-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`condition-request-ip-not-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`expires-on`,{type:`string`,description:`The expiration time on or after which the JWT MUST NOT be accepted for processing.`}).option(`name`,{type:`string`,description:`Token name.`}).option(`not-before`,{type:`string`,description:`The time before which the token MUST NOT be accepted for processing.`}).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 st={command:`create`,describe:`Create a new Account Owned API token.`,builder:ot,handler:async r=>{if(r.dryRun){o({command:`cf accounts tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({condition:{request_ip:{in:r[`condition-request-ip-in`],not_in:r[`condition-request-ip-not-in`]}},expires_on:u(r[`expires-on`],`expires-on`,`text`),name:u(r.name,`name`,`text`),not_before:u(r[`not-before`],`not-before`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.accounts.tokens.create({body:e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await d(`name`,`Token name.`));let m=l({condition:{request_ip:{in:r[`condition-request-ip-in`],not_in:r[`condition-request-ip-not-in`]}},expires_on:u(r[`expires-on`],`expires-on`,`text`),name:u(r.name,`name`,`text`),not_before:u(r[`not-before`],`not-before`,`text`)});a(await s(`Creating`,async()=>f.accounts.tokens.create({body:m,account_id:p})),{successLabel:`Created`})}};function ct(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,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 lt={command:`delete <token-id>`,describe:`Destroy an Account Owned API token.`,builder:ct,handler:async r=>{if(r.dryRun){o({command:`cf accounts tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens/${r[`token-id`]==null?`<token-id>`:encodeURIComponent(String(r[`token-id`]))}`,pathParams:{"token-id":String(r[`token-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
24
- `);return}a(await s(`Deleting`,async()=>c.accounts.tokens.delete({account_id:l,token_id:r[`token-id`]})),{successLabel:`Deleted`})}};function ut(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dt={command:`get <token-id>`,describe:`Get information about a specific Account Owned API token.`,builder:ut,handler:async r=>{if(r.dryRun){o({command:`cf accounts tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens/${r[`token-id`]==null?`<token-id>`:encodeURIComponent(String(r[`token-id`]))}`,pathParams:{"token-id":String(r[`token-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.tokens.get({account_id:l,token_id:r[`token-id`]})),{successLabel:`Loaded`})}};function ft(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`include-expired`,{type:`boolean`,description:`When true, includes recently-expired tokens in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`List all Account Owned API tokens created for this account. Results include active, disabled, and recently-expired tokens when include_expired is set to true.`,builder:p(ft),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],direction:r.direction,include_expired:r[`include-expired`]};if(r.dryRun){o({command:`cf accounts tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.tokens.list({account_id:u,...c})),{successLabel:`Loaded`})}};function pt(e){return e.option(`name`,{type:`string`,description:`Filter by the name of the permission group.
25
- The value must be URL-encoded.`}).option(`scope`,{type:`string`,description:`Filter by the scope of the permission group.
26
- The value must be URL-encoded.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const mt={command:`list`,describe:`Find all available permission groups for Account Owned API Tokens`,builder:pt,handler:async r=>{let c={name:r.name,scope:r.scope};if(r.dryRun){o({command:`cf accounts tokens permission-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens/permission_groups`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.accounts.tokens.permissionGroups.list({account_id:u,...c})),{successLabel:`Loaded`})}},ht={command:`permission-groups`,describe:`Operations for tokens.permission-groups`,builder:e=>e.command(mt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gt(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,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 _t={command:`roll <token-id>`,describe:`Roll the Account Owned API token secret.`,builder:gt,handler:async r=>{if(r.dryRun){o({command:`cf accounts tokens roll`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens/${r[`token-id`]==null?`<token-id>`:encodeURIComponent(String(r[`token-id`]))}/value`,pathParams:{"token-id":String(r[`token-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await f({force:!!r.force,message:`Rolling this token will invalidate the current secret and generate a new one. Any integrations using the current secret will stop working.`})){process.stderr.write(`Aborted.
27
- `);return}a(await s(`Deleting`,async()=>c.accounts.tokens.roll({account_id:l,token_id:r[`token-id`]})),{successLabel:`Deleted`})}};function vt(e){return e.positional(`token-id`,{type:`string`,description:`Token identifier tag.`,demandOption:!0}).option(`condition-request-ip-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`condition-request-ip-not-in`,{type:`string`,array:!0,description:`List of IPv4/IPv6 CIDR addresses.`}).option(`expires-on`,{type:`string`,description:`The expiration time on or after which the JWT MUST NOT be accepted for processing.`}).option(`name`,{type:`string`,description:`Token name.`}).option(`not-before`,{type:`string`,description:`The time before which the token MUST NOT be accepted for processing.`}).option(`status`,{type:`string`,description:`Status of the token.`,choices:[`active`,`disabled`,`expired`]}).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 yt={command:`update <token-id>`,describe:`Update an existing token.`,builder:vt,handler:async r=>{if(r.dryRun){o({command:`cf accounts tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens/${r[`token-id`]==null?`<token-id>`:encodeURIComponent(String(r[`token-id`]))}`,pathParams:{"token-id":String(r[`token-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({condition:{request_ip:{in:r[`condition-request-ip-in`],not_in:r[`condition-request-ip-not-in`]}},expires_on:u(r[`expires-on`],`expires-on`,`text`),name:u(r.name,`name`,`text`),not_before:u(r[`not-before`],`not-before`,`text`),status:u(r.status,`status`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>f.accounts.tokens.update({body:e,account_id:p,token_id:r[`token-id`]})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await d(`name`,`Token name.`));let m=l({condition:{request_ip:{in:r[`condition-request-ip-in`],not_in:r[`condition-request-ip-not-in`]}},expires_on:u(r[`expires-on`],`expires-on`,`text`),name:u(r.name,`name`,`text`),not_before:u(r[`not-before`],`not-before`,`text`),status:u(r.status,`status`,`text`)});a(await s(`Updating`,async()=>f.accounts.tokens.update({body:m,account_id:p,token_id:r[`token-id`]})),{successLabel:`Updated`})}};function bt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xt={command:`verify`,describe:`Test whether a token works.`,builder:bt,handler:async r=>{if(r.dryRun){o({command:`cf accounts tokens verify`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tokens/verify`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.accounts.tokens.verify({account_id:l})),{successLabel:`Loaded`})}},St={command:`tokens`,describe:`Create and manage scoped API tokens for programmatic access to the Cloudflare API`,builder:e=>e.command(st).command(lt).command(dt).command($).command(_t).command(yt).command(xt).command(ht).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ct(e){return e.option(`id`,{type:`string`,description:`Identifier`}).option(`name`,{type:`string`,description:`Account name`}).option(`settings-abuse-contact-email`,{type:`string`,description:`Sets an abuse contact email to notify for abuse reports.`}).option(`settings-enforce-twofactor`,{type:`boolean`,description:`Indicates whether membership in this account requires that
28
- Two-Factor Authentication is enabled`}).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 wt={command:`update`,describe:`Update an existing account.`,builder:Ct,handler:async r=>{if(r.dryRun){o({command:`cf accounts update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({id:u(r.id,`id`,`text`),name:u(r.name,`name`,`text`),settings:{abuse_contact_email:u(r[`settings-abuse-contact-email`],`settings-abuse-contact-email`,`text`),enforce_twofactor:r[`settings-enforce-twofactor`]}}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>f.accounts.update({body:e,account_id:p})),{successLabel:`Updated`});return}r.id===void 0&&(r.id=await d(`id`,`Identifier`)),r.name===void 0&&(r.name=await d(`name`,`Account name`));let m=l({id:u(r.id,`id`,`text`),name:u(r.name,`name`,`text`),settings:{abuse_contact_email:u(r[`settings-abuse-contact-email`],`settings-abuse-contact-email`,`text`),enforce_twofactor:r[`settings-enforce-twofactor`]}});a(await s(`Updating`,async()=>f.accounts.update({body:m,account_id:p})),{successLabel:`Updated`})}},Tt={command:`accounts`,describe:`Account settings, members, roles, subscriptions, and API tokens for your Cloudflare account`,builder:e=>e.command(_e).command(ye).command(xe).command(Ce).command(wt).command(E).command(ce).command(he).command(je).command(He).command(at).command(St).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Tt as default};
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{a as r,r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.mjs";import{n as c,t as l}from"./body-parser-CYD7PKFC.mjs";import{n as u,t as d}from"./input-validation-BBKJRoRB.mjs";import{a as f,i as p,n as m}from"./prompt-DM4z101s.mjs";import{t as h}from"./cli-types-BWdZbsFE.mjs";import{n as ee,t as te}from"./raw-fetch-25gXED6c.mjs";function g(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`model`,{type:`string`,description:`The model field`}).option(`stream`,{type:`boolean`,description:`The stream field`}).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 _={command:`chat-completions <id>`,describe:`Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/chat/completions`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream});a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`})}};function v(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`The ai_search_model field`}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).option(`chunk`,{type:`boolean`,description:`The chunk field`,default:!0}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`,default:10}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`],default:`rrf`}).option(`hybrid-search-enabled`,{type:`boolean`,description:`Deprecated — use index_method instead.`,default:!1}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`],default:`porter`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`,default:!0}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`,default:!1}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`,default:`Finds exactly what you're looking for`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`,default:!1}).option(`reranking`,{type:`boolean`,description:`The reranking field`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`The rewrite_model field`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`,default:.4}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`,default:5}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own.",default:!1}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`,default:!1}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`,default:1e5}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`,default:86400}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`],default:`all`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`,default:!1}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`,default:!0}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`],default:`sitemap`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`r2`,`web-crawler`]}).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)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0})}const y={command:`create <name> <id>`,describe:`Create a new AI Search instance with the given configuration.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.create({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}let p=l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id});a(await s(`Creating`,async()=>d.aiSearch.create({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function b(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,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 x={command:`delete <id>`,describe:`Permanently delete an AI Search instance and all its indexed data.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>c.aiSearch.delete({account_id:l,name:r.name,id:r.id})),{successLabel:`Deleted`})}};function S(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <id>`,describe:`Retrieve the configuration and status of an AI Search instance.`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.get({account_id:l,name:r.name,id:r.id})),{successLabel:`Loaded`})}};function w(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).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 T={command:`chunks <item-id>`,describe:`Lists chunks for a specific item in an AI Search instance, including their text content.`,builder:w,handler:async r=>{let c={limit:r.limit,offset:r.offset};if(r.dryRun){o({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/chunks`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.items.chunks({account_id:u,name:r.name,id:r.id,item_id:r[`item-id`],...c})),{successLabel:`Loaded`})}};function E(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance 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 D={command:`delete <item-id>`,describe:`Deletes a file from a managed AI Search instance and triggers a reindex.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting`,async()=>c.aiSearch.items.delete({account_id:l,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,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 k={command:`download <item-id>`,describe:`Downloads the raw file content for a specific item from the managed AI Search instance storage.`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/download`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}await i(r);let a=r.local?e:await t();r.accountId=a;let c=await s(`Loading`,async()=>te(`/accounts/${a}/ai-search/namespaces/${encodeURIComponent(String(r.name))}/instances/${encodeURIComponent(String(r.id))}/items/${encodeURIComponent(String(r[`item-id`]))}/download`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}));ee(r.text===!0?c.toString(`utf-8`):c)}};function A(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get <item-id>`,describe:`Retrieves a specific indexed item from an AI Search instance.`,builder:A,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.items.get({account_id:l,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Loaded`})}};function M(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search`}).option(`sort-by`,{type:`string`,description:`Sort order for items. "status" (default) sorts by status priority then last_seen_at. "modified_at" sorts by file modification time (most recent first), falling back to created_at.`,choices:[`status`,`modified_at`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`completed`,`error`,`skipped`,`outdated`]}).option(`source`,{type:`string`,description:`Filter items by source_id. Use "builtin" for uploaded files, or a source identifier like "web-crawler:https://example.com".`}).option(`metadata-filter`,{type:`string`,description:`JSON-encoded metadata filter using Vectorize filter syntax. Examples: {"folder":"reports/"}, {"timestamp":{"$gte":1700000000000}}, {"folder":{"$in":["docs/","reports/"]}}`}).option(`item-id`,{type:`string`,description:`Filter items by their unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Filter items by their exact key (object key / filename). Keys are unique per source, so combine with `source` to disambiguate across data sources."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Lists indexed items in an AI Search instance.`,builder:h(M),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search,sort_by:r[`sort-by`],status:r.status,source:r.source,metadata_filter:r[`metadata-filter`],item_id:r[`item-id`],key:r.key};if(r.dryRun){o({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items`,pathParams:{id:String(r.id??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.items.list({account_id:u,name:r.name,id:r.id,...c})),{successLabel:`Loaded`})}};function P(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).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 F={command:`logs <item-id>`,describe:`Lists processing logs for a specific item in an AI Search instance.`,builder:P,handler:async r=>{let c={limit:r.limit,cursor:r.cursor};if(r.dryRun){o({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/logs`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.items.logs({account_id:u,name:r.name,id:r.id,item_id:r[`item-id`],...c})),{successLabel:`Loaded`})}};function I(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).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 L={command:`sync <item-id>`,describe:`Syncs an item to an AI Search instance index.`,builder:I,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.items.sync({...e,account_id:f,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Updated`});return}r[`next-action`]===void 0&&(r[`next-action`]=await p(`next-action`,`The next_action field`,[`INDEX`]));let m=l({next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]});a(await s(`Updating`,async()=>d.aiSearch.items.sync({...m,account_id:f,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Updated`})}};function R(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`JSON string of custom metadata key-value pairs.`}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."})}const z={command:`upload <id>`,describe:`Uploads a file to a managed AI Search instance via multipart/form-data.`,builder:R,handler:async c=>{if(c.dryRun){o({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${c.name==null?`<name>`:encodeURIComponent(String(c.name))}/instances/${c.id==null?`<id>`:encodeURIComponent(String(c.id))}/items`,pathParams:{id:String(c.id??``),name:String(c.name??``)},bodyKind:`multipart`,body:{body:c.body,file:c.file,metadata:c.metadata,"wait-for-completion":c[`wait-for-completion`]}});return}let l=await i(c),f=c.local?e:await t();if(c.accountId=f,c.file!==void 0||c.body!==void 0||c.metadata!==void 0||c[`wait-for-completion`]!==void 0){let e=new FormData;if(c.file){let t=d(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);c.metadata!==void 0&&e.append(`metadata`,String(u(c.metadata,`metadata`,`text`)??``)),c[`wait-for-completion`]!==void 0&&e.append(`wait_for_completion`,String(c[`wait-for-completion`])),a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e})),{successLabel:`Created`});return}if(c.body){let e=u(c.body,`body`,`binary`);a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function B(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`key`,{type:`string`,description:`Item key / filename. Must not exceed 128 characters.`}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).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:`upsert <id>`,describe:`Creates or updates an indexed item in an AI Search instance.`,builder:B,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({key:u(r.key,`key`,`text`),next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]}):c(r.body)});return}let d=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.items.upsert({...e,account_id:m,name:r.name,id:r.id})),{successLabel:`Updated`});return}r.key===void 0&&(r.key=await f(`key`,`Item key / filename. Must not exceed 128 characters.`)),r[`next-action`]===void 0&&(r[`next-action`]=await p(`next-action`,`The next_action field`,[`INDEX`]));let h=l({key:u(r.key,`key`,`text`),next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]});a(await s(`Updating`,async()=>d.aiSearch.items.upsert({...h,account_id:m,name:r.name,id:r.id})),{successLabel:`Updated`})}},H={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`cancel`]}).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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`cancel <job-id>`,describe:`Cancel an in-progress indexing job for an AI Search instance.`,builder:U,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({action:u(r.action,`action`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,!await m({force:!!r.force,message:`This operation cancels the running indexing job.`})){process.stderr.write(`Aborted.
5
- `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>d.aiSearch.jobs.cancel({...e,account_id:f,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Deleted`});return}r.action===void 0&&(r.action=await p(`action`,`The action field`,[`cancel`]));let h=l({action:u(r.action,`action`,`text`)});a(await s(`Deleting`,async()=>d.aiSearch.jobs.cancel({...h,account_id:f,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).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 K={command:`create <id>`,describe:`Creates a new indexing job for an AI Search instance.`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.jobs.create({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`});return}let p=l({description:u(r.description,`description`,`text`)});a(await s(`Creating`,async()=>d.aiSearch.jobs.create({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`})}};function q(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <job-id>`,describe:`Retrieves details for a specific AI Search indexing job.`,builder:q,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.jobs.get({account_id:l,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Loaded`})}};function Y(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).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 X={command:`list`,describe:`Lists indexing jobs for an AI Search instance.`,builder:Y,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs`,pathParams:{id:String(r.id??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.jobs.list({account_id:u,name:r.name,id:r.id,...c})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).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 Q={command:`logs <job-id>`,describe:`Lists log entries for an AI Search indexing job.`,builder:Z,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}/logs`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.jobs.logs({account_id:u,name:r.name,id:r.id,job_id:r[`job-id`],...c})),{successLabel:`Loaded`})}},ne={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter instances whose id contains this string (case-insensitive).`}).option(`order-by`,{type:`string`,description:`Field to order results by.`,choices:[`created_at`]}).option(`order-by-direction`,{type:`string`,description:`Order direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`List all AI Search instances in the account.`,builder:h(re),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search,order_by:r[`order-by`],order_by_direction:r[`order-by-direction`]};if(r.dryRun){o({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances`,pathParams:{name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.list({account_id:u,name:r.name,...c})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace currently containing the instance.`,demandOption:!0}).option(`destination-namespace`,{type:`string`,description:`Target namespace to move the instance into.`}).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 oe={command:`move <id>`,describe:`Moves an instance from its current namespace to the specified target namespace. Use 'default' with --destination-namespace to move the instance back to the default namespace. Fails with 400 if the target namespace already has an instance with the same id (ids must be unique within a namespace — the same id can exist in different namespaces).`,builder:ae,handler:async r=>{if(r.dryRun){o({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{name:String(r.name??``),id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({new_namespace:u(r[`destination-namespace`],`destination-namespace`,`text`)}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.move({...e,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`});return}r[`destination-namespace`]===void 0&&(r[`destination-namespace`]=await f(`destination-namespace`,`Target namespace to move the instance into.`));let m=l({new_namespace:u(r[`destination-namespace`],`destination-namespace`,`text`)});a(await s(`Updating`,async()=>d.aiSearch.move({...m,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`})}};function se(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`model`,{type:`string`,description:`The model field`}).option(`stream`,{type:`boolean`,description:`The stream field`}).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 ce={command:`multi-chat-completions <name>`,describe:`Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.`,builder:se,handler:async r=>{if(r.dryRun){o({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/chat/completions`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.multiChatCompletions({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}if(r[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream});a(await s(`Creating`,async()=>d.aiSearch.multiChatCompletions({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function le(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).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 ue={command:`multi-search <name> <query>`,describe:`Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`,builder:le,handler:async r=>{if(r.dryRun){o({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/search`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.multiSearch({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}if(r[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query});a(await s(`Creating`,async()=>d.aiSearch.multiSearch({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function de(e){return e.positional(`namespace`,{type:`string`,description:`Name for the new namespace.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`,default:!0}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`,default:!1}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`,default:`Finds exactly what you're looking for`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`,default:!1}).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 fe={command:`create <namespace>`,describe:`Create a namespace for organizing AI Search instances.`,builder:de,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},name:r.namespace}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.namespace.create({...e,account_id:f})),{successLabel:`Created`});return}let p=l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},name:r.namespace});a(await s(`Creating`,async()=>d.aiSearch.namespace.create({...p,account_id:f})),{successLabel:`Created`})}};function pe(e){return e.positional(`name`,{type:`string`,description:`Namespace to delete.`,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 me={command:`delete <name>`,describe:`Permanently delete a namespace. The namespace must be empty (no instances), and the default namespace cannot be deleted.`,builder:pe,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}`,pathParams:{name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the namespace.`})){process.stderr.write(`Aborted.
6
- `);return}a(await s(`Deleting`,async()=>c.aiSearch.namespace.delete({account_id:l,name:r.name})),{successLabel:`Deleted`})}};function he(e){return e.positional(`name`,{type:`string`,description:`Namespace to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <name>`,describe:`Retrieve a namespace and its description.`,builder:he,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}`,pathParams:{name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.namespace.get({account_id:l,name:r.name})),{successLabel:`Loaded`})}};function _e(e){return e.option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter namespaces whose name or description contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`list`,describe:`List namespaces in the account, including their descriptions and creation times.`,builder:_e,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search};if(r.dryRun){o({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.namespace.list({account_id:u,...c})),{successLabel:`Loaded`})}};function ye(e){return e.positional(`name`,{type:`string`,description:`Namespace to update.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).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 be={command:`update <name>`,describe:`Update the description and/or the public endpoint configuration of an existing namespace. The default namespace's description cannot be modified, but its public endpoint can.`,builder:ye,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}}}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.namespace.update({...e,account_id:f,name:r.name})),{successLabel:`Updated`});return}let p=l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}}});a(await s(`Updating`,async()=>d.aiSearch.namespace.update({...p,account_id:f,name:r.name})),{successLabel:`Updated`})}},xe={command:`namespace`,describe:`Logical groupings for organizing AI Search instances`,builder:e=>e.command(fe).command(me).command(ge).command(ve).command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`purge-cache <id>`,describe:`Purges all cached search results for an AI Search instance. A new internal cache key is generated, immediately orphaning all prior cached entries.`,builder:Se,handler:async r=>{if(r.dryRun){o({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/purge_cache`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.aiSearch.purgeCache({account_id:l,name:r.name,id:r.id})),{successLabel:`Created`})}};function we(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`The ai_search_options.query_rewrite.model field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).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 Te={command:`search <id> <query>`,describe:`Executes a semantic search query against an AI Search instance to find relevant indexed content.`,builder:we,handler:async r=>{if(r.dryRun){o({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/search`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Loading`,async()=>d.aiSearch.search({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Loaded`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query});a(await s(`Loading`,async()=>d.aiSearch.search({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Loaded`})}};function Ee(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`stats <id>`,describe:`Retrieve usage and indexing statistics for an AI Search instance.`,builder:Ee,handler:async r=>{if(r.dryRun){o({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/stats`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.stats({account_id:l,name:r.name,id:r.id})),{successLabel:`Loaded`})}};function $(e){return e.positional(`name`,{type:`string`,description:`Human-readable name for the credential.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`,default:!0}).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 Oe={command:`create <name>`,describe:`Create a stored Cloudflare credential for an AI Search instance to access its data source.`,builder:$,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:r.name}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.tokens.create({...e,account_id:p})),{successLabel:`Created`});return}r[`api-token-id`]===void 0&&(r[`api-token-id`]=await f(`api-token-id`,`The cf_api_id field`)),r[`api-token`]===void 0&&(r[`api-token`]=await f(`api-token`,`The cf_api_key field`,{kind:`secret`}));let m=l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:r.name});a(await s(`Creating`,async()=>d.aiSearch.tokens.create({...m,account_id:p})),{successLabel:`Created`})}};function ke(e){return e.positional(`id`,{type:`string`,description:`Stored credential record 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 Ae={command:`delete <id>`,describe:`Permanently delete a stored AI Search credential. Credentials in use by an instance cannot be deleted.`,builder:ke,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the stored credential.`})){process.stderr.write(`Aborted.
7
- `);return}a(await s(`Deleting`,async()=>c.aiSearch.tokens.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function je(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`get <id>`,describe:`Retrieve a stored AI Search credential without exposing its secret.`,builder:je,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.tokens.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function Ne(e){return e.option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter tokens whose name contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`list`,describe:`List stored AI Search credentials in the account without exposing their secrets.`,builder:Ne,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search};if(r.dryRun){o({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.tokens.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Fe(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`}).option(`name`,{type:`string`,description:`The name field`}).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 Ie={command:`update <id>`,describe:`Replace a stored AI Search credential and invalidate cached credentials for instances that use it.`,builder:Fe,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:u(r.name,`name`,`text`)}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.tokens.update({...e,account_id:p,id:r.id})),{successLabel:`Updated`});return}r[`api-token-id`]===void 0&&(r[`api-token-id`]=await f(`api-token-id`,`The cf_api_id field`)),r[`api-token`]===void 0&&(r[`api-token`]=await f(`api-token`,`The cf_api_key field`,{kind:`secret`})),r.name===void 0&&(r.name=await f(`name`,`The name field`));let m=l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:u(r.name,`name`,`text`)});a(await s(`Updating`,async()=>d.aiSearch.tokens.update({...m,account_id:p,id:r.id})),{successLabel:`Updated`})}},Le={command:`tokens`,describe:`Credentials used by AI Search instances`,builder:e=>e.command(Oe).command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Re(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`The ai_search_model field`}).option(`cache`,{type:`boolean`,description:`The cache field`}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`chunk`,{type:`boolean`,description:`The chunk field`}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`]}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`paused`,{type:`boolean`,description:`The paused field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).option(`reranking`,{type:`boolean`,description:`The reranking field`}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`The rewrite_model field`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).option(`summarization`,{type:`boolean`,description:`The summarization field`}).option(`summarization-model`,{type:`string`,description:`The summarization_model field`}).option(`system-prompt-ai-search`,{type:`string`,description:`The system_prompt_ai_search field`}).option(`system-prompt-index-summarization`,{type:`string`,description:`The system_prompt_index_summarization field`}).option(`system-prompt-rewrite-query`,{type:`string`,description:`The system_prompt_rewrite_query field`}).option(`token-id`,{type:`string`,description:`The token_id field`}).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)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0})}const ze={command:`update <id>`,describe:`Update the configuration of an AI Search instance.`,builder:Re,handler:async r=>{if(r.dryRun){o({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:r.paused,public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:r.summarization,summarization_model:u(r[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:u(r[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:u(r[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:u(r[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:u(r[`token-id`],`token-id`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.update({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Updated`});return}let p=l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:r.paused,public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:r.summarization,summarization_model:u(r[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:u(r[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:u(r[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:u(r[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:u(r[`token-id`],`token-id`,`text`)});a(await s(`Updating`,async()=>d.aiSearch.update({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Updated`})}},Be={command:`ai-search`,describe:`Managed search-as-a-service: crawl, index, and query content with AI-powered relevance and chat completions`,builder:e=>e.command(_).command(y).command(x).command(C).command(ie).command(oe).command(ce).command(ue).command(Ce).command(Te).command(De).command(ze).command(H).command(ne).command(xe).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Be as default};