智能体自己找到命令
用自然语言描述目标,cf cli search 会依据 API 描述与参数返回可用命令,不必先记住命令名。
cf d1 create找到命令cf schema d1 create查看参数cf d1 create --dry-run预演请求cf 公开测试版现已发布,完整映射整个 Cloudflare API。
阅读发布公告可操作的 API
Wrangler 原有命令
上周智能体执行占比
Wrangler 维护支持
Wrangler 由各产品团队手工构建,即使只有约 280 条命令路径,术语与模式也难以统一。同一件事在不同产品里有三种写法。
cf 换了一条路:命令直接从支撑 API 文档与 SDK 的 OpenAPI 模式生成。产品只需为模式补充少量注解,新增能力即可自动出现在 CLI 中。
同一件事,三种命名
d1 infohyperdrive getworkflows describe在 cf 中,命名与参数由同一份模式决定,命令之间不再各说各话。
每一个设计取舍都指向同一件事:让智能体少花上下文,让你少花时间。
用自然语言描述目标,cf cli search 会依据 API 描述与参数返回可用命令,不必先记住命令名。
cf d1 create找到命令cf schema d1 create查看参数cf d1 create --dry-run预演请求对人类美化排版,对智能体压缩成单行,省下的是上下文。
"name": "my-worker", "routes": 3
从 Workers 到 DNS、WAF、Access 与域名注册,一个工具触达全部产品。
具备 HMR 的开发服务器、基于 Rolldown 的构建,以及可直接复用的 Vite 插件生态。
cloudflare.config.ts 让人类与编辑器都读得懂配置。使用 LSP 的智能体可以直接在上下文中解读它,给出更准确的建议。
TOML 没有可访问的模式,JSONC 虽有模式却很少被智能体使用;TypeScript 两者兼得。
import { bindings, defineConfig } from "cf/config";
import * as entrypoint from "./index.js" with { type: "cf-worker" };
export default defineConfig(({ mode }) => ({
worker: {
name: "example-worker",
entrypoint,
compatibilityDate: "2026-09-27",
env: {
Environment: bindings.text(`This is ${mode} environment`),
},
},
}));一个文件描述整个 Worker
import { bindings, defineConfig } from "cf/config";
export default defineConfig(({ mode }) => ({
worker: {
// ...
env: {
API_URL: bindings.text(
mode === "production"
? "https://example.com"
: "https://staging.example.com",
),
API_TOKEN: bindings.secret(),
CACHE: bindings.kv({
id: mode === "production"
? "production-namespace-id"
: "staging-namespace-id",
}),
DATABASE: bindings.d1({ name: `example-${mode}-database` }),
UPLOADS: bindings.r2({ name: `example-${mode}-uploads` }),
JOBS: bindings.queue<{ userId: string }>({
name: `example-${mode}-jobs`,
}),
AI: bindings.ai(),
SEARCH_INDEX: bindings.vectorize({
name: `example-${mode}-search`,
}),
API: bindings.worker({ worker: `example-${mode}-api` }),
},
},
}));所有平台能力都可自动补全
import { defineConfig, triggers } from "cf/config";
export default defineConfig({
worker: {
// ...
triggers: [
triggers.fetch({ pattern: "example.com/*" }),
triggers.scheduled({ schedule: "0 * * * *" }),
triggers.queue({ name: "jobs", maxBatchSize: 10 }),
triggers.email({ addresses: ["support@example.com"] }),
],
},
});触发方式集中在一处声明
cf migrate 读取 Wrangler 配置,生成 cloudflare.config.ts 并接管依赖。
无法自动转换的条目会列成清单,例如 Durable Object 绑定需要迁移后复核。
esbuild 的 JavaScript Worker 与 Rust、Python Worker 仍由 Wrangler 开发部署。
$npm i -g cf