Documentation
¶
Index ¶
Constants ¶
const ( Filename = "COMMITBRIEF.md" OutputFilename = "OUTPUT.md" LocalSubdir = ".commitbrief" )
const RepairJSONComplete = `` /* 241-byte string literal not displayed */
RepairJSONComplete is the recovery directive for truncated / malformed JSON (ParseErrMalformedJSON): ask the model to finish and correct the document.
const RepairPrevOutputTemplate = "Your previous response, which failed to parse, was:\n```\n%s\n```\nReturn the complete corrected JSON object now."
RepairPrevOutputTemplate embeds the previous (partial) output in the repair user prompt so the model can complete it. Single %s for the prior response. The Provider interface is single-shot (ADR-0014); "continue" must be a fresh request carrying the partial output, not a multi-turn continuation.
const RepairSchemaReset = `` /* 288-byte string literal not displayed */
RepairSchemaReset is the recovery directive for prose / schema-ignored output (ParseErrEmpty, ParseErrSchema): a hard "JSON only" reset.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(rulesLoaded Loaded, langRes lang.Resolution, archContext string) (system, userTpl string)
Build assembles the system prompt from the user's review rules and then appends the fixed severity rubric, the JSON-contract response format, the language directive, and the prompt-injection guard. ADR-0014 §1-2 govern the prompt shape — the LLM's only output channel is the JSON findings document; OUTPUT.md no longer participates in prompt construction (it has become a client-side renderer template).
archContext (ADR-0030), when non-empty, inserts an <architecture_constraints> block between the rules and the rubric so the reviewer can flag diffs that cross a declared import boundary. Empty (the default / no architecture.json) emits nothing, keeping the system prompt — and therefore the cache key — byte-identical to a pre-ADR-0030 run.
func BuildPlainText ¶ added in v0.9.0
func BuildPlainText(rulesLoaded Loaded, langRes lang.Resolution, archContext string) (system, userTpl string)
BuildPlainText is the system-prompt variant for CLI-based providers (claude-cli, gemini-cli, …). Same project rules and severity rubric as Build, but swaps the JSON-contract response format for a fixed plain-text layout the host CLI can produce and we can stream straight to stdout — no JSON parsing, no findings struct.
Used when the active provider satisfies provider.PlainTextEmitter. The user prompt template (`userTpl`) is shared with Build so the review pipeline (cache key, token estimation) doesn't branch on mode. archContext (ADR-0030) is injected the same way as in Build.
Types ¶
type Loaded ¶
func DefaultOutput ¶
func DefaultOutput() Loaded
func LoadOutput ¶
LoadOutput resolves the output-format template through a three-tier fallback: repo-local (<repoRoot>/.commitbrief/OUTPUT.md) → user-level (<userHome>/.commitbrief/OUTPUT.md) → binary-embedded default. Both path segments are gitignored by `commitbrief setup --local`, so the override is per-user rather than team-shared — output convention is considered a personal preference; team-shared review content stays in COMMITBRIEF.md.
Pass userHome == "" to skip the user-level layer (test injection); the CLI passes os.UserHomeDir() as resolved at startup.