Lines 13-56javascript
13 * and the gateway forwards it to OpenAI as-is.
15 * TOML handling is deliberately line-based and conservative: the file is never parsed and
16 * re-serialized (which would reformat user content). We only (a) manage ONE top-level
17 * `model_provider = …` line (tagged with a trailing `# vachi-codex:managed` comment) and
18 * (b) append ONE clearly marked BEGIN/END block at the end of the file. Everything else is
19 * preserved byte-for-byte, and `disable` restores the exact prior bytes.
22 * npx vachi-codex enable (login if needed + configure Codex)
23 * npx vachi-codex login re-run the browser login only
24 * npx vachi-codex status show current configuration
25 * npx vachi-codex doctor read-only health checks
26 * npx vachi-codex disable restore config.toml (keeps credentials)
27 * npx vachi-codex disable --purge ...and delete stored credentials/state
31const fs = require('fs');
32const os = require('os');
33const path = require('path');
34const http = require('http');
35const crypto = require('crypto');
36const readline = require('readline');
37const { spawn } = require('child_process');
38
HighChild Process
Package source references child process execution.
bin/vachi-codex.jsView on unpkg · L36 39const GATEWAY_URL = process.env.VACHI_GATEWAY_URL || 'https://gateway.vachiai.com';
40const SIGNIN_URL = process.env.VACHI_SIGNIN_URL || 'https://vachiai.com/cli-signin';
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
bin/vachi-codex.jsView on unpkg · L33 41const HEADER_NAME = 'x-vachi-id';
42const LOGIN_TIMEOUT_MS = 5 * 60 * 1000;
43const BACKUP_KEEP = 20;
45const HOME = os.homedir();
46const VACHI_DIR = path.join(HOME, '.vachi');
47const CRED_FILE = path.join(VACHI_DIR, 'credentials.json');
48const STATE_FILE = path.join(VACHI_DIR, 'state', 'codex.json');
49const BACKUP_DIR = path.join(VACHI_DIR, 'backups');
50const CODEX_DIR = path.join(HOME, '.codex');
51const CONFIG_FILE = path.join(CODEX_DIR, 'config.toml');
52const AUTH_FILE = path.join(CODEX_DIR, 'auth.json');
54// Managed-edit markers. The BEGIN/END pair fences the appended provider table;
55// the :managed tag marks the single top-level model_provider line we own.
56const BLOCK_BEGIN = '# >>> vachi-codex BEGIN — managed by `npx vachi-codex`; do not edit by hand.';