Documentation
¶
Overview ¶
Package output defines the OutputFormatter interface for writing scan results in various formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterFormatter ¶
func RegisterFormatter(f Formatter)
RegisterFormatter adds a formatter to the global registry.
Types ¶
type BeadsFormatter ¶
type BeadsFormatter struct {
// contains filtered or unexported fields
}
BeadsFormatter writes signals as Beads-compatible JSONL.
func NewBeadsFormatter ¶
func NewBeadsFormatter() *BeadsFormatter
NewBeadsFormatter returns a new BeadsFormatter.
func (*BeadsFormatter) Format ¶
Format writes each signal as a single-line JSON object to w. Each line is valid JSON parseable by `bd import`.
func (*BeadsFormatter) SetConventions ¶ added in v0.4.0
func (b *BeadsFormatter) SetConventions(c *beads.Conventions)
SetConventions configures the formatter to adopt existing beads conventions. Passing nil resets to default behavior.
type Formatter ¶
type Formatter interface {
// Name returns the format name (e.g., "beads", "json", "markdown").
Name() string
// Format writes the signals to w.
Format(signals []signal.RawSignal, w io.Writer) error
}
Formatter writes a slice of raw signals to the given writer in a specific format.
func GetFormatter ¶
GetFormatter returns the formatter with the given name, or an error if not found.
type JSONEnvelope ¶
type JSONEnvelope struct {
Signals []signal.RawSignal `json:"signals"`
Metadata JSONMetadata `json:"metadata"`
}
JSONEnvelope wraps signals with metadata for the JSON output format.
type JSONFormatter ¶
type JSONFormatter struct {
// Compact controls whether output is compact (single line) or pretty-printed.
// When false (default), output is indented with two spaces.
Compact bool
// contains filtered or unexported fields
}
JSONFormatter writes signals as a JSON object with metadata envelope.
func NewJSONFormatter ¶
func NewJSONFormatter() *JSONFormatter
NewJSONFormatter returns a new JSONFormatter with default settings.
type JSONMetadata ¶
type JSONMetadata struct {
TotalCount int `json:"total_count"`
Collectors []string `json:"collectors"`
GeneratedAt string `json:"generated_at"`
}
JSONMetadata contains information about the scan that produced these signals.
type MarkdownFormatter ¶
type MarkdownFormatter struct{}
MarkdownFormatter writes signals as a human-readable Markdown summary.
func NewMarkdownFormatter ¶
func NewMarkdownFormatter() *MarkdownFormatter
NewMarkdownFormatter returns a new MarkdownFormatter.
func (*MarkdownFormatter) Format ¶
Format writes all signals as a grouped Markdown document to w.
The output includes:
- A title heading
- A summary line with total signals and collector names
- A priority distribution table (P1/P2/P3/P4)
- Sections grouped by collector, each with signal listings
func (*MarkdownFormatter) Name ¶
func (m *MarkdownFormatter) Name() string
Name returns the format name.
type TasksEnvelope ¶ added in v0.4.0
type TasksEnvelope struct {
Tasks []taskRecord `json:"tasks"`
Metadata JSONMetadata `json:"metadata"`
}
TasksEnvelope wraps tasks with metadata for the tasks output format.
type TasksFormatter ¶ added in v0.4.0
type TasksFormatter struct {
// Compact controls whether output is compact or pretty-printed.
Compact bool
// contains filtered or unexported fields
}
TasksFormatter writes signals as Claude Code TaskCreate-compatible JSON.
func NewTasksFormatter ¶ added in v0.4.0
func NewTasksFormatter() *TasksFormatter
NewTasksFormatter returns a new TasksFormatter with default settings.
func (*TasksFormatter) Format ¶ added in v0.4.0
Format writes all signals as a tasks JSON document to w.
func (*TasksFormatter) Name ¶ added in v0.4.0
func (f *TasksFormatter) Name() string
Name returns the format name.