rawi
Version:
Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into
434 lines (412 loc) • 19.4 kB
JavaScript
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */
var e={bash:`# bash completion for rawi
# Save as rawi.bash and source it in ~/.bashrc or /etc/bash_completion.d/
_rawi_get_profiles() {
local config_file="$HOME/.rawi/credentials"
if [[ -f "$config_file" ]]; then
if command -v jq >/dev/null 2>&1; then
jq -r 'keys[]' "$config_file" 2>/dev/null
else
grep -o '^[[:space:]]*"[a-zA-Z0-9_-]\\+"' "$config_file" 2>/dev/null | \\
sed 's/[[:space:]]*"\\([^"]*\\)".*/\\1/' | head -20
fi
else
echo "default"
fi
}
_rawi()
{
local cur prev opts cmds
COMPREPLY=()
cur="\${COMP_WORDS[COMP_CWORD]}"
prev="\${COMP_WORDS[COMP_CWORD-1]}"
cmds="ask chat exec act configure provider history info completion"
global_opts="-h --help -v --version"
# if completing the first arg after "rawi"
if [[ $COMP_CWORD -eq 1 ]]; then
COMPREPLY=( $(compgen -W "$cmds $global_opts" -- "$cur") )
return 0
fi
# dispatch based on subcommand
case "\${COMP_WORDS[1]}" in
ask)
opts="--profile -p --session -s --new-session --act -a --file -f --files \\
--batch -b --parallel --max-concurrency --continue-on-error \\
--file-type --verbose --filter-sensitive --filter-types \\
--show-filtered --highlight-filtered --save-filter-config \\
--reset-filter-config -h --help -v --version"
case "$prev" in
-p|--profile)
COMPREPLY=( $(compgen -W "$(_rawi_get_profiles)" -- "$cur") )
return 0
;;
-a|--act)
COMPREPLY=( $(compgen -W "code-reviewer translator debugger optimizer consultant teacher" -- "$cur") )
return 0
;;
--file-type)
COMPREPLY=( $(compgen -W "js ts jsx tsx py java go rs cpp c h hpp cs php rb swift kt dart" -- "$cur") )
return 0
;;
esac
;;
chat)
opts="--profile -p --session -s --new-session --act -a --file -f --files \\
--verbose --filter-sensitive --filter-types --show-filtered \\
--highlight-filtered --save-filter-config --reset-filter-config \\
-h --help -v --version"
case "$prev" in
-p|--profile)
COMPREPLY=( $(compgen -W "$(_rawi_get_profiles)" -- "$cur") )
return 0
;;
-a|--act)
COMPREPLY=( $(compgen -W "code-reviewer translator debugger optimizer consultant teacher" -- "$cur") )
return 0
;;
esac
;;
exec)
opts="--profile -p --session -s --new-session --execute -e --confirm \\
--explain --shell --dangerous --file -f --files --verbose \\
-h --help -v --version"
case "$prev" in
-p|--profile)
COMPREPLY=( $(compgen -W "$(_rawi_get_profiles)" -- "$cur") )
return 0
;;
--shell)
COMPREPLY=( $(compgen -W "bash zsh fish" -- "$cur") )
return 0
;;
esac
;;
act)
opts="--list -l --search -s --category -c --show --export --validate \\
-h --help -v --version"
case "$prev" in
--show|--export|--validate)
COMPREPLY=( $(compgen -W "code-reviewer translator debugger optimizer consultant teacher" -- "$cur") )
return 0
;;
esac
;;
configure)
opts="--profile -p --provider --model --api-key --base-url --temperature \\
--max-tokens --top-p --frequency-penalty --presence-penalty \\
--stop --system-prompt --language --interactive --list --show \\
--delete --export --import --validate -h --help -v --version"
case "$prev" in
-p|--profile|--show|--delete)
COMPREPLY=( $(compgen -W "$(_rawi_get_profiles)" -- "$cur") )
return 0
;;
--provider)
COMPREPLY=( $(compgen -W "openai anthropic google ollama xai azure bedrock deepseek mistral cerebras lmstudio" -- "$cur") )
return 0
;;
--language)
COMPREPLY=( $(compgen -W "en es fr de it pt ru zh ja ko ar" -- "$cur") )
return 0
;;
esac
;;
provider)
opts="--list --show --models --validate -h --help -v --version"
case "$prev" in
--show|--models|--validate)
COMPREPLY=( $(compgen -W "openai anthropic google ollama xai azure bedrock deepseek mistral cerebras lmstudio" -- "$cur") )
return 0
;;
esac
;;
history)
opts="--list --show --delete --clear --export --import --search \\
--limit --since --before --profile -p --verbose \\
-h --help -v --version"
case "$prev" in
-p|--profile)
COMPREPLY=( $(compgen -W "$(_rawi_get_profiles)" -- "$cur") )
return 0
;;
esac
;;
info)
opts="--system --config --providers --profiles --debug --json \\
-h --help -v --version"
;;
completion)
opts="--shell -s --install --advanced -h --help -v --version"
case "$prev" in
-s|--shell)
COMPREPLY=( $(compgen -W "bash zsh auto" -- "$cur") )
return 0
;;
esac
;;
*)
opts="$global_opts"
;;
esac
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
return 0
}
complete -F _rawi rawi
`,zsh:`#compdef rawi
# Enhanced Zsh completion script for rawi
# Provides dynamic completion based on actual configuration and CLI context
_rawi_get_profiles() {
local config_file="$HOME/.rawi/credentials"
if [[ -f "$config_file" ]]; then
if command -v jq >/dev/null 2>&1; then
# Extract top-level keys (profile names)
jq -r 'keys[]' "$config_file" 2>/dev/null
else
# Fallback: grep profile names (keys before the colon at top level)
grep -o '^[[:space:]]*"[a-zA-Z0-9_-]\\+"' "$config_file" 2>/dev/null | \\
sed 's/[[:space:]]*"\\([^"]*\\)".*/\\1/' | head -20
fi
else
echo "default"
fi
}
_rawi() {
local curcontext="$curcontext" state
typeset -A opt_args
local -a commands
commands=(
'ask:Ask AI a question and get a response'
'chat:Start an interactive chat session with AI'
'exec:Convert natural language to executable CLI commands'
'act:List and explore act templates'
'configure:Configure AI provider settings and profiles'
'provider:Show supported AI providers and models'
'history:Manage chat history and sessions'
'info:Display system and configuration information'
'completion:Generate shell completion scripts'
)
_arguments -C \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]' \\
'1:command:->command' \\
'*::args:->args'
case $state in
command)
_describe -t commands 'rawi commands' commands
;;
args)
case $words[1] in
ask)
_arguments \\
'(-p --profile)'{-p,--profile}'[Profile name]:profile:($(_rawi_get_profiles))' \\
'(-s --session)'{-s,--session}'[Session name]:session:' \\
'--new-session[Start a new session]' \\
'(-a --act)'{-a,--act}'[Act template]:template:(code-reviewer translator debugger optimizer consultant teacher)' \\
'(-f --file)'{-f,--file}'[Input file]:file:_files' \\
'--files[Multiple input files]:files:_files' \\
'(-b --batch)'{-b,--batch}'[Batch processing]' \\
'--parallel[Parallel processing]' \\
'--max-concurrency[Max concurrency]:number:' \\
'--continue-on-error[Continue on error]' \\
'--file-type[File type filter]:type:(js ts jsx tsx py java go rs cpp c h hpp cs php rb swift kt dart)' \\
'--verbose[Verbose output]' \\
'--filter-sensitive[Filter sensitive content]' \\
'--filter-types[Filter types]:types:' \\
'--show-filtered[Show filtered content]' \\
'--highlight-filtered[Highlight filtered content]' \\
'--save-filter-config[Save filter configuration]' \\
'--reset-filter-config[Reset filter configuration]' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
chat)
_arguments \\
'(-p --profile)'{-p,--profile}'[Profile name]:profile:($(_rawi_get_profiles))' \\
'(-s --session)'{-s,--session}'[Session name]:session:' \\
'--new-session[Start a new session]' \\
'(-a --act)'{-a,--act}'[Act template]:template:(code-reviewer translator debugger optimizer consultant teacher)' \\
'(-f --file)'{-f,--file}'[Input file]:file:_files' \\
'--files[Multiple input files]:files:_files' \\
'--verbose[Verbose output]' \\
'--filter-sensitive[Filter sensitive content]' \\
'--filter-types[Filter types]:types:' \\
'--show-filtered[Show filtered content]' \\
'--highlight-filtered[Highlight filtered content]' \\
'--save-filter-config[Save filter configuration]' \\
'--reset-filter-config[Reset filter configuration]' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
exec)
_arguments \\
'(-p --profile)'{-p,--profile}'[Profile name]:profile:($(_rawi_get_profiles))' \\
'(-s --session)'{-s,--session}'[Session name]:session:' \\
'--new-session[Start a new session]' \\
'(-e --execute)'{-e,--execute}'[Execute commands]' \\
'--confirm[Confirm before execution]' \\
'--explain[Explain commands]' \\
'--shell[Target shell]:shell:(bash zsh fish)' \\
'--dangerous[Allow dangerous commands]' \\
'(-f --file)'{-f,--file}'[Input file]:file:_files' \\
'--files[Multiple input files]:files:_files' \\
'--verbose[Verbose output]' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
act)
_arguments \\
'(-l --list)'{-l,--list}'[List templates]' \\
'(-s --search)'{-s,--search}'[Search templates]:query:' \\
'(-c --category)'{-c,--category}'[Filter by category]:category:' \\
'--show[Show template]:template:(code-reviewer translator debugger optimizer consultant teacher)' \\
'--export[Export template]:template:(code-reviewer translator debugger optimizer consultant teacher)' \\
'--validate[Validate template]:template:(code-reviewer translator debugger optimizer consultant teacher)' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
configure)
_arguments \\
'(-p --profile)'{-p,--profile}'[Profile name]:profile:($(_rawi_get_profiles))' \\
'--provider[AI provider]:provider:(openai anthropic google ollama xai azure bedrock deepseek mistral cerebras lmstudio)' \\
'--model[AI model]:model:' \\
'--api-key[API key]:key:' \\
'--base-url[Base URL]:url:' \\
'--temperature[Temperature]:temp:' \\
'--max-tokens[Max tokens]:tokens:' \\
'--top-p[Top P]:top_p:' \\
'--frequency-penalty[Frequency penalty]:penalty:' \\
'--presence-penalty[Presence penalty]:penalty:' \\
'--stop[Stop sequences]:stop:' \\
'--system-prompt[System prompt]:prompt:' \\
'--language[Language]:lang:(en es fr de it pt ru zh ja ko ar)' \\
'--interactive[Interactive mode]' \\
'--list[List profiles]' \\
'--show[Show profile]:profile:($(_rawi_get_profiles))' \\
'--delete[Delete profile]:profile:($(_rawi_get_profiles))' \\
'--export[Export configuration]' \\
'--import[Import configuration]:file:_files' \\
'--validate[Validate configuration]' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
provider)
_arguments \\
'--list[List providers]' \\
'--show[Show provider]:provider:(openai anthropic google ollama xai azure bedrock deepseek mistral cerebras lmstudio)' \\
'--models[Show models]:provider:(openai anthropic google ollama xai azure bedrock deepseek mistral cerebras lmstudio)' \\
'--validate[Validate provider]:provider:(openai anthropic google ollama xai azure bedrock deepseek mistral cerebras lmstudio)' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
history)
_arguments \\
'--list[List sessions]' \\
'--show[Show session]:session:' \\
'--delete[Delete session]:session:' \\
'--clear[Clear history]' \\
'--export[Export history]:file:_files' \\
'--import[Import history]:file:_files' \\
'--search[Search history]:query:' \\
'--limit[Limit results]:limit:' \\
'--since[Since date]:date:' \\
'--before[Before date]:date:' \\
'(-p --profile)'{-p,--profile}'[Profile name]:profile:($(_rawi_get_profiles))' \\
'--verbose[Verbose output]' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
info)
_arguments \\
'--system[System information]' \\
'--config[Configuration information]' \\
'--providers[Provider information]' \\
'--profiles[Profile information]' \\
'--debug[Debug information]' \\
'--json[JSON output]' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
completion)
_arguments \\
'(-s --shell)'{-s,--shell}'[Shell type]:shell:(bash zsh auto)' \\
'--install[Install completion script]' \\
'--advanced[Generate advanced completion script]' \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
*)
_arguments \\
'(-h --help)'{-h,--help}'[Show help]' \\
'(-v --version)'{-v,--version}'[Show version]'
;;
esac
;;
esac
}
# Load and initialize completion
autoload -Uz compinit
compinit
compdef _rawi rawi
`,fish:`# fish completion for rawi
# Save as rawi.fish and source it in ~/.config/fish/completions/rawi.fish
function _rawi_get_profiles
set config_file $HOME/.rawi/credentials
if test -f $config_file
if type -q jq
jq -r 'keys[]' $config_file 2>/dev/null
else
grep -o '^[[:space:]]*"[a-zA-Z0-9_-]\\+"' $config_file 2>/dev/null | sed 's/^[[:space:]]*"\\([^"]*\\)".*/\\1/'
end
else
echo "default"
end
end
# Global options
set -l global_opts -h --help -v --version
# Subcommands
set -l commands ask chat exec act configure provider history info completion
# Complete subcommands
for cmd in $commands
complete -c rawi -n "__fish_use_subcommand" -f -a $cmd -d (string replace ':' ' ' (string join ' ' $cmd))
end
# Complete global flags at top-level
for opt in $global_opts
complete -c rawi -n "not __fish_seen_subcommand_from $commands" -f -a $opt
end
# ask subcommand options
complete -c rawi -n "__fish_seen_subcommand_from ask" -l profile -s p -a "(_rawi_get_profiles)" -d "Profile name"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l session -s s -d "Session name"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l new-session -d "Start a new session"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l act -s a -a "code-reviewer translator debugger optimizer consultant teacher" -d "Act template"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l file -s f -a "(ls)" -d "Input file"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l files -d "Multiple input files"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l verbose -d "Verbose output"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l help -s h -d "Show help"
complete -c rawi -n "__fish_seen_subcommand_from ask" -l version -s v -d "Show version"
# chat subcommand options
complete -c rawi -n "__fish_seen_subcommand_from chat" -l profile -s p -a "(_rawi_get_profiles)" -d "Profile name"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l session -s s -d "Session name"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l new-session -d "Start a new session"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l act -s a -a "code-reviewer translator debugger optimizer consultant teacher" -d "Act template"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l file -s f -a "(ls)" -d "Input file"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l files -d "Multiple input files"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l verbose -d "Verbose output"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l help -s h -d "Show help"
complete -c rawi -n "__fish_seen_subcommand_from chat" -l version -s v -d "Show version"
# exec subcommand options
complete -c rawi -n "__fish_seen_subcommand_from exec" -l profile -s p -a "(_rawi_get_profiles)" -d "Profile name"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l session -s s -d "Session name"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l new-session -d "Start a new session"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l execute -s e -d "Execute commands"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l confirm -d "Confirm before execution"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l explain -d "Explain commands"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l shell -d "Target shell" -a "bash zsh fish"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l dangerous -d "Allow dangerous commands"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l file -s f -a "(ls)" -d "Input file"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l files -d "Multiple input files"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l verbose -d "Verbose output"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l help -s h -d "Show help"
complete -c rawi -n "__fish_seen_subcommand_from exec" -l version -s v -d "Show version"
`};exports.a = e;
/* Rawi (راوي) is the developer-friendly AI CLI that brings the power of 11 major AI providers directly to your terminal. With seamless shell integration, persistent conversations, and 200+ specialized prompt templates, Rawi transforms your command line into an intelligent development workspace. */
//# sourceMappingURL=chunk-WWDFLDG4.cjs.map