threadcontext

package
v0.10.259 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package threadcontext normalizes inline review threads into prompt-safe domain context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeBody

func SanitizeBody(body string) string

SanitizeBody removes closed codereview marker comments and escapes any remaining marker opening so prompt-facing text cannot carry live markers.

Types

type Anchor

type Anchor struct {
	Path        string
	Side        review.DiffSide
	Line        int
	SubjectType review.AnchorKind
	CommitSHA   string
}

Anchor identifies the review-thread location.

type Comment

type Comment struct {
	ID                        gitprovider.CommentID
	ThreadID                  gitprovider.ThreadID
	Body                      string
	Author                    gitprovider.Identity
	Anchor                    Anchor
	URL                       string
	CreatedAt                 time.Time
	UpdatedAt                 time.Time
	AuthoredByPostingIdentity bool
	HasFindingMarker          bool
	HasThreadReplyMarker      bool
	HasThreadSummaryMarker    bool
	// contains filtered or unexported fields
}

Comment is one prompt-safe normalized thread comment.

type Options

type Options struct {
	PostingIdentity gitprovider.Identity
}

Options controls thread normalization.

type Status

type Status struct {
	CRAuthoredFinding       bool
	HasCRSummary            bool
	LatestCRComment         *Comment
	LatestHumanReplyAfterCR *Comment
	PendingHumanReply       bool
}

Status summarizes lifecycle-relevant thread state.

type Thread

type Thread struct {
	ID               gitprovider.ThreadID
	Resolved         bool
	Anchor           Anchor
	Comments         []Comment
	Status           Status
	ResolvedSummary  *ThreadSummary
	CRSettledSummary *ThreadSummary
}

Thread is one normalized inline review thread.

func Normalize

func Normalize(threads []gitprovider.InlineThread, opts Options) ([]Thread, error)

Normalize converts provider inline threads into deterministic prompt-safe domain threads.

func PendingCRAuthoredFindingThreads

func PendingCRAuthoredFindingThreads(threads []Thread) []Thread

PendingCRAuthoredFindingThreads filters to unresolved CR-authored finding threads that have a human reply after the latest CR-authored comment.

func (Thread) EffectiveSettledSummary added in v0.9.191

func (thread Thread) EffectiveSettledSummary() (*ThreadSummary, bool)

EffectiveSettledSummary returns the compact settled context that reviewer prompts should use, preserving provider resolution as the preferred source.

type ThreadSummary

type ThreadSummary struct {
	ThreadID                             gitprovider.ThreadID
	Anchor                               Anchor
	URL                                  string
	Body                                 string
	LastCommentID                        gitprovider.CommentID
	LastCommentAuthor                    gitprovider.Identity
	LastCommentAuthoredByPostingIdentity bool
	LastCommentHasThreadSummaryMarker    bool
}

ThreadSummary is compact reviewer context for a provider-resolved or CR-settled inline thread.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL