summarylogtreecommitdiffstats
path: root/parrot-cli.install
blob: 56015bdbf6a55efee30941892520658953358919 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
post_install() {
    echo "🦜 Parrot has been installed successfully!"
    echo ""

    # Check if Ollama is available for automatic setup
    if command -v ollama >/dev/null 2>&1; then
        echo "🤖 Ollama detected - checking server status..."

        # Check if ollama server is running
        if ! ollama list >/dev/null 2>&1; then
            echo ""
            echo "⚠️  Ollama server is not running. To start it:"
            echo "    sudo systemctl enable --now ollama"
            echo ""
            echo "   After starting, you can pull the AI model with:"
            echo "    ollama pull llama3.2:3b"
            echo ""
        else
            # Pull the model in background if not already present
            if ! ollama list 2>/dev/null | grep -q "llama3.2:3b"; then
                echo "📥 Downloading AI model (this may take a few minutes)..."
                echo "   You can continue using your terminal - parrot will work when ready"
                (ollama pull llama3.2:3b >/dev/null 2>&1 && echo "✅ AI model ready!" || echo "⚠️  Model download failed - run 'ollama pull llama3.2:3b' manually") &
            else
                echo "✅ AI model already available"
            fi
            echo ""
        fi
    else
        echo "🔄 Using built-in responses (no setup required)"
        echo ""
        echo "💡 For AI-powered responses, install Ollama:"
        echo "   yay -S ollama"
        echo "   sudo systemctl enable --now ollama"
        echo "   ollama pull llama3.2:3b"
        echo ""
    fi

    echo "🚀 NEXT STEP: Run this command to enable shell integration:"
    echo "    parrot install"
    echo ""
    echo "💡 This adds smart command failure detection to your shell"
    echo "   After running it, failed commands will trigger helpful responses!"
    echo ""
    echo "📖 For more options, run: parrot --help"
}

post_upgrade() {
    post_install
}