Documentation
¶
Index ¶
- Constants
- func AgentHandlesEnabled(ctx context.Context) bool
- func Colorize(text, color string, enabled bool) string
- func FormatAgentChatID(chatID string) string
- func FormatAgentMessage(msg AgentMessage) string
- func FormatAgentMessageID(messageID string) string
- func GetColor(ctx context.Context) string
- func GetCompactJSON(ctx context.Context) bool
- func GetFormat(ctx context.Context) string
- func GetQuery(ctx context.Context) string
- func GetResultsOnly(ctx context.Context) bool
- func GetTemplate(ctx context.Context) string
- func GetTransform(ctx context.Context) string
- func IsTerminalWriter(out io.Writer) bool
- func OutputTo(ctx context.Context, w io.Writer, data any, textFn func(io.Writer)) error
- func OutputWithPager(ctx context.Context, w io.Writer, data any, textFn func(io.Writer)) error
- func OutputWithQueryTemplateTo(format, query, tmpl string, w io.Writer, data any, textFn func(io.Writer)) error
- func OutputWithQueryTo(format, query string, w io.Writer, data any, textFn func(io.Writer)) error
- func ResultsOnly(data any) any
- func RunExplorer(w io.Writer, data any) error
- func ShouldColorizeWriter(w io.Writer, mode string) bool
- func TerminalHeight() int
- func WithAgentHandles(ctx context.Context, enabled bool) context.Context
- func WithColor(ctx context.Context, mode string) context.Context
- func WithCompactJSON(ctx context.Context, enabled bool) context.Context
- func WithFormat(ctx context.Context, format string) context.Context
- func WithQuery(ctx context.Context, query string) context.Context
- func WithResultsOnly(ctx context.Context, enabled bool) context.Context
- func WithTemplate(ctx context.Context, tmpl string) context.Context
- func WithTransform(ctx context.Context, t string) context.Context
- func WriteAgentChats(w io.Writer, chats []AgentChat)
- func WriteAgentHeader(w io.Writer, chatID, title string)
- func WriteAgentMessage(w io.Writer, msg AgentMessage)
- func WriteAgentMessages(w io.Writer, chatID, title string, messages []AgentMessage)
- func WriteJSON(w io.Writer, data any) error
- func WriteJSONLines(w io.Writer, data any, query string) error
- func WriteJSONPretty(w io.Writer, data any) error
- func WriteJSONWithQuery(w io.Writer, data any, queryStr string) error
- func WriteJSONWithTransform(w io.Writer, data any, expr string) error
- func WriteJSONWithTransformPretty(w io.Writer, data any, expr string) error
- func WriteTemplate(w io.Writer, data any, tmplText string) error
- type AgentChat
- type AgentMessage
- type ColorMode
- type PagerWriter
- type TableWriter
Constants ¶
const ( Reset = "\033[0m" Bold = "\033[1m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" Gray = "\033[90m" )
ANSI color codes
Variables ¶
This section is empty.
Functions ¶
func AgentHandlesEnabled ¶ added in v0.2.5
AgentHandlesEnabled reports whether handle tokens should be emitted.
func FormatAgentChatID ¶ added in v0.2.3
func FormatAgentMessage ¶ added in v0.2.3
func FormatAgentMessage(msg AgentMessage) string
func FormatAgentMessageID ¶ added in v0.2.3
func GetCompactJSON ¶ added in v0.2.17
func GetResultsOnly ¶ added in v0.2.12
func GetTemplate ¶ added in v0.1.7
func GetTransform ¶ added in v0.2.14
GetTransform returns the GJSON path expression from the context.
func IsTerminalWriter ¶ added in v0.2.14
IsTerminalWriter reports whether the given writer is a terminal-backed file.
func OutputWithPager ¶ added in v0.2.14
OutputWithPager works like OutputTo but routes output through a pager when the content exceeds the terminal height.
func OutputWithQueryTemplateTo ¶ added in v0.1.7
func OutputWithQueryTo ¶ added in v0.1.7
func ResultsOnly ¶ added in v0.2.12
ResultsOnly strips common list envelopes (items/results/messages) and returns just the slice. If the input does not look like a supported envelope, it is returned unchanged.
func RunExplorer ¶ added in v0.2.14
RunExplorer launches the interactive JSON explorer TUI.
func ShouldColorizeWriter ¶ added in v0.1.7
ShouldColorizeWriter returns true if output should be colorized for the writer.
func TerminalHeight ¶ added in v0.2.14
func TerminalHeight() int
TerminalHeight returns the height of the terminal attached to stdout, or 40 as a reasonable fallback.
func WithAgentHandles ¶ added in v0.2.5
WithAgentHandles stores whether agent handle tokens should be emitted.
func WithCompactJSON ¶ added in v0.2.17
func WithResultsOnly ¶ added in v0.2.12
func WithTemplate ¶ added in v0.1.7
func WithTransform ¶ added in v0.2.14
WithTransform stores a GJSON path expression in the context.
func WriteAgentChats ¶ added in v0.2.1
WriteAgentChats writes chats in agent-friendly format. Format: [chat:!id] Title (network) - N unread [group]
func WriteAgentHeader ¶ added in v0.2.3
func WriteAgentMessage ¶ added in v0.2.3
func WriteAgentMessage(w io.Writer, msg AgentMessage)
func WriteAgentMessages ¶ added in v0.2.1
func WriteAgentMessages(w io.Writer, chatID, title string, messages []AgentMessage)
WriteAgentMessages writes messages in agent-friendly format. Format: [chat:!id] Title header, then lines like: 10:23 Alice: Can you review the PR? [id:$msg1] 10:25 You: Sure, looking now [id:$msg2]
func WriteJSONLines ¶ added in v0.1.7
func WriteJSONWithTransform ¶ added in v0.2.14
WriteJSONWithTransform marshals data to JSON and applies a GJSON path expression, writing the matching result to w.
func WriteJSONWithTransformPretty ¶ added in v0.2.14
WriteJSONWithTransformPretty writes transform output using pretty-indented JSON.
Types ¶
type AgentChat ¶ added in v0.2.1
type AgentChat struct {
ID string
Title string
Network string
Type string
UnreadCount int
Preview string
Handle string
}
AgentChat is a simplified chat for agent output.
type AgentMessage ¶ added in v0.2.1
type AgentMessage struct {
ID string
ChatID string
Timestamp time.Time
Sender string
Text string
ReplyToID string
Handle string
}
AgentMessage is a simplified message for agent output.
type PagerWriter ¶ added in v0.2.14
type PagerWriter struct {
// contains filtered or unexported fields
}
PagerWriter buffers all written data and, on Close, either writes it directly to the underlying writer (if short or non-TTY) or pipes it through the user's $PAGER.
func (*PagerWriter) Close ¶ added in v0.2.14
func (p *PagerWriter) Close() error
type TableWriter ¶
type TableWriter struct {
// contains filtered or unexported fields
}
func NewTable ¶ added in v0.1.7
func NewTable(w io.Writer, headers []string, colorEnabled bool) *TableWriter
NewTable creates a TableWriter with optional colorized headers.
func NewTableWriter ¶
func NewTableWriter(w io.Writer) *TableWriter
func (*TableWriter) Append ¶
func (t *TableWriter) Append(row []string)
func (*TableWriter) Render ¶
func (t *TableWriter) Render()
func (*TableWriter) SetHeader ¶
func (t *TableWriter) SetHeader(headers []string)