Skip to main content

Module precompile

Module precompile 

Source
Expand description

harn precompile — dispatches the directory-walk + per-file fanout to the embedded cli/precompile.harn script (see harn#2313 / W13).

The .harn port owns argv parsing, walking, –out path mirroring, and the per-file progress + summary render. The actual parse + typecheck

  • compile work stays on the legacy Rust path: the script spawns harn precompile <single-file> per source with HARN_CLI_IMPL=rust so the child resolves to run_legacy instead of recursing back into the wedge.

Phase deferrals: harn time and harn bench (the other two W13 commands) stay Rust-only in this PR — both depend on in-process VM thread-locals (LLM trace summary, profile spans, getrusage CPU samples) that don’t survive a spawn_captured subprocess boundary without inventing a new child-binary emit protocol. The W13 ticket description presumed an --internal-phase-emit protocol on harn run that doesn’t actually exist in the current codebase; the preconditions for porting each are filed as #2348 (harn bench--emit-summary-json) and #2350 (harn time--emit-phase-json).

HARN_CLI_IMPL=rust keeps the legacy Rust impl reachable for the parity-snapshot harness (#2299) and the C1 LOC ratchet (#2314) until the .harn impl is the default everywhere.

Constants§

PRECOMPILE_BIN_ENV
Env var the embedded cli/precompile script reads to find the running harn binary path. Set from std::env::current_exe() so the child invocation is robust to $PATH ordering / test sandboxes.

Functions§

run
run_legacy
Legacy Rust impl, kept behind HARN_CLI_IMPL=rust for the parity-snapshot harness and as the inner compiler the .harn port dispatches each per-file child to. The C1 ratchet (#2314) removes this once the .harn impl is the production default everywhere.