Implementation:20000419 Fauxnix buildLauncher
| Knowledge Sources | |
|---|---|
| Domains | Launcher, Node_SEA, Windows |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
Concrete launcher builder that produces a bash.exe executable — a copy of the active node.exe with the prebuilt facade bundle injected via Node SEA + postject, or a GA stub with a routing config — so a harness can point its built-in Bash tool at fauxnix.
Description
The buildLauncher function (src/facade-launch.ts) creates or rebuilds the experimental bash.exe launcher. It resolves the launcher directory (FAUXNIX_FACADE_DIR override or %LOCALAPPDATA%/fauxnix/bin), computes launcherInputs (package version, node version, node path, bundle path, bundle SHA-256, optional stub path), and checks staleness via launcherMatches against a bash.exe.launcher.json marker. If up-to-date, it returns the existing path. Otherwise:
- GA stub path (FAUXNIX_FACADE_STUB): copies the stub to bash.exe and writes a fauxnix-launch.json routing config ({ node, bundle }).
- SEA path (default): writes a sea-config, runs node --experimental-sea-config, copies node.exe to bash.exe, and injects the SEA blob via postject with the sentinel fuse. Roughly 85 MB per install — the documented experimental-phase trade.
A failed rebuild removes the stale marker first so a partially replaced launcher is never claimed as current. launcherStatus reports the installed/up-to-date state for fauxnix doctor.
Usage
Called by installClaudeShell (fauxnix install --claude-shell) and by launcherStatus (doctor). The resulting bash.exe is pointed at by the CLAUDE_CODE_GIT_BASH_PATH user env var.
Code Reference
Source Location
- Repository: fauxnix
- File: src/facade-launch.ts
- Lines: buildLauncher L121-173; launcherInputs L55-76; launcherMatches L86-97; launcherStatus L99-118; launcherDir L32-37
Signature
export interface LauncherStatus {
dir: string; exePath: string; installed: boolean; upToDate: boolean;
packageVersion: string; nodeVersion: string;
}
export function launcherDir(env?: NodeJS.ProcessEnv): string;
export function launcherStatus(env?: NodeJS.ProcessEnv): LauncherStatus;
export async function buildLauncher(env?: NodeJS.ProcessEnv): Promise<string>;
Import
import { buildLauncher, launcherStatus, launcherDir } from './facade-launch.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| env | NodeJS.ProcessEnv | No | Reads FAUXNIX_FACADE_DIR, FAUXNIX_FACADE_STUB, LOCALAPPDATA/USERPROFILE |
Outputs
| Name | Type | Description |
|---|---|---|
| (return) | string | Absolute path to the built bash.exe |
Usage Examples
Build the Launcher
import { buildLauncher } from './facade-launch.js';
const exePath = await buildLauncher();
// → "C:\Users\me\AppData\Local\fauxnix\bin\bash.exe"
Check Launcher Status (Doctor)
import { launcherStatus } from './facade-launch.js';
const status = launcherStatus();
if (!status.installed) console.log('not installed');
else console.log(status.upToDate ? 'up to date' : 'stale', 'at', status.exePath);