ReviewOS

home-lang/home

feat(runtime): add configurable zig-js repository-tool runner

#170
Closed chris opened this 9 days ago ·
9 days ago

Goal

Provide a native Home runner for repository JavaScript and TypeScript utilities, with zig-js as the default engine and system JavaScriptCore retained as a configurable differential backend.

Architectural boundary

Home's production runtime uses a large private/generated WebKit/Bun ABI and cannot be switched to zig-js's deliberately pinned public/private subsets. Repository tooling therefore needs a narrow runner that:

  • uses Home's own TypeScript parser/emitter;
  • links only the JavaScriptCore-shaped public C API;
  • defaults to ~/Code/Libraries/zig-js/zig-out/lib/libzig-js.a;
  • accepts -Dtool-js-engine=zig-js|jsc;
  • never delegates execution to Bun, Node, or Python.

Required host surface

  • console and process.argv/env/cwd/platform/exit
  • synchronous UTF-8 file read/write/existence checks
  • synchronous subprocess capture with exit code/stdout/stderr
  • stable Home.engine reporting for differential tests

Acceptance criteria

  • home-tool eval compiles TypeScript through Home and evaluates it.
  • home-tool run executes standalone .ts/.js files.
  • zig-js and JSC builds pass the same smoke fixture.
  • Missing zig-js archives and unknown engine selections fail clearly.
  • Runtime/ABI boundary and commands are documented.
  • Add module discovery/loading when migrated tools require imports.
  • Expand host APIs only from concrete migration needs.

Verification

Run zig build home-tool-smoke -Dtool-js-engine=zig-js -Dzig-js-root=$HOME/Code/Libraries/zig-js and the same step with -Dtool-js-engine=jsc.

9 days ago

Implemented on main in ac53f50.

Verification completed:

  • home-tool-smoke passes with -Dtool-js-engine=zig-js.
  • The same fixture passes with -Dtool-js-engine=jsc.
  • The installed ~/Code/Home/lang/zig-out/bin/home-tool is built against zig-js.
  • The first downstream migration landed as zig-utils/zig-js@45cc184: a real TypeScript generator runs through Home on both engines and reproduces its checked JSON byte-for-byte.

The issue remains open for its intentionally deferred module-loading and concrete host-surface expansion items.

9 days ago

Completed in 2e5791e and consumed by zig-js through f3a0c53.

Home.spawnSync now supports cwd, environment overlay/replacement, timeoutMs, and timedOut. The repository-tool runner uses zig-js by default and supports the configurable JSC engine. Both engine builds passed smoke tests and all migrated zig-js gates, corpus drivers, ABI audits, benchmark self-tests, and the 12/12 release compatibility gate. The consumer inventory pins this exact Home revision.

Sign in to comment on this issue.