Skip to main content

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//! - [`sweep`] — stopping what `bynk dev`'s wranglers leave running (#1742).
26//! - `job` — on Windows, the job object that stops a wrangler's whole process
27//!   tree (#1762).
28
29pub mod check;
30pub mod cli;
31pub mod compiler;
32pub mod deploy;
33pub mod dev;
34pub mod diagnostics;
35pub mod doctor;
36pub mod explain;
37pub mod fmt;
38#[cfg(windows)]
39pub mod job;
40pub mod new;
41
42// The shared detection probe (Wave 5 §5.4, findings #40/#72) moved down into
43// `bynk-driver` — `bynkc` needs it too (replacing its old `tool_exists`
44// PATH-only check), and `bynk-driver` is the crate both binaries already
45// depend on (`bynk` cannot depend on `bynkc`, and vice versa). Re-exported
46// here so every `crate::probe`/`bynk::probe` path in this crate resolves
47// unchanged.
48pub use bynk_driver::probe;
49pub mod report;
50pub mod shell;
51pub mod sweep;
52pub mod test;
53pub mod workers;
54
55/// The driver's own version, from Cargo. Compared against the resolved
56/// `bynkc`'s version to detect skew ([`compiler::Skew`]).
57pub const DRIVER_VERSION: &str = env!("CARGO_PKG_VERSION");