// Package vcs defines the shared interface and types for VCS platform clients. // Adapters (gitea, github) implement these interfaces; the core review logic // uses them without knowing the underlying platform. package vcs // PullRequest holds relevant PR metadata. type PullRequest struct { Title string `json:"title"` Body string `json:"body"` Head struct { Sha string `json:"sha"` Ref string `json:"ref"` } `json:"head"` } // ChangedFile represents a file modified in a PR. type ChangedFile struct { Filename string `json:"filename"` Status string `json:"status"` } // ContentEntry represents a file or directory entry from the contents API. type ContentEntry struct { Name string `json:"name"` Path string `json:"path"` Type string `json:"type"` // "file" or "dir" } // Review represents a pull request review. type Review struct { ID int64 `json:"id"` Body string `json:"body"` User struct { Login string `json:"login"` } `json:"user"` State string `json:"state"` Stale bool `json:"stale"` CommitID string `json:"commit_id"` } // ReviewComment represents an inline comment in a review. // All adapters use GitHub diff-position convention: // - Position is a 1-indexed offset from the @@ hunk line in the unified diff. // - CommitID is the commit SHA the comment is anchored to. // // Adapters are responsible for translating to/from platform-native formats // (e.g. Gitea uses line numbers; GitHub uses diff positions natively). type ReviewComment struct { Path string `json:"path"` Position int `json:"position"` // diff-position: 1-indexed offset from @@ hunk line CommitID string `json:"commit_id"` Body string `json:"body"` } // ReviewRequest is the payload for posting a review. type ReviewRequest struct { // Body is the top-level review comment. Body string `json:"body"` // Event is "APPROVED" or "REQUEST_CHANGES". Event string `json:"event"` Comments []ReviewComment `json:"comments,omitempty"` }