export interface CliCommandEntry { name: string; aliases?: string[]; usage: string; summary: string; details?: string[]; hidden?: boolean; } export const CLI_COMMANDS: CliCommandEntry[] = [ { name: "init", aliases: ["setup"], usage: "ocx init [--yes]", summary: "Interactive setup for providers and Codex config injection.", }, { name: "setup", aliases: [], usage: "ocx setup [--yes]", summary: "Interactive setup for providers and Codex config injection (alias of init).", }, { name: "start", usage: "ocx start [--port ]", summary: "Start the proxy server and sync models to Codex." }, { name: "stop", usage: "ocx stop", summary: "Stop the proxy and restore native Codex config." }, { name: "restore", aliases: ["eject"], usage: "ocx restore [back]", summary: "Restore native Codex config without stopping the proxy; `restore back` re-points codex at the running proxy.", }, { name: "eject", aliases: [], usage: "ocx eject [back]", summary: "Restore native Codex config without stopping the proxy; `eject back` re-points codex at the running proxy.", }, { name: "recover-history", usage: "ocx recover-history --legacy-openai --yes", summary: "Force all user-message opencodex rows to OpenAI for legacy recovery.", }, { name: "uninstall", aliases: ["remove"], usage: "ocx uninstall", summary: "Remove service/shim/config and restore native Codex.", details: [ "Alias: ocx remove", "Config cleanup requires ownership metadata created by a fresh install; legacy or shared directories are left in place.", ], }, { name: "remove", aliases: [], usage: "ocx remove", summary: "Remove service/shim/config and restore native Codex.", details: [ "Alias of: ocx uninstall", "Config cleanup requires ownership metadata created by a fresh install; legacy or shared directories are left in place.", ], }, { name: "service", usage: "ocx service [install|repair|restart|start|stop|status|uninstall|remove]", summary: "Run as a background service.", details: [ "With no subcommand, installs when absent or repairs/restarts an existing service.", "`restart` aliases `repair`; healthy Windows tasks are reused, while stale definitions may re-register and elevate.", "Use `ocx service status` to see diagnostics and log paths.", ], }, { name: "codex-shim", usage: "ocx codex-shim ", summary: "Auto-start the proxy when `codex` launches.", details: ["Use `remove` as an alias for `uninstall`."], }, { name: "tray", usage: "ocx tray [--json] [--no-start]", summary: "Install and control the Windows status tray icon.", details: [ "The tray starts at Windows login and provides one-click proxy controls.", "Tray start/stop controls the icon only; use its menu to start or stop the proxy.", "--no-start (install only) installs the tray without launching it immediately.", ], }, { name: "ensure", usage: "ocx ensure", summary: "Ensure the proxy is running and Codex config/cache are current." }, { name: "connect", usage: "ocx connect [--management-url ] (--pairing-code-stdin | --admin-token-stdin) [--clients codex,claude] [--management-transport direct|relay] [--catalog-timeout ] [--no-sync]", summary: "Connect this machine to a remote OpenCodex hub without persisting the one-time authority.", details: [ "Status: ocx connect status [--json]", "Rotate or recover: ocx connect rotate (--pairing-code-stdin | --admin-token-stdin) [--json]", "Revoke while connected: ocx connect revoke --admin-token-stdin [--json]", "Machine resources: /api/machine/status, /api/machine/shim, /api/machine/clients, /api/machine/sync, /api/machine/disconnect, and the fixed /api/machine/hub-relay namespace.", "Remote browser self-logout uses /api/session/logout from the GUI; it is distinct from client disconnect and key revocation.", "Credentials are accepted only through stdin; argv and environment credential forms are not supported.", ], }, { name: "disconnect", usage: "ocx disconnect [--keep-catalog] [--json]", summary: "Restore local client state offline and clear the remote-hub connection.", }, { name: "sync", usage: "ocx sync [--restart-codex] [--restart-desktop-app]", summary: "Fetch provider models and inject them into Codex config.", details: [ "After writing the catalog, warns if long-lived Codex app-server processes are still running.", "--restart-codex sends SIGTERM only to matching app-server / code-mode-host processes (may interrupt active turns).", "--restart-desktop-app (Windows only, opt-in) fully restarts the Codex desktop app so its model picker re-reads the catalog. Never implied by --restart-codex: it ends live conversations.", ], }, { name: "sync-cache", usage: "ocx sync-cache [--restart-codex] [--restart-desktop-app]", summary: "Refresh Codex's model cache from the active catalog.", details: [ "Warns when Codex app-server processes still hold an in-memory model list.", "--restart-codex sends SIGTERM only to matching app-server / code-mode-host processes (may interrupt active turns).", "--restart-desktop-app (Windows only, opt-in) fully restarts the Codex desktop app so its model picker re-reads the catalog. Never implied by --restart-codex: it ends live conversations.", ], }, { name: "status", usage: "ocx status", summary: "Check proxy server status." }, { name: "doctor", usage: "ocx doctor", summary: "Diagnose environment/network issues (paths, WSL /mnt, proxy env, ChatGPT reachability).", details: [ "Default mode is observe-only and reports the native-write coordinator state and exact path.", "After stopping the proxy/service, `--recover-zero-byte-coordinator --yes` moves only a proven zero-byte coordinator to a same-directory backup.", ], }, { name: "debug", usage: "ocx debug ", summary: "Show or toggle runtime provider, usage, injection, and Claude debug capture.", details: [ "Provider: ocx debug provider on | off | status | reset | logs [-f]", "Usage JSONL: ocx debug usage on | off | status | reset | logs [-f]", "Env default: OCX_DEBUG=1 (legacy OCX_DEBUG_FRAMES still works)", ], }, { name: "login", usage: "ocx login ", summary: "OAuth or API-key login for a provider." }, { name: "logout", usage: "ocx logout ", summary: "Remove a stored provider login." }, { name: "gui", usage: "ocx gui [pair --origin [--json]]", summary: "Open the opencodex dashboard or create a secret single-use remote pairing grant.", details: [ "Pairing requires an explicit allowed --origin; there is no localhost or config-derived default.", "The printed grant is secret, single-use, short-lived, and must not be persisted.", ], }, { name: "update", usage: "ocx update [--tag latest|preview]", summary: "Update opencodex. Preview installs stay on the preview tag unless overridden.", }, { name: "provider", usage: "ocx provider ", summary: "Non-interactive provider management.", details: [ "Subcommands: list, add, install-replit, edit/test/remove/show, set-default, selected, quota, presets, account-mode", "install-replit reads the gateway key from REPLIT_GATEWAY_KEY, --stdin, or --gateway-key-file (never argv).", "Registry providers are auto-configured by name. Custom providers need --adapter and --base-url.", "Run `ocx provider help` for full usage and examples.", ], }, { name: "account", usage: "ocx account ...", summary: "List and switch provider accounts and API-key pools (GUI parity).", details: [ "list [provider] Codex account pool, OAuth accounts and API keys (identifiers shown masked as the API returns them).", "current Show the active account or key.", "use Switch the active credential; 'main' selects the Codex App login.", "refresh Force-refresh Codex or provider quota reports.", "auto-switch Control the Codex pool threshold.", "priority [first|earlier|normal|later|last|-100..100|reset] Selection order; omit the value to read it.", "remove --yes Remove a stored account or key after an existence check.", "add-key [--label