describework

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 13 Imported by: 0

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 — because commit subjects like "fix", "wip", or "asdf" don't belong in a timesheet or client report. A thin or junk title triggers a diff fetch so the description reflects what actually changed, not a meaningless subject line.

The primitive depends on nothing concrete: 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). That dependency inversion keeps this package unit-testable with mocks — see /home/bw/work/psyb0t/.git-trakz.md's "LLM steps are versioned + cached" section for the cache contract this implements.

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 ¶

View Source
const Name = "describe-work"

Name is the primitive's registry key.

Variables ¶

View Source
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.

View Source
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)

Types ¶

type By ¶

type By string

By selects which key describe-work groups commit events on.

const (
	ByDay  By = "day"
	ByRepo By = "repo"
)

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.

type GHDiffer ¶

type GHDiffer interface {
	Diff(ctx context.Context, owner, repo, sha string) (string, error)
}

GHDiffer fetches the diff/patch for a single commit. The engine wires this to commander's gh shell-out; describe-work never shells out directly.

type LLMClient ¶

type LLMClient interface {
	Describe(ctx context.Context, prompt string) (string, error)
}

LLMClient produces a natural-language response to a prompt. The engine wires this to elelem; describe-work never talks to a model provider directly.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL