Documentation
¶
Overview ¶
Package prroute is deterministic PULL-REQUEST → SESSION routing's pure half: which pull request a review mail is about (ParseMail), and the shape of an authorship report (Signal) — which pull request a session created, or which branch it pushed — as a host's PostToolUse hook sends it to POST /api/pr-sessions (internal/api/pr_routes.go). It holds no store and makes no network call. docs/plugins.md#a-pull-request-review-mail.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // RepoPattern is a repository as the mail and a transcript name it. RepoPattern = regexp.MustCompile(`^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$`) )
Functions ¶
Types ¶
type Ref ¶
type Ref struct {
// Repo is "<owner>/<repo>", lower-cased (GitHub's names are case-insensitive).
Repo string
// PR is the pull request's number.
PR int64
// HeadSHA is the reviewed head commit (40 lower-case hex).
HeadSHA string
// HeadRef is the pull request's head branch, "" when the mail names none.
HeadRef string
}
Ref is the pull request a review mail names.
func ParseMail ¶
ParseMail is the pull request mail body names, read from the LAST fenced ```json block of the body. ok is false for anything malformed — no such block, invalid JSON, a missing or invalid repo, pr or head_sha, or a head_ref that is present and not a branch name — and the caller then routes nothing by it.
🔴 THE LAST BLOCK DECIDES, AND AN EARLIER ONE IS NEVER A FALLBACK: the gate writes its machine-readable block last, and a body may quote other JSON before it (a finding's excerpt). A fence is matched as CommonMark matches it — closed only by a backtick run at least as long as the one that opened it — so a block the gate fenced with more backticks than any run inside it is read whole, and a fenced block of another kind hides what is inside it.