chatcli

command module
v1.103.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

README

ChatCLI Logo

ChatCLI

A plataforma de IA unificada para terminal, servidor e Kubernetes.
12 provedores. 12 agentes autônomos. Um único binário.


EnglishDocumentação completa


ChatCLI Demo


ChatCLI conecta os maiores modelos de linguagem do mercado a uma interface única e extensível — do chatcli -p no seu terminal até um operador Kubernetes com pipeline AIOps autônomo, passando por um servidor gRPC production-ready com autenticação, fallback e métricas.


Por que o ChatCLI?

Multi-provider de verdade 12 provedores de LLM com fallback automático, backoff exponencial e cooldown inteligente.
Agentes autônomos 12 agentes especializados com motor ReAct (Reason + Act) e execução em paralelo.
Production-ready gRPC + TLS, JWT + RBAC, AES-256-GCM, rate limiting, audit logging, Prometheus metrics.
Kubernetes-native Operador com 17 CRDs e pipeline AIOps autônomo: 54+ ações de remediação automatizada.
Extensível Plugins com verificação de assinatura, skills multi-registry (skills.sh, ClawHub), hooks de lifecycle, MCP.

Instalação

# Homebrew (macOS / Linux)
brew tap diillson/chatcli && brew install chatcli

# Go install
go install github.com/diillson/chatcli@latest

# Binários pre-compilados
# https://github.com/diillson/chatcli/releases
Compilação a partir do código-fonte
git clone https://github.com/diillson/chatcli.git && cd chatcli
go mod tidy && go build -o chatcli

# Com informações de versão
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
go build -ldflags "-X github.com/diillson/chatcli/version.Version=${VERSION}" -o chatcli

Configuração rápida

Crie um arquivo .env na raiz ou exporte as variáveis:

LLM_PROVIDER=OPENAI          # OPENAI, CLAUDEAI, GOOGLEAI, XAI, ZAI, MINIMAX, COPILOT, OLLAMA, STACKSPOT, OPENROUTER
OPENAI_API_KEY=sk-xxx         # Chave do provider escolhido
Referência completa de variáveis por provider
Provider API Key Model Extras
OpenAI OPENAI_API_KEY OPENAI_MODEL OPENAI_MAX_TOKENS, OPENAI_USE_RESPONSES
Anthropic ANTHROPIC_API_KEY ANTHROPIC_MODEL ANTHROPIC_MAX_TOKENS
Google Gemini GOOGLEAI_API_KEY GOOGLEAI_MODEL GOOGLEAI_MAX_TOKENS
xAI XAI_API_KEY XAI_MODEL XAI_MAX_TOKENS
ZAI ZAI_API_KEY ZAI_MODEL ZAI_MAX_TOKENS
MiniMax MINIMAX_API_KEY MINIMAX_MODEL MINIMAX_MAX_TOKENS
GitHub Copilot GITHUB_COPILOT_TOKEN COPILOT_MODEL ou /auth login github-copilot
GitHub Models GITHUB_TOKEN GITHUB_MODELS_MODEL GH_TOKEN, GITHUB_MODELS_TOKEN
StackSpot CLIENT_ID, CLIENT_KEY - STACKSPOT_REALM, STACKSPOT_AGENT_ID
OpenRouter OPENROUTER_API_KEY - OPENROUTER_MAX_TOKENS, OPENROUTER_FALLBACK_MODELS
Ollama - OLLAMA_MODEL OLLAMA_ENABLED=true, OLLAMA_BASE_URL

Três modos de operação

O ChatCLI adapta-se ao seu contexto — da máquina de um desenvolvedor a um cluster Kubernetes em produção.


CLI Interativa

Para desenvolvedores individuais. Terminal inteligente com TUI (Bubble Tea), contexto de projeto, tool calling e agentes.

chatcli
chatcli -p "Explique este repo"
git diff | chatcli -p "Resuma"

Servidor gRPC

Para equipes e plataformas. Servidor centralizado com TLS, autenticação, fallback, métricas Prometheus, MCP e discovery de plugins.

chatcli server --port 50051 \
  --token meu-token
chatcli connect \
  --server host:50051 \
  --token meu-token

Kubernetes Operator

Para operações em escala. Pipeline AIOps autônomo com 17 CRDs, 54+ ações de remediação, SLO monitoring e post-mortems automatizados.

helm install chatcli-operator \
  oci://ghcr.io/diillson/charts/chatcli-operator \
  --namespace aiops-system \
  --create-namespace

Comandos contextuais do modo CLI

Injete dados do ambiente diretamente no prompt:

Comando O que faz
@git Status, branches e commits recentes
@file <path> Conteúdo de arquivos/diretórios
@env Variáveis de ambiente
@history Últimos comandos do shell
@command <cmd> Executa e injeta a saída
Exemplo de manifesto Kubernetes (Instance CRD)
apiVersion: platform.chatcli.io/v1alpha1
kind: Instance
metadata:
  name: chatcli-prod
spec:
  provider: ZAI
  model: glm-5
  replicas: 2
  fallback:
    enabled: true
    providers:
      - name: OPENAI
        model: gpt-5.4
      - name: MINIMAX
        model: MiniMax-M2.7
helm install chatcli oci://ghcr.io/diillson/charts/chatcli \
  --namespace chatcli --create-namespace \
  --set llm.provider=OPENAI --set secrets.openaiApiKey=sk-xxx

Provedores suportados

12 provedores com interface unificada. Fallback automático entre providers com classificação inteligente de erros.

Provider Default Model Tool Calling Vision
OpenAI gpt-5.4 Nativo Sim
Anthropic (Claude) claude-sonnet-4-6 Nativo Sim
Google Gemini gemini-2.5-flash Nativo Sim
xAI (Grok) grok-4-1 XML fallback -
ZAI (Zhipu AI) glm-5 Nativo Sim
MiniMax MiniMax-M2.7 Nativo Sim
GitHub Copilot gpt-4o Nativo Sim
GitHub Models gpt-4o Nativo Sim
StackSpot AI StackSpotAI - -
OpenRouter openai/gpt-4o Nativo Sim
Ollama (local) XML fallback -
OpenAI Assistants gpt-4o Assistants API -
# Fallback chain configurável
CHATCLI_FALLBACK_PROVIDERS=OPENAI,CLAUDEAI,ZAI,MINIMAX,OPENROUTER

Classificação de erros (rate limit, timeout, auth, context overflow), backoff exponencial e cooldown por provider.


Agentes autônomos

Motor ReAct (Reason + Act) com 12 agentes especializados executando em paralelo.

/coder "Refatore o módulo auth para usar JWT"
chatcli -p "Crie testes para o pacote utils" --agent-auto-exec

Os agentes operam de forma coordenada, decompondo tarefas complexas em subtarefas e delegando para os workers mais adequados:

Agente Responsabilidade
File Leitura, escrita e manipulação de arquivos
Coder Geração e edição de código
Shell Execução de comandos no sistema
Git Operações de versionamento
Search Busca em código e arquivos
Planner Decomposição de tarefas complexas
Reviewer Code review automatizado
Tester Geração e execução de testes
Refactor Refatoração segura de código
Diagnostics Análise e debug de problemas
Formatter Formatação e linting
Deps Gerenciamento de dependências

Enterprise Security

Segurança não é um feature flag. É a fundação de cada camada do ChatCLI.

O ChatCLI implementa segurança defense-in-depth, da autenticação ao armazenamento, da rede ao plugin system.

Autenticação e autorização

  • JWT com RBAC (Role-Based Access Control)
  • OAuth PKCE + Device Flow (RFC 8628)
  • Token refresh automático por provider

Criptografia

  • AES-256-GCM para credenciais at rest
  • TLS 1.3 para comunicação gRPC
  • Sessões encriptadas em disco

Rede

  • Prevenção de SSRF integrada
  • Rate limiting por client/endpoint
  • Webhook validation no operator

Plugin e agent security

  • Verificação de assinatura Ed25519 para plugins
  • Agent command allowlist (150+ comandos aprovados)
  • Schema validation em plugin discovery

Auditoria e compliance

  • Structured audit logging (JSON)
  • Cost tracking por sessão e provider
  • Prometheus metrics para observabilidade

CI/CD security

  • govulncheck em pipeline CI
  • gosec para análise estática de segurança
  • Scanning automático de dependências
Autenticação OAuth integrada
/auth login openai-codex       # OAuth PKCE + callback local
/auth login anthropic          # OAuth PKCE + code manual
/auth login github-copilot     # Device Flow (RFC 8628)
/auth status                   # Status de todos os providers

Credenciais armazenadas com AES-256-GCM em ~/.chatcli/auth-profiles.json.


Funcionalidades

Cada feature foi projetada para compor com as demais. Plugins descobrem skills. Hooks acionam tools. Contextos alimentam agentes.

Feature Descrição
Tool calling nativo Chamadas estruturadas via API da OpenAI, Anthropic, Google, ZAI, MiniMax e OpenRouter. Cache ephemeral para Anthropic. XML fallback automático para providers sem suporte nativo.
MCP (Model Context Protocol) Integração com servidores MCP via stdio e SSE para contexto expandido.
Contextos persistentes /context create, /context attach — injeta projetos inteiros no system prompt com cache hints.
Bootstrap e Memória SOUL.md, USER.md, IDENTITY.md, RULES.md + memória de longo prazo com facts e decay.
Plugins Sistema extensível com auto-detecção, schema validation, verificação de assinatura e plugins remotos.
Skills Registry multi-source (skills.sh, ClawHub, ChatCLI.dev) com busca fuzzy, auditorias de segurança, preferências de source e instalação atômica.
Agentes customizáveis Personas em Markdown com frontmatter YAML (model, tools, skills).
Hooks Lifecycle events (PreToolUse, PostToolUse, SessionStart) com shell commands e webhooks.
WebFetch / WebSearch Busca DuckDuckGo e fetch de páginas com extração de texto.
Cost tracking Custo por sessão com pricing tables por provider.
Git Worktrees Trabalho isolado em branches paralelas.
K8s Watcher Monitoramento multi-target com métricas, logs, events e Prometheus scraping.
i18n Interface em Português e Inglês com detecção automática.
Session management Save, load, fork e export de conversas.
Exemplo de configuração MCP
// ~/.chatcli/mcp_servers.json
{
  "servers": [
    {
      "name": "filesystem",
      "transport": "stdio",
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-filesystem", "/workspace"]
    },
    {
      "name": "search",
      "transport": "sse",
      "url": "http://mcp-search:8080/sse"
    }
  ]
}

Arquitetura

chatcli/
  cli/            Interface TUI (Bubble Tea), modo agente, multi-agent workers
  llm/            12 providers, registry auto-registro, fallback chain, catalog
  pkg/registry/   Skill registries multi-source (skills.sh, ClawHub, custom), instalação atômica
  pkg/persona/    Skills, agentes customizáveis, resolução por preferência
  server/         Servidor gRPC com TLS, JWT auth, metrics e MCP
  operator/       Kubernetes Operator — 17 CRDs, pipeline AIOps autônomo
  k8s/            Watcher (collectors, store, summarizer)
  models/         Tipos compartilhados (ToolDefinition, ToolCall, LLMResponse)
  auth/           OAuth PKCE, Device Flow, token refresh, store encriptado (AES-256-GCM)
  config/         ConfigManager com migração versionada
  i18n/           Internacionalização (embed.FS + golang.org/x/text)

Princípio de design: cada pacote define suas interfaces e se auto-registra no sistema. O llm/ registry permite adicionar um novo provider implementando uma única interface. O operator/ coordena CRDs independentes via controller pattern.


Contribuição

  1. Fork o repositório
  2. Crie uma branch a partir da main: git checkout -b feature/minha-feature
  3. Commit e push
  4. Abra um Pull Request

Licença

Apache License 2.0


DocumentaçãoReleasesHelm ChartsIssues

Documentation

Overview

ChatCLI is a multi-provider AI platform for terminal, server, and Kubernetes.

It connects 11 LLM providers (OpenAI, Anthropic Claude, Google Gemini, xAI Grok, ZAI, MiniMax, GitHub Copilot, GitHub Models, StackSpot AI, Ollama, and OpenAI Assistants) to a unified interface with autonomous agents, native tool calling, automatic provider failover, and a full AIOps pipeline.

Three Modes of Operation

  • Interactive CLI: Terminal-based TUI (Bubble Tea) with context injection, 12 specialized agents running in parallel, and tool calling.
  • gRPC Server: Centralized server with JWT + RBAC authentication, TLS 1.3, rate limiting, Prometheus metrics, MCP integration, and plugin/agent discovery.
  • Kubernetes Operator: 17 CRDs powering an autonomous AIOps pipeline with anomaly detection, AI-driven root cause analysis, 54+ automated remediation actions, approval workflows, SLO monitoring, and auto-generated post-mortems.

Key Features

  • Multi-provider with automatic failover and exponential backoff
  • ReAct engine with 12 specialized agents (File, Coder, Shell, Git, Search, Planner, Reviewer, Tester, Refactor, Diagnostics, Formatter, Deps)
  • Native tool calling via OpenAI, Anthropic, Google, ZAI, and MiniMax APIs
  • MCP (Model Context Protocol) for extending LLM capabilities
  • OAuth PKCE + Device Flow authentication with AES-256-GCM encrypted storage
  • Plugin system with Ed25519 signature verification
  • Persistent contexts, bootstrap files (SOUL.md, USER.md), and long-term memory
  • Session management with AES-256-GCM encryption at rest
  • Cost tracking per session and provider
  • Internationalization (Portuguese and English)

Enterprise Security

  • JWT authentication with RBAC roles (admin, user, readonly)
  • AES-256-GCM encryption for credentials and sessions
  • TLS 1.3 enforcement with mTLS support
  • SSRF prevention blocking private IPs and cloud metadata endpoints
  • Per-client token-bucket rate limiting
  • Ed25519 plugin signature verification
  • Agent command allowlist (150+ pre-approved commands)
  • Structured audit logging (JSON lines)
  • Automated security scanning (govulncheck, gosec, Dependabot)

Installation

brew tap diillson/chatcli && brew install chatcli

Or:

go install github.com/diillson/chatcli@latest

Full documentation: https://chatcli.edilsonfreitas.com

Source code: https://github.com/diillson/chatcli

  • ChatCLI - Command Line Interface for LLM interaction
  • Copyright (c) 2024 Edilson Freitas
  • License: Apache-2.0

Directories

Path Synopsis
Package auth provides OAuth authentication flows and secure credential storage for ChatCLI's multi-provider LLM integration.
Package auth provides OAuth authentication flows and secure credential storage for ChatCLI's multi-provider LLM integration.
cli
agent
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
agent/workers
* ChatCLI - Builtin agent model/effort metadata * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * Shared base struct providing Model() and Effort() for built-in workers.
* ChatCLI - Builtin agent model/effort metadata * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * Shared base struct providing Model() and Effort() for built-in workers.
bus
coder
* ChatCLI - Denial Tracker * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * Tracks consecutive and total denials to prevent infinite permission prompting.
* ChatCLI - Denial Tracker * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * Tracks consecutive and total denials to prevent infinite permission prompting.
ctxmgr
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
mcp
metrics
Go Multi-Agent - Metrics Display
Go Multi-Agent - Metrics Display
paste
* ChatCLI - Paste Detection * cli/paste/detector.go * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Paste Detection * cli/paste/detector.go * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
plugins
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
client
remote
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
Package config provides configuration management for ChatCLI with environment variable loading, versioned migration, and runtime defaults.
Package config provides configuration management for ChatCLI with environment variable loading, versioned migration, and runtime defaults.
Package i18n provides internationalization support for ChatCLI with automatic locale detection and embedded translation files.
Package i18n provides internationalization support for ChatCLI with automatic locale detection and embedded translation files.
llm
bedrock
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
claudeai
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
client
Package client defines the LLMClient interface that all LLM providers must implement, along with shared types for tool calling, streaming, and metrics instrumentation.
Package client defines the LLMClient interface that all LLM providers must implement, along with shared types for tool calling, streaming, and metrics instrumentation.
copilot
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
fallback
Package fallback implements the provider fallback chain for automatic failover between LLM providers.
Package fallback implements the provider fallback chain for automatic failover between LLM providers.
github_models
* ChatCLI - GitHub Models marketplace provider * Uses OpenAI-compatible API at models.inference.ai.azure.com * Auth: GitHub Personal Access Token (PAT) * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - GitHub Models marketplace provider * Uses OpenAI-compatible API at models.inference.ai.azure.com * Auth: GitHub Personal Access Token (PAT) * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
googleai
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
manager
Package manager provides the LLM provider manager that creates and caches LLM clients based on provider name and model configuration.
Package manager provides the LLM provider manager that creates and caches LLM clients based on provider name and model configuration.
minimax
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
ollama
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
openai
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
openai_assistant
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
openai_responses
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
openrouter
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
registry
Package registry provides the auto-register mechanism for LLM providers.
Package registry provides the auto-register mechanism for LLM providers.
stackspotai
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
token
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
toolshim
Package toolshim provides a conversion layer that enables LLM providers without native tool calling support to use structured tool definitions.
Package toolshim provides a conversion layer that enables LLM providers without native tool calling support to use structured tool definitions.
xai
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
zai
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
Package models defines the shared data types used across all ChatCLI components — CLI, server, operator, and LLM providers.
Package models defines the shared data types used across all ChatCLI components — CLI, server, operator, and LLM providers.
operator module
pkg
persona
* ChatCLI - Persona System * pkg/persona/builder.go * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Persona System * pkg/persona/builder.go * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
registry
* ChatCLI - ChatCLI.dev Registry Adapter * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * Implements SkillRegistry for the official ChatCLI skill registry.
* ChatCLI - ChatCLI.dev Registry Adapter * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * Implements SkillRegistry for the official ChatCLI skill registry.
plugins-examples
chatcli-coder command
proto
tools
docgen command
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL