Expand description
bynk-driver — the shared front-end of the bynkc and bynk CLIs (#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 output::write_compiled_file;pub use output::write_output;
Modules§
- coverage
bynkc test --coverage— remap V8 line coverage onto.bynksource.- discovery
- Walking a directory tree for
.bynkfiles and reading them — the driver’s side ofCompileOptions.sources(#1077, R2.3/T0.7 residue). - output
- Writing a compiled project’s output to disk.
- probe
- The shared detection probe: presence + version + provenance.
- schema_
lock - Reading and atomically writing
bynk.schema.lock— the driver’s side ofCompileOptions::schema_registry(#1078, R2.3/T0.7 residue). - test_
json - v0.59: the
bynkc test --format jsonresult model, plus the parser that folds the runner’s NDJSON event stream into it. - test_
runner bynkc test/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 frombynkc— bothbynkcandbynkneed one implementation instead of two.
Structs§
- FmtArgs
- The
fmtsubcommand’s arguments, flattened by bothbynkc::cliandbynk::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§
- 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 (bynk_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
bynk_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 (likebynk_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 thebynkc test --format jsoncompile-error document, whosediagnosticsthe VS Codebynkcproblem-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. - run_
check - The
checkcommand body shared bybynkc checkandbynk 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::compile_with_warnings.shortselects the one-line--format shortrendering.progprefixes messages (bynk: …). - run_fmt
- The
fmtcommand body shared bybynkc fmtandbynk 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.