feat(ai): make ai mode model-configurable + add --compare for A/B testing

Default the ai mode to qwen2.5-coder:1.5b instead of the hardcoded (and
uninstalled) westenfelder/NL2SH, which left ai mode broken. The model is now
configurable via SUPERMAN_AI_MODEL / --model, with markdown-fence stripping and
a coder-specific prompt wrapper so general coder models emit a single bare
one-liner. NL2SH still receives the raw query. Adds --compare to run multiple
models side by side (SUPERMAN_AI_COMPARE_MODELS) with timing for benchmarking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
leetcrypt
2026-06-09 14:24:40 -07:00
parent 0c6b871713
commit a699989088
2 changed files with 146 additions and 37 deletions
+21 -1
View File
@@ -28,9 +28,29 @@ super-man ask "find large files" # ask a question
super-man task "monitor cpu usage" # describe what you want to do
super-man category files # browse by category (files/text/network/system)
super-man explain "tar -czf" # explain what a command does
super-man ai "count lines in js files" # AI-powered NL2SH model (advanced)
super-man ai "count lines in js files" # AI bash one-liner via local LLM (advanced)
```
### AI mode (local LLM via ollama)
`ai` generates a bash one-liner from plain English using a local [ollama](https://ollama.com)
model. The model is configurable, so you can A/B different local LLMs:
```bash
super-man ai "find python files modified last week" # default model
super-man ai --model qwen2.5:3b "count lines in all js files" # override model
super-man ai --compare "list the 5 largest files" # run several models side by side
```
| Env var | Purpose | Default |
|---------|---------|---------|
| `SUPERMAN_AI_MODEL` | Default model for `ai` | `qwen2.5-coder:1.5b` |
| `SUPERMAN_AI_COMPARE_MODELS` | Space-separated list for `--compare` | `qwen2.5-coder:1.5b westenfelder/NL2SH` |
General coder models (e.g. `qwen2.5-coder`) are prompt-wrapped to emit a single bare
command; the purpose-built `westenfelder/NL2SH` model receives the raw query. Pull
either with `ollama pull <model>`.
`Esc` in the flag browser returns to the command list; `Esc` on the home screen
exits.