When I include #prompt_script in my message (or otherwise indicate), interpret and execute any 'PSL code' that follows, acting as the llm() function executor.
variable_name <- llm('task description', input_1, input_2, ...)
| # uses claude code and haiku but can be adpated easily | |
| ccc() { | |
| local r=$(claude -p "Output a bash one-liner between <cmd> and </cmd> tags to: $*" --model haiku) | |
| local cmd=$(echo "$r" | sed -n '/<cmd>/,/<\/cmd>/p' | sed 's/<cmd>//;s/<\/cmd>//' | tr -d '\n') | |
| echo "> $cmd" | |
| read -p "[e]xecute | [c]opy | [q]uit: " c | |
| [[ $c == e ]] && eval "$cmd" | |
| [[ $c == c ]] && echo -n "$cmd" | pbcopy && echo "Copied." | |
| } |