Skip to content

Tiny shell helper that lets you draft, tweak, and run AI-generated commands straight from Bash or Zsh.

Notifications You must be signed in to change notification settings

XanderStrike/ai-completion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

ai-completion

Tiny shell helper that lets you draft, tweak, and run AI-generated commands straight from Bash or Zsh.

It exposes two public functions:

• ai – talks to the OpenAI Chat Completions API
• aio – talks to a local Ollama daemon

Quick install

  1. Save the script or clone this repo somewhere.
  2. In ~/.bashrc or ~/.zshrc add
    source /path/to/ai-completion.sh
  3. For ai export OPENAI_API_KEY=<your-key>.

Usage

Describe the task in plain English:

➜ ai organize all photos in this directory into subfolders using the iso date of the image capture time
$ exiftool '-Directory<DateTimeOriginal' -d '%Y-%m-%d' .

The suggestion appears inline on your prompt. Edit if necessary, press ↵, and it executes.

Piping

Anything you pipe into the function is forwarded to the model as extra context, e.g.

➜ git diff --staged | ai write a commit message
$ git commit -am "Refactor payload construction using jq for better JSON handling"

Local

Save a buck using local ollama for the easy stuff

➜ aio list stopped docker containers
Using gemma3:4b on http://localhost:11434...
$ docker ps -a --filter status=exited

Environment variables

Required for ai:

  • OPENAI_API_KEY – your OpenAI key

Optional (defaults):

  • OPENAI_MODEL (gpt-5-chat-latest)
  • OPENAI_TEMP (0.3)
  • OLLAMA_MODEL (gemma3:4b)
  • OLLAMA_TEMP (0.3)
  • OLLAMA_HOST (http://localhost:11434)

Dependencies: curl, jq, and – for aio – a running Ollama daemon somewhere.

About

Tiny shell helper that lets you draft, tweak, and run AI-generated commands straight from Bash or Zsh.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages