bynk/lib.rs
1//! `bynk` — the Bynk driver.
2//!
3//! A thin orchestrator over the `bynkc` compiler and the Node toolchain:
4//! `bynk` is to `bynkc` what `cargo` is to `rustc`. The compiler stays pure
5//! (compile / check / fmt / test); environment orchestration — "is `wrangler`
6//! installed", "is your machine ready" — lives here (ADR: introduce the `bynk`
7//! driver).
8//!
9//! v0.46 ships the first command, [`doctor`], an upfront environment check. The
10//! crate is deliberately split into single-concern modules (per ADR 0060):
11//!
12//! - [`probe`] — the portable detection primitive (presence + version +
13//! provenance), backed by the `which` crate so it is not Unix-only.
14//! - [`compiler`] — locate `bynkc` (override → PATH → sibling-of-`bynk`) and
15//! report driver↔compiler version skew.
16//! - [`doctor`] — the capability model, the checks, and the exit-code contract.
17//! - [`report`] — render a [`doctor::Report`] as a human table, `--format
18//! short`, or `--format json`.
19//! - [`new`] — scaffold a new project (offline file-writing; no toolchain).
20//! - [`dev`] — build a project and serve it locally with `wrangler dev`.
21//! - [`check`] / [`fmt`] — type-check / format in-process (v0.138, #487).
22//! - [`test`](mod@test) — delegate to the driver-resolved `bynkc` (v0.138, #487).
23//! - [`diagnostics`] — shared flatten-then-delegate rendering for in-process
24//! compiles; [`shell`] — shelling the resolved `bynkc`.
25
26pub mod check;
27pub mod cli;
28pub mod compiler;
29pub mod deploy;
30pub mod dev;
31pub mod diagnostics;
32pub mod doctor;
33pub mod explain;
34pub mod fmt;
35pub mod new;
36
37// The shared detection probe (Wave 5 §5.4, findings #40/#72) moved down into
38// `bynk-driver` — `bynkc` needs it too (replacing its old `tool_exists`
39// PATH-only check), and `bynk-driver` is the crate both binaries already
40// depend on (`bynk` cannot depend on `bynkc`, and vice versa). Re-exported
41// here so every `crate::probe`/`bynk::probe` path in this crate resolves
42// unchanged.
43pub use bynk_driver::probe;
44pub mod report;
45pub mod shell;
46pub mod test;
47pub mod workers;
48
49/// The driver's own version, from Cargo. Compared against the resolved
50/// `bynkc`'s version to detect skew ([`compiler::Skew`]).
51pub const DRIVER_VERSION: &str = env!("CARGO_PKG_VERSION");