summaryrefslogtreecommitdiff
path: root/vicar
blob: 0f1be17f48ccc12010d88100f07c4e5efc24bbd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
#
# vicar assistant

show_help() {
  echo "Usage: $0 <command>"
  echo ""
  echo "Commands:"
  echo "  inbox    summarize unread inbox for the last 7 days"
}

MODEL="local-gemma"

# Check if there's exactly one argument and it's 'inbox'
if [ $# -eq 1 ] && [ "$1" = "inbox" ]; then
  date_fmt="+%Y-%m-%d"
  beg=$(date -d '7 days ago' $date_fmt)
  end=$(date $date_fmt)
  mu find "flag:unseen date:$beg..$end" maildir:/ben@bensima.com/Inbox \
  --format=json | jq '.[]|.":path"' | xargs mu view | llm -m $MODEL -s 'summarize these emails'
else
  show_help
fi