#!/usr/bin/env sh
set -eu
prompt='You are a severe but fair editor. Review this blog draft. Return: unclear thesis, unsupported claims, missing citations, structure problems, title ideas, and concrete edits. Do not rewrite the whole piece.'
if [ "$#" -eq 0 ]; then
input=$(cat)
else
input=$(cat "$@")
fi
if command -v llm >/dev/null 2>&1; then
printf '%s\n' "$input" | llm -s "$prompt"
elif command -v aichat >/dev/null 2>&1; then
printf '%s\n' "$input" | aichat "$prompt"
elif command -v mods >/dev/null 2>&1; then
printf '%s\n' "$input" | mods "$prompt"
else
printf 'No llm, aichat, or mods command found. Draft word count:\n' >&2
printf '%s\n' "$input" | wc -w
exit 1
fi