cli

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Overview

Package cli implements ok's command-line entry: subcommand routing, flag parsing, assembly from config, and exit codes. The core is config-driven — providers and tools are resolved from configuration, not hardcoded.

─── File organization ────────────────────────────────────────────────────

cli.go       — root: flag parsing, subcommand routing, Run()
acp.go       — ACP stdio JSON-RPC server
chat*.go     — chat REPL + Bubbletea TUI model
complete.go  — tab-completion (slash commands, args)
event_handler— TUI event dispatch (approval keys, model, skills)
helpers.go   — TUI helpers (balance, events, rendering updates)
msg.go       — TUI message types
render.go    — TUI rendering helpers
slash.go     — slash-command dispatch (/model, /mcp, /skills)
select.go    — interactive single/multi-select menus
style.go     — ANSI style constants + color detection
theme.go     — JSON theme system
box.go       — ANSI-aware terminal width + border rendering
md.go        — Markdown → ANSI renderer
*             — one-file subcommands (audit, ci, demo, doctor, mcp,
                review, run, session, setup, update, welcome, memory,
                model, agent_cmd, skill_hooks)
chooser.go   — multi-select component for ask tool

The TUI files (chat_tui, event_handler, helpers, msg, render, select, chooser, complete) form a natural cli/tui subpackage candidate.

Package cli provides the command-line interface for OK.

review.go — review pending git changes.

Package cli provides the terminal UI. This file defines the theme system which lets users customize colors, spacing, and rendering style.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoctorSummary

func DoctorSummary() string

func ListThemes

func ListThemes() []string

ListThemes returns all available theme names (built-in + user).

func ReviewChanges

func ReviewChanges(ctx context.Context, ctrl *control.Controller) error

ReviewChanges runs the agent on the current git diff.

func Run

func Run(args []string, version string) int

Run is the CLI entry point; it returns a process exit code.

func ThemeDir

func ThemeDir() string

ThemeDir returns the directory where user themes are stored.

Types

type Theme

type Theme struct {
	// Name identifies the theme for /theme list.
	Name string `json:"name"`

	// Colors
	Primary   string `json:"primary,omitempty"`   // user text / accent
	Secondary string `json:"secondary,omitempty"` // assistant text
	Muted     string `json:"muted,omitempty"`     // reasoning / notices
	Error     string `json:"error,omitempty"`     // error messages
	Success   string `json:"success,omitempty"`   // tool results
	Warning   string `json:"warning,omitempty"`   // warnings
	Bg        string `json:"bg,omitempty"`        // background
	CodeBg    string `json:"code_bg,omitempty"`   // code block background

	// Spacing
	Padding    int `json:"padding,omitempty"`
	Gap        int `json:"gap,omitempty"`
	CodeWidth  int `json:"code_width,omitempty"`
	CodeHeight int `json:"code_height,omitempty"`
}

Theme defines customizable TUI colors and spacing.

func CurrentTheme

func CurrentTheme() Theme

CurrentTheme returns the active theme.

func DefaultTheme

func DefaultTheme() Theme

DefaultTheme returns the built-in dark theme.

func LightTheme

func LightTheme() Theme

LightTheme returns a light mode theme.

func SetTheme

func SetTheme(name string) (Theme, error)

SetTheme switches the active theme by name. Returns the resolved theme.

func SolarizedTheme

func SolarizedTheme() Theme

SolarizedTheme returns a solarized-inspired theme.

Jump to

Keyboard shortcuts

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