Skip to content

CLI (`bynkc`)

The Bynk compiler

Run bynkc <command> --help for the authoritative help text.

A diagnostic’s severity decides whether it fails a build (v0.89). An Error rejects the program: bynkc compile/check exit non-zero and produce no output. A Warning is surfaced but does not fail the build: these commands still succeed (exit 0) and emit their output, with warnings reported alongside. The build-failure gate counts error-severity diagnostics only. See the normative rule in the specification and the diagnostic index (warning-severity codes are marked (warning)).

Type-check a .bynk file or project without writing output

bynkc check <INPUT> [--format <FORMAT>]
ArgumentRequiredDefaultDescription
INPUTyesInput .bynk file or project root
--formatnorichDiagnostic output format. rich (default) is the ariadne source-context rendering; short emits one terse path:line:col: severity[category]: message line per diagnostic, for tooling (the VS Code problem-matcher, CI, scripts) (one of: rich, short)

Compile a .bynk file (single-file commons) to a TypeScript file, or a directory project to a tree of TypeScript files mirroring the source layout

bynkc compile <INPUT> --output <OUTPUT> [--target <TARGET>] [--platform <PLATFORM>] [--emit <EMIT>]
ArgumentRequiredDefaultDescription
INPUTyesInput .bynk file, or directory project root
--output (-o)yesOutput .ts file (for single-file input) or output root directory (for project input)
--targetnobundleBuild target. bundle (default) produces a single deployment unit; workers produces one Cloudflare Worker per context with Service Binding plumbing (v0.8) (one of: bundle, workers)
--platformnocloudflareDeploy platform selecting the bynk surface binding (v0.17). A new axis, distinct from --target: cloudflare (default), node, or browser (the in-browser playground binding; Bundle topology only) (one of: cloudflare, node, browser)
--emitnotsArtefact language (v0.108). ts (default) writes typed TypeScript; js writes the same modules with types stripped — a JavaScript artefact that runs with no tsc in the loop (ADR 0137) (one of: ts, js)

Format .bynk source files in place. Passing - reads from stdin and writes to stdout

bynkc fmt [INPUTS] [--check] [--indent <INDENT>] [--indent-width <N>] [--max-line-width <COLUMNS>] [--trailing-comma] [--no-trailing-comma] [--no-config]
ArgumentRequiredDefaultDescription
INPUTSnoFiles to format. Use - for stdin → stdout
--checknoCheck formatting without writing changes. Exits non-zero if any file is not already canonical
--indentnoIndent with tabs or spaces. Defaults to the project’s [fmt] indent, or tabs (one of: tab, spaces)
--indent-widthnoSpaces per nesting level, with spaces indentation. Defaults to the project’s [fmt] indent_width, or 2. Rejected when the effective indentation is tabs, where it would have no effect
--max-line-widthnoSoft target line width in columns. A construct wider than this wraps across lines where the grammar allows; one with no break point in it (a long string literal) is left long. Defaults to the project’s [fmt] max_line_width, or 100
--trailing-commanoEmit a trailing comma in multi-line records, sums, list literals and exports clauses. Overrides a project’s trailing_comma = false, and overrides an earlier --no-trailing-comma
--no-trailing-commanoOmit the trailing comma in multi-line records, sums, list literals and exports clauses. (Parameter and argument lists never carry one — the grammar rejects it — regardless of this flag.)
--no-confignoIgnore the project’s bynk.toml [fmt] section and format to the canonical style, plus whatever flags this run passes. For a script that wants one fixed rendering whatever project it is pointed at

Discover and run test declarations in a project. Compiles the project (including all generated tests/*.test.ts modules), then invokes Node.js on the aggregated runner script. Requires tsc and node to be on PATH

bynkc test [INPUT] [--output <OUTPUT>] [--no-run] [--format <FORMAT>] [--inspect] [--seed <SEED>] [--case <NAME>] [--coverage]
ArgumentRequiredDefaultDescription
INPUTno.Input project root directory. Defaults to the current directory
--output (-o)noWhere to write compiled TypeScript test runner modules. Defaults to <input>/out
--no-runnoSkip the runner invocation. With --format rich this emits the generated test files (for CI flows that drive the runner separately); with --format json it emits a discovery document listing every suite and case (each outcome: "discovered") without running them — a pure compile, no tsc/Node
--formatnorichOutput format. rich (default) is the grouped ✓ / ✗ human output; json is a single pinned JSON document of results, for tooling (one of: rich, json)
--inspectnoCompile a debug build and launch the test runner under Node’s inspector (node --inspect-brk), printing the inspector URL for a JavaScript debugger to attach. The emitted .ts runs directly under Node’s line-preserving type-stripping, so source maps resolve breakpoints back to .bynk. Requires Node ≥ 22.18 (or ≥ 23.6 unflagged). Does not run tsc
--seednoThe root seed for generative property tests, as hex (e.g. 0x5f3a). A failing property prints the seed it used; re-running with --seed <hex> reproduces that run byte-for-byte. Omitted, each run draws a fresh random seed
--casenoRun only test cases whose name matches <name>, skipping the rest — the filter behind the editor’s per-case ▷ Run Test lens. Matches by exact case name across suites; omitted, every case runs. No effect with --no-run (discovery lists all cases regardless)
--coveragenoAfter the suite runs, report statement/line coverage attributed to .bynk source (a rich summary table, or a coverage block in --format json). Requires the tsc → node path: incompatible with --inspect and --no-run, and errors if only tsx is available