Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:20000419 Fauxnix runCli

From Leeroopedia
Knowledge Sources
Domains CLI, Dispatch
Last Updated 2026-10-26 00:00 GMT

Overview

Concrete CLI dispatcher for the fauxnix command-line tool, routing verbs (translate, mcp, list, check, doctor, install, facade) and executing bare bash-style commands by default.

Description

The runCli function is the primary entry point for the fauxnix CLI. It inspects the first argv token (the "verb") and dispatches to the appropriate subcommand handler. The default verb — when no recognized subcommand is given — joins the argv into a bash command string, parses it, translates it to PowerShell, executes it via a one-shot FauxnixSession, and writes GNU-style stdout/stderr plus the exit code. It also handles runCheck (PowerShell environment probe) and runDoctor (check + diagnostics report) as related verbs.

Usage

Import this function when you need to drive fauxnix from a Node process entry point. The process entry (src/index.ts) guards the Node version and calls runCli(process.argv.slice(2)). Use it to execute a bash command directly, start the MCP server, run diagnostics, or install a harness config.

Code Reference

Source Location

  • Repository: fauxnix
  • File: src/cli.ts
  • Lines: L44-136 (runCli), L138-143 (runDoctor), L145-213 (runCheck)

Signature

export async function runCli(argv: string[]): Promise<void>

export async function runCheck(): Promise<boolean>

async function runDoctor(): Promise<void>

Import

import { runCli, runCheck } from './cli.js';

I/O Contract

Inputs

Name Type Required Description
argv string[] Yes Process argv tokens after the node binary (e.g. process.argv.slice(2))

Outputs

Name Type Description
stdout string GNU-style command output written to process.stdout
stderr string bash-style error text written to process.stderr
exitCode number Set on process.exitCode from the executed command's exit code

Usage Examples

Default Verb: Execute a Bash Command

import { runCli } from './cli.js';

// "ls -la | head -5" → parsed, translated to PowerShell, executed natively
await runCli(['ls', '-la', '|', 'head', '-5']);
// process.exitCode reflects the command's exit code

Translate Verb: Show PowerShell Without Executing

await runCli(['translate', 'grep', '-rn', 'foo', '.']);
// Prints the translated PowerShell script to stdout; nothing runs

Check Verb: Verify PowerShell Environment

await runCli(['check']);
// Prints powershell path, version, edition, command count, status

Install Verb: Patch a Harness Config

await runCli(['install', '--claude']);
// Writes the spawn-safe absolute launcher into ~/.claude.json

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment