Skip to main content

Module mode

Module mode 

Source
Expand description

Compatibility Mode resolution.

Per plan.md AD-004 and spec.md FR-021..FR-023:

Resolves the CompatibilityMode for an invocation once at startup at zero per-line cost. Precedence (highest first):

  1. Explicit --no-strict / --no-moreutils-compat flag → Default
  2. Explicit --strict / --moreutils-compat flag → Strict
  3. RUSTY_TS_STRICT env var (1/true/yes = on; anything else = off)
  4. argv[0] basename auto-detect: ts (or ts.exe stripped on Windows) → Strict
  5. Default

Encoded as a single pure function resolve(...) so the precedence is testable in isolation (HINT-002 — the precedence ladder lives in exactly one place).

Enums§

CompatibilityMode
The resolved compatibility-mode posture for the invocation.
ExplicitChoice
Explicit user choice from the CLI flag layer.

Functions§

argv0_basename
Extract the argv[0] basename, stripping a .exe extension on Windows.
resolve
Resolve the compatibility mode from the three inputs.