cf-auth-setup
GitHub通过单一幂等命令自动化配置、迁移和安全部署 Cloudflare Auth 应用的生产环境。支持预检、运行、收敛修复及验证,提供报告驱动的迭代循环以解决部署问题,确保应用安全上线。
触发场景
安装
npx skills add leopoldsw/cloudflare-auth --skill cf-auth-setup -g -y
SKILL.md
Frontmatter
{
"name": "cf-auth-setup",
"description": "Provision, migrate, secure, deploy, and verify a Cloudflare Auth app's production environment with one idempotent command and a report-driven convergence loop. Use when asked to set up, deploy, fix, or diagnose a cf-auth \/ Cloudflare Auth application on Cloudflare."
}
Cloudflare Auth one-command setup
The deterministic CLI does the work. Your job: check preconditions, run one
command, execute the fixes it reports, and hand human-only steps to the
operator. The normative contract is docs/automation.md; human-only steps are
docs/manual-steps.md (both in the Cloudflare Auth repository).
Preflight
-
Confirm you are in an initialized app: a
wrangler.jsonc/wrangler.jsonwith anAUTH_DBD1 binding and asrc/auth.config.ts. If not, runnpx --package @cf-auth/cli@latest cf-auth initfirst (it also writes an AGENTS.md runbook). -
Confirm credentials:
wrangler whoamisucceeds, orCLOUDFLARE_ACCOUNT_IDandCLOUDFLARE_API_TOKENare exported with the scopes fromdocs/cloudflare-permissions.md. NEVER echo, log, or write these values. -
In an account you have not deployed to before, show the plan first:
npx --package @cf-auth/cli@latest cf-auth setup --dry-run --env production
Run
npx --package @cf-auth/cli@latest cf-auth setup --report --env production --output setup-report.json
If the app has no AUTH_PUBLIC_ORIGIN configured yet, ask the user for the
intended https origin (or their workers.dev URL) and add
--origin <https-origin>.
Converge (max 5 iterations)
- Parse
setup-report.json(schema:schemas/setup-report.schema.json). ok: true→ go to Verify.- For each step with
status: "fail", run itsfixstring exactly as printed. Do not improvise alternative commands. - If a fix references
docs/manual-steps.mdor a dashboard URL, STOP. Print the exact numbered manual step, where to do it, and its "done when" check, then wait for the operator. Never automate the Cloudflare dashboard. - Rerun the Run command. If two consecutive reports show identical failure sets, stop and summarize the remaining steps and the single next action.
Verify
npx --package @cf-auth/cli@latest cf-auth doctor --env productionexits 0.- The setup report's
verifystep ispass(setup already exercised signup, login, and logout against the deployed origin with a throwaway user unless--skip-verifywas used).
Failure quick reference
preflightfails on accounts: exportCLOUDFLARE_ACCOUNT_IDor setaccount_idin the Wrangler config.originfails: rerun with--origin <https-origin>after confirming the origin with the user.deployfails with a workers.dev onboarding URL: manual step 3 — the operator registers the subdomain once, then rerun setup.doctoremail checks fail: manual steps 4–5 (Workers Paid, sender/domain DNS) — hand off, then rerun.verifyfails: confirm the origin actually serves this Worker (route, custom domain, DNS) and inspectwrangler tail --env production.
Invariants
- Setup never rotates an existing
AUTH_SECRET; never runrotate-secret --applyon a live deployment without--previous-from-env/--previous-from-stdinand explicit user intent. - Prefer
cf-authcommands over rawwrangler; usewrangleronly for diagnostics such aswhoamiandtail. - Reports are redaction-safe; keep them that way — never paste secrets, cookies, or tokens into output or files.
版本历史
- 1953f69 当前 2026-07-24 12:18


