~kris/dots

srice

ref: 9f828eb14bdd54d2c4fd8a3b2c90253021df3152 srice/.local/bin/blog-ai-review -rwxr-xr-x 693 bytes
9f828eb1 — Kris Yotam mksh: backslash-escape commands in history hook to bypass module aliases (wc=tokei, tr=transmission-remote, cat=bat) 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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