Implementation:20000419 Fauxnix runFacade
| Knowledge Sources | |
|---|---|
| Domains | Facade, Bash_Argv_Contract, Agent_Integration |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
Concrete bash.exe-compatible facade entry that parses the bash argv contract (-c/-lc/-l -c/marker session), adapts Claude Code harness scaffolding, and executes commands through fauxnix in one-shot or persistent marker-session mode.
Description
The runFacade function (src/facade.ts) is the entry point when the built bash.exe launcher is invoked. It implements the bash process contract:
- --version: prints the GNU bash version line identifying fauxnix (disclosure rule from the RFC).
- parseDashC(argv): accepts combined -c/-l/-i/-s/-r options and -- separator; returns { script?, positionals } or null.
- -c one-shot: if no trailing positionals, attempts tryClaudeCodeAdapter; otherwise runOneShot (sets $0/$1.. via set -- then runs the script).
- no -c: runMarkerSession reads stdin chunks delimited by <bash-input>...</bash-input>, runs each in the resident session, and answers with output plus <bash-exit>N</bash-exit>.
runScript is the shared helper: translateCommandList(parseCommand(script), EXECUTE_TRANSLATION) → session.run. FAUXNIX_FACADE_TRACE enables diagnostic argv/stdin logging. Exit codes follow bash (2 for syntax errors, 127 for not-found).
Usage
Invoked by the built bash.exe launcher when Claude Code's built-in Bash tool runs a command. The facade is experimental (fauxnix install --claude-shell).
Code Reference
Source Location
- Repository: fauxnix
- File: src/facade.ts
- Lines: runFacade L211-239; parseDashC L184-209; runOneShot L108-132; runMarkerSession L145-177; runScript L25-36; bashQuote L38-40; trace L135-143; VERSION_LINE L22-23; MARKER_RE L20
Signature
export async function runFacade(argv: string[]): Promise<number>;
function parseDashC(argv: string[]): { script?: string; positionals: string[] } | null;
async function runOneShot(session: FauxnixSession, script: string, positionals: string[]): Promise<number>;
async function runMarkerSession(session: FauxnixSession): Promise<number>;
async function runScript(session: FauxnixSession, script: string): Promise<{ stdout: string; stderr: string; exitCode: number }>;
Import
import { runFacade } from './facade.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| argv | string[] | The facade process argv (e.g. ['-c', 'ls -la']) | |
| stdin | stream | Marker-session input when no -c flag |
Outputs
| Name | Type | Description |
|---|---|---|
| (return) | Promise<number> | Process exit code (0 ok, 2 syntax, 127 not-found) |
| stdout/stderr | string | Written to process.stdout/process.stderr |
Usage Examples
One-Shot (-c)
import { runFacade } from './facade.js';
process.exitCode = await runFacade(['-c', 'ls -la | head -5']);
Persistent Marker Session
// stdin: <bash-input>pwd</bash-input><bash-input>echo hi</bash-input>
process.exitCode = await runFacade([]);
// stdout per block + <bash-exit>0</bash-exit>
Related Pages
Implements Principle
- Principle:20000419_Fauxnix_Bash_Argv_Contract
- Principle:20000419_Fauxnix_Harness_Scaffolding_Adaptation