Repository navigation
feat: add a read-only Cloudflare account audit script - #43
Merged
Merged
Conversation
scripts/cloudflare-audit.mjs runs Wrangler's own read-only list and view commands and checks the account against the free-tier boundary: no KV, D1, Queues, Vectorize, Hyperdrive, or Secrets Store resources, no secrets, R2 not enabled, exactly one Worker version at 100 percent, and live bindings, compatibility settings, and handlers matching wrangler.jsonc. It uses the existing Wrangler login, never reads or prints a token, calls no Cloudflare API itself, and changes nothing. With --open it opens the two dashboard pages that only a person can read (the plan and the live observability settings). Exit code is 1 on any failure. Verified against production v0.7.0 (12 of 12 pass) and negatively tested by mismatching the config, which fails two checks and exits 1. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Automate the account audit so the no-charge boundary can be verified with one command, and make the two facts that need a person (the plan and the live observability settings) one click away.
Scope / non-goals
Added
scripts/cloudflare-audit.mjs. It runs Wrangler's own read-only list and view commands and checks:wrangler.jsonc.--openopens the plan page and the Worker settings page in the default browser. Docs (FREE_TIER.md,CLOUDFLARE.md) and the changelog now point to it.Deliberately not done: reading the plan or observability settings through the API. The plan needs a Billing Read token, which this project does not create, and I did not extract the Wrangler OAuth token to try. The script uses only Wrangler's own commands, never reads or prints a token, calls no Cloudflare API itself, and changes nothing on the account.
Public contract
None. Not part of the Worker bundle.
Security impact
Verification
wrangler.jsonc, which fails two checks and exits 1npm run verify(the script is linted; the policy check confirms the documented path exists)git diff --check🤖 Generated with Claude Code