Documentation
¶
Overview ¶
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT Package render serializes a query Result into the supported output formats.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityEstimate ¶ added in v1.1.0
func ActivityEstimate(cost model.CostReport) string
ActivityEstimate renders estimate-only output: the projected cost and the remaining quota, with an explicit statement that nothing was gathered.
Saying so plainly matters — an estimate that reads like a result would let a caller believe it had evidence it never collected.
func ActivityMarkdown ¶ added in v1.1.0
func ActivityMarkdown(r model.ActivityResult) string
ActivityMarkdown renders r as Markdown. It never fails, so it is convenient for callers that always want the human-readable form (the MCP text content, for one).
func Markdown ¶
Markdown renders r as Markdown. It never fails, so it is convenient for callers that always want the human-readable form.
Example ¶
ExampleMarkdown renders a query result as a Markdown report grouped by repository, newest commit first.
package main
import (
"fmt"
"time"
"github.com/skaphos/sting/internal/render"
"github.com/skaphos/sting/model"
)
func main() {
result := model.Result{
Author: "octocat",
Scope: model.ScopeSearch,
Since: time.Date(2026, 5, 22, 0, 0, 0, 0, time.UTC),
Until: time.Date(2026, 5, 29, 0, 0, 0, 0, time.UTC),
Count: 1,
Commits: []model.Commit{{
SHA: "abc1234def5678",
Repo: "skaphos/sting",
Date: time.Date(2026, 5, 28, 0, 0, 0, 0, time.UTC),
Message: "Add example\n\nbody ignored in the summary line",
}},
}
fmt.Print(render.Markdown(result))
}
Output: # Commits by `octocat` - **Window:** 2026-05-22 → 2026-05-29 - **Scope:** search - **Commits:** 1 ## skaphos/sting - `abc1234` 2026-05-28 — Add example
func RenderActivity ¶ added in v1.1.0
func RenderActivity(r model.ActivityResult, f Format) (string, error)
RenderActivity encodes a repository activity result in the requested format. JSON is the contract; Markdown is a view of it, never a superset.