tui

package
v6.9.0-aug.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package tui provides a terminal-based management interface for CLIProxyAPI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(port int, secretKey string, hook *LogHook, output io.Writer) error

Run starts the TUI application. output specifies where bubbletea renders. If nil, defaults to os.Stdout.

Types

type Client

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

Client wraps HTTP calls to the management API.

func NewClient

func NewClient(port int, secretKey string) *Client

NewClient creates a new management API client.

func (*Client) DeleteAuthFile

func (c *Client) DeleteAuthFile(name string) error

DeleteAuthFile deletes a single auth file by name.

func (*Client) DeleteField

func (c *Client) DeleteField(path string) error

DeleteField sends a DELETE request for a config field.

func (*Client) GetAPIKeys

func (c *Client) GetAPIKeys() ([]string, error)

GetAPIKeys fetches the list of API keys. API returns {"api-keys": [...]}.

func (*Client) GetAuthStatus

func (c *Client) GetAuthStatus(state string) (string, string, error)

GetAuthStatus polls the OAuth session status. Returns status ("wait", "ok", "error") and optional error message.

func (*Client) GetClaudeKeys

func (c *Client) GetClaudeKeys() ([]map[string]any, error)

GetClaudeKeys fetches Claude API keys.

func (*Client) GetCodexKeys

func (c *Client) GetCodexKeys() ([]map[string]any, error)

GetCodexKeys fetches Codex API keys.

func (*Client) GetConfig

func (c *Client) GetConfig() (map[string]any, error)

GetConfig fetches the parsed config.

func (*Client) GetConfigYAML

func (c *Client) GetConfigYAML() (string, error)

GetConfigYAML fetches the raw config.yaml content.

func (*Client) GetDebug

func (c *Client) GetDebug() (bool, error)

GetDebug fetches the current debug setting.

func (*Client) GetGeminiKeys

func (c *Client) GetGeminiKeys() ([]map[string]any, error)

GetGeminiKeys fetches Gemini API keys. API returns {"gemini-api-key": [...]}.

func (*Client) GetLogs

func (c *Client) GetLogs(after int64, limit int) ([]string, int64, error)

GetLogs fetches log lines from the server.

func (*Client) GetOpenAICompat

func (c *Client) GetOpenAICompat() ([]map[string]any, error)

GetOpenAICompat fetches OpenAI compatibility entries.

func (*Client) PatchAuthFileFields

func (c *Client) PatchAuthFileFields(name string, fields map[string]any) error

PatchAuthFileFields updates editable fields on an auth file.

func (*Client) PutConfigYAML

func (c *Client) PutConfigYAML(yamlContent string) error

PutConfigYAML uploads new config.yaml content.

type LogHook

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

LogHook is a logrus hook that captures log entries and sends them to a channel.

func NewLogHook

func NewLogHook(bufSize int) *LogHook

NewLogHook creates a new LogHook with a buffered channel of the given size.

func (*LogHook) Chan

func (h *LogHook) Chan() <-chan string

Chan returns the channel to read log lines from.

func (*LogHook) Fire

func (h *LogHook) Fire(entry *log.Entry) error

Fire is called by logrus when a log entry is fired.

func (*LogHook) Levels

func (h *LogHook) Levels() []log.Level

Levels returns the log levels this hook should fire on.

func (*LogHook) SetFormatter

func (h *LogHook) SetFormatter(f log.Formatter)

SetFormatter sets a custom formatter for the hook.

Jump to

Keyboard shortcuts

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