memorycite

package
v0.39.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package memorycite answers one question about a piece of text: does it cite a specific working-memory file (ADR-0158)? The working-memory convention allows a decision record to name the directory or a placeholder, and bans naming an actual file, so the discrimination is entirely about what follows the prefix.

The prefix lives in a constant rather than inline in each literal because this file is itself scanned material: a source line writing a concrete name right after the prefix would be the very shape the detector flags, and the convention is to keep the shipped surfaces free of it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Categories

func Categories(findings []Finding) ([]presentation.ReportCategory, error)

Categories maps memory-citation scan results into their check-report vocabulary.

func CommitGateDocument

func CommitGateDocument(findings []Reference) (presentation.Document, error)

CommitGateDocument maps commit-message memory citations into the gate's complete ordinary presentation. Scan ownership and finding wording remain here.

func Format

func Format(f Finding) string

Format renders one finding as a diagnostic line.

Types

type Exemption

type Exemption struct {
	Path  string
	Count *int
}

Exemption permits citations in a path, optionally pinning their count.

type File

type File struct {
	Path  string
	Bytes []byte
}

File is one staged file supplied by the command's git snapshot.

type Finding

type Finding struct {
	Path   string
	Lines  []int
	Pinned *int
}

Finding is one path's citations; the count is len(Lines). Pinned is non-nil when an exemption pinned a count that did not match, carrying the pin (which may legitimately be zero); nil when the path was not exempt at all.

func Scan

func Scan(files []File, exemptions []Exemption) []Finding

Scan reports every citation in the supplied files outside the exemptions, grouped by path and sorted by path.

type Reference

type Reference struct {
	Path    string
	Line    int
	Segment string
}

Reference is one citation, with a 1-based line number.

func ScanText

func ScanText(path string, b []byte) []Reference

ScanText reports every citation in b, in line order and left-to-right within a line. Path is used verbatim, so a caller with no file may pass a synthetic label such as the name of the message it is scanning.

Jump to

Keyboard shortcuts

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