annotation

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	File    string // file path relative to repo root
	Line    int    // line number in the diff
	Type    string // change type: "+", "-", or " "
	Comment string // user comment text
}

Annotation represents a user comment on a specific diff line.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store holds annotations in memory, keyed by filename.

func NewStore

func NewStore() *Store

NewStore creates a new empty annotation store.

func (*Store) Add

func (s *Store) Add(a Annotation)

Add adds an annotation for the given file and line. If an annotation already exists at the same file:line, it is replaced.

func (*Store) All

func (s *Store) All() map[string][]Annotation

All returns all annotations grouped by file. The returned map is a copy.

func (*Store) Count

func (s *Store) Count() int

Count returns the total number of annotations across all files.

func (*Store) Delete

func (s *Store) Delete(file string, line int, changeType string) bool

Delete removes the annotation at the given file, line and change type. Returns true if an annotation was found and removed.

func (*Store) Files

func (s *Store) Files() []string

Files returns the list of files that have annotations, sorted alphabetically.

func (*Store) FormatOutput

func (s *Store) FormatOutput() string

FormatOutput produces the structured output format for stdout. Files are sorted alphabetically, annotations within each file by line number. Returns empty string if no annotations exist.

func (*Store) Get

func (s *Store) Get(file string) []Annotation

Get returns all annotations for the given file, sorted by line number.

func (*Store) Has

func (s *Store) Has(file string, line int, changeType string) bool

Has checks if an annotation exists at the given file, line and change type.

Jump to

Keyboard shortcuts

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