A CLI programming assistant for computer-science tasks
Project description
aicheat
A command-line based AI coding assistant
Features
- Supports OpenAI-compatible inference servers (such as vLLM/llama.cpp/OpenAI, ...)
- Powerful line editing/completion capabilities thanks to
prompt-toolkit - Theming support using
pygments - Extensibility via custom tool definitions
- Skills support
Installation
# Install a stable version
uv pip install git+https://git.decapod.one/brethil/aicheat@v0.4.0
# Install the latest main
uv pip install git+https://git.decapod.one/brethil/aicheat@main
# Install the latest dev
uv pip install git+https://git.decapod.one/brethil/aicheat@dev
# Clone and install (development)
git clone https://git.decapod.one/brethil/aicheat
uv pip install -e ".[dev]"
Quick Start
AICHEAT_HOST: path to an OpenAI-compatible server, such as vllm, or llama.cpp, see instructions in docsOPENAI_API_KEY: (optional) set if API Key is required to connect toAICHEAT_HOSTAICHEAT_MODEL: (optional) set default model. If a single model is available onAICHEAT_HOST, it is automatically selected. If multiple models are available, user is prompted to select the model.
Note: this should also work with the official OpenAI API, although this is untested.
Start chatting:
aicheat
# Optionally, a starting message can be provided:
aicheat "What's the current status of this git repo?"
# optional: select a model
export AICHEAT_MODEL="your-model-name"
In the aicheat "REPL":
- Type
/helpfor available commands - Type
/toolsto see available tools - Use
/theme listto list/select available themes, using/config saveto persist the theme choice. - Prefix messages with
!to run a shell command, e.g.!uptimecallsuptime. - Type a question to start chatting
Provider Documentation
See docs/providers/ for detailed instructions on using aicheat with different OpenAI-compatible API providers:
Usage Examples
Basic Usage
# Start a chat session
aicheat
# Start with an initial prompt
aicheat "What's the status of this git repo?"
aicheat
In-Chat Commands
Once in the chat, you can use these commands:
/help- List available commands/tools- List available tools/clear- Clear the conversation history (or hit ctrl-c twice)/multiline- Toggle multiline input mode, also see Editor/Multiline section below/model- Show/set the active model/fragment <file> [prompt]- Include a file in the session with optional instructions
Tool Calling
aicheat comes with several built-in tools
File Operations
read_file(filename)- Read the content of a filewrite_file(filename, content)- Write content to a fileapply_patch(filename, content)- Patch a filesearch(pattern, path)- Search for patterns in files using ripgrep
System & Shell
execute_shell_command(cmd)- Execute shell commands (with confirmation)man(program_name)- Retrieve man pages for programspwd()- Get current working directorycd(path)- Change directory
Git Integration
git_status()- Show git status as a diffgit_updates(from_refish)- Show commits since last tag/releasegit_show_patch(commit_id)- Show patch for a specific commitgit_list_files()- List all git-tracked files
Code Execution
execute_python_code(code)- Execute Python code snippets (with confirmation)
Web & Documentation
cheat_sh_search(program_name)- Search cheat.sh for program documentation
Adding Custom Tools
You can extend aicheat with custom tools by creating new modules in src/aicheat/tools/.
Here's an example for a ping tool to check network status:
from aicheat.tools.core import tool
from subprocess import check_output, CalledProcessError, STDOUT
import re
@tool(
message_template="🌐 Pinging {host} {count} times}"
requires_confirmation=False,
)
def ping(host: str, count: int) -> str:
"""Pings a host using the unix `ping` tool"""
if not host:
return "No host provided"
try:
result = check_output(
["ping", "-c", str(count), host],
text=True,
stderr=STDOUT, # redirect stderr to stdout
)
except CalledProcessError as exc:
result = f"ping failed with returncode={exc.returncode}\noutput:\n{exc.stdout}"
return result
Note: @tool() must always be called with parentheses.
For more examples, see:
aicheat.tools.shell- Shell-related toolsaicheat.tools.git- Git-related toolsaicheat.tools.code.python- Python-related code tools
Tips & Tricks
Shell Integration
Add an alias to aicheat so that it's prefixed by noglob, making it easier to give initial prompts from the shell without expanding globs:
echo "alias aicheat=\"noglob aicheat\"" >> ~/.zshrc
Editor/Multiline
The REPL uses prompt-toolkit to leverage its powerful line-editing capabilities. aicheat, depending on your $EDITOR value supports:
- emacs-style line-editing shortcuts:
- use
ctrl-x ctrl-eto open the current line in your$EDITOR) - ctrl-a/ctrl-e to move to beginning/end of the current line and other emacs-style movements
- use
- vi-style line-editing shortcuts:
vvto open the current line in your$EDITOR- modal editing and other vi-style movement shortcuts
Multiline editing is also supported, either via /multiline or via ctrl-v. This can be useful to paste text/code.
Requirements
- Python 3.8+
- An OpenAI-compatible API server (like vLLM or llama.cpp)
ripgrep(optional, for improved search functionality)cht.shCLI tool (optional, for cheat.sh functionality)
License
MIT
aicheat.tools.shellshell-related toolsaicheat.tools.gitgit-related toolsaicheat.tools.code.pythonpython-related code tools
Skills
Load skills using /skill load path/to/skill
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aicheat-0.4.0.post1.tar.gz.
File metadata
- Download URL: aicheat-0.4.0.post1.tar.gz
- Upload date:
- Size: 627.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82ddaa1a068e0ae3fe275b97f10dc0694bd6994e5670f706039a9507f8b32369
|
|
| MD5 |
748148f9fe5e6aa185ea6f140b055bad
|
|
| BLAKE2b-256 |
d80257923b689219eea22c36abd0db61108f6f8c9201b43e897b95b14ba9f206
|
File details
Details for the file aicheat-0.4.0.post1-py3-none-any.whl.
File metadata
- Download URL: aicheat-0.4.0.post1-py3-none-any.whl
- Upload date:
- Size: 43.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cb1f10bbe79f106d4c28017649082c1537d35f868c1a94e622c925a95c57634
|
|
| MD5 |
a24996a29075d572ef6bf65f95dd3ebb
|
|
| BLAKE2b-256 |
142e875f9c5ce758220ffa36f3c0ab0ad70aabf4d4c59cf1ed7b32a48f3c76fc
|