output

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustPrintJSON added in v0.3.0

func MustPrintJSON(data interface{})

MustPrintJSON prints JSON and panics on error (for simple cases)

func PrintJSON added in v0.3.0

func PrintJSON(data interface{}) error

PrintJSON is a helper function to print any data as JSON

Types

type AgentInfo added in v0.3.0

type AgentInfo struct {
	Name        string `json:"name"`
	Scope       string `json:"scope"`
	Tool        string `json:"tool"`
	Description string `json:"description,omitempty"`
	Model       string `json:"model,omitempty"`
	Path        string `json:"path,omitempty"`
}

AgentInfo represents agent information in JSON output

type CLIOutput added in v0.3.0

type CLIOutput struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data,omitempty"`
	Error   string      `json:"error,omitempty"`
}

CLIOutput represents a structured output for machine-parseable JSON responses

type CommandInfo added in v0.3.0

type CommandInfo struct {
	Name        string `json:"name"`
	Scope       string `json:"scope"`
	Tool        string `json:"tool,omitempty"`
	Description string `json:"description,omitempty"`
}

CommandInfo represents command information in JSON output

type CopyResourceResult added in v0.3.0

type CopyResourceResult struct {
	Type       string `json:"type"` // "command", "rule", "skill"
	Name       string `json:"name"`
	FromScope  string `json:"fromScope"`
	ToScope    string `json:"toScope"`
	SourcePath string `json:"sourcePath"`
	TargetPath string `json:"targetPath"`
}

CopyResourceResult represents the JSON output for resource copy commands

type DoctorConfigResult added in v0.3.0

type DoctorConfigResult struct {
	Path        string `json:"path"`
	Valid       bool   `json:"valid"`
	Error       string `json:"error,omitempty"`
	ServerCount int    `json:"serverCount"`
}

DoctorConfigResult represents the config check result

type DoctorOutput added in v0.3.0

type DoctorOutput struct {
	Config     DoctorConfigResult    `json:"config"`
	Runtimes   []DoctorRuntimeResult `json:"runtimes"`
	Tools      []DoctorToolResult    `json:"tools"`
	Servers    []DoctorServerResult  `json:"servers,omitempty"`
	SyncState  DoctorSyncState       `json:"syncState"`
	System     DoctorSystemInfo      `json:"system"`
	IssueCount int                   `json:"issueCount"`
}

DoctorOutput represents the JSON output for the doctor command

type DoctorRuntimeResult added in v0.3.0

type DoctorRuntimeResult struct {
	Name     string `json:"name"`
	Command  string `json:"command"`
	Version  string `json:"version,omitempty"`
	Found    bool   `json:"found"`
	Required bool   `json:"required"`
}

DoctorRuntimeResult represents a runtime check result

type DoctorServerResult added in v0.3.0

type DoctorServerResult struct {
	Name      string `json:"name"`
	Type      string `json:"type"` // "stdio" or "http"
	Disabled  bool   `json:"disabled"`
	Available bool   `json:"available"`
	Error     string `json:"error,omitempty"`
}

DoctorServerResult represents an MCP server check result

type DoctorSyncState added in v0.3.0

type DoctorSyncState struct {
	Path           string `json:"path"`
	Valid          bool   `json:"valid"`
	Error          string `json:"error,omitempty"`
	ManagedServers int    `json:"managedServers"`
	AdapterCount   int    `json:"adapterCount"`
}

DoctorSyncState represents the sync state check result

type DoctorSystemInfo added in v0.3.0

type DoctorSystemInfo struct {
	OS              string `json:"os"`
	Arch            string `json:"arch"`
	AgentctlVersion string `json:"agentctlVersion"`
	AgentctlCommit  string `json:"agentctlCommit"`
}

DoctorSystemInfo represents system information

type DoctorToolResult added in v0.3.0

type DoctorToolResult struct {
	Name        string `json:"name"`
	ConfigPath  string `json:"configPath"`
	Detected    bool   `json:"detected"`
	Valid       bool   `json:"valid"`
	Error       string `json:"error,omitempty"`
	ServerCount int    `json:"serverCount"`
}

DoctorToolResult represents a tool check result

type JSONWriter added in v0.3.0

type JSONWriter struct {
	Out io.Writer
}

JSONWriter handles JSON output for CLI commands

func NewJSONWriter added in v0.3.0

func NewJSONWriter() *JSONWriter

NewJSONWriter creates a new JSON writer that outputs to stdout

func (*JSONWriter) Write added in v0.3.0

func (w *JSONWriter) Write(output CLIOutput) error

Write outputs a CLIOutput as JSON

func (*JSONWriter) WriteError added in v0.3.0

func (w *JSONWriter) WriteError(err error) error

WriteError outputs an error as JSON

func (*JSONWriter) WriteErrorString added in v0.3.0

func (w *JSONWriter) WriteErrorString(errMsg string) error

WriteErrorString outputs an error string as JSON

func (*JSONWriter) WriteSuccess added in v0.3.0

func (w *JSONWriter) WriteSuccess(data interface{}) error

WriteSuccess outputs a successful result as JSON

type ListOutput added in v0.3.0

type ListOutput struct {
	ProjectPath string        `json:"projectPath,omitempty"`
	Servers     []ServerInfo  `json:"servers,omitempty"`
	Commands    []CommandInfo `json:"commands,omitempty"`
	Rules       []RuleInfo    `json:"rules,omitempty"`
	Skills      []SkillInfo   `json:"skills,omitempty"`
	Plugins     []PluginInfo  `json:"plugins,omitempty"`
	Agents      []AgentInfo   `json:"agents,omitempty"`
}

ListOutput represents the JSON output for the list command

type NewResourceResult added in v0.3.0

type NewResourceResult struct {
	Type  string `json:"type"` // "command", "rule", "skill", "prompt", "agent"
	Name  string `json:"name"`
	Scope string `json:"scope"` // "local" or "global"
	Path  string `json:"path"`
}

NewResourceResult represents the JSON output for resource creation commands (new)

type PluginInfo added in v0.3.0

type PluginInfo struct {
	Name    string `json:"name"`
	Scope   string `json:"scope"`
	Tool    string `json:"tool"`
	Version string `json:"version,omitempty"`
	Status  string `json:"status"`
	Path    string `json:"path,omitempty"`
}

PluginInfo represents plugin information in JSON output

type RuleInfo added in v0.3.0

type RuleInfo struct {
	Name  string `json:"name"`
	Scope string `json:"scope"`
	Tool  string `json:"tool,omitempty"`
	Path  string `json:"path,omitempty"`
}

RuleInfo represents rule information in JSON output

type ServerInfo added in v0.3.0

type ServerInfo struct {
	Name      string `json:"name"`
	Scope     string `json:"scope"`
	Source    string `json:"source"`
	Status    string `json:"status"`
	Command   string `json:"command,omitempty"`
	URL       string `json:"url,omitempty"`
	Transport string `json:"transport,omitempty"`
}

ServerInfo represents server information in JSON output

type SkillInfo added in v0.3.0

type SkillInfo struct {
	Name        string `json:"name"`
	Scope       string `json:"scope"`
	Tool        string `json:"tool,omitempty"`
	Description string `json:"description,omitempty"`
}

SkillInfo represents skill information in JSON output

type SyncChange added in v0.3.0

type SyncChange struct {
	Type     string `json:"type"`     // "add", "update", "remove", "preserve"
	Resource string `json:"resource"` // "server", "command", "rule"
	Name     string `json:"name"`
}

SyncChange represents a single change during sync

type SyncOutput added in v0.3.0

type SyncOutput struct {
	DryRun      bool             `json:"dryRun"`
	ProjectPath string           `json:"projectPath,omitempty"`
	ToolResults []SyncToolResult `json:"toolResults"`
	Summary     SyncSummary      `json:"summary"`
}

SyncOutput represents the JSON output for the sync command

type SyncSummary added in v0.3.0

type SyncSummary struct {
	ToolsSucceeded int `json:"toolsSucceeded"`
	ToolsFailed    int `json:"toolsFailed"`
	TotalServers   int `json:"totalServers"`
	TotalCommands  int `json:"totalCommands"`
	TotalRules     int `json:"totalRules"`
}

SyncSummary represents the summary of a sync operation

type SyncToolResult added in v0.3.0

type SyncToolResult struct {
	Tool           string       `json:"tool"`
	ConfigPath     string       `json:"configPath"`
	Success        bool         `json:"success"`
	Error          string       `json:"error,omitempty"`
	ServersAdded   int          `json:"serversAdded,omitempty"`
	ServersUpdated int          `json:"serversUpdated,omitempty"`
	ServersRemoved int          `json:"serversRemoved,omitempty"`
	CommandsSynced int          `json:"commandsSynced,omitempty"`
	RulesSynced    int          `json:"rulesSynced,omitempty"`
	Changes        []SyncChange `json:"changes,omitempty"`
}

SyncToolResult represents the sync result for a single tool

type Table

type Table struct {
	Headers []string
	Rows    [][]string
	Out     io.Writer
}

Table represents a simple table for output

func NewTable

func NewTable(headers ...string) *Table

NewTable creates a new table

func (*Table) AddRow

func (t *Table) AddRow(cells ...string)

AddRow adds a row to the table

func (*Table) Render

func (t *Table) Render()

Render outputs the table

type ValidateOutput added in v0.3.0

type ValidateOutput struct {
	Results []ValidateToolResult `json:"results"`
	Summary ValidateSummary      `json:"summary"`
}

ValidateOutput represents the JSON output for the validate command

type ValidateSummary added in v0.3.0

type ValidateSummary struct {
	TotalTools   int `json:"totalTools"`
	ValidTools   int `json:"validTools"`
	InvalidTools int `json:"invalidTools"`
}

ValidateSummary represents the summary of validation

type ValidateToolResult added in v0.3.0

type ValidateToolResult struct {
	Tool        string   `json:"tool"`
	ConfigPath  string   `json:"configPath"`
	Valid       bool     `json:"valid"`
	Errors      []string `json:"errors,omitempty"`
	Warnings    []string `json:"warnings,omitempty"`
	ServerCount int      `json:"serverCount"`
}

ValidateToolResult represents the validation result for a single tool

type Writer

type Writer struct {
	Out    io.Writer
	Err    io.Writer
	IsaTTY bool
}

Writer handles formatted output (inspired by gh CLI's iostreams)

func DefaultWriter

func DefaultWriter() *Writer

DefaultWriter creates a writer for stdout/stderr

func (*Writer) Error

func (w *Writer) Error(format string, args ...interface{})

Error prints an error message with an X

func (*Writer) Info

func (w *Writer) Info(format string, args ...interface{})

Info prints an info message

func (*Writer) List

func (w *Writer) List(items []string)

List prints a bulleted list

func (*Writer) ListWithMarker

func (w *Writer) ListWithMarker(items []string, markerIndex int, marker string)

ListWithMarker prints a list with a custom marker for one item

func (*Writer) Print

func (w *Writer) Print(format string, args ...interface{})

Print prints a message without prefix

func (*Writer) Println

func (w *Writer) Println(format string, args ...interface{})

Println prints a message with newline

func (*Writer) Success

func (w *Writer) Success(format string, args ...interface{})

Success prints a success message with a checkmark

func (*Writer) Warning

func (w *Writer) Warning(format string, args ...interface{})

Warning prints a warning message

Jump to

Keyboard shortcuts

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