1 unstable release
Uses new Rust 2024
| 0.2.0 | Dec 11, 2025 |
|---|
#1634 in Text processing
17KB
154 lines
π§ term-gpt β A ChatGPT-powered CLI for Your Terminal
term-gpt is a fast, colorful, file-aware ChatGPT client for your terminal.
It supports one-shot prompts, REPL mode, file context, and a custom assistant personality.
Use it like:
gpt "Explain Rust ownership like I'm an exhausted developer."
Or enter interactive chat:
gpt --repl
Supports injecting files into the prompt:
gpt -f src/main.rs "Explain what this code does."
β¨ Features
- π₯ One-shot prompts
- π¬ Interactive REPL mode (
--repl) - π Include files as context (
-f path/to/file) - π¨ Colored output (user blue, assistant green)
- π§ Custom assistant personality baked into the tool
- π Uses your own OpenAI API key
- βοΈ Configurable, simple, and fast
π Installation
1. Install
cargo install --git https://github.com/YOURNAME/gpt
Or install through cargo:
cargo install term-gpt
2. Ensure Cargo bin is in your PATH
export PATH="$HOME/.cargo/bin:$PATH"
3. Set your OpenAI API key
export OPENAI_API_KEY="sk-your-key-here"
β οΈ Never hardcode your API key into source files.
β οΈ Never commit.envfiles with secrets.
π§© Usage
One-shot prompt
gpt "Write me a haiku about Rust and caffeine dependency."
Provide files as context
gpt -f src/main.rs "Explain this code."
Multiple files:
gpt -f src/main.rs -f README.md "Summarize the project."
REPL mode
gpt --repl
Quit with:
:q
π Example Output
You > Why is Rust so strict?
Assistant >
Because Rust is the gym coach who screams βFORM MATTERSβ
while making sure you donβt blow out your back doing a deadlift
with a null pointer.
π Building From Source
git clone https://github.com/reid-ctl/term-gpt
cd gpt
cargo build --release
Optimized binary:
target/release/gpt
Symlink:
sudo ln -s $(pwd)/target/release/gpt /usr/local/bin/gpt
βοΈ Configuration
This CLI uses OpenAIβs Responses API.
You can tweak:
- model
- assistant personality
- formatting/colors
- REPL behavior
Inside DEFAULT_PERSONALITY in main.rs.
π§ͺ To-Do / Future Enhancements
- Streaming responses
-
--modelflag - Save chat transcripts
- Pipe stdin (
cat file | gpt) - Shell completions
- Arch package (
PKGBUILD)
π License
MIT β do whatever you want, just donβt sue me if you anger the borrow checker.
π¬ Author
Made by Garrett Reid,
powered by Rust, caffeine, and an unhealthy relationship with terminal prompts.
Dependencies
~6β20MB
~209K SLoC