跳到主内容
@wquguru
精选88Cloudflare 博客(RSS)产品发布/更新

Cloudflare发布面向AI Agent的CLI工具cf

Introducing cf: the agentic CLI for the entire Cloudflare API

原文
发到 X
推荐理由

Agent开发者的新基建,用cf替代Wrangler可大幅扩展Agent对Cloudflare全平台的操作能力,且原生JSON输出和搜索机制显著降低Token消耗,值得集成测试。

Over the last year, agent use of Wrangler has skyrocketed.

在过去一年中,智能体对 Wrangler 的使用量激增。

In March 2026, agents were responsible for a quarter of Wrangler use, up from single-digit percentages the year prior. Last week, agent usage reached 48%.

2026年3月,智能体负责了四分之一的 Wrangler 使用量,而去年这一比例仅为个位数百分比。上周,智能体使用率达到了48%。

Agents are more prolific users, using almost twice as many distinct commands per day, and are almost four times as likely to use six or more commands.

智能体是更活跃的用户,每天使用的不同命令数量几乎是普通用户的两倍,且使用六个或更多命令的可能性高出近四倍。

Agents love CLIs. But Wrangler only provides commands for around 280 operations, and Cloudflare offers thousands.

智能体热爱命令行界面(CLI)。但 Wrangler 仅提供约280个操作的命令,而 Cloudflare 提供了数千种操作。

Earlier in the year we teased how we were planning to solve this and today, we’re enabling agents to use every Cloudflare product by introducing a new CLI: cf.

今年早些时候,我们曾预告过计划如何解决这一问题;今天,我们通过引入一个新的 CLI:cf,使智能体能够使用所有 Cloudflare 产品。

cf is a CLI that is built for the next generation of software development:

cf 是一个为下一代软件开发打造的 CLI:

  • Agents can find the command they need to do anything they want to do with bespoke search and steering.
  • JSON is the default interface, pretty printed for humans and condensed for agents for maximum context savings.
  • cloudflare.config.ts is the new configuration format for the whole of Cloudflare, starting with Workers, and bringing the safety and accuracy of TypeScript to you and your agent’s language server protocol (LSP)
  • Vite becomes default, bringing with it the best local development server, and a plugin suite for developers and framework authors.
  • 智能体可以通过定制化的搜索和引导功能,找到执行任何所需操作所需的命令。
  • JSON 是默认接口,对人类友好地进行美化打印,对智能体则进行压缩以节省最大上下文空间。
  • cloudflare.config.ts 是 Cloudflare 全平台的新配置格式,从 Workers 开始,将 TypeScript 的安全性和准确性带给您以及您的智能体的语言服务器协议(LSP)。
  • Vite 成为默认选项,带来了最佳的本地开发服务器,以及面向开发者和框架作者的插件套件。

Install the open beta today globally and run it from anywhere:

立即在全球范围内安装开放测试版,并从任何地方运行它:

Copy prompt

复制提示词

代码 · 7 行
Please update your global agent instructions, so you use Cloudflare's new `cf` CLI.
Add the Markdown below to the user-level instructions file that you load in every project – not this repository's AGENTS.md or CLAUDE.md. Use the file for the agent you are: Claude Code `~/.claude/CLAUDE.md`, Codex `~/.codex/AGENTS.md`, OpenCode `~/.config/opencode/AGENTS.md`, Pi `~/.pi/agent/AGENTS.md`. For any other agent, use its equivalent global rules file; if your global rules can only be set in a settings screen, tell me what to paste there instead. Create the file if it doesn't exist. Keep everything already in it, but replace any existing instruction about Wrangler or the Cloudflare CLI instead of adding a conflicting one. If the same guidance is already there, leave the file as it is. When you're done, tell me the path of the file you changed.
```markdown
## Cloudflare CLI - cf - v20260928
`cf` is Cloudflare's current CLI and covers the whole Cloudflare platform. Prefer it over Wrangler: create projects with `cf init`, develop with `cf dev`, deploy with `cf deploy`, and manage account resources with `cf <product> …` (for example `cf d1 list`).
Wrangler is only for projects that already use it – a `wrangler.jsonc`, `wrangler.json` or `wrangler.toml` file – or when the user asks for it. Keep using Wrangler in those projects unless asked to migrate, and use `cf migrate` in this case.
`cf` commands differ from Wrangler's; check `cf --help` or `cf cli search <what you want to do>` instead of guessing. If a `cf` command fails in a project that doesn't use Wrangler, don't fall back to Wrangler (including `npx wrangler`) without offering to report it.

cf gives your agent access to the entire Cloudflare API

cf 让您的智能体能够访问整个 Cloudflare API

What if your agent could do everything Cloudflare can do? That’s the question that sparked our interest earlier this year: agents were getting ever more powerful, but what they were able to do with Cloudflare’s CLI was still limited.

如果智能体能够完成 Cloudflare 所能做的所有事情会怎样?这是今年早些时候引发我们兴趣的问题:智能体变得越来越强大,但它们通过 Cloudflare CLI 能做的事情仍然有限。

Wrangler was hand-built with each product team contributing and taking their own approach to their command developer experience. Enforcing patterns across teams was virtually impossible, even across our ~280 command paths. We had inconsistent terminology across d1 info, hyperdrive get, workflows describe as each team came up with their own practices at different times. Some teams built entirely custom experiences across thousands of lines of code that turned out to be used extremely rarely, and teams came up with different approaches to solve the same problems.

Wrangler 是由各个产品团队手工构建的,每个团队都采用各自的方法来优化其命令的开发体验。即使在大约280个命令路径之间,跨团队强制执行统一模式也几乎不可能。由于各团队在不同时间形成了各自的实践,导致术语不一致,例如 d1 info、hyperdrive get、workflows describe。有些团队在数千行代码中构建了完全自定义的体验,但这些体验实际上极少被使用;而各团队针对相同问题却采用了不同的解决方案。

We wanted to both standardize what we had and make a massive expansion, all at once. Forge — Cloudflare’s new unified API generation pipeline — enabled us to do this, building on the idea of generating our CLI commands directly from the API schema that powers our API documentation and SDK generation. Everything we provide has an OpenAPI schema, and if we annotate this with just a little more information, we can use it as the source for Forge to make a CLI.

我们既希望标准化现有内容,又希望能实现大规模扩展,且两者同步进行。Forge —— Cloudflare 全新的统一 API 生成管道 —— 使我们能够做到这一点,其理念是基于直接由支撑 API 文档和 SDK 生成的 API 模式来生成 CLI 命令。我们提供的所有内容都拥有 OpenAPI 模式,如果在此基础上仅增加少量注释信息,我们就可以将其作为 Forge 的源数据来构建 CLI。

This enables us to expand cf from the ~280 functions that Wrangler had built up over time, to cover the entirety of the Cloudflare API surface of over 3,000 operations.

这使得我们能够从 Wrangler 随时间积累的大约 280 个函数扩展到覆盖整个 Cloudflare API 表面,后者包含超过 3,000 个操作。

Now it’s simple to give your agent cf and ask it to go set up a worker, deploy it, monitor and observe it, protect it with Cloudflare Access, buy a domain, and front it with Cloudflare WAF, all from a single tool.

现在,你可以简单地给你的代理工具 cf,并让它去设置一个 worker、部署它、监控和观察它、用 Cloudflare Access 保护它、购买域名,并用 Cloudflare WAF 进行前端防护,所有这些都可以从单一工具中完成。

Building for an agent that has never used cf

为从未使用过 cf 的代理而构建

cf is built for the trajectory of software engineering, where agentic development is drastically changing how software is built and deployed. This year we’ve been focused on providing tools to support this shift, culminating in cf. cf has been built from the ground up with agents in mind, and includes novel tools for agentic command discovery that we think will become standard in more CLIs in the near future.

cf 是为软件工程的发展轨迹而构建的,其中代理式开发正在极大地改变软件的开发和部署方式。今年我们专注于提供支持这一转变的工具,最终成果就是 cf。cf 从底层开始就考虑了代理的需求,并包括了一些新颖的代理命令发现工具,我们认为这些工具将在不久的将来成为更多 CLI 的标准配置。

Wrangler came with the advantage that years of documentation, blogs, and third-party guides have been absorbed into the training process of LLMs. It also came with the same disadvantage: changing how Wrangler works now goes against learned behavior, and significant change would be inevitable given the scale of improvement we want to make.

Wrangler 的优势在于,多年的文档、博客和第三方指南已被吸收进 LLM 的训练过程中。但它也有同样的劣势:现在改变 Wrangler 的工作方式会违背已习得的行为,鉴于我们希望实现的改进规模,重大变更是不可避免的。

Introducing a new CLI that agents have never seen sounds like a big disruptive change — but actually it’s the cleanest thing we can do. Because of the design decisions we have made, the context injections we can make, and the AGENTS.md files we can append, making a switch in this way is actually less confusing than having an agent contextualize the major differences between two versions of a tool it is familiar with. We’re launching with a couple of these agent-focused features built in, with more to come.

引入一个代理从未见过的全新 CLI 听起来像是一个巨大的颠覆性变化——但实际上这是我们所能做的最干净的事情。由于我们所做的设计决策、我们可以进行的上下文注入以及我们可以附加的 AGENTS.md 文件,以这种方式进行切换实际上比让代理去理解它熟悉的工具的兩個版本之间的主要差异更不容易令人困惑。我们带着几个内置的面向代理的功能启动,未来还会有更多功能推出。

Agents need to filter JSON, not look at tables

代理需要过滤 JSON,而不是查看表格

When agents use Wrangler, they append --json to every command they run, and then often filter the output with jq to extract a subset of fields. But only some commands in Wrangler supported --json ; many commands returned unicode tables, designed for humans looking at output in their terminal. Agents can figure these out, but it costs them more time and tokens than a jq filter.

当代理使用 Wrangler 时,它们会在运行的每个命令后附加 --json,然后经常使用 jq 过滤输出以提取部分字段。但只有 Wrangler 中的一些命令支持 --json;许多命令返回的是 Unicode 表格,旨在供人类在终端中查看输出。代理可以解析这些内容,但这比使用 jq 过滤器消耗更多的时间和 token。

In cf we’re taking the opposite stance: agents just need JSON, and if agents are the future primary user of this tool, it should be the default. For the vast majority of commands that will rarely be accessed by humans, this is obviously the right call.

在 cf 中,我们采取相反的立场:代理只需要 JSON,如果代理是该工具未来的主要用户,那么 JSON 就应该是默认格式。对于绝大多数很少由人类访问的命令来说,这显然是正确的选择。

You as the human customer of this CLI are, in reality, one step removed from using it. Agents being able to easily filter their results and then return that filtered list in whatever format you request is preferable to supplying tables you will never likely read directly.

作为该 CLI 的人类客户,你实际上离直接使用它还有一步之遥。代理能够轻松过滤其结果,并以你要求的任何格式返回该过滤后的列表,这优于提供你几乎不可能直接阅读的表格。

But what if you’re looking to do something that might require real personal input, like searching for a domain to buy?

但是,如果你想要做一些可能需要真实个人输入的事情,比如搜索要购买的域名呢?

For commands that your agent can access through chaining named parameters in a long and unwieldy sequence, you can simply fill in a form. Cf deconstructs the requirements of the API into a series of validated inputs, so buying a domain, even one with complex requirements, is simple to follow.

对于你的代理可以通过在一长串笨拙的序列中链接命名参数来访问的命令,你可以简单地填写一个表单。Cf 将 API 的需求分解为一系列经过验证的输入,因此购买域名,即使是有复杂要求的域名,也变得简单易行。

Or, if you insist, just ask your agent to do it.

或者,如果你坚持的话,只需让你的代理去做即可。

Your agent can find the right command itself

你的代理可以自己找到正确的命令

With 3,000 possible routes through a CLI, how can your agent find the right operation it needs quickly without bloating your context? For this reason we have also added cf cli search.

在一个 CLI 中存在 3,000 种可能的路由,你的代理如何在不膨胀上下文的情况下快速找到所需的操作?出于这个原因,我们还添加了 cf cli search。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件