Documentation
¶
Overview ¶
Package commitref parses commit messages for task references (bare #N, keyword refs, and slug#N cross-project refs) and maps action keywords to task statuses. Parsing is split into a chain of internal parsers sharing per-message dedup state; the package is provided as a service so every consumer shares the same configured keyword table.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Config ¶
type Config struct {
// ActionKeywords maps a commit message keyword to the task status
// transition it triggers.
ActionKeywords map[string]KeywordEntry
}
Config holds the settings for parsing commit messages.
type KeywordAction ¶
type KeywordAction struct {
Status tasks.Status // target status
Verb string // past-tense label for comment, e.g. "Resolved"
}
KeywordAction maps a commit message keyword to a task status transition.
type KeywordEntry ¶
type ParsedReference ¶
type ParsedReference struct {
TaskNumber int
ProjectSlug string // empty means the current project
Action *KeywordAction // nil if bare #N with no keyword
CommitHash string
CommitMessage string
}
ParsedReference represents a single task reference found in a commit message.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service parses commit messages for task references by running an ordered chain of parsers over shared per-message state.
func NewService ¶
NewService builds a Service from cfg. It validates every keyword status, rejects keywords that collide after case normalization, and compiles the keyword matcher from the sorted keyword list. An invalid configuration is returned as an error so the app fails at startup instead of silently ignoring commit references. An empty ActionKeywords map leaves the keyword matcher uncompiled: the chain then runs in mentions-only mode, so bare #N and slug#N references still parse but no keyword carries a status transition.
func (*Service) ParseCommitMessage ¶
func (s *Service) ParseCommitMessage(message string) []ParsedReference
ParseCommitMessage scans a commit message for task references. Returns a list of ParsedReference, one per unique (slug, number) pair found. A reference may carry an optional project-slug prefix (e.g. "resto-web#13"); a bare "#NUMBER" keeps ProjectSlug == "" and refers to the current project. Parsers run in precedence order (keyword, prefixed, bare); if both a keyword and bare reference exist for the same (slug, number), the keyword wins.