Documentation
¶
Overview ¶
Package describework implements the "describe-work" transform primitive: it turns a group of raw commit titles into a one-line, natural-language description of the work. A thin or junk title triggers a diff fetch so the description reflects what actually changed, not the subject line alone.
CacheStore, LLMClient, and GHDiffer (interfaces.go) are small in-package interfaces the engine wires to real implementations (the db-backed llm_cache table, elelem, commander's gh shell-out), which keeps the package unit-testable with mocks.
Every group is cached by (step, processingVersion, inputHash): processingVersion hashes the whole LLM config (prompt version + model), so a cache hit skips the LLM call entirely, and changing the prompt or model bumps the version, cleanly invalidating old entries without deleting them.
Index ¶
Constants ¶
const Name = "describe-work"
Name is the primitive's registry key.
Variables ¶
var ErrMissingDependency = errors.New(
"describe-work missing required dependency",
)
ErrMissingDependency is returned by New when cache, llm, or gh is nil — describe-work cannot run without all three.
var ErrUnknownBy = errors.New("unknown describe-work group field")
ErrUnknownBy is returned by New when the "by" param names a field describe-work doesn't know how to group on.
Functions ¶
func New ¶
func New( cache CacheStore, llm LLMClient, gh GHDiffer, rawParams []byte, ) (transform.Primitive, error)
New builds a describe-work primitive from cache, llm, gh — the engine's wired implementations — and its JSON params, shaped {"by": "day"|"repo", "promptVersion": string, "model": string, "thinMessageMaxLen": int}. by defaults to "day", promptVersion to "v1", and thinMessageMaxLen to 12 when omitted. Returns ErrMissingDependency when any of cache, llm, gh is nil, or a wrapped ErrUnknownBy when by names anything else.
Types ¶
type CacheStore ¶
type CacheStore interface {
Get(ctx context.Context, key string) (string, bool, error)
Put(
ctx context.Context,
key, step, processingVersion, inputHash, output string,
) error
}
CacheStore persists and retrieves LLM step outputs keyed by a deterministic hash of (step, processingVersion, inputHash) — the llm_cache table's shape (see common/transform doc + git-trakz.md's "LLM steps are versioned + cached"). Get's second return reports a cache hit; a miss returns ("", false, nil) with no error.