codex-cmd installs cx, a small local helper that turns natural language into one shell command using your existing Codex CLI login.
It is built for a fast terminal workflow:
cx git clone without history
# git clone --depth 1 <URL>cx prints a command. It never runs the command for you.
Requirements:
- macOS or another Unix-like shell environment
- Python 3.9+
zshfor the in-place prompt widgetcodexonPATHcodex logincompleted with ChatGPT/Codex subscription auth
One-line install:
/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/liorsbg/codex-cmd/main/scripts/bootstrap.sh)"The installer checks for git, python3, zsh, and codex, clones the repo into ~/.local/share/codex-cmd, installs symlinks, and asks before updating ~/.zshrc.
For a non-interactive install that updates ~/.zshrc automatically:
/bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/liorsbg/codex-cmd/main/scripts/bootstrap.sh)" -- --yesManual install:
git clone https://github.com/liorsbg/codex-cmd.git ~/.local/share/codex-cmd
cd ~/.local/share/codex-cmd
scripts/install.shThe installer creates these symlinks:
~/.local/bin/cx -> <repo>/bin/cx
~/.config/codex-cmd/cx.zsh -> <repo>/shell/cx.zsh
Make sure ~/.local/bin is on your PATH, then test:
cx git clone without historyThe best workflow is the zsh widget. It lets you type a request at the prompt and replace that prompt text with the generated shell command.
Add this line to ~/.zshrc:
source ~/.config/codex-cmd/cx.zshOpen a new terminal, then type:
curl <URL> every 5 seconds for 60 seconds
Press Ctrl-X Ctrl-C. The current prompt buffer is replaced with a command. Review or edit it, then press Enter yourself if it looks right.
The widget does not submit the line automatically.
Basic form:
cx <natural language request>Useful options:
cx --model gpt-5.4-mini git clone without history
cx --effort low explain disk usage sorted by size
cx --timeout 90 rsync a folder but exclude node_modulesDefaults:
- model:
gpt-5.3-codex-spark - timeout:
45seconds - Codex sandbox:
read-only - web search: disabled
cx --raw is accepted for the zsh widget. It still prints only the generated command.
cx git clone without history
# git clone --depth 1 <URL>cx curl '<URL>' every 5 seconds for 60 seconds
# for i in {1..13}; do curl "<URL>"; (( i < 13 )) && sleep 5; donecx find the biggest files under this directory
# find . -type f -print0 | xargs -0 du -h | sort -hr | headcx show only commits from last week
# git log --since="1 week ago" --onelineGenerated commands may vary. Treat the output like a suggestion from an assistant, not a trusted script.
cx is intentionally conservative:
- It never executes generated commands.
- The zsh widget only replaces
BUFFER; it does not callaccept-line. - Codex runs through
codex exec --json --ephemeral. cxpasses--ignore-user-configand--ignore-rulesso unrelated local MCP servers, plugins, and repo guidance do not affect command generation.cxuses--sandbox read-onlyand disables web search for this command-generation task.- Placeholders such as
<URL>,<repo-url>, and<file>are preserved when your request does not include a concrete value.
You still need to inspect generated commands before running them, especially commands that remove files, overwrite data, change permissions, or send network requests.
cx: codex executable not found on PATH
Install the Codex CLI, then confirm:
codex --versioncx: reauthorization is required or an auth-related Codex error
Refresh your Codex login:
codex loginThe zsh keybinding does nothing
Confirm the widget is loaded:
source ~/.config/codex-cmd/cx.zsh
zsh -ic 'whence -w cx-replace-buffer; bindkey "^X^C"'cx works in one terminal but not another
Check that ~/.local/bin is on PATH in the failing terminal:
command -v cxIf it is missing, rerun the bootstrap installer and allow the ~/.zshrc update, or add this block manually:
case ":$PATH:" in
*":$HOME/.local/bin:"*) ;;
*) export PATH="$HOME/.local/bin:$PATH" ;;
esac
source "$HOME/.config/codex-cmd/cx.zsh"Output is slow
cx uses your Codex account and model choice. For faster responses, keep the default Spark model or try:
cx --model gpt-5.4-mini --effort low <request>Does cx use my OpenAI API key?
No. It shells out to codex exec, which reuses your existing Codex CLI authentication. You do not need to set OPENAI_API_KEY for cx.
Does cx send my whole repository to Codex?
No. cx sends the natural-language request you type. It also runs Codex with --ignore-user-config, --ignore-rules, and --skip-git-repo-check for this narrow command-generation workflow.
Can it run the command automatically?
No. That is deliberate. The output is meant to be reviewed, edited, and run manually.
Can I change the keybinding?
Yes. Source shell/cx.zsh, then bind the widget yourself:
bindkey '^G' cx-replace-bufferCan I use another shell?
The cx CLI works from any shell. The in-place prompt replacement is currently a zsh ZLE widget.
User-facing docs live here in the README. Contributor docs are separate so the quick start stays easy to scan: