#!/usr/bin/env sh
#
# dependencies: aichat/sc | ollama | vipe (moreutils)

model="${1:-$(ollama-current)}"

aichat -m "ollama:${model}" "command to $*. only the command, no explanations, no formatting, no surrounding backticks, remove surrounding codeblocks, replace specific directories with placeholders formatted as {{ placeholder }}" \
  | vipe \
  | tee -a /dev/tty \
  | bash
