diff

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package diff computes minimal deltas between the current enriched AST and a previous snapshot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CursorHash

func CursorHash(roots []*parser.ContextNode) string

func CursorHashFlat

func CursorHashFlat(flat []*parser.ContextNode) string

func SnapshotFromNodes

func SnapshotFromNodes(roots []*parser.ContextNode) map[string]NodeState

Build a NodeState map from enriched nodes.

Types

type Delta

type Delta struct {
	NodeID     string
	OldHash    string
	NewHash    string
	OldContent string
	NewContent string
	Op
}

func Diff

func Diff(roots []*parser.ContextNode, prev map[string]NodeState) []Delta

Compare enriched nodes against the previous snapshot and returns one.

func DiffFlat

func DiffFlat(flat []*parser.ContextNode, prev map[string]NodeState) []Delta

type NodeState

type NodeState struct {
	Hash    string
	Content string
}

Node's hash+content pair from the previous snapshot.

type Op

type Op string
const (
	OpAdd Op = "add"
	OpMod Op = "mod"
	OpRem Op = "rem"
)

Jump to

Keyboard shortcuts

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