Help us shape the future of Go! Take the 2026 Go Developer Survey

attribution

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeSession = "session"
	ModeStaged  = "staged"
	ModeRange   = "range"
	ModePR      = "pr"
)

Variables

View Source
var ErrNoSession = errors.New("no session found for this repository")

Functions

func ClassifyHunk

func ClassifyHunk(tests *testdetect.Detector, fp gitx.FilePatch, lines []gitx.Line) model.ChangeType

func ContentHash

func ContentHash(added []string) string

ContentHash is the Agent Trace range hash: 32-bit MurmurHash3 (seed 0) of the added lines, whitespace-normalized and joined with "\n".

func Contributor

func Contributor(prov []model.HunkProvenance, actorKind map[string]string) string

func GroupDeterministic

func GroupDeterministic(changeID string, hunks []model.Hunk) []model.ReviewUnit

GroupDeterministic groups hunks by change type, then by top-level directory, and orders the units behavior → config/dependency → tests → refactor → docs → generated. It sets ReviewUnitID on every hunk.

func ParseBlame

func ParseBlame(out []byte) map[int]string

ParseBlame maps each final line number to the commit that blame gives it.

func ResolveSession

func ResolveSession(st *store.Store, repoID, id string) (model.Session, error)

ResolveSession finds a session by xis ID, agent session ID or a prefix of either. An empty id means the session of the repository with the latest activity that has a prompt; a session that was opened and closed without one is skipped. A long session that started first can be the latest one.

func UnitID

func UnitID(changeID, key string) string

Types

type Engine

type Engine struct {
	Redact func(string) string
	Cfg    config.Config
	Store  *store.Store
	Repo   snapshot.Repo
	Shadow *snapshot.Shadow
	Tests  *testdetect.Detector
}

func NewEngine

func NewEngine(p config.Paths, cfg config.Config, st *store.Store, repoDir string) (*Engine, error)

func (*Engine) Compute

func (e *Engine) Compute(opts Options) (*Result, error)

Compute builds the change for opts, attributes its hunks and stores it.

type Options

type Options struct {
	Mode      string
	SessionID string
	Range     string
}

type Result

type Result struct {
	Change       model.Change
	Sessions     []model.Session
	Hunks        []model.Hunk
	Provenance   []model.HunkProvenance
	Units        []model.ReviewUnit
	Files        []gitx.FilePatch
	AttribCommit string
	BaseCommit   string
	StepSession  map[string]string
	ActorKind    map[string]string
	LineSteps    map[string]map[int]string
	// RawPatches holds the unredacted hunk patches in memory only, for the secret rule.
	RawPatches map[string]string
}

func (*Result) HunkAt

func (r *Result) HunkAt(file string, line int) (model.Hunk, bool)

func (*Result) ProvenanceOf

func (r *Result) ProvenanceOf(hunkID string) []model.HunkProvenance

Jump to

Keyboard shortcuts

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