Cherry.Theme.Provenance (cherry v0.2.0)

Copy Markdown View Source

The lineage header written by theme.eject and read back to detect staleness (ADR 0004).

Recording theme name, version, and content hash at eject time is what turns theme upgrades into a mechanical three-way comparison instead of Jekyll's silently frozen copies.

Summary

Functions

Content hash used in headers (lowercase hex SHA-256).

Reads the provenance header from an overlay file, if present.

Prepends a provenance header to ejected template content.

Compares an overlay file against the currently installed theme template: :fresh (ejected from this exact content), :stale (upstream moved), or :untracked (no header — a hand copy).

Removes the provenance header, leaving the template body.

Types

t()

@type t() :: %Cherry.Theme.Provenance{
  sha256: String.t(),
  theme: String.t(),
  version: String.t()
}

Functions

hash(content)

@spec hash(String.t()) :: String.t()

Content hash used in headers (lowercase hex SHA-256).

read(content)

@spec read(String.t()) :: {:ok, t()} | :untracked

Reads the provenance header from an overlay file, if present.

stamp(content, theme_name, theme_version)

@spec stamp(String.t(), String.t(), String.t()) :: String.t()

Prepends a provenance header to ejected template content.

status(overlay_content, current_theme_content)

@spec status(String.t(), String.t()) :: :fresh | :stale | :untracked

Compares an overlay file against the currently installed theme template: :fresh (ejected from this exact content), :stale (upstream moved), or :untracked (no header — a hand copy).

strip(content)

@spec strip(String.t()) :: String.t()

Removes the provenance header, leaving the template body.