Documentation
¶
Overview ¶
Package render turns domain types into the two output forms: compact fixed-column text and flat JSON.
Index ¶
- func ColorEnabled(w io.Writer) bool
- func CursorHookJSON(w io.Writer, primer string) error
- func EpicList(w io.Writer, issues []model.Issue, s Style)
- func EpicStatus(w io.Writer, epic model.Issue, children []model.Issue, s Style)
- func FormatCycle(path []int) string
- func FormatWarning(w model.Warning) string
- func JSONEpicStatus(w io.Writer, epic model.Issue, children []model.Issue) error
- func JSONIssue(w io.Writer, i model.Issue, children []model.Issue) error
- func JSONList(w io.Writer, issues []model.Issue, withBodies bool) error
- func JSONPrime(w io.Writer, d PrimeData) error
- func JSONShow(w io.Writer, i model.Issue, children []model.Issue) error
- func JSONTriage(w io.Writer, issues []model.Issue) error
- func JSONUnchanged(w io.Writer, i model.Issue) error
- func Line(i model.Issue, s Style) string
- func List(w io.Writer, issues []model.Issue, s Style)
- func ListWithAssignees(w io.Writer, issues []model.Issue, s Style)
- func Prime(w io.Writer, static string, d PrimeData, s Style)
- func SanitizeInline(s string) string
- func Show(w io.Writer, i model.Issue, children []model.Issue, s Style)
- func Triage(w io.Writer, issues []model.Issue, s Style)
- func WriteJSON(w io.Writer, v any) error
- type CommentJSON
- type EpicStatusJSON
- type IssueJSON
- type PrimeData
- type PrimeJSON
- type Style
- type TextFindingJSON
- type WarningJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorEnabled ¶ added in v0.11.0
ColorEnabled decides whether output to w carries color: the environment contract applied to whether w is a real terminal.
func CursorHookJSON ¶ added in v0.11.0
CursorHookJSON writes the primer as the JSON object Cursor's sessionStart hook reads: its stdout must be valid JSON — bare primer text fails the parse — and the context travels in additional_context. The spelling is snake_case on purpose: Cursor ignores Claude Code's camelCase additionalContext field.
func EpicStatus ¶
EpicStatus renders one epic and its children. Children are the epic's full parent-backlinked set (complete even when the sub-issue connection was capped); the rollup line keeps the server-side completed/total.
func FormatCycle ¶
FormatCycle renders a cycle's member path as "#a → #b → … → #a".
func FormatWarning ¶
FormatWarning renders a structured warning as the human sentence shown in prime and ready output. It is the single place warning prose lives.
func JSONEpicStatus ¶
JSONEpicStatus writes one epic and its children. Children are the epic's full parent-backlinked set, so every entry is a real fetched issue — no fabricated placeholders — and the list is complete even when the epic's sub-issue connection was capped.
func JSONIssue ¶
JSONIssue writes one issue with full detail. Children is the issue's parent-backlinked child set, used to name the next workable child when the issue is an epic.
func JSONList ¶
JSONList writes issues as NDJSON — one compact object per line. Unlike an array, it stays parseable under head/grep and agent output truncation, which is how list output actually gets consumed. withBodies carries each issue's body (list --bodies), turning dedup over the triaged tracker into a single call instead of a show per candidate.
func JSONPrime ¶
JSONPrime writes the primer's live state as JSON (the static primer text is for context injection, not machine consumption).
func JSONShow ¶ added in v0.13.0
JSONShow is JSONIssue plus attributed findings, for the show read only — write commands reuse JSONIssue and stay unannotated. Clean issues omit textFindings, so their detail output is unchanged.
func JSONTriage ¶ added in v0.12.0
JSONTriage adds findings to the normal NDJSON issue schema only on triage. Clean issues omit textFindings, preserving their ordinary list representation.
func JSONUnchanged ¶ added in v0.15.0
JSONUnchanged writes one issue with full detail plus unchanged: true, the marker for a write whose requested state already held. Changed writes emit JSONIssue, which omits the field.
func Line ¶
Line renders one issue as `#n meta title`, unaligned. Under a color style the number is amber and the priority green.
func List ¶
List renders one aligned line per issue, annotated with whatever keeps it from being plain ready work.
func ListWithAssignees ¶
ListWithAssignees renders lines with @assignee suffixes (in-progress view).
func Prime ¶
Prime renders the session-start primer: static conventions, live state, contradictions. Sections are omitted when empty.
func SanitizeInline ¶ added in v0.11.0
SanitizeInline neutralizes every control character in a value rendered on one line. Newline and tab go too: neither is formatting there, and a newline would let a hostile title forge a line of its own. Exported so command-level messages that bypass the renderer (start's title echo, guard and warning logins) route through the same sanitizer.
func Show ¶
Show renders the full detail view for one issue. Children is the issue's parent-backlinked child set (empty for non-epics), used to name the epic's next workable child.
Types ¶
type CommentJSON ¶
type CommentJSON struct {
Author string `json:"author"`
CreatedAt time.Time `json:"createdAt"`
Body string `json:"body"`
}
CommentJSON is one recent comment in show --json.
type EpicStatusJSON ¶
type EpicStatusJSON struct {
Epic IssueJSON `json:"epic"`
Next *int `json:"next"`
Children []IssueJSON `json:"children"`
}
EpicStatusJSON pairs an epic with its resolved children and the next workable one (null when the sequence is dry).
type IssueJSON ¶
type IssueJSON struct {
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"`
Priority *string `json:"priority"`
Type *string `json:"type"`
Areas []string `json:"areas"`
Assignees []string `json:"assignees"`
Epic bool `json:"epic"`
InProgress bool `json:"inProgress"`
Untriaged bool `json:"untriaged"`
Parent *int `json:"parent"`
BlockedBy []int `json:"blockedBy"`
BlockedByTotal int `json:"blockedByTotal"`
OpenBlockers []int `json:"openBlockers"`
SubIssues []int `json:"subIssues"`
SubIssuesTotal int `json:"subIssuesTotal"`
SubIssuesCompleted int `json:"subIssuesCompleted"`
CreatedAt time.Time `json:"createdAt"`
// Next is set only for an epic's detail view (show --json): the next
// workable child's number. Absent, not null, for non-epics and when the
// sequence is dry — consumers key on the epic field for the difference.
Next *int `json:"next,omitempty"`
// Body is a pointer so presence tracks the mode (show, list --bodies)
// rather than emptiness: modes that carry it emit the field on every
// issue, empty or not, and plain list lines stay byte-for-byte body-free.
Body *string `json:"body,omitempty"`
Comments []CommentJSON `json:"comments,omitempty"`
CommentsTotal int `json:"commentsTotal,omitempty"`
}
IssueJSON is the stable flat schema for --json output: deps as number arrays, GraphQL shapes hidden.
type PrimeData ¶
type PrimeData struct {
Repo string
Ready []model.Issue // already capped to top N
ReadyTotal int
OpenTotal int
InProgress []model.Issue // already capped to top N
InProgressTotal int
Epics []model.Issue // already capped to top N
EpicsTotal int
Warnings []model.Warning
Untriaged int
}
PrimeData is everything the primer needs, precomputed by the command.
type PrimeJSON ¶
type PrimeJSON struct {
Repo string `json:"repo"`
OpenTotal int `json:"openTotal"`
ReadyTotal int `json:"readyTotal"`
Ready []IssueJSON `json:"ready"`
InProgress []IssueJSON `json:"inProgress"`
InProgressTotal int `json:"inProgressTotal"`
Epics []IssueJSON `json:"epics"`
EpicsTotal int `json:"epicsTotal"`
Untriaged int `json:"untriaged"`
Warnings []WarningJSON `json:"warnings"`
}
PrimeJSON is the structured form of the primer's live state.
type Style ¶ added in v0.11.0
type Style struct {
// contains filtered or unexported fields
}
Style carries whether text renderers wrap their semantic spans in ANSI. The zero value renders plain — every existing golden test, agent pipe, and --json stream stays byte-identical.
type TextFindingJSON ¶ added in v0.13.0
type TextFindingJSON struct {
Source string `json:"source"`
CommentIndex *int `json:"commentIndex,omitempty"`
model.TextFindings
}
TextFindingJSON is one field's advisory Unicode findings in show --json. Source is "title", "body" or "comment"; CommentIndex is set only for a comment and indexes the emitted comments array.
type WarningJSON ¶
type WarningJSON struct {
Kind string `json:"kind"`
Issue int `json:"issue,omitempty"`
Cycle []int `json:"cycle,omitempty"`
Total int `json:"total,omitempty"`
Fetched int `json:"fetched,omitempty"`
Message string `json:"message"`
}
WarningJSON is one structured warning: a machine-readable kind plus the numbers involved, alongside the rendered human message. Consumers branch on kind rather than parsing message prose.