Skip to content

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.

  • 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> --remote command to fix them.
  • Required env vars. Variables declared in the build fragment but absent from wrangler.jsonc.
Terminal window
notewright doctor
bun run doctor # the convenience script in a scaffolded app

Add --check-remote to also query the remote d1_migrations table via Wrangler and compare applied migrations against the local migration files:

Terminal window
notewright doctor --check-remote

Without --check-remote, doctor makes no network calls.

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.

  • 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.