Documentation
¶
Overview ¶
Package output defines the OutputFormatter interface for writing scan results in various formats.
Index ¶
- func RegisterFormatter(f Formatter)
- func SignalID(sig signal.RawSignal, prefix string) string
- type BeadsFormatter
- type DirectoryFormatter
- type Formatter
- type HTMLDirFormatter
- type HTMLFormatter
- type JSONEnvelope
- type JSONFormatter
- type JSONMetadata
- type MarkdownFormatter
- type TasksEnvelope
- type TasksFormatter
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 DirectoryFormatter ¶ added in v1.0.0
type DirectoryFormatter interface {
Formatter
FormatDir(signals []signal.RawSignal, dir string) error
}
DirectoryFormatter extends Formatter for formats that produce a directory of files (e.g., index.html + assets/) instead of a single stream.
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 HTMLDirFormatter ¶ added in v1.0.0
type HTMLDirFormatter struct {
// contains filtered or unexported fields
}
HTMLDirFormatter writes signals as an HTML dashboard with external CSS and JS in a directory structure: index.html + assets/dashboard.{css,js}.
func NewHTMLDirFormatter ¶ added in v1.0.0
func NewHTMLDirFormatter() *HTMLDirFormatter
NewHTMLDirFormatter returns a new HTMLDirFormatter.
func (*HTMLDirFormatter) Format ¶ added in v1.0.0
Format returns an error directing users to use --output (-o) with html-dir.
func (*HTMLDirFormatter) FormatDir ¶ added in v1.0.0
func (h *HTMLDirFormatter) FormatDir(signals []signal.RawSignal, dir string) error
FormatDir writes the dashboard to dir as index.html + assets/.
func (*HTMLDirFormatter) Name ¶ added in v1.0.0
func (h *HTMLDirFormatter) Name() string
Name returns the format name.
type HTMLFormatter ¶ added in v1.0.0
type HTMLFormatter struct {
// contains filtered or unexported fields
}
HTMLFormatter writes signals as a self-contained HTML dashboard.
func NewHTMLFormatter ¶ added in v1.0.0
func NewHTMLFormatter() *HTMLFormatter
NewHTMLFormatter returns a new HTMLFormatter.
func (*HTMLFormatter) Format ¶ added in v1.0.0
Format writes all signals as a self-contained HTML dashboard to w.
func (*HTMLFormatter) Name ¶ added in v1.0.0
func (h *HTMLFormatter) Name() string
Name returns the format name.
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.
When signals span multiple workspaces, output is grouped by workspace first, then by collector within each workspace. For single-workspace or non-monorepo signals, the output is unchanged (grouped by collector only).
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.