Documentation
¶
Overview ¶
Package notify sends notifications to Microsoft Teams via incoming webhooks.
Notifications are formatted as Adaptive Cards (schema v1.4) for rich display in Teams channels. Each event type has a dedicated card template.
Disabled by default — configure notifications.teams_webhook_url in forge.yaml.
Index ¶
- Constants
- func FormatWebhookURL(url string) (string, error)
- type Config
- type EventType
- type Notifier
- func (n *Notifier) BeadDecomposed(ctx context.Context, anvil, beadID, beadTitle string, subBeads []SubBead)
- func (n *Notifier) BeadFailed(ctx context.Context, anvil, beadID string, retries int, lastError string)
- func (n *Notifier) DailyCost(ctx context.Context, date string, totalCost float64, limit float64, ...)
- func (n *Notifier) PRCreated(ctx context.Context, anvil, beadID string, prNumber int, prURL, title string)
- func (n *Notifier) ShouldNotify(event EventType) bool
- func (n *Notifier) WorkerDone(ctx context.Context, anvil, beadID, workerID string, duration time.Duration)
- type SubBead
Constants ¶
const ( // AdaptiveCardSchema is the schema URL for adaptive cards. AdaptiveCardSchema = "http://adaptivecards.io/schemas/adaptive-card.json" // CardVersion is the adaptive card version. CardVersion = "1.4" )
Variables ¶
This section is empty.
Functions ¶
func FormatWebhookURL ¶
FormatWebhookURL validates and normalises a Teams webhook URL.
Types ¶
type Config ¶
type Config struct {
WebhookURL string
Enabled bool
Events []string // Filter to these events only; empty = all
}
Config holds notifier settings.
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier sends notifications to Teams.
func NewNotifier ¶
NewNotifier creates a Teams notifier. Returns nil if disabled or no URL.
func (*Notifier) BeadDecomposed ¶
func (n *Notifier) BeadDecomposed(ctx context.Context, anvil, beadID, beadTitle string, subBeads []SubBead)
BeadDecomposed sends a notification when Schematic decomposes a bead into sub-beads. This is significant because it changes the work queue.
func (*Notifier) BeadFailed ¶
func (n *Notifier) BeadFailed(ctx context.Context, anvil, beadID string, retries int, lastError string)
BeadFailed sends a notification when a bead fails after retries.
func (*Notifier) DailyCost ¶
func (n *Notifier) DailyCost(ctx context.Context, date string, totalCost float64, limit float64, inputTokens, outputTokens int64)
DailyCost sends a daily cost summary.
func (*Notifier) PRCreated ¶
func (n *Notifier) PRCreated(ctx context.Context, anvil, beadID string, prNumber int, prURL, title string)
PRCreated sends a notification when a PR is created.
func (*Notifier) ShouldNotify ¶
ShouldNotify checks if an event type should trigger a notification.