cf 0.3.0 → 0.4.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.
- package/dist/_meta/agent-context.json +26 -21
- package/dist/_meta/commands.json +7696 -18100
- package/dist/_meta/schemas.json +6411 -13925
- package/dist/{abuse-reports-dMIfUJ8v.mjs → abuse-reports-Dy76QPNP.mjs} +1 -1
- package/dist/{accounts-Kx1epdA1.mjs → accounts-CjtZ8x1z.mjs} +2 -2
- package/dist/{acm-Utu252kC.mjs → acm-C2lYIWs1.mjs} +1 -1
- package/dist/{addressing-CBq7Z7Vq.mjs → addressing-CHFK6uxW.mjs} +1 -1
- package/dist/{agent-context-BGTU299M.mjs → agent-context-CgGCT0xU.mjs} +1 -1
- package/dist/{ai-DOOKLPkG.mjs → ai-DS3i-I1a.mjs} +1 -1
- package/dist/{ai-gateway-Cj1T3avF.mjs → ai-gateway-RIsegO2x.mjs} +1 -1
- package/dist/ai-search-Dcj4BauG.mjs +7 -0
- package/dist/{ai_gateway-C3fH22C0.mjs → ai_gateway-w7YwfcPE.mjs} +1 -1
- package/dist/{alerting-CqmEIaKn.mjs → alerting-Bk85NNf5.mjs} +1 -1
- package/dist/{analytics-Dv-X8x7D.mjs → analytics-CkhhhZWZ.mjs} +1 -1
- package/dist/{analytics_engine-DdXVR8z2.mjs → analytics_engine-B7qgDJCA.mjs} +1 -1
- package/dist/{api-gateway-CNv0IHTU.mjs → api-gateway-CWdR4Ne7.mjs} +1 -1
- package/dist/{argo-CX_A4kcn.mjs → argo-DnJRVnGX.mjs} +1 -1
- package/dist/artifacts-BVWKiJUl.mjs +4 -0
- package/dist/{audit-logs-BfBf3oo-.mjs → audit-logs-DjTstbzL.mjs} +1 -1
- package/dist/auth-BqDOIrKX.mjs +150 -0
- package/dist/auth-DKkSwnxh.mjs +5 -0
- package/dist/billing-3rEqF83h.mjs +2 -0
- package/dist/{bot-management-CFvtVx62.mjs → bot-management-CJxD1pqi.mjs} +1 -1
- package/dist/{botnet-feed-B-M4Yu0W.mjs → botnet-feed-MG91D7BR.mjs} +1 -1
- package/dist/{brand-protection-D05Eg-_6.mjs → brand-protection-CK7gJi06.mjs} +1 -1
- package/dist/browser-rendering-Rae0AUt0.mjs +4 -0
- package/dist/{build-DYkGW4dh.mjs → build-BE4o4imx.mjs} +131 -131
- package/dist/{cache-DsoW6Xwv.mjs → cache-B7pRbpTy.mjs} +1 -1
- package/dist/{calls-CZbO7TyR.mjs → calls-DXRWsZ8n.mjs} +3 -3
- package/dist/{certificate-authorities-D2yr7_3t.mjs → certificate-authorities-BR3gXBLs.mjs} +1 -1
- package/dist/chunk-6IEM75FG-U3L9fKgi.mjs +2 -0
- package/dist/{client-certificates-MJcDsTId.mjs → client-certificates-B0ebLJdk.mjs} +1 -1
- package/dist/{cloud-connector-DWOrN2eM.mjs → cloud-connector-BOjaggJk.mjs} +1 -1
- package/dist/{cloudforce-one-2Bhz8YdW.mjs → cloudforce-one-B6HYfk5Z.mjs} +1 -1
- package/dist/{completions-BwRpZQVn.mjs → completions-D_9WsLG7.mjs} +1 -1
- package/dist/config-7CBz8Xm0.mjs +2 -0
- package/dist/{connectivity-BX8C7tvK.mjs → connectivity-welFvZ7X.mjs} +1 -1
- package/dist/connector-interrupts-DTV3F-50.mjs +2 -0
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +2 -0
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +2 -0
- package/dist/connectors-3vjrdFLB.mjs +3 -0
- package/dist/content-scanning-CnW2A0pv.mjs +4 -0
- package/dist/{context-DGlHRGWM.mjs → context-CONbNKO-.mjs} +1 -1
- package/dist/{custom-certificates-aAiEguR7.mjs → custom-certificates-CnYh6Yi-.mjs} +1 -1
- package/dist/{custom-hostnames-AG5yBHIi.mjs → custom-hostnames-C2upqZso.mjs} +1 -1
- package/dist/{custom-nameservers-D1DtlRue.mjs → custom-nameservers-BGkAD_PZ.mjs} +1 -1
- package/dist/{custom-pages-DQCi2plU.mjs → custom-pages-5fCSP8in.mjs} +1 -1
- package/dist/{d1-DbnYhw45.mjs → d1-CyiRbZZn.mjs} +1 -1
- package/dist/data-security-Casx4OS_.mjs +6 -0
- package/dist/{dcv-delegation-CHspSzTI.mjs → dcv-delegation-DVYO10oA.mjs} +1 -1
- package/dist/{deploy-CQial3kN.mjs → deploy-KBRFIatG.mjs} +1 -1
- package/dist/{dev-B38LfCTl.mjs → dev-pPazzZvt.mjs} +1 -1
- package/dist/{diagnostics-BJQGjVJn.mjs → diagnostics-BqYDoDfw.mjs} +1 -1
- package/dist/{dispatch-namespaces-DmHvoBOg.mjs → dispatch-namespaces-Cz2rajnP.mjs} +1 -1
- package/dist/{dist-AIcZFk0U.mjs → dist-DA54ZQu0.mjs} +7 -7
- package/dist/dist-DpDjsWWn.mjs +306 -0
- package/dist/{dns-VMhQSr5n.mjs → dns-62t95Xif.mjs} +1 -1
- package/dist/{dns-firewall-B4DVXFBQ.mjs → dns-firewall-Coy8d47t.mjs} +1 -1
- package/dist/{durable-objects-CTboySEo.mjs → durable-objects-BSuRERkw.mjs} +1 -1
- package/dist/{email-routing-tIR2SFu-.mjs → email-routing-BDUYYeV3.mjs} +1 -1
- package/dist/{email-security-Ca1id3rZ.mjs → email-security-ChHA6eqQ.mjs} +1 -1
- package/dist/{email-sending-DwWKc5jC.mjs → email-sending-CVrRqn6S.mjs} +1 -1
- package/dist/{filters-A4dg_a68.mjs → filters-qJpU9uAS.mjs} +1 -1
- package/dist/{firewall-DWPQgYd9.mjs → firewall-C3DDwfwh.mjs} +1 -1
- package/dist/{fraud-BMkSsJGU.mjs → fraud-DY3YXFVf.mjs} +1 -1
- package/dist/{google-tag-gateway-BGD49nRC.mjs → google-tag-gateway-B00MHDfB.mjs} +1 -1
- package/dist/{healthchecks-CtIfrFql.mjs → healthchecks-Drvb79v0.mjs} +1 -1
- package/dist/{hostnames-BiomxukN.mjs → hostnames-BdAQo1Mr.mjs} +1 -1
- package/dist/{hyperdrive-Da104VaQ.mjs → hyperdrive-99OJV9nl.mjs} +1 -1
- package/dist/{iam-BIGKo0WW.mjs → iam-BRbpg3lN.mjs} +1 -1
- package/dist/images-D1jI3r3O.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/{intel-CY6_79v8.mjs → intel-C3ajLpXd.mjs} +1 -1
- package/dist/{ips-K4bzaGqd.mjs → ips-B6JETVOY.mjs} +1 -1
- package/dist/{keyless-certificates-CZC-L8gM.mjs → keyless-certificates-C4MZ4xnf.mjs} +1 -1
- package/dist/{kv-8o27w_pY.mjs → kv-CSWoD9ks.mjs} +1 -1
- package/dist/{leaked-credential-checks-qLzRyu85.mjs → leaked-credential-checks-Dgs2oKm9.mjs} +2 -2
- package/dist/{load-balancers-DtG8nj25.mjs → load-balancers-Du1tNuUt.mjs} +1 -1
- package/dist/{logpush-4L0njy1d.mjs → logpush-SuJyO-uX.mjs} +1 -1
- package/dist/{logs-B_Yp95hv.mjs → logs-DcDNRPRl.mjs} +1 -1
- package/dist/{magic-cloud-networking-CSOM3EM-.mjs → magic-cloud-networking-D-T0RCvi.mjs} +1 -1
- package/dist/{magic-network-monitoring-BnwvM4-I.mjs → magic-network-monitoring-CqtvOePQ.mjs} +1 -1
- package/dist/{magic-transit-CXDyvhxq.mjs → magic-transit-BTbkhBtF.mjs} +32 -33
- package/dist/{managed-transforms-D15yVbZx.mjs → managed-transforms-CfUBSz9p.mjs} +1 -1
- package/dist/{mtls-certificates-D8k0AXWK.mjs → mtls-certificates-Cf1O8c2E.mjs} +1 -1
- package/dist/{network-interconnects-rrr7red3.mjs → network-interconnects-DsiNytOU.mjs} +1 -1
- package/dist/{observability-DWvpqnQJ.mjs → observability-CLqZ7OSi.mjs} +1 -1
- package/dist/open-YWOUIZ5Y-BpqIuBsR.mjs +4 -0
- package/dist/{organizations-T77D50Sq.mjs → organizations-aRi1bhFC.mjs} +2 -2
- package/dist/{origin-ca-certificates-DXIvD8H5.mjs → origin-ca-certificates-BB4H89a_.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-C8oOczyV.mjs → origin-post-quantum-encryption-DurP3PXG.mjs} +1 -1
- package/dist/{origin-tls-client-auth-CaVW1Ztp.mjs → origin-tls-client-auth-CnQNy9-l.mjs} +1 -1
- package/dist/{output-BJFNwj7b.mjs → output-CUxZRM5A.mjs} +1 -1
- package/dist/{page-rules-CjZPTMQX.mjs → page-rules-CYqtPU1p.mjs} +1 -1
- package/dist/{page-shield-D5RRNJCY.mjs → page-shield-D8l9ZMUl.mjs} +1 -1
- package/dist/{pages-CWJtJnL0.mjs → pages-ChurJ2H7.mjs} +1 -1
- package/dist/{pipelines-B0L_7j9e.mjs → pipelines-CeyujvRf.mjs} +1 -1
- package/dist/{progress-CrCGTq7N.mjs → progress-Cent9Lsg.mjs} +1 -1
- package/dist/{queues-CN6DPhRR.mjs → queues-Rf_n11Cx.mjs} +1 -1
- package/dist/{r2-DQIcyRtA.mjs → r2-BtuTO3vQ.mjs} +1 -1
- package/dist/{r2-data-catalog-Bbo93TJx.mjs → r2-data-catalog-Debz38kv.mjs} +1 -1
- package/dist/radar-CzGM92uM.mjs +2 -0
- package/dist/{rate-limits-DcrQV6Ar.mjs → rate-limits-Bbk7HxP7.mjs} +1 -1
- package/dist/{raw-fetch-Dlccg0Tr.mjs → raw-fetch-DnbAMFBp.mjs} +1 -1
- package/dist/{realtime-kit-CaquuVOE.mjs → realtime-kit-CivLpkpg.mjs} +1 -1
- package/dist/{registrar-Ko-xZemf.mjs → registrar-8IeA5DKd.mjs} +1 -1
- package/dist/{request-tracers-DOW_reTJ.mjs → request-tracers-D1aH4NmL.mjs} +1 -1
- package/dist/{resource-sharing-D7TX0JV0.mjs → resource-sharing-B-Pcto7-.mjs} +3 -3
- package/dist/{resource-tagging-C3qtLzCz.mjs → resource-tagging-Bpb6Qq1M.mjs} +1 -1
- package/dist/{rules-BXRADHL5.mjs → rules-B10XWY10.mjs} +1 -1
- package/dist/{rulesets-CBgpeSvJ.mjs → rulesets-lYczEcJp.mjs} +1 -1
- package/dist/{rum-BjPptTUP.mjs → rum-B5GUKa4I.mjs} +3 -3
- package/dist/{schema-D16TgWBg.mjs → schema-hefO-tzo.mjs} +1 -1
- package/dist/{schema-validation-Dgv_opM3.mjs → schema-validation-DTq517Em.mjs} +1 -1
- package/dist/{scim-DdSEr4kZ.mjs → scim-BiLfOQ89.mjs} +1 -1
- package/dist/{secrets-store-7BfyvJLb.mjs → secrets-store-CBX0dvHL.mjs} +1 -1
- package/dist/{security-center-DAy6AKtT.mjs → security-center-AVpTOBK3.mjs} +1 -1
- package/dist/{security-txt-xAMb7K6Y.mjs → security-txt-DVlh8y9l.mjs} +1 -1
- package/dist/{session-COHHdS7A.mjs → session-CsvPYFj8.mjs} +2 -2
- package/dist/shared-0bwWVDLo.mjs +2 -0
- package/dist/{smart-shield-TeWZFnH2.mjs → smart-shield-DblHIce0.mjs} +1 -1
- package/dist/{snippets-CCSsCXVs.mjs → snippets-DrpqSXYC.mjs} +1 -1
- package/dist/{spawn-DcppKGI5.mjs → spawn-DK7pott_.mjs} +1 -1
- package/dist/{spectrum-CTTZID8u.mjs → spectrum-CnrG0jIC.mjs} +2 -2
- package/dist/speed-BzRY3Xlh.mjs +4 -0
- package/dist/{src-BW6vfAwE.mjs → src-D9_Gq68b.mjs} +10 -10
- package/dist/{ssl-BWA2LdwC.mjs → ssl-Cp6tQkZH.mjs} +1 -1
- package/dist/stream-CGTRN4ZN.mjs +14 -0
- package/dist/{tenants-Bd7NGQ_m.mjs → tenants-o_M62Y1n.mjs} +1 -1
- package/dist/{token-validation-DAgtFOvs.mjs → token-validation-Ca5AGEns.mjs} +1 -1
- package/dist/{tools-DXQmfFuE.mjs → tools-DtNNmO6l.mjs} +1 -1
- package/dist/{turnstile-cfdaO4ca.mjs → turnstile-l7mo9BWL.mjs} +2 -2
- package/dist/{ui-D4KtlMh9.mjs → ui-B97lRnOv.mjs} +1 -1
- package/dist/{url-normalization-B5RN4nLD.mjs → url-normalization-D1CogSIG.mjs} +1 -1
- package/dist/{url-scanner-BrZ1L9OC.mjs → url-scanner-BnJHJqcz.mjs} +1 -1
- package/dist/{user-CAo-yCJA.mjs → user-CiyYZ69X.mjs} +2 -2
- package/dist/{vectorize-C7_oQlaI.mjs → vectorize-D3LgMLOn.mjs} +1 -1
- package/dist/{versions-CUwWJWmy.mjs → versions-B6E8WQyA.mjs} +1 -1
- package/dist/{waiting-rooms-Dln5ICg5.mjs → waiting-rooms-Bhy_nuV3.mjs} +1 -1
- package/dist/{web3-HQJRm38W.mjs → web3-DlHE0CZc.mjs} +1 -1
- package/dist/{workers-Dg7ddG2Q.mjs → workers-DRAkU6YR.mjs} +1 -1
- package/dist/{workers-builds-AVfx8IyL.mjs → workers-builds-BmNjiHDZ.mjs} +1 -1
- package/dist/{workflows-VquuSh2J.mjs → workflows-z6oapEJs.mjs} +1 -1
- package/dist/{zaraz-xYSWIV4P.mjs → zaraz-CyzfYOEU.mjs} +1 -1
- package/dist/{zero-trust-CP96wnSh.mjs → zero-trust-fyyIelWx.mjs} +44 -44
- package/dist/zero_trust-BAhlNkjo.mjs +3 -0
- package/dist/{zones-BSgmZ9WC.mjs → zones-MSULnDwW.mjs} +4 -4
- package/package.json +4 -4
- package/dist/ai-search-CQF_Sn7d.mjs +0 -7
- package/dist/auth-SyWhMmPu.mjs +0 -6
- package/dist/auth-ffdf9yR0.mjs +0 -135
- package/dist/autorag-BuGhGTeZ.mjs +0 -2
- package/dist/billing-PoG81XaQ.mjs +0 -2
- package/dist/browser-rendering-xu8F_Rrv.mjs +0 -4
- package/dist/config-DYzlVxcB.mjs +0 -2
- package/dist/content-scanning-r6uzMO1r.mjs +0 -4
- package/dist/data-security-D_EtYBfo.mjs +0 -6
- package/dist/dist-DNBSHor6.mjs +0 -301
- package/dist/images-BO8FbDAa.mjs +0 -5
- package/dist/radar-Bxb0WX8V.mjs +0 -2
- package/dist/shared-AGtpXwwL.mjs +0 -2
- package/dist/speed-CuzTE0AL.mjs +0 -4
- package/dist/stream-GFsIZ-pP.mjs +0 -14
- /package/dist/{body-parser-DKa8Ipg1.mjs → body-parser-CBpeIUns.mjs} +0 -0
- /package/dist/{cli-types-CRIDdDw3.mjs → cli-types-CMNMD1V7.mjs} +0 -0
- /package/dist/{input-validation-zEO81MWN.mjs → input-validation-CTqtyiY9.mjs} +0 -0
- /package/dist/{lib-Eu1wXxuh.mjs → lib-B6xvCJjc.mjs} +0 -0
- /package/dist/{local-VJaJ3BZ1.mjs → local-D8bhHUMK.mjs} +0 -0
- /package/dist/{metadata-5VwHPW6C.mjs → metadata-jh2EIan8.mjs} +0 -0
- /package/dist/{resolve-4-OSeHlK.mjs → resolve-D1mG0REg.mjs} +0 -0
- /package/dist/{theme-BklJDrb2.mjs → theme-CFHr0Dh9.mjs} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-BqDOIrKX.mjs";import{n as s,r as c,t as l}from"./body-parser-CBpeIUns.mjs";import{t as u}from"./output-CUxZRM5A.mjs";import{n as d,t as f}from"./progress-Cent9Lsg.mjs";import{n as p,t as m}from"./input-validation-CTqtyiY9.mjs";import{t as h}from"./local-D8bhHUMK.mjs";import{t as g}from"./cli-types-CMNMD1V7.mjs";function _(e){return e.option(`application-id`,{type:`string`,description:`Application/vendor identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Returns available auth methods for the specified vendor, including credential schema, instructions, and example payloads. Use this to understand what credentials are required before calling POST /v2/integrations.`,builder:g(_),handler:async t=>{if(t.dryRun){d({command:`cf zero_trust casb applications auth_methods list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/applications/${t[`application-id`]==null?`<application-id>`:encodeURIComponent(String(t[`application-id`]))}/auth-methods`,pathParams:{"application-id":String(t[`application-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?h:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.zeroTrust.casb.applications.authMethods.list({account_id:r,application_id:t[`application-id`]})),{successLabel:`Loaded`})}},y={command:`auth_methods`,describe:`Operations for casb.applications.auth_methods`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.positional(`application-id`,{type:`string`,description:`Application/vendor identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`get <application-id>`,describe:`Returns full application details including auth methods, use cases, and permissions.`,builder:g(b),handler:async t=>{if(t.dryRun){d({command:`cf zero_trust casb applications get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/applications/${t[`application-id`]==null?`<application-id>`:encodeURIComponent(String(t[`application-id`]))}`,pathParams:{"application-id":String(t[`application-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?h:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.zeroTrust.casb.applications.get({account_id:r,application_id:t[`application-id`]})),{successLabel:`Loaded`})}};function S(e){return e.option(`environment`,{type:`string`,description:`Filter by supported environment (standard, fedramp).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`list`,describe:`Returns a list of available applications with use cases and permissions.`,builder:S,handler:async t=>{let n={environment:t.environment};if(t.dryRun){d({command:`cf zero_trust casb applications list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/applications`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?h:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.zeroTrust.casb.applications.list({account_id:a,...n})),{successLabel:`Loaded`})}};function w(e){return e.option(`application-id`,{type:`string`,description:`Application/vendor identifier.`,demandOption:!0}).option(`auth-method`,{type:`string`,description:`Filter by auth method id. Get available ids from GET /v2/applications.`}).option(`environment`,{type:`string`,description:`Filter by environment.`,choices:[`fedramp`,`standard`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`Returns all available setup flows for the application, one per auth method.`,builder:g(w),handler:async t=>{let n={auth_method:t[`auth-method`],environment:t.environment};if(t.dryRun){d({command:`cf zero_trust casb applications setup_flows list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/applications/${t[`application-id`]==null?`<application-id>`:encodeURIComponent(String(t[`application-id`]))}/setup-flows`,pathParams:{"application-id":String(t[`application-id`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?h:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.zeroTrust.casb.applications.setupFlows.list({account_id:a,application_id:t[`application-id`],...n})),{successLabel:`Loaded`})}},E={command:`setup_flows`,describe:`Operations for casb.applications.setup_flows`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`applications`,describe:`Operations for casb.applications`,builder:e=>e.command(x).command(C).command(y).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.option(`application`,{type:`string`,description:"Vendor/application slug (e.g., GOOGLE_WORKSPACE).\n\n* `BITBUCKET` - BITBUCKET\n* `BOX` - BOX\n* `CONFLUENCE` - CONFLUENCE\n* `DROPBOX` - DROPBOX\n* `GITHUB` - GITHUB\n* `GOOGLE_WORKSPACE` - GOOGLE_WORKSPACE\n* `JIRA` - JIRA\n* `MICROSOFT_INTERNAL` - MICROSOFT_INTERNAL\n* `SALESFORCE` - SALESFORCE\n* `SLACK` - SLACK",choices:[`BITBUCKET`,`BOX`,`CONFLUENCE`,`DROPBOX`,`GITHUB`,`GOOGLE_WORKSPACE`,`JIRA`,`MICROSOFT_INTERNAL`,`SALESFORCE`,`SLACK`]}).option(`auth-method`,{type:`string`,description:`Authentication method slug (uses default if omitted).`}).option(`dlp-profiles`,{type:`string`,array:!0,description:`List of DLP profile IDs to associate.`}).option(`name`,{type:`string`,description:`Name of the integration.`}).option(`permissions`,{type:`string`,array:!0,description:`List of permission scopes (uses policy defaults if empty).`}).option(`use-cases`,{type:`string`,array:!0,description:`List of use case or feature slugs to enroll (e.g., ['casb', 'ces', 'auto_remediation']).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Serializer for v2 integration create requests.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const k={command:`create`,describe:"Creates a new integration for the specified application. Integration creation with OAuth is not supported by API at the moment. For other auth methods, use `GET /v2/applications/{application_id}/credential-guide` to see the required credential structure and example payloads for each vendor.",builder:O,handler:async r=>{if(r.dryRun){d({command:`cf zero_trust casb integrations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/integrations`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({application:p(r.application,`application`,`text`),auth_method:p(r[`auth-method`],`auth-method`,`text`),dlp_profiles:r[`dlp-profiles`],name:p(r.name,`name`,`text`),permissions:r.permissions,use_cases:r[`use-cases`]}):s(r.body)});return}let g=await o(r),_=r.local?h:await i(g);if(r.accountId=_,r.file){let e=m(r.file);u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/one/integrations`,{body:e,headers:{"Content-Type":``}})),{successLabel:`Created`});return}if(r.body){let e=s(r.body);u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/one/integrations`,{body:e})),{successLabel:`Created`});return}r.application===void 0&&(r.application=await n(`application`,"Vendor/application slug (e.g., GOOGLE_WORKSPACE). * `BITBUCKET` - BITBUCKET * `BOX` - BOX * `CONFLUENCE` - CONFLUENCE * `DROPBOX` - DROPBOX * `GITHUB` - GITHUB * `GOOGLE_WORKSPACE` - GOOGLE_WORKSPACE * `JIRA` - JIRA * `MICROSOFT_INTERNAL` - MICROSOFT_INTERNAL * `SALESFORCE` - SALESFORCE * `SLACK` - SLACK",[`BITBUCKET`,`BOX`,`CONFLUENCE`,`DROPBOX`,`GITHUB`,`GOOGLE_WORKSPACE`,`JIRA`,`MICROSOFT_INTERNAL`,`SALESFORCE`,`SLACK`])),r.name===void 0&&(r.name=await t(`name`,`Name of the integration.`));let v={};r.application!==void 0&&c(v,[`application`],p(r.application,`application`,`text`)),r[`auth-method`]!==void 0&&c(v,[`auth_method`],p(r[`auth-method`],`auth-method`,`text`)),r[`dlp-profiles`]!==void 0&&c(v,[`dlp_profiles`],r[`dlp-profiles`]),r.name!==void 0&&c(v,[`name`],p(r.name,`name`,`text`)),r.permissions!==void 0&&c(v,[`permissions`],r.permissions),r[`use-cases`]!==void 0&&c(v,[`use_cases`],r[`use-cases`]),u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/one/integrations`,{body:Object.keys(v).length>0?v:void 0})),{successLabel:`Created`})}};function A(e){return e.positional(`id`,{type:`string`,description:`Integration 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 j={command:`delete <id>`,describe:`Delete an integration by soft-deleting it.`,builder:A,handler:async t=>{if(t.dryRun){d({command:`cf zero_trust casb integrations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/integrations/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?h:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}u(await f(`Deleting`,async()=>n.zeroTrust.casb.integrations.delete({account_id:a,id:t.id})),{successLabel:`Deleted`})}};function M(e){return e.positional(`id`,{type:`string`,description:`Integration ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get <id>`,describe:`Returns full integration details including use cases and permissions.`,builder:M,handler:async t=>{if(t.dryRun){d({command:`cf zero_trust casb integrations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/integrations/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?h:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.zeroTrust.casb.integrations.get({account_id:r,id:t.id})),{successLabel:`Loaded`})}};function P(e){return e.option(`application`,{type:`string`,description:`Filter by application/vendor (e.g., GOOGLE_WORKSPACE, MICROSOFT_INTERNAL).`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`dlp-enabled`,{type:`boolean`,description:`Filter by DLP enabled status (true/false).`}).option(`order`,{type:`string`,description:`Field to order results by.`,choices:[`application`,`created`,`name`,`status`]}).option(`page`,{type:`number`,description:`Page number within the paginated result set.`}).option(`page-size`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Search integrations by name or application.`}).option(`status`,{type:`string`,description:`Filter by integration status.`,choices:[`Healthy`,`Initializing`,`Offline`,`Unhealthy`]}).option(`use-cases`,{type:`string`,description:`Filter by enabled use cases (e.g., casb, ces). Matches integrations enrolled in any of the specified values. Can be specified multiple times.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`list`,describe:`Returns a paginated list of integrations for the account.`,builder:g(P),handler:async t=>{let n={application:t.application,direction:t.direction,dlp_enabled:t[`dlp-enabled`],order:t.order,page:t.page,page_size:t[`page-size`],search:t.search,status:t.status,use_cases:t[`use-cases`]};if(t.dryRun){d({command:`cf zero_trust casb integrations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/integrations`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?h:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.zeroTrust.casb.integrations.list({account_id:a,...n})),{successLabel:`Loaded`})}};function I(e){return e.positional(`id`,{type:`string`,description:`Integration ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`pause <id>`,describe:`Pauses an integration, stopping all crawlers.`,builder:I,handler:async t=>{if(t.dryRun){d({command:`cf zero_trust casb integrations pause`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/integrations/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/pause`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?h:await i(n);t.accountId=r,u(await f(`Creating`,async()=>n.zeroTrust.casb.integrations.pause({account_id:r,id:t.id})),{successLabel:`Created`})}};function R(e){return e.positional(`id`,{type:`string`,description:`Integration ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`resume <id>`,describe:`Resumes a paused integration, restarting crawlers.`,builder:R,handler:async t=>{if(t.dryRun){d({command:`cf zero_trust casb integrations resume`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/integrations/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/resume`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?h:await i(n);t.accountId=r,u(await f(`Creating`,async()=>n.zeroTrust.casb.integrations.resume({account_id:r,id:t.id})),{successLabel:`Created`})}};function B(e){return e.positional(`id`,{type:`string`,description:`Integration ID.`,demandOption:!0}).option(`dlp-profiles`,{type:`string`,array:!0,description:`List of DLP profile IDs to associate with the integration.`}).option(`name`,{type:`string`,description:`Name of the integration.`}).option(`permissions`,{type:`string`,array:!0,description:`List of permission scopes granted to the integration.`}).option(`use-cases`,{type:`string`,array:!0,description:`List of use case or feature slugs to enroll (e.g., ['casb', 'ces', 'auto_remediation']).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Serializer for v2 integration PATCH requests.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const V={command:`update <id>`,describe:`Updates an integration's name, permissions, DLP profiles, use cases, or credentials.`,builder:B,handler:async t=>{if(t.dryRun){d({command:`cf zero_trust casb integrations update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/one/integrations/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`json`,body:t.body===void 0?l({dlp_profiles:t[`dlp-profiles`],name:p(t.name,`name`,`text`),permissions:t.permissions,use_cases:t[`use-cases`]}):s(t.body)});return}let n=await o(t),r=t.local?h:await i(n);if(t.accountId=r,t.file){let e=m(t.file);u(await f(`Updating`,async()=>a(n,`PATCH`,`/accounts/${r}/one/integrations/${encodeURIComponent(String(t.id))}`,{body:e,headers:{"Content-Type":``}})),{successLabel:`Updated`});return}if(t.body){let e=s(t.body);u(await f(`Updating`,async()=>a(n,`PATCH`,`/accounts/${r}/one/integrations/${encodeURIComponent(String(t.id))}`,{body:e})),{successLabel:`Updated`});return}let g={};t[`dlp-profiles`]!==void 0&&c(g,[`dlp_profiles`],t[`dlp-profiles`]),t.name!==void 0&&c(g,[`name`],p(t.name,`name`,`text`)),t.permissions!==void 0&&c(g,[`permissions`],t.permissions),t[`use-cases`]!==void 0&&c(g,[`use_cases`],t[`use-cases`]),u(await f(`Updating`,async()=>a(n,`PATCH`,`/accounts/${r}/one/integrations/${encodeURIComponent(String(t.id))}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated`})}},H={command:`integrations`,describe:`Operations for casb.integrations`,builder:e=>e.command(k).command(j).command(N).command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`casb`,describe:`Operations for casb`,builder:e=>e.command(D).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`zero_trust`,describe:`zero_trust`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{W as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{D as e,E as t,S as n,T as r,n as i}from"./auth-
|
|
2
|
+
import{D as e,E as t,S as n,T as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./cli-types-CMNMD1V7.mjs";function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`trigger`,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:f,handler:async e=>{if(e.dryRun){c({command:`cf zones activation-check trigger`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/activation_check`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Updating`,async()=>t.zones.activationCheck.trigger({zone_id:r})),{successLabel:`Updated`})}},te={command:`activation-check`,describe:`Operations for activation-check`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(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 m={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:p,handler:async e=>{if(e.dryRun){c({command:`cf zones aegis edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/aegis`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:{enabled:e[`value-enabled`],pool_id:u(e[`value-pool-id`],`value-pool-id`,`text`)}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.aegis.edit({...n,zone_id:r})),{successLabel:`Updated`});return}let d=o({value:{enabled:e[`value-enabled`],pool_id:u(e[`value-pool-id`],`value-pool-id`,`text`)}});s(await l(`Updating`,async()=>t.zones.aegis.edit({...d,zone_id:r})),{successLabel:`Updated`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`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:h,handler:async e=>{if(e.dryRun){c({command:`cf zones aegis get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/aegis`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.aegis.get({zone_id:r})),{successLabel:`Loaded`})}},_={command:`aegis`,describe:`Aegis operations`,builder:e=>e.command(m).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(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
|
-
`,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 y={command:`create`,describe:`
|
|
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 y={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:v,handler:async t=>{if(t.dryRun){c({command:`cf zones create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones`,pathParams:{},bodyKind:`json`,body:t.body===void 0?o({account:{id:u(t[`account-id`],`account-id`,`text`)},name:u(t.name,`name`,`text`),type:u(t.type,`type`,`text`)}):a(t.body)});return}let n=await i(t);if(t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.zones.create({...e})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await e(`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 r=o({account:{id:u(t[`account-id`],`account-id`,`text`)},name:u(t.name,`name`,`text`),type:u(t.type,`type`,`text`)});s(await l(`Creating`,async()=>n.zones.create({...r})),{successLabel:`Created`})}};function b(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 x={command:`delete`,describe:`Deletes an existing zone.`,builder:b,handler:async e=>{if(e.dryRun){c({command:`cf zones delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),a=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
5
|
`);return}s(await l(`Deleting`,async()=>t.zones.delete({zone_id:a})),{successLabel:`Deleted`})}};function S(e){return e.option(`paused`,{type:`boolean`,description:`Indicates whether the zone is only using Cloudflare DNS services. A
|
|
6
6
|
true value means the zone will not receive security or performance
|
|
7
7
|
benefits.
|
|
@@ -11,11 +11,11 @@ parameter is only available to Enterprise customers or if it has
|
|
|
11
11
|
been explicitly enabled on a zone.
|
|
12
12
|
`,choices:[`full`,`partial`,`secondary`,`internal`]}).option(`vanity-name-servers`,{type:`string`,array:!0,description:`An array of domains used for custom name servers. This is only
|
|
13
13
|
available for Business and Enterprise plans.`}).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 C={command:`edit`,describe:`Edits a zone. Only one zone property can be changed at a time.`,builder:S,handler:async e=>{if(e.dryRun){c({command:`cf zones edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({paused:e.paused,plan:{id:u(e[`plan-id`],`plan-id`,`text`)},type:u(e.type,`type`,`text`),vanity_name_servers:e[`vanity-name-servers`]}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.edit({...n,zone_id:r})),{successLabel:`Updated`});return}let d=o({paused:e.paused,plan:{id:u(e[`plan-id`],`plan-id`,`text`)},type:u(e.type,`type`,`text`),vanity_name_servers:e[`vanity-name-servers`]});s(await l(`Updating`,async()=>t.zones.edit({...d,zone_id:r})),{successLabel:`Updated`})}};function w(e){return e.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 T={command:`create`,describe:`Creates environments for a zone.`,builder:w,handler:async e=>{if(e.dryRun){c({command:`cf zones environments create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Creating`,async()=>t.zones.environments.create({body:n,zone_id:r})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function E(e){return e.positional(`environment-id`,{type:`string`,description:`Reference identifier for the environment.`,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 <environment-id>`,describe:`Deletes a zone environment by reference identifier.`,builder:E,handler:async e=>{if(e.dryRun){c({command:`cf zones environments delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments/${e[`environment-id`]==null?`<environment-id>`:encodeURIComponent(String(e[`environment-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"environment-id":String(e[`environment-id`]??``)},bodyKind:`none`});return}let t=await i(e),a=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
14
|
-
`);return}s(await l(`Deleting`,async()=>t.zones.environments.delete({zone_id:a,environment_id:e[`environment-id`]})),{successLabel:`Deleted`})}};function O(e){return e.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:`edit`,describe:`Applies partial updates to zone environments.`,builder:O,handler:async e=>{if(e.dryRun){c({command:`cf zones environments edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.environments.edit({body:n,zone_id:r})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Lists configured environments for a zone.`,builder:A,handler:async e=>{if(e.dryRun){c({command:`cf zones environments list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.environments.list({zone_id:r})),{successLabel:`Loaded`})}};function M(e){return e.positional(`environment-id`,{type:`string`,description:`Reference identifier for the environment.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`rollback <environment-id>`,describe:`Rolls a zone environment back to its previous version.`,builder:M,handler:async e=>{if(e.dryRun){c({command:`cf zones environments rollback`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments/${e[`environment-id`]==null?`<environment-id>`:encodeURIComponent(String(e[`environment-id`]))}/rollback`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"environment-id":String(e[`environment-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Creating`,async()=>t.zones.environments.rollback({zone_id:r,environment_id:e[`environment-id`]})),{successLabel:`Created`})}};function P(e){return e.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 F={command:`update`,describe:`Replaces the full environment configuration for a zone.`,builder:P,handler:async e=>{if(e.dryRun){c({command:`cf zones environments update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.environments.update({body:n,zone_id:r})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},I={command:`environments`,describe:`Operations for environments`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.option(`value`,{type:`string`,description:`Whether the feature is enabled or disabled.`,choices:[`on`,`off`]}).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 R={command:`edit`,describe:`Enhance your website's font delivery with Cloudflare Fonts. Deliver Google Hosted fonts from your own domain, boost performance, and enhance user privacy. Refer to the Cloudflare Fonts documentation for more information.`,builder:L,handler:async e=>{if(e.dryRun){c({command:`cf zones fonts edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/fonts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let r=await i(e),d=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=d,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.zones.fonts.edit({...t,zone_id:d})),{successLabel:`Updated`});return}e.value===void 0&&(e.value=await t(`value`,`Whether the feature is enabled or disabled.`,[`on`,`off`]));let f=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>r.zones.fonts.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function z(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get`,describe:`Enhance your website's font delivery with Cloudflare Fonts. Deliver Google Hosted fonts from your own domain, boost performance, and enhance user privacy. Refer to the Cloudflare Fonts documentation for more information.`,builder:z,handler:async e=>{if(e.dryRun){c({command:`cf zones fonts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/fonts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.fonts.get({zone_id:r})),{successLabel:`Loaded`})}},V={command:`fonts`,describe:`Fonts operations`,builder:e=>e.command(R).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`get`,describe:`
|
|
14
|
+
`);return}s(await l(`Deleting`,async()=>t.zones.environments.delete({zone_id:a,environment_id:e[`environment-id`]})),{successLabel:`Deleted`})}};function O(e){return e.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:`edit`,describe:`Applies partial updates to zone environments.`,builder:O,handler:async e=>{if(e.dryRun){c({command:`cf zones environments edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.environments.edit({body:n,zone_id:r})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Lists configured environments for a zone.`,builder:A,handler:async e=>{if(e.dryRun){c({command:`cf zones environments list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.environments.list({zone_id:r})),{successLabel:`Loaded`})}};function M(e){return e.positional(`environment-id`,{type:`string`,description:`Reference identifier for the environment.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`rollback <environment-id>`,describe:`Rolls a zone environment back to its previous version.`,builder:M,handler:async e=>{if(e.dryRun){c({command:`cf zones environments rollback`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments/${e[`environment-id`]==null?`<environment-id>`:encodeURIComponent(String(e[`environment-id`]))}/rollback`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"environment-id":String(e[`environment-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Creating`,async()=>t.zones.environments.rollback({zone_id:r,environment_id:e[`environment-id`]})),{successLabel:`Created`})}};function P(e){return e.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 F={command:`update`,describe:`Replaces the full environment configuration for a zone.`,builder:P,handler:async e=>{if(e.dryRun){c({command:`cf zones environments update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.environments.update({body:n,zone_id:r})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},I={command:`environments`,describe:`Operations for environments`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.option(`value`,{type:`string`,description:`Whether the feature is enabled or disabled.`,choices:[`on`,`off`]}).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 R={command:`edit`,describe:`Enhance your website's font delivery with Cloudflare Fonts. Deliver Google Hosted fonts from your own domain, boost performance, and enhance user privacy. Refer to the Cloudflare Fonts documentation for more information.`,builder:L,handler:async e=>{if(e.dryRun){c({command:`cf zones fonts edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/fonts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let r=await i(e),d=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=d,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.zones.fonts.edit({...t,zone_id:d})),{successLabel:`Updated`});return}e.value===void 0&&(e.value=await t(`value`,`Whether the feature is enabled or disabled.`,[`on`,`off`]));let f=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>r.zones.fonts.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function z(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get`,describe:`Enhance your website's font delivery with Cloudflare Fonts. Deliver Google Hosted fonts from your own domain, boost performance, and enhance user privacy. Refer to the Cloudflare Fonts documentation for more information.`,builder:z,handler:async e=>{if(e.dryRun){c({command:`cf zones fonts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/fonts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.fonts.get({zone_id:r})),{successLabel:`Loaded`})}},V={command:`fonts`,describe:`Fonts operations`,builder:e=>e.command(R).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`get`,describe:`Retrieves detailed information about a specific zone identified by its zone ID. Returns zone configuration, status, nameservers, and associated metadata.`,builder:H,handler:async e=>{if(e.dryRun){c({command:`cf zones get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.get({zone_id:r})),{successLabel:`Loaded`})}};function W(e){return e.option(`include-subdomains`,{type:`boolean`,description:`If provided, the zone hold will extend to block any subdomain of the given zone, as well
|
|
15
15
|
as SSL4SaaS Custom Hostnames. For example, a zone hold on a zone with the hostname
|
|
16
16
|
'example.com' and include_subdomains=true will block 'example.com',
|
|
17
17
|
'staging.example.com', 'api.staging.example.com', etc.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`create`,describe:`Enforce a zone hold on the zone, blocking the creation and activation of zones with this zone's hostname. Zone holds cannot be enabled on CDN-only zones.`,builder:W,handler:async e=>{let t={include_subdomains:e[`include-subdomains`]};if(e.dryRun){c({command:`cf zones holds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hold`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await i(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Creating`,async()=>r.zones.holds.create({zone_id:a,...t})),{successLabel:`Created`})}};function K(e){return e.option(`hold-after`,{type:`string`,description:"If `hold_after` is provided, the hold will be temporarily disabled,\nthen automatically re-enabled by the system at the time specified\nin this RFC3339-formatted timestamp. Otherwise, the hold will be\ndisabled indefinitely. `hold_after` cannot be provided for CDN-only zones."}).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`,describe:"Stop enforcement of a zone hold on the zone, permanently or temporarily, allowing the creation and activation of zones with this zone's hostname. Existing zone holds can be removed from CDN-only zones when `hold_after` is not provided. Active holds are automatically disabled when a zone transitions to CDN-only mode.",builder:K,handler:async e=>{let t={hold_after:e[`hold-after`]};if(e.dryRun){c({command:`cf zones holds delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hold`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let a=await i(e),o=await n({zone:e.zone},a,{quiet:e.quiet});if(e.zoneId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
18
18
|
`);return}s(await l(`Deleting`,async()=>a.zones.holds.delete({zone_id:o,...t})),{successLabel:`Deleted`})}};function J(e){return e.option(`hold-after`,{type:`string`,description:"If `hold_after` is provided and future-dated, the hold will be temporarily disabled,\nthen automatically re-enabled by the system at the time specified\nin this RFC3339-formatted timestamp. A past-dated `hold_after` value will have\nno effect on an existing, enabled hold. Providing an empty string will set its value\nto the current time. Providing `null` will disable the hold indefinitely."}).option(`include-subdomains`,{type:`boolean`,description:`If \`true\`, the zone hold will extend to block any subdomain of the given zone, as well
|
|
19
19
|
as SSL4SaaS Custom Hostnames. For example, a zone hold on a zone with the hostname
|
|
20
20
|
'example.com' and include_subdomains=true will block 'example.com',
|
|
21
|
-
'staging.example.com', 'api.staging.example.com', etc.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Y={command:`edit`,describe:"Update the `hold_after` and/or `include_subdomains` values on an existing zone hold. The hold is enabled if the `hold_after` date-time value is in the past. Existing zone holds can be removed from CDN-only zones by setting `hold_after` to `null`. Other zone hold updates cannot be made on CDN-only zones. Active holds are automatically disabled when a zone transitions to CDN-only mode.",builder:J,handler:async e=>{if(e.dryRun){c({command:`cf zones holds edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hold`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({hold_after:u(e[`hold-after`],`hold-after`,`text`),include_subdomains:e[`include-subdomains`]}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.holds.edit({...n,zone_id:r})),{successLabel:`Updated`});return}let d=o({hold_after:u(e[`hold-after`],`hold-after`,`text`),include_subdomains:e[`include-subdomains`]});s(await l(`Updating`,async()=>t.zones.holds.edit({...d,zone_id:r})),{successLabel:`Updated`})}};function X(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`get`,describe:`Retrieve whether the zone is subject to a zone hold, and metadata about the hold.`,builder:X,handler:async e=>{if(e.dryRun){c({command:`cf zones holds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hold`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.holds.get({zone_id:r})),{successLabel:`Loaded`})}},Q={command:`holds`,describe:`Operations for holds`,builder:e=>e.command(G).command(q).command(Y).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.option(`name`,{type:`string`,description:"A domain name. Optional filter operators can be provided to extend refine the search:\n * `equal` (default)\n * `not_equal`\n * `starts_with`\n * `ends_with`\n * `contains`\n * `starts_with_case_sensitive`\n * `ends_with_case_sensitive`\n * `contains_case_sensitive`"}).option(`status`,{type:`string`,description:`Specify a zone status to filter by.`,choices:[`initializing`,`pending`,`active`,`moved`]}).option(`type`,{type:`string`,description:`Zone types to filter by. Multiple types can be specified as a comma-separated list (e.g., ?type=full,partial,secondary). When this parameter is not provided, zones with type "internal" are excluded from the results.`}).option(`account-id`,{type:`string`,description:`Filter by an account ID.`}).option(`account-name`,{type:`string`,description:"An account Name. Optional filter operators can be provided to extend refine the search:\n * `equal` (default)\n * `not_equal`\n * `starts_with`\n * `ends_with`\n * `contains`\n * `starts_with_case_sensitive`\n * `ends_with_case_sensitive`\n * `contains_case_sensitive`"}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of zones per page.`}).option(`order`,{type:`string`,description:`Field to order zones by.`,choices:[`name`,`status`,`account.id`,`account.name`,`plan.id`]}).option(`direction`,{type:`string`,description:`Direction to order zones.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:`Whether to match all search requirements or at least one (any).`,choices:[`any`,`all`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list`,describe:`Lists, searches, sorts, and filters your zones. Listing zones across more than 500 accounts is currently not allowed.`,builder:d(ne),handler:async e=>{let t={name:e.name,status:e.status,type:e.type,"account.id":e[`account-id`],"account.name":e[`account-name`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match};if(e.dryRun){c({command:`cf zones list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones`,pathParams:{},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.zones.list(t)),{successLabel:`Loaded`})}};function ie(e){return e.option(`value`,{type:`number`,description:`Value of the Origin H2 Max Streams Setting.`}).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 ae={command:`edit`,describe:"Origin H2 Max Streams configures the max number of concurrent requests that Cloudflare will send within the same connection when communicating with the origin server, if the origin supports it. Note that if your origin does not support H2 multiplexing, 5xx errors may be observed, particularly 520s. Also note that the default value is `100` for all plan types except Enterprise where it is `1`. `1` means that H2 multiplexing is disabled.",builder:ie,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-h2-max-streams edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_h2_max_streams`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:e.value}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.originH2MaxStreams.edit({...n,zone_id:r})),{successLabel:`Updated`});return}if(e.value===void 0)throw Error(`--value is required (or pass --body with this field set).`);let u=o({value:e.value});s(await l(`Updating`,async()=>t.zones.originH2MaxStreams.edit({...u,zone_id:r})),{successLabel:`Updated`})}};function oe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`get`,describe:"Origin H2 Max Streams configures the max number of concurrent requests that Cloudflare will send within the same connection when communicating with the origin server, if the origin supports it. Note that if your origin does not support H2 multiplexing, 5xx errors may be observed, particularly 520s. Also note that the default value is `100` for all plan types except Enterprise where it is `1`. `1` means that H2 multiplexing is disabled.",builder:oe,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-h2-max-streams get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_h2_max_streams`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.originH2MaxStreams.get({zone_id:r})),{successLabel:`Loaded`})}},ce={command:`origin-h2-max-streams`,describe:`Origin H2 Max Streams operations`,builder:e=>e.command(ae).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(e){return e.option(`value`,{type:`string`,description:`Value of the Origin Max HTTP Version Setting.`,choices:[`2`,`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 ue={command:`edit`,describe:`Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 requests to your origin. (Refer to [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), for more information.). The default value is "2" for all plan types except Enterprise where it is "1".`,builder:le,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-max-http-version edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_max_http_version`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let r=await i(e),d=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=d,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.zones.originMaxHttpVersion.edit({...t,zone_id:d})),{successLabel:`Updated`});return}e.value===void 0&&(e.value=await t(`value`,`Value of the Origin Max HTTP Version Setting.`,[`2`,`1`]));let f=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>r.zones.originMaxHttpVersion.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function de(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get`,describe:`Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 requests to your origin. (Refer to [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), for more information.). The default value is "2" for all plan types except Enterprise where it is "1".`,builder:de,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-max-http-version get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_max_http_version`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.originMaxHttpVersion.get({zone_id:r})),{successLabel:`Loaded`})}},pe={command:`origin-max-http-version`,describe:`Origin Max Http Version operations`,builder:e=>e.command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.positional(`plan-identifier`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`get <plan-identifier>`,describe:`Details of the available plan that the zone can subscribe to.`,builder:me,handler:async e=>{if(e.dryRun){c({command:`cf zones plans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/available_plans/${e[`plan-identifier`]==null?`<plan-identifier>`:encodeURIComponent(String(e[`plan-identifier`]))}`,pathParams:{"plan-identifier":String(e[`plan-identifier`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.plans.get({zone_id:r,plan_identifier:e[`plan-identifier`]})),{successLabel:`Loaded`})}};function ge(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _e={command:`list`,describe:`Lists available plans the zone can subscribe to.`,builder:ge,handler:async e=>{if(e.dryRun){c({command:`cf zones plans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/available_plans`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.plans.list({zone_id:r})),{successLabel:`Loaded`})}},ve={command:`plans`,describe:`Operations for plans`,builder:e=>e.command(he).command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ye(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`get`,describe:`Lists all rate plans the zone can subscribe to.`,builder:ye,handler:async e=>{if(e.dryRun){c({command:`cf zones rate-plans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/available_rate_plans`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.ratePlans.get({zone_id:r})),{successLabel:`Loaded`})}},xe={command:`rate-plans`,describe:`Operations for rate-plans`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.option(`value`,{type:`string`,description:`Value can either be On or Off.`}).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:`edit`,describe:`Toggles RUM on/off for an existing zone.`,builder:Se,handler:async e=>{if(e.dryRun){c({command:`cf zones rum edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/rum`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.rum.edit({...n,zone_id:r})),{successLabel:`Updated`});return}let d=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>t.zones.rum.edit({...d,zone_id:r})),{successLabel:`Updated`})}};function we(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`get`,describe:`Retrieves RUM status for a zone.`,builder:we,handler:async e=>{if(e.dryRun){c({command:`cf zones rum get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/rum`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.rum.get({zone_id:r})),{successLabel:`Loaded`})}},Ee={command:`rum`,describe:`Rum operations`,builder:e=>e.command(Ce).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(e){return e.positional(`setting-id`,{type:`string`,description:`Setting name`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`ssl-recommender enrollment setting.`}).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(`value-cache-by-device-type`,{type:`boolean`,description:`Indicates whether or not [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) is enabled.`}).option(`value-cf`,{type:`boolean`,description:`Indicates whether or not Cloudflare proxy is enabled.`}).option(`value-hostnames`,{type:`string`,array:!0,description:`An array of hostnames where Automatic Platform Optimization for WordPress is activated.`}).option(`value-wordpress`,{type:`boolean`,description:`Indicates whether or not site is powered by WordPress.`}).option(`value-wp-plugin`,{type:`boolean`,description:`Indicates whether or not [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is installed.`}).option(`value-strict-transport-security-enabled`,{type:`boolean`,description:`Whether or not strict transport security is enabled.`}).option(`value-strict-transport-security-include-subdomains`,{type:`boolean`,description:`Include all subdomains for strict transport security.`}).option(`value-strict-transport-security-max-age`,{type:`number`,description:`Max age in seconds of the strict transport security.`}).option(`value-strict-transport-security-nosniff`,{type:`boolean`,description:`Whether or not to include 'X-Content-Type-Options: nosniff' header.`}).option(`value-strict-transport-security-preload`,{type:`boolean`,description:`Enable automatic preload of the HSTS configuration.`}).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)`}).conflicts(`value-pool-id`,[`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).conflicts(`value-cache-by-device-type`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-cache-by-device-type`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wordpress`,`value-wp-plugin`,`value-hostnames`]).conflicts(`value-cf`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-cf`,[`value-strict-transport-security-enabled`,`value-wordpress`,`value-wp-plugin`,`value-hostnames`,`value-cache-by-device-type`]).conflicts(`value-hostnames`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-hostnames`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wordpress`,`value-wp-plugin`,`value-cache-by-device-type`]).conflicts(`value-wordpress`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-wordpress`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wp-plugin`,`value-hostnames`,`value-cache-by-device-type`]).conflicts(`value-wp-plugin`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-wp-plugin`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wordpress`,`value-hostnames`,`value-cache-by-device-type`]).implies(`value-strict-transport-security-enabled`,[`value-cf`,`value-wordpress`,`value-wp-plugin`,`value-hostnames`,`value-cache-by-device-type`]).conflicts(`value-strict-transport-security-include-subdomains`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`]).conflicts(`value-strict-transport-security-max-age`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`]).conflicts(`value-strict-transport-security-nosniff`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`]).conflicts(`value-strict-transport-security-preload`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`])}const Oe={command:`edit <setting-id>`,describe:`Updates a single zone setting by the identifier`,builder:De,handler:async e=>{if(e.dryRun){c({command:`cf zones settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({enabled:e.enabled,value:{enabled:e[`value-enabled`],pool_id:u(e[`value-pool-id`],`value-pool-id`,`text`),cache_by_device_type:e[`value-cache-by-device-type`],cf:e[`value-cf`],hostnames:e[`value-hostnames`],wordpress:e[`value-wordpress`],wp_plugin:e[`value-wp-plugin`],strict_transport_security:{enabled:e[`value-strict-transport-security-enabled`],include_subdomains:e[`value-strict-transport-security-include-subdomains`],max_age:e[`value-strict-transport-security-max-age`],nosniff:e[`value-strict-transport-security-nosniff`],preload:e[`value-strict-transport-security-preload`]}}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.settings.edit({body:n,zone_id:r,setting_id:e[`setting-id`]})),{successLabel:`Updated`});return}let d=o({enabled:e.enabled,value:{enabled:e[`value-enabled`],pool_id:u(e[`value-pool-id`],`value-pool-id`,`text`),cache_by_device_type:e[`value-cache-by-device-type`],cf:e[`value-cf`],hostnames:e[`value-hostnames`],wordpress:e[`value-wordpress`],wp_plugin:e[`value-wp-plugin`],strict_transport_security:{enabled:e[`value-strict-transport-security-enabled`],include_subdomains:e[`value-strict-transport-security-include-subdomains`],max_age:e[`value-strict-transport-security-max-age`],nosniff:e[`value-strict-transport-security-nosniff`],preload:e[`value-strict-transport-security-preload`]}}});s(await l(`Updating`,async()=>t.zones.settings.edit({body:d,zone_id:r,setting_id:e[`setting-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`setting-id`,{type:`string`,description:`Setting name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <setting-id>`,describe:`Fetch a single zone setting by name`,builder:ke,handler:async e=>{if(e.dryRun){c({command:`cf zones settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.settings.get({zone_id:r,setting_id:e[`setting-id`]})),{successLabel:`Loaded`})}},je={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(Oe).command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.option(`value`,{type:`string`,description:`Whether the feature is enabled or disabled.`,choices:[`on`,`off`]}).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:`edit`,describe:`Speed Brain lets compatible browsers speculate on content which can be prefetched or preloaded, making website navigation faster. Refer to the Cloudflare Speed Brain documentation for more information.`,builder:Me,handler:async e=>{if(e.dryRun){c({command:`cf zones speed-brain edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/speed_brain`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let r=await i(e),d=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=d,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.zones.speedBrain.edit({...t,zone_id:d})),{successLabel:`Updated`});return}e.value===void 0&&(e.value=await t(`value`,`Whether the feature is enabled or disabled.`,[`on`,`off`]));let f=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>r.zones.speedBrain.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function Pe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get`,describe:`Speed Brain lets compatible browsers speculate on content which can be prefetched or preloaded, making website navigation faster. Refer to the Cloudflare Speed Brain documentation for more information.`,builder:Pe,handler:async e=>{if(e.dryRun){c({command:`cf zones speed-brain get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/speed_brain`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.speedBrain.get({zone_id:r})),{successLabel:`Loaded`})}},Fe={command:`speed-brain`,describe:`Speed Brain operations`,builder:e=>e.command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(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 Le={command:`create`,describe:`Create a zone subscription, either plan or add-ons.`,builder:Ie,handler:async e=>{if(e.dryRun){c({command:`cf zones subscriptions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/subscription`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Creating`,async()=>t.zones.subscriptions.create({body:n,zone_id:r})),{successLabel:`Created`});return}let d=o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}});s(await l(`Creating`,async()=>t.zones.subscriptions.create({body:d,zone_id:r})),{successLabel:`Created`})}};function Re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get`,describe:`Lists zone subscription details.`,builder:Re,handler:async e=>{if(e.dryRun){c({command:`cf zones subscriptions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/subscription`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.subscriptions.get({zone_id:r})),{successLabel:`Loaded`})}};function Be(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 Ve={command:`update`,describe:`Updates zone subscriptions, either plan or add-ons.`,builder:Be,handler:async e=>{if(e.dryRun){c({command:`cf zones subscriptions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/subscription`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.subscriptions.update({body:n,zone_id:r})),{successLabel:`Updated`});return}let d=o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}});s(await l(`Updating`,async()=>t.zones.subscriptions.update({body:d,zone_id:r})),{successLabel:`Updated`})}},He={command:`subscriptions`,describe:`Operations for subscriptions`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`zones`,describe:`Zones are domains on Cloudflare — list, create, and configure domain settings`,builder:e=>e.command(y).command(x).command(C).command(U).command(re).command(te).command(_).command(I).command(V).command(Q).command(ce).command(pe).command(ve).command(xe).command(Ee).command(je).command(Fe).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ue as default};
|
|
21
|
+
'staging.example.com', 'api.staging.example.com', etc.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Y={command:`edit`,describe:"Update the `hold_after` and/or `include_subdomains` values on an existing zone hold. The hold is enabled if the `hold_after` date-time value is in the past. Existing zone holds can be removed from CDN-only zones by setting `hold_after` to `null`. Other zone hold updates cannot be made on CDN-only zones. Active holds are automatically disabled when a zone transitions to CDN-only mode.",builder:J,handler:async e=>{if(e.dryRun){c({command:`cf zones holds edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hold`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({hold_after:u(e[`hold-after`],`hold-after`,`text`),include_subdomains:e[`include-subdomains`]}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.holds.edit({...n,zone_id:r})),{successLabel:`Updated`});return}let d=o({hold_after:u(e[`hold-after`],`hold-after`,`text`),include_subdomains:e[`include-subdomains`]});s(await l(`Updating`,async()=>t.zones.holds.edit({...d,zone_id:r})),{successLabel:`Updated`})}};function X(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`get`,describe:`Retrieve whether the zone is subject to a zone hold, and metadata about the hold.`,builder:X,handler:async e=>{if(e.dryRun){c({command:`cf zones holds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hold`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.holds.get({zone_id:r})),{successLabel:`Loaded`})}},Q={command:`holds`,describe:`Operations for holds`,builder:e=>e.command(G).command(q).command(Y).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.option(`name`,{type:`string`,description:"A domain name. Optional filter operators can be provided to extend refine the search:\n * `equal` (default)\n * `not_equal`\n * `starts_with`\n * `ends_with`\n * `contains`\n * `starts_with_case_sensitive`\n * `ends_with_case_sensitive`\n * `contains_case_sensitive`"}).option(`status`,{type:`string`,description:`Specify a zone status to filter by.`,choices:[`initializing`,`pending`,`active`,`moved`]}).option(`type`,{type:`string`,description:`Zone types to filter by. Multiple types can be specified as a comma-separated list (e.g., ?type=full,partial,secondary). When this parameter is not provided, zones with type "internal" are excluded from the results.`}).option(`account-id`,{type:`string`,description:`Filter by an account ID.`}).option(`account-name`,{type:`string`,description:"An account Name. Optional filter operators can be provided to extend refine the search:\n * `equal` (default)\n * `not_equal`\n * `starts_with`\n * `ends_with`\n * `contains`\n * `starts_with_case_sensitive`\n * `ends_with_case_sensitive`\n * `contains_case_sensitive`"}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of zones per page.`}).option(`order`,{type:`string`,description:`Field to order zones by.`,choices:[`name`,`status`,`account.id`,`account.name`,`plan.id`]}).option(`direction`,{type:`string`,description:`Direction to order zones.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:`Whether to match all search requirements or at least one (any).`,choices:[`any`,`all`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list`,describe:`Lists, searches, sorts, and filters your zones. Listing zones across more than 500 accounts is currently not allowed.`,builder:d(ne),handler:async e=>{let t={name:e.name,status:e.status,type:e.type,"account.id":e[`account-id`],"account.name":e[`account-name`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match};if(e.dryRun){c({command:`cf zones list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones`,pathParams:{},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.zones.list(t)),{successLabel:`Loaded`})}};function ie(e){return e.option(`value`,{type:`number`,description:`Value of the Origin H2 Max Streams Setting.`}).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 ae={command:`edit`,describe:"Origin H2 Max Streams configures the max number of concurrent requests that Cloudflare will send within the same connection when communicating with the origin server, if the origin supports it. Note that if your origin does not support H2 multiplexing, 5xx errors may be observed, particularly 520s. Also note that the default value is `100` for all plan types except Enterprise where it is `1`. `1` means that H2 multiplexing is disabled.",builder:ie,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-h2-max-streams edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_h2_max_streams`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:e.value}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.originH2MaxStreams.edit({...n,zone_id:r})),{successLabel:`Updated`});return}if(e.value===void 0)throw Error(`--value is required (or pass --body with this field set).`);let u=o({value:e.value});s(await l(`Updating`,async()=>t.zones.originH2MaxStreams.edit({...u,zone_id:r})),{successLabel:`Updated`})}};function oe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`get`,describe:"Origin H2 Max Streams configures the max number of concurrent requests that Cloudflare will send within the same connection when communicating with the origin server, if the origin supports it. Note that if your origin does not support H2 multiplexing, 5xx errors may be observed, particularly 520s. Also note that the default value is `100` for all plan types except Enterprise where it is `1`. `1` means that H2 multiplexing is disabled.",builder:oe,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-h2-max-streams get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_h2_max_streams`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.originH2MaxStreams.get({zone_id:r})),{successLabel:`Loaded`})}},ce={command:`origin-h2-max-streams`,describe:`Origin H2 Max Streams operations`,builder:e=>e.command(ae).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(e){return e.option(`value`,{type:`string`,description:`Value of the Origin Max HTTP Version Setting.`,choices:[`2`,`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 ue={command:`edit`,describe:`Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 requests to your origin. (Refer to [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), for more information.). The default value is "2" for all plan types except Enterprise where it is "1".`,builder:le,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-max-http-version edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_max_http_version`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let r=await i(e),d=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=d,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.zones.originMaxHttpVersion.edit({...t,zone_id:d})),{successLabel:`Updated`});return}e.value===void 0&&(e.value=await t(`value`,`Value of the Origin Max HTTP Version Setting.`,[`2`,`1`]));let f=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>r.zones.originMaxHttpVersion.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function de(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get`,describe:`Origin Max HTTP Setting Version sets the highest HTTP version Cloudflare will attempt to use with your origin. This setting allows Cloudflare to make HTTP/2 requests to your origin. (Refer to [Enable HTTP/2 to Origin](https://developers.cloudflare.com/cache/how-to/enable-http2-to-origin/), for more information.). The default value is "2" for all plan types except Enterprise where it is "1".`,builder:de,handler:async e=>{if(e.dryRun){c({command:`cf zones origin-max-http-version get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/origin_max_http_version`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.originMaxHttpVersion.get({zone_id:r})),{successLabel:`Loaded`})}},pe={command:`origin-max-http-version`,describe:`Origin Max Http Version operations`,builder:e=>e.command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.positional(`plan-identifier`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`get <plan-identifier>`,describe:`Details of the available plan that the zone can subscribe to.`,builder:me,handler:async e=>{if(e.dryRun){c({command:`cf zones plans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/available_plans/${e[`plan-identifier`]==null?`<plan-identifier>`:encodeURIComponent(String(e[`plan-identifier`]))}`,pathParams:{"plan-identifier":String(e[`plan-identifier`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.plans.get({zone_id:r,plan_identifier:e[`plan-identifier`]})),{successLabel:`Loaded`})}};function ge(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _e={command:`list`,describe:`Lists available plans the zone can subscribe to.`,builder:ge,handler:async e=>{if(e.dryRun){c({command:`cf zones plans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/available_plans`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.plans.list({zone_id:r})),{successLabel:`Loaded`})}},ve={command:`plans`,describe:`Operations for plans`,builder:e=>e.command(he).command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ye(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`get`,describe:`Lists all rate plans the zone can subscribe to.`,builder:ye,handler:async e=>{if(e.dryRun){c({command:`cf zones rate-plans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/available_rate_plans`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.ratePlans.get({zone_id:r})),{successLabel:`Loaded`})}},xe={command:`rate-plans`,describe:`Operations for rate-plans`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.option(`value`,{type:`string`,description:`Value can either be On or Off.`}).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:`edit`,describe:`Toggles RUM on/off for an existing zone.`,builder:Se,handler:async e=>{if(e.dryRun){c({command:`cf zones rum edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/rum`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.rum.edit({...n,zone_id:r})),{successLabel:`Updated`});return}let d=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>t.zones.rum.edit({...d,zone_id:r})),{successLabel:`Updated`})}};function we(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`get`,describe:`Retrieves RUM status for a zone.`,builder:we,handler:async e=>{if(e.dryRun){c({command:`cf zones rum get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/rum`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.rum.get({zone_id:r})),{successLabel:`Loaded`})}},Ee={command:`rum`,describe:`Operations for rum`,builder:e=>e.command(Ce).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(e){return e.positional(`setting-id`,{type:`string`,description:`Setting name`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`ssl-recommender enrollment setting.`}).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(`value-cache-by-device-type`,{type:`boolean`,description:`Indicates whether or not [cache by device type](https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/) is enabled.`}).option(`value-cf`,{type:`boolean`,description:`Indicates whether or not Cloudflare proxy is enabled.`}).option(`value-hostnames`,{type:`string`,array:!0,description:`An array of hostnames where Automatic Platform Optimization for WordPress is activated.`}).option(`value-wordpress`,{type:`boolean`,description:`Indicates whether or not site is powered by WordPress.`}).option(`value-wp-plugin`,{type:`boolean`,description:`Indicates whether or not [Cloudflare for WordPress plugin](https://wordpress.org/plugins/cloudflare/) is installed.`}).option(`value-strict-transport-security-enabled`,{type:`boolean`,description:`Whether or not strict transport security is enabled.`}).option(`value-strict-transport-security-include-subdomains`,{type:`boolean`,description:`Include all subdomains for strict transport security.`}).option(`value-strict-transport-security-max-age`,{type:`number`,description:`Max age in seconds of the strict transport security.`}).option(`value-strict-transport-security-nosniff`,{type:`boolean`,description:`Whether or not to include 'X-Content-Type-Options: nosniff' header.`}).option(`value-strict-transport-security-preload`,{type:`boolean`,description:`Enable automatic preload of the HSTS configuration.`}).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)`}).conflicts(`value-pool-id`,[`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).conflicts(`value-cache-by-device-type`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-cache-by-device-type`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wordpress`,`value-wp-plugin`,`value-hostnames`]).conflicts(`value-cf`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-cf`,[`value-strict-transport-security-enabled`,`value-wordpress`,`value-wp-plugin`,`value-hostnames`,`value-cache-by-device-type`]).conflicts(`value-hostnames`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-hostnames`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wordpress`,`value-wp-plugin`,`value-cache-by-device-type`]).conflicts(`value-wordpress`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-wordpress`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wp-plugin`,`value-hostnames`,`value-cache-by-device-type`]).conflicts(`value-wp-plugin`,[`value-pool-id`,`value-strict-transport-security-include-subdomains`,`value-strict-transport-security-max-age`,`value-strict-transport-security-nosniff`,`value-strict-transport-security-preload`]).implies(`value-wp-plugin`,[`value-strict-transport-security-enabled`,`value-cf`,`value-wordpress`,`value-hostnames`,`value-cache-by-device-type`]).implies(`value-strict-transport-security-enabled`,[`value-cf`,`value-wordpress`,`value-wp-plugin`,`value-hostnames`,`value-cache-by-device-type`]).conflicts(`value-strict-transport-security-include-subdomains`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`]).conflicts(`value-strict-transport-security-max-age`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`]).conflicts(`value-strict-transport-security-nosniff`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`]).conflicts(`value-strict-transport-security-preload`,[`value-pool-id`,`value-cache-by-device-type`,`value-cf`,`value-hostnames`,`value-wordpress`,`value-wp-plugin`])}const Oe={command:`edit <setting-id>`,describe:`Updates a single zone setting by the identifier`,builder:De,handler:async e=>{if(e.dryRun){c({command:`cf zones settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({enabled:e.enabled,value:{enabled:e[`value-enabled`],pool_id:u(e[`value-pool-id`],`value-pool-id`,`text`),cache_by_device_type:e[`value-cache-by-device-type`],cf:e[`value-cf`],hostnames:e[`value-hostnames`],wordpress:e[`value-wordpress`],wp_plugin:e[`value-wp-plugin`],strict_transport_security:{enabled:e[`value-strict-transport-security-enabled`],include_subdomains:e[`value-strict-transport-security-include-subdomains`],max_age:e[`value-strict-transport-security-max-age`],nosniff:e[`value-strict-transport-security-nosniff`],preload:e[`value-strict-transport-security-preload`]}}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.settings.edit({body:n,zone_id:r,setting_id:e[`setting-id`]})),{successLabel:`Updated`});return}let d=o({enabled:e.enabled,value:{enabled:e[`value-enabled`],pool_id:u(e[`value-pool-id`],`value-pool-id`,`text`),cache_by_device_type:e[`value-cache-by-device-type`],cf:e[`value-cf`],hostnames:e[`value-hostnames`],wordpress:e[`value-wordpress`],wp_plugin:e[`value-wp-plugin`],strict_transport_security:{enabled:e[`value-strict-transport-security-enabled`],include_subdomains:e[`value-strict-transport-security-include-subdomains`],max_age:e[`value-strict-transport-security-max-age`],nosniff:e[`value-strict-transport-security-nosniff`],preload:e[`value-strict-transport-security-preload`]}}});s(await l(`Updating`,async()=>t.zones.settings.edit({body:d,zone_id:r,setting_id:e[`setting-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`setting-id`,{type:`string`,description:`Setting name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <setting-id>`,describe:`Fetch a single zone setting by name`,builder:ke,handler:async e=>{if(e.dryRun){c({command:`cf zones settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.settings.get({zone_id:r,setting_id:e[`setting-id`]})),{successLabel:`Loaded`})}},je={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(Oe).command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.option(`value`,{type:`string`,description:`Whether the feature is enabled or disabled.`,choices:[`on`,`off`]}).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:`edit`,describe:`Speed Brain lets compatible browsers speculate on content which can be prefetched or preloaded, making website navigation faster. Refer to the Cloudflare Speed Brain documentation for more information.`,builder:Me,handler:async e=>{if(e.dryRun){c({command:`cf zones speed-brain edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/speed_brain`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:u(e.value,`value`,`text`)}):a(e.body)});return}let r=await i(e),d=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=d,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.zones.speedBrain.edit({...t,zone_id:d})),{successLabel:`Updated`});return}e.value===void 0&&(e.value=await t(`value`,`Whether the feature is enabled or disabled.`,[`on`,`off`]));let f=o({value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>r.zones.speedBrain.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function Pe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get`,describe:`Speed Brain lets compatible browsers speculate on content which can be prefetched or preloaded, making website navigation faster. Refer to the Cloudflare Speed Brain documentation for more information.`,builder:Pe,handler:async e=>{if(e.dryRun){c({command:`cf zones speed-brain get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/speed_brain`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.speedBrain.get({zone_id:r})),{successLabel:`Loaded`})}},Fe={command:`speed-brain`,describe:`Speed Brain operations`,builder:e=>e.command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(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 Le={command:`create`,describe:`Create a zone subscription, either plan or add-ons.`,builder:Ie,handler:async e=>{if(e.dryRun){c({command:`cf zones subscriptions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/subscription`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Creating`,async()=>t.zones.subscriptions.create({body:n,zone_id:r})),{successLabel:`Created`});return}let d=o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}});s(await l(`Creating`,async()=>t.zones.subscriptions.create({body:d,zone_id:r})),{successLabel:`Created`})}};function Re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get`,describe:`Lists zone subscription details.`,builder:Re,handler:async e=>{if(e.dryRun){c({command:`cf zones subscriptions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/subscription`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.zones.subscriptions.get({zone_id:r})),{successLabel:`Loaded`})}};function Be(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 Ve={command:`update`,describe:`Updates zone subscriptions, either plan or add-ons.`,builder:Be,handler:async e=>{if(e.dryRun){c({command:`cf zones subscriptions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/subscription`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.zones.subscriptions.update({body:n,zone_id:r})),{successLabel:`Updated`});return}let d=o({app:{install_id:u(e[`app-install-id`],`app-install-id`,`text`)},frequency:u(e.frequency,`frequency`,`text`),rate_plan:{currency:u(e[`rate-plan-currency`],`rate-plan-currency`,`text`),externally_managed:e[`rate-plan-externally-managed`],id:u(e[`rate-plan-id`],`rate-plan-id`,`text`),is_contract:e[`rate-plan-is-contract`],public_name:u(e[`rate-plan-public-name`],`rate-plan-public-name`,`text`),scope:u(e[`rate-plan-scope`],`rate-plan-scope`,`text`),sets:e[`rate-plan-sets`]}});s(await l(`Updating`,async()=>t.zones.subscriptions.update({body:d,zone_id:r})),{successLabel:`Updated`})}},He={command:`subscriptions`,describe:`Operations for subscriptions`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`zones`,describe:`Zones are domains on Cloudflare — list, create, and configure domain settings`,builder:e=>e.command(y).command(x).command(C).command(U).command(re).command(te).command(_).command(I).command(V).command(Q).command(ce).command(pe).command(ve).command(xe).command(Ee).command(je).command(Fe).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ue as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The Cloudflare CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@clack/core": "1.2.0",
|
|
44
44
|
"@clack/prompts": "^1.2.0",
|
|
45
45
|
"@cloudflare/cli-shared-helpers": "^0.1.0",
|
|
46
|
-
"@cloudflare/deploy-helpers": "
|
|
46
|
+
"@cloudflare/deploy-helpers": "file:../../vendor/cloudflare-deploy-helpers-0.4.0.tgz",
|
|
47
47
|
"@cloudflare/forge": "file:../../vendor/cloudflare-forge-0.1.0.tgz",
|
|
48
48
|
"@cloudflare/forge-transformer-sdk-ts": "file:../../vendor/cloudflare-forge-transformer-sdk-ts-0.1.0.tgz",
|
|
49
|
-
"@cloudflare/workers-auth": "
|
|
50
|
-
"@cloudflare/workers-utils": "
|
|
49
|
+
"@cloudflare/workers-auth": "file:../../vendor/cloudflare-workers-auth-0.4.2.tgz",
|
|
50
|
+
"@cloudflare/workers-utils": "file:../../vendor/cloudflare-workers-utils-0.26.0.tgz",
|
|
51
51
|
"@types/node": "25.3.5",
|
|
52
52
|
"@types/yargs": "17.0.35",
|
|
53
53
|
"am-i-vibing": "^0.1.1",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f,t as p}from"./input-validation-zEO81MWN.mjs";import{t as m}from"./local-VJaJ3BZ1.mjs";import{t as h}from"./cli-types-CRIDdDw3.mjs";import{n as ee,t as te}from"./raw-fetch-Dlccg0Tr.mjs";function g(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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-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-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(`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 t=>{if(t.dryRun){u({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/chat/completions`,pathParams:{id:String(t.id??``)},bodyKind:`json`,body:t.body===void 0?c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},stream:t.stream}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.aiSearch.chatCompletions({...e,account_id:r,id:t.id})),{successLabel:`Created`});return}let a=c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},stream:t.stream});l(await d(`Creating`,async()=>n.aiSearch.chatCompletions({...a,account_id:r,id:t.id})),{successLabel:`Created`})}};function v(e){return e.option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`The ai_search_model field`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).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`,choices:[`@cf/qwen/qwen3-embedding-0.6b`,`@cf/qwen/qwen3-vl-embedding-2b`,`@cf/baai/bge-m3`,`@cf/baai/bge-large-en-v1.5`,`@cf/google/embeddinggemma-300m`,`google-ai-studio/gemini-embedding-001`,`google-ai-studio/gemini-embedding-2-preview`,`google-ai-studio/gemini-embedding-2`,`openai/text-embedding-3-small`,`openai/text-embedding-3-large`]}).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(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`}).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-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`,choices:[`@cf/baai/bge-reranker-base`]}).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`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).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)`}).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)`}).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`,default:`default`}).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:`The source_params.web_crawler.parse_type field`,choices:[`sitemap`,`crawl`],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`,describe:`Create a new AI Search instance with the given configuration.`,builder:v,handler:async n=>{if(n.dryRun){u({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({ai_gateway_id:f(n[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(n[`ai-search-model`],`ai-search-model`,`text`),cache:n.cache,cache_threshold:f(n[`cache-threshold`],`cache-threshold`,`text`),chunk:n.chunk,chunk_overlap:n[`chunk-overlap`],chunk_size:n[`chunk-size`],embedding_model:f(n[`embedding-model`],`embedding-model`,`text`),fusion_method:f(n[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:n[`hybrid-search-enabled`],id:f(n.id,`id`,`text`),index_method:{keyword:n[`index-method-keyword`],vector:n[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(n[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:n[`max-num-results`],metadata:{created_from_aisearch_wizard:n[`metadata-created-from-aisearch-wizard`],worker_domain:f(n[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],enabled:n[`public-endpoint-params-enabled`],mcp:{description:f(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:f(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},reranking:n.reranking,reranking_model:f(n[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(n[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(n[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:n[`rewrite-query`],score_threshold:n[`score-threshold`],source:f(n.source,`source`,`text`),source_params:{exclude_items:n[`source-params-exclude-items`],include_items:n[`source-params-include-items`],prefix:f(n[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(n[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{parse_options:{include_images:n[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:n[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:n[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(n[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:f(n[`token-id`],`token-id`,`text`),type:f(n.type,`type`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>r.aiSearch.create({...e,account_id:a})),{successLabel:`Created`});return}n.id===void 0&&(n.id=await t(`id`,`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`));let p=c({ai_gateway_id:f(n[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(n[`ai-search-model`],`ai-search-model`,`text`),cache:n.cache,cache_threshold:f(n[`cache-threshold`],`cache-threshold`,`text`),chunk:n.chunk,chunk_overlap:n[`chunk-overlap`],chunk_size:n[`chunk-size`],embedding_model:f(n[`embedding-model`],`embedding-model`,`text`),fusion_method:f(n[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:n[`hybrid-search-enabled`],id:f(n.id,`id`,`text`),index_method:{keyword:n[`index-method-keyword`],vector:n[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(n[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:n[`max-num-results`],metadata:{created_from_aisearch_wizard:n[`metadata-created-from-aisearch-wizard`],worker_domain:f(n[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],enabled:n[`public-endpoint-params-enabled`],mcp:{description:f(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:f(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},reranking:n.reranking,reranking_model:f(n[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(n[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(n[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:n[`rewrite-query`],score_threshold:n[`score-threshold`],source:f(n.source,`source`,`text`),source_params:{exclude_items:n[`source-params-exclude-items`],include_items:n[`source-params-include-items`],prefix:f(n[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(n[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{parse_options:{include_images:n[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:n[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:n[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(n[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:f(n[`token-id`],`token-id`,`text`),type:f(n.type,`type`,`text`)});l(await d(`Creating`,async()=>r.aiSearch.create({...p,account_id:a})),{successLabel:`Created`})}};function b(e){return e.positional(`id`,{type:`string`,description:`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 x={command:`delete <id>`,describe:`Permanently delete an AI Search instance and all its indexed data.`,builder:b,handler:async t=>{if(t.dryRun){u({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force,message:`This will permanently delete the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await d(`Deleting`,async()=>n.aiSearch.delete({account_id:a,id:t.id})),{successLabel:`Deleted`})}};function S(e){return e.positional(`id`,{type:`string`,description:`ID`,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 t=>{if(t.dryRun){u({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.aiSearch.get({account_id:r,id:t.id})),{successLabel:`Loaded`})}};function w(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 T={command:`cancel <job-id>`,describe:`Cancel an in-progress indexing job for an AI Search instance.`,builder:w,handler:async t=>{if(t.dryRun){u({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}`,pathParams:{id:String(t.id??``),"job-id":String(t[`job-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({action:f(t.action,`action`,`text`)}):s(t.body)});return}let a=await o(t),p=t.local?m:await i(a);if(t.accountId=p,!await r({force:!!t.force,message:`This will cancel the running indexing job.`})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(t.body){let e=s(t.body);l(await d(`Deleting`,async()=>a.aiSearch.jobs.cancel({...e,account_id:p,id:t.id,job_id:t[`job-id`]})),{successLabel:`Deleted`});return}t.action===void 0&&(t.action=await n(`action`,`The action field`,[`cancel`]));let h=c({action:f(t.action,`action`,`text`)});l(await d(`Deleting`,async()=>a.aiSearch.jobs.cancel({...h,account_id:p,id:t.id,job_id:t[`job-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 D={command:`create <id>`,describe:`Creates a new indexing job for an AI Search instance.`,builder:E,handler:async t=>{if(t.dryRun){u({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/jobs`,pathParams:{id:String(t.id??``)},bodyKind:`json`,body:t.body===void 0?c({description:f(t.description,`description`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.aiSearch.jobs.create({...e,account_id:r,id:t.id})),{successLabel:`Created`});return}let a=c({description:f(t.description,`description`,`text`)});l(await d(`Creating`,async()=>n.aiSearch.jobs.create({...a,account_id:r,id:t.id})),{successLabel:`Created`})}};function O(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <job-id>`,describe:`Retrieves details for a specific AI Search indexing job.`,builder:O,handler:async t=>{if(t.dryRun){u({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}`,pathParams:{id:String(t.id??``),"job-id":String(t[`job-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.aiSearch.jobs.get({account_id:r,id:t.id,job_id:t[`job-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 j={command:`list`,describe:`Lists indexing jobs for an AI Search instance.`,builder:A,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){u({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/jobs`,pathParams:{id:String(t.id??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.jobs.list({account_id:a,id:t.id,...n})),{successLabel:`Loaded`})}};function M(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 N={command:`logs <job-id>`,describe:`Lists log entries for an AI Search indexing job.`,builder:M,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){u({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}/logs`,pathParams:{id:String(t.id??``),"job-id":String(t[`job-id`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.jobs.logs({account_id:a,id:t.id,job_id:t[`job-id`],...n})),{successLabel:`Loaded`})}},P={command:`jobs`,describe:`Operations for jobs`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(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 instances whose id contains this string (case-insensitive).`}).option(`namespace`,{type:`string`,description:`Filter by namespace.`}).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 I={command:`list`,describe:`List all AI Search instances in the account.`,builder:h(F),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search,namespace:t.namespace,order_by:t[`order-by`],order_by_direction:t[`order-by-direction`]};if(t.dryRun){u({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.list({account_id:a,...n})),{successLabel:`Loaded`})}};function L(e){return e.option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).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 R={command:`create`,describe:`Create a new namespace.`,builder:L,handler:async n=>{if(n.dryRun){u({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>r.aiSearch.namespace.create({...e,account_id:a})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`The name field`));let p=c({description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>r.aiSearch.namespace.create({...p,account_id:a})),{successLabel:`Created`})}};function z(e){return e.positional(`name`,{type:`string`,description:`Name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const B={command:`delete <name>`,describe:`Permanently delete a namespace. The namespace must be empty (no instances).`,builder:z,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}`,pathParams:{name:String(t.name??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force,message:`This will permanently delete the namespace.`})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}l(await d(`Deleting`,async()=>n.aiSearch.namespace.delete({account_id:a,name:t.name})),{successLabel:`Deleted`})}};function V(e){return e.positional(`name`,{type:`string`,description:`Name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <name>`,describe:`Read namespace.`,builder:V,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}`,pathParams:{name:String(t.name??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.aiSearch.namespace.get({account_id:r,name:t.name})),{successLabel:`Loaded`})}};function U(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 W={command:`list`,describe:`List namespaces.`,builder:U,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search};if(t.dryRun){u({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.namespace.list({account_id:a,...n})),{successLabel:`Loaded`})}};function G(e){return e.positional(`name`,{type:`string`,description:`Name`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).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:`update <name>`,describe:`Update namespace.`,builder:G,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}`,pathParams:{name:String(t.name??``)},bodyKind:`json`,body:t.body===void 0?c({description:f(t.description,`description`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.aiSearch.namespace.update({...e,account_id:r,name:t.name})),{successLabel:`Updated`});return}let a=c({description:f(t.description,`description`,`text`)});l(await d(`Updating`,async()=>n.aiSearch.namespace.update({...a,account_id:r,name:t.name})),{successLabel:`Updated`})}},q={command:`namespace`,describe:`Operations for namespace`,builder:e=>e.command(R).command(B).command(H).command(W).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,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-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-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(`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 Y={command:`completions <id>`,describe:`Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`,builder:J,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces instances chat completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/chat/completions`,pathParams:{id:String(t.id??``),name:String(t.name??``)},bodyKind:`json`,body:t.body===void 0?c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},stream:t.stream}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.aiSearch.namespaces.instances.chat.completions({...e,account_id:r,name:t.name,id:t.id})),{successLabel:`Created`});return}let a=c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},stream:t.stream});l(await d(`Creating`,async()=>n.aiSearch.namespaces.instances.chat.completions({...a,account_id:r,name:t.name,id:t.id})),{successLabel:`Created`})}},X={command:`chat`,describe:`Namespaces for organizing and managing AI Search instances, items, and jobs`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.option(`name`,{type:`string`,description:`Namespace name`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,demandOption:!0}).option(`item-id`,{type:`string`,description:`Item 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 Q={command:`list`,describe:`Lists chunks for a specific item in an AI Search instance, including their text content.`,builder:Z,handler:async t=>{let n={limit:t.limit,offset:t.offset};if(t.dryRun){u({command:`cf ai-search namespaces instances items chunks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/chunks`,pathParams:{id:String(t.id??``),"item-id":String(t[`item-id`]??``),name:String(t.name??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.namespaces.instances.items.chunks.list({account_id:a,name:t.name,id:t.id,item_id:t[`item-id`],...n})),{successLabel:`Loaded`})}},ne={command:`chunks`,describe:`Namespaces for organizing and managing AI Search instances, items, and jobs`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 ie={command:`get <item-id>`,describe:`Downloads the raw file content for a specific item from the managed AI Search instance storage.`,builder:re,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces instances items content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/download`,pathParams:{id:String(t.id??``),"item-id":String(t[`item-id`]??``),name:String(t.name??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r;let a=await d(`Loading`,async()=>te(`/accounts/${r}/ai-search/namespaces/${encodeURIComponent(String(t.name))}/instances/${encodeURIComponent(String(t.id))}/items/${encodeURIComponent(String(t[`item-id`]))}/download`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));ee(t.text===!0?a.toString(`utf-8`):a)}},ae={command:`content`,describe:`Namespaces for organizing and managing AI Search instances, items, and jobs`,builder:e=>e.command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,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 se={command:`update <id>`,describe:`Creates or updates an indexed item in an AI Search instance.`,builder:oe,handler:async r=>{if(r.dryRun){u({command:`cf ai-search namespaces instances items create or update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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?c({key:f(r.key,`key`,`text`),next_action:f(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]}):s(r.body)});return}let a=await o(r),p=r.local?m:await i(a);if(r.accountId=p,r.body){let e=s(r.body);l(await d(`Updating`,async()=>a.aiSearch.namespaces.instances.items.create.or.update({...e,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`});return}r.key===void 0&&(r.key=await t(`key`,`Item key / filename. Must not exceed 128 characters.`)),r[`next-action`]===void 0&&(r[`next-action`]=await n(`next-action`,`The next_action field`,[`INDEX`]));let h=c({key:f(r.key,`key`,`text`),next_action:f(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]});l(await d(`Updating`,async()=>a.aiSearch.namespaces.instances.items.create.or.update({...h,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`})}},ce={command:`or`,describe:`Namespaces for organizing and managing AI Search instances, items, and jobs`,builder:e=>e.command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},le={command:`create`,describe:`Operations for namespaces.instances.items.create`,builder:e=>e.command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ue(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 de={command:`delete <item-id>`,describe:`Deletes a file from a managed AI Search instance and triggers a reindex.`,builder:ue,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces instances items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{id:String(t.id??``),"item-id":String(t[`item-id`]??``),name:String(t.name??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}l(await d(`Deleting`,async()=>n.aiSearch.namespaces.instances.items.delete({account_id:a,name:t.name,id:t.id,item_id:t[`item-id`]})),{successLabel:`Deleted`})}};function fe(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pe={command:`get <item-id>`,describe:`Retrieves a specific indexed item from an AI Search instance.`,builder:fe,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces instances items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{id:String(t.id??``),"item-id":String(t[`item-id`]??``),name:String(t.name??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.aiSearch.namespaces.instances.items.get({account_id:r,name:t.name,id:t.id,item_id:t[`item-id`]})),{successLabel:`Loaded`})}};function me(e){return e.option(`name`,{type:`string`,description:`Namespace name`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 he={command:`list`,describe:`Lists indexed items in an AI Search instance.`,builder:h(me),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search,sort_by:t[`sort-by`],status:t.status,source:t.source,metadata_filter:t[`metadata-filter`],item_id:t[`item-id`],key:t.key};if(t.dryRun){u({command:`cf ai-search namespaces instances items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items`,pathParams:{id:String(t.id??``),name:String(t.name??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.namespaces.instances.items.list({account_id:a,name:t.name,id:t.id,...n})),{successLabel:`Loaded`})}};function ge(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 _e={command:`logs <item-id>`,describe:`Lists processing logs for a specific item in an AI Search instance.`,builder:ge,handler:async t=>{let n={limit:t.limit,cursor:t.cursor};if(t.dryRun){u({command:`cf ai-search namespaces instances items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/logs`,pathParams:{id:String(t.id??``),"item-id":String(t[`item-id`]??``),name:String(t.name??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.namespaces.instances.items.logs({account_id:a,name:t.name,id:t.id,item_id:t[`item-id`],...n})),{successLabel:`Loaded`})}};function ve(e){return e.positional(`item-id`,{type:`string`,description:`Item ID`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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 ye={command:`sync <item-id>`,describe:`Syncs an item to an AI Search instance index.`,builder:ve,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces instances items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{id:String(t.id??``),"item-id":String(t[`item-id`]??``),name:String(t.name??``)},bodyKind:`json`,body:t.body===void 0?c({next_action:f(t[`next-action`],`next-action`,`text`),wait_for_completion:t[`wait-for-completion`]}):s(t.body)});return}let r=await o(t),a=t.local?m:await i(r);if(t.accountId=a,t.body){let e=s(t.body);l(await d(`Updating`,async()=>r.aiSearch.namespaces.instances.items.sync({...e,account_id:a,name:t.name,id:t.id,item_id:t[`item-id`]})),{successLabel:`Updated`});return}t[`next-action`]===void 0&&(t[`next-action`]=await n(`next-action`,`The next_action field`,[`INDEX`]));let p=c({next_action:f(t[`next-action`],`next-action`,`text`),wait_for_completion:t[`wait-for-completion`]});l(await d(`Updating`,async()=>r.aiSearch.namespaces.instances.items.sync({...p,account_id:a,name:t.name,id:t.id,item_id:t[`item-id`]})),{successLabel:`Updated`})}};function be(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace name`,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 xe={command:`upload <id>`,describe:`Uploads a file to a managed AI Search instance via multipart/form-data.`,builder:be,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces instances items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/items`,pathParams:{id:String(t.id??``),name:String(t.name??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,metadata:t.metadata,"wait-for-completion":t[`wait-for-completion`]}});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.file!==void 0||t.body!==void 0||t.metadata!==void 0||t[`wait-for-completion`]!==void 0){let e=new FormData;if(t.file){let n=p(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);t.metadata!==void 0&&e.append(`metadata`,String(f(t.metadata,`metadata`,`text`)??``)),t[`wait-for-completion`]!==void 0&&e.append(`wait_for_completion`,String(t[`wait-for-completion`])),l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/ai-search/namespaces/${encodeURIComponent(String(t.name))}/instances/${encodeURIComponent(String(t.id))}/items`,{body:e})),{successLabel:`Created`});return}if(t.body){let e=f(t.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/ai-search/namespaces/${encodeURIComponent(String(t.name))}/instances/${encodeURIComponent(String(t.id))}/items`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},Se={command:`items`,describe:`Namespaces for organizing and managing AI Search instances, items, and jobs`,builder:e=>e.command(de).command(pe).command(he).command(_e).command(ye).command(xe).command(ne).command(ae).command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ce={command:`instances`,describe:`Operations for namespaces.instances`,builder:e=>e.command(X).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.positional(`id`,{type:`string`,description:`Instance id.`,demandOption:!0}).option(`name`,{type:`string`,description:`Current namespace of the instance.`,demandOption:!0}).option(`new-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 Te={command:`instance <id>`,describe:`Moves an instance from its current namespace to the specified target namespace. Use 'default' as new_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:we,handler:async n=>{if(n.dryRun){u({command:`cf ai-search namespaces move instance`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{name:String(n.name??``),id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?c({new_namespace:f(n[`new-namespace`],`new-namespace`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>r.aiSearch.namespaces.move.instance({...e,account_id:a,name:n.name,id:n.id})),{successLabel:`Updated`});return}n[`new-namespace`]===void 0&&(n[`new-namespace`]=await t(`new-namespace`,`Target namespace to move the instance into.`));let p=c({new_namespace:f(n[`new-namespace`],`new-namespace`,`text`)});l(await d(`Updating`,async()=>r.aiSearch.namespaces.move.instance({...p,account_id:a,name:n.name,id:n.id})),{successLabel:`Updated`})}},Ee={command:`move`,describe:`Operations for namespaces.move`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function De(e){return e.positional(`name`,{type:`string`,description:`Namespace name`,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-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-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(`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 Oe={command:`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:De,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces multi instance chat completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/chat/completions`,pathParams:{name:String(t.name??``)},bodyKind:`json`,body:t.body===void 0?c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},stream:t.stream}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.aiSearch.namespaces.multi.instance.chat.completions({...e,account_id:r,name:t.name})),{successLabel:`Created`});return}if(t[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let a=c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},stream:t.stream});l(await d(`Creating`,async()=>n.aiSearch.namespaces.multi.instance.chat.completions({...a,account_id:r,name:t.name})),{successLabel:`Created`})}},ke={command:`chat`,describe:`Namespaces for organizing and managing AI Search instances, items, and jobs`,builder:e=>e.command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ae(e){return e.positional(`name`,{type:`string`,description:`Namespace name`,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-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-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(`query`,{type:`string`,description:`A simple text query string. Alternative to 'messages' — provide either this or 'messages', not both.`}).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:`search <name>`,describe:`Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`,builder:Ae,handler:async t=>{if(t.dryRun){u({command:`cf ai-search namespaces multi instance search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/namespaces/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/search`,pathParams:{name:String(t.name??``)},bodyKind:`json`,body:t.body===void 0?c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},query:f(t.query,`query`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Loading`,async()=>n.aiSearch.namespaces.multi.instance.search({...e,account_id:r,name:t.name})),{successLabel:`Loaded`});return}if(t[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let a=c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},query:f(t.query,`query`,`text`)});l(await d(`Loading`,async()=>n.aiSearch.namespaces.multi.instance.search({...a,account_id:r,name:t.name})),{successLabel:`Loaded`})}},Me={command:`instance`,describe:`Namespaces for organizing and managing AI Search instances, items, and jobs`,builder:e=>e.command(je).command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ne={command:`multi`,describe:`Operations for namespaces.multi`,builder:e=>e.command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Pe={command:`namespaces`,describe:`Operations for namespaces`,builder:e=>e.command(Ce).command(Ee).command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,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-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-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(`query`,{type:`string`,description:`A simple text query string. Alternative to 'messages' — provide either this or 'messages', not both.`}).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:`search <id>`,describe:`Executes a semantic search query against an AI Search instance to find relevant indexed content.`,builder:Fe,handler:async t=>{if(t.dryRun){u({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/search`,pathParams:{id:String(t.id??``)},bodyKind:`json`,body:t.body===void 0?c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},query:f(t.query,`query`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Loading`,async()=>n.aiSearch.search({...e,account_id:r,id:t.id})),{successLabel:`Loaded`});return}let a=c({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},query:f(t.query,`query`,`text`)});l(await d(`Loading`,async()=>n.aiSearch.search({...a,account_id:r,id:t.id})),{successLabel:`Loaded`})}};function Le(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Re={command:`stats <id>`,describe:`Retrieve usage and indexing statistics for an AI Search instance.`,builder:Le,handler:async t=>{if(t.dryRun){u({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}/stats`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.aiSearch.stats({account_id:r,id:t.id})),{successLabel:`Loaded`})}};function ze(e){return e.option(`cf-api-id`,{type:`string`,description:`The cf_api_id field`}).option(`cf-api-key`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`,default:!0}).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 Be={command:`create`,describe:`Create a new token.`,builder:ze,handler:async n=>{if(n.dryRun){u({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({cf_api_id:f(n[`cf-api-id`],`cf-api-id`,`text`),cf_api_key:f(n[`cf-api-key`],`cf-api-key`,`text`),legacy:n.legacy,name:f(n.name,`name`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>r.aiSearch.tokens.create({...e,account_id:a})),{successLabel:`Created`});return}n[`cf-api-id`]===void 0&&(n[`cf-api-id`]=await t(`cf-api-id`,`The cf_api_id field`)),n[`cf-api-key`]===void 0&&(n[`cf-api-key`]=await t(`cf-api-key`,`The cf_api_key field`,{kind:`secret`})),n.name===void 0&&(n.name=await t(`name`,`The name field`));let p=c({cf_api_id:f(n[`cf-api-id`],`cf-api-id`,`text`),cf_api_key:f(n[`cf-api-key`],`cf-api-key`,`text`),legacy:n.legacy,name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>r.aiSearch.tokens.create({...p,account_id:a})),{successLabel:`Created`})}};function Ve(e){return e.positional(`id`,{type:`string`,description:`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 token.`,builder:Ve,handler:async t=>{if(t.dryRun){u({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/tokens/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}l(await d(`Deleting`,async()=>n.aiSearch.tokens.delete({account_id:a,id:t.id})),{successLabel:`Deleted`})}};function He(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 Ue={command:`list`,describe:`List tokens.`,builder:He,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search};if(t.dryRun){u({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/tokens`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.aiSearch.tokens.list({account_id:a,...n})),{successLabel:`Loaded`})}};function We(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ge={command:`read <id>`,describe:`Read token.`,builder:We,handler:async t=>{if(t.dryRun){u({command:`cf ai-search tokens read`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/tokens/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.aiSearch.tokens.read({account_id:r,id:t.id})),{successLabel:`Loaded`})}};function Ke(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`cf-api-id`,{type:`string`,description:`The cf_api_id field`}).option(`cf-api-key`,{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 qe={command:`update <id>`,describe:`Update token.`,builder:Ke,handler:async n=>{if(n.dryRun){u({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/tokens/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?c({cf_api_id:f(n[`cf-api-id`],`cf-api-id`,`text`),cf_api_key:f(n[`cf-api-key`],`cf-api-key`,`text`),legacy:n.legacy,name:f(n.name,`name`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>r.aiSearch.tokens.update({...e,account_id:a,id:n.id})),{successLabel:`Updated`});return}n[`cf-api-id`]===void 0&&(n[`cf-api-id`]=await t(`cf-api-id`,`The cf_api_id field`)),n[`cf-api-key`]===void 0&&(n[`cf-api-key`]=await t(`cf-api-key`,`The cf_api_key field`,{kind:`secret`})),n.name===void 0&&(n.name=await t(`name`,`The name field`));let p=c({cf_api_id:f(n[`cf-api-id`],`cf-api-id`,`text`),cf_api_key:f(n[`cf-api-key`],`cf-api-key`,`text`),legacy:n.legacy,name:f(n.name,`name`,`text`)});l(await d(`Updating`,async()=>r.aiSearch.tokens.update({...p,account_id:a,id:n.id})),{successLabel:`Updated`})}},Je={command:`tokens`,describe:`Scoped authentication tokens that grant access to specific AI Search instances`,builder:e=>e.command(Be).command($).command(Ue).command(Ge).command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ye(e){return e.positional(`id`,{type:`string`,description:`ID`,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`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).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`,choices:[`@cf/qwen/qwen3-embedding-0.6b`,`@cf/qwen/qwen3-vl-embedding-2b`,`@cf/baai/bge-m3`,`@cf/baai/bge-large-en-v1.5`,`@cf/google/embeddinggemma-300m`,`google-ai-studio/gemini-embedding-001`,`google-ai-studio/gemini-embedding-2-preview`,`google-ai-studio/gemini-embedding-2`,`openai/text-embedding-3-small`,`openai/text-embedding-3-large`]}).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-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`,choices:[`@cf/baai/bge-reranker-base`]}).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`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).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)`}).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)`}).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-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:`The source_params.web_crawler.parse_type field`,choices:[`sitemap`,`crawl`]}).option(`summarization`,{type:`boolean`,description:`The summarization field`}).option(`summarization-model`,{type:`string`,description:`The summarization_model field`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).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 Xe={command:`update <id>`,describe:`Update the configuration of an AI Search instance.`,builder:Ye,handler:async t=>{if(t.dryRun){u({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/ai-search/instances/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`json`,body:t.body===void 0?c({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:f(t[`cache-threshold`],`cache-threshold`,`text`),chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:f(t[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(t[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:t.paused,public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(t[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(t[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:t.summarization,summarization_model:f(t[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:f(t[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:f(t[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:f(t[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:f(t[`token-id`],`token-id`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.aiSearch.update({...e,account_id:r,id:t.id})),{successLabel:`Updated`});return}let a=c({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:f(t[`cache-threshold`],`cache-threshold`,`text`),chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:f(t[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(t[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:t.paused,public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(t[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(t[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:t.summarization,summarization_model:f(t[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:f(t[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:f(t[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:f(t[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:f(t[`token-id`],`token-id`,`text`)});l(await d(`Updating`,async()=>n.aiSearch.update({...a,account_id:r,id:t.id})),{successLabel:`Updated`})}},Ze={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(I).command(Ie).command(Re).command(Xe).command(P).command(q).command(Pe).command(Je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ze as default};
|