Expand description
bynk-driver — the front-end of the bynk CLI (#521).
Both binaries expose fmt and check with identical semantics; before
this crate each re-implemented the command bodies (and the project-failure
flattening layer, and the project-rooting rule) as by-hand copies pinned
only by comments and a skip-able parity test. The single implementation
lives here, parameterised by the program name that prefixes messages.
Re-exports§
pub use compile_cmd::BuildArgs;pub use compile_cmd::CliPlatform;pub use compile_cmd::CliProfile;pub use compile_cmd::CliTarget;pub use compile_cmd::CompileArgs;pub use compile_cmd::EmitFormat;pub use compile_cmd::profile_contracts;pub use compile_cmd::project_contracts;pub use compile_cmd::refuse_release_contracts;pub use compile_cmd::refuse_undeployable_project;pub use compile_cmd::run_build;pub use compile_cmd::run_compile;pub use output::write_document;pub use output::write_modules;pub use output::write_modules_for_node;pub use output::write_output;
Modules§
- colour
- When the driver’s human output is coloured, and the few styles it uses.
- compile_
cmd - The
compilecommand body, run bybynk compile(D2/E1, #2998): before this, onlybynkhad it, sobynk compilehad to start abynkprocess. Parameterised by the program name that prefixes messages, likecrate::run_checkandcrate::run_fmt. - contracts_
lock - Reading and atomically writing
bynk.contracts.lock(#2554): the driver’s side ofCompileOptions::contracts_lock, besidecrate::schema_lockand sharing its read and write. - coverage
bynk test --coverage— remap V8 line coverage onto.bynksource.- dev_run
- #2138 (end-to-end testing track §3.5):
bynk test --against dev, thesystemsuites run against a localbynk devthe runner starts itself. - discovery
- Walking a directory tree for
.bynkfiles and reading them — the driver’s side ofCompileOptions.sources(#1077, R2.3/T0.7 residue). - doc_
examples - Doc-comment examples (#2461): a fenced
bynkblock in a doc comment is checked bybynk test, so an example cannot silently fall out of step with the code it documents. One markedbynk testalso runs. - eval
bynk eval(#3585): evaluate a snippet in a project’s context and report the value it ends in.- fix
- #2642:
check --fix— apply the machine-applicable suggestions of a file or project from the command line. - mutate
bynk test --mutate(#3069): check that the suites would notice a small change to the code.- npm_
install - Installing the npm packages a generated build directory lists, with the package manager the user already has (#3350).
- output
- Writing a compiled project’s output to disk.
- probe
- The shared detection probe: presence + version + provenance.
- progress
- #3100: per-context build progress, printed to stderr.
- project
- Multi-file project compilation (v0.3 §3.2 and §3.3, v0.4 §3.5).
- remote
- #2138 (end-to-end testing track §3.5, §3.7, §3.8):
test --against, a run of thesystemsuites against a real runtime. - render
- Bynk’s shared diagnostic-rendering layer.
- schema_
lock - Reading and atomically writing
bynk.schema.lock— the driver’s side ofCompileOptions::schema_registry(#1078, R2.3/T0.7 residue). - smoke
bynk test --smoke(#2658): asystemsuite per context, derived from itsfrom httpservices, so every declared route is exercised on a real runtime without a test written for it.- snapshots
- #2842: the driver’s half of snapshot testing.
- source_
overlay - #2471: an in-memory overlay of unsaved editor buffers for a build.
- strip
- The project-level strip: rewrite a compiled
ProjectOutputfrom TypeScript into a JavaScript artefact (the in-browser track’s first-class JS output, ADR 0137). - test_
filter bynk test --case/--suite(#2273): the set of tests one run executes.- test_
json - v0.59: the
bynk test --format jsonresult model, plus the parser that folds the runner’s NDJSON event stream into it. - test_
runner bynk test’s shared command body (Wave 5 §5.4, findings #40/#72/#20/#21 remainder): compile the project’s test declarations, write them, and run them viatsc → node(falling back totsx), folding the result into the pinnedcrate::test_json::TestRundocument in--format jsonmode. Moved down from the oldbynkccrate.- test_
stream bynk test --format ndjson(#2267, Slice D stage 1): the supported result stream.- tools
- Back-half paydown 1D.5b (#4003, Decision F): the spawning of the external
tools the driver runs, in one place:
tsc,tsx,node,git, and the npm, pnpm, bun and yarn installs. - tsc_
report - #3068: report a
tscfailure on generated TypeScript as a Bynk diagnostic,bynk.codegen.tsc_failed, at the Bynk source the failing line came from.
Macros§
- emsg
eprintln!for a message with anerror:,warning:ornote:label, coloured ascolour::messagedoes when stderr is.
Structs§
- FmtArgs
- The
fmtsubcommand’s arguments, flattened bybynk::cliso the two spell one contract rather than two copies of it (thetest_runner::TestArgspattern, findings #40/#72). Field docs here are the CLI help text for both commands’ flags.
Enums§
- Indent
Kind - How
--indentspells the twoIndentStylevariants. The words match the[fmt] indentkey inbynk.toml, which the language server already reads, so a project states the same choice the same way in either place. - Project
Options Error - Why
try_project_optionscould not produce a usableCompileOptions: either the manifest itself is unreadable (ProjectPathsError), or a well-formed manifest names a project tree that can’t be walked (discovery::DiscoveryError) — #1081 review.
Functions§
- display_
path - #1772: the path a diagnostic names, as a user would type it from the
working directory: the build’s root as the caller spelled it, joined with
the file’s identity path (relative to that root). A relative root is
already relative to the working directory; an absolute one (
bynk devresolves the project root) is shown relative to the working directory when it lies inside it. This matches the pathfmtreports for the same file, so a problem matcher resolving against the working directory finds it. Separators print as/on every platform. - member_
dir - #2207: a member’s directory as the command names it:
root(as the user typed it) joined with the member’s relative path, without.components, so a run at.namespackages/money, not./packages/money. - member_
header - #2207 (decision C): the line that heads one member’s report in a
workspace run,
── packages/money ──, its path as typed from the working directory. - print_
project_ check - Render every diagnostic from a
project::ProjectCheck(finding #64) with the same per-file ariadne contextprint_project_failuregives its own, errors-only list. Unlike that renderer, aProjectCheck’s list can legitimately mix both severities — the unattributed fallback line names its actual severity (crate::render::severity_word) rather thanprint_project_failure’s bare[category]: message(silently correct only because that list is errors-only by construction). - print_
project_ check_ short print_project_checkviaproject_check_short_lines.- print_
project_ failure - Render a project build failure with per-file ariadne context, exactly as single-file mode had rich rendering. Unattributed (project-level) errors keep the plain form.
- print_
project_ failure_ short - The project-failure analogue of
crate::render::print_errors_short: each attributed error is positioned against its file’s snapshot; an unattributed (project-level) error falls back to<severity>[<category>]: <message>. - print_
project_ warnings - v0.89 (ADR 0117): print a successful build’s non-failing warnings, with
real per-file ariadne context now that a successful build’s
snapshots(mirroringProjectFailure::snapshots) make that possible. A warning whose source isn’t attributable (or doesn’t fit the snapshot) falls back to the plainwarning[<category>]: <message>form. - print_
project_ warnings_ short print_project_warnings’s--format shortanalogue: onepath:line:col: warning[category]: messageline per warning, falling back towarning[category]: messagewhen unattributed. Strictly one line per warning throughout (likecrate::render::render_errors_short, this mirrors the VS Code problem-matcher’s contract), so — unlikeprint_project_warnings— finding #47 doesn’t reach this one.- project_
check_ short_ lines print_project_check’s--format shortanalogue, mirroringproject_failure_short_lines.- project_
failure_ short_ lines - The string form of
print_project_failure_short: onepath:line:col: severity[category]: messageline per attributed error (an unattributed project-level error falls back toseverity[category]: message). Backs both the printer above and thebynk test --format jsoncompile-error document, whosediagnosticsthe VS Codebynkproblem-matcher re-parses — eachVecentry is exactly one line by that contract, so unlike the other renderers in this file this one deliberately does not grow note/label continuation lines (finding #47): doing so would break a machine consumer that re-parses every entry as a single diagnostic line. - project_
options - Root a directory project the way every project command should (#46): a
bynk.tomlor asrc/subdir selects project mode, whose flat[paths] include/excludelayout (v0.113, DECISION S) defaults to the conventional roots that exist (src,tests) or the project root itself; otherwise the legacy single-tree where<dir>is itself the root.check,compile,test, anddevall route through this so the conventional layout works the same from any of them. - project_
source_ files - The
.bynkfilestry_project_optionsreads for the directoryinput, sorted: whatcheck,testandcompilesee. #1753:fmtexpands a directory argument through this, sofmt --check <dir>andcheck <dir>cover the same files. - run_
check - The
checkcommand body run bybynk check: a directory routes throughproject::check_project(finding #64 — non-bailing, so a structural error anywhere does not hide diagnostics elsewhere the waycompile_project’s bail-fastMode::Buildwould), a single file throughbynk_emit::check_with_warnings.shortselects the one-line--format shortrendering.progprefixes messages (bynk: …). - run_fmt
- The
fmtcommand body run bybynk fmt: each input is formatted and rewritten only when it changes;--checkreports non-canonical files without writing;-reads stdin and writes the formatted result to stdout.progprefixes messages (bynk fmt: …). - try_
project_ options project_options, but a malformedbynk.tomlis an error rather than a silent fall-back to the conventional layout — the one input a user hand-edits that the compiler otherwise reads without checking, after which a cascade ofbynk.uses.unknown_targeterrors points at units that plainly exist on disk.- workspace_
at - #2207: if
inputis a workspace root (a directory whosebynk.tomlholds[workspace]), the workspace it loads to, or why it doesn’t. - workspace_
at_ each - #3274:
workspace_at, or, witheach, the workspace--eachstands for: