skilldiff

package
v0.0.0-...-25a7a33 Latest Latest
Warning

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

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

Documentation

Overview

Package skilldiff represents a proposed SKILL.md edit as a unified diff so a suggestion outlives the exact version it was generated against.

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.New("skill diff conflicts with the current content")

ErrConflict reports that a diff no longer lines up with the content it is replayed onto, which retires the suggestion carrying it.

Functions

func Apply

func Apply(base, diff string) (string, error)

Apply replays diff onto base. Hunks are relocated to wherever their recorded context still appears, so an edit elsewhere in the skill shifts a suggestion rather than invalidating it. A hunk whose context is gone is a conflict, not a silent partial edit.

func Hunks

func Hunks(diff string) []string

Hunks splits diff into one standalone diff per hunk, in the order they appear, so a reviewer can accept part of a suggestion without taking the rest. Each result carries the file headers and replays through Apply on its own; Apply relocates hunks by their context, so the pieces do not have to be applied in order. An empty diff yields no hunks.

func Unified

func Unified(base, proposed string) (string, error)

Unified renders the edit that turns base into proposed. Both sides are normalized to end in a newline, and an unchanged edit renders as the empty diff, which Apply replays as the identity.

Types

This section is empty.

Jump to

Keyboard shortcuts

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