-
-
Notifications
You must be signed in to change notification settings - Fork 0
OUTPUT md
A per-user Go text/template
that controls how findings are formatted locally. Applied to
the parsed findings JSON to produce the markdown output for
--markdown and --output <file>.md. Never sent to the LLM.
CommitBrief looks in this order (first hit wins):
-
<repo-root>/.commitbrief/OUTPUT.md— per-repo override. -
<user-home>/.commitbrief/OUTPUT.md— per-user default. - Embedded default at
internal/rules/output.md.
A repo-local OUTPUT.md is gitignored by default (the
.commitbrief/ directory is added to the repo .gitignore
on first use). This makes OUTPUT.md a personal preference rather
than a team artifact.
commitbrief initWrites the embedded default to
<repo>/.commitbrief/OUTPUT.md. See
Init command for force/skip semantics.
Plain Go text/template. The template data is:
type TemplateData struct {
Findings []Finding
}
type Finding struct {
Severity string
File string
Line int
LineEnd int
Title string
Description string
Suggestion string
Language string
Snippet string
}Inside the template, .Findings is a typed slice over which you
range:
{{ range .Findings }}
- **{{ upper .Severity }}** {{ .File }}:{{ .Line }} — {{ .Title }}
{{ .Description }}
> {{ .Suggestion }}
{{ end }}
Exposed via render.TemplateFuncs():
| Function | Signature | Purpose |
|---|---|---|
upper |
string → string |
strings.ToUpper. |
lower |
string → string |
strings.ToLower. |
groupBySeverity |
[]Finding → map[Severity][]Finding |
Bucket findings by severity. Keys: critical, high, medium, low, info. |
countFiles |
[]Finding → int |
Count distinct files touched by the finding set. |
The set is the public template contract (ADR-0014 §2); additions are allowed in v1.x, removals require a schema bump.
All built-in text/template actions also work — range, if,
with, len, printf, etc.
If you write a custom OUTPUT.md and the template is malformed, CommitBrief catches it before any provider call (ADR-0014 §5). Three checks run on load:
- Parse —
text/templatesyntax check. - Empty-findings execute — template runs against an empty
[]Finding{}. - Sample-findings execute — template runs against a synthetic sample of one finding per severity.
A failure aborts the run with:
OUTPUT.md template is invalid at <path>:\n <error>\n\nThe pipeline did not contact the provider. Fix the template, or run 'commitbrief init --yes' to overwrite it with the default.
The embedded default is presumed-valid via the release-check script, so the runtime guard fires only on user-written templates.
Minimal grouping-by-severity template:
{{ $bucketed := groupBySeverity .Findings }}
# Review summary
Files touched: {{ countFiles .Findings }}
{{ with index $bucketed "critical" }}
## Critical
{{ range . }}
- **{{ .File }}:{{ .Line }}** — {{ .Title }}
{{ .Description }}
> {{ .Suggestion }}
{{ end }}
{{ end }}
{{ with index $bucketed "high" }}
## High
{{ range . }}
- **{{ .File }}:{{ .Line }}** — {{ .Title }}
{{ end }}
{{ end }}
- It does NOT affect the LLM prompt or the review behavior at all.
- It does NOT affect
--jsonoutput (the JSON schema is fixed). - It does NOT apply to the cards renderer (that has its own lipgloss-styled layout).
- It does NOT apply to CLI-tool-backed providers
(
claude-cli/gemini-cliemit pre-formatted text directly).
- Init command — scaffolding.
- JSON schema — the canonical Finding shape.
- COMMITBRIEF.md — the team-shared review rules (separate, sent to the LLM).
Home · Installation · Quick start · Troubleshooting · GitHub repo · Issues
CommitBrief — local, LLM-powered code review for git diffs. This wiki documents only what ships in the binary.
Getting started
Commands · reviewing
Commands · summarizing
Commands · committing
Commands · setup
Commands · integration
Commands · inspect
Commands · maintenance
Configuration
Providers
Output
Operations
Reference