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.

The .harn port owns argv parsing, walking, –out path mirroring, and the per-file progress and summary render. The actual parse, typecheck, and compile work stays in Rust behind a command-specific internal mode: the script spawns harn precompile <single-file> per source with HARN_PRECOMPILE_INNER=1 so the child compiles one source instead of recursing back into the directory walker.

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).

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.
PRECOMPILE_INNER_ENV

Functions§

run
run_inner_compile
Rust compiler entrypoint used by the .harn directory-walk driver for each source file.