# NERF shell completions for bash
# Install: source completions/nerf.bash
#   or: cp completions/nerf.bash /etc/bash_completion.d/nerf

_nerf_completion() {
    local cur="${COMP_WORDS[COMP_CWORD]}"
    local prev="${COMP_WORDS[COMP_CWORD-1]}"
    local commands="analyze api benchmark bot chain compliance council diff doctor domains feedback guardrail ingest leaderboard marketplace mcp memory-export memory-import osint panel plugin query resume review sarif scan score search setup setup-signal shard skills stats status store update version workflow"
    local modes="red blue incident purple recon privacy architect researcher build"
    local flags="--auto --backend --no-stream --help"

    if [ "$COMP_CWORD" -eq 1 ]; then
        COMPREPLY=( $(compgen -W "$commands $modes $flags" -- "$cur") )
    elif [ "$prev" = "--backend" ]; then
        COMPREPLY=( $(compgen -W "claude ollama openai openrouter openai-compat pi-ai" -- "$cur") )
    elif [ "$prev" = "--auto" ] || [[ " $modes " == *" $prev "* ]]; then
        COMPREPLY=( $(compgen -W "$modes" -- "$cur") )
    fi
}

complete -F _nerf_completion nerf
