Documentation
¶
Index ¶
- type AnchorHistoryEntry
- type ContextRequest
- type ContextResponse
- type CreateAnchorInput
- type FileLine
- type FileView
- type RelocateInput
- type RelocationCandidate
- type Service
- func (s *Service) AcceptRelocation(ctx context.Context, input RelocateInput) (domain.Anchor, error)
- func (s *Service) CloseAnchor(ctx context.Context, id string) (domain.Anchor, error)
- func (s *Service) Context(ctx context.Context, request ContextRequest) (ContextResponse, error)
- func (s *Service) CreateAnchor(ctx context.Context, input CreateAnchorInput) (domain.Anchor, error)
- func (s *Service) CreateComment(ctx context.Context, anchorID, parentID, author, body string) (domain.Comment, error)
- func (s *Service) FileView(ctx context.Context, repoID, ref, path string) (FileView, error)
- func (s *Service) GetAnchor(ctx context.Context, id string) (domain.Anchor, error)
- func (s *Service) GetRepo(ctx context.Context, id string) (domain.Repo, error)
- func (s *Service) ListAnchorEvents(ctx context.Context, anchorID string) ([]domain.AnchorEvent, error)
- func (s *Service) ListAnchors(ctx context.Context, filter domain.AnchorFilter) ([]domain.Anchor, error)
- func (s *Service) ListComments(ctx context.Context, anchorID string) ([]domain.Comment, error)
- func (s *Service) ListRepos(ctx context.Context) ([]domain.Repo, error)
- func (s *Service) RegisterRepo(ctx context.Context, name, root string) (domain.Repo, error)
- func (s *Service) RelocationCandidates(ctx context.Context, anchorID string) ([]RelocationCandidate, error)
- func (s *Service) RemoveRepo(ctx context.Context, id string) error
- func (s *Service) ReopenAnchor(ctx context.Context, id string) (domain.Anchor, error)
- func (s *Service) ResolveAll(ctx context.Context) error
- func (s *Service) ResolveAnchor(ctx context.Context, id string) (domain.Anchor, error)
- func (s *Service) ResolvePath(ctx context.Context, repoID, ref, path string) ([]domain.Anchor, error)
- func (s *Service) Search(ctx context.Context, query domain.SearchQuery) ([]domain.SearchHit, error)
- func (s *Service) StaleQueue(ctx context.Context, repoID string, limit int) ([]StaleEntry, error)
- func (s *Service) SyncRepo(ctx context.Context, id string) (domain.Repo, error)
- func (s *Service) UpdateAnchor(ctx context.Context, input UpdateAnchorInput) (domain.Anchor, error)
- type StaleEntry
- type Store
- type UpdateAnchorInput
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 ContextResponse ¶
type CreateAnchorInput ¶
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 (*Service) AcceptRelocation ¶
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 (*Service) Context ¶
func (s *Service) Context(ctx context.Context, request ContextRequest) (ContextResponse, error)
func (*Service) CreateAnchor ¶
func (*Service) CreateComment ¶
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 (*Service) ListComments ¶
func (*Service) RegisterRepo ¶
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) ReopenAnchor ¶
func (*Service) ResolveAnchor ¶
func (*Service) ResolvePath ¶
func (*Service) StaleQueue ¶
StaleQueue lists anchors needing attention, most recently affected first, each with its strongest relocation suggestion.
func (*Service) UpdateAnchor ¶
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 Store ¶
type Store interface {
CreateRepo(context.Context, domain.Repo) (domain.Repo, error)
ListRepos(context.Context) ([]domain.Repo, error)
GetRepo(context.Context, string) (domain.Repo, error)
UpdateRepo(context.Context, domain.Repo) (domain.Repo, error)
DeleteRepo(context.Context, string) error
CreateAnchor(context.Context, domain.Anchor) (domain.Anchor, error)
UpdateAnchor(context.Context, domain.Anchor, string) (domain.Anchor, error)
GetAnchor(context.Context, string) (domain.Anchor, error)
ListAnchors(context.Context, domain.AnchorFilter) ([]domain.Anchor, error)
ApplyResolution(context.Context, string, domain.Binding, domain.AnchorStatus, string, float64) (domain.Anchor, error)
ListAnchorEvents(context.Context, string) ([]domain.AnchorEvent, error)
CreateComment(context.Context, domain.Comment) (domain.Comment, error)
ListComments(context.Context, string) ([]domain.Comment, error)
Search(context.Context, domain.SearchQuery) ([]domain.SearchHit, error)
}