Skip to content

[Turnstile] Add Spin docs page#31195

Open
juleslemee wants to merge 5 commits into
cloudflare:productionfrom
juleslemee:turnstile-spin-docs
Open

[Turnstile] Add Spin docs page#31195
juleslemee wants to merge 5 commits into
cloudflare:productionfrom
juleslemee:turnstile-spin-docs

Conversation

@juleslemee
Copy link
Copy Markdown

Adds the canonical docs page for Turnstile Spin at /turnstile/spin/.

What's on the page

  • A "Quick start (humans)" copy-pasteable prompt that inlines the full Spin skill so anyone using an AI coding agent (Claude Code, Cursor, Codex, OpenCode, Copilot) can run it from anywhere without first installing the skill.
  • The agent-readable Spin skill: when to load, hard scope boundaries (no email/SMS, no custom Worker, no Pages duplication, etc.), recovery flow against existing widgets, the 9-step wizard, telemetry marker convention.
  • "What happens after you paste the prompt": narrated walkthrough so humans reading the page know what to expect.
  • Migrating from reCAPTCHA / hCaptcha section.
  • Per-framework code examples + edge cases.

Also adds the matching plain-markdown copy at public/turnstile/spin/index.md so the agent's Step 8 (persist skill) can fetch it via curl.

Companion PRs

Internal context

Tier 3 launch tracked in NC-8209. PRD: https://jira.cfdata.org/browse/NC-8209

Validation: `pnpm run check` passes on the spin MDX. No type errors or broken internal links specific to this page.

Adds /turnstile/spin/ documenting the Turnstile Spin agent skill: how to invoke it, what it does end-to-end (widget create, Worker deploy, frontend snippets, validation), the full inlined SKILL.md prompt for paste-into-agent flows, recovery flow, edge cases, and migration from reCAPTCHA/hCaptcha.

Companion to the skill PR at cloudflare/skills#58.

Internal PRD: https://jira.cfdata.org/browse/NC-8209
@cloudflare-docs-bot
Copy link
Copy Markdown

cloudflare-docs-bot Bot commented Jun 2, 2026

Review

⏸️ Automatic reviews for this PR are paused.

This PR has already received 2 automatic reviews. To run another review, a codeowner can comment /review or /full-review.

Tip: Keep PRs in draft mode until they are ready for review — the bot skips draft PRs automatically.

jules lemee added 4 commits June 3, 2026 11:23
Sync to the refactored skill bundle. The MDX page's inlined paste-into-agent prompt now consists of the (much shorter) SKILL.md orchestration + a bootstrap section that writes the 6 helper scripts under /tmp/turnstile-spin-scripts/. Total prompt length is comparable to before; the architecture is cleaner because the agent now branches on structured JSON output from deterministic scripts instead of inline bash interpretation.

Companion to cloudflare/skills#58.
Per Marina's review feedback, add the Beta badge to the Spin landing page (matching the multi-cloud-networking pattern):

- title gets the "(beta)" suffix
- sidebar.badge.text set to "Beta"
Move spin/index.mdx to spin.mdx so the page is a flat sidebar
sibling of Plans, Concepts, etc., instead of a collapsible group
with a single child. Shorten sidebar.label from
"Spin (one-shot setup)" to "Spin".
Addresses 5 findings from Miguel's review:

1. Resolved wrangler login contradiction. The skill prose said "don't
   use wrangler login because OAuth lacks Account.Turnstile:Edit" but
   the human walkthrough, the troubleshooting table, and the 403
   recovery section all instructed the agent to run wrangler login.
   Replaced with token-creation guidance everywhere.

2. Fixed multi-account handling in auth-probe.sh. The script hardcoded
   .accounts[0].id and treated any user-set CLOUDFLARE_ACCOUNT_ID
   pointing at a non-first account as a mismatch. It now checks
   membership in the accounts array, emits a new multiple_accounts
   status when the token covers >1 accounts and the env var is unset,
   and only uses [0] when there is exactly one account.

3. Added a Workers scope probe. The script docstring claimed status:ok
   meant both Turnstile and Workers scope were present, but the code
   only hit GET /challenges/widgets. Added a second probe against
   /workers/scripts that emits missing_workers_scope when the token
   lacks Account.Workers Scripts:Edit, preventing widget creation
   followed by Worker deploy failure.

4. Fixed wrangler secret put without --name in the human walkthrough.
   The script uses --name correctly; the docs prose did not, so the
   secret would land on wrangler.toml's default worker name. Also
   reordered: deploy first (so the named Worker exists), then put the
   secret on it. Made set_secret failure fatal in worker-deploy.sh
   (was previously swallowed; the script could emit status:ok with
   no secret on the Worker).

5. Fixed jq shape mismatch in curl fallback. Was '.account.id'
   (singular, wrong); now '.accounts[0].id' (matches wrangler whoami
   --json output and the helper script).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants