From 55a31278a83cfb9fa84e4eed4b7f6531aff0ed15 Mon Sep 17 00:00:00 2001 From: truetype Date: Sat, 21 Mar 2026 08:52:39 +0100 Subject: [PATCH] Fix completion scripts: remove remaining maxclaw references - Rewrote langcode.bash with full unified CLI support - Rewrote langcode.zsh with full unified CLI support - All commands: chat, server, tui, config, analytics, dashboard, version - Config subcommands: list, add, remove, use, active, test, export, import, search --- completions/langcode.bash | 68 +++++++++++++++++----- completions/langcode.zsh | 118 +++++++++++++++++++++++--------------- 2 files changed, 128 insertions(+), 58 deletions(-) diff --git a/completions/langcode.bash b/completions/langcode.bash index 59e4499..77a355f 100644 --- a/completions/langcode.bash +++ b/completions/langcode.bash @@ -1,15 +1,18 @@ #!/bin/bash -# Bash completion for MaxClaw Agent CLI +# Bash completion for LangCode Agent CLI -_maxclaw_completions() +_langcode_completions() { - local cur prev commands + local cur prev commands subcommands COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" # Main commands - commands="list search add remove set-active active test export import help" + commands="chat server tui config analytics dashboard version" + + # Config subcommands + config_subcommands="list add remove use active test export import search" # Handle main command completion if [[ ${COMP_CWORD} -eq 1 ]]; then @@ -17,19 +20,40 @@ _maxclaw_completions() return 0 fi + # Handle config subcommand completion + if [[ "${COMP_WORDS[1]}" == "config" && ${COMP_CWORD} -eq 2 ]]; then + COMPREPLY=( $(compgen -W "${config_subcommands}" -- ${cur}) ) + return 0 + fi + # Handle subcommand-specific completions case "${prev}" in + server) + local server_options="--port --host" + COMPREPLY=( $(compgen -W "${server_options}" -- ${cur}) ) + return 0 + ;; + analytics) + local analytics_options="--report --clear" + COMPREPLY=( $(compgen -W "${analytics_options}" -- ${cur}) ) + return 0 + ;; + dashboard) + local dashboard_options="--clear" + COMPREPLY=( $(compgen -W "${dashboard_options}" -- ${cur}) ) + return 0 + ;; search) # Search term - no completion return 0 ;; add) # Add command options - local add_options="--non-interactive --name --provider --model --api-key --base-url --set-active" + local add_options="--name --provider --model --api-key --base-url --activate" COMPREPLY=( $(compgen -W "${add_options}" -- ${cur}) ) return 0 ;; - remove|set-active|test) + remove|use|test) # Configuration names - try to get from config list if command -v python3 &> /dev/null; then local configs=$(python3 -c " @@ -57,25 +81,43 @@ except: COMPREPLY=( $(compgen -f -- ${cur}) ) return 0 ;; - --provider) + --provider|-p) # Provider options - local providers="openai ollama openrouter" + local providers="openai ollama openrouter anthropic google" COMPREPLY=( $(compgen -W "${providers}" -- ${cur}) ) return 0 ;; - --format) + --format|-f) # Format options local formats="json yaml" COMPREPLY=( $(compgen -W "${formats}" -- ${cur}) ) return 0 ;; + --port|-p) + # Port suggestions + local ports="8000 3000 8080 5000" + COMPREPLY=( $(compgen -W "${ports}" -- ${cur}) ) + return 0 + ;; esac # Handle option arguments case "${cur}" in -*) - # Option completion - local options="--non-interactive --name --provider --model --api-key --base-url --set-active --format --output" + # Option completion based on context + if [[ "${COMP_WORDS[1]}" == "server" ]]; then + local options="--port --host" + elif [[ "${COMP_WORDS[1]}" == "config" && "${COMP_WORDS[2]}" == "add" ]]; then + local options="--name --provider --model --api-key --base-url --activate" + elif [[ "${COMP_WORDS[1]}" == "config" && "${COMP_WORDS[2]}" == "export" ]]; then + local options="--format --output" + elif [[ "${COMP_WORDS[1]}" == "analytics" ]]; then + local options="--report --clear" + elif [[ "${COMP_WORDS[1]}" == "dashboard" ]]; then + local options="--clear" + else + local options="--help --version" + fi COMPREPLY=( $(compgen -W "${options}" -- ${cur}) ) return 0 ;; @@ -84,5 +126,5 @@ except: return 0 } -complete -F _maxclaw_completions python3 config_cli.py -complete -F _maxclaw_completions python config_cli.py \ No newline at end of file +complete -F _langcode_completions langcode +complete -F _langcode_completions langcode.py diff --git a/completions/langcode.zsh b/completions/langcode.zsh index b56b33d..a76bc4c 100644 --- a/completions/langcode.zsh +++ b/completions/langcode.zsh @@ -1,8 +1,8 @@ -#compdef config_cli.py -# Zsh completion for MaxClaw Agent CLI +#compdef langcode +# Zsh completion for LangCode Agent CLI -_maxclaw() { - local -a commands +_langcode() { + local -a commands config_subcommands local curcontext="$curcontext" state line typeset -A opt_args @@ -13,39 +13,65 @@ _maxclaw() { case $state in command) commands=( - 'list:List all configurations' - 'search:Search configurations' - 'add:Add a new configuration' - 'remove:Remove a configuration' - 'set-active:Set active configuration' - 'active:Show active configuration' - 'test:Test connection to a configuration' - 'export:Export configurations to JSON/YAML' - 'import:Import configurations from JSON/YAML' - 'help:Show help' + 'chat:Avvia l'\''agent in modalità chat' + 'server:Avvia il web server' + 'tui:Apre TUI per gestione configurazioni' + 'config:Gestione configurazioni' + 'analytics:Mostra analytics' + 'dashboard:Mostra dashboard performance' + 'version:Mostra versione' ) - _describe -t commands 'MaxClaw commands' commands + _describe -t commands 'LangCode commands' commands ;; args) case ${line[1]} in - search) - _message 'search term' + config) + config_subcommands=( + 'list:Lista configurazioni' + 'add:Aggiungi configurazione' + 'remove:Rimuovi configurazione' + 'use:Attiva configurazione' + 'active:Mostra configurazione attiva' + 'test:Testa connessione configurazione' + 'export:Esporta configurazioni' + 'import:Importa configurazioni' + 'search:Cerca configurazioni' + ) + _describe -t config_commands 'config commands' config_subcommands ;; - add) + server) _arguments \ - '--non-interactive[Non-interactive mode]' \ - '--name[Configuration name]:name' \ - '--provider[Provider]:provider:(openai ollama openrouter)' \ - '--model[Model name]:model' \ - '--api-key[API key]:api_key' \ - '--base-url[Base URL]:base_url' \ - '--set-active[Set as active configuration]' + '--port[Porta del server]:port:(8000 3000 8080 5000)' \ + '--host[Host del server]:host' ;; - remove|set-active|test) - # Try to get configuration names - local -a configs - if (( $+commands[python3] )); then - configs=(${(f)"$(python3 -c " + analytics) + _arguments \ + '--report[Genera report completo]' \ + '--clear[Cancella dati analytics]' + ;; + dashboard) + _arguments \ + '--clear[Cancella dati performance]' + ;; + config) + case ${line[2]} in + search) + _message 'termine di ricerca' + ;; + add) + _arguments \ + '--name[Nome configurazione]:name' \ + '--provider[Provider]:provider:(openai ollama openrouter anthropic google)' \ + '--model[Modello]:model' \ + '--api-key[API key]:api_key' \ + '--base-url[Base URL]:base_url' \ + '--activate[Attiva dopo la creazione]' + ;; + remove|use|test) + # Try to get configuration names + local -a configs + if (( $+commands[python3] )); then + configs=(${(f)"$(python3 -c " import sys sys.path.insert(0, '.') try: @@ -56,24 +82,26 @@ try: except: pass " 2>/dev/null)"}) - fi - if (( ${#configs} )); then - _describe -t configurations 'configurations' configs - else - _message 'configuration name' - fi - ;; - export) - _arguments \ - '--format[Export format]:format:(json yaml)' \ - '--output[Output filename]:filename' - ;; - import) - _files -g '*.json *.yaml *.yml' + fi + if (( ${#configs} )); then + _describe -t configurations 'configurazioni' configs + else + _message 'nome configurazione' + fi + ;; + export) + _arguments \ + '--format[Formato export]:format:(json yaml)' \ + '--output[File output]:filename' + ;; + import) + _files -g '*.json *.yaml *.yml' + ;; + esac ;; esac ;; esac } -_maxclaw "$@" \ No newline at end of file +_langcode "$@"