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