llmscript
llmscript is a shell script that uses a large language model (LLM) to build and test shell programs so that you can write scripts in natural language instead of bash or other shell scripting languages.
<img src="https://github.com/user-attachments/assets/6257eb3c-fe66-41b0-9b45-39ec29b40a3a" width="640" alt="a terminal window showing a demonstration of the llmscript tool to print hello world" /
You can configure it to use Ollama (free and local), Claude (paid), OpenAI (paid), Google Gemini (paid), or OpenRouter (paid, one key for many models).
[!NOTE] Does this actually work? Yeah, somewhat! Could it create scripts that erase your drive? Maybe! Good luck! Most of this project was written by Claude with Cursor. I can't actually claim that I "wrote" any of the source code. I barely know Go.
Example
#!/usr/bin/env llmscript
Create an output directory, `output`.
For every PNG file in `input`:
- Convert it to 256x256 with ImageMagick
- Run pngcrushRunning it with a directory of PNG files would look like this:
$ ./convert-pngs
✓ Script generated successfully!
Creating output directory
Convering input/1.png
Convering input/2.png
Convering input/3.png
Running pngcrush on output/1.png
Running pngcrush on output/2.png
Running pngcrush on output/3.png
Done!Running it again will use the cache and not generate any new scripts:
$ ./convert-pngs
✓ Cached script found
Creating output directory
Convering input/1.png
...If you want to generate a new script, use the --no-cache flag.
Prerequisites
- Go (1.24 or later)
- One of:
- Ollama running locally
- A Claude (Anthropic) API key
- An OpenAI API key
- A Google Gemini API key
- An OpenRouter API key
Installation
go install github.com/statico/llmscript/cmd/llmscript@latest(Can't find it? Check ~/go/bin.)