// Package bridge reads the seat git's branch-moved and the acts owed to the forge, and makes the messages the forge // bridge writes on its stream forge: head-moved (design 47 H ยง739) and owed.ended. package bridge import ( "errors" "fmt" "regexp" ) // ErrUnreadable is wrapped by every error that says an event cannot be turned into a message; it is never // redelivered. var ErrUnreadable = errors.New("unreadable event") // Message is a message for the stream forge: the event name (forge....head-moved) and its // JSON body. type Message struct { Event string Data []byte // Said is what the bridge did that the log says, beside writing the message; empty for none. Said string } var sha40 = regexp.MustCompile(`^[0-9a-f]{40}$`) func unreadable(subject, why string, args ...any) error { return fmt.Errorf("%w: %s: %s", ErrUnreadable, subject, fmt.Sprintf(why, args...)) }