Documentation
¶
Index ¶
Constants ¶
View Source
const ( FormatJSON = "json" FormatMarkdownFallback = "markdown-fallback" // FormatPlainText is the marker for cache entries written by // PlainTextEmitter providers (CLI-based). The Content is the // host CLI's already-formatted output — no JSON parse, no // retry-once, no degrade warning. Renderer emits Content verbatim. FormatPlainText = "plain-text" )
Format values for cache.Result.Format. Kept as package-level constants so callers (CLI, renderer) avoid stringly-typed comparisons.
View Source
const DefaultTTL = 7 * 24 * time.Hour
View Source
const SchemaVersion = 1
Variables ¶
This section is empty.
Functions ¶
func Compute ¶
func Compute(args ComputeArgs) string
Compute returns the deterministic SHA-256 key (lowercase hex) for the cache lookup. The schema version is folded in so a future bump invalidates every existing entry without touching disk.
func EnsureGitignore ¶
EnsureGitignore appends `.commitbrief/` to the repo's .gitignore if not already present. Idempotent: a file that already contains the entry is left untouched. Returns true if the file was modified.
Types ¶
type ComputeArgs ¶
type Entry ¶
type Options ¶
type Options struct {
Dir string
// RepoRoot, if non-empty, enables auto-add of `.commitbrief/` to the
// repo's .gitignore on the first successful Put.
RepoRoot string
// TTL controls how long an entry is considered fresh. Zero falls back
// to DefaultTTL (7 days).
TTL time.Duration
// Now overrides time.Now (test injection); production callers leave it nil.
Now func() time.Time
}
type Result ¶
type Result struct {
Content string `json:"content"`
Tokens Tokens `json:"tokens"`
// Format records which renderer path the cached entry should take on
// replay. Values (ADR-0014 §4):
// "json" — Content is the structured-findings JSON; the
// renderer parses it as usual.
// "markdown-fallback" — provider produced unparseable output; the
// retry also failed. The cached Content is the
// raw text and the renderer skips the parse
// step entirely (no warning re-emitted).
// Empty string is treated as "json" for backwards compatibility with
// pre-ADR-0014 cache entries; they'll be invalidated next request
// anyway via the system-prompt SHA change (ADR-0014 §6).
Format string `json:"format,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.