cli

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: MIT

* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: MIT

* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: MIT

* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: MIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMode

type AgentMode struct {
	// contains filtered or unexported fields
}

AgentMode representa a funcionalidade de agente autônomo no ChatCLI

func NewAgentMode

func NewAgentMode(cli *ChatCLI, logger *zap.Logger) *AgentMode

NewAgentMode cria uma nova instância do modo agente

func (*AgentMode) Run

func (a *AgentMode) Run(ctx context.Context, query string, additionalContext string) error

Run inicia o modo agente com uma pergunta do usuário

type AnimationManager

type AnimationManager struct {
	// contains filtered or unexported fields
}

func NewAnimationManager

func NewAnimationManager() *AnimationManager

func (*AnimationManager) ShowThinkingAnimation

func (am *AnimationManager) ShowThinkingAnimation(message string)

ShowThinkingAnimation inicia ou atualiza a animação "pensando"

func (*AnimationManager) StopThinkingAnimation

func (am *AnimationManager) StopThinkingAnimation()

StopThinkingAnimation para a animação de forma segura

func (*AnimationManager) UpdateMessage

func (am *AnimationManager) UpdateMessage(message string)

UpdateMessage atualiza a mensagem sem parar e reiniciar a animação

type ChatCLI

type ChatCLI struct {
	Client client.LLMClient
	// contains filtered or unexported fields
}

ChatCLI representa a interface de linha de comando do chat

func NewChatCLI

func NewChatCLI(manager manager.LLMManager, logger *zap.Logger) (*ChatCLI, error)

NewChatCLI cria uma nova instância de ChatCLI

func (*ChatCLI) Start

func (cli *ChatCLI) Start(ctx context.Context)

Start inicia o loop principal do ChatCLI

type CommandBlock

type CommandBlock struct {
	Description string
	Commands    []string
	Language    string
	ContextInfo CommandContextInfo
}

CommandBlock representa um bloco de comandos executáveis

type CommandContextInfo

type CommandContextInfo struct {
	SourceType    SourceType
	FileExtension string
	IsScript      bool
	ScriptType    string // shell, python, etc.
}

CommandContextInfo contém metadados sobre a origem e natureza de um comando

type CommandHandler

type CommandHandler struct {
	// contains filtered or unexported fields
}

func NewCommandHandler

func NewCommandHandler(cli *ChatCLI) *CommandHandler

func (*CommandHandler) HandleCommand

func (ch *CommandHandler) HandleCommand(userInput string) bool

Atualizar o método HandleCommand no CommandHandler para incluir os novos comandos

type CommandOutput

type CommandOutput struct {
	CommandBlock CommandBlock
	Output       string
	ErrorMsg     string
}

type FileChunk

type FileChunk struct {
	Index   int
	Total   int
	Content string
}

FileChunk representa um pedaço do conteúdo de arquivos

type HistoryManager

type HistoryManager struct {
	// contains filtered or unexported fields
}

func NewHistoryManager

func NewHistoryManager(logger *zap.Logger) *HistoryManager

func (*HistoryManager) LoadHistory

func (hm *HistoryManager) LoadHistory() ([]string, error)

LoadHistory carrega o histórico do arquivo

func (*HistoryManager) SaveHistory

func (hm *HistoryManager) SaveHistory(commandHistory []string) error

SaveHistory salva o histórico no arquivo e faz backup se o tamanho exceder o limite

type Liner

type Liner interface {
	Prompt(string) (string, error)
	Close() error
	SetCtrlCAborts(bool)
	AppendHistory(string)
	SetCompleter(liner.Completer)
}

Adicione a interface Liner

type Logger

type Logger interface {
	Info(msg string, fields ...zap.Field)
	Error(msg string, fields ...zap.Field)
	Warn(msg string, fields ...zap.Field)
	Sync() error
}

Logger interface para facilitar a testabilidade

type SourceType

type SourceType int
const (
	SourceTypeUserInput SourceType = iota
	SourceTypeFile
	SourceTypeCommandOutput
)

Jump to

Keyboard shortcuts

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