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 runInstall

From Leeroopedia
Knowledge Sources
Domains Install, Harness_Config, Agent_Integration
Last Updated 2026-10-26 00:00 GMT

Overview

Concrete harness-config patcher that resolves the spawn-safe launcher once and writes mcpServers.fauxnix (JSON) or [mcp_servers.fauxnix] (TOML) into the selected agent harness config with idempotent, upgrade-safe logic.

Description

The runInstall function (src/install.ts) parses harness flags (--claude, --codex, --opencode, --kimi, --qwen), resolves the spawn-safe launcher tuple once, and dispatches to the per-harness patcher:

  • patchMcpServers (Claude, Kimi, Qwen): reads the JSON config, validates mcpServers is an object, and writes mcpServers.fauxnix = { command, args }. Detects legacy bare-shim entries and upgrades them to the absolute launcher.
  • patchCodex: reads/writes the TOML config at ~/.codex/config.toml, appending [mcp_servers.fauxnix] or upgrading the legacy command = "fauxnix" table via upgradeCodexLegacyTable.
  • patchOpenCode: writes mcp.fauxnix (or mcp.servers.fauxnix) with { type: 'local', command: [node, entry, 'mcp'] }.

Each patcher is idempotent: an already-correct config is left untouched; a legacy fauxnix entry is upgraded; a hand-written non-fauxnix entry is never clobbered. installHarness dispatches by name; readJsonObject/writeJson/writeText are shared I/O helpers.

Usage

Run via fauxnix install --<harness>. The CLI prints the status lines; process.exitCode is set to 1 on any failure.

Code Reference

Source Location

  • Repository: fauxnix
  • File: src/install.ts
  • Lines: runInstall L54-78; installHarness L113-126; patchMcpServers L177-213; patchCodex L240-272; patchOpenCode L215-238; patchQwen L128-175; upgradeCodexLegacyTable L291-300

Signature

export type InstallOptions = { home?: string; cwd?: string; env?: NodeJS.ProcessEnv };
export type InstallReport = { lines: string[]; ok: boolean };
export type HarnessName = 'claude' | 'codex' | 'opencode' | 'kimi' | 'qwen';

export function runInstall(argv: string[], opts?: InstallOptions): InstallReport;

function installHarness(name: HarnessName, ctx: { home: string; env: NodeJS.ProcessEnv }, launch: McpLaunchTuple): { ok: boolean; line: string };

Import

import { runInstall, type HarnessName } from './install.js';

I/O Contract

Inputs

Name Type Required Description
argv string[] Yes Harness flags, e.g. ['--claude', '--codex']
opts.home string No Override os.homedir() for the config path

Outputs

Name Type Description
(return) InstallReport lines (status messages) and ok (all patches succeeded)

Usage Examples

Install for Claude

import { runInstall } from './install.js';

const report = runInstall(['--claude']);
for (const line of report.lines) console.log(line);
// → "claude: created ~/.claude.json" or "claude: patched ... (added mcpServers.fauxnix)"
if (!report.ok) process.exitCode = 1;

Install for Multiple Harnesses

const report = runInstall(['--claude', '--codex', '--qwen']);
// Patches all three configs in one run

Related Pages

Implements Principle

Requires Environment

Page Connections

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