gitnotes

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 14 Imported by: 0

Documentation

Overview

Package gitnotes anchors a committed Change Evidence Map to a commit in a Corvint notes ref and reads Git-native provenance beside it: the Git AI `refs/notes/ai` authorship log and the `Assisted-by` / `Agent-Logs-Url` commit trailers (FPK-V0-037..040, decision 0355).

Every row it reports is repository-history: a relation read from commit history, never project authority (AGENTS.md invariant 3). Foreign text is carried only inside a row's bounded `untrusted` member, and no URL it holds is ever fetched (invariant 7). Only Anchor writes, and it writes only the Corvint notes ref.

Index

Constants

View Source
const (
	// Ref is the notes ref Anchor writes and Provenance reads the pointer from.
	Ref = "refs/notes/corvint"
	// ForeignRef is the Git AI authorship-log notes ref, read only.
	ForeignRef = "refs/notes/ai"
	// PointerSchema names the one pointer shape Anchor writes.
	PointerSchema = "corvint-cem-anchor/0"
	// Trust is contextindex.TrustRepositoryHistory: every row here is a
	// relation read from history, never proof and never project authority.
	Trust = "repository-history"
	// Authority is the row label that contextindex.TrustClass derives Trust from.
	Authority = "git-history"

	KindAnchor       = "cem-anchor-note"
	KindAINote       = "git-ai-authorship-note"
	KindAssistedBy   = "assisted-by-trailer"
	KindAgentLogsURL = "agent-logs-url-trailer"

	MaxNoteBytes     = 1 << 20  // one note body
	MaxListBytes     = 4 << 20  // one `git notes list`
	MaxTrailerBytes  = 64 << 10 // one commit's trailer block
	MaxTextBytes     = 256      // one untrusted string
	MaxListedEntries = 64       // untrusted files, agents, or trailers per commit
)

Frozen refs, labels, and bounds.

View Source
const (
	CodeMapUncommitted  = "anchor-map-uncommitted"
	CodeMapDirty        = "anchor-map-dirty"
	CodeBlobUnavailable = "anchor-blob-unavailable"
	CodeNoteConflict    = "anchor-note-conflict"
)

Registered failure codes of the anchor mutation.

Variables

This section is empty.

Functions

func Anchor

func Anchor(ctx context.Context, root, mapPath, commit string) (map[string]any, error)

Anchor records a pointer to the CEM committed at HEAD under mapPath as the Corvint note of commit (FPK-V0-037). It refuses an untracked, dirty, or uncommitted map and a map blob absent from the object database, never replaces a different note, and reads the note back before reporting.

func Provenance

func Provenance(ctx context.Context, root, commit string) (map[string]any, error)

Provenance reads, without writing anything, every Git-native provenance row of one commit (FPK-V0-038, FPK-V0-039): the Corvint anchor note with its digest re-verified, the Git AI authorship note, and the Assisted-by and Agent-Logs-Url trailers. An absent source yields no row.

Types

type Pointer

type Pointer struct {
	Schema    string `json:"schema"`
	CEMCommit string `json:"cem_commit"`
	MapPath   string `json:"map_path"`
	MapBlob   string `json:"map_blob"`
	MapSha256 string `json:"map_sha256"`
	MapSpec   string `json:"map_spec"`
}

Pointer is the one note body Anchor writes: the committed map's blob, its digest, and the commit that holds it.

Jump to

Keyboard shortcuts

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