智能体
developers.cloudflare.com ·
@Cloudflare Developers
Cloudflare CLI 新增 cf docs search 文档检索命令
Cloudflare CLI 1.0.0-beta.16 加入 cf docs search,开发者与编码 Agent 可在终端内检索 Cloudflare 指南、教程和示例,命令返回最多五条按相关度排序的 JSON 结果(含标题、描述和文档 URL),需联网。Agent 可解析结果并用 Accept: text/markdown 抓取整页 Markdown。该版本还将生成命令名统一为 kebab-case,如 getCredits 改为 get-credits,属破坏性变更。
AI推荐理由 Cloudflare 官方 changelog,介绍 CLI 1.0.0-beta.16 新增 cf docs search,可检索实时文档并返回最多五条带标题、描述和 URL 的 JSON 结果,便于编码 Agent 解析并抓取 Markdown 页面;同时说明命令名统一为 kebab-case 的破坏性变更。对开发者工具链和 Agent 文档检索有实际用途,但仍是 beta 版本,且需联网,未提供检索质量评估。
70
正文
Cloudflare CLI `1.0.0-beta.16` includes `cf docs search`, so you and your coding agent can find Cloudflare documentation without leaving the terminal. Search for guides, tutorials, and examples across Cloudflare products.
To install or update to the latest release:
npmyarnpnpmbun
```
npm install --global cf@latest
```
```
yarn global add cf@latest
```
```
pnpm add --global cf@latest
```
```
bun add --global cf@latest
```
Describe what you want to do, or ask a question:
```
cf docs search "proxy a DNS record"
cf docs search "rate limit requests with WAF"
cf docs search "schedule a worker"
```
The command searches live Cloudflare documentation and returns up to five ranked JSON results. Each result includes a title, description, and documentation URL. An Internet connection is required.

Agents can parse the results and fetch a complete page as Markdown. For example, use `jq` to select the first result, then request its URL with the `Accept: text/markdown` header:
```
url=$(cf docs search "proxy a DNS record" | jq -r '.[0].url')
curl -H "Accept: text/markdown" "$url"
```
This release also standardizes generated command names to kebab-case. For example, `cf accounts billing getCredits` becomes `cf accounts billing get-credits`. For the full list of breaking command and flag changes, refer to the [Cloudflare CLI release notes ↗︎](https://github.com/cloudflare/cf/blob/main/packages/cli/CHANGELOG.md).
For more information, refer to [Find Cloudflare documentation with a coding agent](https://developers.cloudflare.com/cf/agents/#find-cloudflare-documentation).