Skip to content

CLI (`bynk` driver)

The bynk driver is the developer front-end — it links the compiler pipeline in-process and orchestrates the Node toolchain (bynk is to bynkc as cargo is to rustc). A fresh cargo install bynk is self-contained: it compiles without a separately-installed bynkc. This page is the argument and exit-code reference for its subcommands. The pure-pipeline binary bynkc (compile, check, fmt, test) survives for CI and direct use.

bynk <command> [options]
CommandWhat it does
bynk doctorCheck whether your machine is ready to compile, test, and deploy.
bynk newScaffold a new, runnable project.
bynk devBuild the project and serve it locally with wrangler dev.

Scaffold a new project: a complete, runnable single-context HTTP service you can serve immediately with bynk dev. See the guide Start a new project for a worked walkthrough.

bynk new <PATH> [--name NAME]
ArgumentDefaultMeaning
PATH(required)Directory to create for the new project (e.g. hello or ./hello). Parent directories are created.
--name NAMEPATH’s final componentProject name / context identifier. Must be a legal Bynk identifier (a letter followed by letters, digits, or underscores — no dashes or dots).

What it writes

<PATH>/
├── bynk.toml # [project] name/version + optional [paths] include/exclude
├── .gitignore # /.bynk
└── src/
└── <name>.bynk # context <name> — a GET "/" HTTP service

Behaviourbynk new is pure, offline file-writing: it shells nothing, compiles nothing, and reads no network, so it works before bynkc, Node, or wrangler are installed.

  1. Derive the project name from PATH’s final component (or --name) and validate it as a legal Bynk identifier — both [project] name and the starter’s context use it.
  2. Refuse to clobber: if the target exists and is non-empty, fail before writing anything. An empty directory is fine; VCS/OS cruft (.git, .gitignore, .DS_Store, …) doesn’t count as non-empty.
  3. Write the scaffold and print next steps (cd <path> && bynk dev).

Exit code0 on a written scaffold. A non-empty target or a name that isn’t a legal identifier exits non-zero, touching nothing.

Notes

  • bynk new never overwrites a file it didn’t create, and never runs git init or writes outside the project — the scaffold drops cleanly into an existing repository.
  • The .gitignore covers only /.bynk, the build directory bynk dev writes (compiled workers and local wrangler state).

Build the project and serve it locally — one step in place of the manual bynkc compile + cd + wrangler dev recipe. See the guide Run your project locally for a worked walkthrough.

bynk dev [PATH] [--context NAME] [--inspect] [--inspect-port N] [-- <wrangler args>]
ArgumentDefaultMeaning
PATH.A directory inside the project. The root is found by walking up for bynk.toml.
--context NAMEWhich context’s worker to serve, for multi-context projects. Accepts the dotted name (a.b) or its worker-directory form (a-b).
--inspectoffServe with the V8 inspector enabled (wrangler dev --inspector-port) so a JavaScript debugger can attach. Breakpoints set in .bynk sources resolve through the emitted source maps, composed into the worker bundle. Prints the inspector URL on start.
--inspect-port N9229Inspector port for --inspect.
-- <wrangler args>Everything after -- is forwarded to wrangler dev verbatim (e.g. -- --port 8788).

Behaviour

  1. Locate the project root and read [paths] include.
  2. Pre-flight the deploy capability (bynkc, Node, wrangler) exactly as doctor does; a missing required tool fails here, before any build, with doctor’s remedy text.
  3. Compile to the managed .bynk/dev/ build directory (gitignored automatically; the workers/ tree is cleared before each build).
  4. Select the worker: one context is served automatically; --context chooses among several; an ambiguous project fails and lists the available contexts.
  5. Run wrangler dev from inside the selected worker directory, in local mode (Miniflare) — no namespace provisioning is needed and wrangler.toml is served untouched.

Exit code — On a successful hand-off, bynk dev exits with wrangler’s own exit code (a clean Ctrl-C stop is a 0). A pre-flight or build failure exits non-zero before serving.

Notes

  • bynk dev provisions nothing and never edits wrangler.toml. Real namespaces and deployment are a separate, manual step — see Target Cloudflare Workers. There is no --remote flag; reach remote dev, if you must, via bynk dev -- --remote.
  • wrangler is resolved with the same provenance ordering as doctor (project-local node_modules/.binPATHnpx). An npx resolution is surfaced as a notice — it downloads on first use.

Survey the toolchain — grouped by capability — and print the exact remedy for anything missing. Documented in full in the guide Check your environment with bynk doctor.

bynk doctor [PATH] [--only CAPABILITY] [--strict] [--format human|short|json]
ArgumentDefaultMeaning
PATH.Project directory, for project-local node_modules/.bin resolution.
--only CAPABILITYScope the check — and the exit code — to one of compile, test, deploy, editor, build.
--strictTreat every warning (optional gaps, npx provisionability, minor skew) as a failure. For CI.
--formathumanhuman is a grouped table; short and json are the stable scriptable surface.

Exit code — Bare bynk doctor is informational: it exits 0 unless bynkc itself is unusable. --only <capability> gates on that capability; --strict fails on any warning.