presenters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package presenters renders structured query results as text for CLI output. Presenters take pure data from finders plus an io.Writer and formatting parameters; they have no IO of their own beyond the writer.

The package isolates the view layer from finders (data) and from CLI command plumbing — separating concerns so each can be tested in isolation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntryLine

func EntryLine(w io.Writer, e *model.Entry, g *model.Graph)

EntryLine writes a single entry summary line — used by status, list, and other surfaces that show entries in a flat list.

Format: `<id> <layer> <kind>? <type> [confidence: <conf>]? (<participants>) {status: <status>}? <summary>` Kind renders as a qualifier alongside layer/type — it's identity, not an attribute (d-cpt-omm's two-type redesign makes every entry carry a kind). Square brackets denote stored attributes (today: confidence); curly braces denote derived attributes computed from graph relationships (d-tac-3yi). Participants are always present — empty is rendered as `()`. Status is present for signals and decisions; omitted for actions.

func FormatConfidence

func FormatConfidence(c string) string

FormatConfidence renders a stored confidence attribute in square-bracket notation.

func FormatStatus

func FormatStatus(s model.Status) string

FormatStatus renders a derived status in curly-brace notation. Returns the empty string for StatusNone (actions) so callers can omit the attribute. Compound states use a space separator in the value (`closed-by <id>`) to avoid ambiguity with the outer `{key: value}` delimiter.

func GroupByLayer

func GroupByLayer(entries []*model.Entry) map[model.Layer][]*model.Entry

GroupByLayer groups entries by layer for display. Returns a map from layer to entries; iterate with LayerOrder to render in canonical order.

func LayerOrder

func LayerOrder() []model.Layer

LayerOrder returns the display order for layers (strategic → process).

func RenderLint

func RenderLint(w io.Writer, result *query.LintResult, g *model.Graph)

RenderLint writes a human-readable lint report to w. Returns nothing — the caller decides what to do about a non-zero issue count (typically returning a non-zero exit code from the CLI).

func RenderList

func RenderList(w io.Writer, result *query.ListResult)

RenderList writes one EntryLine per matched entry.

func RenderShow

func RenderShow(w io.Writer, result *query.ShowResult)

RenderShow writes the show output for a ShowResult. Each group renders: the primary entry at full detail, then an upstream section (summary lines), then a downstream section (summary lines). Groups are separated by "---".

func RenderStatus

func RenderStatus(w io.Writer, result *query.StatusResult)

RenderStatus writes the status view: top-line counts, then sections for contracts, plans, active decisions, open signals, and recent actions. Each section is grouped by layer using LayerOrder.

func RenderWIPList

func RenderWIPList(w io.Writer, result *query.WIPListResult)

RenderWIPList writes the active WIP markers in a fixed-width layout.

func WriteEntryFull

func WriteEntryFull(w io.Writer, e *model.Entry, graph *model.Graph)

WriteEntryFull writes the full metadata and content of an entry. Stored frontmatter fields render first, then a "Derived:" section lists attributes computed from graph relationships (d-tac-3yi). The curly-brace inline notation (`{status: ...}`) is reserved for flat contexts like status, list, and summary chains — the labeled block here keeps the stored/derived split explicit without redundant wrapping.

Types

This section is empty.

Jump to

Keyboard shortcuts

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