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 ¶
- func EntryLine(w io.Writer, e *model.Entry, g *model.Graph)
- func FormatConfidence(c string) string
- func FormatStatus(s model.Status) string
- func GroupByLayer(entries []*model.Entry) map[model.Layer][]*model.Entry
- func LayerOrder() []model.Layer
- func RenderInitSkills(w io.Writer, installDir string, result command.SkillInstallResult)
- func RenderLint(w io.Writer, result *query.LintResult, g *model.Graph)
- func RenderList(w io.Writer, result *query.ListResult)
- func RenderSchemaError(w io.Writer, compat model.CompatibilityResult)
- func RenderShow(w io.Writer, result *query.ShowResult)
- func RenderStatus(w io.Writer, result *query.StatusResult)
- func RenderWIPList(w io.Writer, result *query.WIPListResult)
- func WriteEntryFull(w io.Writer, e *model.Entry, graph *model.Graph)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EntryLine ¶
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 ¶
FormatConfidence renders a stored confidence attribute in square-bracket notation.
func FormatStatus ¶
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 ¶
GroupByLayer groups entries by layer for display. Returns a map from layer to entries; iterate with LayerOrder to render in canonical order.
func LayerOrder ¶
LayerOrder returns the display order for layers (strategic → process).
func RenderInitSkills ¶ added in v0.2.0
func RenderInitSkills(w io.Writer, installDir string, result command.SkillInstallResult)
RenderInitSkills summarises a skill install pass for the user. Counts are always printed; individual paths appear only for categories that warrant per-path attention (overwritten, skipped-modified).
func RenderLint ¶
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 RenderSchemaError ¶ added in v0.2.0
func RenderSchemaError(w io.Writer, compat model.CompatibilityResult)
RenderSchemaError writes a user-facing explanation of a compatibility failure to w. The CompatibilityResult.Reason is already human-readable; this presenter frames it with a fixed prefix and exit hint so output reads the same across every write command.
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 one section per decision kind (Aspirations, Contracts, Plans, Activities, Directives), followed by the signal sections (Gaps and Questions, Recent Insights, Recent Done Signals). Decision-kind sections are grouped by layer; signal sections are flat activity streams. Empty sections are suppressed — the section header implies membership, so "open" / "active" prefixes are not needed on the headers.
func RenderWIPList ¶
func RenderWIPList(w io.Writer, result *query.WIPListResult)
RenderWIPList writes the active WIP markers in a fixed-width layout.
func WriteEntryFull ¶
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.