summaryrefslogtreecommitdiff
path: root/fish/conf.d/ai.fish
blob: 01993c450a02b88e68390b79b6b87e7bb577a972 (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
26
27
28
29
30
# set -gx HEXAI_PROVIDER copilot

function ai::cursor_agent
    set last_updated_file ~/.cursor_agent_last_updated
    if not test -e $last_updated_file
        cursor-agent update
        touch $last_updated_file
    else
        set current_time (date +%s)
        if test (uname) = Darwin
            set file_time (stat -f %m $last_updated_file 2>/dev/null)
        else
            set file_time (stat -c %Y $last_updated_file 2>/dev/null)
        end
        set time_diff (math "$current_time - $file_time")
        if test $time_diff -gt 86400
            cursor-agent update
            touch $last_updated_file
        end
    end
    touch ~/.nofish
    cursor-agent
end

function a
    ai::cursor_agent
end

abbr -a suggest hexai
abbr -a explain 'hexai explain'