pi-cloudflare 0.9.5 → 0.10.1
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/README.md +16 -4
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/cloudflare-cf-cli/SKILL.md +116 -0
package/README.md
CHANGED
|
@@ -146,20 +146,32 @@ Avoid re-running full setup on a schedule: each fresh approval can rotate
|
|
|
146
146
|
away tokens other sessions still hold. Re-authenticate single servers with
|
|
147
147
|
`--only` and only when told to.
|
|
148
148
|
|
|
149
|
-
## Wrangler CLI
|
|
149
|
+
## Wrangler, cf CLI, and MCP tools
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
bearers are recognized by MCP servers but scope-rejected
|
|
153
|
-
|
|
151
|
+
All three are first-class; pick per task. Credentials do not transfer between
|
|
152
|
+
them: wrangler bearers are recognized by MCP servers but scope-rejected
|
|
153
|
+
(verified live), and `cf` reads `CLOUDFLARE_API_TOKEN` from the environment, so
|
|
154
|
+
use each where it wins:
|
|
154
155
|
|
|
155
156
|
| Task | Use |
|
|
156
157
|
| -------------------------------------------- | ---------------------------------------------- |
|
|
157
158
|
| Deploys, `tail -f`, KV/R2/D1 CLIs, scripting | `wrangler` in bash (durable months-long login) |
|
|
159
|
+
| Full API as typed commands, JSON out | `cf` CLI (`cf zones list`, `cf d1 ...`) |
|
|
160
|
+
| Finding the right API operation | `cf cli search "<intent>"` |
|
|
158
161
|
| Endpoint discovery, docs search | `cf_api_search`, `cf_docs_*` |
|
|
159
162
|
| Typed CRUD on bindings with agent-shaped I/O | `cf_bindings_*` |
|
|
160
163
|
| Builds history, log exploration | `cf_builds_*`, `cf_obs_*` |
|
|
161
164
|
| Arbitrary API paths with static credentials | `cf_api_execute` + `apiToken` |
|
|
162
165
|
|
|
166
|
+
Install `cf` with `bun add -g cf` (or `npm i -g cf`); it authenticates from
|
|
167
|
+
`CLOUDFLARE_API_TOKEN`, the same token the MCP servers use. `cf` is Cloudflare's
|
|
168
|
+
agent-first successor surface — JSON output by default and intent-based command
|
|
169
|
+
discovery via `cf cli search` — but it does not replace wrangler: `cf dev`,
|
|
170
|
+
`cf build`, and `cf deploy` delegate to the dev-server each project declares
|
|
171
|
+
(wrangler for legacy Worker projects, `@cloudflare/vite-plugin` for Vite), and
|
|
172
|
+
that delegation expects projects migrated to `cloudflare.config.ts` via
|
|
173
|
+
`cf migrate`. See `skills/cloudflare-cf-cli/SKILL.md`.
|
|
174
|
+
|
|
163
175
|
Wrangler's months-long session comes from its first-party OAuth grant; MCP
|
|
164
176
|
servers require their own per-server grants (verified: cross-use fails
|
|
165
177
|
closed on scope). They complement; neither replaces the other.
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "pi-cloudflare",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"description": "Cloudflare skills and cf_-prefixed MCP tools, with a native Pi adapter and an Agent Plugins 1.0 portable runtime.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "0xPlayerOne",
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cloudflare-cf-cli
|
|
3
|
+
description: Use the Cloudflare cf CLI for estate-wide Cloudflare operations from bash — typed commands over the full API (~3,000 operations), JSON output by default, natural-language command discovery, and Workers deploys. Load when a task mentions the cf CLI, when running Cloudflare operations in a shell (deploys, DNS, KV/R2/D1, zones, WAF, cache, secrets), when wrangler lacks a command, or when an agent needs machine-readable Cloudflare output.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cloudflare cf CLI
|
|
7
|
+
|
|
8
|
+
`cf` is Cloudflare's agent-first CLI: the full API as typed commands, JSON
|
|
9
|
+
output by default, and intent-based command discovery. It complements the
|
|
10
|
+
pi-cloudflare MCP servers (in-session tool calls) and wrangler (local dev and
|
|
11
|
+
legacy deploys) — it does not replace either.
|
|
12
|
+
|
|
13
|
+
## Install and auth
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add -g cf # or: npm i -g cf (open beta, node >= 22)
|
|
17
|
+
ln -sf ~/.bun/install/global/node_modules/.bin/cf ~/.bun/bin/cf # bun quirk: link the bin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Auth is read from the environment — **no OAuth login is needed** when the
|
|
21
|
+
estate's API token is present, and the CLI inherits whatever scope that token
|
|
22
|
+
has:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
export CLOUDFLARE_API_TOKEN=... # same token the MCP servers use
|
|
26
|
+
cf auth whoami # authSource: "CLOUDFLARE_API_TOKEN environment variable"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If the binary is missing from PATH after a bun global install, the package's
|
|
30
|
+
real bin lives at `~/.bun/install/global/node_modules/.bin/cf` — symlink it.
|
|
31
|
+
|
|
32
|
+
## The two commands that matter most for agents
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
cf cli search "purge cache for a zone" # intent -> command, JSON array out
|
|
36
|
+
cf <command> # JSON output by default
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`cf cli search` finds commands by what they do, not by name. Prefer it over
|
|
40
|
+
guessing command names, then read the found command's `--help`.
|
|
41
|
+
|
|
42
|
+
Global flags worth knowing: `-q` (quiet), `-z <zone>` (zone id or domain,
|
|
43
|
+
overrides `CLOUDFLARE_ZONE_ID`), `--profile` (auth profile), `--local`
|
|
44
|
+
(simulations).
|
|
45
|
+
|
|
46
|
+
## Where cf wins, and where it does not
|
|
47
|
+
|
|
48
|
+
| Task | Tool |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| API-surface operations in bash (DNS, KV/R2/D1, zones, WAF, cache, secrets) | `cf` — typed commands, JSON out |
|
|
51
|
+
| Finding the right API operation | `cf cli search` |
|
|
52
|
+
| Workers deploys for migrated projects | `cf deploy` |
|
|
53
|
+
| **Local dev** (`cf dev`, `cf build`) | **delegates to the project's dev server** — see below |
|
|
54
|
+
| `wrangler tail` | `wrangler` (cf has no tail command) |
|
|
55
|
+
| Docs lookup, primitives guidance | `cf_docs_*` / `cf_bindings_*` MCP tools |
|
|
56
|
+
|
|
57
|
+
## Delegation: why wrangler is still a dependency
|
|
58
|
+
|
|
59
|
+
`cf deploy`, `cf dev`, and `cf build` do not bundle a bundler or dev server.
|
|
60
|
+
They drive whichever **dev-server implementation the project declares**:
|
|
61
|
+
|
|
62
|
+
- `@cloudflare/vite-plugin` — recommended for new JS/TS projects
|
|
63
|
+
- `wrangler` — legacy Worker projects
|
|
64
|
+
- `cloudflare-py-dev-server` / `cloudflare-rs-dev-server` — Python / Rust
|
|
65
|
+
|
|
66
|
+
So for existing Workers, wrangler stays a **project dev dependency** and cf
|
|
67
|
+
spawns it (via the `cf-wrangler` delegate binary). Two consequences:
|
|
68
|
+
|
|
69
|
+
1. **Uninstalling wrangler breaks `cf dev`/`cf build`/`cf deploy`** for any
|
|
70
|
+
project that declares it. Keep it until every project is migrated.
|
|
71
|
+
2. The delegation path expects the **new `cloudflare.config.ts`** format. A
|
|
72
|
+
project still on `wrangler.jsonc` fails with
|
|
73
|
+
`cloudflare.config.ts is required when --experimental-new-config is enabled`.
|
|
74
|
+
Run `cf migrate` in the project to convert, or keep using `wrangler deploy`
|
|
75
|
+
there until migrated.
|
|
76
|
+
|
|
77
|
+
Two more traps from real migrations:
|
|
78
|
+
|
|
79
|
+
- **cf picks the delegation runner from the package manager it detects**, and
|
|
80
|
+
defaults to `npx`. In a Bun workspace whose `devEngines` rejects npm, every cf
|
|
81
|
+
build fails with `EBADDEVENGINES Invalid devEngines.packageManager` before
|
|
82
|
+
anything runs. Declare `packageManager: "bun@<version>"` in the root manifest
|
|
83
|
+
so cf delegates via `bunx`.
|
|
84
|
+
- **Keep both configs in sync during the transition.** The cf flow reads
|
|
85
|
+
`cloudflare.config.ts` + `wrangler.config.ts`; the legacy CI deploy (the
|
|
86
|
+
code-foundry reusable workflow's `wrangler versions upload` / `deploy`)
|
|
87
|
+
reads `wrangler.jsonc`. Deleting `wrangler.jsonc` after `cf migrate` breaks
|
|
88
|
+
the CI deploy even though local cf commands work — and `cf build` will error
|
|
89
|
+
with `no root config found at .cloudflare/output/v0/config.json` because the
|
|
90
|
+
wrangler bundling step runs via the project's own build, not cf build.
|
|
91
|
+
- **Never launch wrangler under the Bun runtime.** The code-foundry deploy
|
|
92
|
+
workflow launched it via `bunx --bun`, and one Worker's production deploy
|
|
93
|
+
failed deterministically with `The object can not be cloned` — while other
|
|
94
|
+
Workers deployed fine in the same run — plus wrangler's own warning that it
|
|
95
|
+
does not support the Bun runtime. If a repo's deploy uses a Bun launcher,
|
|
96
|
+
that is the first thing to check when a deploy fails without a clear error.
|
|
97
|
+
|
|
98
|
+
A project with **no** manifest (`package.json`/`pyproject.toml`/`Cargo.toml`)
|
|
99
|
+
cannot be deployed by cf at all — wrangler still deploys a bare `index.js` +
|
|
100
|
+
`wrangler.jsonc`.
|
|
101
|
+
|
|
102
|
+
## Migration
|
|
103
|
+
|
|
104
|
+
`cf migrate` converts a Wrangler project in place. Vite-based Workers become
|
|
105
|
+
`cloudflare.config.ts` automatically. Do it per project, in that project's
|
|
106
|
+
repo — not estate-wide from outside.
|
|
107
|
+
|
|
108
|
+
## Relationship to the pi-cloudflare MCP servers
|
|
109
|
+
|
|
110
|
+
The MCP servers are in-session tool calls with structured I/O and result caps;
|
|
111
|
+
cf is a subprocess with JSON output. Heavy overlap on the API surface
|
|
112
|
+
(`cf_api_*` vs ~3,000 cf commands), and moderate overlap on builds and
|
|
113
|
+
observability (`cf_builds_*`/`cf_obs_*` vs `cf builds`/`cf observability`).
|
|
114
|
+
Neither is obsolete: pick the MCP for in-session structured calls, cf for
|
|
115
|
+
bash, scripts, and anything the MCP tool surface does not expose. `cf_docs_*`
|
|
116
|
+
and `cf_bindings_*` have no cf equivalent.
|