Skip to content

jebko0429/termux-codex-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Termux Codex Helper

A small Termux-first CLI that wraps the OpenAI API for safe terminal workflows:

  • ask "question"
  • explain path/to/file
  • review path/to/file
  • cmd "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

Requirements

  • Termux
  • bash
  • curl
  • jq
  • patch for applying diffs

Install the missing packages if needed:

pkg install curl jq patch

Setup

Copy .env.example to .env and set your API key:

cp .env.example .env

Or export variables in your shell:

export OPENAI_API_KEY="..."
export OPENAI_MODEL="gpt-5-mini"

Install

Install into ~/.local/bin and add a stable ask launcher:

./install.sh

If ~/.local/bin is not already on your PATH, add this to ~/.bashrc:

export PATH="$HOME/.local/bin:$PATH"

Then reload your shell:

source ~/.bashrc

Usage

Ask

ask "Why is my shell script hanging?"
ask -f lib/watchdog.sh "Explain the restart flow"
cat script.sh | ask "Review this for bugs"

Explain

termux-codex explain lib/watchdog.sh

Review

termux-codex review lib/watchdog.sh

Command Suggestions

termux-codex cmd "find which process is listening on port 18789 in Termux"

Fix

termux-codex fix lib/watchdog.sh "Add a startup grace period before health checks"

Patch

termux-codex patch lib/watchdog.sh "Add a startup grace period before health checks"

The command will:

  1. Read the target file
  2. Ask the model for a unified diff only
  3. Show the diff
  4. Run patch --dry-run
  5. Ask whether to apply it

Environment Variables

  • OPENAI_API_KEY required API key
  • OPENAI_MODEL optional model override, default gpt-5-mini
  • OPENAI_BASE_URL optional API base URL, default https://api.openai.com/v1

Notes

  • 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.

About

A small Termux-first CLI wrapper around the OpenAI API for safe terminal workflows: ask questions, include file context, and generate/apply single-file patches with explicit confirmation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages