dbg

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dbg provides formatted debug output for the audit and review pipelines. When disabled, all methods are no-ops so debug-instrumented code paths stay zero-cost in production.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer handles formatted debug output. Zero value is invalid; use New.

func New

func New(enabled bool) *Writer

New creates a debug writer. If enabled is false, all output is suppressed. Output goes to stderr by default; use SetOutput to redirect to a file.

Compact mode is on by default. Setting the PRR_DEBUG_VERBOSE environment variable (to any non-empty value) makes the writer verbose at construction — useful for one-shot debug runs without touching code.

func (*Writer) Enabled

func (d *Writer) Enabled() bool

Enabled reports whether debug output is active. Useful for callers that want to skip expensive formatting work entirely.

func (*Writer) Phase

func (d *Writer) Phase(name string)

Phase prints a phase header.

func (*Writer) Prompt

func (d *Writer) Prompt(systemPrompt string, userMessage string)

Prompt prints an LLM prompt. In compact mode (default) the system prompt is skipped entirely — it's static .md content reprinted on every LLM call and adds 100+ lines of noise per call. Only the User Message is printed, with embedded `=== <path> ===` file-content blocks collapsed to header-only.

In verbose mode (SetVerbose(true) or PRR_DEBUG_VERBOSE env var) the full system prompt is included and file blocks pass through verbatim — useful when debugging prompt content specifically.

func (*Writer) Response

func (d *Writer) Response(raw string)

Response prints a raw LLM response.

func (*Writer) Section

func (d *Writer) Section(name string)

Section prints a section header within a phase.

func (*Writer) Separator

func (d *Writer) Separator()

Separator prints a visual separator.

func (*Writer) SetOutput

func (d *Writer) SetOutput(w io.Writer)

SetOutput redirects debug output to the given writer.

func (*Writer) SetVerbose

func (d *Writer) SetVerbose(verbose bool)

SetVerbose toggles compact (false, default) vs verbose (true) mode. See the Writer doc comment for what each mode includes.

func (*Writer) Text

func (d *Writer) Text(format string, args ...any)

Text prints arbitrary text.

func (*Writer) Verbose

func (d *Writer) Verbose() bool

Verbose reports the current mode. Useful for callers that want to branch decisions on compact-vs-verbose.

Jump to

Keyboard shortcuts

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