Documentation
¶
Overview ¶
Package review holds the comment model and on-disk store for the workbench review tab. Derived from kevindutra/crit (see NOTICE.md); unlike upstream, every path is rooted at an explicit worktree root rather than the process working directory.
Index ¶
- func ComposePrompt(root string, states []*ReviewState) string
- func EnsureDirs(root string) error
- func ReviewPath(root, docPath string) string
- func Save(root string, state *ReviewState) error
- func SaveSession(root string, session *CodeReviewSession) error
- type CodeReviewSession
- type Comment
- type Document
- type ReviewState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComposePrompt ¶
func ComposePrompt(root string, states []*ReviewState) string
ComposePrompt formats review comments as a single instruction prompt for the session's agent. File paths are shown relative to root (the agent's working directory). Returns "" when there are no comments.
func EnsureDirs ¶
EnsureDirs creates <root>/.crit/reviews and a self-ignoring .gitignore so review state never shows up in git status or loom's diff stats.
func ReviewPath ¶
ReviewPath maps a document path to its review file under root. The hash covers the absolute doc path so renaming the worktree parent (loom never does) is the only way to orphan a review.
func Save ¶
func Save(root string, state *ReviewState) error
Save writes state atomically (tmp + rename) under a flock so a concurrently running crit CLI in the same worktree can't interleave.
func SaveSession ¶
func SaveSession(root string, session *CodeReviewSession) error
Types ¶
type CodeReviewSession ¶
type CodeReviewSession struct {
Files []string `yaml:"files"`
DiffBase string `yaml:"diff_base"`
CreatedAt time.Time `yaml:"created_at"`
}
CodeReviewSession tracks which files belong to the current code review. Written for interop: an agent running the crit CLI in the worktree reads the same manifest.
func LoadSession ¶
func LoadSession(root string) (*CodeReviewSession, error)
type Comment ¶
type Comment struct {
ID string `json:"id" yaml:"id"`
Line int `json:"line" yaml:"line"`
EndLine int `json:"end_line,omitempty" yaml:"end_line,omitempty"`
ContentSnippet string `json:"content_snippet" yaml:"content_snippet"`
Body string `json:"body" yaml:"body"`
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
}
type Document ¶
func LoadDocument ¶
type ReviewState ¶
type ReviewState struct {
File string `json:"file" yaml:"file"`
Comments []Comment `json:"comments" yaml:"comments"`
}
func Load ¶
func Load(root, docPath string) (*ReviewState, error)
Load reads the review state for docPath, returning an empty state when none exists yet.
func (*ReviewState) AddComment ¶
func (s *ReviewState) AddComment(c Comment)
func (*ReviewState) DeleteComment ¶
func (s *ReviewState) DeleteComment(id string)