app

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnchorHistoryEntry

type AnchorHistoryEntry struct {
	Type       domain.AnchorEventType `json:"type"`
	Reason     string                 `json:"reason"`
	Confidence float64                `json:"confidence"`
	FromRange  string                 `json:"from_range,omitempty"`
	ToRange    string                 `json:"to_range,omitempty"`
	CreatedAt  time.Time              `json:"created_at"`
}

AnchorHistoryEntry is one step of an anchor's life, flattened for display: what happened, why, and where it landed.

type ContextRequest

type ContextRequest struct {
	RepoID string
	Ref    string
	Path   string
	Symbol string
}

type ContextResponse

type ContextResponse struct {
	Repo    domain.Repo     `json:"repo"`
	Anchors []domain.Anchor `json:"anchors"`
}

type CreateAnchorInput

type CreateAnchorInput struct {
	RepoID    string
	Ref       string
	Path      string
	StartLine int
	StartCol  int
	EndLine   int
	EndCol    int
	Kind      string
	Title     string
	Body      string
	Author    string
	Tags      []string
	Symbol    string
}

type FileLine

type FileLine struct {
	Number      int    `json:"number"`
	Text        string `json:"text"`
	Highlighted bool   `json:"highlighted"`
	// Stale marks a line covered by an anchor that lost its place, so the
	// gutter can distinguish "a note lives here" from "a note is lost here".
	Stale bool `json:"stale"`
	// Starts lists anchors beginning on this line, giving the viewer a scroll
	// target for each anchor card.
	Starts []string `json:"starts,omitempty"`
}

type FileView

type FileView struct {
	Repo     domain.Repo                     `json:"repo"`
	Ref      string                          `json:"ref"`
	Path     string                          `json:"path"`
	Content  string                          `json:"content"`
	Lines    []FileLine                      `json:"lines"`
	Diff     string                          `json:"diff"`
	Files    []string                        `json:"files"`
	Anchors  []domain.Anchor                 `json:"anchors"`
	Comments map[string][]domain.Comment     `json:"comments"`
	History  map[string][]AnchorHistoryEntry `json:"history"`
	// Candidates holds relocation suggestions, populated only for stale
	// anchors: computing them costs a parse of the file, and an anchor that
	// resolved cleanly has nothing to triage.
	Candidates map[string][]RelocationCandidate `json:"candidates"`
}

FileView carries JSON tags because it crosses the MCP and HTTP boundaries. Without them it encoded Go field names, so this one tool answered in CamelCase while every other tool answered in snake_case.

type RelocateInput

type RelocateInput struct {
	AnchorID  string
	Candidate *int
	StartLine int
	StartCol  int
	EndLine   int
	EndCol    int
}

RelocateInput selects where an anchor should be re-pinned, either by accepting a ranked candidate or by naming an explicit span.

type RelocationCandidate

type RelocationCandidate struct {
	Index      int     `json:"index"`
	StartLine  int     `json:"start_line"`
	StartCol   int     `json:"start_col"`
	EndLine    int     `json:"end_line"`
	EndCol     int     `json:"end_col"`
	Confidence float64 `json:"confidence"`
	Reason     string  `json:"reason"`
	SymbolPath string  `json:"symbol_path,omitempty"`
	Preview    string  `json:"preview"`
}

RelocationCandidate is a proposed new home for a stale anchor.

type Service

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

func NewService

func NewService(store Store) (*Service, error)

func (*Service) AcceptRelocation

func (s *Service) AcceptRelocation(ctx context.Context, input RelocateInput) (domain.Anchor, error)

AcceptRelocation re-pins an anchor and returns it to active. The new span is re-read from the file rather than trusted from the request, so the stored text and hashes always describe what is really there.

func (*Service) CloseAnchor

func (s *Service) CloseAnchor(ctx context.Context, id string) (domain.Anchor, error)

func (*Service) Context

func (s *Service) Context(ctx context.Context, request ContextRequest) (ContextResponse, error)

func (*Service) CreateAnchor

func (s *Service) CreateAnchor(ctx context.Context, input CreateAnchorInput) (domain.Anchor, error)

func (*Service) CreateComment

func (s *Service) CreateComment(ctx context.Context, anchorID, parentID, author, body string) (domain.Comment, error)

func (*Service) FileView

func (s *Service) FileView(ctx context.Context, repoID, ref, path string) (FileView, error)

func (*Service) GetAnchor

func (s *Service) GetAnchor(ctx context.Context, id string) (domain.Anchor, error)

func (*Service) GetRepo

func (s *Service) GetRepo(ctx context.Context, id string) (domain.Repo, error)

func (*Service) ListAnchorEvents

func (s *Service) ListAnchorEvents(ctx context.Context, anchorID string) ([]domain.AnchorEvent, error)

ListAnchorEvents returns an anchor's move/stale/update history. The store has always recorded these; this exposes them to the surfaces above it.

func (*Service) ListAnchors

func (s *Service) ListAnchors(ctx context.Context, filter domain.AnchorFilter) ([]domain.Anchor, error)

func (*Service) ListComments

func (s *Service) ListComments(ctx context.Context, anchorID string) ([]domain.Comment, error)

func (*Service) ListRepos

func (s *Service) ListRepos(ctx context.Context) ([]domain.Repo, error)

func (*Service) RegisterRepo

func (s *Service) RegisterRepo(ctx context.Context, name, root string) (domain.Repo, error)

func (*Service) RelocationCandidates

func (s *Service) RelocationCandidates(ctx context.Context, anchorID string) ([]RelocationCandidate, error)

RelocationCandidates ranks the places an anchor might now belong.

func (*Service) RemoveRepo

func (s *Service) RemoveRepo(ctx context.Context, id string) error

func (*Service) ReopenAnchor

func (s *Service) ReopenAnchor(ctx context.Context, id string) (domain.Anchor, error)

func (*Service) ResolveAll

func (s *Service) ResolveAll(ctx context.Context) error

func (*Service) ResolveAnchor

func (s *Service) ResolveAnchor(ctx context.Context, id string) (domain.Anchor, error)

func (*Service) ResolvePath

func (s *Service) ResolvePath(ctx context.Context, repoID, ref, path string) ([]domain.Anchor, error)

func (*Service) Search

func (s *Service) Search(ctx context.Context, query domain.SearchQuery) ([]domain.SearchHit, error)

func (*Service) StaleQueue

func (s *Service) StaleQueue(ctx context.Context, repoID string, limit int) ([]StaleEntry, error)

StaleQueue lists anchors needing attention, most recently affected first, each with its strongest relocation suggestion.

func (*Service) SyncRepo

func (s *Service) SyncRepo(ctx context.Context, id string) (domain.Repo, error)

func (*Service) UpdateAnchor

func (s *Service) UpdateAnchor(ctx context.Context, input UpdateAnchorInput) (domain.Anchor, error)

type StaleEntry

type StaleEntry struct {
	Anchor        domain.Anchor        `json:"anchor"`
	StaleReason   string               `json:"stale_reason,omitempty"`
	BestCandidate *RelocationCandidate `json:"best_candidate,omitempty"`
}

StaleEntry is one row of the triage queue: the anchor plus its best guess, so a reviewer can judge without opening each anchor individually.

type UpdateAnchorInput

type UpdateAnchorInput struct {
	ID          string
	Kind        string
	Title       string
	Body        string
	Author      string
	Tags        []string
	ReplaceTags bool
}

Jump to

Keyboard shortcuts

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