outputstyle

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package outputstyle loads and applies named response style settings.

Index

Constants

View Source
const StateFileName = "output-style.json"

StateFileName is the workspace-local file that stores the selected output style.

Variables

This section is empty.

Functions

func RenderPrompt

func RenderPrompt(configHome, workspace string) string

RenderPrompt renders the selected output style as system-prompt context.

func RenderText

func RenderText(w io.Writer, report Report)

RenderText writes a human-readable output style report.

func SaveState

func SaveState(workspace string, state State) error

SaveState persists the workspace's output style selection atomically.

func StatePath

func StatePath(workspace string) string

StatePath returns the workspace-local path used to persist output style state.

Types

type DiscoveryRoot

type DiscoveryRoot struct {
	Source string `json:"source"`
	Label  string `json:"label"`
	Path   string `json:"path,omitempty"`
	Exists bool   `json:"exists"`
}

DiscoveryRoot describes a catalog location that can provide output styles.

func Sources

func Sources(configHome, workspace string) []DiscoveryRoot

Sources reports the output style catalog roots in effective precedence order.

type HealthSummary

type HealthSummary struct {
	Total     int `json:"total"`
	Effective int `json:"effective"`
	Shadowed  int `json:"shadowed"`
}

HealthSummary summarizes effective and shadowed output style definitions.

type NotFoundError

type NotFoundError struct {
	Name string
}

NotFoundError reports that a named output style could not be found.

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Report

type Report struct {
	Kind        string          `json:"kind"`
	Action      string          `json:"action"`
	Status      string          `json:"status"`
	Active      string          `json:"active,omitempty"`
	Query       string          `json:"query,omitempty"`
	Styles      []StyleSummary  `json:"styles,omitempty"`
	Style       *Style          `json:"style,omitempty"`
	Sources     []DiscoveryRoot `json:"sources,omitempty"`
	SourceCount int             `json:"source_count,omitempty"`
	Summary     *HealthSummary  `json:"summary,omitempty"`
	Message     string          `json:"message,omitempty"`
}

Report is the JSON and text-rendering payload for output style commands.

func Audit

func Audit(configHome, workspace string) (Report, error)

Audit reports output style catalog health and shadowing diagnostics.

func Clear

func Clear(workspace string) (Report, error)

Clear removes the workspace's selected output style.

func List

func List(configHome, workspace string) (Report, error)

List reports every discovered output style with precedence diagnostics.

func Search(configHome, workspace, query string) (Report, error)

Search reports output styles whose name, source, preview, or body matches query.

func Set

func Set(configHome, workspace, name string) (Report, error)

Set selects the effective output style with the requested name for workspace.

func Show

func Show(configHome, workspace, name string) (Report, error)

Show reports the effective output style with the requested name.

type State

type State struct {
	Kind      string    `json:"kind"`
	Active    string    `json:"active,omitempty"`
	UpdatedAt time.Time `json:"updated_at"`
}

State stores the workspace's active output style selection.

func LoadState

func LoadState(workspace string) (State, error)

LoadState reads the workspace's persisted output style selection.

type Style

type Style struct {
	Name    string `json:"name"`
	Source  string `json:"source"`
	Path    string `json:"path,omitempty"`
	Preview string `json:"preview"`
	Body    string `json:"body,omitempty"`
}

Style describes one available output style loaded from built-in, user, or workspace catalogs.

func Find

func Find(configHome, workspace, name string) (Style, error)

Find returns the effective output style with the requested name.

func Load

func Load(configHome, workspace string) ([]Style, error)

Load discovers built-in, user, and workspace output styles.

type StyleSummary

type StyleSummary struct {
	Name           string `json:"name"`
	Source         string `json:"source"`
	Path           string `json:"path,omitempty"`
	Preview        string `json:"preview"`
	Active         bool   `json:"active,omitempty"`
	Effective      bool   `json:"effective,omitempty"`
	ShadowedBy     string `json:"shadowed_by,omitempty"`
	ShadowedByPath string `json:"shadowed_by_path,omitempty"`
}

StyleSummary is the list-facing view of a style, including precedence diagnostics.

Jump to

Keyboard shortcuts

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