cliui

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cliui renders human-oriented CLI output: bordered panels and columns on wide interactive terminals. Layout (boxes/columns) is independent of ANSI color: use --no-color or NO_COLOR to disable colors only; narrow or non-TTY stdout falls back to plain line-oriented output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatCLIError

func FormatCLIError(msg string, ctx *cobra.Command) string

FormatCLIError formats errors with the same boxed sections as help. When ctx is the command that was running when the error occurred, Usage / Flags panels are appended so styling matches facet-studio -h.

func Init

func Init(disableAnsiColors bool)

Init configures lipgloss for this process. When disableAnsiColors is true (e.g. --no-color, NO_COLOR, or TERM=dumb), only color is turned off; Unicode borders still render when UseFancyLayout() is true.

func InnerStderrWidth

func InnerStderrWidth() int

InnerStderrWidth mirrors InnerWidth but for stderr.

func InnerWidth

func InnerWidth() int

InnerWidth is the target content width inside borders/margins.

func PrintMCPList

func PrintMCPList(w io.Writer, rows []MCPListRow)

PrintMCPList renders the mcp list output (plain or fancy).

func PrintMCPShow

func PrintMCPShow(w io.Writer, server MCPShowServer, tools []MCPShowTool, disabled bool)

PrintMCPShow renders the mcp show output (plain or fancy). w is where the output is written; pass cmd.OutOrStdout() from cobra commands.

func PrintOnboardComplete

func PrintOnboardComplete(logo string, encrypt bool, configPath string)

PrintOnboardComplete prints the post-onboard “ready” message and next steps.

func PrintStatus

func PrintStatus(r StatusReport)

PrintStatus renders facet-studio status (plain or fancy).

func PrintVersion

func PrintVersion(logo, versionLine string, build, goVer string)

PrintVersion prints version, optional build info, and Go toolchain line.

func RenderCommandHelp

func RenderCommandHelp(c *cobra.Command) string

RenderCommandHelp builds Ruff-style sectioned, two-column help when UseFancyLayout(); otherwise plain Cobra-style text.

func RenderCommandQuickRef

func RenderCommandQuickRef(c *cobra.Command, outerW int) string

RenderCommandQuickRef prints the same Usage / Flags / Global sections as help, for embedding after errors (stderr). outerW is typically InnerStderrWidth().

func StderrWidth

func StderrWidth() int

StderrWidth returns stderr terminal width or a sane default.

func StdoutWidth

func StdoutWidth() int

StdoutWidth returns the terminal width or a sane default if unknown.

func UseColumnLayout

func UseColumnLayout() bool

UseColumnLayout is true when a second content column is viable.

func UseFancyLayout

func UseFancyLayout() bool

UseFancyLayout is true when styled boxes/columns should be used.

func UseFancyStderr

func UseFancyStderr() bool

UseFancyStderr is true when stderr can show boxed errors without ugly wraps.

Types

type MCPListRow

type MCPListRow struct {
	Name              string
	Type              string
	Target            string
	Status            string // "enabled", "disabled", "ok (N tools)", "error"
	EffectiveDeferred bool   // resolved value (per-server override or global default)
	DeferredExplicit  bool   // true = per-server override set, false = inherited from global
}

MCPListRow is one row in the mcp list output.

type MCPShowParam

type MCPShowParam struct {
	Name        string
	Type        string
	Description string
	Required    bool
}

MCPShowParam is one parameter entry.

type MCPShowServer

type MCPShowServer struct {
	Name              string
	Type              string
	Target            string
	Enabled           bool
	EffectiveDeferred bool     // resolved value (per-server override or global default)
	DeferredExplicit  bool     // true = per-server override set, false = inherited from global
	EnvKeys           []string // sorted env var names (values intentionally omitted)
	EnvFile           string
	Headers           []string // sorted header names
}

MCPShowServer holds the server metadata for PrintMCPShow.

type MCPShowTool

type MCPShowTool struct {
	Name        string
	Description string
	Parameters  []MCPShowParam
}

MCPShowTool holds one tool's info for PrintMCPShow.

type ProviderRow

type ProviderRow struct {
	Name string
	Val  string
}

ProviderRow holds one provider's display name and status value.

type StatusReport

type StatusReport struct {
	Version       string
	Build         string
	ConfigPath    string
	ConfigOK      bool
	WorkspacePath string
	WorkspaceOK   bool
	Model         string
	Providers     []ProviderRow
	OAuthLines    []string // each full line "provider (method): state"
}

StatusReport is a structured status view for PrintStatus.

Jump to

Keyboard shortcuts

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