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/precompilescript reads to find the runningharnbinary path. Set fromstd::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
.harndirectory-walk driver for each source file.