doctor preflight
notewright doctor is a report-only preflight. It imports your composed Worker
entry (under Bun) and diffs it against wrangler.jsonc. It mutates nothing; it is
purely a read-only report.
What it checks
Section titled “What it checks”- Durable Object bindings. Missing or extra DO bindings versus what the composed providers declare.
- DO migrations. Missing or extra DO migration entries.
- D1 migrations. Migration files present locally but not applied. It prints the
exact
bunx wrangler d1 migrations apply <db> --remotecommand to fix them. - Required env vars. Variables declared in the build fragment but absent from
wrangler.jsonc.
Running it
Section titled “Running it”notewright doctorbun run doctor # the convenience script in a scaffolded appAdd --check-remote to also query the remote d1_migrations table via Wrangler
and compare applied migrations against the local migration files:
notewright doctor --check-remoteWithout --check-remote, doctor makes no network calls.
Requires Bun
Section titled “Requires Bun”The notewright CLI bin carries a #!/usr/bin/env bun shebang because it imports
your TypeScript entry directly. The composed entry transitively imports agents
and cloudflare: modules that plain Node cannot load, so doctor stubs those
behind a Bun plugin before the dynamic import (it never executes a request). You
must have Bun installed; Node-only environments cannot run doctor.
When to run it
Section titled “When to run it”- After composing your providers, to confirm the bindings and migrations line up.
- Before every deploy, to catch configuration drift.
- After changing Durable Object bindings or migrations in
wrangler.jsonc.
Because wrangler.jsonc is the canonical source for bindings and migrations,
doctor is how you confirm your composed code and your configuration agree before
Cloudflare ever sees them.