Skip to content

Latest commit

 

History

History
85 lines (59 loc) · 2.27 KB

File metadata and controls

85 lines (59 loc) · 2.27 KB

lite-diff

spec: lite-diff v1.0

A simplified text format for describing file changes, inspired by the classic unified diff format.

Specification

📄 Read the full specification → SPEC.md

Overview

lite-diff is designed to be:

  • Predictable — position matching by content, not line numbers
  • Easy to read — minimal syntax, familiar to anyone who knows unified diff
  • Easy to implement — clear rules, well-defined error codes
  • AI-friendly — ideal for LLM-generated patches and code editing tools

Quick Example

--- hello.txt
+++ hello.txt
@@
-Hello, World
+Hello, lite-diff

Key Features

Feature Description
Content-based matching Finds position by context, ignores line numbers
@@ BOF / @@ EOF Insert at file beginning or end
Boundary blocks ... Delete ranges between markers
Global options --ignore-space-change, --apply-all-matches, etc.
File operations Create, delete, rename, copy
Comments Lines starting with # are ignored

File Operations

# Create a new file
--- /dev/null
+++ new-file.txt
@@
+First line
+Second line

# Delete a file
--- old-file.txt
+++ /dev/null

# Rename with modifications
rename from old.txt
rename to new.txt
--- old.txt
+++ new.txt
@@
-old content
+new content

Compatibility

lite-diff accepts standard unified diff headers (diff --git, ---/+++, @@) and extended Git headers. Most patches generated by git diff can be parsed by a lite-diff implementation.

However, lite-diff ignores numeric ranges in hunk headers — it finds positions by matching content, making patches more resilient to minor file changes.

See Interoperability Notes in the specification.

Implementations

License

This specification is published under CC BY 4.0.

You are free to share and adapt it with attribution.

Contributing

Found an issue or have a suggestion? Please open an issue.