A small Termux-first CLI that wraps the OpenAI API for safe terminal workflows:
ask "question"explain path/to/filereview path/to/filecmd "goal"ask -f path/to/file "question about this file"fix path/to/file "instruction"patch path/to/file "instruction"with explicit confirmation before apply
The tool is intentionally conservative:
- read-only by default
- patch generation is opt-in
- file edits require confirmation
- obvious secrets are masked before content is sent to the API
- Termux
bashcurljqpatchfor applying diffs
Install the missing packages if needed:
pkg install curl jq patchCopy .env.example to .env and set your API key:
cp .env.example .envOr export variables in your shell:
export OPENAI_API_KEY="..."
export OPENAI_MODEL="gpt-5-mini"Install into ~/.local/bin and add a stable ask launcher:
./install.shIf ~/.local/bin is not already on your PATH, add this to ~/.bashrc:
export PATH="$HOME/.local/bin:$PATH"Then reload your shell:
source ~/.bashrcask "Why is my shell script hanging?"
ask -f lib/watchdog.sh "Explain the restart flow"
cat script.sh | ask "Review this for bugs"termux-codex explain lib/watchdog.shtermux-codex review lib/watchdog.shtermux-codex cmd "find which process is listening on port 18789 in Termux"termux-codex fix lib/watchdog.sh "Add a startup grace period before health checks"termux-codex patch lib/watchdog.sh "Add a startup grace period before health checks"The command will:
- Read the target file
- Ask the model for a unified diff only
- Show the diff
- Run
patch --dry-run - Ask whether to apply it
OPENAI_API_KEYrequired API keyOPENAI_MODELoptional model override, defaultgpt-5-miniOPENAI_BASE_URLoptional API base URL, defaulthttps://api.openai.com/v1
- The patch workflow is single-file by design.
- The helper masks common
KEY=,TOKEN=,SECRET=patterns before sending content. - For large files, trim the file manually before sending if you want lower token usage.