Documentation
¶
Overview ¶
Package dailyreport contains the provider-independent daily report rules.
Index ¶
- func GroupCommits(pushes []Push, accounts map[string]string, ...) (map[string][]AttributedCommit, error)
- func SaveConfig(path string, c Config) error
- func SendCard(ctx context.Context, client *http.Client, webhook, title, summary string) error
- func ShouldReport(accountType string, commits int) bool
- type AttributedCommit
- type Commit
- type Config
- type DeliveryStore
- type FileDeliveryStore
- type Push
- type ResponsesClient
- type RunResult
- type Schedule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GroupCommits ¶
func GroupCommits(pushes []Push, accounts map[string]string, resolve func(string) (string, error)) (map[string][]AttributedCommit, error)
GroupCommits attributes complete push records and removes repeat pushes. An empty account from resolve denotes an email without a matching account.
func SaveConfig ¶
SaveConfig writes private configuration atomically with owner-only permissions.
func ShouldReport ¶
ShouldReport excludes service accounts and users without commits.
Types ¶
type AttributedCommit ¶
type AttributedCommit struct {
RepositoryID int64 `json:"repository_id"`
ID string `json:"id"`
Message string `json:"message"`
}
AttributedCommit omits author email from the provider input.
type Config ¶
type Config struct {
Schedule Schedule `json:"schedule"`
BaseURL string `json:"base_url"`
Model string `json:"model"`
APIKey string `json:"api_key"`
Webhook string `json:"webhook"`
OmitStore bool `json:"omit_store"`
Accounts map[string]string `json:"accounts"`
}
Config is private server state; it must not be returned to ordinary users.
func LoadConfig ¶
LoadConfig reads an explicitly selected private configuration file.
type DeliveryStore ¶
type DeliveryStore interface {
Delivered(date, account string) (bool, error)
MarkDelivered(date, account string) error
}
DeliveryStore records successfully delivered cards for a report date.
type FileDeliveryStore ¶
type FileDeliveryStore struct{ Path string }
FileDeliveryStore persists successful deliveries outside the source tree.
func (FileDeliveryStore) Delivered ¶
func (s FileDeliveryStore) Delivered(date, account string) (bool, error)
Delivered checks whether the card has already been acknowledged.
func (FileDeliveryStore) MarkDelivered ¶
func (s FileDeliveryStore) MarkDelivered(date, account string) error
MarkDelivered atomically records an acknowledged card.
type ResponsesClient ¶
type ResponsesClient struct {
HTTP *http.Client
BaseURL string
APIKey string
Model string
// OmitStore is for providers that reject the OpenAI store parameter.
OmitStore bool
}
ResponsesClient speaks the text subset of the OpenAI Responses API.
type RunResult ¶
RunResult contains counts only; commit messages and credentials stay private.
func Run ¶
func Run(ctx context.Context, date string, grouped map[string][]AttributedCommit, store DeliveryStore, summarize func(context.Context, string) (string, error), send func(context.Context, string, string) error) (RunResult, error)
Run delivers one card for each classified author with commits. Callers must serialize runs that share a delivery store.
type Schedule ¶
type Schedule struct {
Enabled bool `json:"enabled"`
Time string `json:"time"`
SkipHolidays bool `json:"skip_holidays"`
Holidays []string `json:"holidays"`
Workdays []string `json:"workdays"`
CalendarYears []int `json:"calendar_years"`
}
Schedule is evaluated in China Standard Time. Workdays override weekends.